]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
Eliminate roughly a third of the script execution time overhead
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sun, 11 Feb 2007 16:16:38 +0000 (16:16 +0000)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sun, 11 Feb 2007 16:16:38 +0000 (16:16 +0000)
for all modes except for link/relink and uninstall/clean.

* libltdl/m4/libtool.m4 (_LT_CONFIG): Remove unused `TEST SUITE
MARKER', obsolete since 2005-04-17.
* libltdl/config/ltmain.m4sh: Likewise, several instances.
(Main): Tear apart, moving individual bits up as early in the
script as possible, to help the shell to avoid parsing the rest.

ChangeLog
libltdl/config/ltmain.m4sh
libltdl/m4/libtool.m4

index fd4384eececac11cac21909fd25a583f94720645..3cb735ba1a390968a24c46d049ad57d16b420ce5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2007-02-11  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       Eliminate roughly a third of the script execution time overhead
+       for all modes except for link/relink and uninstall/clean.
+
+       * libltdl/m4/libtool.m4 (_LT_CONFIG): Remove unused `TEST SUITE
+       MARKER', obsolete since 2005-04-17.
+       * libltdl/config/ltmain.m4sh: Likewise, several instances.
+       (Main): Tear apart, moving individual bits up as early in the
+       script as possible, to help the shell to avoid parsing the rest.
+
 2007-02-11  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
        * doc/libtool.texi: Update copyright years.
index 27d5383b2bfd69d1e6bffb0e38556f127b78c967..ec83da77d0b9974664d8ed1b6d2057bcc30c0571 100644 (file)
@@ -425,7 +425,6 @@ Otherwise, only FILE itself is deleted using RM."
     exit $?
 }
 
-# TEST SUITE MARKER ## NON-FUNCTION
 # Parse options once, thoroughly.  This comes as soon as possible in
 # the script to make things like `libtool --version' happen quickly.
 {
@@ -576,7 +575,6 @@ Otherwise, only FILE itself is deleted using RM."
   # anything was wrong.
   $exit_cmd $EXIT_FAILURE
 }
-# TEST SUITE MARKER ## BEGIN SOURCABLE
 
 # func_check_version_match
 # Ensure that we are using m4 macros, and libtool script from the same
@@ -614,6 +612,38 @@ _LT_EOF
 }
 
 
+## ----------- ##
+##    Main.    ##
+## ----------- ##
+
+{
+  # Sanity checks first:
+  func_check_version_match
+
+  if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
+    func_fatal_configuration "not configured to build any kind of library"
+  fi
+
+  test -z "$mode" && func_fatal_error "error: you must specify a MODE."
+
+
+  # Darwin sucks
+  eval std_shrext=\"$shrext_cmds\"
+
+
+  # Only execute mode is allowed to have -dlopen flags.
+  if test -n "$execute_dlfiles" && test "$mode" != execute; then
+    func_error "unrecognized option \`-dlopen'"
+    $ECHO "$help" 1>&2
+    exit $EXIT_FAILURE
+  fi
+
+  # Change the help message to a mode-specific one.
+  generic_help="$help"
+  help="Try \`$progname --help --mode=$mode' for more information."
+}
+
+
 # func_lalib_p file
 # True iff FILE is a libtool `.la' library or `.lo' object file.
 # This function is only a basic sanity check; it will hardly flush out
@@ -1549,6 +1579,8 @@ compiler."
     exit $EXIT_SUCCESS
 }
 
+test "$mode" = compile && func_mode_compile ${1+"$@"}
+
 
 # func_mode_execute arg...
 func_mode_execute ()
@@ -1674,6 +1706,8 @@ func_mode_execute ()
     fi
 }
 
+test "$mode" = execute && func_mode_execute ${1+"$@"}
+
 
 # func_mode_finish arg...
 func_mode_finish ()
@@ -1752,6 +1786,8 @@ func_mode_finish ()
     exit $EXIT_SUCCESS
 }
 
+test "$mode" = finish && func_mode_finish ${1+"$@"}
+
 
 # func_mode_install arg...
 func_mode_install ()
@@ -2183,6 +2219,8 @@ func_mode_install ()
     fi
 }
 
+test "$mode" = install && func_mode_install ${1+"$@"}
+
 
 # func_mode_link arg...
 func_mode_link ()
@@ -6710,6 +6748,9 @@ relink_command=\"$relink_command\""
     exit $EXIT_SUCCESS
 }
 
+{ test "$mode" = link || test "$mode" = relink; } &&
+    func_mode_link ${1+"$@"}
+
 
 # func_mode_uninstall arg...
 func_mode_uninstall ()
@@ -6877,59 +6918,21 @@ func_mode_uninstall ()
     exit $exit_status
 }
 
+{ test "$mode" = uninstall || test "$mode" = clean; } &&
+    func_mode_uninstall ${1+"$@"}
 
-# TEST SUITE MARKER ## NON-FUNCTION
-## ----------- ##
-##    Main.    ##
-## ----------- ##
-
-{
-  # Sanity checks first:
-  func_check_version_match
-
-  if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
-    func_fatal_configuration "not configured to build any kind of library"
-  fi
-
-  test -z "$mode" && func_fatal_error "error: you must specify a MODE."
-
-
-  # Darwin sucks
-  eval std_shrext=\"$shrext_cmds\"
-
-
-  # Only execute mode is allowed to have -dlopen flags.
-  if test -n "$execute_dlfiles" && test "$mode" != execute; then
-    func_error "unrecognized option \`-dlopen'"
-    $ECHO "$help" 1>&2
-    exit $EXIT_FAILURE
-  fi
-
-  # Change the help message to a mode-specific one.
-  generic_help="$help"
-  help="Try \`$progname --help --mode=$mode' for more information."
-
-  case $mode in
-    compile)           func_mode_compile ${1+"$@"}             ;;
-    execute)           func_mode_execute ${1+"$@"}             ;;
-    finish)            func_mode_finish ${1+"$@"}              ;;
-    install)           func_mode_install ${1+"$@"}             ;;
-    link|relink)       func_mode_link ${1+"$@"}                ;;
-    uninstall|clean)   func_mode_uninstall ${1+"$@"}           ;;
-
-    "")                        help="$generic_help"
-                       func_fatal_help "you must specify a MODE"
-                       ;;
-  esac
+test -z "$mode" && {
+  help="$generic_help"
+  func_fatal_help "you must specify a MODE"
+}
 
-  test -z "$exec_cmd" && \
-    func_fatal_help "invalid operation mode \`$mode'"
+test -z "$exec_cmd" && \
+  func_fatal_help "invalid operation mode \`$mode'"
 
-  if test -n "$exec_cmd"; then
-    eval exec "$exec_cmd"
-    exit $EXIT_FAILURE
-  fi
-}
+if test -n "$exec_cmd"; then
+  eval exec "$exec_cmd"
+  exit $EXIT_FAILURE
+fi
 
 exit $exit_status
 
index 7e3098b2aa98803b5e4d9e40f46a2eb51a7bc23d..62beff5304d785a61f3dcf04ab8c12ed6e7d917f 100644 (file)
@@ -674,7 +674,6 @@ _LT_CONFIG_SAVE_COMMANDS([
 # NOTE: Changes made to this file will be lost: look at ltmain.sh.
 #
 _LT_COPYING
-# TEST SUITE MARKER ## BEGIN SOURCABLE
 _LT_LIBTOOL_TAGS
 
 # ### BEGIN LIBTOOL CONFIG