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