File: autoconf.info, Node: Running the Compiler, Next: Running the Linker, Prev: Running the Preprocessor, Up: Writing Tests 6.4 Running the Compiler ======================== To check for a syntax feature of the current language's (*note Language Choice::) compiler, such as whether it recognizes a certain keyword, or simply to try some library feature, use ‘AC_COMPILE_IFELSE’ to try to compile a small program that uses that feature. -- Macro: AC_COMPILE_IFELSE (INPUT, [ACTION-IF-TRUE], [ACTION-IF-FALSE]) Run the compiler and compilation flags of the current language (*note Language Choice::) on the INPUT, run the shell commands ACTION-IF-TRUE on success, ACTION-IF-FALSE otherwise. If INPUT is nonempty use the equivalent of ‘AC_LANG_CONFTEST(INPUT)’ to generate the current test source file; otherwise reuse the already-existing test source file. The INPUT can be made by ‘AC_LANG_PROGRAM’ and friends. The INPUT text is expanded as an unquoted here-document, so ‘$’, ‘`’ and some ‘\’s should be backslash-escaped. *Note Here-Documents::. It is customary to report unexpected failures with ‘AC_MSG_FAILURE’. This macro does not try to link; use ‘AC_LINK_IFELSE’ if you need to do that (*note Running the Linker::). If needed, ACTION-IF-TRUE can further access the just-compiled object file ‘conftest.$OBJEXT’. This macro uses ‘AC_REQUIRE’ for the compiler associated with the current language, which means that if the compiler has not yet been determined, the compiler determination will be made prior to the body of the outermost ‘AC_DEFUN’ macro that triggered this macro to expand (*note Expanded Before Required::). For tests in Erlang, the INPUT must be the source code of a module named ‘conftest’. ‘AC_COMPILE_IFELSE’ generates a ‘conftest.beam’ file that can be interpreted by the Erlang virtual machine (‘ERL’). It is recommended to use ‘AC_LANG_PROGRAM’ to specify the test program, to ensure that the Erlang module has the right name.