Hello,
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. We both use the same pattern
`sed -n '/@datadir@/p;/@docdir@/p;/@infodir@/p...' ...`
We both decided not to touch the normal AC_SUBST's for these variables.
For the sake of Automake < 1.10, which traces AC_SUBST, these calls
cannotbe removed. And it would be tricky to remove them from
_AC_SUBST_VARS, so it's best to leave the redundant substitutions
in the main sed scripts.
But this means that
> + ac_datadir='$datadir'
> + ac_docdir='$docdir'
...
is not necessary; we can just omit the whole part of the sed program.
Another idea: there is no need to expand ${datarootdir} in the
variables' values; it can be done by the very same sed program:
s&@datadir@&${datarootdir}&g
s&@docdir@&${datarootdir}/doc/${PACKAGE_TARNAME}&g
s&@infodir@&${datarootdir}/info&g
s&@localedir@&${datarootdir}/locale&g
s&@mandir@&${datarootdir}/man&g
s&\${datarootdir}&${prefix}/share&g
(Remember we know the templates cannot contain ${datarootdir}.
And the probablity that this string would be created as a concatenation
from something in the template and something from @datadir@, @docdir@,
and such is very low.)
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.
Attached please find the consolidated version of the patch.
[CCing to autoconf-patches, too.]
Have a nice day,
Stepan Kasal
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.
* NEWS: Advertise this temporary fixup.
Based on a patch by Bruno Haible.
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 19:14:10 -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 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 19:14:12 -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], [datadir, docdir, infodir, localedir, mandir],
+ [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 19:14:12 -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. ##
## -------- ##
_______________________________________________
Autoconf mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/autoconf