From: Gary V. Vaughan Date: Wed, 10 Oct 2012 12:30:07 +0000 (+0700) Subject: libtool: rewritten over funclib.sh instead of general.m4sh. X-Git-Tag: v2.4.2.418~124 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0a42997c6032b9550a009a271552e811bfbcc430;p=thirdparty%2Flibtool.git libtool: rewritten over funclib.sh instead of general.m4sh. * Makefile.am (ltmain_m4sh, ltmain_sh_edit): Remove. (ltmain_in): Path to ltmain.in. (ltmain_sh): Generate ltmain.sh from ltmain.in using $(bootstrap_edit). * build-aux/ltmain.m4sh: Remove. * build-aux/ltmain.in: Rewritten as a client of funclib.sh. Signed-off-by: Gary V. Vaughan --- diff --git a/Makefile.am b/Makefile.am index 747a01bef..f01837fe2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -60,7 +60,6 @@ rebuild = rebuild=:; revision=`$(lt__cd) $(srcdir) && $(git_version_gen) | sed ' general_m4sh = $(srcdir)/$(m4sh_dir)/general.m4sh getopt_m4sh = $(srcdir)/$(m4sh_dir)/getopt.m4sh -ltmain_m4sh = $(srcdir)/$(m4sh_dir)/ltmain.m4sh sh_files = $(general_m4sh) $(getopt_m4sh) build_scripts = $(srcdir)/$(aux_dir)/announce-gen \ @@ -89,13 +88,14 @@ funclib_sh = $(srcdir)/$(aux_dir)/funclib.sh inline_source = $(srcdir)/$(aux_dir)/inline-source libtoolize_in = $(srcdir)/libtoolize.in ltmain_sh = $(srcdir)/$(aux_dir)/ltmain.sh +ltmain_in = $(srcdir)/$(aux_dir)/ltmain.in libtool_m4 = $(srcdir)/$(macro_dir)/libtool.m4 ltversion_in = $(srcdir)/$(macro_dir)/ltversion.in ltversion_m4 = $(srcdir)/$(macro_dir)/ltversion.m4 options_parser = $(srcdir)/$(aux_dir)/options-parser EXTRA_DIST += $(extract_trace) $(funclib_sh) $(inline_source) \ - $(libtoolize_in) $(ltmain_m4sh) $(ltmain_sh) \ + $(libtoolize_in) $(ltmain_in) $(ltmain_sh) \ $(ltversion_in) $(ltversion_m4) $(options_parser) ## These are the replacements that need to be made at bootstrap time, @@ -117,12 +117,6 @@ bootstrap_edit = $(SED) \ -e 's|@PACKAGE_VERSION\@|$(VERSION)|g' \ -e 's|@VERSION\@|$(VERSION)|g' -## ltmain.sh needs some additional editing to remove unsubstituted -## variable defaulting lines, because ltmain.sh never gets passed -## through $(configure_edit). -ltmain_sh_edit = $(bootstrap_edit) \ - -e '/^: \$${.*="@.*@"}$$/d' - ## We build ltversion.m4 here, instead of from config.status, ## because config.status is rerun each time one of configure's ## dependencies change and ltversion.m4 happens to be a configure @@ -158,12 +152,12 @@ $(ltversion_m4): $(ltversion_in) $(dotversion) ## would rerun configure on every invocation, so now we manually ## check the version numbers from the build rule when necessary. ## !WARNING! If you edit this rule to change the contents of ltmain.sh, -## you must `touch $(m4sh_dir)/ltmain.m4sh' from the +## you must `touch $(aux_dir)/ltmain.in' from the ## shell if you need ltmain.sh to be regenerated. Ideally, we ## should make this rule depend on Makefile but that will break ## distcheck (at least) by rebuilding ltmain.sh in the source ## tree whenever config.status regenerates the Makefile. -$(ltmain_sh): $(ltmain_m4sh) $(sh_files) $(dotversion) +$(ltmain_sh): $(ltmain_in) $(sh_files) $(dotversion) @$(rebuild); \ if test -f '$@'; then \ eval `'$(SED)' -n '/^package_revision=/p' '$@'`; \ @@ -175,8 +169,8 @@ $(ltmain_sh): $(ltmain_m4sh) $(sh_files) $(dotversion) if $$rebuild; then \ rm -f '$@'; \ if test 0 = '$(V)'; then echo " GEN " $@; \ - else echo "$(LT_M4SH) '$(ltmain.m4sh)' |" $(ltmain_sh_edit) "> '$@'"; fi; \ - $(LT_M4SH) '$(ltmain_m4sh)' | $(ltmain_sh_edit) > '$@'; \ + else echo $(bootstrap_edit) "< '$(ltmain_in)' > '$@'"; fi; \ + $(bootstrap_edit) < '$(ltmain_in)' > '$@'; \ chmod a-w '$@'; \ fi @@ -511,8 +505,16 @@ install-data-local: $(lt_Makefile_in) @list='$(pkgaux_data_files)' && for p in $$list; do \ d=`echo "$(DESTDIR)$(pkgauxdir)/$$p" |$(SED) 's|[^/]*$$||'`; \ test -d "$$d" || $(mkinstalldirs) "$$d"; \ - echo " $(INSTALL_DATA) '$(srcdir)/$(aux_dir)/$$p' '$(DESTDIR)$(pkgauxdir)/$$p'"; \ - $(INSTALL_DATA) "$(srcdir)/$(aux_dir)/$$p" "$(DESTDIR)$(pkgauxdir)/$$p"; \ + case $$p in \ + ltmain.sh) \ + echo "$(inline_source) '$(srcdir)/$(aux_dir)/$$p' > '$(DESTDIR)$(pkgauxdir)/$$p'"; \ + $(inline_source) "$(srcdir)/$(aux_dir)/$$p" > "$(DESTDIR)$(pkgauxdir)/$$p"; \ + ;; \ + *) \ + echo " $(INSTALL_DATA) '$(srcdir)/$(aux_dir)/$$p' '$(DESTDIR)$(pkgauxdir)/$$p'"; \ + $(INSTALL_DATA) "$(srcdir)/$(aux_dir)/$$p" "$(DESTDIR)$(pkgauxdir)/$$p"; \ + ;; \ + esac; \ done ## install the libltdl files @list='$(pkgltdl_files)' && for p in $$list; do \ diff --git a/build-aux/ltmain.m4sh b/build-aux/ltmain.in similarity index 95% rename from build-aux/ltmain.m4sh rename to build-aux/ltmain.in index 1a00e79d5..7ea29956d 100644 --- a/build-aux/ltmain.m4sh +++ b/build-aux/ltmain.in @@ -1,9 +1,10 @@ -m4_define([_m4_divert(SCRIPT)], 100) -m4_divert_push([SCRIPT]) +#! /bin/sh + # libtool (GNU @PACKAGE@) @VERSION@ +# Provide generalized library-building support services. # Written by Gordon Matzigkeit , 1996 -# Copyright (C) 1996-2001, 2003-2012 Free Software Foundation, Inc. +# Copyright (C) 1996-2012 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. @@ -23,136 +24,153 @@ m4_divert_push([SCRIPT]) # General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with GNU Libtool; see the file COPYING. If not, a copy -# can be downloaded from http://www.gnu.org/licenses/gpl.html, -# or obtained by writing to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# along with this program. If not, see . -# Usage: $progname [OPTION]... [MODE-ARG]... -# -# Provide generalized library-building support services. -# -# --config show all configuration variables -# --debug enable verbose shell tracing -# -n, --dry-run display commands without modifying any files -# --features display basic configuration information and exit -# --mode=MODE use operation mode MODE -# --preserve-dup-deps don't remove duplicate dependency libraries -# --quiet, --silent don't print informational messages -# --no-quiet, --no-silent -# print informational messages (default) -# --no-warn don't display warning messages -# --tag=TAG use configuration variables from tag TAG -# -v, --verbose print more informational messages than default -# --no-verbose don't print the extra informational messages -# --version print version information -# -h, --help, --help-all print short, long, or detailed help message -# -# MODE must be one of the following: -# -# clean remove files from the build directory -# compile compile a source file into a libtool object -# execute automatically set library path, then run a program -# finish complete the installation of libtool libraries -# install install libraries or executables -# link create a library or an executable -# uninstall remove libraries from an installed directory -# -# MODE-ARGS vary depending on the MODE. When passed as first option, -# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that. -# Try `$progname --help --mode=MODE' for a more detailed description of MODE. -# -# When reporting a bug, please describe a test case to reproduce it and -# include the following information: -# -# host-triplet: $host -# shell: $SHELL -# compiler: $LTCC -# compiler flags: $LTCFLAGS -# linker: $LD (gnu? $with_gnu_ld) -# $progname: (GNU @PACKAGE@) @VERSION@ -# automake: $automake_version -# autoconf: $autoconf_version -# -# Report bugs to <@PACKAGE_BUGREPORT@>. -# GNU @PACKAGE@ home page: <@PACKAGE_URL@>. -# General help using GNU software: . PROGRAM=libtool PACKAGE=@PACKAGE@ VERSION=@VERSION@ package_revision=@package_revision@ -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac -fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh -# A function that is used when there is no print builtin or printf. -func_fallback_echo () +## ------ ## +## Usage. ## +## ------ ## + +# Run `./libtool --help` for help with using this script from the +# command line. + + +## ------------------------------- ## +## User overridable command paths. ## +## ------------------------------- ## + +# After configure completes, it has a better idea of some of the +# shell tools we need than the defaults used by the functions shared +# with bootstrap, so set those here where they can still be over- +# ridden by the user, but otherwise take precedence. + +: ${AUTOCONF="autoconf"} +: ${AUTOMAKE="automake"} + + +## -------------------------- ## +## Source external libraries. ## +## -------------------------- ## + +# Much of our low-level functionality needs to be sourced from external +# libraries, which are installed to $pkgauxdir under normal use, though +# we also need to be able to find them in $srcdir during testing, or if +# executed directly from the build tree. + +. "@auxscriptsdir@/funclib.sh" +. "@auxscriptsdir@/options-parser" + +# Set a version string. +scriptversion='(GNU @PACKAGE@) @VERSION@' + + +# func_echo ARG... +# ---------------- +# Libtool also displays the current mode in messages, so override +# funclib.sh func_echo with this custom definition. +func_echo () { - eval 'cat <<_LTECHO_EOF -$1 -_LTECHO_EOF' + $debug_cmd + + _G_message=$* + + func_echo_IFS=$IFS + IFS=$nl + for _G_line in $_G_message; do + IFS=$func_echo_IFS + $bs_echo "$progname${opt_mode+: $opt_mode}: $_G_line" + done + IFS=$func_echo_IFS } -# NLS nuisances: We save the old values to restore during execute mode. -lt_user_locale= -lt_safe_locale= -for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES -do - eval "if test \"\${$lt_var+set}\" = set; then - save_$lt_var=\$$lt_var - $lt_var=C - export $lt_var - lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" - lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" - fi" -done -LC_ALL=C -LANGUAGE=C -export LANGUAGE LC_ALL - -$lt_unset CDPATH - -dnl This script is generated by config.status, so we cannot put things -dnl in the header. -m4_define([M4SH_IN_HEADER], [$1])dnl - -m4_include([getopt.m4sh]) - -M4SH_VERBATIM([[ -magic='%%%MAGIC variable%%%' -magic_exe='%%%MAGIC EXE variable%%%' -# Global variables. -nonopt= -preserve_args= -lo2o=s/\\.lo\$/.$objext/ -o2lo=s/\\.$objext\$/.lo/ -extracted_archives= -extracted_serial=0 +# func_warning ARG... +# ------------------- +# Libtool warnings are not categorized, so override funclib.sh +# func_warning with this simpler definition. +func_warning () +{ + $debug_cmd + + $warning_func ${1+"$@"} +} -# If this variable is set in any of the actions, the command in it -# will be execed at the end. This prevents here-documents from being -# left over by shells. -exec_cmd= +## ---------------- ## +## Options parsing. ## +## ---------------- ## + +# Hook in the functions to make sure our own options are parsed during +# the option parsing loop. + +usage='$progpath [OPTION]... [MODE-ARG]...' + +# Short help message in response to `-h'. +usage_message='Options: + --config show all configuration variables + --debug enable verbose shell tracing + -n, --dry-run display commands without modifying any files + --features display basic configuration information and exit + --mode=MODE use operation mode MODE + --no-warnings equivalent to \`-Wnone'\'' + --preserve-dup-deps don'\''t remove duplicate dependency libraries + --quiet, --silent don'\''t print informational messages + --tag=TAG use configuration variables from tag TAG + -v, --verbose print more informational messages than default + --version print version information + -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all] + -h, --help, --help-all print short, long, or detailed help message +' + +# Additional text appended to `usage_message' in response to `--help'. +long_help_message=$long_help_message" + +MODE must be one of the following: + + clean remove files from the build directory + compile compile a source file into a libtool object + execute automatically set library path, then run a program + finish complete the installation of libtool libraries + install install libraries or executables + link create a library or an executable + uninstall remove libraries from an installed directory + +MODE-ARGS vary depending on the MODE. When passed as first option, +\`--mode=MODE' may be abbreviated as \`MODE' or a unique abbreviation of that. +Try \`$progname --help --mode=MODE' for a more detailed description of MODE. + +When reporting a bug, please describe a test case to reproduce it and +include the following information: + + host-triplet: $host + shell: $SHELL + compiler: $LTCC + compiler flags: $LTCFLAGS + linker: $LD (gnu? $with_gnu_ld) + version: $progname (GNU @PACKAGE@) @VERSION@ + automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q` + autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q` + +Report bugs to <@PACKAGE_BUGREPORT@>. +GNU @PACKAGE@ home page: <@PACKAGE_URL@>. +General help using GNU software: ." + + +# func_lo2o OBJECT-NAME +# --------------------- +# Transform OBJECT-NAME from a `.lo' suffix to the platform specific +# object suffix. + +lo2o=s/\\.lo\$/.$objext/ +o2lo=s/\\.$objext\$/.lo/ -# If this shell supports prefix and suffix pattern removal, then -# use them to avoid forking. Hide the definition in an eval in case -# the shell chokes on unsupported syntax... -if test yes = "$lt_HAVE_XSI_OPS"; then - # func_lo2o object +if test yes = "$_G_HAVE_XSI_OPS"; then eval 'func_lo2o () { case $1 in @@ -161,7 +179,10 @@ if test yes = "$lt_HAVE_XSI_OPS"; then esac }' - # func_xform libobj-or-source + # func_xform LIBOBJ-OR-SOURCE + # --------------------------- + # Transform LIBOBJ-OR-SOURCE from a `.o' or `.c' (or otherwise) + # suffix to a `.lo' libtool-object suffix. eval 'func_xform () { func_xform_result=${1%.*}.lo @@ -180,18 +201,20 @@ else fi -# func_fatal_configuration arg... +# func_fatal_configuration ARG... +# ------------------------------- # Echo program name prefixed message to standard error, followed by # a configuration failure hint, and exit. func_fatal_configuration () { - func_error ${1+"$@"} - func_error "See the $PACKAGE documentation for more information." - func_fatal_error "Fatal configuration error." + func__fatal_error ${1+"$@"} \ + "See the $PACKAGE documentation for more information." \ + "Fatal configuration error." } # func_config +# ----------- # Display the configuration for all the tags in this script. func_config () { @@ -209,7 +232,9 @@ func_config () exit $? } + # func_features +# ------------- # Display the features supported by this script. func_features () { @@ -228,200 +253,323 @@ func_features () exit $? } -# func_enable_tag tagname + +# func_enable_tag TAGNAME +# ----------------------- # Verify that TAGNAME is valid, and either flag an error and exit, or # enable the TAGNAME tag. We also add TAGNAME to the global $taglist # variable here. func_enable_tag () { - # Global variable: - tagname=$1 + # Global variable: + tagname=$1 - re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" - re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" - sed_extractcf=/$re_begincf/,/$re_endcf/p + re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" + re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" + sed_extractcf=/$re_begincf/,/$re_endcf/p - # Validate tagname. - case $tagname in - *[!-_A-Za-z0-9,/]*) - func_fatal_error "invalid tag name: $tagname" - ;; - esac + # Validate tagname. + case $tagname in + *[!-_A-Za-z0-9,/]*) + func_fatal_error "invalid tag name: $tagname" + ;; + esac - # Don't test for the "default" C tag, as we know it's - # there but not specially marked. - case $tagname in - CC) ;; + # Don't test for the "default" C tag, as we know it's + # there but not specially marked. + case $tagname in + CC) ;; *) - if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then - taglist="$taglist $tagname" - - # Evaluate the configuration. Be careful to quote the path - # and the sed script, to avoid splitting on whitespace, but - # also don't use non-portable quotes within backquotes within - # quotes we have to do it in 2 steps: - extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` - eval "$extractedcf" - else - func_error "ignoring unknown tag $tagname" - fi - ;; - esac + if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then + taglist="$taglist $tagname" + + # Evaluate the configuration. Be careful to quote the path + # and the sed script, to avoid splitting on whitespace, but + # also don't use non-portable quotes within backquotes within + # quotes we have to do it in 2 steps: + extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` + eval "$extractedcf" + else + func_error "ignoring unknown tag $tagname" + fi + ;; + esac } + # func_check_version_match +# ------------------------ # Ensure that we are using m4 macros, and libtool script from the same # release of libtool. func_check_version_match () { - if test "$package_revision" != "$macro_revision"; then - if test "$VERSION" != "$macro_version"; then - if test -z "$macro_version"; then - cat >&2 <<_LT_EOF + if test "$package_revision" != "$macro_revision"; then + if test "$VERSION" != "$macro_version"; then + if test -z "$macro_version"; then + cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from an older release. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF - else - cat >&2 <<_LT_EOF + else + cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF - fi - else - cat >&2 <<_LT_EOF + fi + else + cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, $progname: but the definition of this LT_INIT comes from revision $macro_revision. $progname: You should recreate aclocal.m4 with macros from revision $package_revision $progname: of $PACKAGE $VERSION and run autoconf again. _LT_EOF - fi + fi - exit $EXIT_MISMATCH - fi + exit $EXIT_MISMATCH + fi } -# Shorthand for --mode=foo, only valid as the first argument -case $1 in -clean|clea|cle|cl) - shift; set dummy --mode clean ${1+"$@"}; shift - ;; -compile|compil|compi|comp|com|co|c) - shift; set dummy --mode compile ${1+"$@"}; shift - ;; -execute|execut|execu|exec|exe|ex|e) - shift; set dummy --mode execute ${1+"$@"}; shift - ;; -finish|finis|fini|fin|fi|f) - shift; set dummy --mode finish ${1+"$@"}; shift - ;; -install|instal|insta|inst|ins|in|i) - shift; set dummy --mode install ${1+"$@"}; shift - ;; -link|lin|li|l) - shift; set dummy --mode link ${1+"$@"}; shift - ;; -uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) - shift; set dummy --mode uninstall ${1+"$@"}; shift - ;; -esac -]]) - -dnl SHORT LONG DEFAULT INIT -dnl ---------------------------------------------------------------------- -M4SH_GETOPTS( - [n], [--dry-run|--dryrun], [], [], - [], [--config], [], [ - func_config], - [;], [--dlopen|-dlopen], [], [], - [], [--preserve-dup-deps], [], [], - [], [--features], [], [ - func_features], - [], [--finish], [], [ - set dummy --mode finish ${1+"[$]@"}; shift], - [], [--help], [], [], - [], [--help-all], [], [ - opt_help=': help-all'], - [!], [--mode], [], [ - case $optarg in - # Valid mode arguments: - clean|compile|execute|finish|install|link|relink|uninstall) ;; - - # Catch anything else as an error - *) func_error "invalid argument for $opt" - exit_cmd=exit - break - ;; - esac], - [], [--no-silent|--no-quiet], [false], [ - func_append preserve_args " $opt"], - [], [--no-warning|--no-warn], [false], [ - func_append preserve_args " $opt"], - [], [--no-verbose], [false], [ - func_append preserve_args " $opt"], - [], [--silent|--quiet], [], [ - func_append preserve_args " $opt" - opt_verbose=false], - [v], [--verbose], [], [ - func_append preserve_args " $opt" - opt_silent=false], - [!], [--tag], [], [ - func_append preserve_args " $opt $optarg" - func_enable_tag "$optarg"], -[ - # save first non-option argument - if test "$[]#" -gt 0; then - nonopt=$opt - shift - fi +# libtool_options_prep [ARG]... +# ----------------------------- +# Preparation for options parsed by libtool. +libtool_options_prep () +{ + $debug_mode - # preserve --debug - test : = "$debug_cmd" || func_append preserve_args " --debug" + # Option defaults: + opt_config=false + opt_dlopen= + opt_dry_run=false + opt_help=false + opt_mode= + opt_preserve_dup_deps=false + opt_quiet=false - case $host in - *cygwin* | *mingw* | *pw32* | *cegcc*) - # don't eliminate duplications in $postdeps and $predeps - opt_duplicate_compiler_generated_deps=: + nonopt= + preserve_args= + + # Shorthand for --mode=foo, only valid as the first argument + case $1 in + clean|clea|cle|cl) + shift; set dummy --mode clean ${1+"$@"}; shift ;; - *) - opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps + compile|compil|compi|comp|com|co|c) + shift; set dummy --mode compile ${1+"$@"}; shift ;; - esac + execute|execut|execu|exec|exe|ex|e) + shift; set dummy --mode execute ${1+"$@"}; shift + ;; + finish|finis|fini|fin|fi|f) + shift; set dummy --mode finish ${1+"$@"}; shift + ;; + install|instal|insta|inst|ins|in|i) + shift; set dummy --mode install ${1+"$@"}; shift + ;; + link|lin|li|l) + shift; set dummy --mode link ${1+"$@"}; shift + ;; + uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) + shift; set dummy --mode uninstall ${1+"$@"}; shift + ;; + esac + + # Pass back the list of options. + func_quote_for_eval ${1+"$@"} + libtool_options_prep_result=$func_quote_for_eval_result +} +func_add_hook func_options_prep libtool_options_prep - $opt_help || { - # Sanity checks first: - func_check_version_match - test yes != "$build_libtool_libs" \ - && test yes != "$build_old_libs" \ - && func_fatal_configuration "not configured to build any kind of library" +# libtool_parse_options [ARG]... +# --------------------------------- +# Provide handling for libtool specific options. +libtool_parse_options () +{ + $debug_cmd - # Darwin sucks - eval std_shrext=\"$shrext_cmds\" + # Perform our own loop to consume as many options as possible in + # each iteration. + while test $# -gt 0; do + _G_opt=$1 + shift + case $_G_opt in + --dry-run|--dryrun|-n) + opt_dry_run=: + ;; + + --config) func_config ;; + + --dlopen|-dlopen) + opt_dlopen="${opt_dlopen+$opt_dlopen +}$1" + shift + ;; + + --preserve-dup-deps) + opt_preserve_dup_deps=: ;; + + --features) func_features ;; + + --finish) set dummy --mode finish ${1+"$@"}; shift ;; + + --help) opt_help=: ;; + + --help-all) opt_help=': help-all' ;; + + --mode) test $# = 0 && func_missing_arg $_G_opt && break + opt_mode=$1 + case $1 in + # Valid mode arguments: + clean|compile|execute|finish|install|link|relink|uninstall) ;; + + # Catch anything else as an error + *) func_error "invalid argument for $_G_opt" + exit_cmd=exit + break + ;; + esac + shift + ;; + + --no-silent|--no-quiet) + opt_quiet=false + func_append preserve_args " $_G_opt" + ;; + + --no-warnings|--no-warning|--no-warn) + opt_warning=false + func_append preserve_args " $_G_opt" + ;; + + --no-verbose) + opt_verbose=false + func_append preserve_args " $_G_opt" + ;; + + --silent|--quiet) + opt_quiet=: + opt_verbose=false + func_append preserve_args " $_G_opt" + ;; + + --tag) test $# = 0 && func_missing_arg $_G_opt && break + opt_tag=$1 + func_append preserve_args " $_G_opt $1" + func_enable_tag "$1" + shift + ;; + + --verbose|-v) opt_quiet=false + opt_verbose=: + func_append preserve_args " $_G_opt" + ;; + + # An option not handled by this hook function: + *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;; + esac + done - # Only execute mode is allowed to have -dlopen flags. - if test -n "$opt_dlopen" && test execute != "$opt_mode"; then - func_error "unrecognized option \`-dlopen'" - $ECHO "$help" 1>&2 - exit $EXIT_FAILURE + + # save modified positional parameters for caller + func_quote_for_eval ${1+"$@"} + libtool_parse_options_result=$func_quote_for_eval_result +} +func_add_hook func_parse_options libtool_parse_options + + + +# libtool_validate_options [ARG]... +# --------------------------------- +# Perform any sanity checks on option settings and/or unconsumed +# arguments. +libtool_validate_options () +{ + # save first non-option argument + if test 0 -lt $#; then + nonopt=$1 + shift fi - # Change the help message to a mode-specific one. - generic_help=$help - help="Try \`$progname --help --mode=$opt_mode' for more information." - } -]) + # preserve --debug + test : = "$debug_cmd" || func_append preserve_args " --debug" + + case $host in + *cygwin* | *mingw* | *pw32* | *cegcc*) + # don't eliminate duplications in $postdeps and $predeps + opt_duplicate_compiler_generated_deps=: + ;; + *) + opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps + ;; + esac + + $opt_help || { + # Sanity checks first: + func_check_version_match + + test yes != "$build_libtool_libs" \ + && test yes != "$build_old_libs" \ + && func_fatal_configuration "not configured to build any kind of library" + + # Darwin sucks + eval std_shrext=\"$shrext_cmds\" + + # Only execute mode is allowed to have -dlopen flags. + if test -n "$opt_dlopen" && test execute != "$opt_mode"; 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=$opt_mode' for more information." + } + + # Pass back the unparsed argument list + func_quote_for_eval ${1+"$@"} + libtool_validate_options_result=$func_quote_for_eval_result +} +func_add_hook func_validate_options libtool_validate_options + + +# Process options as early as possible so that --help and --version +# can return quickly. +func_options ${1+"$@"} +eval set dummy "$func_options_result"; shift + -M4SH_VERBATIM([[ ## ----------- ## ## Main. ## ## ----------- ## +magic='%%%MAGIC variable%%%' +magic_exe='%%%MAGIC EXE variable%%%' + +# Global variables. +extracted_archives= +extracted_serial=0 + +# If this variable is set in any of the actions, the command in it +# will be execed at the end. This prevents here-documents from being +# left over by shells. +exec_cmd= + + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +$1 +_LTECHO_EOF' +} + # 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 @@ -1937,7 +2085,7 @@ func_mode_finish () fi # Exit here if they wanted silent mode. - $opt_silent && exit $EXIT_SUCCESS + $opt_quiet && exit $EXIT_SUCCESS if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then echo "----------------------------------------------------------------------" @@ -2376,7 +2524,7 @@ func_mode_install () # Replace the output file specification. relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` - $opt_silent || { + $opt_quiet || { func_quote_for_expand "$relink_command" eval "func_echo $func_quote_for_expand_result" } @@ -7688,7 +7836,7 @@ EOF save_ifs=$IFS; IFS='~' for cmd in $concat_cmds; do IFS=$save_ifs - $opt_silent || { + $opt_quiet || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } @@ -7781,7 +7929,7 @@ EOF for cmd in $cmds; do IFS=$save_ifs eval cmd=\"$cmd\" - $opt_silent || { + $opt_quiet || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } @@ -8898,5 +9046,3 @@ build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` # mode:shell-script # sh-indentation:2 # End: -# vi:sw=2 -]]) diff --git a/doc/libtool.texi b/doc/libtool.texi index 77d65bcd3..d19db34d1 100644 --- a/doc/libtool.texi +++ b/doc/libtool.texi @@ -5067,7 +5067,7 @@ to the compiler command at @command{configure} run time: If you think @command{libtool} should let some flag through by default, here's how you can test such an inclusion: grab the Libtool development -tree, edit the @file{ltmain.m4sh} file in the @file{libltdl/config} +tree, edit the @file{ltmain.in} file in the @file{libltdl/config} subdirectory to pass through the flag (search for @samp{Flags to be passed through}), re-bootstrap and build with the flags in question added to @code{LDFLAGS}, @code{CFLAGS}, @code{CXXFLAGS}, etc. on the diff --git a/tests/bindir.at b/tests/bindir.at index 79366b83c..e734ea525 100644 --- a/tests/bindir.at +++ b/tests/bindir.at @@ -24,7 +24,7 @@ #### # In this testcase, and in the chunk of code that makes use -# of $bindir in ltmain.m4sh, we would very much have liked to +# of $bindir in ltmain.in, we would very much have liked to # automatically decide which systems require dynamically-loaded # libraries to be installed to a directory in $PATH according # to the libtool properties that tell us that "the system provides @@ -55,7 +55,7 @@ # # So alas we punt for now, and just hardcode the relevant OSs that require # this functionality. That's Cygwin, MinGW and CeGCC for now; see the case -# statement in libtool.m4sh around where the 'tdlname' variable is set. +# statement in ltmain.in around where the 'tdlname' variable is set. #### # First a simple test that we can build and run an executable with a couple of diff --git a/tests/help.at b/tests/help.at index 3d8090061..3befcd1e7 100644 --- a/tests/help.at +++ b/tests/help.at @@ -35,9 +35,9 @@ AT_CHECK([$LIBTOOL --help-all], [], [ignore]) AT_CHECK([$LIBTOOL --version], [], [stdout]) AT_CHECK([grep 'Copyright.*Free Software Foundation' stdout], [], [ignore]) -AT_CHECK([$LIBTOOL], [1], [ignore], [stderr]) +AT_CHECK([$LIBTOOL], [1], [stdout], [stderr]) AT_CHECK([grep 'specify a MODE' stderr], [], [ignore]) -AT_CHECK([grep ' --help' stderr], [], [ignore]) +AT_CHECK([grep ' --help' stdout], [], [ignore]) AT_CLEANUP diff --git a/tests/mdemo.at b/tests/mdemo.at index 4d7059699..f534171c2 100644 --- a/tests/mdemo.at +++ b/tests/mdemo.at @@ -697,7 +697,7 @@ after=$objdir/temp/temp/after # Create a new libtool script that will enter dry run if the environment # variable force_dry_run is set -sed 's|^opt_dry_run=.*$|opt_dry_run=$force_dry_run|' libtool > ltnew && mv ltnew libtool +sed 's|^[[ ]]*opt_dry_run=.*$|opt_dry_run=$force_dry_run|' libtool > ltnew && mv ltnew libtool export force_dry_run # main.o is not compiled with libtool, but it depends on it, so make