More autoupdate issues.

This commit is contained in:
Stepan Kasal 2006-04-01 15:57:02 +00:00
parent 718a299d81
commit 713895ae5c
6 changed files with 168 additions and 6 deletions

View File

@ -1,3 +1,22 @@
2006-04-01 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* lib/autoconf/general.m4 (AC_COMPILE_CHECK): Prefer
AC_MSG_CHECKING over obsolete AC_CHECKING in autoupdated code.
Remove stray newline in output.
(AC_FOREACH): AU_DEFUN this as literal for autoupdate, and also
AC_DEFUN this for autoconf, including the obsoletion diagnose.
Fixes autoupdating of code where the replacement output contains
m4sugar macros.
* lib/autoconf/lang.m4 (AC_LANG_SAVE): Likewise.
* tests/mktests.sh (ac_exclude_list): Add AC_FOREACH.
(au_exclude_list): Add AC_LANG_SAVE.
* tests/tools.at: Several new tests for all of this.
* doc/autoconf.texi (Obsoleting Macros): Give a hint about the
hairy details.
The AC_LANG_SAVE issue was reported against Libtool by
Dalibor Topic <robilad@kaffe.org>, and against Autoconf 2.57 by
Kristian Kvilekval <kris@cs.ucsb.edu>.
2006-04-01 Stepan Kasal <kasal@ucw.cz>
* bin/autoupdate.in: Handle m4 builtins and m4sugar macros together--

View File

@ -9937,6 +9937,12 @@ replaced by the modern @var{implementation}. @var{message} should
include information on what to do after running @command{autoupdate};
@command{autoupdate} will print it as a warning, and include it
in the updated @file{configure.ac} file.
The details of this macro are hairy: if @command{autoconf} encounters an
@code{AU_DEFUN}ed macro, all macros inside its second argument are expanded
as usual. However, when @command{autoupdate} is run, only M4 and M4sugar
macros will be expanded here, while all other macros are disabled and will
appear literally in the updated @file{configure.ac}.
@end defmac
@defmac AU_ALIAS (@var{old-name}, @var{new-name})

View File

@ -192,7 +192,10 @@ m4_define([AC_OBSOLETE],
# AU::AC_FOREACH(VARIABLE, LIST, EXPRESSION)
# ------------------------------------------
AU_ALIAS([AC_FOREACH], [m4_foreach_w])
AU_DEFUN([AC_FOREACH], [[m4_foreach_w($@)]])
AC_DEFUN([AC_FOREACH], [m4_foreach_w($@)dnl
AC_DIAGNOSE([obsolete], [The macro `AC_FOREACH' is obsolete.
You should run autoupdate.])])
@ -2319,9 +2322,8 @@ AU_DEFUN([AC_TRY_LINK],
# ACTION-IF-FOUND, [ACTION-IF-NOT-FOUND])
# --------------------------------------------------------
AU_DEFUN([AC_COMPILE_CHECK],
[m4_ifvaln([$1], [AC_CHECKING([for $1])])dnl
AC_LINK_IFELSE([AC_LANG_PROGRAM([[$2]], [[$3]])], [$4], [$5])
])
[m4_ifvaln([$1], [AC_MSG_CHECKING([for $1])])dnl
AC_LINK_IFELSE([AC_LANG_PROGRAM([[$2]], [[$3]])], [$4], [$5])])

View File

@ -161,9 +161,13 @@ m4_popdef([$0 OLD])dnl
# ------------
# Save the current language, but don't change language.
AU_DEFUN([AC_LANG_SAVE],
[m4_pushdef([_AC_LANG], _AC_LANG)],
[[AC_LANG_SAVE]],
[Instead of using `AC_LANG', `AC_LANG_SAVE', and `AC_LANG_RESTORE',
you should use `AC_LANG_PUSH' and `AC_LANG_POP'.])
AC_DEFUN([AC_LANG_SAVE],
[m4_pushdef([_AC_LANG], _AC_LANG)dnl
AC_DIAGNOSE([obsolete], [The macro `AC_LANG_SAVE' is obsolete.
You should run autoupdate.])])
# AC_LANG_RESTORE

View File

@ -133,6 +133,9 @@ exclude_list='^ac_cv_prog_(gcc|gxx|g77)$
# - AC_SYS_RESTARTABLE_SYSCALLS, AC_FUNC_WAIT3
# Obsolete, checked in semantics.
#
# - AC_FOREACH
# Obsolete, but needs to be AC_DEFUN'ed.
#
ac_exclude_list='^AC_ARG_VAR$
^AC_CANONICALIZE|AC_PREFIX_PROGRAM|AC_PREREQ$
^AC_CHECK_(ALIGNOF|DECL|FILE|FUNC|HEADER|LIB|MEMBER|PROG|SIZEOF|(TARGET_)?TOOL|TYPE)S?$
@ -156,6 +159,7 @@ ac_exclude_list='^AC_ARG_VAR$
^AC_(CYGWIN|CYGWIN32|EMXOS2|MING32|EXEEXT|OBJEXT)$
^AC_PATH_XTRA$
^AC_SYS_RESTARTABLE_SYSCALLS$
^AC_FOREACH$
_AC_'
@ -167,6 +171,8 @@ ac_exclude_egrep=$exclude_list$ac_exclude_list
# au_exclude_list
# ---------------
# AC_LANG_SAVE
# needs user interaction to be removed.
# AC_LANG_RESTORE
# cannot be used alone.
# AC_LINK_FILES, AC_PREREQ
@ -177,7 +183,7 @@ ac_exclude_egrep=$exclude_list$ac_exclude_list
# are empty.
# AC_CYGWIN, AC_MINGW32, AC_EMXOS2
# are using AC_REQUIRE.
au_exclude_list='^AC_LANG_RESTORE$
au_exclude_list='^AC_LANG_(SAVE|RESTORE)$
^AC_LINK_FILES|AC_PREREQ$
^AC_(INIT|OUTPUT)$
^AC_C_CROSS|AC_PROG_CC_STDC$

View File

@ -594,3 +594,128 @@ AT_CHECK([grep 'AC_HEADER_STDC(' configure.ac], 1, [ignore], [ignore])
AT_CHECK([grep 'AC_HEADER_STDC' configure.ac], 0, [ignore], [ignore])
AT_CLEANUP
# autoupdating OLD to NEW
# -----------------------
# The example taken from the code comments.
AT_SETUP([autoupdating OLD to NEW])
AT_DATA([aclocal.m4],
[[AU_DEFUN([OLD], [NEW([$1, $2], m4@&t@_eval([$1 + $2]))])
AC_DEFUN([NEW], [echo "sum($1) = $2"])
]])
AT_DATA([configure.ac],
[[AC_INIT
OLD(1, 2)
NEW([0, 0], [0])
]])
# Checking `autoupdate'.
AT_CHECK_AUTOUPDATE
AT_CHECK_AUTOCONF
AT_CHECK_CONFIGURE
AT_CHECK([[grep 'NEW(\[1, 2], *\[3])' configure.ac]], 0, [ignore], [ignore])
AT_CHECK([[grep 'NEW(\[0, 0], *\[0])' configure.ac]], 0, [ignore], [ignore])
AT_CLEANUP
# autoupdating AC_HELP_STRING
# ---------------------------
AT_SETUP([autoupdating AC_HELP_STRING])
AT_DATA([configure.ac],
[[AC_INIT
AC_ARG_ENABLE([foo], [AC_HELP_STRING([--enable-foo], [foo bar])], [:], [:])
]])
# Checking `autoupdate'.
AT_CHECK_AUTOUPDATE([], [], [], [ignore])
AT_CHECK_AUTOCONF
AT_CHECK_CONFIGURE([], [], [], [ignore])
AT_CHECK([[grep '\[--enable-foo], *\[foo bar]' configure.ac]], 0, [ignore], [ignore])
AT_CLEANUP
# autoupdating with m4sugar
# -------------------------
AT_SETUP([autoupdating with m4sugar])
AT_DATA([aclocal.m4],
[[AU_DEFUN([OLD],
[m4@&t@_pushdef([foo], [bar])dn@&t@l
echo "foo $1 foo"
m4@&t@_popdef([foo])dn@&t@l
])
]])
touch foo.in
AT_DATA([configure.ac],
[[AC_PREREQ(2.54)
m4_define([gnumeric_version_epoch], [1])
AC_INIT
OLD([ bla bla ])
AC_FOREACH([name], [n1 n2],
[echo name
])
AC_CHECKING([for feature])
AC_MSG_RESULT_UNQUOTED([`echo done`])
AC_OUTPUT([foo])
]])
# Checking `autoupdate'.
AT_CHECK_AUTOUPDATE([], [], [], [ignore])
AT_CHECK_AUTOCONF
AT_CHECK_CONFIGURE([], [], [], [ignore])
AT_CLEANUP
# autoupdating AC_LANG_SAVE
# -------------------------
AT_SETUP([autoupdating AC_LANG_SAVE])
AT_DATA([configure.ac],
[[AC_INIT
AC_LANG_SAVE
AC_LANG_RESTORE
AC_LANG_SAVE
AC_LANG_RESTORE
]])
# Checking `autoupdate'.
AT_CHECK_AUTOUPDATE([], [], [], [ignore])
AT_CHECK_AUTOCONF
AT_CHECK_CONFIGURE([], [], [], [ignore])
AT_CLEANUP
# autoupdating AC_FOREACH
# -----------------------
AT_SETUP([autoupdating AC_FOREACH])
AT_DATA([aclocal.m4],
[[AU_DEFUN([OLD], [AC_FOREACH([myvar], [4 5 6], [' myvar'])])
]])
AT_DATA([configure.ac],
[[AC_INIT
echo AC_FOREACH([myvar], [1 2 3], [' myvar'])OLD
]])
# Checking `autoupdate'.
AT_CHECK_AUTOUPDATE
AT_CHECK([[grep 'echo 1 2 3 4 5 6' configure.ac]], 1, [ignore], [ignore])
AT_CHECK([[grep 'm4@&t@_foreach_w' configure.ac]], 0, [ignore], [ignore])
AT_CHECK_AUTOCONF
AT_CHECK_CONFIGURE([], [0], [stdout])
AT_CHECK([[grep ' 1 2 3 4 5 6' stdout]], 0, [ignore], [ignore])
AT_CLEANUP