Previous: , Up: Autoconf 2.13   [Contents][Index]


Since Autoconf 2.50, internal codes uses AC_PREPROC_IFELSE, AC_COMPILE_IFELSE, AC_LINK_IFELSE, and AC_RUN_IFELSE on one hand and AC_LANG_SOURCE, and AC_LANG_PROGRAM on the other hand instead of the deprecated AC_TRY_CPP, AC_TRY_COMPILE, AC_TRY_LINK, and AC_TRY_RUN. The motivations where:

In addition to the change of syntax, the philosophy has changed too: while emphasis was put on speed at the expense of accuracy, today’s Autoconf promotes accuracy of the testing framework at, ahem…, the expense of speed.

As a perfect example of what is not to be done, here is how to find out whether a header file contains a particular declaration, such as a typedef, a structure, a structure member, or a function. Use AC_EGREP_HEADER instead of running grep directly on the header file; on some systems the symbol might be defined in another header file that the file you are checking includes.

As a (bad) example, here is how you should not check for C preprocessor symbols, either defined by header files or predefined by the C preprocessor: using AC_EGREP_CPP:

[#ifdef _AIX
], is_aix=yes, is_aix=no)

The above example, properly written would (i) use AC_LANG_PROGRAM, and (ii) run the compiler:

[[#ifndef _AIX
 error: This isn't AIX!

Previous: , Up: Autoconf 2.13   [Contents][Index]