ltmain.sh revision 52f9793f
152f9793fSmrg# ltmain.sh - Provide generalized library-building support services.
252f9793fSmrg# NOTE: Changing this file will not affect anything until you rerun configure.
352f9793fSmrg#
452f9793fSmrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005
552f9793fSmrg# Free Software Foundation, Inc.
652f9793fSmrg# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
752f9793fSmrg#
852f9793fSmrg# This program is free software; you can redistribute it and/or modify
952f9793fSmrg# it under the terms of the GNU General Public License as published by
1052f9793fSmrg# the Free Software Foundation; either version 2 of the License, or
1152f9793fSmrg# (at your option) any later version.
1252f9793fSmrg#
1352f9793fSmrg# This program is distributed in the hope that it will be useful, but
1452f9793fSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of
1552f9793fSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1652f9793fSmrg# General Public License for more details.
1752f9793fSmrg#
1852f9793fSmrg# You should have received a copy of the GNU General Public License
1952f9793fSmrg# along with this program; if not, write to the Free Software
2052f9793fSmrg# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
2152f9793fSmrg#
2252f9793fSmrg# As a special exception to the GNU General Public License, if you
2352f9793fSmrg# distribute this file as part of a program that contains a
2452f9793fSmrg# configuration script generated by Autoconf, you may include it under
2552f9793fSmrg# the same distribution terms that you use for the rest of that program.
2652f9793fSmrg
2752f9793fSmrgbasename="s,^.*/,,g"
2852f9793fSmrg
2952f9793fSmrg# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
3052f9793fSmrg# is ksh but when the shell is invoked as "sh" and the current value of
3152f9793fSmrg# the _XPG environment variable is not equal to 1 (one), the special
3252f9793fSmrg# positional parameter $0, within a function call, is the name of the
3352f9793fSmrg# function.
3452f9793fSmrgprogpath="$0"
3552f9793fSmrg
3652f9793fSmrg# The name of this program:
3752f9793fSmrgprogname=`echo "$progpath" | $SED $basename`
3852f9793fSmrgmodename="$progname"
3952f9793fSmrg
4052f9793fSmrg# Global variables:
4152f9793fSmrgEXIT_SUCCESS=0
4252f9793fSmrgEXIT_FAILURE=1
4352f9793fSmrg
4452f9793fSmrgPROGRAM=ltmain.sh
4552f9793fSmrgPACKAGE=libtool
4652f9793fSmrgVERSION="1.5.22 Debian 1.5.22-4"
4752f9793fSmrgTIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)"
4852f9793fSmrg
4952f9793fSmrg# See if we are running on zsh, and set the options which allow our
5052f9793fSmrg# commands through without removal of \ escapes.
5152f9793fSmrgif test -n "${ZSH_VERSION+set}" ; then
5252f9793fSmrg  setopt NO_GLOB_SUBST
5352f9793fSmrgfi
5452f9793fSmrg
5552f9793fSmrg# Check that we have a working $echo.
5652f9793fSmrgif test "X$1" = X--no-reexec; then
5752f9793fSmrg  # Discard the --no-reexec flag, and continue.
5852f9793fSmrg  shift
5952f9793fSmrgelif test "X$1" = X--fallback-echo; then
6052f9793fSmrg  # Avoid inline document here, it may be left over
6152f9793fSmrg  :
6252f9793fSmrgelif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
6352f9793fSmrg  # Yippee, $echo works!
6452f9793fSmrg  :
6552f9793fSmrgelse
6652f9793fSmrg  # Restart under the correct shell, and then maybe $echo will work.
6752f9793fSmrg  exec $SHELL "$progpath" --no-reexec ${1+"$@"}
6852f9793fSmrgfi
6952f9793fSmrg
7052f9793fSmrgif test "X$1" = X--fallback-echo; then
7152f9793fSmrg  # used as fallback echo
7252f9793fSmrg  shift
7352f9793fSmrg  cat <<EOF
7452f9793fSmrg$*
7552f9793fSmrgEOF
7652f9793fSmrg  exit $EXIT_SUCCESS
7752f9793fSmrgfi
7852f9793fSmrg
7952f9793fSmrgdefault_mode=
8052f9793fSmrghelp="Try \`$progname --help' for more information."
8152f9793fSmrgmagic="%%%MAGIC variable%%%"
8252f9793fSmrgmkdir="mkdir"
8352f9793fSmrgmv="mv -f"
8452f9793fSmrgrm="rm -f"
8552f9793fSmrg
8652f9793fSmrg# Sed substitution that helps us do robust quoting.  It backslashifies
8752f9793fSmrg# metacharacters that are still active within double-quoted strings.
8852f9793fSmrgXsed="${SED}"' -e 1s/^X//'
8952f9793fSmrgsed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
9052f9793fSmrg# test EBCDIC or ASCII
9152f9793fSmrgcase `echo X|tr X '\101'` in
9252f9793fSmrg A) # ASCII based system
9352f9793fSmrg    # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
9452f9793fSmrg  SP2NL='tr \040 \012'
9552f9793fSmrg  NL2SP='tr \015\012 \040\040'
9652f9793fSmrg  ;;
9752f9793fSmrg *) # EBCDIC based system
9852f9793fSmrg  SP2NL='tr \100 \n'
9952f9793fSmrg  NL2SP='tr \r\n \100\100'
10052f9793fSmrg  ;;
10152f9793fSmrgesac
10252f9793fSmrg
10352f9793fSmrg# NLS nuisances.
10452f9793fSmrg# Only set LANG and LC_ALL to C if already set.
10552f9793fSmrg# These must not be set unconditionally because not all systems understand
10652f9793fSmrg# e.g. LANG=C (notably SCO).
10752f9793fSmrg# We save the old values to restore during execute mode.
10852f9793fSmrgif test "${LC_ALL+set}" = set; then
10952f9793fSmrg  save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
11052f9793fSmrgfi
11152f9793fSmrgif test "${LANG+set}" = set; then
11252f9793fSmrg  save_LANG="$LANG"; LANG=C; export LANG
11352f9793fSmrgfi
11452f9793fSmrg
11552f9793fSmrg# Make sure IFS has a sensible default
11652f9793fSmrglt_nl='
11752f9793fSmrg'
11852f9793fSmrgIFS=" 	$lt_nl"
11952f9793fSmrg
12052f9793fSmrgif test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
12152f9793fSmrg  $echo "$modename: not configured to build any kind of library" 1>&2
12252f9793fSmrg  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
12352f9793fSmrg  exit $EXIT_FAILURE
12452f9793fSmrgfi
12552f9793fSmrg
12652f9793fSmrg# Global variables.
12752f9793fSmrgmode=$default_mode
12852f9793fSmrgnonopt=
12952f9793fSmrgprev=
13052f9793fSmrgprevopt=
13152f9793fSmrgrun=
13252f9793fSmrgshow="$echo"
13352f9793fSmrgshow_help=
13452f9793fSmrgexecute_dlfiles=
13552f9793fSmrgduplicate_deps=no
13652f9793fSmrgpreserve_args=
13752f9793fSmrglo2o="s/\\.lo\$/.${objext}/"
13852f9793fSmrgo2lo="s/\\.${objext}\$/.lo/"
13952f9793fSmrg
14052f9793fSmrg#####################################
14152f9793fSmrg# Shell function definitions:
14252f9793fSmrg# This seems to be the best place for them
14352f9793fSmrg
14452f9793fSmrg# func_mktempdir [string]
14552f9793fSmrg# Make a temporary directory that won't clash with other running
14652f9793fSmrg# libtool processes, and avoids race conditions if possible.  If
14752f9793fSmrg# given, STRING is the basename for that directory.
14852f9793fSmrgfunc_mktempdir ()
14952f9793fSmrg{
15052f9793fSmrg    my_template="${TMPDIR-/tmp}/${1-$progname}"
15152f9793fSmrg
15252f9793fSmrg    if test "$run" = ":"; then
15352f9793fSmrg      # Return a directory name, but don't create it in dry-run mode
15452f9793fSmrg      my_tmpdir="${my_template}-$$"
15552f9793fSmrg    else
15652f9793fSmrg
15752f9793fSmrg      # If mktemp works, use that first and foremost
15852f9793fSmrg      my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
15952f9793fSmrg
16052f9793fSmrg      if test ! -d "$my_tmpdir"; then
16152f9793fSmrg	# Failing that, at least try and use $RANDOM to avoid a race
16252f9793fSmrg	my_tmpdir="${my_template}-${RANDOM-0}$$"
16352f9793fSmrg
16452f9793fSmrg	save_mktempdir_umask=`umask`
16552f9793fSmrg	umask 0077
16652f9793fSmrg	$mkdir "$my_tmpdir"
16752f9793fSmrg	umask $save_mktempdir_umask
16852f9793fSmrg      fi
16952f9793fSmrg
17052f9793fSmrg      # If we're not in dry-run mode, bomb out on failure
17152f9793fSmrg      test -d "$my_tmpdir" || {
17252f9793fSmrg        $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
17352f9793fSmrg	exit $EXIT_FAILURE
17452f9793fSmrg      }
17552f9793fSmrg    fi
17652f9793fSmrg
17752f9793fSmrg    $echo "X$my_tmpdir" | $Xsed
17852f9793fSmrg}
17952f9793fSmrg
18052f9793fSmrg
18152f9793fSmrg# func_win32_libid arg
18252f9793fSmrg# return the library type of file 'arg'
18352f9793fSmrg#
18452f9793fSmrg# Need a lot of goo to handle *both* DLLs and import libs
18552f9793fSmrg# Has to be a shell function in order to 'eat' the argument
18652f9793fSmrg# that is supplied when $file_magic_command is called.
18752f9793fSmrgfunc_win32_libid ()
18852f9793fSmrg{
18952f9793fSmrg  win32_libid_type="unknown"
19052f9793fSmrg  win32_fileres=`file -L $1 2>/dev/null`
19152f9793fSmrg  case $win32_fileres in
19252f9793fSmrg  *ar\ archive\ import\ library*) # definitely import
19352f9793fSmrg    win32_libid_type="x86 archive import"
19452f9793fSmrg    ;;
19552f9793fSmrg  *ar\ archive*) # could be an import, or static
19652f9793fSmrg    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
19752f9793fSmrg      $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
19852f9793fSmrg      win32_nmres=`eval $NM -f posix -A $1 | \
19952f9793fSmrg	$SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'`
20052f9793fSmrg      case $win32_nmres in
20152f9793fSmrg      import*)  win32_libid_type="x86 archive import";;
20252f9793fSmrg      *)        win32_libid_type="x86 archive static";;
20352f9793fSmrg      esac
20452f9793fSmrg    fi
20552f9793fSmrg    ;;
20652f9793fSmrg  *DLL*)
20752f9793fSmrg    win32_libid_type="x86 DLL"
20852f9793fSmrg    ;;
20952f9793fSmrg  *executable*) # but shell scripts are "executable" too...
21052f9793fSmrg    case $win32_fileres in
21152f9793fSmrg    *MS\ Windows\ PE\ Intel*)
21252f9793fSmrg      win32_libid_type="x86 DLL"
21352f9793fSmrg      ;;
21452f9793fSmrg    esac
21552f9793fSmrg    ;;
21652f9793fSmrg  esac
21752f9793fSmrg  $echo $win32_libid_type
21852f9793fSmrg}
21952f9793fSmrg
22052f9793fSmrg
22152f9793fSmrg# func_infer_tag arg
22252f9793fSmrg# Infer tagged configuration to use if any are available and
22352f9793fSmrg# if one wasn't chosen via the "--tag" command line option.
22452f9793fSmrg# Only attempt this if the compiler in the base compile
22552f9793fSmrg# command doesn't match the default compiler.
22652f9793fSmrg# arg is usually of the form 'gcc ...'
22752f9793fSmrgfunc_infer_tag ()
22852f9793fSmrg{
22952f9793fSmrg    if test -n "$available_tags" && test -z "$tagname"; then
23052f9793fSmrg      CC_quoted=
23152f9793fSmrg      for arg in $CC; do
23252f9793fSmrg	case $arg in
23352f9793fSmrg	  *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
23452f9793fSmrg	  arg="\"$arg\""
23552f9793fSmrg	  ;;
23652f9793fSmrg	esac
23752f9793fSmrg	CC_quoted="$CC_quoted $arg"
23852f9793fSmrg      done
23952f9793fSmrg      case $@ in
24052f9793fSmrg      # Blanks in the command may have been stripped by the calling shell,
24152f9793fSmrg      # but not from the CC environment variable when configure was run.
24252f9793fSmrg      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
24352f9793fSmrg      # Blanks at the start of $base_compile will cause this to fail
24452f9793fSmrg      # if we don't check for them as well.
24552f9793fSmrg      *)
24652f9793fSmrg	for z in $available_tags; do
24752f9793fSmrg	  if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
24852f9793fSmrg	    # Evaluate the configuration.
24952f9793fSmrg	    eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
25052f9793fSmrg	    CC_quoted=
25152f9793fSmrg	    for arg in $CC; do
25252f9793fSmrg	    # Double-quote args containing other shell metacharacters.
25352f9793fSmrg	    case $arg in
25452f9793fSmrg	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
25552f9793fSmrg	      arg="\"$arg\""
25652f9793fSmrg	      ;;
25752f9793fSmrg	    esac
25852f9793fSmrg	    CC_quoted="$CC_quoted $arg"
25952f9793fSmrg	  done
26052f9793fSmrg	    case "$@ " in
26152f9793fSmrg	      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
26252f9793fSmrg	      # The compiler in the base compile command matches
26352f9793fSmrg	      # the one in the tagged configuration.
26452f9793fSmrg	      # Assume this is the tagged configuration we want.
26552f9793fSmrg	      tagname=$z
26652f9793fSmrg	      break
26752f9793fSmrg	      ;;
26852f9793fSmrg	    esac
26952f9793fSmrg	  fi
27052f9793fSmrg	done
27152f9793fSmrg	# If $tagname still isn't set, then no tagged configuration
27252f9793fSmrg	# was found and let the user know that the "--tag" command
27352f9793fSmrg	# line option must be used.
27452f9793fSmrg	if test -z "$tagname"; then
27552f9793fSmrg	  $echo "$modename: unable to infer tagged configuration"
27652f9793fSmrg	  $echo "$modename: specify a tag with \`--tag'" 1>&2
27752f9793fSmrg	  exit $EXIT_FAILURE
27852f9793fSmrg#        else
27952f9793fSmrg#          $echo "$modename: using $tagname tagged configuration"
28052f9793fSmrg	fi
28152f9793fSmrg	;;
28252f9793fSmrg      esac
28352f9793fSmrg    fi
28452f9793fSmrg}
28552f9793fSmrg
28652f9793fSmrg
28752f9793fSmrg# func_extract_an_archive dir oldlib
28852f9793fSmrgfunc_extract_an_archive ()
28952f9793fSmrg{
29052f9793fSmrg    f_ex_an_ar_dir="$1"; shift
29152f9793fSmrg    f_ex_an_ar_oldlib="$1"
29252f9793fSmrg
29352f9793fSmrg    $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
29452f9793fSmrg    $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
29552f9793fSmrg    if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
29652f9793fSmrg     :
29752f9793fSmrg    else
29852f9793fSmrg      $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
29952f9793fSmrg      exit $EXIT_FAILURE
30052f9793fSmrg    fi
30152f9793fSmrg}
30252f9793fSmrg
30352f9793fSmrg# func_extract_archives gentop oldlib ...
30452f9793fSmrgfunc_extract_archives ()
30552f9793fSmrg{
30652f9793fSmrg    my_gentop="$1"; shift
30752f9793fSmrg    my_oldlibs=${1+"$@"}
30852f9793fSmrg    my_oldobjs=""
30952f9793fSmrg    my_xlib=""
31052f9793fSmrg    my_xabs=""
31152f9793fSmrg    my_xdir=""
31252f9793fSmrg    my_status=""
31352f9793fSmrg
31452f9793fSmrg    $show "${rm}r $my_gentop"
31552f9793fSmrg    $run ${rm}r "$my_gentop"
31652f9793fSmrg    $show "$mkdir $my_gentop"
31752f9793fSmrg    $run $mkdir "$my_gentop"
31852f9793fSmrg    my_status=$?
31952f9793fSmrg    if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
32052f9793fSmrg      exit $my_status
32152f9793fSmrg    fi
32252f9793fSmrg
32352f9793fSmrg    for my_xlib in $my_oldlibs; do
32452f9793fSmrg      # Extract the objects.
32552f9793fSmrg      case $my_xlib in
32652f9793fSmrg	[\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
32752f9793fSmrg	*) my_xabs=`pwd`"/$my_xlib" ;;
32852f9793fSmrg      esac
32952f9793fSmrg      my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
33052f9793fSmrg      my_xdir="$my_gentop/$my_xlib"
33152f9793fSmrg
33252f9793fSmrg      $show "${rm}r $my_xdir"
33352f9793fSmrg      $run ${rm}r "$my_xdir"
33452f9793fSmrg      $show "$mkdir $my_xdir"
33552f9793fSmrg      $run $mkdir "$my_xdir"
33652f9793fSmrg      exit_status=$?
33752f9793fSmrg      if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
33852f9793fSmrg	exit $exit_status
33952f9793fSmrg      fi
34052f9793fSmrg      case $host in
34152f9793fSmrg      *-darwin*)
34252f9793fSmrg	$show "Extracting $my_xabs"
34352f9793fSmrg	# Do not bother doing anything if just a dry run
34452f9793fSmrg	if test -z "$run"; then
34552f9793fSmrg	  darwin_orig_dir=`pwd`
34652f9793fSmrg	  cd $my_xdir || exit $?
34752f9793fSmrg	  darwin_archive=$my_xabs
34852f9793fSmrg	  darwin_curdir=`pwd`
34952f9793fSmrg	  darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
35052f9793fSmrg	  darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
35152f9793fSmrg	  if test -n "$darwin_arches"; then 
35252f9793fSmrg	    darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
35352f9793fSmrg	    darwin_arch=
35452f9793fSmrg	    $show "$darwin_base_archive has multiple architectures $darwin_arches"
35552f9793fSmrg	    for darwin_arch in  $darwin_arches ; do
35652f9793fSmrg	      mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
35752f9793fSmrg	      lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
35852f9793fSmrg	      cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
35952f9793fSmrg	      func_extract_an_archive "`pwd`" "${darwin_base_archive}"
36052f9793fSmrg	      cd "$darwin_curdir"
36152f9793fSmrg	      $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
36252f9793fSmrg	    done # $darwin_arches
36352f9793fSmrg      ## Okay now we have a bunch of thin objects, gotta fatten them up :)
36452f9793fSmrg	    darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
36552f9793fSmrg	    darwin_file=
36652f9793fSmrg	    darwin_files=
36752f9793fSmrg	    for darwin_file in $darwin_filelist; do
36852f9793fSmrg	      darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
36952f9793fSmrg	      lipo -create -output "$darwin_file" $darwin_files
37052f9793fSmrg	    done # $darwin_filelist
37152f9793fSmrg	    ${rm}r unfat-$$
37252f9793fSmrg	    cd "$darwin_orig_dir"
37352f9793fSmrg	  else
37452f9793fSmrg	    cd "$darwin_orig_dir"
37552f9793fSmrg 	    func_extract_an_archive "$my_xdir" "$my_xabs"
37652f9793fSmrg	  fi # $darwin_arches
37752f9793fSmrg	fi # $run
37852f9793fSmrg	;;
37952f9793fSmrg      *)
38052f9793fSmrg        func_extract_an_archive "$my_xdir" "$my_xabs"
38152f9793fSmrg        ;;
38252f9793fSmrg      esac
38352f9793fSmrg      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
38452f9793fSmrg    done
38552f9793fSmrg    func_extract_archives_result="$my_oldobjs"
38652f9793fSmrg}
38752f9793fSmrg# End of Shell function definitions
38852f9793fSmrg#####################################
38952f9793fSmrg
39052f9793fSmrg# Darwin sucks
39152f9793fSmrgeval std_shrext=\"$shrext_cmds\"
39252f9793fSmrg
39352f9793fSmrgdisable_libs=no
39452f9793fSmrg
39552f9793fSmrg# Parse our command line options once, thoroughly.
39652f9793fSmrgwhile test "$#" -gt 0
39752f9793fSmrgdo
39852f9793fSmrg  arg="$1"
39952f9793fSmrg  shift
40052f9793fSmrg
40152f9793fSmrg  case $arg in
40252f9793fSmrg  -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
40352f9793fSmrg  *) optarg= ;;
40452f9793fSmrg  esac
40552f9793fSmrg
40652f9793fSmrg  # If the previous option needs an argument, assign it.
40752f9793fSmrg  if test -n "$prev"; then
40852f9793fSmrg    case $prev in
40952f9793fSmrg    execute_dlfiles)
41052f9793fSmrg      execute_dlfiles="$execute_dlfiles $arg"
41152f9793fSmrg      ;;
41252f9793fSmrg    tag)
41352f9793fSmrg      tagname="$arg"
41452f9793fSmrg      preserve_args="${preserve_args}=$arg"
41552f9793fSmrg
41652f9793fSmrg      # Check whether tagname contains only valid characters
41752f9793fSmrg      case $tagname in
41852f9793fSmrg      *[!-_A-Za-z0-9,/]*)
41952f9793fSmrg	$echo "$progname: invalid tag name: $tagname" 1>&2
42052f9793fSmrg	exit $EXIT_FAILURE
42152f9793fSmrg	;;
42252f9793fSmrg      esac
42352f9793fSmrg
42452f9793fSmrg      case $tagname in
42552f9793fSmrg      CC)
42652f9793fSmrg	# Don't test for the "default" C tag, as we know, it's there, but
42752f9793fSmrg	# not specially marked.
42852f9793fSmrg	;;
42952f9793fSmrg      *)
43052f9793fSmrg	if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
43152f9793fSmrg	  taglist="$taglist $tagname"
43252f9793fSmrg	  # Evaluate the configuration.
43352f9793fSmrg	  eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
43452f9793fSmrg	else
43552f9793fSmrg	  $echo "$progname: ignoring unknown tag $tagname" 1>&2
43652f9793fSmrg	fi
43752f9793fSmrg	;;
43852f9793fSmrg      esac
43952f9793fSmrg      ;;
44052f9793fSmrg    *)
44152f9793fSmrg      eval "$prev=\$arg"
44252f9793fSmrg      ;;
44352f9793fSmrg    esac
44452f9793fSmrg
44552f9793fSmrg    prev=
44652f9793fSmrg    prevopt=
44752f9793fSmrg    continue
44852f9793fSmrg  fi
44952f9793fSmrg
45052f9793fSmrg  # Have we seen a non-optional argument yet?
45152f9793fSmrg  case $arg in
45252f9793fSmrg  --help)
45352f9793fSmrg    show_help=yes
45452f9793fSmrg    ;;
45552f9793fSmrg
45652f9793fSmrg  --version)
45752f9793fSmrg    $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
45852f9793fSmrg    $echo
45952f9793fSmrg    $echo "Copyright (C) 2005  Free Software Foundation, Inc."
46052f9793fSmrg    $echo "This is free software; see the source for copying conditions.  There is NO"
46152f9793fSmrg    $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
46252f9793fSmrg    exit $?
46352f9793fSmrg    ;;
46452f9793fSmrg
46552f9793fSmrg  --config)
46652f9793fSmrg    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
46752f9793fSmrg    # Now print the configurations for the tags.
46852f9793fSmrg    for tagname in $taglist; do
46952f9793fSmrg      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
47052f9793fSmrg    done
47152f9793fSmrg    exit $?
47252f9793fSmrg    ;;
47352f9793fSmrg
47452f9793fSmrg  --debug)
47552f9793fSmrg    $echo "$progname: enabling shell trace mode"
47652f9793fSmrg    set -x
47752f9793fSmrg    preserve_args="$preserve_args $arg"
47852f9793fSmrg    ;;
47952f9793fSmrg
48052f9793fSmrg  --dry-run | -n)
48152f9793fSmrg    run=:
48252f9793fSmrg    ;;
48352f9793fSmrg
48452f9793fSmrg  --features)
48552f9793fSmrg    $echo "host: $host"
48652f9793fSmrg    if test "$build_libtool_libs" = yes; then
48752f9793fSmrg      $echo "enable shared libraries"
48852f9793fSmrg    else
48952f9793fSmrg      $echo "disable shared libraries"
49052f9793fSmrg    fi
49152f9793fSmrg    if test "$build_old_libs" = yes; then
49252f9793fSmrg      $echo "enable static libraries"
49352f9793fSmrg    else
49452f9793fSmrg      $echo "disable static libraries"
49552f9793fSmrg    fi
49652f9793fSmrg    exit $?
49752f9793fSmrg    ;;
49852f9793fSmrg
49952f9793fSmrg  --finish) mode="finish" ;;
50052f9793fSmrg
50152f9793fSmrg  --mode) prevopt="--mode" prev=mode ;;
50252f9793fSmrg  --mode=*) mode="$optarg" ;;
50352f9793fSmrg
50452f9793fSmrg  --preserve-dup-deps) duplicate_deps="yes" ;;
50552f9793fSmrg
50652f9793fSmrg  --quiet | --silent)
50752f9793fSmrg    show=:
50852f9793fSmrg    preserve_args="$preserve_args $arg"
50952f9793fSmrg    ;;
51052f9793fSmrg
51152f9793fSmrg  --tag)
51252f9793fSmrg    prevopt="--tag"
51352f9793fSmrg    prev=tag
51452f9793fSmrg    preserve_args="$preserve_args --tag"
51552f9793fSmrg    ;;
51652f9793fSmrg  --tag=*)
51752f9793fSmrg    set tag "$optarg" ${1+"$@"}
51852f9793fSmrg    shift
51952f9793fSmrg    prev=tag
52052f9793fSmrg    preserve_args="$preserve_args --tag"
52152f9793fSmrg    ;;
52252f9793fSmrg
52352f9793fSmrg  -dlopen)
52452f9793fSmrg    prevopt="-dlopen"
52552f9793fSmrg    prev=execute_dlfiles
52652f9793fSmrg    ;;
52752f9793fSmrg
52852f9793fSmrg  -*)
52952f9793fSmrg    $echo "$modename: unrecognized option \`$arg'" 1>&2
53052f9793fSmrg    $echo "$help" 1>&2
53152f9793fSmrg    exit $EXIT_FAILURE
53252f9793fSmrg    ;;
53352f9793fSmrg
53452f9793fSmrg  *)
53552f9793fSmrg    nonopt="$arg"
53652f9793fSmrg    break
53752f9793fSmrg    ;;
53852f9793fSmrg  esac
53952f9793fSmrgdone
54052f9793fSmrg
54152f9793fSmrgif test -n "$prevopt"; then
54252f9793fSmrg  $echo "$modename: option \`$prevopt' requires an argument" 1>&2
54352f9793fSmrg  $echo "$help" 1>&2
54452f9793fSmrg  exit $EXIT_FAILURE
54552f9793fSmrgfi
54652f9793fSmrg
54752f9793fSmrgcase $disable_libs in
54852f9793fSmrgno) 
54952f9793fSmrg  ;;
55052f9793fSmrgshared)
55152f9793fSmrg  build_libtool_libs=no
55252f9793fSmrg  build_old_libs=yes
55352f9793fSmrg  ;;
55452f9793fSmrgstatic)
55552f9793fSmrg  build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
55652f9793fSmrg  ;;
55752f9793fSmrgesac
55852f9793fSmrg
55952f9793fSmrg# If this variable is set in any of the actions, the command in it
56052f9793fSmrg# will be execed at the end.  This prevents here-documents from being
56152f9793fSmrg# left over by shells.
56252f9793fSmrgexec_cmd=
56352f9793fSmrg
56452f9793fSmrgif test -z "$show_help"; then
56552f9793fSmrg
56652f9793fSmrg  # Infer the operation mode.
56752f9793fSmrg  if test -z "$mode"; then
56852f9793fSmrg    $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
56952f9793fSmrg    $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
57052f9793fSmrg    case $nonopt in
57152f9793fSmrg    *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
57252f9793fSmrg      mode=link
57352f9793fSmrg      for arg
57452f9793fSmrg      do
57552f9793fSmrg	case $arg in
57652f9793fSmrg	-c)
57752f9793fSmrg	   mode=compile
57852f9793fSmrg	   break
57952f9793fSmrg	   ;;
58052f9793fSmrg	esac
58152f9793fSmrg      done
58252f9793fSmrg      ;;
58352f9793fSmrg    *db | *dbx | *strace | *truss)
58452f9793fSmrg      mode=execute
58552f9793fSmrg      ;;
58652f9793fSmrg    *install*|cp|mv)
58752f9793fSmrg      mode=install
58852f9793fSmrg      ;;
58952f9793fSmrg    *rm)
59052f9793fSmrg      mode=uninstall
59152f9793fSmrg      ;;
59252f9793fSmrg    *)
59352f9793fSmrg      # If we have no mode, but dlfiles were specified, then do execute mode.
59452f9793fSmrg      test -n "$execute_dlfiles" && mode=execute
59552f9793fSmrg
59652f9793fSmrg      # Just use the default operation mode.
59752f9793fSmrg      if test -z "$mode"; then
59852f9793fSmrg	if test -n "$nonopt"; then
59952f9793fSmrg	  $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
60052f9793fSmrg	else
60152f9793fSmrg	  $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
60252f9793fSmrg	fi
60352f9793fSmrg      fi
60452f9793fSmrg      ;;
60552f9793fSmrg    esac
60652f9793fSmrg  fi
60752f9793fSmrg
60852f9793fSmrg  # Only execute mode is allowed to have -dlopen flags.
60952f9793fSmrg  if test -n "$execute_dlfiles" && test "$mode" != execute; then
61052f9793fSmrg    $echo "$modename: unrecognized option \`-dlopen'" 1>&2
61152f9793fSmrg    $echo "$help" 1>&2
61252f9793fSmrg    exit $EXIT_FAILURE
61352f9793fSmrg  fi
61452f9793fSmrg
61552f9793fSmrg  # Change the help message to a mode-specific one.
61652f9793fSmrg  generic_help="$help"
61752f9793fSmrg  help="Try \`$modename --help --mode=$mode' for more information."
61852f9793fSmrg
61952f9793fSmrg  # These modes are in order of execution frequency so that they run quickly.
62052f9793fSmrg  case $mode in
62152f9793fSmrg  # libtool compile mode
62252f9793fSmrg  compile)
62352f9793fSmrg    modename="$modename: compile"
62452f9793fSmrg    # Get the compilation command and the source file.
62552f9793fSmrg    base_compile=
62652f9793fSmrg    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
62752f9793fSmrg    suppress_opt=yes
62852f9793fSmrg    suppress_output=
62952f9793fSmrg    arg_mode=normal
63052f9793fSmrg    libobj=
63152f9793fSmrg    later=
63252f9793fSmrg
63352f9793fSmrg    for arg
63452f9793fSmrg    do
63552f9793fSmrg      case $arg_mode in
63652f9793fSmrg      arg  )
63752f9793fSmrg	# do not "continue".  Instead, add this to base_compile
63852f9793fSmrg	lastarg="$arg"
63952f9793fSmrg	arg_mode=normal
64052f9793fSmrg	;;
64152f9793fSmrg
64252f9793fSmrg      target )
64352f9793fSmrg	libobj="$arg"
64452f9793fSmrg	arg_mode=normal
64552f9793fSmrg	continue
64652f9793fSmrg	;;
64752f9793fSmrg
64852f9793fSmrg      normal )
64952f9793fSmrg	# Accept any command-line options.
65052f9793fSmrg	case $arg in
65152f9793fSmrg	-o)
65252f9793fSmrg	  if test -n "$libobj" ; then
65352f9793fSmrg	    $echo "$modename: you cannot specify \`-o' more than once" 1>&2
65452f9793fSmrg	    exit $EXIT_FAILURE
65552f9793fSmrg	  fi
65652f9793fSmrg	  arg_mode=target
65752f9793fSmrg	  continue
65852f9793fSmrg	  ;;
65952f9793fSmrg
66052f9793fSmrg	-static | -prefer-pic | -prefer-non-pic)
66152f9793fSmrg	  later="$later $arg"
66252f9793fSmrg	  continue
66352f9793fSmrg	  ;;
66452f9793fSmrg
66552f9793fSmrg	-no-suppress)
66652f9793fSmrg	  suppress_opt=no
66752f9793fSmrg	  continue
66852f9793fSmrg	  ;;
66952f9793fSmrg
67052f9793fSmrg	-Xcompiler)
67152f9793fSmrg	  arg_mode=arg  #  the next one goes into the "base_compile" arg list
67252f9793fSmrg	  continue      #  The current "srcfile" will either be retained or
67352f9793fSmrg	  ;;            #  replaced later.  I would guess that would be a bug.
67452f9793fSmrg
67552f9793fSmrg	-Wc,*)
67652f9793fSmrg	  args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
67752f9793fSmrg	  lastarg=
67852f9793fSmrg	  save_ifs="$IFS"; IFS=','
67952f9793fSmrg 	  for arg in $args; do
68052f9793fSmrg	    IFS="$save_ifs"
68152f9793fSmrg
68252f9793fSmrg	    # Double-quote args containing other shell metacharacters.
68352f9793fSmrg	    # Many Bourne shells cannot handle close brackets correctly
68452f9793fSmrg	    # in scan sets, so we specify it separately.
68552f9793fSmrg	    case $arg in
68652f9793fSmrg	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
68752f9793fSmrg	      arg="\"$arg\""
68852f9793fSmrg	      ;;
68952f9793fSmrg	    esac
69052f9793fSmrg	    lastarg="$lastarg $arg"
69152f9793fSmrg	  done
69252f9793fSmrg	  IFS="$save_ifs"
69352f9793fSmrg	  lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
69452f9793fSmrg
69552f9793fSmrg	  # Add the arguments to base_compile.
69652f9793fSmrg	  base_compile="$base_compile $lastarg"
69752f9793fSmrg	  continue
69852f9793fSmrg	  ;;
69952f9793fSmrg
70052f9793fSmrg	* )
70152f9793fSmrg	  # Accept the current argument as the source file.
70252f9793fSmrg	  # The previous "srcfile" becomes the current argument.
70352f9793fSmrg	  #
70452f9793fSmrg	  lastarg="$srcfile"
70552f9793fSmrg	  srcfile="$arg"
70652f9793fSmrg	  ;;
70752f9793fSmrg	esac  #  case $arg
70852f9793fSmrg	;;
70952f9793fSmrg      esac    #  case $arg_mode
71052f9793fSmrg
71152f9793fSmrg      # Aesthetically quote the previous argument.
71252f9793fSmrg      lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
71352f9793fSmrg
71452f9793fSmrg      case $lastarg in
71552f9793fSmrg      # Double-quote args containing other shell metacharacters.
71652f9793fSmrg      # Many Bourne shells cannot handle close brackets correctly
71752f9793fSmrg      # in scan sets, and some SunOS ksh mistreat backslash-escaping
71852f9793fSmrg      # in scan sets (worked around with variable expansion),
71952f9793fSmrg      # and furthermore cannot handle '|' '&' '(' ')' in scan sets 
72052f9793fSmrg      # at all, so we specify them separately.
72152f9793fSmrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
72252f9793fSmrg	lastarg="\"$lastarg\""
72352f9793fSmrg	;;
72452f9793fSmrg      esac
72552f9793fSmrg
72652f9793fSmrg      base_compile="$base_compile $lastarg"
72752f9793fSmrg    done # for arg
72852f9793fSmrg
72952f9793fSmrg    case $arg_mode in
73052f9793fSmrg    arg)
73152f9793fSmrg      $echo "$modename: you must specify an argument for -Xcompile"
73252f9793fSmrg      exit $EXIT_FAILURE
73352f9793fSmrg      ;;
73452f9793fSmrg    target)
73552f9793fSmrg      $echo "$modename: you must specify a target with \`-o'" 1>&2
73652f9793fSmrg      exit $EXIT_FAILURE
73752f9793fSmrg      ;;
73852f9793fSmrg    *)
73952f9793fSmrg      # Get the name of the library object.
74052f9793fSmrg      [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
74152f9793fSmrg      ;;
74252f9793fSmrg    esac
74352f9793fSmrg
74452f9793fSmrg    # Recognize several different file suffixes.
74552f9793fSmrg    # If the user specifies -o file.o, it is replaced with file.lo
74652f9793fSmrg    xform='[cCFSifmso]'
74752f9793fSmrg    case $libobj in
74852f9793fSmrg    *.ada) xform=ada ;;
74952f9793fSmrg    *.adb) xform=adb ;;
75052f9793fSmrg    *.ads) xform=ads ;;
75152f9793fSmrg    *.asm) xform=asm ;;
75252f9793fSmrg    *.c++) xform=c++ ;;
75352f9793fSmrg    *.cc) xform=cc ;;
75452f9793fSmrg    *.ii) xform=ii ;;
75552f9793fSmrg    *.class) xform=class ;;
75652f9793fSmrg    *.cpp) xform=cpp ;;
75752f9793fSmrg    *.cxx) xform=cxx ;;
75852f9793fSmrg    *.f90) xform=f90 ;;
75952f9793fSmrg    *.for) xform=for ;;
76052f9793fSmrg    *.java) xform=java ;;
76152f9793fSmrg    esac
76252f9793fSmrg
76352f9793fSmrg    libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
76452f9793fSmrg
76552f9793fSmrg    case $libobj in
76652f9793fSmrg    *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
76752f9793fSmrg    *)
76852f9793fSmrg      $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
76952f9793fSmrg      exit $EXIT_FAILURE
77052f9793fSmrg      ;;
77152f9793fSmrg    esac
77252f9793fSmrg
77352f9793fSmrg    func_infer_tag $base_compile
77452f9793fSmrg
77552f9793fSmrg    for arg in $later; do
77652f9793fSmrg      case $arg in
77752f9793fSmrg      -static)
77852f9793fSmrg	build_old_libs=yes
77952f9793fSmrg	continue
78052f9793fSmrg	;;
78152f9793fSmrg
78252f9793fSmrg      -prefer-pic)
78352f9793fSmrg	pic_mode=yes
78452f9793fSmrg	continue
78552f9793fSmrg	;;
78652f9793fSmrg
78752f9793fSmrg      -prefer-non-pic)
78852f9793fSmrg	pic_mode=no
78952f9793fSmrg	continue
79052f9793fSmrg	;;
79152f9793fSmrg      esac
79252f9793fSmrg    done
79352f9793fSmrg
79452f9793fSmrg    qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
79552f9793fSmrg    case $qlibobj in
79652f9793fSmrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
79752f9793fSmrg	qlibobj="\"$qlibobj\"" ;;
79852f9793fSmrg    esac
79952f9793fSmrg    test "X$libobj" != "X$qlibobj" \
80052f9793fSmrg	&& $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' 	&()|`$[]' \
80152f9793fSmrg	&& $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
80252f9793fSmrg    objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
80352f9793fSmrg    xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
80452f9793fSmrg    if test "X$xdir" = "X$obj"; then
80552f9793fSmrg      xdir=
80652f9793fSmrg    else
80752f9793fSmrg      xdir=$xdir/
80852f9793fSmrg    fi
80952f9793fSmrg    lobj=${xdir}$objdir/$objname
81052f9793fSmrg
81152f9793fSmrg    if test -z "$base_compile"; then
81252f9793fSmrg      $echo "$modename: you must specify a compilation command" 1>&2
81352f9793fSmrg      $echo "$help" 1>&2
81452f9793fSmrg      exit $EXIT_FAILURE
81552f9793fSmrg    fi
81652f9793fSmrg
81752f9793fSmrg    # Delete any leftover library objects.
81852f9793fSmrg    if test "$build_old_libs" = yes; then
81952f9793fSmrg      removelist="$obj $lobj $libobj ${libobj}T"
82052f9793fSmrg    else
82152f9793fSmrg      removelist="$lobj $libobj ${libobj}T"
82252f9793fSmrg    fi
82352f9793fSmrg
82452f9793fSmrg    $run $rm $removelist
82552f9793fSmrg    trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
82652f9793fSmrg
82752f9793fSmrg    # On Cygwin there's no "real" PIC flag so we must build both object types
82852f9793fSmrg    case $host_os in
82952f9793fSmrg    cygwin* | mingw* | pw32* | os2*)
83052f9793fSmrg      pic_mode=default
83152f9793fSmrg      ;;
83252f9793fSmrg    esac
83352f9793fSmrg    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
83452f9793fSmrg      # non-PIC code in shared libraries is not supported
83552f9793fSmrg      pic_mode=default
83652f9793fSmrg    fi
83752f9793fSmrg
83852f9793fSmrg    # Calculate the filename of the output object if compiler does
83952f9793fSmrg    # not support -o with -c
84052f9793fSmrg    if test "$compiler_c_o" = no; then
84152f9793fSmrg      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
84252f9793fSmrg      lockfile="$output_obj.lock"
84352f9793fSmrg      removelist="$removelist $output_obj $lockfile"
84452f9793fSmrg      trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
84552f9793fSmrg    else
84652f9793fSmrg      output_obj=
84752f9793fSmrg      need_locks=no
84852f9793fSmrg      lockfile=
84952f9793fSmrg    fi
85052f9793fSmrg
85152f9793fSmrg    # Lock this critical section if it is needed
85252f9793fSmrg    # We use this script file to make the link, it avoids creating a new file
85352f9793fSmrg    if test "$need_locks" = yes; then
85452f9793fSmrg      until $run ln "$progpath" "$lockfile" 2>/dev/null; do
85552f9793fSmrg	$show "Waiting for $lockfile to be removed"
85652f9793fSmrg	sleep 2
85752f9793fSmrg      done
85852f9793fSmrg    elif test "$need_locks" = warn; then
85952f9793fSmrg      if test -f "$lockfile"; then
86052f9793fSmrg	$echo "\
86152f9793fSmrg*** ERROR, $lockfile exists and contains:
86252f9793fSmrg`cat $lockfile 2>/dev/null`
86352f9793fSmrg
86452f9793fSmrgThis indicates that another process is trying to use the same
86552f9793fSmrgtemporary object file, and libtool could not work around it because
86652f9793fSmrgyour compiler does not support \`-c' and \`-o' together.  If you
86752f9793fSmrgrepeat this compilation, it may succeed, by chance, but you had better
86852f9793fSmrgavoid parallel builds (make -j) in this platform, or get a better
86952f9793fSmrgcompiler."
87052f9793fSmrg
87152f9793fSmrg	$run $rm $removelist
87252f9793fSmrg	exit $EXIT_FAILURE
87352f9793fSmrg      fi
87452f9793fSmrg      $echo "$srcfile" > "$lockfile"
87552f9793fSmrg    fi
87652f9793fSmrg
87752f9793fSmrg    if test -n "$fix_srcfile_path"; then
87852f9793fSmrg      eval srcfile=\"$fix_srcfile_path\"
87952f9793fSmrg    fi
88052f9793fSmrg    qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
88152f9793fSmrg    case $qsrcfile in
88252f9793fSmrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
88352f9793fSmrg      qsrcfile="\"$qsrcfile\"" ;;
88452f9793fSmrg    esac
88552f9793fSmrg
88652f9793fSmrg    $run $rm "$libobj" "${libobj}T"
88752f9793fSmrg
88852f9793fSmrg    # Create a libtool object file (analogous to a ".la" file),
88952f9793fSmrg    # but don't create it if we're doing a dry run.
89052f9793fSmrg    test -z "$run" && cat > ${libobj}T <<EOF
89152f9793fSmrg# $libobj - a libtool object file
89252f9793fSmrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
89352f9793fSmrg#
89452f9793fSmrg# Please DO NOT delete this file!
89552f9793fSmrg# It is necessary for linking the library.
89652f9793fSmrg
89752f9793fSmrg# Name of the PIC object.
89852f9793fSmrgEOF
89952f9793fSmrg
90052f9793fSmrg    # Only build a PIC object if we are building libtool libraries.
90152f9793fSmrg    if test "$build_libtool_libs" = yes; then
90252f9793fSmrg      # Without this assignment, base_compile gets emptied.
90352f9793fSmrg      fbsd_hideous_sh_bug=$base_compile
90452f9793fSmrg
90552f9793fSmrg      if test "$pic_mode" != no; then
90652f9793fSmrg	command="$base_compile $qsrcfile $pic_flag"
90752f9793fSmrg      else
90852f9793fSmrg	# Don't build PIC code
90952f9793fSmrg	command="$base_compile $qsrcfile"
91052f9793fSmrg      fi
91152f9793fSmrg
91252f9793fSmrg      if test ! -d "${xdir}$objdir"; then
91352f9793fSmrg	$show "$mkdir ${xdir}$objdir"
91452f9793fSmrg	$run $mkdir ${xdir}$objdir
91552f9793fSmrg	exit_status=$?
91652f9793fSmrg	if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
91752f9793fSmrg	  exit $exit_status
91852f9793fSmrg	fi
91952f9793fSmrg      fi
92052f9793fSmrg
92152f9793fSmrg      if test -z "$output_obj"; then
92252f9793fSmrg	# Place PIC objects in $objdir
92352f9793fSmrg	command="$command -o $lobj"
92452f9793fSmrg      fi
92552f9793fSmrg
92652f9793fSmrg      $run $rm "$lobj" "$output_obj"
92752f9793fSmrg
92852f9793fSmrg      $show "$command"
92952f9793fSmrg      if $run eval "$command"; then :
93052f9793fSmrg      else
93152f9793fSmrg	test -n "$output_obj" && $run $rm $removelist
93252f9793fSmrg	exit $EXIT_FAILURE
93352f9793fSmrg      fi
93452f9793fSmrg
93552f9793fSmrg      if test "$need_locks" = warn &&
93652f9793fSmrg	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
93752f9793fSmrg	$echo "\
93852f9793fSmrg*** ERROR, $lockfile contains:
93952f9793fSmrg`cat $lockfile 2>/dev/null`
94052f9793fSmrg
94152f9793fSmrgbut it should contain:
94252f9793fSmrg$srcfile
94352f9793fSmrg
94452f9793fSmrgThis indicates that another process is trying to use the same
94552f9793fSmrgtemporary object file, and libtool could not work around it because
94652f9793fSmrgyour compiler does not support \`-c' and \`-o' together.  If you
94752f9793fSmrgrepeat this compilation, it may succeed, by chance, but you had better
94852f9793fSmrgavoid parallel builds (make -j) in this platform, or get a better
94952f9793fSmrgcompiler."
95052f9793fSmrg
95152f9793fSmrg	$run $rm $removelist
95252f9793fSmrg	exit $EXIT_FAILURE
95352f9793fSmrg      fi
95452f9793fSmrg
95552f9793fSmrg      # Just move the object if needed, then go on to compile the next one
95652f9793fSmrg      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
95752f9793fSmrg	$show "$mv $output_obj $lobj"
95852f9793fSmrg	if $run $mv $output_obj $lobj; then :
95952f9793fSmrg	else
96052f9793fSmrg	  error=$?
96152f9793fSmrg	  $run $rm $removelist
96252f9793fSmrg	  exit $error
96352f9793fSmrg	fi
96452f9793fSmrg      fi
96552f9793fSmrg
96652f9793fSmrg      # Append the name of the PIC object to the libtool object file.
96752f9793fSmrg      test -z "$run" && cat >> ${libobj}T <<EOF
96852f9793fSmrgpic_object='$objdir/$objname'
96952f9793fSmrg
97052f9793fSmrgEOF
97152f9793fSmrg
97252f9793fSmrg      # Allow error messages only from the first compilation.
97352f9793fSmrg      if test "$suppress_opt" = yes; then
97452f9793fSmrg        suppress_output=' >/dev/null 2>&1'
97552f9793fSmrg      fi
97652f9793fSmrg    else
97752f9793fSmrg      # No PIC object so indicate it doesn't exist in the libtool
97852f9793fSmrg      # object file.
97952f9793fSmrg      test -z "$run" && cat >> ${libobj}T <<EOF
98052f9793fSmrgpic_object=none
98152f9793fSmrg
98252f9793fSmrgEOF
98352f9793fSmrg    fi
98452f9793fSmrg
98552f9793fSmrg    # Only build a position-dependent object if we build old libraries.
98652f9793fSmrg    if test "$build_old_libs" = yes; then
98752f9793fSmrg      if test "$pic_mode" != yes; then
98852f9793fSmrg	# Don't build PIC code
98952f9793fSmrg	command="$base_compile $qsrcfile"
99052f9793fSmrg      else
99152f9793fSmrg	command="$base_compile $qsrcfile $pic_flag"
99252f9793fSmrg      fi
99352f9793fSmrg      if test "$compiler_c_o" = yes; then
99452f9793fSmrg	command="$command -o $obj"
99552f9793fSmrg      fi
99652f9793fSmrg
99752f9793fSmrg      # Suppress compiler output if we already did a PIC compilation.
99852f9793fSmrg      command="$command$suppress_output"
99952f9793fSmrg      $run $rm "$obj" "$output_obj"
100052f9793fSmrg      $show "$command"
100152f9793fSmrg      if $run eval "$command"; then :
100252f9793fSmrg      else
100352f9793fSmrg	$run $rm $removelist
100452f9793fSmrg	exit $EXIT_FAILURE
100552f9793fSmrg      fi
100652f9793fSmrg
100752f9793fSmrg      if test "$need_locks" = warn &&
100852f9793fSmrg	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
100952f9793fSmrg	$echo "\
101052f9793fSmrg*** ERROR, $lockfile contains:
101152f9793fSmrg`cat $lockfile 2>/dev/null`
101252f9793fSmrg
101352f9793fSmrgbut it should contain:
101452f9793fSmrg$srcfile
101552f9793fSmrg
101652f9793fSmrgThis indicates that another process is trying to use the same
101752f9793fSmrgtemporary object file, and libtool could not work around it because
101852f9793fSmrgyour compiler does not support \`-c' and \`-o' together.  If you
101952f9793fSmrgrepeat this compilation, it may succeed, by chance, but you had better
102052f9793fSmrgavoid parallel builds (make -j) in this platform, or get a better
102152f9793fSmrgcompiler."
102252f9793fSmrg
102352f9793fSmrg	$run $rm $removelist
102452f9793fSmrg	exit $EXIT_FAILURE
102552f9793fSmrg      fi
102652f9793fSmrg
102752f9793fSmrg      # Just move the object if needed
102852f9793fSmrg      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
102952f9793fSmrg	$show "$mv $output_obj $obj"
103052f9793fSmrg	if $run $mv $output_obj $obj; then :
103152f9793fSmrg	else
103252f9793fSmrg	  error=$?
103352f9793fSmrg	  $run $rm $removelist
103452f9793fSmrg	  exit $error
103552f9793fSmrg	fi
103652f9793fSmrg      fi
103752f9793fSmrg
103852f9793fSmrg      # Append the name of the non-PIC object the libtool object file.
103952f9793fSmrg      # Only append if the libtool object file exists.
104052f9793fSmrg      test -z "$run" && cat >> ${libobj}T <<EOF
104152f9793fSmrg# Name of the non-PIC object.
104252f9793fSmrgnon_pic_object='$objname'
104352f9793fSmrg
104452f9793fSmrgEOF
104552f9793fSmrg    else
104652f9793fSmrg      # Append the name of the non-PIC object the libtool object file.
104752f9793fSmrg      # Only append if the libtool object file exists.
104852f9793fSmrg      test -z "$run" && cat >> ${libobj}T <<EOF
104952f9793fSmrg# Name of the non-PIC object.
105052f9793fSmrgnon_pic_object=none
105152f9793fSmrg
105252f9793fSmrgEOF
105352f9793fSmrg    fi
105452f9793fSmrg
105552f9793fSmrg    $run $mv "${libobj}T" "${libobj}"
105652f9793fSmrg
105752f9793fSmrg    # Unlock the critical section if it was locked
105852f9793fSmrg    if test "$need_locks" != no; then
105952f9793fSmrg      $run $rm "$lockfile"
106052f9793fSmrg    fi
106152f9793fSmrg
106252f9793fSmrg    exit $EXIT_SUCCESS
106352f9793fSmrg    ;;
106452f9793fSmrg
106552f9793fSmrg  # libtool link mode
106652f9793fSmrg  link | relink)
106752f9793fSmrg    modename="$modename: link"
106852f9793fSmrg    case $host in
106952f9793fSmrg    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
107052f9793fSmrg      # It is impossible to link a dll without this setting, and
107152f9793fSmrg      # we shouldn't force the makefile maintainer to figure out
107252f9793fSmrg      # which system we are compiling for in order to pass an extra
107352f9793fSmrg      # flag for every libtool invocation.
107452f9793fSmrg      # allow_undefined=no
107552f9793fSmrg
107652f9793fSmrg      # FIXME: Unfortunately, there are problems with the above when trying
107752f9793fSmrg      # to make a dll which has undefined symbols, in which case not
107852f9793fSmrg      # even a static library is built.  For now, we need to specify
107952f9793fSmrg      # -no-undefined on the libtool link line when we can be certain
108052f9793fSmrg      # that all symbols are satisfied, otherwise we get a static library.
108152f9793fSmrg      allow_undefined=yes
108252f9793fSmrg      ;;
108352f9793fSmrg    *)
108452f9793fSmrg      allow_undefined=yes
108552f9793fSmrg      ;;
108652f9793fSmrg    esac
108752f9793fSmrg    libtool_args="$nonopt"
108852f9793fSmrg    base_compile="$nonopt $@"
108952f9793fSmrg    compile_command="$nonopt"
109052f9793fSmrg    finalize_command="$nonopt"
109152f9793fSmrg
109252f9793fSmrg    compile_rpath=
109352f9793fSmrg    finalize_rpath=
109452f9793fSmrg    compile_shlibpath=
109552f9793fSmrg    finalize_shlibpath=
109652f9793fSmrg    convenience=
109752f9793fSmrg    old_convenience=
109852f9793fSmrg    deplibs=
109952f9793fSmrg    old_deplibs=
110052f9793fSmrg    compiler_flags=
110152f9793fSmrg    linker_flags=
110252f9793fSmrg    dllsearchpath=
110352f9793fSmrg    lib_search_path=`pwd`
110452f9793fSmrg    inst_prefix_dir=
110552f9793fSmrg
110652f9793fSmrg    avoid_version=no
110752f9793fSmrg    dlfiles=
110852f9793fSmrg    dlprefiles=
110952f9793fSmrg    dlself=no
111052f9793fSmrg    export_dynamic=no
111152f9793fSmrg    export_symbols=
111252f9793fSmrg    export_symbols_regex=
111352f9793fSmrg    generated=
111452f9793fSmrg    libobjs=
111552f9793fSmrg    ltlibs=
111652f9793fSmrg    module=no
111752f9793fSmrg    no_install=no
111852f9793fSmrg    objs=
111952f9793fSmrg    non_pic_objects=
112052f9793fSmrg    notinst_path= # paths that contain not-installed libtool libraries
112152f9793fSmrg    precious_files_regex=
112252f9793fSmrg    prefer_static_libs=no
112352f9793fSmrg    preload=no
112452f9793fSmrg    prev=
112552f9793fSmrg    prevarg=
112652f9793fSmrg    release=
112752f9793fSmrg    rpath=
112852f9793fSmrg    xrpath=
112952f9793fSmrg    perm_rpath=
113052f9793fSmrg    temp_rpath=
113152f9793fSmrg    thread_safe=no
113252f9793fSmrg    vinfo=
113352f9793fSmrg    vinfo_number=no
113452f9793fSmrg
113552f9793fSmrg    func_infer_tag $base_compile
113652f9793fSmrg
113752f9793fSmrg    # We need to know -static, to get the right output filenames.
113852f9793fSmrg    for arg
113952f9793fSmrg    do
114052f9793fSmrg      case $arg in
114152f9793fSmrg      -all-static | -static)
114252f9793fSmrg	if test "X$arg" = "X-all-static"; then
114352f9793fSmrg	  if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
114452f9793fSmrg	    $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
114552f9793fSmrg	  fi
114652f9793fSmrg	  if test -n "$link_static_flag"; then
114752f9793fSmrg	    dlopen_self=$dlopen_self_static
114852f9793fSmrg	  fi
114952f9793fSmrg	  prefer_static_libs=yes
115052f9793fSmrg	else
115152f9793fSmrg	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
115252f9793fSmrg	    dlopen_self=$dlopen_self_static
115352f9793fSmrg	  fi
115452f9793fSmrg	  prefer_static_libs=built
115552f9793fSmrg	fi
115652f9793fSmrg	build_libtool_libs=no
115752f9793fSmrg	build_old_libs=yes
115852f9793fSmrg	break
115952f9793fSmrg	;;
116052f9793fSmrg      esac
116152f9793fSmrg    done
116252f9793fSmrg
116352f9793fSmrg    # See if our shared archives depend on static archives.
116452f9793fSmrg    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
116552f9793fSmrg
116652f9793fSmrg    # Go through the arguments, transforming them on the way.
116752f9793fSmrg    while test "$#" -gt 0; do
116852f9793fSmrg      arg="$1"
116952f9793fSmrg      shift
117052f9793fSmrg      case $arg in
117152f9793fSmrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
117252f9793fSmrg	qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
117352f9793fSmrg	;;
117452f9793fSmrg      *) qarg=$arg ;;
117552f9793fSmrg      esac
117652f9793fSmrg      libtool_args="$libtool_args $qarg"
117752f9793fSmrg
117852f9793fSmrg      # If the previous option needs an argument, assign it.
117952f9793fSmrg      if test -n "$prev"; then
118052f9793fSmrg	case $prev in
118152f9793fSmrg	output)
118252f9793fSmrg	  compile_command="$compile_command @OUTPUT@"
118352f9793fSmrg	  finalize_command="$finalize_command @OUTPUT@"
118452f9793fSmrg	  ;;
118552f9793fSmrg	esac
118652f9793fSmrg
118752f9793fSmrg	case $prev in
118852f9793fSmrg	dlfiles|dlprefiles)
118952f9793fSmrg	  if test "$preload" = no; then
119052f9793fSmrg	    # Add the symbol object into the linking commands.
119152f9793fSmrg	    compile_command="$compile_command @SYMFILE@"
119252f9793fSmrg	    finalize_command="$finalize_command @SYMFILE@"
119352f9793fSmrg	    preload=yes
119452f9793fSmrg	  fi
119552f9793fSmrg	  case $arg in
119652f9793fSmrg	  *.la | *.lo) ;;  # We handle these cases below.
119752f9793fSmrg	  force)
119852f9793fSmrg	    if test "$dlself" = no; then
119952f9793fSmrg	      dlself=needless
120052f9793fSmrg	      export_dynamic=yes
120152f9793fSmrg	    fi
120252f9793fSmrg	    prev=
120352f9793fSmrg	    continue
120452f9793fSmrg	    ;;
120552f9793fSmrg	  self)
120652f9793fSmrg	    if test "$prev" = dlprefiles; then
120752f9793fSmrg	      dlself=yes
120852f9793fSmrg	    elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
120952f9793fSmrg	      dlself=yes
121052f9793fSmrg	    else
121152f9793fSmrg	      dlself=needless
121252f9793fSmrg	      export_dynamic=yes
121352f9793fSmrg	    fi
121452f9793fSmrg	    prev=
121552f9793fSmrg	    continue
121652f9793fSmrg	    ;;
121752f9793fSmrg	  *)
121852f9793fSmrg	    if test "$prev" = dlfiles; then
121952f9793fSmrg	      dlfiles="$dlfiles $arg"
122052f9793fSmrg	    else
122152f9793fSmrg	      dlprefiles="$dlprefiles $arg"
122252f9793fSmrg	    fi
122352f9793fSmrg	    prev=
122452f9793fSmrg	    continue
122552f9793fSmrg	    ;;
122652f9793fSmrg	  esac
122752f9793fSmrg	  ;;
122852f9793fSmrg	expsyms)
122952f9793fSmrg	  export_symbols="$arg"
123052f9793fSmrg	  if test ! -f "$arg"; then
123152f9793fSmrg	    $echo "$modename: symbol file \`$arg' does not exist"
123252f9793fSmrg	    exit $EXIT_FAILURE
123352f9793fSmrg	  fi
123452f9793fSmrg	  prev=
123552f9793fSmrg	  continue
123652f9793fSmrg	  ;;
123752f9793fSmrg	expsyms_regex)
123852f9793fSmrg	  export_symbols_regex="$arg"
123952f9793fSmrg	  prev=
124052f9793fSmrg	  continue
124152f9793fSmrg	  ;;
124252f9793fSmrg	inst_prefix)
124352f9793fSmrg	  inst_prefix_dir="$arg"
124452f9793fSmrg	  prev=
124552f9793fSmrg	  continue
124652f9793fSmrg	  ;;
124752f9793fSmrg	precious_regex)
124852f9793fSmrg	  precious_files_regex="$arg"
124952f9793fSmrg	  prev=
125052f9793fSmrg	  continue
125152f9793fSmrg	  ;;
125252f9793fSmrg	release)
125352f9793fSmrg	  release="-$arg"
125452f9793fSmrg	  prev=
125552f9793fSmrg	  continue
125652f9793fSmrg	  ;;
125752f9793fSmrg	objectlist)
125852f9793fSmrg	  if test -f "$arg"; then
125952f9793fSmrg	    save_arg=$arg
126052f9793fSmrg	    moreargs=
126152f9793fSmrg	    for fil in `cat $save_arg`
126252f9793fSmrg	    do
126352f9793fSmrg#	      moreargs="$moreargs $fil"
126452f9793fSmrg	      arg=$fil
126552f9793fSmrg	      # A libtool-controlled object.
126652f9793fSmrg
126752f9793fSmrg	      # Check to see that this really is a libtool object.
126852f9793fSmrg	      if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
126952f9793fSmrg		pic_object=
127052f9793fSmrg		non_pic_object=
127152f9793fSmrg
127252f9793fSmrg		# Read the .lo file
127352f9793fSmrg		# If there is no directory component, then add one.
127452f9793fSmrg		case $arg in
127552f9793fSmrg		*/* | *\\*) . $arg ;;
127652f9793fSmrg		*) . ./$arg ;;
127752f9793fSmrg		esac
127852f9793fSmrg
127952f9793fSmrg		if test -z "$pic_object" || \
128052f9793fSmrg		   test -z "$non_pic_object" ||
128152f9793fSmrg		   test "$pic_object" = none && \
128252f9793fSmrg		   test "$non_pic_object" = none; then
128352f9793fSmrg		  $echo "$modename: cannot find name of object for \`$arg'" 1>&2
128452f9793fSmrg		  exit $EXIT_FAILURE
128552f9793fSmrg		fi
128652f9793fSmrg
128752f9793fSmrg		# Extract subdirectory from the argument.
128852f9793fSmrg		xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
128952f9793fSmrg		if test "X$xdir" = "X$arg"; then
129052f9793fSmrg		  xdir=
129152f9793fSmrg		else
129252f9793fSmrg		  xdir="$xdir/"
129352f9793fSmrg		fi
129452f9793fSmrg
129552f9793fSmrg		if test "$pic_object" != none; then
129652f9793fSmrg		  # Prepend the subdirectory the object is found in.
129752f9793fSmrg		  pic_object="$xdir$pic_object"
129852f9793fSmrg
129952f9793fSmrg		  if test "$prev" = dlfiles; then
130052f9793fSmrg		    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
130152f9793fSmrg		      dlfiles="$dlfiles $pic_object"
130252f9793fSmrg		      prev=
130352f9793fSmrg		      continue
130452f9793fSmrg		    else
130552f9793fSmrg		      # If libtool objects are unsupported, then we need to preload.
130652f9793fSmrg		      prev=dlprefiles
130752f9793fSmrg		    fi
130852f9793fSmrg		  fi
130952f9793fSmrg
131052f9793fSmrg		  # CHECK ME:  I think I busted this.  -Ossama
131152f9793fSmrg		  if test "$prev" = dlprefiles; then
131252f9793fSmrg		    # Preload the old-style object.
131352f9793fSmrg		    dlprefiles="$dlprefiles $pic_object"
131452f9793fSmrg		    prev=
131552f9793fSmrg		  fi
131652f9793fSmrg
131752f9793fSmrg		  # A PIC object.
131852f9793fSmrg		  libobjs="$libobjs $pic_object"
131952f9793fSmrg		  arg="$pic_object"
132052f9793fSmrg		fi
132152f9793fSmrg
132252f9793fSmrg		# Non-PIC object.
132352f9793fSmrg		if test "$non_pic_object" != none; then
132452f9793fSmrg		  # Prepend the subdirectory the object is found in.
132552f9793fSmrg		  non_pic_object="$xdir$non_pic_object"
132652f9793fSmrg
132752f9793fSmrg		  # A standard non-PIC object
132852f9793fSmrg		  non_pic_objects="$non_pic_objects $non_pic_object"
132952f9793fSmrg		  if test -z "$pic_object" || test "$pic_object" = none ; then
133052f9793fSmrg		    arg="$non_pic_object"
133152f9793fSmrg		  fi
133252f9793fSmrg		else
133352f9793fSmrg		  # If the PIC object exists, use it instead.
133452f9793fSmrg		  # $xdir was prepended to $pic_object above.
133552f9793fSmrg		  non_pic_object="$pic_object"
133652f9793fSmrg		  non_pic_objects="$non_pic_objects $non_pic_object"
133752f9793fSmrg		fi
133852f9793fSmrg	      else
133952f9793fSmrg		# Only an error if not doing a dry-run.
134052f9793fSmrg		if test -z "$run"; then
134152f9793fSmrg		  $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
134252f9793fSmrg		  exit $EXIT_FAILURE
134352f9793fSmrg		else
134452f9793fSmrg		  # Dry-run case.
134552f9793fSmrg
134652f9793fSmrg		  # Extract subdirectory from the argument.
134752f9793fSmrg		  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
134852f9793fSmrg		  if test "X$xdir" = "X$arg"; then
134952f9793fSmrg		    xdir=
135052f9793fSmrg		  else
135152f9793fSmrg		    xdir="$xdir/"
135252f9793fSmrg		  fi
135352f9793fSmrg
135452f9793fSmrg		  pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
135552f9793fSmrg		  non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
135652f9793fSmrg		  libobjs="$libobjs $pic_object"
135752f9793fSmrg		  non_pic_objects="$non_pic_objects $non_pic_object"
135852f9793fSmrg		fi
135952f9793fSmrg	      fi
136052f9793fSmrg	    done
136152f9793fSmrg	  else
136252f9793fSmrg	    $echo "$modename: link input file \`$save_arg' does not exist"
136352f9793fSmrg	    exit $EXIT_FAILURE
136452f9793fSmrg	  fi
136552f9793fSmrg	  arg=$save_arg
136652f9793fSmrg	  prev=
136752f9793fSmrg	  continue
136852f9793fSmrg	  ;;
136952f9793fSmrg	rpath | xrpath)
137052f9793fSmrg	  # We need an absolute path.
137152f9793fSmrg	  case $arg in
137252f9793fSmrg	  [\\/]* | [A-Za-z]:[\\/]*) ;;
137352f9793fSmrg	  *)
137452f9793fSmrg	    $echo "$modename: only absolute run-paths are allowed" 1>&2
137552f9793fSmrg	    exit $EXIT_FAILURE
137652f9793fSmrg	    ;;
137752f9793fSmrg	  esac
137852f9793fSmrg	  if test "$prev" = rpath; then
137952f9793fSmrg	    case "$rpath " in
138052f9793fSmrg	    *" $arg "*) ;;
138152f9793fSmrg	    *) rpath="$rpath $arg" ;;
138252f9793fSmrg	    esac
138352f9793fSmrg	  else
138452f9793fSmrg	    case "$xrpath " in
138552f9793fSmrg	    *" $arg "*) ;;
138652f9793fSmrg	    *) xrpath="$xrpath $arg" ;;
138752f9793fSmrg	    esac
138852f9793fSmrg	  fi
138952f9793fSmrg	  prev=
139052f9793fSmrg	  continue
139152f9793fSmrg	  ;;
139252f9793fSmrg	xcompiler)
139352f9793fSmrg	  compiler_flags="$compiler_flags $qarg"
139452f9793fSmrg	  prev=
139552f9793fSmrg	  compile_command="$compile_command $qarg"
139652f9793fSmrg	  finalize_command="$finalize_command $qarg"
139752f9793fSmrg	  continue
139852f9793fSmrg	  ;;
139952f9793fSmrg	xlinker)
140052f9793fSmrg	  linker_flags="$linker_flags $qarg"
140152f9793fSmrg	  compiler_flags="$compiler_flags $wl$qarg"
140252f9793fSmrg	  prev=
140352f9793fSmrg	  compile_command="$compile_command $wl$qarg"
140452f9793fSmrg	  finalize_command="$finalize_command $wl$qarg"
140552f9793fSmrg	  continue
140652f9793fSmrg	  ;;
140752f9793fSmrg	xcclinker)
140852f9793fSmrg	  linker_flags="$linker_flags $qarg"
140952f9793fSmrg	  compiler_flags="$compiler_flags $qarg"
141052f9793fSmrg	  prev=
141152f9793fSmrg	  compile_command="$compile_command $qarg"
141252f9793fSmrg	  finalize_command="$finalize_command $qarg"
141352f9793fSmrg	  continue
141452f9793fSmrg	  ;;
141552f9793fSmrg	shrext)
141652f9793fSmrg  	  shrext_cmds="$arg"
141752f9793fSmrg	  prev=
141852f9793fSmrg	  continue
141952f9793fSmrg	  ;;
142052f9793fSmrg	darwin_framework|darwin_framework_skip)
142152f9793fSmrg	  test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
142252f9793fSmrg	  compile_command="$compile_command $arg"
142352f9793fSmrg	  finalize_command="$finalize_command $arg"
142452f9793fSmrg	  prev=
142552f9793fSmrg	  continue
142652f9793fSmrg	  ;;
142752f9793fSmrg	*)
142852f9793fSmrg	  eval "$prev=\"\$arg\""
142952f9793fSmrg	  prev=
143052f9793fSmrg	  continue
143152f9793fSmrg	  ;;
143252f9793fSmrg	esac
143352f9793fSmrg      fi # test -n "$prev"
143452f9793fSmrg
143552f9793fSmrg      prevarg="$arg"
143652f9793fSmrg
143752f9793fSmrg      case $arg in
143852f9793fSmrg      -all-static)
143952f9793fSmrg	if test -n "$link_static_flag"; then
144052f9793fSmrg	  compile_command="$compile_command $link_static_flag"
144152f9793fSmrg	  finalize_command="$finalize_command $link_static_flag"
144252f9793fSmrg	fi
144352f9793fSmrg	continue
144452f9793fSmrg	;;
144552f9793fSmrg
144652f9793fSmrg      -allow-undefined)
144752f9793fSmrg	# FIXME: remove this flag sometime in the future.
144852f9793fSmrg	$echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
144952f9793fSmrg	continue
145052f9793fSmrg	;;
145152f9793fSmrg
145252f9793fSmrg      -avoid-version)
145352f9793fSmrg	avoid_version=yes
145452f9793fSmrg	continue
145552f9793fSmrg	;;
145652f9793fSmrg
145752f9793fSmrg      -dlopen)
145852f9793fSmrg	prev=dlfiles
145952f9793fSmrg	continue
146052f9793fSmrg	;;
146152f9793fSmrg
146252f9793fSmrg      -dlpreopen)
146352f9793fSmrg	prev=dlprefiles
146452f9793fSmrg	continue
146552f9793fSmrg	;;
146652f9793fSmrg
146752f9793fSmrg      -export-dynamic)
146852f9793fSmrg	export_dynamic=yes
146952f9793fSmrg	continue
147052f9793fSmrg	;;
147152f9793fSmrg
147252f9793fSmrg      -export-symbols | -export-symbols-regex)
147352f9793fSmrg	if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
147452f9793fSmrg	  $echo "$modename: more than one -exported-symbols argument is not allowed"
147552f9793fSmrg	  exit $EXIT_FAILURE
147652f9793fSmrg	fi
147752f9793fSmrg	if test "X$arg" = "X-export-symbols"; then
147852f9793fSmrg	  prev=expsyms
147952f9793fSmrg	else
148052f9793fSmrg	  prev=expsyms_regex
148152f9793fSmrg	fi
148252f9793fSmrg	continue
148352f9793fSmrg	;;
148452f9793fSmrg
148552f9793fSmrg      -framework|-arch|-isysroot)
148652f9793fSmrg	case " $CC " in
148752f9793fSmrg	  *" ${arg} ${1} "* | *" ${arg}	${1} "*) 
148852f9793fSmrg		prev=darwin_framework_skip ;;
148952f9793fSmrg	  *) compiler_flags="$compiler_flags $arg"
149052f9793fSmrg	     prev=darwin_framework ;;
149152f9793fSmrg	esac
149252f9793fSmrg	compile_command="$compile_command $arg"
149352f9793fSmrg	finalize_command="$finalize_command $arg"
149452f9793fSmrg	continue
149552f9793fSmrg	;;
149652f9793fSmrg
149752f9793fSmrg      -inst-prefix-dir)
149852f9793fSmrg	prev=inst_prefix
149952f9793fSmrg	continue
150052f9793fSmrg	;;
150152f9793fSmrg
150252f9793fSmrg      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
150352f9793fSmrg      # so, if we see these flags be careful not to treat them like -L
150452f9793fSmrg      -L[A-Z][A-Z]*:*)
150552f9793fSmrg	case $with_gcc/$host in
150652f9793fSmrg	no/*-*-irix* | /*-*-irix*)
150752f9793fSmrg	  compile_command="$compile_command $arg"
150852f9793fSmrg	  finalize_command="$finalize_command $arg"
150952f9793fSmrg	  ;;
151052f9793fSmrg	esac
151152f9793fSmrg	continue
151252f9793fSmrg	;;
151352f9793fSmrg
151452f9793fSmrg      -L*)
151552f9793fSmrg	dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
151652f9793fSmrg	# We need an absolute path.
151752f9793fSmrg	case $dir in
151852f9793fSmrg	[\\/]* | [A-Za-z]:[\\/]*) ;;
151952f9793fSmrg	*)
152052f9793fSmrg	  absdir=`cd "$dir" && pwd`
152152f9793fSmrg	  if test -z "$absdir"; then
152252f9793fSmrg	    $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
152352f9793fSmrg	    absdir="$dir"
152452f9793fSmrg	    notinst_path="$notinst_path $dir"
152552f9793fSmrg	  fi
152652f9793fSmrg	  dir="$absdir"
152752f9793fSmrg	  ;;
152852f9793fSmrg	esac
152952f9793fSmrg	case "$deplibs " in
153052f9793fSmrg	*" -L$dir "*) ;;
153152f9793fSmrg	*)
153252f9793fSmrg	  deplibs="$deplibs -L$dir"
153352f9793fSmrg	  lib_search_path="$lib_search_path $dir"
153452f9793fSmrg	  ;;
153552f9793fSmrg	esac
153652f9793fSmrg	case $host in
153752f9793fSmrg	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
153852f9793fSmrg	  testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
153952f9793fSmrg	  case :$dllsearchpath: in
154052f9793fSmrg	  *":$dir:"*) ;;
154152f9793fSmrg	  *) dllsearchpath="$dllsearchpath:$dir";;
154252f9793fSmrg	  esac
154352f9793fSmrg	  case :$dllsearchpath: in
154452f9793fSmrg	  *":$testbindir:"*) ;;
154552f9793fSmrg	  *) dllsearchpath="$dllsearchpath:$testbindir";;
154652f9793fSmrg	  esac
154752f9793fSmrg	  ;;
154852f9793fSmrg	esac
154952f9793fSmrg	continue
155052f9793fSmrg	;;
155152f9793fSmrg
155252f9793fSmrg      -l*)
155352f9793fSmrg	if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
155452f9793fSmrg	  case $host in
155552f9793fSmrg	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
155652f9793fSmrg	    # These systems don't actually have a C or math library (as such)
155752f9793fSmrg	    continue
155852f9793fSmrg	    ;;
155952f9793fSmrg	  *-*-os2*)
156052f9793fSmrg	    # These systems don't actually have a C library (as such)
156152f9793fSmrg	    test "X$arg" = "X-lc" && continue
156252f9793fSmrg	    ;;
156352f9793fSmrg	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
156452f9793fSmrg	    # Do not include libc due to us having libc/libc_r.
156552f9793fSmrg	    test "X$arg" = "X-lc" && continue
156652f9793fSmrg	    ;;
156752f9793fSmrg	  *-*-rhapsody* | *-*-darwin1.[012])
156852f9793fSmrg	    # Rhapsody C and math libraries are in the System framework
156952f9793fSmrg	    deplibs="$deplibs -framework System"
157052f9793fSmrg	    continue
157152f9793fSmrg	    ;;
157252f9793fSmrg	  *-*-sco3.2v5* | *-*-sco5v6*)
157352f9793fSmrg	    # Causes problems with __ctype
157452f9793fSmrg	    test "X$arg" = "X-lc" && continue
157552f9793fSmrg	    ;;
157652f9793fSmrg	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
157752f9793fSmrg	    # Compiler inserts libc in the correct place for threads to work
157852f9793fSmrg	    test "X$arg" = "X-lc" && continue
157952f9793fSmrg	    ;;
158052f9793fSmrg	  esac
158152f9793fSmrg	elif test "X$arg" = "X-lc_r"; then
158252f9793fSmrg	 case $host in
158352f9793fSmrg	 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
158452f9793fSmrg	   # Do not include libc_r directly, use -pthread flag.
158552f9793fSmrg	   continue
158652f9793fSmrg	   ;;
158752f9793fSmrg	 esac
158852f9793fSmrg	fi
158952f9793fSmrg	deplibs="$deplibs $arg"
159052f9793fSmrg	continue
159152f9793fSmrg	;;
159252f9793fSmrg
159352f9793fSmrg      # Tru64 UNIX uses -model [arg] to determine the layout of C++
159452f9793fSmrg      # classes, name mangling, and exception handling.
159552f9793fSmrg      -model)
159652f9793fSmrg	compile_command="$compile_command $arg"
159752f9793fSmrg	compiler_flags="$compiler_flags $arg"
159852f9793fSmrg	finalize_command="$finalize_command $arg"
159952f9793fSmrg	prev=xcompiler
160052f9793fSmrg	continue
160152f9793fSmrg	;;
160252f9793fSmrg
160352f9793fSmrg     -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
160452f9793fSmrg	compiler_flags="$compiler_flags $arg"
160552f9793fSmrg	compile_command="$compile_command $arg"
160652f9793fSmrg	finalize_command="$finalize_command $arg"
160752f9793fSmrg	continue
160852f9793fSmrg	;;
160952f9793fSmrg
161052f9793fSmrg      -module)
161152f9793fSmrg	module=yes
161252f9793fSmrg	continue
161352f9793fSmrg	;;
161452f9793fSmrg
161552f9793fSmrg      # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
161652f9793fSmrg      # -r[0-9][0-9]* specifies the processor on the SGI compiler
161752f9793fSmrg      # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
161852f9793fSmrg      # +DA*, +DD* enable 64-bit mode on the HP compiler
161952f9793fSmrg      # -q* pass through compiler args for the IBM compiler
162052f9793fSmrg      # -m* pass through architecture-specific compiler args for GCC
162152f9793fSmrg      # -m*, -t[45]*, -txscale* pass through architecture-specific
162252f9793fSmrg      # compiler args for GCC
162352f9793fSmrg      # -pg pass through profiling flag for GCC
162452f9793fSmrg      # @file GCC response files
162552f9793fSmrg      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \
162652f9793fSmrg      -t[45]*|-txscale*|@*)
162752f9793fSmrg
162852f9793fSmrg	# Unknown arguments in both finalize_command and compile_command need
162952f9793fSmrg	# to be aesthetically quoted because they are evaled later.
163052f9793fSmrg	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
163152f9793fSmrg	case $arg in
163252f9793fSmrg	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
163352f9793fSmrg	  arg="\"$arg\""
163452f9793fSmrg	  ;;
163552f9793fSmrg	esac
163652f9793fSmrg        compile_command="$compile_command $arg"
163752f9793fSmrg        finalize_command="$finalize_command $arg"
163852f9793fSmrg        compiler_flags="$compiler_flags $arg"
163952f9793fSmrg        continue
164052f9793fSmrg        ;;
164152f9793fSmrg
164252f9793fSmrg      -shrext)
164352f9793fSmrg	prev=shrext
164452f9793fSmrg	continue
164552f9793fSmrg	;;
164652f9793fSmrg
164752f9793fSmrg      -no-fast-install)
164852f9793fSmrg	fast_install=no
164952f9793fSmrg	continue
165052f9793fSmrg	;;
165152f9793fSmrg
165252f9793fSmrg      -no-install)
165352f9793fSmrg	case $host in
165452f9793fSmrg	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
165552f9793fSmrg	  # The PATH hackery in wrapper scripts is required on Windows
165652f9793fSmrg	  # in order for the loader to find any dlls it needs.
165752f9793fSmrg	  $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
165852f9793fSmrg	  $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
165952f9793fSmrg	  fast_install=no
166052f9793fSmrg	  ;;
166152f9793fSmrg	*) no_install=yes ;;
166252f9793fSmrg	esac
166352f9793fSmrg	continue
166452f9793fSmrg	;;
166552f9793fSmrg
166652f9793fSmrg      -no-undefined)
166752f9793fSmrg	allow_undefined=no
166852f9793fSmrg	continue
166952f9793fSmrg	;;
167052f9793fSmrg
167152f9793fSmrg      -objectlist)
167252f9793fSmrg	prev=objectlist
167352f9793fSmrg	continue
167452f9793fSmrg	;;
167552f9793fSmrg
167652f9793fSmrg      -o) prev=output ;;
167752f9793fSmrg
167852f9793fSmrg      -precious-files-regex)
167952f9793fSmrg	prev=precious_regex
168052f9793fSmrg	continue
168152f9793fSmrg	;;
168252f9793fSmrg
168352f9793fSmrg      -release)
168452f9793fSmrg	prev=release
168552f9793fSmrg	continue
168652f9793fSmrg	;;
168752f9793fSmrg
168852f9793fSmrg      -rpath)
168952f9793fSmrg	prev=rpath
169052f9793fSmrg	continue
169152f9793fSmrg	;;
169252f9793fSmrg
169352f9793fSmrg      -R)
169452f9793fSmrg	prev=xrpath
169552f9793fSmrg	continue
169652f9793fSmrg	;;
169752f9793fSmrg
169852f9793fSmrg      -R*)
169952f9793fSmrg	dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
170052f9793fSmrg	# We need an absolute path.
170152f9793fSmrg	case $dir in
170252f9793fSmrg	[\\/]* | [A-Za-z]:[\\/]*) ;;
170352f9793fSmrg	*)
170452f9793fSmrg	  $echo "$modename: only absolute run-paths are allowed" 1>&2
170552f9793fSmrg	  exit $EXIT_FAILURE
170652f9793fSmrg	  ;;
170752f9793fSmrg	esac
170852f9793fSmrg	case "$xrpath " in
170952f9793fSmrg	*" $dir "*) ;;
171052f9793fSmrg	*) xrpath="$xrpath $dir" ;;
171152f9793fSmrg	esac
171252f9793fSmrg	continue
171352f9793fSmrg	;;
171452f9793fSmrg
171552f9793fSmrg      -static)
171652f9793fSmrg	# The effects of -static are defined in a previous loop.
171752f9793fSmrg	# We used to do the same as -all-static on platforms that
171852f9793fSmrg	# didn't have a PIC flag, but the assumption that the effects
171952f9793fSmrg	# would be equivalent was wrong.  It would break on at least
172052f9793fSmrg	# Digital Unix and AIX.
172152f9793fSmrg	continue
172252f9793fSmrg	;;
172352f9793fSmrg
172452f9793fSmrg      -thread-safe)
172552f9793fSmrg	thread_safe=yes
172652f9793fSmrg	continue
172752f9793fSmrg	;;
172852f9793fSmrg
172952f9793fSmrg      -version-info)
173052f9793fSmrg	prev=vinfo
173152f9793fSmrg	continue
173252f9793fSmrg	;;
173352f9793fSmrg      -version-number)
173452f9793fSmrg	prev=vinfo
173552f9793fSmrg	vinfo_number=yes
173652f9793fSmrg	continue
173752f9793fSmrg	;;
173852f9793fSmrg
173952f9793fSmrg      -Wc,*)
174052f9793fSmrg	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
174152f9793fSmrg	arg=
174252f9793fSmrg	save_ifs="$IFS"; IFS=','
174352f9793fSmrg	for flag in $args; do
174452f9793fSmrg	  IFS="$save_ifs"
174552f9793fSmrg	  case $flag in
174652f9793fSmrg	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
174752f9793fSmrg	    flag="\"$flag\""
174852f9793fSmrg	    ;;
174952f9793fSmrg	  esac
175052f9793fSmrg	  arg="$arg $wl$flag"
175152f9793fSmrg	  compiler_flags="$compiler_flags $flag"
175252f9793fSmrg	done
175352f9793fSmrg	IFS="$save_ifs"
175452f9793fSmrg	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
175552f9793fSmrg	;;
175652f9793fSmrg
175752f9793fSmrg      -Wl,*)
175852f9793fSmrg	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
175952f9793fSmrg	arg=
176052f9793fSmrg	save_ifs="$IFS"; IFS=','
176152f9793fSmrg	for flag in $args; do
176252f9793fSmrg	  IFS="$save_ifs"
176352f9793fSmrg	  case $flag in
176452f9793fSmrg	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
176552f9793fSmrg	    flag="\"$flag\""
176652f9793fSmrg	    ;;
176752f9793fSmrg	  esac
176852f9793fSmrg	  arg="$arg $wl$flag"
176952f9793fSmrg	  compiler_flags="$compiler_flags $wl$flag"
177052f9793fSmrg	  linker_flags="$linker_flags $flag"
177152f9793fSmrg	done
177252f9793fSmrg	IFS="$save_ifs"
177352f9793fSmrg	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
177452f9793fSmrg	;;
177552f9793fSmrg
177652f9793fSmrg      -Xcompiler)
177752f9793fSmrg	prev=xcompiler
177852f9793fSmrg	continue
177952f9793fSmrg	;;
178052f9793fSmrg
178152f9793fSmrg      -Xlinker)
178252f9793fSmrg	prev=xlinker
178352f9793fSmrg	continue
178452f9793fSmrg	;;
178552f9793fSmrg
178652f9793fSmrg      -XCClinker)
178752f9793fSmrg	prev=xcclinker
178852f9793fSmrg	continue
178952f9793fSmrg	;;
179052f9793fSmrg
179152f9793fSmrg      # Some other compiler flag.
179252f9793fSmrg      -* | +*)
179352f9793fSmrg	# Unknown arguments in both finalize_command and compile_command need
179452f9793fSmrg	# to be aesthetically quoted because they are evaled later.
179552f9793fSmrg	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
179652f9793fSmrg	case $arg in
179752f9793fSmrg	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
179852f9793fSmrg	  arg="\"$arg\""
179952f9793fSmrg	  ;;
180052f9793fSmrg	esac
180152f9793fSmrg	;;
180252f9793fSmrg
180352f9793fSmrg      *.$objext)
180452f9793fSmrg	# A standard object.
180552f9793fSmrg	objs="$objs $arg"
180652f9793fSmrg	;;
180752f9793fSmrg
180852f9793fSmrg      *.lo)
180952f9793fSmrg	# A libtool-controlled object.
181052f9793fSmrg
181152f9793fSmrg	# Check to see that this really is a libtool object.
181252f9793fSmrg	if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
181352f9793fSmrg	  pic_object=
181452f9793fSmrg	  non_pic_object=
181552f9793fSmrg
181652f9793fSmrg	  # Read the .lo file
181752f9793fSmrg	  # If there is no directory component, then add one.
181852f9793fSmrg	  case $arg in
181952f9793fSmrg	  */* | *\\*) . $arg ;;
182052f9793fSmrg	  *) . ./$arg ;;
182152f9793fSmrg	  esac
182252f9793fSmrg
182352f9793fSmrg	  if test -z "$pic_object" || \
182452f9793fSmrg	     test -z "$non_pic_object" ||
182552f9793fSmrg	     test "$pic_object" = none && \
182652f9793fSmrg	     test "$non_pic_object" = none; then
182752f9793fSmrg	    $echo "$modename: cannot find name of object for \`$arg'" 1>&2
182852f9793fSmrg	    exit $EXIT_FAILURE
182952f9793fSmrg	  fi
183052f9793fSmrg
183152f9793fSmrg	  # Extract subdirectory from the argument.
183252f9793fSmrg	  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
183352f9793fSmrg	  if test "X$xdir" = "X$arg"; then
183452f9793fSmrg	    xdir=
183552f9793fSmrg 	  else
183652f9793fSmrg	    xdir="$xdir/"
183752f9793fSmrg	  fi
183852f9793fSmrg
183952f9793fSmrg	  if test "$pic_object" != none; then
184052f9793fSmrg	    # Prepend the subdirectory the object is found in.
184152f9793fSmrg	    pic_object="$xdir$pic_object"
184252f9793fSmrg
184352f9793fSmrg	    if test "$prev" = dlfiles; then
184452f9793fSmrg	      if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
184552f9793fSmrg		dlfiles="$dlfiles $pic_object"
184652f9793fSmrg		prev=
184752f9793fSmrg		continue
184852f9793fSmrg	      else
184952f9793fSmrg		# If libtool objects are unsupported, then we need to preload.
185052f9793fSmrg		prev=dlprefiles
185152f9793fSmrg	      fi
185252f9793fSmrg	    fi
185352f9793fSmrg
185452f9793fSmrg	    # CHECK ME:  I think I busted this.  -Ossama
185552f9793fSmrg	    if test "$prev" = dlprefiles; then
185652f9793fSmrg	      # Preload the old-style object.
185752f9793fSmrg	      dlprefiles="$dlprefiles $pic_object"
185852f9793fSmrg	      prev=
185952f9793fSmrg	    fi
186052f9793fSmrg
186152f9793fSmrg	    # A PIC object.
186252f9793fSmrg	    libobjs="$libobjs $pic_object"
186352f9793fSmrg	    arg="$pic_object"
186452f9793fSmrg	  fi
186552f9793fSmrg
186652f9793fSmrg	  # Non-PIC object.
186752f9793fSmrg	  if test "$non_pic_object" != none; then
186852f9793fSmrg	    # Prepend the subdirectory the object is found in.
186952f9793fSmrg	    non_pic_object="$xdir$non_pic_object"
187052f9793fSmrg
187152f9793fSmrg	    # A standard non-PIC object
187252f9793fSmrg	    non_pic_objects="$non_pic_objects $non_pic_object"
187352f9793fSmrg	    if test -z "$pic_object" || test "$pic_object" = none ; then
187452f9793fSmrg	      arg="$non_pic_object"
187552f9793fSmrg	    fi
187652f9793fSmrg	  else
187752f9793fSmrg	    # If the PIC object exists, use it instead.
187852f9793fSmrg	    # $xdir was prepended to $pic_object above.
187952f9793fSmrg	    non_pic_object="$pic_object"
188052f9793fSmrg	    non_pic_objects="$non_pic_objects $non_pic_object"
188152f9793fSmrg	  fi
188252f9793fSmrg	else
188352f9793fSmrg	  # Only an error if not doing a dry-run.
188452f9793fSmrg	  if test -z "$run"; then
188552f9793fSmrg	    $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
188652f9793fSmrg	    exit $EXIT_FAILURE
188752f9793fSmrg	  else
188852f9793fSmrg	    # Dry-run case.
188952f9793fSmrg
189052f9793fSmrg	    # Extract subdirectory from the argument.
189152f9793fSmrg	    xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
189252f9793fSmrg	    if test "X$xdir" = "X$arg"; then
189352f9793fSmrg	      xdir=
189452f9793fSmrg	    else
189552f9793fSmrg	      xdir="$xdir/"
189652f9793fSmrg	    fi
189752f9793fSmrg
189852f9793fSmrg	    pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
189952f9793fSmrg	    non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
190052f9793fSmrg	    libobjs="$libobjs $pic_object"
190152f9793fSmrg	    non_pic_objects="$non_pic_objects $non_pic_object"
190252f9793fSmrg	  fi
190352f9793fSmrg	fi
190452f9793fSmrg	;;
190552f9793fSmrg
190652f9793fSmrg      *.$libext)
190752f9793fSmrg	# An archive.
190852f9793fSmrg	deplibs="$deplibs $arg"
190952f9793fSmrg	old_deplibs="$old_deplibs $arg"
191052f9793fSmrg	continue
191152f9793fSmrg	;;
191252f9793fSmrg
191352f9793fSmrg      *.la)
191452f9793fSmrg	# A libtool-controlled library.
191552f9793fSmrg
191652f9793fSmrg	if test "$prev" = dlfiles; then
191752f9793fSmrg	  # This library was specified with -dlopen.
191852f9793fSmrg	  dlfiles="$dlfiles $arg"
191952f9793fSmrg	  prev=
192052f9793fSmrg	elif test "$prev" = dlprefiles; then
192152f9793fSmrg	  # The library was specified with -dlpreopen.
192252f9793fSmrg	  dlprefiles="$dlprefiles $arg"
192352f9793fSmrg	  prev=
192452f9793fSmrg	else
192552f9793fSmrg	  deplibs="$deplibs $arg"
192652f9793fSmrg	fi
192752f9793fSmrg	continue
192852f9793fSmrg	;;
192952f9793fSmrg
193052f9793fSmrg      # Some other compiler argument.
193152f9793fSmrg      *)
193252f9793fSmrg	# Unknown arguments in both finalize_command and compile_command need
193352f9793fSmrg	# to be aesthetically quoted because they are evaled later.
193452f9793fSmrg	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
193552f9793fSmrg	case $arg in
193652f9793fSmrg	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
193752f9793fSmrg	  arg="\"$arg\""
193852f9793fSmrg	  ;;
193952f9793fSmrg	esac
194052f9793fSmrg	;;
194152f9793fSmrg      esac # arg
194252f9793fSmrg
194352f9793fSmrg      # Now actually substitute the argument into the commands.
194452f9793fSmrg      if test -n "$arg"; then
194552f9793fSmrg	compile_command="$compile_command $arg"
194652f9793fSmrg	finalize_command="$finalize_command $arg"
194752f9793fSmrg      fi
194852f9793fSmrg    done # argument parsing loop
194952f9793fSmrg
195052f9793fSmrg    if test -n "$prev"; then
195152f9793fSmrg      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
195252f9793fSmrg      $echo "$help" 1>&2
195352f9793fSmrg      exit $EXIT_FAILURE
195452f9793fSmrg    fi
195552f9793fSmrg
195652f9793fSmrg    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
195752f9793fSmrg      eval arg=\"$export_dynamic_flag_spec\"
195852f9793fSmrg      compile_command="$compile_command $arg"
195952f9793fSmrg      finalize_command="$finalize_command $arg"
196052f9793fSmrg    fi
196152f9793fSmrg
196252f9793fSmrg    oldlibs=
196352f9793fSmrg    # calculate the name of the file, without its directory
196452f9793fSmrg    outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
196552f9793fSmrg    libobjs_save="$libobjs"
196652f9793fSmrg
196752f9793fSmrg    if test -n "$shlibpath_var"; then
196852f9793fSmrg      # get the directories listed in $shlibpath_var
196952f9793fSmrg      eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
197052f9793fSmrg    else
197152f9793fSmrg      shlib_search_path=
197252f9793fSmrg    fi
197352f9793fSmrg    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
197452f9793fSmrg    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
197552f9793fSmrg
197652f9793fSmrg    output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
197752f9793fSmrg    if test "X$output_objdir" = "X$output"; then
197852f9793fSmrg      output_objdir="$objdir"
197952f9793fSmrg    else
198052f9793fSmrg      output_objdir="$output_objdir/$objdir"
198152f9793fSmrg    fi
198252f9793fSmrg    # Create the object directory.
198352f9793fSmrg    if test ! -d "$output_objdir"; then
198452f9793fSmrg      $show "$mkdir $output_objdir"
198552f9793fSmrg      $run $mkdir $output_objdir
198652f9793fSmrg      exit_status=$?
198752f9793fSmrg      if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
198852f9793fSmrg	exit $exit_status
198952f9793fSmrg      fi
199052f9793fSmrg    fi
199152f9793fSmrg
199252f9793fSmrg    # Determine the type of output
199352f9793fSmrg    case $output in
199452f9793fSmrg    "")
199552f9793fSmrg      $echo "$modename: you must specify an output file" 1>&2
199652f9793fSmrg      $echo "$help" 1>&2
199752f9793fSmrg      exit $EXIT_FAILURE
199852f9793fSmrg      ;;
199952f9793fSmrg    *.$libext) linkmode=oldlib ;;
200052f9793fSmrg    *.lo | *.$objext) linkmode=obj ;;
200152f9793fSmrg    *.la) linkmode=lib ;;
200252f9793fSmrg    *) linkmode=prog ;; # Anything else should be a program.
200352f9793fSmrg    esac
200452f9793fSmrg
200552f9793fSmrg    case $host in
200652f9793fSmrg    *cygwin* | *mingw* | *pw32*)
200752f9793fSmrg      # don't eliminate duplications in $postdeps and $predeps
200852f9793fSmrg      duplicate_compiler_generated_deps=yes
200952f9793fSmrg      ;;
201052f9793fSmrg    *)
201152f9793fSmrg      duplicate_compiler_generated_deps=$duplicate_deps
201252f9793fSmrg      ;;
201352f9793fSmrg    esac
201452f9793fSmrg    specialdeplibs=
201552f9793fSmrg
201652f9793fSmrg    libs=
201752f9793fSmrg    # Find all interdependent deplibs by searching for libraries
201852f9793fSmrg    # that are linked more than once (e.g. -la -lb -la)
201952f9793fSmrg    for deplib in $deplibs; do
202052f9793fSmrg      if test "X$duplicate_deps" = "Xyes" ; then
202152f9793fSmrg	case "$libs " in
202252f9793fSmrg	*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
202352f9793fSmrg	esac
202452f9793fSmrg      fi
202552f9793fSmrg      libs="$libs $deplib"
202652f9793fSmrg    done
202752f9793fSmrg
202852f9793fSmrg    if test "$linkmode" = lib; then
202952f9793fSmrg      libs="$predeps $libs $compiler_lib_search_path $postdeps"
203052f9793fSmrg
203152f9793fSmrg      # Compute libraries that are listed more than once in $predeps
203252f9793fSmrg      # $postdeps and mark them as special (i.e., whose duplicates are
203352f9793fSmrg      # not to be eliminated).
203452f9793fSmrg      pre_post_deps=
203552f9793fSmrg      if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
203652f9793fSmrg	for pre_post_dep in $predeps $postdeps; do
203752f9793fSmrg	  case "$pre_post_deps " in
203852f9793fSmrg	  *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
203952f9793fSmrg	  esac
204052f9793fSmrg	  pre_post_deps="$pre_post_deps $pre_post_dep"
204152f9793fSmrg	done
204252f9793fSmrg      fi
204352f9793fSmrg      pre_post_deps=
204452f9793fSmrg    fi
204552f9793fSmrg
204652f9793fSmrg    deplibs=
204752f9793fSmrg    newdependency_libs=
204852f9793fSmrg    newlib_search_path=
204952f9793fSmrg    need_relink=no # whether we're linking any uninstalled libtool libraries
205052f9793fSmrg    notinst_deplibs= # not-installed libtool libraries
205152f9793fSmrg    case $linkmode in
205252f9793fSmrg    lib)
205352f9793fSmrg	passes="conv link"
205452f9793fSmrg	for file in $dlfiles $dlprefiles; do
205552f9793fSmrg	  case $file in
205652f9793fSmrg	  *.la) ;;
205752f9793fSmrg	  *)
205852f9793fSmrg	    $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
205952f9793fSmrg	    exit $EXIT_FAILURE
206052f9793fSmrg	    ;;
206152f9793fSmrg	  esac
206252f9793fSmrg	done
206352f9793fSmrg	;;
206452f9793fSmrg    prog)
206552f9793fSmrg	compile_deplibs=
206652f9793fSmrg	finalize_deplibs=
206752f9793fSmrg	alldeplibs=no
206852f9793fSmrg	newdlfiles=
206952f9793fSmrg	newdlprefiles=
207052f9793fSmrg	passes="conv scan dlopen dlpreopen link"
207152f9793fSmrg	;;
207252f9793fSmrg    *)  passes="conv"
207352f9793fSmrg	;;
207452f9793fSmrg    esac
207552f9793fSmrg    for pass in $passes; do
207652f9793fSmrg      if test "$linkmode,$pass" = "lib,link" ||
207752f9793fSmrg	 test "$linkmode,$pass" = "prog,scan"; then
207852f9793fSmrg	libs="$deplibs"
207952f9793fSmrg	deplibs=
208052f9793fSmrg      fi
208152f9793fSmrg      if test "$linkmode" = prog; then
208252f9793fSmrg	case $pass in
208352f9793fSmrg	dlopen) libs="$dlfiles" ;;
208452f9793fSmrg	dlpreopen) libs="$dlprefiles" ;;
208552f9793fSmrg	link)
208652f9793fSmrg	  libs="$deplibs %DEPLIBS%"
208752f9793fSmrg	  test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
208852f9793fSmrg	  ;;
208952f9793fSmrg	esac
209052f9793fSmrg      fi
209152f9793fSmrg      if test "$pass" = dlopen; then
209252f9793fSmrg	# Collect dlpreopened libraries
209352f9793fSmrg	save_deplibs="$deplibs"
209452f9793fSmrg	deplibs=
209552f9793fSmrg      fi
209652f9793fSmrg      for deplib in $libs; do
209752f9793fSmrg	lib=
209852f9793fSmrg	found=no
209952f9793fSmrg	case $deplib in
210052f9793fSmrg	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
210152f9793fSmrg	  if test "$linkmode,$pass" = "prog,link"; then
210252f9793fSmrg	    compile_deplibs="$deplib $compile_deplibs"
210352f9793fSmrg	    finalize_deplibs="$deplib $finalize_deplibs"
210452f9793fSmrg	  else
210552f9793fSmrg	    compiler_flags="$compiler_flags $deplib"
210652f9793fSmrg	  fi
210752f9793fSmrg	  continue
210852f9793fSmrg	  ;;
210952f9793fSmrg	-l*)
211052f9793fSmrg	  if test "$linkmode" != lib && test "$linkmode" != prog; then
211152f9793fSmrg	    $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
211252f9793fSmrg	    continue
211352f9793fSmrg	  fi
211452f9793fSmrg	  name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
211552f9793fSmrg	  for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
211652f9793fSmrg	    for search_ext in .la $std_shrext .so .a; do
211752f9793fSmrg	      # Search the libtool library
211852f9793fSmrg	      lib="$searchdir/lib${name}${search_ext}"
211952f9793fSmrg	      if test -f "$lib"; then
212052f9793fSmrg		if test "$search_ext" = ".la"; then
212152f9793fSmrg		  found=yes
212252f9793fSmrg		else
212352f9793fSmrg		  found=no
212452f9793fSmrg		fi
212552f9793fSmrg		break 2
212652f9793fSmrg	      fi
212752f9793fSmrg	    done
212852f9793fSmrg	  done
212952f9793fSmrg	  if test "$found" != yes; then
213052f9793fSmrg	    # deplib doesn't seem to be a libtool library
213152f9793fSmrg	    if test "$linkmode,$pass" = "prog,link"; then
213252f9793fSmrg	      compile_deplibs="$deplib $compile_deplibs"
213352f9793fSmrg	      finalize_deplibs="$deplib $finalize_deplibs"
213452f9793fSmrg	    else
213552f9793fSmrg	      deplibs="$deplib $deplibs"
213652f9793fSmrg	      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
213752f9793fSmrg	    fi
213852f9793fSmrg	    continue
213952f9793fSmrg	  else # deplib is a libtool library
214052f9793fSmrg	    # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
214152f9793fSmrg	    # We need to do some special things here, and not later.
214252f9793fSmrg	    if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
214352f9793fSmrg	      case " $predeps $postdeps " in
214452f9793fSmrg	      *" $deplib "*)
214552f9793fSmrg		if (${SED} -e '2q' $lib |
214652f9793fSmrg                    grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
214752f9793fSmrg		  library_names=
214852f9793fSmrg		  old_library=
214952f9793fSmrg		  case $lib in
215052f9793fSmrg		  */* | *\\*) . $lib ;;
215152f9793fSmrg		  *) . ./$lib ;;
215252f9793fSmrg		  esac
215352f9793fSmrg		  for l in $old_library $library_names; do
215452f9793fSmrg		    ll="$l"
215552f9793fSmrg		  done
215652f9793fSmrg		  if test "X$ll" = "X$old_library" ; then # only static version available
215752f9793fSmrg		    found=no
215852f9793fSmrg		    ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
215952f9793fSmrg		    test "X$ladir" = "X$lib" && ladir="."
216052f9793fSmrg		    lib=$ladir/$old_library
216152f9793fSmrg		    if test "$linkmode,$pass" = "prog,link"; then
216252f9793fSmrg		      compile_deplibs="$deplib $compile_deplibs"
216352f9793fSmrg		      finalize_deplibs="$deplib $finalize_deplibs"
216452f9793fSmrg		    else
216552f9793fSmrg		      deplibs="$deplib $deplibs"
216652f9793fSmrg		      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
216752f9793fSmrg		    fi
216852f9793fSmrg		    continue
216952f9793fSmrg		  fi
217052f9793fSmrg		fi
217152f9793fSmrg	        ;;
217252f9793fSmrg	      *) ;;
217352f9793fSmrg	      esac
217452f9793fSmrg	    fi
217552f9793fSmrg	  fi
217652f9793fSmrg	  ;; # -l
217752f9793fSmrg	-L*)
217852f9793fSmrg	  case $linkmode in
217952f9793fSmrg	  lib)
218052f9793fSmrg	    deplibs="$deplib $deplibs"
218152f9793fSmrg	    test "$pass" = conv && continue
218252f9793fSmrg	    newdependency_libs="$deplib $newdependency_libs"
218352f9793fSmrg	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
218452f9793fSmrg	    ;;
218552f9793fSmrg	  prog)
218652f9793fSmrg	    if test "$pass" = conv; then
218752f9793fSmrg	      deplibs="$deplib $deplibs"
218852f9793fSmrg	      continue
218952f9793fSmrg	    fi
219052f9793fSmrg	    if test "$pass" = scan; then
219152f9793fSmrg	      deplibs="$deplib $deplibs"
219252f9793fSmrg	    else
219352f9793fSmrg	      compile_deplibs="$deplib $compile_deplibs"
219452f9793fSmrg	      finalize_deplibs="$deplib $finalize_deplibs"
219552f9793fSmrg	    fi
219652f9793fSmrg	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
219752f9793fSmrg	    ;;
219852f9793fSmrg	  *)
219952f9793fSmrg	    $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
220052f9793fSmrg	    ;;
220152f9793fSmrg	  esac # linkmode
220252f9793fSmrg	  continue
220352f9793fSmrg	  ;; # -L
220452f9793fSmrg	-R*)
220552f9793fSmrg	  if test "$pass" = link; then
220652f9793fSmrg	    dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
220752f9793fSmrg	    # Make sure the xrpath contains only unique directories.
220852f9793fSmrg	    case "$xrpath " in
220952f9793fSmrg	    *" $dir "*) ;;
221052f9793fSmrg	    *) xrpath="$xrpath $dir" ;;
221152f9793fSmrg	    esac
221252f9793fSmrg	  fi
221352f9793fSmrg	  deplibs="$deplib $deplibs"
221452f9793fSmrg	  continue
221552f9793fSmrg	  ;;
221652f9793fSmrg	*.la) lib="$deplib" ;;
221752f9793fSmrg	*.$libext)
221852f9793fSmrg	  if test "$pass" = conv; then
221952f9793fSmrg	    deplibs="$deplib $deplibs"
222052f9793fSmrg	    continue
222152f9793fSmrg	  fi
222252f9793fSmrg	  case $linkmode in
222352f9793fSmrg	  lib)
222452f9793fSmrg	    valid_a_lib=no
222552f9793fSmrg	    case $deplibs_check_method in
222652f9793fSmrg	      match_pattern*)
222752f9793fSmrg		set dummy $deplibs_check_method
222852f9793fSmrg	        match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
222952f9793fSmrg		if eval $echo \"$deplib\" 2>/dev/null \
223052f9793fSmrg		    | $SED 10q \
223152f9793fSmrg		    | $EGREP "$match_pattern_regex" > /dev/null; then
223252f9793fSmrg		  valid_a_lib=yes
223352f9793fSmrg		fi
223452f9793fSmrg		;;
223552f9793fSmrg	      pass_all)
223652f9793fSmrg		valid_a_lib=yes
223752f9793fSmrg		;;
223852f9793fSmrg            esac
223952f9793fSmrg	    if test "$valid_a_lib" != yes; then
224052f9793fSmrg	      $echo
224152f9793fSmrg	      $echo "*** Warning: Trying to link with static lib archive $deplib."
224252f9793fSmrg	      $echo "*** I have the capability to make that library automatically link in when"
224352f9793fSmrg	      $echo "*** you link to this library.  But I can only do this if you have a"
224452f9793fSmrg	      $echo "*** shared version of the library, which you do not appear to have"
224552f9793fSmrg	      $echo "*** because the file extensions .$libext of this argument makes me believe"
224652f9793fSmrg	      $echo "*** that it is just a static archive that I should not used here."
224752f9793fSmrg	    else
224852f9793fSmrg	      $echo
224952f9793fSmrg	      $echo "*** Warning: Linking the shared library $output against the"
225052f9793fSmrg	      $echo "*** static library $deplib is not portable!"
225152f9793fSmrg	      deplibs="$deplib $deplibs"
225252f9793fSmrg	    fi
225352f9793fSmrg	    continue
225452f9793fSmrg	    ;;
225552f9793fSmrg	  prog)
225652f9793fSmrg	    if test "$pass" != link; then
225752f9793fSmrg	      deplibs="$deplib $deplibs"
225852f9793fSmrg	    else
225952f9793fSmrg	      compile_deplibs="$deplib $compile_deplibs"
226052f9793fSmrg	      finalize_deplibs="$deplib $finalize_deplibs"
226152f9793fSmrg	    fi
226252f9793fSmrg	    continue
226352f9793fSmrg	    ;;
226452f9793fSmrg	  esac # linkmode
226552f9793fSmrg	  ;; # *.$libext
226652f9793fSmrg	*.lo | *.$objext)
226752f9793fSmrg	  if test "$pass" = conv; then
226852f9793fSmrg	    deplibs="$deplib $deplibs"
226952f9793fSmrg	  elif test "$linkmode" = prog; then
227052f9793fSmrg	    if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
227152f9793fSmrg	      # If there is no dlopen support or we're linking statically,
227252f9793fSmrg	      # we need to preload.
227352f9793fSmrg	      newdlprefiles="$newdlprefiles $deplib"
227452f9793fSmrg	      compile_deplibs="$deplib $compile_deplibs"
227552f9793fSmrg	      finalize_deplibs="$deplib $finalize_deplibs"
227652f9793fSmrg	    else
227752f9793fSmrg	      newdlfiles="$newdlfiles $deplib"
227852f9793fSmrg	    fi
227952f9793fSmrg	  fi
228052f9793fSmrg	  continue
228152f9793fSmrg	  ;;
228252f9793fSmrg	%DEPLIBS%)
228352f9793fSmrg	  alldeplibs=yes
228452f9793fSmrg	  continue
228552f9793fSmrg	  ;;
228652f9793fSmrg	esac # case $deplib
228752f9793fSmrg	if test "$found" = yes || test -f "$lib"; then :
228852f9793fSmrg	else
228952f9793fSmrg	  $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
229052f9793fSmrg	  exit $EXIT_FAILURE
229152f9793fSmrg	fi
229252f9793fSmrg
229352f9793fSmrg	# Check to see that this really is a libtool archive.
229452f9793fSmrg	if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
229552f9793fSmrg	else
229652f9793fSmrg	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
229752f9793fSmrg	  exit $EXIT_FAILURE
229852f9793fSmrg	fi
229952f9793fSmrg
230052f9793fSmrg	ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
230152f9793fSmrg	test "X$ladir" = "X$lib" && ladir="."
230252f9793fSmrg
230352f9793fSmrg	dlname=
230452f9793fSmrg	dlopen=
230552f9793fSmrg	dlpreopen=
230652f9793fSmrg	libdir=
230752f9793fSmrg	library_names=
230852f9793fSmrg	old_library=
230952f9793fSmrg	# If the library was installed with an old release of libtool,
231052f9793fSmrg	# it will not redefine variables installed, or shouldnotlink
231152f9793fSmrg	installed=yes
231252f9793fSmrg	shouldnotlink=no
231352f9793fSmrg	avoidtemprpath=
231452f9793fSmrg
231552f9793fSmrg
231652f9793fSmrg	# Read the .la file
231752f9793fSmrg	case $lib in
231852f9793fSmrg	*/* | *\\*) . $lib ;;
231952f9793fSmrg	*) . ./$lib ;;
232052f9793fSmrg	esac
232152f9793fSmrg
232252f9793fSmrg	if test "$linkmode,$pass" = "lib,link" ||
232352f9793fSmrg	   test "$linkmode,$pass" = "prog,scan" ||
232452f9793fSmrg	   { test "$linkmode" != prog && test "$linkmode" != lib; }; then
232552f9793fSmrg	  test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
232652f9793fSmrg	  test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
232752f9793fSmrg	fi
232852f9793fSmrg
232952f9793fSmrg	if test "$pass" = conv; then
233052f9793fSmrg	  # Only check for convenience libraries
233152f9793fSmrg	  deplibs="$lib $deplibs"
233252f9793fSmrg	  if test -z "$libdir"; then
233352f9793fSmrg	    if test -z "$old_library"; then
233452f9793fSmrg	      $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
233552f9793fSmrg	      exit $EXIT_FAILURE
233652f9793fSmrg	    fi
233752f9793fSmrg	    # It is a libtool convenience library, so add in its objects.
233852f9793fSmrg	    convenience="$convenience $ladir/$objdir/$old_library"
233952f9793fSmrg	    old_convenience="$old_convenience $ladir/$objdir/$old_library"
234052f9793fSmrg	    tmp_libs=
234152f9793fSmrg	    for deplib in $dependency_libs; do
234252f9793fSmrg	      deplibs="$deplib $deplibs"
234352f9793fSmrg              if test "X$duplicate_deps" = "Xyes" ; then
234452f9793fSmrg	        case "$tmp_libs " in
234552f9793fSmrg	        *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
234652f9793fSmrg	        esac
234752f9793fSmrg              fi
234852f9793fSmrg	      tmp_libs="$tmp_libs $deplib"
234952f9793fSmrg	    done
235052f9793fSmrg	  elif test "$linkmode" != prog && test "$linkmode" != lib; then
235152f9793fSmrg	    $echo "$modename: \`$lib' is not a convenience library" 1>&2
235252f9793fSmrg	    exit $EXIT_FAILURE
235352f9793fSmrg	  fi
235452f9793fSmrg	  continue
235552f9793fSmrg	fi # $pass = conv
235652f9793fSmrg
235752f9793fSmrg
235852f9793fSmrg	# Get the name of the library we link against.
235952f9793fSmrg	linklib=
236052f9793fSmrg	for l in $old_library $library_names; do
236152f9793fSmrg	  linklib="$l"
236252f9793fSmrg	done
236352f9793fSmrg	if test -z "$linklib"; then
236452f9793fSmrg	  $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
236552f9793fSmrg	  exit $EXIT_FAILURE
236652f9793fSmrg	fi
236752f9793fSmrg
236852f9793fSmrg	# This library was specified with -dlopen.
236952f9793fSmrg	if test "$pass" = dlopen; then
237052f9793fSmrg	  if test -z "$libdir"; then
237152f9793fSmrg	    $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
237252f9793fSmrg	    exit $EXIT_FAILURE
237352f9793fSmrg	  fi
237452f9793fSmrg	  if test -z "$dlname" ||
237552f9793fSmrg	     test "$dlopen_support" != yes ||
237652f9793fSmrg	     test "$build_libtool_libs" = no; then
237752f9793fSmrg	    # If there is no dlname, no dlopen support or we're linking
237852f9793fSmrg	    # statically, we need to preload.  We also need to preload any
237952f9793fSmrg	    # dependent libraries so libltdl's deplib preloader doesn't
238052f9793fSmrg	    # bomb out in the load deplibs phase.
238152f9793fSmrg	    dlprefiles="$dlprefiles $lib $dependency_libs"
238252f9793fSmrg	  else
238352f9793fSmrg	    newdlfiles="$newdlfiles $lib"
238452f9793fSmrg	  fi
238552f9793fSmrg	  continue
238652f9793fSmrg	fi # $pass = dlopen
238752f9793fSmrg
238852f9793fSmrg	# We need an absolute path.
238952f9793fSmrg	case $ladir in
239052f9793fSmrg	[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
239152f9793fSmrg	*)
239252f9793fSmrg	  abs_ladir=`cd "$ladir" && pwd`
239352f9793fSmrg	  if test -z "$abs_ladir"; then
239452f9793fSmrg	    $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
239552f9793fSmrg	    $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
239652f9793fSmrg	    abs_ladir="$ladir"
239752f9793fSmrg	  fi
239852f9793fSmrg	  ;;
239952f9793fSmrg	esac
240052f9793fSmrg	laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
240152f9793fSmrg
240252f9793fSmrg	# Find the relevant object directory and library name.
240352f9793fSmrg	if test "X$installed" = Xyes; then
240452f9793fSmrg	  if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
240552f9793fSmrg	    $echo "$modename: warning: library \`$lib' was moved." 1>&2
240652f9793fSmrg	    dir="$ladir"
240752f9793fSmrg	    absdir="$abs_ladir"
240852f9793fSmrg	    libdir="$abs_ladir"
240952f9793fSmrg	  else
241052f9793fSmrg	    dir="$libdir"
241152f9793fSmrg	    absdir="$libdir"
241252f9793fSmrg	  fi
241352f9793fSmrg	  test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
241452f9793fSmrg	else
241552f9793fSmrg	  if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
241652f9793fSmrg	    dir="$ladir"
241752f9793fSmrg	    absdir="$abs_ladir"
241852f9793fSmrg	    # Remove this search path later
241952f9793fSmrg	    notinst_path="$notinst_path $abs_ladir"
242052f9793fSmrg	  else
242152f9793fSmrg	    dir="$ladir/$objdir"
242252f9793fSmrg	    absdir="$abs_ladir/$objdir"
242352f9793fSmrg	    # Remove this search path later
242452f9793fSmrg	    notinst_path="$notinst_path $abs_ladir"
242552f9793fSmrg	  fi
242652f9793fSmrg	fi # $installed = yes
242752f9793fSmrg	name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
242852f9793fSmrg
242952f9793fSmrg	# This library was specified with -dlpreopen.
243052f9793fSmrg	if test "$pass" = dlpreopen; then
243152f9793fSmrg	  if test -z "$libdir"; then
243252f9793fSmrg	    $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
243352f9793fSmrg	    exit $EXIT_FAILURE
243452f9793fSmrg	  fi
243552f9793fSmrg	  # Prefer using a static library (so that no silly _DYNAMIC symbols
243652f9793fSmrg	  # are required to link).
243752f9793fSmrg	  if test -n "$old_library"; then
243852f9793fSmrg	    newdlprefiles="$newdlprefiles $dir/$old_library"
243952f9793fSmrg	  # Otherwise, use the dlname, so that lt_dlopen finds it.
244052f9793fSmrg	  elif test -n "$dlname"; then
244152f9793fSmrg	    newdlprefiles="$newdlprefiles $dir/$dlname"
244252f9793fSmrg	  else
244352f9793fSmrg	    newdlprefiles="$newdlprefiles $dir/$linklib"
244452f9793fSmrg	  fi
244552f9793fSmrg	fi # $pass = dlpreopen
244652f9793fSmrg
244752f9793fSmrg	if test -z "$libdir"; then
244852f9793fSmrg	  # Link the convenience library
244952f9793fSmrg	  if test "$linkmode" = lib; then
245052f9793fSmrg	    deplibs="$dir/$old_library $deplibs"
245152f9793fSmrg	  elif test "$linkmode,$pass" = "prog,link"; then
245252f9793fSmrg	    compile_deplibs="$dir/$old_library $compile_deplibs"
245352f9793fSmrg	    finalize_deplibs="$dir/$old_library $finalize_deplibs"
245452f9793fSmrg	  else
245552f9793fSmrg	    deplibs="$lib $deplibs" # used for prog,scan pass
245652f9793fSmrg	  fi
245752f9793fSmrg	  continue
245852f9793fSmrg	fi
245952f9793fSmrg
246052f9793fSmrg
246152f9793fSmrg	if test "$linkmode" = prog && test "$pass" != link; then
246252f9793fSmrg	  newlib_search_path="$newlib_search_path $ladir"
246352f9793fSmrg	  deplibs="$lib $deplibs"
246452f9793fSmrg
246552f9793fSmrg	  linkalldeplibs=no
246652f9793fSmrg	  if test "$link_all_deplibs" != no || test -z "$library_names" ||
246752f9793fSmrg	     test "$build_libtool_libs" = no; then
246852f9793fSmrg	    linkalldeplibs=yes
246952f9793fSmrg	  fi
247052f9793fSmrg
247152f9793fSmrg	  tmp_libs=
247252f9793fSmrg	  for deplib in $dependency_libs; do
247352f9793fSmrg	    case $deplib in
247452f9793fSmrg	    -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
247552f9793fSmrg	    esac
247652f9793fSmrg	    # Need to link against all dependency_libs?
247752f9793fSmrg	    if test "$linkalldeplibs" = yes; then
247852f9793fSmrg	      deplibs="$deplib $deplibs"
247952f9793fSmrg	    else
248052f9793fSmrg	      # Need to hardcode shared library paths
248152f9793fSmrg	      # or/and link against static libraries
248252f9793fSmrg	      newdependency_libs="$deplib $newdependency_libs"
248352f9793fSmrg	    fi
248452f9793fSmrg	    if test "X$duplicate_deps" = "Xyes" ; then
248552f9793fSmrg	      case "$tmp_libs " in
248652f9793fSmrg	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
248752f9793fSmrg	      esac
248852f9793fSmrg	    fi
248952f9793fSmrg	    tmp_libs="$tmp_libs $deplib"
249052f9793fSmrg	  done # for deplib
249152f9793fSmrg	  continue
249252f9793fSmrg	fi # $linkmode = prog...
249352f9793fSmrg
249452f9793fSmrg	if test "$linkmode,$pass" = "prog,link"; then
249552f9793fSmrg	  if test -n "$library_names" &&
249652f9793fSmrg	     { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
249752f9793fSmrg	    # We need to hardcode the library path
249852f9793fSmrg	    if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
249952f9793fSmrg	      # Make sure the rpath contains only unique directories.
250052f9793fSmrg	      case "$temp_rpath " in
250152f9793fSmrg	      *" $dir "*) ;;
250252f9793fSmrg	      *" $absdir "*) ;;
250352f9793fSmrg	      *) temp_rpath="$temp_rpath $absdir" ;;
250452f9793fSmrg	      esac
250552f9793fSmrg	    fi
250652f9793fSmrg
250752f9793fSmrg	    # Hardcode the library path.
250852f9793fSmrg	    # Skip directories that are in the system default run-time
250952f9793fSmrg	    # search path.
251052f9793fSmrg	    case " $sys_lib_dlsearch_path " in
251152f9793fSmrg	    *" $absdir "*) ;;
251252f9793fSmrg	    *)
251352f9793fSmrg	      case "$compile_rpath " in
251452f9793fSmrg	      *" $absdir "*) ;;
251552f9793fSmrg	      *) compile_rpath="$compile_rpath $absdir"
251652f9793fSmrg	      esac
251752f9793fSmrg	      ;;
251852f9793fSmrg	    esac
251952f9793fSmrg	    case " $sys_lib_dlsearch_path " in
252052f9793fSmrg	    *" $libdir "*) ;;
252152f9793fSmrg	    *)
252252f9793fSmrg	      case "$finalize_rpath " in
252352f9793fSmrg	      *" $libdir "*) ;;
252452f9793fSmrg	      *) finalize_rpath="$finalize_rpath $libdir"
252552f9793fSmrg	      esac
252652f9793fSmrg	      ;;
252752f9793fSmrg	    esac
252852f9793fSmrg	  fi # $linkmode,$pass = prog,link...
252952f9793fSmrg
253052f9793fSmrg	  if test "$alldeplibs" = yes &&
253152f9793fSmrg	     { test "$deplibs_check_method" = pass_all ||
253252f9793fSmrg	       { test "$build_libtool_libs" = yes &&
253352f9793fSmrg		 test -n "$library_names"; }; }; then
253452f9793fSmrg	    # We only need to search for static libraries
253552f9793fSmrg	    continue
253652f9793fSmrg	  fi
253752f9793fSmrg	fi
253852f9793fSmrg
253952f9793fSmrg	link_static=no # Whether the deplib will be linked statically
254052f9793fSmrg	use_static_libs=$prefer_static_libs
254152f9793fSmrg	if test "$use_static_libs" = built && test "$installed" = yes ; then
254252f9793fSmrg	  use_static_libs=no
254352f9793fSmrg	fi
254452f9793fSmrg	if test -n "$library_names" &&
254552f9793fSmrg	   { test "$use_static_libs" = no || test -z "$old_library"; }; then
254652f9793fSmrg	  if test "$installed" = no; then
254752f9793fSmrg	    notinst_deplibs="$notinst_deplibs $lib"
254852f9793fSmrg	    need_relink=yes
254952f9793fSmrg	  fi
255052f9793fSmrg	  # This is a shared library
255152f9793fSmrg
255252f9793fSmrg	  # Warn about portability, can't link against -module's on
255352f9793fSmrg	  # some systems (darwin)
255452f9793fSmrg	  if test "$shouldnotlink" = yes && test "$pass" = link ; then
255552f9793fSmrg	    $echo
255652f9793fSmrg	    if test "$linkmode" = prog; then
255752f9793fSmrg	      $echo "*** Warning: Linking the executable $output against the loadable module"
255852f9793fSmrg	    else
255952f9793fSmrg	      $echo "*** Warning: Linking the shared library $output against the loadable module"
256052f9793fSmrg	    fi
256152f9793fSmrg	    $echo "*** $linklib is not portable!"
256252f9793fSmrg	  fi
256352f9793fSmrg	  if test "$linkmode" = lib &&
256452f9793fSmrg	     test "$hardcode_into_libs" = yes; then
256552f9793fSmrg	    # Hardcode the library path.
256652f9793fSmrg	    # Skip directories that are in the system default run-time
256752f9793fSmrg	    # search path.
256852f9793fSmrg	    case " $sys_lib_dlsearch_path " in
256952f9793fSmrg	    *" $absdir "*) ;;
257052f9793fSmrg	    *)
257152f9793fSmrg	      case "$compile_rpath " in
257252f9793fSmrg	      *" $absdir "*) ;;
257352f9793fSmrg	      *) compile_rpath="$compile_rpath $absdir"
257452f9793fSmrg	      esac
257552f9793fSmrg	      ;;
257652f9793fSmrg	    esac
257752f9793fSmrg	    case " $sys_lib_dlsearch_path " in
257852f9793fSmrg	    *" $libdir "*) ;;
257952f9793fSmrg	    *)
258052f9793fSmrg	      case "$finalize_rpath " in
258152f9793fSmrg	      *" $libdir "*) ;;
258252f9793fSmrg	      *) finalize_rpath="$finalize_rpath $libdir"
258352f9793fSmrg	      esac
258452f9793fSmrg	      ;;
258552f9793fSmrg	    esac
258652f9793fSmrg	  fi
258752f9793fSmrg
258852f9793fSmrg	  if test -n "$old_archive_from_expsyms_cmds"; then
258952f9793fSmrg	    # figure out the soname
259052f9793fSmrg	    set dummy $library_names
259152f9793fSmrg	    realname="$2"
259252f9793fSmrg	    shift; shift
259352f9793fSmrg	    libname=`eval \\$echo \"$libname_spec\"`
259452f9793fSmrg	    # use dlname if we got it. it's perfectly good, no?
259552f9793fSmrg	    if test -n "$dlname"; then
259652f9793fSmrg	      soname="$dlname"
259752f9793fSmrg	    elif test -n "$soname_spec"; then
259852f9793fSmrg	      # bleh windows
259952f9793fSmrg	      case $host in
260052f9793fSmrg	      *cygwin* | mingw*)
260152f9793fSmrg		major=`expr $current - $age`
260252f9793fSmrg		versuffix="-$major"
260352f9793fSmrg		;;
260452f9793fSmrg	      esac
260552f9793fSmrg	      eval soname=\"$soname_spec\"
260652f9793fSmrg	    else
260752f9793fSmrg	      soname="$realname"
260852f9793fSmrg	    fi
260952f9793fSmrg
261052f9793fSmrg	    # Make a new name for the extract_expsyms_cmds to use
261152f9793fSmrg	    soroot="$soname"
261252f9793fSmrg	    soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
261352f9793fSmrg	    newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
261452f9793fSmrg
261552f9793fSmrg	    # If the library has no export list, then create one now
261652f9793fSmrg	    if test -f "$output_objdir/$soname-def"; then :
261752f9793fSmrg	    else
261852f9793fSmrg	      $show "extracting exported symbol list from \`$soname'"
261952f9793fSmrg	      save_ifs="$IFS"; IFS='~'
262052f9793fSmrg	      cmds=$extract_expsyms_cmds
262152f9793fSmrg	      for cmd in $cmds; do
262252f9793fSmrg		IFS="$save_ifs"
262352f9793fSmrg		eval cmd=\"$cmd\"
262452f9793fSmrg		$show "$cmd"
262552f9793fSmrg		$run eval "$cmd" || exit $?
262652f9793fSmrg	      done
262752f9793fSmrg	      IFS="$save_ifs"
262852f9793fSmrg	    fi
262952f9793fSmrg
263052f9793fSmrg	    # Create $newlib
263152f9793fSmrg	    if test -f "$output_objdir/$newlib"; then :; else
263252f9793fSmrg	      $show "generating import library for \`$soname'"
263352f9793fSmrg	      save_ifs="$IFS"; IFS='~'
263452f9793fSmrg	      cmds=$old_archive_from_expsyms_cmds
263552f9793fSmrg	      for cmd in $cmds; do
263652f9793fSmrg		IFS="$save_ifs"
263752f9793fSmrg		eval cmd=\"$cmd\"
263852f9793fSmrg		$show "$cmd"
263952f9793fSmrg		$run eval "$cmd" || exit $?
264052f9793fSmrg	      done
264152f9793fSmrg	      IFS="$save_ifs"
264252f9793fSmrg	    fi
264352f9793fSmrg	    # make sure the library variables are pointing to the new library
264452f9793fSmrg	    dir=$output_objdir
264552f9793fSmrg	    linklib=$newlib
264652f9793fSmrg	  fi # test -n "$old_archive_from_expsyms_cmds"
264752f9793fSmrg
264852f9793fSmrg	  if test "$linkmode" = prog || test "$mode" != relink; then
264952f9793fSmrg	    add_shlibpath=
265052f9793fSmrg	    add_dir=
265152f9793fSmrg	    add=
265252f9793fSmrg	    lib_linked=yes
265352f9793fSmrg	    case $hardcode_action in
265452f9793fSmrg	    immediate | unsupported)
265552f9793fSmrg	      if test "$hardcode_direct" = no; then
265652f9793fSmrg		add="$dir/$linklib"
265752f9793fSmrg		case $host in
265852f9793fSmrg		  *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
265952f9793fSmrg		  *-*-sysv4*uw2*) add_dir="-L$dir" ;;
266052f9793fSmrg		  *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
266152f9793fSmrg		    *-*-unixware7*) add_dir="-L$dir" ;;
266252f9793fSmrg		  *-*-darwin* )
266352f9793fSmrg		    # if the lib is a module then we can not link against
266452f9793fSmrg		    # it, someone is ignoring the new warnings I added
266552f9793fSmrg		    if /usr/bin/file -L $add 2> /dev/null |
266652f9793fSmrg                      $EGREP ": [^:]* bundle" >/dev/null ; then
266752f9793fSmrg		      $echo "** Warning, lib $linklib is a module, not a shared library"
266852f9793fSmrg		      if test -z "$old_library" ; then
266952f9793fSmrg		        $echo
267052f9793fSmrg		        $echo "** And there doesn't seem to be a static archive available"
267152f9793fSmrg		        $echo "** The link will probably fail, sorry"
267252f9793fSmrg		      else
267352f9793fSmrg		        add="$dir/$old_library"
267452f9793fSmrg		      fi
267552f9793fSmrg		    fi
267652f9793fSmrg		esac
267752f9793fSmrg	      elif test "$hardcode_minus_L" = no; then
267852f9793fSmrg		case $host in
267952f9793fSmrg		*-*-sunos*) add_shlibpath="$dir" ;;
268052f9793fSmrg		esac
268152f9793fSmrg		add_dir="-L$dir"
268252f9793fSmrg		add="-l$name"
268352f9793fSmrg	      elif test "$hardcode_shlibpath_var" = no; then
268452f9793fSmrg		add_shlibpath="$dir"
268552f9793fSmrg		add="-l$name"
268652f9793fSmrg	      else
268752f9793fSmrg		lib_linked=no
268852f9793fSmrg	      fi
268952f9793fSmrg	      ;;
269052f9793fSmrg	    relink)
269152f9793fSmrg	      if test "$hardcode_direct" = yes; then
269252f9793fSmrg		add="$dir/$linklib"
269352f9793fSmrg	      elif test "$hardcode_minus_L" = yes; then
269452f9793fSmrg		add_dir="-L$dir"
269552f9793fSmrg		# Try looking first in the location we're being installed to.
269652f9793fSmrg		if test -n "$inst_prefix_dir"; then
269752f9793fSmrg		  case $libdir in
269852f9793fSmrg		    [\\/]*)
269952f9793fSmrg		      add_dir="$add_dir -L$inst_prefix_dir$libdir"
270052f9793fSmrg		      ;;
270152f9793fSmrg		  esac
270252f9793fSmrg		fi
270352f9793fSmrg		add="-l$name"
270452f9793fSmrg	      elif test "$hardcode_shlibpath_var" = yes; then
270552f9793fSmrg		add_shlibpath="$dir"
270652f9793fSmrg		add="-l$name"
270752f9793fSmrg	      else
270852f9793fSmrg		lib_linked=no
270952f9793fSmrg	      fi
271052f9793fSmrg	      ;;
271152f9793fSmrg	    *) lib_linked=no ;;
271252f9793fSmrg	    esac
271352f9793fSmrg
271452f9793fSmrg	    if test "$lib_linked" != yes; then
271552f9793fSmrg	      $echo "$modename: configuration error: unsupported hardcode properties"
271652f9793fSmrg	      exit $EXIT_FAILURE
271752f9793fSmrg	    fi
271852f9793fSmrg
271952f9793fSmrg	    if test -n "$add_shlibpath"; then
272052f9793fSmrg	      case :$compile_shlibpath: in
272152f9793fSmrg	      *":$add_shlibpath:"*) ;;
272252f9793fSmrg	      *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
272352f9793fSmrg	      esac
272452f9793fSmrg	    fi
272552f9793fSmrg	    if test "$linkmode" = prog; then
272652f9793fSmrg	      test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
272752f9793fSmrg	      test -n "$add" && compile_deplibs="$add $compile_deplibs"
272852f9793fSmrg	    else
272952f9793fSmrg	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
273052f9793fSmrg	      test -n "$add" && deplibs="$add $deplibs"
273152f9793fSmrg	      if test "$hardcode_direct" != yes && \
273252f9793fSmrg		 test "$hardcode_minus_L" != yes && \
273352f9793fSmrg		 test "$hardcode_shlibpath_var" = yes; then
273452f9793fSmrg		case :$finalize_shlibpath: in
273552f9793fSmrg		*":$libdir:"*) ;;
273652f9793fSmrg		*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
273752f9793fSmrg		esac
273852f9793fSmrg	      fi
273952f9793fSmrg	    fi
274052f9793fSmrg	  fi
274152f9793fSmrg
274252f9793fSmrg	  if test "$linkmode" = prog || test "$mode" = relink; then
274352f9793fSmrg	    add_shlibpath=
274452f9793fSmrg	    add_dir=
274552f9793fSmrg	    add=
274652f9793fSmrg	    # Finalize command for both is simple: just hardcode it.
274752f9793fSmrg	    if test "$hardcode_direct" = yes; then
274852f9793fSmrg	      add="$libdir/$linklib"
274952f9793fSmrg	    elif test "$hardcode_minus_L" = yes; then
275052f9793fSmrg	      add_dir="-L$libdir"
275152f9793fSmrg	      add="-l$name"
275252f9793fSmrg	    elif test "$hardcode_shlibpath_var" = yes; then
275352f9793fSmrg	      case :$finalize_shlibpath: in
275452f9793fSmrg	      *":$libdir:"*) ;;
275552f9793fSmrg	      *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
275652f9793fSmrg	      esac
275752f9793fSmrg	      add="-l$name"
275852f9793fSmrg	    elif test "$hardcode_automatic" = yes; then
275952f9793fSmrg	      if test -n "$inst_prefix_dir" &&
276052f9793fSmrg		 test -f "$inst_prefix_dir$libdir/$linklib" ; then
276152f9793fSmrg	        add="$inst_prefix_dir$libdir/$linklib"
276252f9793fSmrg	      else
276352f9793fSmrg	        add="$libdir/$linklib"
276452f9793fSmrg	      fi
276552f9793fSmrg	    else
276652f9793fSmrg	      # We cannot seem to hardcode it, guess we'll fake it.
276752f9793fSmrg	      add_dir="-L$libdir"
276852f9793fSmrg	      # Try looking first in the location we're being installed to.
276952f9793fSmrg	      if test -n "$inst_prefix_dir"; then
277052f9793fSmrg		case $libdir in
277152f9793fSmrg		  [\\/]*)
277252f9793fSmrg		    add_dir="$add_dir -L$inst_prefix_dir$libdir"
277352f9793fSmrg		    ;;
277452f9793fSmrg		esac
277552f9793fSmrg	      fi
277652f9793fSmrg	      add="-l$name"
277752f9793fSmrg	    fi
277852f9793fSmrg
277952f9793fSmrg	    if test "$linkmode" = prog; then
278052f9793fSmrg	      test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
278152f9793fSmrg	      test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
278252f9793fSmrg	    else
278352f9793fSmrg	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
278452f9793fSmrg	      test -n "$add" && deplibs="$add $deplibs"
278552f9793fSmrg	    fi
278652f9793fSmrg	  fi
278752f9793fSmrg	elif test "$linkmode" = prog; then
278852f9793fSmrg	  # Here we assume that one of hardcode_direct or hardcode_minus_L
278952f9793fSmrg	  # is not unsupported.  This is valid on all known static and
279052f9793fSmrg	  # shared platforms.
279152f9793fSmrg	  if test "$hardcode_direct" != unsupported; then
279252f9793fSmrg	    test -n "$old_library" && linklib="$old_library"
279352f9793fSmrg	    compile_deplibs="$dir/$linklib $compile_deplibs"
279452f9793fSmrg	    finalize_deplibs="$dir/$linklib $finalize_deplibs"
279552f9793fSmrg	  else
279652f9793fSmrg	    compile_deplibs="-l$name -L$dir $compile_deplibs"
279752f9793fSmrg	    finalize_deplibs="-l$name -L$dir $finalize_deplibs"
279852f9793fSmrg	  fi
279952f9793fSmrg	elif test "$build_libtool_libs" = yes; then
280052f9793fSmrg	  # Not a shared library
280152f9793fSmrg	  if test "$deplibs_check_method" != pass_all; then
280252f9793fSmrg	    # We're trying link a shared library against a static one
280352f9793fSmrg	    # but the system doesn't support it.
280452f9793fSmrg
280552f9793fSmrg	    # Just print a warning and add the library to dependency_libs so
280652f9793fSmrg	    # that the program can be linked against the static library.
280752f9793fSmrg	    $echo
280852f9793fSmrg	    $echo "*** Warning: This system can not link to static lib archive $lib."
280952f9793fSmrg	    $echo "*** I have the capability to make that library automatically link in when"
281052f9793fSmrg	    $echo "*** you link to this library.  But I can only do this if you have a"
281152f9793fSmrg	    $echo "*** shared version of the library, which you do not appear to have."
281252f9793fSmrg	    if test "$module" = yes; then
281352f9793fSmrg	      $echo "*** But as you try to build a module library, libtool will still create "
281452f9793fSmrg	      $echo "*** a static module, that should work as long as the dlopening application"
281552f9793fSmrg	      $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
281652f9793fSmrg	      if test -z "$global_symbol_pipe"; then
281752f9793fSmrg		$echo
281852f9793fSmrg		$echo "*** However, this would only work if libtool was able to extract symbol"
281952f9793fSmrg		$echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
282052f9793fSmrg		$echo "*** not find such a program.  So, this module is probably useless."
282152f9793fSmrg		$echo "*** \`nm' from GNU binutils and a full rebuild may help."
282252f9793fSmrg	      fi
282352f9793fSmrg	      if test "$build_old_libs" = no; then
282452f9793fSmrg		build_libtool_libs=module
282552f9793fSmrg		build_old_libs=yes
282652f9793fSmrg	      else
282752f9793fSmrg		build_libtool_libs=no
282852f9793fSmrg	      fi
282952f9793fSmrg	    fi
283052f9793fSmrg	  else
283152f9793fSmrg	    deplibs="$dir/$old_library $deplibs"
283252f9793fSmrg	    link_static=yes
283352f9793fSmrg	  fi
283452f9793fSmrg	fi # link shared/static library?
283552f9793fSmrg
283652f9793fSmrg	if test "$linkmode" = lib; then
283752f9793fSmrg	  if test -n "$dependency_libs" &&
283852f9793fSmrg	     { test "$hardcode_into_libs" != yes ||
283952f9793fSmrg	       test "$build_old_libs" = yes ||
284052f9793fSmrg	       test "$link_static" = yes; }; then
284152f9793fSmrg	    # Extract -R from dependency_libs
284252f9793fSmrg	    temp_deplibs=
284352f9793fSmrg	    for libdir in $dependency_libs; do
284452f9793fSmrg	      case $libdir in
284552f9793fSmrg	      -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
284652f9793fSmrg		   case " $xrpath " in
284752f9793fSmrg		   *" $temp_xrpath "*) ;;
284852f9793fSmrg		   *) xrpath="$xrpath $temp_xrpath";;
284952f9793fSmrg		   esac;;
285052f9793fSmrg	      *) temp_deplibs="$temp_deplibs $libdir";;
285152f9793fSmrg	      esac
285252f9793fSmrg	    done
285352f9793fSmrg	    dependency_libs="$temp_deplibs"
285452f9793fSmrg	  fi
285552f9793fSmrg
285652f9793fSmrg	  newlib_search_path="$newlib_search_path $absdir"
285752f9793fSmrg	  # Link against this library
285852f9793fSmrg	  test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
285952f9793fSmrg	  # ... and its dependency_libs
286052f9793fSmrg	  tmp_libs=
286152f9793fSmrg	  for deplib in $dependency_libs; do
286252f9793fSmrg	    newdependency_libs="$deplib $newdependency_libs"
286352f9793fSmrg	    if test "X$duplicate_deps" = "Xyes" ; then
286452f9793fSmrg	      case "$tmp_libs " in
286552f9793fSmrg	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
286652f9793fSmrg	      esac
286752f9793fSmrg	    fi
286852f9793fSmrg	    tmp_libs="$tmp_libs $deplib"
286952f9793fSmrg	  done
287052f9793fSmrg
287152f9793fSmrg	  if test "$link_all_deplibs" != no; then
287252f9793fSmrg	    # Add the search paths of all dependency libraries
287352f9793fSmrg	    for deplib in $dependency_libs; do
287452f9793fSmrg	      case $deplib in
287552f9793fSmrg	      -L*) path="$deplib" ;;
287652f9793fSmrg	      *.la)
287752f9793fSmrg		dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
287852f9793fSmrg		test "X$dir" = "X$deplib" && dir="."
287952f9793fSmrg		# We need an absolute path.
288052f9793fSmrg		case $dir in
288152f9793fSmrg		[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
288252f9793fSmrg		*)
288352f9793fSmrg		  absdir=`cd "$dir" && pwd`
288452f9793fSmrg		  if test -z "$absdir"; then
288552f9793fSmrg		    $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
288652f9793fSmrg		    absdir="$dir"
288752f9793fSmrg		  fi
288852f9793fSmrg		  ;;
288952f9793fSmrg		esac
289052f9793fSmrg		if grep "^installed=no" $deplib > /dev/null; then
289152f9793fSmrg		  path="$absdir/$objdir"
289252f9793fSmrg		else
289352f9793fSmrg		  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
289452f9793fSmrg		  if test -z "$libdir"; then
289552f9793fSmrg		    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
289652f9793fSmrg		    exit $EXIT_FAILURE
289752f9793fSmrg		  fi
289852f9793fSmrg		  if test "$absdir" != "$libdir"; then
289952f9793fSmrg		    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
290052f9793fSmrg		  fi
290152f9793fSmrg		  path="$absdir"
290252f9793fSmrg		fi
290352f9793fSmrg		depdepl=
290452f9793fSmrg		case $host in
290552f9793fSmrg		*-*-darwin*)
290652f9793fSmrg		  # we do not want to link against static libs,
290752f9793fSmrg		  # but need to link against shared
290852f9793fSmrg		  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
290952f9793fSmrg		  if test -n "$deplibrary_names" ; then
291052f9793fSmrg		    for tmp in $deplibrary_names ; do
291152f9793fSmrg		      depdepl=$tmp
291252f9793fSmrg		    done
291352f9793fSmrg		    if test -f "$path/$depdepl" ; then
291452f9793fSmrg		      depdepl="$path/$depdepl"
291552f9793fSmrg		    fi
291652f9793fSmrg		    # do not add paths which are already there
291752f9793fSmrg		    case " $newlib_search_path " in
291852f9793fSmrg		    *" $path "*) ;;
291952f9793fSmrg		    *) newlib_search_path="$newlib_search_path $path";;
292052f9793fSmrg		    esac
292152f9793fSmrg		  fi
292252f9793fSmrg		  path=""
292352f9793fSmrg		  ;;
292452f9793fSmrg		*)
292552f9793fSmrg		  path="-L$path"
292652f9793fSmrg		  ;;
292752f9793fSmrg		esac
292852f9793fSmrg		;;
292952f9793fSmrg	      -l*)
293052f9793fSmrg		case $host in
293152f9793fSmrg		*-*-darwin*)
293252f9793fSmrg		  # Again, we only want to link against shared libraries
293352f9793fSmrg		  eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
293452f9793fSmrg		  for tmp in $newlib_search_path ; do
293552f9793fSmrg		    if test -f "$tmp/lib$tmp_libs.dylib" ; then
293652f9793fSmrg		      eval depdepl="$tmp/lib$tmp_libs.dylib"
293752f9793fSmrg		      break
293852f9793fSmrg		    fi
293952f9793fSmrg		  done
294052f9793fSmrg		  path=""
294152f9793fSmrg		  ;;
294252f9793fSmrg		*) continue ;;
294352f9793fSmrg		esac
294452f9793fSmrg		;;
294552f9793fSmrg	      *) continue ;;
294652f9793fSmrg	      esac
294752f9793fSmrg	      case " $deplibs " in
294852f9793fSmrg	      *" $path "*) ;;
294952f9793fSmrg	      *) deplibs="$path $deplibs" ;;
295052f9793fSmrg	      esac
295152f9793fSmrg	      case " $deplibs " in
295252f9793fSmrg	      *" $depdepl "*) ;;
295352f9793fSmrg	      *) deplibs="$depdepl $deplibs" ;;
295452f9793fSmrg	      esac
295552f9793fSmrg	    done
295652f9793fSmrg	  fi # link_all_deplibs != no
295752f9793fSmrg	fi # linkmode = lib
295852f9793fSmrg      done # for deplib in $libs
295952f9793fSmrg      dependency_libs="$newdependency_libs"
296052f9793fSmrg      if test "$pass" = dlpreopen; then
296152f9793fSmrg	# Link the dlpreopened libraries before other libraries
296252f9793fSmrg	for deplib in $save_deplibs; do
296352f9793fSmrg	  deplibs="$deplib $deplibs"
296452f9793fSmrg	done
296552f9793fSmrg      fi
296652f9793fSmrg      if test "$pass" != dlopen; then
296752f9793fSmrg	if test "$pass" != conv; then
296852f9793fSmrg	  # Make sure lib_search_path contains only unique directories.
296952f9793fSmrg	  lib_search_path=
297052f9793fSmrg	  for dir in $newlib_search_path; do
297152f9793fSmrg	    case "$lib_search_path " in
297252f9793fSmrg	    *" $dir "*) ;;
297352f9793fSmrg	    *) lib_search_path="$lib_search_path $dir" ;;
297452f9793fSmrg	    esac
297552f9793fSmrg	  done
297652f9793fSmrg	  newlib_search_path=
297752f9793fSmrg	fi
297852f9793fSmrg
297952f9793fSmrg	if test "$linkmode,$pass" != "prog,link"; then
298052f9793fSmrg	  vars="deplibs"
298152f9793fSmrg	else
298252f9793fSmrg	  vars="compile_deplibs finalize_deplibs"
298352f9793fSmrg	fi
298452f9793fSmrg	for var in $vars dependency_libs; do
298552f9793fSmrg	  # Add libraries to $var in reverse order
298652f9793fSmrg	  eval tmp_libs=\"\$$var\"
298752f9793fSmrg	  new_libs=
298852f9793fSmrg	  for deplib in $tmp_libs; do
298952f9793fSmrg	    # FIXME: Pedantically, this is the right thing to do, so
299052f9793fSmrg	    #        that some nasty dependency loop isn't accidentally
299152f9793fSmrg	    #        broken:
299252f9793fSmrg	    #new_libs="$deplib $new_libs"
299352f9793fSmrg	    # Pragmatically, this seems to cause very few problems in
299452f9793fSmrg	    # practice:
299552f9793fSmrg	    case $deplib in
299652f9793fSmrg	    -L*) new_libs="$deplib $new_libs" ;;
299752f9793fSmrg	    -R*) ;;
299852f9793fSmrg	    *)
299952f9793fSmrg	      # And here is the reason: when a library appears more
300052f9793fSmrg	      # than once as an explicit dependence of a library, or
300152f9793fSmrg	      # is implicitly linked in more than once by the
300252f9793fSmrg	      # compiler, it is considered special, and multiple
300352f9793fSmrg	      # occurrences thereof are not removed.  Compare this
300452f9793fSmrg	      # with having the same library being listed as a
300552f9793fSmrg	      # dependency of multiple other libraries: in this case,
300652f9793fSmrg	      # we know (pedantically, we assume) the library does not
300752f9793fSmrg	      # need to be listed more than once, so we keep only the
300852f9793fSmrg	      # last copy.  This is not always right, but it is rare
300952f9793fSmrg	      # enough that we require users that really mean to play
301052f9793fSmrg	      # such unportable linking tricks to link the library
301152f9793fSmrg	      # using -Wl,-lname, so that libtool does not consider it
301252f9793fSmrg	      # for duplicate removal.
301352f9793fSmrg	      case " $specialdeplibs " in
301452f9793fSmrg	      *" $deplib "*) new_libs="$deplib $new_libs" ;;
301552f9793fSmrg	      *)
301652f9793fSmrg		case " $new_libs " in
301752f9793fSmrg		*" $deplib "*) ;;
301852f9793fSmrg		*) new_libs="$deplib $new_libs" ;;
301952f9793fSmrg		esac
302052f9793fSmrg		;;
302152f9793fSmrg	      esac
302252f9793fSmrg	      ;;
302352f9793fSmrg	    esac
302452f9793fSmrg	  done
302552f9793fSmrg	  tmp_libs=
302652f9793fSmrg	  for deplib in $new_libs; do
302752f9793fSmrg	    case $deplib in
302852f9793fSmrg	    -L*)
302952f9793fSmrg	      case " $tmp_libs " in
303052f9793fSmrg	      *" $deplib "*) ;;
303152f9793fSmrg	      *) tmp_libs="$tmp_libs $deplib" ;;
303252f9793fSmrg	      esac
303352f9793fSmrg	      ;;
303452f9793fSmrg	    *) tmp_libs="$tmp_libs $deplib" ;;
303552f9793fSmrg	    esac
303652f9793fSmrg	  done
303752f9793fSmrg	  eval $var=\"$tmp_libs\"
303852f9793fSmrg	done # for var
303952f9793fSmrg      fi
304052f9793fSmrg      # Last step: remove runtime libs from dependency_libs
304152f9793fSmrg      # (they stay in deplibs)
304252f9793fSmrg      tmp_libs=
304352f9793fSmrg      for i in $dependency_libs ; do
304452f9793fSmrg	case " $predeps $postdeps $compiler_lib_search_path " in
304552f9793fSmrg	*" $i "*)
304652f9793fSmrg	  i=""
304752f9793fSmrg	  ;;
304852f9793fSmrg	esac
304952f9793fSmrg	if test -n "$i" ; then
305052f9793fSmrg	  tmp_libs="$tmp_libs $i"
305152f9793fSmrg	fi
305252f9793fSmrg      done
305352f9793fSmrg      dependency_libs=$tmp_libs
305452f9793fSmrg    done # for pass
305552f9793fSmrg    if test "$linkmode" = prog; then
305652f9793fSmrg      dlfiles="$newdlfiles"
305752f9793fSmrg      dlprefiles="$newdlprefiles"
305852f9793fSmrg    fi
305952f9793fSmrg
306052f9793fSmrg    case $linkmode in
306152f9793fSmrg    oldlib)
306252f9793fSmrg      if test -n "$deplibs"; then
306352f9793fSmrg	$echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
306452f9793fSmrg      fi
306552f9793fSmrg
306652f9793fSmrg      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
306752f9793fSmrg	$echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
306852f9793fSmrg      fi
306952f9793fSmrg
307052f9793fSmrg      if test -n "$rpath"; then
307152f9793fSmrg	$echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
307252f9793fSmrg      fi
307352f9793fSmrg
307452f9793fSmrg      if test -n "$xrpath"; then
307552f9793fSmrg	$echo "$modename: warning: \`-R' is ignored for archives" 1>&2
307652f9793fSmrg      fi
307752f9793fSmrg
307852f9793fSmrg      if test -n "$vinfo"; then
307952f9793fSmrg	$echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
308052f9793fSmrg      fi
308152f9793fSmrg
308252f9793fSmrg      if test -n "$release"; then
308352f9793fSmrg	$echo "$modename: warning: \`-release' is ignored for archives" 1>&2
308452f9793fSmrg      fi
308552f9793fSmrg
308652f9793fSmrg      if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
308752f9793fSmrg	$echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
308852f9793fSmrg      fi
308952f9793fSmrg
309052f9793fSmrg      # Now set the variables for building old libraries.
309152f9793fSmrg      build_libtool_libs=no
309252f9793fSmrg      oldlibs="$output"
309352f9793fSmrg      objs="$objs$old_deplibs"
309452f9793fSmrg      ;;
309552f9793fSmrg
309652f9793fSmrg    lib)
309752f9793fSmrg      # Make sure we only generate libraries of the form `libNAME.la'.
309852f9793fSmrg      case $outputname in
309952f9793fSmrg      lib*)
310052f9793fSmrg	name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
310152f9793fSmrg	eval shared_ext=\"$shrext_cmds\"
310252f9793fSmrg	eval libname=\"$libname_spec\"
310352f9793fSmrg	;;
310452f9793fSmrg      *)
310552f9793fSmrg	if test "$module" = no; then
310652f9793fSmrg	  $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
310752f9793fSmrg	  $echo "$help" 1>&2
310852f9793fSmrg	  exit $EXIT_FAILURE
310952f9793fSmrg	fi
311052f9793fSmrg	if test "$need_lib_prefix" != no; then
311152f9793fSmrg	  # Add the "lib" prefix for modules if required
311252f9793fSmrg	  name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
311352f9793fSmrg	  eval shared_ext=\"$shrext_cmds\"
311452f9793fSmrg	  eval libname=\"$libname_spec\"
311552f9793fSmrg	else
311652f9793fSmrg	  libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
311752f9793fSmrg	fi
311852f9793fSmrg	;;
311952f9793fSmrg      esac
312052f9793fSmrg
312152f9793fSmrg      if test -n "$objs"; then
312252f9793fSmrg	if test "$deplibs_check_method" != pass_all; then
312352f9793fSmrg	  $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
312452f9793fSmrg	  exit $EXIT_FAILURE
312552f9793fSmrg	else
312652f9793fSmrg	  $echo
312752f9793fSmrg	  $echo "*** Warning: Linking the shared library $output against the non-libtool"
312852f9793fSmrg	  $echo "*** objects $objs is not portable!"
312952f9793fSmrg	  libobjs="$libobjs $objs"
313052f9793fSmrg	fi
313152f9793fSmrg      fi
313252f9793fSmrg
313352f9793fSmrg      if test "$dlself" != no; then
313452f9793fSmrg	$echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
313552f9793fSmrg      fi
313652f9793fSmrg
313752f9793fSmrg      set dummy $rpath
313852f9793fSmrg      if test "$#" -gt 2; then
313952f9793fSmrg	$echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
314052f9793fSmrg      fi
314152f9793fSmrg      install_libdir="$2"
314252f9793fSmrg
314352f9793fSmrg      oldlibs=
314452f9793fSmrg      if test -z "$rpath"; then
314552f9793fSmrg	if test "$build_libtool_libs" = yes; then
314652f9793fSmrg	  # Building a libtool convenience library.
314752f9793fSmrg	  # Some compilers have problems with a `.al' extension so
314852f9793fSmrg	  # convenience libraries should have the same extension an
314952f9793fSmrg	  # archive normally would.
315052f9793fSmrg	  oldlibs="$output_objdir/$libname.$libext $oldlibs"
315152f9793fSmrg	  build_libtool_libs=convenience
315252f9793fSmrg	  build_old_libs=yes
315352f9793fSmrg	fi
315452f9793fSmrg
315552f9793fSmrg	if test -n "$vinfo"; then
315652f9793fSmrg	  $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
315752f9793fSmrg	fi
315852f9793fSmrg
315952f9793fSmrg	if test -n "$release"; then
316052f9793fSmrg	  $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
316152f9793fSmrg	fi
316252f9793fSmrg      else
316352f9793fSmrg
316452f9793fSmrg	# Parse the version information argument.
316552f9793fSmrg	save_ifs="$IFS"; IFS=':'
316652f9793fSmrg	set dummy $vinfo 0 0 0
316752f9793fSmrg	IFS="$save_ifs"
316852f9793fSmrg
316952f9793fSmrg	if test -n "$8"; then
317052f9793fSmrg	  $echo "$modename: too many parameters to \`-version-info'" 1>&2
317152f9793fSmrg	  $echo "$help" 1>&2
317252f9793fSmrg	  exit $EXIT_FAILURE
317352f9793fSmrg	fi
317452f9793fSmrg
317552f9793fSmrg	# convert absolute version numbers to libtool ages
317652f9793fSmrg	# this retains compatibility with .la files and attempts
317752f9793fSmrg	# to make the code below a bit more comprehensible
317852f9793fSmrg
317952f9793fSmrg	case $vinfo_number in
318052f9793fSmrg	yes)
318152f9793fSmrg	  number_major="$2"
318252f9793fSmrg	  number_minor="$3"
318352f9793fSmrg	  number_revision="$4"
318452f9793fSmrg	  #
318552f9793fSmrg	  # There are really only two kinds -- those that
318652f9793fSmrg	  # use the current revision as the major version
318752f9793fSmrg	  # and those that subtract age and use age as
318852f9793fSmrg	  # a minor version.  But, then there is irix
318952f9793fSmrg	  # which has an extra 1 added just for fun
319052f9793fSmrg	  #
319152f9793fSmrg	  case $version_type in
319252f9793fSmrg	  darwin|linux|osf|windows)
319352f9793fSmrg	    current=`expr $number_major + $number_minor`
319452f9793fSmrg	    age="$number_minor"
319552f9793fSmrg	    revision="$number_revision"
319652f9793fSmrg	    ;;
319752f9793fSmrg	  freebsd-aout|freebsd-elf|sunos)
319852f9793fSmrg	    current="$number_major"
319952f9793fSmrg	    revision="$number_minor"
320052f9793fSmrg	    age="0"
320152f9793fSmrg	    ;;
320252f9793fSmrg	  irix|nonstopux)
320352f9793fSmrg	    current=`expr $number_major + $number_minor - 1`
320452f9793fSmrg	    age="$number_minor"
320552f9793fSmrg	    revision="$number_minor"
320652f9793fSmrg	    ;;
320752f9793fSmrg	  *)
320852f9793fSmrg	    $echo "$modename: unknown library version type \`$version_type'" 1>&2
320952f9793fSmrg	    $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
321052f9793fSmrg	    exit $EXIT_FAILURE
321152f9793fSmrg	    ;;
321252f9793fSmrg	  esac
321352f9793fSmrg	  ;;
321452f9793fSmrg	no)
321552f9793fSmrg	  current="$2"
321652f9793fSmrg	  revision="$3"
321752f9793fSmrg	  age="$4"
321852f9793fSmrg	  ;;
321952f9793fSmrg	esac
322052f9793fSmrg
322152f9793fSmrg	# Check that each of the things are valid numbers.
322252f9793fSmrg	case $current in
322352f9793fSmrg	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]) ;;
322452f9793fSmrg	*)
322552f9793fSmrg	  $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
322652f9793fSmrg	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
322752f9793fSmrg	  exit $EXIT_FAILURE
322852f9793fSmrg	  ;;
322952f9793fSmrg	esac
323052f9793fSmrg
323152f9793fSmrg	case $revision in
323252f9793fSmrg	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]) ;;
323352f9793fSmrg	*)
323452f9793fSmrg	  $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
323552f9793fSmrg	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
323652f9793fSmrg	  exit $EXIT_FAILURE
323752f9793fSmrg	  ;;
323852f9793fSmrg	esac
323952f9793fSmrg
324052f9793fSmrg	case $age in
324152f9793fSmrg	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]) ;;
324252f9793fSmrg	*)
324352f9793fSmrg	  $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
324452f9793fSmrg	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
324552f9793fSmrg	  exit $EXIT_FAILURE
324652f9793fSmrg	  ;;
324752f9793fSmrg	esac
324852f9793fSmrg
324952f9793fSmrg	if test "$age" -gt "$current"; then
325052f9793fSmrg	  $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
325152f9793fSmrg	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
325252f9793fSmrg	  exit $EXIT_FAILURE
325352f9793fSmrg	fi
325452f9793fSmrg
325552f9793fSmrg	# Calculate the version variables.
325652f9793fSmrg	major=
325752f9793fSmrg	versuffix=
325852f9793fSmrg	verstring=
325952f9793fSmrg	case $version_type in
326052f9793fSmrg	none) ;;
326152f9793fSmrg
326252f9793fSmrg	darwin)
326352f9793fSmrg	  # Like Linux, but with the current version available in
326452f9793fSmrg	  # verstring for coding it into the library header
326552f9793fSmrg	  major=.`expr $current - $age`
326652f9793fSmrg	  versuffix="$major.$age.$revision"
326752f9793fSmrg	  # Darwin ld doesn't like 0 for these options...
326852f9793fSmrg	  minor_current=`expr $current + 1`
326952f9793fSmrg	  verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
327052f9793fSmrg	  ;;
327152f9793fSmrg
327252f9793fSmrg	freebsd-aout)
327352f9793fSmrg	  major=".$current"
327452f9793fSmrg	  versuffix=".$current.$revision";
327552f9793fSmrg	  ;;
327652f9793fSmrg
327752f9793fSmrg	freebsd-elf)
327852f9793fSmrg	  major=".$current"
327952f9793fSmrg	  versuffix=".$current";
328052f9793fSmrg	  ;;
328152f9793fSmrg
328252f9793fSmrg	irix | nonstopux)
328352f9793fSmrg	  major=`expr $current - $age + 1`
328452f9793fSmrg
328552f9793fSmrg	  case $version_type in
328652f9793fSmrg	    nonstopux) verstring_prefix=nonstopux ;;
328752f9793fSmrg	    *)         verstring_prefix=sgi ;;
328852f9793fSmrg	  esac
328952f9793fSmrg	  verstring="$verstring_prefix$major.$revision"
329052f9793fSmrg
329152f9793fSmrg	  # Add in all the interfaces that we are compatible with.
329252f9793fSmrg	  loop=$revision
329352f9793fSmrg	  while test "$loop" -ne 0; do
329452f9793fSmrg	    iface=`expr $revision - $loop`
329552f9793fSmrg	    loop=`expr $loop - 1`
329652f9793fSmrg	    verstring="$verstring_prefix$major.$iface:$verstring"
329752f9793fSmrg	  done
329852f9793fSmrg
329952f9793fSmrg	  # Before this point, $major must not contain `.'.
330052f9793fSmrg	  major=.$major
330152f9793fSmrg	  versuffix="$major.$revision"
330252f9793fSmrg	  ;;
330352f9793fSmrg
330452f9793fSmrg	linux)
330552f9793fSmrg	  major=.`expr $current - $age`
330652f9793fSmrg	  versuffix="$major.$age.$revision"
330752f9793fSmrg	  ;;
330852f9793fSmrg
330952f9793fSmrg	osf)
331052f9793fSmrg	  major=.`expr $current - $age`
331152f9793fSmrg	  versuffix=".$current.$age.$revision"
331252f9793fSmrg	  verstring="$current.$age.$revision"
331352f9793fSmrg
331452f9793fSmrg	  # Add in all the interfaces that we are compatible with.
331552f9793fSmrg	  loop=$age
331652f9793fSmrg	  while test "$loop" -ne 0; do
331752f9793fSmrg	    iface=`expr $current - $loop`
331852f9793fSmrg	    loop=`expr $loop - 1`
331952f9793fSmrg	    verstring="$verstring:${iface}.0"
332052f9793fSmrg	  done
332152f9793fSmrg
332252f9793fSmrg	  # Make executables depend on our current version.
332352f9793fSmrg	  verstring="$verstring:${current}.0"
332452f9793fSmrg	  ;;
332552f9793fSmrg
332652f9793fSmrg	sunos)
332752f9793fSmrg	  major=".$current"
332852f9793fSmrg	  versuffix=".$current.$revision"
332952f9793fSmrg	  ;;
333052f9793fSmrg
333152f9793fSmrg	windows)
333252f9793fSmrg	  # Use '-' rather than '.', since we only want one
333352f9793fSmrg	  # extension on DOS 8.3 filesystems.
333452f9793fSmrg	  major=`expr $current - $age`
333552f9793fSmrg	  versuffix="-$major"
333652f9793fSmrg	  ;;
333752f9793fSmrg
333852f9793fSmrg	*)
333952f9793fSmrg	  $echo "$modename: unknown library version type \`$version_type'" 1>&2
334052f9793fSmrg	  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
334152f9793fSmrg	  exit $EXIT_FAILURE
334252f9793fSmrg	  ;;
334352f9793fSmrg	esac
334452f9793fSmrg
334552f9793fSmrg	# Clear the version info if we defaulted, and they specified a release.
334652f9793fSmrg	if test -z "$vinfo" && test -n "$release"; then
334752f9793fSmrg	  major=
334852f9793fSmrg	  case $version_type in
334952f9793fSmrg	  darwin)
335052f9793fSmrg	    # we can't check for "0.0" in archive_cmds due to quoting
335152f9793fSmrg	    # problems, so we reset it completely
335252f9793fSmrg	    verstring=
335352f9793fSmrg	    ;;
335452f9793fSmrg	  *)
335552f9793fSmrg	    verstring="0.0"
335652f9793fSmrg	    ;;
335752f9793fSmrg	  esac
335852f9793fSmrg	  if test "$need_version" = no; then
335952f9793fSmrg	    versuffix=
336052f9793fSmrg	  else
336152f9793fSmrg	    versuffix=".0.0"
336252f9793fSmrg	  fi
336352f9793fSmrg	fi
336452f9793fSmrg
336552f9793fSmrg	# Remove version info from name if versioning should be avoided
336652f9793fSmrg	if test "$avoid_version" = yes && test "$need_version" = no; then
336752f9793fSmrg	  major=
336852f9793fSmrg	  versuffix=
336952f9793fSmrg	  verstring=""
337052f9793fSmrg	fi
337152f9793fSmrg
337252f9793fSmrg	# Check to see if the archive will have undefined symbols.
337352f9793fSmrg	if test "$allow_undefined" = yes; then
337452f9793fSmrg	  if test "$allow_undefined_flag" = unsupported; then
337552f9793fSmrg	    $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
337652f9793fSmrg	    build_libtool_libs=no
337752f9793fSmrg	    build_old_libs=yes
337852f9793fSmrg	  fi
337952f9793fSmrg	else
338052f9793fSmrg	  # Don't allow undefined symbols.
338152f9793fSmrg	  allow_undefined_flag="$no_undefined_flag"
338252f9793fSmrg	fi
338352f9793fSmrg      fi
338452f9793fSmrg
338552f9793fSmrg      if test "$mode" != relink; then
338652f9793fSmrg	# Remove our outputs, but don't remove object files since they
338752f9793fSmrg	# may have been created when compiling PIC objects.
338852f9793fSmrg	removelist=
338952f9793fSmrg	tempremovelist=`$echo "$output_objdir/*"`
339052f9793fSmrg	for p in $tempremovelist; do
339152f9793fSmrg	  case $p in
339252f9793fSmrg	    *.$objext)
339352f9793fSmrg	       ;;
339452f9793fSmrg	    $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
339552f9793fSmrg	       if test "X$precious_files_regex" != "X"; then
339652f9793fSmrg	         if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
339752f9793fSmrg	         then
339852f9793fSmrg		   continue
339952f9793fSmrg		 fi
340052f9793fSmrg	       fi
340152f9793fSmrg	       removelist="$removelist $p"
340252f9793fSmrg	       ;;
340352f9793fSmrg	    *) ;;
340452f9793fSmrg	  esac
340552f9793fSmrg	done
340652f9793fSmrg	if test -n "$removelist"; then
340752f9793fSmrg	  $show "${rm}r $removelist"
340852f9793fSmrg	  $run ${rm}r $removelist
340952f9793fSmrg	fi
341052f9793fSmrg      fi
341152f9793fSmrg
341252f9793fSmrg      # Now set the variables for building old libraries.
341352f9793fSmrg      if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
341452f9793fSmrg	oldlibs="$oldlibs $output_objdir/$libname.$libext"
341552f9793fSmrg
341652f9793fSmrg	# Transform .lo files to .o files.
341752f9793fSmrg	oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
341852f9793fSmrg      fi
341952f9793fSmrg
342052f9793fSmrg      # Eliminate all temporary directories.
342152f9793fSmrg      for path in $notinst_path; do
342252f9793fSmrg	lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
342352f9793fSmrg	deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
342452f9793fSmrg	dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
342552f9793fSmrg      done
342652f9793fSmrg
342752f9793fSmrg      if test -n "$xrpath"; then
342852f9793fSmrg	# If the user specified any rpath flags, then add them.
342952f9793fSmrg	temp_xrpath=
343052f9793fSmrg	for libdir in $xrpath; do
343152f9793fSmrg	  temp_xrpath="$temp_xrpath -R$libdir"
343252f9793fSmrg	  case "$finalize_rpath " in
343352f9793fSmrg	  *" $libdir "*) ;;
343452f9793fSmrg	  *) finalize_rpath="$finalize_rpath $libdir" ;;
343552f9793fSmrg	  esac
343652f9793fSmrg	done
343752f9793fSmrg	if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
343852f9793fSmrg	  dependency_libs="$temp_xrpath $dependency_libs"
343952f9793fSmrg	fi
344052f9793fSmrg      fi
344152f9793fSmrg
344252f9793fSmrg      # Make sure dlfiles contains only unique files that won't be dlpreopened
344352f9793fSmrg      old_dlfiles="$dlfiles"
344452f9793fSmrg      dlfiles=
344552f9793fSmrg      for lib in $old_dlfiles; do
344652f9793fSmrg	case " $dlprefiles $dlfiles " in
344752f9793fSmrg	*" $lib "*) ;;
344852f9793fSmrg	*) dlfiles="$dlfiles $lib" ;;
344952f9793fSmrg	esac
345052f9793fSmrg      done
345152f9793fSmrg
345252f9793fSmrg      # Make sure dlprefiles contains only unique files
345352f9793fSmrg      old_dlprefiles="$dlprefiles"
345452f9793fSmrg      dlprefiles=
345552f9793fSmrg      for lib in $old_dlprefiles; do
345652f9793fSmrg	case "$dlprefiles " in
345752f9793fSmrg	*" $lib "*) ;;
345852f9793fSmrg	*) dlprefiles="$dlprefiles $lib" ;;
345952f9793fSmrg	esac
346052f9793fSmrg      done
346152f9793fSmrg
346252f9793fSmrg      if test "$build_libtool_libs" = yes; then
346352f9793fSmrg	if test -n "$rpath"; then
346452f9793fSmrg	  case $host in
346552f9793fSmrg	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
346652f9793fSmrg	    # these systems don't actually have a c library (as such)!
346752f9793fSmrg	    ;;
346852f9793fSmrg	  *-*-rhapsody* | *-*-darwin1.[012])
346952f9793fSmrg	    # Rhapsody C library is in the System framework
347052f9793fSmrg	    deplibs="$deplibs -framework System"
347152f9793fSmrg	    ;;
347252f9793fSmrg	  *-*-netbsd*)
347352f9793fSmrg	    # Don't link with libc until the a.out ld.so is fixed.
347452f9793fSmrg	    ;;
347552f9793fSmrg	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
347652f9793fSmrg	    # Do not include libc due to us having libc/libc_r.
347752f9793fSmrg	    ;;
347852f9793fSmrg	  *-*-sco3.2v5* | *-*-sco5v6*)
347952f9793fSmrg	    # Causes problems with __ctype
348052f9793fSmrg	    ;;
348152f9793fSmrg	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
348252f9793fSmrg	    # Compiler inserts libc in the correct place for threads to work
348352f9793fSmrg	    ;;
348452f9793fSmrg 	  *)
348552f9793fSmrg	    # Add libc to deplibs on all other systems if necessary.
348652f9793fSmrg	    if test "$build_libtool_need_lc" = "yes"; then
348752f9793fSmrg	      deplibs="$deplibs -lc"
348852f9793fSmrg	    fi
348952f9793fSmrg	    ;;
349052f9793fSmrg	  esac
349152f9793fSmrg	fi
349252f9793fSmrg
349352f9793fSmrg	# Transform deplibs into only deplibs that can be linked in shared.
349452f9793fSmrg	name_save=$name
349552f9793fSmrg	libname_save=$libname
349652f9793fSmrg	release_save=$release
349752f9793fSmrg	versuffix_save=$versuffix
349852f9793fSmrg	major_save=$major
349952f9793fSmrg	# I'm not sure if I'm treating the release correctly.  I think
350052f9793fSmrg	# release should show up in the -l (ie -lgmp5) so we don't want to
350152f9793fSmrg	# add it in twice.  Is that correct?
350252f9793fSmrg	release=""
350352f9793fSmrg	versuffix=""
350452f9793fSmrg	major=""
350552f9793fSmrg	newdeplibs=
350652f9793fSmrg	droppeddeps=no
350752f9793fSmrg	case $deplibs_check_method in
350852f9793fSmrg	pass_all)
350952f9793fSmrg	  # Don't check for shared/static.  Everything works.
351052f9793fSmrg	  # This might be a little naive.  We might want to check
351152f9793fSmrg	  # whether the library exists or not.  But this is on
351252f9793fSmrg	  # osf3 & osf4 and I'm not really sure... Just
351352f9793fSmrg	  # implementing what was already the behavior.
351452f9793fSmrg	  newdeplibs=$deplibs
351552f9793fSmrg	  ;;
351652f9793fSmrg	test_compile)
351752f9793fSmrg	  # This code stresses the "libraries are programs" paradigm to its
351852f9793fSmrg	  # limits. Maybe even breaks it.  We compile a program, linking it
351952f9793fSmrg	  # against the deplibs as a proxy for the library.  Then we can check
352052f9793fSmrg	  # whether they linked in statically or dynamically with ldd.
352152f9793fSmrg	  $rm conftest.c
352252f9793fSmrg	  cat > conftest.c <<EOF
352352f9793fSmrg	  int main() { return 0; }
352452f9793fSmrgEOF
352552f9793fSmrg	  $rm conftest
352652f9793fSmrg	  $LTCC $LTCFLAGS -o conftest conftest.c $deplibs
352752f9793fSmrg	  if test "$?" -eq 0 ; then
352852f9793fSmrg	    ldd_output=`ldd conftest`
352952f9793fSmrg	    for i in $deplibs; do
353052f9793fSmrg	      name=`expr $i : '-l\(.*\)'`
353152f9793fSmrg	      # If $name is empty we are operating on a -L argument.
353252f9793fSmrg              if test "$name" != "" && test "$name" -ne "0"; then
353352f9793fSmrg		if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
353452f9793fSmrg		  case " $predeps $postdeps " in
353552f9793fSmrg		  *" $i "*)
353652f9793fSmrg		    newdeplibs="$newdeplibs $i"
353752f9793fSmrg		    i=""
353852f9793fSmrg		    ;;
353952f9793fSmrg		  esac
354052f9793fSmrg	        fi
354152f9793fSmrg		if test -n "$i" ; then
354252f9793fSmrg		  libname=`eval \\$echo \"$libname_spec\"`
354352f9793fSmrg		  deplib_matches=`eval \\$echo \"$library_names_spec\"`
354452f9793fSmrg		  set dummy $deplib_matches
354552f9793fSmrg		  deplib_match=$2
354652f9793fSmrg		  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
354752f9793fSmrg		    newdeplibs="$newdeplibs $i"
354852f9793fSmrg		  else
354952f9793fSmrg		    droppeddeps=yes
355052f9793fSmrg		    $echo
355152f9793fSmrg		    $echo "*** Warning: dynamic linker does not accept needed library $i."
355252f9793fSmrg		    $echo "*** I have the capability to make that library automatically link in when"
355352f9793fSmrg		    $echo "*** you link to this library.  But I can only do this if you have a"
355452f9793fSmrg		    $echo "*** shared version of the library, which I believe you do not have"
355552f9793fSmrg		    $echo "*** because a test_compile did reveal that the linker did not use it for"
355652f9793fSmrg		    $echo "*** its dynamic dependency list that programs get resolved with at runtime."
355752f9793fSmrg		  fi
355852f9793fSmrg		fi
355952f9793fSmrg	      else
356052f9793fSmrg		newdeplibs="$newdeplibs $i"
356152f9793fSmrg	      fi
356252f9793fSmrg	    done
356352f9793fSmrg	  else
356452f9793fSmrg	    # Error occurred in the first compile.  Let's try to salvage
356552f9793fSmrg	    # the situation: Compile a separate program for each library.
356652f9793fSmrg	    for i in $deplibs; do
356752f9793fSmrg	      name=`expr $i : '-l\(.*\)'`
356852f9793fSmrg	      # If $name is empty we are operating on a -L argument.
356952f9793fSmrg              if test "$name" != "" && test "$name" != "0"; then
357052f9793fSmrg		$rm conftest
357152f9793fSmrg		$LTCC $LTCFLAGS -o conftest conftest.c $i
357252f9793fSmrg		# Did it work?
357352f9793fSmrg		if test "$?" -eq 0 ; then
357452f9793fSmrg		  ldd_output=`ldd conftest`
357552f9793fSmrg		  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
357652f9793fSmrg		    case " $predeps $postdeps " in
357752f9793fSmrg		    *" $i "*)
357852f9793fSmrg		      newdeplibs="$newdeplibs $i"
357952f9793fSmrg		      i=""
358052f9793fSmrg		      ;;
358152f9793fSmrg		    esac
358252f9793fSmrg		  fi
358352f9793fSmrg		  if test -n "$i" ; then
358452f9793fSmrg		    libname=`eval \\$echo \"$libname_spec\"`
358552f9793fSmrg		    deplib_matches=`eval \\$echo \"$library_names_spec\"`
358652f9793fSmrg		    set dummy $deplib_matches
358752f9793fSmrg		    deplib_match=$2
358852f9793fSmrg		    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
358952f9793fSmrg		      newdeplibs="$newdeplibs $i"
359052f9793fSmrg		    else
359152f9793fSmrg		      droppeddeps=yes
359252f9793fSmrg		      $echo
359352f9793fSmrg		      $echo "*** Warning: dynamic linker does not accept needed library $i."
359452f9793fSmrg		      $echo "*** I have the capability to make that library automatically link in when"
359552f9793fSmrg		      $echo "*** you link to this library.  But I can only do this if you have a"
359652f9793fSmrg		      $echo "*** shared version of the library, which you do not appear to have"
359752f9793fSmrg		      $echo "*** because a test_compile did reveal that the linker did not use this one"
359852f9793fSmrg		      $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
359952f9793fSmrg		    fi
360052f9793fSmrg		  fi
360152f9793fSmrg		else
360252f9793fSmrg		  droppeddeps=yes
360352f9793fSmrg		  $echo
360452f9793fSmrg		  $echo "*** Warning!  Library $i is needed by this library but I was not able to"
360552f9793fSmrg		  $echo "***  make it link in!  You will probably need to install it or some"
360652f9793fSmrg		  $echo "*** library that it depends on before this library will be fully"
360752f9793fSmrg		  $echo "*** functional.  Installing it before continuing would be even better."
360852f9793fSmrg		fi
360952f9793fSmrg	      else
361052f9793fSmrg		newdeplibs="$newdeplibs $i"
361152f9793fSmrg	      fi
361252f9793fSmrg	    done
361352f9793fSmrg	  fi
361452f9793fSmrg	  ;;
361552f9793fSmrg	file_magic*)
361652f9793fSmrg	  set dummy $deplibs_check_method
361752f9793fSmrg	  file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
361852f9793fSmrg	  for a_deplib in $deplibs; do
361952f9793fSmrg	    name=`expr $a_deplib : '-l\(.*\)'`
362052f9793fSmrg	    # If $name is empty we are operating on a -L argument.
362152f9793fSmrg            if test "$name" != "" && test  "$name" != "0"; then
362252f9793fSmrg	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
362352f9793fSmrg		case " $predeps $postdeps " in
362452f9793fSmrg		*" $a_deplib "*)
362552f9793fSmrg		  newdeplibs="$newdeplibs $a_deplib"
362652f9793fSmrg		  a_deplib=""
362752f9793fSmrg		  ;;
362852f9793fSmrg		esac
362952f9793fSmrg	      fi
363052f9793fSmrg	      if test -n "$a_deplib" ; then
363152f9793fSmrg		libname=`eval \\$echo \"$libname_spec\"`
363252f9793fSmrg		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
363352f9793fSmrg		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
363452f9793fSmrg		  for potent_lib in $potential_libs; do
363552f9793fSmrg		      # Follow soft links.
363652f9793fSmrg		      if ls -lLd "$potent_lib" 2>/dev/null \
363752f9793fSmrg			 | grep " -> " >/dev/null; then
363852f9793fSmrg			continue
363952f9793fSmrg		      fi
364052f9793fSmrg		      # The statement above tries to avoid entering an
364152f9793fSmrg		      # endless loop below, in case of cyclic links.
364252f9793fSmrg		      # We might still enter an endless loop, since a link
364352f9793fSmrg		      # loop can be closed while we follow links,
364452f9793fSmrg		      # but so what?
364552f9793fSmrg		      potlib="$potent_lib"
364652f9793fSmrg		      while test -h "$potlib" 2>/dev/null; do
364752f9793fSmrg			potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
364852f9793fSmrg			case $potliblink in
364952f9793fSmrg			[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
365052f9793fSmrg			*) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
365152f9793fSmrg			esac
365252f9793fSmrg		      done
365352f9793fSmrg		      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
365452f9793fSmrg			 | ${SED} 10q \
365552f9793fSmrg			 | $EGREP "$file_magic_regex" > /dev/null; then
365652f9793fSmrg			newdeplibs="$newdeplibs $a_deplib"
365752f9793fSmrg			a_deplib=""
365852f9793fSmrg			break 2
365952f9793fSmrg		      fi
366052f9793fSmrg		  done
366152f9793fSmrg		done
366252f9793fSmrg	      fi
366352f9793fSmrg	      if test -n "$a_deplib" ; then
366452f9793fSmrg		droppeddeps=yes
366552f9793fSmrg		$echo
366652f9793fSmrg		$echo "*** Warning: linker path does not have real file for library $a_deplib."
366752f9793fSmrg		$echo "*** I have the capability to make that library automatically link in when"
366852f9793fSmrg		$echo "*** you link to this library.  But I can only do this if you have a"
366952f9793fSmrg		$echo "*** shared version of the library, which you do not appear to have"
367052f9793fSmrg		$echo "*** because I did check the linker path looking for a file starting"
367152f9793fSmrg		if test -z "$potlib" ; then
367252f9793fSmrg		  $echo "*** with $libname but no candidates were found. (...for file magic test)"
367352f9793fSmrg		else
367452f9793fSmrg		  $echo "*** with $libname and none of the candidates passed a file format test"
367552f9793fSmrg		  $echo "*** using a file magic. Last file checked: $potlib"
367652f9793fSmrg		fi
367752f9793fSmrg	      fi
367852f9793fSmrg	    else
367952f9793fSmrg	      # Add a -L argument.
368052f9793fSmrg	      newdeplibs="$newdeplibs $a_deplib"
368152f9793fSmrg	    fi
368252f9793fSmrg	  done # Gone through all deplibs.
368352f9793fSmrg	  ;;
368452f9793fSmrg	match_pattern*)
368552f9793fSmrg	  set dummy $deplibs_check_method
368652f9793fSmrg	  match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
368752f9793fSmrg	  for a_deplib in $deplibs; do
368852f9793fSmrg	    name=`expr $a_deplib : '-l\(.*\)'`
368952f9793fSmrg	    # If $name is empty we are operating on a -L argument.
369052f9793fSmrg	    if test -n "$name" && test "$name" != "0"; then
369152f9793fSmrg	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
369252f9793fSmrg		case " $predeps $postdeps " in
369352f9793fSmrg		*" $a_deplib "*)
369452f9793fSmrg		  newdeplibs="$newdeplibs $a_deplib"
369552f9793fSmrg		  a_deplib=""
369652f9793fSmrg		  ;;
369752f9793fSmrg		esac
369852f9793fSmrg	      fi
369952f9793fSmrg	      if test -n "$a_deplib" ; then
370052f9793fSmrg		libname=`eval \\$echo \"$libname_spec\"`
370152f9793fSmrg		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
370252f9793fSmrg		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
370352f9793fSmrg		  for potent_lib in $potential_libs; do
370452f9793fSmrg		    potlib="$potent_lib" # see symlink-check above in file_magic test
370552f9793fSmrg		    if eval $echo \"$potent_lib\" 2>/dev/null \
370652f9793fSmrg		        | ${SED} 10q \
370752f9793fSmrg		        | $EGREP "$match_pattern_regex" > /dev/null; then
370852f9793fSmrg		      newdeplibs="$newdeplibs $a_deplib"
370952f9793fSmrg		      a_deplib=""
371052f9793fSmrg		      break 2
371152f9793fSmrg		    fi
371252f9793fSmrg		  done
371352f9793fSmrg		done
371452f9793fSmrg	      fi
371552f9793fSmrg	      if test -n "$a_deplib" ; then
371652f9793fSmrg		droppeddeps=yes
371752f9793fSmrg		$echo
371852f9793fSmrg		$echo "*** Warning: linker path does not have real file for library $a_deplib."
371952f9793fSmrg		$echo "*** I have the capability to make that library automatically link in when"
372052f9793fSmrg		$echo "*** you link to this library.  But I can only do this if you have a"
372152f9793fSmrg		$echo "*** shared version of the library, which you do not appear to have"
372252f9793fSmrg		$echo "*** because I did check the linker path looking for a file starting"
372352f9793fSmrg		if test -z "$potlib" ; then
372452f9793fSmrg		  $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
372552f9793fSmrg		else
372652f9793fSmrg		  $echo "*** with $libname and none of the candidates passed a file format test"
372752f9793fSmrg		  $echo "*** using a regex pattern. Last file checked: $potlib"
372852f9793fSmrg		fi
372952f9793fSmrg	      fi
373052f9793fSmrg	    else
373152f9793fSmrg	      # Add a -L argument.
373252f9793fSmrg	      newdeplibs="$newdeplibs $a_deplib"
373352f9793fSmrg	    fi
373452f9793fSmrg	  done # Gone through all deplibs.
373552f9793fSmrg	  ;;
373652f9793fSmrg	none | unknown | *)
373752f9793fSmrg	  newdeplibs=""
373852f9793fSmrg	  tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
373952f9793fSmrg	    -e 's/ -[LR][^ ]*//g'`
374052f9793fSmrg	  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
374152f9793fSmrg	    for i in $predeps $postdeps ; do
374252f9793fSmrg	      # can't use Xsed below, because $i might contain '/'
374352f9793fSmrg	      tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
374452f9793fSmrg	    done
374552f9793fSmrg	  fi
374652f9793fSmrg	  if $echo "X $tmp_deplibs" | $Xsed -e 's/[ 	]//g' \
374752f9793fSmrg	    | grep . >/dev/null; then
374852f9793fSmrg	    $echo
374952f9793fSmrg	    if test "X$deplibs_check_method" = "Xnone"; then
375052f9793fSmrg	      $echo "*** Warning: inter-library dependencies are not supported in this platform."
375152f9793fSmrg	    else
375252f9793fSmrg	      $echo "*** Warning: inter-library dependencies are not known to be supported."
375352f9793fSmrg	    fi
375452f9793fSmrg	    $echo "*** All declared inter-library dependencies are being dropped."
375552f9793fSmrg	    droppeddeps=yes
375652f9793fSmrg	  fi
375752f9793fSmrg	  ;;
375852f9793fSmrg	esac
375952f9793fSmrg	versuffix=$versuffix_save
376052f9793fSmrg	major=$major_save
376152f9793fSmrg	release=$release_save
376252f9793fSmrg	libname=$libname_save
376352f9793fSmrg	name=$name_save
376452f9793fSmrg
376552f9793fSmrg	case $host in
376652f9793fSmrg	*-*-rhapsody* | *-*-darwin1.[012])
376752f9793fSmrg	  # On Rhapsody replace the C library is the System framework
376852f9793fSmrg	  newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
376952f9793fSmrg	  ;;
377052f9793fSmrg	esac
377152f9793fSmrg
377252f9793fSmrg	if test "$droppeddeps" = yes; then
377352f9793fSmrg	  if test "$module" = yes; then
377452f9793fSmrg	    $echo
377552f9793fSmrg	    $echo "*** Warning: libtool could not satisfy all declared inter-library"
377652f9793fSmrg	    $echo "*** dependencies of module $libname.  Therefore, libtool will create"
377752f9793fSmrg	    $echo "*** a static module, that should work as long as the dlopening"
377852f9793fSmrg	    $echo "*** application is linked with the -dlopen flag."
377952f9793fSmrg	    if test -z "$global_symbol_pipe"; then
378052f9793fSmrg	      $echo
378152f9793fSmrg	      $echo "*** However, this would only work if libtool was able to extract symbol"
378252f9793fSmrg	      $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
378352f9793fSmrg	      $echo "*** not find such a program.  So, this module is probably useless."
378452f9793fSmrg	      $echo "*** \`nm' from GNU binutils and a full rebuild may help."
378552f9793fSmrg	    fi
378652f9793fSmrg	    if test "$build_old_libs" = no; then
378752f9793fSmrg	      oldlibs="$output_objdir/$libname.$libext"
378852f9793fSmrg	      build_libtool_libs=module
378952f9793fSmrg	      build_old_libs=yes
379052f9793fSmrg	    else
379152f9793fSmrg	      build_libtool_libs=no
379252f9793fSmrg	    fi
379352f9793fSmrg	  else
379452f9793fSmrg	    $echo "*** The inter-library dependencies that have been dropped here will be"
379552f9793fSmrg	    $echo "*** automatically added whenever a program is linked with this library"
379652f9793fSmrg	    $echo "*** or is declared to -dlopen it."
379752f9793fSmrg
379852f9793fSmrg	    if test "$allow_undefined" = no; then
379952f9793fSmrg	      $echo
380052f9793fSmrg	      $echo "*** Since this library must not contain undefined symbols,"
380152f9793fSmrg	      $echo "*** because either the platform does not support them or"
380252f9793fSmrg	      $echo "*** it was explicitly requested with -no-undefined,"
380352f9793fSmrg	      $echo "*** libtool will only create a static version of it."
380452f9793fSmrg	      if test "$build_old_libs" = no; then
380552f9793fSmrg		oldlibs="$output_objdir/$libname.$libext"
380652f9793fSmrg		build_libtool_libs=module
380752f9793fSmrg		build_old_libs=yes
380852f9793fSmrg	      else
380952f9793fSmrg		build_libtool_libs=no
381052f9793fSmrg	      fi
381152f9793fSmrg	    fi
381252f9793fSmrg	  fi
381352f9793fSmrg	fi
381452f9793fSmrg	# Done checking deplibs!
381552f9793fSmrg	deplibs=$newdeplibs
381652f9793fSmrg      fi
381752f9793fSmrg
381852f9793fSmrg
381952f9793fSmrg      # move library search paths that coincide with paths to not yet
382052f9793fSmrg      # installed libraries to the beginning of the library search list
382152f9793fSmrg      new_libs=
382252f9793fSmrg      for path in $notinst_path; do
382352f9793fSmrg	case " $new_libs " in
382452f9793fSmrg	*" -L$path/$objdir "*) ;;
382552f9793fSmrg	*)
382652f9793fSmrg	  case " $deplibs " in
382752f9793fSmrg	  *" -L$path/$objdir "*)
382852f9793fSmrg	    new_libs="$new_libs -L$path/$objdir" ;;
382952f9793fSmrg	  esac
383052f9793fSmrg	  ;;
383152f9793fSmrg	esac
383252f9793fSmrg      done
383352f9793fSmrg      for deplib in $deplibs; do
383452f9793fSmrg	case $deplib in
383552f9793fSmrg	-L*)
383652f9793fSmrg	  case " $new_libs " in
383752f9793fSmrg	  *" $deplib "*) ;;
383852f9793fSmrg	  *) new_libs="$new_libs $deplib" ;;
383952f9793fSmrg	  esac
384052f9793fSmrg	  ;;
384152f9793fSmrg	*) new_libs="$new_libs $deplib" ;;
384252f9793fSmrg	esac
384352f9793fSmrg      done
384452f9793fSmrg      deplibs="$new_libs"
384552f9793fSmrg
384652f9793fSmrg
384752f9793fSmrg      # All the library-specific variables (install_libdir is set above).
384852f9793fSmrg      library_names=
384952f9793fSmrg      old_library=
385052f9793fSmrg      dlname=
385152f9793fSmrg
385252f9793fSmrg      # Test again, we may have decided not to build it any more
385352f9793fSmrg      if test "$build_libtool_libs" = yes; then
385452f9793fSmrg	if test "$hardcode_into_libs" = yes; then
385552f9793fSmrg	  # Hardcode the library paths
385652f9793fSmrg	  hardcode_libdirs=
385752f9793fSmrg	  dep_rpath=
385852f9793fSmrg	  rpath="$finalize_rpath"
385952f9793fSmrg	  test "$mode" != relink && rpath="$compile_rpath$rpath"
386052f9793fSmrg	  for libdir in $rpath; do
386152f9793fSmrg	    if test -n "$hardcode_libdir_flag_spec"; then
386252f9793fSmrg	      if test -n "$hardcode_libdir_separator"; then
386352f9793fSmrg		if test -z "$hardcode_libdirs"; then
386452f9793fSmrg		  hardcode_libdirs="$libdir"
386552f9793fSmrg		else
386652f9793fSmrg		  # Just accumulate the unique libdirs.
386752f9793fSmrg		  case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
386852f9793fSmrg		  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
386952f9793fSmrg		    ;;
387052f9793fSmrg		  *)
387152f9793fSmrg		    hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
387252f9793fSmrg		    ;;
387352f9793fSmrg		  esac
387452f9793fSmrg		fi
387552f9793fSmrg	      else
387652f9793fSmrg		eval flag=\"$hardcode_libdir_flag_spec\"
387752f9793fSmrg		dep_rpath="$dep_rpath $flag"
387852f9793fSmrg	      fi
387952f9793fSmrg	    elif test -n "$runpath_var"; then
388052f9793fSmrg	      case "$perm_rpath " in
388152f9793fSmrg	      *" $libdir "*) ;;
388252f9793fSmrg	      *) perm_rpath="$perm_rpath $libdir" ;;
388352f9793fSmrg	      esac
388452f9793fSmrg	    fi
388552f9793fSmrg	  done
388652f9793fSmrg	  # Substitute the hardcoded libdirs into the rpath.
388752f9793fSmrg	  if test -n "$hardcode_libdir_separator" &&
388852f9793fSmrg	     test -n "$hardcode_libdirs"; then
388952f9793fSmrg	    libdir="$hardcode_libdirs"
389052f9793fSmrg	    if test -n "$hardcode_libdir_flag_spec_ld"; then
389152f9793fSmrg	      eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
389252f9793fSmrg	    else
389352f9793fSmrg	      eval dep_rpath=\"$hardcode_libdir_flag_spec\"
389452f9793fSmrg	    fi
389552f9793fSmrg	  fi
389652f9793fSmrg	  if test -n "$runpath_var" && test -n "$perm_rpath"; then
389752f9793fSmrg	    # We should set the runpath_var.
389852f9793fSmrg	    rpath=
389952f9793fSmrg	    for dir in $perm_rpath; do
390052f9793fSmrg	      rpath="$rpath$dir:"
390152f9793fSmrg	    done
390252f9793fSmrg	    eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
390352f9793fSmrg	  fi
390452f9793fSmrg	  test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
390552f9793fSmrg	fi
390652f9793fSmrg
390752f9793fSmrg	shlibpath="$finalize_shlibpath"
390852f9793fSmrg	test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
390952f9793fSmrg	if test -n "$shlibpath"; then
391052f9793fSmrg	  eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
391152f9793fSmrg	fi
391252f9793fSmrg
391352f9793fSmrg	# Get the real and link names of the library.
391452f9793fSmrg	eval shared_ext=\"$shrext_cmds\"
391552f9793fSmrg	eval library_names=\"$library_names_spec\"
391652f9793fSmrg	set dummy $library_names
391752f9793fSmrg	realname="$2"
391852f9793fSmrg	shift; shift
391952f9793fSmrg
392052f9793fSmrg	if test -n "$soname_spec"; then
392152f9793fSmrg	  eval soname=\"$soname_spec\"
392252f9793fSmrg	else
392352f9793fSmrg	  soname="$realname"
392452f9793fSmrg	fi
392552f9793fSmrg	if test -z "$dlname"; then
392652f9793fSmrg	  dlname=$soname
392752f9793fSmrg	fi
392852f9793fSmrg
392952f9793fSmrg	lib="$output_objdir/$realname"
393052f9793fSmrg	linknames=
393152f9793fSmrg	for link
393252f9793fSmrg	do
393352f9793fSmrg	  linknames="$linknames $link"
393452f9793fSmrg	done
393552f9793fSmrg
393652f9793fSmrg	# Use standard objects if they are pic
393752f9793fSmrg	test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
393852f9793fSmrg
393952f9793fSmrg	# Prepare the list of exported symbols
394052f9793fSmrg	if test -z "$export_symbols"; then
394152f9793fSmrg	  if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
394252f9793fSmrg	    $show "generating symbol list for \`$libname.la'"
394352f9793fSmrg	    export_symbols="$output_objdir/$libname.exp"
394452f9793fSmrg	    $run $rm $export_symbols
394552f9793fSmrg	    cmds=$export_symbols_cmds
394652f9793fSmrg	    save_ifs="$IFS"; IFS='~'
394752f9793fSmrg	    for cmd in $cmds; do
394852f9793fSmrg	      IFS="$save_ifs"
394952f9793fSmrg	      eval cmd=\"$cmd\"
395052f9793fSmrg	      if len=`expr "X$cmd" : ".*"` &&
395152f9793fSmrg	       test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
395252f9793fSmrg	        $show "$cmd"
395352f9793fSmrg	        $run eval "$cmd" || exit $?
395452f9793fSmrg	        skipped_export=false
395552f9793fSmrg	      else
395652f9793fSmrg	        # The command line is too long to execute in one step.
395752f9793fSmrg	        $show "using reloadable object file for export list..."
395852f9793fSmrg	        skipped_export=:
395952f9793fSmrg		# Break out early, otherwise skipped_export may be
396052f9793fSmrg		# set to false by a later but shorter cmd.
396152f9793fSmrg		break
396252f9793fSmrg	      fi
396352f9793fSmrg	    done
396452f9793fSmrg	    IFS="$save_ifs"
396552f9793fSmrg	    if test -n "$export_symbols_regex"; then
396652f9793fSmrg	      $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
396752f9793fSmrg	      $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
396852f9793fSmrg	      $show "$mv \"${export_symbols}T\" \"$export_symbols\""
396952f9793fSmrg	      $run eval '$mv "${export_symbols}T" "$export_symbols"'
397052f9793fSmrg	    fi
397152f9793fSmrg	  fi
397252f9793fSmrg	fi
397352f9793fSmrg
397452f9793fSmrg	if test -n "$export_symbols" && test -n "$include_expsyms"; then
397552f9793fSmrg	  $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
397652f9793fSmrg	fi
397752f9793fSmrg
397852f9793fSmrg	tmp_deplibs=
397952f9793fSmrg	for test_deplib in $deplibs; do
398052f9793fSmrg		case " $convenience " in
398152f9793fSmrg		*" $test_deplib "*) ;;
398252f9793fSmrg		*)
398352f9793fSmrg			tmp_deplibs="$tmp_deplibs $test_deplib"
398452f9793fSmrg			;;
398552f9793fSmrg		esac
398652f9793fSmrg	done
398752f9793fSmrg	deplibs="$tmp_deplibs"
398852f9793fSmrg
398952f9793fSmrg	if test -n "$convenience"; then
399052f9793fSmrg	  if test -n "$whole_archive_flag_spec"; then
399152f9793fSmrg	    save_libobjs=$libobjs
399252f9793fSmrg	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
399352f9793fSmrg	  else
399452f9793fSmrg	    gentop="$output_objdir/${outputname}x"
399552f9793fSmrg	    generated="$generated $gentop"
399652f9793fSmrg
399752f9793fSmrg	    func_extract_archives $gentop $convenience
399852f9793fSmrg	    libobjs="$libobjs $func_extract_archives_result"
399952f9793fSmrg	  fi
400052f9793fSmrg	fi
400152f9793fSmrg	
400252f9793fSmrg	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
400352f9793fSmrg	  eval flag=\"$thread_safe_flag_spec\"
400452f9793fSmrg	  linker_flags="$linker_flags $flag"
400552f9793fSmrg	fi
400652f9793fSmrg
400752f9793fSmrg	# Make a backup of the uninstalled library when relinking
400852f9793fSmrg	if test "$mode" = relink; then
400952f9793fSmrg	  $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
401052f9793fSmrg	fi
401152f9793fSmrg
401252f9793fSmrg	# Do each of the archive commands.
401352f9793fSmrg	if test "$module" = yes && test -n "$module_cmds" ; then
401452f9793fSmrg	  if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
401552f9793fSmrg	    eval test_cmds=\"$module_expsym_cmds\"
401652f9793fSmrg	    cmds=$module_expsym_cmds
401752f9793fSmrg	  else
401852f9793fSmrg	    eval test_cmds=\"$module_cmds\"
401952f9793fSmrg	    cmds=$module_cmds
402052f9793fSmrg	  fi
402152f9793fSmrg	else
402252f9793fSmrg	if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
402352f9793fSmrg	  eval test_cmds=\"$archive_expsym_cmds\"
402452f9793fSmrg	  cmds=$archive_expsym_cmds
402552f9793fSmrg	else
402652f9793fSmrg	  eval test_cmds=\"$archive_cmds\"
402752f9793fSmrg	  cmds=$archive_cmds
402852f9793fSmrg	  fi
402952f9793fSmrg	fi
403052f9793fSmrg
403152f9793fSmrg	if test "X$skipped_export" != "X:" &&
403252f9793fSmrg	   len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
403352f9793fSmrg	   test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
403452f9793fSmrg	  :
403552f9793fSmrg	else
403652f9793fSmrg	  # The command line is too long to link in one step, link piecewise.
403752f9793fSmrg	  $echo "creating reloadable object files..."
403852f9793fSmrg
403952f9793fSmrg	  # Save the value of $output and $libobjs because we want to
404052f9793fSmrg	  # use them later.  If we have whole_archive_flag_spec, we
404152f9793fSmrg	  # want to use save_libobjs as it was before
404252f9793fSmrg	  # whole_archive_flag_spec was expanded, because we can't
404352f9793fSmrg	  # assume the linker understands whole_archive_flag_spec.
404452f9793fSmrg	  # This may have to be revisited, in case too many
404552f9793fSmrg	  # convenience libraries get linked in and end up exceeding
404652f9793fSmrg	  # the spec.
404752f9793fSmrg	  if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
404852f9793fSmrg	    save_libobjs=$libobjs
404952f9793fSmrg	  fi
405052f9793fSmrg	  save_output=$output
405152f9793fSmrg	  output_la=`$echo "X$output" | $Xsed -e "$basename"`
405252f9793fSmrg
405352f9793fSmrg	  # Clear the reloadable object creation command queue and
405452f9793fSmrg	  # initialize k to one.
405552f9793fSmrg	  test_cmds=
405652f9793fSmrg	  concat_cmds=
405752f9793fSmrg	  objlist=
405852f9793fSmrg	  delfiles=
405952f9793fSmrg	  last_robj=
406052f9793fSmrg	  k=1
406152f9793fSmrg	  output=$output_objdir/$output_la-${k}.$objext
406252f9793fSmrg	  # Loop over the list of objects to be linked.
406352f9793fSmrg	  for obj in $save_libobjs
406452f9793fSmrg	  do
406552f9793fSmrg	    eval test_cmds=\"$reload_cmds $objlist $last_robj\"
406652f9793fSmrg	    if test "X$objlist" = X ||
406752f9793fSmrg	       { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
406852f9793fSmrg		 test "$len" -le "$max_cmd_len"; }; then
406952f9793fSmrg	      objlist="$objlist $obj"
407052f9793fSmrg	    else
407152f9793fSmrg	      # The command $test_cmds is almost too long, add a
407252f9793fSmrg	      # command to the queue.
407352f9793fSmrg	      if test "$k" -eq 1 ; then
407452f9793fSmrg		# The first file doesn't have a previous command to add.
407552f9793fSmrg		eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
407652f9793fSmrg	      else
407752f9793fSmrg		# All subsequent reloadable object files will link in
407852f9793fSmrg		# the last one created.
407952f9793fSmrg		eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
408052f9793fSmrg	      fi
408152f9793fSmrg	      last_robj=$output_objdir/$output_la-${k}.$objext
408252f9793fSmrg	      k=`expr $k + 1`
408352f9793fSmrg	      output=$output_objdir/$output_la-${k}.$objext
408452f9793fSmrg	      objlist=$obj
408552f9793fSmrg	      len=1
408652f9793fSmrg	    fi
408752f9793fSmrg	  done
408852f9793fSmrg	  # Handle the remaining objects by creating one last
408952f9793fSmrg	  # reloadable object file.  All subsequent reloadable object
409052f9793fSmrg	  # files will link in the last one created.
409152f9793fSmrg	  test -z "$concat_cmds" || concat_cmds=$concat_cmds~
409252f9793fSmrg	  eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
409352f9793fSmrg
409452f9793fSmrg	  if ${skipped_export-false}; then
409552f9793fSmrg	    $show "generating symbol list for \`$libname.la'"
409652f9793fSmrg	    export_symbols="$output_objdir/$libname.exp"
409752f9793fSmrg	    $run $rm $export_symbols
409852f9793fSmrg	    libobjs=$output
409952f9793fSmrg	    # Append the command to create the export file.
410052f9793fSmrg	    eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
410152f9793fSmrg          fi
410252f9793fSmrg
410352f9793fSmrg	  # Set up a command to remove the reloadable object files
410452f9793fSmrg	  # after they are used.
410552f9793fSmrg	  i=0
410652f9793fSmrg	  while test "$i" -lt "$k"
410752f9793fSmrg	  do
410852f9793fSmrg	    i=`expr $i + 1`
410952f9793fSmrg	    delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
411052f9793fSmrg	  done
411152f9793fSmrg
411252f9793fSmrg	  $echo "creating a temporary reloadable object file: $output"
411352f9793fSmrg
411452f9793fSmrg	  # Loop through the commands generated above and execute them.
411552f9793fSmrg	  save_ifs="$IFS"; IFS='~'
411652f9793fSmrg	  for cmd in $concat_cmds; do
411752f9793fSmrg	    IFS="$save_ifs"
411852f9793fSmrg	    $show "$cmd"
411952f9793fSmrg	    $run eval "$cmd" || exit $?
412052f9793fSmrg	  done
412152f9793fSmrg	  IFS="$save_ifs"
412252f9793fSmrg
412352f9793fSmrg	  libobjs=$output
412452f9793fSmrg	  # Restore the value of output.
412552f9793fSmrg	  output=$save_output
412652f9793fSmrg
412752f9793fSmrg	  if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
412852f9793fSmrg	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
412952f9793fSmrg	  fi
413052f9793fSmrg	  # Expand the library linking commands again to reset the
413152f9793fSmrg	  # value of $libobjs for piecewise linking.
413252f9793fSmrg
413352f9793fSmrg	  # Do each of the archive commands.
413452f9793fSmrg	  if test "$module" = yes && test -n "$module_cmds" ; then
413552f9793fSmrg	    if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
413652f9793fSmrg	      cmds=$module_expsym_cmds
413752f9793fSmrg	    else
413852f9793fSmrg	      cmds=$module_cmds
413952f9793fSmrg	    fi
414052f9793fSmrg	  else
414152f9793fSmrg	  if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
414252f9793fSmrg	    cmds=$archive_expsym_cmds
414352f9793fSmrg	  else
414452f9793fSmrg	    cmds=$archive_cmds
414552f9793fSmrg	    fi
414652f9793fSmrg	  fi
414752f9793fSmrg
414852f9793fSmrg	  # Append the command to remove the reloadable object files
414952f9793fSmrg	  # to the just-reset $cmds.
415052f9793fSmrg	  eval cmds=\"\$cmds~\$rm $delfiles\"
415152f9793fSmrg	fi
415252f9793fSmrg	save_ifs="$IFS"; IFS='~'
415352f9793fSmrg	for cmd in $cmds; do
415452f9793fSmrg	  IFS="$save_ifs"
415552f9793fSmrg	  eval cmd=\"$cmd\"
415652f9793fSmrg	  $show "$cmd"
415752f9793fSmrg	  $run eval "$cmd" || {
415852f9793fSmrg	    lt_exit=$?
415952f9793fSmrg
416052f9793fSmrg	    # Restore the uninstalled library and exit
416152f9793fSmrg	    if test "$mode" = relink; then
416252f9793fSmrg	      $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
416352f9793fSmrg	    fi
416452f9793fSmrg
416552f9793fSmrg	    exit $lt_exit
416652f9793fSmrg	  }
416752f9793fSmrg	done
416852f9793fSmrg	IFS="$save_ifs"
416952f9793fSmrg
417052f9793fSmrg	# Restore the uninstalled library and exit
417152f9793fSmrg	if test "$mode" = relink; then
417252f9793fSmrg	  $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
417352f9793fSmrg
417452f9793fSmrg	  if test -n "$convenience"; then
417552f9793fSmrg	    if test -z "$whole_archive_flag_spec"; then
417652f9793fSmrg	      $show "${rm}r $gentop"
417752f9793fSmrg	      $run ${rm}r "$gentop"
417852f9793fSmrg	    fi
417952f9793fSmrg	  fi
418052f9793fSmrg
418152f9793fSmrg	  exit $EXIT_SUCCESS
418252f9793fSmrg	fi
418352f9793fSmrg
418452f9793fSmrg	# Create links to the real library.
418552f9793fSmrg	for linkname in $linknames; do
418652f9793fSmrg	  if test "$realname" != "$linkname"; then
418752f9793fSmrg	    $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
418852f9793fSmrg	    $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
418952f9793fSmrg	  fi
419052f9793fSmrg	done
419152f9793fSmrg
419252f9793fSmrg	# If -module or -export-dynamic was specified, set the dlname.
419352f9793fSmrg	if test "$module" = yes || test "$export_dynamic" = yes; then
419452f9793fSmrg	  # On all known operating systems, these are identical.
419552f9793fSmrg	  dlname="$soname"
419652f9793fSmrg	fi
419752f9793fSmrg      fi
419852f9793fSmrg      ;;
419952f9793fSmrg
420052f9793fSmrg    obj)
420152f9793fSmrg      if test -n "$deplibs"; then
420252f9793fSmrg	$echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
420352f9793fSmrg      fi
420452f9793fSmrg
420552f9793fSmrg      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
420652f9793fSmrg	$echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
420752f9793fSmrg      fi
420852f9793fSmrg
420952f9793fSmrg      if test -n "$rpath"; then
421052f9793fSmrg	$echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
421152f9793fSmrg      fi
421252f9793fSmrg
421352f9793fSmrg      if test -n "$xrpath"; then
421452f9793fSmrg	$echo "$modename: warning: \`-R' is ignored for objects" 1>&2
421552f9793fSmrg      fi
421652f9793fSmrg
421752f9793fSmrg      if test -n "$vinfo"; then
421852f9793fSmrg	$echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
421952f9793fSmrg      fi
422052f9793fSmrg
422152f9793fSmrg      if test -n "$release"; then
422252f9793fSmrg	$echo "$modename: warning: \`-release' is ignored for objects" 1>&2
422352f9793fSmrg      fi
422452f9793fSmrg
422552f9793fSmrg      case $output in
422652f9793fSmrg      *.lo)
422752f9793fSmrg	if test -n "$objs$old_deplibs"; then
422852f9793fSmrg	  $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
422952f9793fSmrg	  exit $EXIT_FAILURE
423052f9793fSmrg	fi
423152f9793fSmrg	libobj="$output"
423252f9793fSmrg	obj=`$echo "X$output" | $Xsed -e "$lo2o"`
423352f9793fSmrg	;;
423452f9793fSmrg      *)
423552f9793fSmrg	libobj=
423652f9793fSmrg	obj="$output"
423752f9793fSmrg	;;
423852f9793fSmrg      esac
423952f9793fSmrg
424052f9793fSmrg      # Delete the old objects.
424152f9793fSmrg      $run $rm $obj $libobj
424252f9793fSmrg
424352f9793fSmrg      # Objects from convenience libraries.  This assumes
424452f9793fSmrg      # single-version convenience libraries.  Whenever we create
424552f9793fSmrg      # different ones for PIC/non-PIC, this we'll have to duplicate
424652f9793fSmrg      # the extraction.
424752f9793fSmrg      reload_conv_objs=
424852f9793fSmrg      gentop=
424952f9793fSmrg      # reload_cmds runs $LD directly, so let us get rid of
425052f9793fSmrg      # -Wl from whole_archive_flag_spec
425152f9793fSmrg      wl=
425252f9793fSmrg
425352f9793fSmrg      if test -n "$convenience"; then
425452f9793fSmrg	if test -n "$whole_archive_flag_spec"; then
425552f9793fSmrg	  eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
425652f9793fSmrg	else
425752f9793fSmrg	  gentop="$output_objdir/${obj}x"
425852f9793fSmrg	  generated="$generated $gentop"
425952f9793fSmrg
426052f9793fSmrg	  func_extract_archives $gentop $convenience
426152f9793fSmrg	  reload_conv_objs="$reload_objs $func_extract_archives_result"
426252f9793fSmrg	fi
426352f9793fSmrg      fi
426452f9793fSmrg
426552f9793fSmrg      # Create the old-style object.
426652f9793fSmrg      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
426752f9793fSmrg
426852f9793fSmrg      output="$obj"
426952f9793fSmrg      cmds=$reload_cmds
427052f9793fSmrg      save_ifs="$IFS"; IFS='~'
427152f9793fSmrg      for cmd in $cmds; do
427252f9793fSmrg	IFS="$save_ifs"
427352f9793fSmrg	eval cmd=\"$cmd\"
427452f9793fSmrg	$show "$cmd"
427552f9793fSmrg	$run eval "$cmd" || exit $?
427652f9793fSmrg      done
427752f9793fSmrg      IFS="$save_ifs"
427852f9793fSmrg
427952f9793fSmrg      # Exit if we aren't doing a library object file.
428052f9793fSmrg      if test -z "$libobj"; then
428152f9793fSmrg	if test -n "$gentop"; then
428252f9793fSmrg	  $show "${rm}r $gentop"
428352f9793fSmrg	  $run ${rm}r $gentop
428452f9793fSmrg	fi
428552f9793fSmrg
428652f9793fSmrg	exit $EXIT_SUCCESS
428752f9793fSmrg      fi
428852f9793fSmrg
428952f9793fSmrg      if test "$build_libtool_libs" != yes; then
429052f9793fSmrg	if test -n "$gentop"; then
429152f9793fSmrg	  $show "${rm}r $gentop"
429252f9793fSmrg	  $run ${rm}r $gentop
429352f9793fSmrg	fi
429452f9793fSmrg
429552f9793fSmrg	# Create an invalid libtool object if no PIC, so that we don't
429652f9793fSmrg	# accidentally link it into a program.
429752f9793fSmrg	# $show "echo timestamp > $libobj"
429852f9793fSmrg	# $run eval "echo timestamp > $libobj" || exit $?
429952f9793fSmrg	exit $EXIT_SUCCESS
430052f9793fSmrg      fi
430152f9793fSmrg
430252f9793fSmrg      if test -n "$pic_flag" || test "$pic_mode" != default; then
430352f9793fSmrg	# Only do commands if we really have different PIC objects.
430452f9793fSmrg	reload_objs="$libobjs $reload_conv_objs"
430552f9793fSmrg	output="$libobj"
430652f9793fSmrg	cmds=$reload_cmds
430752f9793fSmrg	save_ifs="$IFS"; IFS='~'
430852f9793fSmrg	for cmd in $cmds; do
430952f9793fSmrg	  IFS="$save_ifs"
431052f9793fSmrg	  eval cmd=\"$cmd\"
431152f9793fSmrg	  $show "$cmd"
431252f9793fSmrg	  $run eval "$cmd" || exit $?
431352f9793fSmrg	done
431452f9793fSmrg	IFS="$save_ifs"
431552f9793fSmrg      fi
431652f9793fSmrg
431752f9793fSmrg      if test -n "$gentop"; then
431852f9793fSmrg	$show "${rm}r $gentop"
431952f9793fSmrg	$run ${rm}r $gentop
432052f9793fSmrg      fi
432152f9793fSmrg
432252f9793fSmrg      exit $EXIT_SUCCESS
432352f9793fSmrg      ;;
432452f9793fSmrg
432552f9793fSmrg    prog)
432652f9793fSmrg      case $host in
432752f9793fSmrg	*cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
432852f9793fSmrg      esac
432952f9793fSmrg      if test -n "$vinfo"; then
433052f9793fSmrg	$echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
433152f9793fSmrg      fi
433252f9793fSmrg
433352f9793fSmrg      if test -n "$release"; then
433452f9793fSmrg	$echo "$modename: warning: \`-release' is ignored for programs" 1>&2
433552f9793fSmrg      fi
433652f9793fSmrg
433752f9793fSmrg      if test "$preload" = yes; then
433852f9793fSmrg	if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
433952f9793fSmrg	   test "$dlopen_self_static" = unknown; then
434052f9793fSmrg	  $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
434152f9793fSmrg	fi
434252f9793fSmrg      fi
434352f9793fSmrg
434452f9793fSmrg      case $host in
434552f9793fSmrg      *-*-rhapsody* | *-*-darwin1.[012])
434652f9793fSmrg	# On Rhapsody replace the C library is the System framework
434752f9793fSmrg	compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
434852f9793fSmrg	finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
434952f9793fSmrg	;;
435052f9793fSmrg      esac
435152f9793fSmrg
435252f9793fSmrg      case $host in
435352f9793fSmrg      *darwin*)
435452f9793fSmrg        # Don't allow lazy linking, it breaks C++ global constructors
435552f9793fSmrg        if test "$tagname" = CXX ; then
435652f9793fSmrg        compile_command="$compile_command ${wl}-bind_at_load"
435752f9793fSmrg        finalize_command="$finalize_command ${wl}-bind_at_load"
435852f9793fSmrg        fi
435952f9793fSmrg        ;;
436052f9793fSmrg      esac
436152f9793fSmrg
436252f9793fSmrg
436352f9793fSmrg      # move library search paths that coincide with paths to not yet
436452f9793fSmrg      # installed libraries to the beginning of the library search list
436552f9793fSmrg      new_libs=
436652f9793fSmrg      for path in $notinst_path; do
436752f9793fSmrg	case " $new_libs " in
436852f9793fSmrg	*" -L$path/$objdir "*) ;;
436952f9793fSmrg	*)
437052f9793fSmrg	  case " $compile_deplibs " in
437152f9793fSmrg	  *" -L$path/$objdir "*)
437252f9793fSmrg	    new_libs="$new_libs -L$path/$objdir" ;;
437352f9793fSmrg	  esac
437452f9793fSmrg	  ;;
437552f9793fSmrg	esac
437652f9793fSmrg      done
437752f9793fSmrg      for deplib in $compile_deplibs; do
437852f9793fSmrg	case $deplib in
437952f9793fSmrg	-L*)
438052f9793fSmrg	  case " $new_libs " in
438152f9793fSmrg	  *" $deplib "*) ;;
438252f9793fSmrg	  *) new_libs="$new_libs $deplib" ;;
438352f9793fSmrg	  esac
438452f9793fSmrg	  ;;
438552f9793fSmrg	*) new_libs="$new_libs $deplib" ;;
438652f9793fSmrg	esac
438752f9793fSmrg      done
438852f9793fSmrg      compile_deplibs="$new_libs"
438952f9793fSmrg
439052f9793fSmrg
439152f9793fSmrg      compile_command="$compile_command $compile_deplibs"
439252f9793fSmrg      finalize_command="$finalize_command $finalize_deplibs"
439352f9793fSmrg
439452f9793fSmrg      if test -n "$rpath$xrpath"; then
439552f9793fSmrg	# If the user specified any rpath flags, then add them.
439652f9793fSmrg	for libdir in $rpath $xrpath; do
439752f9793fSmrg	  # This is the magic to use -rpath.
439852f9793fSmrg	  case "$finalize_rpath " in
439952f9793fSmrg	  *" $libdir "*) ;;
440052f9793fSmrg	  *) finalize_rpath="$finalize_rpath $libdir" ;;
440152f9793fSmrg	  esac
440252f9793fSmrg	done
440352f9793fSmrg      fi
440452f9793fSmrg
440552f9793fSmrg      # Now hardcode the library paths
440652f9793fSmrg      rpath=
440752f9793fSmrg      hardcode_libdirs=
440852f9793fSmrg      for libdir in $compile_rpath $finalize_rpath; do
440952f9793fSmrg	if test -n "$hardcode_libdir_flag_spec"; then
441052f9793fSmrg	  if test -n "$hardcode_libdir_separator"; then
441152f9793fSmrg	    if test -z "$hardcode_libdirs"; then
441252f9793fSmrg	      hardcode_libdirs="$libdir"
441352f9793fSmrg	    else
441452f9793fSmrg	      # Just accumulate the unique libdirs.
441552f9793fSmrg	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
441652f9793fSmrg	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
441752f9793fSmrg		;;
441852f9793fSmrg	      *)
441952f9793fSmrg		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
442052f9793fSmrg		;;
442152f9793fSmrg	      esac
442252f9793fSmrg	    fi
442352f9793fSmrg	  else
442452f9793fSmrg	    eval flag=\"$hardcode_libdir_flag_spec\"
442552f9793fSmrg	    rpath="$rpath $flag"
442652f9793fSmrg	  fi
442752f9793fSmrg	elif test -n "$runpath_var"; then
442852f9793fSmrg	  case "$perm_rpath " in
442952f9793fSmrg	  *" $libdir "*) ;;
443052f9793fSmrg	  *) perm_rpath="$perm_rpath $libdir" ;;
443152f9793fSmrg	  esac
443252f9793fSmrg	fi
443352f9793fSmrg	case $host in
443452f9793fSmrg	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
443552f9793fSmrg	  testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
443652f9793fSmrg	  case :$dllsearchpath: in
443752f9793fSmrg	  *":$libdir:"*) ;;
443852f9793fSmrg	  *) dllsearchpath="$dllsearchpath:$libdir";;
443952f9793fSmrg	  esac
444052f9793fSmrg	  case :$dllsearchpath: in
444152f9793fSmrg	  *":$testbindir:"*) ;;
444252f9793fSmrg	  *) dllsearchpath="$dllsearchpath:$testbindir";;
444352f9793fSmrg	  esac
444452f9793fSmrg	  ;;
444552f9793fSmrg	esac
444652f9793fSmrg      done
444752f9793fSmrg      # Substitute the hardcoded libdirs into the rpath.
444852f9793fSmrg      if test -n "$hardcode_libdir_separator" &&
444952f9793fSmrg	 test -n "$hardcode_libdirs"; then
445052f9793fSmrg	libdir="$hardcode_libdirs"
445152f9793fSmrg	eval rpath=\" $hardcode_libdir_flag_spec\"
445252f9793fSmrg      fi
445352f9793fSmrg      compile_rpath="$rpath"
445452f9793fSmrg
445552f9793fSmrg      rpath=
445652f9793fSmrg      hardcode_libdirs=
445752f9793fSmrg      for libdir in $finalize_rpath; do
445852f9793fSmrg	if test -n "$hardcode_libdir_flag_spec"; then
445952f9793fSmrg	  if test -n "$hardcode_libdir_separator"; then
446052f9793fSmrg	    if test -z "$hardcode_libdirs"; then
446152f9793fSmrg	      hardcode_libdirs="$libdir"
446252f9793fSmrg	    else
446352f9793fSmrg	      # Just accumulate the unique libdirs.
446452f9793fSmrg	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
446552f9793fSmrg	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
446652f9793fSmrg		;;
446752f9793fSmrg	      *)
446852f9793fSmrg		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
446952f9793fSmrg		;;
447052f9793fSmrg	      esac
447152f9793fSmrg	    fi
447252f9793fSmrg	  else
447352f9793fSmrg	    eval flag=\"$hardcode_libdir_flag_spec\"
447452f9793fSmrg	    rpath="$rpath $flag"
447552f9793fSmrg	  fi
447652f9793fSmrg	elif test -n "$runpath_var"; then
447752f9793fSmrg	  case "$finalize_perm_rpath " in
447852f9793fSmrg	  *" $libdir "*) ;;
447952f9793fSmrg	  *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
448052f9793fSmrg	  esac
448152f9793fSmrg	fi
448252f9793fSmrg      done
448352f9793fSmrg      # Substitute the hardcoded libdirs into the rpath.
448452f9793fSmrg      if test -n "$hardcode_libdir_separator" &&
448552f9793fSmrg	 test -n "$hardcode_libdirs"; then
448652f9793fSmrg	libdir="$hardcode_libdirs"
448752f9793fSmrg	eval rpath=\" $hardcode_libdir_flag_spec\"
448852f9793fSmrg      fi
448952f9793fSmrg      finalize_rpath="$rpath"
449052f9793fSmrg
449152f9793fSmrg      if test -n "$libobjs" && test "$build_old_libs" = yes; then
449252f9793fSmrg	# Transform all the library objects into standard objects.
449352f9793fSmrg	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
449452f9793fSmrg	finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
449552f9793fSmrg      fi
449652f9793fSmrg
449752f9793fSmrg      dlsyms=
449852f9793fSmrg      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
449952f9793fSmrg	if test -n "$NM" && test -n "$global_symbol_pipe"; then
450052f9793fSmrg	  dlsyms="${outputname}S.c"
450152f9793fSmrg	else
450252f9793fSmrg	  $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
450352f9793fSmrg	fi
450452f9793fSmrg      fi
450552f9793fSmrg
450652f9793fSmrg      if test -n "$dlsyms"; then
450752f9793fSmrg	case $dlsyms in
450852f9793fSmrg	"") ;;
450952f9793fSmrg	*.c)
451052f9793fSmrg	  # Discover the nlist of each of the dlfiles.
451152f9793fSmrg	  nlist="$output_objdir/${outputname}.nm"
451252f9793fSmrg
451352f9793fSmrg	  $show "$rm $nlist ${nlist}S ${nlist}T"
451452f9793fSmrg	  $run $rm "$nlist" "${nlist}S" "${nlist}T"
451552f9793fSmrg
451652f9793fSmrg	  # Parse the name list into a source file.
451752f9793fSmrg	  $show "creating $output_objdir/$dlsyms"
451852f9793fSmrg
451952f9793fSmrg	  test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
452052f9793fSmrg/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
452152f9793fSmrg/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
452252f9793fSmrg
452352f9793fSmrg#ifdef __cplusplus
452452f9793fSmrgextern \"C\" {
452552f9793fSmrg#endif
452652f9793fSmrg
452752f9793fSmrg/* Prevent the only kind of declaration conflicts we can make. */
452852f9793fSmrg#define lt_preloaded_symbols some_other_symbol
452952f9793fSmrg
453052f9793fSmrg/* External symbol declarations for the compiler. */\
453152f9793fSmrg"
453252f9793fSmrg
453352f9793fSmrg	  if test "$dlself" = yes; then
453452f9793fSmrg	    $show "generating symbol list for \`$output'"
453552f9793fSmrg
453652f9793fSmrg	    test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
453752f9793fSmrg
453852f9793fSmrg	    # Add our own program objects to the symbol list.
453952f9793fSmrg	    progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
454052f9793fSmrg	    for arg in $progfiles; do
454152f9793fSmrg	      $show "extracting global C symbols from \`$arg'"
454252f9793fSmrg	      $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
454352f9793fSmrg	    done
454452f9793fSmrg
454552f9793fSmrg	    if test -n "$exclude_expsyms"; then
454652f9793fSmrg	      $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
454752f9793fSmrg	      $run eval '$mv "$nlist"T "$nlist"'
454852f9793fSmrg	    fi
454952f9793fSmrg
455052f9793fSmrg	    if test -n "$export_symbols_regex"; then
455152f9793fSmrg	      $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
455252f9793fSmrg	      $run eval '$mv "$nlist"T "$nlist"'
455352f9793fSmrg	    fi
455452f9793fSmrg
455552f9793fSmrg	    # Prepare the list of exported symbols
455652f9793fSmrg	    if test -z "$export_symbols"; then
455752f9793fSmrg	      export_symbols="$output_objdir/$outputname.exp"
455852f9793fSmrg	      $run $rm $export_symbols
455952f9793fSmrg	      $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
456052f9793fSmrg              case $host in
456152f9793fSmrg              *cygwin* | *mingw* )
456252f9793fSmrg	        $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
456352f9793fSmrg		$run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
456452f9793fSmrg                ;;
456552f9793fSmrg              esac
456652f9793fSmrg	    else
456752f9793fSmrg	      $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
456852f9793fSmrg	      $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
456952f9793fSmrg	      $run eval 'mv "$nlist"T "$nlist"'
457052f9793fSmrg              case $host in
457152f9793fSmrg              *cygwin* | *mingw* )
457252f9793fSmrg	        $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
457352f9793fSmrg		$run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
457452f9793fSmrg                ;;
457552f9793fSmrg              esac
457652f9793fSmrg	    fi
457752f9793fSmrg	  fi
457852f9793fSmrg
457952f9793fSmrg	  for arg in $dlprefiles; do
458052f9793fSmrg	    $show "extracting global C symbols from \`$arg'"
458152f9793fSmrg	    name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
458252f9793fSmrg	    $run eval '$echo ": $name " >> "$nlist"'
458352f9793fSmrg	    $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
458452f9793fSmrg	  done
458552f9793fSmrg
458652f9793fSmrg	  if test -z "$run"; then
458752f9793fSmrg	    # Make sure we have at least an empty file.
458852f9793fSmrg	    test -f "$nlist" || : > "$nlist"
458952f9793fSmrg
459052f9793fSmrg	    if test -n "$exclude_expsyms"; then
459152f9793fSmrg	      $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
459252f9793fSmrg	      $mv "$nlist"T "$nlist"
459352f9793fSmrg	    fi
459452f9793fSmrg
459552f9793fSmrg	    # Try sorting and uniquifying the output.
459652f9793fSmrg	    if grep -v "^: " < "$nlist" |
459752f9793fSmrg		if sort -k 3 </dev/null >/dev/null 2>&1; then
459852f9793fSmrg		  sort -k 3
459952f9793fSmrg		else
460052f9793fSmrg		  sort +2
460152f9793fSmrg		fi |
460252f9793fSmrg		uniq > "$nlist"S; then
460352f9793fSmrg	      :
460452f9793fSmrg	    else
460552f9793fSmrg	      grep -v "^: " < "$nlist" > "$nlist"S
460652f9793fSmrg	    fi
460752f9793fSmrg
460852f9793fSmrg	    if test -f "$nlist"S; then
460952f9793fSmrg	      eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
461052f9793fSmrg	    else
461152f9793fSmrg	      $echo '/* NONE */' >> "$output_objdir/$dlsyms"
461252f9793fSmrg	    fi
461352f9793fSmrg
461452f9793fSmrg	    $echo >> "$output_objdir/$dlsyms" "\
461552f9793fSmrg
461652f9793fSmrg#undef lt_preloaded_symbols
461752f9793fSmrg
461852f9793fSmrg#if defined (__STDC__) && __STDC__
461952f9793fSmrg# define lt_ptr void *
462052f9793fSmrg#else
462152f9793fSmrg# define lt_ptr char *
462252f9793fSmrg# define const
462352f9793fSmrg#endif
462452f9793fSmrg
462552f9793fSmrg/* The mapping between symbol names and symbols. */
462652f9793fSmrg"
462752f9793fSmrg
462852f9793fSmrg	    case $host in
462952f9793fSmrg	    *cygwin* | *mingw* )
463052f9793fSmrg	  $echo >> "$output_objdir/$dlsyms" "\
463152f9793fSmrg/* DATA imports from DLLs on WIN32 can't be const, because
463252f9793fSmrg   runtime relocations are performed -- see ld's documentation
463352f9793fSmrg   on pseudo-relocs */
463452f9793fSmrgstruct {
463552f9793fSmrg"
463652f9793fSmrg	      ;;
463752f9793fSmrg	    * )
463852f9793fSmrg	  $echo >> "$output_objdir/$dlsyms" "\
463952f9793fSmrgconst struct {
464052f9793fSmrg"
464152f9793fSmrg	      ;;
464252f9793fSmrg	    esac
464352f9793fSmrg
464452f9793fSmrg
464552f9793fSmrg	  $echo >> "$output_objdir/$dlsyms" "\
464652f9793fSmrg  const char *name;
464752f9793fSmrg  lt_ptr address;
464852f9793fSmrg}
464952f9793fSmrglt_preloaded_symbols[] =
465052f9793fSmrg{\
465152f9793fSmrg"
465252f9793fSmrg
465352f9793fSmrg	    eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
465452f9793fSmrg
465552f9793fSmrg	    $echo >> "$output_objdir/$dlsyms" "\
465652f9793fSmrg  {0, (lt_ptr) 0}
465752f9793fSmrg};
465852f9793fSmrg
465952f9793fSmrg/* This works around a problem in FreeBSD linker */
466052f9793fSmrg#ifdef FREEBSD_WORKAROUND
466152f9793fSmrgstatic const void *lt_preloaded_setup() {
466252f9793fSmrg  return lt_preloaded_symbols;
466352f9793fSmrg}
466452f9793fSmrg#endif
466552f9793fSmrg
466652f9793fSmrg#ifdef __cplusplus
466752f9793fSmrg}
466852f9793fSmrg#endif\
466952f9793fSmrg"
467052f9793fSmrg	  fi
467152f9793fSmrg
467252f9793fSmrg	  pic_flag_for_symtable=
467352f9793fSmrg	  case $host in
467452f9793fSmrg	  # compiling the symbol table file with pic_flag works around
467552f9793fSmrg	  # a FreeBSD bug that causes programs to crash when -lm is
467652f9793fSmrg	  # linked before any other PIC object.  But we must not use
467752f9793fSmrg	  # pic_flag when linking with -static.  The problem exists in
467852f9793fSmrg	  # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
467952f9793fSmrg	  *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
468052f9793fSmrg	    case "$compile_command " in
468152f9793fSmrg	    *" -static "*) ;;
468252f9793fSmrg	    *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
468352f9793fSmrg	    esac;;
468452f9793fSmrg	  *-*-hpux*)
468552f9793fSmrg	    case "$compile_command " in
468652f9793fSmrg	    *" -static "*) ;;
468752f9793fSmrg	    *) pic_flag_for_symtable=" $pic_flag";;
468852f9793fSmrg	    esac
468952f9793fSmrg	  esac
469052f9793fSmrg
469152f9793fSmrg	  # Now compile the dynamic symbol file.
469252f9793fSmrg	  $show "(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
469352f9793fSmrg	  $run eval '(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
469452f9793fSmrg
469552f9793fSmrg	  # Clean up the generated files.
469652f9793fSmrg	  $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
469752f9793fSmrg	  $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
469852f9793fSmrg
469952f9793fSmrg	  # Transform the symbol file into the correct name.
470052f9793fSmrg          case $host in
470152f9793fSmrg          *cygwin* | *mingw* )
470252f9793fSmrg            if test -f "$output_objdir/${outputname}.def" ; then
470352f9793fSmrg              compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
470452f9793fSmrg              finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
470552f9793fSmrg            else
470652f9793fSmrg              compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
470752f9793fSmrg              finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
470852f9793fSmrg             fi
470952f9793fSmrg            ;;
471052f9793fSmrg          * )
471152f9793fSmrg            compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
471252f9793fSmrg            finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
471352f9793fSmrg            ;;
471452f9793fSmrg          esac
471552f9793fSmrg	  ;;
471652f9793fSmrg	*)
471752f9793fSmrg	  $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
471852f9793fSmrg	  exit $EXIT_FAILURE
471952f9793fSmrg	  ;;
472052f9793fSmrg	esac
472152f9793fSmrg      else
472252f9793fSmrg	# We keep going just in case the user didn't refer to
472352f9793fSmrg	# lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
472452f9793fSmrg	# really was required.
472552f9793fSmrg
472652f9793fSmrg	# Nullify the symbol file.
472752f9793fSmrg	compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
472852f9793fSmrg	finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
472952f9793fSmrg      fi
473052f9793fSmrg
473152f9793fSmrg      if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
473252f9793fSmrg	# Replace the output file specification.
473352f9793fSmrg	compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
473452f9793fSmrg	link_command="$compile_command$compile_rpath"
473552f9793fSmrg
473652f9793fSmrg	# We have no uninstalled library dependencies, so finalize right now.
473752f9793fSmrg	$show "$link_command"
473852f9793fSmrg	$run eval "$link_command"
473952f9793fSmrg	exit_status=$?
474052f9793fSmrg
474152f9793fSmrg	# Delete the generated files.
474252f9793fSmrg	if test -n "$dlsyms"; then
474352f9793fSmrg	  $show "$rm $output_objdir/${outputname}S.${objext}"
474452f9793fSmrg	  $run $rm "$output_objdir/${outputname}S.${objext}"
474552f9793fSmrg	fi
474652f9793fSmrg
474752f9793fSmrg	exit $exit_status
474852f9793fSmrg      fi
474952f9793fSmrg
475052f9793fSmrg      if test -n "$shlibpath_var"; then
475152f9793fSmrg	# We should set the shlibpath_var
475252f9793fSmrg	rpath=
475352f9793fSmrg	for dir in $temp_rpath; do
475452f9793fSmrg	  case $dir in
475552f9793fSmrg	  [\\/]* | [A-Za-z]:[\\/]*)
475652f9793fSmrg	    # Absolute path.
475752f9793fSmrg	    rpath="$rpath$dir:"
475852f9793fSmrg	    ;;
475952f9793fSmrg	  *)
476052f9793fSmrg	    # Relative path: add a thisdir entry.
476152f9793fSmrg	    rpath="$rpath\$thisdir/$dir:"
476252f9793fSmrg	    ;;
476352f9793fSmrg	  esac
476452f9793fSmrg	done
476552f9793fSmrg	temp_rpath="$rpath"
476652f9793fSmrg      fi
476752f9793fSmrg
476852f9793fSmrg      if test -n "$compile_shlibpath$finalize_shlibpath"; then
476952f9793fSmrg	compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
477052f9793fSmrg      fi
477152f9793fSmrg      if test -n "$finalize_shlibpath"; then
477252f9793fSmrg	finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
477352f9793fSmrg      fi
477452f9793fSmrg
477552f9793fSmrg      compile_var=
477652f9793fSmrg      finalize_var=
477752f9793fSmrg      if test -n "$runpath_var"; then
477852f9793fSmrg	if test -n "$perm_rpath"; then
477952f9793fSmrg	  # We should set the runpath_var.
478052f9793fSmrg	  rpath=
478152f9793fSmrg	  for dir in $perm_rpath; do
478252f9793fSmrg	    rpath="$rpath$dir:"
478352f9793fSmrg	  done
478452f9793fSmrg	  compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
478552f9793fSmrg	fi
478652f9793fSmrg	if test -n "$finalize_perm_rpath"; then
478752f9793fSmrg	  # We should set the runpath_var.
478852f9793fSmrg	  rpath=
478952f9793fSmrg	  for dir in $finalize_perm_rpath; do
479052f9793fSmrg	    rpath="$rpath$dir:"
479152f9793fSmrg	  done
479252f9793fSmrg	  finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
479352f9793fSmrg	fi
479452f9793fSmrg      fi
479552f9793fSmrg
479652f9793fSmrg      if test "$no_install" = yes; then
479752f9793fSmrg	# We don't need to create a wrapper script.
479852f9793fSmrg	link_command="$compile_var$compile_command$compile_rpath"
479952f9793fSmrg	# Replace the output file specification.
480052f9793fSmrg	link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
480152f9793fSmrg	# Delete the old output file.
480252f9793fSmrg	$run $rm $output
480352f9793fSmrg	# Link the executable and exit
480452f9793fSmrg	$show "$link_command"
480552f9793fSmrg	$run eval "$link_command" || exit $?
480652f9793fSmrg	exit $EXIT_SUCCESS
480752f9793fSmrg      fi
480852f9793fSmrg
480952f9793fSmrg      if test "$hardcode_action" = relink; then
481052f9793fSmrg	# Fast installation is not supported
481152f9793fSmrg	link_command="$compile_var$compile_command$compile_rpath"
481252f9793fSmrg	relink_command="$finalize_var$finalize_command$finalize_rpath"
481352f9793fSmrg
481452f9793fSmrg	$echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
481552f9793fSmrg	$echo "$modename: \`$output' will be relinked during installation" 1>&2
481652f9793fSmrg      else
481752f9793fSmrg	if test "$fast_install" != no; then
481852f9793fSmrg	  link_command="$finalize_var$compile_command$finalize_rpath"
481952f9793fSmrg	  if test "$fast_install" = yes; then
482052f9793fSmrg	    relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
482152f9793fSmrg	  else
482252f9793fSmrg	    # fast_install is set to needless
482352f9793fSmrg	    relink_command=
482452f9793fSmrg	  fi
482552f9793fSmrg	else
482652f9793fSmrg	  link_command="$compile_var$compile_command$compile_rpath"
482752f9793fSmrg	  relink_command="$finalize_var$finalize_command$finalize_rpath"
482852f9793fSmrg	fi
482952f9793fSmrg      fi
483052f9793fSmrg
483152f9793fSmrg      # Replace the output file specification.
483252f9793fSmrg      link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
483352f9793fSmrg
483452f9793fSmrg      # Delete the old output files.
483552f9793fSmrg      $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
483652f9793fSmrg
483752f9793fSmrg      $show "$link_command"
483852f9793fSmrg      $run eval "$link_command" || exit $?
483952f9793fSmrg
484052f9793fSmrg      # Now create the wrapper script.
484152f9793fSmrg      $show "creating $output"
484252f9793fSmrg
484352f9793fSmrg      # Quote the relink command for shipping.
484452f9793fSmrg      if test -n "$relink_command"; then
484552f9793fSmrg	# Preserve any variables that may affect compiler behavior
484652f9793fSmrg	for var in $variables_saved_for_relink; do
484752f9793fSmrg	  if eval test -z \"\${$var+set}\"; then
484852f9793fSmrg	    relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
484952f9793fSmrg	  elif eval var_value=\$$var; test -z "$var_value"; then
485052f9793fSmrg	    relink_command="$var=; export $var; $relink_command"
485152f9793fSmrg	  else
485252f9793fSmrg	    var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
485352f9793fSmrg	    relink_command="$var=\"$var_value\"; export $var; $relink_command"
485452f9793fSmrg	  fi
485552f9793fSmrg	done
485652f9793fSmrg	relink_command="(cd `pwd`; $relink_command)"
485752f9793fSmrg	relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
485852f9793fSmrg      fi
485952f9793fSmrg
486052f9793fSmrg      # Quote $echo for shipping.
486152f9793fSmrg      if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
486252f9793fSmrg	case $progpath in
486352f9793fSmrg	[\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
486452f9793fSmrg	*) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
486552f9793fSmrg	esac
486652f9793fSmrg	qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
486752f9793fSmrg      else
486852f9793fSmrg	qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
486952f9793fSmrg      fi
487052f9793fSmrg
487152f9793fSmrg      # Only actually do things if our run command is non-null.
487252f9793fSmrg      if test -z "$run"; then
487352f9793fSmrg	# win32 will think the script is a binary if it has
487452f9793fSmrg	# a .exe suffix, so we strip it off here.
487552f9793fSmrg	case $output in
487652f9793fSmrg	  *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
487752f9793fSmrg	esac
487852f9793fSmrg	# test for cygwin because mv fails w/o .exe extensions
487952f9793fSmrg	case $host in
488052f9793fSmrg	  *cygwin*)
488152f9793fSmrg	    exeext=.exe
488252f9793fSmrg	    outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
488352f9793fSmrg	  *) exeext= ;;
488452f9793fSmrg	esac
488552f9793fSmrg	case $host in
488652f9793fSmrg	  *cygwin* | *mingw* )
488752f9793fSmrg            output_name=`basename $output`
488852f9793fSmrg            output_path=`dirname $output`
488952f9793fSmrg            cwrappersource="$output_path/$objdir/lt-$output_name.c"
489052f9793fSmrg            cwrapper="$output_path/$output_name.exe"
489152f9793fSmrg            $rm $cwrappersource $cwrapper
489252f9793fSmrg            trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
489352f9793fSmrg
489452f9793fSmrg	    cat > $cwrappersource <<EOF
489552f9793fSmrg
489652f9793fSmrg/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
489752f9793fSmrg   Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
489852f9793fSmrg
489952f9793fSmrg   The $output program cannot be directly executed until all the libtool
490052f9793fSmrg   libraries that it depends on are installed.
490152f9793fSmrg
490252f9793fSmrg   This wrapper executable should never be moved out of the build directory.
490352f9793fSmrg   If it is, it will not operate correctly.
490452f9793fSmrg
490552f9793fSmrg   Currently, it simply execs the wrapper *script* "/bin/sh $output",
490652f9793fSmrg   but could eventually absorb all of the scripts functionality and
490752f9793fSmrg   exec $objdir/$outputname directly.
490852f9793fSmrg*/
490952f9793fSmrgEOF
491052f9793fSmrg	    cat >> $cwrappersource<<"EOF"
491152f9793fSmrg#include <stdio.h>
491252f9793fSmrg#include <stdlib.h>
491352f9793fSmrg#include <unistd.h>
491452f9793fSmrg#include <malloc.h>
491552f9793fSmrg#include <stdarg.h>
491652f9793fSmrg#include <assert.h>
491752f9793fSmrg#include <string.h>
491852f9793fSmrg#include <ctype.h>
491952f9793fSmrg#include <sys/stat.h>
492052f9793fSmrg
492152f9793fSmrg#if defined(PATH_MAX)
492252f9793fSmrg# define LT_PATHMAX PATH_MAX
492352f9793fSmrg#elif defined(MAXPATHLEN)
492452f9793fSmrg# define LT_PATHMAX MAXPATHLEN
492552f9793fSmrg#else
492652f9793fSmrg# define LT_PATHMAX 1024
492752f9793fSmrg#endif
492852f9793fSmrg
492952f9793fSmrg#ifndef DIR_SEPARATOR
493052f9793fSmrg# define DIR_SEPARATOR '/'
493152f9793fSmrg# define PATH_SEPARATOR ':'
493252f9793fSmrg#endif
493352f9793fSmrg
493452f9793fSmrg#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
493552f9793fSmrg  defined (__OS2__)
493652f9793fSmrg# define HAVE_DOS_BASED_FILE_SYSTEM
493752f9793fSmrg# ifndef DIR_SEPARATOR_2
493852f9793fSmrg#  define DIR_SEPARATOR_2 '\\'
493952f9793fSmrg# endif
494052f9793fSmrg# ifndef PATH_SEPARATOR_2
494152f9793fSmrg#  define PATH_SEPARATOR_2 ';'
494252f9793fSmrg# endif
494352f9793fSmrg#endif
494452f9793fSmrg
494552f9793fSmrg#ifndef DIR_SEPARATOR_2
494652f9793fSmrg# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
494752f9793fSmrg#else /* DIR_SEPARATOR_2 */
494852f9793fSmrg# define IS_DIR_SEPARATOR(ch) \
494952f9793fSmrg        (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
495052f9793fSmrg#endif /* DIR_SEPARATOR_2 */
495152f9793fSmrg
495252f9793fSmrg#ifndef PATH_SEPARATOR_2
495352f9793fSmrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
495452f9793fSmrg#else /* PATH_SEPARATOR_2 */
495552f9793fSmrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
495652f9793fSmrg#endif /* PATH_SEPARATOR_2 */
495752f9793fSmrg
495852f9793fSmrg#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
495952f9793fSmrg#define XFREE(stale) do { \
496052f9793fSmrg  if (stale) { free ((void *) stale); stale = 0; } \
496152f9793fSmrg} while (0)
496252f9793fSmrg
496352f9793fSmrg/* -DDEBUG is fairly common in CFLAGS.  */
496452f9793fSmrg#undef DEBUG
496552f9793fSmrg#if defined DEBUGWRAPPER
496652f9793fSmrg# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
496752f9793fSmrg#else
496852f9793fSmrg# define DEBUG(format, ...)
496952f9793fSmrg#endif
497052f9793fSmrg
497152f9793fSmrgconst char *program_name = NULL;
497252f9793fSmrg
497352f9793fSmrgvoid * xmalloc (size_t num);
497452f9793fSmrgchar * xstrdup (const char *string);
497552f9793fSmrgconst char * base_name (const char *name);
497652f9793fSmrgchar * find_executable(const char *wrapper);
497752f9793fSmrgint    check_executable(const char *path);
497852f9793fSmrgchar * strendzap(char *str, const char *pat);
497952f9793fSmrgvoid lt_fatal (const char *message, ...);
498052f9793fSmrg
498152f9793fSmrgint
498252f9793fSmrgmain (int argc, char *argv[])
498352f9793fSmrg{
498452f9793fSmrg  char **newargz;
498552f9793fSmrg  int i;
498652f9793fSmrg
498752f9793fSmrg  program_name = (char *) xstrdup (base_name (argv[0]));
498852f9793fSmrg  DEBUG("(main) argv[0]      : %s\n",argv[0]);
498952f9793fSmrg  DEBUG("(main) program_name : %s\n",program_name);
499052f9793fSmrg  newargz = XMALLOC(char *, argc+2);
499152f9793fSmrgEOF
499252f9793fSmrg
499352f9793fSmrg            cat >> $cwrappersource <<EOF
499452f9793fSmrg  newargz[0] = (char *) xstrdup("$SHELL");
499552f9793fSmrgEOF
499652f9793fSmrg
499752f9793fSmrg            cat >> $cwrappersource <<"EOF"
499852f9793fSmrg  newargz[1] = find_executable(argv[0]);
499952f9793fSmrg  if (newargz[1] == NULL)
500052f9793fSmrg    lt_fatal("Couldn't find %s", argv[0]);
500152f9793fSmrg  DEBUG("(main) found exe at : %s\n",newargz[1]);
500252f9793fSmrg  /* we know the script has the same name, without the .exe */
500352f9793fSmrg  /* so make sure newargz[1] doesn't end in .exe */
500452f9793fSmrg  strendzap(newargz[1],".exe");
500552f9793fSmrg  for (i = 1; i < argc; i++)
500652f9793fSmrg    newargz[i+1] = xstrdup(argv[i]);
500752f9793fSmrg  newargz[argc+1] = NULL;
500852f9793fSmrg
500952f9793fSmrg  for (i=0; i<argc+1; i++)
501052f9793fSmrg  {
501152f9793fSmrg    DEBUG("(main) newargz[%d]   : %s\n",i,newargz[i]);
501252f9793fSmrg    ;
501352f9793fSmrg  }
501452f9793fSmrg
501552f9793fSmrgEOF
501652f9793fSmrg
501752f9793fSmrg            case $host_os in
501852f9793fSmrg              mingw*)
501952f9793fSmrg                cat >> $cwrappersource <<EOF
502052f9793fSmrg  execv("$SHELL",(char const **)newargz);
502152f9793fSmrgEOF
502252f9793fSmrg              ;;
502352f9793fSmrg              *)
502452f9793fSmrg                cat >> $cwrappersource <<EOF
502552f9793fSmrg  execv("$SHELL",newargz);
502652f9793fSmrgEOF
502752f9793fSmrg              ;;
502852f9793fSmrg            esac
502952f9793fSmrg
503052f9793fSmrg            cat >> $cwrappersource <<"EOF"
503152f9793fSmrg  return 127;
503252f9793fSmrg}
503352f9793fSmrg
503452f9793fSmrgvoid *
503552f9793fSmrgxmalloc (size_t num)
503652f9793fSmrg{
503752f9793fSmrg  void * p = (void *) malloc (num);
503852f9793fSmrg  if (!p)
503952f9793fSmrg    lt_fatal ("Memory exhausted");
504052f9793fSmrg
504152f9793fSmrg  return p;
504252f9793fSmrg}
504352f9793fSmrg
504452f9793fSmrgchar *
504552f9793fSmrgxstrdup (const char *string)
504652f9793fSmrg{
504752f9793fSmrg  return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
504852f9793fSmrg;
504952f9793fSmrg}
505052f9793fSmrg
505152f9793fSmrgconst char *
505252f9793fSmrgbase_name (const char *name)
505352f9793fSmrg{
505452f9793fSmrg  const char *base;
505552f9793fSmrg
505652f9793fSmrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
505752f9793fSmrg  /* Skip over the disk name in MSDOS pathnames. */
505852f9793fSmrg  if (isalpha ((unsigned char)name[0]) && name[1] == ':')
505952f9793fSmrg    name += 2;
506052f9793fSmrg#endif
506152f9793fSmrg
506252f9793fSmrg  for (base = name; *name; name++)
506352f9793fSmrg    if (IS_DIR_SEPARATOR (*name))
506452f9793fSmrg      base = name + 1;
506552f9793fSmrg  return base;
506652f9793fSmrg}
506752f9793fSmrg
506852f9793fSmrgint
506952f9793fSmrgcheck_executable(const char * path)
507052f9793fSmrg{
507152f9793fSmrg  struct stat st;
507252f9793fSmrg
507352f9793fSmrg  DEBUG("(check_executable)  : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
507452f9793fSmrg  if ((!path) || (!*path))
507552f9793fSmrg    return 0;
507652f9793fSmrg
507752f9793fSmrg  if ((stat (path, &st) >= 0) &&
507852f9793fSmrg      (
507952f9793fSmrg        /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
508052f9793fSmrg#if defined (S_IXOTH)
508152f9793fSmrg       ((st.st_mode & S_IXOTH) == S_IXOTH) ||
508252f9793fSmrg#endif
508352f9793fSmrg#if defined (S_IXGRP)
508452f9793fSmrg       ((st.st_mode & S_IXGRP) == S_IXGRP) ||
508552f9793fSmrg#endif
508652f9793fSmrg       ((st.st_mode & S_IXUSR) == S_IXUSR))
508752f9793fSmrg      )
508852f9793fSmrg    return 1;
508952f9793fSmrg  else
509052f9793fSmrg    return 0;
509152f9793fSmrg}
509252f9793fSmrg
509352f9793fSmrg/* Searches for the full path of the wrapper.  Returns
509452f9793fSmrg   newly allocated full path name if found, NULL otherwise */
509552f9793fSmrgchar *
509652f9793fSmrgfind_executable (const char* wrapper)
509752f9793fSmrg{
509852f9793fSmrg  int has_slash = 0;
509952f9793fSmrg  const char* p;
510052f9793fSmrg  const char* p_next;
510152f9793fSmrg  /* static buffer for getcwd */
510252f9793fSmrg  char tmp[LT_PATHMAX + 1];
510352f9793fSmrg  int tmp_len;
510452f9793fSmrg  char* concat_name;
510552f9793fSmrg
510652f9793fSmrg  DEBUG("(find_executable)  : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
510752f9793fSmrg
510852f9793fSmrg  if ((wrapper == NULL) || (*wrapper == '\0'))
510952f9793fSmrg    return NULL;
511052f9793fSmrg
511152f9793fSmrg  /* Absolute path? */
511252f9793fSmrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
511352f9793fSmrg  if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
511452f9793fSmrg  {
511552f9793fSmrg    concat_name = xstrdup (wrapper);
511652f9793fSmrg    if (check_executable(concat_name))
511752f9793fSmrg      return concat_name;
511852f9793fSmrg    XFREE(concat_name);
511952f9793fSmrg  }
512052f9793fSmrg  else
512152f9793fSmrg  {
512252f9793fSmrg#endif
512352f9793fSmrg    if (IS_DIR_SEPARATOR (wrapper[0]))
512452f9793fSmrg    {
512552f9793fSmrg      concat_name = xstrdup (wrapper);
512652f9793fSmrg      if (check_executable(concat_name))
512752f9793fSmrg        return concat_name;
512852f9793fSmrg      XFREE(concat_name);
512952f9793fSmrg    }
513052f9793fSmrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
513152f9793fSmrg  }
513252f9793fSmrg#endif
513352f9793fSmrg
513452f9793fSmrg  for (p = wrapper; *p; p++)
513552f9793fSmrg    if (*p == '/')
513652f9793fSmrg    {
513752f9793fSmrg      has_slash = 1;
513852f9793fSmrg      break;
513952f9793fSmrg    }
514052f9793fSmrg  if (!has_slash)
514152f9793fSmrg  {
514252f9793fSmrg    /* no slashes; search PATH */
514352f9793fSmrg    const char* path = getenv ("PATH");
514452f9793fSmrg    if (path != NULL)
514552f9793fSmrg    {
514652f9793fSmrg      for (p = path; *p; p = p_next)
514752f9793fSmrg      {
514852f9793fSmrg        const char* q;
514952f9793fSmrg        size_t p_len;
515052f9793fSmrg        for (q = p; *q; q++)
515152f9793fSmrg          if (IS_PATH_SEPARATOR(*q))
515252f9793fSmrg            break;
515352f9793fSmrg        p_len = q - p;
515452f9793fSmrg        p_next = (*q == '\0' ? q : q + 1);
515552f9793fSmrg        if (p_len == 0)
515652f9793fSmrg        {
515752f9793fSmrg          /* empty path: current directory */
515852f9793fSmrg          if (getcwd (tmp, LT_PATHMAX) == NULL)
515952f9793fSmrg            lt_fatal ("getcwd failed");
516052f9793fSmrg          tmp_len = strlen(tmp);
516152f9793fSmrg          concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
516252f9793fSmrg          memcpy (concat_name, tmp, tmp_len);
516352f9793fSmrg          concat_name[tmp_len] = '/';
516452f9793fSmrg          strcpy (concat_name + tmp_len + 1, wrapper);
516552f9793fSmrg        }
516652f9793fSmrg        else
516752f9793fSmrg        {
516852f9793fSmrg          concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
516952f9793fSmrg          memcpy (concat_name, p, p_len);
517052f9793fSmrg          concat_name[p_len] = '/';
517152f9793fSmrg          strcpy (concat_name + p_len + 1, wrapper);
517252f9793fSmrg        }
517352f9793fSmrg        if (check_executable(concat_name))
517452f9793fSmrg          return concat_name;
517552f9793fSmrg        XFREE(concat_name);
517652f9793fSmrg      }
517752f9793fSmrg    }
517852f9793fSmrg    /* not found in PATH; assume curdir */
517952f9793fSmrg  }
518052f9793fSmrg  /* Relative path | not found in path: prepend cwd */
518152f9793fSmrg  if (getcwd (tmp, LT_PATHMAX) == NULL)
518252f9793fSmrg    lt_fatal ("getcwd failed");
518352f9793fSmrg  tmp_len = strlen(tmp);
518452f9793fSmrg  concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
518552f9793fSmrg  memcpy (concat_name, tmp, tmp_len);
518652f9793fSmrg  concat_name[tmp_len] = '/';
518752f9793fSmrg  strcpy (concat_name + tmp_len + 1, wrapper);
518852f9793fSmrg
518952f9793fSmrg  if (check_executable(concat_name))
519052f9793fSmrg    return concat_name;
519152f9793fSmrg  XFREE(concat_name);
519252f9793fSmrg  return NULL;
519352f9793fSmrg}
519452f9793fSmrg
519552f9793fSmrgchar *
519652f9793fSmrgstrendzap(char *str, const char *pat)
519752f9793fSmrg{
519852f9793fSmrg  size_t len, patlen;
519952f9793fSmrg
520052f9793fSmrg  assert(str != NULL);
520152f9793fSmrg  assert(pat != NULL);
520252f9793fSmrg
520352f9793fSmrg  len = strlen(str);
520452f9793fSmrg  patlen = strlen(pat);
520552f9793fSmrg
520652f9793fSmrg  if (patlen <= len)
520752f9793fSmrg  {
520852f9793fSmrg    str += len - patlen;
520952f9793fSmrg    if (strcmp(str, pat) == 0)
521052f9793fSmrg      *str = '\0';
521152f9793fSmrg  }
521252f9793fSmrg  return str;
521352f9793fSmrg}
521452f9793fSmrg
521552f9793fSmrgstatic void
521652f9793fSmrglt_error_core (int exit_status, const char * mode,
521752f9793fSmrg          const char * message, va_list ap)
521852f9793fSmrg{
521952f9793fSmrg  fprintf (stderr, "%s: %s: ", program_name, mode);
522052f9793fSmrg  vfprintf (stderr, message, ap);
522152f9793fSmrg  fprintf (stderr, ".\n");
522252f9793fSmrg
522352f9793fSmrg  if (exit_status >= 0)
522452f9793fSmrg    exit (exit_status);
522552f9793fSmrg}
522652f9793fSmrg
522752f9793fSmrgvoid
522852f9793fSmrglt_fatal (const char *message, ...)
522952f9793fSmrg{
523052f9793fSmrg  va_list ap;
523152f9793fSmrg  va_start (ap, message);
523252f9793fSmrg  lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
523352f9793fSmrg  va_end (ap);
523452f9793fSmrg}
523552f9793fSmrgEOF
523652f9793fSmrg          # we should really use a build-platform specific compiler
523752f9793fSmrg          # here, but OTOH, the wrappers (shell script and this C one)
523852f9793fSmrg          # are only useful if you want to execute the "real" binary.
523952f9793fSmrg          # Since the "real" binary is built for $host, then this
524052f9793fSmrg          # wrapper might as well be built for $host, too.
524152f9793fSmrg          $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
524252f9793fSmrg          ;;
524352f9793fSmrg        esac
524452f9793fSmrg        $rm $output
524552f9793fSmrg        trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
524652f9793fSmrg
524752f9793fSmrg	$echo > $output "\
524852f9793fSmrg#! $SHELL
524952f9793fSmrg
525052f9793fSmrg# $output - temporary wrapper script for $objdir/$outputname
525152f9793fSmrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
525252f9793fSmrg#
525352f9793fSmrg# The $output program cannot be directly executed until all the libtool
525452f9793fSmrg# libraries that it depends on are installed.
525552f9793fSmrg#
525652f9793fSmrg# This wrapper script should never be moved out of the build directory.
525752f9793fSmrg# If it is, it will not operate correctly.
525852f9793fSmrg
525952f9793fSmrg# Sed substitution that helps us do robust quoting.  It backslashifies
526052f9793fSmrg# metacharacters that are still active within double-quoted strings.
526152f9793fSmrgXsed='${SED} -e 1s/^X//'
526252f9793fSmrgsed_quote_subst='$sed_quote_subst'
526352f9793fSmrg
526452f9793fSmrg# The HP-UX ksh and POSIX shell print the target directory to stdout
526552f9793fSmrg# if CDPATH is set.
526652f9793fSmrg(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
526752f9793fSmrg
526852f9793fSmrgrelink_command=\"$relink_command\"
526952f9793fSmrg
527052f9793fSmrg# This environment variable determines our operation mode.
527152f9793fSmrgif test \"\$libtool_install_magic\" = \"$magic\"; then
527252f9793fSmrg  # install mode needs the following variable:
527352f9793fSmrg  notinst_deplibs='$notinst_deplibs'
527452f9793fSmrgelse
527552f9793fSmrg  # When we are sourced in execute mode, \$file and \$echo are already set.
527652f9793fSmrg  if test \"\$libtool_execute_magic\" != \"$magic\"; then
527752f9793fSmrg    echo=\"$qecho\"
527852f9793fSmrg    file=\"\$0\"
527952f9793fSmrg    # Make sure echo works.
528052f9793fSmrg    if test \"X\$1\" = X--no-reexec; then
528152f9793fSmrg      # Discard the --no-reexec flag, and continue.
528252f9793fSmrg      shift
528352f9793fSmrg    elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
528452f9793fSmrg      # Yippee, \$echo works!
528552f9793fSmrg      :
528652f9793fSmrg    else
528752f9793fSmrg      # Restart under the correct shell, and then maybe \$echo will work.
528852f9793fSmrg      exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
528952f9793fSmrg    fi
529052f9793fSmrg  fi\
529152f9793fSmrg"
529252f9793fSmrg	$echo >> $output "\
529352f9793fSmrg
529452f9793fSmrg  # Find the directory that this script lives in.
529552f9793fSmrg  thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
529652f9793fSmrg  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
529752f9793fSmrg
529852f9793fSmrg  # Follow symbolic links until we get to the real thisdir.
529952f9793fSmrg  file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
530052f9793fSmrg  while test -n \"\$file\"; do
530152f9793fSmrg    destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
530252f9793fSmrg
530352f9793fSmrg    # If there was a directory component, then change thisdir.
530452f9793fSmrg    if test \"x\$destdir\" != \"x\$file\"; then
530552f9793fSmrg      case \"\$destdir\" in
530652f9793fSmrg      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
530752f9793fSmrg      *) thisdir=\"\$thisdir/\$destdir\" ;;
530852f9793fSmrg      esac
530952f9793fSmrg    fi
531052f9793fSmrg
531152f9793fSmrg    file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
531252f9793fSmrg    file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
531352f9793fSmrg  done
531452f9793fSmrg
531552f9793fSmrg  # Try to get the absolute directory name.
531652f9793fSmrg  absdir=\`cd \"\$thisdir\" && pwd\`
531752f9793fSmrg  test -n \"\$absdir\" && thisdir=\"\$absdir\"
531852f9793fSmrg"
531952f9793fSmrg
532052f9793fSmrg	if test "$fast_install" = yes; then
532152f9793fSmrg	  $echo >> $output "\
532252f9793fSmrg  program=lt-'$outputname'$exeext
532352f9793fSmrg  progdir=\"\$thisdir/$objdir\"
532452f9793fSmrg
532552f9793fSmrg  if test ! -f \"\$progdir/\$program\" || \\
532652f9793fSmrg     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
532752f9793fSmrg       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
532852f9793fSmrg
532952f9793fSmrg    file=\"\$\$-\$program\"
533052f9793fSmrg
533152f9793fSmrg    if test ! -d \"\$progdir\"; then
533252f9793fSmrg      $mkdir \"\$progdir\"
533352f9793fSmrg    else
533452f9793fSmrg      $rm \"\$progdir/\$file\"
533552f9793fSmrg    fi"
533652f9793fSmrg
533752f9793fSmrg	  $echo >> $output "\
533852f9793fSmrg
533952f9793fSmrg    # relink executable if necessary
534052f9793fSmrg    if test -n \"\$relink_command\"; then
534152f9793fSmrg      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
534252f9793fSmrg      else
534352f9793fSmrg	$echo \"\$relink_command_output\" >&2
534452f9793fSmrg	$rm \"\$progdir/\$file\"
534552f9793fSmrg	exit $EXIT_FAILURE
534652f9793fSmrg      fi
534752f9793fSmrg    fi
534852f9793fSmrg
534952f9793fSmrg    $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
535052f9793fSmrg    { $rm \"\$progdir/\$program\";
535152f9793fSmrg      $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
535252f9793fSmrg    $rm \"\$progdir/\$file\"
535352f9793fSmrg  fi"
535452f9793fSmrg	else
535552f9793fSmrg	  $echo >> $output "\
535652f9793fSmrg  program='$outputname'
535752f9793fSmrg  progdir=\"\$thisdir/$objdir\"
535852f9793fSmrg"
535952f9793fSmrg	fi
536052f9793fSmrg
536152f9793fSmrg	$echo >> $output "\
536252f9793fSmrg
536352f9793fSmrg  if test -f \"\$progdir/\$program\"; then"
536452f9793fSmrg
536552f9793fSmrg	# Export our shlibpath_var if we have one.
536652f9793fSmrg	if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
536752f9793fSmrg	  $echo >> $output "\
536852f9793fSmrg    # Add our own library path to $shlibpath_var
536952f9793fSmrg    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
537052f9793fSmrg
537152f9793fSmrg    # Some systems cannot cope with colon-terminated $shlibpath_var
537252f9793fSmrg    # The second colon is a workaround for a bug in BeOS R4 sed
537352f9793fSmrg    $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
537452f9793fSmrg
537552f9793fSmrg    export $shlibpath_var
537652f9793fSmrg"
537752f9793fSmrg	fi
537852f9793fSmrg
537952f9793fSmrg	# fixup the dll searchpath if we need to.
538052f9793fSmrg	if test -n "$dllsearchpath"; then
538152f9793fSmrg	  $echo >> $output "\
538252f9793fSmrg    # Add the dll search path components to the executable PATH
538352f9793fSmrg    PATH=$dllsearchpath:\$PATH
538452f9793fSmrg"
538552f9793fSmrg	fi
538652f9793fSmrg
538752f9793fSmrg	$echo >> $output "\
538852f9793fSmrg    if test \"\$libtool_execute_magic\" != \"$magic\"; then
538952f9793fSmrg      # Run the actual program with our arguments.
539052f9793fSmrg"
539152f9793fSmrg	case $host in
539252f9793fSmrg	# Backslashes separate directories on plain windows
539352f9793fSmrg	*-*-mingw | *-*-os2*)
539452f9793fSmrg	  $echo >> $output "\
539552f9793fSmrg      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
539652f9793fSmrg"
539752f9793fSmrg	  ;;
539852f9793fSmrg
539952f9793fSmrg	*)
540052f9793fSmrg	  $echo >> $output "\
540152f9793fSmrg      exec \"\$progdir/\$program\" \${1+\"\$@\"}
540252f9793fSmrg"
540352f9793fSmrg	  ;;
540452f9793fSmrg	esac
540552f9793fSmrg	$echo >> $output "\
540652f9793fSmrg      \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
540752f9793fSmrg      exit $EXIT_FAILURE
540852f9793fSmrg    fi
540952f9793fSmrg  else
541052f9793fSmrg    # The program doesn't exist.
541152f9793fSmrg    \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
541252f9793fSmrg    \$echo \"This script is just a wrapper for \$program.\" 1>&2
541352f9793fSmrg    $echo \"See the $PACKAGE documentation for more information.\" 1>&2
541452f9793fSmrg    exit $EXIT_FAILURE
541552f9793fSmrg  fi
541652f9793fSmrgfi\
541752f9793fSmrg"
541852f9793fSmrg	chmod +x $output
541952f9793fSmrg      fi
542052f9793fSmrg      exit $EXIT_SUCCESS
542152f9793fSmrg      ;;
542252f9793fSmrg    esac
542352f9793fSmrg
542452f9793fSmrg    # See if we need to build an old-fashioned archive.
542552f9793fSmrg    for oldlib in $oldlibs; do
542652f9793fSmrg
542752f9793fSmrg      if test "$build_libtool_libs" = convenience; then
542852f9793fSmrg	oldobjs="$libobjs_save"
542952f9793fSmrg	addlibs="$convenience"
543052f9793fSmrg	build_libtool_libs=no
543152f9793fSmrg      else
543252f9793fSmrg	if test "$build_libtool_libs" = module; then
543352f9793fSmrg	  oldobjs="$libobjs_save"
543452f9793fSmrg	  build_libtool_libs=no
543552f9793fSmrg	else
543652f9793fSmrg	  oldobjs="$old_deplibs $non_pic_objects"
543752f9793fSmrg	fi
543852f9793fSmrg	addlibs="$old_convenience"
543952f9793fSmrg      fi
544052f9793fSmrg
544152f9793fSmrg      if test -n "$addlibs"; then
544252f9793fSmrg	gentop="$output_objdir/${outputname}x"
544352f9793fSmrg	generated="$generated $gentop"
544452f9793fSmrg
544552f9793fSmrg	func_extract_archives $gentop $addlibs
544652f9793fSmrg	oldobjs="$oldobjs $func_extract_archives_result"
544752f9793fSmrg      fi
544852f9793fSmrg
544952f9793fSmrg      # Do each command in the archive commands.
545052f9793fSmrg      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
545152f9793fSmrg       cmds=$old_archive_from_new_cmds
545252f9793fSmrg      else
545352f9793fSmrg	# POSIX demands no paths to be encoded in archives.  We have
545452f9793fSmrg	# to avoid creating archives with duplicate basenames if we
545552f9793fSmrg	# might have to extract them afterwards, e.g., when creating a
545652f9793fSmrg	# static archive out of a convenience library, or when linking
545752f9793fSmrg	# the entirety of a libtool archive into another (currently
545852f9793fSmrg	# not supported by libtool).
545952f9793fSmrg	if (for obj in $oldobjs
546052f9793fSmrg	    do
546152f9793fSmrg	      $echo "X$obj" | $Xsed -e 's%^.*/%%'
546252f9793fSmrg	    done | sort | sort -uc >/dev/null 2>&1); then
546352f9793fSmrg	  :
546452f9793fSmrg	else
546552f9793fSmrg	  $echo "copying selected object files to avoid basename conflicts..."
546652f9793fSmrg
546752f9793fSmrg	  if test -z "$gentop"; then
546852f9793fSmrg	    gentop="$output_objdir/${outputname}x"
546952f9793fSmrg	    generated="$generated $gentop"
547052f9793fSmrg
547152f9793fSmrg	    $show "${rm}r $gentop"
547252f9793fSmrg	    $run ${rm}r "$gentop"
547352f9793fSmrg	    $show "$mkdir $gentop"
547452f9793fSmrg	    $run $mkdir "$gentop"
547552f9793fSmrg	    exit_status=$?
547652f9793fSmrg	    if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
547752f9793fSmrg	      exit $exit_status
547852f9793fSmrg	    fi
547952f9793fSmrg	  fi
548052f9793fSmrg
548152f9793fSmrg	  save_oldobjs=$oldobjs
548252f9793fSmrg	  oldobjs=
548352f9793fSmrg	  counter=1
548452f9793fSmrg	  for obj in $save_oldobjs
548552f9793fSmrg	  do
548652f9793fSmrg	    objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
548752f9793fSmrg	    case " $oldobjs " in
548852f9793fSmrg	    " ") oldobjs=$obj ;;
548952f9793fSmrg	    *[\ /]"$objbase "*)
549052f9793fSmrg	      while :; do
549152f9793fSmrg		# Make sure we don't pick an alternate name that also
549252f9793fSmrg		# overlaps.
549352f9793fSmrg		newobj=lt$counter-$objbase
549452f9793fSmrg		counter=`expr $counter + 1`
549552f9793fSmrg		case " $oldobjs " in
549652f9793fSmrg		*[\ /]"$newobj "*) ;;
549752f9793fSmrg		*) if test ! -f "$gentop/$newobj"; then break; fi ;;
549852f9793fSmrg		esac
549952f9793fSmrg	      done
550052f9793fSmrg	      $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
550152f9793fSmrg	      $run ln "$obj" "$gentop/$newobj" ||
550252f9793fSmrg	      $run cp "$obj" "$gentop/$newobj"
550352f9793fSmrg	      oldobjs="$oldobjs $gentop/$newobj"
550452f9793fSmrg	      ;;
550552f9793fSmrg	    *) oldobjs="$oldobjs $obj" ;;
550652f9793fSmrg	    esac
550752f9793fSmrg	  done
550852f9793fSmrg	fi
550952f9793fSmrg
551052f9793fSmrg	eval cmds=\"$old_archive_cmds\"
551152f9793fSmrg
551252f9793fSmrg	if len=`expr "X$cmds" : ".*"` &&
551352f9793fSmrg	     test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
551452f9793fSmrg	  cmds=$old_archive_cmds
551552f9793fSmrg	else
551652f9793fSmrg	  # the command line is too long to link in one step, link in parts
551752f9793fSmrg	  $echo "using piecewise archive linking..."
551852f9793fSmrg	  save_RANLIB=$RANLIB
551952f9793fSmrg	  RANLIB=:
552052f9793fSmrg	  objlist=
552152f9793fSmrg	  concat_cmds=
552252f9793fSmrg	  save_oldobjs=$oldobjs
552352f9793fSmrg
552452f9793fSmrg	  # Is there a better way of finding the last object in the list?
552552f9793fSmrg	  for obj in $save_oldobjs
552652f9793fSmrg	  do
552752f9793fSmrg	    last_oldobj=$obj
552852f9793fSmrg	  done
552952f9793fSmrg	  for obj in $save_oldobjs
553052f9793fSmrg	  do
553152f9793fSmrg	    oldobjs="$objlist $obj"
553252f9793fSmrg	    objlist="$objlist $obj"
553352f9793fSmrg	    eval test_cmds=\"$old_archive_cmds\"
553452f9793fSmrg	    if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
553552f9793fSmrg	       test "$len" -le "$max_cmd_len"; then
553652f9793fSmrg	      :
553752f9793fSmrg	    else
553852f9793fSmrg	      # the above command should be used before it gets too long
553952f9793fSmrg	      oldobjs=$objlist
554052f9793fSmrg	      if test "$obj" = "$last_oldobj" ; then
554152f9793fSmrg	        RANLIB=$save_RANLIB
554252f9793fSmrg	      fi
554352f9793fSmrg	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
554452f9793fSmrg	      eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
554552f9793fSmrg	      objlist=
554652f9793fSmrg	    fi
554752f9793fSmrg	  done
554852f9793fSmrg	  RANLIB=$save_RANLIB
554952f9793fSmrg	  oldobjs=$objlist
555052f9793fSmrg	  if test "X$oldobjs" = "X" ; then
555152f9793fSmrg	    eval cmds=\"\$concat_cmds\"
555252f9793fSmrg	  else
555352f9793fSmrg	    eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
555452f9793fSmrg	  fi
555552f9793fSmrg	fi
555652f9793fSmrg      fi
555752f9793fSmrg      save_ifs="$IFS"; IFS='~'
555852f9793fSmrg      for cmd in $cmds; do
555952f9793fSmrg        eval cmd=\"$cmd\"
556052f9793fSmrg	IFS="$save_ifs"
556152f9793fSmrg	$show "$cmd"
556252f9793fSmrg	$run eval "$cmd" || exit $?
556352f9793fSmrg      done
556452f9793fSmrg      IFS="$save_ifs"
556552f9793fSmrg    done
556652f9793fSmrg
556752f9793fSmrg    if test -n "$generated"; then
556852f9793fSmrg      $show "${rm}r$generated"
556952f9793fSmrg      $run ${rm}r$generated
557052f9793fSmrg    fi
557152f9793fSmrg
557252f9793fSmrg    # Now create the libtool archive.
557352f9793fSmrg    case $output in
557452f9793fSmrg    *.la)
557552f9793fSmrg      old_library=
557652f9793fSmrg      test "$build_old_libs" = yes && old_library="$libname.$libext"
557752f9793fSmrg      $show "creating $output"
557852f9793fSmrg
557952f9793fSmrg      # Preserve any variables that may affect compiler behavior
558052f9793fSmrg      for var in $variables_saved_for_relink; do
558152f9793fSmrg	if eval test -z \"\${$var+set}\"; then
558252f9793fSmrg	  relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
558352f9793fSmrg	elif eval var_value=\$$var; test -z "$var_value"; then
558452f9793fSmrg	  relink_command="$var=; export $var; $relink_command"
558552f9793fSmrg	else
558652f9793fSmrg	  var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
558752f9793fSmrg	  relink_command="$var=\"$var_value\"; export $var; $relink_command"
558852f9793fSmrg	fi
558952f9793fSmrg      done
559052f9793fSmrg      # Quote the link command for shipping.
559152f9793fSmrg      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
559252f9793fSmrg      relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
559352f9793fSmrg      if test "$hardcode_automatic" = yes ; then
559452f9793fSmrg	relink_command=
559552f9793fSmrg      fi
559652f9793fSmrg
559752f9793fSmrg
559852f9793fSmrg      # Only create the output if not a dry run.
559952f9793fSmrg      if test -z "$run"; then
560052f9793fSmrg	for installed in no yes; do
560152f9793fSmrg	  if test "$installed" = yes; then
560252f9793fSmrg	    if test -z "$install_libdir"; then
560352f9793fSmrg	      break
560452f9793fSmrg	    fi
560552f9793fSmrg	    output="$output_objdir/$outputname"i
560652f9793fSmrg	    # Replace all uninstalled libtool libraries with the installed ones
560752f9793fSmrg	    newdependency_libs=
560852f9793fSmrg	    for deplib in $dependency_libs; do
560952f9793fSmrg	      case $deplib in
561052f9793fSmrg	      *.la)
561152f9793fSmrg		name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
561252f9793fSmrg		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
561352f9793fSmrg		if test -z "$libdir"; then
561452f9793fSmrg		  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
561552f9793fSmrg		  exit $EXIT_FAILURE
561652f9793fSmrg		fi
561752f9793fSmrg		newdependency_libs="$newdependency_libs $libdir/$name"
561852f9793fSmrg		;;
561952f9793fSmrg	      *) newdependency_libs="$newdependency_libs $deplib" ;;
562052f9793fSmrg	      esac
562152f9793fSmrg	    done
562252f9793fSmrg	    dependency_libs="$newdependency_libs"
562352f9793fSmrg	    newdlfiles=
562452f9793fSmrg	    for lib in $dlfiles; do
562552f9793fSmrg	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
562652f9793fSmrg	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
562752f9793fSmrg	      if test -z "$libdir"; then
562852f9793fSmrg		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
562952f9793fSmrg		exit $EXIT_FAILURE
563052f9793fSmrg	      fi
563152f9793fSmrg	      newdlfiles="$newdlfiles $libdir/$name"
563252f9793fSmrg	    done
563352f9793fSmrg	    dlfiles="$newdlfiles"
563452f9793fSmrg	    newdlprefiles=
563552f9793fSmrg	    for lib in $dlprefiles; do
563652f9793fSmrg	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
563752f9793fSmrg	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
563852f9793fSmrg	      if test -z "$libdir"; then
563952f9793fSmrg		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
564052f9793fSmrg		exit $EXIT_FAILURE
564152f9793fSmrg	      fi
564252f9793fSmrg	      newdlprefiles="$newdlprefiles $libdir/$name"
564352f9793fSmrg	    done
564452f9793fSmrg	    dlprefiles="$newdlprefiles"
564552f9793fSmrg	  else
564652f9793fSmrg	    newdlfiles=
564752f9793fSmrg	    for lib in $dlfiles; do
564852f9793fSmrg	      case $lib in
564952f9793fSmrg		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
565052f9793fSmrg		*) abs=`pwd`"/$lib" ;;
565152f9793fSmrg	      esac
565252f9793fSmrg	      newdlfiles="$newdlfiles $abs"
565352f9793fSmrg	    done
565452f9793fSmrg	    dlfiles="$newdlfiles"
565552f9793fSmrg	    newdlprefiles=
565652f9793fSmrg	    for lib in $dlprefiles; do
565752f9793fSmrg	      case $lib in
565852f9793fSmrg		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
565952f9793fSmrg		*) abs=`pwd`"/$lib" ;;
566052f9793fSmrg	      esac
566152f9793fSmrg	      newdlprefiles="$newdlprefiles $abs"
566252f9793fSmrg	    done
566352f9793fSmrg	    dlprefiles="$newdlprefiles"
566452f9793fSmrg	  fi
566552f9793fSmrg	  $rm $output
566652f9793fSmrg	  # place dlname in correct position for cygwin
566752f9793fSmrg	  tdlname=$dlname
566852f9793fSmrg	  case $host,$output,$installed,$module,$dlname in
566952f9793fSmrg	    *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
567052f9793fSmrg	  esac
567152f9793fSmrg	  $echo > $output "\
567252f9793fSmrg# $outputname - a libtool library file
567352f9793fSmrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
567452f9793fSmrg#
567552f9793fSmrg# Please DO NOT delete this file!
567652f9793fSmrg# It is necessary for linking the library.
567752f9793fSmrg
567852f9793fSmrg# The name that we can dlopen(3).
567952f9793fSmrgdlname='$tdlname'
568052f9793fSmrg
568152f9793fSmrg# Names of this library.
568252f9793fSmrglibrary_names='$library_names'
568352f9793fSmrg
568452f9793fSmrg# The name of the static archive.
568552f9793fSmrgold_library='$old_library'
568652f9793fSmrg
568752f9793fSmrg# Libraries that this one depends upon.
568852f9793fSmrgdependency_libs='$dependency_libs'
568952f9793fSmrg
569052f9793fSmrg# Version information for $libname.
569152f9793fSmrgcurrent=$current
569252f9793fSmrgage=$age
569352f9793fSmrgrevision=$revision
569452f9793fSmrg
569552f9793fSmrg# Is this an already installed library?
569652f9793fSmrginstalled=$installed
569752f9793fSmrg
569852f9793fSmrg# Should we warn about portability when linking against -modules?
569952f9793fSmrgshouldnotlink=$module
570052f9793fSmrg
570152f9793fSmrg# Files to dlopen/dlpreopen
570252f9793fSmrgdlopen='$dlfiles'
570352f9793fSmrgdlpreopen='$dlprefiles'
570452f9793fSmrg
570552f9793fSmrg# Directory that this library needs to be installed in:
570652f9793fSmrglibdir='$install_libdir'"
570752f9793fSmrg	  if test "$installed" = no && test "$need_relink" = yes; then
570852f9793fSmrg	    $echo >> $output "\
570952f9793fSmrgrelink_command=\"$relink_command\""
571052f9793fSmrg	  fi
571152f9793fSmrg	done
571252f9793fSmrg      fi
571352f9793fSmrg
571452f9793fSmrg      # Do a symbolic link so that the libtool archive can be found in
571552f9793fSmrg      # LD_LIBRARY_PATH before the program is installed.
571652f9793fSmrg      $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
571752f9793fSmrg      $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
571852f9793fSmrg      ;;
571952f9793fSmrg    esac
572052f9793fSmrg    exit $EXIT_SUCCESS
572152f9793fSmrg    ;;
572252f9793fSmrg
572352f9793fSmrg  # libtool install mode
572452f9793fSmrg  install)
572552f9793fSmrg    modename="$modename: install"
572652f9793fSmrg
572752f9793fSmrg    # There may be an optional sh(1) argument at the beginning of
572852f9793fSmrg    # install_prog (especially on Windows NT).
572952f9793fSmrg    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
573052f9793fSmrg       # Allow the use of GNU shtool's install command.
573152f9793fSmrg       $echo "X$nonopt" | grep shtool > /dev/null; then
573252f9793fSmrg      # Aesthetically quote it.
573352f9793fSmrg      arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
573452f9793fSmrg      case $arg in
573552f9793fSmrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
573652f9793fSmrg	arg="\"$arg\""
573752f9793fSmrg	;;
573852f9793fSmrg      esac
573952f9793fSmrg      install_prog="$arg "
574052f9793fSmrg      arg="$1"
574152f9793fSmrg      shift
574252f9793fSmrg    else
574352f9793fSmrg      install_prog=
574452f9793fSmrg      arg=$nonopt
574552f9793fSmrg    fi
574652f9793fSmrg
574752f9793fSmrg    # The real first argument should be the name of the installation program.
574852f9793fSmrg    # Aesthetically quote it.
574952f9793fSmrg    arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
575052f9793fSmrg    case $arg in
575152f9793fSmrg    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
575252f9793fSmrg      arg="\"$arg\""
575352f9793fSmrg      ;;
575452f9793fSmrg    esac
575552f9793fSmrg    install_prog="$install_prog$arg"
575652f9793fSmrg
575752f9793fSmrg    # We need to accept at least all the BSD install flags.
575852f9793fSmrg    dest=
575952f9793fSmrg    files=
576052f9793fSmrg    opts=
576152f9793fSmrg    prev=
576252f9793fSmrg    install_type=
576352f9793fSmrg    isdir=no
576452f9793fSmrg    stripme=
576552f9793fSmrg    for arg
576652f9793fSmrg    do
576752f9793fSmrg      if test -n "$dest"; then
576852f9793fSmrg	files="$files $dest"
576952f9793fSmrg	dest=$arg
577052f9793fSmrg	continue
577152f9793fSmrg      fi
577252f9793fSmrg
577352f9793fSmrg      case $arg in
577452f9793fSmrg      -d) isdir=yes ;;
577552f9793fSmrg      -f) 
577652f9793fSmrg      	case " $install_prog " in
577752f9793fSmrg	*[\\\ /]cp\ *) ;;
577852f9793fSmrg	*) prev=$arg ;;
577952f9793fSmrg	esac
578052f9793fSmrg	;;
578152f9793fSmrg      -g | -m | -o) prev=$arg ;;
578252f9793fSmrg      -s)
578352f9793fSmrg	stripme=" -s"
578452f9793fSmrg	continue
578552f9793fSmrg	;;
578652f9793fSmrg      -*)
578752f9793fSmrg	;;
578852f9793fSmrg      *)
578952f9793fSmrg	# If the previous option needed an argument, then skip it.
579052f9793fSmrg	if test -n "$prev"; then
579152f9793fSmrg	  prev=
579252f9793fSmrg	else
579352f9793fSmrg	  dest=$arg
579452f9793fSmrg	  continue
579552f9793fSmrg	fi
579652f9793fSmrg	;;
579752f9793fSmrg      esac
579852f9793fSmrg
579952f9793fSmrg      # Aesthetically quote the argument.
580052f9793fSmrg      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
580152f9793fSmrg      case $arg in
580252f9793fSmrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
580352f9793fSmrg	arg="\"$arg\""
580452f9793fSmrg	;;
580552f9793fSmrg      esac
580652f9793fSmrg      install_prog="$install_prog $arg"
580752f9793fSmrg    done
580852f9793fSmrg
580952f9793fSmrg    if test -z "$install_prog"; then
581052f9793fSmrg      $echo "$modename: you must specify an install program" 1>&2
581152f9793fSmrg      $echo "$help" 1>&2
581252f9793fSmrg      exit $EXIT_FAILURE
581352f9793fSmrg    fi
581452f9793fSmrg
581552f9793fSmrg    if test -n "$prev"; then
581652f9793fSmrg      $echo "$modename: the \`$prev' option requires an argument" 1>&2
581752f9793fSmrg      $echo "$help" 1>&2
581852f9793fSmrg      exit $EXIT_FAILURE
581952f9793fSmrg    fi
582052f9793fSmrg
582152f9793fSmrg    if test -z "$files"; then
582252f9793fSmrg      if test -z "$dest"; then
582352f9793fSmrg	$echo "$modename: no file or destination specified" 1>&2
582452f9793fSmrg      else
582552f9793fSmrg	$echo "$modename: you must specify a destination" 1>&2
582652f9793fSmrg      fi
582752f9793fSmrg      $echo "$help" 1>&2
582852f9793fSmrg      exit $EXIT_FAILURE
582952f9793fSmrg    fi
583052f9793fSmrg
583152f9793fSmrg    # Strip any trailing slash from the destination.
583252f9793fSmrg    dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
583352f9793fSmrg
583452f9793fSmrg    # Check to see that the destination is a directory.
583552f9793fSmrg    test -d "$dest" && isdir=yes
583652f9793fSmrg    if test "$isdir" = yes; then
583752f9793fSmrg      destdir="$dest"
583852f9793fSmrg      destname=
583952f9793fSmrg    else
584052f9793fSmrg      destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
584152f9793fSmrg      test "X$destdir" = "X$dest" && destdir=.
584252f9793fSmrg      destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
584352f9793fSmrg
584452f9793fSmrg      # Not a directory, so check to see that there is only one file specified.
584552f9793fSmrg      set dummy $files
584652f9793fSmrg      if test "$#" -gt 2; then
584752f9793fSmrg	$echo "$modename: \`$dest' is not a directory" 1>&2
584852f9793fSmrg	$echo "$help" 1>&2
584952f9793fSmrg	exit $EXIT_FAILURE
585052f9793fSmrg      fi
585152f9793fSmrg    fi
585252f9793fSmrg    case $destdir in
585352f9793fSmrg    [\\/]* | [A-Za-z]:[\\/]*) ;;
585452f9793fSmrg    *)
585552f9793fSmrg      for file in $files; do
585652f9793fSmrg	case $file in
585752f9793fSmrg	*.lo) ;;
585852f9793fSmrg	*)
585952f9793fSmrg	  $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
586052f9793fSmrg	  $echo "$help" 1>&2
586152f9793fSmrg	  exit $EXIT_FAILURE
586252f9793fSmrg	  ;;
586352f9793fSmrg	esac
586452f9793fSmrg      done
586552f9793fSmrg      ;;
586652f9793fSmrg    esac
586752f9793fSmrg
586852f9793fSmrg    # This variable tells wrapper scripts just to set variables rather
586952f9793fSmrg    # than running their programs.
587052f9793fSmrg    libtool_install_magic="$magic"
587152f9793fSmrg
587252f9793fSmrg    staticlibs=
587352f9793fSmrg    future_libdirs=
587452f9793fSmrg    current_libdirs=
587552f9793fSmrg    for file in $files; do
587652f9793fSmrg
587752f9793fSmrg      # Do each installation.
587852f9793fSmrg      case $file in
587952f9793fSmrg      *.$libext)
588052f9793fSmrg	# Do the static libraries later.
588152f9793fSmrg	staticlibs="$staticlibs $file"
588252f9793fSmrg	;;
588352f9793fSmrg
588452f9793fSmrg      *.la)
588552f9793fSmrg	# Check to see that this really is a libtool archive.
588652f9793fSmrg	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
588752f9793fSmrg	else
588852f9793fSmrg	  $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
588952f9793fSmrg	  $echo "$help" 1>&2
589052f9793fSmrg	  exit $EXIT_FAILURE
589152f9793fSmrg	fi
589252f9793fSmrg
589352f9793fSmrg	library_names=
589452f9793fSmrg	old_library=
589552f9793fSmrg	relink_command=
589652f9793fSmrg	# If there is no directory component, then add one.
589752f9793fSmrg	case $file in
589852f9793fSmrg	*/* | *\\*) . $file ;;
589952f9793fSmrg	*) . ./$file ;;
590052f9793fSmrg	esac
590152f9793fSmrg
590252f9793fSmrg	# Add the libdir to current_libdirs if it is the destination.
590352f9793fSmrg	if test "X$destdir" = "X$libdir"; then
590452f9793fSmrg	  case "$current_libdirs " in
590552f9793fSmrg	  *" $libdir "*) ;;
590652f9793fSmrg	  *) current_libdirs="$current_libdirs $libdir" ;;
590752f9793fSmrg	  esac
590852f9793fSmrg	else
590952f9793fSmrg	  # Note the libdir as a future libdir.
591052f9793fSmrg	  case "$future_libdirs " in
591152f9793fSmrg	  *" $libdir "*) ;;
591252f9793fSmrg	  *) future_libdirs="$future_libdirs $libdir" ;;
591352f9793fSmrg	  esac
591452f9793fSmrg	fi
591552f9793fSmrg
591652f9793fSmrg	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
591752f9793fSmrg	test "X$dir" = "X$file/" && dir=
591852f9793fSmrg	dir="$dir$objdir"
591952f9793fSmrg
592052f9793fSmrg	if test -n "$relink_command"; then
592152f9793fSmrg	  # Determine the prefix the user has applied to our future dir.
592252f9793fSmrg	  inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
592352f9793fSmrg
592452f9793fSmrg	  # Don't allow the user to place us outside of our expected
592552f9793fSmrg	  # location b/c this prevents finding dependent libraries that
592652f9793fSmrg	  # are installed to the same prefix.
592752f9793fSmrg	  # At present, this check doesn't affect windows .dll's that
592852f9793fSmrg	  # are installed into $libdir/../bin (currently, that works fine)
592952f9793fSmrg	  # but it's something to keep an eye on.
593052f9793fSmrg	  if test "$inst_prefix_dir" = "$destdir"; then
593152f9793fSmrg	    $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
593252f9793fSmrg	    exit $EXIT_FAILURE
593352f9793fSmrg	  fi
593452f9793fSmrg
593552f9793fSmrg	  if test -n "$inst_prefix_dir"; then
593652f9793fSmrg	    # Stick the inst_prefix_dir data into the link command.
593752f9793fSmrg	    relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
593852f9793fSmrg	  else
593952f9793fSmrg	    relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
594052f9793fSmrg	  fi
594152f9793fSmrg
594252f9793fSmrg	  $echo "$modename: warning: relinking \`$file'" 1>&2
594352f9793fSmrg	  $show "$relink_command"
594452f9793fSmrg	  if $run eval "$relink_command"; then :
594552f9793fSmrg	  else
594652f9793fSmrg	    $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
594752f9793fSmrg	    exit $EXIT_FAILURE
594852f9793fSmrg	  fi
594952f9793fSmrg	fi
595052f9793fSmrg
595152f9793fSmrg	# See the names of the shared library.
595252f9793fSmrg	set dummy $library_names
595352f9793fSmrg	if test -n "$2"; then
595452f9793fSmrg	  realname="$2"
595552f9793fSmrg	  shift
595652f9793fSmrg	  shift
595752f9793fSmrg
595852f9793fSmrg	  srcname="$realname"
595952f9793fSmrg	  test -n "$relink_command" && srcname="$realname"T
596052f9793fSmrg
596152f9793fSmrg	  # Install the shared library and build the symlinks.
596252f9793fSmrg	  $show "$install_prog $dir/$srcname $destdir/$realname"
596352f9793fSmrg	  $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
596452f9793fSmrg	  if test -n "$stripme" && test -n "$striplib"; then
596552f9793fSmrg	    $show "$striplib $destdir/$realname"
596652f9793fSmrg	    $run eval "$striplib $destdir/$realname" || exit $?
596752f9793fSmrg	  fi
596852f9793fSmrg
596952f9793fSmrg	  if test "$#" -gt 0; then
597052f9793fSmrg	    # Delete the old symlinks, and create new ones.
597152f9793fSmrg	    # Try `ln -sf' first, because the `ln' binary might depend on
597252f9793fSmrg	    # the symlink we replace!  Solaris /bin/ln does not understand -f,
597352f9793fSmrg	    # so we also need to try rm && ln -s.
597452f9793fSmrg	    for linkname
597552f9793fSmrg	    do
597652f9793fSmrg	      if test "$linkname" != "$realname"; then
597752f9793fSmrg                $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
597852f9793fSmrg                $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
597952f9793fSmrg	      fi
598052f9793fSmrg	    done
598152f9793fSmrg	  fi
598252f9793fSmrg
598352f9793fSmrg	  # Do each command in the postinstall commands.
598452f9793fSmrg	  lib="$destdir/$realname"
598552f9793fSmrg	  cmds=$postinstall_cmds
598652f9793fSmrg	  save_ifs="$IFS"; IFS='~'
598752f9793fSmrg	  for cmd in $cmds; do
598852f9793fSmrg	    IFS="$save_ifs"
598952f9793fSmrg	    eval cmd=\"$cmd\"
599052f9793fSmrg	    $show "$cmd"
599152f9793fSmrg	    $run eval "$cmd" || {
599252f9793fSmrg	      lt_exit=$?
599352f9793fSmrg
599452f9793fSmrg	      # Restore the uninstalled library and exit
599552f9793fSmrg	      if test "$mode" = relink; then
599652f9793fSmrg		$run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
599752f9793fSmrg	      fi
599852f9793fSmrg
599952f9793fSmrg	      exit $lt_exit
600052f9793fSmrg	    }
600152f9793fSmrg	  done
600252f9793fSmrg	  IFS="$save_ifs"
600352f9793fSmrg	fi
600452f9793fSmrg
600552f9793fSmrg	# Install the pseudo-library for information purposes.
600652f9793fSmrg	name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
600752f9793fSmrg	instname="$dir/$name"i
600852f9793fSmrg	$show "$install_prog $instname $destdir/$name"
600952f9793fSmrg	$run eval "$install_prog $instname $destdir/$name" || exit $?
601052f9793fSmrg
601152f9793fSmrg	# Maybe install the static library, too.
601252f9793fSmrg	test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
601352f9793fSmrg	;;
601452f9793fSmrg
601552f9793fSmrg      *.lo)
601652f9793fSmrg	# Install (i.e. copy) a libtool object.
601752f9793fSmrg
601852f9793fSmrg	# Figure out destination file name, if it wasn't already specified.
601952f9793fSmrg	if test -n "$destname"; then
602052f9793fSmrg	  destfile="$destdir/$destname"
602152f9793fSmrg	else
602252f9793fSmrg	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
602352f9793fSmrg	  destfile="$destdir/$destfile"
602452f9793fSmrg	fi
602552f9793fSmrg
602652f9793fSmrg	# Deduce the name of the destination old-style object file.
602752f9793fSmrg	case $destfile in
602852f9793fSmrg	*.lo)
602952f9793fSmrg	  staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
603052f9793fSmrg	  ;;
603152f9793fSmrg	*.$objext)
603252f9793fSmrg	  staticdest="$destfile"
603352f9793fSmrg	  destfile=
603452f9793fSmrg	  ;;
603552f9793fSmrg	*)
603652f9793fSmrg	  $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
603752f9793fSmrg	  $echo "$help" 1>&2
603852f9793fSmrg	  exit $EXIT_FAILURE
603952f9793fSmrg	  ;;
604052f9793fSmrg	esac
604152f9793fSmrg
604252f9793fSmrg	# Install the libtool object if requested.
604352f9793fSmrg	if test -n "$destfile"; then
604452f9793fSmrg	  $show "$install_prog $file $destfile"
604552f9793fSmrg	  $run eval "$install_prog $file $destfile" || exit $?
604652f9793fSmrg	fi
604752f9793fSmrg
604852f9793fSmrg	# Install the old object if enabled.
604952f9793fSmrg	if test "$build_old_libs" = yes; then
605052f9793fSmrg	  # Deduce the name of the old-style object file.
605152f9793fSmrg	  staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
605252f9793fSmrg
605352f9793fSmrg	  $show "$install_prog $staticobj $staticdest"
605452f9793fSmrg	  $run eval "$install_prog \$staticobj \$staticdest" || exit $?
605552f9793fSmrg	fi
605652f9793fSmrg	exit $EXIT_SUCCESS
605752f9793fSmrg	;;
605852f9793fSmrg
605952f9793fSmrg      *)
606052f9793fSmrg	# Figure out destination file name, if it wasn't already specified.
606152f9793fSmrg	if test -n "$destname"; then
606252f9793fSmrg	  destfile="$destdir/$destname"
606352f9793fSmrg	else
606452f9793fSmrg	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
606552f9793fSmrg	  destfile="$destdir/$destfile"
606652f9793fSmrg	fi
606752f9793fSmrg
606852f9793fSmrg	# If the file is missing, and there is a .exe on the end, strip it
606952f9793fSmrg	# because it is most likely a libtool script we actually want to
607052f9793fSmrg	# install
607152f9793fSmrg	stripped_ext=""
607252f9793fSmrg	case $file in
607352f9793fSmrg	  *.exe)
607452f9793fSmrg	    if test ! -f "$file"; then
607552f9793fSmrg	      file=`$echo $file|${SED} 's,.exe$,,'`
607652f9793fSmrg	      stripped_ext=".exe"
607752f9793fSmrg	    fi
607852f9793fSmrg	    ;;
607952f9793fSmrg	esac
608052f9793fSmrg
608152f9793fSmrg	# Do a test to see if this is really a libtool program.
608252f9793fSmrg	case $host in
608352f9793fSmrg	*cygwin*|*mingw*)
608452f9793fSmrg	    wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
608552f9793fSmrg	    ;;
608652f9793fSmrg	*)
608752f9793fSmrg	    wrapper=$file
608852f9793fSmrg	    ;;
608952f9793fSmrg	esac
609052f9793fSmrg	if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
609152f9793fSmrg	  notinst_deplibs=
609252f9793fSmrg	  relink_command=
609352f9793fSmrg
609452f9793fSmrg	  # Note that it is not necessary on cygwin/mingw to append a dot to
609552f9793fSmrg	  # foo even if both foo and FILE.exe exist: automatic-append-.exe
609652f9793fSmrg	  # behavior happens only for exec(3), not for open(2)!  Also, sourcing
609752f9793fSmrg	  # `FILE.' does not work on cygwin managed mounts.
609852f9793fSmrg	  #
609952f9793fSmrg	  # If there is no directory component, then add one.
610052f9793fSmrg	  case $wrapper in
610152f9793fSmrg	  */* | *\\*) . ${wrapper} ;;
610252f9793fSmrg	  *) . ./${wrapper} ;;
610352f9793fSmrg	  esac
610452f9793fSmrg
610552f9793fSmrg	  # Check the variables that should have been set.
610652f9793fSmrg	  if test -z "$notinst_deplibs"; then
610752f9793fSmrg	    $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
610852f9793fSmrg	    exit $EXIT_FAILURE
610952f9793fSmrg	  fi
611052f9793fSmrg
611152f9793fSmrg	  finalize=yes
611252f9793fSmrg	  for lib in $notinst_deplibs; do
611352f9793fSmrg	    # Check to see that each library is installed.
611452f9793fSmrg	    libdir=
611552f9793fSmrg	    if test -f "$lib"; then
611652f9793fSmrg	      # If there is no directory component, then add one.
611752f9793fSmrg	      case $lib in
611852f9793fSmrg	      */* | *\\*) . $lib ;;
611952f9793fSmrg	      *) . ./$lib ;;
612052f9793fSmrg	      esac
612152f9793fSmrg	    fi
612252f9793fSmrg	    libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
612352f9793fSmrg	    if test -n "$libdir" && test ! -f "$libfile"; then
612452f9793fSmrg	      $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
612552f9793fSmrg	      finalize=no
612652f9793fSmrg	    fi
612752f9793fSmrg	  done
612852f9793fSmrg
612952f9793fSmrg	  relink_command=
613052f9793fSmrg	  # Note that it is not necessary on cygwin/mingw to append a dot to
613152f9793fSmrg	  # foo even if both foo and FILE.exe exist: automatic-append-.exe
613252f9793fSmrg	  # behavior happens only for exec(3), not for open(2)!  Also, sourcing
613352f9793fSmrg	  # `FILE.' does not work on cygwin managed mounts.
613452f9793fSmrg	  #
613552f9793fSmrg	  # If there is no directory component, then add one.
613652f9793fSmrg	  case $wrapper in
613752f9793fSmrg	  */* | *\\*) . ${wrapper} ;;
613852f9793fSmrg	  *) . ./${wrapper} ;;
613952f9793fSmrg	  esac
614052f9793fSmrg
614152f9793fSmrg	  outputname=
614252f9793fSmrg	  if test "$fast_install" = no && test -n "$relink_command"; then
614352f9793fSmrg	    if test "$finalize" = yes && test -z "$run"; then
614452f9793fSmrg	      tmpdir=`func_mktempdir`
614552f9793fSmrg	      file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
614652f9793fSmrg	      outputname="$tmpdir/$file"
614752f9793fSmrg	      # Replace the output file specification.
614852f9793fSmrg	      relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
614952f9793fSmrg
615052f9793fSmrg	      $show "$relink_command"
615152f9793fSmrg	      if $run eval "$relink_command"; then :
615252f9793fSmrg	      else
615352f9793fSmrg		$echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
615452f9793fSmrg		${rm}r "$tmpdir"
615552f9793fSmrg		continue
615652f9793fSmrg	      fi
615752f9793fSmrg	      file="$outputname"
615852f9793fSmrg	    else
615952f9793fSmrg	      $echo "$modename: warning: cannot relink \`$file'" 1>&2
616052f9793fSmrg	    fi
616152f9793fSmrg	  else
616252f9793fSmrg	    # Install the binary that we compiled earlier.
616352f9793fSmrg	    file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
616452f9793fSmrg	  fi
616552f9793fSmrg	fi
616652f9793fSmrg
616752f9793fSmrg	# remove .exe since cygwin /usr/bin/install will append another
616852f9793fSmrg	# one anyway 
616952f9793fSmrg	case $install_prog,$host in
617052f9793fSmrg	*/usr/bin/install*,*cygwin*)
617152f9793fSmrg	  case $file:$destfile in
617252f9793fSmrg	  *.exe:*.exe)
617352f9793fSmrg	    # this is ok
617452f9793fSmrg	    ;;
617552f9793fSmrg	  *.exe:*)
617652f9793fSmrg	    destfile=$destfile.exe
617752f9793fSmrg	    ;;
617852f9793fSmrg	  *:*.exe)
617952f9793fSmrg	    destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
618052f9793fSmrg	    ;;
618152f9793fSmrg	  esac
618252f9793fSmrg	  ;;
618352f9793fSmrg	esac
618452f9793fSmrg	$show "$install_prog$stripme $file $destfile"
618552f9793fSmrg	$run eval "$install_prog\$stripme \$file \$destfile" || exit $?
618652f9793fSmrg	test -n "$outputname" && ${rm}r "$tmpdir"
618752f9793fSmrg	;;
618852f9793fSmrg      esac
618952f9793fSmrg    done
619052f9793fSmrg
619152f9793fSmrg    for file in $staticlibs; do
619252f9793fSmrg      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
619352f9793fSmrg
619452f9793fSmrg      # Set up the ranlib parameters.
619552f9793fSmrg      oldlib="$destdir/$name"
619652f9793fSmrg
619752f9793fSmrg      $show "$install_prog $file $oldlib"
619852f9793fSmrg      $run eval "$install_prog \$file \$oldlib" || exit $?
619952f9793fSmrg
620052f9793fSmrg      if test -n "$stripme" && test -n "$old_striplib"; then
620152f9793fSmrg	$show "$old_striplib $oldlib"
620252f9793fSmrg	$run eval "$old_striplib $oldlib" || exit $?
620352f9793fSmrg      fi
620452f9793fSmrg
620552f9793fSmrg      # Do each command in the postinstall commands.
620652f9793fSmrg      cmds=$old_postinstall_cmds
620752f9793fSmrg      save_ifs="$IFS"; IFS='~'
620852f9793fSmrg      for cmd in $cmds; do
620952f9793fSmrg	IFS="$save_ifs"
621052f9793fSmrg	eval cmd=\"$cmd\"
621152f9793fSmrg	$show "$cmd"
621252f9793fSmrg	$run eval "$cmd" || exit $?
621352f9793fSmrg      done
621452f9793fSmrg      IFS="$save_ifs"
621552f9793fSmrg    done
621652f9793fSmrg
621752f9793fSmrg    if test -n "$future_libdirs"; then
621852f9793fSmrg      $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
621952f9793fSmrg    fi
622052f9793fSmrg
622152f9793fSmrg    if test -n "$current_libdirs"; then
622252f9793fSmrg      # Maybe just do a dry run.
622352f9793fSmrg      test -n "$run" && current_libdirs=" -n$current_libdirs"
622452f9793fSmrg      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
622552f9793fSmrg    else
622652f9793fSmrg      exit $EXIT_SUCCESS
622752f9793fSmrg    fi
622852f9793fSmrg    ;;
622952f9793fSmrg
623052f9793fSmrg  # libtool finish mode
623152f9793fSmrg  finish)
623252f9793fSmrg    modename="$modename: finish"
623352f9793fSmrg    libdirs="$nonopt"
623452f9793fSmrg    admincmds=
623552f9793fSmrg
623652f9793fSmrg    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
623752f9793fSmrg      for dir
623852f9793fSmrg      do
623952f9793fSmrg	libdirs="$libdirs $dir"
624052f9793fSmrg      done
624152f9793fSmrg
624252f9793fSmrg      for libdir in $libdirs; do
624352f9793fSmrg	if test -n "$finish_cmds"; then
624452f9793fSmrg	  # Do each command in the finish commands.
624552f9793fSmrg	  cmds=$finish_cmds
624652f9793fSmrg	  save_ifs="$IFS"; IFS='~'
624752f9793fSmrg	  for cmd in $cmds; do
624852f9793fSmrg	    IFS="$save_ifs"
624952f9793fSmrg	    eval cmd=\"$cmd\"
625052f9793fSmrg	    $show "$cmd"
625152f9793fSmrg	    $run eval "$cmd" || admincmds="$admincmds
625252f9793fSmrg       $cmd"
625352f9793fSmrg	  done
625452f9793fSmrg	  IFS="$save_ifs"
625552f9793fSmrg	fi
625652f9793fSmrg	if test -n "$finish_eval"; then
625752f9793fSmrg	  # Do the single finish_eval.
625852f9793fSmrg	  eval cmds=\"$finish_eval\"
625952f9793fSmrg	  $run eval "$cmds" || admincmds="$admincmds
626052f9793fSmrg       $cmds"
626152f9793fSmrg	fi
626252f9793fSmrg      done
626352f9793fSmrg    fi
626452f9793fSmrg
626552f9793fSmrg    # Exit here if they wanted silent mode.
626652f9793fSmrg    test "$show" = : && exit $EXIT_SUCCESS
626752f9793fSmrg
626852f9793fSmrg    $echo "X----------------------------------------------------------------------" | $Xsed
626952f9793fSmrg    $echo "Libraries have been installed in:"
627052f9793fSmrg    for libdir in $libdirs; do
627152f9793fSmrg      $echo "   $libdir"
627252f9793fSmrg    done
627352f9793fSmrg    $echo
627452f9793fSmrg    $echo "If you ever happen to want to link against installed libraries"
627552f9793fSmrg    $echo "in a given directory, LIBDIR, you must either use libtool, and"
627652f9793fSmrg    $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
627752f9793fSmrg    $echo "flag during linking and do at least one of the following:"
627852f9793fSmrg    if test -n "$shlibpath_var"; then
627952f9793fSmrg      $echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
628052f9793fSmrg      $echo "     during execution"
628152f9793fSmrg    fi
628252f9793fSmrg    if test -n "$runpath_var"; then
628352f9793fSmrg      $echo "   - add LIBDIR to the \`$runpath_var' environment variable"
628452f9793fSmrg      $echo "     during linking"
628552f9793fSmrg    fi
628652f9793fSmrg    if test -n "$hardcode_libdir_flag_spec"; then
628752f9793fSmrg      libdir=LIBDIR
628852f9793fSmrg      eval flag=\"$hardcode_libdir_flag_spec\"
628952f9793fSmrg
629052f9793fSmrg      $echo "   - use the \`$flag' linker flag"
629152f9793fSmrg    fi
629252f9793fSmrg    if test -n "$admincmds"; then
629352f9793fSmrg      $echo "   - have your system administrator run these commands:$admincmds"
629452f9793fSmrg    fi
629552f9793fSmrg    if test -f /etc/ld.so.conf; then
629652f9793fSmrg      $echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
629752f9793fSmrg    fi
629852f9793fSmrg    $echo
629952f9793fSmrg    $echo "See any operating system documentation about shared libraries for"
630052f9793fSmrg    $echo "more information, such as the ld(1) and ld.so(8) manual pages."
630152f9793fSmrg    $echo "X----------------------------------------------------------------------" | $Xsed
630252f9793fSmrg    exit $EXIT_SUCCESS
630352f9793fSmrg    ;;
630452f9793fSmrg
630552f9793fSmrg  # libtool execute mode
630652f9793fSmrg  execute)
630752f9793fSmrg    modename="$modename: execute"
630852f9793fSmrg
630952f9793fSmrg    # The first argument is the command name.
631052f9793fSmrg    cmd="$nonopt"
631152f9793fSmrg    if test -z "$cmd"; then
631252f9793fSmrg      $echo "$modename: you must specify a COMMAND" 1>&2
631352f9793fSmrg      $echo "$help"
631452f9793fSmrg      exit $EXIT_FAILURE
631552f9793fSmrg    fi
631652f9793fSmrg
631752f9793fSmrg    # Handle -dlopen flags immediately.
631852f9793fSmrg    for file in $execute_dlfiles; do
631952f9793fSmrg      if test ! -f "$file"; then
632052f9793fSmrg	$echo "$modename: \`$file' is not a file" 1>&2
632152f9793fSmrg	$echo "$help" 1>&2
632252f9793fSmrg	exit $EXIT_FAILURE
632352f9793fSmrg      fi
632452f9793fSmrg
632552f9793fSmrg      dir=
632652f9793fSmrg      case $file in
632752f9793fSmrg      *.la)
632852f9793fSmrg	# Check to see that this really is a libtool archive.
632952f9793fSmrg	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
633052f9793fSmrg	else
633152f9793fSmrg	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
633252f9793fSmrg	  $echo "$help" 1>&2
633352f9793fSmrg	  exit $EXIT_FAILURE
633452f9793fSmrg	fi
633552f9793fSmrg
633652f9793fSmrg	# Read the libtool library.
633752f9793fSmrg	dlname=
633852f9793fSmrg	library_names=
633952f9793fSmrg
634052f9793fSmrg	# If there is no directory component, then add one.
634152f9793fSmrg	case $file in
634252f9793fSmrg	*/* | *\\*) . $file ;;
634352f9793fSmrg	*) . ./$file ;;
634452f9793fSmrg	esac
634552f9793fSmrg
634652f9793fSmrg	# Skip this library if it cannot be dlopened.
634752f9793fSmrg	if test -z "$dlname"; then
634852f9793fSmrg	  # Warn if it was a shared library.
634952f9793fSmrg	  test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
635052f9793fSmrg	  continue
635152f9793fSmrg	fi
635252f9793fSmrg
635352f9793fSmrg	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
635452f9793fSmrg	test "X$dir" = "X$file" && dir=.
635552f9793fSmrg
635652f9793fSmrg	if test -f "$dir/$objdir/$dlname"; then
635752f9793fSmrg	  dir="$dir/$objdir"
635852f9793fSmrg	else
635952f9793fSmrg	  $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
636052f9793fSmrg	  exit $EXIT_FAILURE
636152f9793fSmrg	fi
636252f9793fSmrg	;;
636352f9793fSmrg
636452f9793fSmrg      *.lo)
636552f9793fSmrg	# Just add the directory containing the .lo file.
636652f9793fSmrg	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
636752f9793fSmrg	test "X$dir" = "X$file" && dir=.
636852f9793fSmrg	;;
636952f9793fSmrg
637052f9793fSmrg      *)
637152f9793fSmrg	$echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
637252f9793fSmrg	continue
637352f9793fSmrg	;;
637452f9793fSmrg      esac
637552f9793fSmrg
637652f9793fSmrg      # Get the absolute pathname.
637752f9793fSmrg      absdir=`cd "$dir" && pwd`
637852f9793fSmrg      test -n "$absdir" && dir="$absdir"
637952f9793fSmrg
638052f9793fSmrg      # Now add the directory to shlibpath_var.
638152f9793fSmrg      if eval "test -z \"\$$shlibpath_var\""; then
638252f9793fSmrg	eval "$shlibpath_var=\"\$dir\""
638352f9793fSmrg      else
638452f9793fSmrg	eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
638552f9793fSmrg      fi
638652f9793fSmrg    done
638752f9793fSmrg
638852f9793fSmrg    # This variable tells wrapper scripts just to set shlibpath_var
638952f9793fSmrg    # rather than running their programs.
639052f9793fSmrg    libtool_execute_magic="$magic"
639152f9793fSmrg
639252f9793fSmrg    # Check if any of the arguments is a wrapper script.
639352f9793fSmrg    args=
639452f9793fSmrg    for file
639552f9793fSmrg    do
639652f9793fSmrg      case $file in
639752f9793fSmrg      -*) ;;
639852f9793fSmrg      *)
639952f9793fSmrg	# Do a test to see if this is really a libtool program.
640052f9793fSmrg	if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
640152f9793fSmrg	  # If there is no directory component, then add one.
640252f9793fSmrg	  case $file in
640352f9793fSmrg	  */* | *\\*) . $file ;;
640452f9793fSmrg	  *) . ./$file ;;
640552f9793fSmrg	  esac
640652f9793fSmrg
640752f9793fSmrg	  # Transform arg to wrapped name.
640852f9793fSmrg	  file="$progdir/$program"
640952f9793fSmrg	fi
641052f9793fSmrg	;;
641152f9793fSmrg      esac
641252f9793fSmrg      # Quote arguments (to preserve shell metacharacters).
641352f9793fSmrg      file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
641452f9793fSmrg      args="$args \"$file\""
641552f9793fSmrg    done
641652f9793fSmrg
641752f9793fSmrg    if test -z "$run"; then
641852f9793fSmrg      if test -n "$shlibpath_var"; then
641952f9793fSmrg	# Export the shlibpath_var.
642052f9793fSmrg	eval "export $shlibpath_var"
642152f9793fSmrg      fi
642252f9793fSmrg
642352f9793fSmrg      # Restore saved environment variables
642452f9793fSmrg      if test "${save_LC_ALL+set}" = set; then
642552f9793fSmrg	LC_ALL="$save_LC_ALL"; export LC_ALL
642652f9793fSmrg      fi
642752f9793fSmrg      if test "${save_LANG+set}" = set; then
642852f9793fSmrg	LANG="$save_LANG"; export LANG
642952f9793fSmrg      fi
643052f9793fSmrg
643152f9793fSmrg      # Now prepare to actually exec the command.
643252f9793fSmrg      exec_cmd="\$cmd$args"
643352f9793fSmrg    else
643452f9793fSmrg      # Display what would be done.
643552f9793fSmrg      if test -n "$shlibpath_var"; then
643652f9793fSmrg	eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
643752f9793fSmrg	$echo "export $shlibpath_var"
643852f9793fSmrg      fi
643952f9793fSmrg      $echo "$cmd$args"
644052f9793fSmrg      exit $EXIT_SUCCESS
644152f9793fSmrg    fi
644252f9793fSmrg    ;;
644352f9793fSmrg
644452f9793fSmrg  # libtool clean and uninstall mode
644552f9793fSmrg  clean | uninstall)
644652f9793fSmrg    modename="$modename: $mode"
644752f9793fSmrg    rm="$nonopt"
644852f9793fSmrg    files=
644952f9793fSmrg    rmforce=
645052f9793fSmrg    exit_status=0
645152f9793fSmrg
645252f9793fSmrg    # This variable tells wrapper scripts just to set variables rather
645352f9793fSmrg    # than running their programs.
645452f9793fSmrg    libtool_install_magic="$magic"
645552f9793fSmrg
645652f9793fSmrg    for arg
645752f9793fSmrg    do
645852f9793fSmrg      case $arg in
645952f9793fSmrg      -f) rm="$rm $arg"; rmforce=yes ;;
646052f9793fSmrg      -*) rm="$rm $arg" ;;
646152f9793fSmrg      *) files="$files $arg" ;;
646252f9793fSmrg      esac
646352f9793fSmrg    done
646452f9793fSmrg
646552f9793fSmrg    if test -z "$rm"; then
646652f9793fSmrg      $echo "$modename: you must specify an RM program" 1>&2
646752f9793fSmrg      $echo "$help" 1>&2
646852f9793fSmrg      exit $EXIT_FAILURE
646952f9793fSmrg    fi
647052f9793fSmrg
647152f9793fSmrg    rmdirs=
647252f9793fSmrg
647352f9793fSmrg    origobjdir="$objdir"
647452f9793fSmrg    for file in $files; do
647552f9793fSmrg      dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
647652f9793fSmrg      if test "X$dir" = "X$file"; then
647752f9793fSmrg	dir=.
647852f9793fSmrg	objdir="$origobjdir"
647952f9793fSmrg      else
648052f9793fSmrg	objdir="$dir/$origobjdir"
648152f9793fSmrg      fi
648252f9793fSmrg      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
648352f9793fSmrg      test "$mode" = uninstall && objdir="$dir"
648452f9793fSmrg
648552f9793fSmrg      # Remember objdir for removal later, being careful to avoid duplicates
648652f9793fSmrg      if test "$mode" = clean; then
648752f9793fSmrg	case " $rmdirs " in
648852f9793fSmrg	  *" $objdir "*) ;;
648952f9793fSmrg	  *) rmdirs="$rmdirs $objdir" ;;
649052f9793fSmrg	esac
649152f9793fSmrg      fi
649252f9793fSmrg
649352f9793fSmrg      # Don't error if the file doesn't exist and rm -f was used.
649452f9793fSmrg      if (test -L "$file") >/dev/null 2>&1 \
649552f9793fSmrg	|| (test -h "$file") >/dev/null 2>&1 \
649652f9793fSmrg	|| test -f "$file"; then
649752f9793fSmrg	:
649852f9793fSmrg      elif test -d "$file"; then
649952f9793fSmrg	exit_status=1
650052f9793fSmrg	continue
650152f9793fSmrg      elif test "$rmforce" = yes; then
650252f9793fSmrg	continue
650352f9793fSmrg      fi
650452f9793fSmrg
650552f9793fSmrg      rmfiles="$file"
650652f9793fSmrg
650752f9793fSmrg      case $name in
650852f9793fSmrg      *.la)
650952f9793fSmrg	# Possibly a libtool archive, so verify it.
651052f9793fSmrg	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
651152f9793fSmrg	  . $dir/$name
651252f9793fSmrg
651352f9793fSmrg	  # Delete the libtool libraries and symlinks.
651452f9793fSmrg	  for n in $library_names; do
651552f9793fSmrg	    rmfiles="$rmfiles $objdir/$n"
651652f9793fSmrg	  done
651752f9793fSmrg	  test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
651852f9793fSmrg
651952f9793fSmrg	  case "$mode" in
652052f9793fSmrg	  clean)
652152f9793fSmrg	    case "  $library_names " in
652252f9793fSmrg	    # "  " in the beginning catches empty $dlname
652352f9793fSmrg	    *" $dlname "*) ;;
652452f9793fSmrg	    *) rmfiles="$rmfiles $objdir/$dlname" ;;
652552f9793fSmrg	    esac
652652f9793fSmrg	     test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
652752f9793fSmrg	    ;;
652852f9793fSmrg	  uninstall)
652952f9793fSmrg	    if test -n "$library_names"; then
653052f9793fSmrg	      # Do each command in the postuninstall commands.
653152f9793fSmrg	      cmds=$postuninstall_cmds
653252f9793fSmrg	      save_ifs="$IFS"; IFS='~'
653352f9793fSmrg	      for cmd in $cmds; do
653452f9793fSmrg		IFS="$save_ifs"
653552f9793fSmrg		eval cmd=\"$cmd\"
653652f9793fSmrg		$show "$cmd"
653752f9793fSmrg		$run eval "$cmd"
653852f9793fSmrg		if test "$?" -ne 0 && test "$rmforce" != yes; then
653952f9793fSmrg		  exit_status=1
654052f9793fSmrg		fi
654152f9793fSmrg	      done
654252f9793fSmrg	      IFS="$save_ifs"
654352f9793fSmrg	    fi
654452f9793fSmrg
654552f9793fSmrg	    if test -n "$old_library"; then
654652f9793fSmrg	      # Do each command in the old_postuninstall commands.
654752f9793fSmrg	      cmds=$old_postuninstall_cmds
654852f9793fSmrg	      save_ifs="$IFS"; IFS='~'
654952f9793fSmrg	      for cmd in $cmds; do
655052f9793fSmrg		IFS="$save_ifs"
655152f9793fSmrg		eval cmd=\"$cmd\"
655252f9793fSmrg		$show "$cmd"
655352f9793fSmrg		$run eval "$cmd"
655452f9793fSmrg		if test "$?" -ne 0 && test "$rmforce" != yes; then
655552f9793fSmrg		  exit_status=1
655652f9793fSmrg		fi
655752f9793fSmrg	      done
655852f9793fSmrg	      IFS="$save_ifs"
655952f9793fSmrg	    fi
656052f9793fSmrg	    # FIXME: should reinstall the best remaining shared library.
656152f9793fSmrg	    ;;
656252f9793fSmrg	  esac
656352f9793fSmrg	fi
656452f9793fSmrg	;;
656552f9793fSmrg
656652f9793fSmrg      *.lo)
656752f9793fSmrg	# Possibly a libtool object, so verify it.
656852f9793fSmrg	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
656952f9793fSmrg
657052f9793fSmrg	  # Read the .lo file
657152f9793fSmrg	  . $dir/$name
657252f9793fSmrg
657352f9793fSmrg	  # Add PIC object to the list of files to remove.
657452f9793fSmrg	  if test -n "$pic_object" \
657552f9793fSmrg	     && test "$pic_object" != none; then
657652f9793fSmrg	    rmfiles="$rmfiles $dir/$pic_object"
657752f9793fSmrg	  fi
657852f9793fSmrg
657952f9793fSmrg	  # Add non-PIC object to the list of files to remove.
658052f9793fSmrg	  if test -n "$non_pic_object" \
658152f9793fSmrg	     && test "$non_pic_object" != none; then
658252f9793fSmrg	    rmfiles="$rmfiles $dir/$non_pic_object"
658352f9793fSmrg	  fi
658452f9793fSmrg	fi
658552f9793fSmrg	;;
658652f9793fSmrg
658752f9793fSmrg      *)
658852f9793fSmrg	if test "$mode" = clean ; then
658952f9793fSmrg	  noexename=$name
659052f9793fSmrg	  case $file in
659152f9793fSmrg	  *.exe)
659252f9793fSmrg	    file=`$echo $file|${SED} 's,.exe$,,'`
659352f9793fSmrg	    noexename=`$echo $name|${SED} 's,.exe$,,'`
659452f9793fSmrg	    # $file with .exe has already been added to rmfiles,
659552f9793fSmrg	    # add $file without .exe
659652f9793fSmrg	    rmfiles="$rmfiles $file"
659752f9793fSmrg	    ;;
659852f9793fSmrg	  esac
659952f9793fSmrg	  # Do a test to see if this is a libtool program.
660052f9793fSmrg	  if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
660152f9793fSmrg	    relink_command=
660252f9793fSmrg	    . $dir/$noexename
660352f9793fSmrg
660452f9793fSmrg	    # note $name still contains .exe if it was in $file originally
660552f9793fSmrg	    # as does the version of $file that was added into $rmfiles
660652f9793fSmrg	    rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
660752f9793fSmrg	    if test "$fast_install" = yes && test -n "$relink_command"; then
660852f9793fSmrg	      rmfiles="$rmfiles $objdir/lt-$name"
660952f9793fSmrg	    fi
661052f9793fSmrg	    if test "X$noexename" != "X$name" ; then
661152f9793fSmrg	      rmfiles="$rmfiles $objdir/lt-${noexename}.c"
661252f9793fSmrg	    fi
661352f9793fSmrg	  fi
661452f9793fSmrg	fi
661552f9793fSmrg	;;
661652f9793fSmrg      esac
661752f9793fSmrg      $show "$rm $rmfiles"
661852f9793fSmrg      $run $rm $rmfiles || exit_status=1
661952f9793fSmrg    done
662052f9793fSmrg    objdir="$origobjdir"
662152f9793fSmrg
662252f9793fSmrg    # Try to remove the ${objdir}s in the directories where we deleted files
662352f9793fSmrg    for dir in $rmdirs; do
662452f9793fSmrg      if test -d "$dir"; then
662552f9793fSmrg	$show "rmdir $dir"
662652f9793fSmrg	$run rmdir $dir >/dev/null 2>&1
662752f9793fSmrg      fi
662852f9793fSmrg    done
662952f9793fSmrg
663052f9793fSmrg    exit $exit_status
663152f9793fSmrg    ;;
663252f9793fSmrg
663352f9793fSmrg  "")
663452f9793fSmrg    $echo "$modename: you must specify a MODE" 1>&2
663552f9793fSmrg    $echo "$generic_help" 1>&2
663652f9793fSmrg    exit $EXIT_FAILURE
663752f9793fSmrg    ;;
663852f9793fSmrg  esac
663952f9793fSmrg
664052f9793fSmrg  if test -z "$exec_cmd"; then
664152f9793fSmrg    $echo "$modename: invalid operation mode \`$mode'" 1>&2
664252f9793fSmrg    $echo "$generic_help" 1>&2
664352f9793fSmrg    exit $EXIT_FAILURE
664452f9793fSmrg  fi
664552f9793fSmrgfi # test -z "$show_help"
664652f9793fSmrg
664752f9793fSmrgif test -n "$exec_cmd"; then
664852f9793fSmrg  eval exec $exec_cmd
664952f9793fSmrg  exit $EXIT_FAILURE
665052f9793fSmrgfi
665152f9793fSmrg
665252f9793fSmrg# We need to display help for each of the modes.
665352f9793fSmrgcase $mode in
665452f9793fSmrg"") $echo \
665552f9793fSmrg"Usage: $modename [OPTION]... [MODE-ARG]...
665652f9793fSmrg
665752f9793fSmrgProvide generalized library-building support services.
665852f9793fSmrg
665952f9793fSmrg    --config          show all configuration variables
666052f9793fSmrg    --debug           enable verbose shell tracing
666152f9793fSmrg-n, --dry-run         display commands without modifying any files
666252f9793fSmrg    --features        display basic configuration information and exit
666352f9793fSmrg    --finish          same as \`--mode=finish'
666452f9793fSmrg    --help            display this help message and exit
666552f9793fSmrg    --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
666652f9793fSmrg    --quiet           same as \`--silent'
666752f9793fSmrg    --silent          don't print informational messages
666852f9793fSmrg    --tag=TAG         use configuration variables from tag TAG
666952f9793fSmrg    --version         print version information
667052f9793fSmrg
667152f9793fSmrgMODE must be one of the following:
667252f9793fSmrg
667352f9793fSmrg      clean           remove files from the build directory
667452f9793fSmrg      compile         compile a source file into a libtool object
667552f9793fSmrg      execute         automatically set library path, then run a program
667652f9793fSmrg      finish          complete the installation of libtool libraries
667752f9793fSmrg      install         install libraries or executables
667852f9793fSmrg      link            create a library or an executable
667952f9793fSmrg      uninstall       remove libraries from an installed directory
668052f9793fSmrg
668152f9793fSmrgMODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
668252f9793fSmrga more detailed description of MODE.
668352f9793fSmrg
668452f9793fSmrgReport bugs to <bug-libtool@gnu.org>."
668552f9793fSmrg  exit $EXIT_SUCCESS
668652f9793fSmrg  ;;
668752f9793fSmrg
668852f9793fSmrgclean)
668952f9793fSmrg  $echo \
669052f9793fSmrg"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
669152f9793fSmrg
669252f9793fSmrgRemove files from the build directory.
669352f9793fSmrg
669452f9793fSmrgRM is the name of the program to use to delete files associated with each FILE
669552f9793fSmrg(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
669652f9793fSmrgto RM.
669752f9793fSmrg
669852f9793fSmrgIf FILE is a libtool library, object or program, all the files associated
669952f9793fSmrgwith it are deleted. Otherwise, only FILE itself is deleted using RM."
670052f9793fSmrg  ;;
670152f9793fSmrg
670252f9793fSmrgcompile)
670352f9793fSmrg  $echo \
670452f9793fSmrg"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
670552f9793fSmrg
670652f9793fSmrgCompile a source file into a libtool library object.
670752f9793fSmrg
670852f9793fSmrgThis mode accepts the following additional options:
670952f9793fSmrg
671052f9793fSmrg  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
671152f9793fSmrg  -prefer-pic       try to building PIC objects only
671252f9793fSmrg  -prefer-non-pic   try to building non-PIC objects only
671352f9793fSmrg  -static           always build a \`.o' file suitable for static linking
671452f9793fSmrg
671552f9793fSmrgCOMPILE-COMMAND is a command to be used in creating a \`standard' object file
671652f9793fSmrgfrom the given SOURCEFILE.
671752f9793fSmrg
671852f9793fSmrgThe output file name is determined by removing the directory component from
671952f9793fSmrgSOURCEFILE, then substituting the C source code suffix \`.c' with the
672052f9793fSmrglibrary object suffix, \`.lo'."
672152f9793fSmrg  ;;
672252f9793fSmrg
672352f9793fSmrgexecute)
672452f9793fSmrg  $echo \
672552f9793fSmrg"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
672652f9793fSmrg
672752f9793fSmrgAutomatically set library path, then run a program.
672852f9793fSmrg
672952f9793fSmrgThis mode accepts the following additional options:
673052f9793fSmrg
673152f9793fSmrg  -dlopen FILE      add the directory containing FILE to the library path
673252f9793fSmrg
673352f9793fSmrgThis mode sets the library path environment variable according to \`-dlopen'
673452f9793fSmrgflags.
673552f9793fSmrg
673652f9793fSmrgIf any of the ARGS are libtool executable wrappers, then they are translated
673752f9793fSmrginto their corresponding uninstalled binary, and any of their required library
673852f9793fSmrgdirectories are added to the library path.
673952f9793fSmrg
674052f9793fSmrgThen, COMMAND is executed, with ARGS as arguments."
674152f9793fSmrg  ;;
674252f9793fSmrg
674352f9793fSmrgfinish)
674452f9793fSmrg  $echo \
674552f9793fSmrg"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
674652f9793fSmrg
674752f9793fSmrgComplete the installation of libtool libraries.
674852f9793fSmrg
674952f9793fSmrgEach LIBDIR is a directory that contains libtool libraries.
675052f9793fSmrg
675152f9793fSmrgThe commands that this mode executes may require superuser privileges.  Use
675252f9793fSmrgthe \`--dry-run' option if you just want to see what would be executed."
675352f9793fSmrg  ;;
675452f9793fSmrg
675552f9793fSmrginstall)
675652f9793fSmrg  $echo \
675752f9793fSmrg"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
675852f9793fSmrg
675952f9793fSmrgInstall executables or libraries.
676052f9793fSmrg
676152f9793fSmrgINSTALL-COMMAND is the installation command.  The first component should be
676252f9793fSmrgeither the \`install' or \`cp' program.
676352f9793fSmrg
676452f9793fSmrgThe rest of the components are interpreted as arguments to that command (only
676552f9793fSmrgBSD-compatible install options are recognized)."
676652f9793fSmrg  ;;
676752f9793fSmrg
676852f9793fSmrglink)
676952f9793fSmrg  $echo \
677052f9793fSmrg"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
677152f9793fSmrg
677252f9793fSmrgLink object files or libraries together to form another library, or to
677352f9793fSmrgcreate an executable program.
677452f9793fSmrg
677552f9793fSmrgLINK-COMMAND is a command using the C compiler that you would use to create
677652f9793fSmrga program from several object files.
677752f9793fSmrg
677852f9793fSmrgThe following components of LINK-COMMAND are treated specially:
677952f9793fSmrg
678052f9793fSmrg  -all-static       do not do any dynamic linking at all
678152f9793fSmrg  -avoid-version    do not add a version suffix if possible
678252f9793fSmrg  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
678352f9793fSmrg  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
678452f9793fSmrg  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
678552f9793fSmrg  -export-symbols SYMFILE
678652f9793fSmrg		    try to export only the symbols listed in SYMFILE
678752f9793fSmrg  -export-symbols-regex REGEX
678852f9793fSmrg		    try to export only the symbols matching REGEX
678952f9793fSmrg  -LLIBDIR          search LIBDIR for required installed libraries
679052f9793fSmrg  -lNAME            OUTPUT-FILE requires the installed library libNAME
679152f9793fSmrg  -module           build a library that can dlopened
679252f9793fSmrg  -no-fast-install  disable the fast-install mode
679352f9793fSmrg  -no-install       link a not-installable executable
679452f9793fSmrg  -no-undefined     declare that a library does not refer to external symbols
679552f9793fSmrg  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
679652f9793fSmrg  -objectlist FILE  Use a list of object files found in FILE to specify objects
679752f9793fSmrg  -precious-files-regex REGEX
679852f9793fSmrg                    don't remove output files matching REGEX
679952f9793fSmrg  -release RELEASE  specify package release information
680052f9793fSmrg  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
680152f9793fSmrg  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
680252f9793fSmrg  -static           do not do any dynamic linking of libtool libraries
680352f9793fSmrg  -version-info CURRENT[:REVISION[:AGE]]
680452f9793fSmrg		    specify library version info [each variable defaults to 0]
680552f9793fSmrg
680652f9793fSmrgAll other options (arguments beginning with \`-') are ignored.
680752f9793fSmrg
680852f9793fSmrgEvery other argument is treated as a filename.  Files ending in \`.la' are
680952f9793fSmrgtreated as uninstalled libtool libraries, other files are standard or library
681052f9793fSmrgobject files.
681152f9793fSmrg
681252f9793fSmrgIf the OUTPUT-FILE ends in \`.la', then a libtool library is created,
681352f9793fSmrgonly library objects (\`.lo' files) may be specified, and \`-rpath' is
681452f9793fSmrgrequired, except when creating a convenience library.
681552f9793fSmrg
681652f9793fSmrgIf OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
681752f9793fSmrgusing \`ar' and \`ranlib', or on Windows using \`lib'.
681852f9793fSmrg
681952f9793fSmrgIf OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
682052f9793fSmrgis created, otherwise an executable program is created."
682152f9793fSmrg  ;;
682252f9793fSmrg
682352f9793fSmrguninstall)
682452f9793fSmrg  $echo \
682552f9793fSmrg"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
682652f9793fSmrg
682752f9793fSmrgRemove libraries from an installation directory.
682852f9793fSmrg
682952f9793fSmrgRM is the name of the program to use to delete files associated with each FILE
683052f9793fSmrg(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
683152f9793fSmrgto RM.
683252f9793fSmrg
683352f9793fSmrgIf FILE is a libtool library, all the files associated with it are deleted.
683452f9793fSmrgOtherwise, only FILE itself is deleted using RM."
683552f9793fSmrg  ;;
683652f9793fSmrg
683752f9793fSmrg*)
683852f9793fSmrg  $echo "$modename: invalid operation mode \`$mode'" 1>&2
683952f9793fSmrg  $echo "$help" 1>&2
684052f9793fSmrg  exit $EXIT_FAILURE
684152f9793fSmrg  ;;
684252f9793fSmrgesac
684352f9793fSmrg
684452f9793fSmrg$echo
684552f9793fSmrg$echo "Try \`$modename --help' for more information about other modes."
684652f9793fSmrg
684752f9793fSmrgexit $?
684852f9793fSmrg
684952f9793fSmrg# The TAGs below are defined such that we never get into a situation
685052f9793fSmrg# in which we disable both kinds of libraries.  Given conflicting
685152f9793fSmrg# choices, we go for a static library, that is the most portable,
685252f9793fSmrg# since we can't tell whether shared libraries were disabled because
685352f9793fSmrg# the user asked for that or because the platform doesn't support
685452f9793fSmrg# them.  This is particularly important on AIX, because we don't
685552f9793fSmrg# support having both static and shared libraries enabled at the same
685652f9793fSmrg# time on that platform, so we default to a shared-only configuration.
685752f9793fSmrg# If a disable-shared tag is given, we'll fallback to a static-only
685852f9793fSmrg# configuration.  But we'll never go from static-only to shared-only.
685952f9793fSmrg
686052f9793fSmrg# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
686152f9793fSmrgdisable_libs=shared
686252f9793fSmrg# ### END LIBTOOL TAG CONFIG: disable-shared
686352f9793fSmrg
686452f9793fSmrg# ### BEGIN LIBTOOL TAG CONFIG: disable-static
686552f9793fSmrgdisable_libs=static
686652f9793fSmrg# ### END LIBTOOL TAG CONFIG: disable-static
686752f9793fSmrg
686852f9793fSmrg# Local Variables:
686952f9793fSmrg# mode:shell-script
687052f9793fSmrg# sh-indentation:2
687152f9793fSmrg# End:
6872