+1999-10-31 Akim Demaille <akim@epita.fr>
+
+ 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 <akim@epita.fr>
New macro: AC_CONFIG_FILES which is very much like AC_OUTPUT but
[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
])
[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
[$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
AC_SUBST(subdirs)dnl
])
+
dnl AC_OUTPUT([CONFIG_FILES...] [, EXTRA-CMDS] [, INIT-CMDS])
dnl ---------------------------------------------------------
dnl The big finish.
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
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 <bug-autoconf@gnu.org>."
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
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 <<EOF
# If there were arguments, don't assign a default value.
if test \$[#] = 0; then
])dnl
ifdef([AC_LIST_LINKS], [ CONFIG_LINKS="\$config_links"
])dnl
+ifdef([AC_LIST_COMMANDS], [ CONFIG_COMMANDS="\$config_commands"
+])dnl
fi
# Remove all the CONFIG_FILES, and trap to remove the temp files.
ifdef([AC_LIST_FILES],
[AC_OUTPUT_FILES(AC_LIST_FILES)],
[AC_DIVERT_PUSH(AC_DIVERSION_KILL)dnl
-AC_OUTPUT_FILES(AC_LIST_FILES)dnl
-AC_DIVERT_POP()])dnl
-ifdef([AC_LIST_HEADERS], [AC_OUTPUT_HEADER(AC_LIST_HEADERS)])dnl
-ifdef([AC_LIST_LINKS], [AC_OUTPUT_LINKS(AC_LIST_LINKS)])dnl
+ AC_OUTPUT_FILES(AC_LIST_FILES)dnl
+ AC_DIVERT_POP()])dnl
+ifdef([AC_LIST_HEADERS],
+ [AC_OUTPUT_HEADER(AC_LIST_HEADERS)])dnl
+ifdef([AC_LIST_LINKS],
+ [AC_OUTPUT_LINKS(AC_LIST_LINKS)])dnl
+ifdef([AC_LIST_COMMANDS],
+ [AC_OUTPUT_COMMANDS_COMMANDS()])dnl
cat >> $CONFIG_STATUS <<EOF
undivert(AC_DIVERSION_ICMDS)dnl
EOF
])dnl AC_OUTPUT_LINKS
+
+dnl AC_OUTPUT_COMMANDS_COMMANDS
+dnl ---------------------------
+dnl This is a subroutine of AC_OUTPUT, in charge of issuing the code
+dnl related to AC_CONFIG_COMMANDS. The weird name is due to the fact
+dnl that AC_OUTPUT_COMMANDS is already used. This should be fixed.
+dnl
+dnl It has to send itself into $CONFIG_STATUS (eg, via here documents).
+dnl Upon exit, no here document shall be opened.
+define(AC_OUTPUT_COMMANDS_COMMANDS,
+[cat >> $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...)
[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
])
[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
[$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
AC_SUBST(subdirs)dnl
])
+
dnl AC_OUTPUT([CONFIG_FILES...] [, EXTRA-CMDS] [, INIT-CMDS])
dnl ---------------------------------------------------------
dnl The big finish.
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
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 <bug-autoconf@gnu.org>."
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
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 <<EOF
# If there were arguments, don't assign a default value.
if test \$[#] = 0; then
])dnl
ifdef([AC_LIST_LINKS], [ CONFIG_LINKS="\$config_links"
])dnl
+ifdef([AC_LIST_COMMANDS], [ CONFIG_COMMANDS="\$config_commands"
+])dnl
fi
# Remove all the CONFIG_FILES, and trap to remove the temp files.
ifdef([AC_LIST_FILES],
[AC_OUTPUT_FILES(AC_LIST_FILES)],
[AC_DIVERT_PUSH(AC_DIVERSION_KILL)dnl
-AC_OUTPUT_FILES(AC_LIST_FILES)dnl
-AC_DIVERT_POP()])dnl
-ifdef([AC_LIST_HEADERS], [AC_OUTPUT_HEADER(AC_LIST_HEADERS)])dnl
-ifdef([AC_LIST_LINKS], [AC_OUTPUT_LINKS(AC_LIST_LINKS)])dnl
+ AC_OUTPUT_FILES(AC_LIST_FILES)dnl
+ AC_DIVERT_POP()])dnl
+ifdef([AC_LIST_HEADERS],
+ [AC_OUTPUT_HEADER(AC_LIST_HEADERS)])dnl
+ifdef([AC_LIST_LINKS],
+ [AC_OUTPUT_LINKS(AC_LIST_LINKS)])dnl
+ifdef([AC_LIST_COMMANDS],
+ [AC_OUTPUT_COMMANDS_COMMANDS()])dnl
cat >> $CONFIG_STATUS <<EOF
undivert(AC_DIVERSION_ICMDS)dnl
EOF
])dnl AC_OUTPUT_LINKS
+
+dnl AC_OUTPUT_COMMANDS_COMMANDS
+dnl ---------------------------
+dnl This is a subroutine of AC_OUTPUT, in charge of issuing the code
+dnl related to AC_CONFIG_COMMANDS. The weird name is due to the fact
+dnl that AC_OUTPUT_COMMANDS is already used. This should be fixed.
+dnl
+dnl It has to send itself into $CONFIG_STATUS (eg, via here documents).
+dnl Upon exit, no here document shall be opened.
+define(AC_OUTPUT_COMMANDS_COMMANDS,
+[cat >> $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...)