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