* lib/autoconf/status.m4 (_AC_OUTPUT_FILE): Expand tests for

datarootdir-related errors only if AC_DATAROOTDIR_CHECKED is
not defined.
* doc/autoconf.texi (Changed Directory Variables): New node,
to document the whole `datarootdir' business a bit better.
* NEWS: Update.
* tests/torture.at (datarootdir workaround): Extend test.
Prompted by report by Alexandre Julliard.
This commit is contained in:
Ralf Wildenhues 2006-06-23 14:56:30 +00:00
parent 49b75d0906
commit c56384c677
5 changed files with 114 additions and 3 deletions

View File

@ -1,3 +1,14 @@
2006-06-23 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* lib/autoconf/status.m4 (_AC_OUTPUT_FILE): Expand tests for
datarootdir-related errors only if AC_DATAROOTDIR_CHECKED is
not defined.
* doc/autoconf.texi (Changed Directory Variables): New node,
to document the whole `datarootdir' business a bit better.
* NEWS: Update.
* tests/torture.at (datarootdir workaround): Extend test.
Prompted by report by Alexandre Julliard.
2006-06-22 Paul Eggert <eggert@cs.ucla.edu>
* lib/autoconf/c.m4 (_AC_PROG_CC_C89): Check for C89 incompatibility

2
NEWS
View File

@ -4,6 +4,8 @@
or LIFO (as in GNU M4 1.4.x). GNU M4 2.0 is expected to conform to Posix
here, so m4wrap/m4_wrap users should no longer depend on LIFO behavior.
** Provide a way to turn off warnings about the changed directory variables.
* Major changes in Autoconf 2.59d
Released 2006-06-05, by Ralf Wildenhues.

View File

@ -318,6 +318,7 @@ Substitutions in Makefiles
* Preset Output Variables:: Output variables that are always set
* Installation Directory Variables:: Other preset output variables
* Changed Directory Variables:: Warnings about @file{datarootdir}
* Build Directories:: Supporting multiple concurrent compiles
* Automatic Remaking:: Makefile rules for configuring
@ -2197,6 +2198,7 @@ makefiles.
@menu
* Preset Output Variables:: Output variables that are always set
* Installation Directory Variables:: Other preset output variables
* Changed Directory Variables:: Warnings about @file{datarootdir}
* Build Directories:: Supporting multiple concurrent compiles
* Automatic Remaking:: Makefile rules for configuring
@end menu
@ -2667,6 +2669,87 @@ macro in @file{configure.ac}.
@xref{Erlang Libraries}, for details.
@node Changed Directory Variables
@subsection Changed Directory Variables
@cindex @file{datarootdir}
In Autoconf 2.60, the set of directory variables has changed, and the
defaults of some variables have been adjusted
(@pxref{Installation Directory Variables}) to changes in the
@acronym{GNU} Coding Standards. Notably, @file{datadir}, @file{infodir}, and
@file{mandir} are now expressed in terms of @file{datarootdir}. If you are
upgrading from an earlier Autoconf version, you may need to adjust your files
to ensure that the directory variables are substituted correctly
(@pxref{Defining Directories}), and that a definition of @file{datarootdir} is
in place. For example, in a @file{Makefile.in}, adding
@example
datarootdir = @@datarootdir@@
@end example
@noindent
is usually sufficient. If you use Automake to create @file{Makefile.in},
it will add this for you.
To help with the transition, Autoconf warns about files that seem to use
@code{datarootdir} without defining it. In some cases, it then expands
the value of @code{$datarootdir} in substitutions of the directory
variables. The following example shows such a warning:
@example
$ @kbd{cat configure.ac}
AC_INIT
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
$ @kbd{cat Makefile.in}
prefix = @@prefix@@
datadir = @@datadir@@
$ @kbd{autoconf}
$ @kbd{configure}
configure: creating ./config.status
config.status: creating Makefile
config.status: WARNING:
Makefile.in seems to ignore the --datarootdir setting
$ @kbd{cat Makefile}
prefix = /usr/local
datadir = $@{prefix@}/share
@end example
Usually one can easily change the file to accommodate both older and newer
Autoconf releases:
@example
$ @kbd{cat Makefile.in}
prefix = @@prefix@@
datarootdir = @@datarootdir@@
datadir = @@datadir@@
$ @kbd{configure}
configure: creating ./config.status
config.status: creating Makefile
$ @kbd{cat Makefile}
prefix = /usr/local
datarootdir = $@{prefix@}/share
datadir = $@{datarootdir@}
@end example
@acindex{DATAROOTDIR_CHECKED}
In some cases, however, the checks may not be able to detect that a suitable
initialization of @code{datarootdir} is in place, or they may fail to detect
that such an initialization is necessary in the output file. If, after
auditing your package, there are still spurious @file{configure} warnings about
@code{datarootdir}, you may add the line
@example
AC_DEFUN([AC_DATAROOTDIR_CHECKED])
@end example
@noindent
to your @file{configure.ac} to disable the warnings. This is an exception
to the usual rule that you should not define a macro whose name begins with
@code{AC_} (@pxref{Macro Names}).
@node Build Directories
@subsection Build Directories
@cindex Build directories

View File

@ -505,7 +505,8 @@ AC_PROVIDE_IFELSE([AC_PROG_MKDIR_P],
])dnl
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
m4_ifndef([AC_DATAROOTDIR_CHECKED],
[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_seen=
@ -530,6 +531,7 @@ cat >>$CONFIG_STATUS <<_ACEOF
s&\\\${datarootdir}&$datarootdir&g' ;;
esac
_ACEOF
])dnl
# Neutralize VPATH when `$srcdir' = `.'.
# Shell code in configure.ac might set extrasub.
@ -550,14 +552,17 @@ m4_foreach([_AC_Var], [srcdir, abs_srcdir, top_srcdir, abs_top_srcdir,
abs_top_builddir]AC_PROVIDE_IFELSE([AC_PROG_INSTALL], [[, INSTALL]])AC_PROVIDE_IFELSE([AC_PROG_MKDIR_P], [[, MKDIR_P]]),
[s&@_AC_Var@&$ac_[]_AC_Var&;t t[]AC_SUBST_TRACE(_AC_Var)
])dnl
$ac_datarootdir_hack
m4_ifndef([AC_DATAROOTDIR_CHECKED], [$ac_datarootdir_hack
])dnl
" $ac_file_inputs m4_defn([_AC_SED_CMDS])>$tmp/out
test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
m4_ifndef([AC_DATAROOTDIR_CHECKED],
[test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
{ ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
{ ac_out=`sed -n '/^[[ ]]*datarootdir[[ ]]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
AC_MSG_WARN([$ac_file contains a reference to the variable `datarootdir'
which seems to be undefined. Please make sure it is defined.])
])dnl
rm -f "$tmp/stdin"
case $ac_file in

View File

@ -673,6 +673,8 @@ AT_DATA([Bar.in],
AT_DATA([configure.ac],
[[AC_INIT
d@&t@nl The following line silences the warnings, if uncommented:
d@&t@nl AC_DEFUN([AC_DATAROOTDIR_CHECKED])
AC_CONFIG_AUX_DIR($top_srcdir/config)
# This substitution is wrong and bogus! Don't use it in your own code!
@ -690,6 +692,14 @@ 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, [])
rm configure
sed '/AC_DEFUN/s/^d@&t@nl //' configure.ac >t
mv t configure.ac
AT_CHECK_AUTOCONF
AT_CHECK_CONFIGURE
AT_CLEANUP