From bcdfe9f2731f378e9706d2455e765b3d79a454ee Mon Sep 17 00:00:00 2001 From: "Gary V. Vaughan" Date: Thu, 27 Oct 2011 18:29:50 +0700 Subject: [PATCH] libtoolize: rename `libltdl/m4' directory to standard `m4'. In addition to moving the autoconf macro directory into the place expected by GNU developers ($top_srcdir/m4), we also simplify libtoolize somewhat by having libltdl use whatever directory was specified by the parent project. This is much more flexible, allows libltdl client projects to also use a single canonical `$top_srcdir/m4' macro directory, and maintains backward compatibility with existing projects that wish to continue using $ltdl_dir/m4. * libltdl/m4: Moved to it's parent directory. * Makefile.am (ACLOCAL_AMFLAGS, BUILDCHECK_ENVIRONMENT) (libltdl/Makefile.am, libltdl/aclocal.m4): Adjust. * configure.ac (AC_CONFIG_MACRO_DIR): Adjust. * libltdl/configure.ac (AC_CONFIG_MACRO_DIR): Remove. The libtoolize script can pick up the project macro directory from ACLOCAL_AMFLAGS in libltdl/Makefile.am, saving us from needing to regenerate configure for the sake of a different macro directory declared in the libltdl using client project. * libtoolize.m4sh (func_install_pkgmacro_subproject): Remove. (func_install_pkgmacro_parent): Remove. (subproject_macro_dir): Remove. (require_libltdl_Makefile_am, require_ltdl_aclocal_amflags) (require_ltdl_am_macro_dir): New functions, generated at runtime by adding libltdl/Makefile.am to the generation loop. (func_install_pkgmacro_files): Considerably simplified now that we have only a single macro directory to worry about. (require_ltdl_relative_macro_dir): New function. Calculate the relative path from $ltdl_dir to the parent project macro_dir. (require_Makefile_am_filter): Depending on $ltdl_mode, edit Makefile.am ACLOCAL_AMFLAGS to use the parent project macro directory if necessary. (require_aclocal_m4_filter): Make sure m4_includes point to the correct macro directory by editing the file as it is copied into the parent project. (func_install_pkgltdl_files): Use the filters. (func_check_macros): Remove various advice that no longer applies with an always shared macro directory. (func_require_ltdl_dir): Don't default ltdl_dir to subproject when `--ltdl' was not given. (func_require_ltdl_mode): Leave ltdl_mode empty when ltdl_dir is not set. (func_require_macro_dir): Default to $ltdl_dir/m4 in subproject mode with no other directory implied by AC_CONFIG_MACRO_DIR or ACLOCAL_AMFLAGS, otherwise m4 as before. * tests/libtoolize.at: Match new "creating file `Makefile.am'" messages correctly. (subproject ltdl with non-shared directories): This test no longer makes sense, so repurposed... (subproject ltdl with non-canonical macro dir): ...this, to ensure subproject ltdl continues to automatically share the parent macro directory. * tests/cdemo/Makefile.am, tests/demo/Makefile.am, tests/depdemo/Makefile.am, tests/f77demo/Makefile.am, tests/fcdemo/Makefile.am, tests/mdemo/Makefile.am, tests/mdemo2/Makefile.am, tests/pdemo/Makefile.am, tests/tagdemo/Makefile.am (ACLOCAL_AMFLAGS): Use new location of macro_dir. * NEWS: Updated. Signed-off-by: Gary V. Vaughan --- Makefile.am | 8 +- NEWS | 7 + configure.ac | 2 +- libltdl/configure.ac | 1 - libtoolize.m4sh | 341 ++++++++++++++++-------------- {libltdl/m4 => m4}/.gitignore | 0 {libltdl/m4 => m4}/argz.m4 | 0 {libltdl/m4 => m4}/autobuild.m4 | 0 {libltdl/m4 => m4}/libtool.m4 | 0 {libltdl/m4 => m4}/ltdl.m4 | 0 {libltdl/m4 => m4}/ltoptions.m4 | 0 {libltdl/m4 => m4}/ltsugar.m4 | 0 {libltdl/m4 => m4}/ltversion.in | 0 {libltdl/m4 => m4}/lt~obsolete.m4 | 0 tests/cdemo/Makefile.am | 2 +- tests/demo/Makefile.am | 2 +- tests/depdemo/Makefile.am | 2 +- tests/f77demo/Makefile.am | 2 +- tests/fcdemo/Makefile.am | 2 +- tests/libtoolize.at | 75 +++---- tests/mdemo/Makefile.am | 2 +- tests/mdemo2/Makefile.am | 2 +- tests/pdemo/Makefile.am | 2 +- tests/tagdemo/Makefile.am | 2 +- 24 files changed, 240 insertions(+), 212 deletions(-) rename {libltdl/m4 => m4}/.gitignore (100%) rename {libltdl/m4 => m4}/argz.m4 (100%) rename {libltdl/m4 => m4}/autobuild.m4 (100%) rename {libltdl/m4 => m4}/libtool.m4 (100%) rename {libltdl/m4 => m4}/ltdl.m4 (100%) rename {libltdl/m4 => m4}/ltoptions.m4 (100%) rename {libltdl/m4 => m4}/ltsugar.m4 (100%) rename {libltdl/m4 => m4}/ltversion.in (100%) rename {libltdl/m4 => m4}/lt~obsolete.m4 (100%) diff --git a/Makefile.am b/Makefile.am index 1a8a3eb7..3496eafa 100644 --- a/Makefile.am +++ b/Makefile.am @@ -23,7 +23,7 @@ ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ##### -ACLOCAL_AMFLAGS = -I libltdl/m4 +ACLOCAL_AMFLAGS = -I m4 AM_CPPFLAGS = AM_LDFLAGS = @@ -195,7 +195,7 @@ $(lt_Makefile_am): $(ltdl_mk) $(AM_V_at)rm -f '$@' $(AM_V_GEN)( '$(SED)' -n '1,/^.. DO NOT REMOVE THIS LINE -- /p' \ '$(ltdl_mk)'; \ - { echo 'ACLOCAL_AMFLAGS = -I m4'; \ + { echo 'ACLOCAL_AMFLAGS = -I ../m4'; \ echo 'AUTOMAKE_OPTIONS = foreign'; \ echo 'AM_CPPFLAGS ='; \ echo 'AM_LDFLAGS ='; \ @@ -384,7 +384,7 @@ lt_aclocal_m4_deps = \ lt_configure_deps = $(lt_aclocal_m4) $(lt_aclocal_m4_deps) $(lt_aclocal_m4): $(lt_aclocal_m4_deps) - $(AM_V_GEN)cd '$(srcdir)/$(ltdl_dir)' && $(ACLOCAL) -I m4 + $(AM_V_GEN)cd '$(srcdir)/$(ltdl_dir)' && $(ACLOCAL) -I ../m4 $(lt_configure): $(lt_configure_deps) $(AM_V_GEN)cd '$(srcdir)/$(ltdl_dir)' && $(AUTOCONF) @@ -708,7 +708,7 @@ TESTS_ENVIRONMENT = MAKE="$(MAKE)" CC="$(CC)" CFLAGS="$(CFLAGS)" \ BUILDCHECK_ENVIRONMENT = _lt_pkgdatadir="$(abs_top_srcdir)" \ LIBTOOLIZE="$(abs_top_builddir)/libtoolize" \ LIBTOOL="$(abs_top_builddir)/libtool" \ - tst_aclocaldir="$(abs_top_srcdir)/libltdl/m4" + tst_aclocaldir="$(abs_top_srcdir)/m4" INSTALLCHECK_ENVIRONMENT = \ LIBTOOLIZE="$(bindir)/`echo libtoolize |$(SED) '$(program_transform_name)'`" \ diff --git a/NEWS b/NEWS index 2e6879c9..816a3db9 100644 --- a/NEWS +++ b/NEWS @@ -12,6 +12,13 @@ NEWS - list of user-visible changes between releases of GNU Libtool version number or any other argument that Libtoolize needs to know at M4 time using git-version-gen from gnulib, for example. + - Invoking `libtoolize --ltdl' no longer maintains a separate autoconf + macro directory in the libltdl tree, but automatically adjusts the + installed libltdl configuration files to share whatever macro + directory is declared by the parent project. (Note: if you were + already sharing a macro directory with AC_CONFIG_MACRO_DIR(ltdl/m4) + or similar, that still works as does any other directory choice). + - The Autotest testsuite can be run without the especially time consuming tests with: diff --git a/configure.ac b/configure.ac index d6906d1b..f524b558 100644 --- a/configure.ac +++ b/configure.ac @@ -52,7 +52,7 @@ AC_CONFIG_HEADERS([config.h:config-h.in]) AC_CONFIG_SRCDIR([libtoolize.m4sh]) LT_CONFIG_LTDL_DIR([libltdl], [nonrecursive]) AC_CONFIG_AUX_DIR([libltdl/config]) -AC_CONFIG_MACRO_DIR([libltdl/m4]) +AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_LIBOBJ_DIR([libltdl]) package_revision=`$SHELL $ac_aux_dir/git-version-gen .tarball-version` diff --git a/libltdl/configure.ac b/libltdl/configure.ac index 9b737c20..d7a383a9 100644 --- a/libltdl/configure.ac +++ b/libltdl/configure.ac @@ -44,7 +44,6 @@ AC_INIT([libltdl], [2.4.3a], [bug-libtool@gnu.org]) AC_CONFIG_HEADERS([config.h:config-h.in]) AC_CONFIG_SRCDIR([ltdl.c]) AC_CONFIG_AUX_DIR([config]) -AC_CONFIG_MACRO_DIR([m4]) LT_CONFIG_LTDL_DIR([.]) # I am me! diff --git a/libtoolize.m4sh b/libtoolize.m4sh index 6d92cf15..8eceb918 100644 --- a/libtoolize.m4sh +++ b/libtoolize.m4sh @@ -700,89 +700,6 @@ func_install_update () } -# func_install_pkgmacro_subproject -# Unless --quiet was passed, display a message. Then copy pkgmacro_files -# from libtool installation tree to subproject libltdl tree. -func_install_pkgmacro_subproject () -{ - $debug_cmd - - $require_macro_dir - - # Remove any lingering files that my have been installed by some - # previous libtoolize release: - $opt_force && for file in $all_pkgmacro_files; do - test -f "$subproject_macro_dir/$file" && func_verbose "rm -f '$subproject_macro_dir/$file'" - rm -f "$subproject_macro_dir/$file" - done - - # Copy all the files from installed libltdl to this project, if the - # user specified a macro_dir. - $opt_quiet || if test "x$macro_dir" != "x$subproject_macro_dir"; then - pkgmacro_header="putting macros in \`$subproject_macro_dir'." - elif test -n "$subproject_macro_dir"; then - pkgmacro_header="putting macros in AC_CONFIG_MACRO_DIR, \`$subproject_macro_dir'." - fi - - for file in $pkgmacro_files; do - func_copy "$file" "$aclocaldir" "$subproject_macro_dir" pkgmacro_header - done -} - - -# func_install_pkgmacro_parent -# Unless --quiet was passed, or AC_CONFIG_MACRO_DIR was not seen, display -# a message. Then update appropriate macros if newer ones are available -# from the libtool installation tree. -func_install_pkgmacro_parent () -{ - $debug_cmd - - $require_ac_macro_dir - $require_macro_dir - - # Remove any lingering files that my have been installed by some - # previous libtoolize release: - $opt_force && for file in $all_pkgmacro_files; do - test -f "$macro_dir/$file" && func_verbose "rm -f '$macro_dir/$file'" - rm -f "$macro_dir/$file" - done - - # Copy all the files from installed libltdl to this project, if the - # user specified a macro_dir. - $opt_quiet || if test -n "$ac_macro_dir"; then - my_pkgmacro_header="putting macros in AC_CONFIG_MACRO_DIR, \`$ac_macro_dir'." - else - my_pkgmacro_header="putting macros in \`$macro_dir'." - fi - - for file in $pkgmacro_files; do - case $file in - argz.m4|ltdl.m4) - $opt_ltdl || { - func_verbose "Not copying \`$macro_dir/$file', libltdl not used." - continue - } - ;; - esac - - case $file in - libtool.m4) - func_serial_update libtool.m4 "$aclocaldir" "$macro_dir" \ - my_pkgmacro_header LT_INIT 'A[CM]_PROG_LIBTOOL' ;; - - ltdl.m4) - func_serial_update ltdl.m4 "$aclocaldir" "$macro_dir" \ - my_pkgmacro_header 'LTDL_INIT' ;; - - *) - func_serial_update "$file" "$aclocaldir" "$macro_dir" \ - my_pkgmacro_header "$file" ;; - esac - done -} - - # func_install_pkgmacro_files # Install copies of the libtool and libltdl m4 macros into this package. func_install_pkgmacro_files () @@ -791,33 +708,53 @@ func_install_pkgmacro_files () $require_ac_macro_dir $require_am_macro_dir - $require_configure_ac $require_ltdl_mode $require_macro_dir - # 1. Parent has separate macro_dir to subproject ltdl: - if $opt_ltdl && test "x$ltdl_mode" = "xsubproject" && - test "x$macro_dir" != "x$subproject_macro_dir" - then - # No point installing configure macros in the parent project when - # there's no $configure_ac to use them. - test -f "$configure_ac" && func_install_pkgmacro_parent - func_install_pkgmacro_subproject + $opt_ltdl || test -n "$ac_macro_dir$am_macro_dir" || return - # 2. Parent shares macro_dir with subproject ltdl: - elif $opt_ltdl && test "x$ltdl_mode" = "xsubproject" - # && test "x$macro_dir" = "x$subproject_macro_dir" - then - func_install_pkgmacro_subproject + # Remove any lingering files that my have been installed by some + # previous libtoolize release: + $opt_force && for file in $all_pkgmacro_files; do + test -f "$macro_dir/$file" && func_verbose "rm -f '$macro_dir/$file'" + rm -f "$macro_dir/$file" + done - # 3. Not a subproject, but macro_dir was specified in parent: - elif test -n "$ac_macro_dir$am_macro_dir"; then - func_install_pkgmacro_parent - - # 4. AC_CONFIG_MACRO_DIR was not specified: + # Install the libltdl autoconf macros to this project's source tree. + $opt_quiet || if test -n "$ac_macro_dir"; then + my_pkgmacro_header="putting macros in AC_CONFIG_MACRO_DIR, \`$ac_macro_dir'." else - func_verbose "AC_CONFIG_MACRO_DIR not defined, not copying libtool macros." + my_pkgmacro_header="putting macros in \`$macro_dir'." fi + + for file in $pkgmacro_files; do + case $file in + libtool.m4) + func_serial_update "$file" "$aclocaldir" "$macro_dir" \ + my_pkgmacro_header LT_INIT 'A[CM]_PROG_LIBTOOL' + ;; + ltdl.m4) + if $opt_ltdl; then + func_serial_update "$file" "$aclocaldir" "$macro_dir" \ + my_pkgmacro_header 'LTDL_INIT' + else + func_verbose "Not copying \`$macro_dir/$file', libltdl not used." + fi + ;; + ltoptions.m4|ltsugar.m4|ltversion.m4|lt~obsolete.m4) + func_serial_update "$file" "$aclocaldir" "$macro_dir" \ + my_pkgmacro_header "$file" + ;; + *) + if $opt_ltdl; then + func_serial_update "$file" "$aclocaldir" "$macro_dir" \ + my_pkgmacro_header "$file" + else + func_verbose "Not copying \`$macro_dir/$file', libltdl not used." + fi + ;; + esac + done } @@ -858,11 +795,8 @@ func_install_pkgltdl_files () my_copy_filter= case $file in Makefile.am|Makefile.in) - case $ltdl_mode in - nonrecursive) continue ;; - recursive) my_copy_filter=$Makefile_am_filter ;; - *) ;; # fall through to unfiltered func_copy - esac + test nonrecursive = "$ltdl_mode" && continue + my_copy_filter=$Makefile_am_filter ;; ltdl.mk) @@ -870,10 +804,24 @@ func_install_pkgltdl_files () my_copy_filter=$Makefile_inc_filter ;; - aclocal.m4|configure) - # Always copy aclocal.m4 and configure, otherwise regenerating - # them can overwrite the destination if they are symlinked. + aclocal.m4) test subproject = "$ltdl_mode" && { + $require_aclocal_m4_filter + + # Always copy aclocal.m4, otherwise regenerating it can + # overwrite the destination if it is symlinked. + ( opt_copy=: + func_copy "$file" "$pkgltdldir" "$ltdl_dir" \ + pkgltdl_header "$aclocal_m4_filter" + ) + } + continue + ;; + + configure) + test subproject = "$ltdl_mode" && { + # Always copy configure, otherwise regenerating it can + # overwrite the destination if it is symlinked. ( opt_copy=: func_copy "$file" "$pkgltdldir" "$ltdl_dir" pkgltdl_header ) @@ -1051,12 +999,7 @@ func_check_macros () ac_config_macro_dir_advised=false - if test -n "$ac_macro_dir$ltdl_dir" && test -z "$ac_macro_dir$am_macro_dir"; then - my_ac_config_macro_srcdir="$aclocaldir" - if $opt_ltdl && test "$macro_dir" != "$subproject_macro_dir"; then - my_ac_config_macro_srcdir="$subproject_macro_dir" - fi - + if test -z "$ac_macro_dir$am_macro_dir"; then my_missing= for file in $pkgmacro_files; do case $file in @@ -1072,13 +1015,8 @@ func_check_macros () if test -n "$my_missing"; then func_echo "You should add the contents of the following files to \`aclocal.m4':" for need in $my_missing; do - func_echo " \`$my_ac_config_macro_srcdir/$need'" + func_echo " \`$aclocaldir/$need'" done - - if test "$my_ac_config_macro_srcdir" != "$aclocaldir"; then - func_echo "or else add \`AC_CONFIG_MACRO_DIR([$subproject_macro_dir])' to $configure_ac." - ac_config_macro_dir_advised=: - fi fi fi @@ -1122,8 +1060,6 @@ func_check_macros () if test "x$ltdl_mode" = "xsubproject"; then test "$subproject_aux_dir" = "$aux_dir" || func_echo "Consider using \`AC_CONFIG_AUX_DIR([$subproject_aux_dir])' in $configure_ac." - $ac_config_macro_dir_advised || test "$subproject_macro_dir" = "$macro_dir" || - func_echo "Consider using \`AC_CONFIG_MACRO_DIR([$subproject_macro_dir])' in $configure_ac." ac_config_macro_dir_advised=: fi fi @@ -1144,11 +1080,7 @@ func_check_macros () func_echo "Consider adding \`-I m4' to ACLOCAL_AMFLAGS in Makefile.am." elif test -z "$am_macro_dir"; then - if $opt_ltdl && test "x$ltdl_mode" = "xsubproject" && test "$subproject_macro_dir" != "$macro_dir"; then - func_echo "Consider adding \`-I $subproject_macro_dir' to ACLOCAL_AMFLAGS in Makefile.am." - else - func_echo "Consider adding \`-I $macro_dir' to ACLOCAL_AMFLAGS in Makefile.am." - fi + func_echo "Consider adding \`-I $macro_dir' to ACLOCAL_AMFLAGS in Makefile.am." fi # Don't trace for this, we're just checking the user didn't invoke it @@ -1195,7 +1127,6 @@ func_autoconf_configure () } - ## -------------------- ## ## Resource management. ## ## -------------------- ## @@ -1218,16 +1149,18 @@ func_autoconf_configure () # # After that, the rest appear in asciibetical order. -base= -p= +for base in '' ltdl_; do + if test ltdl_ = "$base"; then p='$pkgltdldir/'; else p=; fi # require_Makefile_am - # ------------------- + # require_ltdl_Makefile_am + # ------------------------ # If not already set, set Makefile_am to `Makefile.am' if that file is - # present in the current directory. - r=${base}Makefile_am - v=require_$r - f=func_$v + # present in the current directory, and similarly for + # `$pkgltdldir/Makefile.am'. + r=${base}Makefile_am # _r_esource acquired by calling this function + v=require_$r # _v_ariable pointing to the function + f=func_$v # _f_unction name eval $v'='$f' '$f' () { @@ -1249,8 +1182,10 @@ p= # require_aclocal_amflags - # ----------------------- - # Extract `$aclocal_amflags' from `Makefile.am' if present. + # require_ltdl_aclocal_amflags + # ---------------------------- + # Extract `$aclocal_amflags' from `Makefile.am' if present, and + # similarly for `libltdl/Makefile.am'. r=${base}aclocal_amflags v=require_$r f=func_$v @@ -1281,9 +1216,11 @@ p= # require_am_macro_dir - # -------------------- + # require_ltdl_am_macro_dir + # ------------------------- # Set am_macro_dir to the first directory specified in - # ACLOCAL_AMFLAGS from `Makefile.am'. + # ACLOCAL_AMFLAGS from `Makefile.am', and similarly for + # 'libltdl/Makefile.am'. r=${base}am_macro_dir v=require_$r f=func_$v @@ -1309,6 +1246,8 @@ p= }' o=$r +done + # require_Makefile_am_filter # -------------------------- @@ -1320,11 +1259,33 @@ func_require_Makefile_am_filter () { $debug_cmd - Makefile_am_filter=' - /^[^#]/{ - s,(LIBOBJS),(ltdl_LIBOBJS),g - s,(LTLIBOBJS),(ltdl_LTLIBOBJS),g - }' + $require_ltdl_mode + + case $ltdl_mode in + recursive) + Makefile_am_filter=' + /^[^#]/{ + s,(LIBOBJS),(ltdl_LIBOBJS),g + s,(LTLIBOBJS),(ltdl_LTLIBOBJS),g + }' + ;; + + subproject) + $require_ltdl_am_macro_dir + $require_ltdl_relative_macro_dir + + test "$ltdl_am_macro_dir" = "$ltdl_relative_macro_dir" || { + my_am_macro_dir_regex=`$ECHO "\ +$ltdl_am_macro_dir" |$SED "$sed_make_literal_regex"` + + Makefile_am_filter=" + /^ACLOCAL_AMFLAGS = /{ + s, -I $my_am_macro_dir_regex\$, -I $ltdl_relative_macro_dir, + } + s,dir)/$my_am_macro_dir_regex,dir)/$ltdl_relative_macro_dir,g" + } + ;; + esac require_Makefile_am_filter=: } @@ -1488,6 +1449,35 @@ func_require_ac_macro_dir () } +# require_aclocal_m4_filter +# ------------------------- +# Set `aclocal_m4_filter' ready for passing to func_copy when libltdl's +# stock aclocal.m4 contents need to be filtered to work in recursive +# mode. +require_aclocal_m4_filter=func_require_aclocal_m4_filter +func_require_aclocal_m4_filter () +{ + $debug_cmd + + $require_ltdl_am_macro_dir + $require_ltdl_relative_macro_dir + + test "$ltdl_am_macro_dir" = "$ltdl_relative_macro_dir" || { + my_am_macro_dir_regex=`$ECHO "\ +$ltdl_am_macro_dir" |$SED "$sed_make_literal_regex"` + + # Tricky [m] quoting to stop m4sh processing from flagging an + # undefined macro. + aclocal_m4_filter=" + /^[m]4_include(/{ + s,$my_am_macro_dir_regex,$ltdl_relative_macro_dir,g + }" + } + + require_aclocal_m4_filter=: +} + + # require_aux_dir # --------------- # Set aux_dir according to AC_CONFIG_AUX_DIR or else use the same @@ -1549,8 +1539,8 @@ func_require_ltdl_dir () $require_ac_ltdl_dir - test -n "$ltdl_dir" || ltdl_dir=$ac_ltdl_dir - test -n "$ltdl_dir" || ltdl_dir=libltdl + test -z "$ltdl_dir" && ltdl_dir=$ac_ltdl_dir + test -z "$ltdl_dir" && $opt_ltdl && ltdl_dir=libltdl if test -n "$ac_ltdl_dir"; then test "$ac_ltdl_dir" = "$ltdl_dir" || func_fatal_error "\ @@ -1572,18 +1562,45 @@ func_require_ltdl_mode () $require_ac_ltdl_mode - test -n "$ltdl_mode" || ltdl_mode=$ac_ltdl_mode - test -n "$ltdl_mode" || ltdl_mode=subproject + test -z "$ltdl_mode" && ltdl_mode=$ac_ltdl_mode + test -z "$ltdl_mode" && { + $require_ltdl_dir + + test -n "$ltdl_dir" && ltdl_mode=subproject + } if test -n "$ac_ltdl_mode"; then test "$ac_ltdl_mode" = "$ltdl_mode" || func_fatal_error "\ --$ltdl_mode does not match LTDL_INIT($ac_ltdl_mode)" fi + func_verbose "ltdl mode='$ltdl_mode'" + require_ltdl_mode=: } +# require_ltdl_relative_macro_dir +# ------------------------------- +# Set ltdl_relative_macro_dir to the relative path from $ltdl_dir to +# the parent project macro directory. +require_ltdl_relative_macro_dir=func_require_ltdl_relative_macro_dir +func_require_ltdl_relative_macro_dir () +{ + $debug_cmd + + $require_ltdl_dir + $require_macro_dir + + func_relative_path "$ltdl_dir" "$macro_dir" + ltdl_relative_macro_dir=$func_relative_path_result + + func_verbose "relative ltdl macro_dir='$ltdl_relative_macro_dir'" + + require_ltdl_relative_macro_dir=: +} + + # require_macro_dir # ----------------- # If both are specified, ensure both ACLOCAL_AMFLAGS and @@ -1596,10 +1613,25 @@ func_require_macro_dir () $require_ac_macro_dir $require_am_macro_dir + # AC_CONFIG_MACRO_DIR takes precedence. macro_dir=$ac_macro_dir - test -n "$macro_dir" || macro_dir=$am_macro_dir - test -n "$macro_dir" || macro_dir=m4 + # Followed by first -I optarg from ACLOCAL_AMFLAGS. + test -z "$macro_dir" && macro_dir=$am_macro_dir + + # Subproject ltdl without either of the above keeps macros in + # specified --ltdl optarg subdirectory. + test -z "$macro_dir" && $opt_ltdl && { + $require_ltdl_dir + $require_ltdl_mode + + test subproject = "$ltdl_mode" && macro_dir="$ltdl_dir/m4" + } + + # Use ./m4 as the last resort. + test -z "$macro_dir" && macro_dir=m4 + + # Diagnose conflicts. if test -n "$ac_macro_dir" && test -n "$am_macro_dir"; then test "$ac_macro_dir" = "$am_macro_dir" || func_fatal_error "\ AC_CONFIG_MACRO_DIR([$ac_macro_dir]) conflicts with ACLOCAL_AMFLAGS=-I $am_macro_dir." @@ -1684,7 +1716,7 @@ func_require_seen_libtool () if test -n "$_lt_pkgdatadir"; then pkgltdldir="$_lt_pkgdatadir/libltdl" pkgdatadir="$_lt_pkgdatadir/libltdl" - aclocaldir="$_lt_pkgdatadir/libltdl/m4" + aclocaldir="$_lt_pkgdatadir/m4" fi func_nonemptydir_p pkgltdldir func_nonemptydir_p pkgdatadir @@ -1698,7 +1730,6 @@ func_require_seen_libtool () *) ltdlprefix=$ltdl_dir/ ;; esac subproject_aux_dir=${ltdlprefix}config - subproject_macro_dir=${ltdlprefix}m4 # :::BE CAREFUL HERE::: # func_check_macros needs to check whether --ltdl was specified when diff --git a/libltdl/m4/.gitignore b/m4/.gitignore similarity index 100% rename from libltdl/m4/.gitignore rename to m4/.gitignore diff --git a/libltdl/m4/argz.m4 b/m4/argz.m4 similarity index 100% rename from libltdl/m4/argz.m4 rename to m4/argz.m4 diff --git a/libltdl/m4/autobuild.m4 b/m4/autobuild.m4 similarity index 100% rename from libltdl/m4/autobuild.m4 rename to m4/autobuild.m4 diff --git a/libltdl/m4/libtool.m4 b/m4/libtool.m4 similarity index 100% rename from libltdl/m4/libtool.m4 rename to m4/libtool.m4 diff --git a/libltdl/m4/ltdl.m4 b/m4/ltdl.m4 similarity index 100% rename from libltdl/m4/ltdl.m4 rename to m4/ltdl.m4 diff --git a/libltdl/m4/ltoptions.m4 b/m4/ltoptions.m4 similarity index 100% rename from libltdl/m4/ltoptions.m4 rename to m4/ltoptions.m4 diff --git a/libltdl/m4/ltsugar.m4 b/m4/ltsugar.m4 similarity index 100% rename from libltdl/m4/ltsugar.m4 rename to m4/ltsugar.m4 diff --git a/libltdl/m4/ltversion.in b/m4/ltversion.in similarity index 100% rename from libltdl/m4/ltversion.in rename to m4/ltversion.in diff --git a/libltdl/m4/lt~obsolete.m4 b/m4/lt~obsolete.m4 similarity index 100% rename from libltdl/m4/lt~obsolete.m4 rename to m4/lt~obsolete.m4 diff --git a/tests/cdemo/Makefile.am b/tests/cdemo/Makefile.am index ba58fea2..148ca53c 100644 --- a/tests/cdemo/Makefile.am +++ b/tests/cdemo/Makefile.am @@ -23,7 +23,7 @@ ##### AUTOMAKE_OPTIONS = no-dependencies foreign -ACLOCAL_AMFLAGS = -I ../../libltdl/m4 +ACLOCAL_AMFLAGS = -I ../../m4 AM_CPPFLAGS = -I$(top_srcdir)/../.. noinst_LTLIBRARIES = libfoo.la diff --git a/tests/demo/Makefile.am b/tests/demo/Makefile.am index a3c61441..3cf17c68 100644 --- a/tests/demo/Makefile.am +++ b/tests/demo/Makefile.am @@ -23,7 +23,7 @@ ##### AUTOMAKE_OPTIONS = no-dependencies foreign -ACLOCAL_AMFLAGS = -I ../../libltdl/m4 +ACLOCAL_AMFLAGS = -I ../../m4 AM_CPPFLAGS = -I$(top_srcdir)/../.. # Build a libtool library, libhello.la for installation in libdir. diff --git a/tests/depdemo/Makefile.am b/tests/depdemo/Makefile.am index ef6b0607..282a861d 100644 --- a/tests/depdemo/Makefile.am +++ b/tests/depdemo/Makefile.am @@ -23,7 +23,7 @@ ##### AUTOMAKE_OPTIONS = no-dependencies foreign -ACLOCAL_AMFLAGS = -I ../../libltdl/m4 +ACLOCAL_AMFLAGS = -I ../../m4 AM_CPPFLAGS = -I$(top_srcdir)/../.. SUBDIRS = l1 l2 l3 l4 diff --git a/tests/f77demo/Makefile.am b/tests/f77demo/Makefile.am index d38156e3..83e5db67 100644 --- a/tests/f77demo/Makefile.am +++ b/tests/f77demo/Makefile.am @@ -23,7 +23,7 @@ ##### AUTOMAKE_OPTIONS = no-dependencies foreign -ACLOCAL_AMFLAGS = -I ../../libltdl/m4 +ACLOCAL_AMFLAGS = -I ../../m4 AM_CPPFLAGS = -I$(top_srcdir)/../.. lib_LTLIBRARIES = libfoo.la libmix.la libfoo2.la libfoo3.la diff --git a/tests/fcdemo/Makefile.am b/tests/fcdemo/Makefile.am index 299286ea..f494e9fd 100644 --- a/tests/fcdemo/Makefile.am +++ b/tests/fcdemo/Makefile.am @@ -23,7 +23,7 @@ ##### AUTOMAKE_OPTIONS = no-dependencies foreign -ACLOCAL_AMFLAGS = -I ../../libltdl/m4 +ACLOCAL_AMFLAGS = -I ../../m4 AM_CPPFLAGS = -I$(top_srcdir)/../.. lib_LTLIBRARIES = libfoo.la libmix.la libfoo2.la libfoo3.la diff --git a/tests/libtoolize.at b/tests/libtoolize.at index e7fe60c3..84aad85f 100644 --- a/tests/libtoolize.at +++ b/tests/libtoolize.at @@ -359,14 +359,14 @@ libtoolize: linking file `ltdl/config/depcomp' libtoolize: linking file `ltdl/config/install-sh' libtoolize: linking file `ltdl/config/missing' libtoolize: linking file `ltdl/config/ltmain.sh' -libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `ltdl/m4'. -libtoolize: linking file `ltdl/m4/argz.m4' -libtoolize: linking file `ltdl/m4/libtool.m4' -libtoolize: linking file `ltdl/m4/ltdl.m4' -libtoolize: linking file `ltdl/m4/ltoptions.m4' -libtoolize: linking file `ltdl/m4/ltsugar.m4' -libtoolize: linking file `ltdl/m4/ltversion.m4' -libtoolize: linking file `ltdl/m4/lt~obsolete.m4' +libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'. +libtoolize: linking file `m4/argz.m4' +libtoolize: linking file `m4/libtool.m4' +libtoolize: linking file `m4/ltdl.m4' +libtoolize: linking file `m4/ltoptions.m4' +libtoolize: linking file `m4/ltsugar.m4' +libtoolize: linking file `m4/ltversion.m4' +libtoolize: linking file `m4/lt~obsolete.m4' libtoolize: putting libltdl files in LT_CONFIG_LTDL_DIR, `ltdl'. libtoolize: linking file `ltdl/COPYING.LIB' libtoolize: linking file `ltdl/Makefile.am' @@ -408,14 +408,14 @@ AT_DATA([configure.ac], [[AC_INIT([libtoolize-demo], ]AT_PACKAGE_VERSION[, ]AT_PACKAGE_BUGREPORT[) LT_CONFIG_LTDL_DIR([ltdl]) AC_CONFIG_AUX_DIR([ltdl/config]) -AC_CONFIG_MACRO_DIR([ltdl/m4]) +AC_CONFIG_MACRO_DIR([m4]) LT_INIT LTDL_INIT AC_OUTPUT ]]) AT_DATA([Makefile.am], -[[ACLOCAL_AMFLAGS = -I ltdl/m4 +[[ACLOCAL_AMFLAGS = -I m4 ]]) ])# _LT_AT_LTDL_SETUP @@ -458,14 +458,14 @@ libtoolize: copying file `ltdl/config/depcomp' libtoolize: copying file `ltdl/config/install-sh' libtoolize: copying file `ltdl/config/missing' libtoolize: copying file `ltdl/config/ltmain.sh' -libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `ltdl/m4'. -libtoolize: copying file `ltdl/m4/argz.m4' -libtoolize: copying file `ltdl/m4/libtool.m4' -libtoolize: copying file `ltdl/m4/ltdl.m4' -libtoolize: copying file `ltdl/m4/ltoptions.m4' -libtoolize: copying file `ltdl/m4/ltsugar.m4' -libtoolize: copying file `ltdl/m4/ltversion.m4' -libtoolize: copying file `ltdl/m4/lt~obsolete.m4' +libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'. +libtoolize: copying file `m4/argz.m4' +libtoolize: copying file `m4/libtool.m4' +libtoolize: copying file `m4/ltdl.m4' +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: putting libltdl files in LT_CONFIG_LTDL_DIR, `ltdl'. libtoolize: copying file `ltdl/COPYING.LIB' libtoolize: copying file `ltdl/Makefile.am' @@ -502,14 +502,14 @@ 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. +libtoolize: Consider adding `-I m4' to ACLOCAL_AMFLAGS in Makefile.am. ]]) AT_DATA([configure.ac], [[AC_INIT([libtoolize-demo], ]AT_PACKAGE_VERSION[, ]AT_PACKAGE_BUGREPORT[) LT_CONFIG_LTDL_DIR([ltdl]) AC_CONFIG_AUX_DIR([ltdl/config]) -AC_CONFIG_MACRO_DIR([ltdl/m4]) +AC_CONFIG_MACRO_DIR([m4]) LT_INIT AC_OUTPUT ]]) @@ -689,7 +689,7 @@ LT_AT_CHECK_LIBTOOLIZE([--copy], 0, expout) ## Upgrading an aclocal maintained aclocal.m4 without AC_CONFIG_MACRO_DIR. ## ## ----------------------------------------------------------------------- ## -LT_AT_ACLOCAL([-I $abs_top_srcdir/libltdl/m4]) +LT_AT_ACLOCAL([-I $abs_top_srcdir/m4]) ## The following code is adapted (and simplified) from libtoolize.m4sh #### @@ -743,7 +743,7 @@ ltversion_serial=`func_serial "$tst_aclocaldir/ltversion.m4" ltversion.m4` ltsugar_serial=`func_serial "$tst_aclocaldir/ltsugar.m4" ltsugar.m4` lt_obsolete_serial=`func_serial "$tst_aclocaldir/lt~obsolete.m4" lt~obsolete.m4` $SED -e 's,^#.*serial.*ltoptions.m4$,# serial 99999 ltoptions.m4,' \ - -e "s,^#.*serial.*libtool.m4\$,# serial $libtool_serial libtool.m4," \ + -e "s,^#.*serial.*libtool.m4\$,# serial $libtool_serial libtool.m4," \ -e "s,^#.*serial.*ltversion.m4\$,# serial $ltversion_serial ltversion.m4," \ -e "s,^#.*serial.*ltsugar.m4\$,# serial $ltsugar_serial ltsugar.m4," \ -e "s,^#.*serial.*lt~obsolete.m4\$,# serial $lt_obsolete_serial lt~obsolete.m4," \ @@ -847,11 +847,11 @@ LT_AT_CHECK_LIBTOOLIZE([--copy --install --ltdl=ltdl], 0, expout) AT_CLEANUP -## -------------------------------------------------------- ## -## Check subproject ltdl with non-shared AC_CONFIG_.*_DIRs. ## -## -------------------------------------------------------- ## +## ----------------------------------------------------- ## +## Check subproject ltdl with AC_CONFIG_MACRO_DIR(acm4). ## +## ----------------------------------------------------- ## -AT_SETUP([subproject ltdl with non-shared directories]) +AT_SETUP([subproject ltdl with non-canonical macro dir]) AT_DATA(expout, [[libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, `build-aux'. @@ -875,21 +875,13 @@ libtoolize: copying file `acm4/ltoptions.m4' libtoolize: copying file `acm4/ltsugar.m4' libtoolize: copying file `acm4/ltversion.m4' libtoolize: copying file `acm4/lt~obsolete.m4' -libtoolize: putting macros in `ltdl/m4'. -libtoolize: copying file `ltdl/m4/argz.m4' -libtoolize: copying file `ltdl/m4/libtool.m4' -libtoolize: copying file `ltdl/m4/ltdl.m4' -libtoolize: copying file `ltdl/m4/ltoptions.m4' -libtoolize: copying file `ltdl/m4/ltsugar.m4' -libtoolize: copying file `ltdl/m4/ltversion.m4' -libtoolize: copying file `ltdl/m4/lt~obsolete.m4' libtoolize: putting libltdl files in LT_CONFIG_LTDL_DIR, `ltdl'. libtoolize: copying file `ltdl/COPYING.LIB' -libtoolize: copying file `ltdl/Makefile.am' -libtoolize: copying file `ltdl/Makefile.in' +libtoolize: creating file `ltdl/Makefile.am' +libtoolize: creating file `ltdl/Makefile.in' libtoolize: copying file `ltdl/README' libtoolize: copying file `ltdl/configure.ac' -libtoolize: copying file `ltdl/aclocal.m4' +libtoolize: creating file `ltdl/aclocal.m4' libtoolize: copying file `ltdl/argz_.h' libtoolize: copying file `ltdl/argz.c' libtoolize: copying file `ltdl/config-h.in' @@ -919,8 +911,7 @@ libtoolize: copying file `ltdl/ltdl.c' 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. +libtoolize: Consider adding `-I acm4' to ACLOCAL_AMFLAGS in Makefile.am. ]]) AT_DATA([configure.ac], @@ -963,11 +954,11 @@ libtoolize: linking file `ltdl/m4/ltversion.m4' libtoolize: linking file `ltdl/m4/lt~obsolete.m4' libtoolize: putting libltdl files in `ltdl'. libtoolize: linking file `ltdl/COPYING.LIB' -libtoolize: linking file `ltdl/Makefile.am' -libtoolize: linking file `ltdl/Makefile.in' +libtoolize: creating file `ltdl/Makefile.am' +libtoolize: creating file `ltdl/Makefile.in' libtoolize: linking file `ltdl/README' libtoolize: linking file `ltdl/configure.ac' -libtoolize: copying file `ltdl/aclocal.m4' +libtoolize: creating file `ltdl/aclocal.m4' libtoolize: linking file `ltdl/argz_.h' libtoolize: linking file `ltdl/argz.c' libtoolize: linking file `ltdl/config-h.in' diff --git a/tests/mdemo/Makefile.am b/tests/mdemo/Makefile.am index f73fc9bc..a0ab4905 100644 --- a/tests/mdemo/Makefile.am +++ b/tests/mdemo/Makefile.am @@ -23,7 +23,7 @@ ##### AUTOMAKE_OPTIONS = no-dependencies foreign -ACLOCAL_AMFLAGS = -I ../../libltdl/m4 +ACLOCAL_AMFLAGS = -I ../../m4 AM_CPPFLAGS = -I$(top_srcdir)/../.. $(INCLTDL) lib_LTLIBRARIES = libsub.la foo1.la libfoo2.la libmlib.la diff --git a/tests/mdemo2/Makefile.am b/tests/mdemo2/Makefile.am index e215650b..3b2beb12 100644 --- a/tests/mdemo2/Makefile.am +++ b/tests/mdemo2/Makefile.am @@ -23,7 +23,7 @@ ##### AUTOMAKE_OPTIONS = no-dependencies foreign -ACLOCAL_AMFLAGS = -I ../../libltdl/m4 +ACLOCAL_AMFLAGS = -I ../../m4 AM_CPPFLAGS = -I$(top_srcdir)/../.. -I$(top_srcdir)/../../libltdl bin_PROGRAMS = mdemo2 mdemo2_static diff --git a/tests/pdemo/Makefile.am b/tests/pdemo/Makefile.am index 91fe1e26..775b3474 100644 --- a/tests/pdemo/Makefile.am +++ b/tests/pdemo/Makefile.am @@ -23,7 +23,7 @@ ##### AUTOMAKE_OPTIONS = no-dependencies foreign -ACLOCAL_AMFLAGS = -I ../../libltdl/m4 +ACLOCAL_AMFLAGS = -I ../../m4 AM_CPPFLAGS = -I$(top_srcdir)/../.. # Build a libtool library, libhello.la for installation in libdir. diff --git a/tests/tagdemo/Makefile.am b/tests/tagdemo/Makefile.am index 295e7b61..71a7825b 100644 --- a/tests/tagdemo/Makefile.am +++ b/tests/tagdemo/Makefile.am @@ -23,7 +23,7 @@ ##### AUTOMAKE_OPTIONS = no-dependencies foreign -ACLOCAL_AMFLAGS = -I ../../libltdl/m4 +ACLOCAL_AMFLAGS = -I ../../m4 AM_CPPFLAGS = -I$(top_srcdir)/../.. noinst_LTLIBRARIES = libconv.la