ln $$file $$distname/$$file \
|| { echo copying $$file instead; cp -p $$file $$distname/$$file;}; \
done; \
- chmod -R a+rX $$distname; \
+ chmod -R a+rwX $$distname; \
tar -chz -f $$distname.tar.gz $$distname; \
rm -fr $$distname
* AC_CACHE_VAL to share results of tests between configure runs.
* AC_DEFUN to define macros, automatically AC_PROVIDE them, and ensure
that macros invoked with AC_REQUIRE don't interrupt other macros.
-* AC_CONFIG_AUX_DIR, AC_CANONICAL_SYSTEM, AC_LINK_FILES to
+* AC_CONFIG_AUX_DIR, AC_CANONICAL_SYSTEM, AC_CANONICAL_HOST, AC_LINK_FILES to
support deciding unguessable features based on the host and target types.
* AC_CONFIG_SUBDIRS to recursively configure a source tree.
* AC_CHECK_TYPE, which checks whether sys/types.h defines a given type.
* AC_SUBST_FILE, to insert one file into another.
** Changed macros:
-* Many macros renamed, but old names are accepted for backward compatibility.
+* Many macros renamed systematically, but old names are accepted for
+ backward compatibility.
* AC_OUTPUT adds the "automatically generated" comment after "#!" lines,
not before them.
* AC_OUTPUT does not replace "prefix" and "exec_prefix" in generated
files when they are not enclosed in @ signs.
* AC_OUTPUT allows the optional environment variable CONFIG_STATUS to
override the file name "config.status".
+* AC_OUTPUT takes an optional argument for passing variables from
+ configure to config.status.
* AC_OUTPUT and AC_CONFIG_HEADER allow you to override the input-file names.
* AC_OUTPUT automatically substitutes the values of CFLAGS, CXXFLAGS,
CPPFLAGS, and LDFLAGS from the environment, with default values.
------------------------------------------------------------------------------
+* Doc: Centralize information on POSIX, MS-DOS, cross-compiling, and
+ other important topics.
+
+------------------------------------------------------------------------------
+
* Split up AC_SUBST substitutions using a loop to accomodate shells
with severely limited here document sizes, if it turns out to be a problem.
I'm not sure whether the limit is on lines or bytes; if bytes, it
divert(-1)dnl Throw away output until AC_INIT is called.
changequote([, ])
-define(AC_ACVERSION, 1.110)
+define(AC_ACVERSION, 1.111)
dnl Some old m4's don't support m4exit. But they provide
dnl equivalent functionality by core dumping because of the
host=NONE
no_create=
nonopt=NONE
-norecursion=
+no_recursion=
prefix=NONE
program_prefix=
program_suffix=
| --no-cr | --no-c)
no_create=yes ;;
- -norecursion | --norecursion | --norecursio | --norecursi \
- | --norecurs | --norecur | --norecu | --norec | --nore | --nor)
- norecursion=yes ;;
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+ no_recursion=yes ;;
-prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
ac_prev=prefix ;;
dnl AC_INIT_PREPARE(UNIQUE-FILE-IN-SOURCE-DIR)
AC_DEFUN(AC_INIT_PREPARE,
[trap 'rm -fr conftest* confdefs* core $ac_clean_files; exit 1' 1 2 15
-trap 'rm -fr confdefs* $ac_clean_files' 0
# File descriptor usage:
# 0 unused; standard input
# Save the original args if we used an alternate arg parser.
ac_configure_temp="${configure_args-[$]@}"
-# Strip out --no-create and --norecursion so they do not pile up.
+# 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
case "$ac_arg" in
-no-create | --no-create | --no-creat | --no-crea | --no-cre \
| --no-cr | --no-c) ;;
- -norecursion | --norecursion | --norecursio | --norecursi \
- | --norecurs | --norecur | --norecu | --norec | --nore | --nor) ;;
+ -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'" ;;
changequote([, ])dnl
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
# scripts and configure runs. It is not useful on other systems.
-# If its contents are invalid for some reason, you may delete or edit it.
+# If it contains results you don't want to keep, you may remove or edit it.
#
# By default, configure uses ./config.cache as the cache file,
# creating it if it does not exist already. You can give configure
#include "confdefs.h"
[$1]
EOF
-dnl Capture the stderr of cpp.
-dnl eval is necessary to expand ac_cpp.
-dnl Ultrix and Pyramid sh refuse to redirect output of eval, so use subshell.
-dnl Coherent sh does redirections in the wrong order, so separate them.
-# Note: sh -x echos commands on subshell stderr, making this test fail.
-ac_err=`(eval "$ac_cpp conftest.${ac_ext} >/dev/null") 2>&1`
+dnl Capture the stderr of cpp. eval is necessary to expand ac_cpp.
+dnl We used to copy stderr to stdout and capture it in a variable, but
+dnl that breaks under sh -x.
+eval "$ac_cpp conftest.${ac_ext} >/dev/null 2>conftest.out"
+ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
ifelse([$2], , :, [rm -rf conftest*
$2])
do
case "[\$]ac_option" in
-recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
- echo running [\$]{CONFIG_SHELL-/bin/sh} [$]0 [$]configure_args --no-create --norecursion
- exec [\$]{CONFIG_SHELL-/bin/sh} [$]0 [$]configure_args --no-create --norecursion ;;
+ 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 ;;
-version | --version | --versio | --versi | --vers | --ver | --ve | --v)
echo "${CONFIG_STATUS} generated by autoconf version AC_ACVERSION"
exit 0 ;;
exit 0
EOF
chmod +x ${CONFIG_STATUS}
+rm -fr confdefs* $ac_clean_files
test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} ${CONFIG_STATUS}
dnl config.status should not do recursion.
ifdef([AC_LIST_SUBDIRS], [AC_OUTPUT_SUBDIRS(AC_LIST_SUBDIRS)])dnl
])dnl
-dnl
+
dnl This is a subroutine of AC_OUTPUT.
+dnl It is called inside configure, outside of config.status.
dnl AC_OUTPUT_MAKE_DEFS()
AC_DEFUN(AC_OUTPUT_MAKE_DEFS,
[# Transform confdefs.h into DEFS.
EOF
DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '`
rm -f conftest.defs
-])dnl
-dnl
+])
+
dnl This is a subroutine of AC_OUTPUT. It is called inside an unquoted
dnl here document whose contents are going into config.status.
dnl AC_OUTPUT_FILES(FILE...)
" -f conftest.subs $ac_given_srcdir/$ac_file_in > $ac_file
fi; done
rm -f conftest.subs
-])dnl
-dnl
+])
+
dnl This is a subroutine of AC_OUTPUT. It is called inside a quoted
dnl here document whose contents are going into config.status.
dnl AC_OUTPUT_HEADER(HEADER-FILE...)
done
rm -f conftest.vals
-# Now back to your regularly scheduled config.status.
+dnl Now back to your regularly scheduled config.status.
cat >> ${CONFIG_STATUS} <<\EOF
rm -f conftest.frag conftest.h
echo "/* $ac_file. Generated automatically by configure. */" > conftest.h
fi
fi; done
-])dnl
-dnl
+])
+
dnl This is a subroutine of AC_OUTPUT. It is called inside a quoted
dnl here document whose contents are going into config.status.
dnl AC_OUTPUT_LINKS(DEST..., SOURCE...)
[EOF
cat >> ${CONFIG_STATUS} <<EOF
-ac_links="$1"
-ac_files="$2"
+ac_dests="$1"
+ac_sources="$2"
EOF
cat >> ${CONFIG_STATUS} <<\EOF
-while test -n "${ac_files}"; do
- set ${ac_links}; ac_link=[$]1; shift; ac_links=[$]*
- set ${ac_files}; ac_file=[$]1; shift; ac_files=[$]*
+srcdir=$ac_given_srcdir
+while test -n "${ac_sources}"; do
+ set ${ac_dests}; ac_dest=[$]1; shift; ac_dests=[$]*
+ set ${ac_sources}; ac_source=[$]1; shift; ac_sources=[$]*
- echo "linking ${ac_link} to ${srcdir}/${ac_file}"
+ echo "linking ${ac_dest} to ${srcdir}/${ac_source}"
- if test ! -r ${srcdir}/${ac_file}; then
- AC_MSG_ERROR(${srcdir}/${ac_file}: File not found)
+ if test ! -r ${srcdir}/${ac_source}; then
+ AC_MSG_ERROR(${srcdir}/${ac_source}: File not found)
fi
- rm -f ${ac_link}
+ rm -f ${ac_dest}
# Make a symlink if possible; otherwise try a hard link.
- if ln -s ${srcdir}/${ac_file} ${ac_link} 2>/dev/null ||
- ln ${srcdir}/${ac_file} ${ac_link}; then :
+ if ln -s ${srcdir}/${ac_source} ${ac_dest} 2>/dev/null ||
+ ln ${srcdir}/${ac_source} ${ac_dest}; then :
else
- AC_MSG_ERROR(can not link ${ac_link} to ${srcdir}/${ac_file})
+ AC_MSG_ERROR(can not link ${ac_dest} to ${srcdir}/${ac_source})
fi
done
-])dnl
-dnl
+])
+
dnl AC_OUTPUT_SUBDIRS(DIRECTORY...)
AC_DEFUN(AC_OUTPUT_SUBDIRS,
[
-if test "${norecursion}" != yes; then
+if test "${no_recursion}" != yes; then
# Remove --cache-file and --srcdir arguments so they do not pile up.
ac_sub_configure_args=
AC_DEFUN(AC_PROG_RANLIB,
[AC_CHECK_PROG(RANLIB, ranlib, ranlib, :)])
+dnl Check for mawk first since it's said to be faster.
AC_DEFUN(AC_PROG_AWK,
[AC_CHECK_PROGS(AWK, mawk gawk nawk awk, )])
case "$ac_dir" in
''|.|/etc|/usr/sbin|/usr/etc|/sbin|/usr/afsws/bin|/usr/ucb) ;;
*)
- # OSF1 and SCO ODT 3.0 have their own names for install.
- for ac_prog in ginstall installbsd scoinst install; do
+ # OSF1, X11, and SCO ODT 3.0 have their own names for install.
+ for ac_prog in ginstall installbsd bsdinst scoinst install; do
if test -f $ac_dir/$ac_prog; then
if test $ac_prog = install &&
grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
[ac_header_dir=no
AC_CHECK_HEADERS(dirent.h sys/ndir.h sys/dir.h ndir.h,
[ac_header_dir=$ac_hdr; break])
+])
+AC_DEFUN(AC_FUNC_CLOSEDIR_VOID,
+[AC_REQUIRE([AC_HEADER_DIRENT])dnl
AC_MSG_CHECKING(whether closedir returns void)
AC_CACHE_VAL(ac_cv_func_closedir_void,
[AC_TRY_RUN([#include <sys/types.h>
exit(1);
exit(0);
}
-], ac_cv_func_mmap=yes, ac_cv_func_mmap=no)])dnl
+], ac_cv_func_mmap=yes, ac_cv_func_mmap=no, ac_cv_func_mmap=no)])dnl
AC_MSG_RESULT($ac_cv_func_mmap)
if test $ac_cv_func_mmap = yes; then
AC_DEFINE(HAVE_MMAP)
|| fstat(fileno(stdout), &st) != 0
);
}
-}], ac_cv_func_vfork=yes, ac_cv_func_vfork=no)])dnl
+}], ac_cv_func_vfork=yes, ac_cv_func_vfork=no, ac_cv_func_vfork=no)])dnl
AC_MSG_RESULT($ac_cv_func_vfork)
if test $ac_cv_func_vfork = no; then
AC_DEFINE(vfork, fork)
exit(r.ru_nvcsw == 0
&& r.ru_stime.tv_sec == 0 && r.ru_stime.tv_usec == 0);
}
-}], ac_cv_func_wait3=yes, ac_cv_func_wait3=no)])dnl
+}], ac_cv_func_wait3=yes, ac_cv_func_wait3=no, ac_cv_func_wait3=no)])dnl
AC_MSG_RESULT($ac_cv_func_wait3)
if test $ac_cv_func_wait3 = yes; then
AC_DEFINE(HAVE_WAIT3)
fi
])dnl
+dnl FIXME two bugs here:
+dnl Hardwiring the path of getloadavg.c in the top-level directory,
+dnl and not checking whether a getloadavg from a library needs privileges.
AC_MSG_CHECKING(whether getloadavg requires setgid)
AC_CACHE_VAL(ac_cv_func_getloadavg_setgid,
[AC_EGREP_CPP([Yowza Am I SETGID yet],
exit(!(stat ("conftestdata", &s) == 0 && utime("conftestdata", (long *)0) == 0
&& stat("conftestdata", &t) == 0 && t.st_mtime >= s.st_mtime
&& t.st_mtime - s.st_mtime < 120));
-}], ac_cv_func_utime_null=yes, ac_cv_func_utime_null=no)
+}], ac_cv_func_utime_null=yes, ac_cv_func_utime_null=no,
+ ac_cv_func_utime_null=no)
rm -f core])dnl
AC_MSG_RESULT($ac_cv_func_utime_null)
if test $ac_cv_func_utime_null = yes; then
exit (strcoll ("abc", "def") >= 0 ||
strcoll ("ABC", "DEF") >= 0 ||
strcoll ("123", "456") >= 0);
-}], ac_cv_func_strcoll=yes, ac_cv_func_strcoll=no)])dnl
+}], ac_cv_func_strcoll=yes, ac_cv_func_strcoll=no, ac_cv_func_strcoll=no)])dnl
AC_MSG_RESULT($ac_cv_func_strcoll)
if test $ac_cv_func_strcoll = yes; then
AC_DEFINE(HAVE_STRCOLL)
# --without-x overrides everything else, but does not touch the cache.
AC_MSG_CHECKING(for X)
+AC_ARG_WITH(x, [ --with-x use the X Window System])
if test "x$with_x" = xno; then
no_x=yes
else
@c @setchapternewpage odd
@c %**end of header
-@set EDITION 1.110
-@set VERSION 1.110
-@set UPDATED August 1994
+@set EDITION 1.111
+@set VERSION 1.111
+@set UPDATED September 1994
@iftex
@finalout
@ifinfo
@format
START-INFO-DIR-ENTRY
-* autoconf: (autoconf). The Autoconf configuration system.
+* Autoconf: (autoconf). Create source code configuration scripts.
END-INFO-DIR-ENTRY
@end format
Test Programs
+* Alternatives:: Approaches preferred over test programs.
* Guidelines:: General rules for writing test programs.
* Test Functions:: Special ways to work around problems.
have Autoconf.
The configuration scripts produced by Autoconf require no manual user
-intervention when run; they do not normally even take an argument
+intervention when run; they do not normally even need an argument
specifying the system type. Instead, they test for the presence of each
feature that the software package they are for might need individually.
(Before each check, they print a one-line message stating what they are
of each variant of UNIX.
For each software package that Autoconf is used with, it creates a
-configuration script from a template file that lists the operating
-system features that the package can use. After the shell code to
-recognize and respond to an operating system feature has been written,
+configuration script from a template file that lists the
+system features that the package needs or can use. After the shell code to
+recognize and respond to a system feature has been written,
Autoconf allows it to be shared by many software packages that can
use (or need) that feature. If it later turns out that the shell code
needs adjustment for some reason, it needs to be changed in only one
-place; all of the the configuration scripts can be regenerated
+place; all of the configuration scripts can be regenerated
automatically to take advantage of the updated code.
Larry Wall's Metaconfig package is similar in purpose to Autoconf, but
@end example
@node Invoking autoconf, Invoking autoheader, Writing configure.in, Making configure Scripts
-@section Invoking @code{autoconf}
+@section Using @code{autoconf} to Create @file{configure}
To create @code{configure} from @file{configure.in}, run the
@code{autoconf} program with no arguments. @code{autoconf} processes
looks for the optional file @file{acsite.m4} in the directory that
contains the distributed Autoconf macro files, and for the optional file
@file{aclocal.m4} in the current directory. Those files can contain
-your site's own locally written Autoconf macro definitions
+your site's or the package's own Autoconf macro definitions
(@pxref{Writing Macros}, for more information). If a macro is defined
in more than one of the files that @code{autoconf} reads, the last
definition it reads overrides the earlier ones.
summary of the command-line options and exits.
@node Invoking autoheader, Invoking autoscan, Invoking autoconf, Making configure Scripts
-@section Invoking @code{autoheader}
+@section Using @code{autoheader} to Create @file{config.h.in}
You can use the @code{autoheader} program to create a template file of C
@samp{#define} statements for @code{configure} to use. By default, the
@code{#define} and @code{#undef} statements from a file called
@file{acconfig.h}, which comes with and is installed with Autoconf. It
also uses a file called @file{acconfig.h} in the current directory, if
-present; you must create that file to contain entries for any additional
-symbols that you @code{AC_DEFINE}. For symbols defined by
+present. If you @code{AC_DEFINE} any additional symbols, you must
+create that file with entries for them. For symbols defined by
@code{AC_CHECK_HEADERS}, @code{AC_CHECK_FUNCS}, @code{AC_CHECK_SIZEOF},
-or @code{AC_CHECK_LIB},
-@code{autoheader} generates comments and @code{#undef} statements itself
-rather than copying them from a file, since the possible symbols are
-effectively limitless.
+or @code{AC_CHECK_LIB}, @code{autoheader} generates comments and
+@code{#undef} statements itself rather than copying them from a file,
+since the possible symbols are effectively limitless.
The file that @code{autoheader} creates contains mainly @code{#define}
and @code{#undef} statements and their accompanying comments. If
@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.
+two more files to clutter up the directory. (@pxref{Output}, for more
+information about avoiding file names that MS-DOS cannot store.)
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
summary of the command-line options and exits.
@node Invoking autoscan, Invoking ifnames, Invoking autoheader, Making configure Scripts
-@section Invoking @code{autoscan}
+@section Using @code{autoscan} to Create @file{configure.in}
The @code{autoscan} program can help you create a @file{configure.in}
file for a software package. @code{autoscan} examines source files in
argument, or the current directory if none is given. It searches the
source files for common portability problems and creates a file
@file{configure.scan} which is a preliminary @file{configure.in} for
-that package. You should manually examine @file{configure.scan} before
-renaming it to @file{configure.in}; it will probably need some
-adjustments. If you want the package to use a configuration header
-file, you will have to add a call to @code{AC_CONFIG_HEADER}. You might
-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 might help with that job).
+that package.
+
+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}. You might 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 might help with that job).
@code{autoscan} uses several data files, which are installed with the
distributed Autoconf macro files, to determine which macros to output
@end table
@node Invoking ifnames, Invoking autoreconf, Invoking autoscan, Making configure Scripts
-@section Invoking @code{ifnames}
+@section Using @code{ifnames} to List Conditionals
@code{ifnames} can help when writing a @file{configure.in} for a
software package. It prints the identifiers used in C preprocessor
@end table
@node Invoking autoreconf, Invoking autoupdate, Invoking ifnames, Making configure Scripts
-@section Invoking @code{autoreconf}
+@section Using @code{autoreconf} to Recreate @file{configure}
If you have a lot of Autoconf-generated @code{configure} scripts and you
get a new version of Autoconf, the @code{autoreconf} program can be
handy. It runs @code{autoconf} (and @code{autoheader}, where
appropriate) repeatedly to remake all of the Autoconf @code{configure}
-scripts in a directory tree.
+scripts in a directory tree. @xref{Automatic Remaking}, for further
+information about automatic remaking of @code{configure} scripts.
@noindent
@code{autoreconf} accepts the following options:
@end table
@node Invoking autoupdate, , Invoking autoreconf, Making configure Scripts
-@section Invoking @code{autoupdate}
+@section Using @code{autoupdate} to Modernize @file{configure}
The @code{autoupdate} program updates a @file{configure.in} file that
calls Autoconf macros by their old names to use the current macro names.
@var{unique-file-in-source-dir} is some file that is in the package's
source directory; @code{configure} checks for this file's existence to
make sure that the directory that it is told contains the source code in
-fact does (@pxref{Invoking configure}, for more information).
+fact does (@pxref{Invoking configure}, for more information). This
+macro is required in every @file{configure.in}.
@end defmac
@node Output, Package Options, Input, Operation
@file{config.status}. If @code{AC_CONFIG_HEADER} has been called, also
create the header file that was named as its argument. The argument is
a whitespace-separated list of files to create; if it is omitted, no
-files are created. @code{AC_OUTPUT} creates each file @file{@var{file}}
-in the list 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 each
-file is in if it doesn't exist (but not the parents of that directory).
-A plausible value for the argument to @code{AC_OUTPUT} is @samp{Makefile
-src/Makefile man/Makefile X/Imakefile}.
-
-You can override an input file name by appending it to @var{file},
-separated by a colon. For example,
+files are created. This macro is required in every @file{configure.in}.
+
+@code{AC_OUTPUT} creates each file @file{@var{file}} in the list 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 each file is in if it
+doesn't exist (but not the parents of that directory). A plausible
+value for the argument to @code{AC_OUTPUT} is @samp{Makefile
+src/Makefile man/Makefile X/Imakefile}. You can override an input file
+name by appending it to @var{file}, separated by a colon. For example,
@example
AC_OUTPUT(Makefile:templates/top.mk lib/Makefile:templates/lib.mk)
@end example
@section Checking for Package Options
These macros check whether the user gave @code{configure} command line
-arguments to select optional features of the package. These macros may
+arguments to select optional features of the package. They may
take an argument to use if the argument was given and one for if it was
-not given.
-
-@defmac AC_ARG_ENABLE (@var{feature}, @var{help-string}, @var{action-if-true} @r{[}, @var{action-if-false}@r{]})
-@maindex ARG_ENABLE
-If the user gave @code{configure} the option
-@samp{--enable-@var{feature}} or @samp{--disable-@var{feature}}, run
-shell commands @var{action-if-true}. Otherwise run shell commands
-@var{action-if-false}. @var{help-string} is a description of
+not given. The argument @var{help-string} is a description of
the option which looks like this:
@example
--enable-editing support fancy command line editing
Avoid tabs in the help string. You'll need to enclose it in @samp{[}
and @samp{]} in order to produce the leading spaces.
+@defmac AC_ARG_ENABLE (@var{feature}, @var{help-string}, @var{action-if-true} @r{[}, @var{action-if-false}@r{]})
+@maindex ARG_ENABLE
+If the user gave @code{configure} the option
+@samp{--enable-@var{feature}} or @samp{--disable-@var{feature}}, run
+shell commands @var{action-if-true}. Otherwise run shell commands
+@var{action-if-false}.
+
The name @var{feature} should consist only of alphanumeric characters
and dashes. The @var{feature} indicates an optional user-level
facility. This option allows users to choose which optional features to
If the user gave @code{configure} the option @samp{--with-@var{package}}
or @samp{--without-@var{package}}, run shell commands
@var{action-if-true}. Otherwise run shell commands
-@var{action-if-false}. @var{help-string} is a description of
-the option which looks like this:
-@example
- --with-gnu-as use the GNU assembler
-@end example
-@noindent
-@var{help-string} may be more than one line long, if more detail is
-needed. Just make sure the columns line up in @samp{configure --help}.
-Avoid tabs in the help string. You'll need to enclose it in @samp{[}
-and @samp{]} in order to produce the leading spaces.
+@var{action-if-false}.
The name @var{package} should consist only of alphanumeric characters
and dashes. The @var{package} indicates another software package that
@defmac AC_ENABLE (@var{feature}, @var{action-if-true} @r{[}, @var{action-if-false}@r{]})
@maindex ENABLE
This is an obsolete version of @code{AC_ARG_ENABLE} that does not
-provide a help string.
+support providing a help string.
@end defmac
@defmac AC_WITH (@var{package}, @var{action-if-true} @r{[}, @var{action-if-false}@r{]})
@maindex WITH
This is an obsolete version of @code{AC_ARG_WITH} that does not
-provide a help string.
+support providing a help string.
@end defmac
@node Versions, , Package Options, Operation
@maindex PREREQ
Ensure that a recent enough version of Autoconf is being used. If the
version of Autoconf being used to create @code{configure} is earlier
-than @var{version} (e.g., @samp{1.8}), print an error message on the
-standard error output and do not create @code{configure}.
+than @var{version}, print an error message on the standard error output
+and do not create @code{configure}. For example:
+
+@example
+AC_PREREQ(1.8)
+@end example
This macro is useful if your @file{configure.in} relies on non-obvious
behavior that changed between Autoconf releases. If it merely needs
For example, this line in @file{configure.in}:
+@c The asis prevents RCS from changing the example in the manual.
@example
AC_REVISION($@asis{Revision: 1.30 }$)dnl
@end example
@node Existing Tests, Primitives, Operation, Top
@chapter Existing Tests
-These macros test for particular operating system features that packages
+These macros test for particular system features that packages
might need or want to use. If you need to test for a kind of feature
that none of these macros check for, you can probably do it by calling
primitive test macros with appropriate arguments (@pxref{Primitives}).
@code{AC_PROG_CXXCPP} if C++ is the current language, @pxref{Language
Choice}) and @code{AC_PROG_LEX} if they haven't been called already.
-This macro replaces @code{AC_DECLARE_YYTEXT}, which didn't work.
+This macro replaces @code{AC_DECLARE_YYTEXT}, which didn't work reliably.
@end defmac
@defmac AC_PROG_AWK
Determine a C compiler to use. If @code{CC} is not already set in the
environment, check for @code{gcc}, and use @code{cc} if it's not found.
Set @code{make} variable @code{CC} to the name of the compiler found.
-Set shell variable @code{GCC} to @samp{yes} if it found the GNU C
+Set shell variable @code{GCC} to @samp{yes} if using the GNU C
compiler, empty otherwise, and if @code{make} variable @code{CFLAGS} was
not already set, set it to @samp{-g -O} for the GNU C compiler or
@samp{-g} for other compilers.
under likely names (@code{c++}, @code{g++}, @code{gcc}, @code{CC}, and
@code{cxx}). If none of those checks succeed, as a last resort set
@code{CXX} to @code{gcc}. Also set shell variable @code{GXX} to
-@samp{yes} if it found the GNU C++ compiler, empty otherwise, and if
+@samp{yes} if using the GNU C++ compiler, empty otherwise, and if
@code{make} variable @code{CXXFLAGS} was not already set, set it to
@samp{-g -O} for the GNU C++ compiler or @samp{-g} for other compilers.
@end defmac
@var{function} argument of @code{main}. In addition, @var{library} can
be written as any of @samp{foo}, @samp{-lfoo}, or @samp{libfoo.a}. In
all of those cases, the compiler is passed @samp{-lfoo}. However,
-@var{library} can not be a shell variable; it must be a constant.
+@var{library} can not be a shell variable; it must be a literal name.
This macro is considered obsolete, because some linkers (e.g., Apollo's)
do not fail when asked to link with a nonexistent library if there are
@cvindex SYSNDIR
@cvindex NDIR
@cvindex VOID_CLOSEDIR
-Like @code{AC_HEADER_DIRENT}, but defines a different set of C
-preprocessor macros to indicate which header file is found. This macro
-and the names it defines are considered obsolete. The names it defines are:
+Like calling @code{AC_HEADER_DIRENT} and @code{AC_FUNC_CLOSEDIR_VOID},
+but defines a different set of C preprocessor macros to indicate which
+header file is found. This macro and the names it defines are
+considered obsolete. The names it defines are:
@table @file
@item dirent.h
@code{NDIR}
@end table
-Also, if the directory library header file contains a declaration of the
-@code{closedir} function with a @code{void} return type, define
-@code{VOID_CLOSEDIR}.
+If the @code{closedir} function does not return a meaningful value,
+define @code{VOID_CLOSEDIR}.
@end defmac
@defmac AC_HEADER_DIRENT
@cvindex HAVE_NDIR_H
@cvindex HAVE_SYS_DIR_H
@cvindex HAVE_SYS_NDIR_H
-@cvindex CLOSEDIR_VOID
Check for the the following header files, and for the first one that is
found, define the listed C preprocessor macro:
@code{HAVE_NDIR_H}
@end table
-Also, if the directory library header file contains a declaration of the
-@code{closedir} function with a @code{void} return type, define
-@code{CLOSEDIR_VOID}.
-
The directory library declarations in the source code should look
something like the following, which assumes that you have also called
@samp{AC_CHECK_HEADERS(unistd.h)}:
@defmac AC_CHECK_TYPE (@var{type}, @var{default})
@maindex CHECK_TYPE
If the type @var{type} is not defined in @file{sys/types.h}, define it
-to be the C (or C++) builtin type @var{default}, e.g. @samp{short} or
+to be the C (or C++) builtin type @var{default}; e.g., @samp{short} or
@samp{unsigned}.
@end defmac
@end example
@end defmac
+@defmac AC_FUNC_CLOSEDIR_VOID
+@maindex FUNC_CLOSEDIR_VOID
+@cvindex CLOSEDIR_VOID
+If the @code{closedir} function does not return a meaningful value,
+define @code{CLOSEDIR_VOID}. Otherwise, callers ought to check its
+return value for an error indicator. This macro calls
+@code{AC_HEADER_DIRENT} if it has not been called yet already
+(@pxref{Particular Headers}).
+@end defmac
+
@defmac AC_FUNC_GETLOADAVG
@maindex FUNC_GETLOADAVG
@cvindex SVR4
variable @code{cross_compiling} to @samp{yes}, otherwise @samp{no}.
This information can be used by @code{AC_TRY_RUN} to determine whether
to take a default action instead of trying to run a test program
-(@pxref{C System Output}).
+(@pxref{C System Output}). For more information on dealing with
+cross-compiling, @xref{Alternatives}.
@end defmac
@defmac AC_C_INLINE
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.
It is preferable to use @code{AC_TRY_LINK} instead of @code{AC_TRY_RUN},
-when possible. @xref{Test Programs}, for more information.
+when possible. @xref{Test Programs}, for a fuller explanation.
@end defmac
@node Setting Variables, Printing Messages, C System Output, Primitives
test program by hand. You can compile and run it using
@code{AC_TRY_RUN} (@pxref{C System Output}).
-Try to avoid running test programs if possible, because using them
-prevents people from configuring your package for cross-compiling. If
-it's really best that you test for a run-time behavior, try to provide a
-default ``worst case'' 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 set up
-a test results cache file with the correct values for the target system
-(@pxref{Caching Values}). But that is a last resort. Alternatively,
-choose a value for those parameters based on the canonical system name
-(@pxref{Manual Configuration}).
-
@menu
+* Alternatives:: Approaches preferred over test programs.
* Guidelines:: General rules for writing test programs.
* Test Functions:: Special ways to work around problems.
@end menu
-@node Guidelines, Test Functions, , Test Programs
+@node Alternatives, Guidelines, , Test Programs
+@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.
+
+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} is set to @samp{yes}, use an alternate
+method to get the results instead of calling the macros.
+
+@node Guidelines, Test Functions, Alternatives, Test Programs
@subsection Guidelines for Test Programs
Test programs should not write anything to the standard output. They
esac
@end example
-@defmac AC_LINK_FILES (@var{link} @dots{}, @var{file} @dots{})
+@defmac AC_LINK_FILES (@var{dest} @dots{}, @var{source} @dots{})
@maindex LINK_FILES
-Link each of the existing files @var{file} to the corresponding link
-name @var{link}. Makes a symbolic link if possible, otherwise a hard
+Link each of the existing files @var{source} to the corresponding link
+name @var{dest}. Makes a symbolic link if possible, otherwise a hard
link. For example, this call:
@example
touch $@{srcdir@}/stamp-h.in
# config.status might not change config.h
-# Don't rerun config.status if we just configured.
-# Use || so the command line always returns success.
config.h: stamp-h
stamp-h: config.h.in config.status
- test ! -f stamp-h || ./config.status
- touch stamp-h
+ ./config.status
Makefile: Makefile.in config.status
./config.status
@end group
@end example
+In addition, you should pass @samp{touch stamp-h} in the @var{extra-cmds}
+argument to @code{AC_OUTPUT}, so @file{config.status} will ensure that
+@file{config.h} is considered up to date. @xref{Output}, for more
+information about @code{AC_OUTPUT}.
+
@xref{Invoking config.status}, for more information on handling
configuration-related dependencies.
@samp{--recheck} option re-runs @code{configure} with the same arguments
you used before, plus the @samp{--no-create} option, which prevent
@code{configure} from running @file{config.status} and creating
-@file{Makefile} and other files, and the @samp{--norecursion} option,
+@file{Makefile} and other files, and the @samp{--no-recursion} option,
which prevents @code{configure} from running other @code{configure}
scripts in subdirectories. (This is so other @file{Makefile} rules can
run @file{config.status} when it changes; @pxref{Automatic Remaking},
ln $$file $$distname/$$file \
|| { echo copying $$file instead; cp -p $$file $$distname/$$file;}; \
done; \
- chmod -R a+rX $$distname; \
+ chmod -R a+rwX $$distname; \
tar -chz -f $$distname.tar.gz $$distname; \
rm -fr $$distname
@c @setchapternewpage odd
@c %**end of header
-@set EDITION 1.110
-@set VERSION 1.110
-@set UPDATED August 1994
+@set EDITION 1.111
+@set VERSION 1.111
+@set UPDATED September 1994
@iftex
@finalout
@ifinfo
@format
START-INFO-DIR-ENTRY
-* autoconf: (autoconf). The Autoconf configuration system.
+* Autoconf: (autoconf). Create source code configuration scripts.
END-INFO-DIR-ENTRY
@end format
Test Programs
+* Alternatives:: Approaches preferred over test programs.
* Guidelines:: General rules for writing test programs.
* Test Functions:: Special ways to work around problems.
have Autoconf.
The configuration scripts produced by Autoconf require no manual user
-intervention when run; they do not normally even take an argument
+intervention when run; they do not normally even need an argument
specifying the system type. Instead, they test for the presence of each
feature that the software package they are for might need individually.
(Before each check, they print a one-line message stating what they are
of each variant of UNIX.
For each software package that Autoconf is used with, it creates a
-configuration script from a template file that lists the operating
-system features that the package can use. After the shell code to
-recognize and respond to an operating system feature has been written,
+configuration script from a template file that lists the
+system features that the package needs or can use. After the shell code to
+recognize and respond to a system feature has been written,
Autoconf allows it to be shared by many software packages that can
use (or need) that feature. If it later turns out that the shell code
needs adjustment for some reason, it needs to be changed in only one
-place; all of the the configuration scripts can be regenerated
+place; all of the configuration scripts can be regenerated
automatically to take advantage of the updated code.
Larry Wall's Metaconfig package is similar in purpose to Autoconf, but
@end example
@node Invoking autoconf, Invoking autoheader, Writing configure.in, Making configure Scripts
-@section Invoking @code{autoconf}
+@section Using @code{autoconf} to Create @file{configure}
To create @code{configure} from @file{configure.in}, run the
@code{autoconf} program with no arguments. @code{autoconf} processes
looks for the optional file @file{acsite.m4} in the directory that
contains the distributed Autoconf macro files, and for the optional file
@file{aclocal.m4} in the current directory. Those files can contain
-your site's own locally written Autoconf macro definitions
+your site's or the package's own Autoconf macro definitions
(@pxref{Writing Macros}, for more information). If a macro is defined
in more than one of the files that @code{autoconf} reads, the last
definition it reads overrides the earlier ones.
summary of the command-line options and exits.
@node Invoking autoheader, Invoking autoscan, Invoking autoconf, Making configure Scripts
-@section Invoking @code{autoheader}
+@section Using @code{autoheader} to Create @file{config.h.in}
You can use the @code{autoheader} program to create a template file of C
@samp{#define} statements for @code{configure} to use. By default, the
@code{#define} and @code{#undef} statements from a file called
@file{acconfig.h}, which comes with and is installed with Autoconf. It
also uses a file called @file{acconfig.h} in the current directory, if
-present; you must create that file to contain entries for any additional
-symbols that you @code{AC_DEFINE}. For symbols defined by
+present. If you @code{AC_DEFINE} any additional symbols, you must
+create that file with entries for them. For symbols defined by
@code{AC_CHECK_HEADERS}, @code{AC_CHECK_FUNCS}, @code{AC_CHECK_SIZEOF},
-or @code{AC_CHECK_LIB},
-@code{autoheader} generates comments and @code{#undef} statements itself
-rather than copying them from a file, since the possible symbols are
-effectively limitless.
+or @code{AC_CHECK_LIB}, @code{autoheader} generates comments and
+@code{#undef} statements itself rather than copying them from a file,
+since the possible symbols are effectively limitless.
The file that @code{autoheader} creates contains mainly @code{#define}
and @code{#undef} statements and their accompanying comments. If
@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.
+two more files to clutter up the directory. (@pxref{Output}, for more
+information about avoiding file names that MS-DOS cannot store.)
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
summary of the command-line options and exits.
@node Invoking autoscan, Invoking ifnames, Invoking autoheader, Making configure Scripts
-@section Invoking @code{autoscan}
+@section Using @code{autoscan} to Create @file{configure.in}
The @code{autoscan} program can help you create a @file{configure.in}
file for a software package. @code{autoscan} examines source files in
argument, or the current directory if none is given. It searches the
source files for common portability problems and creates a file
@file{configure.scan} which is a preliminary @file{configure.in} for
-that package. You should manually examine @file{configure.scan} before
-renaming it to @file{configure.in}; it will probably need some
-adjustments. If you want the package to use a configuration header
-file, you will have to add a call to @code{AC_CONFIG_HEADER}. You might
-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 might help with that job).
+that package.
+
+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}. You might 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 might help with that job).
@code{autoscan} uses several data files, which are installed with the
distributed Autoconf macro files, to determine which macros to output
@end table
@node Invoking ifnames, Invoking autoreconf, Invoking autoscan, Making configure Scripts
-@section Invoking @code{ifnames}
+@section Using @code{ifnames} to List Conditionals
@code{ifnames} can help when writing a @file{configure.in} for a
software package. It prints the identifiers used in C preprocessor
@end table
@node Invoking autoreconf, Invoking autoupdate, Invoking ifnames, Making configure Scripts
-@section Invoking @code{autoreconf}
+@section Using @code{autoreconf} to Recreate @file{configure}
If you have a lot of Autoconf-generated @code{configure} scripts and you
get a new version of Autoconf, the @code{autoreconf} program can be
handy. It runs @code{autoconf} (and @code{autoheader}, where
appropriate) repeatedly to remake all of the Autoconf @code{configure}
-scripts in a directory tree.
+scripts in a directory tree. @xref{Automatic Remaking}, for further
+information about automatic remaking of @code{configure} scripts.
@noindent
@code{autoreconf} accepts the following options:
@end table
@node Invoking autoupdate, , Invoking autoreconf, Making configure Scripts
-@section Invoking @code{autoupdate}
+@section Using @code{autoupdate} to Modernize @file{configure}
The @code{autoupdate} program updates a @file{configure.in} file that
calls Autoconf macros by their old names to use the current macro names.
@var{unique-file-in-source-dir} is some file that is in the package's
source directory; @code{configure} checks for this file's existence to
make sure that the directory that it is told contains the source code in
-fact does (@pxref{Invoking configure}, for more information).
+fact does (@pxref{Invoking configure}, for more information). This
+macro is required in every @file{configure.in}.
@end defmac
@node Output, Package Options, Input, Operation
@file{config.status}. If @code{AC_CONFIG_HEADER} has been called, also
create the header file that was named as its argument. The argument is
a whitespace-separated list of files to create; if it is omitted, no
-files are created. @code{AC_OUTPUT} creates each file @file{@var{file}}
-in the list 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 each
-file is in if it doesn't exist (but not the parents of that directory).
-A plausible value for the argument to @code{AC_OUTPUT} is @samp{Makefile
-src/Makefile man/Makefile X/Imakefile}.
-
-You can override an input file name by appending it to @var{file},
-separated by a colon. For example,
+files are created. This macro is required in every @file{configure.in}.
+
+@code{AC_OUTPUT} creates each file @file{@var{file}} in the list 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 each file is in if it
+doesn't exist (but not the parents of that directory). A plausible
+value for the argument to @code{AC_OUTPUT} is @samp{Makefile
+src/Makefile man/Makefile X/Imakefile}. You can override an input file
+name by appending it to @var{file}, separated by a colon. For example,
@example
AC_OUTPUT(Makefile:templates/top.mk lib/Makefile:templates/lib.mk)
@end example
@section Checking for Package Options
These macros check whether the user gave @code{configure} command line
-arguments to select optional features of the package. These macros may
+arguments to select optional features of the package. They may
take an argument to use if the argument was given and one for if it was
-not given.
-
-@defmac AC_ARG_ENABLE (@var{feature}, @var{help-string}, @var{action-if-true} @r{[}, @var{action-if-false}@r{]})
-@maindex ARG_ENABLE
-If the user gave @code{configure} the option
-@samp{--enable-@var{feature}} or @samp{--disable-@var{feature}}, run
-shell commands @var{action-if-true}. Otherwise run shell commands
-@var{action-if-false}. @var{help-string} is a description of
+not given. The argument @var{help-string} is a description of
the option which looks like this:
@example
--enable-editing support fancy command line editing
Avoid tabs in the help string. You'll need to enclose it in @samp{[}
and @samp{]} in order to produce the leading spaces.
+@defmac AC_ARG_ENABLE (@var{feature}, @var{help-string}, @var{action-if-true} @r{[}, @var{action-if-false}@r{]})
+@maindex ARG_ENABLE
+If the user gave @code{configure} the option
+@samp{--enable-@var{feature}} or @samp{--disable-@var{feature}}, run
+shell commands @var{action-if-true}. Otherwise run shell commands
+@var{action-if-false}.
+
The name @var{feature} should consist only of alphanumeric characters
and dashes. The @var{feature} indicates an optional user-level
facility. This option allows users to choose which optional features to
If the user gave @code{configure} the option @samp{--with-@var{package}}
or @samp{--without-@var{package}}, run shell commands
@var{action-if-true}. Otherwise run shell commands
-@var{action-if-false}. @var{help-string} is a description of
-the option which looks like this:
-@example
- --with-gnu-as use the GNU assembler
-@end example
-@noindent
-@var{help-string} may be more than one line long, if more detail is
-needed. Just make sure the columns line up in @samp{configure --help}.
-Avoid tabs in the help string. You'll need to enclose it in @samp{[}
-and @samp{]} in order to produce the leading spaces.
+@var{action-if-false}.
The name @var{package} should consist only of alphanumeric characters
and dashes. The @var{package} indicates another software package that
@defmac AC_ENABLE (@var{feature}, @var{action-if-true} @r{[}, @var{action-if-false}@r{]})
@maindex ENABLE
This is an obsolete version of @code{AC_ARG_ENABLE} that does not
-provide a help string.
+support providing a help string.
@end defmac
@defmac AC_WITH (@var{package}, @var{action-if-true} @r{[}, @var{action-if-false}@r{]})
@maindex WITH
This is an obsolete version of @code{AC_ARG_WITH} that does not
-provide a help string.
+support providing a help string.
@end defmac
@node Versions, , Package Options, Operation
@maindex PREREQ
Ensure that a recent enough version of Autoconf is being used. If the
version of Autoconf being used to create @code{configure} is earlier
-than @var{version} (e.g., @samp{1.8}), print an error message on the
-standard error output and do not create @code{configure}.
+than @var{version}, print an error message on the standard error output
+and do not create @code{configure}. For example:
+
+@example
+AC_PREREQ(1.8)
+@end example
This macro is useful if your @file{configure.in} relies on non-obvious
behavior that changed between Autoconf releases. If it merely needs
For example, this line in @file{configure.in}:
+@c The asis prevents RCS from changing the example in the manual.
@example
AC_REVISION($@asis{Revision: 1.30 }$)dnl
@end example
@node Existing Tests, Primitives, Operation, Top
@chapter Existing Tests
-These macros test for particular operating system features that packages
+These macros test for particular system features that packages
might need or want to use. If you need to test for a kind of feature
that none of these macros check for, you can probably do it by calling
primitive test macros with appropriate arguments (@pxref{Primitives}).
@code{AC_PROG_CXXCPP} if C++ is the current language, @pxref{Language
Choice}) and @code{AC_PROG_LEX} if they haven't been called already.
-This macro replaces @code{AC_DECLARE_YYTEXT}, which didn't work.
+This macro replaces @code{AC_DECLARE_YYTEXT}, which didn't work reliably.
@end defmac
@defmac AC_PROG_AWK
Determine a C compiler to use. If @code{CC} is not already set in the
environment, check for @code{gcc}, and use @code{cc} if it's not found.
Set @code{make} variable @code{CC} to the name of the compiler found.
-Set shell variable @code{GCC} to @samp{yes} if it found the GNU C
+Set shell variable @code{GCC} to @samp{yes} if using the GNU C
compiler, empty otherwise, and if @code{make} variable @code{CFLAGS} was
not already set, set it to @samp{-g -O} for the GNU C compiler or
@samp{-g} for other compilers.
under likely names (@code{c++}, @code{g++}, @code{gcc}, @code{CC}, and
@code{cxx}). If none of those checks succeed, as a last resort set
@code{CXX} to @code{gcc}. Also set shell variable @code{GXX} to
-@samp{yes} if it found the GNU C++ compiler, empty otherwise, and if
+@samp{yes} if using the GNU C++ compiler, empty otherwise, and if
@code{make} variable @code{CXXFLAGS} was not already set, set it to
@samp{-g -O} for the GNU C++ compiler or @samp{-g} for other compilers.
@end defmac
@var{function} argument of @code{main}. In addition, @var{library} can
be written as any of @samp{foo}, @samp{-lfoo}, or @samp{libfoo.a}. In
all of those cases, the compiler is passed @samp{-lfoo}. However,
-@var{library} can not be a shell variable; it must be a constant.
+@var{library} can not be a shell variable; it must be a literal name.
This macro is considered obsolete, because some linkers (e.g., Apollo's)
do not fail when asked to link with a nonexistent library if there are
@cvindex SYSNDIR
@cvindex NDIR
@cvindex VOID_CLOSEDIR
-Like @code{AC_HEADER_DIRENT}, but defines a different set of C
-preprocessor macros to indicate which header file is found. This macro
-and the names it defines are considered obsolete. The names it defines are:
+Like calling @code{AC_HEADER_DIRENT} and @code{AC_FUNC_CLOSEDIR_VOID},
+but defines a different set of C preprocessor macros to indicate which
+header file is found. This macro and the names it defines are
+considered obsolete. The names it defines are:
@table @file
@item dirent.h
@code{NDIR}
@end table
-Also, if the directory library header file contains a declaration of the
-@code{closedir} function with a @code{void} return type, define
-@code{VOID_CLOSEDIR}.
+If the @code{closedir} function does not return a meaningful value,
+define @code{VOID_CLOSEDIR}.
@end defmac
@defmac AC_HEADER_DIRENT
@cvindex HAVE_NDIR_H
@cvindex HAVE_SYS_DIR_H
@cvindex HAVE_SYS_NDIR_H
-@cvindex CLOSEDIR_VOID
Check for the the following header files, and for the first one that is
found, define the listed C preprocessor macro:
@code{HAVE_NDIR_H}
@end table
-Also, if the directory library header file contains a declaration of the
-@code{closedir} function with a @code{void} return type, define
-@code{CLOSEDIR_VOID}.
-
The directory library declarations in the source code should look
something like the following, which assumes that you have also called
@samp{AC_CHECK_HEADERS(unistd.h)}:
@defmac AC_CHECK_TYPE (@var{type}, @var{default})
@maindex CHECK_TYPE
If the type @var{type} is not defined in @file{sys/types.h}, define it
-to be the C (or C++) builtin type @var{default}, e.g. @samp{short} or
+to be the C (or C++) builtin type @var{default}; e.g., @samp{short} or
@samp{unsigned}.
@end defmac
@end example
@end defmac
+@defmac AC_FUNC_CLOSEDIR_VOID
+@maindex FUNC_CLOSEDIR_VOID
+@cvindex CLOSEDIR_VOID
+If the @code{closedir} function does not return a meaningful value,
+define @code{CLOSEDIR_VOID}. Otherwise, callers ought to check its
+return value for an error indicator. This macro calls
+@code{AC_HEADER_DIRENT} if it has not been called yet already
+(@pxref{Particular Headers}).
+@end defmac
+
@defmac AC_FUNC_GETLOADAVG
@maindex FUNC_GETLOADAVG
@cvindex SVR4
variable @code{cross_compiling} to @samp{yes}, otherwise @samp{no}.
This information can be used by @code{AC_TRY_RUN} to determine whether
to take a default action instead of trying to run a test program
-(@pxref{C System Output}).
+(@pxref{C System Output}). For more information on dealing with
+cross-compiling, @xref{Alternatives}.
@end defmac
@defmac AC_C_INLINE
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.
It is preferable to use @code{AC_TRY_LINK} instead of @code{AC_TRY_RUN},
-when possible. @xref{Test Programs}, for more information.
+when possible. @xref{Test Programs}, for a fuller explanation.
@end defmac
@node Setting Variables, Printing Messages, C System Output, Primitives
test program by hand. You can compile and run it using
@code{AC_TRY_RUN} (@pxref{C System Output}).
-Try to avoid running test programs if possible, because using them
-prevents people from configuring your package for cross-compiling. If
-it's really best that you test for a run-time behavior, try to provide a
-default ``worst case'' 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 set up
-a test results cache file with the correct values for the target system
-(@pxref{Caching Values}). But that is a last resort. Alternatively,
-choose a value for those parameters based on the canonical system name
-(@pxref{Manual Configuration}).
-
@menu
+* Alternatives:: Approaches preferred over test programs.
* Guidelines:: General rules for writing test programs.
* Test Functions:: Special ways to work around problems.
@end menu
-@node Guidelines, Test Functions, , Test Programs
+@node Alternatives, Guidelines, , Test Programs
+@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.
+
+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} is set to @samp{yes}, use an alternate
+method to get the results instead of calling the macros.
+
+@node Guidelines, Test Functions, Alternatives, Test Programs
@subsection Guidelines for Test Programs
Test programs should not write anything to the standard output. They
esac
@end example
-@defmac AC_LINK_FILES (@var{link} @dots{}, @var{file} @dots{})
+@defmac AC_LINK_FILES (@var{dest} @dots{}, @var{source} @dots{})
@maindex LINK_FILES
-Link each of the existing files @var{file} to the corresponding link
-name @var{link}. Makes a symbolic link if possible, otherwise a hard
+Link each of the existing files @var{source} to the corresponding link
+name @var{dest}. Makes a symbolic link if possible, otherwise a hard
link. For example, this call:
@example
touch $@{srcdir@}/stamp-h.in
# config.status might not change config.h
-# Don't rerun config.status if we just configured.
-# Use || so the command line always returns success.
config.h: stamp-h
stamp-h: config.h.in config.status
- test ! -f stamp-h || ./config.status
- touch stamp-h
+ ./config.status
Makefile: Makefile.in config.status
./config.status
@end group
@end example
+In addition, you should pass @samp{touch stamp-h} in the @var{extra-cmds}
+argument to @code{AC_OUTPUT}, so @file{config.status} will ensure that
+@file{config.h} is considered up to date. @xref{Output}, for more
+information about @code{AC_OUTPUT}.
+
@xref{Invoking config.status}, for more information on handling
configuration-related dependencies.
@samp{--recheck} option re-runs @code{configure} with the same arguments
you used before, plus the @samp{--no-create} option, which prevent
@code{configure} from running @file{config.status} and creating
-@file{Makefile} and other files, and the @samp{--norecursion} option,
+@file{Makefile} and other files, and the @samp{--no-recursion} option,
which prevents @code{configure} from running other @code{configure}
scripts in subdirectories. (This is so other @file{Makefile} rules can
run @file{config.status} when it changes; @pxref{Automatic Remaking},
package. It may also create one or more @file{.h} files containing
system-dependent definitions. Finally, it creates a shell script
@file{config.status} that you can run in the future to recreate the
-current configuration, and a file @file{config.log} containing compiler
-output (useful mainly for debugging @code{configure}).
+current configuration, a file @file{config.cache} that saves the results
+of its tests to speed up reconfiguring, and a file @file{config.log}
+containing compiler output (useful mainly for debugging
+@code{configure}).
If you need to do unusual things to compile the package, please try to
figure out how @code{configure} could check whether to do them, and mail
diffs or instructions to the address given in the @file{README} so they
-can be considered for the next release.
+can be considered for the next release. If at some point
+@file{config.cache} contains results you don't want to keep, you may
+remove or edit it.
The file @file{configure.in} is used to create @file{configure} by a
program called @code{autoconf}. You only need @file{configure.in} if
@code{configure} also recognizes the following options:
@table @code
+@item --cache-file=@var{file}
+Save the results of the tests in @var{file} instead of @file{config.cache}.
+Set @var{file} to @file{/dev/null} to disable caching, for debugging configure.
+
@item --help
Print a summary of the options to @code{configure}, and exit.
package. It may also create one or more @file{.h} files containing
system-dependent definitions. Finally, it creates a shell script
@file{config.status} that you can run in the future to recreate the
-current configuration, and a file @file{config.log} containing compiler
-output (useful mainly for debugging @code{configure}).
+current configuration, a file @file{config.cache} that saves the results
+of its tests to speed up reconfiguring, and a file @file{config.log}
+containing compiler output (useful mainly for debugging
+@code{configure}).
If you need to do unusual things to compile the package, please try to
figure out how @code{configure} could check whether to do them, and mail
diffs or instructions to the address given in the @file{README} so they
-can be considered for the next release.
+can be considered for the next release. If at some point
+@file{config.cache} contains results you don't want to keep, you may
+remove or edit it.
The file @file{configure.in} is used to create @file{configure} by a
program called @code{autoconf}. You only need @file{configure.in} if
@code{configure} also recognizes the following options:
@table @code
+@item --cache-file=@var{file}
+Save the results of the tests in @var{file} instead of @file{config.cache}.
+Set @var{file} to @file{/dev/null} to disable caching, for debugging configure.
+
@item --help
Print a summary of the options to @code{configure}, and exit.
divert(-1)dnl Throw away output until AC_INIT is called.
changequote([, ])
-define(AC_ACVERSION, 1.110)
+define(AC_ACVERSION, 1.111)
dnl Some old m4's don't support m4exit. But they provide
dnl equivalent functionality by core dumping because of the
host=NONE
no_create=
nonopt=NONE
-norecursion=
+no_recursion=
prefix=NONE
program_prefix=
program_suffix=
| --no-cr | --no-c)
no_create=yes ;;
- -norecursion | --norecursion | --norecursio | --norecursi \
- | --norecurs | --norecur | --norecu | --norec | --nore | --nor)
- norecursion=yes ;;
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+ no_recursion=yes ;;
-prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
ac_prev=prefix ;;
dnl AC_INIT_PREPARE(UNIQUE-FILE-IN-SOURCE-DIR)
AC_DEFUN(AC_INIT_PREPARE,
[trap 'rm -fr conftest* confdefs* core $ac_clean_files; exit 1' 1 2 15
-trap 'rm -fr confdefs* $ac_clean_files' 0
# File descriptor usage:
# 0 unused; standard input
# Save the original args if we used an alternate arg parser.
ac_configure_temp="${configure_args-[$]@}"
-# Strip out --no-create and --norecursion so they do not pile up.
+# 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
case "$ac_arg" in
-no-create | --no-create | --no-creat | --no-crea | --no-cre \
| --no-cr | --no-c) ;;
- -norecursion | --norecursion | --norecursio | --norecursi \
- | --norecurs | --norecur | --norecu | --norec | --nore | --nor) ;;
+ -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'" ;;
changequote([, ])dnl
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
# scripts and configure runs. It is not useful on other systems.
-# If its contents are invalid for some reason, you may delete or edit it.
+# If it contains results you don't want to keep, you may remove or edit it.
#
# By default, configure uses ./config.cache as the cache file,
# creating it if it does not exist already. You can give configure
#include "confdefs.h"
[$1]
EOF
-dnl Capture the stderr of cpp.
-dnl eval is necessary to expand ac_cpp.
-dnl Ultrix and Pyramid sh refuse to redirect output of eval, so use subshell.
-dnl Coherent sh does redirections in the wrong order, so separate them.
-# Note: sh -x echos commands on subshell stderr, making this test fail.
-ac_err=`(eval "$ac_cpp conftest.${ac_ext} >/dev/null") 2>&1`
+dnl Capture the stderr of cpp. eval is necessary to expand ac_cpp.
+dnl We used to copy stderr to stdout and capture it in a variable, but
+dnl that breaks under sh -x.
+eval "$ac_cpp conftest.${ac_ext} >/dev/null 2>conftest.out"
+ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
ifelse([$2], , :, [rm -rf conftest*
$2])
do
case "[\$]ac_option" in
-recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
- echo running [\$]{CONFIG_SHELL-/bin/sh} [$]0 [$]configure_args --no-create --norecursion
- exec [\$]{CONFIG_SHELL-/bin/sh} [$]0 [$]configure_args --no-create --norecursion ;;
+ 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 ;;
-version | --version | --versio | --versi | --vers | --ver | --ve | --v)
echo "${CONFIG_STATUS} generated by autoconf version AC_ACVERSION"
exit 0 ;;
exit 0
EOF
chmod +x ${CONFIG_STATUS}
+rm -fr confdefs* $ac_clean_files
test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} ${CONFIG_STATUS}
dnl config.status should not do recursion.
ifdef([AC_LIST_SUBDIRS], [AC_OUTPUT_SUBDIRS(AC_LIST_SUBDIRS)])dnl
])dnl
-dnl
+
dnl This is a subroutine of AC_OUTPUT.
+dnl It is called inside configure, outside of config.status.
dnl AC_OUTPUT_MAKE_DEFS()
AC_DEFUN(AC_OUTPUT_MAKE_DEFS,
[# Transform confdefs.h into DEFS.
EOF
DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '`
rm -f conftest.defs
-])dnl
-dnl
+])
+
dnl This is a subroutine of AC_OUTPUT. It is called inside an unquoted
dnl here document whose contents are going into config.status.
dnl AC_OUTPUT_FILES(FILE...)
" -f conftest.subs $ac_given_srcdir/$ac_file_in > $ac_file
fi; done
rm -f conftest.subs
-])dnl
-dnl
+])
+
dnl This is a subroutine of AC_OUTPUT. It is called inside a quoted
dnl here document whose contents are going into config.status.
dnl AC_OUTPUT_HEADER(HEADER-FILE...)
done
rm -f conftest.vals
-# Now back to your regularly scheduled config.status.
+dnl Now back to your regularly scheduled config.status.
cat >> ${CONFIG_STATUS} <<\EOF
rm -f conftest.frag conftest.h
echo "/* $ac_file. Generated automatically by configure. */" > conftest.h
fi
fi; done
-])dnl
-dnl
+])
+
dnl This is a subroutine of AC_OUTPUT. It is called inside a quoted
dnl here document whose contents are going into config.status.
dnl AC_OUTPUT_LINKS(DEST..., SOURCE...)
[EOF
cat >> ${CONFIG_STATUS} <<EOF
-ac_links="$1"
-ac_files="$2"
+ac_dests="$1"
+ac_sources="$2"
EOF
cat >> ${CONFIG_STATUS} <<\EOF
-while test -n "${ac_files}"; do
- set ${ac_links}; ac_link=[$]1; shift; ac_links=[$]*
- set ${ac_files}; ac_file=[$]1; shift; ac_files=[$]*
+srcdir=$ac_given_srcdir
+while test -n "${ac_sources}"; do
+ set ${ac_dests}; ac_dest=[$]1; shift; ac_dests=[$]*
+ set ${ac_sources}; ac_source=[$]1; shift; ac_sources=[$]*
- echo "linking ${ac_link} to ${srcdir}/${ac_file}"
+ echo "linking ${ac_dest} to ${srcdir}/${ac_source}"
- if test ! -r ${srcdir}/${ac_file}; then
- AC_MSG_ERROR(${srcdir}/${ac_file}: File not found)
+ if test ! -r ${srcdir}/${ac_source}; then
+ AC_MSG_ERROR(${srcdir}/${ac_source}: File not found)
fi
- rm -f ${ac_link}
+ rm -f ${ac_dest}
# Make a symlink if possible; otherwise try a hard link.
- if ln -s ${srcdir}/${ac_file} ${ac_link} 2>/dev/null ||
- ln ${srcdir}/${ac_file} ${ac_link}; then :
+ if ln -s ${srcdir}/${ac_source} ${ac_dest} 2>/dev/null ||
+ ln ${srcdir}/${ac_source} ${ac_dest}; then :
else
- AC_MSG_ERROR(can not link ${ac_link} to ${srcdir}/${ac_file})
+ AC_MSG_ERROR(can not link ${ac_dest} to ${srcdir}/${ac_source})
fi
done
-])dnl
-dnl
+])
+
dnl AC_OUTPUT_SUBDIRS(DIRECTORY...)
AC_DEFUN(AC_OUTPUT_SUBDIRS,
[
-if test "${norecursion}" != yes; then
+if test "${no_recursion}" != yes; then
# Remove --cache-file and --srcdir arguments so they do not pile up.
ac_sub_configure_args=
AC_DEFUN(AC_PROG_RANLIB,
[AC_CHECK_PROG(RANLIB, ranlib, ranlib, :)])
+dnl Check for mawk first since it's said to be faster.
AC_DEFUN(AC_PROG_AWK,
[AC_CHECK_PROGS(AWK, mawk gawk nawk awk, )])
case "$ac_dir" in
''|.|/etc|/usr/sbin|/usr/etc|/sbin|/usr/afsws/bin|/usr/ucb) ;;
*)
- # OSF1 and SCO ODT 3.0 have their own names for install.
- for ac_prog in ginstall installbsd scoinst install; do
+ # OSF1, X11, and SCO ODT 3.0 have their own names for install.
+ for ac_prog in ginstall installbsd bsdinst scoinst install; do
if test -f $ac_dir/$ac_prog; then
if test $ac_prog = install &&
grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
[ac_header_dir=no
AC_CHECK_HEADERS(dirent.h sys/ndir.h sys/dir.h ndir.h,
[ac_header_dir=$ac_hdr; break])
+])
+AC_DEFUN(AC_FUNC_CLOSEDIR_VOID,
+[AC_REQUIRE([AC_HEADER_DIRENT])dnl
AC_MSG_CHECKING(whether closedir returns void)
AC_CACHE_VAL(ac_cv_func_closedir_void,
[AC_TRY_RUN([#include <sys/types.h>
exit(1);
exit(0);
}
-], ac_cv_func_mmap=yes, ac_cv_func_mmap=no)])dnl
+], ac_cv_func_mmap=yes, ac_cv_func_mmap=no, ac_cv_func_mmap=no)])dnl
AC_MSG_RESULT($ac_cv_func_mmap)
if test $ac_cv_func_mmap = yes; then
AC_DEFINE(HAVE_MMAP)
|| fstat(fileno(stdout), &st) != 0
);
}
-}], ac_cv_func_vfork=yes, ac_cv_func_vfork=no)])dnl
+}], ac_cv_func_vfork=yes, ac_cv_func_vfork=no, ac_cv_func_vfork=no)])dnl
AC_MSG_RESULT($ac_cv_func_vfork)
if test $ac_cv_func_vfork = no; then
AC_DEFINE(vfork, fork)
exit(r.ru_nvcsw == 0
&& r.ru_stime.tv_sec == 0 && r.ru_stime.tv_usec == 0);
}
-}], ac_cv_func_wait3=yes, ac_cv_func_wait3=no)])dnl
+}], ac_cv_func_wait3=yes, ac_cv_func_wait3=no, ac_cv_func_wait3=no)])dnl
AC_MSG_RESULT($ac_cv_func_wait3)
if test $ac_cv_func_wait3 = yes; then
AC_DEFINE(HAVE_WAIT3)
fi
])dnl
+dnl FIXME two bugs here:
+dnl Hardwiring the path of getloadavg.c in the top-level directory,
+dnl and not checking whether a getloadavg from a library needs privileges.
AC_MSG_CHECKING(whether getloadavg requires setgid)
AC_CACHE_VAL(ac_cv_func_getloadavg_setgid,
[AC_EGREP_CPP([Yowza Am I SETGID yet],
exit(!(stat ("conftestdata", &s) == 0 && utime("conftestdata", (long *)0) == 0
&& stat("conftestdata", &t) == 0 && t.st_mtime >= s.st_mtime
&& t.st_mtime - s.st_mtime < 120));
-}], ac_cv_func_utime_null=yes, ac_cv_func_utime_null=no)
+}], ac_cv_func_utime_null=yes, ac_cv_func_utime_null=no,
+ ac_cv_func_utime_null=no)
rm -f core])dnl
AC_MSG_RESULT($ac_cv_func_utime_null)
if test $ac_cv_func_utime_null = yes; then
exit (strcoll ("abc", "def") >= 0 ||
strcoll ("ABC", "DEF") >= 0 ||
strcoll ("123", "456") >= 0);
-}], ac_cv_func_strcoll=yes, ac_cv_func_strcoll=no)])dnl
+}], ac_cv_func_strcoll=yes, ac_cv_func_strcoll=no, ac_cv_func_strcoll=no)])dnl
AC_MSG_RESULT($ac_cv_func_strcoll)
if test $ac_cv_func_strcoll = yes; then
AC_DEFINE(HAVE_STRCOLL)
# --without-x overrides everything else, but does not touch the cache.
AC_MSG_CHECKING(for X)
+AC_ARG_WITH(x, [ --with-x use the X Window System])
if test "x$with_x" = xno; then
no_x=yes
else