+2000-05-11 Akim Demaille <akim@epita.fr>
+
+ AC_CONFIG_SUBDIRS needs two lists: one, ac_subdirs_all, which
+ contains all the possible subdirs for `--help=recursive', and
+ another, `subdirs' which can be built dynamically for launching
+ sub configurations.
+
+ * acgeneral.m4 (AC_CONFIG_SUBDIRS): Define `subdirs' dynamically.
+ Define `ac_subdirs_all' statically.
+ Warn if the argument is not a literal.
+ (AC_LIST_SUBDIRS): Rename as...
+ (_AC_LIST_SUBDIRS): this.
+ (_AC_INIT_HELP): Loop over `ac_subdirs_all', not `subdirs'.
+ (_AC_OUTPUT_SUBDIRS): Loop over `subdirs', not `AC_LIST_SUBDIRS'.
+ * doc/autoconf.texi (Subdirectories): Adjust.
+
+ * acgeneral.m4: Replace all the `test ! -d foo && bar' with
+ `test -d foo || bar'.
+
+ * Makefile.am (.m4.m4f): Stop hiding what you're doing.
+ Don't check for GNU m4, let it die.
+
2000-05-11 Akim Demaille <akim@epita.fr>
The Associated Rewriters are even prouder to present...
$(editpl) $< > $@.tmp && chmod +x $@.tmp && mv $@.tmp $@
.m4.m4f:
- @case `$(M4) --help </dev/null 2>&1` in \
- *reload-state*) echo freezing $*.m4; \
- $(M4) -F $*.m4f -I$(srcdir) $(srcdir)/$*.m4 ;; \
- *) echo Error: Autoconf requires GNU m4 1.4 or later; exit 1 ;; \
- esac
+ $(M4) -F $*.m4f -I$(srcdir) $(srcdir)/$*.m4
common = libm4.m4 acgeneral.m4 acspecific.m4 acoldnames.m4 acversion.m4 \
aclang.m4
$(editpl) $< > $@.tmp && chmod +x $@.tmp && mv $@.tmp $@
.m4.m4f:
- @case `$(M4) --help </dev/null 2>&1` in \
- *reload-state*) echo freezing $*.m4; \
- $(M4) -F $*.m4f -I$(srcdir) $(srcdir)/$*.m4 ;; \
- *) echo Error: Autoconf requires GNU m4 1.4 or later; exit 1 ;; \
- esac
+ $(M4) -F $*.m4f -I$(srcdir) $(srcdir)/$*.m4
autoconf.m4f: autoconf.m4 $(common)
-* Major changes in Autoconf 2.14a -*- outline -*-
+* Major changes in Autoconf 2.14a -*- outline -*-
** Use of Automake
All the standard GNU Makefile targets are supported. The layout has
** config.status
- faster
- Much faster on most architectures
+ Much faster on most architectures.
- concurrent executions
It is safe to use `make -j' with config.status.
-- files to links (AC_CONFIG_LINKS) can be specified via CONFIG_LINKS.
-- commands to run (AC_CONFIG_COMMANDS) can be specified via CONFIG_COMMANDS.
- human interface improved
It is possible to invoke
./config.status foobar
- AC_PACKAGE
Identify the configure.in's package.
+
** General changes.
- Uniform quotation
Most macros, if not all, now strictly follow the `one quotation
level' rule. This results in a more predictable expansion.
-** Generic Macros
+
+** Setup Macros
+- AC_ARG_VAR
+ Document and ask for the registration of an envvar.
+
+- AC_CONFIG_COMMANDS
+ To add new actions to config.status. Should be used instead of
+ AC_OUTPUT_COMMANDS.
+
+- AC_CONFIG_LINKS
+ Replaces AC_LINK_FILES.
+
+- AC_CONFIG_SUBDIRS
+ It now has a dynamic behavior: you should no longer use shell
+ variables as argument. Instead of
+
+ test "$package_foo_enabled" = yes && $my_subdirs="$my_subdirs foo"
+ AC_CONFIG_SUBDIRS($my_subdirs)
+
+ write
+
+ if test "$package_foo_enabled" = yes; then
+ AC_CONFIG_SUBDIRS(foo)
+ fi
+
+- AC_HELP_STRING
+ To format an Autoconf macro's help string so that it looks pretty
+ when the user executes `configure --help'.
+
+
+** Generic Test Macros
- AC_CHECK families
The interface of the AC_CHECK families of macros (decl, header,
type, member, func) is now uniform. They support the same set of
Check for given members in aggregates (e.g., pw_gecos in struct
passwd).
-- AC_HELP_STRING
- To format an Autoconf macro's help string so that it looks pretty
- when the user executes `configure --help'.
-
-- AC_ARG_VAR
- Document and ask for the registration of an envvar.
-
-- AC_CONFIG_LINKS
- Replaces AC_LINK_FILES.
-
-- AC_CONFIG_COMMANDS
- To add new actions to config.status. Should be used instead of
- AC_OUTPUT_COMMANDS.
- AC_PROG_CC_STDC
Checks if the compiler supports ISO C, included when needs special
** Specific Macros
-
- AC_PROG_LEX
Now integrates `AC_DECL_YYTEXT' which is obsoleted.
if test "$ac_init_help" = "recursive"; then
# If there are subdirs, report their specific --help.
ac_popdir=`pwd`
- for ac_subdir in : $subdirs; do test "x$ac_subdir" = x: && continue
+ for ac_subdir in : $ac_subdirs_all; do test "x$ac_subdir" = x: && continue
cd $ac_subdir
# A "../" for each directory in /$ac_subdir.
ac_dots=`echo $ac_subdir |
[AC_FATAL(`AC_Dest' [is already registered with AC_CONFIG_HEADER or AC_CONFIG_HEADERS.])])
AC_CONFIG_IF_MEMBER(AC_Dest, [AC_LIST_LINKS],
[AC_FATAL(`AC_Dest' [is already registered with AC_CONFIG_LINKS.])])
- AC_CONFIG_IF_MEMBER(AC_Dest, [AC_LIST_SUBDIRS],
+ AC_CONFIG_IF_MEMBER(AC_Dest, [_AC_LIST_SUBDIRS],
[AC_FATAL(`AC_Dest' [is already registered with AC_CONFIG_SUBDIRS.])])
AC_CONFIG_IF_MEMBER(AC_Dest, [AC_LIST_COMMANDS],
[AC_FATAL(`AC_Dest' [is already registered with AC_CONFIG_COMMANDS.])])
# AC_CONFIG_SUBDIRS(DIR ...)
# --------------------------
-# FIXME: `subdirs=' should not be here.
-AC_DEFUN(AC_CONFIG_SUBDIRS,
+# We define two variables:
+# - ac_subdirs_all
+# is built in the `default' section, and should contain *all*
+# the arguments of AC_CONFIG_SUBDIRS. It is used for --help=recursive.
+# It makes no sense for arguments which are sh variables.
+# - subdirs
+# which is built at runtime, so some of these dirs might not be
+# included, if for instance the user refused a part of the tree.
+# This is used in _AC_OUTPUT_SUBDIRS.
+# _AC_LIST_SUBDIRS is used only for _AC_CONFIG_UNIQUE.
+AC_DEFUN([AC_CONFIG_SUBDIRS],
[_AC_CONFIG_UNIQUE([$1])dnl
AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
-m4_append([AC_LIST_SUBDIRS], [ $1])dnl
-subdirs="AC_LIST_SUBDIRS"
-AC_SUBST(subdirs)dnl
+m4_append([_AC_LIST_SUBDIRS], [ $1])dnl
+AC_VAR_IF_INDIR([$1],
+ [AC_DIAGNOSE(syntax,
+ [$0: you should use literals])])
+AC_DIVERT([DEFAULTS], [ac_subdirs_all="$ac_subdirs_all $1"])
+AC_SUBST(subdirs, "$subdirs $1")dnl
])
# Initialize the list.
-define([AC_LIST_SUBDIRS])
+define([_AC_LIST_SUBDIRS])
# autoupdate::AC_OUTPUT([CONFIG_FILES...], [EXTRA-CMDS], [INIT-CMDS])
test "$no_create" = yes || $SHELL $CONFIG_STATUS || exit 1
dnl config.status should not do recursion.
-ifset([AC_LIST_SUBDIRS], [_AC_OUTPUT_SUBDIRS()])dnl
+AC_PROVIDE_IFELSE([AC_CONFIG_SUBDIRS], [_AC_OUTPUT_SUBDIRS()])dnl
])# AC_OUTPUT
# The file is in a subdirectory.
dnl FIXME: should actually be mkinstalldirs (parents may have
dnl to be created too).
- test ! -d "$ac_dir" && mkdir "$ac_dir"
+ test -d "$ac_dir" || mkdir "$ac_dir"
ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
# A "../" for each directory in $ac_dir_suffix.
ac_dots=`echo "$ac_dir_suffix" | sed 's%/[[^/]]*%../%g'`
# The file is in a subdirectory.
dnl FIXME: should actually be mkinstalldirs (parents may have
dnl to be created too).
- test ! -d "$ac_dir" && mkdir "$ac_dir"
+ test -d "$ac_dir" || mkdir "$ac_dir"
fi
rm -f $ac_file
mv $tmp/config.h $ac_file
# The dest file is in a subdirectory.
dnl FIXME: should actually be mkinstalldirs (parents may have
dnl to be created too).
- test ! -d "$ac_dest_dir" && mkdir "$ac_dest_dir"
+ test -d "$ac_dest_dir" || mkdir "$ac_dest_dir"
ac_dest_dir_suffix="/`echo $ac_dest_dir|sed 's%^\./%%'`"
# A "../" for each directory in $ac_dest_dir_suffix.
ac_dots=`echo $ac_dest_dir_suffix|sed 's%/[[^/]]*%../%g'`
esac
done
-AC_PROVIDE_IFELSE([AC_PROG_INSTALL], [ ac_given_INSTALL=$INSTALL
+AC_PROVIDE_IFELSE([AC_PROG_INSTALL],
+[ ac_given_INSTALL=$INSTALL
])dnl
- for ac_subdir in AC_LIST_SUBDIRS; do
+ for ac_subdir in : $subdirs; do test "x$ac_subdir" = x: && continue
# Do not complain, so a configure script can configure whichever
# parts of a large source tree are present.
- if test ! -d $srcdir/$ac_subdir; then
- continue
- fi
+ test -d $srcdir/$ac_subdir || continue
echo configuring in $ac_subdir
-
case "$srcdir" in
.) ;;
*)
# The recursion is here.
if test -n "$ac_sub_configure"; then
-
# Make the cache file name correct relative to the subdirectory.
case "$cache_file" in
[[\\/]]* | ?:[[\\/]]* ) ac_sub_cache_file=$cache_file ;;
@maindex CONFIG_SUBDIRS
@ovindex subdirs
Make @code{AC_OUTPUT} run @code{configure} in each subdirectory
-@var{dir} in the given whitespace-separated list. If a given @var{dir}
-is not found, no error is reported, so a @code{configure} script can
-configure whichever parts of a large source tree are present. If a
-given @var{dir} contains @file{configure.in} but no @code{configure},
-the Cygnus @code{configure} script found by @code{AC_CONFIG_AUXDIR} is
-used.
-
-The subdirectory @code{configure} scripts are given the same
-command line options that were given to this @code{configure} script,
-with minor changes if needed (e.g., to adjust a relative path for the
-cache file or source directory). This macro also sets the output
-variable @code{subdirs} to the list of directories @samp{@var{dir}
-@dots{}}. @file{Makefile} rules can use this variable to determine
-which subdirectories to recurse into. This macro may be called multiple
+@var{dir} in the given whitespace-separated list. Each @var{dir} should
+be a literal, i.e., please do not use:
+
+@example
+if test "$package_foo_enabled" = yes; then
+ $my_subdirs="$my_subdirs foo"
+fi
+AC_CONFIG_SUBDIRS($my_subdirs)
+@end example
+
+@noindent
+because this prevents @samp{./configure --help=recursive} from
+displaying the options of the package @code{foo}. Rather, you should
+write:
+
+@example
+if test "$package_foo_enabled" = yes then;
+ AC_CONFIG_SUBDIRS(foo)
+fi
+@end example
+
+If a given @var{dir} is not found, no error is reported, so a
+@code{configure} script can configure whichever parts of a large source
+tree are present. If a given @var{dir} contains @file{configure.in} but
+no @code{configure}, the Cygnus @code{configure} script found by
+@code{AC_CONFIG_AUXDIR} is used.
+
+The subdirectory @code{configure} scripts are given the same command
+line options that were given to this @code{configure} script, with minor
+changes if needed (e.g., to adjust a relative path for the cache file or
+source directory). This macro also sets the output variable
+@code{subdirs} to the list of directories @samp{@var{dir} @dots{}}.
+@file{Makefile} rules can use this variable to determine which
+subdirectories to recurse into. This macro may be called multiple
times.
@end defmac
if test "$ac_init_help" = "recursive"; then
# If there are subdirs, report their specific --help.
ac_popdir=`pwd`
- for ac_subdir in : $subdirs; do test "x$ac_subdir" = x: && continue
+ for ac_subdir in : $ac_subdirs_all; do test "x$ac_subdir" = x: && continue
cd $ac_subdir
# A "../" for each directory in /$ac_subdir.
ac_dots=`echo $ac_subdir |
[AC_FATAL(`AC_Dest' [is already registered with AC_CONFIG_HEADER or AC_CONFIG_HEADERS.])])
AC_CONFIG_IF_MEMBER(AC_Dest, [AC_LIST_LINKS],
[AC_FATAL(`AC_Dest' [is already registered with AC_CONFIG_LINKS.])])
- AC_CONFIG_IF_MEMBER(AC_Dest, [AC_LIST_SUBDIRS],
+ AC_CONFIG_IF_MEMBER(AC_Dest, [_AC_LIST_SUBDIRS],
[AC_FATAL(`AC_Dest' [is already registered with AC_CONFIG_SUBDIRS.])])
AC_CONFIG_IF_MEMBER(AC_Dest, [AC_LIST_COMMANDS],
[AC_FATAL(`AC_Dest' [is already registered with AC_CONFIG_COMMANDS.])])
# AC_CONFIG_SUBDIRS(DIR ...)
# --------------------------
-# FIXME: `subdirs=' should not be here.
-AC_DEFUN(AC_CONFIG_SUBDIRS,
+# We define two variables:
+# - ac_subdirs_all
+# is built in the `default' section, and should contain *all*
+# the arguments of AC_CONFIG_SUBDIRS. It is used for --help=recursive.
+# It makes no sense for arguments which are sh variables.
+# - subdirs
+# which is built at runtime, so some of these dirs might not be
+# included, if for instance the user refused a part of the tree.
+# This is used in _AC_OUTPUT_SUBDIRS.
+# _AC_LIST_SUBDIRS is used only for _AC_CONFIG_UNIQUE.
+AC_DEFUN([AC_CONFIG_SUBDIRS],
[_AC_CONFIG_UNIQUE([$1])dnl
AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
-m4_append([AC_LIST_SUBDIRS], [ $1])dnl
-subdirs="AC_LIST_SUBDIRS"
-AC_SUBST(subdirs)dnl
+m4_append([_AC_LIST_SUBDIRS], [ $1])dnl
+AC_VAR_IF_INDIR([$1],
+ [AC_DIAGNOSE(syntax,
+ [$0: you should use literals])])
+AC_DIVERT([DEFAULTS], [ac_subdirs_all="$ac_subdirs_all $1"])
+AC_SUBST(subdirs, "$subdirs $1")dnl
])
# Initialize the list.
-define([AC_LIST_SUBDIRS])
+define([_AC_LIST_SUBDIRS])
# autoupdate::AC_OUTPUT([CONFIG_FILES...], [EXTRA-CMDS], [INIT-CMDS])
test "$no_create" = yes || $SHELL $CONFIG_STATUS || exit 1
dnl config.status should not do recursion.
-ifset([AC_LIST_SUBDIRS], [_AC_OUTPUT_SUBDIRS()])dnl
+AC_PROVIDE_IFELSE([AC_CONFIG_SUBDIRS], [_AC_OUTPUT_SUBDIRS()])dnl
])# AC_OUTPUT
# The file is in a subdirectory.
dnl FIXME: should actually be mkinstalldirs (parents may have
dnl to be created too).
- test ! -d "$ac_dir" && mkdir "$ac_dir"
+ test -d "$ac_dir" || mkdir "$ac_dir"
ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
# A "../" for each directory in $ac_dir_suffix.
ac_dots=`echo "$ac_dir_suffix" | sed 's%/[[^/]]*%../%g'`
# The file is in a subdirectory.
dnl FIXME: should actually be mkinstalldirs (parents may have
dnl to be created too).
- test ! -d "$ac_dir" && mkdir "$ac_dir"
+ test -d "$ac_dir" || mkdir "$ac_dir"
fi
rm -f $ac_file
mv $tmp/config.h $ac_file
# The dest file is in a subdirectory.
dnl FIXME: should actually be mkinstalldirs (parents may have
dnl to be created too).
- test ! -d "$ac_dest_dir" && mkdir "$ac_dest_dir"
+ test -d "$ac_dest_dir" || mkdir "$ac_dest_dir"
ac_dest_dir_suffix="/`echo $ac_dest_dir|sed 's%^\./%%'`"
# A "../" for each directory in $ac_dest_dir_suffix.
ac_dots=`echo $ac_dest_dir_suffix|sed 's%/[[^/]]*%../%g'`
esac
done
-AC_PROVIDE_IFELSE([AC_PROG_INSTALL], [ ac_given_INSTALL=$INSTALL
+AC_PROVIDE_IFELSE([AC_PROG_INSTALL],
+[ ac_given_INSTALL=$INSTALL
])dnl
- for ac_subdir in AC_LIST_SUBDIRS; do
+ for ac_subdir in : $subdirs; do test "x$ac_subdir" = x: && continue
# Do not complain, so a configure script can configure whichever
# parts of a large source tree are present.
- if test ! -d $srcdir/$ac_subdir; then
- continue
- fi
+ test -d $srcdir/$ac_subdir || continue
echo configuring in $ac_subdir
-
case "$srcdir" in
.) ;;
*)
# The recursion is here.
if test -n "$ac_sub_configure"; then
-
# Make the cache file name correct relative to the subdirectory.
case "$cache_file" in
[[\\/]]* | ?:[[\\/]]* ) ac_sub_cache_file=$cache_file ;;