TEXI2DVI = texi2dvi
M4 = @M4@
-PROGS = autoconf autoheader autoreconf autoupdate ifnames @PROGS@
+# Programs that are always installed.
+APROGS = autoconf autoheader autoreconf autoupdate ifnames
+PROGS = $(APROGS) @PROGS@
# Path of the perl interpreter.
PERL = @PERL@
SHELL = /bin/sh
SUBDIRS = testsuite
+
+M4FILES = autoconf.m4 acgeneral.m4 acoldnames.m4 acspecific.m4
+
# Files that can be generated, but should be up to date for a distribution.
DISTDEP = info Makefile
# Files to distribute.
DISTFILES = COPYING ChangeLog ChangeLog.1 INSTALL \
- Makefile.in NEWS README TODO \
- acconfig.h acfunctions acgeneral.m4 acheaders acidentifiers \
- acmakevars acoldnames.m4 acprograms acspecific.m4 autoconf.info* \
- autoconf.m4 autoconf.sh autoconf.texi install.texi \
+ Makefile.in NEWS README TODO $(M4FILES) \
+ acconfig.h acfunctions acheaders acidentifiers \
+ acmakevars acprograms autoconf.info* \
+ 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 \
installdirs:
$(SHELL) ${srcdir}/mkinstalldirs $(bindir) $(infodir) $(acdatadir)
-# References to install-info have been removed until it's released.
-install: all autoconf.m4 acgeneral.m4 acoldnames.m4 acspecific.m4 acconfig.h \
- installdirs install-info
+install: all $(M4FILES) acconfig.h installdirs install-info
+ @case `$(M4) --help < /dev/null 2>&1` in \
+ *reload-state*) $(M4) -F $(acdatadir)/autoconf.m4f autoconf.m4 ;; \
+ *traditional*) ;; \
+ *) echo Error: Autoconf requires GNU m4 1.1 or later; exit 1 ;; \
+ esac
for i in autoconf autoheader autoreconf autoupdate ifnames; do \
$(INSTALL_PROGRAM) $$i $(bindir)/$$i; \
done
- for i in autoconf.m4 acgeneral.m4 acoldnames.m4 \
- acspecific.m4 acconfig.h; do \
+ for i in $(M4FILES) acconfig.h; do \
$(INSTALL_DATA) $(srcdir)/$$i $(acdatadir)/$$i; \
done
-if test -f autoscan; then \
if test -f standards.info || test -f $(srcdir)/standards.info; \
then cd $(infodir); rm -f standards.info*; fi
-configure: configure.in autoconf.m4 acgeneral.m4 acspecific.m4 acoldnames.m4
+configure: configure.in $(M4FILES)
cd $(srcdir); \
rm -f $@ $@.tmp; \
$(M4) autoconf.m4 configure.in > $@.tmp && \
** New macros:
* AC_CACHE_VAL to share results of tests between configure runs.
-* AC_DEFUN to define macros and automatically AC_PROVIDE them.
+* 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
support deciding unguessable features based on the host and target types.
* AC_CONFIG_SUBDIRS to recursively configure a source tree.
macro calls.
Producing configuration scripts using Autoconf requires GNU m4. You
-should install GNU m4 (version 1.1 or later) before configuring
-Autoconf, so that Autoconf's configure script can find it. The
-configuration scripts produced by Autoconf are self-contained, so
-their users do not need to have Autoconf (or GNU m4).
+must install GNU m4 (version 1.1 or later, preferably 1.3 or later
+for better performance) before configuring Autoconf, so that
+Autoconf's configure script can find it. The configuration scripts
+produced by Autoconf are self-contained, so their users do not need to
+have Autoconf (or GNU m4).
Also, some optional utilities that come with Autoconf use Perl, TCL,
and the TCL packages Expect and DejaGNU. However, none of those
-dnl Parameterized macros that do not check for something specific.
+dnl Parameterized macros.
dnl Requires GNU m4.
dnl This file is part of Autoconf.
dnl Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
M4 environment variable to its path name.
)m4exit(2)])dnl
dnl
-define(AC_ACVERSION, 1.108)dnl
+define(AC_ACVERSION, 1.109)dnl
dnl This is defined by the --version option of the autoconf script.
ifdef([AC_PRINT_VERSION], [Autoconf version AC_ACVERSION
m4exit(0)])dnl
dnl
dnl
dnl m4 output diversions. We let m4 output them all in order at the end,
-dnl except that we insert AC_DIVERSION_SED into AC_DIVERSION_NORMAL.
-dnl We don't use the default diversion (0) at all.
+dnl except that we explicitly undivert AC_DIVERSION_SED.
+dnl
+dnl AC_DIVERSION_NOTICE - 1 (= 0) AC_REQUIRE'd #!/bin/sh line
define(AC_DIVERSION_NOTICE, 1)dnl copyright notice & option help strings
define(AC_DIVERSION_INIT, 2)dnl initialization code
-define(AC_DIVERSION_NORMAL, 3)dnl the tests and output code
-define(AC_DIVERSION_SED, 6)dnl variable substitutions in config.status
-divert(AC_DIVERSION_NOTICE)dnl
+define(AC_DIVERSION_SED, 3)dnl variable substitutions in config.status
+define(AC_DIVERSION_NORMAL_4, 4)dnl AC_REQUIRE'd code, 4 level deep
+define(AC_DIVERSION_NORMAL_3, 5)dnl AC_REQUIRE'd code, 3 level deep
+define(AC_DIVERSION_NORMAL_2, 6)dnl AC_REQUIRE'd code, 2 level deep
+define(AC_DIVERSION_NORMAL_1, 7)dnl AC_REQUIRE'd code, 1 level deep
+define(AC_DIVERSION_NORMAL, 8)dnl the tests and output code
+dnl
+dnl Change the diversion stream to STREAM, while stacking old values.
+dnl AC_DIVERT_PUSH(STREAM)
+define(AC_DIVERT_PUSH,
+[pushdef([AC_DIVERSION_CURRENT], $1)dnl
+divert(AC_DIVERSION_CURRENT)dnl
+])dnl
+dnl
+dnl Change the diversion stream to its previous value, unstacking it.
+dnl AC_DIVERT_POP()
+define(AC_DIVERT_POP,
+[popdef([AC_DIVERSION_CURRENT])dnl
+divert(AC_DIVERSION_CURRENT)dnl
+])dnl
+dnl
+dnl Initialize the diversion setup.
+define(AC_DIVERSION_CURRENT, AC_DIVERSION_NORMAL)dnl
+AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl will be later POPed by AC_INIT
+dnl
+dnl The prologue for Autoconf macros.
+dnl AC_PRO(MACRO-NAME)
+define(AC_PRO,
+[define([AC_PROVIDE_$1], )dnl
+ifelse(AC_DIVERSION_CURRENT, AC_DIVERSION_NORMAL,
+[AC_DIVERT_PUSH(builtin(eval, AC_DIVERSION_CURRENT - 1))],
+[pushdef([AC_DIVERSION_CURRENT], AC_DIVERSION_CURRENT)])dnl
+])dnl
+dnl
+dnl The Epilogue for Autoconf macros.
+dnl AC_EPI()
+define(AC_EPI,
+[AC_DIVERT_POP()dnl
+ifelse(AC_DIVERSION_CURRENT, AC_DIVERSION_NORMAL,
+[undivert(AC_DIVERSION_NORMAL_4)dnl
+undivert(AC_DIVERSION_NORMAL_3)dnl
+undivert(AC_DIVERSION_NORMAL_2)dnl
+undivert(AC_DIVERSION_NORMAL_1)dnl
+])dnl
+])dnl
dnl
-dnl Define a macro which automatically provides itself.
-dnl Use instead of define for macros to be used as functions.
+dnl Define a macro which automatically provides itself. Add machinery
+dnl so the macro automatically switches expansion to the diversion
+dnl stack if it is not already using it. In this case, once finished,
+dnl it will bring back all the code accumulated in the diversion stack.
+dnl This, combined with AC_REQUIRE, achieves the topological ordering of
+dnl macros.
dnl AC_DEFUN(NAME, EXPANSION)
define([AC_DEFUN],
-[define($1,
-[define([AC_PROVIDE_$1], )][$2])])dnl
+[define($1, [AC_PRO([$1])$2[]AC_EPI()])])dnl
dnl
dnl AC_INIT_NOTICE()
AC_DEFUN(AC_INIT_NOTICE,
fi
])dnl
dnl
-dnl Try to have only one #! line, so the script doesn't look funny.
+dnl Try to have only one #! line, so the script doesn't look funny
+dnl for users of AC_REVISION.
dnl AC_INIT_BINSH()
AC_DEFUN(AC_INIT_BINSH,
[#!/bin/sh
dnl
dnl AC_INIT(UNIQUE-FILE-IN-SOURCE-DIR)
AC_DEFUN(AC_INIT,
-[AC_REQUIRE([AC_INIT_BINSH])dnl
+[sinclude(./aclocal.m4)dnl
+AC_REQUIRE([AC_INIT_BINSH])dnl
AC_INIT_NOTICE
-divert(AC_DIVERSION_INIT)dnl
+AC_DIVERT_POP()dnl to NORMAL
+AC_DIVERT_PUSH(AC_DIVERSION_INIT)dnl
AC_INIT_PARSE_ARGS
AC_INIT_PREPARE($1)dnl
-divert(AC_DIVERSION_NORMAL)dnl
+AC_DIVERT_POP()dnl to NORMAL
])dnl
dnl
dnl AC_INIT_PREPARE(UNIQUE-FILE-IN-SOURCE-DIR)
dnl
dnl AC_ARG_ENABLE(FEATURE, HELP-STRING, ACTION-IF-TRUE [, ACTION-IF-FALSE])
AC_DEFUN(AC_ARG_ENABLE,
-[divert(AC_DIVERSION_NOTICE)dnl
+[AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl
ac_help="${ac_help}
[$2]"
-divert(AC_DIVERSION_NORMAL)dnl
+AC_DIVERT_POP()dnl
[#] Check whether --enable-$1 or --disable-$1 was given.
enableval="[$enable_]patsubst($1, -, _)"
if test -n "$enableval"; then
dnl
dnl AC_ARG_WITH(PACKAGE, HELP-STRING, ACTION-IF-TRUE [, ACTION-IF-FALSE])
AC_DEFUN(AC_ARG_WITH,
-[divert(AC_DIVERSION_NOTICE)dnl
+[AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl
ac_help="${ac_help}
[$2]"
-divert(AC_DIVERSION_NORMAL)dnl
+AC_DIVERT_POP()dnl
[#] Check whether --with-$1 or --without-$1 was given.
withval="[$with_]patsubst($1, -, _)"
if test -n "$withval"; then
AC_DEFUN(AC_SUBST,
[ifdef([AC_SUBST_$1], ,
[define([AC_SUBST_$1], )dnl
-divert(AC_DIVERSION_SED)dnl
+AC_DIVERT_PUSH(AC_DIVERSION_SED)dnl
s%@$1@%[$]$1%g
-divert(AC_DIVERSION_NORMAL)dnl
+AC_DIVERT_POP()dnl
])])dnl
dnl
dnl AC_SUBST_FILE(VARIABLE)
AC_DEFUN(AC_SUBST_FILE,
[ifdef([AC_SUBST_$1], ,
[define([AC_SUBST_$1], )dnl
-divert(AC_DIVERSION_SED)dnl
+AC_DIVERT_PUSH(AC_DIVERSION_SED)dnl
/@$1@/r [$]$1
s%@$1@%%g
-divert(AC_DIVERSION_NORMAL)dnl
+AC_DIVERT_POP()dnl
])])dnl
dnl
dnl
dnl
dnl AC_REQUIRE(MACRO-NAME)
AC_DEFUN(AC_REQUIRE,
-[ifdef([AC_PROVIDE_$1], , [indir([$1])])])dnl
+[ifdef([AC_PROVIDE_$1], ,
+[AC_DIVERT_PUSH(builtin(eval, AC_DIVERSION_CURRENT - 1))dnl
+indir([$1])
+AC_DIVERT_POP()dnl
+])])dnl
dnl
dnl AC_PROVIDE(MACRO-NAME)
define(AC_PROVIDE,
)])dnl
dnl
dnl
-dnl ### Checking for files - fundamental (caching)
+dnl ### Checking for files (caching)
dnl
dnl
dnl AC_CHECK_PROG(VARIABLE, PROG-TO-CHECK-FOR, VALUE-IF-FOUND
AC_SUBST($1)dnl
])dnl
dnl
-dnl
-dnl ### Checking for files - derived (caching)
-dnl
-dnl
dnl AC_CHECK_PROGS(VARIABLE, PROGS-TO-CHECK-FOR [, VALUE-IF-NOT-FOUND])
AC_DEFUN(AC_CHECK_PROGS,
[for ac_prog in $2
[changequote(, )dnl
ac_tr_lib=HAVE_LIB`echo $1 | tr '[a-z]' '[A-Z]'`
changequote([, ])dnl
- AC_DEFINE(${ac_tr_lib})
+ AC_DEFINE_UNQUOTED(${ac_tr_lib})
LIBS="${LIBS} -l$1"
], [$3])
else
])dnl
dnl
dnl
-dnl ### Checking for C features - fundamental (no caching)
+dnl ### Checking for C features - primitive (no caching)
dnl
dnl
dnl AC_EGREP_HEADER(PATTERN, HEADER-FILE, ACTION-IF-FOUND [,
fi
fi
-$M4 -I$AC_MACRODIR $print_version autoconf.m4 $infile > $tmpout || { rm -f $tmpin $tmpout; exit 2; }
+# Use the frozen version of Autoconf if available.
+r= f=
+# Some non-GNU m4's don't reject the --help option, so give them /dev/null.
+case `$M4 --help < /dev/null 2>&1` in
+*reload-state*) test -r $AC_MACRODIR/autoconf.m4f && { r=--reload f=f; } ;;
+*traditional*) ;;
+*) echo Autoconf requires GNU m4 1.1 or later >&2; rm -f $tmpin; exit 1 ;;
+esac
+
+$M4 -I$AC_MACRODIR $print_version $r autoconf.m4$f $infile > $tmpout || { rm -f $tmpin $tmpout; exit 2; }
if test -n "$print_version"; then
cat $tmpout
builtin(include, acspecific.m4)dnl
builtin(include, acoldnames.m4)dnl
sinclude(acsite.m4)dnl
-sinclude(./aclocal.m4)dnl
+dnl Do not sinclude ./aclocal.m4 here, to prevent it from being frozen.
fi
fi
-$M4 -I$AC_MACRODIR $print_version autoconf.m4 $infile > $tmpout || { rm -f $tmpin $tmpout; exit 2; }
+# Use the frozen version of Autoconf if available.
+r= f=
+# Some non-GNU m4's don't reject the --help option, so give them /dev/null.
+case `$M4 --help < /dev/null 2>&1` in
+*reload-state*) test -r $AC_MACRODIR/autoconf.m4f && { r=--reload f=f; } ;;
+*traditional*) ;;
+*) echo Autoconf requires GNU m4 1.1 or later >&2; rm -f $tmpin; exit 1 ;;
+esac
+
+$M4 -I$AC_MACRODIR $print_version $r autoconf.m4$f $infile > $tmpout || { rm -f $tmpin $tmpout; exit 2; }
if test -n "$print_version"; then
cat $tmpout
@c @setchapternewpage odd
@c %**end of header
-@set EDITION 1.108
-@set VERSION 1.108
+@set EDITION 1.109
+@set VERSION 1.109
@set UPDATED August 1994
@iftex
Autoconf requires GNU @code{m4} in order to generate the scripts. It
uses features that some UNIX versions of @code{m4} do not have. It also
overflows internal limits of some versions of @code{m4}, including GNU
-@code{m4} 1.0; you must use version 1.1 or later of GNU @code{m4}.
+@code{m4} 1.0. You must use version 1.1 or later of GNU @code{m4}.
+Using version 1.3 or later will be much faster than 1.1 or 1.2.
@xref{Concerns}, for answers to some common questions about Autoconf.
@xref{Upgrading}, for information about upgrading from version 1.
@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} causes the macro, when
-it is called, to set a flag which is used to constrain the order in
-which macros are called (@pxref{Prerequisite Macros}).
+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}).
An Autoconf macro definition looks like this:
@end display
Many @code{m4} implementations have hard-coded limitations on the size
-and number of macros. They also lack regular expression capabilities
-and other builtins that it would be difficult to get along without in a
-sophisticated application like Autoconf. Since only software
-maintainers need to use Autoconf, and since GNU @code{m4} is simple to
-configure and install, it does not seem like an unreasonable burden to
-require GNU @code{m4} to be installed also. Most maintainers of GNU and
-other free software already have most of the GNU utilities installed,
-since they prefer them.
+and number of macros, which Autoconf exceeds. They also lack several
+builtin macros that it would be difficult to get along without in a
+sophisticated application like Autoconf, including:
+
+@example
+builtin
+indir
+patsubst
+__file__
+__line__
+@end example
+
+Since only software maintainers need to use Autoconf, and since GNU
+@code{m4} is simple to configure and install, it does not seem like an
+unreasonable burden to require GNU @code{m4} to be installed also. Most
+maintainers of GNU and other free software already have most of the GNU
+utilities installed, since they prefer them.
@node Bootstrapping, Policy Decisions, Why GNU m4, Concerns
@section How Can I Bootstrap?
@code{configure} scripts could benefit from some of the new features in
version 2.
-First, make sure you have GNU @code{m4} version 1.1 or higher installed.
-Earlier versions have bugs that prevent them from working with Autoconf
-version 2.
+First, make sure you have GNU @code{m4} version 1.1 or higher installed,
+preferably 1.3 or higher. Versions before 1.1 have bugs that prevent
+them from working with Autoconf version 2. Versions 1.3 and later are
+much faster than earlier versions, because as of version 1.3, GNU
+@code{m4} has a more efficient implementation of diversions and can
+freeze its internal state in a file that it can read back quickly.
@menu
* Changed File Names:: Files you might rename.
@node Changed Macro Writing, , Changed Results, Upgrading
@section Changed Macro Writing
-When defining your own macros, you may now use @code{AC_DEFUN} instead of
-@code{define}, because @code{AC_DEFUN} automatically calls
-@code{AC_PROVIDE}. There's no harm in continuing to use the older way;
-it's just less convenient. @xref{Macro Format}.
+When defining your own macros, you should now use @code{AC_DEFUN}
+instead of @code{define}. @code{AC_DEFUN} automatically calls
+@code{AC_PROVIDE} and ensures that macros called via @code{AC_REQUIRE}
+do not interrupt other macros, to prevent nested @samp{checking@dots{}}
+messages on the screen. There's no actual harm in continuing to use the
+older way, but it's less convenient and attractive. @xref{Macro
+Format}.
You probably looked at the macros that came with Autoconf as a guide for
how to do things. It would be a good idea to take a look at the new
fi
fi
-$M4 -I$AC_MACRODIR $print_version autoconf.m4 $infile > $tmpout || { rm -f $tmpin $tmpout; exit 2; }
+# Use the frozen version of Autoconf if available.
+r= f=
+# Some non-GNU m4's don't reject the --help option, so give them /dev/null.
+case `$M4 --help < /dev/null 2>&1` in
+*reload-state*) test -r $AC_MACRODIR/autoconf.m4f && { r=--reload f=f; } ;;
+*traditional*) ;;
+*) echo Autoconf requires GNU m4 1.1 or later >&2; rm -f $tmpin; exit 1 ;;
+esac
+
+$M4 -I$AC_MACRODIR $print_version $r autoconf.m4$f $infile > $tmpout || { rm -f $tmpin $tmpout; exit 2; }
if test -n "$print_version"; then
cat $tmpout
TEXI2DVI = texi2dvi
M4 = @M4@
-PROGS = autoconf autoheader autoreconf autoupdate ifnames @PROGS@
+# Programs that are always installed.
+APROGS = autoconf autoheader autoreconf autoupdate ifnames
+PROGS = $(APROGS) @PROGS@
# Path of the perl interpreter.
PERL = @PERL@
SHELL = /bin/sh
SUBDIRS = testsuite
+
+M4FILES = autoconf.m4 acgeneral.m4 acoldnames.m4 acspecific.m4
+
# Files that can be generated, but should be up to date for a distribution.
DISTDEP = info Makefile
# Files to distribute.
DISTFILES = COPYING ChangeLog ChangeLog.1 INSTALL \
- Makefile.in NEWS README TODO \
- acconfig.h acfunctions acgeneral.m4 acheaders acidentifiers \
- acmakevars acoldnames.m4 acprograms acspecific.m4 autoconf.info* \
- autoconf.m4 autoconf.sh autoconf.texi install.texi \
+ Makefile.in NEWS README TODO $(M4FILES) \
+ acconfig.h acfunctions acheaders acidentifiers \
+ acmakevars acprograms autoconf.info* \
+ 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 \
installdirs:
$(SHELL) ${srcdir}/mkinstalldirs $(bindir) $(infodir) $(acdatadir)
-# References to install-info have been removed until it's released.
-install: all autoconf.m4 acgeneral.m4 acoldnames.m4 acspecific.m4 acconfig.h \
- installdirs install-info
+install: all $(M4FILES) acconfig.h installdirs install-info
+ @case `$(M4) --help < /dev/null 2>&1` in \
+ *reload-state*) $(M4) -F $(acdatadir)/autoconf.m4f autoconf.m4 ;; \
+ *traditional*) ;; \
+ *) echo Error: Autoconf requires GNU m4 1.1 or later; exit 1 ;; \
+ esac
for i in autoconf autoheader autoreconf autoupdate ifnames; do \
$(INSTALL_PROGRAM) $$i $(bindir)/$$i; \
done
- for i in autoconf.m4 acgeneral.m4 acoldnames.m4 \
- acspecific.m4 acconfig.h; do \
+ for i in $(M4FILES) acconfig.h; do \
$(INSTALL_DATA) $(srcdir)/$$i $(acdatadir)/$$i; \
done
-if test -f autoscan; then \
if test -f standards.info || test -f $(srcdir)/standards.info; \
then cd $(infodir); rm -f standards.info*; fi
-configure: configure.in autoconf.m4 acgeneral.m4 acspecific.m4 acoldnames.m4
+configure: configure.in $(M4FILES)
cd $(srcdir); \
rm -f $@ $@.tmp; \
$(M4) autoconf.m4 configure.in > $@.tmp && \
@c @setchapternewpage odd
@c %**end of header
-@set EDITION 1.108
-@set VERSION 1.108
+@set EDITION 1.109
+@set VERSION 1.109
@set UPDATED August 1994
@iftex
Autoconf requires GNU @code{m4} in order to generate the scripts. It
uses features that some UNIX versions of @code{m4} do not have. It also
overflows internal limits of some versions of @code{m4}, including GNU
-@code{m4} 1.0; you must use version 1.1 or later of GNU @code{m4}.
+@code{m4} 1.0. You must use version 1.1 or later of GNU @code{m4}.
+Using version 1.3 or later will be much faster than 1.1 or 1.2.
@xref{Concerns}, for answers to some common questions about Autoconf.
@xref{Upgrading}, for information about upgrading from version 1.
@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} causes the macro, when
-it is called, to set a flag which is used to constrain the order in
-which macros are called (@pxref{Prerequisite Macros}).
+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}).
An Autoconf macro definition looks like this:
@end display
Many @code{m4} implementations have hard-coded limitations on the size
-and number of macros. They also lack regular expression capabilities
-and other builtins that it would be difficult to get along without in a
-sophisticated application like Autoconf. Since only software
-maintainers need to use Autoconf, and since GNU @code{m4} is simple to
-configure and install, it does not seem like an unreasonable burden to
-require GNU @code{m4} to be installed also. Most maintainers of GNU and
-other free software already have most of the GNU utilities installed,
-since they prefer them.
+and number of macros, which Autoconf exceeds. They also lack several
+builtin macros that it would be difficult to get along without in a
+sophisticated application like Autoconf, including:
+
+@example
+builtin
+indir
+patsubst
+__file__
+__line__
+@end example
+
+Since only software maintainers need to use Autoconf, and since GNU
+@code{m4} is simple to configure and install, it does not seem like an
+unreasonable burden to require GNU @code{m4} to be installed also. Most
+maintainers of GNU and other free software already have most of the GNU
+utilities installed, since they prefer them.
@node Bootstrapping, Policy Decisions, Why GNU m4, Concerns
@section How Can I Bootstrap?
@code{configure} scripts could benefit from some of the new features in
version 2.
-First, make sure you have GNU @code{m4} version 1.1 or higher installed.
-Earlier versions have bugs that prevent them from working with Autoconf
-version 2.
+First, make sure you have GNU @code{m4} version 1.1 or higher installed,
+preferably 1.3 or higher. Versions before 1.1 have bugs that prevent
+them from working with Autoconf version 2. Versions 1.3 and later are
+much faster than earlier versions, because as of version 1.3, GNU
+@code{m4} has a more efficient implementation of diversions and can
+freeze its internal state in a file that it can read back quickly.
@menu
* Changed File Names:: Files you might rename.
@node Changed Macro Writing, , Changed Results, Upgrading
@section Changed Macro Writing
-When defining your own macros, you may now use @code{AC_DEFUN} instead of
-@code{define}, because @code{AC_DEFUN} automatically calls
-@code{AC_PROVIDE}. There's no harm in continuing to use the older way;
-it's just less convenient. @xref{Macro Format}.
+When defining your own macros, you should now use @code{AC_DEFUN}
+instead of @code{define}. @code{AC_DEFUN} automatically calls
+@code{AC_PROVIDE} and ensures that macros called via @code{AC_REQUIRE}
+do not interrupt other macros, to prevent nested @samp{checking@dots{}}
+messages on the screen. There's no actual harm in continuing to use the
+older way, but it's less convenient and attractive. @xref{Macro
+Format}.
You probably looked at the macros that came with Autoconf as a guide for
how to do things. It would be a good idea to take a look at the new
builtin(include, acspecific.m4)dnl
builtin(include, acoldnames.m4)dnl
sinclude(acsite.m4)dnl
-sinclude(./aclocal.m4)dnl
+dnl Do not sinclude ./aclocal.m4 here, to prevent it from being frozen.
-dnl Parameterized macros that do not check for something specific.
+dnl Parameterized macros.
dnl Requires GNU m4.
dnl This file is part of Autoconf.
dnl Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
M4 environment variable to its path name.
)m4exit(2)])dnl
dnl
-define(AC_ACVERSION, 1.108)dnl
+define(AC_ACVERSION, 1.109)dnl
dnl This is defined by the --version option of the autoconf script.
ifdef([AC_PRINT_VERSION], [Autoconf version AC_ACVERSION
m4exit(0)])dnl
dnl
dnl
dnl m4 output diversions. We let m4 output them all in order at the end,
-dnl except that we insert AC_DIVERSION_SED into AC_DIVERSION_NORMAL.
-dnl We don't use the default diversion (0) at all.
+dnl except that we explicitly undivert AC_DIVERSION_SED.
+dnl
+dnl AC_DIVERSION_NOTICE - 1 (= 0) AC_REQUIRE'd #!/bin/sh line
define(AC_DIVERSION_NOTICE, 1)dnl copyright notice & option help strings
define(AC_DIVERSION_INIT, 2)dnl initialization code
-define(AC_DIVERSION_NORMAL, 3)dnl the tests and output code
-define(AC_DIVERSION_SED, 6)dnl variable substitutions in config.status
-divert(AC_DIVERSION_NOTICE)dnl
+define(AC_DIVERSION_SED, 3)dnl variable substitutions in config.status
+define(AC_DIVERSION_NORMAL_4, 4)dnl AC_REQUIRE'd code, 4 level deep
+define(AC_DIVERSION_NORMAL_3, 5)dnl AC_REQUIRE'd code, 3 level deep
+define(AC_DIVERSION_NORMAL_2, 6)dnl AC_REQUIRE'd code, 2 level deep
+define(AC_DIVERSION_NORMAL_1, 7)dnl AC_REQUIRE'd code, 1 level deep
+define(AC_DIVERSION_NORMAL, 8)dnl the tests and output code
+dnl
+dnl Change the diversion stream to STREAM, while stacking old values.
+dnl AC_DIVERT_PUSH(STREAM)
+define(AC_DIVERT_PUSH,
+[pushdef([AC_DIVERSION_CURRENT], $1)dnl
+divert(AC_DIVERSION_CURRENT)dnl
+])dnl
+dnl
+dnl Change the diversion stream to its previous value, unstacking it.
+dnl AC_DIVERT_POP()
+define(AC_DIVERT_POP,
+[popdef([AC_DIVERSION_CURRENT])dnl
+divert(AC_DIVERSION_CURRENT)dnl
+])dnl
+dnl
+dnl Initialize the diversion setup.
+define(AC_DIVERSION_CURRENT, AC_DIVERSION_NORMAL)dnl
+AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl will be later POPed by AC_INIT
+dnl
+dnl The prologue for Autoconf macros.
+dnl AC_PRO(MACRO-NAME)
+define(AC_PRO,
+[define([AC_PROVIDE_$1], )dnl
+ifelse(AC_DIVERSION_CURRENT, AC_DIVERSION_NORMAL,
+[AC_DIVERT_PUSH(builtin(eval, AC_DIVERSION_CURRENT - 1))],
+[pushdef([AC_DIVERSION_CURRENT], AC_DIVERSION_CURRENT)])dnl
+])dnl
+dnl
+dnl The Epilogue for Autoconf macros.
+dnl AC_EPI()
+define(AC_EPI,
+[AC_DIVERT_POP()dnl
+ifelse(AC_DIVERSION_CURRENT, AC_DIVERSION_NORMAL,
+[undivert(AC_DIVERSION_NORMAL_4)dnl
+undivert(AC_DIVERSION_NORMAL_3)dnl
+undivert(AC_DIVERSION_NORMAL_2)dnl
+undivert(AC_DIVERSION_NORMAL_1)dnl
+])dnl
+])dnl
dnl
-dnl Define a macro which automatically provides itself.
-dnl Use instead of define for macros to be used as functions.
+dnl Define a macro which automatically provides itself. Add machinery
+dnl so the macro automatically switches expansion to the diversion
+dnl stack if it is not already using it. In this case, once finished,
+dnl it will bring back all the code accumulated in the diversion stack.
+dnl This, combined with AC_REQUIRE, achieves the topological ordering of
+dnl macros.
dnl AC_DEFUN(NAME, EXPANSION)
define([AC_DEFUN],
-[define($1,
-[define([AC_PROVIDE_$1], )][$2])])dnl
+[define($1, [AC_PRO([$1])$2[]AC_EPI()])])dnl
dnl
dnl AC_INIT_NOTICE()
AC_DEFUN(AC_INIT_NOTICE,
fi
])dnl
dnl
-dnl Try to have only one #! line, so the script doesn't look funny.
+dnl Try to have only one #! line, so the script doesn't look funny
+dnl for users of AC_REVISION.
dnl AC_INIT_BINSH()
AC_DEFUN(AC_INIT_BINSH,
[#!/bin/sh
dnl
dnl AC_INIT(UNIQUE-FILE-IN-SOURCE-DIR)
AC_DEFUN(AC_INIT,
-[AC_REQUIRE([AC_INIT_BINSH])dnl
+[sinclude(./aclocal.m4)dnl
+AC_REQUIRE([AC_INIT_BINSH])dnl
AC_INIT_NOTICE
-divert(AC_DIVERSION_INIT)dnl
+AC_DIVERT_POP()dnl to NORMAL
+AC_DIVERT_PUSH(AC_DIVERSION_INIT)dnl
AC_INIT_PARSE_ARGS
AC_INIT_PREPARE($1)dnl
-divert(AC_DIVERSION_NORMAL)dnl
+AC_DIVERT_POP()dnl to NORMAL
])dnl
dnl
dnl AC_INIT_PREPARE(UNIQUE-FILE-IN-SOURCE-DIR)
dnl
dnl AC_ARG_ENABLE(FEATURE, HELP-STRING, ACTION-IF-TRUE [, ACTION-IF-FALSE])
AC_DEFUN(AC_ARG_ENABLE,
-[divert(AC_DIVERSION_NOTICE)dnl
+[AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl
ac_help="${ac_help}
[$2]"
-divert(AC_DIVERSION_NORMAL)dnl
+AC_DIVERT_POP()dnl
[#] Check whether --enable-$1 or --disable-$1 was given.
enableval="[$enable_]patsubst($1, -, _)"
if test -n "$enableval"; then
dnl
dnl AC_ARG_WITH(PACKAGE, HELP-STRING, ACTION-IF-TRUE [, ACTION-IF-FALSE])
AC_DEFUN(AC_ARG_WITH,
-[divert(AC_DIVERSION_NOTICE)dnl
+[AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl
ac_help="${ac_help}
[$2]"
-divert(AC_DIVERSION_NORMAL)dnl
+AC_DIVERT_POP()dnl
[#] Check whether --with-$1 or --without-$1 was given.
withval="[$with_]patsubst($1, -, _)"
if test -n "$withval"; then
AC_DEFUN(AC_SUBST,
[ifdef([AC_SUBST_$1], ,
[define([AC_SUBST_$1], )dnl
-divert(AC_DIVERSION_SED)dnl
+AC_DIVERT_PUSH(AC_DIVERSION_SED)dnl
s%@$1@%[$]$1%g
-divert(AC_DIVERSION_NORMAL)dnl
+AC_DIVERT_POP()dnl
])])dnl
dnl
dnl AC_SUBST_FILE(VARIABLE)
AC_DEFUN(AC_SUBST_FILE,
[ifdef([AC_SUBST_$1], ,
[define([AC_SUBST_$1], )dnl
-divert(AC_DIVERSION_SED)dnl
+AC_DIVERT_PUSH(AC_DIVERSION_SED)dnl
/@$1@/r [$]$1
s%@$1@%%g
-divert(AC_DIVERSION_NORMAL)dnl
+AC_DIVERT_POP()dnl
])])dnl
dnl
dnl
dnl
dnl AC_REQUIRE(MACRO-NAME)
AC_DEFUN(AC_REQUIRE,
-[ifdef([AC_PROVIDE_$1], , [indir([$1])])])dnl
+[ifdef([AC_PROVIDE_$1], ,
+[AC_DIVERT_PUSH(builtin(eval, AC_DIVERSION_CURRENT - 1))dnl
+indir([$1])
+AC_DIVERT_POP()dnl
+])])dnl
dnl
dnl AC_PROVIDE(MACRO-NAME)
define(AC_PROVIDE,
)])dnl
dnl
dnl
-dnl ### Checking for files - fundamental (caching)
+dnl ### Checking for files (caching)
dnl
dnl
dnl AC_CHECK_PROG(VARIABLE, PROG-TO-CHECK-FOR, VALUE-IF-FOUND
AC_SUBST($1)dnl
])dnl
dnl
-dnl
-dnl ### Checking for files - derived (caching)
-dnl
-dnl
dnl AC_CHECK_PROGS(VARIABLE, PROGS-TO-CHECK-FOR [, VALUE-IF-NOT-FOUND])
AC_DEFUN(AC_CHECK_PROGS,
[for ac_prog in $2
[changequote(, )dnl
ac_tr_lib=HAVE_LIB`echo $1 | tr '[a-z]' '[A-Z]'`
changequote([, ])dnl
- AC_DEFINE(${ac_tr_lib})
+ AC_DEFINE_UNQUOTED(${ac_tr_lib})
LIBS="${LIBS} -l$1"
], [$3])
else
])dnl
dnl
dnl
-dnl ### Checking for C features - fundamental (no caching)
+dnl ### Checking for C features - primitive (no caching)
dnl
dnl
dnl AC_EGREP_HEADER(PATTERN, HEADER-FILE, ACTION-IF-FOUND [,