title: Where to put the language for an AC_DEFUN?
body: <p>I'm using an alternate <a href="https://stackoverflow.com/q/47160617/608639"><code>AC_COMPILE_IFELSE</code></a> as shown below.</p>
  
  <pre><code>BAD_RESULT="fatal|error|unknown|unrecognized|illegal|ignored|not found|not exist|cannot find"
  
  AC_DEFUN([XXX_COMPILE_IFELSE],
     [AC_REQUIRE([AC_PROG_EGREP])
     AC_COMPILE_IFELSE(
        [$1],
        [retval=0
          if $EGREP -i -c -E "$BAD_RESULT" conftest.err &gt;/dev/null; then retval=1; fi
        ],[retval=1]
     )
     AS_IF([test $retval = 0],[$2],[$3])]
  )
  </code></pre>
  
  <p>When I <code>autoreconf</code> to create the <code>configure</code> scipt, the alternate is generating a lot of warnings like:</p>
  
  <pre><code>configure.ac:812: warning: AC_LANG_CONFTEST: no AC_LANG_SOURCE call detected in body
  ../../lib/autoconf/lang.m4:194: AC_LANG_CONFTEST is expanded from...
  ../../lib/autoconf/general.m4:2591: _AC_COMPILE_IFELSE is expanded from...
  ../../lib/autoconf/general.m4:2607: AC_COMPILE_IFELSE is expanded from...
  configure.ac:152: XXX_COMPILE_IFELSE is expanded from...
  configure.ac:812: the top level
  </code></pre>
  
  <p>The Autotools documents (<a href="https://ftp.gnu.org/old-gnu/Manuals/autoconf-2.57/html_chapter/autoconf_6.html" rel="nofollow noreferrer">here</a> and <a href="https://www.gnu.org/software/autoconf/manual/autoconf-2.61/html_node/Macro-Definitions.html" rel="nofollow noreferrer">here</a> and <a href="https://www.gnu.org/software/autoconf/manual/autoconf-2.66/html_node/Running-the-Compiler.html" rel="nofollow noreferrer">here</a>) don't discuss where to put the language. I tried to bookend <code>AC_COMPILE_IFELSE</code> with calls to <code>AC_LANG_PUSH([C++])</code> and <code>AC_LANG_POP</code> but it did not squash the warning.</p>
  
  <p>Where do I tell machinery that the language is C++?</p>
  
  <hr>
  
  <p>Here is an example of using <code>XXX_COMPILE_IFELSE</code>.</p>
  
  <pre><code>XXX_PROGRAM="#include &lt;wmmintrin.h&gt;
    int main(int argc, char* argv[]) {
       __m128i x;
       x=_mm_aesenc_si128(x,x);
       x=_mm_aesenclast_si128(x,x);
       return 0;
    }"
  
  CXXFLAGS="-xarch=aes"
  AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS])
  XXX_COMPILE_IFELSE(
    [$XXX_PROGRAM],
    [AC_MSG_RESULT([yes]); AC_SUBST([tr_RESULT], [1])],
    [AC_MSG_RESULT([no]);  AC_SUBST([tr_RESULT], [0])]
  )
  </code></pre>
  
  <hr>
  
  <p>The head of <code>configure.ac</code> has the following. It seems like it is not being honored since switching to <code>XXX_COMPILE_IFELSE</code>.</p>
  
  <pre><code>AC_INIT([Crypto++], [7.1], ...)
  AM_INIT_AUTOMAKE
  
  AC_CONFIG_MACRO_DIR([m4])
  AC_CONFIG_HEADERS([local.h])
  AC_CONFIG_FILES([Makefile] [libcryptopp.pc])
  AC_CONFIG_SRCDIR([configure.ac])
  
  AM_PROG_AS
  AC_PROG_LIBTOOL
  LT_INIT
  
  AC_PROG_CXX
  AC_LANG([C++])
  AC_PROG_GREP
  
  ## Assert this once to avoid surprises
  AC_LANG_ASSERT([C++])
  </code></pre>