Go to the first, previous, next, last section, table of contents.


Existing Tests

These macros test for particular system features that packages might need or want to use. If you need to test for a kind of feature that none of these macros check for, you can probably do it by calling primitive test macros with appropriate arguments (see section Writing Tests).

These tests print messages telling the user which feature they're checking for, and what they find. They cache their results for future configure runs (see section Caching Results).

Some of these macros set output variables. See section Substitutions in Makefiles, for how to get their values. The phrase "define name" is used below as a shorthand to mean "define C preprocessor symbol name to the value 1". See section Defining C Preprocessor Symbols, for how to get those symbol definitions into your program.

Alternative Programs

These macros check for the presence or behavior of particular programs. They are used to choose between several alternative programs and to decide what to do once one has been chosen. If there is no macro specifically defined to check for a program you need, and you don't need to check for any special properties of it, then you can use one of the general program check macros.

Particular Program Checks

These macros check for particular programs--whether they exist, and in some cases whether they support certain features.

Macro: AC_DECL_YYTEXT
Define YYTEXT_POINTER if yytext is a `char *' instead of a `char []'. Also set output variable LEX_OUTPUT_ROOT to the base of the file name that the lexer generates; usually `lex.yy', but sometimes something else. These results vary according to whether lex or flex is being used.

Macro: AC_PROG_AWK
Check for mawk, gawk, nawk, and awk, in that order, and set output variable AWK to the first one that it finds. It tries mawk first because that is reported to be the fastest implementation.

Macro: AC_PROG_CC
Determine a C compiler to use. If CC is not already set in the environment, check for gcc, and use cc if that's not found. Set output variable CC to the name of the compiler found.

If using the GNU C compiler, set shell variable GCC to `yes', empty otherwise. If output variable CFLAGS was not already set, set it to `-g -O2' for the GNU C compiler (`-O2' on systems where GCC does not accept `-g'), or `-g' for other compilers.

If the C compiler being used does not produce executables that can run on the system where configure is being run, set the shell variable cross_compiling to `yes', otherwise `no'. In other words, this tests whether the build system type is different from the host system type (the target system type is irrelevant to this test). See section Manual Configuration, for more on support for cross compiling.

Macro: AC_PROG_CC_C_O
If the C compiler does not accept the `-c' and `-o' options simultaneously, define NO_MINUS_C_MINUS_O.

Macro: AC_PROG_CPP
Set output variable CPP to a command that runs the C preprocessor. If `$CC -E' doesn't work, it uses `/lib/cpp'. It is only portable to run CPP on files with a `.c' extension.

If the current language is C (see section Language Choice), many of the specific test macros use the value of CPP indirectly by calling AC_TRY_CPP, AC_CHECK_HEADER, AC_EGREP_HEADER, or AC_EGREP_CPP.

Macro: AC_PROG_CXX
Determine a C++ compiler to use. Check if the environment variable CXX or CCC (in that order) is set; if so, set output variable CXX to its value. Otherwise search for a C++ compiler under likely names (c++, g++, gcc, CC, cxx, and cc++). If none of those checks succeed, as a last resort set CXX to gcc.

If using the GNU C++ compiler, set shell variable GXX to `yes', empty otherwise. If output variable CXXFLAGS was not already set, set it to `-g -O2' for the GNU C++ compiler (`-O2' on systems where G++ does not accept `-g'), or `-g' for other compilers.

If the C++ compiler being used does not produce executables that can run on the system where configure is being run, set the shell variable cross_compiling to `yes', otherwise `no'. In other words, this tests whether the build system type is different from the host system type (the target system type is irrelevant to this test). See section Manual Configuration, for more on support for cross compiling.

Macro: AC_PROG_CXXCPP
Set output variable CXXCPP to a command that runs the C++ preprocessor. If `$CXX -E' doesn't work, it uses `/lib/cpp'. It is only portable to run CXXCPP on files with a `.c', `.C', or `.cc' extension.

If the current language is C++ (see section Language Choice), many of the specific test macros use the value of CXXCPP indirectly by calling AC_TRY_CPP, AC_CHECK_HEADER, AC_EGREP_HEADER, or AC_EGREP_CPP.

Macro: AC_PROG_F77
Determine a Fortran 77 compiler to use. If F77 is not already set in the environment, check for g77, f77 and f2c, in that order. Set the output variable F77 to the name of the compiler found.

If using g77 (the GNU Fortran 77 compiler), then AC_PROG_F77 will set the shell variable G77 to `yes', and empty otherwise. If the output variable FFLAGS was not already set in the environment, then set it to `-g -02' for g77 (or `-O2' where g77 does not accept `-g'). Otherwise, set FFLAGS to `-g' for all other Fortran 77 compilers.

Macro: AC_PROG_F77_C_O
Test if the Fortran 77 compiler accepts the options `-c' and `-o' simultaneously, and define F77_NO_MINUS_C_MINUS_O if it does not.

Macro: AC_PROG_GCC_TRADITIONAL
Add `-traditional' to output variable CC if using the GNU C compiler and ioctl does not work properly without `-traditional'. That usually happens when the fixed header files have not been installed on an old system. Since recent versions of the GNU C compiler fix the header files automatically when installed, this is becoming a less prevalent problem.

Macro: AC_PROG_INSTALL
Set output variable INSTALL to the path of a BSD compatible install program, if one is found in the current PATH. Otherwise, set INSTALL to `dir/install-sh -c', checking the directories specified to AC_CONFIG_AUX_DIR (or its default directories) to determine dir (see section Creating Output Files). Also set the variables INSTALL_PROGRAM and INSTALL_SCRIPT to `${INSTALL}' and INSTALL_DATA to `${INSTALL} -m 644'.

This macro screens out various instances of install known to not work. It prefers to find a C program rather than a shell script, for speed. Instead of `install-sh', it can also use `install.sh', but that name is obsolete because some make programs have a rule that creates `install' from it if there is no `Makefile'.

A copy of `install-sh' which you may use comes with Autoconf. If you use AC_PROG_INSTALL, you must include either `install-sh' or `install.sh' in your distribution, or configure will produce an error message saying it can't find them--even if the system you're on has a good install program. This check is a safety measure to prevent you from accidentally leaving that file out, which would prevent your package from installing on systems that don't have a BSD-compatible install program.

If you need to use your own installation program because it has features not found in standard install programs, there is no reason to use AC_PROG_INSTALL; just put the pathname of your program into your `Makefile.in' files.

Macro: AC_PROG_LEX
If flex is found, set output variable LEX to `flex' and LEXLIB to `-lfl', if that library is in a standard place. Otherwise set LEX to `lex' and LEXLIB to `-ll'.

Macro: AC_PROG_LN_S
If `ln -s' works on the current filesystem (the operating system and filesystem support symbolic links), set output variable LN_S to `ln -s', otherwise set it to `ln'.

If the link is put in a directory other than the current directory, its meaning depends on whether `ln' or `ln -s' is used. To safely create links using `$(LN_S)', either find out which form is used and adjust the arguments, or always invoke ln in the directory where the link is to be created.

In other words, it does not work to do

$(LN_S) foo /x/bar

Instead, do

(cd /x && $(LN_S) foo bar)

Macro: AC_PROG_RANLIB
Set output variable RANLIB to `ranlib' if ranlib is found, otherwise to `:' (do nothing).

Macro: AC_PROG_YACC
If bison is found, set output variable YACC to `bison -y'. Otherwise, if byacc is found, set YACC to `byacc'. Otherwise set YACC to `yacc'.

Generic Program and File Checks

These macros are used to find programs not covered by the particular test macros. If you need to check the behavior of a program as well as find out whether it is present, you have to write your own test for it (see section Writing Tests). By default, these macros use the environment variable PATH. If you need to check for a program that might not be in the user's PATH, you can pass a modified path to use instead, like this:

AC_PATH_PROG(INETD, inetd, /usr/libexec/inetd,
  $PATH:/usr/libexec:/usr/sbin:/usr/etc:etc)

Macro: AC_CHECK_FILE (file [, action-if-found [, action-if-not-found]])
Check whether file file exists on the native system. If it is found, execute action-if-found, otherwise do action-if-not-found, if given.

Macro: AC_CHECK_FILES (files[, action-if-found [, action-if-not-found]])
Executes AC_CHECK_FILE once for each file listed in files. Additionally, defines `HAVEfile' for each file found, set to 1.

Macro: AC_CHECK_PROG (variable, prog-to-check-for, value-if-found [, value-if-not-found [, path, [ reject ]]])
Check whether program prog-to-check-for exists in PATH. If it is found, set variable to value-if-found, otherwise to value-if-not-found, if given. Always pass over reject (an absolute file name) even if it is the first found in the search path; in that case, set variable using the absolute file name of the prog-to-check-for found that is not reject. If variable was already set, do nothing. Calls AC_SUBST for variable.

Macro: AC_CHECK_PROGS (variable, progs-to-check-for [, value-if-not-found [, path]])
Check for each program in the whitespace-separated list progs-to-check-for exists in PATH. If it is found, set variable to the name of that program. Otherwise, continue checking the next program in the list. If none of the programs in the list are found, set variable to value-if-not-found; if value-if-not-found is not specified, the value of variable is not changed. Calls AC_SUBST for variable.

Macro: AC_CHECK_TOOL (variable, prog-to-check-for [, value-if-not-found [, path]])
Like AC_CHECK_PROG, but first looks for prog-to-check-for with a prefix of the host type as determined by AC_CANONICAL_HOST, followed by a dash (see section Getting the Canonical System Type). For example, if the user runs `configure --host=i386-gnu', then this call:
AC_CHECK_TOOL(RANLIB, ranlib, :)

sets RANLIB to `i386-gnu-ranlib' if that program exists in PATH, or to `ranlib' if that program exists in PATH, or to `:' if neither program exists.

Macro: AC_PATH_PROG (variable, prog-to-check-for [, value-if-not-found [, path]])
Like AC_CHECK_PROG, but set variable to the entire path of prog-to-check-for if found.

Macro: AC_PATH_PROGS (variable, progs-to-check-for [, value-if-not-found [, path]])
Like AC_CHECK_PROGS, but if any of progs-to-check-for are found, set variable to the entire path of the program found.

Library Files

The following macros check for the presence of certain C, C++ or Fortran 77 library archive files.

Macro: AC_CHECK_LIB (library, function [, action-if-found [, action-if-not-found [, other-libraries]]])
Depending on the current language(see section Language Choice), try to ensure that the C, C++ or Fortran 77 function function is available by checking whether a test program can be linked with the library library to get the function. library is the base name of the library; e.g., to check for `-lmp', use `mp' as the library argument.

action-if-found is a list of shell commands to run if the link with the library succeeds; action-if-not-found is a list of shell commands to run if the link fails. If action-if-found is not specified, the default action will add `-llibrary' to LIBS and define `HAVE_LIBlibrary' (in all capitals).

If linking with library results in unresolved symbols, which would be resolved by linking with additional libraries, give those libraries as the other-libraries argument, separated by spaces: `-lXt -lX11'. Otherwise this macro will fail to detect that library is present, because linking the test program will always fail with unresolved symbols.

Macro: AC_HAVE_LIBRARY (library, [, action-if-found [, action-if-not-found [, other-libraries]]])
This macro is equivalent to calling AC_CHECK_LIB with a function argument of main. In addition, library can be written as any of `foo', `-lfoo', or `libfoo.a'. In all of those cases, the compiler is passed `-lfoo'. However, library can not be a shell variable; it must be a literal name. This macro is considered obsolete.

Macro: AC_SEARCH_LIBS (function, search-libs [, action-if-found [, action-if-not-found [, other-libraries]]])
Search for a library defining function, if it's not already available. This equates to calling AC_TRY_LINK_FUNC first with no libraries, then for each library listed in search-libs.

If the function is found, run action-if-found, otherwise run action-if-not-found.

If linking with library results in unresolved symbols, which would be resolved by linking with additional libraries, give those libraries as the other-libraries argument, separated by spaces: `-lXt -lX11'. Otherwise this macro will fail to detect that function is present, because linking the test program will always fail with unresolved symbols.

Macro: AC_SEARCH_LIBS (function, search-libs[, action-if-found [, action-if-not-found]])
This macro is equivalent to calling AC_TRY_LINK_FUNC once for each library listed in search-libs. Add `-llibrary' to LIBS for the first library found to contain function, and execute action-if-found. Otherwise execute action-if-not-found.

Library Functions

The following macros check for particular C library functions. If there is no macro specifically defined to check for a function you need, and you don't need to check for any special properties of it, then you can use one of the general function check macros.

Particular Function Checks

These macros check for particular C functions--whether they exist, and in some cases how they respond when given certain arguments.

Macro: AC_FUNC_ALLOCA
Check how to get alloca. Tries to get a builtin version by checking for `alloca.h' or the predefined C preprocessor macros __GNUC__ and _AIX. If this macro finds `alloca.h', it defines HAVE_ALLOCA_H.

If those attempts fail, it looks for the function in the standard C library. If any of those methods succeed, it defines HAVE_ALLOCA. Otherwise, it sets the output variable ALLOCA to `alloca.o' and defines C_ALLOCA (so programs can periodically call `alloca(0)' to garbage collect). This variable is separate from LIBOBJS so multiple programs can share the value of ALLOCA without needing to create an actual library, in case only some of them use the code in LIBOBJS.

This macro does not try to get alloca from the System V R3 `libPW' or the System V R4 `libucb' because those libraries contain some incompatible functions that cause trouble. Some versions do not even contain alloca or contain a buggy version. If you still want to use their alloca, use ar to extract `alloca.o' from them instead of compiling `alloca.c'.

Source files that use alloca should start with a piece of code like the following, to declare it properly. In some versions of AIX, the declaration of alloca must precede everything else except for comments and preprocessor directives. The #pragma directive is indented so that pre-ANSI C compilers will ignore it, rather than choke on it.

/* AIX requires this to be the first thing in the file.  */
#ifndef __GNUC__
# if HAVE_ALLOCA_H
#  include <alloca.h>
# else
#  ifdef _AIX
 #pragma alloca
#  else
#   ifndef alloca /* predefined by HP cc +Olibcalls */
char *alloca ();
#   endif
#  endif
# endif
#endif

Macro: AC_FUNC_CLOSEDIR_VOID
If the closedir function does not return a meaningful value, define CLOSEDIR_VOID. Otherwise, callers ought to check its return value for an error indicator.

Macro: AC_FUNC_FNMATCH
If the fnmatch function is available and works (unlike the one on SunOS 5.4), define HAVE_FNMATCH.

Macro: AC_FUNC_GETLOADAVG
Check how to get the system load averages. If the system has the getloadavg function, this macro defines HAVE_GETLOADAVG, and adds to LIBS any libraries needed to get that function.

Otherwise, it adds `getloadavg.o' to the output variable LIBOBJS, and possibly defines several other C preprocessor macros and output variables:

  1. It defines SVR4, DGUX, UMAX, or UMAX4_3 if on those systems.
  2. If it finds `nlist.h', it defines NLIST_STRUCT.
  3. If `struct nlist' has an `n_un' member, it defines NLIST_NAME_UNION.
  4. If compiling `getloadavg.c' defines LDAV_PRIVILEGED, programs need to be installed specially on this system for getloadavg to work, and this macro defines GETLOADAVG_PRIVILEGED.
  5. This macro sets the output variable NEED_SETGID. The value is `true' if special installation is required, `false' if not. If NEED_SETGID is `true', this macro sets KMEM_GROUP to the name of the group that should own the installed program.

Macro: AC_FUNC_GETMNTENT
Check for getmntent in the `sun', `seq', and `gen' libraries, for Irix 4, PTX, and Unixware, respectively. Then, if getmntent is available, define HAVE_GETMNTENT.

Macro: AC_FUNC_GETPGRP
If getpgrp takes no argument (the POSIX.1 version), define GETPGRP_VOID. Otherwise, it is the BSD version, which takes a process ID as an argument. This macro does not check whether getpgrp exists at all; if you need to work in that situation, first call AC_CHECK_FUNC for getpgrp.

Macro: AC_FUNC_MEMCMP
If the memcmp function is not available, or does not work on 8-bit data (like the one on SunOS 4.1.3), add `memcmp.o' to output variable LIBOBJS.

Macro: AC_FUNC_MMAP
If the mmap function exists and works correctly, define HAVE_MMAP. Only checks private fixed mapping of already-mapped memory.

Macro: AC_FUNC_SELECT_ARGTYPES
Determines the correct type to be passed to each of the select function's arguments, and defines those types in SELECT_TYPE_ARG1, SELECT_TYPE_ARG234, and SELECT_TYPE_ARG5 respectively. SELECT_TYPE_ARG1 defaults to `int', SELECT_TYPE_ARG234 defaults to `int *', and SELECT_TYPE_ARG5 defaults to `struct timeval *'.

Macro: AC_FUNC_SETPGRP
If setpgrp takes no argument (the POSIX.1 version), define SETPGRP_VOID. Otherwise, it is the BSD version, which takes two process ID as arguments. This macro does not check whether setpgrp exists at all; if you need to work in that situation, first call AC_CHECK_FUNC for setpgrp.

Macro: AC_FUNC_SETVBUF_REVERSED
If setvbuf takes the buffering type as its second argument and the buffer pointer as the third, instead of the other way around, define SETVBUF_REVERSED. This is the case on System V before release 3.

Macro: AC_FUNC_STRCOLL
If the strcoll function exists and works correctly, define HAVE_STRCOLL. This does a bit more than `AC_CHECK_FUNCS(strcoll)', because some systems have incorrect definitions of strcoll, which should not be used.

Macro: AC_FUNC_STRFTIME
Check for strftime in the `intl' library, for SCO UNIX. Then, if strftime is available, define HAVE_STRFTIME.

Macro: AC_FUNC_UTIME_NULL
If `utime(file, NULL)' sets file's timestamp to the present, define HAVE_UTIME_NULL.

Macro: AC_FUNC_VFORK
If `vfork.h' is found, define HAVE_VFORK_H. If a working vfork is not found, define vfork to be fork. This macro checks for several known errors in implementations of vfork and considers the system to not have a working vfork if it detects any of them. It is not considered to be an implementation error if a child's invocation of signal modifies the parent's signal handler, since child processes rarely change their signal handlers.

Macro: AC_FUNC_VPRINTF
If vprintf is found, define HAVE_VPRINTF. Otherwise, if _doprnt is found, define HAVE_DOPRNT. (If vprintf is available, you may assume that vfprintf and vsprintf are also available.)

Macro: AC_FUNC_WAIT3
If wait3 is found and fills in the contents of its third argument (a `struct rusage *'), which HP-UX does not do, define HAVE_WAIT3.

Generic Function Checks

These macros are used to find functions not covered by the particular test macros. If the functions might be in libraries other than the default C library, first call AC_CHECK_LIB for those libraries. If you need to check the behavior of a function as well as find out whether it is present, you have to write your own test for it (see section Writing Tests).

Macro: AC_CHECK_FUNC (function, [action-if-found [, action-if-not-found]])
If C function function is available, run shell commands action-if-found, otherwise action-if-not-found. If you just want to define a symbol if the function is available, consider using AC_CHECK_FUNCS instead. This macro checks for functions with C linkage even when AC_LANG_CPLUSPLUS has been called, since C++ is more standardized than C is. (see section Language Choice, for more information about selecting the language for checks.)

Macro: AC_CHECK_FUNCS (function... [, action-if-found [, action-if-not-found]])
For each given function in the whitespace-separated argument list that is available, define HAVE_function (in all capitals). If action-if-found is given, it is additional shell code to execute when one of the functions is found. You can give it a value of `break' to break out of the loop on the first match. If action-if-not-found is given, it is executed when one of the functions is not found.

Macro: AC_REPLACE_FUNCS (function...)
Like calling AC_CHECK_FUNCS using an action-if-not-found that adds `function.o' to the value of the output variable LIBOBJS. You can declare a function for which your replacement version is used by enclosing the prototype in `#ifndef HAVE_function'. If the system has the function, it probably declares it in a header file you should be including, so you shouldn't redeclare it, lest your declaration conflict.

Header Files

The following macros check for the presence of certain C header files. If there is no macro specifically defined to check for a header file you need, and you don't need to check for any special properties of it, then you can use one of the general header file check macros.

Particular Header Checks

These macros check for particular system header files--whether they exist, and in some cases whether they declare certain symbols.

Macro: AC_DECL_SYS_SIGLIST
Define SYS_SIGLIST_DECLARED if the variable sys_siglist is declared in a system header file, either `signal.h' or `unistd.h'.

Macro: AC_DIR_HEADER
Like calling AC_HEADER_DIRENT and AC_FUNC_CLOSEDIR_VOID, but defines a different set of C preprocessor macros to indicate which header file is found. This macro and the names it defines are considered obsolete. The names it defines are:

`dirent.h'
DIRENT
`sys/ndir.h'
SYSNDIR
`sys/dir.h'
SYSDIR
`ndir.h'
NDIR

In addition, if the closedir function does not return a meaningful value, define VOID_CLOSEDIR.

Macro: AC_HEADER_DIRENT
Check for the following header files, and for the first one that is found and defines `DIR', define the listed C preprocessor macro:

`dirent.h'
HAVE_DIRENT_H
`sys/ndir.h'
HAVE_SYS_NDIR_H
`sys/dir.h'
HAVE_SYS_DIR_H
`ndir.h'
HAVE_NDIR_H

The directory library declarations in the source code should look something like the following:

#if HAVE_DIRENT_H
# include <dirent.h>
# define NAMLEN(dirent) strlen((dirent)->d_name)
#else
# define dirent direct
# define NAMLEN(dirent) (dirent)->d_namlen
# if HAVE_SYS_NDIR_H
#  include <sys/ndir.h>
# endif
# if HAVE_SYS_DIR_H
#  include <sys/dir.h>
# endif
# if HAVE_NDIR_H
#  include <ndir.h>
# endif
#endif

Using the above declarations, the program would declare variables to be type struct dirent, not struct direct, and would access the length of a directory entry name by passing a pointer to a struct dirent to the NAMLEN macro.

This macro also checks for the SCO Xenix `dir' and `x' libraries.

Macro: AC_HEADER_MAJOR
If `sys/types.h' does not define major, minor, and makedev, but `sys/mkdev.h' does, define MAJOR_IN_MKDEV; otherwise, if `sys/sysmacros.h' does, define MAJOR_IN_SYSMACROS.

Macro: AC_HEADER_STDC
Define STDC_HEADERS if the system has ANSI C header files. Specifically, this macro checks for `stdlib.h', `stdarg.h', `string.h', and `float.h'; if the system has those, it probably has the rest of the ANSI C header files. This macro also checks whether `string.h' declares memchr (and thus presumably the other mem functions), whether `stdlib.h' declare free (and thus presumably malloc and other related functions), and whether the `ctype.h' macros work on characters with the high bit set, as ANSI C requires.

Use STDC_HEADERS instead of __STDC__ to determine whether the system has ANSI-compliant header files (and probably C library functions) because many systems that have GCC do not have ANSI C header files.

On systems without ANSI C headers, there is so much variation that it is probably easier to declare the functions you use than to figure out exactly what the system header files declare. Some systems contain a mix of functions ANSI and BSD; some are mostly ANSI but lack `memmove'; some define the BSD functions as macros in `string.h' or `strings.h'; some have only the BSD functions but `string.h'; some declare the memory functions in `memory.h', some in `string.h'; etc. It is probably sufficient to check for one string function and one memory function; if the library has the ANSI versions of those then it probably has most of the others. If you put the following in `configure.in':

AC_HEADER_STDC
AC_CHECK_FUNCS(strchr memcpy)

then, in your code, you can put declarations like this:

#if STDC_HEADERS
# include <string.h>
#else
# ifndef HAVE_STRCHR
#  define strchr index
#  define strrchr rindex
# endif
char *strchr (), *strrchr ();
# ifndef HAVE_MEMCPY
#  define memcpy(d, s, n) bcopy ((s), (d), (n))
#  define memmove(d, s, n) bcopy ((s), (d), (n))
# endif
#endif

If you use a function like memchr, memset, strtok, or strspn, which have no BSD equivalent, then macros won't suffice; you must provide an implementation of each function. An easy way to incorporate your implementations only when needed (since the ones in system C libraries may be hand optimized) is to, taking memchr for example, put it in `memchr.c' and use `AC_REPLACE_FUNCS(memchr)'.

Macro: AC_HEADER_SYS_WAIT
If `sys/wait.h' exists and is compatible with POSIX.1, define HAVE_SYS_WAIT_H. Incompatibility can occur if `sys/wait.h' does not exist, or if it uses the old BSD union wait instead of int to store a status value. If `sys/wait.h' is not POSIX.1 compatible, then instead of including it, define the POSIX.1 macros with their usual interpretations. Here is an example:

#include <sys/types.h>
#if HAVE_SYS_WAIT_H
# include <sys/wait.h>
#endif
#ifndef WEXITSTATUS
# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
#endif
#ifndef WIFEXITED
# define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
#endif

Macro: AC_MEMORY_H
Define NEED_MEMORY_H if memcpy, memcmp, etc. are not declared in `string.h' and `memory.h' exists. This macro is obsolete; instead, use AC_CHECK_HEADERS(memory.h). See the example for AC_HEADER_STDC.

Macro: AC_UNISTD_H
Define HAVE_UNISTD_H if the system has `unistd.h'. This macro is obsolete; instead, use `AC_CHECK_HEADERS(unistd.h)'.

The way to check if the system supports POSIX.1 is:

#if HAVE_UNISTD_H
# include <sys/types.h>
# include <unistd.h>
#endif

#ifdef _POSIX_VERSION
/* Code for POSIX.1 systems.  */
#endif

_POSIX_VERSION is defined when `unistd.h' is included on POSIX.1 systems. If there is no `unistd.h', it is definitely not a POSIX.1 system. However, some non-POSIX.1 systems do have `unistd.h'.

Macro: AC_USG
Define USG if the system does not have `strings.h', rindex, bzero, etc. This implies that it has `string.h', strrchr, memset, etc.

The symbol USG is obsolete. Instead of this macro, see the example for AC_HEADER_STDC.

Generic Header Checks

These macros are used to find system header files not covered by the particular test macros. If you need to check the contents of a header as well as find out whether it is present, you have to write your own test for it (see section Writing Tests).

Macro: AC_CHECK_HEADER (header-file, [action-if-found [, action-if-not-found]])
If the system header file header-file exists, execute shell commands action-if-found, otherwise execute action-if-not-found. If you just want to define a symbol if the header file is available, consider using AC_CHECK_HEADERS instead.

Macro: AC_CHECK_HEADERS (header-file... [, action-if-found [, action-if-not-found]])
For each given system header file header-file in the whitespace-separated argument list that exists, define HAVE_header-file (in all capitals). If action-if-found is given, it is additional shell code to execute when one of the header files is found. You can give it a value of `break' to break out of the loop on the first match. If action-if-not-found is given, it is executed when one of the header files is not found.

Structures

The following macros check for certain structures or structure members. To check structures not listed here, use AC_EGREP_CPP (see section Examining Declarations) or AC_TRY_COMPILE (see section Examining Syntax).

Macro: AC_HEADER_STAT
If the macros S_ISDIR, S_ISREG et al. defined in `sys/stat.h' do not work properly (returning false positives), define STAT_MACROS_BROKEN. This is the case on Tektronix UTekV, Amdahl UTS and Motorola System V/88.

Macro: AC_HEADER_TIME
If a program may include both `time.h' and `sys/time.h', define TIME_WITH_SYS_TIME. On some older systems, `sys/time.h' includes `time.h', but `time.h' is not protected against multiple inclusion, so programs should not explicitly include both files. This macro is useful in programs that use, for example, struct timeval or struct timezone as well as struct tm. It is best used in conjunction with HAVE_SYS_TIME_H, which can be checked for using AC_CHECK_HEADERS(sys/time.h).

#if TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
#else
# if HAVE_SYS_TIME_H
#  include <sys/time.h>
# else
#  include <time.h>
# endif
#endif

Macro: AC_STRUCT_ST_BLKSIZE
If struct stat contains an st_blksize member, define HAVE_ST_BLKSIZE.

Macro: AC_STRUCT_ST_BLOCKS
If struct stat contains an st_blocks member, define HAVE_ST_BLOCKS. Otherwise, add `fileblocks.o' to the output variable LIBOBJS.

Macro: AC_STRUCT_ST_RDEV
If struct stat contains an st_rdev member, define HAVE_ST_RDEV.

Macro: AC_STRUCT_TM
If `time.h' does not define struct tm, define TM_IN_SYS_TIME, which means that including `sys/time.h' had better define struct tm.

Macro: AC_STRUCT_TIMEZONE
Figure out how to get the current timezone. If struct tm has a tm_zone member, define HAVE_TM_ZONE. Otherwise, if the external array tzname is found, define HAVE_TZNAME.

Typedefs

The following macros check for C typedefs. If there is no macro specifically defined to check for a typedef you need, and you don't need to check for any special properties of it, then you can use a general typedef check macro.

Particular Typedef Checks

These macros check for particular C typedefs in `sys/types.h' and `stdlib.h' (if it exists).

Macro: AC_TYPE_GETGROUPS
Define GETGROUPS_T to be whichever of gid_t or int is the base type of the array argument to getgroups.

Macro: AC_TYPE_MODE_T
If mode_t is not defined, define mode_t to be int.

Macro: AC_TYPE_OFF_T
If off_t is not defined, define off_t to be long.

Macro: AC_TYPE_PID_T
If pid_t is not defined, define pid_t to be int.

Macro: AC_TYPE_SIGNAL
If `signal.h' declares signal as returning a pointer to a function returning void, define RETSIGTYPE to be void; otherwise, define it to be int.

Define signal handlers as returning type RETSIGTYPE:

RETSIGTYPE
hup_handler ()
{
...
}

Macro: AC_TYPE_SIZE_T
If size_t is not defined, define size_t to be unsigned.

Macro: AC_TYPE_UID_T
If uid_t is not defined, define uid_t to be int and gid_t to be int.

Generic Typedef Checks

This macro is used to check for typedefs not covered by the particular test macros.

Macro: AC_CHECK_TYPE (type, default)
If the type type is not defined in `sys/types.h', or `stdlib.h' or `stddef.h' if they exist, define it to be the C (or C++) builtin type default; e.g., `short' or `unsigned'.

C Compiler Characteristics

The following macros check for C compiler or machine architecture features. To check for characteristics not listed here, use AC_TRY_COMPILE (see section Examining Syntax) or AC_TRY_RUN (see section Checking Run Time Behavior)

Macro: AC_C_BIGENDIAN
If words are stored with the most significant byte first (like Motorola and SPARC, but not Intel and VAX, CPUs), define WORDS_BIGENDIAN.

Macro: AC_C_CONST
If the C compiler does not fully support the keyword const, define const to be empty. Some C compilers that do not define __STDC__ do support const; some compilers that define __STDC__ do not completely support const. Programs can simply use const as if every C compiler supported it; for those that don't, the `Makefile' or configuration header file will define it as empty.

Macro: AC_C_INLINE
If the C compiler supports the keyword inline, do nothing. Otherwise define inline to __inline__ or __inline if it accepts one of those, otherwise define inline to be empty.

Macro: AC_C_CHAR_UNSIGNED
If the C type char is unsigned, define __CHAR_UNSIGNED__, unless the C compiler predefines it.

Macro: AC_C_LONG_DOUBLE
If the C compiler supports the long double type, define HAVE_LONG_DOUBLE. Some C compilers that do not define __STDC__ do support the long double type; some compilers that define __STDC__ do not support long double.

Macro: AC_C_STRINGIZE
If the C preprocessor supports the stringizing operator, define HAVE_STRINGIZE. The stringizing operator is `#' and is found in macros such as this:

#define x(y) #y

Macro: AC_CHECK_SIZEOF (type [, cross-size])
Define SIZEOF_uctype to be the size in bytes of the C (or C++) builtin type type, e.g. `int' or `char *'. If `type' is unknown to the compiler, it gets a size of 0. uctype is type, with lowercase converted to uppercase, spaces changed to underscores, and asterisks changed to `P'. If cross-compiling, the value cross-size is used if given, otherwise configure exits with an error message.

For example, the call

AC_CHECK_SIZEOF(int *)

defines SIZEOF_INT_P to be 8 on DEC Alpha AXP systems.

Macro: AC_INT_16_BITS
If the C type int is 16 bits wide, define INT_16_BITS. This macro is obsolete; it is more general to use `AC_CHECK_SIZEOF(int)' instead.

Macro: AC_LONG_64_BITS
If the C type long int is 64 bits wide, define LONG_64_BITS. This macro is obsolete; it is more general to use `AC_CHECK_SIZEOF(long)' instead.

Fortran 77 Compiler Characteristics

The following macros check for Fortran 77 compiler characteristics. To check for characteristics not listed here, use AC_TRY_COMPILE (see section Examining Syntax) or AC_TRY_RUN (see section Checking Run Time Behavior), making sure to first set the current lanuage to Fortran 77 AC_LANG_FORTRAN77 (see section Language Choice).

Macro: AC_F77_LIBRARY_LDFLAGS
Determine the linker flags (e.g. `-L' and `-l') for the Fortran 77 intrinsic and run-time libraries that are required to successfully link a Fortran 77 program or shared library. The output variable FLIBS is set to these flags.

This macro is intended to be used in those situations when it is necessary to mix, e.g. C++ and Fortran 77 source code into a single program or shared library (see section `Mixing Fortran 77 With C and C++' in GNU Automake).

For example, if object files from a C++ and Fortran 77 compiler must be linked together, then the C++ compiler/linker must be used for linking (since special C++-ish things need to happen at link time like calling global constructors, instantiating templates, enabling exception support, etc.).

However, the Fortran 77 intrinsic and run-time libraries must be linked in as well, but the C++ compiler/linker doesn't know by default how to add these Fortran 77 libraries. Hence, the macro AC_F77_LIBRARY_LDFLAGS was created to determine these Fortran 77 libraries.

System Services

The following macros check for operating system services or capabilities.

Macro: AC_CYGWIN
Checks for the Cygwin environment. If present, sets shell variable CYGWIN to `yes'. If not present, sets CYGWIN to the empty string.

Macro: AC_EXEEXT
Defines substitute variable EXEEXT based on the output of the compiler, after .c, .o, and .obj files have been excluded. Typically set to empty string if Unix, `.exe' or `.EXE' if Win32.

Macro: AC_OBJEXT
Defines substitute variable OBJEXT based on the output of the compiler, after .c files have been excluded. Typically set to `.o' if Unix, `.obj' if Win32.

Macro: AC_MINGW32
Checks for the MingW32 compiler environment. If present, sets shell variable MINGW32 to `yes'. If not present, sets MINGW32 to the empty string.

Macro: AC_PATH_X
Try to locate the X Window System include files and libraries. If the user gave the command line options `--x-includes=dir' and `--x-libraries=dir', use those directories. If either or both were not given, get the missing values by running xmkmf on a trivial `Imakefile' and examining the `Makefile' that it produces. If that fails (such as if xmkmf is not present), look for them in several directories where they often reside. If either method is successful, set the shell variables x_includes and x_libraries to their locations, unless they are in directories the compiler searches by default.

If both methods fail, or the user gave the command line option `--without-x', set the shell variable no_x to `yes'; otherwise set it to the empty string.

Macro: AC_PATH_XTRA
An enhanced version of AC_PATH_X. It adds the C compiler flags that X needs to output variable X_CFLAGS, and the X linker flags to X_LIBS. If X is not available, adds `-DX_DISPLAY_MISSING' to X_CFLAGS.

This macro also checks for special libraries that some systems need in order to compile X programs. It adds any that the system needs to output variable X_EXTRA_LIBS. And it checks for special X11R6 libraries that need to be linked with before `-lX11', and adds any found to the output variable X_PRE_LIBS.

Macro: AC_SYS_INTERPRETER
Check whether the system supports starting scripts with a line of the form `#! /bin/csh' to select the interpreter to use for the script. After running this macro, shell code in configure.in can check the shell variable interpval; it will be set to `yes' if the system supports `#!', `no' if not.

Macro: AC_SYS_LONG_FILE_NAMES
If the system supports file names longer than 14 characters, define HAVE_LONG_FILE_NAMES.

Macro: AC_SYS_RESTARTABLE_SYSCALLS
If the system automatically restarts a system call that is interrupted by a signal, define HAVE_RESTARTABLE_SYSCALLS.

UNIX Variants

The following macros check for certain operating systems that need special treatment for some programs, due to exceptional oddities in their header files or libraries. These macros are warts; they will be replaced by a more systematic approach, based on the functions they make available or the environments they provide.

Macro: AC_AIX
If on AIX, define _ALL_SOURCE. Allows the use of some BSD functions. Should be called before any macros that run the C compiler.

Macro: AC_DYNIX_SEQ
If on Dynix/PTX (Sequent UNIX), add `-lseq' to output variable LIBS. This macro is obsolete; instead, use AC_FUNC_GETMNTENT.

Macro: AC_IRIX_SUN
If on IRIX (Silicon Graphics UNIX), add `-lsun' to output variable LIBS. This macro is obsolete. If you were using it to get getmntent, use AC_FUNC_GETMNTENT instead. If you used it for the NIS versions of the password and group functions, use `AC_CHECK_LIB(sun, getpwnam)'.

Macro: AC_ISC_POSIX
If on a POSIXized ISC UNIX, define _POSIX_SOURCE and add `-posix' (for the GNU C compiler) or `-Xp' (for other C compilers) to output variable CC. This allows the use of POSIX facilities. Must be called after AC_PROG_CC and before any other macros that run the C compiler.

Macro: AC_MINIX
If on Minix, define _MINIX and _POSIX_SOURCE and define _POSIX_1_SOURCE to be 2. This allows the use of POSIX facilities. Should be called before any macros that run the C compiler.

Macro: AC_SCO_INTL
If on SCO UNIX, add `-lintl' to output variable LIBS. This macro is obsolete; instead, use AC_FUNC_STRFTIME.

Macro: AC_XENIX_DIR
If on Xenix, add `-lx' to output variable LIBS. Also, if `dirent.h' is being used, add `-ldir' to LIBS. This macro is obsolete; use AC_HEADER_DIRENT instead.


Go to the first, previous, next, last section, table of contents.