libtool-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/4] libtoolize: massage installed macro list at make time.


From: Gary V. Vaughan
Subject: [PATCH 2/4] libtoolize: massage installed macro list at make time.
Date: Sun, 6 Nov 2011 00:07:24 +0700

(Please excuse the brute force rearrangement of libtoolize.at expout files... I
have a much nicer patch to generate these from the filelists that libtoolize 
itself
is using, but I want to get back to the directory renaming patches in as few 
steps
as possible, without flooding the list with patches along the way)

* libtoolize.m4sh (func_massage_aclocal_DATA): Removed function
and only caller, because...
(pkgmacro_files): ...we substitute the pre-massaged files
directly...
(func_install_pkgmacro_files): ...from here.
* Makefile.am (pkgmacro_files): New pre-massaged list of aclocal
macros used by func_install_pkgmacro_files.
(configure_edit): Substitute pkgmacro_files instead of
aclocalfiles.

Signed-off-by: Gary V. Vaughan <address@hidden>
---
 Makefile.am         |   19 ++++------
 libtoolize.m4sh     |   96 +++++++++++++++++++--------------------------------
 tests/libtoolize.at |    4 +-
 3 files changed, 46 insertions(+), 73 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index b1abaa1..fed52fc 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -269,7 +269,6 @@ all-local: $(LTDL_BOOTSTRAP_DEPS)
 ## ---------------- ##
 
 configure_edit = $(SED) \
-       -e 's,@aclocal_DATA\@,$(aclocalfiles),g' \
        -e 's,@aclocaldir\@,$(aclocaldir),g' \
        -e 's,@aux_dir\@,$(aux_dir),g' \
        -e 's,@datadir\@,$(datadir),g' \
@@ -282,6 +281,7 @@ configure_edit = $(SED) \
        -e "s,@pkgconfig_files\@,$(auxfiles),g" \
        -e 's,@pkgdatadir\@,$(pkgdatadir),g' \
        -e "s,@pkgltdl_files\@,$(ltdldatafiles),g" \
+       -e 's,@pkgmacro_files\@,$(pkgmacro_files),g' \
        -e 's,@prefix\@,$(prefix),g' \
        -e 's,@SED\@,$(SED),g' \
        -e 's,@srcdir\@,$(srcdir),g'
@@ -333,9 +333,7 @@ lt_config_h_in      = $(ltdl_dir)/config-h.in
 lt_configure   = $(ltdl_dir)/configure
 stamp_mk       = $(ltdl_dir)/stamp-mk
 
-lt_obsolete_m4 = $(macro_dir)/lt~obsolete.m4
-
-EXTRA_DIST     += $(stamp_mk) $(lt_obsolete_m4)
+EXTRA_DIST     += $(stamp_mk) $(macro_dir)/lt~obsolete.m4
 
 $(lt_Makefile_in): $(lt_Makefile_am) $(lt_aclocal_m4)
        $(AM_V_GEN)cd '$(ltdl_dir)' && $(AUTOMAKE) Makefile
@@ -439,8 +437,8 @@ auxfiles    = $(pkgaux_scripts) config/ltmain.sh
 
 # Everything that gets picked up by aclocal is automatically distributed,
 # this is the list of macro files we install on the user's system.
-aclocalfiles   = m4/argz.m4 m4/libtool.m4 m4/ltdl.m4 m4/ltoptions.m4 \
-                 m4/ltsugar.m4 m4/ltversion.m4 m4/lt~obsolete.m4
+pkgmacro_files = argz.m4 libtool.m4 ltdl.m4 ltoptions.m4 ltsugar.m4 \
+                 ltversion.m4 lt~obsolete.m4
 
 ## These are installed as a subdirectory of pkgdatadir so that
 ## libtoolize --ltdl can find them later:
@@ -473,10 +471,9 @@ install-data-local: $(lt_Makefile_in)
 ## with libtoolize, we have to install them in the correct order:
 ## First, put a copy of the libtool m4 macros in the aclocal dir
        $(mkinstalldirs) $(DESTDIR)$(aclocaldir)
-       @list='$(aclocalfiles)'; for p in $$list; do \
-         f=`echo "$$p" |'$(SED)' 's|^.*/||'`; \
-         echo " $(INSTALL_DATA) '$(macro_dir)/$$f' 
'$(DESTDIR)$(aclocaldir)/$$f'"; \
-         $(INSTALL_DATA) "$(macro_dir)/$$f" "$(DESTDIR)$(aclocaldir)/$$f"; \
+       @list='$(pkgmacro_files)'; for p in $$list; do \
+         echo " $(INSTALL_DATA) '$(macro_dir)/$$p' 
'$(DESTDIR)$(aclocaldir)/$$p'"; \
+         $(INSTALL_DATA) "$(macro_dir)/$$p" "$(DESTDIR)$(aclocaldir)/$$p"; \
        done
 ## install the helper scripts
        $(mkinstalldirs) '$(DESTDIR)$(pkgdatadir)'
@@ -559,7 +556,7 @@ uninstall-hook:
          echo " rm -f '$(DESTDIR)$(pkgdatadir)/$$f'"; \
          rm -f "$(DESTDIR)$(pkgdatadir)/$$f"; \
        done
-       @for p in $(aclocalfiles); do \
+       @for p in $(pkgmacro_files); do \
          f=`echo "$$p" |$(SED) 's|^.*/||'`; \
          echo " rm -f '$(DESTDIR)$(aclocaldir)/$$f'"; \
          rm -f "$(DESTDIR)$(aclocaldir)/$$f"; \
diff --git a/libtoolize.m4sh b/libtoolize.m4sh
index 7568f1c..608471f 100644
--- a/libtoolize.m4sh
+++ b/libtoolize.m4sh
@@ -759,34 +759,6 @@ func_install_update ()
 }
 
 
-# func_massage_aclocal_DATA [glob_exclude]
-# @aclocal_DATA\@ is substituted as per its value in Makefile.am;
-# this function massages it into a suitable format for func_copy_some_files.
-func_massage_aclocal_DATA ()
-{
-    $debug_cmd
-
-    pkgmacro_files=     # GLOBAL VAR
-
-    my_glob_exclude="$1"
-
-    # Massage a value for pkgmacro_files from the value used in Makefile.am.
-    for my_filename in @aclocal_DATA@; do
-      func_dirname_and_basename "$my_filename"
-      my_filename=$func_basename_result
-
-      # ignore excluded filenames
-      if test -n "$my_glob_exclude"; then
-       my_cont=false
-       eval 'case $my_filename in '$my_glob_exclude') my_cont=: ;; esac'
-       $my_cont && continue
-      fi
-
-      pkgmacro_files="${pkgmacro_files+$pkgmacro_files }$my_filename"
-    done
-}
-
-
 # func_install_pkgmacro_subproject
 # Unless --quiet was passed, display a message. Then copy pkgmacro_files
 # from libtool installation tree to subproject libltdl tree.
@@ -811,7 +783,7 @@ func_install_pkgmacro_subproject ()
       pkgmacro_header="putting macros in AC_CONFIG_MACRO_DIR, 
\`$subproject_macro_dir'."
     fi
 
-    func_copy_some_files "libtool.m4 ltdl.m4 $pkgmacro_files" \
+    func_copy_some_files "$pkgmacro_files" \
       "$aclocaldir" "$subproject_macro_dir" pkgmacro_header
 }
 
@@ -842,26 +814,29 @@ func_install_pkgmacro_parent ()
       my_pkgmacro_header="putting macros in \`$macro_dir'."
     fi
 
-    if $opt_ltdl; then
-      func_serial_update argz.m4 "$aclocaldir" "$macro_dir" \
-        my_pkgmacro_header argz.m4
-    else
-      func_verbose "Not copying \`$macro_dir/argz.m4', libltdl not used."
-    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
 
-    func_serial_update  libtool.m4 "$aclocaldir" "$macro_dir" \
-      my_pkgmacro_header LT_INIT 'A[CM]_PROG_LIBTOOL'
+      case $file in
+        libtool.m4)
+          func_serial_update libtool.m4 "$aclocaldir" "$macro_dir" \
+            my_pkgmacro_header LT_INIT 'A[CM]_PROG_LIBTOOL' ;;
 
-    if $opt_ltdl; then
-      func_serial_update ltdl.m4 "$aclocaldir" "$macro_dir" \
-        my_pkgmacro_header 'LTDL_INIT'
-    else
-      func_verbose "Not copying \`$macro_dir/ltdl.m4', libltdl not used."
-    fi
+        ltdl.m4)
+          func_serial_update ltdl.m4 "$aclocaldir" "$macro_dir" \
+            my_pkgmacro_header 'LTDL_INIT' ;;
 
-    for file in $pkgmacro_files; do
-      func_serial_update "$file" "$aclocaldir" "$macro_dir" \
-        my_pkgmacro_header "$file"
+        *)
+          func_serial_update "$file" "$aclocaldir" "$macro_dir" \
+            my_pkgmacro_header "$file" ;;
+      esac
     done
 }
 
@@ -877,9 +852,6 @@ func_install_pkgmacro_files ()
     $require_ltdl_mode
     $require_macro_dir
 
-    # argz.m4, libtool.m4 and ltdl.m4 are handled specially:
-    func_massage_aclocal_DATA 'argz.m4|libtool.m4|ltdl.m4'
-
   # 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"
@@ -1173,17 +1145,17 @@ func_check_macros ()
        my_ac_config_macro_srcdir="$subproject_macro_dir"
       fi
 
-      my_needed="libtool.m4 ltoptions.m4 ltversion.m4 ltsugar.m4 
lt~obsolete.m4"
-      $opt_ltdl && my_needed="$my_needed argz.m4 ltdl.m4"
-
-      if test -f "aclocal.m4"; then
-       for need in $my_needed; do
-         func_aclocal_update_check $need
-         $func_aclocal_update_check_result && my_missing="$my_missing $need"
-       done
-      else
-        my_missing="$my_needed"
-      fi
+      my_missing=
+      for file in $pkgmacro_files; do
+        case $file in
+          argz.m4|ltdl.m4) $opt_ltdl || continue ;;
+        esac
+        if test -f "aclocal.m4"; then
+          func_aclocal_update_check $file
+          $func_aclocal_update_check_result || continue
+        fi
+        my_missing="$my_missing $file"
+      done
 
       if test -n "$my_missing"; then
         func_echo "You should add the contents of the following files to 
\`aclocal.m4':"
@@ -1685,6 +1657,10 @@ func_require_seen_libtool ()
   all_pkgmacro_files="argz.m4 libtool.m4 ltdl.m4 ltoptions.m4 ltsugar.m4 
ltversion.in ltversion.m4 lt~obsolete.m4"
   all_pkgltdl_files="COPYING.LIB Makefile Makefile.in Makefile.inc Makefile.am 
README acinclude.m4 aclocal.m4 argz_.h argz.c config.h.in config-h.in configure 
configure.ac configure.in libltdl/lt__alloc.h libltdl/lt__dirent.h 
libltdl/lt__glibc.h libltdl/lt__private.h libltdl/lt__strl.h 
libltdl/lt_dlloader.h libltdl/lt_error.h libltdl/lt_system.h libltdl/slist.h 
loaders/dld_link.c loaders/dlopen.c loaders/dyld.c loaders/load_add_on.c 
loaders/loadlibrary.c loaders/preopen.c loaders/shl_load.c lt__alloc.c 
lt__dirent.c lt__strl.c lt_dlloader.c lt_error.c ltdl.c ltdl.h slist.c"
 
+  # Files installed by func_install_pkgmacro_files(), not including
+  # libtool.m4 and ltdl.m4 which are handled specially.
+  pkgmacro_files="@pkgmacro_files@"
+
   # Locations for important files:
   address@hidden@
   address@hidden@
diff --git a/tests/libtoolize.at b/tests/libtoolize.at
index 541753b..cf366c0 100644
--- a/tests/libtoolize.at
+++ b/tests/libtoolize.at
@@ -539,8 +539,8 @@ libtoolize: copying file `build-aux/ltmain.sh'
 libtoolize: You should add the contents of the following files to `aclocal.m4':
 libtoolize:   `/usr/local/share/aclocal/libtool.m4'
 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/ltversion.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.
@@ -674,8 +674,8 @@ AT_DATA([expout],
 libtoolize: copying file `./ltmain.sh'
 libtoolize: You should add the contents of the following files to `aclocal.m4':
 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/ltversion.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.
-- 
1.7.7.2

Cheers,
-- 
Gary V. Vaughan (gary AT gnu DOT org)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]