📄 ltmain.sh
字号:
}# func_show_eval_locale cmd [fail_exp]# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP# is given, then evaluate it. Use the saved locale for evaluation.func_show_eval_locale (){ my_cmd="$1" my_fail_exp="${2-:}" ${opt_silent-false} || { func_quote_for_expand "$my_cmd" eval "func_echo $func_quote_for_expand_result" } if ${opt_dry_run-false}; then :; else eval "$lt_user_locale $my_cmd" my_status=$? eval "$lt_safe_locale" if test "$my_status" -eq 0; then :; else eval "(exit $my_status); $my_fail_exp" fi fi}# func_version# Echo version message to standard output and exit.func_version (){ $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / { s/^# // s/^# *$// s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ p }' < "$progpath" exit $?}# func_usage# Echo short help message to standard output and exit.func_usage (){ $SED -n '/^# Usage:/,/# -h/ { s/^# // s/^# *$// s/\$progname/'$progname'/ p }' < "$progpath" $ECHO $ECHO "run \`$progname --help | more' for full usage" exit $?}# func_help# Echo long help message to standard output and exit.func_help (){ $SED -n '/^# Usage:/,/# Report bugs to/ { s/^# // s/^# *$// s*\$progname*'$progname'* s*\$host*'"$host"'* s*\$SHELL*'"$SHELL"'* s*\$LTCC*'"$LTCC"'* s*\$LTCFLAGS*'"$LTCFLAGS"'* s*\$LD*'"$LD"'* s/\$with_gnu_ld/'"$with_gnu_ld"'/ s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/ s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/ p }' < "$progpath" exit $?}# func_missing_arg argname# Echo program name prefixed message to standard error and set global# exit_cmd.func_missing_arg (){ func_error "missing argument for $1" exit_cmd=exit}exit_cmd=:# Check that we have a working $ECHO.if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shiftelif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over :elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then # Yippee, $ECHO works! :else # Restart under the correct shell, and then maybe $ECHO will work. exec $SHELL "$progpath" --no-reexec ${1+"$@"}fi# Same for EGREP, and just to be sure, do LTCC as wellif test "x$EGREP" = x ; then EGREP=egrepfiif test "x$LTCC" = x ; then LTCC=${CC-gcc}fiif test "X$1" = X--fallback-echo; then # used as fallback echo shift cat <<EOF$*EOF exit $EXIT_SUCCESSfimagic="%%%MAGIC variable%%%"magic_exe="%%%MAGIC EXE variable%%%"# Global variables.# $mode is unsetnonopt=execute_dlfiles=preserve_args=lo2o="s/\\.lo\$/.${objext}/"o2lo="s/\\.${objext}\$/.lo/"extracted_archives=extracted_serial=0opt_dry_run=falseopt_duplicate_deps=falseopt_silent=falseopt_debug=:# 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=# 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_config# Display the configuration for all the tags in this script.func_config (){ re_begincf='^# ### BEGIN LIBTOOL' re_endcf='^# ### END LIBTOOL' # Default configuration. $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" # Now print the configurations for the tags. for tagname in $taglist; do $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" done exit $?}# func_features# Display the features supported by this script.func_features (){ $ECHO "host: $host" if test "$build_libtool_libs" = yes; then $ECHO "enable shared libraries" else $ECHO "disable shared libraries" fi if test "$build_old_libs" = yes; then $ECHO "enable static libraries" else $ECHO "disable static libraries" fi exit $?}# 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" 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 # 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}# Parse options once, thoroughly. This comes as soon as possible in# the script to make things like `libtool --version' happen quickly.{ # 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 # Parse non-mode specific arguments: while test "$#" -gt 0; do opt="$1" shift case $opt in --config) func_config ;; --debug) preserve_args="$preserve_args $opt" func_echo "enabling shell trace mode" opt_debug='set -x' $opt_debug ;; -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break execute_dlfiles="$execute_dlfiles $1" shift ;; --dry-run | -n) opt_dry_run=: ;; --features) func_features ;; --finish) mode="finish" ;; --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break 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 $opt" exit_cmd=exit break ;; esac mode="$1" shift ;; --preserve-dup-deps) opt_duplicate_deps=: ;; --quiet|--silent) preserve_args="$preserve_args $opt" opt_silent=: ;; --verbose| -v) preserve_args="$preserve_args $opt" opt_silent=false ;; --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break preserve_args="$preserve_args $opt $1" func_enable_tag "$1" # tagname is set here shift ;; # Separate optargs to long options: -dlopen=*|--mode=*|--tag=*) func_opt_split "$opt" set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"} shift ;; -\?|-h) func_usage ;; --help) opt_help=: ;; --version) func_version ;; -*) func_fatal_help "unrecognized option \`$opt'" ;; *) nonopt="$opt" break ;; esac done case $host in *cygwin* | *mingw* | *pw32*) # don't eliminate duplications in $postdeps and $predeps opt_duplicate_compiler_generated_deps=: ;; *) opt_duplicate_compiler_generated_deps=$opt_duplicate_deps ;; esac # Having warned about all mis-specified options, bail out if # anything was wrong. $exit_cmd $EXIT_FAILURE}# 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$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$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$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 exit $EXIT_MISMATCH fi}## ----------- #### Main. #### ----------- ##$opt_help || { # 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# determined imposters.func_lalib_p (){ $SED -e 4q "$1" 2>/dev/null \ | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1}# func_lalib_unsafe_p file# True iff FILE is a libtool `.la' library or `.lo' object file.# This function implements the same check as func_lalib_p without# resorting to external programs. To this end, it redirects stdin and# closes it afterwards, without saving the original file descriptor.# As a safety measure, use it only where a negative result would be# fatal anyway. Works if `file' does not exist.func_lalib_unsafe_p (){ lalib_p=no if test -r "$1" && exec 5<&0 <"$1"; then for lalib_p_l in 1 2 3 4 do read lalib_p_line case "$lalib_p_line" in \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; esac done
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -