📄 ltmain.sh
字号:
#ifdef __cplusplusextern \"C\" {#endif/* Prevent the only kind of declaration conflicts we can make. */#define dld_preloaded_symbols some_other_symbol/* External symbol declarations for the compiler. */\" if test -n "$export_symbols"; then sed -e 's/^\(.*\)/\1 \1/' < "$export_symbols" > "$nlist" fi for arg in $dlprefiles; do $show "extracting global C symbols from \`$arg'" $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" done if test -z "$run"; then # Make sure we at least have an empty file. test -f "$nlist" || : > "$nlist" # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else $rm "$nlist"T fi if test -f "$nlist"; then sed -e 's/^.* \(.*\)$/extern char \1;/' < "$nlist" >> "$output_objdir/$dlsyms" else echo '/* NONE */' >> "$output_objdir/$dlsyms" fi $echo >> "$output_objdir/$dlsyms" "\#undef dld_preloaded_symbols#if defined (__STDC__) && __STDC__# define __ptr_t void *#else# define __ptr_t char *#endif/* The mapping between symbol names and symbols. */struct { char *name; __ptr_t address;}dld_preloaded_symbols[] ={\" if test -n "$export_symbols"; then echo >> "$objdir/$dlsyms" "\ {\"${output}\", (__ptr_t) 0}," sed 's/^\(.*\)/ {"\1", (__ptr_t) \&\1},/' < "$export_symbols" >> "$objdir/$dlsyms" fi for arg in $dlprefiles; do name=`echo "$arg" | sed -e 's%^.*/%%'` echo >> "$objdir/$dlsyms" "\ {\"$name\", (__ptr_t) 0}," eval "$NM $arg | $global_symbol_pipe > '$nlist'" if test -f "$nlist"; then sed 's/^\(.*\) \(.*\)$/ {"\1", (__ptr_t) \&\2},/' < "$nlist" >> "$objdir/$dlsyms" else echo '/* NONE */' >> "$output_objdir/$dlsyms" fi done if test -f "$nlist"; then sed 's/^\(.*\) \(.*\)$/ {"\1", (__ptr_t) \&\2},/' < "$nlist" >> "$output_objdir/$dlsyms" fi $echo >> "$output_objdir/$dlsyms" "\ {0, (__ptr_t) 0}};#ifdef __cplusplus}#endif\" fi # Now compile the dynamic symbol file. $show "(cd $objdir && $C_compiler -c$no_builtin_flag \"$dlsyms\")" $run eval '(cd $objdir && $C_compiler -c$no_builtin_flag "$dlsyms")' || exit $? # Transform the symbol file into the correct name. compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$objdir/${output}S.${objext}%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$objdir/${output}S.${objext}%"` ;; *) $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 exit 1 ;; esac elif test "$export_dynamic" != yes; then test -n "$dlfiles$dlprefiles" && $echo "$modename: warning: \`-dlopen' and \`-dlpreopen' are ignored without \`-export-dynamic'" 1>&2 else # We keep going just in case the user didn't refer to # dld_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 # Nullify the symbol file. compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` fi if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then # Replace the output file specification. compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` finalize_command=`$echo "X$finalize_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` # We have no uninstalled library dependencies, so finalize right now. $show "$compile_command" $run eval "$compile_command" exit $? fi # Replace the output file specification. compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` finalize_command=`$echo "X$finalize_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'T%g'` # Create the binary in the object directory, then wrap it. if test ! -d $output_objdir; then $show "$mkdir $output_objdir" $run $mkdir $output_objdir status=$? if test $status -ne 0 && test ! -d $objdir; then exit $status fi fi if test -n "$shlibpath_var"; then # We should set the shlibpath_var rpath= for dir in $temp_rpath; do case "$dir" in /* | [A-Za-z]:[/\\]*) # Absolute path. rpath="$rpath$dir:" ;; *) # Relative path: add a thisdir entry. rpath="$rpath\$thisdir/$dir:" ;; esac done temp_rpath="$rpath" fi # Delete the old output file. $run $rm $output if test -n "$compile_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done compile_command="$runpath_var=\"$rpath\$$runpath_var\" $compile_command" finalize_command="$runpath_var=\"$rpath\$$runpath_var\" $finalize_command" fi if test "$hardcode_action" = relink; then # AGH! Flame the AIX and HP-UX people for me, will ya? $echo "$modename: warning: this platform doesn\'t like uninstalled shared libraries" 1>&2 $echo "$modename: \`$output' will be relinked during installation" 1>&2 fi $show "$compile_command" $run eval "$compile_command" || exit $? # Now create the wrapper script. $show "creating $output" # Quote the finalize command for shipping. finalize_command=`$echo "X$finalize_command" | $Xsed -e "$sed_quote_subst"` # Quote $echo for shipping. if test "X$echo" = "X$SHELL $0 --fallback-echo"; then case "$0" in /* | [A-Za-z]:[/\\]*) qecho="$SHELL $0 --fallback-echo";; *) qecho="$SHELL `pwd`/$0 --fallback-echo";; esac qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` else qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` fi # Only actually do things if our run command is non-null. if test -z "$run"; then $rm $output trap "$rm $output; exit 1" 1 2 15 $echo > $output "\#! $SHELL# $output - temporary wrapper script for $objdir/$outputname# Generated by $PROGRAM - GNU $PACKAGE $VERSION## The $output program cannot be directly executed until all the libtool# libraries that it depends on are installed.## This wrapper script should never be moved out of the build directory.# If it is, it will not operate correctly.# Sed substitution that helps us do robust quoting. It backslashifies# metacharacters that are still active within double-quoted strings.Xsed='sed -e s/^X//'sed_quote_subst='$sed_quote_subst'# The HP-UX ksh and POSIX shell print the target directory to stdout# if CDPATH is set.if test \"\${CDPATH+set}\" = set; then CDPATH=; export CDPATH; fi# This environment variable determines our operation mode.if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variables: link_against_libtool_libs='$link_against_libtool_libs' finalize_command=\"cd `pwd | sed -e $sed_quote_subst`; $finalize_command\"else # When we are sourced in execute mode, \$file and \$echo are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then echo=\"$qecho\" file=\"\$0\" # Make sure echo works. if test \"X\$1\" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift 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 \"\$0\" --no-reexec \${1+\"\$@\"} fi fi\" $echo >> $output "\ # Find the directory that this script lives in. thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in /* | [A-Za-z]:[/\\]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\` done # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" progdir=\"\$thisdir/$objdir\" program='$outputname' if test -f \"\$progdir/\$program\"; then" # Export our shlibpath_var if we have one. if test -n "$shlibpath_var" && test -n "$temp_rpath"; then $echo >> $output "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/:*\$//'\` export $shlibpath_var" fi $echo >> $output "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. # Export the path to the program. PATH=\"\$progdir:\$PATH\" export PATH exec \$program \${1+\"\$@\"} \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" exit 1 fi else # The program doesn't exist. \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 \$echo \"This script is just a wrapper for \$program.\" 1>&2 echo \"See the $PACKAGE documentation for more information.\" 1>&2 exit 1 fifi\" chmod +x $output fi exit 0 ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do if test "$build_libtool_libs" = convenience; then oldobjs="$libobjs" addlibs="$convenience" build_libtool_libs=no else oldobjs="$objs"`$echo "X$libobjs " | $Xsed -e 's/[^ ]*\.'${libext}' //g' -e 's/[^ ]*\.lib //g' -e "$los2o" -e 's/ $//g'` addlibs="$old_convenience" fi # Add in members from convenience archives. for xlib in $addlibs; do # Extract the objects. xdir="$xlib"x generated="$generated $xdir" xlib=`echo "$xlib" | $Xsed -e 's%^.*/%%'` $show "${rm}r $xdir" $run ${rm}r "$xdir" $show "mkdir $xdir" $run mkdir "$xdir" status=$? if test $status -ne 0 && test ! -d "$xdir"; then exit $status fi $show "(cd $xdir && $AR x ../$xlib)" $run eval "(cd \$xdir && $AR x ../\$xlib)" || exit $? oldobjs="$oldobjs `echo $xdir/*`" done # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then eval cmds=\"$old_archive_from_new_cmds\" else eval cmds=\"$old_archive_cmds\" fi IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done if test -n "$generated"; then $show "${rm}r$generated" $run ${rm}r$generated fi # Now create the libtool archive. case "$output" in *.la) old_library= test "$build_old_libs" = yes && old_library="$libname.$libext" $show "creating $output" # Only create the output if not a dry run. if test -z "$run"; then $echo > $output "\# $output - a libtool library file# Generated by $PROGRAM - GNU $PACKAGE $VERSION# The name that we can dlopen(3).dlname='$dlname'# Names of this library.library_names='$library_names'# The name of the static archive.old_library='$old_library'# Libraries that this one depends upon.dependency_libs='$dependency_libs'# Version information for $libname.current=$currentage=$agerevision=$revision# Is this an already installed library?installed=no# Directory that this library needs to be installed in:libdir='$install_libdir'\" fi # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. $show "(cd $output_objdir && $LN_S ../$outputname $outputname)" $run eval "(cd $output_objdir && $LN_S ../$outputname $outputname)" || exit $? ;; esac exit 0 ;; # libtool install mode install) modename="$modename: install" # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh; then # Aesthetically quote it. arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` case "$arg" in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\""
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -