+2001-06-23 Paolo Bonzini <bonzini@gnu.org>
+
+ * acgeneral.m4 (_AC_OUTPUT_CONFIG_STATUS): Defer parsing of
+ config.status targets to after the evaluation of the INIT-CMDS.
+ Double quote config.status targets (used to be single quoted).
+
+2001-06-23 Akim Demaille <akim@epita.fr>
+
+ * tests/torture.at (CONFIG_FILES, HEADERS, LINKS and COMMANDS):
+ Check the content of the created file.
+ Check the ./config.status command line invocation.
+
2001-06-23 Akim Demaille <akim@epita.fr>
* tests/foreign.at (Libtool): Reject prehistoric versions.
CONFIG_HEADERS="$CONFIG_HEADERS $[1]"
ac_need_defaults=false;;
- # Handling of arguments.
-AC_FOREACH([AC_File], AC_LIST_FILES,
-[ 'm4_patsubst(AC_File, [:.*])' )dnl
- CONFIG_FILES="$CONFIG_FILES AC_File" ;;
-])dnl
-AC_FOREACH([AC_File], AC_LIST_LINKS,
-[ 'm4_patsubst(AC_File, [:.*])' )dnl
- CONFIG_LINKS="$CONFIG_LINKS AC_File" ;;
-])dnl
-AC_FOREACH([AC_File], AC_LIST_COMMANDS,
-[ 'm4_patsubst(AC_File, [:.*])' )dnl
- CONFIG_COMMANDS="$CONFIG_COMMANDS AC_File" ;;
-])dnl
-AC_FOREACH([AC_File], AC_LIST_HEADERS,
-[ 'm4_patsubst(AC_File, [:.*])' )dnl
- CONFIG_HEADERS="$CONFIG_HEADERS AC_File" ;;
-])dnl
-
# This is an error.
-*) AC_MSG_ERROR([unrecognized option: $[1]
Try `$[0] --help' for more information.]) ;;
- *) AC_MSG_ERROR([invalid argument: $[1]]);;
+
+ *) ac_config_targets="$ac_config_targets $[1]" ;;
+
esac
shift
done
_ACEOF
EOF
+dnl We output the INIT-CMDS first for obvious reasons :)
+m4_ifset([_AC_OUTPUT_COMMANDS_INIT],
+[cat >>$CONFIG_STATUS <<EOF
+#
+# INIT-COMMANDS section.
+#
+
+_AC_OUTPUT_COMMANDS_INIT()
+EOF])
+
+
dnl Issue this section only if there were actually config files.
dnl This checks if one of AC_LIST_HEADERS, AC_LIST_FILES, AC_LIST_COMMANDS,
dnl or AC_LIST_LINKS is set.
m4_ifval(AC_LIST_HEADERS()AC_LIST_LINKS()AC_LIST_FILES()AC_LIST_COMMANDS(),
-[cat >>$CONFIG_STATUS <<\EOF
+[
+cat >>$CONFIG_STATUS <<\EOF
+for ac_config_target in $ac_config_targets
+do
+ case "$ac_config_target" in
+ # Handling of arguments.
+AC_FOREACH([AC_File], AC_LIST_FILES,
+[ "m4_patsubst(AC_File, [:.*])" )dnl
+ CONFIG_FILES="$CONFIG_FILES AC_File" ;;
+])dnl
+AC_FOREACH([AC_File], AC_LIST_LINKS,
+[ "m4_patsubst(AC_File, [:.*])" )dnl
+ CONFIG_LINKS="$CONFIG_LINKS AC_File" ;;
+])dnl
+AC_FOREACH([AC_File], AC_LIST_COMMANDS,
+[ "m4_patsubst(AC_File, [:.*])" )dnl
+ CONFIG_COMMANDS="$CONFIG_COMMANDS AC_File" ;;
+])dnl
+AC_FOREACH([AC_File], AC_LIST_HEADERS,
+[ "m4_patsubst(AC_File, [:.*])" )dnl
+ CONFIG_HEADERS="$CONFIG_HEADERS AC_File" ;;
+])dnl
+ *) AC_MSG_ERROR([invalid argument: $ac_config_target]);;
+ esac
+done
+
# If the user did not use the arguments to specify the items to instantiate,
# then the envvar interface is used. Set only those that are not.
# We use the long form for the default assignment because of an extremely
EOF
])[]dnl m4_ifval
-dnl We output the INIT-CMDS first for obvious reasons :)
-m4_ifset([_AC_OUTPUT_COMMANDS_INIT],
-[cat >>$CONFIG_STATUS <<EOF
-#
-# INIT-COMMANDS section.
-#
-
-_AC_OUTPUT_COMMANDS_INIT()
-EOF])
-
-
dnl The following four sections are in charge of their own here
dnl documenting into $CONFIG_STATUS.
m4_ifset([AC_LIST_FILES], [_AC_OUTPUT_FILES()])dnl
CONFIG_HEADERS="$CONFIG_HEADERS $[1]"
ac_need_defaults=false;;
- # Handling of arguments.
-AC_FOREACH([AC_File], AC_LIST_FILES,
-[ 'm4_patsubst(AC_File, [:.*])' )dnl
- CONFIG_FILES="$CONFIG_FILES AC_File" ;;
-])dnl
-AC_FOREACH([AC_File], AC_LIST_LINKS,
-[ 'm4_patsubst(AC_File, [:.*])' )dnl
- CONFIG_LINKS="$CONFIG_LINKS AC_File" ;;
-])dnl
-AC_FOREACH([AC_File], AC_LIST_COMMANDS,
-[ 'm4_patsubst(AC_File, [:.*])' )dnl
- CONFIG_COMMANDS="$CONFIG_COMMANDS AC_File" ;;
-])dnl
-AC_FOREACH([AC_File], AC_LIST_HEADERS,
-[ 'm4_patsubst(AC_File, [:.*])' )dnl
- CONFIG_HEADERS="$CONFIG_HEADERS AC_File" ;;
-])dnl
-
# This is an error.
-*) AC_MSG_ERROR([unrecognized option: $[1]
Try `$[0] --help' for more information.]) ;;
- *) AC_MSG_ERROR([invalid argument: $[1]]);;
+
+ *) ac_config_targets="$ac_config_targets $[1]" ;;
+
esac
shift
done
_ACEOF
EOF
+dnl We output the INIT-CMDS first for obvious reasons :)
+m4_ifset([_AC_OUTPUT_COMMANDS_INIT],
+[cat >>$CONFIG_STATUS <<EOF
+#
+# INIT-COMMANDS section.
+#
+
+_AC_OUTPUT_COMMANDS_INIT()
+EOF])
+
+
dnl Issue this section only if there were actually config files.
dnl This checks if one of AC_LIST_HEADERS, AC_LIST_FILES, AC_LIST_COMMANDS,
dnl or AC_LIST_LINKS is set.
m4_ifval(AC_LIST_HEADERS()AC_LIST_LINKS()AC_LIST_FILES()AC_LIST_COMMANDS(),
-[cat >>$CONFIG_STATUS <<\EOF
+[
+cat >>$CONFIG_STATUS <<\EOF
+for ac_config_target in $ac_config_targets
+do
+ case "$ac_config_target" in
+ # Handling of arguments.
+AC_FOREACH([AC_File], AC_LIST_FILES,
+[ "m4_patsubst(AC_File, [:.*])" )dnl
+ CONFIG_FILES="$CONFIG_FILES AC_File" ;;
+])dnl
+AC_FOREACH([AC_File], AC_LIST_LINKS,
+[ "m4_patsubst(AC_File, [:.*])" )dnl
+ CONFIG_LINKS="$CONFIG_LINKS AC_File" ;;
+])dnl
+AC_FOREACH([AC_File], AC_LIST_COMMANDS,
+[ "m4_patsubst(AC_File, [:.*])" )dnl
+ CONFIG_COMMANDS="$CONFIG_COMMANDS AC_File" ;;
+])dnl
+AC_FOREACH([AC_File], AC_LIST_HEADERS,
+[ "m4_patsubst(AC_File, [:.*])" )dnl
+ CONFIG_HEADERS="$CONFIG_HEADERS AC_File" ;;
+])dnl
+ *) AC_MSG_ERROR([invalid argument: $ac_config_target]);;
+ esac
+done
+
# If the user did not use the arguments to specify the items to instantiate,
# then the envvar interface is used. Set only those that are not.
# We use the long form for the default assignment because of an extremely
EOF
])[]dnl m4_ifval
-dnl We output the INIT-CMDS first for obvious reasons :)
-m4_ifset([_AC_OUTPUT_COMMANDS_INIT],
-[cat >>$CONFIG_STATUS <<EOF
-#
-# INIT-COMMANDS section.
-#
-
-_AC_OUTPUT_COMMANDS_INIT()
-EOF])
-
-
dnl The following four sections are in charge of their own here
dnl documenting into $CONFIG_STATUS.
m4_ifset([AC_LIST_FILES], [_AC_OUTPUT_FILES()])dnl
AT_CHECK_AC_ARG_VAR([change a precious variable],
[apple of my eye], [orange of my eye])
+
+
+
## ---------------------------------------------- ##
## AC_CONFIG_FILES, HEADERS, LINKS and COMMANDS. ##
## ---------------------------------------------- ##
AT_DATA(configure.ac,
[[AC_INIT
-rm -rf header file link command
-touch header.in file.in link.in command.in
+rm -rf header var-header file var-file link var-link command var-command
+echo 'OK' >input
+
+# Be sure to also stress the associated INIT-CMDS.
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);;
+ header)
+ AC_CONFIG_HEADERS(header:input);;
+ var-header)
+ AC_CONFIG_HEADERS(var-header:$header_in, [], [header_in=input]);;
+
+ file)
+ AC_CONFIG_FILES(file:input);;
+ var-file)
+ AC_CONFIG_FILES(var-file:$file_in, [], [file_in=input]);;
+
+ command)
+ AC_CONFIG_COMMANDS(command:input,
+ [cp input command]);;
+ var-command)
+ AC_CONFIG_COMMANDS(var-command:$command_in,
+ [cp $command_in var-command], [command_in=input]);;
+
+ link)
+ AC_CONFIG_LINKS(link:input);;
+ var-link)
+ AC_CONFIG_LINKS(var-link:$link_in, [], [link_in=input]);;
esac
AC_OUTPUT
]])
AT_CHECK_AUTOCONF
-# Create a header
-AT_CHECK_CONFIGURE([what_to_test=header])
-AT_CHECK([ls header file command link], [ignore], [header
-], [ignore])
+
+# AT_CHECK_CONFIG_CREATION(THING = (header | link | file | command))
+# ------------------------------------------------------------------
+# Check that THING and var-THING (which uses variables in AC_CONFIG_THING)
+# are properly created, with the right content.
+# Use `grep OK' instead of a simple `cat' to avoid banners such as in
+# AC_CONFIG_HEADERS.
+m4_define([AT_CHECK_CONFIG_CREATION],
+[AT_CHECK_CONFIGURE([what_to_test=$1])
+AT_CHECK([ls header var-header file var-file command var-command link var-link 2>/dev/null],
+ [ignore], [$1
+])
+AT_CHECK([grep OK $1], [], [OK
+])
+
+AT_CHECK_CONFIGURE([what_to_test=var-$1 --no-create])
+# config.status might be stupidly expecting data on stdin, if it's
+# really broken...
+AT_CHECK([./config.status var-$1 </dev/null], [], [ignore])
+AT_CHECK([ls header var-header file var-file command var-command link var-link 2>/dev/null],
+ [ignore], [var-$1
+])
+AT_CHECK([grep OK var-$1], [], [OK
+])
+])# AT_CHECK_CONFIG_CREATION
+
# Create a file
-AT_CHECK_CONFIGURE([what_to_test=file])
-AT_CHECK([ls header file command link], [ignore], [file
-], [ignore])
+AT_CHECK_CONFIG_CREATION(file)
+
+# Create a header
+AT_CHECK_CONFIG_CREATION(header)
# Execute a command
-AT_CHECK_CONFIGURE([what_to_test=command])
-AT_CHECK([ls header file command link], [ignore], [command
-], [ignore])
+AT_CHECK_CONFIG_CREATION(command)
# Create a link
-AT_CHECK_CONFIGURE([what_to_test=link])
-AT_CHECK([ls header file command link], [ignore], [link
-], [ignore])
+AT_CHECK_CONFIG_CREATION(link)
-AT_CLEANUP(header file link command header.in file.in link.in command.in)
+AT_CLEANUP(header file link commandvar-header var-file var-link var-command
+ input)