Next: Running the Linker, Previous: Running the Preprocessor, Up: Writing Tests
To check for a syntax feature of the current language's (see 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.
Run the compiler and compilation flags of the current language (see Language Choice) on the input, run the shell commands action-if-true on success, action-if-false otherwise. The input can be made by
AC_LANG_PROGRAM
and friends.It is customary to report unexpected failures with
AC_MSG_FAILURE
. This macro does not try to link; useAC_LINK_IFELSE
if you need to do that (see Running the Linker).
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.