autoconf.sh autoconf.texi install.texi \
autoheader.sh autoreconf.sh autoscan.pl autoupdate.sh ifnames.sh \
config.guess config.sub configure configure.in \
- install.sh mkinstalldirs texinfo.tex \
+ install-sh mkinstalldirs texinfo.tex \
testsuite/Makefile.in testsuite/config/*.exp \
testsuite/lib/*.exp testsuite/autoconf.[gs]/*.exp \
standards.texi make-stds.texi standards.info*
* AC_OUTPUT automatically substitutes the values of CFLAGS, CXXFLAGS,
CPPFLAGS, and LDFLAGS from the environment.
* AC_PROG_CC and AC_PROG_CXX now set CFLAGS and CXXFLAGS, respectively.
-* AC_PROG_INSTALL looks for install.sh in the directory specified by
- AC_CONFIG_AUXDIR, or srcdir or srcdir/.. or srcdir/../.. by default.
+* AC_PROG_INSTALL looks for install-sh or install.sh in the directory
+ specified by AC_CONFIG_AUXDIR, or srcdir or srcdir/.. or
+ srcdir/../.. by default.
* AC_DEFINE, AC_DEFINE_UNQUOTED, and AC_SUBST are more robust and smaller.
* AC_DEFINE no longer prints anything, because of the new result reporting
mechanism (AC_MSG_CHECKING and AC_MSG_RESULT).
divert(-1)dnl Throw away output until AC_INIT is called.
changequote([, ])
-define(AC_ACVERSION, 1.115)
+define(AC_ACVERSION, 1.116)
dnl Some old m4's don't support m4exit. But they provide
dnl equivalent functionality by core dumping because of the
dnl AC_INIT_PARSE_ARGS()
AC_DEFUN(AC_INIT_PARSE_ARGS,
-[# Save the original args to write them into config.status later.
-configure_args="[$]@"
-
+[
# Omit some internal or obsolete options to make the list less imposing.
changequote(, )dnl
ac_usage="Usage: configure [options] [host]
running configure, to aid debugging if configure makes a mistake.
" 1>&AC_FD_CC
-ac_configure_temp="$configure_args"
# Strip out --no-create and --no-recursion so they do not pile up.
# Also quote any args containing spaces.
-configure_args=
-for ac_arg in $ac_configure_temp; do
+ac_configure_args=
+for ac_arg
+do
case "$ac_arg" in
-no-create | --no-create | --no-creat | --no-crea | --no-cre \
| --no-cr | --no-c) ;;
-no-recursion | --no-recursion | --no-recursio | --no-recursi \
| --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
changequote(, )dnl
- *[" "]*) configure_args="$configure_args '$ac_arg'" ;;
+ *[" "]*) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
changequote([, ])dnl
- *) configure_args="$configure_args $ac_arg" ;;
+ *) ac_configure_args="$ac_configure_args $ac_arg" ;;
esac
done
dnl ### Canonicalizing the system type
-dnl Find install.sh, config.sub, config.guess, and Cygnus configure
+dnl Find install-sh, config.sub, config.guess, and Cygnus configure
dnl in directory DIR. These are auxiliary files used in configuration.
dnl DIR can be either absolute or relative to ${srcdir}.
dnl AC_CONFIG_AUX_DIR(DIR)
dnl Internal subroutine.
dnl Search for the configuration auxiliary files in directory list $1.
-dnl We look only for install.sh, so users of AC_PROG_INSTALL
+dnl We look only for install-sh, so users of AC_PROG_INSTALL
dnl do not automatically need to distribute the other auxiliary files.
dnl AC_CONFIG_AUX_DIRS(DIR ...)
AC_DEFUN(AC_CONFIG_AUX_DIRS,
[ac_aux_dir=
for ac_dir in $1; do
- if test -f $ac_dir/install.sh; then
- ac_aux_dir=$ac_dir; break
+ if test -f $ac_dir/install-sh; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="${ac_aux_dir}/install-sh -c"
+ break
+ elif test -f $ac_dir/install.sh; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="${ac_aux_dir}/install.sh -c"
+ break
fi
done
if test -z "$ac_aux_dir"; then
- AC_MSG_ERROR([can not find install.sh in $1])
+ AC_MSG_ERROR([can not find install-sh or install.sh in $1])
fi
ac_config_guess=${ac_aux_dir}/config.guess
ac_config_sub=${ac_aux_dir}/config.sub
ac_configure=${ac_aux_dir}/configure # This should be Cygnus configure.
-ac_install_sh="${ac_aux_dir}/install.sh -c"
AC_PROVIDE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
])
dnl so uname gets run too.
# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
#
-[#] [$]0 [$]configure_args
+[#] [$]0 [$]ac_configure_args
#
# Compiler output produced by configure, useful for debugging
# configure, is in ./config.log if it exists.
do
case "[\$]ac_option" in
-recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
- echo running [\$]{CONFIG_SHELL-/bin/sh} [$]0 [$]configure_args --no-create --no-recursion
- exec [\$]{CONFIG_SHELL-/bin/sh} [$]0 [$]configure_args --no-create --no-recursion ;;
+ echo "running [\$]{CONFIG_SHELL-/bin/sh} [$]0 [$]ac_configure_args --no-create --no-recursion"
+ exec [\$]{CONFIG_SHELL-/bin/sh} [$]0 [$]ac_configure_args --no-create --no-recursion ;;
-version | --version | --versio | --versi | --vers | --ver | --ve | --v)
echo "${CONFIG_STATUS} generated by autoconf version AC_ACVERSION"
exit 0 ;;
# Remove --cache-file and --srcdir arguments so they do not pile up.
ac_sub_configure_args=
ac_prev=
- for ac_arg in $configure_args; do
+ for ac_arg in $ac_configure_args; do
if test -n "$ac_prev"; then
ac_prev=
continue
esac
echo "[running ${CONFIG_SHELL-/bin/sh} ${ac_sub_configure} ${ac_sub_configure_args} --cache-file=$ac_sub_cache_file] --srcdir=${ac_sub_srcdir}"
- if ${CONFIG_SHELL-/bin/sh} ${ac_sub_configure} ${ac_sub_configure_args} --cache-file=$ac_sub_cache_file --srcdir=${ac_sub_srcdir}
+ # The eval makes quoting arguments work.
+ if eval ${CONFIG_SHELL-/bin/sh} ${ac_sub_configure} ${ac_sub_configure_args} --cache-file=$ac_sub_cache_file --srcdir=${ac_sub_srcdir}
then :
else
AC_MSG_ERROR(${ac_sub_configure} failed for ${ac_config_dir})
])
AC_DEFUN(AC_FUNC_GETMNTENT,
-[# getmntent is in -lsun on Irix 4, -lseq on PTX.
-AC_CHECK_LIB(sun, getmntent, LIBS="$LIBS -lsun")
-AC_CHECK_LIB(seq, getmntent, LIBS="$LIBS -lseq")
+[# getmntent is in -lsun on Irix 4, -lseq on Dynix/PTX.
+AC_CHECK_LIB(sun, getmntent, LIBS="$LIBS -lsun",
+ [AC_CHECK_LIB(seq, getmntent, LIBS="$LIBS -lseq")])
AC_CHECK_FUNC(getmntent, [AC_DEFINE(HAVE_GETMNTENT)])])
AC_DEFUN(AC_FUNC_STRFTIME,
@c @setchapternewpage odd
@c %**end of header
-@set EDITION 1.115
-@set VERSION 1.115
+@set EDITION 1.116
+@set VERSION 1.116
@set UPDATED September 1994
@iftex
* Invoking autoconf:: How to create configuration scripts.
* Invoking autoreconf:: Remaking multiple @code{configure} scripts.
-Initialization and Output
+Initialization and Output Files
* Input:: Where Autoconf should find files.
* Output:: Creating output files.
* Subdirectories:: Configuring independent packages together.
* Versions:: Version numbers in @code{configure}.
-Makefiles
+Substitutions in Makefiles
-* Predefined Variables:: Output variables that are always set.
+* Preset Variables:: Output variables that are always set.
* Object Directories:: Compiling in a different directory.
* Automatic Remaking:: Makefile rules for configuring.
Writing Tests
-* Checking for Symbols:: Finding whether a symbol is defined.
+* Checking Declarations:: Detecting header files and declarations.
+* Checking Libraries:: Detecting functions and global variables.
* Run Time:: Testing for run-time features.
* Portable Shell:: Shell script portability pitfalls.
* Testing Values and Files:: Checking strings and files.
Checking Run Time Behavior
-* Alternatives:: Approaches preferred over test programs.
+* Test Programs:: Running test programs.
* Guidelines:: General rules for writing test programs.
* Test Functions:: Avoiding pitfalls in test programs.
@item
optionally, a C header file, the name of which is configurable,
-containing @code{#define} directives (@pxref{Output});
+containing @code{#define} directives (@pxref{Configuration Headers});
@item
a shell script called @file{config.status} that, when run, will recreate
@item
a shell script called @file{config.cache} that saves the results of
-running many of the tests;
+running many of the tests (@pxref{Cache Files});
@item
a file called @file{config.log} containing any messages produced by
If you write your own feature tests to supplement those that come with
Autoconf, you might also write files called @file{aclocal.m4} and
@file{acsite.m4}. If you use a C header file to contain @code{#define}
-directives, you might also write @file{acconfig.h}, @file{config.h.top},
-and @file{config.h.bot}, and you will distribute the Autoconf-generated
-file @file{config.h.in} with the package.
+directives, you might also write @file{acconfig.h}, and you will
+distribute the Autoconf-generated file @file{config.h.in} with the
+package.
Here is a diagram showing how the files that can be used in
configuration are produced. Programs that are executed are suffixed by
When calling macros that take arguments, there must not be any blank
space between the macro name and the open parenthesis. Arguments can be
more than one line long if they are enclosed within the @code{m4} quote
-characters @samp{[} and @samp{]}. Several macros handle two cases: what
+characters @samp{[} and @samp{]}. Some macros handle two cases: what
to do if the given condition is met, and what to do if the condition is
not met. In some places you might want to do something if a
condition is true but do nothing if it's false, or vice versa. To omit
You should manually examine @file{configure.scan} before renaming it to
@file{configure.in}; it will probably need some adjustments. For
example, if you want the package to use a configuration header file, you
-will have to add a call to @code{AC_CONFIG_HEADER} (@pxref{Output}).
-You might also have to change or add some @code{#if} directives to your
-program in order to make it work with Autoconf (@pxref{Invoking
-ifnames}, for information about a program that can help with that job).
+will have to add a call to @code{AC_CONFIG_HEADER} (@pxref{Configuration
+Headers}). You might also have to change or add some @code{#if}
+directives to your program in order to make it work with Autoconf
+(@pxref{Invoking ifnames}, for information about a program that can help
+with that job).
@code{autoscan} uses several data files, which are installed along with the
distributed Autoconf macro files, to determine which macros to output
Print a summary of the command line options and exit.
@item --macrodir=@var{dir}
+@evindex AC_MACRODIR
Look for the data files in directory @var{dir} instead of the default
-installation directory.
+installation directory. You can also set the @code{AC_MACRODIR}
+environment variable to a directory; this option overrides the
+environment variable.
@item --verbose
Print the names of the files it examines and the potentially interesting
symbols it finds in them. This output can be voluminous.
@item --version
-Print the version number of @code{autoscan} and exit.
+Print the version number of Autoconf and exit.
@end table
@node Invoking ifnames, Invoking autoconf, Invoking autoscan, Making configure Scripts
Print a summary of the command line options and exit.
@item --macrodir=@var{dir}
+@evindex AC_MACRODIR
Look for the Autoconf macro files in directory @var{dir} instead of the
default installation directory. Only used to get the version number.
+You can also set the @code{AC_MACRODIR}
+environment variable to a directory; this option overrides the
+environment variable.
@item --version
-Print the version number of @code{ifnames} and exit.
+Print the version number of Autoconf and exit.
@end table
@node Invoking autoconf, Invoking autoreconf, Invoking ifnames, Making configure Scripts
in more than one of the files that @code{autoconf} reads, the last
definition it reads overrides the earlier ones.
+@code{autoconf} accepts the following options:
+
+@table @code
+@item --help
+Print a summary of the command line options and exit.
+
+@item --macrodir=@var{dir}
@evindex AC_MACRODIR
-You can override the directory where @code{autoconf} looks for the
-installed macro files by setting the @code{AC_MACRODIR} environment
-variable to a different directory. You can also give @code{autoconf}
-the @samp{--macrodir=@var{dir}} option, which overrides @code{AC_MACRODIR}.
+Look for the installed macro files in directory @var{dir}. You can also
+set the @code{AC_MACRODIR} environment variable to a directory; this
+option overrides the environment variable.
-@code{autoconf} also accepts the options @code{--version}, which prints
-the Autoconf version number and exits, and @code{--help}, which prints a
-summary of the command-line options and exits.
+@item --version
+Print the version number of Autoconf and exit.
+@end table
@node Invoking autoreconf, , Invoking autoconf, Making configure Scripts
@section Using @code{autoreconf} to Update @file{configure} Scripts
@item --macrodir=@var{dir}
@itemx -m @var{dir}
+@evindex AC_MACRODIR
Look for the Autoconf macro files in directory @var{dir} instead of the
default installation directory.
+You can also set the @code{AC_MACRODIR}
+environment variable to a directory; this option overrides the
+environment variable.
@item --verbose
Print the name of each directory where @code{autoreconf} runs
@file{configure.in} calls @code{AC_CONFIG_HEADER}).
@item --version
-Print the version number of @code{autoreconf} and exit.
+Print the version number of Autoconf and exit.
@end table
@node Setup, Existing Tests, Making configure Scripts, Top
-@chapter Initialization and Output
+@chapter Initialization and Output Files
Autoconf-generated @code{configure} scripts need some information about
how to initialize, such as how to find the package's source files; and
@end menu
@node Input, Output, , Setup
-@section Finding Autoconf Input
+@section Finding @code{configure} Input
Every @code{configure} script must call @code{AC_INIT} before doing
anything else. The only other required macro is @code{AC_OUTPUT}
-(@pxref{Output}). Packages that do manual configuration or use the
-@code{install} program might need to tell @code{configure} where to find
-some other shell scripts by calling @code{AC_CONFIG_AUX_DIR}, though the
-default places it looks are correct for most cases.
+(@pxref{Output}).
@defmac AC_INIT (@var{unique-file-in-source-dir})
@maindex INIT
fact does (@pxref{Invoking configure}, for more information).
@end defmac
+Packages that do manual configuration or use the @code{install} program
+might need to tell @code{configure} where to find some other shell
+scripts by calling @code{AC_CONFIG_AUX_DIR}, though the default places
+it looks are correct for most cases.
+
@defmac AC_CONFIG_AUX_DIR(@var{dir})
@maindex CONFIG_AUX_DIR
-Use the @file{install.sh}, @file{config.sub}, @file{config.guess}, and
+Use the @file{install-sh}, @file{config.sub}, @file{config.guess}, and
Cygnus @file{configure} scripts that are in directory @var{dir}. These
are auxiliary files used in configuration. @var{dir} can be either
absolute or relative to @file{@var{srcdir}}. The default is
@file{@var{srcdir}} or @file{@var{srcdir}/..} or
@file{@var{srcdir}/../..}, whichever is the first that contains
-@file{install.sh}. The other files are not checked for, so that using
+@file{install-sh}. The other files are not checked for, so that using
@code{AC_PROG_INSTALL} does not automatically require distributing the
-other auxiliary files.
+other auxiliary files. It checks for @file{install.sh} also, but that
+name is obsolete because some @code{make} programs have a rule that
+creates @file{install} from it if there is no @file{Makefile}.
@end defmac
@node Output, Makefiles, Input, Setup
Create output files. The @var{file}@dots{} argument is a
whitespace-separated list of files to create; it may be empty. This
macro creates each file @file{@var{file}} by copying an input file (by
-default named @file{@var{file}.in}), substituting the variable values
-that have been selected by calling @code{AC_SUBST}. It creates the
-directory that the file is in if it doesn't exist (but not the parents
-of that directory).
+default named @file{@var{file}.in}), substituting the output variable
+values that have been selected by calling @code{AC_SUBST}
+(@pxref{Setting Variables}). It creates the directory that the file is
+in if it doesn't exist (but not the parents of that directory).
If @code{AC_CONFIG_HEADER} has been called, this macro also creates the
header file that was named as its argument (@pxref{Configuration Headers}).
@end defmac
@node Makefiles, Configuration Headers, Output, Setup
-@section Makefiles
+@section Substitutions in Makefiles
Each subdirectory in a distribution that contains something to be
compiled or installed should come with a file @file{Makefile.in}, from
@xref{Makefile Conventions, , Makefile Conventions, standards.info, The
GNU Coding Standards}, for more information on what to put in Makefiles.
+A software package that uses a @code{configure} script should be
+distributed with a file @file{Makefile.in}, but no @file{Makefile}; that
+way, the user has to properly configure the package for the local system
+before compiling it.
+
@menu
-* Predefined Variables:: Output variables that are always set.
+* Preset Variables:: Output variables that are always set.
* Object Directories:: Compiling in a different directory.
* Automatic Remaking:: Makefile rules for configuring.
@end menu
-@node Predefined Variables, Object Directories, , Makefiles
-@subsection Predefined Variables
+@node Preset Variables, Object Directories, , Makefiles
+@subsection Preset Output Variables
-Some output variables are predefined by the Autoconf macros.
+Some output variables are preset by the Autoconf macros.
@code{AC_SUBST} is called for them automatically (@pxref{Setting
Variables}), so in your @file{Makefile.in} files you can get their
values by enclosing their names in @samp{@@} characters.
@xref{Makefiles}, for more information on @samp{@@} substitutions.
@end ifinfo
The variables that are automatically defined by the Autoconf macros are
-listed here. Some of the Autoconf macros define additional variables,
+listed here. Some of the Autoconf macros set additional output variables,
which are mentioned in the descriptions for those macros. @xref{Output
Variable Index}, for a complete list of output variables.
@samp{-l} and @samp{-L} options to pass to the linker.
@end defvar
-@node Object Directories, Automatic Remaking, Predefined Variables, Makefiles
+@node Object Directories, Automatic Remaking, Preset Variables, Makefiles
@subsection Object Directories
You might want to compile a software package in a different directory
recompilation. You should include the file @file{stamp-h.in} your
package's distribution, so @code{make} will consider @file{config.h.in}
up to date. On some old BSD systems, @code{touch} does not update the
-timestamps on empty files, so use @code{echo} as a workaround.
+timestamps on empty files, so use @code{echo} or an empty command as a
+workaround.
@example
@group
some operating systems. As an alternative to passing @samp{-D} options
to the compiler, @code{configure} scripts can create a C header file
containing @samp{#define} directives. The @code{AC_CONFIG_HEADER} macro
-selects this kind of output.
+selects this kind of output. It should be called right after @code{AC_INIT}.
-If using a configuration header file, the program should include it
-before any other header files, to prevent inconsistencies in
-declarations.
+The package should @samp{#include} the configuration header file before
+any other header files, to prevent inconsistencies in declarations.
@defmac AC_CONFIG_HEADER (@var{header-to-create} @dots{})
@maindex CONFIG_HEADER
Your distribution should contain a template file that looks as you want
the final header file to look, including comments, with default values
-in the @code{#define} statements. A default value can be to
-@code{#undef} the variable instead of to define it to a value, if your
-code tests for configuration options using @code{#ifdef} instead of
-@code{#if}. For example, suppose your @file{configure.in} makes these
-calls:
+in the @code{#define} statements. For example, suppose your
+@file{configure.in} makes these calls:
@example
AC_CONFIG_HEADER(conf.h)
@end group
@end example
-Alternately, if you prefer to use @code{#ifdef}, your @file{conf.h.in}
-could have code like the following. On systems that have
-@file{unistd.h}, @code{configure} will change the second line to read
-@samp{#define HAVE_UNISTD_H 1}. On other systems, it will comment that
-line out (in case the system predefines that symbol).
+Alternately, if your code tests for configuration options using
+@code{#ifdef} instead of @code{#if}, a default value can be to
+@code{#undef} the variable instead of to define it to a value. On
+systems that have @file{unistd.h}, @code{configure} will change the
+second line to read @samp{#define HAVE_UNISTD_H 1}. On other systems,
+it will comment that line out (in case the system predefines that
+symbol).
@example
@group
@end example
@node Invoking autoheader, , Header Templates, Configuration Headers
-@section Using @code{autoheader} to Create @file{config.h.in}
+@subsection Using @code{autoheader} to Create @file{config.h.in}
The @code{autoheader} program can create a template file of C
@samp{#define} statements for @code{configure} to use. If
@code{autoheader} creates @file{@var{file}.in}. Otherwise,
@code{autoheader} creates @file{config.h.in}.
+If you give @code{autoheader} an argument, it uses that file instead of
+@file{configure.in} and writes the header file to the standard output
+instead of to @file{config.h.in}. If you give @code{autoheader} an
+argument of @samp{-}, it reads the standard input instead of
+@file{configure.in} and writes the header file to the standard output.
+
@code{autoheader} scans @file{configure.in} and figures out which C
preprocessor symbols it might define. It copies comments and
@code{#define} and @code{#undef} statements from a file called
@code{autoheader} copies them to the beginning and end, respectively, of
its output. Their use is discouraged because they have file names that
contain two periods, and so can not be stored on MS-DOS; also, they are
-two more files to clutter up the directory (@pxref{Output}, for more
-information about avoiding file names that MS-DOS cannot store).
+two more files to clutter up the directory.
-If you give @code{autoheader} an argument, it uses that file instead of
-@file{configure.in} and writes the header file to the standard output
-instead of to @file{config.h.in}. If you give @code{autoheader} an
-argument of @samp{-}, it reads the standard input instead of
-@file{configure.in} and writes the header file to the standard output.
+@code{autoheader} accepts the following options:
+
+@table @code
+@item --help
+Print a summary of the command line options and exit.
+@item --macrodir=@var{dir}
@evindex AC_MACRODIR
-You can override the directory where @code{autoheader} looks for the
-installed macro and @file{acconfig.h} files by setting the
-@code{AC_MACRODIR} environment variable to a different directory. You
-can also give @code{autoheader} the @samp{--macrodir=@var{dir}} option,
-which overrides @code{AC_MACRODIR}.
+Look for the installed macro files and @file{acconfig.h} in directory
+@var{dir}. You can also set the @code{AC_MACRODIR} environment variable
+to a directory; this option overrides the environment variable.
-@code{autoheader} also accepts the options @code{--version}, which prints
-the Autoconf version number and exits, and @code{--help}, which prints a
-summary of the command-line options and exits.
+@item --version
+Print the version number of Autoconf and exit.
+@end table
@node Subdirectories, Versions, Configuration Headers, Setup
@section Configuring Other Packages in Subdirectories
@end defmac
@node Versions, , Subdirectories, Setup
-@section Controlling Autoconf Versions
+@section Version Numbers in @code{configure}
The following macros manage version numbers for @code{configure}
-scripts. Most people don't need them.
+scripts. They are optional.
@defmac AC_PREREQ (@var{version})
@maindex PREREQ
@ovindex INSTALL_DATA
Set output variable @code{INSTALL} to the path of a BSD compatible
@code{install} program, if one is found in the current @code{PATH}.
-Otherwise, set @code{INSTALL} to @samp{@var{dir}/install.sh -c}, where
-it checks the directories specified to @code{AC_CONFIG_AUX_DIR} (or its
-default directories) to determine @var{dir} (@pxref{Output}).
+Otherwise, set @code{INSTALL} to @samp{@var{dir}/install-sh -c},
+checking the directories specified to @code{AC_CONFIG_AUX_DIR} (or its
+default directories) to determine @var{dir} (@pxref{Output}). Also set
+the variable @code{INSTALL_PROGRAM} to @samp{$@{INSTALL@}} and
+@code{INSTALL_DATA} to @samp{$@{INSTALL@} -m 644}.
This macro screens out various instances of @code{install} known to not
-work. It also sets the variable @code{INSTALL_PROGRAM} to
-@samp{$@{INSTALL@}} and @code{INSTALL_DATA} to @samp{$@{INSTALL@} -m
-644}.
-
-If you need to use your own installation program because it has features
-not found in standard @code{install} programs, there is no reason to use
-@code{AC_PROG_INSTALL}; just put the pathname of your program into your
-@file{Makefile.in} files.
+work. It prefers to find a C program rather than a shell script, for
+speed. Instead of @file{install-sh}, it can also use @file{install.sh},
+but that name is obsolete because some @code{make} programs have a rule
+that creates @file{install} from it if there is no @file{Makefile}.
+
+If you need to use your own installation program because it has
+features not found in standard @code{install} programs, there is no
+reason to use @code{AC_PROG_INSTALL}; just put the pathname of your
+program into your @file{Makefile.in} files.
@end defmac
@defmac AC_PROG_LEX
@end defmac
@node Generic Programs, , Particular Programs, Alternative Programs
-@subsection Generic Program Checking Macros
+@subsection Generic Program Checks
These macros are used to find programs not covered by the particular
test macros.
@defmac AC_PATH_PROGS (@var{variable}, @var{progs-to-check-for} @r{[}, @var{value-if-not-found}@r{]})
@maindex PATH_PROGS
Like @code{AC_CHECK_PROGS}, but if any of @var{progs-to-check-for}
-are found, set @var{variable} to the entire pathname of the program
+are found, set @var{variable} to the entire path of the program
found.
@end defmac
See whether a test C program can be linked with the library
@var{library}. @var{function} should be the name of a function that the
library contains, to force the linker to try to link with the library to
-resolve the name. @var{library} must be the base name of the library;
+resolve the name. @var{library} is the base name of the library;
e.g., to check for @samp{-lmp}, use @samp{mp} as the @var{library}
argument.
@end defmac
@node Generic Functions, , Particular Functions, Library Functions
-@subsection Generic Function Checking Macros
+@subsection Generic Function Checks
These macros are used to find functions not covered by the particular
-test macros.
+test macros. If the functions might be in libraries other than the
+default C library, first call @code{AC_CHECK_LIB} for those libraries.
@defmac AC_CHECK_FUNC (@var{function}, @var{action-if-found} @r{[}, @var{action-if-not-found}@r{]})
@maindex CHECK_FUNC
If C function @var{function} is available, run shell commands
-@var{action-if-found}, otherwise @var{action-if-not-found}. If the
-functions might be in libraries other than the default C library, first
-call @code{AC_CHECK_LIB} for those libraries. If you just want to
-define a symbol if the function is available, consider using
+@var{action-if-found}, otherwise @var{action-if-not-found}. If you just
+want to define a symbol if the function is available, consider using
@code{AC_CHECK_FUNCS} instead. This macro checks for functions with C
linkage even when @code{AC_LANG_CPLUSPLUS} has been called, since C++ is
more standardized than C is. (@pxref{Language Choice}, for more
when one of the functions is found. You can give it a value of
@samp{break} to break out of the loop on the first match. If
@var{action-if-not-found} is given, it is executed when one of the
-functions is not found. If the functions might be in libraries other
-than the default C library, first call @code{AC_CHECK_LIB} for those
-libraries.
+functions is not found.
@end defmac
@defmac AC_REPLACE_FUNCS (@var{function-name}@dots{})
@ovindex LIBOBJS
For each given @var{function-name} in the whitespace-separated argument
list that is not in the C library, add @samp{@var{function-name}.o} to
-the value of the output variable @code{LIBOBJS}. If the functions
-might be in libraries other than the default C library, first call
-@code{AC_CHECK_LIB} for those libraries.
+the value of the output variable @code{LIBOBJS}.
@end defmac
@node Header Files, Structures, Library Functions, Existing Tests
@code{NDIR}
@end table
-If the @code{closedir} function does not return a meaningful value,
-define @code{VOID_CLOSEDIR}.
+In addition, if the @code{closedir} function does not return a
+meaningful value, define @code{VOID_CLOSEDIR}.
@end defmac
@defmac AC_HEADER_DIRENT
@end defmac
@node Generic Headers, , Particular Headers, Header Files
-@subsection Generic Header Checking Macros
+@subsection Generic Header Checks
These macros are used to find system header files not covered by the
particular test macros.
@section Structures
The following macros check for certain structures or structure members.
-You can use @code{AC_TRY_LINK} (@pxref{Checking for Symbols}) to check
+You can use @code{AC_TRY_LINK} (@pxref{Checking Libraries}) to check
structures not listed here.
@defmac AC_HEADER_STAT
@code{AC_CHECK_HEADERS(sys/time.h)}.
@example
+@group
#if TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
# include <time.h>
# endif
#endif
+@end group
@end example
@end defmac
@end defmac
@node Generic Typedefs, , Particular Typedefs, Typedefs
-@subsection Generic Typedef Checking Macro
+@subsection Generic Typedef Checks
This macro is used to find types not covered by the particular test
macros.
@section Compiler Characteristics
The following macros check for C compiler or machine architecture
-features. You can use @code{AC_TRY_LINK} (@pxref{Checking for Symbols})
+features. You can use @code{AC_TRY_LINK} (@pxref{Checking Libraries})
or @code{AC_TRY_RUN} (@pxref{Run Time}) to check for
characteristics not listed here.
@defmac AC_DYNIX_SEQ
@maindex OS_DYNIX_SEQ
-If on PTX (Sequent UNIX), add @samp{-lseq} to output
+If on Dynix/PTX (Sequent UNIX), add @samp{-lseq} to output
variable @code{LIBS}. This macro is obsolete; instead, use
@code{AC_FUNC_GETMNTENT}.
@end defmac
@maindex IRIX_SUN
If on IRIX (Silicon Graphics UNIX), add @samp{-lsun} to output variable
@code{LIBS}. This macro is obsolete. If you were using it to get
-@code{getmntent}, instead, use @code{AC_FUNC_GETMNTENT}. If you used it
+@code{getmntent}, use @code{AC_FUNC_GETMNTENT} instead. If you used it
for the NIS versions of the password and group functions, use
@samp{AC_CHECK_LIB(sun, getpwnam)}.
@end defmac
ways for other macros to check whether various kinds of features are
available and report the results.
-Here are some suggestions and some of the reasons why the
+This chapter contains some suggestions and some of the reasons why the
existing tests are written the way they are. You can also learn a lot
about how to write Autoconf tests by looking at the existing ones. If
something goes wrong in one or more of the Autoconf tests, this
-information can help you understand why they work the way they do and
-the assumptions behind them, which might help you figure out how to best
-solve the problem.
+information can help you understand the assumptions behind them, which
+might help you figure out how to best solve the problem.
+
+These macros check the output of the C compiler system. They @emph{do
+not} cache the results of their tests for future use (@pxref{Caching
+Values}), because they don't know enough about the information they are
+checking for to generate a cache variable name. They also do not print
+any messages, for the same reason. The checks for particular kinds of C
+features call these macros and do cache their results and print messages
+about what they're checking for.
@menu
-* Checking for Symbols:: Finding whether a symbol is defined.
+* Checking Declarations:: Detecting header files and declarations.
+* Checking Libraries:: Detecting functions and global variables.
* Run Time:: Testing for run-time features.
* Portable Shell:: Shell script portability pitfalls.
* Testing Values and Files:: Checking strings and files.
* Language Choice:: Selecting which language to use for testing.
@end menu
-@node Checking for Symbols, Run Time, , Writing Tests
-@section Checking for Symbols
+@node Checking Declarations, Checking Libraries, , Writing Tests
+@section Checking Declarations
-These macros check the output of the C compiler system. They @emph{do
-not} cache the results of their tests for future use (@pxref{Caching
-Values}), because they don't know enough about the information they are
-checking for to generate a cache variable name. They also do not print
-any messages, for the same reason. The checks for particular kinds of C
-features call these macros and do cache their results and print messages
-about what they're checking for.
+Here is how to check whether particular header files exist.
-Autoconf checks for many features by using these macros to examine or
-compile small test programs. To find out whether a library function is
-available, Autoconf tries to compile and link a small program that uses
-it. This is unlike Larry Wall's Metaconfig, which uses @code{nm} or
-@code{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
-and flexible approach because it avoids dealing with the variations in
-the options and output formats of @code{nm} and @code{ar} and in the
-location of the standard libraries. It also allows @code{configure} to
-check aspects of the function's runtime behavior if needed. On the
-other hand, it is sometimes slower than scanning the libraries.
+@defmac AC_TRY_CPP (@var{includes}, @var{action-if-true} @r{[}, @var{action-if-false}@r{]})
+@maindex TRY_CPP
+@var{includes} is C or C++ @code{#include} statements and declarations,
+on which shell variable, backquote, and backslash substitutions are
+performed. (Actually, it can be any C program, but other statements are
+probably not useful.) If the preprocessor produces no error messages
+while processing it, run shell commands @var{action-if-true}. Otherwise
+run shell commands @var{action-if-false}.
-@defmac AC_COMPILE_CHECK (@var{echo-text}, @var{includes}, @var{function-body}, @var{action-if-found} @r{[}, @var{action-if-not-found}@r{]})
-@maindex COMPILE_CHECK
-This is an obsolete alias for @code{AC_TRY_LINK}, with the addition that it
-prints @samp{checking for @var{echo-text}} to the standard output first,
-if @var{echo-text} is non-empty.
+This macro calls @code{AC_PROG_CPP} or @code{AC_PROG_CXXCPP} (depending
+on which language is current, @pxref{Language Choice}), if it hasn't
+been called already. It uses @code{CPPFLAGS}, but not @code{CFLAGS},
+because @samp{-g}, @samp{-O}, etc. are not valid options to many C
+preprocessors.
@end defmac
+The following macros check whether header files contain particular
+symbols. You can not check whether preprocessor symbols are defined
+this way, because they get expanded before @code{egrep} sees them. But
+you can detect them by simply using @code{#ifdef} directives in your
+programs.
+
+You can also use @code{AC_EGREP_CPP} to check whether the C preprocessor
+predefines particular symbols, like this:
+
+@example
+AC_EGREP_CPP(yes,
+[#ifdef _AIX
+ yes
+#endif
+], is_aix=yes, is_aix=no)
+@end example
+
@defmac AC_EGREP_CPP (@var{pattern}, @var{program}, @var{action-if-found} @r{[}, @var{action-if-not-found}@r{]})
@maindex EGREP_CPP
@var{program} is the text of a C or C++ program, on which shell
variable, backquote, and backslash substitutions are performed. If the
-output of running the preprocessor on @var{program} contains the
+output of running the preprocessor on @var{program} matches the
@code{egrep} regular expression @var{pattern}, execute shell commands
@var{action-if-found}, otherwise execute @var{action-if-not-found}.
been called already.
@end defmac
+To find out whether a header file contains a particular symbol, use the
+following macro instead of using @code{grep} directly on the header
+file. On some systems the symbol might be defined in another header
+file that the file you are checking @samp{#include}s.
+
@defmac AC_EGREP_HEADER (@var{pattern}, @var{header-file}, @var{action-if-found} @r{[}, @var{action-if-not-found}@r{]})
@maindex EGREP_HEADER
If the output of running the preprocessor on the system header file
-@var{header-file} contains the @code{egrep} regular expression
+@var{header-file} matches the @code{egrep} regular expression
@var{pattern}, execute shell commands @var{action-if-found}, otherwise
execute @var{action-if-not-found}.
-Use this macro instead of using @code{grep} directly on a header file,
-because on some systems it might be defined in another header file that
-the file you are checking @samp{#include}s.
-
This macro calls @code{AC_PROG_CPP} or @code{AC_PROG_CXXCPP} (depending
on which language is current, @pxref{Language Choice}), if it hasn't
been called already.
@var{action-if-not-found}.
-
-You can not check whether preprocessor symbols are defined this way,
-because they get expanded before @code{egrep} sees them. But you can
-almost always detect them by simply using @code{#ifdef} directives in
-your programs.
@end defmac
-@defmac AC_TRY_CPP (@var{includes}, @var{action-if-true} @r{[}, @var{action-if-false}@r{]})
-@maindex TRY_CPP
-@var{includes} is C or C++ @code{#include} statements and declarations,
-on which shell variable, backquote, and backslash substitutions are
-performed. (Actually, it can be any C program, but other statements are
-probably not useful.) If the preprocessor produces no error messages
-while processing it, run shell commands @var{action-if-true}. Otherwise
-run shell commands @var{action-if-false}.
+@node Checking Libraries, Run Time, Checking Declarations, Writing Tests
+@section Checking Libraries
+
+Autoconf checks for many features by examining or compiling small test
+programs. To find out whether a library function is available, Autoconf
+tries to compile and link a small program that uses it. This is unlike
+Larry Wall's Metaconfig, which uses @code{nm} or @code{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 and flexible approach
+because it avoids dealing with the variations in the options and output
+formats of @code{nm} and @code{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 is
+sometimes slower than scanning the libraries.
-This macro calls @code{AC_PROG_CPP} or @code{AC_PROG_CXXCPP} (depending
-on which language is current, @pxref{Language Choice}), if it hasn't
-been called already. It uses @code{CPPFLAGS}, but not @code{CFLAGS},
-because @samp{-g}, @samp{-O}, etc. are not valid options to many C
-preprocessors.
-@end defmac
+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.
@defmac AC_TRY_LINK (@var{includes}, @var{function-body}, @var{action-if-found} @r{[}, @var{action-if-not-found}@r{]})
@maindex TRY_LINK
@var{action-if-found}, otherwise run @var{action-if-not-found}. This
macro uses @code{CFLAGS} or @code{CXXFLAGS}, @code{CPPFLAGS},
@code{LDFLAGS}, and @code{LIBS} when compiling.
+@end defmac
-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.
+@defmac AC_COMPILE_CHECK (@var{echo-text}, @var{includes}, @var{function-body}, @var{action-if-found} @r{[}, @var{action-if-not-found}@r{]})
+@maindex COMPILE_CHECK
+This is an obsolete alias for @code{AC_TRY_LINK}, with the addition that it
+prints @samp{checking for @var{echo-text}} to the standard output first,
+if @var{echo-text} is non-empty.
@end defmac
-@node Run Time, Portable Shell, Checking for Symbols, Writing Tests
+@node Run Time, Portable Shell, Checking Libraries, Writing Tests
@section Checking Run Time Behavior
-If you need to check for a condition other than whether some symbol
-exists on the system or has a certain value, then you can't use
-@code{AC_TRY_LINK} (@pxref{Checking for Symbols}). One alternative is
-to write a test program to determine the result, and compile and run it
-using @code{AC_TRY_RUN}.
+Sometimes you need to find out how a system performs at run time, such
+as whether a given function has a certain capability or bug. If you
+can, make such checks when your program runs instead of when it is
+configured. You can check for things like the machine's endianness when
+your program initializes itself.
+
+If you really need to test for a run-time behavior while configuring,
+you can write a test program to determine the result, and compile and
+run it using @code{AC_TRY_RUN}. Avoid running test programs if
+possible, because using them prevents people from configuring your
+package for cross-compiling.
+
+@menu
+* Test Programs:: Running test programs.
+* Guidelines:: General rules for writing test programs.
+* Test Functions:: Avoiding pitfalls in test programs.
+@end menu
+
+@node Test Programs, Guidelines, , Run Time
+@subsection Running Test Programs
+
+Use the following macro if you need to test run-time behavior of the
+system while configuring.
@defmac AC_TRY_RUN (@var{program}, @var{action-if-true} @r{[}, @var{action-if-false} @r{[}, @var{action-if-cross-compiling}@r{]]})
@maindex TRY_RUN
the system where @code{configure} is being run, then the test program is
not run. If the optional shell commands @var{action-if-cross-compiling}
are given, they are run instead and this macro calls @code{AC_C_CROSS}
-if it has not already been called (@pxref{Compiler Characteristics}).
-Otherwise, @code{configure} prints an error message and exits.
-@code{autoconf} prints a warning message when creating @code{configure}
-each time it encounters a call to @code{AC_TRY_RUN} with no
-@var{action-if-cross-compiling} argument given. You may ignore the
-warning, though users will not be able to configure your package for
-cross-compiling. A few of the macros distributed with Autoconf produce
-this warning message.
+if it has not already been called. Otherwise, @code{configure} prints
+an error message and exits.
@end defmac
+Try to provide a pessimistic default value to use when cross-compiling
+makes run-time tests impossible. You do this by passing the optional
+last argument to @code{AC_TRY_RUN}. @code{autoconf} prints a warning
+message when creating @code{configure} each time it encounters a call to
+@code{AC_TRY_RUN} with no @var{action-if-cross-compiling} argument
+given. You may ignore the warning, though users will not be able to
+configure your package for cross-compiling. A few of the macros
+distributed with Autoconf produce this warning message.
+
+To configure for cross-compiling you can also choose a value for those
+parameters based on the canonical system name (@pxref{Manual
+Configuration}). Alternatively, set up a test results cache file with
+the correct values for the target system (@pxref{Caching Values}).
+
To provide a default for calls of @code{AC_TRY_RUN} that are embedded in
other macros, including a few of the ones that come with Autoconf, you
can call @code{AC_C_CROSS} before running them. Then if the shell
variable @code{cross_compiling} to @samp{yes}, otherwise @samp{no}.
@end defmac
-@menu
-* Alternatives:: Approaches preferred over test programs.
-* Guidelines:: General rules for writing test programs.
-* Test Functions:: Avoiding pitfalls in test programs.
-@end menu
-
-@node Alternatives, Guidelines, , Run Time
-@subsection Alternatives to Test Programs
-
-Avoid running test programs if possible, because using them prevents
-people from configuring your package for cross-compiling. If you can,
-make the checks at run-time instead of at configure-time. You can check
-for things like the machine's endianness when your program initializes
-itself instead of when configuring it.
-
-If you still need to test for a run-time behavior while configuring, try
-to provide a default pessimistic value to use when cross-compiling
-makes run-time tests impossible. You do this by passing the optional
-last argument to @code{AC_TRY_RUN}. To configure for cross-compiling
-you can also choose a value for those parameters based on the canonical
-system name (@pxref{Manual Configuration}). Alternatively, set up a
-test results cache file with the correct values for the target system
-(@pxref{Caching Values}). But that is a quick-hack solution to the
-problem.
-
-@node Guidelines, Test Functions, Alternatives, Run Time
+@node Guidelines, Test Functions, Test Programs, Run Time
@subsection Guidelines for Test Programs
Test programs should not write anything to the standard output. They
@maindex LANG_C
Do compilation tests using @code{CC} and @code{CPP} and use extension
@file{.c} for test programs.
-
-This is the initial state.
@end defmac
@defmac AC_LANG_CPLUSPLUS
@chapter Results of Tests
Once @code{configure} has determined whether a feature exists, what can
-it do to record that information? There are three sorts of things it
-can do: set a variable in the output files, save the result in a cache
-file for future @code{configure} runs, and print a message letting the
-user know the result of the test.
+it do to record that information? There are four sorts of things it can
+do: define a C preprocessor symbol, set a variable in the output files,
+save the result in a cache file for future @code{configure} runs, and
+print a message letting the user know the result of the test.
@menu
* Defining Symbols:: Defining C preprocessor symbols.
@section Defining C Preprocessor Symbols
A common action to take in response to a feature test is to define a C
-preprocessor symbol indicating the results of the test. The two macros
-described below do that.
+preprocessor symbol indicating the results of the test. These two
+macros do that.
+
+@defmac AC_DEFINE (@var{variable} @r{[}, @var{value}@r{]})
+@maindex DEFINE
+Define C preprocessor variable @var{variable}. If @var{value} is given,
+set @var{variable} to that value (verbatim), otherwise set it to 1.
+@var{value} should not contain literal newlines, and if you are not
+using @code{AC_CONFIG_HEADER} it should not contain any @samp{#}
+characters, as @code{make} tends to eat them. To use a shell variable
+(which you need to do in order to define a value containing the
+@code{m4} quote characters @samp{[} or @samp{]}), use
+@code{AC_DEFINE_UNQUOTED} instead. The following example defines the C
+preprocessor variable @code{EQUATION} to be the string constant
+@samp{"$a > $b"}:
+
+@example
+AC_DEFINE(EQUATION, "$a > $b")
+@end example
+@end defmac
+
+@defmac AC_DEFINE_UNQUOTED (@var{variable} @r{[}, @var{value}@r{]})
+@maindex DEFINE_UNQUOTED
+Like @code{AC_DEFINE}, but three shell expansions are
+performed---once---on @var{variable} and @var{value}: variable expansion
+(@samp{$}), command substitution (@samp{`}), and backslash escaping
+(@samp{\}). Single and double quote characters in the value have no
+special meaning. Use this macro instead of @code{AC_DEFINE} when
+@var{variable} or @var{value} is a shell variable. Examples:
+
+@example
+AC_DEFINE_UNQUOTED(config_machfile, "$@{machfile@}")
+AC_DEFINE_UNQUOTED(GETGROUPS_T, $ac_cv_type_getgroups)
+AC_DEFINE_UNQUOTED($@{ac_tr_hdr@})
+@end example
+@end defmac
By default, @code{AC_OUTPUT} substitutes the symbols defined by these
macros into the output variable @code{DEFS}, which contains an option
AC_CHECK_HEADER(elf.h, AC_DEFINE(SVR4); LIBS="$LIBS -lelf")
@end example
-@defmac AC_DEFINE (@var{variable} @r{[}, @var{value}@r{]})
-@maindex DEFINE
-Define C preprocessor variable @var{variable}. If @var{value} is given,
-set @var{variable} to that value (verbatim), otherwise set it to 1.
-@var{value} should not contain literal newlines, and if you are not
-using @code{AC_CONFIG_HEADER} it should not contain any @samp{#}
-characters, as @code{make} tends to eat them. To use a shell variable
-(which you need to do in order to define a value containing the
-@code{m4} quote characters @samp{[} or @samp{]}), use
-@code{AC_DEFINE_UNQUOTED} instead.
-@end defmac
-
-@defmac AC_DEFINE_UNQUOTED (@var{variable} @r{[}, @var{value}@r{]})
-@maindex DEFINE_UNQUOTED
-Like @code{AC_DEFINE}, but three shell expansions are
-performed---once---on @var{value}: variable expansion (@samp{$}),
-command substitution (@samp{`}), and backslash escaping (@samp{\}).
-Single and double quote characters in the value have no special meaning.
-Use this macro instead of @code{AC_DEFINE} when @var{value} is a shell
-variable. For example:
-
-@example
-AC_DEFINE_UNQUOTED(config_machfile, "$@{machfile@}")
-@end example
-@end defmac
-
@node Setting Variables, Caching Values, Defining Symbols, Results
-@section Setting Variables
+@section Setting Output Variables
These macros help other macros to define variables that are used in the
@code{configure} shell script and substituted into output files. These
@defmac AC_SUBST (@var{variable})
@maindex SUBST
+Create an output variable from a shell variable.
Make @code{AC_OUTPUT} substitute the variable @var{variable} into output
files (typically one or more @file{Makefile}s). This means that
@code{AC_OUTPUT} will replace instances of @samp{@@@var{variable}@@} in
@defmac AC_SUBST_FILE (@var{variable})
@maindex SUBST_FILE
+Another way to create an output variable from a shell variable.
Make @code{AC_OUTPUT} substitute the contents of the file named by shell
variable @var{variable} into output files (typically one or more
@file{Makefile}s). This means that @code{AC_OUTPUT} will replace
on them.
These macros are all wrappers around the @code{echo} shell command.
-Other macros should rarely need to run @code{echo} directly to print
-messages for the @code{configure} user. Using these macros makes it
-easy to change how and when each kind of message is printed; such
-changes need only be made to the macro definitions, and all of the
-callers change automatically.
-
-@defmac AC_CHECKING (@var{feature-description})
-@maindex CHECKING
-This macro is similar to @code{AC_MSG_CHECKING}, except that it prints a
-newline after the @var{feature-description}. It is useful mainly to
-print a general description of the overall purpose of a group of feature
-checks, e.g.,
-
-@example
-AC_CHECKING(if stack overflow is detectable)
-@end example
-@end defmac
+@code{configure} scripts should rarely need to run @code{echo} directly
+to print messages for the user. Using these macros makes it easy to
+change how and when each kind of message is printed; such changes need
+only be made to the macro definitions, and all of the callers change
+automatically.
@defmac AC_MSG_CHECKING (@var{feature-description})
@maindex MSG_CHECKING
@samp{--quiet} or @samp{--silent} option.
@end defmac
-@defmac AC_MSG_ERROR (@var{error-description})
-@maindex MSG_ERROR
-Notify the user of an error that prevents @code{configure} from
-completing. This macro prints an error message on the standard error
-stream and exits @code{configure} with a nonzero status.
-@var{error-description} should be something like @samp{invalid value
-$HOME for \$HOME}.
-@end defmac
-
@defmac AC_MSG_RESULT (@var{result-description})
@maindex MSG_RESULT
Notify the user of the results of a check. @var{result-description} is
@samp{--quiet} or @samp{--silent} option.
@end defmac
+@defmac AC_MSG_ERROR (@var{error-description})
+@maindex MSG_ERROR
+Notify the user of an error that prevents @code{configure} from
+completing. This macro prints an error message on the standard error
+stream and exits @code{configure} with a nonzero status.
+@var{error-description} should be something like @samp{invalid value
+$HOME for \$HOME}.
+@end defmac
+
@defmac AC_MSG_WARN (@var{problem-description})
@maindex MSG_WARN
Notify the @code{configure} user of a possible problem. This macro
make hard links}.
@end defmac
+The following two macros are an obsolete alternative to
+@code{AC_MSG_CHECKING} and @code{AC_MSG_RESULT}.
+
+@defmac AC_CHECKING (@var{feature-description})
+@maindex CHECKING
+This macro is similar to @code{AC_MSG_CHECKING}, except that it prints a
+newline after the @var{feature-description}. It is useful mainly to
+print a general description of the overall purpose of a group of feature
+checks, e.g.,
+
+@example
+AC_CHECKING(if stack overflow is detectable)
+@end example
+@end defmac
+
@defmac AC_VERBOSE (@var{result-description})
@maindex VERBOSE
This macro is similar to @code{AC_MSG_RESULT}, except that it is meant
When you write a feature test that could be applicable to more than one
software package, the best thing to do is encapsulate it in a new macro.
-Here are some instructions and guidelines for doing so.
-
-If you add macros that you think would be useful to other people, or
-find problems with the distributed macros, please send electronic mail
-to @file{bug-gnu-utils@@prep.ai.mit.edu}, so we can consider them for
-future releases of Autoconf. Please include the Autoconf version
-number, which you can get by running @samp{autoconf --version}.
+Here are some instructions and guidelines for writing Autoconf macros.
@menu
* Macro Format:: Basic format of an Autoconf macro.
@section Macro Format
@maindex DEFUN
-Autoconf macros are defined as arguments to the @code{AC_DEFUN} macro,
-which is similar to the @code{m4} builtin @code{define} macro. In
-addition to defining the macro, @code{AC_DEFUN} adds some code to the
-macro which is used to constrain the order in which macros are called
-(@pxref{Prerequisite Macros}).
+Autoconf macros are defined using the @code{AC_DEFUN} macro, which is
+similar to the @code{m4} builtin @code{define} macro. In addition to
+defining a macro, @code{AC_DEFUN} adds to it some code which is used to
+constrain the order in which macros are called (@pxref{Prerequisite
+Macros}).
An Autoconf macro definition looks like this:
Header files.
@item LIB
C libraries.
-@item OS
-Quirks of particular operating systems.
@item PATH
The full path names to files, including programs.
@item PROG
that it has been called.
@end defmac
-An obsolete alternative to using @code{AC_DEFUN} is to use @code{define}
-and call @code{AC_PROVIDE}:
+An alternative to using @code{AC_DEFUN} is to use @code{define} and call
+@code{AC_PROVIDE}. Because this technique does not prevent nested
+messages, it is considered obsolete.
@defmac AC_PROVIDE (@var{this-macro-name})
@maindex PROVIDE
macros that run the C compiler. Many of these dependencies are noted in
the documentation.
-Autoconf provides a way to warn users when macros with this kind of
-dependency appear out of order in a @file{configure.in} file. The
-warning occurs when creating @file{configure} from @file{configure.in},
-not when running @file{configure}.
-The @code{AC_BEFORE} macro causes @code{m4} to print a warning message
-on the standard error output when a macro is used before another macro
-which might change its behavior. The macro which should come first
-should contain a call to @code{AC_BEFORE}.
-
-For example, @code{AC_AIX} contains
+Autoconf provides the @code{AC_BEFORE} macro to warn users when macros
+with this kind of dependency appear out of order in a
+@file{configure.in} file. The warning occurs when creating
+@file{configure} from @file{configure.in}, not when running
+@file{configure}.
+For example, @code{AC_PROG_CPP} checks whether the C compiler
+can run the C preprocessor when given the @samp{-E} option. It should
+therefore be called after any macros that change which C compiler is
+being used, such as @code{AC_PROG_CC}. So @code{AC_PROG_CC} contains:
@example
-AC_BEFORE([$0], [AC_TRY_LINK])
+AC_BEFORE([$0], [AC_PROG_CPP])dnl
@end example
@noindent
-As a result, if @code{AC_AIX} is called after @code{AC_TRY_LINK},
-it will note that @code{AC_TRY_LINK} has already been called and
-print a warning message.
+This warns the user if a call to @code{AC_PROG_CPP} has already occurred
+when @code{AC_PROG_CC} is called.
@defmac AC_BEFORE (@var{this-macro-name}, @var{called-macro-name})
@maindex BEFORE
macro @var{called-macro-name} must have been defined using
@code{AC_DEFUN} or else contain a call to @code{AC_PROVIDE} to indicate
that it has been called.
-
-This macro should be used when one macro makes changes that might affect
-another macro, so that the other macro should probably not be called
-first. For example, @code{AC_PROG_CPP} checks whether the C compiler
-can run the C preprocessor when given the @samp{-E} option. It should
-therefore be called after any macros that change which C compiler is
-being used, such as @code{AC_PROG_CC}. So @code{AC_PROG_CC} contains:
-
-@example
-AC_BEFORE([$0], [AC_PROG_CPP])dnl
-@end example
-
-@noindent
-This warns the user if a call to @code{AC_PROG_CPP} has already occurred
-when @code{AC_PROG_CC} is called.
@end defmac
@node Obsolete Macros, , Suggested Ordering, Dependencies Between Macros
ad-hoc approaches are systematized. This process has occurred in many
parts of Autoconf. One result is that some of the macros are now
considered @dfn{obsolete}; they still work, but are no longer considered
-the best thing to do. Autoconf has a way to warn users producing
-@code{configure} scripts when they use obsolete macros, to encourage
-them to modernize.
+the best thing to do. Autoconf provides the @code{AC_OBSOLETE} macro to
+warn users producing @code{configure} scripts when they use obsolete
+macros, to encourage them to modernize. A sample call is:
+
+@example
+AC_OBSOLETE([$0], [; use AC_CHECK_HEADERS(unistd.h) instead])dnl
+@end example
@defmac AC_OBSOLETE (@var{this-macro-name} @r{[}, @var{suggestion}@r{]})
@maindex OBSOLETE
Make @code{m4} print a message on the standard error output warning that
@var{this-macro-name} is obsolete, and giving the file and line number
where it was called. @var{this-macro-name} should be the name of the
-macro that is calling @code{AC_BEFORE}. If @var{suggestion} is given,
+macro that is calling @code{AC_OBSOLETE}. If @var{suggestion} is given,
it is printed at the end of the warning message; for example, it can be
a suggestion for what to use instead of @var{this-macro-name}.
-
-A sample call is:
-
-@example
-AC_OBSOLETE([$0], [; use AC_CHECK_HEADERS(unistd.h) instead])dnl
-@end example
@end defmac
@node Manual Configuration, Site Configuration, Writing Macros, Top
@chapter Manual Configuration
-Some kinds of features can't be guessed automatically by running test
-programs. For example, how to allocate a pseudo tty, or the details of
-the object file format, or special options that need to be passed to the
-compiler or linker to provide a POSIX or ANSI C environment. It is
+A few kinds of features can't be guessed automatically by running test
+programs. For example, the details of the object file format, or
+special options that need to be passed to the compiler or linker. It is
possible to check for such features using ad-hoc means, such as having
@code{configure} check the output of the @code{uname} program, or
looking for libraries that are unique to particular systems. However,
types default to the host type if it is given and they are not. If you
are cross-compiling, you still have to specify the names of the
cross-tools you use, in particular the C compiler, on the
-@code{configure} and @code{make} command lines, e.g.,
+@code{configure} command line, e.g.,
@example
-CC=m68k-coff-gcc configure --target=m68k-coff; CC=m68k-coff-gcc make
+CC=m68k-coff-gcc configure --target=m68k-coff
@end example
@code{configure} recognizes short aliases for many system types; for
@code{configure} ignores any @samp{--host}, @samp{--target}, and
@samp{--build} options given to it.
+@defmac AC_CANONICAL_SYSTEM
+@maindex CANONICAL_SYSTEM
+Determine the system type and set output variables to the names of the
+canonical system types.
+@end defmac
+
@defmac AC_CANONICAL_HOST
@maindex CANONICAL_HOST
Perform only the subset of @code{AC_CANONICAL_SYSTEM} relevant to the
a compiler toolchain.
@end defmac
-@defmac AC_CANONICAL_SYSTEM
-@maindex CANONICAL_SYSTEM
-Set output variables to the names of the canonical system
-types.
-@end defmac
-
@node System Name Variables, Using System Type, Canonicalizing, Manual Configuration
@section System Name Variables
-After calling @code{AC_CANONICAL_SYSTEM} or @code{AC_CANONICAL_HOST},
-the output variables that contain the system type information are:
+After calling @code{AC_CANONICAL_SYSTEM}, the following output variables
+contain the system type information. After @code{AC_CANONICAL_HOST},
+only the @code{host} variables below are set.
@table @code
@ovindex build
@end example
@node Site Defaults, , Transforming Names, Site Configuration
-@section Site Defaults
+@section Setting Site Defaults
-Autoconf-generated @code{configure} scripts allow a site to provide
-default values for some configuration values, both on all of your
-systems and separately for each architecture. You do this by creating
+Autoconf-generated @code{configure} scripts allow your site to provide
+default values for some configuration values. You do this by creating
site- and system-wide initialization files.
@evindex CONFIG_SITE
@node Invoking configure, Invoking config.status, Site Configuration, Top
@chapter Running @code{configure} Scripts
-A software package that uses a @code{configure} script
-should be distributed with a file @file{Makefile.in}, but no
-@file{Makefile}; that way, the user has to properly configure the
-package for the local system before compiling it.
Below are instructions on how to configure a package that uses a
@code{configure} script, suitable for inclusion as an @file{INSTALL}
file in the package.
@node Concerns, Upgrading, Invoking config.status, Top
@chapter Concerns About Autoconf
-Several concerns about Autoconf come up regularly. Here some of them
+Several concerns about Autoconf come up occasionally. Here some of them
are addressed.
@menu
@item --macrodir=@var{dir}
@itemx -m @var{dir}
+@evindex AC_MACRODIR
Look for the Autoconf macro files in directory @var{dir} instead of the
default installation directory.
+You can also set the @code{AC_MACRODIR}
+environment variable to a directory; this option overrides the
+environment variable.
@item --version
Print the version number of @code{autoupdate} and exit.
advantage of some new features.
If you were doing tricky things with undocumented Autoconf internals
-(diversions, macros, variables), check whether you need to change
+(macros, variables, diversions), check whether you need to change
anything to account for changes that have been made. Perhaps you can
even use an officially supported technique in version 2 instead of
kludging. Or perhaps not.
-To speed up your locally written feature tests, add caching to them. If
-you don't encapsulate your tests into macros, do so; don't be sloppy.
-(I've been guilty myself.) @xref{Caching Values}.
+To speed up your locally written feature tests, add caching to them.
+See whether any of your tests are of general enough usefulness to
+encapsulate into macros that you can share.
@node History, Old Macro Names, Upgrading, Top
@chapter History of Autoconf
a tool for generating them that I could send him. No, I thought, but
I should! So I started to work out how to generate them. And the
journey from the slavery of hand-written @file{configure} scripts to the
-freedom of Autoconf began.
+abundance and ease of Autoconf began.
Cygnus @code{configure}, which was being developed at around that time,
is table driven; it is meant to deal mainly with a discrete number of
Karl Berry, who got Autoconf to configure @TeX{} and added the
macro index to the documentation; and Ian Taylor, who added support for
creating a C header file as an alternative to putting @samp{-D} options
-in a @file{Makefile}, so he could use Autoconf in his UUCP package. The
+in a @file{Makefile}, so he could use Autoconf for his UUCP package. The
alpha testers cheerfully adjusted their files again and again as the
names and calling conventions of the Autoconf macros changed from
release to release. They all contributed many specific checks, great
require "find.pl";
-$datadir = "@datadir@";
+$datadir = $ENV{"AC_MACRODIR"} || "@datadir@";
$verbose = 0;
&parse_args;
require "find.pl";
-$datadir = "@datadir@";
+$datadir = $ENV{"AC_MACRODIR"} || "@datadir@";
$verbose = 0;
&parse_args;
require "find.pl";
-$datadir = "@datadir@";
+$datadir = $ENV{"AC_MACRODIR"} || "@datadir@";
$verbose = 0;
&parse_args;
autoconf.sh autoconf.texi install.texi \
autoheader.sh autoreconf.sh autoscan.pl autoupdate.sh ifnames.sh \
config.guess config.sub configure configure.in \
- install.sh mkinstalldirs texinfo.tex \
+ install-sh mkinstalldirs texinfo.tex \
testsuite/Makefile.in testsuite/config/*.exp \
testsuite/lib/*.exp testsuite/autoconf.[gs]/*.exp \
standards.texi make-stds.texi standards.info*
@c @setchapternewpage odd
@c %**end of header
-@set EDITION 1.115
-@set VERSION 1.115
+@set EDITION 1.116
+@set VERSION 1.116
@set UPDATED September 1994
@iftex
* Invoking autoconf:: How to create configuration scripts.
* Invoking autoreconf:: Remaking multiple @code{configure} scripts.
-Initialization and Output
+Initialization and Output Files
* Input:: Where Autoconf should find files.
* Output:: Creating output files.
* Subdirectories:: Configuring independent packages together.
* Versions:: Version numbers in @code{configure}.
-Makefiles
+Substitutions in Makefiles
-* Predefined Variables:: Output variables that are always set.
+* Preset Variables:: Output variables that are always set.
* Object Directories:: Compiling in a different directory.
* Automatic Remaking:: Makefile rules for configuring.
Writing Tests
-* Checking for Symbols:: Finding whether a symbol is defined.
+* Checking Declarations:: Detecting header files and declarations.
+* Checking Libraries:: Detecting functions and global variables.
* Run Time:: Testing for run-time features.
* Portable Shell:: Shell script portability pitfalls.
* Testing Values and Files:: Checking strings and files.
Checking Run Time Behavior
-* Alternatives:: Approaches preferred over test programs.
+* Test Programs:: Running test programs.
* Guidelines:: General rules for writing test programs.
* Test Functions:: Avoiding pitfalls in test programs.
@item
optionally, a C header file, the name of which is configurable,
-containing @code{#define} directives (@pxref{Output});
+containing @code{#define} directives (@pxref{Configuration Headers});
@item
a shell script called @file{config.status} that, when run, will recreate
@item
a shell script called @file{config.cache} that saves the results of
-running many of the tests;
+running many of the tests (@pxref{Cache Files});
@item
a file called @file{config.log} containing any messages produced by
If you write your own feature tests to supplement those that come with
Autoconf, you might also write files called @file{aclocal.m4} and
@file{acsite.m4}. If you use a C header file to contain @code{#define}
-directives, you might also write @file{acconfig.h}, @file{config.h.top},
-and @file{config.h.bot}, and you will distribute the Autoconf-generated
-file @file{config.h.in} with the package.
+directives, you might also write @file{acconfig.h}, and you will
+distribute the Autoconf-generated file @file{config.h.in} with the
+package.
Here is a diagram showing how the files that can be used in
configuration are produced. Programs that are executed are suffixed by
When calling macros that take arguments, there must not be any blank
space between the macro name and the open parenthesis. Arguments can be
more than one line long if they are enclosed within the @code{m4} quote
-characters @samp{[} and @samp{]}. Several macros handle two cases: what
+characters @samp{[} and @samp{]}. Some macros handle two cases: what
to do if the given condition is met, and what to do if the condition is
not met. In some places you might want to do something if a
condition is true but do nothing if it's false, or vice versa. To omit
You should manually examine @file{configure.scan} before renaming it to
@file{configure.in}; it will probably need some adjustments. For
example, if you want the package to use a configuration header file, you
-will have to add a call to @code{AC_CONFIG_HEADER} (@pxref{Output}).
-You might also have to change or add some @code{#if} directives to your
-program in order to make it work with Autoconf (@pxref{Invoking
-ifnames}, for information about a program that can help with that job).
+will have to add a call to @code{AC_CONFIG_HEADER} (@pxref{Configuration
+Headers}). You might also have to change or add some @code{#if}
+directives to your program in order to make it work with Autoconf
+(@pxref{Invoking ifnames}, for information about a program that can help
+with that job).
@code{autoscan} uses several data files, which are installed along with the
distributed Autoconf macro files, to determine which macros to output
Print a summary of the command line options and exit.
@item --macrodir=@var{dir}
+@evindex AC_MACRODIR
Look for the data files in directory @var{dir} instead of the default
-installation directory.
+installation directory. You can also set the @code{AC_MACRODIR}
+environment variable to a directory; this option overrides the
+environment variable.
@item --verbose
Print the names of the files it examines and the potentially interesting
symbols it finds in them. This output can be voluminous.
@item --version
-Print the version number of @code{autoscan} and exit.
+Print the version number of Autoconf and exit.
@end table
@node Invoking ifnames, Invoking autoconf, Invoking autoscan, Making configure Scripts
Print a summary of the command line options and exit.
@item --macrodir=@var{dir}
+@evindex AC_MACRODIR
Look for the Autoconf macro files in directory @var{dir} instead of the
default installation directory. Only used to get the version number.
+You can also set the @code{AC_MACRODIR}
+environment variable to a directory; this option overrides the
+environment variable.
@item --version
-Print the version number of @code{ifnames} and exit.
+Print the version number of Autoconf and exit.
@end table
@node Invoking autoconf, Invoking autoreconf, Invoking ifnames, Making configure Scripts
in more than one of the files that @code{autoconf} reads, the last
definition it reads overrides the earlier ones.
+@code{autoconf} accepts the following options:
+
+@table @code
+@item --help
+Print a summary of the command line options and exit.
+
+@item --macrodir=@var{dir}
@evindex AC_MACRODIR
-You can override the directory where @code{autoconf} looks for the
-installed macro files by setting the @code{AC_MACRODIR} environment
-variable to a different directory. You can also give @code{autoconf}
-the @samp{--macrodir=@var{dir}} option, which overrides @code{AC_MACRODIR}.
+Look for the installed macro files in directory @var{dir}. You can also
+set the @code{AC_MACRODIR} environment variable to a directory; this
+option overrides the environment variable.
-@code{autoconf} also accepts the options @code{--version}, which prints
-the Autoconf version number and exits, and @code{--help}, which prints a
-summary of the command-line options and exits.
+@item --version
+Print the version number of Autoconf and exit.
+@end table
@node Invoking autoreconf, , Invoking autoconf, Making configure Scripts
@section Using @code{autoreconf} to Update @file{configure} Scripts
@item --macrodir=@var{dir}
@itemx -m @var{dir}
+@evindex AC_MACRODIR
Look for the Autoconf macro files in directory @var{dir} instead of the
default installation directory.
+You can also set the @code{AC_MACRODIR}
+environment variable to a directory; this option overrides the
+environment variable.
@item --verbose
Print the name of each directory where @code{autoreconf} runs
@file{configure.in} calls @code{AC_CONFIG_HEADER}).
@item --version
-Print the version number of @code{autoreconf} and exit.
+Print the version number of Autoconf and exit.
@end table
@node Setup, Existing Tests, Making configure Scripts, Top
-@chapter Initialization and Output
+@chapter Initialization and Output Files
Autoconf-generated @code{configure} scripts need some information about
how to initialize, such as how to find the package's source files; and
@end menu
@node Input, Output, , Setup
-@section Finding Autoconf Input
+@section Finding @code{configure} Input
Every @code{configure} script must call @code{AC_INIT} before doing
anything else. The only other required macro is @code{AC_OUTPUT}
-(@pxref{Output}). Packages that do manual configuration or use the
-@code{install} program might need to tell @code{configure} where to find
-some other shell scripts by calling @code{AC_CONFIG_AUX_DIR}, though the
-default places it looks are correct for most cases.
+(@pxref{Output}).
@defmac AC_INIT (@var{unique-file-in-source-dir})
@maindex INIT
fact does (@pxref{Invoking configure}, for more information).
@end defmac
+Packages that do manual configuration or use the @code{install} program
+might need to tell @code{configure} where to find some other shell
+scripts by calling @code{AC_CONFIG_AUX_DIR}, though the default places
+it looks are correct for most cases.
+
@defmac AC_CONFIG_AUX_DIR(@var{dir})
@maindex CONFIG_AUX_DIR
-Use the @file{install.sh}, @file{config.sub}, @file{config.guess}, and
+Use the @file{install-sh}, @file{config.sub}, @file{config.guess}, and
Cygnus @file{configure} scripts that are in directory @var{dir}. These
are auxiliary files used in configuration. @var{dir} can be either
absolute or relative to @file{@var{srcdir}}. The default is
@file{@var{srcdir}} or @file{@var{srcdir}/..} or
@file{@var{srcdir}/../..}, whichever is the first that contains
-@file{install.sh}. The other files are not checked for, so that using
+@file{install-sh}. The other files are not checked for, so that using
@code{AC_PROG_INSTALL} does not automatically require distributing the
-other auxiliary files.
+other auxiliary files. It checks for @file{install.sh} also, but that
+name is obsolete because some @code{make} programs have a rule that
+creates @file{install} from it if there is no @file{Makefile}.
@end defmac
@node Output, Makefiles, Input, Setup
Create output files. The @var{file}@dots{} argument is a
whitespace-separated list of files to create; it may be empty. This
macro creates each file @file{@var{file}} by copying an input file (by
-default named @file{@var{file}.in}), substituting the variable values
-that have been selected by calling @code{AC_SUBST}. It creates the
-directory that the file is in if it doesn't exist (but not the parents
-of that directory).
+default named @file{@var{file}.in}), substituting the output variable
+values that have been selected by calling @code{AC_SUBST}
+(@pxref{Setting Variables}). It creates the directory that the file is
+in if it doesn't exist (but not the parents of that directory).
If @code{AC_CONFIG_HEADER} has been called, this macro also creates the
header file that was named as its argument (@pxref{Configuration Headers}).
@end defmac
@node Makefiles, Configuration Headers, Output, Setup
-@section Makefiles
+@section Substitutions in Makefiles
Each subdirectory in a distribution that contains something to be
compiled or installed should come with a file @file{Makefile.in}, from
@xref{Makefile Conventions, , Makefile Conventions, standards.info, The
GNU Coding Standards}, for more information on what to put in Makefiles.
+A software package that uses a @code{configure} script should be
+distributed with a file @file{Makefile.in}, but no @file{Makefile}; that
+way, the user has to properly configure the package for the local system
+before compiling it.
+
@menu
-* Predefined Variables:: Output variables that are always set.
+* Preset Variables:: Output variables that are always set.
* Object Directories:: Compiling in a different directory.
* Automatic Remaking:: Makefile rules for configuring.
@end menu
-@node Predefined Variables, Object Directories, , Makefiles
-@subsection Predefined Variables
+@node Preset Variables, Object Directories, , Makefiles
+@subsection Preset Output Variables
-Some output variables are predefined by the Autoconf macros.
+Some output variables are preset by the Autoconf macros.
@code{AC_SUBST} is called for them automatically (@pxref{Setting
Variables}), so in your @file{Makefile.in} files you can get their
values by enclosing their names in @samp{@@} characters.
@xref{Makefiles}, for more information on @samp{@@} substitutions.
@end ifinfo
The variables that are automatically defined by the Autoconf macros are
-listed here. Some of the Autoconf macros define additional variables,
+listed here. Some of the Autoconf macros set additional output variables,
which are mentioned in the descriptions for those macros. @xref{Output
Variable Index}, for a complete list of output variables.
@samp{-l} and @samp{-L} options to pass to the linker.
@end defvar
-@node Object Directories, Automatic Remaking, Predefined Variables, Makefiles
+@node Object Directories, Automatic Remaking, Preset Variables, Makefiles
@subsection Object Directories
You might want to compile a software package in a different directory
recompilation. You should include the file @file{stamp-h.in} your
package's distribution, so @code{make} will consider @file{config.h.in}
up to date. On some old BSD systems, @code{touch} does not update the
-timestamps on empty files, so use @code{echo} as a workaround.
+timestamps on empty files, so use @code{echo} or an empty command as a
+workaround.
@example
@group
some operating systems. As an alternative to passing @samp{-D} options
to the compiler, @code{configure} scripts can create a C header file
containing @samp{#define} directives. The @code{AC_CONFIG_HEADER} macro
-selects this kind of output.
+selects this kind of output. It should be called right after @code{AC_INIT}.
-If using a configuration header file, the program should include it
-before any other header files, to prevent inconsistencies in
-declarations.
+The package should @samp{#include} the configuration header file before
+any other header files, to prevent inconsistencies in declarations.
@defmac AC_CONFIG_HEADER (@var{header-to-create} @dots{})
@maindex CONFIG_HEADER
Your distribution should contain a template file that looks as you want
the final header file to look, including comments, with default values
-in the @code{#define} statements. A default value can be to
-@code{#undef} the variable instead of to define it to a value, if your
-code tests for configuration options using @code{#ifdef} instead of
-@code{#if}. For example, suppose your @file{configure.in} makes these
-calls:
+in the @code{#define} statements. For example, suppose your
+@file{configure.in} makes these calls:
@example
AC_CONFIG_HEADER(conf.h)
@end group
@end example
-Alternately, if you prefer to use @code{#ifdef}, your @file{conf.h.in}
-could have code like the following. On systems that have
-@file{unistd.h}, @code{configure} will change the second line to read
-@samp{#define HAVE_UNISTD_H 1}. On other systems, it will comment that
-line out (in case the system predefines that symbol).
+Alternately, if your code tests for configuration options using
+@code{#ifdef} instead of @code{#if}, a default value can be to
+@code{#undef} the variable instead of to define it to a value. On
+systems that have @file{unistd.h}, @code{configure} will change the
+second line to read @samp{#define HAVE_UNISTD_H 1}. On other systems,
+it will comment that line out (in case the system predefines that
+symbol).
@example
@group
@end example
@node Invoking autoheader, , Header Templates, Configuration Headers
-@section Using @code{autoheader} to Create @file{config.h.in}
+@subsection Using @code{autoheader} to Create @file{config.h.in}
The @code{autoheader} program can create a template file of C
@samp{#define} statements for @code{configure} to use. If
@code{autoheader} creates @file{@var{file}.in}. Otherwise,
@code{autoheader} creates @file{config.h.in}.
+If you give @code{autoheader} an argument, it uses that file instead of
+@file{configure.in} and writes the header file to the standard output
+instead of to @file{config.h.in}. If you give @code{autoheader} an
+argument of @samp{-}, it reads the standard input instead of
+@file{configure.in} and writes the header file to the standard output.
+
@code{autoheader} scans @file{configure.in} and figures out which C
preprocessor symbols it might define. It copies comments and
@code{#define} and @code{#undef} statements from a file called
@code{autoheader} copies them to the beginning and end, respectively, of
its output. Their use is discouraged because they have file names that
contain two periods, and so can not be stored on MS-DOS; also, they are
-two more files to clutter up the directory (@pxref{Output}, for more
-information about avoiding file names that MS-DOS cannot store).
+two more files to clutter up the directory.
-If you give @code{autoheader} an argument, it uses that file instead of
-@file{configure.in} and writes the header file to the standard output
-instead of to @file{config.h.in}. If you give @code{autoheader} an
-argument of @samp{-}, it reads the standard input instead of
-@file{configure.in} and writes the header file to the standard output.
+@code{autoheader} accepts the following options:
+
+@table @code
+@item --help
+Print a summary of the command line options and exit.
+@item --macrodir=@var{dir}
@evindex AC_MACRODIR
-You can override the directory where @code{autoheader} looks for the
-installed macro and @file{acconfig.h} files by setting the
-@code{AC_MACRODIR} environment variable to a different directory. You
-can also give @code{autoheader} the @samp{--macrodir=@var{dir}} option,
-which overrides @code{AC_MACRODIR}.
+Look for the installed macro files and @file{acconfig.h} in directory
+@var{dir}. You can also set the @code{AC_MACRODIR} environment variable
+to a directory; this option overrides the environment variable.
-@code{autoheader} also accepts the options @code{--version}, which prints
-the Autoconf version number and exits, and @code{--help}, which prints a
-summary of the command-line options and exits.
+@item --version
+Print the version number of Autoconf and exit.
+@end table
@node Subdirectories, Versions, Configuration Headers, Setup
@section Configuring Other Packages in Subdirectories
@end defmac
@node Versions, , Subdirectories, Setup
-@section Controlling Autoconf Versions
+@section Version Numbers in @code{configure}
The following macros manage version numbers for @code{configure}
-scripts. Most people don't need them.
+scripts. They are optional.
@defmac AC_PREREQ (@var{version})
@maindex PREREQ
@ovindex INSTALL_DATA
Set output variable @code{INSTALL} to the path of a BSD compatible
@code{install} program, if one is found in the current @code{PATH}.
-Otherwise, set @code{INSTALL} to @samp{@var{dir}/install.sh -c}, where
-it checks the directories specified to @code{AC_CONFIG_AUX_DIR} (or its
-default directories) to determine @var{dir} (@pxref{Output}).
+Otherwise, set @code{INSTALL} to @samp{@var{dir}/install-sh -c},
+checking the directories specified to @code{AC_CONFIG_AUX_DIR} (or its
+default directories) to determine @var{dir} (@pxref{Output}). Also set
+the variable @code{INSTALL_PROGRAM} to @samp{$@{INSTALL@}} and
+@code{INSTALL_DATA} to @samp{$@{INSTALL@} -m 644}.
This macro screens out various instances of @code{install} known to not
-work. It also sets the variable @code{INSTALL_PROGRAM} to
-@samp{$@{INSTALL@}} and @code{INSTALL_DATA} to @samp{$@{INSTALL@} -m
-644}.
-
-If you need to use your own installation program because it has features
-not found in standard @code{install} programs, there is no reason to use
-@code{AC_PROG_INSTALL}; just put the pathname of your program into your
-@file{Makefile.in} files.
+work. It prefers to find a C program rather than a shell script, for
+speed. Instead of @file{install-sh}, it can also use @file{install.sh},
+but that name is obsolete because some @code{make} programs have a rule
+that creates @file{install} from it if there is no @file{Makefile}.
+
+If you need to use your own installation program because it has
+features not found in standard @code{install} programs, there is no
+reason to use @code{AC_PROG_INSTALL}; just put the pathname of your
+program into your @file{Makefile.in} files.
@end defmac
@defmac AC_PROG_LEX
@end defmac
@node Generic Programs, , Particular Programs, Alternative Programs
-@subsection Generic Program Checking Macros
+@subsection Generic Program Checks
These macros are used to find programs not covered by the particular
test macros.
@defmac AC_PATH_PROGS (@var{variable}, @var{progs-to-check-for} @r{[}, @var{value-if-not-found}@r{]})
@maindex PATH_PROGS
Like @code{AC_CHECK_PROGS}, but if any of @var{progs-to-check-for}
-are found, set @var{variable} to the entire pathname of the program
+are found, set @var{variable} to the entire path of the program
found.
@end defmac
See whether a test C program can be linked with the library
@var{library}. @var{function} should be the name of a function that the
library contains, to force the linker to try to link with the library to
-resolve the name. @var{library} must be the base name of the library;
+resolve the name. @var{library} is the base name of the library;
e.g., to check for @samp{-lmp}, use @samp{mp} as the @var{library}
argument.
@end defmac
@node Generic Functions, , Particular Functions, Library Functions
-@subsection Generic Function Checking Macros
+@subsection Generic Function Checks
These macros are used to find functions not covered by the particular
-test macros.
+test macros. If the functions might be in libraries other than the
+default C library, first call @code{AC_CHECK_LIB} for those libraries.
@defmac AC_CHECK_FUNC (@var{function}, @var{action-if-found} @r{[}, @var{action-if-not-found}@r{]})
@maindex CHECK_FUNC
If C function @var{function} is available, run shell commands
-@var{action-if-found}, otherwise @var{action-if-not-found}. If the
-functions might be in libraries other than the default C library, first
-call @code{AC_CHECK_LIB} for those libraries. If you just want to
-define a symbol if the function is available, consider using
+@var{action-if-found}, otherwise @var{action-if-not-found}. If you just
+want to define a symbol if the function is available, consider using
@code{AC_CHECK_FUNCS} instead. This macro checks for functions with C
linkage even when @code{AC_LANG_CPLUSPLUS} has been called, since C++ is
more standardized than C is. (@pxref{Language Choice}, for more
when one of the functions is found. You can give it a value of
@samp{break} to break out of the loop on the first match. If
@var{action-if-not-found} is given, it is executed when one of the
-functions is not found. If the functions might be in libraries other
-than the default C library, first call @code{AC_CHECK_LIB} for those
-libraries.
+functions is not found.
@end defmac
@defmac AC_REPLACE_FUNCS (@var{function-name}@dots{})
@ovindex LIBOBJS
For each given @var{function-name} in the whitespace-separated argument
list that is not in the C library, add @samp{@var{function-name}.o} to
-the value of the output variable @code{LIBOBJS}. If the functions
-might be in libraries other than the default C library, first call
-@code{AC_CHECK_LIB} for those libraries.
+the value of the output variable @code{LIBOBJS}.
@end defmac
@node Header Files, Structures, Library Functions, Existing Tests
@code{NDIR}
@end table
-If the @code{closedir} function does not return a meaningful value,
-define @code{VOID_CLOSEDIR}.
+In addition, if the @code{closedir} function does not return a
+meaningful value, define @code{VOID_CLOSEDIR}.
@end defmac
@defmac AC_HEADER_DIRENT
@end defmac
@node Generic Headers, , Particular Headers, Header Files
-@subsection Generic Header Checking Macros
+@subsection Generic Header Checks
These macros are used to find system header files not covered by the
particular test macros.
@section Structures
The following macros check for certain structures or structure members.
-You can use @code{AC_TRY_LINK} (@pxref{Checking for Symbols}) to check
+You can use @code{AC_TRY_LINK} (@pxref{Checking Libraries}) to check
structures not listed here.
@defmac AC_HEADER_STAT
@code{AC_CHECK_HEADERS(sys/time.h)}.
@example
+@group
#if TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
# include <time.h>
# endif
#endif
+@end group
@end example
@end defmac
@end defmac
@node Generic Typedefs, , Particular Typedefs, Typedefs
-@subsection Generic Typedef Checking Macro
+@subsection Generic Typedef Checks
This macro is used to find types not covered by the particular test
macros.
@section Compiler Characteristics
The following macros check for C compiler or machine architecture
-features. You can use @code{AC_TRY_LINK} (@pxref{Checking for Symbols})
+features. You can use @code{AC_TRY_LINK} (@pxref{Checking Libraries})
or @code{AC_TRY_RUN} (@pxref{Run Time}) to check for
characteristics not listed here.
@defmac AC_DYNIX_SEQ
@maindex OS_DYNIX_SEQ
-If on PTX (Sequent UNIX), add @samp{-lseq} to output
+If on Dynix/PTX (Sequent UNIX), add @samp{-lseq} to output
variable @code{LIBS}. This macro is obsolete; instead, use
@code{AC_FUNC_GETMNTENT}.
@end defmac
@maindex IRIX_SUN
If on IRIX (Silicon Graphics UNIX), add @samp{-lsun} to output variable
@code{LIBS}. This macro is obsolete. If you were using it to get
-@code{getmntent}, instead, use @code{AC_FUNC_GETMNTENT}. If you used it
+@code{getmntent}, use @code{AC_FUNC_GETMNTENT} instead. If you used it
for the NIS versions of the password and group functions, use
@samp{AC_CHECK_LIB(sun, getpwnam)}.
@end defmac
ways for other macros to check whether various kinds of features are
available and report the results.
-Here are some suggestions and some of the reasons why the
+This chapter contains some suggestions and some of the reasons why the
existing tests are written the way they are. You can also learn a lot
about how to write Autoconf tests by looking at the existing ones. If
something goes wrong in one or more of the Autoconf tests, this
-information can help you understand why they work the way they do and
-the assumptions behind them, which might help you figure out how to best
-solve the problem.
+information can help you understand the assumptions behind them, which
+might help you figure out how to best solve the problem.
+
+These macros check the output of the C compiler system. They @emph{do
+not} cache the results of their tests for future use (@pxref{Caching
+Values}), because they don't know enough about the information they are
+checking for to generate a cache variable name. They also do not print
+any messages, for the same reason. The checks for particular kinds of C
+features call these macros and do cache their results and print messages
+about what they're checking for.
@menu
-* Checking for Symbols:: Finding whether a symbol is defined.
+* Checking Declarations:: Detecting header files and declarations.
+* Checking Libraries:: Detecting functions and global variables.
* Run Time:: Testing for run-time features.
* Portable Shell:: Shell script portability pitfalls.
* Testing Values and Files:: Checking strings and files.
* Language Choice:: Selecting which language to use for testing.
@end menu
-@node Checking for Symbols, Run Time, , Writing Tests
-@section Checking for Symbols
+@node Checking Declarations, Checking Libraries, , Writing Tests
+@section Checking Declarations
-These macros check the output of the C compiler system. They @emph{do
-not} cache the results of their tests for future use (@pxref{Caching
-Values}), because they don't know enough about the information they are
-checking for to generate a cache variable name. They also do not print
-any messages, for the same reason. The checks for particular kinds of C
-features call these macros and do cache their results and print messages
-about what they're checking for.
+Here is how to check whether particular header files exist.
-Autoconf checks for many features by using these macros to examine or
-compile small test programs. To find out whether a library function is
-available, Autoconf tries to compile and link a small program that uses
-it. This is unlike Larry Wall's Metaconfig, which uses @code{nm} or
-@code{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
-and flexible approach because it avoids dealing with the variations in
-the options and output formats of @code{nm} and @code{ar} and in the
-location of the standard libraries. It also allows @code{configure} to
-check aspects of the function's runtime behavior if needed. On the
-other hand, it is sometimes slower than scanning the libraries.
+@defmac AC_TRY_CPP (@var{includes}, @var{action-if-true} @r{[}, @var{action-if-false}@r{]})
+@maindex TRY_CPP
+@var{includes} is C or C++ @code{#include} statements and declarations,
+on which shell variable, backquote, and backslash substitutions are
+performed. (Actually, it can be any C program, but other statements are
+probably not useful.) If the preprocessor produces no error messages
+while processing it, run shell commands @var{action-if-true}. Otherwise
+run shell commands @var{action-if-false}.
-@defmac AC_COMPILE_CHECK (@var{echo-text}, @var{includes}, @var{function-body}, @var{action-if-found} @r{[}, @var{action-if-not-found}@r{]})
-@maindex COMPILE_CHECK
-This is an obsolete alias for @code{AC_TRY_LINK}, with the addition that it
-prints @samp{checking for @var{echo-text}} to the standard output first,
-if @var{echo-text} is non-empty.
+This macro calls @code{AC_PROG_CPP} or @code{AC_PROG_CXXCPP} (depending
+on which language is current, @pxref{Language Choice}), if it hasn't
+been called already. It uses @code{CPPFLAGS}, but not @code{CFLAGS},
+because @samp{-g}, @samp{-O}, etc. are not valid options to many C
+preprocessors.
@end defmac
+The following macros check whether header files contain particular
+symbols. You can not check whether preprocessor symbols are defined
+this way, because they get expanded before @code{egrep} sees them. But
+you can detect them by simply using @code{#ifdef} directives in your
+programs.
+
+You can also use @code{AC_EGREP_CPP} to check whether the C preprocessor
+predefines particular symbols, like this:
+
+@example
+AC_EGREP_CPP(yes,
+[#ifdef _AIX
+ yes
+#endif
+], is_aix=yes, is_aix=no)
+@end example
+
@defmac AC_EGREP_CPP (@var{pattern}, @var{program}, @var{action-if-found} @r{[}, @var{action-if-not-found}@r{]})
@maindex EGREP_CPP
@var{program} is the text of a C or C++ program, on which shell
variable, backquote, and backslash substitutions are performed. If the
-output of running the preprocessor on @var{program} contains the
+output of running the preprocessor on @var{program} matches the
@code{egrep} regular expression @var{pattern}, execute shell commands
@var{action-if-found}, otherwise execute @var{action-if-not-found}.
been called already.
@end defmac
+To find out whether a header file contains a particular symbol, use the
+following macro instead of using @code{grep} directly on the header
+file. On some systems the symbol might be defined in another header
+file that the file you are checking @samp{#include}s.
+
@defmac AC_EGREP_HEADER (@var{pattern}, @var{header-file}, @var{action-if-found} @r{[}, @var{action-if-not-found}@r{]})
@maindex EGREP_HEADER
If the output of running the preprocessor on the system header file
-@var{header-file} contains the @code{egrep} regular expression
+@var{header-file} matches the @code{egrep} regular expression
@var{pattern}, execute shell commands @var{action-if-found}, otherwise
execute @var{action-if-not-found}.
-Use this macro instead of using @code{grep} directly on a header file,
-because on some systems it might be defined in another header file that
-the file you are checking @samp{#include}s.
-
This macro calls @code{AC_PROG_CPP} or @code{AC_PROG_CXXCPP} (depending
on which language is current, @pxref{Language Choice}), if it hasn't
been called already.
@var{action-if-not-found}.
-
-You can not check whether preprocessor symbols are defined this way,
-because they get expanded before @code{egrep} sees them. But you can
-almost always detect them by simply using @code{#ifdef} directives in
-your programs.
@end defmac
-@defmac AC_TRY_CPP (@var{includes}, @var{action-if-true} @r{[}, @var{action-if-false}@r{]})
-@maindex TRY_CPP
-@var{includes} is C or C++ @code{#include} statements and declarations,
-on which shell variable, backquote, and backslash substitutions are
-performed. (Actually, it can be any C program, but other statements are
-probably not useful.) If the preprocessor produces no error messages
-while processing it, run shell commands @var{action-if-true}. Otherwise
-run shell commands @var{action-if-false}.
+@node Checking Libraries, Run Time, Checking Declarations, Writing Tests
+@section Checking Libraries
+
+Autoconf checks for many features by examining or compiling small test
+programs. To find out whether a library function is available, Autoconf
+tries to compile and link a small program that uses it. This is unlike
+Larry Wall's Metaconfig, which uses @code{nm} or @code{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 and flexible approach
+because it avoids dealing with the variations in the options and output
+formats of @code{nm} and @code{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 is
+sometimes slower than scanning the libraries.
-This macro calls @code{AC_PROG_CPP} or @code{AC_PROG_CXXCPP} (depending
-on which language is current, @pxref{Language Choice}), if it hasn't
-been called already. It uses @code{CPPFLAGS}, but not @code{CFLAGS},
-because @samp{-g}, @samp{-O}, etc. are not valid options to many C
-preprocessors.
-@end defmac
+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.
@defmac AC_TRY_LINK (@var{includes}, @var{function-body}, @var{action-if-found} @r{[}, @var{action-if-not-found}@r{]})
@maindex TRY_LINK
@var{action-if-found}, otherwise run @var{action-if-not-found}. This
macro uses @code{CFLAGS} or @code{CXXFLAGS}, @code{CPPFLAGS},
@code{LDFLAGS}, and @code{LIBS} when compiling.
+@end defmac
-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.
+@defmac AC_COMPILE_CHECK (@var{echo-text}, @var{includes}, @var{function-body}, @var{action-if-found} @r{[}, @var{action-if-not-found}@r{]})
+@maindex COMPILE_CHECK
+This is an obsolete alias for @code{AC_TRY_LINK}, with the addition that it
+prints @samp{checking for @var{echo-text}} to the standard output first,
+if @var{echo-text} is non-empty.
@end defmac
-@node Run Time, Portable Shell, Checking for Symbols, Writing Tests
+@node Run Time, Portable Shell, Checking Libraries, Writing Tests
@section Checking Run Time Behavior
-If you need to check for a condition other than whether some symbol
-exists on the system or has a certain value, then you can't use
-@code{AC_TRY_LINK} (@pxref{Checking for Symbols}). One alternative is
-to write a test program to determine the result, and compile and run it
-using @code{AC_TRY_RUN}.
+Sometimes you need to find out how a system performs at run time, such
+as whether a given function has a certain capability or bug. If you
+can, make such checks when your program runs instead of when it is
+configured. You can check for things like the machine's endianness when
+your program initializes itself.
+
+If you really need to test for a run-time behavior while configuring,
+you can write a test program to determine the result, and compile and
+run it using @code{AC_TRY_RUN}. Avoid running test programs if
+possible, because using them prevents people from configuring your
+package for cross-compiling.
+
+@menu
+* Test Programs:: Running test programs.
+* Guidelines:: General rules for writing test programs.
+* Test Functions:: Avoiding pitfalls in test programs.
+@end menu
+
+@node Test Programs, Guidelines, , Run Time
+@subsection Running Test Programs
+
+Use the following macro if you need to test run-time behavior of the
+system while configuring.
@defmac AC_TRY_RUN (@var{program}, @var{action-if-true} @r{[}, @var{action-if-false} @r{[}, @var{action-if-cross-compiling}@r{]]})
@maindex TRY_RUN
the system where @code{configure} is being run, then the test program is
not run. If the optional shell commands @var{action-if-cross-compiling}
are given, they are run instead and this macro calls @code{AC_C_CROSS}
-if it has not already been called (@pxref{Compiler Characteristics}).
-Otherwise, @code{configure} prints an error message and exits.
-@code{autoconf} prints a warning message when creating @code{configure}
-each time it encounters a call to @code{AC_TRY_RUN} with no
-@var{action-if-cross-compiling} argument given. You may ignore the
-warning, though users will not be able to configure your package for
-cross-compiling. A few of the macros distributed with Autoconf produce
-this warning message.
+if it has not already been called. Otherwise, @code{configure} prints
+an error message and exits.
@end defmac
+Try to provide a pessimistic default value to use when cross-compiling
+makes run-time tests impossible. You do this by passing the optional
+last argument to @code{AC_TRY_RUN}. @code{autoconf} prints a warning
+message when creating @code{configure} each time it encounters a call to
+@code{AC_TRY_RUN} with no @var{action-if-cross-compiling} argument
+given. You may ignore the warning, though users will not be able to
+configure your package for cross-compiling. A few of the macros
+distributed with Autoconf produce this warning message.
+
+To configure for cross-compiling you can also choose a value for those
+parameters based on the canonical system name (@pxref{Manual
+Configuration}). Alternatively, set up a test results cache file with
+the correct values for the target system (@pxref{Caching Values}).
+
To provide a default for calls of @code{AC_TRY_RUN} that are embedded in
other macros, including a few of the ones that come with Autoconf, you
can call @code{AC_C_CROSS} before running them. Then if the shell
variable @code{cross_compiling} to @samp{yes}, otherwise @samp{no}.
@end defmac
-@menu
-* Alternatives:: Approaches preferred over test programs.
-* Guidelines:: General rules for writing test programs.
-* Test Functions:: Avoiding pitfalls in test programs.
-@end menu
-
-@node Alternatives, Guidelines, , Run Time
-@subsection Alternatives to Test Programs
-
-Avoid running test programs if possible, because using them prevents
-people from configuring your package for cross-compiling. If you can,
-make the checks at run-time instead of at configure-time. You can check
-for things like the machine's endianness when your program initializes
-itself instead of when configuring it.
-
-If you still need to test for a run-time behavior while configuring, try
-to provide a default pessimistic value to use when cross-compiling
-makes run-time tests impossible. You do this by passing the optional
-last argument to @code{AC_TRY_RUN}. To configure for cross-compiling
-you can also choose a value for those parameters based on the canonical
-system name (@pxref{Manual Configuration}). Alternatively, set up a
-test results cache file with the correct values for the target system
-(@pxref{Caching Values}). But that is a quick-hack solution to the
-problem.
-
-@node Guidelines, Test Functions, Alternatives, Run Time
+@node Guidelines, Test Functions, Test Programs, Run Time
@subsection Guidelines for Test Programs
Test programs should not write anything to the standard output. They
@maindex LANG_C
Do compilation tests using @code{CC} and @code{CPP} and use extension
@file{.c} for test programs.
-
-This is the initial state.
@end defmac
@defmac AC_LANG_CPLUSPLUS
@chapter Results of Tests
Once @code{configure} has determined whether a feature exists, what can
-it do to record that information? There are three sorts of things it
-can do: set a variable in the output files, save the result in a cache
-file for future @code{configure} runs, and print a message letting the
-user know the result of the test.
+it do to record that information? There are four sorts of things it can
+do: define a C preprocessor symbol, set a variable in the output files,
+save the result in a cache file for future @code{configure} runs, and
+print a message letting the user know the result of the test.
@menu
* Defining Symbols:: Defining C preprocessor symbols.
@section Defining C Preprocessor Symbols
A common action to take in response to a feature test is to define a C
-preprocessor symbol indicating the results of the test. The two macros
-described below do that.
+preprocessor symbol indicating the results of the test. These two
+macros do that.
+
+@defmac AC_DEFINE (@var{variable} @r{[}, @var{value}@r{]})
+@maindex DEFINE
+Define C preprocessor variable @var{variable}. If @var{value} is given,
+set @var{variable} to that value (verbatim), otherwise set it to 1.
+@var{value} should not contain literal newlines, and if you are not
+using @code{AC_CONFIG_HEADER} it should not contain any @samp{#}
+characters, as @code{make} tends to eat them. To use a shell variable
+(which you need to do in order to define a value containing the
+@code{m4} quote characters @samp{[} or @samp{]}), use
+@code{AC_DEFINE_UNQUOTED} instead. The following example defines the C
+preprocessor variable @code{EQUATION} to be the string constant
+@samp{"$a > $b"}:
+
+@example
+AC_DEFINE(EQUATION, "$a > $b")
+@end example
+@end defmac
+
+@defmac AC_DEFINE_UNQUOTED (@var{variable} @r{[}, @var{value}@r{]})
+@maindex DEFINE_UNQUOTED
+Like @code{AC_DEFINE}, but three shell expansions are
+performed---once---on @var{variable} and @var{value}: variable expansion
+(@samp{$}), command substitution (@samp{`}), and backslash escaping
+(@samp{\}). Single and double quote characters in the value have no
+special meaning. Use this macro instead of @code{AC_DEFINE} when
+@var{variable} or @var{value} is a shell variable. Examples:
+
+@example
+AC_DEFINE_UNQUOTED(config_machfile, "$@{machfile@}")
+AC_DEFINE_UNQUOTED(GETGROUPS_T, $ac_cv_type_getgroups)
+AC_DEFINE_UNQUOTED($@{ac_tr_hdr@})
+@end example
+@end defmac
By default, @code{AC_OUTPUT} substitutes the symbols defined by these
macros into the output variable @code{DEFS}, which contains an option
AC_CHECK_HEADER(elf.h, AC_DEFINE(SVR4); LIBS="$LIBS -lelf")
@end example
-@defmac AC_DEFINE (@var{variable} @r{[}, @var{value}@r{]})
-@maindex DEFINE
-Define C preprocessor variable @var{variable}. If @var{value} is given,
-set @var{variable} to that value (verbatim), otherwise set it to 1.
-@var{value} should not contain literal newlines, and if you are not
-using @code{AC_CONFIG_HEADER} it should not contain any @samp{#}
-characters, as @code{make} tends to eat them. To use a shell variable
-(which you need to do in order to define a value containing the
-@code{m4} quote characters @samp{[} or @samp{]}), use
-@code{AC_DEFINE_UNQUOTED} instead.
-@end defmac
-
-@defmac AC_DEFINE_UNQUOTED (@var{variable} @r{[}, @var{value}@r{]})
-@maindex DEFINE_UNQUOTED
-Like @code{AC_DEFINE}, but three shell expansions are
-performed---once---on @var{value}: variable expansion (@samp{$}),
-command substitution (@samp{`}), and backslash escaping (@samp{\}).
-Single and double quote characters in the value have no special meaning.
-Use this macro instead of @code{AC_DEFINE} when @var{value} is a shell
-variable. For example:
-
-@example
-AC_DEFINE_UNQUOTED(config_machfile, "$@{machfile@}")
-@end example
-@end defmac
-
@node Setting Variables, Caching Values, Defining Symbols, Results
-@section Setting Variables
+@section Setting Output Variables
These macros help other macros to define variables that are used in the
@code{configure} shell script and substituted into output files. These
@defmac AC_SUBST (@var{variable})
@maindex SUBST
+Create an output variable from a shell variable.
Make @code{AC_OUTPUT} substitute the variable @var{variable} into output
files (typically one or more @file{Makefile}s). This means that
@code{AC_OUTPUT} will replace instances of @samp{@@@var{variable}@@} in
@defmac AC_SUBST_FILE (@var{variable})
@maindex SUBST_FILE
+Another way to create an output variable from a shell variable.
Make @code{AC_OUTPUT} substitute the contents of the file named by shell
variable @var{variable} into output files (typically one or more
@file{Makefile}s). This means that @code{AC_OUTPUT} will replace
on them.
These macros are all wrappers around the @code{echo} shell command.
-Other macros should rarely need to run @code{echo} directly to print
-messages for the @code{configure} user. Using these macros makes it
-easy to change how and when each kind of message is printed; such
-changes need only be made to the macro definitions, and all of the
-callers change automatically.
-
-@defmac AC_CHECKING (@var{feature-description})
-@maindex CHECKING
-This macro is similar to @code{AC_MSG_CHECKING}, except that it prints a
-newline after the @var{feature-description}. It is useful mainly to
-print a general description of the overall purpose of a group of feature
-checks, e.g.,
-
-@example
-AC_CHECKING(if stack overflow is detectable)
-@end example
-@end defmac
+@code{configure} scripts should rarely need to run @code{echo} directly
+to print messages for the user. Using these macros makes it easy to
+change how and when each kind of message is printed; such changes need
+only be made to the macro definitions, and all of the callers change
+automatically.
@defmac AC_MSG_CHECKING (@var{feature-description})
@maindex MSG_CHECKING
@samp{--quiet} or @samp{--silent} option.
@end defmac
-@defmac AC_MSG_ERROR (@var{error-description})
-@maindex MSG_ERROR
-Notify the user of an error that prevents @code{configure} from
-completing. This macro prints an error message on the standard error
-stream and exits @code{configure} with a nonzero status.
-@var{error-description} should be something like @samp{invalid value
-$HOME for \$HOME}.
-@end defmac
-
@defmac AC_MSG_RESULT (@var{result-description})
@maindex MSG_RESULT
Notify the user of the results of a check. @var{result-description} is
@samp{--quiet} or @samp{--silent} option.
@end defmac
+@defmac AC_MSG_ERROR (@var{error-description})
+@maindex MSG_ERROR
+Notify the user of an error that prevents @code{configure} from
+completing. This macro prints an error message on the standard error
+stream and exits @code{configure} with a nonzero status.
+@var{error-description} should be something like @samp{invalid value
+$HOME for \$HOME}.
+@end defmac
+
@defmac AC_MSG_WARN (@var{problem-description})
@maindex MSG_WARN
Notify the @code{configure} user of a possible problem. This macro
make hard links}.
@end defmac
+The following two macros are an obsolete alternative to
+@code{AC_MSG_CHECKING} and @code{AC_MSG_RESULT}.
+
+@defmac AC_CHECKING (@var{feature-description})
+@maindex CHECKING
+This macro is similar to @code{AC_MSG_CHECKING}, except that it prints a
+newline after the @var{feature-description}. It is useful mainly to
+print a general description of the overall purpose of a group of feature
+checks, e.g.,
+
+@example
+AC_CHECKING(if stack overflow is detectable)
+@end example
+@end defmac
+
@defmac AC_VERBOSE (@var{result-description})
@maindex VERBOSE
This macro is similar to @code{AC_MSG_RESULT}, except that it is meant
When you write a feature test that could be applicable to more than one
software package, the best thing to do is encapsulate it in a new macro.
-Here are some instructions and guidelines for doing so.
-
-If you add macros that you think would be useful to other people, or
-find problems with the distributed macros, please send electronic mail
-to @file{bug-gnu-utils@@prep.ai.mit.edu}, so we can consider them for
-future releases of Autoconf. Please include the Autoconf version
-number, which you can get by running @samp{autoconf --version}.
+Here are some instructions and guidelines for writing Autoconf macros.
@menu
* Macro Format:: Basic format of an Autoconf macro.
@section Macro Format
@maindex DEFUN
-Autoconf macros are defined as arguments to the @code{AC_DEFUN} macro,
-which is similar to the @code{m4} builtin @code{define} macro. In
-addition to defining the macro, @code{AC_DEFUN} adds some code to the
-macro which is used to constrain the order in which macros are called
-(@pxref{Prerequisite Macros}).
+Autoconf macros are defined using the @code{AC_DEFUN} macro, which is
+similar to the @code{m4} builtin @code{define} macro. In addition to
+defining a macro, @code{AC_DEFUN} adds to it some code which is used to
+constrain the order in which macros are called (@pxref{Prerequisite
+Macros}).
An Autoconf macro definition looks like this:
Header files.
@item LIB
C libraries.
-@item OS
-Quirks of particular operating systems.
@item PATH
The full path names to files, including programs.
@item PROG
that it has been called.
@end defmac
-An obsolete alternative to using @code{AC_DEFUN} is to use @code{define}
-and call @code{AC_PROVIDE}:
+An alternative to using @code{AC_DEFUN} is to use @code{define} and call
+@code{AC_PROVIDE}. Because this technique does not prevent nested
+messages, it is considered obsolete.
@defmac AC_PROVIDE (@var{this-macro-name})
@maindex PROVIDE
macros that run the C compiler. Many of these dependencies are noted in
the documentation.
-Autoconf provides a way to warn users when macros with this kind of
-dependency appear out of order in a @file{configure.in} file. The
-warning occurs when creating @file{configure} from @file{configure.in},
-not when running @file{configure}.
-The @code{AC_BEFORE} macro causes @code{m4} to print a warning message
-on the standard error output when a macro is used before another macro
-which might change its behavior. The macro which should come first
-should contain a call to @code{AC_BEFORE}.
-
-For example, @code{AC_AIX} contains
+Autoconf provides the @code{AC_BEFORE} macro to warn users when macros
+with this kind of dependency appear out of order in a
+@file{configure.in} file. The warning occurs when creating
+@file{configure} from @file{configure.in}, not when running
+@file{configure}.
+For example, @code{AC_PROG_CPP} checks whether the C compiler
+can run the C preprocessor when given the @samp{-E} option. It should
+therefore be called after any macros that change which C compiler is
+being used, such as @code{AC_PROG_CC}. So @code{AC_PROG_CC} contains:
@example
-AC_BEFORE([$0], [AC_TRY_LINK])
+AC_BEFORE([$0], [AC_PROG_CPP])dnl
@end example
@noindent
-As a result, if @code{AC_AIX} is called after @code{AC_TRY_LINK},
-it will note that @code{AC_TRY_LINK} has already been called and
-print a warning message.
+This warns the user if a call to @code{AC_PROG_CPP} has already occurred
+when @code{AC_PROG_CC} is called.
@defmac AC_BEFORE (@var{this-macro-name}, @var{called-macro-name})
@maindex BEFORE
macro @var{called-macro-name} must have been defined using
@code{AC_DEFUN} or else contain a call to @code{AC_PROVIDE} to indicate
that it has been called.
-
-This macro should be used when one macro makes changes that might affect
-another macro, so that the other macro should probably not be called
-first. For example, @code{AC_PROG_CPP} checks whether the C compiler
-can run the C preprocessor when given the @samp{-E} option. It should
-therefore be called after any macros that change which C compiler is
-being used, such as @code{AC_PROG_CC}. So @code{AC_PROG_CC} contains:
-
-@example
-AC_BEFORE([$0], [AC_PROG_CPP])dnl
-@end example
-
-@noindent
-This warns the user if a call to @code{AC_PROG_CPP} has already occurred
-when @code{AC_PROG_CC} is called.
@end defmac
@node Obsolete Macros, , Suggested Ordering, Dependencies Between Macros
ad-hoc approaches are systematized. This process has occurred in many
parts of Autoconf. One result is that some of the macros are now
considered @dfn{obsolete}; they still work, but are no longer considered
-the best thing to do. Autoconf has a way to warn users producing
-@code{configure} scripts when they use obsolete macros, to encourage
-them to modernize.
+the best thing to do. Autoconf provides the @code{AC_OBSOLETE} macro to
+warn users producing @code{configure} scripts when they use obsolete
+macros, to encourage them to modernize. A sample call is:
+
+@example
+AC_OBSOLETE([$0], [; use AC_CHECK_HEADERS(unistd.h) instead])dnl
+@end example
@defmac AC_OBSOLETE (@var{this-macro-name} @r{[}, @var{suggestion}@r{]})
@maindex OBSOLETE
Make @code{m4} print a message on the standard error output warning that
@var{this-macro-name} is obsolete, and giving the file and line number
where it was called. @var{this-macro-name} should be the name of the
-macro that is calling @code{AC_BEFORE}. If @var{suggestion} is given,
+macro that is calling @code{AC_OBSOLETE}. If @var{suggestion} is given,
it is printed at the end of the warning message; for example, it can be
a suggestion for what to use instead of @var{this-macro-name}.
-
-A sample call is:
-
-@example
-AC_OBSOLETE([$0], [; use AC_CHECK_HEADERS(unistd.h) instead])dnl
-@end example
@end defmac
@node Manual Configuration, Site Configuration, Writing Macros, Top
@chapter Manual Configuration
-Some kinds of features can't be guessed automatically by running test
-programs. For example, how to allocate a pseudo tty, or the details of
-the object file format, or special options that need to be passed to the
-compiler or linker to provide a POSIX or ANSI C environment. It is
+A few kinds of features can't be guessed automatically by running test
+programs. For example, the details of the object file format, or
+special options that need to be passed to the compiler or linker. It is
possible to check for such features using ad-hoc means, such as having
@code{configure} check the output of the @code{uname} program, or
looking for libraries that are unique to particular systems. However,
types default to the host type if it is given and they are not. If you
are cross-compiling, you still have to specify the names of the
cross-tools you use, in particular the C compiler, on the
-@code{configure} and @code{make} command lines, e.g.,
+@code{configure} command line, e.g.,
@example
-CC=m68k-coff-gcc configure --target=m68k-coff; CC=m68k-coff-gcc make
+CC=m68k-coff-gcc configure --target=m68k-coff
@end example
@code{configure} recognizes short aliases for many system types; for
@code{configure} ignores any @samp{--host}, @samp{--target}, and
@samp{--build} options given to it.
+@defmac AC_CANONICAL_SYSTEM
+@maindex CANONICAL_SYSTEM
+Determine the system type and set output variables to the names of the
+canonical system types.
+@end defmac
+
@defmac AC_CANONICAL_HOST
@maindex CANONICAL_HOST
Perform only the subset of @code{AC_CANONICAL_SYSTEM} relevant to the
a compiler toolchain.
@end defmac
-@defmac AC_CANONICAL_SYSTEM
-@maindex CANONICAL_SYSTEM
-Set output variables to the names of the canonical system
-types.
-@end defmac
-
@node System Name Variables, Using System Type, Canonicalizing, Manual Configuration
@section System Name Variables
-After calling @code{AC_CANONICAL_SYSTEM} or @code{AC_CANONICAL_HOST},
-the output variables that contain the system type information are:
+After calling @code{AC_CANONICAL_SYSTEM}, the following output variables
+contain the system type information. After @code{AC_CANONICAL_HOST},
+only the @code{host} variables below are set.
@table @code
@ovindex build
@end example
@node Site Defaults, , Transforming Names, Site Configuration
-@section Site Defaults
+@section Setting Site Defaults
-Autoconf-generated @code{configure} scripts allow a site to provide
-default values for some configuration values, both on all of your
-systems and separately for each architecture. You do this by creating
+Autoconf-generated @code{configure} scripts allow your site to provide
+default values for some configuration values. You do this by creating
site- and system-wide initialization files.
@evindex CONFIG_SITE
@node Invoking configure, Invoking config.status, Site Configuration, Top
@chapter Running @code{configure} Scripts
-A software package that uses a @code{configure} script
-should be distributed with a file @file{Makefile.in}, but no
-@file{Makefile}; that way, the user has to properly configure the
-package for the local system before compiling it.
Below are instructions on how to configure a package that uses a
@code{configure} script, suitable for inclusion as an @file{INSTALL}
file in the package.
@node Concerns, Upgrading, Invoking config.status, Top
@chapter Concerns About Autoconf
-Several concerns about Autoconf come up regularly. Here some of them
+Several concerns about Autoconf come up occasionally. Here some of them
are addressed.
@menu
@item --macrodir=@var{dir}
@itemx -m @var{dir}
+@evindex AC_MACRODIR
Look for the Autoconf macro files in directory @var{dir} instead of the
default installation directory.
+You can also set the @code{AC_MACRODIR}
+environment variable to a directory; this option overrides the
+environment variable.
@item --version
Print the version number of @code{autoupdate} and exit.
advantage of some new features.
If you were doing tricky things with undocumented Autoconf internals
-(diversions, macros, variables), check whether you need to change
+(macros, variables, diversions), check whether you need to change
anything to account for changes that have been made. Perhaps you can
even use an officially supported technique in version 2 instead of
kludging. Or perhaps not.
-To speed up your locally written feature tests, add caching to them. If
-you don't encapsulate your tests into macros, do so; don't be sloppy.
-(I've been guilty myself.) @xref{Caching Values}.
+To speed up your locally written feature tests, add caching to them.
+See whether any of your tests are of general enough usefulness to
+encapsulate into macros that you can share.
@node History, Old Macro Names, Upgrading, Top
@chapter History of Autoconf
a tool for generating them that I could send him. No, I thought, but
I should! So I started to work out how to generate them. And the
journey from the slavery of hand-written @file{configure} scripts to the
-freedom of Autoconf began.
+abundance and ease of Autoconf began.
Cygnus @code{configure}, which was being developed at around that time,
is table driven; it is meant to deal mainly with a discrete number of
Karl Berry, who got Autoconf to configure @TeX{} and added the
macro index to the documentation; and Ian Taylor, who added support for
creating a C header file as an alternative to putting @samp{-D} options
-in a @file{Makefile}, so he could use Autoconf in his UUCP package. The
+in a @file{Makefile}, so he could use Autoconf for his UUCP package. The
alpha testers cheerfully adjusted their files again and again as the
names and calling conventions of the Autoconf macros changed from
release to release. They all contributed many specific checks, great
environment. Using a Bourne-compatible shell, you can do that on the
command line like this:
@example
-CC=c89 CFLAGS=-O2 CPPFLAGS=-I/usr/local/include LDFLAGS=-s LIBS=-lposix ./configure
+CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
@end example
@noindent
Or on systems that have the @code{env} program, you can do it like this:
@example
-env CC=c89 CFLAGS=-O2 CPPFLAGS=-I/usr/local/include LDFLAGS=-s LIBS=-lposix ./configure
+env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
@end example
@node Build Directory
environment. Using a Bourne-compatible shell, you can do that on the
command line like this:
@example
-CC=c89 CFLAGS=-O2 CPPFLAGS=-I/usr/local/include LDFLAGS=-s LIBS=-lposix ./configure
+CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
@end example
@noindent
Or on systems that have the @code{env} program, you can do it like this:
@example
-env CC=c89 CFLAGS=-O2 CPPFLAGS=-I/usr/local/include LDFLAGS=-s LIBS=-lposix ./configure
+env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
@end example
@node Build Directory
divert(-1)dnl Throw away output until AC_INIT is called.
changequote([, ])
-define(AC_ACVERSION, 1.115)
+define(AC_ACVERSION, 1.116)
dnl Some old m4's don't support m4exit. But they provide
dnl equivalent functionality by core dumping because of the
dnl AC_INIT_PARSE_ARGS()
AC_DEFUN(AC_INIT_PARSE_ARGS,
-[# Save the original args to write them into config.status later.
-configure_args="[$]@"
-
+[
# Omit some internal or obsolete options to make the list less imposing.
changequote(, )dnl
ac_usage="Usage: configure [options] [host]
running configure, to aid debugging if configure makes a mistake.
" 1>&AC_FD_CC
-ac_configure_temp="$configure_args"
# Strip out --no-create and --no-recursion so they do not pile up.
# Also quote any args containing spaces.
-configure_args=
-for ac_arg in $ac_configure_temp; do
+ac_configure_args=
+for ac_arg
+do
case "$ac_arg" in
-no-create | --no-create | --no-creat | --no-crea | --no-cre \
| --no-cr | --no-c) ;;
-no-recursion | --no-recursion | --no-recursio | --no-recursi \
| --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
changequote(, )dnl
- *[" "]*) configure_args="$configure_args '$ac_arg'" ;;
+ *[" "]*) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
changequote([, ])dnl
- *) configure_args="$configure_args $ac_arg" ;;
+ *) ac_configure_args="$ac_configure_args $ac_arg" ;;
esac
done
dnl ### Canonicalizing the system type
-dnl Find install.sh, config.sub, config.guess, and Cygnus configure
+dnl Find install-sh, config.sub, config.guess, and Cygnus configure
dnl in directory DIR. These are auxiliary files used in configuration.
dnl DIR can be either absolute or relative to ${srcdir}.
dnl AC_CONFIG_AUX_DIR(DIR)
dnl Internal subroutine.
dnl Search for the configuration auxiliary files in directory list $1.
-dnl We look only for install.sh, so users of AC_PROG_INSTALL
+dnl We look only for install-sh, so users of AC_PROG_INSTALL
dnl do not automatically need to distribute the other auxiliary files.
dnl AC_CONFIG_AUX_DIRS(DIR ...)
AC_DEFUN(AC_CONFIG_AUX_DIRS,
[ac_aux_dir=
for ac_dir in $1; do
- if test -f $ac_dir/install.sh; then
- ac_aux_dir=$ac_dir; break
+ if test -f $ac_dir/install-sh; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="${ac_aux_dir}/install-sh -c"
+ break
+ elif test -f $ac_dir/install.sh; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="${ac_aux_dir}/install.sh -c"
+ break
fi
done
if test -z "$ac_aux_dir"; then
- AC_MSG_ERROR([can not find install.sh in $1])
+ AC_MSG_ERROR([can not find install-sh or install.sh in $1])
fi
ac_config_guess=${ac_aux_dir}/config.guess
ac_config_sub=${ac_aux_dir}/config.sub
ac_configure=${ac_aux_dir}/configure # This should be Cygnus configure.
-ac_install_sh="${ac_aux_dir}/install.sh -c"
AC_PROVIDE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
])
dnl so uname gets run too.
# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
#
-[#] [$]0 [$]configure_args
+[#] [$]0 [$]ac_configure_args
#
# Compiler output produced by configure, useful for debugging
# configure, is in ./config.log if it exists.
do
case "[\$]ac_option" in
-recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
- echo running [\$]{CONFIG_SHELL-/bin/sh} [$]0 [$]configure_args --no-create --no-recursion
- exec [\$]{CONFIG_SHELL-/bin/sh} [$]0 [$]configure_args --no-create --no-recursion ;;
+ echo "running [\$]{CONFIG_SHELL-/bin/sh} [$]0 [$]ac_configure_args --no-create --no-recursion"
+ exec [\$]{CONFIG_SHELL-/bin/sh} [$]0 [$]ac_configure_args --no-create --no-recursion ;;
-version | --version | --versio | --versi | --vers | --ver | --ve | --v)
echo "${CONFIG_STATUS} generated by autoconf version AC_ACVERSION"
exit 0 ;;
# Remove --cache-file and --srcdir arguments so they do not pile up.
ac_sub_configure_args=
ac_prev=
- for ac_arg in $configure_args; do
+ for ac_arg in $ac_configure_args; do
if test -n "$ac_prev"; then
ac_prev=
continue
esac
echo "[running ${CONFIG_SHELL-/bin/sh} ${ac_sub_configure} ${ac_sub_configure_args} --cache-file=$ac_sub_cache_file] --srcdir=${ac_sub_srcdir}"
- if ${CONFIG_SHELL-/bin/sh} ${ac_sub_configure} ${ac_sub_configure_args} --cache-file=$ac_sub_cache_file --srcdir=${ac_sub_srcdir}
+ # The eval makes quoting arguments work.
+ if eval ${CONFIG_SHELL-/bin/sh} ${ac_sub_configure} ${ac_sub_configure_args} --cache-file=$ac_sub_cache_file --srcdir=${ac_sub_srcdir}
then :
else
AC_MSG_ERROR(${ac_sub_configure} failed for ${ac_config_dir})
])
AC_DEFUN(AC_FUNC_GETMNTENT,
-[# getmntent is in -lsun on Irix 4, -lseq on PTX.
-AC_CHECK_LIB(sun, getmntent, LIBS="$LIBS -lsun")
-AC_CHECK_LIB(seq, getmntent, LIBS="$LIBS -lseq")
+[# getmntent is in -lsun on Irix 4, -lseq on Dynix/PTX.
+AC_CHECK_LIB(sun, getmntent, LIBS="$LIBS -lsun",
+ [AC_CHECK_LIB(seq, getmntent, LIBS="$LIBS -lseq")])
AC_CHECK_FUNC(getmntent, [AC_DEFINE(HAVE_GETMNTENT)])])
AC_DEFUN(AC_FUNC_STRFTIME,