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