From f3186c9c010265b3a88ce094a787af51d0ae076c Mon Sep 17 00:00:00 2001 From: Ralf Wildenhues Date: Sun, 11 Feb 2007 16:16:38 +0000 Subject: [PATCH] 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. --- ChangeLog | 11 ++++ libltdl/config/ltmain.m4sh | 109 +++++++++++++++++++------------------ libltdl/m4/libtool.m4 | 1 - 3 files changed, 67 insertions(+), 54 deletions(-) diff --git a/ChangeLog b/ChangeLog index fd4384ee..3cb735ba 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2007-02-11 Ralf Wildenhues + + 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 * doc/libtool.texi: Update copyright years. diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh index 27d5383b..ec83da77 100644 --- a/libltdl/config/ltmain.m4sh +++ b/libltdl/config/ltmain.m4sh @@ -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,60 +6918,22 @@ 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 "$exec_cmd" && \ - func_fatal_help "invalid operation mode \`$mode'" - - if test -n "$exec_cmd"; then - eval exec "$exec_cmd" - exit $EXIT_FAILURE - fi +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'" + +if test -n "$exec_cmd"; then + eval exec "$exec_cmd" + exit $EXIT_FAILURE +fi + exit $exit_status diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4 index 7e3098b2..62beff53 100644 --- a/libltdl/m4/libtool.m4 +++ b/libltdl/m4/libtool.m4 @@ -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