From: Akim Demaille Date: Mon, 20 Dec 1999 13:27:08 +0000 (+0000) Subject: 1999-10-31 Akim Demaille X-Git-Tag: autoconf-2.50~1311 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=627fdb329bd99d95b283c05ee7add726be003a72;p=thirdparty%2Fautoconf.git 1999-10-31 Akim Demaille Add a means to specify commands to be run by config.status. At the difference of AC_OUTPUT_COMMANDS, require that the set of commands be named, so that both CONFIG_COMMANDS=foo ./config.status and ./config.status foo perform the Right Thing. * acgeneral.m4 (AC_CONFIG_UNIQUE): Also check in AC_LIST_COMMANDS. (AC_CONFIG_FILES): Remove a dead pushdef. (AC_CONFIG_COMMANDS): New macro. (AC_LIST_COMMANDS): New config list. (AC_LIST_COMMANDS_COMMANDS): New growing string. (AC_OUTPUT_COMMANDS_COMMANDS): New macro, output config commands in config.status. (AC_OUTPUT): Take AC_LIST_COMMANDS into account. (AC_OUTPUT): Call AC_OUTPUT_COMMANDS_COMMANDS. --- diff --git a/ChangeLog b/ChangeLog index 51e3e9b44..2b3d02fc5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +1999-10-31 Akim Demaille + + Add a means to specify commands to be run by config.status. At + the difference of AC_OUTPUT_COMMANDS, require that the set of + commands be named, so that both + CONFIG_COMMANDS=foo ./config.status + and + ./config.status foo + perform the Right Thing. + + * acgeneral.m4 (AC_CONFIG_UNIQUE): Also check in + AC_LIST_COMMANDS. + (AC_CONFIG_FILES): Remove a dead pushdef. + (AC_CONFIG_COMMANDS): New macro. + (AC_LIST_COMMANDS): New config list. + (AC_LIST_COMMANDS_COMMANDS): New growing string. + (AC_OUTPUT_COMMANDS_COMMANDS): New macro, output config commands + in config.status. + (AC_OUTPUT): Take AC_LIST_COMMANDS into account. + (AC_OUTPUT): Call AC_OUTPUT_COMMANDS_COMMANDS. + 1999-10-31 Akim Demaille New macro: AC_CONFIG_FILES which is very much like AC_OUTPUT but diff --git a/acgeneral.m4 b/acgeneral.m4 index 6d74cd3fe..b870c8c9e 100644 --- a/acgeneral.m4 +++ b/acgeneral.m4 @@ -2911,6 +2911,8 @@ define(AC_CONFIG_UNIQUE, [AC_FATAL(`AC_File' [is already registered with AC_CONFIG_LINKS.])]) AC_CONFIG_IF_MEMBER(AC_File, [AC_LIST_SUBDIRS], [AC_FATAL(`AC_File' [is already registered with AC_CONFIG_SUBDIRS.])]) + AC_CONFIG_IF_MEMBER(AC_File, [AC_LIST_COMMANDS], + [AC_FATAL(`AC_File' [is already registered with AC_CONFIG_COMMANDS.])]) AC_CONFIG_IF_MEMBER(AC_File, [AC_LIST_FILES], [AC_FATAL(`AC_File' [is already registered with AC_CONFIG_FILES or AC_OUTPUT.])])])dnl ]) @@ -2978,11 +2980,34 @@ AC_DEFUN([AC_CONFIG_FILES], [AC_CONFIG_UNIQUE([$1])dnl m4_append([AC_LIST_FILES], [ $1])dnl dnl -pushdef([AC_Prefix], [ ])dnl -dnl ifelse([$2],,, [AC_FOREACH([AC_File], [$1], [m4_append([AC_LIST_FILES_COMMANDS], -[ ]patsubst(AC_File, [:.*])[ ) $2 ;; +[ ]patsubst(AC_File, [:.*])[ ) $2 ;; +])])])dnl +])dnl + + +dnl AC_CONFIG_COMMANDS(NAME..., COMMANDS) +dnl ------------------------------------- +dnl Specify additional commands to be run by config.status. This +dnl commands must be associated with a NAME, which should be thought +dnl as the name of a file the COMMANDS create. +dnl +dnl This name must be a unique config key. +dnl +dnl The commands are stored in a growing string AC_LIST_COMMANDS_COMMANDS +dnl which should be used like this: +dnl +dnl case $ac_file in +dnl AC_LIST_COMMANDS_COMMANDS +dnl esac +AC_DEFUN([AC_CONFIG_COMMANDS], +[AC_CONFIG_UNIQUE([$1])dnl +m4_append([AC_LIST_COMMANDS], [ $1])dnl +dnl +ifelse([$2],,, [AC_FOREACH([AC_Name], [$1], +[m4_append([AC_LIST_COMMANDS_COMMANDS], +[ ]patsubst(AC_Name, [:.*])[ ) $2 ;; ])])])dnl ])dnl @@ -3001,8 +3026,10 @@ AC_DIVERT_PUSH(AC_DIVERSION_ICMDS)dnl [$2] AC_DIVERT_POP()]) + dnl AC_CONFIG_SUBDIRS(DIR ...) dnl -------------------------- +dnl FIXME: `subdirs=' should not be here. AC_DEFUN(AC_CONFIG_SUBDIRS, [AC_CONFIG_UNIQUE([$1])dnl AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl @@ -3011,6 +3038,7 @@ subdirs="AC_LIST_SUBDIRS" AC_SUBST(subdirs)dnl ]) + dnl AC_OUTPUT([CONFIG_FILES...] [, EXTRA-CMDS] [, INIT-CMDS]) dnl --------------------------------------------------------- dnl The big finish. @@ -3071,6 +3099,9 @@ AC_WRAP(AC_LIST_HEADERS, [ ])" ifdef([AC_LIST_LINKS], [config_links="\\ AC_WRAP(AC_LIST_LINKS, [ ])" ])dnl +ifdef([AC_LIST_COMMANDS], [config_commands="\\ +AC_WRAP(AC_LIST_COMMANDS, [ ])" +])dnl ac_cs_usage="\\ \\\`$CONFIG_STATUS' instantiates files from templates according to the @@ -3096,6 +3127,9 @@ ifdef([AC_LIST_HEADERS], [ Configuration headers: ifdef([AC_LIST_LINKS], [ Links to install: \$config_links ])dnl +ifdef([AC_LIST_COMMANDS], [ Individual commands to run: +\$config_commands +])dnl ])dnl Report bugs to ." @@ -3156,6 +3190,16 @@ do esac done test -z "[\$]ac_option" && continue + for ac_file in [\$]config_commands + do + case [\$]ac_file in + [\$]ac_option | [\$]ac_option:* ) + CONFIG_COMMANDS="[\$]CONFIG_COMMANDS [\$]ac_file" + ac_option= + break ;; + esac + done + test -z "[\$]ac_option" && continue echo "$CONFIG_STATUS: invalid argument: [\$]ac_option"; exit 1 ;; esac @@ -3166,7 +3210,7 @@ EOF dnl Issue this section only if there were actually config files. dnl The following test checks if one of AC_LIST_HEADERS, the CONFIG_FILES dnl which are given via $[1], or AC_LIST_LINKS is set. -ifset(ifdef([AC_LIST_HEADERS], 1)ifdef([AC_LIST_LINKS], 1)ifdef([AC_LIST_FILES], 1), +ifset(ifdef([AC_LIST_HEADERS], 1)ifdef([AC_LIST_LINKS], 1)ifdef([AC_LIST_FILES], 1)ifdef([AC_LIST_COMMANDS], 1), [cat >> $CONFIG_STATUS <> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF + +# +# CONFIG_COMMANDS section. +# +for ac_file in .. $CONFIG_COMMANDS; do if test "x$ac_file" != x..; then + ac_dest=`echo "$ac_file"|sed 's%:.*%%'` + ac_source=`echo "$ac_file"|sed 's%@BKL@^:@BKR@*:%%'` + + echo "executing commands of $ac_dest" + case "$ac_dest" in +AC_LIST_COMMANDS_COMMANDS[]dnl + esac +EOF +])dnl AC_OUTPUT_COMMANDS_COMMANDS + + dnl This is a subroutine of AC_OUTPUT. dnl It is called after running config.status. dnl AC_OUTPUT_SUBDIRS(DIRECTORY...) diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4 index 6d74cd3fe..b870c8c9e 100644 --- a/lib/autoconf/general.m4 +++ b/lib/autoconf/general.m4 @@ -2911,6 +2911,8 @@ define(AC_CONFIG_UNIQUE, [AC_FATAL(`AC_File' [is already registered with AC_CONFIG_LINKS.])]) AC_CONFIG_IF_MEMBER(AC_File, [AC_LIST_SUBDIRS], [AC_FATAL(`AC_File' [is already registered with AC_CONFIG_SUBDIRS.])]) + AC_CONFIG_IF_MEMBER(AC_File, [AC_LIST_COMMANDS], + [AC_FATAL(`AC_File' [is already registered with AC_CONFIG_COMMANDS.])]) AC_CONFIG_IF_MEMBER(AC_File, [AC_LIST_FILES], [AC_FATAL(`AC_File' [is already registered with AC_CONFIG_FILES or AC_OUTPUT.])])])dnl ]) @@ -2978,11 +2980,34 @@ AC_DEFUN([AC_CONFIG_FILES], [AC_CONFIG_UNIQUE([$1])dnl m4_append([AC_LIST_FILES], [ $1])dnl dnl -pushdef([AC_Prefix], [ ])dnl -dnl ifelse([$2],,, [AC_FOREACH([AC_File], [$1], [m4_append([AC_LIST_FILES_COMMANDS], -[ ]patsubst(AC_File, [:.*])[ ) $2 ;; +[ ]patsubst(AC_File, [:.*])[ ) $2 ;; +])])])dnl +])dnl + + +dnl AC_CONFIG_COMMANDS(NAME..., COMMANDS) +dnl ------------------------------------- +dnl Specify additional commands to be run by config.status. This +dnl commands must be associated with a NAME, which should be thought +dnl as the name of a file the COMMANDS create. +dnl +dnl This name must be a unique config key. +dnl +dnl The commands are stored in a growing string AC_LIST_COMMANDS_COMMANDS +dnl which should be used like this: +dnl +dnl case $ac_file in +dnl AC_LIST_COMMANDS_COMMANDS +dnl esac +AC_DEFUN([AC_CONFIG_COMMANDS], +[AC_CONFIG_UNIQUE([$1])dnl +m4_append([AC_LIST_COMMANDS], [ $1])dnl +dnl +ifelse([$2],,, [AC_FOREACH([AC_Name], [$1], +[m4_append([AC_LIST_COMMANDS_COMMANDS], +[ ]patsubst(AC_Name, [:.*])[ ) $2 ;; ])])])dnl ])dnl @@ -3001,8 +3026,10 @@ AC_DIVERT_PUSH(AC_DIVERSION_ICMDS)dnl [$2] AC_DIVERT_POP()]) + dnl AC_CONFIG_SUBDIRS(DIR ...) dnl -------------------------- +dnl FIXME: `subdirs=' should not be here. AC_DEFUN(AC_CONFIG_SUBDIRS, [AC_CONFIG_UNIQUE([$1])dnl AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl @@ -3011,6 +3038,7 @@ subdirs="AC_LIST_SUBDIRS" AC_SUBST(subdirs)dnl ]) + dnl AC_OUTPUT([CONFIG_FILES...] [, EXTRA-CMDS] [, INIT-CMDS]) dnl --------------------------------------------------------- dnl The big finish. @@ -3071,6 +3099,9 @@ AC_WRAP(AC_LIST_HEADERS, [ ])" ifdef([AC_LIST_LINKS], [config_links="\\ AC_WRAP(AC_LIST_LINKS, [ ])" ])dnl +ifdef([AC_LIST_COMMANDS], [config_commands="\\ +AC_WRAP(AC_LIST_COMMANDS, [ ])" +])dnl ac_cs_usage="\\ \\\`$CONFIG_STATUS' instantiates files from templates according to the @@ -3096,6 +3127,9 @@ ifdef([AC_LIST_HEADERS], [ Configuration headers: ifdef([AC_LIST_LINKS], [ Links to install: \$config_links ])dnl +ifdef([AC_LIST_COMMANDS], [ Individual commands to run: +\$config_commands +])dnl ])dnl Report bugs to ." @@ -3156,6 +3190,16 @@ do esac done test -z "[\$]ac_option" && continue + for ac_file in [\$]config_commands + do + case [\$]ac_file in + [\$]ac_option | [\$]ac_option:* ) + CONFIG_COMMANDS="[\$]CONFIG_COMMANDS [\$]ac_file" + ac_option= + break ;; + esac + done + test -z "[\$]ac_option" && continue echo "$CONFIG_STATUS: invalid argument: [\$]ac_option"; exit 1 ;; esac @@ -3166,7 +3210,7 @@ EOF dnl Issue this section only if there were actually config files. dnl The following test checks if one of AC_LIST_HEADERS, the CONFIG_FILES dnl which are given via $[1], or AC_LIST_LINKS is set. -ifset(ifdef([AC_LIST_HEADERS], 1)ifdef([AC_LIST_LINKS], 1)ifdef([AC_LIST_FILES], 1), +ifset(ifdef([AC_LIST_HEADERS], 1)ifdef([AC_LIST_LINKS], 1)ifdef([AC_LIST_FILES], 1)ifdef([AC_LIST_COMMANDS], 1), [cat >> $CONFIG_STATUS <> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF + +# +# CONFIG_COMMANDS section. +# +for ac_file in .. $CONFIG_COMMANDS; do if test "x$ac_file" != x..; then + ac_dest=`echo "$ac_file"|sed 's%:.*%%'` + ac_source=`echo "$ac_file"|sed 's%@BKL@^:@BKR@*:%%'` + + echo "executing commands of $ac_dest" + case "$ac_dest" in +AC_LIST_COMMANDS_COMMANDS[]dnl + esac +EOF +])dnl AC_OUTPUT_COMMANDS_COMMANDS + + dnl This is a subroutine of AC_OUTPUT. dnl It is called after running config.status. dnl AC_OUTPUT_SUBDIRS(DIRECTORY...)