libtool-patches
[Top][All Lists]
Advanced

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

[PATCH 7/7] libtoolize: remove sed based configure scanning.


From: Gary V. Vaughan
Subject: [PATCH 7/7] libtoolize: remove sed based configure scanning.
Date: Sat, 5 Nov 2011 23:55:07 +0700

* libtoolize (func_scan_files): Removed function and callers.
(require_seen_ltdl, require_seen_libtool): Factor out remaining
functionality of former sed based scanning.
(func_check_macros): Adjust.
* NEWS: Updated.

Signed-off-by: Gary V. Vaughan <address@hidden>
---
 NEWS            |    7 ++++
 libtoolize.m4sh |  104 ++++++++++++++++++++++++-------------------------------
 2 files changed, 52 insertions(+), 59 deletions(-)

diff --git a/NEWS b/NEWS
index 3672ff8..78ded9f 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,13 @@ NEWS - list of user-visible changes between releases of GNU 
Libtool
 ** New features:
 
   - Moved to gnulib release infrastructure.
+
+  - M4 is now used for scanning the M4 macros in your configure.ac that
+   `libtoolize' looks at to determine what files you want, and where you
+    would like them installed.  This means that you can compose your
+    version number or any other argument that Libtoolize needs to know at
+    M4 time using git-version-gen from gnulib, for example.
+
   - The Autotest testsuite can be run without the especially time consuming
     tests with:
 
diff --git a/libtoolize.m4sh b/libtoolize.m4sh
index 0917cea..a971276 100644
--- a/libtoolize.m4sh
+++ b/libtoolize.m4sh
@@ -378,60 +378,6 @@ func_extract_trace ()
 }
 
 
-# func_scan_files
-# Scan configure.(ac|in) and aclocal.m4 (if present) for use of libltdl
-# and libtool.  Possibly running some of these tools if necessary.
-# Libtoolize affects the contents of aclocal.m4, and should be run before
-# aclocal, so we can't use configure --trace which relies on a consistent
-# configure.(ac|in) and aclocal.m4.
-func_scan_files ()
-{
-    $debug_cmd
-
-    $require_configure_ac
-
-    test -n "$configure_ac" || return
-
-    # ---------------------------------------------------- #
-    # Probe macro usage in configure.ac and/or aclocal.m4. #
-    # ---------------------------------------------------- #
-
-    my_sed_traces='s,#.*$,,; s,^dnl .*$,,; s, dnl .*$,,
-        s,^.*AC_REQUIRE(.*$,,; s,^.*m4@&address@hidden(.*$,,;
-       s,^.*m4@&address@hidden(.*$,,
-       s,^.*A[CU]_DEFUN(.*$,,; s,^.*m4@&address@hidden(.*$,,
-       /\@<:@A[CM]_PROG_LIBTOOL/d
-       /A[CM]_PROG_LIBTOOL/ {
-           s,^.*$,seen_libtool=:,
-           p
-       }
-       /the.*option into.*LT_INIT.*parameter/d
-       /\@<:@LT_INIT/d
-       /LT_INIT/                {
-           s,^.*$,seen_libtool=:,
-           p
-       }
-       /\@<:@LTDL_INIT/d
-       /LTDL_INIT/          {
-           s,^.*$,seen_ltdl=:,
-           p
-       }
-       /LT_WITH_LTDL/       {
-           s,^.*$,seen_ltdl=:,
-           p
-       }
-       /AC_LIB_LTDL/        {
-           s,^.*$,seen_ltdl=:,
-           p
-       }
-       /AC_WITH_LTDL/       {
-           s,^.*$,seen_ltdl=:,
-           p
-       }
-       d'
-    eval `cat aclocal.m4 "$configure_ac" 2>/dev/null | $SED "$my_sed_traces"`
-}
-
 # func_included_files searchfile
 # Output INCLUDEFILE if SEARCHFILE m4_includes it, else output SEARCHFILE.
 func_included_files ()
@@ -1231,6 +1177,8 @@ func_check_macros ()
     $require_ltdl_dir
     $require_ltdl_mode
     $require_macro_dir
+    $require_seen_ltdl
+    $require_seen_libtool
 
     $opt_quiet && return
     test -n "$configure_ac" || return
@@ -1698,6 +1646,48 @@ func_require_makefile_am ()
 }
 
 
+# require_seen_ltdl
+# -----------------
+# Determine from contents of $configure_ac whether this project contains
+# libltdl.
+require_seen_ltdl=func_require_seen_ltdl
+func_require_seen_ltdl ()
+{
+    $debug_cmd
+
+    $require_configure_ac
+
+    if test -n "$configure_ac"; then
+      func_extract_trace AC_LIB_LTDL,AC_WITH_LTDL,LT_WITH_LTDL,LTDL_INIT
+      test -n "$func_extract_trace_result" && seen_ltdl=:
+    fi
+    test -n "$seen_ltdl" || seen_ltdl=false
+
+    require_seen_ltdl=:
+}
+
+
+# require_seen_libtool
+# --------------------
+# Determine from contents of $configure_ac whether this project is using
+# Libtool to compile (some of) its objects.
+require_seen_libtool=func_require_seen_libtool
+func_require_seen_libtool ()
+{
+    $debug_cmd
+
+    $require_configure_ac
+
+    if test -n "$configure_ac"; then
+      func_extract_trace AM_PROG_LIBTOOL,AC_PROG_LIBTOOL,LT_INIT
+      test -n "$func_extract_trace_result" && seen_libtool=:
+    fi
+    test -n "$seen_libtool" || seen_libtool=false
+
+    require_seen_libtool=:
+}
+
+
 
 ## ----------- ##
 ##    Main.    ##
@@ -1720,9 +1710,6 @@ func_require_makefile_am ()
   address@hidden@
   address@hidden@
 
-  seen_libtool=false
-  seen_ltdl=false
-
   # test EBCDIC or ASCII
   case `echo X|tr X '\101'` in
    A) # ASCII based system
@@ -1748,8 +1735,6 @@ func_require_makefile_am ()
 
   extract_trace=$pkgdatadir/config/extract-trace
 
-  func_scan_files
-
   $require_ltdl_dir
   case $ltdl_dir in
   .) ltdlprefix= ;;
@@ -1764,6 +1749,7 @@ func_require_makefile_am ()
   # conditions, or that check will be impossible.   No need to clutter the
   # rest of the code with '$opt_ltdl || $seen_ltdl' though, because we CAN
   # safely set opt_ltdl to true if LTDL_INIT was seen:
+  $require_seen_ltdl
   $seen_ltdl && opt_ltdl=:
 
   func_install_pkgconfig_files
-- 
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]