Hi Stepan, * Stepan Kasal wrote on Wed, Apr 12, 2006 at 09:47:36PM CEST: > On Wed, Apr 12, 2006 at 08:45:04PM +0200, Ralf Wildenhues wrote: > > here's a patch that I think does more or less what Bruno's patch > > intends to do, against current CVS. > > I worked on the same issue [..]
and your patch is so obviously better than mine, that I installed it, with two minor changes only, a doubled word in NEWS, the other noted below (and a bit more complete ChangeLog entry). > BTW: if someone does > AC_SUBST([mydatadir], [$datadir/my]) > then our hack won't help him. But: > 1) It would be too dangerous to add > s&\${datarootdir}&${prefix}/share&g > after all other substitutions. > 2) He is guilty, he should have written > AC_SUBST([mydatadir], ['${datadir}/my']) > 3) And I hope this is not done so often. Yes, but the patch should cause a warning to be issued in any case. Which makes me be much easier with this. (BTW, shouldn't it be possible to amend `make distcheck' to find out whether the user did that right? Or maybe a `make gnitscheck' or so, as we all know not all users make all directory variables conform to those standards.) Cheers, Ralf > +m4_define([_AC_datarootdir_vars], > + [datadir, docdir, infodir, localedir, mandir]) > +cat >>$CONFIG_STATUS <<_ACEOF > + ac_datarootdir_hack=' > + m4_foreach([_AC_Var], [datadir, docdir, infodir, localedir, mandir], > + [s&@_AC_Var@&$_AC_Var&g Used `m4_defn([_AC_datarootdir_vars])' here instead of listing the variables again. 2006-04-12 Stepan Kasal <[EMAIL PROTECTED]> and Ralf Wildenhues <[EMAIL PROTECTED]> * lib/autoconf/status.m4 (_AC_OUTPUT_FILE): If the templates for the instantiated file do not contain the string 'datarootdir' but contain @datadir@, @docdir@, @infodir@, @localedir@, or @mandir@, replace the reference '${datarootdir}' by the value. * tests/torture.at (datarootdir workaround): New test. * NEWS: Advertise this temporary fixup. Based on a patch by Bruno Haible, reported and analyzed by Paul Eggert and Noah Misch. Index: NEWS =================================================================== RCS file: /cvsroot/autoconf/autoconf/NEWS,v retrieving revision 1.359 diff -u -r1.359 NEWS --- NEWS 10 Apr 2006 17:57:17 -0000 1.359 +++ NEWS 12 Apr 2006 20:35:54 -0000 @@ -25,7 +25,10 @@ This means that if you use any of [EMAIL PROTECTED]@', [EMAIL PROTECTED]@', or [EMAIL PROTECTED]@' in a file, you will have to ensure `${datarootdir}' is - defined in this file. + defined in this file. As a temporary measure, if any of those are + found but no mention of `datarootdir', the substitutions will be + replaced with values that do not contain `${datarootdir}', and a + warning will be issued. ** @top_builddir@ is now a dir name: it is always nonempty and doesn't have a trailing slash. Similar change will be made to ac_top_builddir in a Index: lib/autoconf/status.m4 =================================================================== RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/status.m4,v retrieving revision 1.94 diff -u -r1.94 status.m4 --- lib/autoconf/status.m4 6 Apr 2006 17:38:06 -0000 1.94 +++ lib/autoconf/status.m4 12 Apr 2006 20:26:39 -0000 @@ -496,6 +496,32 @@ ]) _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= +m4_define([_AC_datarootdir_vars], + [datadir, docdir, infodir, localedir, mandir]) +case `sed -n '/datarootdir/ { + p + q +} +m4_foreach([_AC_Var], m4_defn([_AC_datarootdir_vars]), + [/@_AC_Var@/p +])' $ac_file_inputs` in +*datarootdir*) ;; [EMAIL PROTECTED]([EMAIL PROTECTED]|[EMAIL PROTECTED], _AC_datarootdir_vars)@*) + AC_MSG_WARN([$ac_file_inputs seems to ignore the --datarootdir setting]) +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF + ac_datarootdir_hack=' + m4_foreach([_AC_Var], m4_defn([_AC_datarootdir_vars]), + [s&@_AC_Var@&$_AC_Var&g + ])dnl + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? @@ -515,6 +541,7 @@ abs_top_builddir]AC_PROVIDE_IFELSE([AC_PROG_INSTALL], [[, INSTALL]]), [s&@_AC_Var@&$ac_[]_AC_Var&;t t[]AC_SUBST_TRACE(_AC_Var) ])dnl +$ac_datarootdir_hack " $ac_file_inputs m4_defn([_AC_SED_CMDS])>$tmp/out rm -f "$tmp/stdin" Index: tests/torture.at =================================================================== RCS file: /cvsroot/autoconf/autoconf/tests/torture.at,v retrieving revision 1.58 diff -u -r1.58 torture.at --- tests/torture.at 8 Apr 2006 09:07:05 -0000 1.58 +++ tests/torture.at 12 Apr 2006 20:26:39 -0000 @@ -633,6 +633,35 @@ AT_CLEANUP +## ------------------------ ## +## datarootdir workaround. ## +## ------------------------ ## + +AT_SETUP([datarootdir workaround]) + +AT_DATA([Foo.in], [EMAIL PROTECTED]@ [EMAIL PROTECTED]@ [EMAIL PROTECTED]@ [EMAIL PROTECTED]@ [EMAIL PROTECTED]@ +]) + +AT_DATA([configure.ac], +[[AC_INIT +AC_CONFIG_AUX_DIR($top_srcdir/config) +AC_CONFIG_FILES([Foo]) +AC_OUTPUT +]]) + +AT_CHECK_AUTOCONF +AT_CHECK_CONFIGURE([], [], [], + [config.status: WARNING: Foo.in seems to ignore the --datarootdir setting +]) +AT_CHECK([grep datarootdir Foo], 1, []) +AT_CLEANUP + + ## -------- ## ## srcdir. ## ## -------- ##