]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* lib/autoconf/status.m4 (_AC_OUTPUT_FILE): Expand tests for
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Fri, 23 Jun 2006 14:56:30 +0000 (14:56 +0000)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Fri, 23 Jun 2006 14:56:30 +0000 (14:56 +0000)
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.

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

index 444d8fa308e6ecad362091ca35e268001e7def69..f8be416897027cb2586ee35db1bc33472bc46f97 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/NEWS b/NEWS
index d0df4d815fd434ee4c1aabf1a2e711a2875d7d0f..424bf3da771d3d82f9e0048868dedcf81ac53ff4 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -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.
index 950871f0d36f8ff22ca48fa43e499f87ecaad55d..086487dc6086557103e37d165f2c3b0d8e7a727e 100644 (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
index 71f23a87ea68aa8e7a0408f5be88a755d1b3d425..fd08f8a2a84ec59108fa10475a3f4d5efe0765d7 100644 (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
index f09683a6edeff163fc9586e88d4ab551ee73ae0d..c6c2237495fb9caca549dd4ed1c05247f6c102c2 100644 (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