libtool-patches
[Top][All Lists]
Advanced

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

[PATCH 6/7] libtoolize: refactor ltdl_mode discovery.


From: Gary V. Vaughan
Subject: [PATCH 6/7] libtoolize: refactor ltdl_mode discovery.
Date: Sat, 5 Nov 2011 23:45:33 +0700

* libtoolize.m4sh (require_ac_ltdl_mode)
(require_ac_ltdl_options, require_ltdl_mode): New functions
factored out of func_scan_files for scanning and setting
ltdl_mode and friends.
(func_scan_files): Remove the factored out code.
(func_install_pkgmacro_files, func_install_pkgltdl_files)
(func_install_pkgconfig_files, func_check_macros): Adjust.

Signed-off-by: Gary V. Vaughan <address@hidden>
---
 libtoolize.m4sh |  125 +++++++++++++++++++++++++++++++++----------------------
 1 files changed, 75 insertions(+), 50 deletions(-)

diff --git a/libtoolize.m4sh b/libtoolize.m4sh
index ba6a8e2..0917cea 100644
--- a/libtoolize.m4sh
+++ b/libtoolize.m4sh
@@ -75,11 +75,6 @@ m4_divert_pop
 m4_include([getopt.m4sh])
 
 M4SH_VERBATIM([[
-# ltdl can be installed to be self-contained (subproject, the default);
-# or to be configured by a parent project, either with a recursive or
-# nonrecursive automake driven make:
-ltdl_mode=
-
 # Parse environment options
 {
   my_sed_env_opt='1s/^\([^,:; ]*\).*$/\1/;q'
@@ -395,13 +390,7 @@ func_scan_files ()
 
     $require_configure_ac
 
-    test -n "$configure_ac" || {
-       # Make sure ltdl_mode has a sensible default
-        # since we return early here:
-       test -n "$ltdl_mode" || ltdl_mode=subproject
-
-       return
-    }
+    test -n "$configure_ac" || return
 
     # ---------------------------------------------------- #
     # Probe macro usage in configure.ac and/or aclocal.m4. #
@@ -424,8 +413,7 @@ func_scan_files ()
        }
        /\@<:@LTDL_INIT/d
        /LTDL_INIT/          {
-           s,^.*LTDL_INIT([[    ]*\([^])]*\).*$,ltdl_options="\1",
-           s,^.*LTDL_INIT[      ]*$,seen_ltdl=:,
+           s,^.*$,seen_ltdl=:,
            p
        }
        /LT_WITH_LTDL/       {
@@ -442,42 +430,6 @@ func_scan_files ()
        }
        d'
     eval `cat aclocal.m4 "$configure_ac" 2>/dev/null | $SED "$my_sed_traces"`
-
-    # ------------------- #
-    # Validate ltdl_mode. #
-    # ------------------- #
-
-    test -n "$ltdl_options" && seen_ltdl=:
-
-    # If $configure_ac contains LTDL_INIT, check that its
-    # arguments were not given in terms of a shell variable!
-    case "$ltdl_options" in
-      *\$*)
-        func_fatal_error "can not handle variables in LTDL_INIT"
-        ;;
-    esac
-
-    # Extract mode name from ltdl_options
-    # FIXME: Diagnose multiple conflicting modes in ltdl_options
-    ac_ltdl_mode=
-    case " $ltdl_options " in
-      *" nonrecursive "*)  ac_ltdl_mode=nonrecursive   ;;
-      *" recursive "*)     ac_ltdl_mode=recursive      ;;
-      *" subproject "*)    ac_ltdl_mode=subproject     ;;
-    esac
-
-    # If neither --ltdl nor an LTDL_INIT mode are specified, default to
-    # `subproject'.  If both are specified, they must be the same.  Otherwise,
-    # take the one that is given!
-    case x$ac_ltdl_mode,x$ltdl_mode in
-      x,x)     ltdl_mode=subproject    ;;
-      x*,x)    ltdl_mode=$ac_ltdl_mode ;;
-      x,x*)    ltdl_mode=$ltdl_mode    ;;
-      *)
-        test x"$ac_ltdl_mode" = x"$ltdl_mode" || \
-           func_fatal_error "--$ltdl_mode does not match 
LTDL_INIT($ac_ltdl_mode)"
-       ;;
-    esac
 }
 
 # func_included_files searchfile
@@ -988,6 +940,7 @@ func_install_pkgmacro_files ()
 
     $require_ac_macro_dir
     $require_am_macro_dir
+    $require_ltdl_mode
     $require_macro_dir
 
     # argz.m4, libtool.m4 and ltdl.m4 are handled specially:
@@ -1065,6 +1018,7 @@ func_install_pkgltdl_files ()
 
     $require_ac_ltdl_dir
     $require_ltdl_dir
+    $require_ltdl_mode
 
     # Remove any lingering files that my have been installed by some
     # previous libtoolize release:
@@ -1213,6 +1167,7 @@ func_install_pkgconfig_files ()
 
     $require_aux_dir
     $require_configure_ac
+    $require_ltdl_mode
 
     func_massage_pkgconfig_files
 
@@ -1274,6 +1229,7 @@ func_check_macros ()
     $require_aux_dir
     $require_configure_ac
     $require_ltdl_dir
+    $require_ltdl_mode
     $require_macro_dir
 
     $opt_quiet && return
@@ -1484,6 +1440,52 @@ can not expand unknown variable in LT_CONFIG_LTDL_DIR 
argument."
 }
 
 
+# require_ac_ltdl_mode
+# --------------------
+# Extract mode name from LTDL_INIT options.
+require_ac_ltdl_mode=func_require_ac_ltdl_mode
+func_require_ac_ltdl_mode ()
+{
+    $debug_cmd
+
+    $require_ac_ltdl_options
+
+    case " $ac_ltdl_options " in
+      *" nonrecursive "*) ac_ltdl_mode=nonrecursive ;;
+      *" recursive "*)    ac_ltdl_mode=recursive    ;;
+      *" subproject "*)   ac_ltdl_mode=subproject   ;;
+    esac
+      
+    require_ac_ltdl_mode=:
+}
+
+
+# require_ac_ltdl_options
+# -----------------------
+# Extract ac_ltdl_options from LTDL_INIT.
+require_ac_ltdl_options=func_require_ac_ltdl_options
+func_require_ac_ltdl_options ()
+{
+    $debug_cmd
+
+    $require_configure_ac
+
+    if test -n "$configure_ac"; then
+      func_extract_trace LTDL_INIT
+      ac_ltdl_options=$func_extract_trace_result
+
+      case $ac_ltdl_options in
+        *\$*)
+          func_fatal_error "\
+can not expand unknown variable in LTDL_INIT argument."
+          ;;
+      esac
+    fi
+
+    require_ac_ltdl_mode=:
+}
+
+
 # require_ac_macro_dir
 # --------------------
 # Extract ac_macro_dir from AC_CONFIG_MACRO_DIR.
@@ -1627,6 +1629,29 @@ func_require_ltdl_dir ()
 }
 
 
+# require_ltdl_mode
+# -----------------
+# If both are specified, ensure both command line setting and LTDL_INIT
+# option agree, and set ltdl_mode to the value of either.
+require_ltdl_mode=func_require_ltdl_mode
+func_require_ltdl_mode ()
+{
+    $debug_cmd
+
+    $require_ac_ltdl_mode
+
+    test -n "$ltdl_mode" || ltdl_mode=$ac_ltdl_mode
+    test -n "$ltdl_mode" || 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
+
+    require_ltdl_mode=:
+}
+
+
 # require_macro_dir
 # -----------------
 # If both are specified, ensure both ACLOCAL_AMFLAGS and
-- 
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]