These macros check for particular C functions—whether they exist, and in some cases how they respond when given certain arguments.
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 definesHAVE_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 variableALLOCA
to ‘${LIBOBJDIR}alloca.o’ and definesC_ALLOCA
(so programs can periodically call ‘alloca (0)’ to garbage collect). This variable is separate fromLIBOBJS
so multiple programs can share the value ofALLOCA
without needing to create an actual library, in case only some of them use the code inLIBOBJS
. The ‘${LIBOBJDIR}’ prefix serves the same purpose as inLIBOBJS
(see AC_LIBOBJ vs 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 containalloca
or contain a buggy version. If you still want to use theiralloca
, usear
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.#ifdef HAVE_ALLOCA_H # include <alloca.h> #elif defined __GNUC__ # define alloca __builtin_alloca #elif defined _AIX # define alloca __alloca #elif defined _MSC_VER # include <malloc.h> # define alloca _alloca #else # include <stddef.h> # ifdef __cplusplus extern "C" # endif void *alloca (size_t); #endif
If the
chown
function is available and works (in particular, it should accept -1 foruid
andgid
), defineHAVE_CHOWN
. The result of this macro is cached in theac_cv_func_chown_works
variable.
If the
closedir
function does not return a meaningful value, defineCLOSEDIR_VOID
. Otherwise, callers ought to check its return value for an error indicator.Currently this test is implemented by running a test program. When cross compiling the pessimistic assumption that
closedir
does not return a meaningful value is made.The result of this macro is cached in the
ac_cv_func_closedir_void
variable.This macro is obsolescent, as
closedir
returns a meaningful value on current systems. New programs need not use this macro.
If the
error_at_line
function is not found, require anAC_LIBOBJ
replacement of ‘error’.The result of this macro is cached in the
ac_cv_lib_error_at_line
variable.
If the
fnmatch
function conforms to Posix, defineHAVE_FNMATCH
. Detect common implementation bugs, for example, the bugs in Solaris 2.4.Unlike the other specific
AC_FUNC
macros,AC_FUNC_FNMATCH
does not replace a broken/missingfnmatch
. This is for historical reasons. SeeAC_REPLACE_FNMATCH
below.The result of this macro is cached in the
ac_cv_func_fnmatch_works
variable.This macro is obsolescent. New programs should use Gnulib's
fnmatch-posix
module. See Gnulib.
Behave like
AC_REPLACE_FNMATCH
(replace) but also test whetherfnmatch
supports GNU extensions. Detect common implementation bugs, for example, the bugs in the GNU C Library 2.1.The result of this macro is cached in the
ac_cv_func_fnmatch_gnu
variable.This macro is obsolescent. New programs should use Gnulib's
fnmatch-gnu
module. See Gnulib.
This macro checks for the
fork
andvfork
functions. If a workingfork
is found, defineHAVE_WORKING_FORK
. This macro checks whetherfork
is just a stub by trying to run it.If vfork.h is found, define
HAVE_VFORK_H
. If a workingvfork
is found, defineHAVE_WORKING_VFORK
. Otherwise, definevfork
to befork
for backward compatibility with previous versions of autoconf. This macro checks for several known errors in implementations ofvfork
and considers the system to not have a workingvfork
if it detects any of them. It is not considered to be an implementation error if a child's invocation ofsignal
modifies the parent's signal handler, since child processes rarely change their signal handlers.Since this macro defines
vfork
only for backward compatibility with previous versions of autoconf you're encouraged to define it yourself in new code:#ifndef HAVE_WORKING_VFORK # define vfork fork #endif
If the
fseeko
function is available, defineHAVE_FSEEKO
. Define_LARGEFILE_SOURCE
if necessary to make the prototype visible on some systems (e.g., glibc 2.2). Otherwise linkage problems may occur when compiling withAC_SYS_LARGEFILE
on largefile-sensitive systems whereoff_t
does not default to a 64bit entity. All systems withfseeko
also supplyftello
.
If the
getgroups
function is available and works (unlike on Ultrix 4.3, where ‘getgroups (0, 0)’ always fails), defineHAVE_GETGROUPS
. SetGETGROUPS_LIBS
to any libraries needed to get that function. This macro runsAC_TYPE_GETGROUPS
.
Check how to get the system load averages. To perform its tests properly, this macro needs the file getloadavg.c; therefore, be sure to set the
AC_LIBOBJ
replacement directory properly (see Generic Functions,AC_CONFIG_LIBOBJ_DIR
).If the system has the
getloadavg
function, defineHAVE_GETLOADAVG
, and setGETLOADAVG_LIBS
to any libraries necessary to get that function. Also addGETLOADAVG_LIBS
toLIBS
. Otherwise, require anAC_LIBOBJ
replacement for ‘getloadavg’ with source code in dir/getloadavg.c, and possibly define several other C preprocessor macros and output variables:
- Define
C_GETLOADAVG
.- Define
SVR4
,DGUX
,UMAX
, orUMAX4_3
if on those systems.- If nlist.h is found, define
HAVE_NLIST_H
.- If ‘struct nlist’ has an ‘n_un.n_name’ member, define
HAVE_STRUCT_NLIST_N_UN_N_NAME
. The obsolete symbolNLIST_NAME_UNION
is still defined, but do not depend upon it.- Programs may need to be installed set-group-ID (or set-user-ID) for
getloadavg
to work. In this case, defineGETLOADAVG_PRIVILEGED
, set the output variableNEED_SETGID
to ‘true’ (and otherwise to ‘false’), and setKMEM_GROUP
to the name of the group that should own the installed program.The
AC_FUNC_GETLOADAVG
macro is obsolescent. New programs should use Gnulib'sgetloadavg
module. See Gnulib.
Check for
getmntent
in the standard C library, and then in the sun, seq, and gen libraries, for UNICOS, IRIX 4, PTX, and UnixWare, respectively. Then, ifgetmntent
is available, defineHAVE_GETMNTENT
and setac_cv_func_getmntent
toyes
. Otherwise setac_cv_func_getmntent
tono
.The result of this macro can be overridden by setting the cache variable
ac_cv_search_getmntent
.
Define
GETPGRP_VOID
if it is an error to pass 0 togetpgrp
; this is the Posix behavior. On older BSD systems, you must pass 0 togetpgrp
, as it takes an argument and behaves like Posix'sgetpgid
.#ifdef GETPGRP_VOID pid = getpgrp (); #else pid = getpgrp (0); #endifThis macro does not check whether
getpgrp
exists at all; if you need to work in that situation, first callAC_CHECK_FUNC
forgetpgrp
.The result of this macro is cached in the
ac_cv_func_getpgrp_void
variable.This macro is obsolescent, as current systems have a
getpgrp
whose signature conforms to Posix. New programs need not use this macro.
If link is a symbolic link, then
lstat
should treat link/ the same as link/.. However, many olderlstat
implementations incorrectly ignore trailing slashes.It is safe to assume that if
lstat
incorrectly ignores trailing slashes, then other symbolic-link-aware functions likeunlink
also incorrectly ignore trailing slashes.If
lstat
behaves properly, defineLSTAT_FOLLOWS_SLASHED_SYMLINK
, otherwise require anAC_LIBOBJ
replacement oflstat
.The result of this macro is cached in the
ac_cv_func_lstat_dereferences_slashed_symlink
variable.
If the
malloc
function is compatible with the GNU C librarymalloc
(i.e., ‘malloc (0)’ returns a valid pointer), defineHAVE_MALLOC
to 1. Otherwise defineHAVE_MALLOC
to 0, ask for anAC_LIBOBJ
replacement for ‘malloc’, and definemalloc
torpl_malloc
so that the nativemalloc
is not used in the main project.Typically, the replacement file malloc.c should look like (note the ‘#undef malloc’):
#include <config.h> #undef malloc #include <sys/types.h> void *malloc (); /* Allocate an N-byte block of memory from the heap. If N is zero, allocate a 1-byte block. */ void * rpl_malloc (size_t n) { if (n == 0) n = 1; return malloc (n); }The result of this macro is cached in the
ac_cv_func_malloc_0_nonnull
variable.
Define
HAVE_MBRTOWC
to 1 if the functionmbrtowc
and the typembstate_t
are properly declared.The result of this macro is cached in the
ac_cv_func_mbrtowc
variable.
If the
memcmp
function is not available, or does not work on 8-bit data (like the one on SunOS 4.1.3), or fails when comparing 16 bytes or more and with at least one buffer not starting on a 4-byte boundary (such as the one on NeXT x86 OpenStep), require anAC_LIBOBJ
replacement for ‘memcmp’.The result of this macro is cached in the
ac_cv_func_memcmp_working
variable.This macro is obsolescent, as current systems have a working
memcmp
. New programs need not use this macro.
If the
mktime
function is not available, or does not work correctly, require anAC_LIBOBJ
replacement for ‘mktime’. For the purposes of this test,mktime
should conform to the Posix standard and should be the inverse oflocaltime
.The result of this macro is cached in the
ac_cv_func_working_mktime
variable.
If the
mmap
function exists and works correctly, defineHAVE_MMAP
. This checks only private fixed mapping of already-mapped memory.The result of this macro is cached in the
ac_cv_func_mmap_fixed_mapped
variable.
If the obstacks are found, define
HAVE_OBSTACK
, else require anAC_LIBOBJ
replacement for ‘obstack’.The result of this macro is cached in the
ac_cv_func_obstack
variable.
If the
realloc
function is compatible with the GNU C libraryrealloc
(i.e., ‘realloc (NULL, 0)’ returns a valid pointer), defineHAVE_REALLOC
to 1. Otherwise defineHAVE_REALLOC
to 0, ask for anAC_LIBOBJ
replacement for ‘realloc’, and definerealloc
torpl_realloc
so that the nativerealloc
is not used in the main project. SeeAC_FUNC_MALLOC
for details.The result of this macro is cached in the
ac_cv_func_realloc_0_nonnull
variable.
Determines the correct type to be passed for each of the
select
function's arguments, and defines those types inSELECT_TYPE_ARG1
,SELECT_TYPE_ARG234
, andSELECT_TYPE_ARG5
respectively.SELECT_TYPE_ARG1
defaults to ‘int’,SELECT_TYPE_ARG234
defaults to ‘int *’, andSELECT_TYPE_ARG5
defaults to ‘struct timeval *’.This macro is obsolescent, as current systems have a
select
whose signature conforms to Posix. New programs need not use this macro.
If
setpgrp
takes no argument (the Posix version), defineSETPGRP_VOID
. Otherwise, it is the BSD version, which takes two process IDs as arguments. This macro does not check whethersetpgrp
exists at all; if you need to work in that situation, first callAC_CHECK_FUNC
forsetpgrp
.The result of this macro is cached in the
ac_cv_func_setpgrp_void
variable.This macro is obsolescent, as current systems have a
setpgrp
whose signature conforms to Posix. New programs need not use this macro.
Determine whether
stat
orlstat
have the bug that it succeeds when given the zero-length file name as argument. Thestat
andlstat
from SunOS 4.1.4 and the Hurd (as of 1998-11-01) do this.If it does, then define
HAVE_STAT_EMPTY_STRING_BUG
(orHAVE_LSTAT_EMPTY_STRING_BUG
) and ask for anAC_LIBOBJ
replacement of it.The results of these macros are cached in the
ac_cv_func_stat_empty_string_bug
and theac_cv_func_lstat_empty_string_bug
variables, respectively.These macros are obsolescent, as no current systems have the bug. New programs need not use these macros.
If the
strcoll
function exists and works correctly, defineHAVE_STRCOLL
. This does a bit more than ‘AC_CHECK_FUNCS(strcoll)’, because some systems have incorrect definitions ofstrcoll
that should not be used.The result of this macro is cached in the
ac_cv_func_strcoll_works
variable.
If
strerror_r
is available, defineHAVE_STRERROR_R
, and if it is declared, defineHAVE_DECL_STRERROR_R
. If it returns achar *
message, defineSTRERROR_R_CHAR_P
; otherwise it returns anint
error number. The Thread-Safe Functions option of Posix requiresstrerror_r
to returnint
, but many systems (including, for example, version 2.2.4 of the GNU C Library) return achar *
value that is not necessarily equal to the buffer argument.The result of this macro is cached in the
ac_cv_func_strerror_r_char_p
variable.
Check for
strftime
in the intl library, for SCO Unix. Then, ifstrftime
is available, defineHAVE_STRFTIME
.This macro is obsolescent, as no current systems require the intl library for
strftime
. New programs need not use this macro.
If the
strtod
function does not exist or doesn't work correctly, ask for anAC_LIBOBJ
replacement of ‘strtod’. In this case, because strtod.c is likely to need ‘pow’, set the output variablePOW_LIB
to the extra library needed.This macro caches its result in the
ac_cv_func_strtod
variable and depends upon the result in theac_cv_func_pow
variable.
If the
strtold
function exists and conforms to C99, defineHAVE_STRTOLD
.This macro caches its result in the
ac_cv_func_strtold
variable.
If the
strnlen
function is not available, or is buggy (like the one from AIX 4.3), require anAC_LIBOBJ
replacement for it.This macro caches its result in the
ac_cv_func_strnlen_working
variable.
If ‘utime (file, NULL)’ sets file's timestamp to the present, define
HAVE_UTIME_NULL
.This macro caches its result in the
ac_cv_func_utime_null
variable.This macro is obsolescent, as all current systems have a
utime
that behaves this way. New programs need not use this macro.
If
vprintf
is found, defineHAVE_VPRINTF
. Otherwise, if_doprnt
is found, defineHAVE_DOPRNT
. (Ifvprintf
is available, you may assume thatvfprintf
andvsprintf
are also available.)This macro is obsolescent, as all current systems have
vprintf
. New programs need not use this macro.
If the
fnmatch
function does not conform to Posix (seeAC_FUNC_FNMATCH
), ask for itsAC_LIBOBJ
replacement.The files fnmatch.c, fnmatch_loop.c, and fnmatch_.h in the
AC_LIBOBJ
replacement directory are assumed to contain a copy of the source code of GNUfnmatch
. If necessary, this source code is compiled as anAC_LIBOBJ
replacement, and the fnmatch_.h file is linked to fnmatch.h so that it can be included in place of the system<fnmatch.h>
.This macro caches its result in the
ac_cv_func_fnmatch_works
variable.This macro is obsolescent, as it assumes the use of particular source files. New programs should use Gnulib's
fnmatch-posix
module, which provides this macro along with the source files. See Gnulib.