From: Gary V. Vaughan Date: Wed, 23 Apr 2008 03:18:56 +0000 (-0400) Subject: Libtoolize now advises AC_CONFIG_MACRO_DIR use where appropriate. X-Git-Tag: v2.2.4~14 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=4d777f8223aabcd4ff95aefe8fd3fb86f5e6d7ae;p=thirdparty%2Flibtool.git Libtoolize now advises AC_CONFIG_MACRO_DIR use where appropriate. * libtoolize.at (func_check_macros): Always advise use of AC_CONFIG_MACRO_DIR when not able to copy libtool macros into the project tree. * tests/libtoolize.at: New test for correct diagnosis of mismatch between AC_CONFIG_MACRO_DIR and ACLOCAL_AMFLAGS. Update expected output of other tests. * NEWS: Updated. --- diff --git a/ChangeLog b/ChangeLog index f251edeaf..ebf9ba93e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2008-04-22 Gary V. Vaughan + + Libtoolize now advises AC_CONFIG_MACRO_DIR use where appropriate. + * libtoolize.m4sh (func_check_macros): Always advise use of + AC_CONFIG_MACRO_DIR when not able to copy libtool macros into + the project tree. + * tests/libtoolize.at: New test for correct diagnosis of mismatch + between AC_CONFIG_MACRO_DIR and ACLOCAL_AMFLAGS. + Update expected output of other tests. + * NEWS: Updated. + 2008-04-22 Ralf Wildenhues Fix regression over 1.5.26 with ccache $CC -all-static. diff --git a/NEWS b/NEWS index df43da7a3..d7579e9aa 100644 --- a/NEWS +++ b/NEWS @@ -18,6 +18,11 @@ New in 2.2.4: 2008-??-??: CVS version 2.2.3a, Libtool team: (i.e. AC_CONFIG_MACRO_DIR is not being used), libtoolize no longer reports that all macros need to be added to `aclocal.m4', and diagnoses only the macro files that are missing or not up-to-date. + - libtoolize now advises use of AC_CONFIG_MACRO_DIR to keep matching + libtool macros in-tree where appropriate. + - libtoolize now advises use of `ACLOCAL_AMFLAGS = -I m4' (or + equivalent) where appropriate, and errors out when ACLOCAL_AMFLAGS + names a different directory to AC_CONFIG_MACRO_DIR. New in 2.2.2: 2008-04-01: CVS version 2.2.1a, Libtool team: diff --git a/libtoolize.m4sh b/libtoolize.m4sh index 7981dde0f..5748e23ed 100644 --- a/libtoolize.m4sh +++ b/libtoolize.m4sh @@ -586,8 +586,7 @@ func_scan_files () # Find local m4 macro directory. # # ------------------------------ # - # If AC_CONFIG_MACRO_DIR turned nothing up, we hunt for ACLOCAL_AMFLAGS - # in `Makefile.am' for a `-I' argument. + # Hunt for ACLOCAL_AMFLAGS in `Makefile.am' for a `-I' argument. my_sed_aclocal_flags=' /^[ ]*ACLOCAL_[A-Z_]*FLAGS[ ]*=/ { @@ -595,12 +594,11 @@ func_scan_files () q } d' - macrodir="$ac_macrodir" - if test ! -n "$macrodir" && test -f Makefile.am; then + if test -f Makefile.am; then my_macrodir_is_next=false for arg in `$SED "$my_sed_aclocal_flags" Makefile.am`; do if $my_macrodir_is_next; then - macrodir="$arg" + am_macrodir="$arg" break else if test "X$arg" = "X-I"; then @@ -611,6 +609,14 @@ func_scan_files () fi done fi + + macrodir="$ac_macrodir" + test -z "$macrodir" && macrodir="$am_macrodir" + + if test -n "$am_macrodir" && test -n "$ac_macrodir"; then + test "$am_macrodir" = "$ac_macrodir" \ + || func_fatal_error "AC_CONFIG_MACRO_DIR([$ac_macrodir]) conflicts with ACLOCAL_AMFLAGS=-I $am_macrodir." + fi } # func_included_files searchfile @@ -1324,17 +1330,7 @@ func_check_macros () ac_config_macro_dir_advised=false - # Suggest modern idioms for storing autoconf macros: - if test -z "$ac_macrodir$ltdldir"; then - if test -z "$macrodir" || test x"$macrodir" = x.; then - func_echo "Consider adding \`AC_CONFIG_MACRO_DIR([m4])' to $configure_ac and" - func_echo "rerunning libtoolize, to keep the correct libtool macros in-tree." - elif test -z "$ac_macrodir$ltdldir"; then - func_echo "Consider adding \`AC_CONFIG_MACRO_DIR([$macrodir])' to $configure_ac," - func_echo "and rerunning libtoolize and aclocal." - fi - - elif test -z "$macrodir"; then + if test -n "$ac_macrodir$ltdldir" && test -z "$macrodir"; then my_ac_config_macro_srcdir="$aclocaldir" if $opt_ltdl && test "$macrodir" != "$subproject_macrodir"; then my_ac_config_macro_srcdir="$subproject_macrodir" @@ -1389,9 +1385,33 @@ func_check_macros () func_echo "Consider using \`AC_CONFIG_AUX_DIR([$subproject_auxdir])' in $configure_ac." $ac_config_macro_dir_advised || test "$subproject_macrodir" = "$macrodir" || func_echo "Consider using \`AC_CONFIG_MACRO_DIR([$subproject_macrodir])' in $configure_ac." + ac_config_macro_dir_advised=: fi fi + # Suggest modern idioms for storing autoconf macros: + $ac_config_macro_dir_advised || if test -z "$ac_macrodir" || test x"$macrodir" = x.; then + func_echo "Consider adding \`AC_CONFIG_MACRO_DIR([m4])' to $configure_ac and" + func_echo "rerunning libtoolize, to keep the correct libtool macros in-tree." + ac_config_macro_dir_advised=: + + elif test -z "$ac_macrodir$ltdldir"; then + func_echo "Consider adding \`AC_CONFIG_MACRO_DIR([$macrodir])' to $configure_ac," + func_echo "and rerunning libtoolize and aclocal." + ac_config_macro_dir_advised=: + fi + + if test -z "$am_macrodir$macrodir"; then + func_echo "Consider adding \`-I m4' to ACLOCAL_AMFLAGS in Makefile.am." + + elif test -z "$am_macrodir"; then + if $opt_ltdl && test "x$ltdl_mode" = "xsubproject" && test "$subproject_macrodir" != "$macrodir"; then + func_echo "Consider adding \`-I $subproject_macrodir' to ACLOCAL_AMFLAGS in Makefile.am." + else + func_echo "Consider adding \`-I $macrodir' to ACLOCAL_AMFLAGS in Makefile.am." + fi + fi + # Don't trace for this, we're just checking the user didn't invoke it # directly from configure.ac. $SED 's,dnl .*$,,; s,# .*$,,' "$configure_ac" | grep AC_PROG_RANLIB >/dev/null && diff --git a/tests/libtoolize.at b/tests/libtoolize.at index 4f673862f..25d664746 100644 --- a/tests/libtoolize.at +++ b/tests/libtoolize.at @@ -46,6 +46,10 @@ test -d m4 || { rm -f m4 && mkdir m4; } rm -f m4/libtool.m4 m4/ltoptions.m4 build-aux/ltmain.sh +AT_DATA([Makefile.am], +[[ACLOCAL_AMFLAGS = -I m4 +]]) + # This file should be upgraded. AT_DATA([m4/libtool.m4], [[ # serial 25 LT_INIT @@ -89,6 +93,7 @@ libtoolize: copying file `m4/ltoptions.m4' libtoolize: copying file `m4/ltsugar.m4' libtoolize: copying file `m4/ltversion.m4' libtoolize: copying file `m4/lt~obsolete.m4' +libtoolize: Consider adding `-I m4' to ACLOCAL_AMFLAGS in Makefile.am. ]]) LT_AT_CHECK_LIBTOOLIZE([--copy], 0, expout) @@ -96,6 +101,26 @@ LT_AT_CHECK_LIBTOOLIZE([--copy], 0, expout) AT_CLEANUP +## ------------------------- ## +## ACLOCAL_AMFLAGS mismatch. ## +## ------------------------- ## + +AT_SETUP([libtoolize macro directory mismatch error]) + +_LT_CONFIGURE_AC + +AT_DATA([Makefile.am], +[[ACLOCAL_AMFLAGS = -I me2 +]]) + +AT_DATA(experr, +[[libtoolize: AC_CONFIG_MACRO_DIR([m4]) conflicts with ACLOCAL_AMFLAGS=-I me2. +]]) + +LT_AT_CHECK_LIBTOOLIZE([--copy], 1, [ignore], experr) + +AT_CLEANUP + ## -------------- ## ## Serial update. ## ## -------------- ## @@ -300,6 +325,7 @@ libtoolize: copying file `ltdl/ltdl.h' libtoolize: copying file `ltdl/slist.c' libtoolize: creating file `ltdl/Makefile.inc' libtoolize: Remember to add `LT_CONFIG_LTDL_DIR([ltdl])' to `configure.ac'. +libtoolize: Consider adding `-I m4' to ACLOCAL_AMFLAGS in Makefile.am. ]]) AT_DATA([configure.ac], @@ -387,6 +413,10 @@ LT_INIT LTDL_INIT AC_OUTPUT ]]) + +AT_DATA([Makefile.am], +[[ACLOCAL_AMFLAGS = -I ltdl/m4 +]]) ])# _LT_AT_LTDL_SETUP ## ------------------------------------------------ ## @@ -472,6 +502,7 @@ libtoolize: copying file `ltdl/ltdl.c' libtoolize: copying file `ltdl/ltdl.h' libtoolize: copying file `ltdl/slist.c' libtoolize: Remember to add `LTDL_INIT' to configure.ac. +libtoolize: Consider adding `-I ltdl/m4' to ACLOCAL_AMFLAGS in Makefile.am. ]]) AT_DATA([configure.ac], @@ -511,6 +542,9 @@ libtoolize: `/usr/local/share/aclocal/ltoptions.m4' libtoolize: `/usr/local/share/aclocal/ltversion.m4' libtoolize: `/usr/local/share/aclocal/ltsugar.m4' libtoolize: `/usr/local/share/aclocal/lt~obsolete.m4' +libtoolize: Consider adding `AC_CONFIG_MACRO_DIR([m4])' to configure.ac and +libtoolize: rerunning libtoolize, to keep the correct libtool macros in-tree. +libtoolize: Consider adding `-I m4' to ACLOCAL_AMFLAGS in Makefile.am. ]]) LT_AT_CHECK_LIBTOOLIZE([--copy], 0, expout) @@ -528,6 +562,10 @@ LT_INIT AC_OUTPUT ]]) +AT_DATA([Makefile.am], +[[ACLOCAL_AMFLAGS = -I m4 +]]) + AT_DATA([aclocal.m4], [[# This should need upgrading: # serial 25 LT_INIT @@ -639,6 +677,9 @@ libtoolize: `/usr/local/share/aclocal/libtool.m4' libtoolize: `/usr/local/share/aclocal/ltversion.m4' libtoolize: `/usr/local/share/aclocal/ltsugar.m4' libtoolize: `/usr/local/share/aclocal/lt~obsolete.m4' +libtoolize: Consider adding `AC_CONFIG_MACRO_DIR([m4])' to configure.ac and +libtoolize: rerunning libtoolize, to keep the correct libtool macros in-tree. +libtoolize: Consider adding `-I m4' to ACLOCAL_AMFLAGS in Makefile.am. ]]) LT_AT_CHECK_LIBTOOLIZE([--copy], 0, expout) @@ -648,8 +689,6 @@ LT_AT_CHECK_LIBTOOLIZE([--copy], 0, expout) ## Upgrading an aclocal maintained aclocal.m4 without AC_CONFIG_MACRO_DIR. ## ## ----------------------------------------------------------------------- ## -rm -f aclocal.m4 - LT_AT_ACLOCAL() ## The following code is adapted (and simplified) from libtoolize.m4sh @@ -711,7 +750,13 @@ $SED -e 's,^#.*serial.*ltoptions.m4$,# serial 99999 ltoptions.m4,' \ < aclocal.m4 > aclocal.m4t mv -f aclocal.m4t aclocal.m4 -LT_AT_CHECK_LIBTOOLIZE([--copy], 0) +AT_DATA([expout], +[[libtoolize: Consider adding `AC_CONFIG_MACRO_DIR([m4])' to configure.ac and +libtoolize: rerunning libtoolize, to keep the correct libtool macros in-tree. +libtoolize: Consider adding `-I m4' to ACLOCAL_AMFLAGS in Makefile.am. +]]) + +LT_AT_CHECK_LIBTOOLIZE([--copy], 0, expout) ## --------------------- ## @@ -721,6 +766,9 @@ LT_AT_CHECK_LIBTOOLIZE([--copy], 0) AT_DATA(expout, [[libtoolize: putting auxiliary files in `.'. libtoolize: copying file `./ltmain.sh' +libtoolize: Consider adding `AC_CONFIG_MACRO_DIR([m4])' to configure.ac and +libtoolize: rerunning libtoolize, to keep the correct libtool macros in-tree. +libtoolize: Consider adding `-I m4' to ACLOCAL_AMFLAGS in Makefile.am. ]]) LT_AT_CHECK_LIBTOOLIZE([--copy --force], 0, expout) @@ -790,6 +838,10 @@ LTDL_INIT([nonrecursive]) AC_OUTPUT ]]) +AT_DATA([Makefile.am], +[[ACLOCAL_AMFLAGS = -I m4 +]]) + LT_AT_CHECK_LIBTOOLIZE([--copy --install --ltdl=ltdl], 0, expout) AT_CLEANUP @@ -868,6 +920,7 @@ libtoolize: copying file `ltdl/ltdl.h' libtoolize: copying file `ltdl/slist.c' libtoolize: Consider using `AC_CONFIG_AUX_DIR([ltdl/config])' in configure.ac. libtoolize: Consider using `AC_CONFIG_MACRO_DIR([ltdl/m4])' in configure.ac. +libtoolize: Consider adding `-I ltdl/m4' to ACLOCAL_AMFLAGS in Makefile.am. ]]) AT_DATA([configure.ac],