Go to the previous, next section.

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

@maindex DECL_YYTEXT @cvindex YYTEXT_POINTER @ovindex LEX_OUTPUT_ROOT 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

@maindex PROG_AWK @ovindex 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

@maindex PROG_CC @ovindex CC @ovindex CFLAGS Determine a C compiler to use. If CC is not already set in the environment, check for gcc, and use cc if it'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 -O' for the GNU C compiler (`-O' on systems where GCC does not accept `-g'), or `-g' for other compilers.

Macro: AC_PROG_CC_C_O

@maindex PROG_CC_C_O @cvindex NO_MINUS_C_MINUS_O If the C compiler does not accept the `-c' and `-o' options simultaneously, define NO_MINUS_C_MINUS_O.

Macro: AC_PROG_CPP

@maindex PROG_CPP @ovindex 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

@maindex PROG_CXX @ovindex CXX @ovindex CXXFLAGS 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, and cxx). 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 -O' for the GNU C++ compiler (`-O' on systems where G++ does not accept `-g'), or `-g' for other compilers.

Macro: AC_PROG_CXXCPP

@maindex PROG_CXXCPP @ovindex 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_GCC_TRADITIONAL

@maindex PROG_GCC_TRADITIONAL @ovindex CC 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

@maindex PROG_INSTALL @ovindex INSTALL @ovindex INSTALL_PROGRAM @ovindex INSTALL_DATA 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 variable INSTALL_PROGRAM 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

@maindex PROG_LEX @ovindex LEX @ovindex LEXLIB 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

@maindex PROG_LN_S @ovindex 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'.

Macro: AC_PROG_RANLIB

@maindex PROG_RANLIB @ovindex RANLIB Set output variable RANLIB to `ranlib' if ranlib is found, otherwise to `:' (do nothing).

Macro: AC_PROG_YACC

@maindex PROG_YACC @ovindex 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 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).

Macro: AC_CHECK_PROG (variable, prog-to-check-for, value-if-found [, value-if-not-found])

@maindex CHECK_PROG 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. 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])

@maindex CHECK_PROGS 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_PATH_PROG (variable, prog-to-check-for [, value-if-not-found])

@maindex PATH_PROG 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])

@maindex PATH_PROGS 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 library archive files.

Macro: AC_CHECK_LIB (library, function [, action-if-found [, action-if-not-found [, other-libraries]]])

@maindex CHECK_LIB Try to ensure that C function function is available by checking whether a test C 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 and action-if-not-found are not specified, the default action is to 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: `-lX11 -lXt'. 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]]])

@maindex HAVE_LIBRARY 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.

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

@maindex FUNC_ALLOCA @cvindex C_ALLOCA @cvindex HAVE_ALLOCA_H @ovindex 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.  */
#ifdef __GNUC__
# define alloca __builtin_alloca
#else
# 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

@maindex FUNC_CLOSEDIR_VOID @cvindex 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_GETLOADAVG

@maindex FUNC_GETLOADAVG @cvindex SVR4 @cvindex DGUX @cvindex UMAX @cvindex UMAX4_3 @cvindex NLIST_STRUCT @cvindex NLIST_NAME_UNION @cvindex GETLODAVG_PRIVILEGED @cvindex NEED_SETGID @ovindex LIBOBJS @ovindex NEED_SETGID @ovindex KMEM_GROUP 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

@maindex FUNC_GETMNTENT @cvindex HAVE_GETMNTENT Check for the getmntent in the `sun' and `seq' libraries, for Irix 4 and PTX, respectively. Then, if getmntent is available, define HAVE_GETMNTENT.

Macro: AC_FUNC_MEMCMP

@maindex FUNC_MEMCMP @ovindex LIBOBJS 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

@maindex FUNC_MMAP @cvindex HAVE_MMAP If the mmap function exists and works correctly on memory mapped files, define HAVE_MMAP.

Macro: AC_FUNC_SETVBUF_REVERSED

@maindex FUNC_SETVBUF_REVERSED @cvindex 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

@maindex FUNC_STRCOLL @cvindex HAVE_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

@maindex FUNC_STRFTIME @cvindex HAVE_STRFTIME Check for strftime in the `intl' library, for SCO UNIX. Then, if strftime is available, define HAVE_STRFTIME.

Macro: AC_FUNC_UTIME_NULL

@maindex FUNC_UTIME_NULL @cvindex HAVE_UTIME_NULL If `utime(file, NULL)' sets file's timestamp to the present, define HAVE_UTIME_NULL.

Macro: AC_FUNC_VFORK

@maindex FUNC_VFORK @cvindex HAVE_VFORK_H @cvindex 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.

Macro: AC_FUNC_VPRINTF

@maindex FUNC_VPRINTF @cvindex HAVE_VPRINTF @cvindex HAVE_DOPRNT 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

@maindex FUNC_WAIT3 @cvindex HAVE_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])

@maindex CHECK_FUNC 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]])

@maindex CHECK_FUNCS @cvindex HAVE_function 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-name...)

@maindex REPLACE_FUNCS @ovindex LIBOBJS For each given function-name in the whitespace-separated argument list that is not in the C library, add `function-name.o' to the value of the output variable LIBOBJS.

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

@maindex DECL_SYS_SIGLIST @cvindex SYS_SIGLIST_DECLARED 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

@maindex DIR_HEADER @cvindex DIRENT @cvindex SYSDIR @cvindex SYSNDIR @cvindex NDIR @cvindex VOID_CLOSEDIR 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

@maindex HEADER_DIRENT @cvindex HAVE_DIRENT_H @cvindex HAVE_NDIR_H @cvindex HAVE_SYS_DIR_H @cvindex HAVE_SYS_NDIR_H 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

@maindex HEADER_MAJOR @cvindex MAJOR_IN_MKDEV @cvindex MAJOR_IN_SYSMACROS 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

@maindex HEADER_STDC @cvindex STDC_HEADERS 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

@maindex HEADER_SYS_WAIT @cvindex HAVE_SYS_WAIT_H 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

@maindex MEMORY_H @cvindex NEED_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

@maindex UNISTD_H @cvindex HAVE_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

@cvindex _POSIX_VERSION _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

@maindex USG @cvindex 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])

@maindex CHECK_HEADER 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]])

@maindex CHECK_HEADERS @cvindex HAVE_header 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

@maindex HEADER_STAT @maindex STAT_MACROS_BROKEN 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

@maindex HEADER_TIME @cvindex TIME_WITH_SYS_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

@maindex STRUCT_ST_BLKSIZE @cvindex HAVE_ST_BLKSIZE If struct stat contains an st_blksize member, define HAVE_ST_BLKSIZE.

Macro: AC_STRUCT_ST_BLOCKS

@maindex STRUCT_ST_BLOCKS @cvindex HAVE_ST_BLOCKS @ovindex LIBOBJS 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

@maindex STRUCT_ST_RDEV @cvindex HAVE_ST_RDEV If struct stat contains an st_rdev member, define HAVE_ST_RDEV.

Macro: AC_STRUCT_TM

@maindex STRUCT_TM @cvindex TM_IN_SYS_TIME 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

@maindex STRUCT_TIMEZONE @cvindex HAVE_TM_ZONE @cvindex HAVE_TZNAME 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

@maindex TYPE_GETGROUPS @cvindex GETGROUPS_T 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

@maindex TYPE_MODE_T @cvindex mode_t If mode_t is not defined, define mode_t to be int.

Macro: AC_TYPE_OFF_T

@maindex TYPE_OFF_T @cvindex off_t If off_t is not defined, define off_t to be long.

Macro: AC_TYPE_PID_T

@maindex TYPE_PID_T @cvindex pid_t If pid_t is not defined, define pid_t to be int.

Macro: AC_TYPE_SIGNAL

@maindex TYPE_SIGNAL @cvindex RETSIGTYPE 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

@maindex TYPE_SIZE_T @cvindex size_t If size_t is not defined, define size_t to be unsigned.

Macro: AC_TYPE_UID_T

@maindex TYPE_UID_T @cvindex uid_t @cvindex gid_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)

@maindex CHECK_TYPE If the type type is not defined in `sys/types.h' or `stdlib.h' (if it exists), define it to be the C (or C++) builtin type default; e.g., `short' or `unsigned'.

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

@maindex C_BIGENDIAN @cvindex WORDS_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

@maindex C_CONST @cvindex 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

@maindex C_INLINE @cvindex inline If the C compiler is a version of GCC that supports the keyword __inline but not inline (such as some NeXT versions), define inline to be __inline.

Macro: AC_C_CHAR_UNSIGNED

@maindex C_CHAR_UNSIGNED @cvindex __CHAR_UNSIGNED__ If the C type char is unsigned, define __CHAR_UNSIGNED__, unless the C compiler predefines it.

Macro: AC_C_LONG_DOUBLE

@maindex C_LONG_DOUBLE @cvindex HAVE_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_CHECK_SIZEOF (type)

@maindex CHECK_SIZEOF 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'. 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

@maindex INT_16_BITS @cvindex 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

@maindex LONG_64_BITS @cvindex 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.

System Services

The following macros check for operating system services or capabilities.

Macro: AC_SYS_INTERPRETER

@maindex 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 variable ac_cv_sys_interpreter; it will be set to `yes' if the system supports `#!', `no' if not.

Macro: AC_PATH_X

@maindex 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

@maindex PATH_XTRA @ovindex X_CFLAGS @ovindex X_LIBS @ovindex X_EXTRA_LIBS @ovindex X_PRE_LIBS An enhanced version of AC_PATH_X. Add 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, add `-DX_DISPLAY_MISSING' to X_CFLAGS.

Also check for special libraries that some systems need in order to compile X programs. Add any that the system needs to output variable X_EXTRA_LIBS. And check for special X11R6 libraries that need to be linked with before `-lX11', and add any found to the output variable X_PRE_LIBS.

Macro: AC_SYS_LONG_FILE_NAMES

@maindex SYS_LONG_FILE_NAMES @cvindex HAVE_LONG_FILE_NAMES If the system supports file names longer than 14 characters, define HAVE_LONG_FILE_NAMES.

Macro: AC_SYS_RESTARTABLE_SYSCALLS

@maindex SYS_RESTARTABLE_SYSCALLS @cvindex HAVE_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

@maindex AIX @cvindex _ALL_SOURCE 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

@maindex 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

@maindex 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

@maindex ISC_POSIX @cvindex _POSIX_SOURCE @ovindex CC 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

@maindex MINIX @cvindex _MINIX @cvindex _POSIX_SOURCE @cvindex _POSIX_1_SOURCE 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

@maindex SCO_INTL @ovindex LIBS If on SCO UNIX, add `-lintl' to output variable LIBS. This macro is obsolete; instead, use AC_FUNC_STRFTIME.

Macro: AC_XENIX_DIR

@maindex XENIX_DIR @ovindex LIBS 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 previous, next section.