]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Handle LIBOBJS and LTLIBOBJS once for all, including Libtool's and
authorAkim Demaille <akim@epita.fr>
Thu, 18 Jul 2002 11:57:32 +0000 (11:57 +0000)
committerAkim Demaille <akim@epita.fr>
Thu, 18 Jul 2002 11:57:32 +0000 (11:57 +0000)
Automake's parts.
* lib/autoconf/general.m4 (_AC_LIBOBJS_NORMALIZE): New.
* lib/autoconf/status.m4 (AC_OUTPUT_COMMANDS_PRE): Call it.
* tests/semantics.at (AC_REPLACE_FUNCS): Adjust.

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

index d5112b16e2ee560ed43609077ac82c546c65221f..2d2acefa3f7d85787639a2f4273dd5c15dad66d2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2002-07-18  Akim Demaille  <akim@epita.fr>,
+
+       Handle LIBOBJS and LTLIBOBJS once for all, including Libtool's and
+       Automake's parts.
+
+       * lib/autoconf/general.m4 (_AC_LIBOBJS_NORMALIZE): New.
+       * lib/autoconf/status.m4 (AC_OUTPUT_COMMANDS_PRE): Call it.
+       * tests/semantics.at (AC_REPLACE_FUNCS): Adjust.
+
 2002-07-18  Akim Demaille  <akim@epita.fr>,
            Alexandre Duret-Lutz  <duret_g@epita.fr>
 
diff --git a/NEWS b/NEWS
index 893fd6ae88c5c5ec1c9830618883360542a4c149..59ea375c87f6aef6d58df9d508a2416e9932fed9 100644 (file)
--- a/NEWS
+++ b/NEWS
 
 ** Macros
 
+- AC_OUTPUT
+  Now handles all the gory details about LIBOBJS and LTLIBOBJS.
+  Please, remove lines such as
+
+       # 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/'`
+
+  and read the `AC_LIBOBJ vs LIBOBJS' section.
+
 - AC_CONFIG_LINKS now makes copies if it can't make links.
+
 - AC_FUNC_FNMATCH now tests only for POSIX compatibility, reverting to
   Autoconf 2.13 behavior.  The new macro AC_FUNC_FNMATCH_GNU also
   tests for GNU extensions to fnmatch, and replaces fnmatch if needed.
index 61d33b6667bdf82fb26d6b893d48d3525e537729..381f229da5c0282bbcf6a581b8f954965c07c08b 100644 (file)
@@ -12815,17 +12815,11 @@ 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.
+variable assignments.  Fortunately, @code{LIBOBJS} was the only problem,
+and it can even be handled gracefully (read, ``without your having to
+change something'').
 
-At the time this documentation is written, Automake does not rely on
-traces yet, but this is planned 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
+There were two typical uses of @code{LIBOBJS}: asking for a replacement
 function, and adjusting @code{LIBOBJS} for Automake and/or Libtool.
 
 @sp 1
@@ -12849,12 +12843,9 @@ AC_LIBOBJ([malloc])
 @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:
+@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}.  People used to run snippets such as:
 
 @example
 # This is necessary so that .o files in LIBOBJS are also built via
@@ -12865,13 +12856,12 @@ AC_SUBST(LTLIBOBJS)
 @end example
 
 @noindent
-First, note that this code is @emph{wrong}, because @samp{.o} is not the
-only possible extension@footnote{
+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:
+}!  It should have read:
 
 @example
 # This is necessary so that .o files in LIBOBJS are also built via
@@ -12883,10 +12873,13 @@ LTLIBOBJS=`echo "$LIB@@&t@@OBJS" |
 AC_SUBST(LTLIBOBJS)
 @end example
 
-@noindent
-Unfortunately, @command{autoupdate} cannot help here, since@dots{} this is
-not a macro!  Of course, first make sure your release of Automake and/or
-Libtool still requires these.
+@sp 1
+
+Fortunately, you no longer have to use this: @code{AC_OUTPUT} normalizes
+@code{LIBOBJS} and @code{LTLIBOBJS} (hence it works with any version of
+Automake and Libtool).  So just remove these lines.
+@command{autoupdate} cannot handle this task, since this is not a macro.
+
 
 @c ============================= Generating Test Suites with Autotest
 
index cb669d43a5a59a814ee14028fc0a03797b5c0fbd..64672cfa8135151a84f16988c8f297c8e87bf81d 100644 (file)
@@ -1272,7 +1272,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 (see section `AC_LIBOBJ vs. LIBOBJS'])
+                  [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
@@ -2393,6 +2393,7 @@ AC_SUBST([LIB@&t@OBJS])dnl
 LIB@&t@OBJS="$LIB@&t@OBJS $1.$ac_objext"])
 
 
+
 # AC_LIBOBJ(FILENAME-NOEXT)
 # -------------------------
 # We need `FILENAME-NOEXT.o', save this into `LIBOBJS'.
@@ -2404,6 +2405,26 @@ m4_define([AC_LIBOBJ],
 ])
 
 
+# _AC_LIBOBJS_NORMALIZE
+# ---------------------
+# Clean up LIBOBJS abd LTLIBOBJS so that they work with 1. ac_objext,
+# 2. Automake's ANSI2KNR, 3. Libtool, 4. combination of the three.
+# Used with AC_CONFIG_COMMANDS_PRE.
+AC_DEFUN([_AC_LIBOBJS_NORMALIZE],
+[ac_libobjs=
+ac_ltlibobjs=
+for ac_i in : $LIB@&t@OBJS; do test "x$ac_i" = x: && continue
+  # 1. Remove the extension, and $U if already installed.
+  ac_i=`echo "$ac_i" |
+         sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
+  # 2. Add them.
+  ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"
+  ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo'
+done
+AC_SUBST([LIB@&t@OBJS], [$ac_libobjs])
+AC_SUBST([LTLIBOBJS], [$ac_ltlibobjs])
+])
+
 
 ## ----------------------------------- ##
 ## Checking compiler characteristics.  ##
index 8c5dd61d9af6b60885c696fb6189e99ddd32f326..25f367604b5adf693096bbddcf54dec8ab12ca9c 100644 (file)
@@ -329,8 +329,12 @@ AC_DEFUN([AC_CONFIG_COMMANDS_PRE],
 
 # AC_OUTPUT_COMMANDS_PRE
 # ----------------------
+# A *variable* in which we append all the actions that must be
+# performed before *creating* config.status.  For a start, clean
+# up all the LIBOBJ mess.
 m4_define([AC_OUTPUT_COMMANDS_PRE],
-[])
+[_AC_LIBOBJS_NORMALIZE()
+])
 
 
 # AC_CONFIG_COMMANDS_POST(CMDS)
index 1d8616664ac554a11e13108f17a2a02ae0687987..0a328c94442ad6e33fa7913fc2e00bb33a15ca59 100644 (file)
@@ -123,7 +123,7 @@ AT_CHECK_DEFINES(
 ])
 
 AT_CHECK([sed 's/  */ /g;s/^ //;s/ $//' config.libobjs], [],
-         [autoconf_ftnirp.o
+         [autoconf_ftnirp$U.o
 ])
 
 AT_CLEANUP([config.libobjs])