📄 ltmain.sh
字号:
*) 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=*) arg=`$ECHO "X$opt" | $Xsed -e "$my_sed_long_arg"` opt=`$ECHO "X$opt" | $Xsed -e "$my_sed_long_opt"` set dummy "$opt" "$arg" ${1+"$@"} shift ;; # Separate optargs to short options:# -x*|-y*)# arg=`$ECHO "X$opt" |$Xsed -e "$my_sed_single_rest"`# opt=`$ECHO "X$opt" |$Xsed -e "$my_sed_single_opt"`# set dummy "$opt" "$arg" ${1+"$@"}# shift# ;; # Separate non-argument short options:# -z*|-z*|-y*)# rest=`$ECHO "X$opt" |$Xsed -e "$my_sed_single_rest"`# opt=`$ECHO "X$opt" |$Xsed -e "$my_sed_single_opt"`# set dummy "$opt" "-$rest" ${1+"$@"}# shift# ;; -\?|-h) func_usage ;; --help) opt_help=: ;; --version) func_version ;; -*) func_fatal_help "unrecognized option \`$opt'" ;; *) nonopt="$opt" break ;; esac done # Now that we've collected a possible --mode arg, show help if necessary $opt_help && func_mode_help 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}# TEST SUITE MARKER ## BEGIN SOURCABLE# 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}# 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<&1 <"$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 exec 1<&5 5<&- fi test "$lalib_p" = yes}# func_ltwrapper_p file# True iff FILE is a libtool wrapper script.# This function is only a basic sanity check; it will hardly flush out# determined imposters.func_ltwrapper_p (){ func_lalib_p "$1"}# func_execute_cmds commands fail_cmd# Execute tilde-delimited COMMANDS.# If FAIL_CMD is given, eval that upon failure.# FAIL_CMD may read-access the current command in variable CMD!func_execute_cmds (){ $opt_debug save_ifs=$IFS; IFS='~' for cmd in $1; do IFS=$save_ifs eval cmd=\"$cmd\" func_show_eval "$cmd" "${2-:}" done IFS=$save_ifs}# func_source file# Source FILE, adding directory component if necessary.# Note that it is not necessary on cygwin/mingw to append a dot to# FILE even if both FILE and FILE.exe exist: automatic-append-.exe# behavior happens only for exec(3), not for open(2)! Also, sourcing# `FILE.' does not work on cygwin managed mounts.func_source (){ $opt_debug case $1 in */* | *\\*) . "$1" ;; *) . "./$1" ;; esac}# Generated shell functions inserted here.# func_win32_libid arg# return the library type of file 'arg'## Need a lot of goo to handle *both* DLLs and import libs# Has to be a shell function in order to 'eat' the argument# that is supplied when $file_magic_command is called.func_win32_libid (){ $opt_debug win32_libid_type="unknown" win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then win32_nmres=`eval $NM -f posix -A $1 | $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'` case $win32_nmres in import*) win32_libid_type="x86 archive import";; *) win32_libid_type="x86 archive static";; esac fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $ECHO "$win32_libid_type"}# func_infer_tag arg# Infer tagged configuration to use if any are available and# if one wasn't chosen via the "--tag" command line option.# Only attempt this if the compiler in the base compile# command doesn't match the default compiler.# arg is usually of the form 'gcc ...'func_infer_tag (){ $opt_debug if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do func_quote_for_eval "$arg" CC_quoted="$CC_quoted $func_quote_for_eval_result" done case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. func_quote_for_eval "$arg" CC_quoted="$CC_quoted $func_quote_for_eval_result" done case "$@ " in " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then func_echo "unable to infer tagged configuration" func_fatal_error "specify a tag with \`--tag'"# else# func_verbose "using $tagname tagged configuration" fi ;; esac fi}# func_generate_dlsyms outputname originator pic_p# Extract symbols from dlprefiles and create ${outputname}S.o with# a dlpreopen symbol table.func_generate_dlsyms (){ $opt_debug my_outputname="$1" my_originator="$2" my_pic_p="${3-no}" my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` my_dlsyms= if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then if test -n "$NM" && test -n "$global_symbol_pipe"; then my_dlsyms="${my_outputname}S.c" else func_error "not configured to extract global symbols from dlpreopened files" fi fi if test -n "$my_dlsyms"; then case $my_dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist="$output_objdir/${my_outputname}.nm" func_show_eval "$RM $nlist ${nlist}S ${nlist}T" # Parse the name list into a source file. func_echo "creating $output_objdir/$my_dlsyms" $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. *//* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */#ifdef __cplusplusextern \"C\" {#endif/* External symbol declarations for the compiler. */\" if test "$dlself" = yes; then func_echo "generating symbol list for \`$output'" $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` for progfile in $progfiles; do func_echo "extracting global C symbols from \`$progfile'" $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $opt_dry_run || { eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi if test -n "$export_symbols_regex"; then $opt_dry_run || { eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols="$output_objdir/$outputname.exp" $opt_dry_run || { $RM $export_symbols eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' case $host in *cygwin* | *mingw* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' ;; esac } else $opt_dry_run || { eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' case $host in *cygwin | *mingw* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' ;; esac } fi fi for dlprefile in $dlprefiles; do func_echo "extracting global C symbols from \`$dlprefile'" func_basename "$dlprefile" name="$func_basename_result" $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'" } done $opt_dry_run || { # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $MV "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if $GREP -v "^: " < "$nlist" | if sort -k 3 </dev/null >/dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else $GREP -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' else $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms" fi $ECHO >> "$output_objdir/$my_dlsyms" "\/* The mapping between symbol names and symbols. */" case $host in *cygwin* | *mingw* ) $ECHO >> "$output_objdir/$my_dlsyms" "\/* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ struct {" ;; *) $ECHO >> "$output_objdir/$my_dlsyms" "\const struct {" ;; esac $ECHO >> "$output_objdir/$my_dlsyms" "\ const char *name; void *address;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -