]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
AC_CONFIG_SUBDIRS needs two lists: one, ac_subdirs_all, which
authorAkim Demaille <akim@epita.fr>
Thu, 11 May 2000 16:56:13 +0000 (16:56 +0000)
committerAkim Demaille <akim@epita.fr>
Thu, 11 May 2000 16:56:13 +0000 (16:56 +0000)
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.

ChangeLog
Makefile.am
Makefile.in
NEWS
acgeneral.m4
doc/autoconf.texi
lib/autoconf/general.m4

index 256460b38566160ab024bff67e9a4d622cc02ee6..0feca70a15667105bd12f577d1da4f7a3f4e9b0b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+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...
index 0675408fbf11a96a7055c47e50ca82c77a7afaac..dcb5217ee05ed382ac4a4929a075f40a4b9817b3 100644 (file)
@@ -88,11 +88,7 @@ editpl = sed -e 's,@''datadir''@,$(pkgdatadir),g' -e 's,@''PERL''@,$(PERL),g' \
        $(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
index def18e33d97002b41ec5647203666d400113577b..84b642388ca246f6ae5a26898369c6230d7b6f2e 100644 (file)
@@ -437,11 +437,7 @@ install-data-hook: INSTALL.txt
        $(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)
 
diff --git a/NEWS b/NEWS
index 3a83d0c84797a31c9304af9e1676a6b71d91d8cf..0c067f74b00366d34c3fd8f804d1a9e82c7823a1 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,4 @@
-* 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
@@ -39,11 +39,9 @@ equivalent.
 
 ** 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
@@ -64,12 +62,43 @@ equivalent.
 - 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
@@ -94,19 +123,6 @@ equivalent.
   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
@@ -118,7 +134,6 @@ equivalent.
 
 
 ** Specific Macros
-
 - AC_PROG_LEX
   Now integrates `AC_DECL_YYTEXT' which is obsoleted.
 
index 6608918261a6e40286ead9de4839c04764cbbcee..a3900985a81510a909466f5a89d4e6d5ab77d4b8 100644 (file)
@@ -1383,7 +1383,7 @@ fi
 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 |
@@ -3483,7 +3483,7 @@ AC_CONFIG_IF_MEMBER(AC_Dest, [AC_LIST_HEADERS],
      [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.])])
@@ -3719,17 +3719,29 @@ define([AC_LIST_FILES_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])
@@ -3801,7 +3813,7 @@ AC_OUTPUT_COMMANDS_POST()dnl
 
 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
 
 
@@ -4152,7 +4164,7 @@ for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
     # 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'`
@@ -4431,7 +4443,7 @@ cat >>$CONFIG_STATUS <<\EOF
       # 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
@@ -4482,7 +4494,7 @@ for ac_file in : $CONFIG_LINKS; do test "x$ac_file" = x: && continue
     # 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'`
@@ -4576,19 +4588,17 @@ if test "$no_recursion" != yes; then
     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
     .) ;;
     *)
@@ -4629,7 +4639,6 @@ dnl to be created too).
 
     # 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 ;;
index 81bf076bde5bddd7e4d93a5711a371ba36525740..6f14647fff3b9e7d41d5a54b490ee239ccf11ac8 100644 (file)
@@ -2095,20 +2095,40 @@ packages in subdirectories.
 @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
 
index 6608918261a6e40286ead9de4839c04764cbbcee..a3900985a81510a909466f5a89d4e6d5ab77d4b8 100644 (file)
@@ -1383,7 +1383,7 @@ fi
 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 |
@@ -3483,7 +3483,7 @@ AC_CONFIG_IF_MEMBER(AC_Dest, [AC_LIST_HEADERS],
      [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.])])
@@ -3719,17 +3719,29 @@ define([AC_LIST_FILES_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])
@@ -3801,7 +3813,7 @@ AC_OUTPUT_COMMANDS_POST()dnl
 
 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
 
 
@@ -4152,7 +4164,7 @@ for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
     # 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'`
@@ -4431,7 +4443,7 @@ cat >>$CONFIG_STATUS <<\EOF
       # 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
@@ -4482,7 +4494,7 @@ for ac_file in : $CONFIG_LINKS; do test "x$ac_file" = x: && continue
     # 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'`
@@ -4576,19 +4588,17 @@ if test "$no_recursion" != yes; then
     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
     .) ;;
     *)
@@ -4629,7 +4639,6 @@ dnl to be created too).
 
     # 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 ;;