This patch makes official the support of shell variables, and explains
why it is better not to :)

Index: 0.352/ChangeLog
--- 0.352/ChangeLog Sat, 24 Jun 2000 21:45:42 +0200 akim (ace/34_ChangeLog 1.319 666)
+++ 0.352(w)/ChangeLog Sat, 24 Jun 2000 22:48:47 +0200 akim (ace/34_ChangeLog 1.319 
+666)
@@ -1,5 +1,17 @@
 2000-06-24  Akim Demaille  <[EMAIL PROTECTED]>

+       * acgeneral.m4 (AC_CONFIG_LINKS, AC_CONFIG_HEADERS,
+       AC_CONFIG_COMMANDS, AC_CONFIG_FILES): Use a shell variable instead
+       of an m4 variable to store what must be done, so that sh
+       conditionals are honored.
+       (_AC_OUTPUT_LINKS, _AC_OUTPUT_HEADERS,
+       _AC_OUTPUT_COMMANDS, _AC_OUTPUT_FILES): Adjust.
+       * tests/semantics.m4: Test the four AC_CONFIG sisters.
+       * doc/autoconf.texi (Configuration Actions): Promote the use of
+       literals, show it works properly with sh conditionals.
+
+2000-06-24  Akim Demaille  <[EMAIL PROTECTED]>
+
        * acgeneral.m4 (AC_CACHE_VAL): Too many people put AC_DEFINE in
        the commands-to-set-it part of it.  Give them a warning.

Index: 0.352/NEWS
--- 0.352/NEWS Sat, 24 Jun 2000 20:07:50 +0200 akim (ace/31_NEWS 1.24 666)
+++ 0.352(w)/NEWS Sat, 24 Jun 2000 22:47:24 +0200 akim (ace/31_NEWS 1.24 666)
@@ -110,9 +110,10 @@
 - 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
+- AC_CONFIG_HEADERS, AC_CONFIG_COMMANDS, AC_CONFIG_SUBDIRS,
+  AC_CONFIG_LINKS, and AC_CONFIG_FILES
+  They now obey sh: 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)
@@ -137,8 +138,8 @@
 - AC_CHECK_DECL, AC_CHECK_DECLS
   To check whether a symbol is declared.

-- AC_CHECK_SIZEOF
-  No longer needs a cross-compilation size.
+- AC_CHECK_SIZEOF, AC_C_CHAR_UNSIGNED.
+  No longer need a cross-compilation default.

 - AC_CHECK_TYPE
   The test it performs is much more robust than previously, and makes
Index: 0.352/TODO
--- 0.352/TODO Tue, 06 Jun 2000 18:05:40 +0200 akim (ace/29_TODO 1.42 666)
+++ 0.352(w)/TODO Sat, 24 Jun 2000 22:44:38 +0200 akim (ace/29_TODO 1.42 666)
@@ -24,17 +24,10 @@
 2.15 cannot be released without having `make check' succeed under
 DJGPP.  EMX will be a requirement for the next release, not this one.

-** AC_REQUIRE
-Axel Thimm (Sp?) once sent a very nice bug report about some problems
-when requirements are crossed.  Fix it, and test it.
-
 ** Doc:
 Should we document AC_LANG_* and AC_*_IFELSE?  I hope the interface is
 right...

-** AC_CONFIG_LINKS
-_Must_ support shell variables.  Yet another patch to config.status...
-
 ** autoconf --install
 We must finalize the interface we want.

@@ -45,9 +38,6 @@
 Shouldn't *any* `program' be installed as `$target_alias-program' even
 if AC_ARG_PROGRAM is not called?  That would be much more predictable.
 Ian?
-
-** AC_SYS_LARGEFILE
-We *need* it.

 ** More macros from Jim
 Those related to *_SLASH_*.
Index: 0.352/acgeneral.m4
--- 0.352/acgeneral.m4 Sat, 24 Jun 2000 21:44:31 +0200 akim (ace/27_acgeneral. 
1.169.8.43 664)
+++ 0.352(w)/acgeneral.m4 Sat, 24 Jun 2000 22:23:21 +0200 akim (ace/27_acgeneral. 
+1.169.8.43 664)
@@ -3711,7 +3711,16 @@ AC_DEFUN([AC_CHECK_TYPE],
 #
 # Finally, the `INIT-CMDS' are dumped into a special diversion, via
 # `_AC_CONFIG_COMMANDS_INIT'.  While `COMMANDS' are output once per TAG,
-# `INIT-CMDS' are dumpdef only once per call to AC_CONFIG_FOOS.
+# `INIT-CMDS' are dumped only once per call to AC_CONFIG_FOOS.
+#
+# It also leave the TAG in the shell variable ac_config_foo which contains
+# those which will actually be executed.  In other words:
+#
+#      if false; then
+#        AC_CONFIG_FOOS(bar, [touch bar])
+#      fi
+#
+# will not create bar.
 #
 # AC_CONFIG_FOOS can be called several times (with different TAGs of
 # course).
@@ -3836,6 +3845,7 @@ AC_DEFUN([AC_CONFIG_COMMANDS],
 ])])])
 _AC_CONFIG_COMMANDS_INIT([$3])
 AC_DIVERT_POP()dnl
+ac_config_commands="$ac_config_commands $1"
 ])dnl

 # Initialize the lists.
@@ -3913,6 +3923,7 @@ AC_DEFUN([AC_CONFIG_HEADERS],
 ])])])
 _AC_CONFIG_COMMANDS_INIT([$3])
 AC_DIVERT_POP()dnl
+ac_config_headers="$ac_config_headers $1"
 ])dnl

 # Initialize to empty.  It is much easier and uniform to have a config
@@ -3949,6 +3960,7 @@ AC_DEFUN([AC_CONFIG_LINKS],
 ])])])
 _AC_CONFIG_COMMANDS_INIT([$3])
 AC_DIVERT_POP()dnl
+ac_config_links="$ac_config_links $1"
 ])dnl


@@ -4019,6 +4031,7 @@ AC_DEFUN([AC_CONFIG_FILES],
 ])])])
 _AC_CONFIG_COMMANDS_INIT([$3])
 AC_DIVERT_POP()dnl
+ac_config_files="$ac_config_files $1"
 ])dnl

 # Initialize the lists.
@@ -4144,25 +4157,26 @@ define([_AC_OUTPUT_CONFIG_STATUS],
 me=`echo "$[0]" | sed -e 's,.*/,,'`
 SHELL=${CONFIG_SHELL-/bin/sh}

-# Files that config.status was made for.
-ifset([AC_LIST_FILES], [config_files="\
-m4_wrap(AC_LIST_FILES, [  ])"
-])dnl
-ifset([AC_LIST_HEADERS], [config_headers="\
-m4_wrap(AC_LIST_HEADERS, [  ])"
-])dnl
-EOF
-# Be careful that the expansion of AC_LIST_LINKS (which may contain
-# uses of shell variables) is itself expanded in an unquoted `here'-document.
-cat >>$CONFIG_STATUS <<EOF
-ifset([AC_LIST_LINKS], [config_links="\
-m4_wrap(AC_LIST_LINKS, [  ])"
-])dnl
 EOF
+
+# Files that config.status was made for.
+if test -n "$ac_config_files"; then
+  echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_headers"; then
+  echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_links"; then
+  echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_commands"; then
+  echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS
+fi
+
 cat >>$CONFIG_STATUS <<\EOF
-ifset([AC_LIST_COMMANDS], [config_commands="\
-m4_wrap(AC_LIST_COMMANDS, [  ])"
-])dnl

 ac_cs_usage="\
 \`$me' instantiates files from templates according to the
Index: 0.352/doc/autoconf.texi
--- 0.352/doc/autoconf.texi Sat, 24 Jun 2000 21:45:42 +0200 akim (ace/16_autoconf.t 
1.61.2.39 666)
+++ 0.352(w)/doc/autoconf.texi Sat, 24 Jun 2000 22:37:33 +0200 akim (ace/16_autoconf.t 
+1.61.2.39 666)
@@ -1355,8 +1355,10 @@ @node Configuration Actions, Configurati
 macro @code{AC_CONFIG_COMMANDS}, and @code{AC_CONFIG_LINKS}.  They all
 have this prototype:

+@c Can't use @ovar here, Texinfo 4.0 goes lunatic and emits something
+@c awful.
 @example
-AC_CONFIG_FOOS(@var{tag}..., @ovar{commands}, @ovar{init-cmds})
+AC_CONFIG_FOOS(@var{tag}..., [@var{commands}], [@var{init-cmds}])
 @end example

 @noindent
@@ -1385,6 +1387,22 @@ @node Configuration Actions, Configurati
 All these macros can be called multiple times, with different
 @var{tag}s, of course!

+You are encouraged to use literals as @var{tags}.  In particular, you
+should avoid
+
+@example
+... && my_foos="$my_foos fooo"
+... && my_foos="$my_foos foooo"
+AC_CONFIG_FOOS($my_foos)
+@end example
+
+@noindent
+and use this instead:
+
+@example
+... && AC_CONFIG_FOOS(fooo)
+... && AC_CONFIG_FOOS(foooo)
+@end example

 @node Configuration Files, Makefile Substitutions, Configuration Actions, Setup
 @section Creating Configuration Files
Index: 0.352/tests/semantics.m4
--- 0.352/tests/semantics.m4 Fri, 26 May 2000 23:15:46 +0200 akim (ace/b/25_semantics. 
1.18 666)
+++ 0.352(w)/tests/semantics.m4 Sat, 24 Jun 2000 22:24:30 +0200 akim 
+(ace/b/25_semantics. 1.18 666)
@@ -307,3 +307,50 @@ define([_AC_CHECK_TYPE_OLD], [OLD])
 case "$GCC,$ac_cv_c_const,$ac_cv_c_inline,$ac_cv_c_volatile" in
  yes,*no*) exit 1;;
 esac]])
+
+
+
+
+## ------------- ##
+## Base macros.  ##
+## ------------- ##
+
+
+AT_SETUP([AC_CONFIG_FILES, HEADERS, LINKS and COMMANDS])
+
+AT_DATA(configure.in,
+[[AC_INIT
+rm -rf header file link command
+touch header.in file.in link.in command.in
+case $what_to_test in
+ header)   AC_CONFIG_HEADERS(header:header.in);;
+ file)     AC_CONFIG_FILES(file:file.in);;
+ command)  AC_CONFIG_COMMANDS(command:command.in, [cp command.in command]);;
+ link)     AC_CONFIG_LINKS(link:link.in);;
+esac
+AC_OUTPUT
+]])
+
+AT_CHECK([../autoconf -m .. -l $at_srcdir], 0,, ignore)
+
+# Create a header
+AT_CHECK([./configure what_to_test=header], 0, ignore)
+AT_CHECK([ls header file command link 2>/dev/null], [], [header
+])
+
+# Create a file
+AT_CHECK([./configure what_to_test=file], 0, ignore)
+AT_CHECK([ls header file command link 2>/dev/null], [], [file
+])
+
+# Execute a command
+AT_CHECK([./configure what_to_test=command], 0, ignore)
+AT_CHECK([ls header file command link 2>/dev/null], [], [command
+])
+
+# Create a link
+AT_CHECK([./configure what_to_test=link], 0, ignore)
+AT_CHECK([ls header file command link 2>/dev/null], [], [link
+])
+
+AT_CLEANUP(header file link command header.in file.in link.in command.in configure 
+config.status)

Reply via email to