From: Akim Demaille Date: Thu, 18 Jul 2002 11:57:32 +0000 (+0000) Subject: Handle LIBOBJS and LTLIBOBJS once for all, including Libtool's and X-Git-Tag: AUTOCONF-2.53b~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6d854434d26b84b84899dfd2cece4df9c03b8dbd;p=thirdparty%2Fautoconf.git 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. --- diff --git a/ChangeLog b/ChangeLog index d5112b16e..2d2acefa3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2002-07-18 Akim Demaille , + + 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 , Alexandre Duret-Lutz diff --git a/NEWS b/NEWS index 893fd6ae8..59ea375c8 100644 --- a/NEWS +++ b/NEWS @@ -18,7 +18,18 @@ ** 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. diff --git a/doc/autoconf.texi b/doc/autoconf.texi index 61d33b666..381f229da 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -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 diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4 index cb669d43a..64672cfa8 100644 --- a/lib/autoconf/general.m4 +++ b/lib/autoconf/general.m4 @@ -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. ## diff --git a/lib/autoconf/status.m4 b/lib/autoconf/status.m4 index 8c5dd61d9..25f367604 100644 --- a/lib/autoconf/status.m4 +++ b/lib/autoconf/status.m4 @@ -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) diff --git a/tests/semantics.at b/tests/semantics.at index 1d8616664..0a328c944 100644 --- a/tests/semantics.at +++ b/tests/semantics.at @@ -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])