Go to the first, previous, next, last section, table of contents.
To check for a library, a function, or a global variable, Autoconf
configure
scripts try to compile and link a small program that
uses it. This is unlike Metaconfig, which by default uses nm
or ar
on the C library to try to figure out which functions are
available. Trying to link with the function is usually a more reliable
approach because it avoids dealing with the variations in the options
and output formats of nm
and ar
and in the location of the
standard libraries. It also allows configuring for cross-compilation or
checking a function's runtime behavior if needed. On the other hand, it
can be slower than scanning the libraries once.
A few systems have linkers that do not return a failure exit status when
there are unresolved functions in the link. This bug makes the
configuration scripts produced by Autoconf unusable on those systems.
However, some of them can be given options that make the exit status
correct. This is a problem that Autoconf does not currently handle
automatically. If users encounter this problem, they might be able to
solve it by setting LDFLAGS
in the environment to pass whatever
options the linker needs (for example, @option{-Wl,-dn} on @sc{mips
risc/os}).
AC_TRY_LINK
is used to compile test programs to test for
functions and global variables. It is also used by AC_CHECK_LIB
to check for libraries (see section Library Files), by adding the library being
checked for to LIBS
temporarily and trying to link a small
program.
For C and C++, includes is any #include
statements needed
by the code in function-body (includes will be ignored if
the currently selected language is Fortran 77). This macro also uses
CFLAGS
or CXXFLAGS
if either C or C++ is the currently
selected language, as well as CPPFLAGS
, when compiling. If
Fortran 77 is the currently selected language then FFLAGS
will be
used when compiling. However, both LDFLAGS
and LIBS
will
be used during linking in all cases.
If the file compiles and links successfully, run shell commands action-if-found, otherwise run action-if-not-found.
If the file compiles and links successfully, run shell commands action-if-found, otherwise run action-if-not-found.
Go to the first, previous, next, last section, table of contents.