* lib/autoconf/status.m4 (_AC_OUTPUT_FILE): If we have not seen

mention of `datarootdir' in the input file(s), but literal
`${datarootdir}' in the output file, and we haven't warned yet,
then warn as well: the user may have (erroneously) used
`AC_SUBST([mydatadir], [$datadir/my])' instead of the correct
`AC_SUBST([mydatadir], ['${datadir}/my'])'.
* tests/torture.at (datarootdir workaround): Extend this test.
* NEWS: Update.
This commit is contained in:
Ralf Wildenhues 2006-05-28 12:38:49 +00:00
parent 3aba941494
commit 2a801ac193
4 changed files with 34 additions and 3 deletions

View File

@ -1,3 +1,15 @@
2005-05-28 Stepan Kasal <kasal@ucw.cz>
and Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* lib/autoconf/status.m4 (_AC_OUTPUT_FILE): If we have not seen
mention of `datarootdir' in the input file(s), but literal
`${datarootdir}' in the output file, and we haven't warned yet,
then warn as well: the user may have (erroneously) used
`AC_SUBST([mydatadir], [$datadir/my])' instead of the correct
`AC_SUBST([mydatadir], ['${datadir}/my'])'.
* tests/torture.at (datarootdir workaround): Extend this test.
* NEWS: Update.
2006-05-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
and Paul Eggert <eggert@cs.ucla.edu>

3
NEWS
View File

@ -1,5 +1,8 @@
* Major changes in Autoconf 2.59d
** Even more safety checks for the new Directory variables:
Warn about suspicious `${datarootdir}' found in config files output.
** AC_TRY_COMMAND, AC_TRY_EVAL, ac_config_guess, ac_config_sub, ac_configure
These never-documented macros and variables have been marked with
comments saying that they may be removed in a future release,

View File

@ -506,7 +506,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
# If the template does not know about datarootdir, expand it.
# FIXME: This hack should be removed a few years after 2.60.
ac_datarootdir_hack=
ac_datarootdir_hack=; ac_datarootdir_seen=
m4_define([_AC_datarootdir_vars],
[datadir, docdir, infodir, localedir, mandir])
case `sed -n '/datarootdir/ {
@ -516,7 +516,7 @@ case `sed -n '/datarootdir/ {
m4_foreach([_AC_Var], m4_defn([_AC_datarootdir_vars]),
[/@_AC_Var@/p
])' $ac_file_inputs` in
*datarootdir*) ;;
*datarootdir*) ac_datarootdir_seen=yes;;
*@[]m4_join([@*|*@], _AC_datarootdir_vars)@*)
AC_MSG_WARN([$ac_file_inputs seems to ignore the --datarootdir setting])
_ACEOF
@ -551,6 +551,11 @@ m4_foreach([_AC_Var], [srcdir, abs_srcdir, top_srcdir, abs_top_srcdir,
$ac_datarootdir_hack
" $ac_file_inputs m4_defn([_AC_SED_CMDS])>$tmp/out
test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
grep '\${datarootdir}' "$tmp/out" &&
AC_MSG_WARN([$ac_file contains a reference to the variable `datarootdir'
which seems to be undefined. Please make sure it is defined.])
rm -f "$tmp/stdin"
case $ac_file in
-) cat "$tmp/out"; rm -f "$tmp/out";;

View File

@ -667,16 +667,27 @@ AT_DATA([Foo.in],
@mandir@
])
AT_DATA([Bar.in],
[@mydatadir@
])
AT_DATA([configure.ac],
[[AC_INIT
AC_CONFIG_AUX_DIR($top_srcdir/config)
AC_CONFIG_FILES([Foo])
# This substitution is wrong and bogus! Don't use it in your own code!
# Read `info Autoconf "Defining Directories"'!
AC_SUBST([mydatadir], [${datadir}/my])
AC_CONFIG_FILES([Foo Bar])
AC_OUTPUT
]])
AT_CHECK_AUTOCONF
AT_CHECK_CONFIGURE([], [], [],
[config.status: WARNING: Foo.in seems to ignore the --datarootdir setting
config.status: WARNING: Bar contains a reference to the variable `datarootdir'
which seems to be undefined. Please make sure it is defined.
])
AT_CHECK([grep datarootdir Foo], 1, [])
AT_CLEANUP