autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Broken makefile given Autoconf version mismatch


From: Ralf Wildenhues
Subject: Re: Broken makefile given Autoconf version mismatch
Date: Thu, 25 May 2006 15:43:11 +0200
User-agent: Mutt/1.5.11+cvs20060403

Picking up an older thread:

> On Wed, Apr 12, 2006 at 09:47:36PM +0200, Stepan Kasal wrote:
> > BTW: if someone does
> >   AC_SUBST([mydatadir], [$datadir/my])
> > then our hack won't help him.  But:

Right.  My previous conclusion here was simply wrong.  

Changing the output file would certainly be too dangerous.  So all we
could do is add a warning in this case.  This is what the patch below
tries to do.  What do you think?  Useful, or overkill?

The Debian switch to 2.59c has already uncovered another (wrong) usage
case: in an AC_DEFINE*.  Now, we could warn when we find the literal
`${datarootdir}' in the config header output, but I don't think we have
a chance to infer a fixed version from its input file, just in case the
program *really* wants to see, say, the string "${datarootdir}/share".
What do you think?

(It's on purpose that I'm putting warning signs everywhere near the
wrong AC_SUBST ... too many people picking up stuff from anywhere.)

Cheers,
Ralf

2005-05-25  Stepan Kasal  <address@hidden>
        and Ralf Wildenhues <address@hidden>

        * 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.

Index: NEWS
===================================================================
RCS file: /cvsroot/autoconf/autoconf/NEWS,v
retrieving revision 1.372
diff -u -r1.372 NEWS
--- NEWS        22 May 2006 15:54:09 -0000      1.372
+++ NEWS        25 May 2006 13:28:24 -0000
@@ -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_config_guess, ac_config_sub, ac_configure
   These never-documented variables have been marked with a comment
   saying that we intend to remove them in a future release.
Index: lib/autoconf/status.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/status.m4,v
retrieving revision 1.108
diff -u -r1.108 status.m4
--- lib/autoconf/status.m4      23 May 2006 23:30:57 -0000      1.108
+++ lib/autoconf/status.m4      25 May 2006 13:15:20 -0000
@@ -506,7 +506,7 @@
 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 @@
 m4_foreach([_AC_Var], m4_defn([_AC_datarootdir_vars]),
            [/@_AC_Var@/p
 ])' $ac_file_inputs` in
-*datarootdir*) ;;
+*datarootdir*) ac_datarootdir_seen=yes;;
 address@hidden(address@hidden|address@hidden, _AC_datarootdir_vars)@*)
   AC_MSG_WARN([$ac_file_inputs seems to ignore the --datarootdir setting])
 _ACEOF
@@ -562,6 +562,10 @@
 dnl  else
 dnl     rm -f $ac_file; mv "$tmp/out" $ac_file
 dnl  fi
+
+test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
+  grep '\${datarootdir}' $ac_file &&
+  AC_MSG_WARN([ $ac_file seems to ignore the --datarootdir setting])
 ])# _AC_OUTPUT_FILE
 
 
Index: tests/torture.at
===================================================================
RCS file: /cvsroot/autoconf/autoconf/tests/torture.at,v
retrieving revision 1.62
diff -u -r1.62 torture.at
--- tests/torture.at    17 May 2006 02:20:15 -0000      1.62
+++ tests/torture.at    25 May 2006 13:15:26 -0000
@@ -667,16 +667,26 @@
 @mandir@
 ])
 
+AT_DATA([Bar.in],
address@hidden@
+])
+
 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 seems to ignore the --datarootdir setting
 ])
 AT_CHECK([grep datarootdir Foo], 1, [])
 AT_CLEANUP




reply via email to

[Prev in Thread] Current Thread [Next in Thread]