]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* lib/autoconf/status.m4 (_AC_OUTPUT_FILE): If we have not seen
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sun, 28 May 2006 12:38:49 +0000 (12:38 +0000)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sun, 28 May 2006 12:38:49 +0000 (12:38 +0000)
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.

ChangeLog
NEWS
lib/autoconf/status.m4
tests/torture.at

index 198f898cd0073eea15555302a64e2b539f8fec11..179ba29d61d081012f6b1a3c9b750ec077821072 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
 
diff --git a/NEWS b/NEWS
index 2bb82ebc0fcc95fdc3e73906760486905771a409..36511d51bd9897b37438875d29d8a4245e6304ef 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -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,
index 13ea507dbc851e13fb76ccc8c62be7437de9a226..cfa0090b87322affcdaec1b762e41a8d7459440e 100644 (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";;
index f3520c08cc6646dec3f9384b676025ae4331478e..f09683a6edeff163fc9586e88d4ab551ee73ae0d 100644 (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