(autoconf.info.gz) AC_LIBOBJ vs LIBOBJS
Info Catalog
(autoconf.info.gz) Hosts and Cross-Compilation
(autoconf.info.gz) Autoconf 2
`AC_LIBOBJ' vs. `LIBOBJS'
-------------------------
Up to Autoconf 2.13, the replacement of functions was triggered via
the variable `LIBOBJS'. Since Autoconf 2.50, the macro `AC_LIBOBJ'
should be used instead ( Generic Functions). Starting at
Autoconf 2.53, the use of `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 `configure.ac' are all replaced with the use of traces. As a
consequence, any action must be traceable, which obsoletes critical
variable assignments. Fortunately, `LIBOBJS' was the only problem, and
it can even be handled gracefully (read, "without your having to change
something").
There were two typical uses of `LIBOBJS': asking for a replacement
function, and adjusting `LIBOBJS' for Automake and/or Libtool.
As for function replacement, the fix is immediate: use `AC_LIBOBJ'.
For instance:
LIBOBJS="$LIBOBJS fnmatch.o"
LIBOBJS="$LIBOBJS malloc.$ac_objext"
should be replaced with:
AC_LIBOBJ([fnmatch])
AC_LIBOBJ([malloc])
When asked for automatic de-ANSI-fication, Automake needs
`LIBOBJS''ed filenames to have `$U' appended to the base names.
Libtool requires the definition of `LTLIBOBJS', whose suffixes are
mapped to `.lo'. People used to run snippets 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/'`
LTLIBOBJS=`echo "$LIBOBJS" | sed 's/\.o/\.lo/g'`
AC_SUBST(LTLIBOBJS)
Note that this code is _wrong_, because `.o' is not the only possible
extension(1)! It should have read:
# 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)
You no longer have to use this: `AC_OUTPUT' normalizes `LIBOBJS' and
`LTLIBOBJS' (hence it works with any version of Automake and Libtool).
Just remove these lines (`autoupdate' cannot handle this task, since
this is not a macro).
Note that `U' must not be used in your Makefiles.
---------- Footnotes ----------
(1) Yet another reason why assigning `LIBOBJS' directly is
discouraged.
Info Catalog
(autoconf.info.gz) Hosts and Cross-Compilation
(autoconf.info.gz) Autoconf 2
automatically generated byinfo2html