* 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.
This commit is contained in:
Akim Demaille 2000-06-26 10:20:36 +00:00
parent 99f2a140ad
commit 8b3a0fbaae
7 changed files with 148 additions and 52 deletions

View File

@ -1,3 +1,15 @@
2000-06-26 Akim Demaille <akim@epita.fr>
* 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-26 Akim Demaille <akim@epita.fr>
* acgeneral.m4 (AC_CACHE_VAL): Too many people put AC_DEFINE in

11
NEWS
View File

@ -110,9 +110,10 @@ test cases in this new frame work.
- 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 @@ test cases in this new frame work.
- 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

10
TODO
View File

@ -24,17 +24,10 @@ Document --install. Should --install `fix' configure.in for the user?
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.
@ -46,9 +39,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_*.

View File

@ -3713,7 +3713,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).
@ -3838,6 +3847,7 @@ ifelse([$2],,, [AC_FOREACH([AC_Name], [$1],
])])])
_AC_CONFIG_COMMANDS_INIT([$3])
AC_DIVERT_POP()dnl
ac_config_commands="$ac_config_commands $1"
])dnl
# Initialize the lists.
@ -3915,6 +3925,7 @@ ifelse([$2],,, [AC_FOREACH([AC_File], [$1],
])])])
_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
@ -3951,6 +3962,7 @@ ifelse([$2],,, [AC_FOREACH([AC_File], [$1],
])])])
_AC_CONFIG_COMMANDS_INIT([$3])
AC_DIVERT_POP()dnl
ac_config_links="$ac_config_links $1"
])dnl
@ -4021,6 +4033,7 @@ ifelse([$2],,, [AC_FOREACH([AC_File], [$1],
])])])
_AC_CONFIG_COMMANDS_INIT([$3])
AC_DIVERT_POP()dnl
ac_config_files="$ac_config_files $1"
])dnl
# Initialize the lists.
@ -4146,25 +4159,26 @@ debug=false
me=`echo "$[0]" | sed -e 's,.*/,,'`
SHELL=${CONFIG_SHELL-/bin/sh}
EOF
# 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
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

View File

@ -1355,8 +1355,10 @@ instantiating macros: @code{AC_CONFIG_FILES}, @code{AC_CONFIG_HEADERS},
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 @@ needs to run the @var{cmds}. At the difference of @var{cmds}, the
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

View File

@ -3713,7 +3713,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).
@ -3838,6 +3847,7 @@ ifelse([$2],,, [AC_FOREACH([AC_Name], [$1],
])])])
_AC_CONFIG_COMMANDS_INIT([$3])
AC_DIVERT_POP()dnl
ac_config_commands="$ac_config_commands $1"
])dnl
# Initialize the lists.
@ -3915,6 +3925,7 @@ ifelse([$2],,, [AC_FOREACH([AC_File], [$1],
])])])
_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
@ -3951,6 +3962,7 @@ ifelse([$2],,, [AC_FOREACH([AC_File], [$1],
])])])
_AC_CONFIG_COMMANDS_INIT([$3])
AC_DIVERT_POP()dnl
ac_config_links="$ac_config_links $1"
])dnl
@ -4021,6 +4033,7 @@ ifelse([$2],,, [AC_FOREACH([AC_File], [$1],
])])])
_AC_CONFIG_COMMANDS_INIT([$3])
AC_DIVERT_POP()dnl
ac_config_files="$ac_config_files $1"
])dnl
# Initialize the lists.
@ -4146,25 +4159,26 @@ debug=false
me=`echo "$[0]" | sed -e 's,.*/,,'`
SHELL=${CONFIG_SHELL-/bin/sh}
EOF
# 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
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

View File

@ -307,3 +307,50 @@ AC_C_VOLATILE
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)