]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* doc/autoconf.texi (AC_LIBOBJ vs. LIBOBJS): New.
authorAkim Demaille <akim@epita.fr>
Mon, 4 Mar 2002 15:09:20 +0000 (15:09 +0000)
committerAkim Demaille <akim@epita.fr>
Mon, 4 Mar 2002 15:09:20 +0000 (15:09 +0000)
* lib/autoconf/general.m4 (AC_INIT): More informative error
message for LIBOBJ.

ChangeLog
NEWS
doc/autoconf.texi
lib/autoconf/general.m4

index 168604576ec4198237135bf9303fdac09fac1a15..28f1ac366ce25271522a9671ec5536f5175d0cbe 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2002-03-04  Akim Demaille  <akim@epita.fr>
+
+       * doc/autoconf.texi (AC_LIBOBJ vs. LIBOBJS): New.
+       * lib/autoconf/general.m4 (AC_INIT): More informative error
+       message for LIBOBJ.
+
 2002-03-04  Akim Demaille  <akim@epita.fr>
 
        * lib/freeze.mk ($(build_libdir)/m4sugar/version.m4): New, for
diff --git a/NEWS b/NEWS
index 52a839e18afaa3c7b886ca669e73043743e7d015..671da3c1afb00b87190a7758bd73d942f3ecfaf0 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -22,6 +22,9 @@
   types.
   Emphasizes that `cross-compilation' == `--host is given'.
   If you are working on compilers etc., be sure to read this section.
+- Section `AC_LIBOBJ vs. LIBOBJS'
+  Explains why assigning LIBOBJS directly is now an error.
+  Details how to update the code.
 
 ** configure
 
index 7f73c6b17812fc59b87cc5c603753cb660e122bb..dc4e64554d911c60558b9d5c2c47d888ae1b1897 100644 (file)
@@ -412,6 +412,7 @@ Upgrading From Version 2.13
 * Changed Quotation::           Broken code which used to work
 * New Macros::                  Interaction with foreign macros
 * Hosts and Cross-Compilation::  Bugward compatibility kludges
+* AC_LIBOBJ vs. LIBOBJS::
 
 Generating Test Suites with Autotest
 
@@ -11493,6 +11494,7 @@ features in version 2.50; the changes are summarized in the file
 * Changed Quotation::           Broken code which used to work
 * New Macros::                  Interaction with foreign macros
 * Hosts and Cross-Compilation::  Bugward compatibility kludges
+* AC_LIBOBJ vs. LIBOBJS::       LIBOBJS is a forbidden token
 @end menu
 
 @node Changed Quotation
@@ -11735,6 +11737,91 @@ configure as follows:
 @end example
 
 
+@node AC_LIBOBJ vs. LIBOBJS
+@subsection @code{AC_LIBOBJ} vs. @code{LIBOBJS}
+
+Up to Autoconf 2.13, the replacement of functions was triggered via the
+variable @code{LIBOBJS}.  Since Autoconf 2.50, the macro
+@code{AC_LIBOBJ} should be used instead (@pxref{Generic Functions}).
+Starting at Autoconf 2.53, the use of @code{LIBOBJS} is an error.
+
+This change is mandated by the unification of the GNU Build System
+components.  In particular, the various fragile techniques used to parse
+a @file{configure.ac} are all replaced with the use of traces.  As a
+consequence, any action must be traceable, which obsoletes critical
+variable assignments.  Fortunately, @code{LIBOBJS} was the only problem.
+
+At the time this documentation is written, Automake does not rely on
+traces yet, but this is planed for a near future.  Nevertheless, to
+ease the transition, and to guarantee this future Automake release will
+be able to use Autoconf 2.53, using @code{LIBOBJS} directly will make
+@command{autoconf} fail.  But note that the output, @command{configure},
+is correct and fully functional: you have some delay to adjust your
+source.
+
+There are two typical uses of @code{LIBOBJS}: asking for a replacement
+function, and adjusting @code{LIBOBJS} for Automake and/or Libtool.
+
+@sp 1
+
+As for function replacement, the fix is immediate: use
+@code{AC_LIBOBJ}.  For instance:
+
+@example
+LIBOBJS="$LIBOBJS fnmatch.o"
+LIBOBJS="$LIBOBJS malloc.$ac_objext"
+@end example
+
+@noindent
+should be replaced with:
+
+@example
+AC_LIBOBJ([fnmatch])
+AC_LIBOBJ([malloc])
+@end example
+
+@sp 1
+
+When asked for automatic de-ANSI-fication, Automake needs
+@code{LIBOBJS}'ed filenames to have @samp{$U} appended to the
+base names.   Libtool requires the definition of @code{LTLIBOBJS}, which
+suffixes are mapped to @samp{.lo}.  Although Autoconf provides them with
+means to free the user to do that by herself, by the time of this
+writing, none do.  Therefore, it is common to see @file{configure.ac}
+end with:
+
+@example
+# This is necessary so that .o files in LIBOBJS are also built via
+# the ANSI2KNR-filtering rules.
+LIBOBJS=`echo "$LIBOBJS" | sed 's/\.o /\$U.o /g;s/\.o$/\$U.o/'`
+LTLIBOBJS=`echo "$LIBOBJS" | sed 's/\.o/\.lo/g'`
+AC_SUBST(LTLIBOBJS)
+@end example
+
+@noindent
+First, note that this code is @emph{wrong}, because @samp{.o} is not the
+only possible extension@footnote{
+@c
+Yet another reason why assigning @code{LIBOBJS} directly is discouraged.
+@c
+}!  Because the token @code{LIBOBJS} is now
+forbidden, you will have to replace this snippet with:
+
+@example
+# This is necessary so that .o files in LIBOBJS are also built via
+# the ANSI2KNR-filtering rules.
+LIB@@&t@@OBJS=`echo "$LIB@@&t@@OBJS" |
+             sed 's,\.[[^.]]* ,$U&,g;s,\.[[^.]]*$,$U&,'`
+LTLIBOBJS=`echo "$LIB@@&t@@OBJS" |
+           sed 's,\.[[^.]]* ,.lo ,g;s,\.[[^.]]*$,.lo,'`
+AC_SUBST(LTLIBOBJS)
+@end example
+
+@noindent
+Unfortunately, @command{autoupdate} cannot help here, since... this is
+not a macro!  Of course, first make sure your release of Automake and/or
+Libtool still requires these.
+
 @c ============================= Generating Test Suites with Autotest
 
 @node Using Autotest
index 8bf019da5a3aa3f66f40b8b0819d0d515d856190..8daca488604f13d6b459f5a228f15faed4380c96 100644 (file)
@@ -1248,7 +1248,7 @@ m4_define([AC_INIT],
 m4_pattern_forbid([^_?A[CHUM]_])
 m4_pattern_forbid([_AC_])
 m4_pattern_forbid([^LIBOBJS$],
-                  [do not use LIBOBJS directly, use AC_LIBOBJ])
+                  [do not use LIBOBJS directly, use AC_LIBOBJ (see section `AC_LIBOBJ vs. LIBOBJS'])
 # Actually reserved by M4sh.
 m4_pattern_allow([^AS_FLAGS$])
 AS_INIT