# ltmain.sh - Provide generalized library-building support services. # NOTE: Changing this file will not affect anything until you rerun configure. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 # Free Software Foundation, Inc. # Originally by Gordon Matzigkeit , 1996 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. setglobal basename = '"s,^.*/,,g'" # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. setglobal progpath = $0 # The name of this program: setglobal progname = $[echo $progpath | $SED $basename] setglobal modename = $progname # Global variables: setglobal EXIT_SUCCESS = '0' setglobal EXIT_FAILURE = '1' setglobal PROGRAM = 'ltmain.sh' setglobal PACKAGE = 'libtool' setglobal VERSION = '1.5.22' setglobal TIMESTAMP = '" (1.1220.2.365 2005/12/18 22:14:06)'" # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. if test -n $(ZSH_VERSION+set) { setopt NO_GLOB_SUBST } # Check that we have a working $echo. if test "X$1" = X--no-reexec { # Discard the --no-reexec flag, and continue. shift } elif test "X$1" = X--fallback-echo { # Avoid inline document here, it may be left over : } elif test "X$[shell {$echo '\t'}]" = 'X\t' { # Yippee, $echo works! : } else { # Restart under the correct shell, and then maybe $echo will work. exec $SHELL $progpath --no-reexec $(1+"$@") } if test "X$1" = X--fallback-echo { # used as fallback echo shift cat << """ $ifsjoin(Argv) """ exit $EXIT_SUCCESS } setglobal default_mode = '' setglobal help = ""Try \`$progname --help' for more information."" setglobal magic = '"%%%MAGIC variable%%%'" setglobal mkdir = '"mkdir'" setglobal mv = '"mv -f'" setglobal rm = '"rm -f'" # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. setglobal Xsed = ""$(SED)"' -e 1s/^X//"' setglobal sed_quote_subst = ''s/\([\\`\\"$\\\\]\)/\\\1/g'' # test EBCDIC or ASCII match $[echo X|tr X '\101] { with A # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr setglobal SP2NL = ''tr \040 \012'' setglobal NL2SP = ''tr \015\012 \040\040'' with * # EBCDIC based system setglobal SP2NL = ''tr \100 \n'' setglobal NL2SP = ''tr \r\n \100\100'' } # NLS nuisances. # Only set LANG and LC_ALL to C if already set. # These must not be set unconditionally because not all systems understand # e.g. LANG=C (notably SCO). # We save the old values to restore during execute mode. if test $(LC_ALL+set) = set { setglobal save_LC_ALL = $LC_ALL; setglobal LC_ALL = 'C'; export LC_ALL } if test $(LANG+set) = set { setglobal save_LANG = $LANG; setglobal LANG = 'C'; export LANG } # Make sure IFS has a sensible default setglobal lt_nl = '' '' setglobal IFS = "" $lt_nl"" if test $build_libtool_libs != yes && test $build_old_libs != yes { $echo "$modename: not configured to build any kind of library" !1 > !2 $echo "Fatal configuration error. See the $PACKAGE docs for more information." !1 > !2 exit $EXIT_FAILURE } # Global variables. setglobal mode = $default_mode setglobal nonopt = '' setglobal prev = '' setglobal prevopt = '' setglobal run = '' setglobal show = $echo setglobal show_help = '' setglobal execute_dlfiles = '' setglobal duplicate_deps = 'no' setglobal preserve_args = '' setglobal lo2o = ""s/\\.lo\$/.$(objext)/"" setglobal o2lo = ""s/\\.$(objext)\$/.lo/"" ##################################### # Shell function definitions: # This seems to be the best place for them # func_mktempdir [string] # Make a temporary directory that won't clash with other running # libtool processes, and avoids race conditions if possible. If # given, STRING is the basename for that directory. proc func_mktempdir { setglobal my_template = ""$(TMPDIR-/tmp)/$(1-$progname)"" if test $run = ":" { # Return a directory name, but don't create it in dry-run mode setglobal my_tmpdir = ""$(my_template)-$Pid"" } else { # If mktemp works, use that first and foremost setglobal my_tmpdir = $[mktemp -d "$(my_template)-XXXXXXXX" !2 >/dev/null] if test ! -d $my_tmpdir { # Failing that, at least try and use $RANDOM to avoid a race setglobal my_tmpdir = ""$(my_template)-$(RANDOM-0)$Pid"" setglobal save_mktempdir_umask = $[umask] umask 0077 $mkdir $my_tmpdir umask $save_mktempdir_umask } # If we're not in dry-run mode, bomb out on failure test -d $my_tmpdir || do { $echo "cannot create temporary directory \`$my_tmpdir'" !1 > !2 exit $EXIT_FAILURE } } $echo "X$my_tmpdir" | $Xsed } # 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. proc func_win32_libid { setglobal win32_libid_type = '"unknown'" setglobal win32_fileres = $[file -L $1 !2 >/dev/null] match $win32_fileres { with *ar\ archive\ import\ library* # definitely import setglobal win32_libid_type = '"x86 archive import'" with *ar\ archive* # could be an import, or static if eval $OBJDUMP -f $1 | $SED -e '10q' !2 >/dev/null | \ $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null { setglobal win32_nmres = $[eval $NM -f posix -A $1 | \ $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}] match $win32_nmres { with import* setglobal win32_libid_type = '"x86 archive import'" with * setglobal win32_libid_type = '"x86 archive static'" } } with *DLL* setglobal win32_libid_type = '"x86 DLL'" with *executable* # but shell scripts are "executable" too... match $win32_fileres { with *MS\ Windows\ PE\ Intel* setglobal win32_libid_type = '"x86 DLL'" } } $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 ...' proc func_infer_tag { if test -n $available_tags && test -z $tagname { setglobal CC_quoted = '' for arg in [$CC] { match $arg { with *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"" setglobal arg = ""\"$arg"\"" } setglobal CC_quoted = ""$CC_quoted $arg"" } match $ifsjoin(Argv) { # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. with " $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. with * for z in [$available_tags] { if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < $progpath > /dev/null { # Evaluate the configuration. eval $[$(SED) -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath] setglobal CC_quoted = '' for arg in [$CC] { # Double-quote args containing other shell metacharacters. match $arg { with *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"" setglobal arg = ""\"$arg"\"" } setglobal CC_quoted = ""$CC_quoted $arg"" } match "$ifsjoin(Argv) " { with " $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. setglobal tagname = $z break } } } # 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 { $echo "$modename: unable to infer tagged configuration" $echo "$modename: specify a tag with \`--tag'" !1 > !2 exit $EXIT_FAILURE # else # $echo "$modename: using $tagname tagged configuration" } } } } # func_extract_an_archive dir oldlib proc func_extract_an_archive { setglobal f_ex_an_ar_dir = $1; shift setglobal f_ex_an_ar_oldlib = $1 $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? if shell {$AR t $f_ex_an_ar_oldlib | sort | sort -uc >/dev/null !2 > !1} { : } else { $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" !1 > !2 exit $EXIT_FAILURE } } # func_extract_archives gentop oldlib ... proc func_extract_archives { setglobal my_gentop = $1; shift setglobal my_oldlibs = $(1+"$@") setglobal my_oldobjs = ''"" setglobal my_xlib = ''"" setglobal my_xabs = ''"" setglobal my_xdir = ''"" setglobal my_status = ''"" $show "$(rm)r $my_gentop" $run $(rm)r $my_gentop $show "$mkdir $my_gentop" $run $mkdir $my_gentop setglobal my_status = $Status if test $my_status -ne 0 && test ! -d $my_gentop { exit $my_status } for my_xlib in [$my_oldlibs] { # Extract the objects. match $my_xlib { with [\\/]* | [A-Za-z]:[\\/]* setglobal my_xabs = $my_xlib with * setglobal my_xabs = "$[pwd]"/$my_xlib"" } setglobal my_xlib = $[$echo "X$my_xlib" | $Xsed -e 's%^.*/%%] setglobal my_xdir = ""$my_gentop/$my_xlib"" $show "$(rm)r $my_xdir" $run $(rm)r $my_xdir $show "$mkdir $my_xdir" $run $mkdir $my_xdir setglobal exit_status = $Status if test $exit_status -ne 0 && test ! -d $my_xdir { exit $exit_status } match $host { with *-darwin* $show "Extracting $my_xabs" # Do not bother doing anything if just a dry run if test -z $run { setglobal darwin_orig_dir = $[pwd] cd $my_xdir || exit $? setglobal darwin_archive = $my_xabs setglobal darwin_curdir = $[pwd] setglobal darwin_base_archive = $[$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%] setglobal darwin_arches = $[lipo -info $darwin_archive !2 >/dev/null | $EGREP Architectures !2 >/dev/null] if test -n $darwin_arches { setglobal darwin_arches = $[echo $darwin_arches | $SED -e 's/.*are://] setglobal darwin_arch = '' $show "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in [$darwin_arches] { mkdir -p "unfat-$Pid/$(darwin_base_archive)-$(darwin_arch)" lipo -thin $darwin_arch -output "unfat-$Pid/$(darwin_base_archive)-$(darwin_arch)/$(darwin_base_archive)" $(darwin_archive) cd "unfat-$Pid/$(darwin_base_archive)-$(darwin_arch)" func_extract_an_archive $[pwd] $(darwin_base_archive) cd $darwin_curdir $rm "unfat-$Pid/$(darwin_base_archive)-$(darwin_arch)/$(darwin_base_archive)" } # $darwin_arches ## Okay now we have a bunch of thin objects, gotta fatten them up :) setglobal darwin_filelist = $[find unfat-$Pid -type f -name '*'.o -print -o -name '*'.lo -print| xargs basename | sort -u | $NL2SP] setglobal darwin_file = '' setglobal darwin_files = '' for darwin_file in [$darwin_filelist] { setglobal darwin_files = $[find unfat-$Pid -name $darwin_file -print | $NL2SP] lipo -create -output $darwin_file $darwin_files } # $darwin_filelist $(rm)r unfat-$Pid cd $darwin_orig_dir } else { cd $darwin_orig_dir func_extract_an_archive $my_xdir $my_xabs } # $darwin_arches } # $run with * func_extract_an_archive $my_xdir $my_xabs } setglobal my_oldobjs = ""$my_oldobjs "$[find $my_xdir -name '*'.$objext -print -o -name '*'.lo -print | $NL2SP]" } setglobal func_extract_archives_result = $my_oldobjs } # End of Shell function definitions ##################################### # Darwin sucks eval std_shrext='"'$shrext_cmds'"' setglobal disable_libs = 'no' # Parse our command line options once, thoroughly. while test "$#" -gt 0 { setglobal arg = $1 shift match $arg { with -*=* setglobal optarg = $[$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//] with * setglobal optarg = '' } # If the previous option needs an argument, assign it. if test -n $prev { match $prev { with execute_dlfiles setglobal execute_dlfiles = ""$execute_dlfiles $arg"" with tag setglobal tagname = $arg setglobal preserve_args = ""$(preserve_args)=$arg"" # Check whether tagname contains only valid characters match $tagname { with *[!-_A-Za-z0-9,/]* $echo "$progname: invalid tag name: $tagname" !1 > !2 exit $EXIT_FAILURE } match $tagname { with CC # Don't test for the "default" C tag, as we know, it's there, but # not specially marked. with * if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < $progpath > /dev/null { setglobal taglist = ""$taglist $tagname"" # Evaluate the configuration. eval $[$(SED) -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath] } else { $echo "$progname: ignoring unknown tag $tagname" !1 > !2 } } with * eval "$prev=\$arg" } setglobal prev = '' setglobal prevopt = '' continue } # Have we seen a non-optional argument yet? match $arg { with --help setglobal show_help = 'yes' with --version $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" $echo $echo "Copyright (C) 2005 Free Software Foundation, Inc." $echo "This is free software; see the source for copying conditions. There is NO" $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." exit $? with --config $(SED) -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath # Now print the configurations for the tags. for tagname in [$taglist] { $(SED) -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < $progpath } exit $? with --debug $echo "$progname: enabling shell trace mode" set -x setglobal preserve_args = ""$preserve_args $arg"" with --dry-run | -n setglobal run = ':' with --features $echo "host: $host" if test $build_libtool_libs = yes { $echo "enable shared libraries" } else { $echo "disable shared libraries" } if test $build_old_libs = yes { $echo "enable static libraries" } else { $echo "disable static libraries" } exit $? with --finish setglobal mode = '"finish'" with --mode setglobal prevopt = '"--mode'," prev = 'mode' with --mode=* setglobal mode = $optarg with --preserve-dup-deps setglobal duplicate_deps = '"yes'" with --quiet | --silent setglobal show = ':' setglobal preserve_args = ""$preserve_args $arg"" with --tag setglobal prevopt = '"--tag'" setglobal prev = 'tag' setglobal preserve_args = ""$preserve_args --tag"" with --tag=* set tag $optarg $(1+"$@") shift setglobal prev = 'tag' setglobal preserve_args = ""$preserve_args --tag"" with -dlopen setglobal prevopt = '"-dlopen'" setglobal prev = 'execute_dlfiles' with -* $echo "$modename: unrecognized option \`$arg'" !1 > !2 $echo $help !1 > !2 exit $EXIT_FAILURE with * setglobal nonopt = $arg break } } if test -n $prevopt { $echo "$modename: option \`$prevopt' requires an argument" !1 > !2 $echo $help !1 > !2 exit $EXIT_FAILURE } match $disable_libs { with no with shared setglobal build_libtool_libs = 'no' setglobal build_old_libs = 'yes' with static setglobal build_old_libs = $[match $build_libtool_libs { with yes echo no with * echo yes }] } # 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. setglobal exec_cmd = '' if test -z $show_help { # Infer the operation mode. if test -z $mode { $echo "*** Warning: inferring the mode of operation is deprecated." !1 > !2 $echo "*** Future versions of Libtool will require --mode=MODE be specified." !1 > !2 match $nonopt { with *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc* setglobal mode = 'link'for arg in @Argv { match $arg { with -c setglobal mode = 'compile' break } } with *db | *dbx | *strace | *truss setglobal mode = 'execute' with *install*|cp|mv setglobal mode = 'install' with *rm setglobal mode = 'uninstall' with * # If we have no mode, but dlfiles were specified, then do execute mode. test -n $execute_dlfiles && setglobal mode = 'execute' # Just use the default operation mode. if test -z $mode { if test -n $nonopt { $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" !1 > !2 } else { $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" !1 > !2 } } } } # Only execute mode is allowed to have -dlopen flags. if test -n $execute_dlfiles && test $mode != execute { $echo "$modename: unrecognized option \`-dlopen'" !1 > !2 $echo $help !1 > !2 exit $EXIT_FAILURE } # Change the help message to a mode-specific one. setglobal generic_help = $help setglobal help = ""Try \`$modename --help --mode=$mode' for more information."" # These modes are in order of execution frequency so that they run quickly. match $mode { # libtool compile mode with compile setglobal modename = ""$modename: compile"" # Get the compilation command and the source file. setglobal base_compile = '' setglobal srcfile = $nonopt # always keep a non-empty value in "srcfile" setglobal suppress_opt = 'yes' setglobal suppress_output = '' setglobal arg_mode = 'normal' setglobal libobj = '' setglobal later = ''for arg in @Argv { match $arg_mode { with arg # do not "continue". Instead, add this to base_compile setglobal lastarg = $arg setglobal arg_mode = 'normal' with target setglobal libobj = $arg setglobal arg_mode = 'normal' continue with normal # Accept any command-line options. match $arg { with -o if test -n $libobj { $echo "$modename: you cannot specify \`-o' more than once" !1 > !2 exit $EXIT_FAILURE } setglobal arg_mode = 'target' continue with -static | -prefer-pic | -prefer-non-pic setglobal later = ""$later $arg"" continue with -no-suppress setglobal suppress_opt = 'no' continue with -Xcompiler setglobal arg_mode = 'arg' # the next one goes into the "base_compile" arg list continue # The current "srcfile" will either be retained or # replaced later. I would guess that would be a bug. with -Wc,* setglobal args = $[$echo "X$arg" | $Xsed -e "s/^-Wc,//] setglobal lastarg = '' setglobal save_ifs = $IFS; setglobal IFS = '','' for arg in [$args] { setglobal IFS = $save_ifs # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. match $arg { with *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"" setglobal arg = ""\"$arg"\"" } setglobal lastarg = ""$lastarg $arg"" } setglobal IFS = $save_ifs setglobal lastarg = $[$echo "X$lastarg" | $Xsed -e "s/^ //] # Add the arguments to base_compile. setglobal base_compile = ""$base_compile $lastarg"" continue with * # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # setglobal lastarg = $srcfile setglobal srcfile = $arg } # case $arg } # case $arg_mode # Aesthetically quote the previous argument. setglobal lastarg = $[$echo "X$lastarg" | $Xsed -e $sed_quote_subst] match $lastarg { # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, and some SunOS ksh mistreat backslash-escaping # in scan sets (worked around with variable expansion), # and furthermore cannot handle '|' '&' '(' ')' in scan sets # at all, so we specify them separately. with *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"" setglobal lastarg = ""\"$lastarg"\"" } setglobal base_compile = ""$base_compile $lastarg"" } # for arg match $arg_mode { with arg $echo "$modename: you must specify an argument for -Xcompile" exit $EXIT_FAILURE with target $echo "$modename: you must specify a target with \`-o'" !1 > !2 exit $EXIT_FAILURE with * # Get the name of the library object. test -z $libobj && setglobal libobj = $[$echo "X$srcfile" | $Xsed -e 's%^.*/%%] } # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo setglobal xform = ''[cCFSifmso]'' match $libobj { with *.ada setglobal xform = 'ada' with *.adb setglobal xform = 'adb' with *.ads setglobal xform = 'ads' with *.asm setglobal xform = 'asm' with *.c++ setglobal xform = 'c++' with *.cc setglobal xform = 'cc' with *.ii setglobal xform = 'ii' with *.class setglobal xform = 'class' with *.cpp setglobal xform = 'cpp' with *.cxx setglobal xform = 'cxx' with *.f90 setglobal xform = 'f90' with *.for setglobal xform = 'for' with *.java setglobal xform = 'java' } setglobal libobj = $[$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/] match $libobj { with *.lo setglobal obj = $[$echo "X$libobj" | $Xsed -e $lo2o] with * $echo "$modename: cannot determine name of library object from \`$libobj'" !1 > !2 exit $EXIT_FAILURE } func_infer_tag $base_compile for arg in [$later] { match $arg { with -static setglobal build_old_libs = 'yes' continue with -prefer-pic setglobal pic_mode = 'yes' continue with -prefer-non-pic setglobal pic_mode = 'no' continue } } setglobal qlibobj = $[$echo "X$libobj" | $Xsed -e $sed_quote_subst] match $qlibobj { with *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"" setglobal qlibobj = ""\"$qlibobj"\"" } test "X$libobj" != "X$qlibobj" \ && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \ && $echo "$modename: libobj name \`$libobj' may not contain shell special characters." setglobal objname = $[$echo "X$obj" | $Xsed -e 's%^.*/%%] setglobal xdir = $[$echo "X$obj" | $Xsed -e 's%/[^/]*$%%] if test "X$xdir" = "X$obj" { setglobal xdir = '' } else { setglobal xdir = "$xdir/" } setglobal lobj = "$(xdir)$objdir/$objname" if test -z $base_compile { $echo "$modename: you must specify a compilation command" !1 > !2 $echo $help !1 > !2 exit $EXIT_FAILURE } # Delete any leftover library objects. if test $build_old_libs = yes { setglobal removelist = ""$obj $lobj $libobj $(libobj)T"" } else { setglobal removelist = ""$lobj $libobj $(libobj)T"" } $run $rm $removelist trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 # On Cygwin there's no "real" PIC flag so we must build both object types match $host_os { with cygwin* | mingw* | pw32* | os2* setglobal pic_mode = 'default' } if test $pic_mode = no && test $deplibs_check_method != pass_all { # non-PIC code in shared libraries is not supported setglobal pic_mode = 'default' } # Calculate the filename of the output object if compiler does # not support -o with -c if test $compiler_c_o = no { setglobal output_obj = "$[$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%].$(objext)" setglobal lockfile = ""$output_obj.lock"" setglobal removelist = ""$removelist $output_obj $lockfile"" trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 } else { setglobal output_obj = '' setglobal need_locks = 'no' setglobal lockfile = '' } # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test $need_locks = yes { while not $run ln $progpath $lockfile !2 >/dev/null { $show "Waiting for $lockfile to be removed" sleep 2 } } elif test $need_locks = warn { if test -f $lockfile { $echo "\ *** ERROR, $lockfile exists and contains: $[cat $lockfile !2 >/dev/null] This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE } $echo $srcfile > $lockfile } if test -n $fix_srcfile_path { eval srcfile='"'$fix_srcfile_path'"' } setglobal qsrcfile = $[$echo "X$srcfile" | $Xsed -e $sed_quote_subst] match $qsrcfile { with *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"" setglobal qsrcfile = ""\"$qsrcfile"\"" } $run $rm $libobj "$(libobj)T" # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. test -z $run && cat > $(libobj)T << """ # $libobj - a libtool object file # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP # # Please DO NOT delete this file! # It is necessary for linking the library. # Name of the PIC object. """ # Only build a PIC object if we are building libtool libraries. if test $build_libtool_libs = yes { # Without this assignment, base_compile gets emptied. setglobal fbsd_hideous_sh_bug = $base_compile if test $pic_mode != no { setglobal command = ""$base_compile $qsrcfile $pic_flag"" } else { # Don't build PIC code setglobal command = ""$base_compile $qsrcfile"" } if test ! -d "$(xdir)$objdir" { $show "$mkdir $(xdir)$objdir" $run $mkdir $(xdir)$objdir setglobal exit_status = $Status if test $exit_status -ne 0 && test ! -d "$(xdir)$objdir" { exit $exit_status } } if test -z $output_obj { # Place PIC objects in $objdir setglobal command = ""$command -o $lobj"" } $run $rm $lobj $output_obj $show $command if $run eval $command { : } else { test -n $output_obj && $run $rm $removelist exit $EXIT_FAILURE } if test $need_locks = warn && test "X$[cat $lockfile !2 >/dev/null]" != "X$srcfile" { $echo "\ *** ERROR, $lockfile contains: $[cat $lockfile !2 >/dev/null] but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE } # Just move the object if needed, then go on to compile the next one if test -n $output_obj && test "X$output_obj" != "X$lobj" { $show "$mv $output_obj $lobj" if $run $mv $output_obj $lobj { : } else { setglobal error = $Status $run $rm $removelist exit $error } } # Append the name of the PIC object to the libtool object file. test -z $run && cat >> $(libobj)T << """ pic_object='$objdir/$objname' """ # Allow error messages only from the first compilation. if test $suppress_opt = yes { setglobal suppress_output = '' >/dev/null 2>&1'' } } else { # No PIC object so indicate it doesn't exist in the libtool # object file. test -z $run && cat >> $(libobj)T << """ pic_object=none """ } # Only build a position-dependent object if we build old libraries. if test $build_old_libs = yes { if test $pic_mode != yes { # Don't build PIC code setglobal command = ""$base_compile $qsrcfile"" } else { setglobal command = ""$base_compile $qsrcfile $pic_flag"" } if test $compiler_c_o = yes { setglobal command = ""$command -o $obj"" } # Suppress compiler output if we already did a PIC compilation. setglobal command = ""$command$suppress_output"" $run $rm $obj $output_obj $show $command if $run eval $command { : } else { $run $rm $removelist exit $EXIT_FAILURE } if test $need_locks = warn && test "X$[cat $lockfile !2 >/dev/null]" != "X$srcfile" { $echo "\ *** ERROR, $lockfile contains: $[cat $lockfile !2 >/dev/null] but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE } # Just move the object if needed if test -n $output_obj && test "X$output_obj" != "X$obj" { $show "$mv $output_obj $obj" if $run $mv $output_obj $obj { : } else { setglobal error = $Status $run $rm $removelist exit $error } } # Append the name of the non-PIC object the libtool object file. # Only append if the libtool object file exists. test -z $run && cat >> $(libobj)T << """ # Name of the non-PIC object. non_pic_object='$objname' """ } else { # Append the name of the non-PIC object the libtool object file. # Only append if the libtool object file exists. test -z $run && cat >> $(libobj)T << """ # Name of the non-PIC object. non_pic_object=none """ } $run $mv "$(libobj)T" $(libobj) # Unlock the critical section if it was locked if test $need_locks != no { $run $rm $lockfile } exit $EXIT_SUCCESS # libtool link mode with link | relink setglobal modename = ""$modename: link"" match $host { with *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # which system we are compiling for in order to pass an extra # flag for every libtool invocation. # allow_undefined=no # FIXME: Unfortunately, there are problems with the above when trying # to make a dll which has undefined symbols, in which case not # even a static library is built. For now, we need to specify # -no-undefined on the libtool link line when we can be certain # that all symbols are satisfied, otherwise we get a static library. setglobal allow_undefined = 'yes' with * setglobal allow_undefined = 'yes' } setglobal libtool_args = $nonopt setglobal base_compile = ""$nonopt $ifsjoin(Argv)"" setglobal compile_command = $nonopt setglobal finalize_command = $nonopt setglobal compile_rpath = '' setglobal finalize_rpath = '' setglobal compile_shlibpath = '' setglobal finalize_shlibpath = '' setglobal convenience = '' setglobal old_convenience = '' setglobal deplibs = '' setglobal old_deplibs = '' setglobal compiler_flags = '' setglobal linker_flags = '' setglobal dllsearchpath = '' setglobal lib_search_path = $[pwd] setglobal inst_prefix_dir = '' setglobal avoid_version = 'no' setglobal dlfiles = '' setglobal dlprefiles = '' setglobal dlself = 'no' setglobal export_dynamic = 'no' setglobal export_symbols = '' setglobal export_symbols_regex = '' setglobal generated = '' setglobal libobjs = '' setglobal ltlibs = '' setglobal module = 'no' setglobal no_install = 'no' setglobal objs = '' setglobal non_pic_objects = '' setglobal notinst_path = '' # paths that contain not-installed libtool libraries setglobal precious_files_regex = '' setglobal prefer_static_libs = 'no' setglobal preload = 'no' setglobal prev = '' setglobal prevarg = '' setglobal release = '' setglobal rpath = '' setglobal xrpath = '' setglobal perm_rpath = '' setglobal temp_rpath = '' setglobal thread_safe = 'no' setglobal vinfo = '' setglobal vinfo_number = 'no' func_infer_tag $base_compilefor arg in @Argv { match $arg { with -all-static | -static if test "X$arg" = "X-all-static" { if test $build_libtool_libs = yes && test -z $link_static_flag { $echo "$modename: warning: complete static linking is impossible in this configuration" !1 > !2 } if test -n $link_static_flag { setglobal dlopen_self = $dlopen_self_static } setglobal prefer_static_libs = 'yes' } else { if test -z $pic_flag && test -n $link_static_flag { setglobal dlopen_self = $dlopen_self_static } setglobal prefer_static_libs = 'built' } setglobal build_libtool_libs = 'no' setglobal build_old_libs = 'yes' break } } # See if our shared archives depend on static archives. test -n $old_archive_from_new_cmds && setglobal build_old_libs = 'yes' # Go through the arguments, transforming them on the way. while test "$Argc" -gt 0 { setglobal arg = $1 shift match $arg { with *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"" setglobal qarg = "'"'$[$echo "X$arg" | $Xsed -e $sed_quote_subst]'"'" ### testsuite: skip nested quoting test with * setglobal qarg = $arg } setglobal libtool_args = ""$libtool_args $qarg"" # If the previous option needs an argument, assign it. if test -n $prev { match $prev { with output setglobal compile_command = ""$compile_command @OUTPUT@"" setglobal finalize_command = ""$finalize_command @OUTPUT@"" } match $prev { with dlfiles|dlprefiles if test $preload = no { # Add the symbol object into the linking commands. setglobal compile_command = ""$compile_command @SYMFILE@"" setglobal finalize_command = ""$finalize_command @SYMFILE@"" setglobal preload = 'yes' } match $arg { with *.la | *.lo # We handle these cases below. with force if test $dlself = no { setglobal dlself = 'needless' setglobal export_dynamic = 'yes' } setglobal prev = '' continue with self if test $prev = dlprefiles { setglobal dlself = 'yes' } elif test $prev = dlfiles && test $dlopen_self != yes { setglobal dlself = 'yes' } else { setglobal dlself = 'needless' setglobal export_dynamic = 'yes' } setglobal prev = '' continue with * if test $prev = dlfiles { setglobal dlfiles = ""$dlfiles $arg"" } else { setglobal dlprefiles = ""$dlprefiles $arg"" } setglobal prev = '' continue } with expsyms setglobal export_symbols = $arg if test ! -f $arg { $echo "$modename: symbol file \`$arg' does not exist" exit $EXIT_FAILURE } setglobal prev = '' continue with expsyms_regex setglobal export_symbols_regex = $arg setglobal prev = '' continue with inst_prefix setglobal inst_prefix_dir = $arg setglobal prev = '' continue with precious_regex setglobal precious_files_regex = $arg setglobal prev = '' continue with release setglobal release = ""-$arg"" setglobal prev = '' continue with objectlist if test -f $arg { setglobal save_arg = $arg setglobal moreargs = '' for fil in [$[cat $save_arg]] { # moreargs="$moreargs $fil" setglobal arg = $fil # A libtool-controlled object. # Check to see that this really is a libtool object. if shell {$(SED) -e '2q' $arg | grep "^# Generated by .*$PACKAGE"} >/dev/null 2>&1 { setglobal pic_object = '' setglobal non_pic_object = '' # Read the .lo file # If there is no directory component, then add one. match $arg { with */* | *\\* source $arg with * source ./$arg } if test -z $pic_object || \ test -z $non_pic_object || test $pic_object = none && \ test $non_pic_object = none { $echo "$modename: cannot find name of object for \`$arg'" !1 > !2 exit $EXIT_FAILURE } # Extract subdirectory from the argument. setglobal xdir = $[$echo "X$arg" | $Xsed -e 's%/[^/]*$%%] if test "X$xdir" = "X$arg" { setglobal xdir = '' } else { setglobal xdir = ""$xdir/"" } if test $pic_object != none { # Prepend the subdirectory the object is found in. setglobal pic_object = ""$xdir$pic_object"" if test $prev = dlfiles { if test $build_libtool_libs = yes && test $dlopen_support = yes { setglobal dlfiles = ""$dlfiles $pic_object"" setglobal prev = '' continue } else { # If libtool objects are unsupported, then we need to preload. setglobal prev = 'dlprefiles' } } # CHECK ME: I think I busted this. -Ossama if test $prev = dlprefiles { # Preload the old-style object. setglobal dlprefiles = ""$dlprefiles $pic_object"" setglobal prev = '' } # A PIC object. setglobal libobjs = ""$libobjs $pic_object"" setglobal arg = $pic_object } # Non-PIC object. if test $non_pic_object != none { # Prepend the subdirectory the object is found in. setglobal non_pic_object = ""$xdir$non_pic_object"" # A standard non-PIC object setglobal non_pic_objects = ""$non_pic_objects $non_pic_object"" if test -z $pic_object || test $pic_object = none { setglobal arg = $non_pic_object } } else { # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. setglobal non_pic_object = $pic_object setglobal non_pic_objects = ""$non_pic_objects $non_pic_object"" } } else { # Only an error if not doing a dry-run. if test -z $run { $echo "$modename: \`$arg' is not a valid libtool object" !1 > !2 exit $EXIT_FAILURE } else { # Dry-run case. # Extract subdirectory from the argument. setglobal xdir = $[$echo "X$arg" | $Xsed -e 's%/[^/]*$%%] if test "X$xdir" = "X$arg" { setglobal xdir = '' } else { setglobal xdir = ""$xdir/"" } setglobal pic_object = $[$echo "X$(xdir)$(objdir)/$(arg)" | $Xsed -e $lo2o] setglobal non_pic_object = $[$echo "X$(xdir)$(arg)" | $Xsed -e $lo2o] setglobal libobjs = ""$libobjs $pic_object"" setglobal non_pic_objects = ""$non_pic_objects $non_pic_object"" } } } } else { $echo "$modename: link input file \`$save_arg' does not exist" exit $EXIT_FAILURE } setglobal arg = $save_arg setglobal prev = '' continue with rpath | xrpath # We need an absolute path. match $arg { with [\\/]* | [A-Za-z]:[\\/]* with * $echo "$modename: only absolute run-paths are allowed" !1 > !2 exit $EXIT_FAILURE } if test $prev = rpath { match "$rpath " { with *" $arg "* with * setglobal rpath = ""$rpath $arg"" } } else { match "$xrpath " { with *" $arg "* with * setglobal xrpath = ""$xrpath $arg"" } } setglobal prev = '' continue with xcompiler setglobal compiler_flags = ""$compiler_flags $qarg"" setglobal prev = '' setglobal compile_command = ""$compile_command $qarg"" setglobal finalize_command = ""$finalize_command $qarg"" continue with xlinker setglobal linker_flags = ""$linker_flags $qarg"" setglobal compiler_flags = ""$compiler_flags $wl$qarg"" setglobal prev = '' setglobal compile_command = ""$compile_command $wl$qarg"" setglobal finalize_command = ""$finalize_command $wl$qarg"" continue with xcclinker setglobal linker_flags = ""$linker_flags $qarg"" setglobal compiler_flags = ""$compiler_flags $qarg"" setglobal prev = '' setglobal compile_command = ""$compile_command $qarg"" setglobal finalize_command = ""$finalize_command $qarg"" continue with shrext setglobal shrext_cmds = $arg setglobal prev = '' continue with darwin_framework|darwin_framework_skip test $prev = "darwin_framework" && setglobal compiler_flags = ""$compiler_flags $arg"" setglobal compile_command = ""$compile_command $arg"" setglobal finalize_command = ""$finalize_command $arg"" setglobal prev = '' continue with * eval "$prev=\"\$arg\"" setglobal prev = '' continue } } # test -n "$prev" setglobal prevarg = $arg match $arg { with -all-static if test -n $link_static_flag { setglobal compile_command = ""$compile_command $link_static_flag"" setglobal finalize_command = ""$finalize_command $link_static_flag"" } continue with -allow-undefined # FIXME: remove this flag sometime in the future. $echo "$modename: \`-allow-undefined' is deprecated because it is the default" !1 > !2 continue with -avoid-version setglobal avoid_version = 'yes' continue with -dlopen setglobal prev = 'dlfiles' continue with -dlpreopen setglobal prev = 'dlprefiles' continue with -export-dynamic setglobal export_dynamic = 'yes' continue with -export-symbols | -export-symbols-regex if test -n $export_symbols || test -n $export_symbols_regex { $echo "$modename: more than one -exported-symbols argument is not allowed" exit $EXIT_FAILURE } if test "X$arg" = "X-export-symbols" { setglobal prev = 'expsyms' } else { setglobal prev = 'expsyms_regex' } continue with -framework|-arch|-isysroot match " $CC " { with *" ${arg} ${1} "* | *" ${arg} ${1} "* setglobal prev = 'darwin_framework_skip' with * setglobal compiler_flags = ""$compiler_flags $arg"" setglobal prev = 'darwin_framework' } setglobal compile_command = ""$compile_command $arg"" setglobal finalize_command = ""$finalize_command $arg"" continue with -inst-prefix-dir setglobal prev = 'inst_prefix' continue # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L with -L[A-Z][A-Z]*:* match $with_gcc/$host { with no/*-*-irix* | /*-*-irix* setglobal compile_command = ""$compile_command $arg"" setglobal finalize_command = ""$finalize_command $arg"" } continue with -L* setglobal dir = $[$echo "X$arg" | $Xsed -e 's/^-L//] # We need an absolute path. match $dir { with [\\/]* | [A-Za-z]:[\\/]* with * setglobal absdir = $[cd $dir && pwd] if test -z $absdir { $echo "$modename: cannot determine absolute directory name of \`$dir'" !1 > !2 setglobal absdir = $dir setglobal notinst_path = ""$notinst_path $dir"" } setglobal dir = $absdir } match "$deplibs " { with *" -L$dir "* with * setglobal deplibs = ""$deplibs -L$dir"" setglobal lib_search_path = ""$lib_search_path $dir"" } match $host { with *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* setglobal testbindir = $[$echo "X$dir" | $Xsed -e 's*/lib$*/bin*] match :$dllsearchpath: { with *":$dir:"* with * setglobal dllsearchpath = ""$dllsearchpath:$dir"" } match :$dllsearchpath: { with *":$testbindir:"* with * setglobal dllsearchpath = ""$dllsearchpath:$testbindir"" } } continue with -l* if test "X$arg" = "X-lc" || test "X$arg" = "X-lm" { match $host { with *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* # These systems don't actually have a C or math library (as such) continue with *-*-os2* # These systems don't actually have a C library (as such) test "X$arg" = "X-lc" && continue with *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue with *-*-rhapsody* | *-*-darwin1.[012] # Rhapsody C and math libraries are in the System framework setglobal deplibs = ""$deplibs -framework System"" continue with *-*-sco3.2v5* | *-*-sco5v6* # Causes problems with __ctype test "X$arg" = "X-lc" && continue with *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX* # Compiler inserts libc in the correct place for threads to work test "X$arg" = "X-lc" && continue } } elif test "X$arg" = "X-lc_r" { match $host { with *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* # Do not include libc_r directly, use -pthread flag. continue } } setglobal deplibs = ""$deplibs $arg"" continue # Tru64 UNIX uses -model [arg] to determine the layout of C++ # classes, name mangling, and exception handling. with -model setglobal compile_command = ""$compile_command $arg"" setglobal compiler_flags = ""$compiler_flags $arg"" setglobal finalize_command = ""$finalize_command $arg"" setglobal prev = 'xcompiler' continue with -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe setglobal compiler_flags = ""$compiler_flags $arg"" setglobal compile_command = ""$compile_command $arg"" setglobal finalize_command = ""$finalize_command $arg"" continue with -module setglobal module = 'yes' continue # -64, -mips[0-9] enable 64-bit mode on the SGI compiler # -r[0-9][0-9]* specifies the processor on the SGI compiler # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler # +DA*, +DD* enable 64-bit mode on the HP compiler # -q* pass through compiler args for the IBM compiler # -m* pass through architecture-specific compiler args for GCC # -m*, -t[45]*, -txscale* pass through architecture-specific # compiler args for GCC # -pg pass through profiling flag for GCC # @file GCC response files with -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \ -t[45]*|-txscale*|@* # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. setglobal arg = $[$echo "X$arg" | $Xsed -e $sed_quote_subst] match $arg { with *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"" setglobal arg = ""\"$arg"\"" } setglobal compile_command = ""$compile_command $arg"" setglobal finalize_command = ""$finalize_command $arg"" setglobal compiler_flags = ""$compiler_flags $arg"" continue with -shrext setglobal prev = 'shrext' continue with -no-fast-install setglobal fast_install = 'no' continue with -no-install match $host { with *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* # The PATH hackery in wrapper scripts is required on Windows # in order for the loader to find any dlls it needs. $echo "$modename: warning: \`-no-install' is ignored for $host" !1 > !2 $echo "$modename: warning: assuming \`-no-fast-install' instead" !1 > !2 setglobal fast_install = 'no' with * setglobal no_install = 'yes' } continue with -no-undefined setglobal allow_undefined = 'no' continue with -objectlist setglobal prev = 'objectlist' continue with -o setglobal prev = 'output' with -precious-files-regex setglobal prev = 'precious_regex' continue with -release setglobal prev = 'release' continue with -rpath setglobal prev = 'rpath' continue with -R setglobal prev = 'xrpath' continue with -R* setglobal dir = $[$echo "X$arg" | $Xsed -e 's/^-R//] # We need an absolute path. match $dir { with [\\/]* | [A-Za-z]:[\\/]* with * $echo "$modename: only absolute run-paths are allowed" !1 > !2 exit $EXIT_FAILURE } match "$xrpath " { with *" $dir "* with * setglobal xrpath = ""$xrpath $dir"" } continue with -static # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue with -thread-safe setglobal thread_safe = 'yes' continue with -version-info setglobal prev = 'vinfo' continue with -version-number setglobal prev = 'vinfo' setglobal vinfo_number = 'yes' continue with -Wc,* setglobal args = $[$echo "X$arg" | $Xsed -e $sed_quote_subst -e 's/^-Wc,//] setglobal arg = '' setglobal save_ifs = $IFS; setglobal IFS = '','' for flag in [$args] { setglobal IFS = $save_ifs match $flag { with *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"" setglobal flag = ""\"$flag"\"" } setglobal arg = ""$arg $wl$flag"" setglobal compiler_flags = ""$compiler_flags $flag"" } setglobal IFS = $save_ifs setglobal arg = $[$echo "X$arg" | $Xsed -e "s/^ //] with -Wl,* setglobal args = $[$echo "X$arg" | $Xsed -e $sed_quote_subst -e 's/^-Wl,//] setglobal arg = '' setglobal save_ifs = $IFS; setglobal IFS = '','' for flag in [$args] { setglobal IFS = $save_ifs match $flag { with *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"" setglobal flag = ""\"$flag"\"" } setglobal arg = ""$arg $wl$flag"" setglobal compiler_flags = ""$compiler_flags $wl$flag"" setglobal linker_flags = ""$linker_flags $flag"" } setglobal IFS = $save_ifs setglobal arg = $[$echo "X$arg" | $Xsed -e "s/^ //] with -Xcompiler setglobal prev = 'xcompiler' continue with -Xlinker setglobal prev = 'xlinker' continue with -XCClinker setglobal prev = 'xcclinker' continue # Some other compiler flag. with -* | +* # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. setglobal arg = $[$echo "X$arg" | $Xsed -e $sed_quote_subst] match $arg { with *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"" setglobal arg = ""\"$arg"\"" } with *.$objext # A standard object. setglobal objs = ""$objs $arg"" with *.lo # A libtool-controlled object. # Check to see that this really is a libtool object. if shell {$(SED) -e '2q' $arg | grep "^# Generated by .*$PACKAGE"} >/dev/null 2>&1 { setglobal pic_object = '' setglobal non_pic_object = '' # Read the .lo file # If there is no directory component, then add one. match $arg { with */* | *\\* source $arg with * source ./$arg } if test -z $pic_object || \ test -z $non_pic_object || test $pic_object = none && \ test $non_pic_object = none { $echo "$modename: cannot find name of object for \`$arg'" !1 > !2 exit $EXIT_FAILURE } # Extract subdirectory from the argument. setglobal xdir = $[$echo "X$arg" | $Xsed -e 's%/[^/]*$%%] if test "X$xdir" = "X$arg" { setglobal xdir = '' } else { setglobal xdir = ""$xdir/"" } if test $pic_object != none { # Prepend the subdirectory the object is found in. setglobal pic_object = ""$xdir$pic_object"" if test $prev = dlfiles { if test $build_libtool_libs = yes && test $dlopen_support = yes { setglobal dlfiles = ""$dlfiles $pic_object"" setglobal prev = '' continue } else { # If libtool objects are unsupported, then we need to preload. setglobal prev = 'dlprefiles' } } # CHECK ME: I think I busted this. -Ossama if test $prev = dlprefiles { # Preload the old-style object. setglobal dlprefiles = ""$dlprefiles $pic_object"" setglobal prev = '' } # A PIC object. setglobal libobjs = ""$libobjs $pic_object"" setglobal arg = $pic_object } # Non-PIC object. if test $non_pic_object != none { # Prepend the subdirectory the object is found in. setglobal non_pic_object = ""$xdir$non_pic_object"" # A standard non-PIC object setglobal non_pic_objects = ""$non_pic_objects $non_pic_object"" if test -z $pic_object || test $pic_object = none { setglobal arg = $non_pic_object } } else { # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. setglobal non_pic_object = $pic_object setglobal non_pic_objects = ""$non_pic_objects $non_pic_object"" } } else { # Only an error if not doing a dry-run. if test -z $run { $echo "$modename: \`$arg' is not a valid libtool object" !1 > !2 exit $EXIT_FAILURE } else { # Dry-run case. # Extract subdirectory from the argument. setglobal xdir = $[$echo "X$arg" | $Xsed -e 's%/[^/]*$%%] if test "X$xdir" = "X$arg" { setglobal xdir = '' } else { setglobal xdir = ""$xdir/"" } setglobal pic_object = $[$echo "X$(xdir)$(objdir)/$(arg)" | $Xsed -e $lo2o] setglobal non_pic_object = $[$echo "X$(xdir)$(arg)" | $Xsed -e $lo2o] setglobal libobjs = ""$libobjs $pic_object"" setglobal non_pic_objects = ""$non_pic_objects $non_pic_object"" } } with *.$libext # An archive. setglobal deplibs = ""$deplibs $arg"" setglobal old_deplibs = ""$old_deplibs $arg"" continue with *.la # A libtool-controlled library. if test $prev = dlfiles { # This library was specified with -dlopen. setglobal dlfiles = ""$dlfiles $arg"" setglobal prev = '' } elif test $prev = dlprefiles { # The library was specified with -dlpreopen. setglobal dlprefiles = ""$dlprefiles $arg"" setglobal prev = '' } else { setglobal deplibs = ""$deplibs $arg"" } continue # Some other compiler argument. with * # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. setglobal arg = $[$echo "X$arg" | $Xsed -e $sed_quote_subst] match $arg { with *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"" setglobal arg = ""\"$arg"\"" } } # arg # Now actually substitute the argument into the commands. if test -n $arg { setglobal compile_command = ""$compile_command $arg"" setglobal finalize_command = ""$finalize_command $arg"" } } # argument parsing loop if test -n $prev { $echo "$modename: the \`$prevarg' option requires an argument" !1 > !2 $echo $help !1 > !2 exit $EXIT_FAILURE } if test $export_dynamic = yes && test -n $export_dynamic_flag_spec { eval arg='"'$export_dynamic_flag_spec'"' setglobal compile_command = ""$compile_command $arg"" setglobal finalize_command = ""$finalize_command $arg"" } setglobal oldlibs = '' # calculate the name of the file, without its directory setglobal outputname = $[$echo "X$output" | $Xsed -e 's%^.*/%%] setglobal libobjs_save = $libobjs if test -n $shlibpath_var { # get the directories listed in $shlibpath_var eval shlib_search_path='`''$'echo '"'X'$'{$shlibpath_var}'"' '|' '$'Xsed -e '''s/:/ /g''''`' } else { setglobal shlib_search_path = '' } eval sys_lib_search_path='"'$sys_lib_search_path_spec'"' eval sys_lib_dlsearch_path='"'$sys_lib_dlsearch_path_spec'"' setglobal output_objdir = $[$echo "X$output" | $Xsed -e 's%/[^/]*$%%] if test "X$output_objdir" = "X$output" { setglobal output_objdir = $objdir } else { setglobal output_objdir = ""$output_objdir/$objdir"" } # Create the object directory. if test ! -d $output_objdir { $show "$mkdir $output_objdir" $run $mkdir $output_objdir setglobal exit_status = $Status if test $exit_status -ne 0 && test ! -d $output_objdir { exit $exit_status } } # Determine the type of output match $output { with "" $echo "$modename: you must specify an output file" !1 > !2 $echo $help !1 > !2 exit $EXIT_FAILURE with *.$libext setglobal linkmode = 'oldlib' with *.lo | *.$objext setglobal linkmode = 'obj' with *.la setglobal linkmode = 'lib' with * setglobal linkmode = 'prog' # Anything else should be a program. } match $host { with *cygwin* | *mingw* | *pw32* # don't eliminate duplications in $postdeps and $predeps setglobal duplicate_compiler_generated_deps = 'yes' with * setglobal duplicate_compiler_generated_deps = $duplicate_deps } setglobal specialdeplibs = '' setglobal libs = '' # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in [$deplibs] { if test "X$duplicate_deps" = "Xyes" { match "$libs " { with *" $deplib "* setglobal specialdeplibs = ""$specialdeplibs $deplib"" } } setglobal libs = ""$libs $deplib"" } if test $linkmode = lib { setglobal libs = ""$predeps $libs $compiler_lib_search_path $postdeps"" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). setglobal pre_post_deps = '' if test "X$duplicate_compiler_generated_deps" = "Xyes" { for pre_post_dep in [$predeps $postdeps] { match "$pre_post_deps " { with *" $pre_post_dep "* setglobal specialdeplibs = ""$specialdeplibs $pre_post_deps"" } setglobal pre_post_deps = ""$pre_post_deps $pre_post_dep"" } } setglobal pre_post_deps = '' } setglobal deplibs = '' setglobal newdependency_libs = '' setglobal newlib_search_path = '' setglobal need_relink = 'no' # whether we're linking any uninstalled libtool libraries setglobal notinst_deplibs = '' # not-installed libtool libraries match $linkmode { with lib setglobal passes = '"conv link'" for file in [$dlfiles $dlprefiles] { match $file { with *.la with * $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" !1 > !2 exit $EXIT_FAILURE } } with prog setglobal compile_deplibs = '' setglobal finalize_deplibs = '' setglobal alldeplibs = 'no' setglobal newdlfiles = '' setglobal newdlprefiles = '' setglobal passes = '"conv scan dlopen dlpreopen link'" with * setglobal passes = '"conv'" } for pass in [$passes] { if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" { setglobal libs = $deplibs setglobal deplibs = '' } if test $linkmode = prog { match $pass { with dlopen setglobal libs = $dlfiles with dlpreopen setglobal libs = $dlprefiles with link setglobal libs = ""$deplibs %DEPLIBS% $dependency_libs"" } } if test $pass = dlopen { # Collect dlpreopened libraries setglobal save_deplibs = $deplibs setglobal deplibs = '' } for deplib in [$libs] { setglobal lib = '' setglobal found = 'no' match $deplib { with -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe if test "$linkmode,$pass" = "prog,link" { setglobal compile_deplibs = ""$deplib $compile_deplibs"" setglobal finalize_deplibs = ""$deplib $finalize_deplibs"" } else { setglobal compiler_flags = ""$compiler_flags $deplib"" } continue with -l* if test $linkmode != lib && test $linkmode != prog { $echo "$modename: warning: \`-l' is ignored for archives/objects" !1 > !2 continue } setglobal name = $[$echo "X$deplib" | $Xsed -e 's/^-l//] for searchdir in [$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path] { for search_ext in [.la $std_shrext .so .a] { # Search the libtool library setglobal lib = ""$searchdir/lib$(name)$(search_ext)"" if test -f $lib { if test $search_ext = ".la" { setglobal found = 'yes' } else { setglobal found = 'no' } break 2 } } } if test $found != yes { # deplib doesn't seem to be a libtool library if test "$linkmode,$pass" = "prog,link" { setglobal compile_deplibs = ""$deplib $compile_deplibs"" setglobal finalize_deplibs = ""$deplib $finalize_deplibs"" } else { setglobal deplibs = ""$deplib $deplibs"" test $linkmode = lib && setglobal newdependency_libs = ""$deplib $newdependency_libs"" } continue } else { # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" { match " $predeps $postdeps " { with *" $deplib "* if shell {$(SED) -e '2q' $lib | grep "^# Generated by .*$PACKAGE"} >/dev/null 2>&1 { setglobal library_names = '' setglobal old_library = '' match $lib { with */* | *\\* source $lib with * source ./$lib } for l in [$old_library $library_names] { setglobal ll = $l } if test "X$ll" = "X$old_library" { # only static version available setglobal found = 'no' setglobal ladir = $[$echo "X$lib" | $Xsed -e 's%/[^/]*$%%] test "X$ladir" = "X$lib" && setglobal ladir = '".'" setglobal lib = "$ladir/$old_library" if test "$linkmode,$pass" = "prog,link" { setglobal compile_deplibs = ""$deplib $compile_deplibs"" setglobal finalize_deplibs = ""$deplib $finalize_deplibs"" } else { setglobal deplibs = ""$deplib $deplibs"" test $linkmode = lib && setglobal newdependency_libs = ""$deplib $newdependency_libs"" } continue } } with * } } } # -l with -L* match $linkmode { with lib setglobal deplibs = ""$deplib $deplibs"" test $pass = conv && continue setglobal newdependency_libs = ""$deplib $newdependency_libs"" setglobal newlib_search_path = ""$newlib_search_path "$[$echo "X$deplib" | $Xsed -e 's/^-L//]" with prog if test $pass = conv { setglobal deplibs = ""$deplib $deplibs"" continue } if test $pass = scan { setglobal deplibs = ""$deplib $deplibs"" } else { setglobal compile_deplibs = ""$deplib $compile_deplibs"" setglobal finalize_deplibs = ""$deplib $finalize_deplibs"" } setglobal newlib_search_path = ""$newlib_search_path "$[$echo "X$deplib" | $Xsed -e 's/^-L//]" with * $echo "$modename: warning: \`-L' is ignored for archives/objects" !1 > !2 } # linkmode continue # -L with -R* if test $pass = link { setglobal dir = $[$echo "X$deplib" | $Xsed -e 's/^-R//] # Make sure the xrpath contains only unique directories. match "$xrpath " { with *" $dir "* with * setglobal xrpath = ""$xrpath $dir"" } } setglobal deplibs = ""$deplib $deplibs"" continue with *.la setglobal lib = $deplib with *.$libext if test $pass = conv { setglobal deplibs = ""$deplib $deplibs"" continue } match $linkmode { with lib setglobal valid_a_lib = 'no' match $deplibs_check_method { with match_pattern* set dummy $deplibs_check_method setglobal match_pattern_regex = $[expr $deplibs_check_method : "$2 \(.*\)] if eval $echo '"'$deplib'"' !2 >/dev/null \ | $SED 10q \ | $EGREP $match_pattern_regex > /dev/null { setglobal valid_a_lib = 'yes' } with pass_all setglobal valid_a_lib = 'yes' } if test $valid_a_lib != yes { $echo $echo "*** Warning: Trying to link with static lib archive $deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because the file extensions .$libext of this argument makes me believe" $echo "*** that it is just a static archive that I should not used here." } else { $echo $echo "*** Warning: Linking the shared library $output against the" $echo "*** static library $deplib is not portable!" setglobal deplibs = ""$deplib $deplibs"" } continue with prog if test $pass != link { setglobal deplibs = ""$deplib $deplibs"" } else { setglobal compile_deplibs = ""$deplib $compile_deplibs"" setglobal finalize_deplibs = ""$deplib $finalize_deplibs"" } continue } # linkmode # *.$libext with *.lo | *.$objext if test $pass = conv { setglobal deplibs = ""$deplib $deplibs"" } elif test $linkmode = prog { if test $pass = dlpreopen || test $dlopen_support != yes || test $build_libtool_libs = no { # If there is no dlopen support or we're linking statically, # we need to preload. setglobal newdlprefiles = ""$newdlprefiles $deplib"" setglobal compile_deplibs = ""$deplib $compile_deplibs"" setglobal finalize_deplibs = ""$deplib $finalize_deplibs"" } else { setglobal newdlfiles = ""$newdlfiles $deplib"" } } continue with %DEPLIBS% setglobal alldeplibs = 'yes' continue } # case $deplib if test $found = yes || test -f $lib { : } else { $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" !1 > !2 exit $EXIT_FAILURE } # Check to see that this really is a libtool archive. if shell {$(SED) -e '2q' $lib | grep "^# Generated by .*$PACKAGE"} >/dev/null 2>&1 { : } else { $echo "$modename: \`$lib' is not a valid libtool archive" !1 > !2 exit $EXIT_FAILURE } setglobal ladir = $[$echo "X$lib" | $Xsed -e 's%/[^/]*$%%] test "X$ladir" = "X$lib" && setglobal ladir = '".'" setglobal dlname = '' setglobal dlopen = '' setglobal dlpreopen = '' setglobal libdir = '' setglobal library_names = '' setglobal old_library = '' # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink setglobal installed = 'yes' setglobal shouldnotlink = 'no' setglobal avoidtemprpath = '' # Read the .la file match $lib { with */* | *\\* source $lib with * source ./$lib } if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || do { test $linkmode != prog && test $linkmode != lib; } { test -n $dlopen && setglobal dlfiles = ""$dlfiles $dlopen"" test -n $dlpreopen && setglobal dlprefiles = ""$dlprefiles $dlpreopen"" } if test $pass = conv { # Only check for convenience libraries setglobal deplibs = ""$lib $deplibs"" if test -z $libdir { if test -z $old_library { $echo "$modename: cannot find name of link library for \`$lib'" !1 > !2 exit $EXIT_FAILURE } # It is a libtool convenience library, so add in its objects. setglobal convenience = ""$convenience $ladir/$objdir/$old_library"" setglobal old_convenience = ""$old_convenience $ladir/$objdir/$old_library"" setglobal tmp_libs = '' for deplib in [$dependency_libs] { setglobal deplibs = ""$deplib $deplibs"" if test "X$duplicate_deps" = "Xyes" { match "$tmp_libs " { with *" $deplib "* setglobal specialdeplibs = ""$specialdeplibs $deplib"" } } setglobal tmp_libs = ""$tmp_libs $deplib"" } } elif test $linkmode != prog && test $linkmode != lib { $echo "$modename: \`$lib' is not a convenience library" !1 > !2 exit $EXIT_FAILURE } continue } # $pass = conv # Get the name of the library we link against. setglobal linklib = '' for l in [$old_library $library_names] { setglobal linklib = $l } if test -z $linklib { $echo "$modename: cannot find name of link library for \`$lib'" !1 > !2 exit $EXIT_FAILURE } # This library was specified with -dlopen. if test $pass = dlopen { if test -z $libdir { $echo "$modename: cannot -dlopen a convenience library: \`$lib'" !1 > !2 exit $EXIT_FAILURE } if test -z $dlname || test $dlopen_support != yes || test $build_libtool_libs = no { # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. setglobal dlprefiles = ""$dlprefiles $lib $dependency_libs"" } else { setglobal newdlfiles = ""$newdlfiles $lib"" } continue } # $pass = dlopen # We need an absolute path. match $ladir { with [\\/]* | [A-Za-z]:[\\/]* setglobal abs_ladir = $ladir with * setglobal abs_ladir = $[cd $ladir && pwd] if test -z $abs_ladir { $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" !1 > !2 $echo "$modename: passing it literally to the linker, although it might fail" !1 > !2 setglobal abs_ladir = $ladir } } setglobal laname = $[$echo "X$lib" | $Xsed -e 's%^.*/%%] # Find the relevant object directory and library name. if test "X$installed" = Xyes { if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib" { $echo "$modename: warning: library \`$lib' was moved." !1 > !2 setglobal dir = $ladir setglobal absdir = $abs_ladir setglobal libdir = $abs_ladir } else { setglobal dir = $libdir setglobal absdir = $libdir } test "X$hardcode_automatic" = Xyes && setglobal avoidtemprpath = 'yes' } else { if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib" { setglobal dir = $ladir setglobal absdir = $abs_ladir # Remove this search path later setglobal notinst_path = ""$notinst_path $abs_ladir"" } else { setglobal dir = ""$ladir/$objdir"" setglobal absdir = ""$abs_ladir/$objdir"" # Remove this search path later setglobal notinst_path = ""$notinst_path $abs_ladir"" } } # $installed = yes setglobal name = $[$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//] # This library was specified with -dlpreopen. if test $pass = dlpreopen { if test -z $libdir { $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" !1 > !2 exit $EXIT_FAILURE } # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n $old_library { setglobal newdlprefiles = ""$newdlprefiles $dir/$old_library"" # Otherwise, use the dlname, so that lt_dlopen finds it. } elif test -n $dlname { setglobal newdlprefiles = ""$newdlprefiles $dir/$dlname"" } else { setglobal newdlprefiles = ""$newdlprefiles $dir/$linklib"" } } # $pass = dlpreopen if test -z $libdir { # Link the convenience library if test $linkmode = lib { setglobal deplibs = ""$dir/$old_library $deplibs"" } elif test "$linkmode,$pass" = "prog,link" { setglobal compile_deplibs = ""$dir/$old_library $compile_deplibs"" setglobal finalize_deplibs = ""$dir/$old_library $finalize_deplibs"" } else { setglobal deplibs = ""$lib $deplibs"" # used for prog,scan pass } continue } if test $linkmode = prog && test $pass != link { setglobal newlib_search_path = ""$newlib_search_path $ladir"" setglobal deplibs = ""$lib $deplibs"" setglobal linkalldeplibs = 'no' if test $link_all_deplibs != no || test -z $library_names || test $build_libtool_libs = no { setglobal linkalldeplibs = 'yes' } setglobal tmp_libs = '' for deplib in [$dependency_libs] { match $deplib { with -L* setglobal newlib_search_path = ""$newlib_search_path "$[$echo "X$deplib" | $Xsed -e 's/^-L//]" ### testsuite: skip nested quoting test } # Need to link against all dependency_libs? if test $linkalldeplibs = yes { setglobal deplibs = ""$deplib $deplibs"" } else { # Need to hardcode shared library paths # or/and link against static libraries setglobal newdependency_libs = ""$deplib $newdependency_libs"" } if test "X$duplicate_deps" = "Xyes" { match "$tmp_libs " { with *" $deplib "* setglobal specialdeplibs = ""$specialdeplibs $deplib"" } } setglobal tmp_libs = ""$tmp_libs $deplib"" } # for deplib continue } # $linkmode = prog... if test "$linkmode,$pass" = "prog,link" { if test -n $library_names && do { test $prefer_static_libs = no || test -z $old_library; } { # We need to hardcode the library path if test -n $shlibpath_var && test -z $avoidtemprpath { # Make sure the rpath contains only unique directories. match "$temp_rpath " { with *" $dir "* with *" $absdir "* with * setglobal temp_rpath = ""$temp_rpath $absdir"" } } # Hardcode the library path. # Skip directories that are in the system default run-time # search path. match " $sys_lib_dlsearch_path " { with *" $absdir "* with * match "$compile_rpath " { with *" $absdir "* with * setglobal compile_rpath = ""$compile_rpath $absdir"" } } match " $sys_lib_dlsearch_path " { with *" $libdir "* with * match "$finalize_rpath " { with *" $libdir "* with * setglobal finalize_rpath = ""$finalize_rpath $libdir"" } } } # $linkmode,$pass = prog,link... if test $alldeplibs = yes && do { test $deplibs_check_method = pass_all || do { test $build_libtool_libs = yes && test -n $library_names; }; } { # We only need to search for static libraries continue } } setglobal link_static = 'no' # Whether the deplib will be linked statically setglobal use_static_libs = $prefer_static_libs if test $use_static_libs = built && test $installed = yes { setglobal use_static_libs = 'no' } if test -n $library_names && do { test $use_static_libs = no || test -z $old_library; } { if test $installed = no { setglobal notinst_deplibs = ""$notinst_deplibs $lib"" setglobal need_relink = 'yes' } # This is a shared library # Warn about portability, can't link against -module's on # some systems (darwin) if test $shouldnotlink = yes && test $pass = link { $echo if test $linkmode = prog { $echo "*** Warning: Linking the executable $output against the loadable module" } else { $echo "*** Warning: Linking the shared library $output against the loadable module" } $echo "*** $linklib is not portable!" } if test $linkmode = lib && test $hardcode_into_libs = yes { # Hardcode the library path. # Skip directories that are in the system default run-time # search path. match " $sys_lib_dlsearch_path " { with *" $absdir "* with * match "$compile_rpath " { with *" $absdir "* with * setglobal compile_rpath = ""$compile_rpath $absdir"" } } match " $sys_lib_dlsearch_path " { with *" $libdir "* with * match "$finalize_rpath " { with *" $libdir "* with * setglobal finalize_rpath = ""$finalize_rpath $libdir"" } } } if test -n $old_archive_from_expsyms_cmds { # figure out the soname set dummy $library_names setglobal realname = $2 shift; shift setglobal libname = $[eval '\'$echo '"'$libname_spec'"'] # use dlname if we got it. it's perfectly good, no? if test -n $dlname { setglobal soname = $dlname } elif test -n $soname_spec { # bleh windows match $host { with *cygwin* | mingw* setglobal major = $[expr $current - $age] setglobal versuffix = ""-$major"" } eval soname='"'$soname_spec'"' } else { setglobal soname = $realname } # Make a new name for the extract_expsyms_cmds to use setglobal soroot = $soname setglobal soname = $[$echo $soroot | $(SED) -e 's/^.*\///] setglobal newlib = ""libimp-$[$echo $soname | $(SED) 's/^lib//;s/\.dll$//].a"" # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def" { : } else { $show "extracting exported symbol list from \`$soname'" setglobal save_ifs = $IFS; setglobal IFS = ''~'' setglobal cmds = $extract_expsyms_cmds for cmd in [$cmds] { setglobal IFS = $save_ifs eval cmd='"'$cmd'"' $show $cmd $run eval $cmd || exit $? } setglobal IFS = $save_ifs } # Create $newlib if test -f "$output_objdir/$newlib" { :; } else { $show "generating import library for \`$soname'" setglobal save_ifs = $IFS; setglobal IFS = ''~'' setglobal cmds = $old_archive_from_expsyms_cmds for cmd in [$cmds] { setglobal IFS = $save_ifs eval cmd='"'$cmd'"' $show $cmd $run eval $cmd || exit $? } setglobal IFS = $save_ifs } # make sure the library variables are pointing to the new library setglobal dir = $output_objdir setglobal linklib = $newlib } # test -n "$old_archive_from_expsyms_cmds" if test $linkmode = prog || test $mode != relink { setglobal add_shlibpath = '' setglobal add_dir = '' setglobal add = '' setglobal lib_linked = 'yes' match $hardcode_action { with immediate | unsupported if test $hardcode_direct = no { setglobal add = ""$dir/$linklib"" match $host { with *-*-sco3.2v5.0.[024]* setglobal add_dir = ""-L$dir"" with *-*-sysv4*uw2* setglobal add_dir = ""-L$dir"" with *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ *-*-unixware7* setglobal add_dir = ""-L$dir"" with *-*-darwin* # if the lib is a module then we can not link against # it, someone is ignoring the new warnings I added if /usr/bin/file -L $add !2 > /dev/null | $EGREP ": [^:]* bundle" >/dev/null { $echo "** Warning, lib $linklib is a module, not a shared library" if test -z $old_library { $echo $echo "** And there doesn't seem to be a static archive available" $echo "** The link will probably fail, sorry" } else { setglobal add = ""$dir/$old_library"" } } } } elif test $hardcode_minus_L = no { match $host { with *-*-sunos* setglobal add_shlibpath = $dir } setglobal add_dir = ""-L$dir"" setglobal add = ""-l$name"" } elif test $hardcode_shlibpath_var = no { setglobal add_shlibpath = $dir setglobal add = ""-l$name"" } else { setglobal lib_linked = 'no' } with relink if test $hardcode_direct = yes { setglobal add = ""$dir/$linklib"" } elif test $hardcode_minus_L = yes { setglobal add_dir = ""-L$dir"" # Try looking first in the location we're being installed to. if test -n $inst_prefix_dir { match $libdir { with [\\/]* setglobal add_dir = ""$add_dir -L$inst_prefix_dir$libdir"" } } setglobal add = ""-l$name"" } elif test $hardcode_shlibpath_var = yes { setglobal add_shlibpath = $dir setglobal add = ""-l$name"" } else { setglobal lib_linked = 'no' } with * setglobal lib_linked = 'no' } if test $lib_linked != yes { $echo "$modename: configuration error: unsupported hardcode properties" exit $EXIT_FAILURE } if test -n $add_shlibpath { match :$compile_shlibpath: { with *":$add_shlibpath:"* with * setglobal compile_shlibpath = ""$compile_shlibpath$add_shlibpath:"" } } if test $linkmode = prog { test -n $add_dir && setglobal compile_deplibs = ""$add_dir $compile_deplibs"" test -n $add && setglobal compile_deplibs = ""$add $compile_deplibs"" } else { test -n $add_dir && setglobal deplibs = ""$add_dir $deplibs"" test -n $add && setglobal deplibs = ""$add $deplibs"" if test $hardcode_direct != yes && \ test $hardcode_minus_L != yes && \ test $hardcode_shlibpath_var = yes { match :$finalize_shlibpath: { with *":$libdir:"* with * setglobal finalize_shlibpath = ""$finalize_shlibpath$libdir:"" } } } } if test $linkmode = prog || test $mode = relink { setglobal add_shlibpath = '' setglobal add_dir = '' setglobal add = '' # Finalize command for both is simple: just hardcode it. if test $hardcode_direct = yes { setglobal add = ""$libdir/$linklib"" } elif test $hardcode_minus_L = yes { setglobal add_dir = ""-L$libdir"" setglobal add = ""-l$name"" } elif test $hardcode_shlibpath_var = yes { match :$finalize_shlibpath: { with *":$libdir:"* with * setglobal finalize_shlibpath = ""$finalize_shlibpath$libdir:"" } setglobal add = ""-l$name"" } elif test $hardcode_automatic = yes { if test -n $inst_prefix_dir && test -f "$inst_prefix_dir$libdir/$linklib" { setglobal add = ""$inst_prefix_dir$libdir/$linklib"" } else { setglobal add = ""$libdir/$linklib"" } } else { # We cannot seem to hardcode it, guess we'll fake it. setglobal add_dir = ""-L$libdir"" # Try looking first in the location we're being installed to. if test -n $inst_prefix_dir { match $libdir { with [\\/]* setglobal add_dir = ""$add_dir -L$inst_prefix_dir$libdir"" } } setglobal add = ""-l$name"" } if test $linkmode = prog { test -n $add_dir && setglobal finalize_deplibs = ""$add_dir $finalize_deplibs"" test -n $add && setglobal finalize_deplibs = ""$add $finalize_deplibs"" } else { test -n $add_dir && setglobal deplibs = ""$add_dir $deplibs"" test -n $add && setglobal deplibs = ""$add $deplibs"" } } } elif test $linkmode = prog { # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test $hardcode_direct != unsupported { test -n $old_library && setglobal linklib = $old_library setglobal compile_deplibs = ""$dir/$linklib $compile_deplibs"" setglobal finalize_deplibs = ""$dir/$linklib $finalize_deplibs"" } else { setglobal compile_deplibs = ""-l$name -L$dir $compile_deplibs"" setglobal finalize_deplibs = ""-l$name -L$dir $finalize_deplibs"" } } elif test $build_libtool_libs = yes { # Not a shared library if test $deplibs_check_method != pass_all { # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. $echo $echo "*** Warning: This system can not link to static lib archive $lib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have." if test $module = yes { $echo "*** But as you try to build a module library, libtool will still create " $echo "*** a static module, that should work as long as the dlopening application" $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z $global_symbol_pipe { $echo $echo "*** However, this would only work if libtool was able to extract symbol" $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" $echo "*** not find such a program. So, this module is probably useless." $echo "*** \`nm' from GNU binutils and a full rebuild may help." } if test $build_old_libs = no { setglobal build_libtool_libs = 'module' setglobal build_old_libs = 'yes' } else { setglobal build_libtool_libs = 'no' } } } else { setglobal deplibs = ""$dir/$old_library $deplibs"" setglobal link_static = 'yes' } } # link shared/static library? if test $linkmode = lib { if test -n $dependency_libs && do { test $hardcode_into_libs != yes || test $build_old_libs = yes || test $link_static = yes; } { # Extract -R from dependency_libs setglobal temp_deplibs = '' for libdir in [$dependency_libs] { match $libdir { with -R* setglobal temp_xrpath = $[$echo "X$libdir" | $Xsed -e 's/^-R//] match " $xrpath " { with *" $temp_xrpath "* with * setglobal xrpath = ""$xrpath $temp_xrpath"" } with * setglobal temp_deplibs = ""$temp_deplibs $libdir"" } } setglobal dependency_libs = $temp_deplibs } setglobal newlib_search_path = ""$newlib_search_path $absdir"" # Link against this library test $link_static = no && setglobal newdependency_libs = ""$abs_ladir/$laname $newdependency_libs"" # ... and its dependency_libs setglobal tmp_libs = '' for deplib in [$dependency_libs] { setglobal newdependency_libs = ""$deplib $newdependency_libs"" if test "X$duplicate_deps" = "Xyes" { match "$tmp_libs " { with *" $deplib "* setglobal specialdeplibs = ""$specialdeplibs $deplib"" } } setglobal tmp_libs = ""$tmp_libs $deplib"" } if test $link_all_deplibs != no { # Add the search paths of all dependency libraries for deplib in [$dependency_libs] { match $deplib { with -L* setglobal path = $deplib with *.la setglobal dir = $[$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%] test "X$dir" = "X$deplib" && setglobal dir = '".'" # We need an absolute path. match $dir { with [\\/]* | [A-Za-z]:[\\/]* setglobal absdir = $dir with * setglobal absdir = $[cd $dir && pwd] if test -z $absdir { $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" !1 > !2 setglobal absdir = $dir } } if grep "^installed=no" $deplib > /dev/null { setglobal path = ""$absdir/$objdir"" } else { eval libdir=$[$(SED) -n -e 's/^libdir=\(.*\)$/\1/p' $deplib] if test -z $libdir { $echo "$modename: \`$deplib' is not a valid libtool archive" !1 > !2 exit $EXIT_FAILURE } if test $absdir != $libdir { $echo "$modename: warning: \`$deplib' seems to be moved" !1 > !2 } setglobal path = $absdir } setglobal depdepl = '' match $host { with *-*-darwin* # we do not want to link against static libs, # but need to link against shared eval deplibrary_names=$[$(SED) -n -e 's/^library_names=\(.*\)$/\1/p' $deplib] if test -n $deplibrary_names { for tmp in [$deplibrary_names] { setglobal depdepl = $tmp } if test -f "$path/$depdepl" { setglobal depdepl = ""$path/$depdepl"" } # do not add paths which are already there match " $newlib_search_path " { with *" $path "* with * setglobal newlib_search_path = ""$newlib_search_path $path"" } } setglobal path = ''"" with * setglobal path = ""-L$path"" } with -l* match $host { with *-*-darwin* # Again, we only want to link against shared libraries eval tmp_libs=$[$echo "X$deplib" | $Xsed -e "s,^\-l,,] for tmp in [$newlib_search_path] { if test -f "$tmp/lib$tmp_libs.dylib" { eval depdepl="$tmp/lib$tmp_libs.dylib" break } } setglobal path = ''"" with * continue } with * continue } match " $deplibs " { with *" $path "* with * setglobal deplibs = ""$path $deplibs"" } match " $deplibs " { with *" $depdepl "* with * setglobal deplibs = ""$depdepl $deplibs"" } } } # link_all_deplibs != no } # linkmode = lib } # for deplib in $libs setglobal dependency_libs = $newdependency_libs if test $pass = dlpreopen { # Link the dlpreopened libraries before other libraries for deplib in [$save_deplibs] { setglobal deplibs = ""$deplib $deplibs"" } } if test $pass != dlopen { if test $pass != conv { # Make sure lib_search_path contains only unique directories. setglobal lib_search_path = '' for dir in [$newlib_search_path] { match "$lib_search_path " { with *" $dir "* with * setglobal lib_search_path = ""$lib_search_path $dir"" } } setglobal newlib_search_path = '' } if test "$linkmode,$pass" != "prog,link" { setglobal vars = '"deplibs'" } else { setglobal vars = '"compile_deplibs finalize_deplibs'" } for var in [$vars dependency_libs] { # Add libraries to $var in reverse order eval tmp_libs='"''$'$var'"' setglobal new_libs = '' for deplib in [$tmp_libs] { # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: match $deplib { with -L* setglobal new_libs = ""$deplib $new_libs"" with -R* with * # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. match " $specialdeplibs " { with *" $deplib "* setglobal new_libs = ""$deplib $new_libs"" with * match " $new_libs " { with *" $deplib "* with * setglobal new_libs = ""$deplib $new_libs"" } } } } setglobal tmp_libs = '' for deplib in [$new_libs] { match $deplib { with -L* match " $tmp_libs " { with *" $deplib "* with * setglobal tmp_libs = ""$tmp_libs $deplib"" } with * setglobal tmp_libs = ""$tmp_libs $deplib"" } } eval $var='"'$tmp_libs'"' } # for var } # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) setglobal tmp_libs = '' for i in [$dependency_libs] { match " $predeps $postdeps $compiler_lib_search_path " { with *" $i "* setglobal i = ''"" } if test -n $i { setglobal tmp_libs = ""$tmp_libs $i"" } } setglobal dependency_libs = $tmp_libs } # for pass if test $linkmode = prog { setglobal dlfiles = $newdlfiles setglobal dlprefiles = $newdlprefiles } match $linkmode { with oldlib if test -n $deplibs { $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" !1 > !2 } if test -n "$dlfiles$dlprefiles" || test $dlself != no { $echo "$modename: warning: \`-dlopen' is ignored for archives" !1 > !2 } if test -n $rpath { $echo "$modename: warning: \`-rpath' is ignored for archives" !1 > !2 } if test -n $xrpath { $echo "$modename: warning: \`-R' is ignored for archives" !1 > !2 } if test -n $vinfo { $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" !1 > !2 } if test -n $release { $echo "$modename: warning: \`-release' is ignored for archives" !1 > !2 } if test -n $export_symbols || test -n $export_symbols_regex { $echo "$modename: warning: \`-export-symbols' is ignored for archives" !1 > !2 } # Now set the variables for building old libraries. setglobal build_libtool_libs = 'no' setglobal oldlibs = $output setglobal objs = ""$objs$old_deplibs"" with lib # Make sure we only generate libraries of the form `libNAME.la'. match $outputname { with lib* setglobal name = $[$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//] eval shared_ext='"'$shrext_cmds'"' eval libname='"'$libname_spec'"' with * if test $module = no { $echo "$modename: libtool library \`$output' must begin with \`lib'" !1 > !2 $echo $help !1 > !2 exit $EXIT_FAILURE } if test $need_lib_prefix != no { # Add the "lib" prefix for modules if required setglobal name = $[$echo "X$outputname" | $Xsed -e 's/\.la$//] eval shared_ext='"'$shrext_cmds'"' eval libname='"'$libname_spec'"' } else { setglobal libname = $[$echo "X$outputname" | $Xsed -e 's/\.la$//] } } if test -n $objs { if test $deplibs_check_method != pass_all { $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" !2 > !1 exit $EXIT_FAILURE } else { $echo $echo "*** Warning: Linking the shared library $output against the non-libtool" $echo "*** objects $objs is not portable!" setglobal libobjs = ""$libobjs $objs"" } } if test $dlself != no { $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" !1 > !2 } set dummy $rpath if test "$Argc" -gt 2 { $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" !1 > !2 } setglobal install_libdir = $2 setglobal oldlibs = '' if test -z $rpath { if test $build_libtool_libs = yes { # Building a libtool convenience library. # Some compilers have problems with a `.al' extension so # convenience libraries should have the same extension an # archive normally would. setglobal oldlibs = ""$output_objdir/$libname.$libext $oldlibs"" setglobal build_libtool_libs = 'convenience' setglobal build_old_libs = 'yes' } if test -n $vinfo { $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" !1 > !2 } if test -n $release { $echo "$modename: warning: \`-release' is ignored for convenience libraries" !1 > !2 } } else { # Parse the version information argument. setglobal save_ifs = $IFS; setglobal IFS = '':'' set dummy $vinfo 0 0 0 setglobal IFS = $save_ifs if test -n $8 { $echo "$modename: too many parameters to \`-version-info'" !1 > !2 $echo $help !1 > !2 exit $EXIT_FAILURE } # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible match $vinfo_number { with yes setglobal number_major = $2 setglobal number_minor = $3 setglobal number_revision = $4 # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # which has an extra 1 added just for fun # match $version_type { with darwin|linux|osf|windows setglobal current = $[expr $number_major + $number_minor] setglobal age = $number_minor setglobal revision = $number_revision with freebsd-aout|freebsd-elf|sunos setglobal current = $number_major setglobal revision = $number_minor setglobal age = '"0'" with irix|nonstopux setglobal current = $[expr $number_major + $number_minor - 1] setglobal age = $number_minor setglobal revision = $number_minor } with no setglobal current = $2 setglobal revision = $3 setglobal age = $4 } # Check that each of the things are valid numbers. match $current { with 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9] with * $echo "$modename: CURRENT \`$current' must be a nonnegative integer" !1 > !2 $echo "$modename: \`$vinfo' is not valid version information" !1 > !2 exit $EXIT_FAILURE } match $revision { with 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9] with * $echo "$modename: REVISION \`$revision' must be a nonnegative integer" !1 > !2 $echo "$modename: \`$vinfo' is not valid version information" !1 > !2 exit $EXIT_FAILURE } match $age { with 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9] with * $echo "$modename: AGE \`$age' must be a nonnegative integer" !1 > !2 $echo "$modename: \`$vinfo' is not valid version information" !1 > !2 exit $EXIT_FAILURE } if test $age -gt $current { $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" !1 > !2 $echo "$modename: \`$vinfo' is not valid version information" !1 > !2 exit $EXIT_FAILURE } # Calculate the version variables. setglobal major = '' setglobal versuffix = '' setglobal verstring = '' match $version_type { with none with darwin # Like Linux, but with the current version available in # verstring for coding it into the library header setglobal major = ".$[expr $current - $age]" setglobal versuffix = ""$major.$age.$revision"" # Darwin ld doesn't like 0 for these options... setglobal minor_current = $[expr $current + 1] setglobal verstring = ""$(wl)-compatibility_version $(wl)$minor_current $(wl)-current_version $(wl)$minor_current.$revision"" with freebsd-aout setglobal major = "".$current"" setglobal versuffix = "".$current.$revision""; with freebsd-elf setglobal major = "".$current"" setglobal versuffix = "".$current""; with irix | nonstopux setglobal major = $[expr $current - $age + 1] match $version_type { with nonstopux setglobal verstring_prefix = 'nonstopux' with * setglobal verstring_prefix = 'sgi' } setglobal verstring = ""$verstring_prefix$major.$revision"" # Add in all the interfaces that we are compatible with. setglobal loop = $revision while test $loop -ne 0 { setglobal iface = $[expr $revision - $loop] setglobal loop = $[expr $loop - 1] setglobal verstring = ""$verstring_prefix$major.$iface:$verstring"" } # Before this point, $major must not contain `.'. setglobal major = ".$major" setglobal versuffix = ""$major.$revision"" with linux setglobal major = ".$[expr $current - $age]" setglobal versuffix = ""$major.$age.$revision"" with osf setglobal major = ".$[expr $current - $age]" setglobal versuffix = "".$current.$age.$revision"" setglobal verstring = ""$current.$age.$revision"" # Add in all the interfaces that we are compatible with. setglobal loop = $age while test $loop -ne 0 { setglobal iface = $[expr $current - $loop] setglobal loop = $[expr $loop - 1] setglobal verstring = ""$verstring:$(iface).0"" } # Make executables depend on our current version. setglobal verstring = ""$verstring:$(current).0"" with sunos setglobal major = "".$current"" setglobal versuffix = "".$current.$revision"" with windows # Use '-' rather than '.', since we only want one # extension on DOS 8.3 filesystems. setglobal major = $[expr $current - $age] setglobal versuffix = ""-$major"" with * $echo "$modename: unknown library version type \`$version_type'" !1 > !2 $echo "Fatal configuration error. See the $PACKAGE docs for more information." !1 > !2 exit $EXIT_FAILURE } # Clear the version info if we defaulted, and they specified a release. if test -z $vinfo && test -n $release { setglobal major = '' match $version_type { with darwin # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely setglobal verstring = '' with * setglobal verstring = '"0.0'" } if test $need_version = no { setglobal versuffix = '' } else { setglobal versuffix = '".0.0'" } } # Remove version info from name if versioning should be avoided if test $avoid_version = yes && test $need_version = no { setglobal major = '' setglobal versuffix = '' setglobal verstring = ''"" } # Check to see if the archive will have undefined symbols. if test $allow_undefined = yes { if test $allow_undefined_flag = unsupported { $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" !1 > !2 setglobal build_libtool_libs = 'no' setglobal build_old_libs = 'yes' } } else { # Don't allow undefined symbols. setglobal allow_undefined_flag = $no_undefined_flag } } if test $mode != relink { # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. setglobal removelist = '' setglobal tempremovelist = $[$echo "$output_objdir/*] for p in [$tempremovelist] { match $p { with *.$objext with $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.* if test "X$precious_files_regex" != "X" { if echo $p | $EGREP -e $precious_files_regex >/dev/null !2 > !1 { continue } } setglobal removelist = ""$removelist $p"" with * } } if test -n $removelist { $show "$(rm)r $removelist" $run $(rm)r $removelist } } # Now set the variables for building old libraries. if test $build_old_libs = yes && test $build_libtool_libs != convenience { setglobal oldlibs = ""$oldlibs $output_objdir/$libname.$libext"" # Transform .lo files to .o files. setglobal oldobjs = ""$objs "$[$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'$(libext)'$/d' -e $lo2o | $NL2SP]" } # Eliminate all temporary directories. for path in [$notinst_path] { setglobal lib_search_path = $[$echo "$lib_search_path " | $(SED) -e "s% $path % %g] setglobal deplibs = $[$echo "$deplibs " | $(SED) -e "s% -L$path % %g] setglobal dependency_libs = $[$echo "$dependency_libs " | $(SED) -e "s% -L$path % %g] } if test -n $xrpath { # If the user specified any rpath flags, then add them. setglobal temp_xrpath = '' for libdir in [$xrpath] { setglobal temp_xrpath = ""$temp_xrpath -R$libdir"" match "$finalize_rpath " { with *" $libdir "* with * setglobal finalize_rpath = ""$finalize_rpath $libdir"" } } if test $hardcode_into_libs != yes || test $build_old_libs = yes { setglobal dependency_libs = ""$temp_xrpath $dependency_libs"" } } # Make sure dlfiles contains only unique files that won't be dlpreopened setglobal old_dlfiles = $dlfiles setglobal dlfiles = '' for lib in [$old_dlfiles] { match " $dlprefiles $dlfiles " { with *" $lib "* with * setglobal dlfiles = ""$dlfiles $lib"" } } # Make sure dlprefiles contains only unique files setglobal old_dlprefiles = $dlprefiles setglobal dlprefiles = '' for lib in [$old_dlprefiles] { match "$dlprefiles " { with *" $lib "* with * setglobal dlprefiles = ""$dlprefiles $lib"" } } if test $build_libtool_libs = yes { if test -n $rpath { match $host { with *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* # these systems don't actually have a c library (as such)! with *-*-rhapsody* | *-*-darwin1.[012] # Rhapsody C library is in the System framework setglobal deplibs = ""$deplibs -framework System"" with *-*-netbsd* # Don't link with libc until the a.out ld.so is fixed. with *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* # Do not include libc due to us having libc/libc_r. with *-*-sco3.2v5* | *-*-sco5v6* # Causes problems with __ctype with *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX* # Compiler inserts libc in the correct place for threads to work with * # Add libc to deplibs on all other systems if necessary. if test $build_libtool_need_lc = "yes" { setglobal deplibs = ""$deplibs -lc"" } } } # Transform deplibs into only deplibs that can be linked in shared. setglobal name_save = $name setglobal libname_save = $libname setglobal release_save = $release setglobal versuffix_save = $versuffix setglobal major_save = $major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? setglobal release = ''"" setglobal versuffix = ''"" setglobal major = ''"" setglobal newdeplibs = '' setglobal droppeddeps = 'no' match $deplibs_check_method { with pass_all # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. setglobal newdeplibs = $deplibs with test_compile # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $rm conftest.c cat > conftest.c << """ int main() { return 0; } """ $rm conftest $LTCC $LTCFLAGS -o conftest conftest.c $deplibs if test "$Status" -eq 0 { setglobal ldd_output = $[ldd conftest] for i in [$deplibs] { setglobal name = $[expr $i : '-l\(.*\)] # If $name is empty we are operating on a -L argument. if test $name != "" && test $name -ne "0" { if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" { match " $predeps $postdeps " { with *" $i "* setglobal newdeplibs = ""$newdeplibs $i"" setglobal i = ''"" } } if test -n $i { setglobal libname = $[eval '\'$echo '"'$libname_spec'"'] setglobal deplib_matches = $[eval '\'$echo '"'$library_names_spec'"'] set dummy $deplib_matches setglobal deplib_match = $2 if test $[expr $ldd_output : ".*$deplib_match] -ne 0 { setglobal newdeplibs = ""$newdeplibs $i"" } else { setglobal droppeddeps = 'yes' $echo $echo "*** Warning: dynamic linker does not accept needed library $i." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which I believe you do not have" $echo "*** because a test_compile did reveal that the linker did not use it for" $echo "*** its dynamic dependency list that programs get resolved with at runtime." } } } else { setglobal newdeplibs = ""$newdeplibs $i"" } } } else { # Error occurred in the first compile. Let's try to salvage # the situation: Compile a separate program for each library. for i in [$deplibs] { setglobal name = $[expr $i : '-l\(.*\)] # If $name is empty we are operating on a -L argument. if test $name != "" && test $name != "0" { $rm conftest $LTCC $LTCFLAGS -o conftest conftest.c $i # Did it work? if test "$Status" -eq 0 { setglobal ldd_output = $[ldd conftest] if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" { match " $predeps $postdeps " { with *" $i "* setglobal newdeplibs = ""$newdeplibs $i"" setglobal i = ''"" } } if test -n $i { setglobal libname = $[eval '\'$echo '"'$libname_spec'"'] setglobal deplib_matches = $[eval '\'$echo '"'$library_names_spec'"'] set dummy $deplib_matches setglobal deplib_match = $2 if test $[expr $ldd_output : ".*$deplib_match] -ne 0 { setglobal newdeplibs = ""$newdeplibs $i"" } else { setglobal droppeddeps = 'yes' $echo $echo "*** Warning: dynamic linker does not accept needed library $i." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because a test_compile did reveal that the linker did not use this one" $echo "*** as a dynamic dependency that programs can get resolved with at runtime." } } } else { setglobal droppeddeps = 'yes' $echo $echo "*** Warning! Library $i is needed by this library but I was not able to" $echo "*** make it link in! You will probably need to install it or some" $echo "*** library that it depends on before this library will be fully" $echo "*** functional. Installing it before continuing would be even better." } } else { setglobal newdeplibs = ""$newdeplibs $i"" } } } with file_magic* set dummy $deplibs_check_method setglobal file_magic_regex = $[expr $deplibs_check_method : "$2 \(.*\)] for a_deplib in [$deplibs] { setglobal name = $[expr $a_deplib : '-l\(.*\)] # If $name is empty we are operating on a -L argument. if test $name != "" && test $name != "0" { if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" { match " $predeps $postdeps " { with *" $a_deplib "* setglobal newdeplibs = ""$newdeplibs $a_deplib"" setglobal a_deplib = ''"" } } if test -n $a_deplib { setglobal libname = $[eval '\'$echo '"'$libname_spec'"'] for i in [$lib_search_path $sys_lib_search_path $shlib_search_path] { setglobal potential_libs = $[ls $i/$libname[.-]* !2 >/dev/null] for potent_lib in [$potential_libs] { # Follow soft links. if ls -lLd $potent_lib !2 >/dev/null \ | grep " -> " >/dev/null { continue } # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? setglobal potlib = $potent_lib while test -h $potlib !2 >/dev/null { setglobal potliblink = $[ls -ld $potlib | $(SED) 's/.* -> //] match $potliblink { with [\\/]* | [A-Za-z]:[\\/]* setglobal potlib = $potliblink with * setglobal potlib = "$[$echo "X$potlib" | $Xsed -e 's,[^/]*$,,]"$potliblink"" } } if eval $file_magic_cmd '"''$'potlib'"' !2 >/dev/null \ | $(SED) 10q \ | $EGREP $file_magic_regex > /dev/null { setglobal newdeplibs = ""$newdeplibs $a_deplib"" setglobal a_deplib = ''"" break 2 } } } } if test -n $a_deplib { setglobal droppeddeps = 'yes' $echo $echo "*** Warning: linker path does not have real file for library $a_deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because I did check the linker path looking for a file starting" if test -z $potlib { $echo "*** with $libname but no candidates were found. (...for file magic test)" } else { $echo "*** with $libname and none of the candidates passed a file format test" $echo "*** using a file magic. Last file checked: $potlib" } } } else { # Add a -L argument. setglobal newdeplibs = ""$newdeplibs $a_deplib"" } } # Gone through all deplibs. with match_pattern* set dummy $deplibs_check_method setglobal match_pattern_regex = $[expr $deplibs_check_method : "$2 \(.*\)] for a_deplib in [$deplibs] { setglobal name = $[expr $a_deplib : '-l\(.*\)] # If $name is empty we are operating on a -L argument. if test -n $name && test $name != "0" { if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" { match " $predeps $postdeps " { with *" $a_deplib "* setglobal newdeplibs = ""$newdeplibs $a_deplib"" setglobal a_deplib = ''"" } } if test -n $a_deplib { setglobal libname = $[eval '\'$echo '"'$libname_spec'"'] for i in [$lib_search_path $sys_lib_search_path $shlib_search_path] { setglobal potential_libs = $[ls $i/$libname[.-]* !2 >/dev/null] for potent_lib in [$potential_libs] { setglobal potlib = $potent_lib # see symlink-check above in file_magic test if eval $echo '"'$potent_lib'"' !2 >/dev/null \ | $(SED) 10q \ | $EGREP $match_pattern_regex > /dev/null { setglobal newdeplibs = ""$newdeplibs $a_deplib"" setglobal a_deplib = ''"" break 2 } } } } if test -n $a_deplib { setglobal droppeddeps = 'yes' $echo $echo "*** Warning: linker path does not have real file for library $a_deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because I did check the linker path looking for a file starting" if test -z $potlib { $echo "*** with $libname but no candidates were found. (...for regex pattern test)" } else { $echo "*** with $libname and none of the candidates passed a file format test" $echo "*** using a regex pattern. Last file checked: $potlib" } } } else { # Add a -L argument. setglobal newdeplibs = ""$newdeplibs $a_deplib"" } } # Gone through all deplibs. with none | unknown | * setglobal newdeplibs = ''"" setglobal tmp_deplibs = $[$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ -e 's/ -[LR][^ ]*//g] if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" { for i in [$predeps $postdeps] { # can't use Xsed below, because $i might contain '/' setglobal tmp_deplibs = $[$echo "X $tmp_deplibs" | $(SED) -e "1s,^X,," -e "s,$i,,] } } if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ | grep . >/dev/null { $echo if test "X$deplibs_check_method" = "Xnone" { $echo "*** Warning: inter-library dependencies are not supported in this platform." } else { $echo "*** Warning: inter-library dependencies are not known to be supported." } $echo "*** All declared inter-library dependencies are being dropped." setglobal droppeddeps = 'yes' } } setglobal versuffix = $versuffix_save setglobal major = $major_save setglobal release = $release_save setglobal libname = $libname_save setglobal name = $name_save match $host { with *-*-rhapsody* | *-*-darwin1.[012] # On Rhapsody replace the C library is the System framework setglobal newdeplibs = $[$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /] } if test $droppeddeps = yes { if test $module = yes { $echo $echo "*** Warning: libtool could not satisfy all declared inter-library" $echo "*** dependencies of module $libname. Therefore, libtool will create" $echo "*** a static module, that should work as long as the dlopening" $echo "*** application is linked with the -dlopen flag." if test -z $global_symbol_pipe { $echo $echo "*** However, this would only work if libtool was able to extract symbol" $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" $echo "*** not find such a program. So, this module is probably useless." $echo "*** \`nm' from GNU binutils and a full rebuild may help." } if test $build_old_libs = no { setglobal oldlibs = ""$output_objdir/$libname.$libext"" setglobal build_libtool_libs = 'module' setglobal build_old_libs = 'yes' } else { setglobal build_libtool_libs = 'no' } } else { $echo "*** The inter-library dependencies that have been dropped here will be" $echo "*** automatically added whenever a program is linked with this library" $echo "*** or is declared to -dlopen it." if test $allow_undefined = no { $echo $echo "*** Since this library must not contain undefined symbols," $echo "*** because either the platform does not support them or" $echo "*** it was explicitly requested with -no-undefined," $echo "*** libtool will only create a static version of it." if test $build_old_libs = no { setglobal oldlibs = ""$output_objdir/$libname.$libext"" setglobal build_libtool_libs = 'module' setglobal build_old_libs = 'yes' } else { setglobal build_libtool_libs = 'no' } } } } # Done checking deplibs! setglobal deplibs = $newdeplibs } # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list setglobal new_libs = '' for path in [$notinst_path] { match " $new_libs " { with *" -L$path/$objdir "* with * match " $deplibs " { with *" -L$path/$objdir "* setglobal new_libs = ""$new_libs -L$path/$objdir"" } } } for deplib in [$deplibs] { match $deplib { with -L* match " $new_libs " { with *" $deplib "* with * setglobal new_libs = ""$new_libs $deplib"" } with * setglobal new_libs = ""$new_libs $deplib"" } } setglobal deplibs = $new_libs # All the library-specific variables (install_libdir is set above). setglobal library_names = '' setglobal old_library = '' setglobal dlname = '' # Test again, we may have decided not to build it any more if test $build_libtool_libs = yes { if test $hardcode_into_libs = yes { # Hardcode the library paths setglobal hardcode_libdirs = '' setglobal dep_rpath = '' setglobal rpath = $finalize_rpath test $mode != relink && setglobal rpath = ""$compile_rpath$rpath"" for libdir in [$rpath] { if test -n $hardcode_libdir_flag_spec { if test -n $hardcode_libdir_separator { if test -z $hardcode_libdirs { setglobal hardcode_libdirs = $libdir } else { # Just accumulate the unique libdirs. match $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator { with *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"* with * setglobal hardcode_libdirs = ""$hardcode_libdirs$hardcode_libdir_separator$libdir"" } } } else { eval flag='"'$hardcode_libdir_flag_spec'"' setglobal dep_rpath = ""$dep_rpath $flag"" } } elif test -n $runpath_var { match "$perm_rpath " { with *" $libdir "* with * setglobal perm_rpath = ""$perm_rpath $libdir"" } } } # Substitute the hardcoded libdirs into the rpath. if test -n $hardcode_libdir_separator && test -n $hardcode_libdirs { setglobal libdir = $hardcode_libdirs if test -n $hardcode_libdir_flag_spec_ld { eval dep_rpath='"'$hardcode_libdir_flag_spec_ld'"' } else { eval dep_rpath='"'$hardcode_libdir_flag_spec'"' } } if test -n $runpath_var && test -n $perm_rpath { # We should set the runpath_var. setglobal rpath = '' for dir in [$perm_rpath] { setglobal rpath = ""$rpath$dir:"" } eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" } test -n $dep_rpath && setglobal deplibs = ""$dep_rpath $deplibs"" } setglobal shlibpath = $finalize_shlibpath test $mode != relink && setglobal shlibpath = ""$compile_shlibpath$shlibpath"" if test -n $shlibpath { eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" } # Get the real and link names of the library. eval shared_ext='"'$shrext_cmds'"' eval library_names='"'$library_names_spec'"' set dummy $library_names setglobal realname = $2 shift; shift if test -n $soname_spec { eval soname='"'$soname_spec'"' } else { setglobal soname = $realname } if test -z $dlname { setglobal dlname = $soname } setglobal lib = ""$output_objdir/$realname"" setglobal linknames = ''for link in @Argv { setglobal linknames = ""$linknames $link"" } # Use standard objects if they are pic test -z $pic_flag && setglobal libobjs = $[$echo "X$libobjs" | $SP2NL | $Xsed -e $lo2o | $NL2SP] # Prepare the list of exported symbols if test -z $export_symbols { if test $always_export_symbols = yes || test -n $export_symbols_regex { $show "generating symbol list for \`$libname.la'" setglobal export_symbols = ""$output_objdir/$libname.exp"" $run $rm $export_symbols setglobal cmds = $export_symbols_cmds setglobal save_ifs = $IFS; setglobal IFS = ''~'' for cmd in [$cmds] { setglobal IFS = $save_ifs eval cmd='"'$cmd'"' if setglobal len = $[expr "X$cmd" : ".*] && test $len -le $max_cmd_len || test $max_cmd_len -le -1 { $show $cmd $run eval $cmd || exit $? setglobal skipped_export = 'false' } else { # The command line is too long to execute in one step. $show "using reloadable object file for export list..." setglobal skipped_export = ':' # Break out early, otherwise skipped_export may be # set to false by a later but shorter cmd. break } } setglobal IFS = $save_ifs if test -n $export_symbols_regex { $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"$(export_symbols)T\"" $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' $show "$mv \"$(export_symbols)T\" \"$export_symbols\"" $run eval '$mv "${export_symbols}T" "$export_symbols"' } } } if test -n $export_symbols && test -n $include_expsyms { $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' } setglobal tmp_deplibs = '' for test_deplib in [$deplibs] { match " $convenience " { with *" $test_deplib "* with * setglobal tmp_deplibs = ""$tmp_deplibs $test_deplib"" } } setglobal deplibs = $tmp_deplibs if test -n $convenience { if test -n $whole_archive_flag_spec { setglobal save_libobjs = $libobjs eval libobjs='"''$'libobjs $whole_archive_flag_spec'"' } else { setglobal gentop = ""$output_objdir/$(outputname)x"" setglobal generated = ""$generated $gentop"" func_extract_archives $gentop $convenience setglobal libobjs = ""$libobjs $func_extract_archives_result"" } } if test $thread_safe = yes && test -n $thread_safe_flag_spec { eval flag='"'$thread_safe_flag_spec'"' setglobal linker_flags = ""$linker_flags $flag"" } # Make a backup of the uninstalled library when relinking if test $mode = relink { $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? } # Do each of the archive commands. if test $module = yes && test -n $module_cmds { if test -n $export_symbols && test -n $module_expsym_cmds { eval test_cmds='"'$module_expsym_cmds'"' setglobal cmds = $module_expsym_cmds } else { eval test_cmds='"'$module_cmds'"' setglobal cmds = $module_cmds } } else { if test -n $export_symbols && test -n $archive_expsym_cmds { eval test_cmds='"'$archive_expsym_cmds'"' setglobal cmds = $archive_expsym_cmds } else { eval test_cmds='"'$archive_cmds'"' setglobal cmds = $archive_cmds } } if test "X$skipped_export" != "X:" && setglobal len = $[expr "X$test_cmds" : ".*" !2 >/dev/null] && test $len -le $max_cmd_len || test $max_cmd_len -le -1 { : } else { # The command line is too long to link in one step, link piecewise. $echo "creating reloadable object files..." # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z $convenience || test -z $whole_archive_flag_spec { setglobal save_libobjs = $libobjs } setglobal save_output = $output setglobal output_la = $[$echo "X$output" | $Xsed -e $basename] # Clear the reloadable object creation command queue and # initialize k to one. setglobal test_cmds = '' setglobal concat_cmds = '' setglobal objlist = '' setglobal delfiles = '' setglobal last_robj = '' setglobal k = '1' setglobal output = "$output_objdir/$output_la-$(k).$objext" # Loop over the list of objects to be linked. for obj in [$save_libobjs] { eval test_cmds='"'$reload_cmds $objlist $last_robj'"' if test "X$objlist" = X || do { setglobal len = $[expr "X$test_cmds" : ".*" !2 >/dev/null] && test $len -le $max_cmd_len; } { setglobal objlist = ""$objlist $obj"" } else { # The command $test_cmds is almost too long, add a # command to the queue. if test $k -eq 1 { # The first file doesn't have a previous command to add. eval concat_cmds='"'$reload_cmds $objlist $last_robj'"' } else { # All subsequent reloadable object files will link in # the last one created. eval concat_cmds='"''$'concat_cmds~$reload_cmds $objlist $last_robj'"' } setglobal last_robj = "$output_objdir/$output_la-$(k).$objext" setglobal k = $[expr $k + 1] setglobal output = "$output_objdir/$output_la-$(k).$objext" setglobal objlist = $obj setglobal len = '1' } } # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z $concat_cmds || setglobal concat_cmds = "$concat_cmds~" eval concat_cmds='"''$'{concat_cmds}$reload_cmds $objlist $last_robj'"' if $(skipped_export-false) { $show "generating symbol list for \`$libname.la'" setglobal export_symbols = ""$output_objdir/$libname.exp"" $run $rm $export_symbols setglobal libobjs = $output # Append the command to create the export file. eval concat_cmds='"''$'concat_cmds~$export_symbols_cmds'"' } # Set up a command to remove the reloadable object files # after they are used. setglobal i = '0' while test "$i" -lt "$k" { setglobal i = $[expr $i + 1] setglobal delfiles = ""$delfiles $output_objdir/$output_la-$(i).$objext"" } $echo "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. setglobal save_ifs = $IFS; setglobal IFS = ''~'' for cmd in [$concat_cmds] { setglobal IFS = $save_ifs $show $cmd $run eval $cmd || exit $? } setglobal IFS = $save_ifs setglobal libobjs = $output # Restore the value of output. setglobal output = $save_output if test -n $convenience && test -n $whole_archive_flag_spec { eval libobjs='"''$'libobjs $whole_archive_flag_spec'"' } # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test $module = yes && test -n $module_cmds { if test -n $export_symbols && test -n $module_expsym_cmds { setglobal cmds = $module_expsym_cmds } else { setglobal cmds = $module_cmds } } else { if test -n $export_symbols && test -n $archive_expsym_cmds { setglobal cmds = $archive_expsym_cmds } else { setglobal cmds = $archive_cmds } } # Append the command to remove the reloadable object files # to the just-reset $cmds. eval cmds='"''$'cmds~'$'rm $delfiles'"' } setglobal save_ifs = $IFS; setglobal IFS = ''~'' for cmd in [$cmds] { setglobal IFS = $save_ifs eval cmd='"'$cmd'"' $show $cmd $run eval $cmd || do { setglobal lt_exit = $Status # Restore the uninstalled library and exit if test $mode = relink { $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' } exit $lt_exit } } setglobal IFS = $save_ifs # Restore the uninstalled library and exit if test $mode = relink { $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? if test -n $convenience { if test -z $whole_archive_flag_spec { $show "$(rm)r $gentop" $run $(rm)r $gentop } } exit $EXIT_SUCCESS } # Create links to the real library. for linkname in [$linknames] { if test $realname != $linkname { $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? } } # If -module or -export-dynamic was specified, set the dlname. if test $module = yes || test $export_dynamic = yes { # On all known operating systems, these are identical. setglobal dlname = $soname } } with obj if test -n $deplibs { $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" !1 > !2 } if test -n "$dlfiles$dlprefiles" || test $dlself != no { $echo "$modename: warning: \`-dlopen' is ignored for objects" !1 > !2 } if test -n $rpath { $echo "$modename: warning: \`-rpath' is ignored for objects" !1 > !2 } if test -n $xrpath { $echo "$modename: warning: \`-R' is ignored for objects" !1 > !2 } if test -n $vinfo { $echo "$modename: warning: \`-version-info' is ignored for objects" !1 > !2 } if test -n $release { $echo "$modename: warning: \`-release' is ignored for objects" !1 > !2 } match $output { with *.lo if test -n "$objs$old_deplibs" { $echo "$modename: cannot build library object \`$output' from non-libtool objects" !1 > !2 exit $EXIT_FAILURE } setglobal libobj = $output setglobal obj = $[$echo "X$output" | $Xsed -e $lo2o] with * setglobal libobj = '' setglobal obj = $output } # Delete the old objects. $run $rm $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. setglobal reload_conv_objs = '' setglobal gentop = '' # reload_cmds runs $LD directly, so let us get rid of # -Wl from whole_archive_flag_spec setglobal wl = '' if test -n $convenience { if test -n $whole_archive_flag_spec { eval reload_conv_objs='"''$'reload_objs $whole_archive_flag_spec'"' } else { setglobal gentop = ""$output_objdir/$(obj)x"" setglobal generated = ""$generated $gentop"" func_extract_archives $gentop $convenience setglobal reload_conv_objs = ""$reload_objs $func_extract_archives_result"" } } # Create the old-style object. setglobal reload_objs = ""$objs$old_deplibs "$[$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'$(libext)$'/d' -e '/\.lib$/d' -e $lo2o | $NL2SP]" $reload_conv_objs"" ### testsuite: skip nested quoting test setglobal output = $obj setglobal cmds = $reload_cmds setglobal save_ifs = $IFS; setglobal IFS = ''~'' for cmd in [$cmds] { setglobal IFS = $save_ifs eval cmd='"'$cmd'"' $show $cmd $run eval $cmd || exit $? } setglobal IFS = $save_ifs # Exit if we aren't doing a library object file. if test -z $libobj { if test -n $gentop { $show "$(rm)r $gentop" $run $(rm)r $gentop } exit $EXIT_SUCCESS } if test $build_libtool_libs != yes { if test -n $gentop { $show "$(rm)r $gentop" $run $(rm)r $gentop } # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $run eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS } if test -n $pic_flag || test $pic_mode != default { # Only do commands if we really have different PIC objects. setglobal reload_objs = ""$libobjs $reload_conv_objs"" setglobal output = $libobj setglobal cmds = $reload_cmds setglobal save_ifs = $IFS; setglobal IFS = ''~'' for cmd in [$cmds] { setglobal IFS = $save_ifs eval cmd='"'$cmd'"' $show $cmd $run eval $cmd || exit $? } setglobal IFS = $save_ifs } if test -n $gentop { $show "$(rm)r $gentop" $run $(rm)r $gentop } exit $EXIT_SUCCESS with prog match $host { with *cygwin* setglobal output = $[$echo $output | $(SED) -e 's,.exe$,,;s,$,.exe,] } if test -n $vinfo { $echo "$modename: warning: \`-version-info' is ignored for programs" !1 > !2 } if test -n $release { $echo "$modename: warning: \`-release' is ignored for programs" !1 > !2 } if test $preload = yes { if test $dlopen_support = unknown && test $dlopen_self = unknown && test $dlopen_self_static = unknown { $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." } } match $host { with *-*-rhapsody* | *-*-darwin1.[012] # On Rhapsody replace the C library is the System framework setglobal compile_deplibs = $[$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /] setglobal finalize_deplibs = $[$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /] } match $host { with *darwin* # Don't allow lazy linking, it breaks C++ global constructors if test $tagname = CXX { setglobal compile_command = ""$compile_command $(wl)-bind_at_load"" setglobal finalize_command = ""$finalize_command $(wl)-bind_at_load"" } } # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list setglobal new_libs = '' for path in [$notinst_path] { match " $new_libs " { with *" -L$path/$objdir "* with * match " $compile_deplibs " { with *" -L$path/$objdir "* setglobal new_libs = ""$new_libs -L$path/$objdir"" } } } for deplib in [$compile_deplibs] { match $deplib { with -L* match " $new_libs " { with *" $deplib "* with * setglobal new_libs = ""$new_libs $deplib"" } with * setglobal new_libs = ""$new_libs $deplib"" } } setglobal compile_deplibs = $new_libs setglobal compile_command = ""$compile_command $compile_deplibs"" setglobal finalize_command = ""$finalize_command $finalize_deplibs"" if test -n "$rpath$xrpath" { # If the user specified any rpath flags, then add them. for libdir in [$rpath $xrpath] { # This is the magic to use -rpath. match "$finalize_rpath " { with *" $libdir "* with * setglobal finalize_rpath = ""$finalize_rpath $libdir"" } } } # Now hardcode the library paths setglobal rpath = '' setglobal hardcode_libdirs = '' for libdir in [$compile_rpath $finalize_rpath] { if test -n $hardcode_libdir_flag_spec { if test -n $hardcode_libdir_separator { if test -z $hardcode_libdirs { setglobal hardcode_libdirs = $libdir } else { # Just accumulate the unique libdirs. match $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator { with *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"* with * setglobal hardcode_libdirs = ""$hardcode_libdirs$hardcode_libdir_separator$libdir"" } } } else { eval flag='"'$hardcode_libdir_flag_spec'"' setglobal rpath = ""$rpath $flag"" } } elif test -n $runpath_var { match "$perm_rpath " { with *" $libdir "* with * setglobal perm_rpath = ""$perm_rpath $libdir"" } } match $host { with *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* setglobal testbindir = $[$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*] match :$dllsearchpath: { with *":$libdir:"* with * setglobal dllsearchpath = ""$dllsearchpath:$libdir"" } match :$dllsearchpath: { with *":$testbindir:"* with * setglobal dllsearchpath = ""$dllsearchpath:$testbindir"" } } } # Substitute the hardcoded libdirs into the rpath. if test -n $hardcode_libdir_separator && test -n $hardcode_libdirs { setglobal libdir = $hardcode_libdirs eval rpath='"' $hardcode_libdir_flag_spec'"' } setglobal compile_rpath = $rpath setglobal rpath = '' setglobal hardcode_libdirs = '' for libdir in [$finalize_rpath] { if test -n $hardcode_libdir_flag_spec { if test -n $hardcode_libdir_separator { if test -z $hardcode_libdirs { setglobal hardcode_libdirs = $libdir } else { # Just accumulate the unique libdirs. match $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator { with *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"* with * setglobal hardcode_libdirs = ""$hardcode_libdirs$hardcode_libdir_separator$libdir"" } } } else { eval flag='"'$hardcode_libdir_flag_spec'"' setglobal rpath = ""$rpath $flag"" } } elif test -n $runpath_var { match "$finalize_perm_rpath " { with *" $libdir "* with * setglobal finalize_perm_rpath = ""$finalize_perm_rpath $libdir"" } } } # Substitute the hardcoded libdirs into the rpath. if test -n $hardcode_libdir_separator && test -n $hardcode_libdirs { setglobal libdir = $hardcode_libdirs eval rpath='"' $hardcode_libdir_flag_spec'"' } setglobal finalize_rpath = $rpath if test -n $libobjs && test $build_old_libs = yes { # Transform all the library objects into standard objects. setglobal compile_command = $[$echo "X$compile_command" | $SP2NL | $Xsed -e $lo2o | $NL2SP] setglobal finalize_command = $[$echo "X$finalize_command" | $SP2NL | $Xsed -e $lo2o | $NL2SP] } setglobal dlsyms = '' if test -n "$dlfiles$dlprefiles" || test $dlself != no { if test -n $NM && test -n $global_symbol_pipe { setglobal dlsyms = ""$(outputname)S.c"" } else { $echo "$modename: not configured to extract global symbols from dlpreopened files" !1 > !2 } } if test -n $dlsyms { match $dlsyms { with "" with *.c # Discover the nlist of each of the dlfiles. setglobal nlist = ""$output_objdir/$(outputname).nm"" $show "$rm $nlist $(nlist)S $(nlist)T" $run $rm $nlist "$(nlist)S" "$(nlist)T" # Parse the name list into a source file. $show "creating $output_objdir/$dlsyms" test -z $run && $echo > "$output_objdir/$dlsyms" "\ /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ #ifdef __cplusplus extern \"C\" { #endif /* Prevent the only kind of declaration conflicts we can make. */ #define lt_preloaded_symbols some_other_symbol /* External symbol declarations for the compiler. */> "$output_objdir/$dlsyms" "\ /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ #ifdef __cplusplus extern \"C\" { #endif /* Prevent the only kind of declaration conflicts we can make. */ #define lt_preloaded_symbols some_other_symbol /* External symbol declarations for the compiler. */\ " if test $dlself = yes { $show "generating symbol list for \`$output'" test -z $run && $echo ': @PROGRAM@ ' > $nlist # Add our own program objects to the symbol list. setglobal progfiles = $[$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e $lo2o | $NL2SP] for arg in [$progfiles] { $show "extracting global C symbols from \`$arg'" $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" } if test -n $exclude_expsyms { $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' } if test -n $export_symbols_regex { $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' } # Prepare the list of exported symbols if test -z $export_symbols { setglobal export_symbols = ""$output_objdir/$outputname.exp"" $run $rm $export_symbols $run eval "$(SED) -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' match $host { with *cygwin* | *mingw* $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' } } else { $run eval "$(SED) -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' $run eval 'mv "$nlist"T "$nlist"' match $host { with *cygwin* | *mingw* $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' } } } for arg in [$dlprefiles] { $show "extracting global C symbols from \`$arg'" setglobal name = $[$echo $arg | $(SED) -e 's%^.*/%%] $run eval '$echo ": $name " >> "$nlist"' $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" } if test -z $run { # Make sure we have at least an empty file. test -f $nlist || : > $nlist if test -n $exclude_expsyms { $EGREP -v " ($exclude_expsyms)$" $nlist > "$nlist"T $mv "$nlist"T $nlist } # Try sorting and uniquifying the output. if grep -v "^: " < $nlist | if sort -k 3 /dev/null !2 > !1 { sort -k 3 } else { sort +2 } | uniq > "$nlist"S { : } else { grep -v "^: " < $nlist > "$nlist"S } if test -f "$nlist"S { eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' } else { $echo '/* NONE */' >> "$output_objdir/$dlsyms" } $echo >> "$output_objdir/$dlsyms" "\ #undef lt_preloaded_symbols #if defined (__STDC__) && __STDC__ # define lt_ptr void * #else # define lt_ptr char * # define const #endif /* The mapping between symbol names and symbols. */ >> "$output_objdir/$dlsyms" "\ #undef lt_preloaded_symbols #if defined (__STDC__) && __STDC__ # define lt_ptr void * #else # define lt_ptr char * # define const #endif /* The mapping between symbol names and symbols. */ " match $host { with *cygwin* | *mingw* $echo >> "$output_objdir/$dlsyms" "\ /* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs */ struct { >> "$output_objdir/$dlsyms" "\ /* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs */ struct { " with * $echo >> "$output_objdir/$dlsyms" "\ const struct { >> "$output_objdir/$dlsyms" "\ const struct { " } $echo >> "$output_objdir/$dlsyms" "\ const char *name; lt_ptr address; } lt_preloaded_symbols[] = {>> "$output_objdir/$dlsyms" "\ const char *name; lt_ptr address; } lt_preloaded_symbols[] = {\ " eval $global_symbol_to_c_name_address < $nlist >> "$output_objdir/$dlsyms" $echo >> "$output_objdir/$dlsyms" "\ {0, (lt_ptr) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_preloaded_symbols; } #endif #ifdef __cplusplus } #endif>> "$output_objdir/$dlsyms" "\ {0, (lt_ptr) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " } setglobal pic_flag_for_symtable = '' match $host { # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. with *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0* match "$compile_command " { with *" -static "* with * setglobal pic_flag_for_symtable = "" $pic_flag -DFREEBSD_WORKAROUND"" } with *-*-hpux* match "$compile_command " { with *" -static "* with * setglobal pic_flag_for_symtable = "" $pic_flag"" } } # Now compile the dynamic symbol file. $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? # Clean up the generated files. $show "$rm $output_objdir/$dlsyms $nlist $(nlist)S $(nlist)T" $run $rm "$output_objdir/$dlsyms" $nlist "$(nlist)S" "$(nlist)T" # Transform the symbol file into the correct name. match $host { with *cygwin* | *mingw* if test -f "$output_objdir/$(outputname).def" { setglobal compile_command = $[$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$(outputname).def $output_objdir/$(outputname)S.$(objext)%] setglobal finalize_command = $[$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$(outputname).def $output_objdir/$(outputname)S.$(objext)%] } else { setglobal compile_command = $[$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$(outputname)S.$(objext)%] setglobal finalize_command = $[$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$(outputname)S.$(objext)%] } with * setglobal compile_command = $[$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$(outputname)S.$(objext)%] setglobal finalize_command = $[$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$(outputname)S.$(objext)%] } with * $echo "$modename: unknown suffix for \`$dlsyms'" !1 > !2 exit $EXIT_FAILURE } } else { # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. setglobal compile_command = $[$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%] setglobal finalize_command = $[$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%] } if test $need_relink = no || test $build_libtool_libs != yes { # Replace the output file specification. setglobal compile_command = $[$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g] setglobal link_command = ""$compile_command$compile_rpath"" # We have no uninstalled library dependencies, so finalize right now. $show $link_command $run eval $link_command setglobal exit_status = $Status # Delete the generated files. if test -n $dlsyms { $show "$rm $output_objdir/$(outputname)S.$(objext)" $run $rm "$output_objdir/$(outputname)S.$(objext)" } exit $exit_status } if test -n $shlibpath_var { # We should set the shlibpath_var setglobal rpath = '' for dir in [$temp_rpath] { match $dir { with [\\/]* | [A-Za-z]:[\\/]* # Absolute path. setglobal rpath = ""$rpath$dir:"" with * # Relative path: add a thisdir entry. setglobal rpath = ""$rpath\$thisdir/$dir:"" } } setglobal temp_rpath = $rpath } if test -n "$compile_shlibpath$finalize_shlibpath" { setglobal compile_command = ""$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"" } if test -n $finalize_shlibpath { setglobal finalize_command = ""$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"" } setglobal compile_var = '' setglobal finalize_var = '' if test -n $runpath_var { if test -n $perm_rpath { # We should set the runpath_var. setglobal rpath = '' for dir in [$perm_rpath] { setglobal rpath = ""$rpath$dir:"" } setglobal compile_var = ""$runpath_var=\"$rpath\$$runpath_var\" "" } if test -n $finalize_perm_rpath { # We should set the runpath_var. setglobal rpath = '' for dir in [$finalize_perm_rpath] { setglobal rpath = ""$rpath$dir:"" } setglobal finalize_var = ""$runpath_var=\"$rpath\$$runpath_var\" "" } } if test $no_install = yes { # We don't need to create a wrapper script. setglobal link_command = ""$compile_var$compile_command$compile_rpath"" # Replace the output file specification. setglobal link_command = $[$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g] # Delete the old output file. $run $rm $output # Link the executable and exit $show $link_command $run eval $link_command || exit $? exit $EXIT_SUCCESS } if test $hardcode_action = relink { # Fast installation is not supported setglobal link_command = ""$compile_var$compile_command$compile_rpath"" setglobal relink_command = ""$finalize_var$finalize_command$finalize_rpath"" $echo "$modename: warning: this platform does not like uninstalled shared libraries" !1 > !2 $echo "$modename: \`$output' will be relinked during installation" !1 > !2 } else { if test $fast_install != no { setglobal link_command = ""$finalize_var$compile_command$finalize_rpath"" if test $fast_install = yes { setglobal relink_command = $[$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g] } else { # fast_install is set to needless setglobal relink_command = '' } } else { setglobal link_command = ""$compile_var$compile_command$compile_rpath"" setglobal relink_command = ""$finalize_var$finalize_command$finalize_rpath"" } } # Replace the output file specification. setglobal link_command = $[$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g] # Delete the old output files. $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname $show $link_command $run eval $link_command || exit $? # Now create the wrapper script. $show "creating $output" # Quote the relink command for shipping. if test -n $relink_command { # Preserve any variables that may affect compiler behavior for var in [$variables_saved_for_relink] { if eval test -z '"''$'{$var+set}'"' { setglobal relink_command = ""{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"" } elif eval var_value='$'$var; test -z $var_value; { setglobal relink_command = ""$var=; export $var; $relink_command"" } else { setglobal var_value = $[$echo "X$var_value" | $Xsed -e $sed_quote_subst] setglobal relink_command = ""$var=\"$var_value\"; export $var; $relink_command"" } } setglobal relink_command = ""(cd $[pwd]; $relink_command)"" setglobal relink_command = $[$echo "X$relink_command" | $Xsed -e $sed_quote_subst] } # Quote $echo for shipping. if test "X$echo" = "X$SHELL $progpath --fallback-echo" { match $progpath { with [\\/]* | [A-Za-z]:[\\/]* setglobal qecho = ""$SHELL $progpath --fallback-echo"" with * setglobal qecho = ""$SHELL $[pwd]/$progpath --fallback-echo"" } setglobal qecho = $[$echo "X$qecho" | $Xsed -e $sed_quote_subst] } else { setglobal qecho = $[$echo "X$echo" | $Xsed -e $sed_quote_subst] } # Only actually do things if our run command is non-null. if test -z $run { # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. match $output { with *.exe setglobal output = $[$echo $output|$(SED) 's,.exe$,,] } # test for cygwin because mv fails w/o .exe extensions match $host { with *cygwin* setglobal exeext = '.exe' setglobal outputname = $[$echo $outputname|$(SED) 's,.exe$,,] with * setglobal exeext = '' } match $host { with *cygwin* | *mingw* setglobal output_name = $[basename $output] setglobal output_path = $[dirname $output] setglobal cwrappersource = ""$output_path/$objdir/lt-$output_name.c"" setglobal cwrapper = ""$output_path/$output_name.exe"" $rm $cwrappersource $cwrapper trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 cat > $cwrappersource << """ /* $cwrappersource - temporary wrapper executable for $objdir/$outputname Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP The $output program cannot be directly executed until all the libtool libraries that it depends on are installed. This wrapper executable should never be moved out of the build directory. If it is, it will not operate correctly. Currently, it simply execs the wrapper *script* "/bin/sh $output", but could eventually absorb all of the scripts functionality and exec $objdir/$outputname directly. */ """ cat >> $cwrappersource<< ''' #include #include #include #include #include #include #include #include #include #if defined(PATH_MAX) # define LT_PATHMAX PATH_MAX #elif defined(MAXPATHLEN) # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' #endif #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ defined (__OS2__) # define HAVE_DOS_BASED_FILE_SYSTEM # ifndef DIR_SEPARATOR_2 # define DIR_SEPARATOR_2 '\\' # endif # ifndef PATH_SEPARATOR_2 # define PATH_SEPARATOR_2 ';' # endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #ifndef PATH_SEPARATOR_2 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) #else /* PATH_SEPARATOR_2 */ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free ((void *) stale); stale = 0; } \ } while (0) /* -DDEBUG is fairly common in CFLAGS. */ #undef DEBUG #if defined DEBUGWRAPPER # define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) #else # define DEBUG(format, ...) #endif const char *program_name = NULL; void * xmalloc (size_t num); char * xstrdup (const char *string); const char * base_name (const char *name); char * find_executable(const char *wrapper); int check_executable(const char *path); char * strendzap(char *str, const char *pat); void lt_fatal (const char *message, ...); int main (int argc, char *argv[]) { char **newargz; int i; program_name = (char *) xstrdup (base_name (argv[0])); DEBUG("(main) argv[0] : %s\n",argv[0]); DEBUG("(main) program_name : %s\n",program_name); newargz = XMALLOC(char *, argc+2); ''' cat >> $cwrappersource << """ newargz[0] = (char *) xstrdup("$SHELL"); """ cat >> $cwrappersource << ''' newargz[1] = find_executable(argv[0]); if (newargz[1] == NULL) lt_fatal("Couldn't find %s", argv[0]); DEBUG("(main) found exe at : %s\n",newargz[1]); /* we know the script has the same name, without the .exe */ /* so make sure newargz[1] doesn't end in .exe */ strendzap(newargz[1],".exe"); for (i = 1; i < argc; i++) newargz[i+1] = xstrdup(argv[i]); newargz[argc+1] = NULL; for (i=0; i> $cwrappersource << """ execv("$SHELL",(char const **)newargz); """ with * cat >> $cwrappersource << """ execv("$SHELL",newargz); """ } cat >> $cwrappersource << ''' return 127; } void * xmalloc (size_t num) { void * p = (void *) malloc (num); if (!p) lt_fatal ("Memory exhausted"); return p; } char * xstrdup (const char *string) { return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL ; } const char * base_name (const char *name) { const char *base; #if defined (HAVE_DOS_BASED_FILE_SYSTEM) /* Skip over the disk name in MSDOS pathnames. */ if (isalpha ((unsigned char)name[0]) && name[1] == ':') name += 2; #endif for (base = name; *name; name++) if (IS_DIR_SEPARATOR (*name)) base = name + 1; return base; } int check_executable(const char * path) { struct stat st; DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); if ((!path) || (!*path)) return 0; if ((stat (path, &st) >= 0) && ( /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ #if defined (S_IXOTH) ((st.st_mode & S_IXOTH) == S_IXOTH) || #endif #if defined (S_IXGRP) ((st.st_mode & S_IXGRP) == S_IXGRP) || #endif ((st.st_mode & S_IXUSR) == S_IXUSR)) ) return 1; else return 0; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise */ char * find_executable (const char* wrapper) { int has_slash = 0; const char* p; const char* p_next; /* static buffer for getcwd */ char tmp[LT_PATHMAX + 1]; int tmp_len; char* concat_name; DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; /* Absolute path? */ #if defined (HAVE_DOS_BASED_FILE_SYSTEM) if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':') { concat_name = xstrdup (wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } else { #endif if (IS_DIR_SEPARATOR (wrapper[0])) { concat_name = xstrdup (wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } #if defined (HAVE_DOS_BASED_FILE_SYSTEM) } #endif for (p = wrapper; *p; p++) if (*p == '/') { has_slash = 1; break; } if (!has_slash) { /* no slashes; search PATH */ const char* path = getenv ("PATH"); if (path != NULL) { for (p = path; *p; p = p_next) { const char* q; size_t p_len; for (q = p; *q; q++) if (IS_PATH_SEPARATOR(*q)) break; p_len = q - p; p_next = (*q == '\0' ? q : q + 1); if (p_len == 0) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); tmp_len = strlen(tmp); concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); } else { concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, p, p_len); concat_name[p_len] = '/'; strcpy (concat_name + p_len + 1, wrapper); } if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } } /* not found in PATH; assume curdir */ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); tmp_len = strlen(tmp); concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); return NULL; } char * strendzap(char *str, const char *pat) { size_t len, patlen; assert(str != NULL); assert(pat != NULL); len = strlen(str); patlen = strlen(pat); if (patlen <= len) { str += len - patlen; if (strcmp(str, pat) == 0) *str = '\0'; } return str; } static void lt_error_core (int exit_status, const char * mode, const char * message, va_list ap) { fprintf (stderr, "%s: %s: ", program_name, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, "FATAL", message, ap); va_end (ap); } ''' # we should really use a build-platform specific compiler # here, but OTOH, the wrappers (shell script and this C one) # are only useful if you want to execute the "real" binary. # Since the "real" binary is built for $host, then this # wrapper might as well be built for $host, too. $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource } $rm $output trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 $echo > $output "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP # # 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 1s/^X//' sed_quote_subst='$sed_quote_subst' # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variable: notinst_deplibs='$notinst_deplibs' 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> $output "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP # # 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 1s/^X//' sed_quote_subst='$sed_quote_subst' # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variable: notinst_deplibs='$notinst_deplibs' 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\" >> $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\" " if test $fast_install = yes { $echo >> $output "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || \\ { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $(SED) 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $mkdir \"\$progdir\" else $rm \"\$progdir/\$file\" fi>> $output "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || \\ { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $mkdir \"\$progdir\" else $rm \"\$progdir/\$file\" fi" $echo >> $output "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else $echo \"\$relink_command_output\" >&2 $rm \"\$progdir/\$file\" exit $EXIT_FAILURE fi fi $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $rm \"\$progdir/\$program\"; $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } $rm \"\$progdir/\$file\" fi>> $output "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else $echo \"\$relink_command_output\" >&2 $rm \"\$progdir/\$file\" exit $EXIT_FAILURE fi fi $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $rm \"\$progdir/\$program\"; $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } $rm \"\$progdir/\$file\" fi" } else { $echo >> $output "\ program='$outputname' progdir=\"\$thisdir/$objdir\" >> $output "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " } $echo >> $output "\ if test -f \"\$progdir/\$program\"; then>> $output "\ if test -f \"\$progdir/\$program\"; then" # Export our shlibpath_var if we have one. if test $shlibpath_overrides_runpath = yes && test -n $shlibpath_var && test -n $temp_rpath { $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 # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` export $shlibpath_var >> $output "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` export $shlibpath_var " } # fixup the dll searchpath if we need to. if test -n $dllsearchpath { $echo >> $output "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH >> $output "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " } $echo >> $output "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. >> $output "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. " match $host { # Backslashes separate directories on plain windows with *-*-mingw | *-*-os2* $echo >> $output "\ exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} >> $output "\ exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} " with * $echo >> $output "\ exec \"\$progdir/\$program\" \${1+\"\$@\"} >> $output "\ exec \"\$progdir/\$program\" \${1+\"\$@\"} " } $echo >> $output "\ \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" exit $EXIT_FAILURE 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 $EXIT_FAILURE fi fi>> $output "\ \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" exit $EXIT_FAILURE 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 $EXIT_FAILURE fi fi\ " chmod +x $output } exit $EXIT_SUCCESS } # See if we need to build an old-fashioned archive. for oldlib in [$oldlibs] { if test $build_libtool_libs = convenience { setglobal oldobjs = $libobjs_save setglobal addlibs = $convenience setglobal build_libtool_libs = 'no' } else { if test $build_libtool_libs = module { setglobal oldobjs = $libobjs_save setglobal build_libtool_libs = 'no' } else { setglobal oldobjs = ""$old_deplibs $non_pic_objects"" } setglobal addlibs = $old_convenience } if test -n $addlibs { setglobal gentop = ""$output_objdir/$(outputname)x"" setglobal generated = ""$generated $gentop"" func_extract_archives $gentop $addlibs setglobal oldobjs = ""$oldobjs $func_extract_archives_result"" } # Do each command in the archive commands. if test -n $old_archive_from_new_cmds && test $build_libtool_libs = yes { setglobal cmds = $old_archive_from_new_cmds } else { # POSIX demands no paths to be encoded in archives. We have # to avoid creating archives with duplicate basenames if we # might have to extract them afterwards, e.g., when creating a # static archive out of a convenience library, or when linking # the entirety of a libtool archive into another (currently # not supported by libtool). if shell {for obj in [$oldobjs] { $echo "X$obj" | $Xsed -e 's%^.*/%%' } | sort | sort -uc >/dev/null !2 > !1} { : } else { $echo "copying selected object files to avoid basename conflicts..." if test -z $gentop { setglobal gentop = ""$output_objdir/$(outputname)x"" setglobal generated = ""$generated $gentop"" $show "$(rm)r $gentop" $run $(rm)r $gentop $show "$mkdir $gentop" $run $mkdir $gentop setglobal exit_status = $Status if test $exit_status -ne 0 && test ! -d $gentop { exit $exit_status } } setglobal save_oldobjs = $oldobjs setglobal oldobjs = '' setglobal counter = '1' for obj in [$save_oldobjs] { setglobal objbase = $[$echo "X$obj" | $Xsed -e 's%^.*/%%] match " $oldobjs " { with " " setglobal oldobjs = $obj with *[\ /]"$objbase "* while : { # Make sure we don't pick an alternate name that also # overlaps. setglobal newobj = "lt$counter-$objbase" setglobal counter = $[expr $counter + 1] match " $oldobjs " { with *[\ /]"$newobj "* with * if test ! -f "$gentop/$newobj" { break; } } } $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" $run ln $obj "$gentop/$newobj" || $run cp $obj "$gentop/$newobj" setglobal oldobjs = ""$oldobjs $gentop/$newobj"" with * setglobal oldobjs = ""$oldobjs $obj"" } } } eval cmds='"'$old_archive_cmds'"' if setglobal len = $[expr "X$cmds" : ".*] && test $len -le $max_cmd_len || test $max_cmd_len -le -1 { setglobal cmds = $old_archive_cmds } else { # the command line is too long to link in one step, link in parts $echo "using piecewise archive linking..." setglobal save_RANLIB = $RANLIB setglobal RANLIB = ':' setglobal objlist = '' setglobal concat_cmds = '' setglobal save_oldobjs = $oldobjs # Is there a better way of finding the last object in the list? for obj in [$save_oldobjs] { setglobal last_oldobj = $obj } for obj in [$save_oldobjs] { setglobal oldobjs = ""$objlist $obj"" setglobal objlist = ""$objlist $obj"" eval test_cmds='"'$old_archive_cmds'"' if setglobal len = $[expr "X$test_cmds" : ".*" !2 >/dev/null] && test $len -le $max_cmd_len { : } else { # the above command should be used before it gets too long setglobal oldobjs = $objlist if test $obj = $last_oldobj { setglobal RANLIB = $save_RANLIB } test -z $concat_cmds || setglobal concat_cmds = "$concat_cmds~" eval concat_cmds='"''$'{concat_cmds}$old_archive_cmds'"' setglobal objlist = '' } } setglobal RANLIB = $save_RANLIB setglobal oldobjs = $objlist if test "X$oldobjs" = "X" { eval cmds='"''$'concat_cmds'"' } else { eval cmds='"''$'concat_cmds~'$'old_archive_cmds'"' } } } setglobal save_ifs = $IFS; setglobal IFS = ''~'' for cmd in [$cmds] { eval cmd='"'$cmd'"' setglobal IFS = $save_ifs $show $cmd $run eval $cmd || exit $? } setglobal IFS = $save_ifs } if test -n $generated { $show "$(rm)r$generated" $run $(rm)r$generated } # Now create the libtool archive. match $output { with *.la setglobal old_library = '' test $build_old_libs = yes && setglobal old_library = ""$libname.$libext"" $show "creating $output" # Preserve any variables that may affect compiler behavior for var in [$variables_saved_for_relink] { if eval test -z '"''$'{$var+set}'"' { setglobal relink_command = ""{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"" } elif eval var_value='$'$var; test -z $var_value; { setglobal relink_command = ""$var=; export $var; $relink_command"" } else { setglobal var_value = $[$echo "X$var_value" | $Xsed -e $sed_quote_subst] setglobal relink_command = ""$var=\"$var_value\"; export $var; $relink_command"" } } # Quote the link command for shipping. setglobal relink_command = ""(cd $[pwd]; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"" setglobal relink_command = $[$echo "X$relink_command" | $Xsed -e $sed_quote_subst] if test $hardcode_automatic = yes { setglobal relink_command = '' } # Only create the output if not a dry run. if test -z $run { for installed in [no yes] { if test $installed = yes { if test -z $install_libdir { break } setglobal output = ""$output_objdir/$outputname"i" # Replace all uninstalled libtool libraries with the installed ones setglobal newdependency_libs = '' for deplib in [$dependency_libs] { match $deplib { with *.la setglobal name = $[$echo "X$deplib" | $Xsed -e 's%^.*/%%] eval libdir=$[$(SED) -n -e 's/^libdir=\(.*\)$/\1/p' $deplib] if test -z $libdir { $echo "$modename: \`$deplib' is not a valid libtool archive" !1 > !2 exit $EXIT_FAILURE } setglobal newdependency_libs = ""$newdependency_libs $libdir/$name"" with * setglobal newdependency_libs = ""$newdependency_libs $deplib"" } } setglobal dependency_libs = $newdependency_libs setglobal newdlfiles = '' for lib in [$dlfiles] { setglobal name = $[$echo "X$lib" | $Xsed -e 's%^.*/%%] eval libdir=$[$(SED) -n -e 's/^libdir=\(.*\)$/\1/p' $lib] if test -z $libdir { $echo "$modename: \`$lib' is not a valid libtool archive" !1 > !2 exit $EXIT_FAILURE } setglobal newdlfiles = ""$newdlfiles $libdir/$name"" } setglobal dlfiles = $newdlfiles setglobal newdlprefiles = '' for lib in [$dlprefiles] { setglobal name = $[$echo "X$lib" | $Xsed -e 's%^.*/%%] eval libdir=$[$(SED) -n -e 's/^libdir=\(.*\)$/\1/p' $lib] if test -z $libdir { $echo "$modename: \`$lib' is not a valid libtool archive" !1 > !2 exit $EXIT_FAILURE } setglobal newdlprefiles = ""$newdlprefiles $libdir/$name"" } setglobal dlprefiles = $newdlprefiles } else { setglobal newdlfiles = '' for lib in [$dlfiles] { match $lib { with [\\/]* | [A-Za-z]:[\\/]* setglobal abs = $lib with * setglobal abs = "$[pwd]"/$lib"" } setglobal newdlfiles = ""$newdlfiles $abs"" } setglobal dlfiles = $newdlfiles setglobal newdlprefiles = '' for lib in [$dlprefiles] { match $lib { with [\\/]* | [A-Za-z]:[\\/]* setglobal abs = $lib with * setglobal abs = "$[pwd]"/$lib"" } setglobal newdlprefiles = ""$newdlprefiles $abs"" } setglobal dlprefiles = $newdlprefiles } $rm $output # place dlname in correct position for cygwin setglobal tdlname = $dlname match $host,$output,$installed,$module,$dlname { with *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll setglobal tdlname = "../bin/$dlname" } $echo > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # 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=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'> $output "\ # $outputname - a libtool library file # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # 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=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test $installed = no && test $need_relink = yes { $echo >> $output "\ relink_command=\"$relink_command>> $output "\ relink_command=\"$relink_command\"" } } } # 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 && $rm $outputname && $LN_S ../$outputname $outputname)" $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? } exit $EXIT_SUCCESS # libtool install mode with install setglobal 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 || # Allow the use of GNU shtool's install command. $echo "X$nonopt" | grep shtool > /dev/null { # Aesthetically quote it. setglobal arg = $[$echo "X$nonopt" | $Xsed -e $sed_quote_subst] match $arg { with *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"" setglobal arg = ""\"$arg"\"" } setglobal install_prog = ""$arg "" setglobal arg = $1 shift } else { setglobal install_prog = '' setglobal arg = $nonopt } # The real first argument should be the name of the installation program. # Aesthetically quote it. setglobal arg = $[$echo "X$arg" | $Xsed -e $sed_quote_subst] match $arg { with *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"" setglobal arg = ""\"$arg"\"" } setglobal install_prog = ""$install_prog$arg"" # We need to accept at least all the BSD install flags. setglobal dest = '' setglobal files = '' setglobal opts = '' setglobal prev = '' setglobal install_type = '' setglobal isdir = 'no' setglobal stripme = ''for arg in @Argv { if test -n $dest { setglobal files = ""$files $dest"" setglobal dest = $arg continue } match $arg { with -d setglobal isdir = 'yes' with -f match " $install_prog " { with *[\\\ /]cp\ * with * setglobal prev = $arg } with -g | -m | -o setglobal prev = $arg with -s setglobal stripme = '" -s'" continue with -* with * # If the previous option needed an argument, then skip it. if test -n $prev { setglobal prev = '' } else { setglobal dest = $arg continue } } # Aesthetically quote the argument. setglobal arg = $[$echo "X$arg" | $Xsed -e $sed_quote_subst] match $arg { with *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"" setglobal arg = ""\"$arg"\"" } setglobal install_prog = ""$install_prog $arg"" } if test -z $install_prog { $echo "$modename: you must specify an install program" !1 > !2 $echo $help !1 > !2 exit $EXIT_FAILURE } if test -n $prev { $echo "$modename: the \`$prev' option requires an argument" !1 > !2 $echo $help !1 > !2 exit $EXIT_FAILURE } if test -z $files { if test -z $dest { $echo "$modename: no file or destination specified" !1 > !2 } else { $echo "$modename: you must specify a destination" !1 > !2 } $echo $help !1 > !2 exit $EXIT_FAILURE } # Strip any trailing slash from the destination. setglobal dest = $[$echo "X$dest" | $Xsed -e 's%/$%%] # Check to see that the destination is a directory. test -d $dest && setglobal isdir = 'yes' if test $isdir = yes { setglobal destdir = $dest setglobal destname = '' } else { setglobal destdir = $[$echo "X$dest" | $Xsed -e 's%/[^/]*$%%] test "X$destdir" = "X$dest" && setglobal destdir = '.' setglobal destname = $[$echo "X$dest" | $Xsed -e 's%^.*/%%] # Not a directory, so check to see that there is only one file specified. set dummy $files if test "$Argc" -gt 2 { $echo "$modename: \`$dest' is not a directory" !1 > !2 $echo $help !1 > !2 exit $EXIT_FAILURE } } match $destdir { with [\\/]* | [A-Za-z]:[\\/]* with * for file in [$files] { match $file { with *.lo with * $echo "$modename: \`$destdir' must be an absolute directory name" !1 > !2 $echo $help !1 > !2 exit $EXIT_FAILURE } } } # This variable tells wrapper scripts just to set variables rather # than running their programs. setglobal libtool_install_magic = $magic setglobal staticlibs = '' setglobal future_libdirs = '' setglobal current_libdirs = '' for file in [$files] { # Do each installation. match $file { with *.$libext # Do the static libraries later. setglobal staticlibs = ""$staticlibs $file"" with *.la # Check to see that this really is a libtool archive. if shell {$(SED) -e '2q' $file | grep "^# Generated by .*$PACKAGE"} >/dev/null 2>&1 { : } else { $echo "$modename: \`$file' is not a valid libtool archive" !1 > !2 $echo $help !1 > !2 exit $EXIT_FAILURE } setglobal library_names = '' setglobal old_library = '' setglobal relink_command = '' # If there is no directory component, then add one. match $file { with */* | *\\* source $file with * source ./$file } # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir" { match "$current_libdirs " { with *" $libdir "* with * setglobal current_libdirs = ""$current_libdirs $libdir"" } } else { # Note the libdir as a future libdir. match "$future_libdirs " { with *" $libdir "* with * setglobal future_libdirs = ""$future_libdirs $libdir"" } } setglobal dir = "$[$echo "X$file" | $Xsed -e 's%/[^/]*$%%]/" test "X$dir" = "X$file/" && setglobal dir = '' setglobal dir = ""$dir$objdir"" if test -n $relink_command { # Determine the prefix the user has applied to our future dir. setglobal inst_prefix_dir = $[$echo $destdir | $SED "s%$libdir\$%%] # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. if test $inst_prefix_dir = $destdir { $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" !1 > !2 exit $EXIT_FAILURE } if test -n $inst_prefix_dir { # Stick the inst_prefix_dir data into the link command. setglobal relink_command = $[$echo $relink_command | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%] } else { setglobal relink_command = $[$echo $relink_command | $SED "s%@inst_prefix_dir@%%] } $echo "$modename: warning: relinking \`$file'" !1 > !2 $show $relink_command if $run eval $relink_command { : } else { $echo "$modename: error: relink \`$file' with the above command before installing it" !1 > !2 exit $EXIT_FAILURE } } # See the names of the shared library. set dummy $library_names if test -n $2 { setglobal realname = $2 shift shift setglobal srcname = $realname test -n $relink_command && setglobal srcname = ""$realname"T" # Install the shared library and build the symlinks. $show "$install_prog $dir/$srcname $destdir/$realname" $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? if test -n $stripme && test -n $striplib { $show "$striplib $destdir/$realname" $run eval "$striplib $destdir/$realname" || exit $? } if test "$Argc" -gt 0 {for linkname in @Argv { if test $linkname != $realname { $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" } } } # Do each command in the postinstall commands. setglobal lib = ""$destdir/$realname"" setglobal cmds = $postinstall_cmds setglobal save_ifs = $IFS; setglobal IFS = ''~'' for cmd in [$cmds] { setglobal IFS = $save_ifs eval cmd='"'$cmd'"' $show $cmd $run eval $cmd || do { setglobal lt_exit = $Status # Restore the uninstalled library and exit if test $mode = relink { $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' } exit $lt_exit } } setglobal IFS = $save_ifs } # Install the pseudo-library for information purposes. setglobal name = $[$echo "X$file" | $Xsed -e 's%^.*/%%] setglobal instname = ""$dir/$name"i" $show "$install_prog $instname $destdir/$name" $run eval "$install_prog $instname $destdir/$name" || exit $? # Maybe install the static library, too. test -n $old_library && setglobal staticlibs = ""$staticlibs $dir/$old_library"" with *.lo # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n $destname { setglobal destfile = ""$destdir/$destname"" } else { setglobal destfile = $[$echo "X$file" | $Xsed -e 's%^.*/%%] setglobal destfile = ""$destdir/$destfile"" } # Deduce the name of the destination old-style object file. match $destfile { with *.lo setglobal staticdest = $[$echo "X$destfile" | $Xsed -e $lo2o] with *.$objext setglobal staticdest = $destfile setglobal destfile = '' with * $echo "$modename: cannot copy a libtool object to \`$destfile'" !1 > !2 $echo $help !1 > !2 exit $EXIT_FAILURE } # Install the libtool object if requested. if test -n $destfile { $show "$install_prog $file $destfile" $run eval "$install_prog $file $destfile" || exit $? } # Install the old object if enabled. if test $build_old_libs = yes { # Deduce the name of the old-style object file. setglobal staticobj = $[$echo "X$file" | $Xsed -e $lo2o] $show "$install_prog $staticobj $staticdest" $run eval "$install_prog \$staticobj \$staticdest" || exit $? } exit $EXIT_SUCCESS with * # Figure out destination file name, if it wasn't already specified. if test -n $destname { setglobal destfile = ""$destdir/$destname"" } else { setglobal destfile = $[$echo "X$file" | $Xsed -e 's%^.*/%%] setglobal destfile = ""$destdir/$destfile"" } # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install setglobal stripped_ext = ''"" match $file { with *.exe if test ! -f $file { setglobal file = $[$echo $file|$(SED) 's,.exe$,,] setglobal stripped_ext = '".exe'" } } # Do a test to see if this is really a libtool program. match $host { with *cygwin*|*mingw* setglobal wrapper = $[$echo $file | $(SED) -e 's,.exe$,,] with * setglobal wrapper = $file } if shell {$(SED) -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE"}>/dev/null 2>&1 { setglobal notinst_deplibs = '' setglobal relink_command = '' # Note that it is not necessary on cygwin/mingw to append a dot to # foo even if both foo 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. # # If there is no directory component, then add one. match $wrapper { with */* | *\\* source ${wrapper} with * source ./${wrapper} } # Check the variables that should have been set. if test -z $notinst_deplibs { $echo "$modename: invalid libtool wrapper script \`$wrapper'" !1 > !2 exit $EXIT_FAILURE } setglobal finalize = 'yes' for lib in [$notinst_deplibs] { # Check to see that each library is installed. setglobal libdir = '' if test -f $lib { # If there is no directory component, then add one. match $lib { with */* | *\\* source $lib with * source ./$lib } } setglobal libfile = ""$libdir/"$[$echo "X$lib" | $Xsed -e 's%^.*/%%g]" ### testsuite: skip nested quoting test if test -n $libdir && test ! -f $libfile { $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" !1 > !2 setglobal finalize = 'no' } } setglobal relink_command = '' # Note that it is not necessary on cygwin/mingw to append a dot to # foo even if both foo 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. # # If there is no directory component, then add one. match $wrapper { with */* | *\\* source ${wrapper} with * source ./${wrapper} } setglobal outputname = '' if test $fast_install = no && test -n $relink_command { if test $finalize = yes && test -z $run { setglobal tmpdir = $[func_mktempdir] setglobal file = $[$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%] setglobal outputname = ""$tmpdir/$file"" # Replace the output file specification. setglobal relink_command = $[$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g] $show $relink_command if $run eval $relink_command { : } else { $echo "$modename: error: relink \`$file' with the above command before installing it" !1 > !2 $(rm)r $tmpdir continue } setglobal file = $outputname } else { $echo "$modename: warning: cannot relink \`$file'" !1 > !2 } } else { # Install the binary that we compiled earlier. setglobal file = $[$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%] } } # remove .exe since cygwin /usr/bin/install will append another # one anyway match $install_prog,$host { with */usr/bin/install*,*cygwin* match $file:$destfile { with *.exe:*.exe # this is ok with *.exe:* setglobal destfile = "$destfile.exe" with *:*.exe setglobal destfile = $[$echo $destfile | $(SED) -e 's,.exe$,,] } } $show "$install_prog$stripme $file $destfile" $run eval "$install_prog\$stripme \$file \$destfile" || exit $? test -n $outputname && $(rm)r $tmpdir } } for file in [$staticlibs] { setglobal name = $[$echo "X$file" | $Xsed -e 's%^.*/%%] # Set up the ranlib parameters. setglobal oldlib = ""$destdir/$name"" $show "$install_prog $file $oldlib" $run eval "$install_prog \$file \$oldlib" || exit $? if test -n $stripme && test -n $old_striplib { $show "$old_striplib $oldlib" $run eval "$old_striplib $oldlib" || exit $? } # Do each command in the postinstall commands. setglobal cmds = $old_postinstall_cmds setglobal save_ifs = $IFS; setglobal IFS = ''~'' for cmd in [$cmds] { setglobal IFS = $save_ifs eval cmd='"'$cmd'"' $show $cmd $run eval $cmd || exit $? } setglobal IFS = $save_ifs } if test -n $future_libdirs { $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" !1 > !2 } if test -n $current_libdirs { # Maybe just do a dry run. test -n $run && setglobal current_libdirs = "" -n$current_libdirs"" setglobal exec_cmd = ''$SHELL $progpath $preserve_args --finish$current_libdirs'' } else { exit $EXIT_SUCCESS } # libtool finish mode with finish setglobal modename = ""$modename: finish"" setglobal libdirs = $nonopt setglobal admincmds = '' if test -n "$finish_cmds$finish_eval" && test -n $libdirs {for dir in @Argv { setglobal libdirs = ""$libdirs $dir"" } for libdir in [$libdirs] { if test -n $finish_cmds { # Do each command in the finish commands. setglobal cmds = $finish_cmds setglobal save_ifs = $IFS; setglobal IFS = ''~'' for cmd in [$cmds] { setglobal IFS = $save_ifs eval cmd='"'$cmd'"' $show $cmd $run eval $cmd || setglobal admincmds = ""$admincmds $cmd"" } setglobal IFS = $save_ifs } if test -n $finish_eval { # Do the single finish_eval. eval cmds='"'$finish_eval'"' $run eval $cmds || setglobal admincmds = ""$admincmds $cmds"" } } } # Exit here if they wanted silent mode. test $show = : && exit $EXIT_SUCCESS $echo "X----------------------------------------------------------------------" | $Xsed $echo "Libraries have been installed in:" for libdir in [$libdirs] { $echo " $libdir" } $echo $echo "If you ever happen to want to link against installed libraries" $echo "in a given directory, LIBDIR, you must either use libtool, and" $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" $echo "flag during linking and do at least one of the following:" if test -n $shlibpath_var { $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" $echo " during execution" } if test -n $runpath_var { $echo " - add LIBDIR to the \`$runpath_var' environment variable" $echo " during linking" } if test -n $hardcode_libdir_flag_spec { setglobal libdir = 'LIBDIR' eval flag='"'$hardcode_libdir_flag_spec'"' $echo " - use the \`$flag' linker flag" } if test -n $admincmds { $echo " - have your system administrator run these commands:$admincmds" } if test -f /etc/ld.so.conf { $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" } $echo $echo "See any operating system documentation about shared libraries for" $echo "more information, such as the ld(1) and ld.so(8) manual pages." $echo "X----------------------------------------------------------------------" | $Xsed exit $EXIT_SUCCESS # libtool execute mode with execute setglobal modename = ""$modename: execute"" # The first argument is the command name. setglobal cmd = $nonopt if test -z $cmd { $echo "$modename: you must specify a COMMAND" !1 > !2 $echo $help exit $EXIT_FAILURE } # Handle -dlopen flags immediately. for file in [$execute_dlfiles] { if test ! -f $file { $echo "$modename: \`$file' is not a file" !1 > !2 $echo $help !1 > !2 exit $EXIT_FAILURE } setglobal dir = '' match $file { with *.la # Check to see that this really is a libtool archive. if shell {$(SED) -e '2q' $file | grep "^# Generated by .*$PACKAGE"} >/dev/null 2>&1 { : } else { $echo "$modename: \`$lib' is not a valid libtool archive" !1 > !2 $echo $help !1 > !2 exit $EXIT_FAILURE } # Read the libtool library. setglobal dlname = '' setglobal library_names = '' # If there is no directory component, then add one. match $file { with */* | *\\* source $file with * source ./$file } # Skip this library if it cannot be dlopened. if test -z $dlname { # Warn if it was a shared library. test -n $library_names && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" continue } setglobal dir = $[$echo "X$file" | $Xsed -e 's%/[^/]*$%%] test "X$dir" = "X$file" && setglobal dir = '.' if test -f "$dir/$objdir/$dlname" { setglobal dir = ""$dir/$objdir"" } else { $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" !1 > !2 exit $EXIT_FAILURE } with *.lo # Just add the directory containing the .lo file. setglobal dir = $[$echo "X$file" | $Xsed -e 's%/[^/]*$%%] test "X$dir" = "X$file" && setglobal dir = '.' with * $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" !1 > !2 continue } # Get the absolute pathname. setglobal absdir = $[cd $dir && pwd] test -n $absdir && setglobal dir = $absdir # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\"" { eval "$shlibpath_var=\"\$dir\"" } else { eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" } } # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. setglobal libtool_execute_magic = $magic # Check if any of the arguments is a wrapper script. setglobal args = ''for file in @Argv { match $file { with -* with * # Do a test to see if this is really a libtool program. if shell {$(SED) -e '4q' $file | grep "^# Generated by .*$PACKAGE"} >/dev/null 2>&1 { # If there is no directory component, then add one. match $file { with */* | *\\* source $file with * source ./$file } # Transform arg to wrapped name. setglobal file = ""$progdir/$program"" } } # Quote arguments (to preserve shell metacharacters). setglobal file = $[$echo "X$file" | $Xsed -e $sed_quote_subst] setglobal args = ""$args \"$file"\"" } if test -z $run { if test -n $shlibpath_var { # Export the shlibpath_var. eval "export $shlibpath_var" } # Restore saved environment variables if test $(save_LC_ALL+set) = set { setglobal LC_ALL = $save_LC_ALL; export LC_ALL } if test $(save_LANG+set) = set { setglobal LANG = $save_LANG; export LANG } # Now prepare to actually exec the command. setglobal exec_cmd = ""\$cmd$args"" } else { # Display what would be done. if test -n $shlibpath_var { eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" $echo "export $shlibpath_var" } $echo "$cmd$args" exit $EXIT_SUCCESS } # libtool clean and uninstall mode with clean | uninstall setglobal modename = ""$modename: $mode"" setglobal rm = $nonopt setglobal files = '' setglobal rmforce = '' setglobal exit_status = '0' # This variable tells wrapper scripts just to set variables rather # than running their programs. setglobal libtool_install_magic = $magicfor arg in @Argv { match $arg { with -f setglobal rm = ""$rm $arg""; setglobal rmforce = 'yes' with -* setglobal rm = ""$rm $arg"" with * setglobal files = ""$files $arg"" } } if test -z $rm { $echo "$modename: you must specify an RM program" !1 > !2 $echo $help !1 > !2 exit $EXIT_FAILURE } setglobal rmdirs = '' setglobal origobjdir = $objdir for file in [$files] { setglobal dir = $[$echo "X$file" | $Xsed -e 's%/[^/]*$%%] if test "X$dir" = "X$file" { setglobal dir = '.' setglobal objdir = $origobjdir } else { setglobal objdir = ""$dir/$origobjdir"" } setglobal name = $[$echo "X$file" | $Xsed -e 's%^.*/%%] test $mode = uninstall && setglobal objdir = $dir # Remember objdir for removal later, being careful to avoid duplicates if test $mode = clean { match " $rmdirs " { with *" $objdir "* with * setglobal rmdirs = ""$rmdirs $objdir"" } } # Don't error if the file doesn't exist and rm -f was used. if shell {test -L $file} >/dev/null 2>&1 \ || shell {test -h $file} >/dev/null 2>&1 \ || test -f $file { : } elif test -d $file { setglobal exit_status = '1' continue } elif test $rmforce = yes { continue } setglobal rmfiles = $file match $name { with *.la # Possibly a libtool archive, so verify it. if shell {$(SED) -e '2q' $file | grep "^# Generated by .*$PACKAGE"} >/dev/null 2>&1 { source $dir/$name # Delete the libtool libraries and symlinks. for n in [$library_names] { setglobal rmfiles = ""$rmfiles $objdir/$n"" } test -n $old_library && setglobal rmfiles = ""$rmfiles $objdir/$old_library"" match $mode { with clean match " $library_names " { # " " in the beginning catches empty $dlname with *" $dlname "* with * setglobal rmfiles = ""$rmfiles $objdir/$dlname"" } test -n $libdir && setglobal rmfiles = ""$rmfiles $objdir/$name $objdir/$(name)i"" with uninstall if test -n $library_names { # Do each command in the postuninstall commands. setglobal cmds = $postuninstall_cmds setglobal save_ifs = $IFS; setglobal IFS = ''~'' for cmd in [$cmds] { setglobal IFS = $save_ifs eval cmd='"'$cmd'"' $show $cmd $run eval $cmd if test "$Status" -ne 0 && test $rmforce != yes { setglobal exit_status = '1' } } setglobal IFS = $save_ifs } if test -n $old_library { # Do each command in the old_postuninstall commands. setglobal cmds = $old_postuninstall_cmds setglobal save_ifs = $IFS; setglobal IFS = ''~'' for cmd in [$cmds] { setglobal IFS = $save_ifs eval cmd='"'$cmd'"' $show $cmd $run eval $cmd if test "$Status" -ne 0 && test $rmforce != yes { setglobal exit_status = '1' } } setglobal IFS = $save_ifs } # FIXME: should reinstall the best remaining shared library. } } with *.lo # Possibly a libtool object, so verify it. if shell {$(SED) -e '2q' $file | grep "^# Generated by .*$PACKAGE"} >/dev/null 2>&1 { # Read the .lo file source $dir/$name # Add PIC object to the list of files to remove. if test -n $pic_object \ && test $pic_object != none { setglobal rmfiles = ""$rmfiles $dir/$pic_object"" } # Add non-PIC object to the list of files to remove. if test -n $non_pic_object \ && test $non_pic_object != none { setglobal rmfiles = ""$rmfiles $dir/$non_pic_object"" } } with * if test $mode = clean { setglobal noexename = $name match $file { with *.exe setglobal file = $[$echo $file|$(SED) 's,.exe$,,] setglobal noexename = $[$echo $name|$(SED) 's,.exe$,,] # $file with .exe has already been added to rmfiles, # add $file without .exe setglobal rmfiles = ""$rmfiles $file"" } # Do a test to see if this is a libtool program. if shell {$(SED) -e '4q' $file | grep "^# Generated by .*$PACKAGE"} >/dev/null 2>&1 { setglobal relink_command = '' source $dir/$noexename # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles setglobal rmfiles = ""$rmfiles $objdir/$name $objdir/$(name)S.$(objext)"" if test $fast_install = yes && test -n $relink_command { setglobal rmfiles = ""$rmfiles $objdir/lt-$name"" } if test "X$noexename" != "X$name" { setglobal rmfiles = ""$rmfiles $objdir/lt-$(noexename).c"" } } } } $show "$rm $rmfiles" $run $rm $rmfiles || setglobal exit_status = '1' } setglobal objdir = $origobjdir # Try to remove the ${objdir}s in the directories where we deleted files for dir in [$rmdirs] { if test -d $dir { $show "rmdir $dir" $run rmdir $dir >/dev/null !2 > !1 } } exit $exit_status with "" $echo "$modename: you must specify a MODE" !1 > !2 $echo $generic_help !1 > !2 exit $EXIT_FAILURE } if test -z $exec_cmd { $echo "$modename: invalid operation mode \`$mode'" !1 > !2 $echo $generic_help !1 > !2 exit $EXIT_FAILURE } } # test -z "$show_help" if test -n $exec_cmd { eval exec $exec_cmd exit $EXIT_FAILURE } # We need to display help for each of the modes. match $mode { with "" $echo \ "Usage: $modename [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 --finish same as \`--mode=finish' --help display this help message and exit --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] --quiet same as \`--silent' --silent don't print informational messages --tag=TAG use configuration variables from tag TAG --version print version information 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. Try \`$modename --help --mode=MODE' for a more detailed description of MODE. Report bugs to ." exit $EXIT_SUCCESS with clean $echo \ "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." with compile $echo \ "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -prefer-pic try to building PIC objects only -prefer-non-pic try to building non-PIC objects only -static always build a \`.o' file suitable for static linking COMPILE-COMMAND is a command to be used in creating a \`standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix \`.c' with the library object suffix, \`.lo'." with execute $echo \ "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to \`-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." with finish $echo \ "Usage: $modename [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the \`--dry-run' option if you just want to see what would be executed." with install $echo \ "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the \`install' or \`cp' program. The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." with link $echo \ "Usage: $modename [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE Use a list of object files found in FILE to specify objects -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -static do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] All other options (arguments beginning with \`-') are ignored. Every other argument is treated as a filename. Files ending in \`.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only library objects (\`.lo' files) may be specified, and \`-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created using \`ar' and \`ranlib', or on Windows using \`lib'. If OUTPUT-FILE ends in \`.lo' or \`.$(objext)', then a reloadable object file is created, otherwise an executable program is created." with uninstall $echo \ "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." with * $echo "$modename: invalid operation mode \`$mode'" !1 > !2 $echo $help !1 > !2 exit $EXIT_FAILURE } $echo $echo "Try \`$modename --help' for more information about other modes." exit $? # The TAGs below are defined such that we never get into a situation # in which we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared setglobal disable_libs = 'shared' # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static setglobal disable_libs = 'static' # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: