ltmain.sh revision 4e411241
18c9fbc29Smrg# ltmain.sh - Provide generalized library-building support services.
28c9fbc29Smrg# NOTE: Changing this file will not affect anything until you rerun configure.
38c9fbc29Smrg#
44e411241Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
54e411241Smrg# 2007, 2008  Free Software Foundation, Inc.
68c9fbc29Smrg# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
78c9fbc29Smrg#
88c9fbc29Smrg# This program is free software; you can redistribute it and/or modify
98c9fbc29Smrg# it under the terms of the GNU General Public License as published by
108c9fbc29Smrg# the Free Software Foundation; either version 2 of the License, or
118c9fbc29Smrg# (at your option) any later version.
128c9fbc29Smrg#
138c9fbc29Smrg# This program is distributed in the hope that it will be useful, but
148c9fbc29Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
158c9fbc29Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
168c9fbc29Smrg# General Public License for more details.
178c9fbc29Smrg#
188c9fbc29Smrg# You should have received a copy of the GNU General Public License
198c9fbc29Smrg# along with this program; if not, write to the Free Software
208c9fbc29Smrg# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
218c9fbc29Smrg#
228c9fbc29Smrg# As a special exception to the GNU General Public License, if you
238c9fbc29Smrg# distribute this file as part of a program that contains a
248c9fbc29Smrg# configuration script generated by Autoconf, you may include it under
258c9fbc29Smrg# the same distribution terms that you use for the rest of that program.
268c9fbc29Smrg
278c9fbc29Smrgbasename="s,^.*/,,g"
288c9fbc29Smrg
298c9fbc29Smrg# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
308c9fbc29Smrg# is ksh but when the shell is invoked as "sh" and the current value of
318c9fbc29Smrg# the _XPG environment variable is not equal to 1 (one), the special
328c9fbc29Smrg# positional parameter $0, within a function call, is the name of the
338c9fbc29Smrg# function.
348c9fbc29Smrgprogpath="$0"
358c9fbc29Smrg
368c9fbc29Smrg# The name of this program:
378c9fbc29Smrgprogname=`echo "$progpath" | $SED $basename`
388c9fbc29Smrgmodename="$progname"
398c9fbc29Smrg
408c9fbc29Smrg# Global variables:
418c9fbc29SmrgEXIT_SUCCESS=0
428c9fbc29SmrgEXIT_FAILURE=1
438c9fbc29Smrg
448c9fbc29SmrgPROGRAM=ltmain.sh
458c9fbc29SmrgPACKAGE=libtool
464e411241SmrgVERSION=1.5.26
474e411241SmrgTIMESTAMP=" (1.1220.2.492 2008/01/30 06:40:56)"
484e411241Smrg
494e411241Smrg# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
504e411241Smrgif test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
514e411241Smrg  emulate sh
524e411241Smrg  NULLCMD=:
534e411241Smrg  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
544e411241Smrg  # is contrary to our usage.  Disable this feature.
554e411241Smrg  alias -g '${1+"$@"}'='"$@"'
568c9fbc29Smrg  setopt NO_GLOB_SUBST
574e411241Smrgelse
584e411241Smrg  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
598c9fbc29Smrgfi
604e411241SmrgBIN_SH=xpg4; export BIN_SH # for Tru64
614e411241SmrgDUALCASE=1; export DUALCASE # for MKS sh
628c9fbc29Smrg
638c9fbc29Smrg# Check that we have a working $echo.
648c9fbc29Smrgif test "X$1" = X--no-reexec; then
658c9fbc29Smrg  # Discard the --no-reexec flag, and continue.
668c9fbc29Smrg  shift
678c9fbc29Smrgelif test "X$1" = X--fallback-echo; then
688c9fbc29Smrg  # Avoid inline document here, it may be left over
698c9fbc29Smrg  :
708c9fbc29Smrgelif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
718c9fbc29Smrg  # Yippee, $echo works!
728c9fbc29Smrg  :
738c9fbc29Smrgelse
748c9fbc29Smrg  # Restart under the correct shell, and then maybe $echo will work.
758c9fbc29Smrg  exec $SHELL "$progpath" --no-reexec ${1+"$@"}
768c9fbc29Smrgfi
778c9fbc29Smrg
788c9fbc29Smrgif test "X$1" = X--fallback-echo; then
798c9fbc29Smrg  # used as fallback echo
808c9fbc29Smrg  shift
818c9fbc29Smrg  cat <<EOF
828c9fbc29Smrg$*
838c9fbc29SmrgEOF
848c9fbc29Smrg  exit $EXIT_SUCCESS
858c9fbc29Smrgfi
868c9fbc29Smrg
878c9fbc29Smrgdefault_mode=
888c9fbc29Smrghelp="Try \`$progname --help' for more information."
898c9fbc29Smrgmagic="%%%MAGIC variable%%%"
908c9fbc29Smrgmkdir="mkdir"
918c9fbc29Smrgmv="mv -f"
928c9fbc29Smrgrm="rm -f"
938c9fbc29Smrg
948c9fbc29Smrg# Sed substitution that helps us do robust quoting.  It backslashifies
958c9fbc29Smrg# metacharacters that are still active within double-quoted strings.
968c9fbc29SmrgXsed="${SED}"' -e 1s/^X//'
978c9fbc29Smrgsed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
988c9fbc29Smrg# test EBCDIC or ASCII
998c9fbc29Smrgcase `echo X|tr X '\101'` in
1008c9fbc29Smrg A) # ASCII based system
1018c9fbc29Smrg    # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
1028c9fbc29Smrg  SP2NL='tr \040 \012'
1038c9fbc29Smrg  NL2SP='tr \015\012 \040\040'
1048c9fbc29Smrg  ;;
1058c9fbc29Smrg *) # EBCDIC based system
1068c9fbc29Smrg  SP2NL='tr \100 \n'
1078c9fbc29Smrg  NL2SP='tr \r\n \100\100'
1088c9fbc29Smrg  ;;
1098c9fbc29Smrgesac
1108c9fbc29Smrg
1118c9fbc29Smrg# NLS nuisances.
1128c9fbc29Smrg# Only set LANG and LC_ALL to C if already set.
1138c9fbc29Smrg# These must not be set unconditionally because not all systems understand
1148c9fbc29Smrg# e.g. LANG=C (notably SCO).
1158c9fbc29Smrg# We save the old values to restore during execute mode.
1164e411241Smrglt_env=
1174e411241Smrgfor lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
1184e411241Smrgdo
1194e411241Smrg  eval "if test \"\${$lt_var+set}\" = set; then
1204e411241Smrg	  save_$lt_var=\$$lt_var
1214e411241Smrg	  lt_env=\"$lt_var=\$$lt_var \$lt_env\"
1224e411241Smrg	  $lt_var=C
1234e411241Smrg	  export $lt_var
1244e411241Smrg	fi"
1254e411241Smrgdone
1264e411241Smrg
1274e411241Smrgif test -n "$lt_env"; then
1284e411241Smrg  lt_env="env $lt_env"
1298c9fbc29Smrgfi
1308c9fbc29Smrg
1318c9fbc29Smrg# Make sure IFS has a sensible default
1328c9fbc29Smrglt_nl='
1338c9fbc29Smrg'
1348c9fbc29SmrgIFS=" 	$lt_nl"
1358c9fbc29Smrg
1368c9fbc29Smrgif test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
1378c9fbc29Smrg  $echo "$modename: not configured to build any kind of library" 1>&2
1388c9fbc29Smrg  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
1398c9fbc29Smrg  exit $EXIT_FAILURE
1408c9fbc29Smrgfi
1418c9fbc29Smrg
1428c9fbc29Smrg# Global variables.
1438c9fbc29Smrgmode=$default_mode
1448c9fbc29Smrgnonopt=
1458c9fbc29Smrgprev=
1468c9fbc29Smrgprevopt=
1478c9fbc29Smrgrun=
1488c9fbc29Smrgshow="$echo"
1498c9fbc29Smrgshow_help=
1508c9fbc29Smrgexecute_dlfiles=
1518c9fbc29Smrgduplicate_deps=no
1528c9fbc29Smrgpreserve_args=
1538c9fbc29Smrglo2o="s/\\.lo\$/.${objext}/"
1548c9fbc29Smrgo2lo="s/\\.${objext}\$/.lo/"
1554e411241Smrgextracted_archives=
1564e411241Smrgextracted_serial=0
1578c9fbc29Smrg
1588c9fbc29Smrg#####################################
1598c9fbc29Smrg# Shell function definitions:
1608c9fbc29Smrg# This seems to be the best place for them
1618c9fbc29Smrg
1628c9fbc29Smrg# func_mktempdir [string]
1638c9fbc29Smrg# Make a temporary directory that won't clash with other running
1648c9fbc29Smrg# libtool processes, and avoids race conditions if possible.  If
1658c9fbc29Smrg# given, STRING is the basename for that directory.
1668c9fbc29Smrgfunc_mktempdir ()
1678c9fbc29Smrg{
1688c9fbc29Smrg    my_template="${TMPDIR-/tmp}/${1-$progname}"
1698c9fbc29Smrg
1708c9fbc29Smrg    if test "$run" = ":"; then
1718c9fbc29Smrg      # Return a directory name, but don't create it in dry-run mode
1728c9fbc29Smrg      my_tmpdir="${my_template}-$$"
1738c9fbc29Smrg    else
1748c9fbc29Smrg
1758c9fbc29Smrg      # If mktemp works, use that first and foremost
1768c9fbc29Smrg      my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
1778c9fbc29Smrg
1788c9fbc29Smrg      if test ! -d "$my_tmpdir"; then
1798c9fbc29Smrg	# Failing that, at least try and use $RANDOM to avoid a race
1808c9fbc29Smrg	my_tmpdir="${my_template}-${RANDOM-0}$$"
1818c9fbc29Smrg
1828c9fbc29Smrg	save_mktempdir_umask=`umask`
1838c9fbc29Smrg	umask 0077
1848c9fbc29Smrg	$mkdir "$my_tmpdir"
1858c9fbc29Smrg	umask $save_mktempdir_umask
1868c9fbc29Smrg      fi
1878c9fbc29Smrg
1888c9fbc29Smrg      # If we're not in dry-run mode, bomb out on failure
1898c9fbc29Smrg      test -d "$my_tmpdir" || {
1908c9fbc29Smrg        $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
1918c9fbc29Smrg	exit $EXIT_FAILURE
1928c9fbc29Smrg      }
1938c9fbc29Smrg    fi
1948c9fbc29Smrg
1958c9fbc29Smrg    $echo "X$my_tmpdir" | $Xsed
1968c9fbc29Smrg}
1978c9fbc29Smrg
1988c9fbc29Smrg
1998c9fbc29Smrg# func_win32_libid arg
2008c9fbc29Smrg# return the library type of file 'arg'
2018c9fbc29Smrg#
2028c9fbc29Smrg# Need a lot of goo to handle *both* DLLs and import libs
2038c9fbc29Smrg# Has to be a shell function in order to 'eat' the argument
2048c9fbc29Smrg# that is supplied when $file_magic_command is called.
2058c9fbc29Smrgfunc_win32_libid ()
2068c9fbc29Smrg{
2078c9fbc29Smrg  win32_libid_type="unknown"
2088c9fbc29Smrg  win32_fileres=`file -L $1 2>/dev/null`
2098c9fbc29Smrg  case $win32_fileres in
2108c9fbc29Smrg  *ar\ archive\ import\ library*) # definitely import
2118c9fbc29Smrg    win32_libid_type="x86 archive import"
2128c9fbc29Smrg    ;;
2138c9fbc29Smrg  *ar\ archive*) # could be an import, or static
2148c9fbc29Smrg    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
2158c9fbc29Smrg      $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
2168c9fbc29Smrg      win32_nmres=`eval $NM -f posix -A $1 | \
2174e411241Smrg	$SED -n -e '1,100{
2184e411241Smrg		/ I /{
2194e411241Smrg			s,.*,import,
2204e411241Smrg			p
2214e411241Smrg			q
2224e411241Smrg			}
2234e411241Smrg		}'`
2248c9fbc29Smrg      case $win32_nmres in
2258c9fbc29Smrg      import*)  win32_libid_type="x86 archive import";;
2268c9fbc29Smrg      *)        win32_libid_type="x86 archive static";;
2278c9fbc29Smrg      esac
2288c9fbc29Smrg    fi
2298c9fbc29Smrg    ;;
2308c9fbc29Smrg  *DLL*)
2318c9fbc29Smrg    win32_libid_type="x86 DLL"
2328c9fbc29Smrg    ;;
2338c9fbc29Smrg  *executable*) # but shell scripts are "executable" too...
2348c9fbc29Smrg    case $win32_fileres in
2358c9fbc29Smrg    *MS\ Windows\ PE\ Intel*)
2368c9fbc29Smrg      win32_libid_type="x86 DLL"
2378c9fbc29Smrg      ;;
2388c9fbc29Smrg    esac
2398c9fbc29Smrg    ;;
2408c9fbc29Smrg  esac
2418c9fbc29Smrg  $echo $win32_libid_type
2428c9fbc29Smrg}
2438c9fbc29Smrg
2448c9fbc29Smrg
2458c9fbc29Smrg# func_infer_tag arg
2468c9fbc29Smrg# Infer tagged configuration to use if any are available and
2478c9fbc29Smrg# if one wasn't chosen via the "--tag" command line option.
2488c9fbc29Smrg# Only attempt this if the compiler in the base compile
2498c9fbc29Smrg# command doesn't match the default compiler.
2508c9fbc29Smrg# arg is usually of the form 'gcc ...'
2518c9fbc29Smrgfunc_infer_tag ()
2528c9fbc29Smrg{
2538c9fbc29Smrg    if test -n "$available_tags" && test -z "$tagname"; then
2548c9fbc29Smrg      CC_quoted=
2558c9fbc29Smrg      for arg in $CC; do
2568c9fbc29Smrg	case $arg in
2578c9fbc29Smrg	  *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
2588c9fbc29Smrg	  arg="\"$arg\""
2598c9fbc29Smrg	  ;;
2608c9fbc29Smrg	esac
2618c9fbc29Smrg	CC_quoted="$CC_quoted $arg"
2628c9fbc29Smrg      done
2638c9fbc29Smrg      case $@ in
2648c9fbc29Smrg      # Blanks in the command may have been stripped by the calling shell,
2658c9fbc29Smrg      # but not from the CC environment variable when configure was run.
2668c9fbc29Smrg      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
2678c9fbc29Smrg      # Blanks at the start of $base_compile will cause this to fail
2688c9fbc29Smrg      # if we don't check for them as well.
2698c9fbc29Smrg      *)
2708c9fbc29Smrg	for z in $available_tags; do
2718c9fbc29Smrg	  if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
2728c9fbc29Smrg	    # Evaluate the configuration.
2738c9fbc29Smrg	    eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
2748c9fbc29Smrg	    CC_quoted=
2758c9fbc29Smrg	    for arg in $CC; do
2768c9fbc29Smrg	    # Double-quote args containing other shell metacharacters.
2778c9fbc29Smrg	    case $arg in
2788c9fbc29Smrg	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
2798c9fbc29Smrg	      arg="\"$arg\""
2808c9fbc29Smrg	      ;;
2818c9fbc29Smrg	    esac
2828c9fbc29Smrg	    CC_quoted="$CC_quoted $arg"
2838c9fbc29Smrg	  done
2848c9fbc29Smrg	    case "$@ " in
2858c9fbc29Smrg	      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
2868c9fbc29Smrg	      # The compiler in the base compile command matches
2878c9fbc29Smrg	      # the one in the tagged configuration.
2888c9fbc29Smrg	      # Assume this is the tagged configuration we want.
2898c9fbc29Smrg	      tagname=$z
2908c9fbc29Smrg	      break
2918c9fbc29Smrg	      ;;
2928c9fbc29Smrg	    esac
2938c9fbc29Smrg	  fi
2948c9fbc29Smrg	done
2958c9fbc29Smrg	# If $tagname still isn't set, then no tagged configuration
2968c9fbc29Smrg	# was found and let the user know that the "--tag" command
2978c9fbc29Smrg	# line option must be used.
2988c9fbc29Smrg	if test -z "$tagname"; then
2998c9fbc29Smrg	  $echo "$modename: unable to infer tagged configuration"
3008c9fbc29Smrg	  $echo "$modename: specify a tag with \`--tag'" 1>&2
3018c9fbc29Smrg	  exit $EXIT_FAILURE
3028c9fbc29Smrg#        else
3038c9fbc29Smrg#          $echo "$modename: using $tagname tagged configuration"
3048c9fbc29Smrg	fi
3058c9fbc29Smrg	;;
3068c9fbc29Smrg      esac
3078c9fbc29Smrg    fi
3088c9fbc29Smrg}
3098c9fbc29Smrg
3108c9fbc29Smrg
3118c9fbc29Smrg# func_extract_an_archive dir oldlib
3128c9fbc29Smrgfunc_extract_an_archive ()
3138c9fbc29Smrg{
3148c9fbc29Smrg    f_ex_an_ar_dir="$1"; shift
3158c9fbc29Smrg    f_ex_an_ar_oldlib="$1"
3168c9fbc29Smrg
3178c9fbc29Smrg    $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
3188c9fbc29Smrg    $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
3198c9fbc29Smrg    if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
3208c9fbc29Smrg     :
3218c9fbc29Smrg    else
3228c9fbc29Smrg      $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
3238c9fbc29Smrg      exit $EXIT_FAILURE
3248c9fbc29Smrg    fi
3258c9fbc29Smrg}
3268c9fbc29Smrg
3278c9fbc29Smrg# func_extract_archives gentop oldlib ...
3288c9fbc29Smrgfunc_extract_archives ()
3298c9fbc29Smrg{
3308c9fbc29Smrg    my_gentop="$1"; shift
3318c9fbc29Smrg    my_oldlibs=${1+"$@"}
3328c9fbc29Smrg    my_oldobjs=""
3338c9fbc29Smrg    my_xlib=""
3348c9fbc29Smrg    my_xabs=""
3358c9fbc29Smrg    my_xdir=""
3368c9fbc29Smrg    my_status=""
3378c9fbc29Smrg
3388c9fbc29Smrg    $show "${rm}r $my_gentop"
3398c9fbc29Smrg    $run ${rm}r "$my_gentop"
3408c9fbc29Smrg    $show "$mkdir $my_gentop"
3418c9fbc29Smrg    $run $mkdir "$my_gentop"
3428c9fbc29Smrg    my_status=$?
3438c9fbc29Smrg    if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
3448c9fbc29Smrg      exit $my_status
3458c9fbc29Smrg    fi
3468c9fbc29Smrg
3478c9fbc29Smrg    for my_xlib in $my_oldlibs; do
3488c9fbc29Smrg      # Extract the objects.
3498c9fbc29Smrg      case $my_xlib in
3508c9fbc29Smrg	[\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
3518c9fbc29Smrg	*) my_xabs=`pwd`"/$my_xlib" ;;
3528c9fbc29Smrg      esac
3538c9fbc29Smrg      my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
3544e411241Smrg      my_xlib_u=$my_xlib
3554e411241Smrg      while :; do
3564e411241Smrg        case " $extracted_archives " in
3574e411241Smrg	*" $my_xlib_u "*)
3584e411241Smrg	  extracted_serial=`expr $extracted_serial + 1`
3594e411241Smrg	  my_xlib_u=lt$extracted_serial-$my_xlib ;;
3604e411241Smrg	*) break ;;
3614e411241Smrg	esac
3624e411241Smrg      done
3634e411241Smrg      extracted_archives="$extracted_archives $my_xlib_u"
3644e411241Smrg      my_xdir="$my_gentop/$my_xlib_u"
3658c9fbc29Smrg
3668c9fbc29Smrg      $show "${rm}r $my_xdir"
3678c9fbc29Smrg      $run ${rm}r "$my_xdir"
3688c9fbc29Smrg      $show "$mkdir $my_xdir"
3698c9fbc29Smrg      $run $mkdir "$my_xdir"
3708c9fbc29Smrg      exit_status=$?
3718c9fbc29Smrg      if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
3728c9fbc29Smrg	exit $exit_status
3738c9fbc29Smrg      fi
3748c9fbc29Smrg      case $host in
3758c9fbc29Smrg      *-darwin*)
3768c9fbc29Smrg	$show "Extracting $my_xabs"
3778c9fbc29Smrg	# Do not bother doing anything if just a dry run
3788c9fbc29Smrg	if test -z "$run"; then
3798c9fbc29Smrg	  darwin_orig_dir=`pwd`
3808c9fbc29Smrg	  cd $my_xdir || exit $?
3818c9fbc29Smrg	  darwin_archive=$my_xabs
3828c9fbc29Smrg	  darwin_curdir=`pwd`
3838c9fbc29Smrg	  darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
3848c9fbc29Smrg	  darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
3858c9fbc29Smrg	  if test -n "$darwin_arches"; then 
3868c9fbc29Smrg	    darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
3878c9fbc29Smrg	    darwin_arch=
3888c9fbc29Smrg	    $show "$darwin_base_archive has multiple architectures $darwin_arches"
3898c9fbc29Smrg	    for darwin_arch in  $darwin_arches ; do
3908c9fbc29Smrg	      mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
3918c9fbc29Smrg	      lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
3928c9fbc29Smrg	      cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
3938c9fbc29Smrg	      func_extract_an_archive "`pwd`" "${darwin_base_archive}"
3948c9fbc29Smrg	      cd "$darwin_curdir"
3958c9fbc29Smrg	      $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
3968c9fbc29Smrg	    done # $darwin_arches
3978c9fbc29Smrg      ## Okay now we have a bunch of thin objects, gotta fatten them up :)
3988c9fbc29Smrg	    darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
3998c9fbc29Smrg	    darwin_file=
4008c9fbc29Smrg	    darwin_files=
4018c9fbc29Smrg	    for darwin_file in $darwin_filelist; do
4028c9fbc29Smrg	      darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
4038c9fbc29Smrg	      lipo -create -output "$darwin_file" $darwin_files
4048c9fbc29Smrg	    done # $darwin_filelist
4058c9fbc29Smrg	    ${rm}r unfat-$$
4068c9fbc29Smrg	    cd "$darwin_orig_dir"
4078c9fbc29Smrg	  else
4088c9fbc29Smrg	    cd "$darwin_orig_dir"
4098c9fbc29Smrg 	    func_extract_an_archive "$my_xdir" "$my_xabs"
4108c9fbc29Smrg	  fi # $darwin_arches
4118c9fbc29Smrg	fi # $run
4128c9fbc29Smrg	;;
4138c9fbc29Smrg      *)
4148c9fbc29Smrg        func_extract_an_archive "$my_xdir" "$my_xabs"
4158c9fbc29Smrg        ;;
4168c9fbc29Smrg      esac
4178c9fbc29Smrg      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
4188c9fbc29Smrg    done
4198c9fbc29Smrg    func_extract_archives_result="$my_oldobjs"
4208c9fbc29Smrg}
4218c9fbc29Smrg# End of Shell function definitions
4228c9fbc29Smrg#####################################
4238c9fbc29Smrg
4248c9fbc29Smrg# Darwin sucks
4258c9fbc29Smrgeval std_shrext=\"$shrext_cmds\"
4268c9fbc29Smrg
4278c9fbc29Smrgdisable_libs=no
4288c9fbc29Smrg
4298c9fbc29Smrg# Parse our command line options once, thoroughly.
4308c9fbc29Smrgwhile test "$#" -gt 0
4318c9fbc29Smrgdo
4328c9fbc29Smrg  arg="$1"
4338c9fbc29Smrg  shift
4348c9fbc29Smrg
4358c9fbc29Smrg  case $arg in
4368c9fbc29Smrg  -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
4378c9fbc29Smrg  *) optarg= ;;
4388c9fbc29Smrg  esac
4398c9fbc29Smrg
4408c9fbc29Smrg  # If the previous option needs an argument, assign it.
4418c9fbc29Smrg  if test -n "$prev"; then
4428c9fbc29Smrg    case $prev in
4438c9fbc29Smrg    execute_dlfiles)
4448c9fbc29Smrg      execute_dlfiles="$execute_dlfiles $arg"
4458c9fbc29Smrg      ;;
4468c9fbc29Smrg    tag)
4478c9fbc29Smrg      tagname="$arg"
4488c9fbc29Smrg      preserve_args="${preserve_args}=$arg"
4498c9fbc29Smrg
4508c9fbc29Smrg      # Check whether tagname contains only valid characters
4518c9fbc29Smrg      case $tagname in
4528c9fbc29Smrg      *[!-_A-Za-z0-9,/]*)
4538c9fbc29Smrg	$echo "$progname: invalid tag name: $tagname" 1>&2
4548c9fbc29Smrg	exit $EXIT_FAILURE
4558c9fbc29Smrg	;;
4568c9fbc29Smrg      esac
4578c9fbc29Smrg
4588c9fbc29Smrg      case $tagname in
4598c9fbc29Smrg      CC)
4608c9fbc29Smrg	# Don't test for the "default" C tag, as we know, it's there, but
4618c9fbc29Smrg	# not specially marked.
4628c9fbc29Smrg	;;
4638c9fbc29Smrg      *)
4648c9fbc29Smrg	if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
4658c9fbc29Smrg	  taglist="$taglist $tagname"
4668c9fbc29Smrg	  # Evaluate the configuration.
4678c9fbc29Smrg	  eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
4688c9fbc29Smrg	else
4698c9fbc29Smrg	  $echo "$progname: ignoring unknown tag $tagname" 1>&2
4708c9fbc29Smrg	fi
4718c9fbc29Smrg	;;
4728c9fbc29Smrg      esac
4738c9fbc29Smrg      ;;
4748c9fbc29Smrg    *)
4758c9fbc29Smrg      eval "$prev=\$arg"
4768c9fbc29Smrg      ;;
4778c9fbc29Smrg    esac
4788c9fbc29Smrg
4798c9fbc29Smrg    prev=
4808c9fbc29Smrg    prevopt=
4818c9fbc29Smrg    continue
4828c9fbc29Smrg  fi
4838c9fbc29Smrg
4848c9fbc29Smrg  # Have we seen a non-optional argument yet?
4858c9fbc29Smrg  case $arg in
4868c9fbc29Smrg  --help)
4878c9fbc29Smrg    show_help=yes
4888c9fbc29Smrg    ;;
4898c9fbc29Smrg
4908c9fbc29Smrg  --version)
4914e411241Smrg    echo "\
4924e411241Smrg$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP
4934e411241Smrg
4944e411241SmrgCopyright (C) 2008  Free Software Foundation, Inc.
4954e411241SmrgThis is free software; see the source for copying conditions.  There is NO
4964e411241Smrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
4978c9fbc29Smrg    exit $?
4988c9fbc29Smrg    ;;
4998c9fbc29Smrg
5008c9fbc29Smrg  --config)
5018c9fbc29Smrg    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
5028c9fbc29Smrg    # Now print the configurations for the tags.
5038c9fbc29Smrg    for tagname in $taglist; do
5048c9fbc29Smrg      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
5058c9fbc29Smrg    done
5068c9fbc29Smrg    exit $?
5078c9fbc29Smrg    ;;
5088c9fbc29Smrg
5098c9fbc29Smrg  --debug)
5108c9fbc29Smrg    $echo "$progname: enabling shell trace mode"
5118c9fbc29Smrg    set -x
5128c9fbc29Smrg    preserve_args="$preserve_args $arg"
5138c9fbc29Smrg    ;;
5148c9fbc29Smrg
5158c9fbc29Smrg  --dry-run | -n)
5168c9fbc29Smrg    run=:
5178c9fbc29Smrg    ;;
5188c9fbc29Smrg
5198c9fbc29Smrg  --features)
5208c9fbc29Smrg    $echo "host: $host"
5218c9fbc29Smrg    if test "$build_libtool_libs" = yes; then
5228c9fbc29Smrg      $echo "enable shared libraries"
5238c9fbc29Smrg    else
5248c9fbc29Smrg      $echo "disable shared libraries"
5258c9fbc29Smrg    fi
5268c9fbc29Smrg    if test "$build_old_libs" = yes; then
5278c9fbc29Smrg      $echo "enable static libraries"
5288c9fbc29Smrg    else
5298c9fbc29Smrg      $echo "disable static libraries"
5308c9fbc29Smrg    fi
5318c9fbc29Smrg    exit $?
5328c9fbc29Smrg    ;;
5338c9fbc29Smrg
5348c9fbc29Smrg  --finish) mode="finish" ;;
5358c9fbc29Smrg
5368c9fbc29Smrg  --mode) prevopt="--mode" prev=mode ;;
5378c9fbc29Smrg  --mode=*) mode="$optarg" ;;
5388c9fbc29Smrg
5398c9fbc29Smrg  --preserve-dup-deps) duplicate_deps="yes" ;;
5408c9fbc29Smrg
5418c9fbc29Smrg  --quiet | --silent)
5428c9fbc29Smrg    show=:
5438c9fbc29Smrg    preserve_args="$preserve_args $arg"
5448c9fbc29Smrg    ;;
5458c9fbc29Smrg
5468c9fbc29Smrg  --tag)
5478c9fbc29Smrg    prevopt="--tag"
5488c9fbc29Smrg    prev=tag
5498c9fbc29Smrg    preserve_args="$preserve_args --tag"
5508c9fbc29Smrg    ;;
5518c9fbc29Smrg  --tag=*)
5528c9fbc29Smrg    set tag "$optarg" ${1+"$@"}
5538c9fbc29Smrg    shift
5548c9fbc29Smrg    prev=tag
5558c9fbc29Smrg    preserve_args="$preserve_args --tag"
5568c9fbc29Smrg    ;;
5578c9fbc29Smrg
5588c9fbc29Smrg  -dlopen)
5598c9fbc29Smrg    prevopt="-dlopen"
5608c9fbc29Smrg    prev=execute_dlfiles
5618c9fbc29Smrg    ;;
5628c9fbc29Smrg
5638c9fbc29Smrg  -*)
5648c9fbc29Smrg    $echo "$modename: unrecognized option \`$arg'" 1>&2
5658c9fbc29Smrg    $echo "$help" 1>&2
5668c9fbc29Smrg    exit $EXIT_FAILURE
5678c9fbc29Smrg    ;;
5688c9fbc29Smrg
5698c9fbc29Smrg  *)
5708c9fbc29Smrg    nonopt="$arg"
5718c9fbc29Smrg    break
5728c9fbc29Smrg    ;;
5738c9fbc29Smrg  esac
5748c9fbc29Smrgdone
5758c9fbc29Smrg
5768c9fbc29Smrgif test -n "$prevopt"; then
5778c9fbc29Smrg  $echo "$modename: option \`$prevopt' requires an argument" 1>&2
5788c9fbc29Smrg  $echo "$help" 1>&2
5798c9fbc29Smrg  exit $EXIT_FAILURE
5808c9fbc29Smrgfi
5818c9fbc29Smrg
5828c9fbc29Smrgcase $disable_libs in
5838c9fbc29Smrgno) 
5848c9fbc29Smrg  ;;
5858c9fbc29Smrgshared)
5868c9fbc29Smrg  build_libtool_libs=no
5878c9fbc29Smrg  build_old_libs=yes
5888c9fbc29Smrg  ;;
5898c9fbc29Smrgstatic)
5908c9fbc29Smrg  build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
5918c9fbc29Smrg  ;;
5928c9fbc29Smrgesac
5938c9fbc29Smrg
5948c9fbc29Smrg# If this variable is set in any of the actions, the command in it
5958c9fbc29Smrg# will be execed at the end.  This prevents here-documents from being
5968c9fbc29Smrg# left over by shells.
5978c9fbc29Smrgexec_cmd=
5988c9fbc29Smrg
5998c9fbc29Smrgif test -z "$show_help"; then
6008c9fbc29Smrg
6018c9fbc29Smrg  # Infer the operation mode.
6028c9fbc29Smrg  if test -z "$mode"; then
6038c9fbc29Smrg    $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
6048c9fbc29Smrg    $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
6058c9fbc29Smrg    case $nonopt in
6068c9fbc29Smrg    *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
6078c9fbc29Smrg      mode=link
6088c9fbc29Smrg      for arg
6098c9fbc29Smrg      do
6108c9fbc29Smrg	case $arg in
6118c9fbc29Smrg	-c)
6128c9fbc29Smrg	   mode=compile
6138c9fbc29Smrg	   break
6148c9fbc29Smrg	   ;;
6158c9fbc29Smrg	esac
6168c9fbc29Smrg      done
6178c9fbc29Smrg      ;;
6188c9fbc29Smrg    *db | *dbx | *strace | *truss)
6198c9fbc29Smrg      mode=execute
6208c9fbc29Smrg      ;;
6218c9fbc29Smrg    *install*|cp|mv)
6228c9fbc29Smrg      mode=install
6238c9fbc29Smrg      ;;
6248c9fbc29Smrg    *rm)
6258c9fbc29Smrg      mode=uninstall
6268c9fbc29Smrg      ;;
6278c9fbc29Smrg    *)
6288c9fbc29Smrg      # If we have no mode, but dlfiles were specified, then do execute mode.
6298c9fbc29Smrg      test -n "$execute_dlfiles" && mode=execute
6308c9fbc29Smrg
6318c9fbc29Smrg      # Just use the default operation mode.
6328c9fbc29Smrg      if test -z "$mode"; then
6338c9fbc29Smrg	if test -n "$nonopt"; then
6348c9fbc29Smrg	  $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
6358c9fbc29Smrg	else
6368c9fbc29Smrg	  $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
6378c9fbc29Smrg	fi
6388c9fbc29Smrg      fi
6398c9fbc29Smrg      ;;
6408c9fbc29Smrg    esac
6418c9fbc29Smrg  fi
6428c9fbc29Smrg
6438c9fbc29Smrg  # Only execute mode is allowed to have -dlopen flags.
6448c9fbc29Smrg  if test -n "$execute_dlfiles" && test "$mode" != execute; then
6458c9fbc29Smrg    $echo "$modename: unrecognized option \`-dlopen'" 1>&2
6468c9fbc29Smrg    $echo "$help" 1>&2
6478c9fbc29Smrg    exit $EXIT_FAILURE
6488c9fbc29Smrg  fi
6498c9fbc29Smrg
6508c9fbc29Smrg  # Change the help message to a mode-specific one.
6518c9fbc29Smrg  generic_help="$help"
6528c9fbc29Smrg  help="Try \`$modename --help --mode=$mode' for more information."
6538c9fbc29Smrg
6548c9fbc29Smrg  # These modes are in order of execution frequency so that they run quickly.
6558c9fbc29Smrg  case $mode in
6568c9fbc29Smrg  # libtool compile mode
6578c9fbc29Smrg  compile)
6588c9fbc29Smrg    modename="$modename: compile"
6598c9fbc29Smrg    # Get the compilation command and the source file.
6608c9fbc29Smrg    base_compile=
6618c9fbc29Smrg    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
6628c9fbc29Smrg    suppress_opt=yes
6638c9fbc29Smrg    suppress_output=
6648c9fbc29Smrg    arg_mode=normal
6658c9fbc29Smrg    libobj=
6668c9fbc29Smrg    later=
6678c9fbc29Smrg
6688c9fbc29Smrg    for arg
6698c9fbc29Smrg    do
6708c9fbc29Smrg      case $arg_mode in
6718c9fbc29Smrg      arg  )
6728c9fbc29Smrg	# do not "continue".  Instead, add this to base_compile
6738c9fbc29Smrg	lastarg="$arg"
6748c9fbc29Smrg	arg_mode=normal
6758c9fbc29Smrg	;;
6768c9fbc29Smrg
6778c9fbc29Smrg      target )
6788c9fbc29Smrg	libobj="$arg"
6798c9fbc29Smrg	arg_mode=normal
6808c9fbc29Smrg	continue
6818c9fbc29Smrg	;;
6828c9fbc29Smrg
6838c9fbc29Smrg      normal )
6848c9fbc29Smrg	# Accept any command-line options.
6858c9fbc29Smrg	case $arg in
6868c9fbc29Smrg	-o)
6878c9fbc29Smrg	  if test -n "$libobj" ; then
6888c9fbc29Smrg	    $echo "$modename: you cannot specify \`-o' more than once" 1>&2
6898c9fbc29Smrg	    exit $EXIT_FAILURE
6908c9fbc29Smrg	  fi
6918c9fbc29Smrg	  arg_mode=target
6928c9fbc29Smrg	  continue
6938c9fbc29Smrg	  ;;
6948c9fbc29Smrg
6958c9fbc29Smrg	-static | -prefer-pic | -prefer-non-pic)
6968c9fbc29Smrg	  later="$later $arg"
6978c9fbc29Smrg	  continue
6988c9fbc29Smrg	  ;;
6998c9fbc29Smrg
7008c9fbc29Smrg	-no-suppress)
7018c9fbc29Smrg	  suppress_opt=no
7028c9fbc29Smrg	  continue
7038c9fbc29Smrg	  ;;
7048c9fbc29Smrg
7058c9fbc29Smrg	-Xcompiler)
7068c9fbc29Smrg	  arg_mode=arg  #  the next one goes into the "base_compile" arg list
7078c9fbc29Smrg	  continue      #  The current "srcfile" will either be retained or
7088c9fbc29Smrg	  ;;            #  replaced later.  I would guess that would be a bug.
7098c9fbc29Smrg
7108c9fbc29Smrg	-Wc,*)
7118c9fbc29Smrg	  args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
7128c9fbc29Smrg	  lastarg=
7138c9fbc29Smrg	  save_ifs="$IFS"; IFS=','
7148c9fbc29Smrg 	  for arg in $args; do
7158c9fbc29Smrg	    IFS="$save_ifs"
7168c9fbc29Smrg
7178c9fbc29Smrg	    # Double-quote args containing other shell metacharacters.
7188c9fbc29Smrg	    # Many Bourne shells cannot handle close brackets correctly
7198c9fbc29Smrg	    # in scan sets, so we specify it separately.
7208c9fbc29Smrg	    case $arg in
7218c9fbc29Smrg	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
7228c9fbc29Smrg	      arg="\"$arg\""
7238c9fbc29Smrg	      ;;
7248c9fbc29Smrg	    esac
7258c9fbc29Smrg	    lastarg="$lastarg $arg"
7268c9fbc29Smrg	  done
7278c9fbc29Smrg	  IFS="$save_ifs"
7288c9fbc29Smrg	  lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
7298c9fbc29Smrg
7308c9fbc29Smrg	  # Add the arguments to base_compile.
7318c9fbc29Smrg	  base_compile="$base_compile $lastarg"
7328c9fbc29Smrg	  continue
7338c9fbc29Smrg	  ;;
7348c9fbc29Smrg
7358c9fbc29Smrg	* )
7368c9fbc29Smrg	  # Accept the current argument as the source file.
7378c9fbc29Smrg	  # The previous "srcfile" becomes the current argument.
7388c9fbc29Smrg	  #
7398c9fbc29Smrg	  lastarg="$srcfile"
7408c9fbc29Smrg	  srcfile="$arg"
7418c9fbc29Smrg	  ;;
7428c9fbc29Smrg	esac  #  case $arg
7438c9fbc29Smrg	;;
7448c9fbc29Smrg      esac    #  case $arg_mode
7458c9fbc29Smrg
7468c9fbc29Smrg      # Aesthetically quote the previous argument.
7478c9fbc29Smrg      lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
7488c9fbc29Smrg
7498c9fbc29Smrg      case $lastarg in
7508c9fbc29Smrg      # Double-quote args containing other shell metacharacters.
7518c9fbc29Smrg      # Many Bourne shells cannot handle close brackets correctly
7528c9fbc29Smrg      # in scan sets, and some SunOS ksh mistreat backslash-escaping
7538c9fbc29Smrg      # in scan sets (worked around with variable expansion),
7548c9fbc29Smrg      # and furthermore cannot handle '|' '&' '(' ')' in scan sets 
7558c9fbc29Smrg      # at all, so we specify them separately.
7568c9fbc29Smrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
7578c9fbc29Smrg	lastarg="\"$lastarg\""
7588c9fbc29Smrg	;;
7598c9fbc29Smrg      esac
7608c9fbc29Smrg
7618c9fbc29Smrg      base_compile="$base_compile $lastarg"
7628c9fbc29Smrg    done # for arg
7638c9fbc29Smrg
7648c9fbc29Smrg    case $arg_mode in
7658c9fbc29Smrg    arg)
7668c9fbc29Smrg      $echo "$modename: you must specify an argument for -Xcompile"
7678c9fbc29Smrg      exit $EXIT_FAILURE
7688c9fbc29Smrg      ;;
7698c9fbc29Smrg    target)
7708c9fbc29Smrg      $echo "$modename: you must specify a target with \`-o'" 1>&2
7718c9fbc29Smrg      exit $EXIT_FAILURE
7728c9fbc29Smrg      ;;
7738c9fbc29Smrg    *)
7748c9fbc29Smrg      # Get the name of the library object.
7758c9fbc29Smrg      [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
7768c9fbc29Smrg      ;;
7778c9fbc29Smrg    esac
7788c9fbc29Smrg
7798c9fbc29Smrg    # Recognize several different file suffixes.
7808c9fbc29Smrg    # If the user specifies -o file.o, it is replaced with file.lo
7818c9fbc29Smrg    xform='[cCFSifmso]'
7828c9fbc29Smrg    case $libobj in
7838c9fbc29Smrg    *.ada) xform=ada ;;
7848c9fbc29Smrg    *.adb) xform=adb ;;
7858c9fbc29Smrg    *.ads) xform=ads ;;
7868c9fbc29Smrg    *.asm) xform=asm ;;
7878c9fbc29Smrg    *.c++) xform=c++ ;;
7888c9fbc29Smrg    *.cc) xform=cc ;;
7898c9fbc29Smrg    *.ii) xform=ii ;;
7908c9fbc29Smrg    *.class) xform=class ;;
7918c9fbc29Smrg    *.cpp) xform=cpp ;;
7928c9fbc29Smrg    *.cxx) xform=cxx ;;
7934e411241Smrg    *.[fF][09]?) xform=[fF][09]. ;;
7948c9fbc29Smrg    *.for) xform=for ;;
7958c9fbc29Smrg    *.java) xform=java ;;
7964e411241Smrg    *.obj) xform=obj ;;
7974e411241Smrg    *.sx) xform=sx ;;
7988c9fbc29Smrg    esac
7998c9fbc29Smrg
8008c9fbc29Smrg    libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
8018c9fbc29Smrg
8028c9fbc29Smrg    case $libobj in
8038c9fbc29Smrg    *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
8048c9fbc29Smrg    *)
8058c9fbc29Smrg      $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
8068c9fbc29Smrg      exit $EXIT_FAILURE
8078c9fbc29Smrg      ;;
8088c9fbc29Smrg    esac
8098c9fbc29Smrg
8108c9fbc29Smrg    func_infer_tag $base_compile
8118c9fbc29Smrg
8128c9fbc29Smrg    for arg in $later; do
8138c9fbc29Smrg      case $arg in
8148c9fbc29Smrg      -static)
8158c9fbc29Smrg	build_old_libs=yes
8168c9fbc29Smrg	continue
8178c9fbc29Smrg	;;
8188c9fbc29Smrg
8198c9fbc29Smrg      -prefer-pic)
8208c9fbc29Smrg	pic_mode=yes
8218c9fbc29Smrg	continue
8228c9fbc29Smrg	;;
8238c9fbc29Smrg
8248c9fbc29Smrg      -prefer-non-pic)
8258c9fbc29Smrg	pic_mode=no
8268c9fbc29Smrg	continue
8278c9fbc29Smrg	;;
8288c9fbc29Smrg      esac
8298c9fbc29Smrg    done
8308c9fbc29Smrg
8318c9fbc29Smrg    qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
8328c9fbc29Smrg    case $qlibobj in
8338c9fbc29Smrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
8348c9fbc29Smrg	qlibobj="\"$qlibobj\"" ;;
8358c9fbc29Smrg    esac
8368c9fbc29Smrg    test "X$libobj" != "X$qlibobj" \
8378c9fbc29Smrg	&& $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' 	&()|`$[]' \
8388c9fbc29Smrg	&& $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
8398c9fbc29Smrg    objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
8408c9fbc29Smrg    xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
8418c9fbc29Smrg    if test "X$xdir" = "X$obj"; then
8428c9fbc29Smrg      xdir=
8438c9fbc29Smrg    else
8448c9fbc29Smrg      xdir=$xdir/
8458c9fbc29Smrg    fi
8468c9fbc29Smrg    lobj=${xdir}$objdir/$objname
8478c9fbc29Smrg
8488c9fbc29Smrg    if test -z "$base_compile"; then
8498c9fbc29Smrg      $echo "$modename: you must specify a compilation command" 1>&2
8508c9fbc29Smrg      $echo "$help" 1>&2
8518c9fbc29Smrg      exit $EXIT_FAILURE
8528c9fbc29Smrg    fi
8538c9fbc29Smrg
8548c9fbc29Smrg    # Delete any leftover library objects.
8558c9fbc29Smrg    if test "$build_old_libs" = yes; then
8568c9fbc29Smrg      removelist="$obj $lobj $libobj ${libobj}T"
8578c9fbc29Smrg    else
8588c9fbc29Smrg      removelist="$lobj $libobj ${libobj}T"
8598c9fbc29Smrg    fi
8608c9fbc29Smrg
8618c9fbc29Smrg    $run $rm $removelist
8628c9fbc29Smrg    trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
8638c9fbc29Smrg
8648c9fbc29Smrg    # On Cygwin there's no "real" PIC flag so we must build both object types
8658c9fbc29Smrg    case $host_os in
8668c9fbc29Smrg    cygwin* | mingw* | pw32* | os2*)
8678c9fbc29Smrg      pic_mode=default
8688c9fbc29Smrg      ;;
8698c9fbc29Smrg    esac
8708c9fbc29Smrg    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
8718c9fbc29Smrg      # non-PIC code in shared libraries is not supported
8728c9fbc29Smrg      pic_mode=default
8738c9fbc29Smrg    fi
8748c9fbc29Smrg
8758c9fbc29Smrg    # Calculate the filename of the output object if compiler does
8768c9fbc29Smrg    # not support -o with -c
8778c9fbc29Smrg    if test "$compiler_c_o" = no; then
8788c9fbc29Smrg      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
8798c9fbc29Smrg      lockfile="$output_obj.lock"
8808c9fbc29Smrg      removelist="$removelist $output_obj $lockfile"
8818c9fbc29Smrg      trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
8828c9fbc29Smrg    else
8838c9fbc29Smrg      output_obj=
8848c9fbc29Smrg      need_locks=no
8858c9fbc29Smrg      lockfile=
8868c9fbc29Smrg    fi
8878c9fbc29Smrg
8888c9fbc29Smrg    # Lock this critical section if it is needed
8898c9fbc29Smrg    # We use this script file to make the link, it avoids creating a new file
8908c9fbc29Smrg    if test "$need_locks" = yes; then
8918c9fbc29Smrg      until $run ln "$progpath" "$lockfile" 2>/dev/null; do
8928c9fbc29Smrg	$show "Waiting for $lockfile to be removed"
8938c9fbc29Smrg	sleep 2
8948c9fbc29Smrg      done
8958c9fbc29Smrg    elif test "$need_locks" = warn; then
8968c9fbc29Smrg      if test -f "$lockfile"; then
8978c9fbc29Smrg	$echo "\
8988c9fbc29Smrg*** ERROR, $lockfile exists and contains:
8998c9fbc29Smrg`cat $lockfile 2>/dev/null`
9008c9fbc29Smrg
9018c9fbc29SmrgThis indicates that another process is trying to use the same
9028c9fbc29Smrgtemporary object file, and libtool could not work around it because
9038c9fbc29Smrgyour compiler does not support \`-c' and \`-o' together.  If you
9048c9fbc29Smrgrepeat this compilation, it may succeed, by chance, but you had better
9058c9fbc29Smrgavoid parallel builds (make -j) in this platform, or get a better
9068c9fbc29Smrgcompiler."
9078c9fbc29Smrg
9088c9fbc29Smrg	$run $rm $removelist
9098c9fbc29Smrg	exit $EXIT_FAILURE
9108c9fbc29Smrg      fi
9118c9fbc29Smrg      $echo "$srcfile" > "$lockfile"
9128c9fbc29Smrg    fi
9138c9fbc29Smrg
9148c9fbc29Smrg    if test -n "$fix_srcfile_path"; then
9158c9fbc29Smrg      eval srcfile=\"$fix_srcfile_path\"
9168c9fbc29Smrg    fi
9178c9fbc29Smrg    qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
9188c9fbc29Smrg    case $qsrcfile in
9198c9fbc29Smrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
9208c9fbc29Smrg      qsrcfile="\"$qsrcfile\"" ;;
9218c9fbc29Smrg    esac
9228c9fbc29Smrg
9238c9fbc29Smrg    $run $rm "$libobj" "${libobj}T"
9248c9fbc29Smrg
9258c9fbc29Smrg    # Create a libtool object file (analogous to a ".la" file),
9268c9fbc29Smrg    # but don't create it if we're doing a dry run.
9278c9fbc29Smrg    test -z "$run" && cat > ${libobj}T <<EOF
9288c9fbc29Smrg# $libobj - a libtool object file
9298c9fbc29Smrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
9308c9fbc29Smrg#
9318c9fbc29Smrg# Please DO NOT delete this file!
9328c9fbc29Smrg# It is necessary for linking the library.
9338c9fbc29Smrg
9348c9fbc29Smrg# Name of the PIC object.
9358c9fbc29SmrgEOF
9368c9fbc29Smrg
9378c9fbc29Smrg    # Only build a PIC object if we are building libtool libraries.
9388c9fbc29Smrg    if test "$build_libtool_libs" = yes; then
9398c9fbc29Smrg      # Without this assignment, base_compile gets emptied.
9408c9fbc29Smrg      fbsd_hideous_sh_bug=$base_compile
9418c9fbc29Smrg
9428c9fbc29Smrg      if test "$pic_mode" != no; then
9438c9fbc29Smrg	command="$base_compile $qsrcfile $pic_flag"
9448c9fbc29Smrg      else
9458c9fbc29Smrg	# Don't build PIC code
9468c9fbc29Smrg	command="$base_compile $qsrcfile"
9478c9fbc29Smrg      fi
9488c9fbc29Smrg
9498c9fbc29Smrg      if test ! -d "${xdir}$objdir"; then
9508c9fbc29Smrg	$show "$mkdir ${xdir}$objdir"
9518c9fbc29Smrg	$run $mkdir ${xdir}$objdir
9528c9fbc29Smrg	exit_status=$?
9538c9fbc29Smrg	if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
9548c9fbc29Smrg	  exit $exit_status
9558c9fbc29Smrg	fi
9568c9fbc29Smrg      fi
9578c9fbc29Smrg
9588c9fbc29Smrg      if test -z "$output_obj"; then
9598c9fbc29Smrg	# Place PIC objects in $objdir
9608c9fbc29Smrg	command="$command -o $lobj"
9618c9fbc29Smrg      fi
9628c9fbc29Smrg
9638c9fbc29Smrg      $run $rm "$lobj" "$output_obj"
9648c9fbc29Smrg
9658c9fbc29Smrg      $show "$command"
9664e411241Smrg      if $run eval $lt_env "$command"; then :
9678c9fbc29Smrg      else
9688c9fbc29Smrg	test -n "$output_obj" && $run $rm $removelist
9698c9fbc29Smrg	exit $EXIT_FAILURE
9708c9fbc29Smrg      fi
9718c9fbc29Smrg
9728c9fbc29Smrg      if test "$need_locks" = warn &&
9738c9fbc29Smrg	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
9748c9fbc29Smrg	$echo "\
9758c9fbc29Smrg*** ERROR, $lockfile contains:
9768c9fbc29Smrg`cat $lockfile 2>/dev/null`
9778c9fbc29Smrg
9788c9fbc29Smrgbut it should contain:
9798c9fbc29Smrg$srcfile
9808c9fbc29Smrg
9818c9fbc29SmrgThis indicates that another process is trying to use the same
9828c9fbc29Smrgtemporary object file, and libtool could not work around it because
9838c9fbc29Smrgyour compiler does not support \`-c' and \`-o' together.  If you
9848c9fbc29Smrgrepeat this compilation, it may succeed, by chance, but you had better
9858c9fbc29Smrgavoid parallel builds (make -j) in this platform, or get a better
9868c9fbc29Smrgcompiler."
9878c9fbc29Smrg
9888c9fbc29Smrg	$run $rm $removelist
9898c9fbc29Smrg	exit $EXIT_FAILURE
9908c9fbc29Smrg      fi
9918c9fbc29Smrg
9928c9fbc29Smrg      # Just move the object if needed, then go on to compile the next one
9938c9fbc29Smrg      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
9948c9fbc29Smrg	$show "$mv $output_obj $lobj"
9958c9fbc29Smrg	if $run $mv $output_obj $lobj; then :
9968c9fbc29Smrg	else
9978c9fbc29Smrg	  error=$?
9988c9fbc29Smrg	  $run $rm $removelist
9998c9fbc29Smrg	  exit $error
10008c9fbc29Smrg	fi
10018c9fbc29Smrg      fi
10028c9fbc29Smrg
10038c9fbc29Smrg      # Append the name of the PIC object to the libtool object file.
10048c9fbc29Smrg      test -z "$run" && cat >> ${libobj}T <<EOF
10058c9fbc29Smrgpic_object='$objdir/$objname'
10068c9fbc29Smrg
10078c9fbc29SmrgEOF
10088c9fbc29Smrg
10098c9fbc29Smrg      # Allow error messages only from the first compilation.
10108c9fbc29Smrg      if test "$suppress_opt" = yes; then
10118c9fbc29Smrg        suppress_output=' >/dev/null 2>&1'
10128c9fbc29Smrg      fi
10138c9fbc29Smrg    else
10148c9fbc29Smrg      # No PIC object so indicate it doesn't exist in the libtool
10158c9fbc29Smrg      # object file.
10168c9fbc29Smrg      test -z "$run" && cat >> ${libobj}T <<EOF
10178c9fbc29Smrgpic_object=none
10188c9fbc29Smrg
10198c9fbc29SmrgEOF
10208c9fbc29Smrg    fi
10218c9fbc29Smrg
10228c9fbc29Smrg    # Only build a position-dependent object if we build old libraries.
10238c9fbc29Smrg    if test "$build_old_libs" = yes; then
10248c9fbc29Smrg      if test "$pic_mode" != yes; then
10258c9fbc29Smrg	# Don't build PIC code
10268c9fbc29Smrg	command="$base_compile $qsrcfile"
10278c9fbc29Smrg      else
10288c9fbc29Smrg	command="$base_compile $qsrcfile $pic_flag"
10298c9fbc29Smrg      fi
10308c9fbc29Smrg      if test "$compiler_c_o" = yes; then
10318c9fbc29Smrg	command="$command -o $obj"
10328c9fbc29Smrg      fi
10338c9fbc29Smrg
10348c9fbc29Smrg      # Suppress compiler output if we already did a PIC compilation.
10358c9fbc29Smrg      command="$command$suppress_output"
10368c9fbc29Smrg      $run $rm "$obj" "$output_obj"
10378c9fbc29Smrg      $show "$command"
10384e411241Smrg      if $run eval $lt_env "$command"; then :
10398c9fbc29Smrg      else
10408c9fbc29Smrg	$run $rm $removelist
10418c9fbc29Smrg	exit $EXIT_FAILURE
10428c9fbc29Smrg      fi
10438c9fbc29Smrg
10448c9fbc29Smrg      if test "$need_locks" = warn &&
10458c9fbc29Smrg	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
10468c9fbc29Smrg	$echo "\
10478c9fbc29Smrg*** ERROR, $lockfile contains:
10488c9fbc29Smrg`cat $lockfile 2>/dev/null`
10498c9fbc29Smrg
10508c9fbc29Smrgbut it should contain:
10518c9fbc29Smrg$srcfile
10528c9fbc29Smrg
10538c9fbc29SmrgThis indicates that another process is trying to use the same
10548c9fbc29Smrgtemporary object file, and libtool could not work around it because
10558c9fbc29Smrgyour compiler does not support \`-c' and \`-o' together.  If you
10568c9fbc29Smrgrepeat this compilation, it may succeed, by chance, but you had better
10578c9fbc29Smrgavoid parallel builds (make -j) in this platform, or get a better
10588c9fbc29Smrgcompiler."
10598c9fbc29Smrg
10608c9fbc29Smrg	$run $rm $removelist
10618c9fbc29Smrg	exit $EXIT_FAILURE
10628c9fbc29Smrg      fi
10638c9fbc29Smrg
10648c9fbc29Smrg      # Just move the object if needed
10658c9fbc29Smrg      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
10668c9fbc29Smrg	$show "$mv $output_obj $obj"
10678c9fbc29Smrg	if $run $mv $output_obj $obj; then :
10688c9fbc29Smrg	else
10698c9fbc29Smrg	  error=$?
10708c9fbc29Smrg	  $run $rm $removelist
10718c9fbc29Smrg	  exit $error
10728c9fbc29Smrg	fi
10738c9fbc29Smrg      fi
10748c9fbc29Smrg
10758c9fbc29Smrg      # Append the name of the non-PIC object the libtool object file.
10768c9fbc29Smrg      # Only append if the libtool object file exists.
10778c9fbc29Smrg      test -z "$run" && cat >> ${libobj}T <<EOF
10788c9fbc29Smrg# Name of the non-PIC object.
10798c9fbc29Smrgnon_pic_object='$objname'
10808c9fbc29Smrg
10818c9fbc29SmrgEOF
10828c9fbc29Smrg    else
10838c9fbc29Smrg      # Append the name of the non-PIC object the libtool object file.
10848c9fbc29Smrg      # Only append if the libtool object file exists.
10858c9fbc29Smrg      test -z "$run" && cat >> ${libobj}T <<EOF
10868c9fbc29Smrg# Name of the non-PIC object.
10878c9fbc29Smrgnon_pic_object=none
10888c9fbc29Smrg
10898c9fbc29SmrgEOF
10908c9fbc29Smrg    fi
10918c9fbc29Smrg
10928c9fbc29Smrg    $run $mv "${libobj}T" "${libobj}"
10938c9fbc29Smrg
10948c9fbc29Smrg    # Unlock the critical section if it was locked
10958c9fbc29Smrg    if test "$need_locks" != no; then
10968c9fbc29Smrg      $run $rm "$lockfile"
10978c9fbc29Smrg    fi
10988c9fbc29Smrg
10998c9fbc29Smrg    exit $EXIT_SUCCESS
11008c9fbc29Smrg    ;;
11018c9fbc29Smrg
11028c9fbc29Smrg  # libtool link mode
11038c9fbc29Smrg  link | relink)
11048c9fbc29Smrg    modename="$modename: link"
11058c9fbc29Smrg    case $host in
11068c9fbc29Smrg    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
11078c9fbc29Smrg      # It is impossible to link a dll without this setting, and
11088c9fbc29Smrg      # we shouldn't force the makefile maintainer to figure out
11098c9fbc29Smrg      # which system we are compiling for in order to pass an extra
11108c9fbc29Smrg      # flag for every libtool invocation.
11118c9fbc29Smrg      # allow_undefined=no
11128c9fbc29Smrg
11138c9fbc29Smrg      # FIXME: Unfortunately, there are problems with the above when trying
11148c9fbc29Smrg      # to make a dll which has undefined symbols, in which case not
11158c9fbc29Smrg      # even a static library is built.  For now, we need to specify
11168c9fbc29Smrg      # -no-undefined on the libtool link line when we can be certain
11178c9fbc29Smrg      # that all symbols are satisfied, otherwise we get a static library.
11188c9fbc29Smrg      allow_undefined=yes
11198c9fbc29Smrg      ;;
11208c9fbc29Smrg    *)
11218c9fbc29Smrg      allow_undefined=yes
11228c9fbc29Smrg      ;;
11238c9fbc29Smrg    esac
11248c9fbc29Smrg    libtool_args="$nonopt"
11258c9fbc29Smrg    base_compile="$nonopt $@"
11268c9fbc29Smrg    compile_command="$nonopt"
11278c9fbc29Smrg    finalize_command="$nonopt"
11288c9fbc29Smrg
11298c9fbc29Smrg    compile_rpath=
11308c9fbc29Smrg    finalize_rpath=
11318c9fbc29Smrg    compile_shlibpath=
11328c9fbc29Smrg    finalize_shlibpath=
11338c9fbc29Smrg    convenience=
11348c9fbc29Smrg    old_convenience=
11358c9fbc29Smrg    deplibs=
11368c9fbc29Smrg    old_deplibs=
11378c9fbc29Smrg    compiler_flags=
11388c9fbc29Smrg    linker_flags=
11398c9fbc29Smrg    dllsearchpath=
11408c9fbc29Smrg    lib_search_path=`pwd`
11418c9fbc29Smrg    inst_prefix_dir=
11428c9fbc29Smrg
11438c9fbc29Smrg    avoid_version=no
11448c9fbc29Smrg    dlfiles=
11458c9fbc29Smrg    dlprefiles=
11468c9fbc29Smrg    dlself=no
11478c9fbc29Smrg    export_dynamic=no
11488c9fbc29Smrg    export_symbols=
11498c9fbc29Smrg    export_symbols_regex=
11508c9fbc29Smrg    generated=
11518c9fbc29Smrg    libobjs=
11528c9fbc29Smrg    ltlibs=
11538c9fbc29Smrg    module=no
11548c9fbc29Smrg    no_install=no
11558c9fbc29Smrg    objs=
11568c9fbc29Smrg    non_pic_objects=
11578c9fbc29Smrg    notinst_path= # paths that contain not-installed libtool libraries
11588c9fbc29Smrg    precious_files_regex=
11598c9fbc29Smrg    prefer_static_libs=no
11608c9fbc29Smrg    preload=no
11618c9fbc29Smrg    prev=
11628c9fbc29Smrg    prevarg=
11638c9fbc29Smrg    release=
11648c9fbc29Smrg    rpath=
11658c9fbc29Smrg    xrpath=
11668c9fbc29Smrg    perm_rpath=
11678c9fbc29Smrg    temp_rpath=
11688c9fbc29Smrg    thread_safe=no
11698c9fbc29Smrg    vinfo=
11708c9fbc29Smrg    vinfo_number=no
11714e411241Smrg    single_module="${wl}-single_module"
11728c9fbc29Smrg
11738c9fbc29Smrg    func_infer_tag $base_compile
11748c9fbc29Smrg
11758c9fbc29Smrg    # We need to know -static, to get the right output filenames.
11768c9fbc29Smrg    for arg
11778c9fbc29Smrg    do
11788c9fbc29Smrg      case $arg in
11794e411241Smrg      -all-static | -static | -static-libtool-libs)
11804e411241Smrg	case $arg in
11814e411241Smrg	-all-static)
11828c9fbc29Smrg	  if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
11838c9fbc29Smrg	    $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
11848c9fbc29Smrg	  fi
11858c9fbc29Smrg	  if test -n "$link_static_flag"; then
11868c9fbc29Smrg	    dlopen_self=$dlopen_self_static
11878c9fbc29Smrg	  fi
11888c9fbc29Smrg	  prefer_static_libs=yes
11894e411241Smrg	  ;;
11904e411241Smrg	-static)
11918c9fbc29Smrg	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
11928c9fbc29Smrg	    dlopen_self=$dlopen_self_static
11938c9fbc29Smrg	  fi
11948c9fbc29Smrg	  prefer_static_libs=built
11954e411241Smrg	  ;;
11964e411241Smrg	-static-libtool-libs)
11974e411241Smrg	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
11984e411241Smrg	    dlopen_self=$dlopen_self_static
11994e411241Smrg	  fi
12004e411241Smrg	  prefer_static_libs=yes
12014e411241Smrg	  ;;
12024e411241Smrg	esac
12038c9fbc29Smrg	build_libtool_libs=no
12048c9fbc29Smrg	build_old_libs=yes
12058c9fbc29Smrg	break
12068c9fbc29Smrg	;;
12078c9fbc29Smrg      esac
12088c9fbc29Smrg    done
12098c9fbc29Smrg
12108c9fbc29Smrg    # See if our shared archives depend on static archives.
12118c9fbc29Smrg    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
12128c9fbc29Smrg
12138c9fbc29Smrg    # Go through the arguments, transforming them on the way.
12148c9fbc29Smrg    while test "$#" -gt 0; do
12158c9fbc29Smrg      arg="$1"
12168c9fbc29Smrg      shift
12178c9fbc29Smrg      case $arg in
12188c9fbc29Smrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
12198c9fbc29Smrg	qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
12208c9fbc29Smrg	;;
12218c9fbc29Smrg      *) qarg=$arg ;;
12228c9fbc29Smrg      esac
12238c9fbc29Smrg      libtool_args="$libtool_args $qarg"
12248c9fbc29Smrg
12258c9fbc29Smrg      # If the previous option needs an argument, assign it.
12268c9fbc29Smrg      if test -n "$prev"; then
12278c9fbc29Smrg	case $prev in
12288c9fbc29Smrg	output)
12298c9fbc29Smrg	  compile_command="$compile_command @OUTPUT@"
12308c9fbc29Smrg	  finalize_command="$finalize_command @OUTPUT@"
12318c9fbc29Smrg	  ;;
12328c9fbc29Smrg	esac
12338c9fbc29Smrg
12348c9fbc29Smrg	case $prev in
12358c9fbc29Smrg	dlfiles|dlprefiles)
12368c9fbc29Smrg	  if test "$preload" = no; then
12378c9fbc29Smrg	    # Add the symbol object into the linking commands.
12388c9fbc29Smrg	    compile_command="$compile_command @SYMFILE@"
12398c9fbc29Smrg	    finalize_command="$finalize_command @SYMFILE@"
12408c9fbc29Smrg	    preload=yes
12418c9fbc29Smrg	  fi
12428c9fbc29Smrg	  case $arg in
12438c9fbc29Smrg	  *.la | *.lo) ;;  # We handle these cases below.
12448c9fbc29Smrg	  force)
12458c9fbc29Smrg	    if test "$dlself" = no; then
12468c9fbc29Smrg	      dlself=needless
12478c9fbc29Smrg	      export_dynamic=yes
12488c9fbc29Smrg	    fi
12498c9fbc29Smrg	    prev=
12508c9fbc29Smrg	    continue
12518c9fbc29Smrg	    ;;
12528c9fbc29Smrg	  self)
12538c9fbc29Smrg	    if test "$prev" = dlprefiles; then
12548c9fbc29Smrg	      dlself=yes
12558c9fbc29Smrg	    elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
12568c9fbc29Smrg	      dlself=yes
12578c9fbc29Smrg	    else
12588c9fbc29Smrg	      dlself=needless
12598c9fbc29Smrg	      export_dynamic=yes
12608c9fbc29Smrg	    fi
12618c9fbc29Smrg	    prev=
12628c9fbc29Smrg	    continue
12638c9fbc29Smrg	    ;;
12648c9fbc29Smrg	  *)
12658c9fbc29Smrg	    if test "$prev" = dlfiles; then
12668c9fbc29Smrg	      dlfiles="$dlfiles $arg"
12678c9fbc29Smrg	    else
12688c9fbc29Smrg	      dlprefiles="$dlprefiles $arg"
12698c9fbc29Smrg	    fi
12708c9fbc29Smrg	    prev=
12718c9fbc29Smrg	    continue
12728c9fbc29Smrg	    ;;
12738c9fbc29Smrg	  esac
12748c9fbc29Smrg	  ;;
12758c9fbc29Smrg	expsyms)
12768c9fbc29Smrg	  export_symbols="$arg"
12778c9fbc29Smrg	  if test ! -f "$arg"; then
12788c9fbc29Smrg	    $echo "$modename: symbol file \`$arg' does not exist"
12798c9fbc29Smrg	    exit $EXIT_FAILURE
12808c9fbc29Smrg	  fi
12818c9fbc29Smrg	  prev=
12828c9fbc29Smrg	  continue
12838c9fbc29Smrg	  ;;
12848c9fbc29Smrg	expsyms_regex)
12858c9fbc29Smrg	  export_symbols_regex="$arg"
12868c9fbc29Smrg	  prev=
12878c9fbc29Smrg	  continue
12888c9fbc29Smrg	  ;;
12898c9fbc29Smrg	inst_prefix)
12908c9fbc29Smrg	  inst_prefix_dir="$arg"
12918c9fbc29Smrg	  prev=
12928c9fbc29Smrg	  continue
12938c9fbc29Smrg	  ;;
12948c9fbc29Smrg	precious_regex)
12958c9fbc29Smrg	  precious_files_regex="$arg"
12968c9fbc29Smrg	  prev=
12978c9fbc29Smrg	  continue
12988c9fbc29Smrg	  ;;
12998c9fbc29Smrg	release)
13008c9fbc29Smrg	  release="-$arg"
13018c9fbc29Smrg	  prev=
13028c9fbc29Smrg	  continue
13038c9fbc29Smrg	  ;;
13048c9fbc29Smrg	objectlist)
13058c9fbc29Smrg	  if test -f "$arg"; then
13068c9fbc29Smrg	    save_arg=$arg
13078c9fbc29Smrg	    moreargs=
13088c9fbc29Smrg	    for fil in `cat $save_arg`
13098c9fbc29Smrg	    do
13108c9fbc29Smrg#	      moreargs="$moreargs $fil"
13118c9fbc29Smrg	      arg=$fil
13128c9fbc29Smrg	      # A libtool-controlled object.
13138c9fbc29Smrg
13148c9fbc29Smrg	      # Check to see that this really is a libtool object.
13158c9fbc29Smrg	      if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
13168c9fbc29Smrg		pic_object=
13178c9fbc29Smrg		non_pic_object=
13188c9fbc29Smrg
13198c9fbc29Smrg		# Read the .lo file
13208c9fbc29Smrg		# If there is no directory component, then add one.
13218c9fbc29Smrg		case $arg in
13228c9fbc29Smrg		*/* | *\\*) . $arg ;;
13238c9fbc29Smrg		*) . ./$arg ;;
13248c9fbc29Smrg		esac
13258c9fbc29Smrg
13268c9fbc29Smrg		if test -z "$pic_object" || \
13278c9fbc29Smrg		   test -z "$non_pic_object" ||
13288c9fbc29Smrg		   test "$pic_object" = none && \
13298c9fbc29Smrg		   test "$non_pic_object" = none; then
13308c9fbc29Smrg		  $echo "$modename: cannot find name of object for \`$arg'" 1>&2
13318c9fbc29Smrg		  exit $EXIT_FAILURE
13328c9fbc29Smrg		fi
13338c9fbc29Smrg
13348c9fbc29Smrg		# Extract subdirectory from the argument.
13358c9fbc29Smrg		xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
13368c9fbc29Smrg		if test "X$xdir" = "X$arg"; then
13378c9fbc29Smrg		  xdir=
13388c9fbc29Smrg		else
13398c9fbc29Smrg		  xdir="$xdir/"
13408c9fbc29Smrg		fi
13418c9fbc29Smrg
13428c9fbc29Smrg		if test "$pic_object" != none; then
13438c9fbc29Smrg		  # Prepend the subdirectory the object is found in.
13448c9fbc29Smrg		  pic_object="$xdir$pic_object"
13458c9fbc29Smrg
13468c9fbc29Smrg		  if test "$prev" = dlfiles; then
13478c9fbc29Smrg		    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
13488c9fbc29Smrg		      dlfiles="$dlfiles $pic_object"
13498c9fbc29Smrg		      prev=
13508c9fbc29Smrg		      continue
13518c9fbc29Smrg		    else
13528c9fbc29Smrg		      # If libtool objects are unsupported, then we need to preload.
13538c9fbc29Smrg		      prev=dlprefiles
13548c9fbc29Smrg		    fi
13558c9fbc29Smrg		  fi
13568c9fbc29Smrg
13578c9fbc29Smrg		  # CHECK ME:  I think I busted this.  -Ossama
13588c9fbc29Smrg		  if test "$prev" = dlprefiles; then
13598c9fbc29Smrg		    # Preload the old-style object.
13608c9fbc29Smrg		    dlprefiles="$dlprefiles $pic_object"
13618c9fbc29Smrg		    prev=
13628c9fbc29Smrg		  fi
13638c9fbc29Smrg
13648c9fbc29Smrg		  # A PIC object.
13658c9fbc29Smrg		  libobjs="$libobjs $pic_object"
13668c9fbc29Smrg		  arg="$pic_object"
13678c9fbc29Smrg		fi
13688c9fbc29Smrg
13698c9fbc29Smrg		# Non-PIC object.
13708c9fbc29Smrg		if test "$non_pic_object" != none; then
13718c9fbc29Smrg		  # Prepend the subdirectory the object is found in.
13728c9fbc29Smrg		  non_pic_object="$xdir$non_pic_object"
13738c9fbc29Smrg
13748c9fbc29Smrg		  # A standard non-PIC object
13758c9fbc29Smrg		  non_pic_objects="$non_pic_objects $non_pic_object"
13768c9fbc29Smrg		  if test -z "$pic_object" || test "$pic_object" = none ; then
13778c9fbc29Smrg		    arg="$non_pic_object"
13788c9fbc29Smrg		  fi
13798c9fbc29Smrg		else
13808c9fbc29Smrg		  # If the PIC object exists, use it instead.
13818c9fbc29Smrg		  # $xdir was prepended to $pic_object above.
13828c9fbc29Smrg		  non_pic_object="$pic_object"
13838c9fbc29Smrg		  non_pic_objects="$non_pic_objects $non_pic_object"
13848c9fbc29Smrg		fi
13858c9fbc29Smrg	      else
13868c9fbc29Smrg		# Only an error if not doing a dry-run.
13878c9fbc29Smrg		if test -z "$run"; then
13888c9fbc29Smrg		  $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
13898c9fbc29Smrg		  exit $EXIT_FAILURE
13908c9fbc29Smrg		else
13918c9fbc29Smrg		  # Dry-run case.
13928c9fbc29Smrg
13938c9fbc29Smrg		  # Extract subdirectory from the argument.
13948c9fbc29Smrg		  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
13958c9fbc29Smrg		  if test "X$xdir" = "X$arg"; then
13968c9fbc29Smrg		    xdir=
13978c9fbc29Smrg		  else
13988c9fbc29Smrg		    xdir="$xdir/"
13998c9fbc29Smrg		  fi
14008c9fbc29Smrg
14018c9fbc29Smrg		  pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
14028c9fbc29Smrg		  non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
14038c9fbc29Smrg		  libobjs="$libobjs $pic_object"
14048c9fbc29Smrg		  non_pic_objects="$non_pic_objects $non_pic_object"
14058c9fbc29Smrg		fi
14068c9fbc29Smrg	      fi
14078c9fbc29Smrg	    done
14088c9fbc29Smrg	  else
14098c9fbc29Smrg	    $echo "$modename: link input file \`$save_arg' does not exist"
14108c9fbc29Smrg	    exit $EXIT_FAILURE
14118c9fbc29Smrg	  fi
14128c9fbc29Smrg	  arg=$save_arg
14138c9fbc29Smrg	  prev=
14148c9fbc29Smrg	  continue
14158c9fbc29Smrg	  ;;
14168c9fbc29Smrg	rpath | xrpath)
14178c9fbc29Smrg	  # We need an absolute path.
14188c9fbc29Smrg	  case $arg in
14198c9fbc29Smrg	  [\\/]* | [A-Za-z]:[\\/]*) ;;
14208c9fbc29Smrg	  *)
14218c9fbc29Smrg	    $echo "$modename: only absolute run-paths are allowed" 1>&2
14228c9fbc29Smrg	    exit $EXIT_FAILURE
14238c9fbc29Smrg	    ;;
14248c9fbc29Smrg	  esac
14258c9fbc29Smrg	  if test "$prev" = rpath; then
14268c9fbc29Smrg	    case "$rpath " in
14278c9fbc29Smrg	    *" $arg "*) ;;
14288c9fbc29Smrg	    *) rpath="$rpath $arg" ;;
14298c9fbc29Smrg	    esac
14308c9fbc29Smrg	  else
14318c9fbc29Smrg	    case "$xrpath " in
14328c9fbc29Smrg	    *" $arg "*) ;;
14338c9fbc29Smrg	    *) xrpath="$xrpath $arg" ;;
14348c9fbc29Smrg	    esac
14358c9fbc29Smrg	  fi
14368c9fbc29Smrg	  prev=
14378c9fbc29Smrg	  continue
14388c9fbc29Smrg	  ;;
14398c9fbc29Smrg	xcompiler)
14408c9fbc29Smrg	  compiler_flags="$compiler_flags $qarg"
14418c9fbc29Smrg	  prev=
14428c9fbc29Smrg	  compile_command="$compile_command $qarg"
14438c9fbc29Smrg	  finalize_command="$finalize_command $qarg"
14448c9fbc29Smrg	  continue
14458c9fbc29Smrg	  ;;
14468c9fbc29Smrg	xlinker)
14478c9fbc29Smrg	  linker_flags="$linker_flags $qarg"
14488c9fbc29Smrg	  compiler_flags="$compiler_flags $wl$qarg"
14498c9fbc29Smrg	  prev=
14508c9fbc29Smrg	  compile_command="$compile_command $wl$qarg"
14518c9fbc29Smrg	  finalize_command="$finalize_command $wl$qarg"
14528c9fbc29Smrg	  continue
14538c9fbc29Smrg	  ;;
14548c9fbc29Smrg	xcclinker)
14558c9fbc29Smrg	  linker_flags="$linker_flags $qarg"
14568c9fbc29Smrg	  compiler_flags="$compiler_flags $qarg"
14578c9fbc29Smrg	  prev=
14588c9fbc29Smrg	  compile_command="$compile_command $qarg"
14598c9fbc29Smrg	  finalize_command="$finalize_command $qarg"
14608c9fbc29Smrg	  continue
14618c9fbc29Smrg	  ;;
14628c9fbc29Smrg	shrext)
14638c9fbc29Smrg  	  shrext_cmds="$arg"
14648c9fbc29Smrg	  prev=
14658c9fbc29Smrg	  continue
14668c9fbc29Smrg	  ;;
14678c9fbc29Smrg	darwin_framework|darwin_framework_skip)
14688c9fbc29Smrg	  test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
14698c9fbc29Smrg	  compile_command="$compile_command $arg"
14708c9fbc29Smrg	  finalize_command="$finalize_command $arg"
14718c9fbc29Smrg	  prev=
14728c9fbc29Smrg	  continue
14738c9fbc29Smrg	  ;;
14748c9fbc29Smrg	*)
14758c9fbc29Smrg	  eval "$prev=\"\$arg\""
14768c9fbc29Smrg	  prev=
14778c9fbc29Smrg	  continue
14788c9fbc29Smrg	  ;;
14798c9fbc29Smrg	esac
14808c9fbc29Smrg      fi # test -n "$prev"
14818c9fbc29Smrg
14828c9fbc29Smrg      prevarg="$arg"
14838c9fbc29Smrg
14848c9fbc29Smrg      case $arg in
14858c9fbc29Smrg      -all-static)
14868c9fbc29Smrg	if test -n "$link_static_flag"; then
14878c9fbc29Smrg	  compile_command="$compile_command $link_static_flag"
14888c9fbc29Smrg	  finalize_command="$finalize_command $link_static_flag"
14898c9fbc29Smrg	fi
14908c9fbc29Smrg	continue
14918c9fbc29Smrg	;;
14928c9fbc29Smrg
14938c9fbc29Smrg      -allow-undefined)
14948c9fbc29Smrg	# FIXME: remove this flag sometime in the future.
14958c9fbc29Smrg	$echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
14968c9fbc29Smrg	continue
14978c9fbc29Smrg	;;
14988c9fbc29Smrg
14998c9fbc29Smrg      -avoid-version)
15008c9fbc29Smrg	avoid_version=yes
15018c9fbc29Smrg	continue
15028c9fbc29Smrg	;;
15038c9fbc29Smrg
15048c9fbc29Smrg      -dlopen)
15058c9fbc29Smrg	prev=dlfiles
15068c9fbc29Smrg	continue
15078c9fbc29Smrg	;;
15088c9fbc29Smrg
15098c9fbc29Smrg      -dlpreopen)
15108c9fbc29Smrg	prev=dlprefiles
15118c9fbc29Smrg	continue
15128c9fbc29Smrg	;;
15138c9fbc29Smrg
15148c9fbc29Smrg      -export-dynamic)
15158c9fbc29Smrg	export_dynamic=yes
15168c9fbc29Smrg	continue
15178c9fbc29Smrg	;;
15188c9fbc29Smrg
15198c9fbc29Smrg      -export-symbols | -export-symbols-regex)
15208c9fbc29Smrg	if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
15218c9fbc29Smrg	  $echo "$modename: more than one -exported-symbols argument is not allowed"
15228c9fbc29Smrg	  exit $EXIT_FAILURE
15238c9fbc29Smrg	fi
15248c9fbc29Smrg	if test "X$arg" = "X-export-symbols"; then
15258c9fbc29Smrg	  prev=expsyms
15268c9fbc29Smrg	else
15278c9fbc29Smrg	  prev=expsyms_regex
15288c9fbc29Smrg	fi
15298c9fbc29Smrg	continue
15308c9fbc29Smrg	;;
15318c9fbc29Smrg
15328c9fbc29Smrg      -framework|-arch|-isysroot)
15338c9fbc29Smrg	case " $CC " in
15348c9fbc29Smrg	  *" ${arg} ${1} "* | *" ${arg}	${1} "*) 
15358c9fbc29Smrg		prev=darwin_framework_skip ;;
15368c9fbc29Smrg	  *) compiler_flags="$compiler_flags $arg"
15378c9fbc29Smrg	     prev=darwin_framework ;;
15388c9fbc29Smrg	esac
15398c9fbc29Smrg	compile_command="$compile_command $arg"
15408c9fbc29Smrg	finalize_command="$finalize_command $arg"
15418c9fbc29Smrg	continue
15428c9fbc29Smrg	;;
15438c9fbc29Smrg
15448c9fbc29Smrg      -inst-prefix-dir)
15458c9fbc29Smrg	prev=inst_prefix
15468c9fbc29Smrg	continue
15478c9fbc29Smrg	;;
15488c9fbc29Smrg
15498c9fbc29Smrg      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
15508c9fbc29Smrg      # so, if we see these flags be careful not to treat them like -L
15518c9fbc29Smrg      -L[A-Z][A-Z]*:*)
15528c9fbc29Smrg	case $with_gcc/$host in
15538c9fbc29Smrg	no/*-*-irix* | /*-*-irix*)
15548c9fbc29Smrg	  compile_command="$compile_command $arg"
15558c9fbc29Smrg	  finalize_command="$finalize_command $arg"
15568c9fbc29Smrg	  ;;
15578c9fbc29Smrg	esac
15588c9fbc29Smrg	continue
15598c9fbc29Smrg	;;
15608c9fbc29Smrg
15618c9fbc29Smrg      -L*)
15628c9fbc29Smrg	dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
15638c9fbc29Smrg	# We need an absolute path.
15648c9fbc29Smrg	case $dir in
15658c9fbc29Smrg	[\\/]* | [A-Za-z]:[\\/]*) ;;
15668c9fbc29Smrg	*)
15678c9fbc29Smrg	  absdir=`cd "$dir" && pwd`
15688c9fbc29Smrg	  if test -z "$absdir"; then
15698c9fbc29Smrg	    $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
15708c9fbc29Smrg	    absdir="$dir"
15718c9fbc29Smrg	    notinst_path="$notinst_path $dir"
15728c9fbc29Smrg	  fi
15738c9fbc29Smrg	  dir="$absdir"
15748c9fbc29Smrg	  ;;
15758c9fbc29Smrg	esac
15768c9fbc29Smrg	case "$deplibs " in
15778c9fbc29Smrg	*" -L$dir "*) ;;
15788c9fbc29Smrg	*)
15798c9fbc29Smrg	  deplibs="$deplibs -L$dir"
15808c9fbc29Smrg	  lib_search_path="$lib_search_path $dir"
15818c9fbc29Smrg	  ;;
15828c9fbc29Smrg	esac
15838c9fbc29Smrg	case $host in
15848c9fbc29Smrg	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
15858c9fbc29Smrg	  testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
15868c9fbc29Smrg	  case :$dllsearchpath: in
15878c9fbc29Smrg	  *":$dir:"*) ;;
15888c9fbc29Smrg	  *) dllsearchpath="$dllsearchpath:$dir";;
15898c9fbc29Smrg	  esac
15908c9fbc29Smrg	  case :$dllsearchpath: in
15918c9fbc29Smrg	  *":$testbindir:"*) ;;
15928c9fbc29Smrg	  *) dllsearchpath="$dllsearchpath:$testbindir";;
15938c9fbc29Smrg	  esac
15948c9fbc29Smrg	  ;;
15958c9fbc29Smrg	esac
15968c9fbc29Smrg	continue
15978c9fbc29Smrg	;;
15988c9fbc29Smrg
15998c9fbc29Smrg      -l*)
16008c9fbc29Smrg	if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
16018c9fbc29Smrg	  case $host in
16028c9fbc29Smrg	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
16038c9fbc29Smrg	    # These systems don't actually have a C or math library (as such)
16048c9fbc29Smrg	    continue
16058c9fbc29Smrg	    ;;
16068c9fbc29Smrg	  *-*-os2*)
16078c9fbc29Smrg	    # These systems don't actually have a C library (as such)
16088c9fbc29Smrg	    test "X$arg" = "X-lc" && continue
16098c9fbc29Smrg	    ;;
16108c9fbc29Smrg	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
16118c9fbc29Smrg	    # Do not include libc due to us having libc/libc_r.
16128c9fbc29Smrg	    test "X$arg" = "X-lc" && continue
16138c9fbc29Smrg	    ;;
16148c9fbc29Smrg	  *-*-rhapsody* | *-*-darwin1.[012])
16158c9fbc29Smrg	    # Rhapsody C and math libraries are in the System framework
16168c9fbc29Smrg	    deplibs="$deplibs -framework System"
16178c9fbc29Smrg	    continue
16188c9fbc29Smrg	    ;;
16198c9fbc29Smrg	  *-*-sco3.2v5* | *-*-sco5v6*)
16208c9fbc29Smrg	    # Causes problems with __ctype
16218c9fbc29Smrg	    test "X$arg" = "X-lc" && continue
16228c9fbc29Smrg	    ;;
16238c9fbc29Smrg	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
16248c9fbc29Smrg	    # Compiler inserts libc in the correct place for threads to work
16258c9fbc29Smrg	    test "X$arg" = "X-lc" && continue
16268c9fbc29Smrg	    ;;
16278c9fbc29Smrg	  esac
16288c9fbc29Smrg	elif test "X$arg" = "X-lc_r"; then
16298c9fbc29Smrg	 case $host in
16308c9fbc29Smrg	 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
16318c9fbc29Smrg	   # Do not include libc_r directly, use -pthread flag.
16328c9fbc29Smrg	   continue
16338c9fbc29Smrg	   ;;
16348c9fbc29Smrg	 esac
16358c9fbc29Smrg	fi
16368c9fbc29Smrg	deplibs="$deplibs $arg"
16378c9fbc29Smrg	continue
16388c9fbc29Smrg	;;
16398c9fbc29Smrg
16408c9fbc29Smrg      # Tru64 UNIX uses -model [arg] to determine the layout of C++
16418c9fbc29Smrg      # classes, name mangling, and exception handling.
16428c9fbc29Smrg      -model)
16438c9fbc29Smrg	compile_command="$compile_command $arg"
16448c9fbc29Smrg	compiler_flags="$compiler_flags $arg"
16458c9fbc29Smrg	finalize_command="$finalize_command $arg"
16468c9fbc29Smrg	prev=xcompiler
16478c9fbc29Smrg	continue
16488c9fbc29Smrg	;;
16498c9fbc29Smrg
16504e411241Smrg     -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
16518c9fbc29Smrg	compiler_flags="$compiler_flags $arg"
16528c9fbc29Smrg	compile_command="$compile_command $arg"
16538c9fbc29Smrg	finalize_command="$finalize_command $arg"
16548c9fbc29Smrg	continue
16558c9fbc29Smrg	;;
16568c9fbc29Smrg
16574e411241Smrg      -multi_module)
16584e411241Smrg	single_module="${wl}-multi_module"
16594e411241Smrg	continue
16604e411241Smrg	;;
16614e411241Smrg
16628c9fbc29Smrg      -module)
16638c9fbc29Smrg	module=yes
16648c9fbc29Smrg	continue
16658c9fbc29Smrg	;;
16668c9fbc29Smrg
16678c9fbc29Smrg      # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
16688c9fbc29Smrg      # -r[0-9][0-9]* specifies the processor on the SGI compiler
16698c9fbc29Smrg      # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
16708c9fbc29Smrg      # +DA*, +DD* enable 64-bit mode on the HP compiler
16718c9fbc29Smrg      # -q* pass through compiler args for the IBM compiler
16728c9fbc29Smrg      # -m* pass through architecture-specific compiler args for GCC
16738c9fbc29Smrg      # -m*, -t[45]*, -txscale* pass through architecture-specific
16748c9fbc29Smrg      # compiler args for GCC
16754e411241Smrg      # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
16764e411241Smrg      # -F/path gives path to uninstalled frameworks, gcc on darwin
16778c9fbc29Smrg      # @file GCC response files
16784e411241Smrg      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
16794e411241Smrg      -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
16808c9fbc29Smrg
16818c9fbc29Smrg	# Unknown arguments in both finalize_command and compile_command need
16828c9fbc29Smrg	# to be aesthetically quoted because they are evaled later.
16838c9fbc29Smrg	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
16848c9fbc29Smrg	case $arg in
16858c9fbc29Smrg	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
16868c9fbc29Smrg	  arg="\"$arg\""
16878c9fbc29Smrg	  ;;
16888c9fbc29Smrg	esac
16898c9fbc29Smrg        compile_command="$compile_command $arg"
16908c9fbc29Smrg        finalize_command="$finalize_command $arg"
16918c9fbc29Smrg        compiler_flags="$compiler_flags $arg"
16928c9fbc29Smrg        continue
16938c9fbc29Smrg        ;;
16948c9fbc29Smrg
16958c9fbc29Smrg      -shrext)
16968c9fbc29Smrg	prev=shrext
16978c9fbc29Smrg	continue
16988c9fbc29Smrg	;;
16998c9fbc29Smrg
17008c9fbc29Smrg      -no-fast-install)
17018c9fbc29Smrg	fast_install=no
17028c9fbc29Smrg	continue
17038c9fbc29Smrg	;;
17048c9fbc29Smrg
17058c9fbc29Smrg      -no-install)
17068c9fbc29Smrg	case $host in
17074e411241Smrg	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*)
17088c9fbc29Smrg	  # The PATH hackery in wrapper scripts is required on Windows
17094e411241Smrg	  # and Darwin in order for the loader to find any dlls it needs.
17108c9fbc29Smrg	  $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
17118c9fbc29Smrg	  $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
17128c9fbc29Smrg	  fast_install=no
17138c9fbc29Smrg	  ;;
17148c9fbc29Smrg	*) no_install=yes ;;
17158c9fbc29Smrg	esac
17168c9fbc29Smrg	continue
17178c9fbc29Smrg	;;
17188c9fbc29Smrg
17198c9fbc29Smrg      -no-undefined)
17208c9fbc29Smrg	allow_undefined=no
17218c9fbc29Smrg	continue
17228c9fbc29Smrg	;;
17238c9fbc29Smrg
17248c9fbc29Smrg      -objectlist)
17258c9fbc29Smrg	prev=objectlist
17268c9fbc29Smrg	continue
17278c9fbc29Smrg	;;
17288c9fbc29Smrg
17298c9fbc29Smrg      -o) prev=output ;;
17308c9fbc29Smrg
17318c9fbc29Smrg      -precious-files-regex)
17328c9fbc29Smrg	prev=precious_regex
17338c9fbc29Smrg	continue
17348c9fbc29Smrg	;;
17358c9fbc29Smrg
17368c9fbc29Smrg      -release)
17378c9fbc29Smrg	prev=release
17388c9fbc29Smrg	continue
17398c9fbc29Smrg	;;
17408c9fbc29Smrg
17418c9fbc29Smrg      -rpath)
17428c9fbc29Smrg	prev=rpath
17438c9fbc29Smrg	continue
17448c9fbc29Smrg	;;
17458c9fbc29Smrg
17468c9fbc29Smrg      -R)
17478c9fbc29Smrg	prev=xrpath
17488c9fbc29Smrg	continue
17498c9fbc29Smrg	;;
17508c9fbc29Smrg
17518c9fbc29Smrg      -R*)
17528c9fbc29Smrg	dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
17538c9fbc29Smrg	# We need an absolute path.
17548c9fbc29Smrg	case $dir in
17558c9fbc29Smrg	[\\/]* | [A-Za-z]:[\\/]*) ;;
17568c9fbc29Smrg	*)
17578c9fbc29Smrg	  $echo "$modename: only absolute run-paths are allowed" 1>&2
17588c9fbc29Smrg	  exit $EXIT_FAILURE
17598c9fbc29Smrg	  ;;
17608c9fbc29Smrg	esac
17618c9fbc29Smrg	case "$xrpath " in
17628c9fbc29Smrg	*" $dir "*) ;;
17638c9fbc29Smrg	*) xrpath="$xrpath $dir" ;;
17648c9fbc29Smrg	esac
17658c9fbc29Smrg	continue
17668c9fbc29Smrg	;;
17678c9fbc29Smrg
17684e411241Smrg      -static | -static-libtool-libs)
17698c9fbc29Smrg	# The effects of -static are defined in a previous loop.
17708c9fbc29Smrg	# We used to do the same as -all-static on platforms that
17718c9fbc29Smrg	# didn't have a PIC flag, but the assumption that the effects
17728c9fbc29Smrg	# would be equivalent was wrong.  It would break on at least
17738c9fbc29Smrg	# Digital Unix and AIX.
17748c9fbc29Smrg	continue
17758c9fbc29Smrg	;;
17768c9fbc29Smrg
17778c9fbc29Smrg      -thread-safe)
17788c9fbc29Smrg	thread_safe=yes
17798c9fbc29Smrg	continue
17808c9fbc29Smrg	;;
17818c9fbc29Smrg
17828c9fbc29Smrg      -version-info)
17838c9fbc29Smrg	prev=vinfo
17848c9fbc29Smrg	continue
17858c9fbc29Smrg	;;
17868c9fbc29Smrg      -version-number)
17878c9fbc29Smrg	prev=vinfo
17888c9fbc29Smrg	vinfo_number=yes
17898c9fbc29Smrg	continue
17908c9fbc29Smrg	;;
17918c9fbc29Smrg
17928c9fbc29Smrg      -Wc,*)
17938c9fbc29Smrg	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
17948c9fbc29Smrg	arg=
17958c9fbc29Smrg	save_ifs="$IFS"; IFS=','
17968c9fbc29Smrg	for flag in $args; do
17978c9fbc29Smrg	  IFS="$save_ifs"
17988c9fbc29Smrg	  case $flag in
17998c9fbc29Smrg	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
18008c9fbc29Smrg	    flag="\"$flag\""
18018c9fbc29Smrg	    ;;
18028c9fbc29Smrg	  esac
18038c9fbc29Smrg	  arg="$arg $wl$flag"
18048c9fbc29Smrg	  compiler_flags="$compiler_flags $flag"
18058c9fbc29Smrg	done
18068c9fbc29Smrg	IFS="$save_ifs"
18078c9fbc29Smrg	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
18088c9fbc29Smrg	;;
18098c9fbc29Smrg
18108c9fbc29Smrg      -Wl,*)
18118c9fbc29Smrg	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
18128c9fbc29Smrg	arg=
18138c9fbc29Smrg	save_ifs="$IFS"; IFS=','
18148c9fbc29Smrg	for flag in $args; do
18158c9fbc29Smrg	  IFS="$save_ifs"
18168c9fbc29Smrg	  case $flag in
18178c9fbc29Smrg	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
18188c9fbc29Smrg	    flag="\"$flag\""
18198c9fbc29Smrg	    ;;
18208c9fbc29Smrg	  esac
18218c9fbc29Smrg	  arg="$arg $wl$flag"
18228c9fbc29Smrg	  compiler_flags="$compiler_flags $wl$flag"
18238c9fbc29Smrg	  linker_flags="$linker_flags $flag"
18248c9fbc29Smrg	done
18258c9fbc29Smrg	IFS="$save_ifs"
18268c9fbc29Smrg	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
18278c9fbc29Smrg	;;
18288c9fbc29Smrg
18298c9fbc29Smrg      -Xcompiler)
18308c9fbc29Smrg	prev=xcompiler
18318c9fbc29Smrg	continue
18328c9fbc29Smrg	;;
18338c9fbc29Smrg
18348c9fbc29Smrg      -Xlinker)
18358c9fbc29Smrg	prev=xlinker
18368c9fbc29Smrg	continue
18378c9fbc29Smrg	;;
18388c9fbc29Smrg
18398c9fbc29Smrg      -XCClinker)
18408c9fbc29Smrg	prev=xcclinker
18418c9fbc29Smrg	continue
18428c9fbc29Smrg	;;
18438c9fbc29Smrg
18448c9fbc29Smrg      # Some other compiler flag.
18458c9fbc29Smrg      -* | +*)
18468c9fbc29Smrg	# Unknown arguments in both finalize_command and compile_command need
18478c9fbc29Smrg	# to be aesthetically quoted because they are evaled later.
18488c9fbc29Smrg	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
18498c9fbc29Smrg	case $arg in
18508c9fbc29Smrg	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
18518c9fbc29Smrg	  arg="\"$arg\""
18528c9fbc29Smrg	  ;;
18538c9fbc29Smrg	esac
18548c9fbc29Smrg	;;
18558c9fbc29Smrg
18568c9fbc29Smrg      *.$objext)
18578c9fbc29Smrg	# A standard object.
18588c9fbc29Smrg	objs="$objs $arg"
18598c9fbc29Smrg	;;
18608c9fbc29Smrg
18618c9fbc29Smrg      *.lo)
18628c9fbc29Smrg	# A libtool-controlled object.
18638c9fbc29Smrg
18648c9fbc29Smrg	# Check to see that this really is a libtool object.
18658c9fbc29Smrg	if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
18668c9fbc29Smrg	  pic_object=
18678c9fbc29Smrg	  non_pic_object=
18688c9fbc29Smrg
18698c9fbc29Smrg	  # Read the .lo file
18708c9fbc29Smrg	  # If there is no directory component, then add one.
18718c9fbc29Smrg	  case $arg in
18728c9fbc29Smrg	  */* | *\\*) . $arg ;;
18738c9fbc29Smrg	  *) . ./$arg ;;
18748c9fbc29Smrg	  esac
18758c9fbc29Smrg
18768c9fbc29Smrg	  if test -z "$pic_object" || \
18778c9fbc29Smrg	     test -z "$non_pic_object" ||
18788c9fbc29Smrg	     test "$pic_object" = none && \
18798c9fbc29Smrg	     test "$non_pic_object" = none; then
18808c9fbc29Smrg	    $echo "$modename: cannot find name of object for \`$arg'" 1>&2
18818c9fbc29Smrg	    exit $EXIT_FAILURE
18828c9fbc29Smrg	  fi
18838c9fbc29Smrg
18848c9fbc29Smrg	  # Extract subdirectory from the argument.
18858c9fbc29Smrg	  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
18868c9fbc29Smrg	  if test "X$xdir" = "X$arg"; then
18878c9fbc29Smrg	    xdir=
18888c9fbc29Smrg 	  else
18898c9fbc29Smrg	    xdir="$xdir/"
18908c9fbc29Smrg	  fi
18918c9fbc29Smrg
18928c9fbc29Smrg	  if test "$pic_object" != none; then
18938c9fbc29Smrg	    # Prepend the subdirectory the object is found in.
18948c9fbc29Smrg	    pic_object="$xdir$pic_object"
18958c9fbc29Smrg
18968c9fbc29Smrg	    if test "$prev" = dlfiles; then
18978c9fbc29Smrg	      if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
18988c9fbc29Smrg		dlfiles="$dlfiles $pic_object"
18998c9fbc29Smrg		prev=
19008c9fbc29Smrg		continue
19018c9fbc29Smrg	      else
19028c9fbc29Smrg		# If libtool objects are unsupported, then we need to preload.
19038c9fbc29Smrg		prev=dlprefiles
19048c9fbc29Smrg	      fi
19058c9fbc29Smrg	    fi
19068c9fbc29Smrg
19078c9fbc29Smrg	    # CHECK ME:  I think I busted this.  -Ossama
19088c9fbc29Smrg	    if test "$prev" = dlprefiles; then
19098c9fbc29Smrg	      # Preload the old-style object.
19108c9fbc29Smrg	      dlprefiles="$dlprefiles $pic_object"
19118c9fbc29Smrg	      prev=
19128c9fbc29Smrg	    fi
19138c9fbc29Smrg
19148c9fbc29Smrg	    # A PIC object.
19158c9fbc29Smrg	    libobjs="$libobjs $pic_object"
19168c9fbc29Smrg	    arg="$pic_object"
19178c9fbc29Smrg	  fi
19188c9fbc29Smrg
19198c9fbc29Smrg	  # Non-PIC object.
19208c9fbc29Smrg	  if test "$non_pic_object" != none; then
19218c9fbc29Smrg	    # Prepend the subdirectory the object is found in.
19228c9fbc29Smrg	    non_pic_object="$xdir$non_pic_object"
19238c9fbc29Smrg
19248c9fbc29Smrg	    # A standard non-PIC object
19258c9fbc29Smrg	    non_pic_objects="$non_pic_objects $non_pic_object"
19268c9fbc29Smrg	    if test -z "$pic_object" || test "$pic_object" = none ; then
19278c9fbc29Smrg	      arg="$non_pic_object"
19288c9fbc29Smrg	    fi
19298c9fbc29Smrg	  else
19308c9fbc29Smrg	    # If the PIC object exists, use it instead.
19318c9fbc29Smrg	    # $xdir was prepended to $pic_object above.
19328c9fbc29Smrg	    non_pic_object="$pic_object"
19338c9fbc29Smrg	    non_pic_objects="$non_pic_objects $non_pic_object"
19348c9fbc29Smrg	  fi
19358c9fbc29Smrg	else
19368c9fbc29Smrg	  # Only an error if not doing a dry-run.
19378c9fbc29Smrg	  if test -z "$run"; then
19388c9fbc29Smrg	    $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
19398c9fbc29Smrg	    exit $EXIT_FAILURE
19408c9fbc29Smrg	  else
19418c9fbc29Smrg	    # Dry-run case.
19428c9fbc29Smrg
19438c9fbc29Smrg	    # Extract subdirectory from the argument.
19448c9fbc29Smrg	    xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
19458c9fbc29Smrg	    if test "X$xdir" = "X$arg"; then
19468c9fbc29Smrg	      xdir=
19478c9fbc29Smrg	    else
19488c9fbc29Smrg	      xdir="$xdir/"
19498c9fbc29Smrg	    fi
19508c9fbc29Smrg
19518c9fbc29Smrg	    pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
19528c9fbc29Smrg	    non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
19538c9fbc29Smrg	    libobjs="$libobjs $pic_object"
19548c9fbc29Smrg	    non_pic_objects="$non_pic_objects $non_pic_object"
19558c9fbc29Smrg	  fi
19568c9fbc29Smrg	fi
19578c9fbc29Smrg	;;
19588c9fbc29Smrg
19598c9fbc29Smrg      *.$libext)
19608c9fbc29Smrg	# An archive.
19618c9fbc29Smrg	deplibs="$deplibs $arg"
19628c9fbc29Smrg	old_deplibs="$old_deplibs $arg"
19638c9fbc29Smrg	continue
19648c9fbc29Smrg	;;
19658c9fbc29Smrg
19668c9fbc29Smrg      *.la)
19678c9fbc29Smrg	# A libtool-controlled library.
19688c9fbc29Smrg
19698c9fbc29Smrg	if test "$prev" = dlfiles; then
19708c9fbc29Smrg	  # This library was specified with -dlopen.
19718c9fbc29Smrg	  dlfiles="$dlfiles $arg"
19728c9fbc29Smrg	  prev=
19738c9fbc29Smrg	elif test "$prev" = dlprefiles; then
19748c9fbc29Smrg	  # The library was specified with -dlpreopen.
19758c9fbc29Smrg	  dlprefiles="$dlprefiles $arg"
19768c9fbc29Smrg	  prev=
19778c9fbc29Smrg	else
19788c9fbc29Smrg	  deplibs="$deplibs $arg"
19798c9fbc29Smrg	fi
19808c9fbc29Smrg	continue
19818c9fbc29Smrg	;;
19828c9fbc29Smrg
19838c9fbc29Smrg      # Some other compiler argument.
19848c9fbc29Smrg      *)
19858c9fbc29Smrg	# Unknown arguments in both finalize_command and compile_command need
19868c9fbc29Smrg	# to be aesthetically quoted because they are evaled later.
19878c9fbc29Smrg	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
19888c9fbc29Smrg	case $arg in
19898c9fbc29Smrg	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
19908c9fbc29Smrg	  arg="\"$arg\""
19918c9fbc29Smrg	  ;;
19928c9fbc29Smrg	esac
19938c9fbc29Smrg	;;
19948c9fbc29Smrg      esac # arg
19958c9fbc29Smrg
19968c9fbc29Smrg      # Now actually substitute the argument into the commands.
19978c9fbc29Smrg      if test -n "$arg"; then
19988c9fbc29Smrg	compile_command="$compile_command $arg"
19998c9fbc29Smrg	finalize_command="$finalize_command $arg"
20008c9fbc29Smrg      fi
20018c9fbc29Smrg    done # argument parsing loop
20028c9fbc29Smrg
20038c9fbc29Smrg    if test -n "$prev"; then
20048c9fbc29Smrg      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
20058c9fbc29Smrg      $echo "$help" 1>&2
20068c9fbc29Smrg      exit $EXIT_FAILURE
20078c9fbc29Smrg    fi
20088c9fbc29Smrg
20098c9fbc29Smrg    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
20108c9fbc29Smrg      eval arg=\"$export_dynamic_flag_spec\"
20118c9fbc29Smrg      compile_command="$compile_command $arg"
20128c9fbc29Smrg      finalize_command="$finalize_command $arg"
20138c9fbc29Smrg    fi
20148c9fbc29Smrg
20158c9fbc29Smrg    oldlibs=
20168c9fbc29Smrg    # calculate the name of the file, without its directory
20178c9fbc29Smrg    outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
20188c9fbc29Smrg    libobjs_save="$libobjs"
20198c9fbc29Smrg
20208c9fbc29Smrg    if test -n "$shlibpath_var"; then
20218c9fbc29Smrg      # get the directories listed in $shlibpath_var
20228c9fbc29Smrg      eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
20238c9fbc29Smrg    else
20248c9fbc29Smrg      shlib_search_path=
20258c9fbc29Smrg    fi
20268c9fbc29Smrg    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
20278c9fbc29Smrg    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
20288c9fbc29Smrg
20298c9fbc29Smrg    output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
20308c9fbc29Smrg    if test "X$output_objdir" = "X$output"; then
20318c9fbc29Smrg      output_objdir="$objdir"
20328c9fbc29Smrg    else
20338c9fbc29Smrg      output_objdir="$output_objdir/$objdir"
20348c9fbc29Smrg    fi
20358c9fbc29Smrg    # Create the object directory.
20368c9fbc29Smrg    if test ! -d "$output_objdir"; then
20378c9fbc29Smrg      $show "$mkdir $output_objdir"
20388c9fbc29Smrg      $run $mkdir $output_objdir
20398c9fbc29Smrg      exit_status=$?
20408c9fbc29Smrg      if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
20418c9fbc29Smrg	exit $exit_status
20428c9fbc29Smrg      fi
20438c9fbc29Smrg    fi
20448c9fbc29Smrg
20458c9fbc29Smrg    # Determine the type of output
20468c9fbc29Smrg    case $output in
20478c9fbc29Smrg    "")
20488c9fbc29Smrg      $echo "$modename: you must specify an output file" 1>&2
20498c9fbc29Smrg      $echo "$help" 1>&2
20508c9fbc29Smrg      exit $EXIT_FAILURE
20518c9fbc29Smrg      ;;
20528c9fbc29Smrg    *.$libext) linkmode=oldlib ;;
20538c9fbc29Smrg    *.lo | *.$objext) linkmode=obj ;;
20548c9fbc29Smrg    *.la) linkmode=lib ;;
20558c9fbc29Smrg    *) linkmode=prog ;; # Anything else should be a program.
20568c9fbc29Smrg    esac
20578c9fbc29Smrg
20588c9fbc29Smrg    case $host in
20598c9fbc29Smrg    *cygwin* | *mingw* | *pw32*)
20608c9fbc29Smrg      # don't eliminate duplications in $postdeps and $predeps
20618c9fbc29Smrg      duplicate_compiler_generated_deps=yes
20628c9fbc29Smrg      ;;
20638c9fbc29Smrg    *)
20648c9fbc29Smrg      duplicate_compiler_generated_deps=$duplicate_deps
20658c9fbc29Smrg      ;;
20668c9fbc29Smrg    esac
20678c9fbc29Smrg    specialdeplibs=
20688c9fbc29Smrg
20698c9fbc29Smrg    libs=
20708c9fbc29Smrg    # Find all interdependent deplibs by searching for libraries
20718c9fbc29Smrg    # that are linked more than once (e.g. -la -lb -la)
20728c9fbc29Smrg    for deplib in $deplibs; do
20738c9fbc29Smrg      if test "X$duplicate_deps" = "Xyes" ; then
20748c9fbc29Smrg	case "$libs " in
20758c9fbc29Smrg	*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
20768c9fbc29Smrg	esac
20778c9fbc29Smrg      fi
20788c9fbc29Smrg      libs="$libs $deplib"
20798c9fbc29Smrg    done
20808c9fbc29Smrg
20818c9fbc29Smrg    if test "$linkmode" = lib; then
20828c9fbc29Smrg      libs="$predeps $libs $compiler_lib_search_path $postdeps"
20838c9fbc29Smrg
20848c9fbc29Smrg      # Compute libraries that are listed more than once in $predeps
20858c9fbc29Smrg      # $postdeps and mark them as special (i.e., whose duplicates are
20868c9fbc29Smrg      # not to be eliminated).
20878c9fbc29Smrg      pre_post_deps=
20888c9fbc29Smrg      if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
20898c9fbc29Smrg	for pre_post_dep in $predeps $postdeps; do
20908c9fbc29Smrg	  case "$pre_post_deps " in
20918c9fbc29Smrg	  *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
20928c9fbc29Smrg	  esac
20938c9fbc29Smrg	  pre_post_deps="$pre_post_deps $pre_post_dep"
20948c9fbc29Smrg	done
20958c9fbc29Smrg      fi
20968c9fbc29Smrg      pre_post_deps=
20978c9fbc29Smrg    fi
20988c9fbc29Smrg
20998c9fbc29Smrg    deplibs=
21008c9fbc29Smrg    newdependency_libs=
21018c9fbc29Smrg    newlib_search_path=
21028c9fbc29Smrg    need_relink=no # whether we're linking any uninstalled libtool libraries
21038c9fbc29Smrg    notinst_deplibs= # not-installed libtool libraries
21048c9fbc29Smrg    case $linkmode in
21058c9fbc29Smrg    lib)
21068c9fbc29Smrg	passes="conv link"
21078c9fbc29Smrg	for file in $dlfiles $dlprefiles; do
21088c9fbc29Smrg	  case $file in
21098c9fbc29Smrg	  *.la) ;;
21108c9fbc29Smrg	  *)
21118c9fbc29Smrg	    $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
21128c9fbc29Smrg	    exit $EXIT_FAILURE
21138c9fbc29Smrg	    ;;
21148c9fbc29Smrg	  esac
21158c9fbc29Smrg	done
21168c9fbc29Smrg	;;
21178c9fbc29Smrg    prog)
21188c9fbc29Smrg	compile_deplibs=
21198c9fbc29Smrg	finalize_deplibs=
21208c9fbc29Smrg	alldeplibs=no
21218c9fbc29Smrg	newdlfiles=
21228c9fbc29Smrg	newdlprefiles=
21238c9fbc29Smrg	passes="conv scan dlopen dlpreopen link"
21248c9fbc29Smrg	;;
21258c9fbc29Smrg    *)  passes="conv"
21268c9fbc29Smrg	;;
21278c9fbc29Smrg    esac
21288c9fbc29Smrg    for pass in $passes; do
21298c9fbc29Smrg      if test "$linkmode,$pass" = "lib,link" ||
21308c9fbc29Smrg	 test "$linkmode,$pass" = "prog,scan"; then
21318c9fbc29Smrg	libs="$deplibs"
21328c9fbc29Smrg	deplibs=
21338c9fbc29Smrg      fi
21348c9fbc29Smrg      if test "$linkmode" = prog; then
21358c9fbc29Smrg	case $pass in
21368c9fbc29Smrg	dlopen) libs="$dlfiles" ;;
21378c9fbc29Smrg	dlpreopen) libs="$dlprefiles" ;;
21388c9fbc29Smrg	link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
21398c9fbc29Smrg	esac
21408c9fbc29Smrg      fi
21418c9fbc29Smrg      if test "$pass" = dlopen; then
21428c9fbc29Smrg	# Collect dlpreopened libraries
21438c9fbc29Smrg	save_deplibs="$deplibs"
21448c9fbc29Smrg	deplibs=
21458c9fbc29Smrg      fi
21468c9fbc29Smrg      for deplib in $libs; do
21478c9fbc29Smrg	lib=
21488c9fbc29Smrg	found=no
21498c9fbc29Smrg	case $deplib in
21504e411241Smrg	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
21518c9fbc29Smrg	  if test "$linkmode,$pass" = "prog,link"; then
21528c9fbc29Smrg	    compile_deplibs="$deplib $compile_deplibs"
21538c9fbc29Smrg	    finalize_deplibs="$deplib $finalize_deplibs"
21548c9fbc29Smrg	  else
21558c9fbc29Smrg	    compiler_flags="$compiler_flags $deplib"
21568c9fbc29Smrg	  fi
21578c9fbc29Smrg	  continue
21588c9fbc29Smrg	  ;;
21598c9fbc29Smrg	-l*)
21608c9fbc29Smrg	  if test "$linkmode" != lib && test "$linkmode" != prog; then
21618c9fbc29Smrg	    $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
21628c9fbc29Smrg	    continue
21638c9fbc29Smrg	  fi
21648c9fbc29Smrg	  name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
21654e411241Smrg	  if test "$linkmode" = lib; then
21664e411241Smrg	    searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
21674e411241Smrg	  else
21684e411241Smrg	    searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
21694e411241Smrg	  fi
21704e411241Smrg	  for searchdir in $searchdirs; do
21718c9fbc29Smrg	    for search_ext in .la $std_shrext .so .a; do
21728c9fbc29Smrg	      # Search the libtool library
21738c9fbc29Smrg	      lib="$searchdir/lib${name}${search_ext}"
21748c9fbc29Smrg	      if test -f "$lib"; then
21758c9fbc29Smrg		if test "$search_ext" = ".la"; then
21768c9fbc29Smrg		  found=yes
21778c9fbc29Smrg		else
21788c9fbc29Smrg		  found=no
21798c9fbc29Smrg		fi
21808c9fbc29Smrg		break 2
21818c9fbc29Smrg	      fi
21828c9fbc29Smrg	    done
21838c9fbc29Smrg	  done
21848c9fbc29Smrg	  if test "$found" != yes; then
21858c9fbc29Smrg	    # deplib doesn't seem to be a libtool library
21868c9fbc29Smrg	    if test "$linkmode,$pass" = "prog,link"; then
21878c9fbc29Smrg	      compile_deplibs="$deplib $compile_deplibs"
21888c9fbc29Smrg	      finalize_deplibs="$deplib $finalize_deplibs"
21898c9fbc29Smrg	    else
21908c9fbc29Smrg	      deplibs="$deplib $deplibs"
21918c9fbc29Smrg	      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
21928c9fbc29Smrg	    fi
21938c9fbc29Smrg	    continue
21948c9fbc29Smrg	  else # deplib is a libtool library
21958c9fbc29Smrg	    # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
21968c9fbc29Smrg	    # We need to do some special things here, and not later.
21978c9fbc29Smrg	    if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
21988c9fbc29Smrg	      case " $predeps $postdeps " in
21998c9fbc29Smrg	      *" $deplib "*)
22008c9fbc29Smrg		if (${SED} -e '2q' $lib |
22018c9fbc29Smrg                    grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
22028c9fbc29Smrg		  library_names=
22038c9fbc29Smrg		  old_library=
22048c9fbc29Smrg		  case $lib in
22058c9fbc29Smrg		  */* | *\\*) . $lib ;;
22068c9fbc29Smrg		  *) . ./$lib ;;
22078c9fbc29Smrg		  esac
22088c9fbc29Smrg		  for l in $old_library $library_names; do
22098c9fbc29Smrg		    ll="$l"
22108c9fbc29Smrg		  done
22118c9fbc29Smrg		  if test "X$ll" = "X$old_library" ; then # only static version available
22128c9fbc29Smrg		    found=no
22138c9fbc29Smrg		    ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
22148c9fbc29Smrg		    test "X$ladir" = "X$lib" && ladir="."
22158c9fbc29Smrg		    lib=$ladir/$old_library
22168c9fbc29Smrg		    if test "$linkmode,$pass" = "prog,link"; then
22178c9fbc29Smrg		      compile_deplibs="$deplib $compile_deplibs"
22188c9fbc29Smrg		      finalize_deplibs="$deplib $finalize_deplibs"
22198c9fbc29Smrg		    else
22208c9fbc29Smrg		      deplibs="$deplib $deplibs"
22218c9fbc29Smrg		      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
22228c9fbc29Smrg		    fi
22238c9fbc29Smrg		    continue
22248c9fbc29Smrg		  fi
22258c9fbc29Smrg		fi
22268c9fbc29Smrg	        ;;
22278c9fbc29Smrg	      *) ;;
22288c9fbc29Smrg	      esac
22298c9fbc29Smrg	    fi
22308c9fbc29Smrg	  fi
22318c9fbc29Smrg	  ;; # -l
22328c9fbc29Smrg	-L*)
22338c9fbc29Smrg	  case $linkmode in
22348c9fbc29Smrg	  lib)
22358c9fbc29Smrg	    deplibs="$deplib $deplibs"
22368c9fbc29Smrg	    test "$pass" = conv && continue
22378c9fbc29Smrg	    newdependency_libs="$deplib $newdependency_libs"
22388c9fbc29Smrg	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
22398c9fbc29Smrg	    ;;
22408c9fbc29Smrg	  prog)
22418c9fbc29Smrg	    if test "$pass" = conv; then
22428c9fbc29Smrg	      deplibs="$deplib $deplibs"
22438c9fbc29Smrg	      continue
22448c9fbc29Smrg	    fi
22458c9fbc29Smrg	    if test "$pass" = scan; then
22468c9fbc29Smrg	      deplibs="$deplib $deplibs"
22478c9fbc29Smrg	    else
22488c9fbc29Smrg	      compile_deplibs="$deplib $compile_deplibs"
22498c9fbc29Smrg	      finalize_deplibs="$deplib $finalize_deplibs"
22508c9fbc29Smrg	    fi
22518c9fbc29Smrg	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
22528c9fbc29Smrg	    ;;
22538c9fbc29Smrg	  *)
22548c9fbc29Smrg	    $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
22558c9fbc29Smrg	    ;;
22568c9fbc29Smrg	  esac # linkmode
22578c9fbc29Smrg	  continue
22588c9fbc29Smrg	  ;; # -L
22598c9fbc29Smrg	-R*)
22608c9fbc29Smrg	  if test "$pass" = link; then
22618c9fbc29Smrg	    dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
22628c9fbc29Smrg	    # Make sure the xrpath contains only unique directories.
22638c9fbc29Smrg	    case "$xrpath " in
22648c9fbc29Smrg	    *" $dir "*) ;;
22658c9fbc29Smrg	    *) xrpath="$xrpath $dir" ;;
22668c9fbc29Smrg	    esac
22678c9fbc29Smrg	  fi
22688c9fbc29Smrg	  deplibs="$deplib $deplibs"
22698c9fbc29Smrg	  continue
22708c9fbc29Smrg	  ;;
22718c9fbc29Smrg	*.la) lib="$deplib" ;;
22728c9fbc29Smrg	*.$libext)
22738c9fbc29Smrg	  if test "$pass" = conv; then
22748c9fbc29Smrg	    deplibs="$deplib $deplibs"
22758c9fbc29Smrg	    continue
22768c9fbc29Smrg	  fi
22778c9fbc29Smrg	  case $linkmode in
22788c9fbc29Smrg	  lib)
22798c9fbc29Smrg	    valid_a_lib=no
22808c9fbc29Smrg	    case $deplibs_check_method in
22818c9fbc29Smrg	      match_pattern*)
22828c9fbc29Smrg		set dummy $deplibs_check_method
22838c9fbc29Smrg	        match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
22848c9fbc29Smrg		if eval $echo \"$deplib\" 2>/dev/null \
22858c9fbc29Smrg		    | $SED 10q \
22868c9fbc29Smrg		    | $EGREP "$match_pattern_regex" > /dev/null; then
22878c9fbc29Smrg		  valid_a_lib=yes
22888c9fbc29Smrg		fi
22898c9fbc29Smrg		;;
22908c9fbc29Smrg	      pass_all)
22918c9fbc29Smrg		valid_a_lib=yes
22928c9fbc29Smrg		;;
22938c9fbc29Smrg            esac
22948c9fbc29Smrg	    if test "$valid_a_lib" != yes; then
22958c9fbc29Smrg	      $echo
22968c9fbc29Smrg	      $echo "*** Warning: Trying to link with static lib archive $deplib."
22978c9fbc29Smrg	      $echo "*** I have the capability to make that library automatically link in when"
22988c9fbc29Smrg	      $echo "*** you link to this library.  But I can only do this if you have a"
22998c9fbc29Smrg	      $echo "*** shared version of the library, which you do not appear to have"
23008c9fbc29Smrg	      $echo "*** because the file extensions .$libext of this argument makes me believe"
23018c9fbc29Smrg	      $echo "*** that it is just a static archive that I should not used here."
23028c9fbc29Smrg	    else
23038c9fbc29Smrg	      $echo
23048c9fbc29Smrg	      $echo "*** Warning: Linking the shared library $output against the"
23058c9fbc29Smrg	      $echo "*** static library $deplib is not portable!"
23068c9fbc29Smrg	      deplibs="$deplib $deplibs"
23078c9fbc29Smrg	    fi
23088c9fbc29Smrg	    continue
23098c9fbc29Smrg	    ;;
23108c9fbc29Smrg	  prog)
23118c9fbc29Smrg	    if test "$pass" != link; then
23128c9fbc29Smrg	      deplibs="$deplib $deplibs"
23138c9fbc29Smrg	    else
23148c9fbc29Smrg	      compile_deplibs="$deplib $compile_deplibs"
23158c9fbc29Smrg	      finalize_deplibs="$deplib $finalize_deplibs"
23168c9fbc29Smrg	    fi
23178c9fbc29Smrg	    continue
23188c9fbc29Smrg	    ;;
23198c9fbc29Smrg	  esac # linkmode
23208c9fbc29Smrg	  ;; # *.$libext
23218c9fbc29Smrg	*.lo | *.$objext)
23228c9fbc29Smrg	  if test "$pass" = conv; then
23238c9fbc29Smrg	    deplibs="$deplib $deplibs"
23248c9fbc29Smrg	  elif test "$linkmode" = prog; then
23258c9fbc29Smrg	    if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
23268c9fbc29Smrg	      # If there is no dlopen support or we're linking statically,
23278c9fbc29Smrg	      # we need to preload.
23288c9fbc29Smrg	      newdlprefiles="$newdlprefiles $deplib"
23298c9fbc29Smrg	      compile_deplibs="$deplib $compile_deplibs"
23308c9fbc29Smrg	      finalize_deplibs="$deplib $finalize_deplibs"
23318c9fbc29Smrg	    else
23328c9fbc29Smrg	      newdlfiles="$newdlfiles $deplib"
23338c9fbc29Smrg	    fi
23348c9fbc29Smrg	  fi
23358c9fbc29Smrg	  continue
23368c9fbc29Smrg	  ;;
23378c9fbc29Smrg	%DEPLIBS%)
23388c9fbc29Smrg	  alldeplibs=yes
23398c9fbc29Smrg	  continue
23408c9fbc29Smrg	  ;;
23418c9fbc29Smrg	esac # case $deplib
23428c9fbc29Smrg	if test "$found" = yes || test -f "$lib"; then :
23438c9fbc29Smrg	else
23448c9fbc29Smrg	  $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
23458c9fbc29Smrg	  exit $EXIT_FAILURE
23468c9fbc29Smrg	fi
23478c9fbc29Smrg
23488c9fbc29Smrg	# Check to see that this really is a libtool archive.
23498c9fbc29Smrg	if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
23508c9fbc29Smrg	else
23518c9fbc29Smrg	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
23528c9fbc29Smrg	  exit $EXIT_FAILURE
23538c9fbc29Smrg	fi
23548c9fbc29Smrg
23558c9fbc29Smrg	ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
23568c9fbc29Smrg	test "X$ladir" = "X$lib" && ladir="."
23578c9fbc29Smrg
23588c9fbc29Smrg	dlname=
23598c9fbc29Smrg	dlopen=
23608c9fbc29Smrg	dlpreopen=
23618c9fbc29Smrg	libdir=
23628c9fbc29Smrg	library_names=
23638c9fbc29Smrg	old_library=
23648c9fbc29Smrg	# If the library was installed with an old release of libtool,
23658c9fbc29Smrg	# it will not redefine variables installed, or shouldnotlink
23668c9fbc29Smrg	installed=yes
23678c9fbc29Smrg	shouldnotlink=no
23688c9fbc29Smrg	avoidtemprpath=
23698c9fbc29Smrg
23708c9fbc29Smrg
23718c9fbc29Smrg	# Read the .la file
23728c9fbc29Smrg	case $lib in
23738c9fbc29Smrg	*/* | *\\*) . $lib ;;
23748c9fbc29Smrg	*) . ./$lib ;;
23758c9fbc29Smrg	esac
23768c9fbc29Smrg
23778c9fbc29Smrg	if test "$linkmode,$pass" = "lib,link" ||
23788c9fbc29Smrg	   test "$linkmode,$pass" = "prog,scan" ||
23798c9fbc29Smrg	   { test "$linkmode" != prog && test "$linkmode" != lib; }; then
23808c9fbc29Smrg	  test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
23818c9fbc29Smrg	  test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
23828c9fbc29Smrg	fi
23838c9fbc29Smrg
23848c9fbc29Smrg	if test "$pass" = conv; then
23858c9fbc29Smrg	  # Only check for convenience libraries
23868c9fbc29Smrg	  deplibs="$lib $deplibs"
23878c9fbc29Smrg	  if test -z "$libdir"; then
23888c9fbc29Smrg	    if test -z "$old_library"; then
23898c9fbc29Smrg	      $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
23908c9fbc29Smrg	      exit $EXIT_FAILURE
23918c9fbc29Smrg	    fi
23928c9fbc29Smrg	    # It is a libtool convenience library, so add in its objects.
23938c9fbc29Smrg	    convenience="$convenience $ladir/$objdir/$old_library"
23948c9fbc29Smrg	    old_convenience="$old_convenience $ladir/$objdir/$old_library"
23958c9fbc29Smrg	    tmp_libs=
23968c9fbc29Smrg	    for deplib in $dependency_libs; do
23978c9fbc29Smrg	      deplibs="$deplib $deplibs"
23988c9fbc29Smrg              if test "X$duplicate_deps" = "Xyes" ; then
23998c9fbc29Smrg	        case "$tmp_libs " in
24008c9fbc29Smrg	        *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
24018c9fbc29Smrg	        esac
24028c9fbc29Smrg              fi
24038c9fbc29Smrg	      tmp_libs="$tmp_libs $deplib"
24048c9fbc29Smrg	    done
24058c9fbc29Smrg	  elif test "$linkmode" != prog && test "$linkmode" != lib; then
24068c9fbc29Smrg	    $echo "$modename: \`$lib' is not a convenience library" 1>&2
24078c9fbc29Smrg	    exit $EXIT_FAILURE
24088c9fbc29Smrg	  fi
24098c9fbc29Smrg	  continue
24108c9fbc29Smrg	fi # $pass = conv
24118c9fbc29Smrg
24128c9fbc29Smrg
24138c9fbc29Smrg	# Get the name of the library we link against.
24148c9fbc29Smrg	linklib=
24158c9fbc29Smrg	for l in $old_library $library_names; do
24168c9fbc29Smrg	  linklib="$l"
24178c9fbc29Smrg	done
24188c9fbc29Smrg	if test -z "$linklib"; then
24198c9fbc29Smrg	  $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
24208c9fbc29Smrg	  exit $EXIT_FAILURE
24218c9fbc29Smrg	fi
24228c9fbc29Smrg
24238c9fbc29Smrg	# This library was specified with -dlopen.
24248c9fbc29Smrg	if test "$pass" = dlopen; then
24258c9fbc29Smrg	  if test -z "$libdir"; then
24268c9fbc29Smrg	    $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
24278c9fbc29Smrg	    exit $EXIT_FAILURE
24288c9fbc29Smrg	  fi
24298c9fbc29Smrg	  if test -z "$dlname" ||
24308c9fbc29Smrg	     test "$dlopen_support" != yes ||
24318c9fbc29Smrg	     test "$build_libtool_libs" = no; then
24328c9fbc29Smrg	    # If there is no dlname, no dlopen support or we're linking
24338c9fbc29Smrg	    # statically, we need to preload.  We also need to preload any
24348c9fbc29Smrg	    # dependent libraries so libltdl's deplib preloader doesn't
24358c9fbc29Smrg	    # bomb out in the load deplibs phase.
24368c9fbc29Smrg	    dlprefiles="$dlprefiles $lib $dependency_libs"
24378c9fbc29Smrg	  else
24388c9fbc29Smrg	    newdlfiles="$newdlfiles $lib"
24398c9fbc29Smrg	  fi
24408c9fbc29Smrg	  continue
24418c9fbc29Smrg	fi # $pass = dlopen
24428c9fbc29Smrg
24438c9fbc29Smrg	# We need an absolute path.
24448c9fbc29Smrg	case $ladir in
24458c9fbc29Smrg	[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
24468c9fbc29Smrg	*)
24478c9fbc29Smrg	  abs_ladir=`cd "$ladir" && pwd`
24488c9fbc29Smrg	  if test -z "$abs_ladir"; then
24498c9fbc29Smrg	    $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
24508c9fbc29Smrg	    $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
24518c9fbc29Smrg	    abs_ladir="$ladir"
24528c9fbc29Smrg	  fi
24538c9fbc29Smrg	  ;;
24548c9fbc29Smrg	esac
24558c9fbc29Smrg	laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
24568c9fbc29Smrg
24578c9fbc29Smrg	# Find the relevant object directory and library name.
24588c9fbc29Smrg	if test "X$installed" = Xyes; then
24598c9fbc29Smrg	  if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
24608c9fbc29Smrg	    $echo "$modename: warning: library \`$lib' was moved." 1>&2
24618c9fbc29Smrg	    dir="$ladir"
24628c9fbc29Smrg	    absdir="$abs_ladir"
24638c9fbc29Smrg	    libdir="$abs_ladir"
24648c9fbc29Smrg	  else
24658c9fbc29Smrg	    dir="$libdir"
24668c9fbc29Smrg	    absdir="$libdir"
24678c9fbc29Smrg	  fi
24688c9fbc29Smrg	  test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
24698c9fbc29Smrg	else
24708c9fbc29Smrg	  if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
24718c9fbc29Smrg	    dir="$ladir"
24728c9fbc29Smrg	    absdir="$abs_ladir"
24738c9fbc29Smrg	    # Remove this search path later
24748c9fbc29Smrg	    notinst_path="$notinst_path $abs_ladir"
24758c9fbc29Smrg	  else
24768c9fbc29Smrg	    dir="$ladir/$objdir"
24778c9fbc29Smrg	    absdir="$abs_ladir/$objdir"
24788c9fbc29Smrg	    # Remove this search path later
24798c9fbc29Smrg	    notinst_path="$notinst_path $abs_ladir"
24808c9fbc29Smrg	  fi
24818c9fbc29Smrg	fi # $installed = yes
24828c9fbc29Smrg	name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
24838c9fbc29Smrg
24848c9fbc29Smrg	# This library was specified with -dlpreopen.
24858c9fbc29Smrg	if test "$pass" = dlpreopen; then
24868c9fbc29Smrg	  if test -z "$libdir"; then
24878c9fbc29Smrg	    $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
24888c9fbc29Smrg	    exit $EXIT_FAILURE
24898c9fbc29Smrg	  fi
24908c9fbc29Smrg	  # Prefer using a static library (so that no silly _DYNAMIC symbols
24918c9fbc29Smrg	  # are required to link).
24928c9fbc29Smrg	  if test -n "$old_library"; then
24938c9fbc29Smrg	    newdlprefiles="$newdlprefiles $dir/$old_library"
24948c9fbc29Smrg	  # Otherwise, use the dlname, so that lt_dlopen finds it.
24958c9fbc29Smrg	  elif test -n "$dlname"; then
24968c9fbc29Smrg	    newdlprefiles="$newdlprefiles $dir/$dlname"
24978c9fbc29Smrg	  else
24988c9fbc29Smrg	    newdlprefiles="$newdlprefiles $dir/$linklib"
24998c9fbc29Smrg	  fi
25008c9fbc29Smrg	fi # $pass = dlpreopen
25018c9fbc29Smrg
25028c9fbc29Smrg	if test -z "$libdir"; then
25038c9fbc29Smrg	  # Link the convenience library
25048c9fbc29Smrg	  if test "$linkmode" = lib; then
25058c9fbc29Smrg	    deplibs="$dir/$old_library $deplibs"
25068c9fbc29Smrg	  elif test "$linkmode,$pass" = "prog,link"; then
25078c9fbc29Smrg	    compile_deplibs="$dir/$old_library $compile_deplibs"
25088c9fbc29Smrg	    finalize_deplibs="$dir/$old_library $finalize_deplibs"
25098c9fbc29Smrg	  else
25108c9fbc29Smrg	    deplibs="$lib $deplibs" # used for prog,scan pass
25118c9fbc29Smrg	  fi
25128c9fbc29Smrg	  continue
25138c9fbc29Smrg	fi
25148c9fbc29Smrg
25158c9fbc29Smrg
25168c9fbc29Smrg	if test "$linkmode" = prog && test "$pass" != link; then
25178c9fbc29Smrg	  newlib_search_path="$newlib_search_path $ladir"
25188c9fbc29Smrg	  deplibs="$lib $deplibs"
25198c9fbc29Smrg
25208c9fbc29Smrg	  linkalldeplibs=no
25218c9fbc29Smrg	  if test "$link_all_deplibs" != no || test -z "$library_names" ||
25228c9fbc29Smrg	     test "$build_libtool_libs" = no; then
25238c9fbc29Smrg	    linkalldeplibs=yes
25248c9fbc29Smrg	  fi
25258c9fbc29Smrg
25268c9fbc29Smrg	  tmp_libs=
25278c9fbc29Smrg	  for deplib in $dependency_libs; do
25288c9fbc29Smrg	    case $deplib in
25298c9fbc29Smrg	    -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
25308c9fbc29Smrg	    esac
25318c9fbc29Smrg	    # Need to link against all dependency_libs?
25328c9fbc29Smrg	    if test "$linkalldeplibs" = yes; then
25338c9fbc29Smrg	      deplibs="$deplib $deplibs"
25348c9fbc29Smrg	    else
25358c9fbc29Smrg	      # Need to hardcode shared library paths
25368c9fbc29Smrg	      # or/and link against static libraries
25378c9fbc29Smrg	      newdependency_libs="$deplib $newdependency_libs"
25388c9fbc29Smrg	    fi
25398c9fbc29Smrg	    if test "X$duplicate_deps" = "Xyes" ; then
25408c9fbc29Smrg	      case "$tmp_libs " in
25418c9fbc29Smrg	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
25428c9fbc29Smrg	      esac
25438c9fbc29Smrg	    fi
25448c9fbc29Smrg	    tmp_libs="$tmp_libs $deplib"
25458c9fbc29Smrg	  done # for deplib
25468c9fbc29Smrg	  continue
25478c9fbc29Smrg	fi # $linkmode = prog...
25488c9fbc29Smrg
25498c9fbc29Smrg	if test "$linkmode,$pass" = "prog,link"; then
25508c9fbc29Smrg	  if test -n "$library_names" &&
25514e411241Smrg	     { { test "$prefer_static_libs" = no ||
25524e411241Smrg		 test "$prefer_static_libs,$installed" = "built,yes"; } ||
25534e411241Smrg	       test -z "$old_library"; }; then
25548c9fbc29Smrg	    # We need to hardcode the library path
25558c9fbc29Smrg	    if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
25568c9fbc29Smrg	      # Make sure the rpath contains only unique directories.
25578c9fbc29Smrg	      case "$temp_rpath " in
25588c9fbc29Smrg	      *" $dir "*) ;;
25598c9fbc29Smrg	      *" $absdir "*) ;;
25608c9fbc29Smrg	      *) temp_rpath="$temp_rpath $absdir" ;;
25618c9fbc29Smrg	      esac
25628c9fbc29Smrg	    fi
25638c9fbc29Smrg
25648c9fbc29Smrg	    # Hardcode the library path.
25658c9fbc29Smrg	    # Skip directories that are in the system default run-time
25668c9fbc29Smrg	    # search path.
25678c9fbc29Smrg	    case " $sys_lib_dlsearch_path " in
25688c9fbc29Smrg	    *" $absdir "*) ;;
25698c9fbc29Smrg	    *)
25708c9fbc29Smrg	      case "$compile_rpath " in
25718c9fbc29Smrg	      *" $absdir "*) ;;
25728c9fbc29Smrg	      *) compile_rpath="$compile_rpath $absdir"
25738c9fbc29Smrg	      esac
25748c9fbc29Smrg	      ;;
25758c9fbc29Smrg	    esac
25768c9fbc29Smrg	    case " $sys_lib_dlsearch_path " in
25778c9fbc29Smrg	    *" $libdir "*) ;;
25788c9fbc29Smrg	    *)
25798c9fbc29Smrg	      case "$finalize_rpath " in
25808c9fbc29Smrg	      *" $libdir "*) ;;
25818c9fbc29Smrg	      *) finalize_rpath="$finalize_rpath $libdir"
25828c9fbc29Smrg	      esac
25838c9fbc29Smrg	      ;;
25848c9fbc29Smrg	    esac
25858c9fbc29Smrg	  fi # $linkmode,$pass = prog,link...
25868c9fbc29Smrg
25878c9fbc29Smrg	  if test "$alldeplibs" = yes &&
25888c9fbc29Smrg	     { test "$deplibs_check_method" = pass_all ||
25898c9fbc29Smrg	       { test "$build_libtool_libs" = yes &&
25908c9fbc29Smrg		 test -n "$library_names"; }; }; then
25918c9fbc29Smrg	    # We only need to search for static libraries
25928c9fbc29Smrg	    continue
25938c9fbc29Smrg	  fi
25948c9fbc29Smrg	fi
25958c9fbc29Smrg
25968c9fbc29Smrg	link_static=no # Whether the deplib will be linked statically
25978c9fbc29Smrg	use_static_libs=$prefer_static_libs
25988c9fbc29Smrg	if test "$use_static_libs" = built && test "$installed" = yes ; then
25998c9fbc29Smrg	  use_static_libs=no
26008c9fbc29Smrg	fi
26018c9fbc29Smrg	if test -n "$library_names" &&
26028c9fbc29Smrg	   { test "$use_static_libs" = no || test -z "$old_library"; }; then
26038c9fbc29Smrg	  if test "$installed" = no; then
26048c9fbc29Smrg	    notinst_deplibs="$notinst_deplibs $lib"
26058c9fbc29Smrg	    need_relink=yes
26068c9fbc29Smrg	  fi
26078c9fbc29Smrg	  # This is a shared library
26088c9fbc29Smrg
26098c9fbc29Smrg	  # Warn about portability, can't link against -module's on
26108c9fbc29Smrg	  # some systems (darwin)
26118c9fbc29Smrg	  if test "$shouldnotlink" = yes && test "$pass" = link ; then
26128c9fbc29Smrg	    $echo
26138c9fbc29Smrg	    if test "$linkmode" = prog; then
26148c9fbc29Smrg	      $echo "*** Warning: Linking the executable $output against the loadable module"
26158c9fbc29Smrg	    else
26168c9fbc29Smrg	      $echo "*** Warning: Linking the shared library $output against the loadable module"
26178c9fbc29Smrg	    fi
26188c9fbc29Smrg	    $echo "*** $linklib is not portable!"
26198c9fbc29Smrg	  fi
26208c9fbc29Smrg	  if test "$linkmode" = lib &&
26218c9fbc29Smrg	     test "$hardcode_into_libs" = yes; then
26228c9fbc29Smrg	    # Hardcode the library path.
26238c9fbc29Smrg	    # Skip directories that are in the system default run-time
26248c9fbc29Smrg	    # search path.
26258c9fbc29Smrg	    case " $sys_lib_dlsearch_path " in
26268c9fbc29Smrg	    *" $absdir "*) ;;
26278c9fbc29Smrg	    *)
26288c9fbc29Smrg	      case "$compile_rpath " in
26298c9fbc29Smrg	      *" $absdir "*) ;;
26308c9fbc29Smrg	      *) compile_rpath="$compile_rpath $absdir"
26318c9fbc29Smrg	      esac
26328c9fbc29Smrg	      ;;
26338c9fbc29Smrg	    esac
26348c9fbc29Smrg	    case " $sys_lib_dlsearch_path " in
26358c9fbc29Smrg	    *" $libdir "*) ;;
26368c9fbc29Smrg	    *)
26378c9fbc29Smrg	      case "$finalize_rpath " in
26388c9fbc29Smrg	      *" $libdir "*) ;;
26398c9fbc29Smrg	      *) finalize_rpath="$finalize_rpath $libdir"
26408c9fbc29Smrg	      esac
26418c9fbc29Smrg	      ;;
26428c9fbc29Smrg	    esac
26438c9fbc29Smrg	  fi
26448c9fbc29Smrg
26458c9fbc29Smrg	  if test -n "$old_archive_from_expsyms_cmds"; then
26468c9fbc29Smrg	    # figure out the soname
26478c9fbc29Smrg	    set dummy $library_names
26488c9fbc29Smrg	    realname="$2"
26498c9fbc29Smrg	    shift; shift
26508c9fbc29Smrg	    libname=`eval \\$echo \"$libname_spec\"`
26518c9fbc29Smrg	    # use dlname if we got it. it's perfectly good, no?
26528c9fbc29Smrg	    if test -n "$dlname"; then
26538c9fbc29Smrg	      soname="$dlname"
26548c9fbc29Smrg	    elif test -n "$soname_spec"; then
26558c9fbc29Smrg	      # bleh windows
26568c9fbc29Smrg	      case $host in
26578c9fbc29Smrg	      *cygwin* | mingw*)
26588c9fbc29Smrg		major=`expr $current - $age`
26598c9fbc29Smrg		versuffix="-$major"
26608c9fbc29Smrg		;;
26618c9fbc29Smrg	      esac
26628c9fbc29Smrg	      eval soname=\"$soname_spec\"
26638c9fbc29Smrg	    else
26648c9fbc29Smrg	      soname="$realname"
26658c9fbc29Smrg	    fi
26668c9fbc29Smrg
26678c9fbc29Smrg	    # Make a new name for the extract_expsyms_cmds to use
26688c9fbc29Smrg	    soroot="$soname"
26698c9fbc29Smrg	    soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
26708c9fbc29Smrg	    newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
26718c9fbc29Smrg
26728c9fbc29Smrg	    # If the library has no export list, then create one now
26738c9fbc29Smrg	    if test -f "$output_objdir/$soname-def"; then :
26748c9fbc29Smrg	    else
26758c9fbc29Smrg	      $show "extracting exported symbol list from \`$soname'"
26768c9fbc29Smrg	      save_ifs="$IFS"; IFS='~'
26778c9fbc29Smrg	      cmds=$extract_expsyms_cmds
26788c9fbc29Smrg	      for cmd in $cmds; do
26798c9fbc29Smrg		IFS="$save_ifs"
26808c9fbc29Smrg		eval cmd=\"$cmd\"
26818c9fbc29Smrg		$show "$cmd"
26828c9fbc29Smrg		$run eval "$cmd" || exit $?
26838c9fbc29Smrg	      done
26848c9fbc29Smrg	      IFS="$save_ifs"
26858c9fbc29Smrg	    fi
26868c9fbc29Smrg
26878c9fbc29Smrg	    # Create $newlib
26888c9fbc29Smrg	    if test -f "$output_objdir/$newlib"; then :; else
26898c9fbc29Smrg	      $show "generating import library for \`$soname'"
26908c9fbc29Smrg	      save_ifs="$IFS"; IFS='~'
26918c9fbc29Smrg	      cmds=$old_archive_from_expsyms_cmds
26928c9fbc29Smrg	      for cmd in $cmds; do
26938c9fbc29Smrg		IFS="$save_ifs"
26948c9fbc29Smrg		eval cmd=\"$cmd\"
26958c9fbc29Smrg		$show "$cmd"
26968c9fbc29Smrg		$run eval "$cmd" || exit $?
26978c9fbc29Smrg	      done
26988c9fbc29Smrg	      IFS="$save_ifs"
26998c9fbc29Smrg	    fi
27008c9fbc29Smrg	    # make sure the library variables are pointing to the new library
27018c9fbc29Smrg	    dir=$output_objdir
27028c9fbc29Smrg	    linklib=$newlib
27038c9fbc29Smrg	  fi # test -n "$old_archive_from_expsyms_cmds"
27048c9fbc29Smrg
27058c9fbc29Smrg	  if test "$linkmode" = prog || test "$mode" != relink; then
27068c9fbc29Smrg	    add_shlibpath=
27078c9fbc29Smrg	    add_dir=
27088c9fbc29Smrg	    add=
27098c9fbc29Smrg	    lib_linked=yes
27108c9fbc29Smrg	    case $hardcode_action in
27118c9fbc29Smrg	    immediate | unsupported)
27128c9fbc29Smrg	      if test "$hardcode_direct" = no; then
27138c9fbc29Smrg		add="$dir/$linklib"
27148c9fbc29Smrg		case $host in
27158c9fbc29Smrg		  *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
27168c9fbc29Smrg		  *-*-sysv4*uw2*) add_dir="-L$dir" ;;
27178c9fbc29Smrg		  *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
27188c9fbc29Smrg		    *-*-unixware7*) add_dir="-L$dir" ;;
27198c9fbc29Smrg		  *-*-darwin* )
27208c9fbc29Smrg		    # if the lib is a module then we can not link against
27218c9fbc29Smrg		    # it, someone is ignoring the new warnings I added
27228c9fbc29Smrg		    if /usr/bin/file -L $add 2> /dev/null |
27238c9fbc29Smrg                      $EGREP ": [^:]* bundle" >/dev/null ; then
27248c9fbc29Smrg		      $echo "** Warning, lib $linklib is a module, not a shared library"
27258c9fbc29Smrg		      if test -z "$old_library" ; then
27268c9fbc29Smrg		        $echo
27278c9fbc29Smrg		        $echo "** And there doesn't seem to be a static archive available"
27288c9fbc29Smrg		        $echo "** The link will probably fail, sorry"
27298c9fbc29Smrg		      else
27308c9fbc29Smrg		        add="$dir/$old_library"
27318c9fbc29Smrg		      fi
27328c9fbc29Smrg		    fi
27338c9fbc29Smrg		esac
27348c9fbc29Smrg	      elif test "$hardcode_minus_L" = no; then
27358c9fbc29Smrg		case $host in
27368c9fbc29Smrg		*-*-sunos*) add_shlibpath="$dir" ;;
27378c9fbc29Smrg		esac
27388c9fbc29Smrg		add_dir="-L$dir"
27398c9fbc29Smrg		add="-l$name"
27408c9fbc29Smrg	      elif test "$hardcode_shlibpath_var" = no; then
27418c9fbc29Smrg		add_shlibpath="$dir"
27428c9fbc29Smrg		add="-l$name"
27438c9fbc29Smrg	      else
27448c9fbc29Smrg		lib_linked=no
27458c9fbc29Smrg	      fi
27468c9fbc29Smrg	      ;;
27478c9fbc29Smrg	    relink)
27488c9fbc29Smrg	      if test "$hardcode_direct" = yes; then
27498c9fbc29Smrg		add="$dir/$linklib"
27508c9fbc29Smrg	      elif test "$hardcode_minus_L" = yes; then
27518c9fbc29Smrg		add_dir="-L$dir"
27528c9fbc29Smrg		# Try looking first in the location we're being installed to.
27538c9fbc29Smrg		if test -n "$inst_prefix_dir"; then
27548c9fbc29Smrg		  case $libdir in
27558c9fbc29Smrg		    [\\/]*)
27568c9fbc29Smrg		      add_dir="$add_dir -L$inst_prefix_dir$libdir"
27578c9fbc29Smrg		      ;;
27588c9fbc29Smrg		  esac
27598c9fbc29Smrg		fi
27608c9fbc29Smrg		add="-l$name"
27618c9fbc29Smrg	      elif test "$hardcode_shlibpath_var" = yes; then
27628c9fbc29Smrg		add_shlibpath="$dir"
27638c9fbc29Smrg		add="-l$name"
27648c9fbc29Smrg	      else
27658c9fbc29Smrg		lib_linked=no
27668c9fbc29Smrg	      fi
27678c9fbc29Smrg	      ;;
27688c9fbc29Smrg	    *) lib_linked=no ;;
27698c9fbc29Smrg	    esac
27708c9fbc29Smrg
27718c9fbc29Smrg	    if test "$lib_linked" != yes; then
27728c9fbc29Smrg	      $echo "$modename: configuration error: unsupported hardcode properties"
27738c9fbc29Smrg	      exit $EXIT_FAILURE
27748c9fbc29Smrg	    fi
27758c9fbc29Smrg
27768c9fbc29Smrg	    if test -n "$add_shlibpath"; then
27778c9fbc29Smrg	      case :$compile_shlibpath: in
27788c9fbc29Smrg	      *":$add_shlibpath:"*) ;;
27798c9fbc29Smrg	      *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
27808c9fbc29Smrg	      esac
27818c9fbc29Smrg	    fi
27828c9fbc29Smrg	    if test "$linkmode" = prog; then
27838c9fbc29Smrg	      test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
27848c9fbc29Smrg	      test -n "$add" && compile_deplibs="$add $compile_deplibs"
27858c9fbc29Smrg	    else
27868c9fbc29Smrg	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
27878c9fbc29Smrg	      test -n "$add" && deplibs="$add $deplibs"
27888c9fbc29Smrg	      if test "$hardcode_direct" != yes && \
27898c9fbc29Smrg		 test "$hardcode_minus_L" != yes && \
27908c9fbc29Smrg		 test "$hardcode_shlibpath_var" = yes; then
27918c9fbc29Smrg		case :$finalize_shlibpath: in
27928c9fbc29Smrg		*":$libdir:"*) ;;
27938c9fbc29Smrg		*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
27948c9fbc29Smrg		esac
27958c9fbc29Smrg	      fi
27968c9fbc29Smrg	    fi
27978c9fbc29Smrg	  fi
27988c9fbc29Smrg
27998c9fbc29Smrg	  if test "$linkmode" = prog || test "$mode" = relink; then
28008c9fbc29Smrg	    add_shlibpath=
28018c9fbc29Smrg	    add_dir=
28028c9fbc29Smrg	    add=
28038c9fbc29Smrg	    # Finalize command for both is simple: just hardcode it.
28048c9fbc29Smrg	    if test "$hardcode_direct" = yes; then
28058c9fbc29Smrg	      add="$libdir/$linklib"
28068c9fbc29Smrg	    elif test "$hardcode_minus_L" = yes; then
28078c9fbc29Smrg	      add_dir="-L$libdir"
28088c9fbc29Smrg	      add="-l$name"
28098c9fbc29Smrg	    elif test "$hardcode_shlibpath_var" = yes; then
28108c9fbc29Smrg	      case :$finalize_shlibpath: in
28118c9fbc29Smrg	      *":$libdir:"*) ;;
28128c9fbc29Smrg	      *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
28138c9fbc29Smrg	      esac
28148c9fbc29Smrg	      add="-l$name"
28158c9fbc29Smrg	    elif test "$hardcode_automatic" = yes; then
28168c9fbc29Smrg	      if test -n "$inst_prefix_dir" &&
28178c9fbc29Smrg		 test -f "$inst_prefix_dir$libdir/$linklib" ; then
28188c9fbc29Smrg	        add="$inst_prefix_dir$libdir/$linklib"
28198c9fbc29Smrg	      else
28208c9fbc29Smrg	        add="$libdir/$linklib"
28218c9fbc29Smrg	      fi
28228c9fbc29Smrg	    else
28238c9fbc29Smrg	      # We cannot seem to hardcode it, guess we'll fake it.
28248c9fbc29Smrg	      add_dir="-L$libdir"
28258c9fbc29Smrg	      # Try looking first in the location we're being installed to.
28268c9fbc29Smrg	      if test -n "$inst_prefix_dir"; then
28278c9fbc29Smrg		case $libdir in
28288c9fbc29Smrg		  [\\/]*)
28298c9fbc29Smrg		    add_dir="$add_dir -L$inst_prefix_dir$libdir"
28308c9fbc29Smrg		    ;;
28318c9fbc29Smrg		esac
28328c9fbc29Smrg	      fi
28338c9fbc29Smrg	      add="-l$name"
28348c9fbc29Smrg	    fi
28358c9fbc29Smrg
28368c9fbc29Smrg	    if test "$linkmode" = prog; then
28378c9fbc29Smrg	      test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
28388c9fbc29Smrg	      test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
28398c9fbc29Smrg	    else
28408c9fbc29Smrg	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
28418c9fbc29Smrg	      test -n "$add" && deplibs="$add $deplibs"
28428c9fbc29Smrg	    fi
28438c9fbc29Smrg	  fi
28448c9fbc29Smrg	elif test "$linkmode" = prog; then
28458c9fbc29Smrg	  # Here we assume that one of hardcode_direct or hardcode_minus_L
28468c9fbc29Smrg	  # is not unsupported.  This is valid on all known static and
28478c9fbc29Smrg	  # shared platforms.
28488c9fbc29Smrg	  if test "$hardcode_direct" != unsupported; then
28498c9fbc29Smrg	    test -n "$old_library" && linklib="$old_library"
28508c9fbc29Smrg	    compile_deplibs="$dir/$linklib $compile_deplibs"
28518c9fbc29Smrg	    finalize_deplibs="$dir/$linklib $finalize_deplibs"
28528c9fbc29Smrg	  else
28538c9fbc29Smrg	    compile_deplibs="-l$name -L$dir $compile_deplibs"
28548c9fbc29Smrg	    finalize_deplibs="-l$name -L$dir $finalize_deplibs"
28558c9fbc29Smrg	  fi
28568c9fbc29Smrg	elif test "$build_libtool_libs" = yes; then
28578c9fbc29Smrg	  # Not a shared library
28588c9fbc29Smrg	  if test "$deplibs_check_method" != pass_all; then
28598c9fbc29Smrg	    # We're trying link a shared library against a static one
28608c9fbc29Smrg	    # but the system doesn't support it.
28618c9fbc29Smrg
28628c9fbc29Smrg	    # Just print a warning and add the library to dependency_libs so
28638c9fbc29Smrg	    # that the program can be linked against the static library.
28648c9fbc29Smrg	    $echo
28658c9fbc29Smrg	    $echo "*** Warning: This system can not link to static lib archive $lib."
28668c9fbc29Smrg	    $echo "*** I have the capability to make that library automatically link in when"
28678c9fbc29Smrg	    $echo "*** you link to this library.  But I can only do this if you have a"
28688c9fbc29Smrg	    $echo "*** shared version of the library, which you do not appear to have."
28698c9fbc29Smrg	    if test "$module" = yes; then
28708c9fbc29Smrg	      $echo "*** But as you try to build a module library, libtool will still create "
28718c9fbc29Smrg	      $echo "*** a static module, that should work as long as the dlopening application"
28728c9fbc29Smrg	      $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
28738c9fbc29Smrg	      if test -z "$global_symbol_pipe"; then
28748c9fbc29Smrg		$echo
28758c9fbc29Smrg		$echo "*** However, this would only work if libtool was able to extract symbol"
28768c9fbc29Smrg		$echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
28778c9fbc29Smrg		$echo "*** not find such a program.  So, this module is probably useless."
28788c9fbc29Smrg		$echo "*** \`nm' from GNU binutils and a full rebuild may help."
28798c9fbc29Smrg	      fi
28808c9fbc29Smrg	      if test "$build_old_libs" = no; then
28818c9fbc29Smrg		build_libtool_libs=module
28828c9fbc29Smrg		build_old_libs=yes
28838c9fbc29Smrg	      else
28848c9fbc29Smrg		build_libtool_libs=no
28858c9fbc29Smrg	      fi
28868c9fbc29Smrg	    fi
28878c9fbc29Smrg	  else
28888c9fbc29Smrg	    deplibs="$dir/$old_library $deplibs"
28898c9fbc29Smrg	    link_static=yes
28908c9fbc29Smrg	  fi
28918c9fbc29Smrg	fi # link shared/static library?
28928c9fbc29Smrg
28938c9fbc29Smrg	if test "$linkmode" = lib; then
28948c9fbc29Smrg	  if test -n "$dependency_libs" &&
28958c9fbc29Smrg	     { test "$hardcode_into_libs" != yes ||
28968c9fbc29Smrg	       test "$build_old_libs" = yes ||
28978c9fbc29Smrg	       test "$link_static" = yes; }; then
28988c9fbc29Smrg	    # Extract -R from dependency_libs
28998c9fbc29Smrg	    temp_deplibs=
29008c9fbc29Smrg	    for libdir in $dependency_libs; do
29018c9fbc29Smrg	      case $libdir in
29028c9fbc29Smrg	      -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
29038c9fbc29Smrg		   case " $xrpath " in
29048c9fbc29Smrg		   *" $temp_xrpath "*) ;;
29058c9fbc29Smrg		   *) xrpath="$xrpath $temp_xrpath";;
29068c9fbc29Smrg		   esac;;
29078c9fbc29Smrg	      *) temp_deplibs="$temp_deplibs $libdir";;
29088c9fbc29Smrg	      esac
29098c9fbc29Smrg	    done
29108c9fbc29Smrg	    dependency_libs="$temp_deplibs"
29118c9fbc29Smrg	  fi
29128c9fbc29Smrg
29138c9fbc29Smrg	  newlib_search_path="$newlib_search_path $absdir"
29148c9fbc29Smrg	  # Link against this library
29158c9fbc29Smrg	  test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
29168c9fbc29Smrg	  # ... and its dependency_libs
29178c9fbc29Smrg	  tmp_libs=
29188c9fbc29Smrg	  for deplib in $dependency_libs; do
29198c9fbc29Smrg	    newdependency_libs="$deplib $newdependency_libs"
29208c9fbc29Smrg	    if test "X$duplicate_deps" = "Xyes" ; then
29218c9fbc29Smrg	      case "$tmp_libs " in
29228c9fbc29Smrg	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
29238c9fbc29Smrg	      esac
29248c9fbc29Smrg	    fi
29258c9fbc29Smrg	    tmp_libs="$tmp_libs $deplib"
29268c9fbc29Smrg	  done
29278c9fbc29Smrg
29288c9fbc29Smrg	  if test "$link_all_deplibs" != no; then
29298c9fbc29Smrg	    # Add the search paths of all dependency libraries
29308c9fbc29Smrg	    for deplib in $dependency_libs; do
29318c9fbc29Smrg	      case $deplib in
29328c9fbc29Smrg	      -L*) path="$deplib" ;;
29338c9fbc29Smrg	      *.la)
29348c9fbc29Smrg		dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
29358c9fbc29Smrg		test "X$dir" = "X$deplib" && dir="."
29368c9fbc29Smrg		# We need an absolute path.
29378c9fbc29Smrg		case $dir in
29388c9fbc29Smrg		[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
29398c9fbc29Smrg		*)
29408c9fbc29Smrg		  absdir=`cd "$dir" && pwd`
29418c9fbc29Smrg		  if test -z "$absdir"; then
29428c9fbc29Smrg		    $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
29438c9fbc29Smrg		    absdir="$dir"
29448c9fbc29Smrg		  fi
29458c9fbc29Smrg		  ;;
29468c9fbc29Smrg		esac
29478c9fbc29Smrg		if grep "^installed=no" $deplib > /dev/null; then
29488c9fbc29Smrg		  path="$absdir/$objdir"
29498c9fbc29Smrg		else
29508c9fbc29Smrg		  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
29518c9fbc29Smrg		  if test -z "$libdir"; then
29528c9fbc29Smrg		    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
29538c9fbc29Smrg		    exit $EXIT_FAILURE
29548c9fbc29Smrg		  fi
29558c9fbc29Smrg		  if test "$absdir" != "$libdir"; then
29568c9fbc29Smrg		    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
29578c9fbc29Smrg		  fi
29588c9fbc29Smrg		  path="$absdir"
29598c9fbc29Smrg		fi
29608c9fbc29Smrg		depdepl=
29618c9fbc29Smrg		case $host in
29628c9fbc29Smrg		*-*-darwin*)
29638c9fbc29Smrg		  # we do not want to link against static libs,
29648c9fbc29Smrg		  # but need to link against shared
29658c9fbc29Smrg		  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
29664e411241Smrg		  eval deplibdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
29678c9fbc29Smrg		  if test -n "$deplibrary_names" ; then
29688c9fbc29Smrg		    for tmp in $deplibrary_names ; do
29698c9fbc29Smrg		      depdepl=$tmp
29708c9fbc29Smrg		    done
29714e411241Smrg		    if test -f "$deplibdir/$depdepl" ; then
29724e411241Smrg		      depdepl="$deplibdir/$depdepl"
29734e411241Smrg	      	    elif test -f "$path/$depdepl" ; then
29748c9fbc29Smrg		      depdepl="$path/$depdepl"
29754e411241Smrg		    else
29764e411241Smrg		      # Can't find it, oh well...
29774e411241Smrg		      depdepl=
29788c9fbc29Smrg		    fi
29798c9fbc29Smrg		    # do not add paths which are already there
29808c9fbc29Smrg		    case " $newlib_search_path " in
29818c9fbc29Smrg		    *" $path "*) ;;
29828c9fbc29Smrg		    *) newlib_search_path="$newlib_search_path $path";;
29838c9fbc29Smrg		    esac
29848c9fbc29Smrg		  fi
29858c9fbc29Smrg		  path=""
29868c9fbc29Smrg		  ;;
29878c9fbc29Smrg		*)
29888c9fbc29Smrg		  path="-L$path"
29898c9fbc29Smrg		  ;;
29908c9fbc29Smrg		esac
29918c9fbc29Smrg		;;
29928c9fbc29Smrg	      -l*)
29938c9fbc29Smrg		case $host in
29948c9fbc29Smrg		*-*-darwin*)
29958c9fbc29Smrg		  # Again, we only want to link against shared libraries
29968c9fbc29Smrg		  eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
29978c9fbc29Smrg		  for tmp in $newlib_search_path ; do
29988c9fbc29Smrg		    if test -f "$tmp/lib$tmp_libs.dylib" ; then
29998c9fbc29Smrg		      eval depdepl="$tmp/lib$tmp_libs.dylib"
30008c9fbc29Smrg		      break
30018c9fbc29Smrg		    fi
30028c9fbc29Smrg		  done
30038c9fbc29Smrg		  path=""
30048c9fbc29Smrg		  ;;
30058c9fbc29Smrg		*) continue ;;
30068c9fbc29Smrg		esac
30078c9fbc29Smrg		;;
30088c9fbc29Smrg	      *) continue ;;
30098c9fbc29Smrg	      esac
30108c9fbc29Smrg	      case " $deplibs " in
30118c9fbc29Smrg	      *" $path "*) ;;
30128c9fbc29Smrg	      *) deplibs="$path $deplibs" ;;
30138c9fbc29Smrg	      esac
30148c9fbc29Smrg	      case " $deplibs " in
30158c9fbc29Smrg	      *" $depdepl "*) ;;
30168c9fbc29Smrg	      *) deplibs="$depdepl $deplibs" ;;
30178c9fbc29Smrg	      esac
30188c9fbc29Smrg	    done
30198c9fbc29Smrg	  fi # link_all_deplibs != no
30208c9fbc29Smrg	fi # linkmode = lib
30218c9fbc29Smrg      done # for deplib in $libs
30228c9fbc29Smrg      dependency_libs="$newdependency_libs"
30238c9fbc29Smrg      if test "$pass" = dlpreopen; then
30248c9fbc29Smrg	# Link the dlpreopened libraries before other libraries
30258c9fbc29Smrg	for deplib in $save_deplibs; do
30268c9fbc29Smrg	  deplibs="$deplib $deplibs"
30278c9fbc29Smrg	done
30288c9fbc29Smrg      fi
30298c9fbc29Smrg      if test "$pass" != dlopen; then
30308c9fbc29Smrg	if test "$pass" != conv; then
30318c9fbc29Smrg	  # Make sure lib_search_path contains only unique directories.
30328c9fbc29Smrg	  lib_search_path=
30338c9fbc29Smrg	  for dir in $newlib_search_path; do
30348c9fbc29Smrg	    case "$lib_search_path " in
30358c9fbc29Smrg	    *" $dir "*) ;;
30368c9fbc29Smrg	    *) lib_search_path="$lib_search_path $dir" ;;
30378c9fbc29Smrg	    esac
30388c9fbc29Smrg	  done
30398c9fbc29Smrg	  newlib_search_path=
30408c9fbc29Smrg	fi
30418c9fbc29Smrg
30428c9fbc29Smrg	if test "$linkmode,$pass" != "prog,link"; then
30438c9fbc29Smrg	  vars="deplibs"
30448c9fbc29Smrg	else
30458c9fbc29Smrg	  vars="compile_deplibs finalize_deplibs"
30468c9fbc29Smrg	fi
30478c9fbc29Smrg	for var in $vars dependency_libs; do
30488c9fbc29Smrg	  # Add libraries to $var in reverse order
30498c9fbc29Smrg	  eval tmp_libs=\"\$$var\"
30508c9fbc29Smrg	  new_libs=
30518c9fbc29Smrg	  for deplib in $tmp_libs; do
30528c9fbc29Smrg	    # FIXME: Pedantically, this is the right thing to do, so
30538c9fbc29Smrg	    #        that some nasty dependency loop isn't accidentally
30548c9fbc29Smrg	    #        broken:
30558c9fbc29Smrg	    #new_libs="$deplib $new_libs"
30568c9fbc29Smrg	    # Pragmatically, this seems to cause very few problems in
30578c9fbc29Smrg	    # practice:
30588c9fbc29Smrg	    case $deplib in
30598c9fbc29Smrg	    -L*) new_libs="$deplib $new_libs" ;;
30608c9fbc29Smrg	    -R*) ;;
30618c9fbc29Smrg	    *)
30628c9fbc29Smrg	      # And here is the reason: when a library appears more
30638c9fbc29Smrg	      # than once as an explicit dependence of a library, or
30648c9fbc29Smrg	      # is implicitly linked in more than once by the
30658c9fbc29Smrg	      # compiler, it is considered special, and multiple
30668c9fbc29Smrg	      # occurrences thereof are not removed.  Compare this
30678c9fbc29Smrg	      # with having the same library being listed as a
30688c9fbc29Smrg	      # dependency of multiple other libraries: in this case,
30698c9fbc29Smrg	      # we know (pedantically, we assume) the library does not
30708c9fbc29Smrg	      # need to be listed more than once, so we keep only the
30718c9fbc29Smrg	      # last copy.  This is not always right, but it is rare
30728c9fbc29Smrg	      # enough that we require users that really mean to play
30738c9fbc29Smrg	      # such unportable linking tricks to link the library
30748c9fbc29Smrg	      # using -Wl,-lname, so that libtool does not consider it
30758c9fbc29Smrg	      # for duplicate removal.
30768c9fbc29Smrg	      case " $specialdeplibs " in
30778c9fbc29Smrg	      *" $deplib "*) new_libs="$deplib $new_libs" ;;
30788c9fbc29Smrg	      *)
30798c9fbc29Smrg		case " $new_libs " in
30808c9fbc29Smrg		*" $deplib "*) ;;
30818c9fbc29Smrg		*) new_libs="$deplib $new_libs" ;;
30828c9fbc29Smrg		esac
30838c9fbc29Smrg		;;
30848c9fbc29Smrg	      esac
30858c9fbc29Smrg	      ;;
30868c9fbc29Smrg	    esac
30878c9fbc29Smrg	  done
30888c9fbc29Smrg	  tmp_libs=
30898c9fbc29Smrg	  for deplib in $new_libs; do
30908c9fbc29Smrg	    case $deplib in
30918c9fbc29Smrg	    -L*)
30928c9fbc29Smrg	      case " $tmp_libs " in
30938c9fbc29Smrg	      *" $deplib "*) ;;
30948c9fbc29Smrg	      *) tmp_libs="$tmp_libs $deplib" ;;
30958c9fbc29Smrg	      esac
30968c9fbc29Smrg	      ;;
30978c9fbc29Smrg	    *) tmp_libs="$tmp_libs $deplib" ;;
30988c9fbc29Smrg	    esac
30998c9fbc29Smrg	  done
31008c9fbc29Smrg	  eval $var=\"$tmp_libs\"
31018c9fbc29Smrg	done # for var
31028c9fbc29Smrg      fi
31038c9fbc29Smrg      # Last step: remove runtime libs from dependency_libs
31048c9fbc29Smrg      # (they stay in deplibs)
31058c9fbc29Smrg      tmp_libs=
31068c9fbc29Smrg      for i in $dependency_libs ; do
31078c9fbc29Smrg	case " $predeps $postdeps $compiler_lib_search_path " in
31088c9fbc29Smrg	*" $i "*)
31098c9fbc29Smrg	  i=""
31108c9fbc29Smrg	  ;;
31118c9fbc29Smrg	esac
31128c9fbc29Smrg	if test -n "$i" ; then
31138c9fbc29Smrg	  tmp_libs="$tmp_libs $i"
31148c9fbc29Smrg	fi
31158c9fbc29Smrg      done
31168c9fbc29Smrg      dependency_libs=$tmp_libs
31178c9fbc29Smrg    done # for pass
31188c9fbc29Smrg    if test "$linkmode" = prog; then
31198c9fbc29Smrg      dlfiles="$newdlfiles"
31208c9fbc29Smrg      dlprefiles="$newdlprefiles"
31218c9fbc29Smrg    fi
31228c9fbc29Smrg
31238c9fbc29Smrg    case $linkmode in
31248c9fbc29Smrg    oldlib)
31254e411241Smrg      case " $deplibs" in
31264e411241Smrg      *\ -l* | *\ -L*)
31274e411241Smrg	$echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 ;;
31284e411241Smrg      esac
31298c9fbc29Smrg
31308c9fbc29Smrg      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
31318c9fbc29Smrg	$echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
31328c9fbc29Smrg      fi
31338c9fbc29Smrg
31348c9fbc29Smrg      if test -n "$rpath"; then
31358c9fbc29Smrg	$echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
31368c9fbc29Smrg      fi
31378c9fbc29Smrg
31388c9fbc29Smrg      if test -n "$xrpath"; then
31398c9fbc29Smrg	$echo "$modename: warning: \`-R' is ignored for archives" 1>&2
31408c9fbc29Smrg      fi
31418c9fbc29Smrg
31428c9fbc29Smrg      if test -n "$vinfo"; then
31438c9fbc29Smrg	$echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
31448c9fbc29Smrg      fi
31458c9fbc29Smrg
31468c9fbc29Smrg      if test -n "$release"; then
31478c9fbc29Smrg	$echo "$modename: warning: \`-release' is ignored for archives" 1>&2
31488c9fbc29Smrg      fi
31498c9fbc29Smrg
31508c9fbc29Smrg      if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
31518c9fbc29Smrg	$echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
31528c9fbc29Smrg      fi
31538c9fbc29Smrg
31548c9fbc29Smrg      # Now set the variables for building old libraries.
31558c9fbc29Smrg      build_libtool_libs=no
31568c9fbc29Smrg      oldlibs="$output"
31578c9fbc29Smrg      objs="$objs$old_deplibs"
31588c9fbc29Smrg      ;;
31598c9fbc29Smrg
31608c9fbc29Smrg    lib)
31618c9fbc29Smrg      # Make sure we only generate libraries of the form `libNAME.la'.
31628c9fbc29Smrg      case $outputname in
31638c9fbc29Smrg      lib*)
31648c9fbc29Smrg	name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
31658c9fbc29Smrg	eval shared_ext=\"$shrext_cmds\"
31668c9fbc29Smrg	eval libname=\"$libname_spec\"
31678c9fbc29Smrg	;;
31688c9fbc29Smrg      *)
31698c9fbc29Smrg	if test "$module" = no; then
31708c9fbc29Smrg	  $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
31718c9fbc29Smrg	  $echo "$help" 1>&2
31728c9fbc29Smrg	  exit $EXIT_FAILURE
31738c9fbc29Smrg	fi
31748c9fbc29Smrg	if test "$need_lib_prefix" != no; then
31758c9fbc29Smrg	  # Add the "lib" prefix for modules if required
31768c9fbc29Smrg	  name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
31778c9fbc29Smrg	  eval shared_ext=\"$shrext_cmds\"
31788c9fbc29Smrg	  eval libname=\"$libname_spec\"
31798c9fbc29Smrg	else
31808c9fbc29Smrg	  libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
31818c9fbc29Smrg	fi
31828c9fbc29Smrg	;;
31838c9fbc29Smrg      esac
31848c9fbc29Smrg
31858c9fbc29Smrg      if test -n "$objs"; then
31868c9fbc29Smrg	if test "$deplibs_check_method" != pass_all; then
31878c9fbc29Smrg	  $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
31888c9fbc29Smrg	  exit $EXIT_FAILURE
31898c9fbc29Smrg	else
31908c9fbc29Smrg	  $echo
31918c9fbc29Smrg	  $echo "*** Warning: Linking the shared library $output against the non-libtool"
31928c9fbc29Smrg	  $echo "*** objects $objs is not portable!"
31938c9fbc29Smrg	  libobjs="$libobjs $objs"
31948c9fbc29Smrg	fi
31958c9fbc29Smrg      fi
31968c9fbc29Smrg
31978c9fbc29Smrg      if test "$dlself" != no; then
31988c9fbc29Smrg	$echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
31998c9fbc29Smrg      fi
32008c9fbc29Smrg
32018c9fbc29Smrg      set dummy $rpath
32028c9fbc29Smrg      if test "$#" -gt 2; then
32038c9fbc29Smrg	$echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
32048c9fbc29Smrg      fi
32058c9fbc29Smrg      install_libdir="$2"
32068c9fbc29Smrg
32078c9fbc29Smrg      oldlibs=
32088c9fbc29Smrg      if test -z "$rpath"; then
32098c9fbc29Smrg	if test "$build_libtool_libs" = yes; then
32108c9fbc29Smrg	  # Building a libtool convenience library.
32118c9fbc29Smrg	  # Some compilers have problems with a `.al' extension so
32128c9fbc29Smrg	  # convenience libraries should have the same extension an
32138c9fbc29Smrg	  # archive normally would.
32148c9fbc29Smrg	  oldlibs="$output_objdir/$libname.$libext $oldlibs"
32158c9fbc29Smrg	  build_libtool_libs=convenience
32168c9fbc29Smrg	  build_old_libs=yes
32178c9fbc29Smrg	fi
32188c9fbc29Smrg
32198c9fbc29Smrg	if test -n "$vinfo"; then
32208c9fbc29Smrg	  $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
32218c9fbc29Smrg	fi
32228c9fbc29Smrg
32238c9fbc29Smrg	if test -n "$release"; then
32248c9fbc29Smrg	  $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
32258c9fbc29Smrg	fi
32268c9fbc29Smrg      else
32278c9fbc29Smrg
32288c9fbc29Smrg	# Parse the version information argument.
32298c9fbc29Smrg	save_ifs="$IFS"; IFS=':'
32308c9fbc29Smrg	set dummy $vinfo 0 0 0
32318c9fbc29Smrg	IFS="$save_ifs"
32328c9fbc29Smrg
32338c9fbc29Smrg	if test -n "$8"; then
32348c9fbc29Smrg	  $echo "$modename: too many parameters to \`-version-info'" 1>&2
32358c9fbc29Smrg	  $echo "$help" 1>&2
32368c9fbc29Smrg	  exit $EXIT_FAILURE
32378c9fbc29Smrg	fi
32388c9fbc29Smrg
32398c9fbc29Smrg	# convert absolute version numbers to libtool ages
32408c9fbc29Smrg	# this retains compatibility with .la files and attempts
32418c9fbc29Smrg	# to make the code below a bit more comprehensible
32428c9fbc29Smrg
32438c9fbc29Smrg	case $vinfo_number in
32448c9fbc29Smrg	yes)
32458c9fbc29Smrg	  number_major="$2"
32468c9fbc29Smrg	  number_minor="$3"
32478c9fbc29Smrg	  number_revision="$4"
32488c9fbc29Smrg	  #
32498c9fbc29Smrg	  # There are really only two kinds -- those that
32508c9fbc29Smrg	  # use the current revision as the major version
32518c9fbc29Smrg	  # and those that subtract age and use age as
32528c9fbc29Smrg	  # a minor version.  But, then there is irix
32538c9fbc29Smrg	  # which has an extra 1 added just for fun
32548c9fbc29Smrg	  #
32558c9fbc29Smrg	  case $version_type in
32564e411241Smrg	  darwin|linux|osf|windows|none)
32578c9fbc29Smrg	    current=`expr $number_major + $number_minor`
32588c9fbc29Smrg	    age="$number_minor"
32598c9fbc29Smrg	    revision="$number_revision"
32608c9fbc29Smrg	    ;;
32618c9fbc29Smrg	  freebsd-aout|freebsd-elf|sunos)
32628c9fbc29Smrg	    current="$number_major"
32638c9fbc29Smrg	    revision="$number_minor"
32648c9fbc29Smrg	    age="0"
32658c9fbc29Smrg	    ;;
32668c9fbc29Smrg	  irix|nonstopux)
32674e411241Smrg	    current=`expr $number_major + $number_minor`
32688c9fbc29Smrg	    age="$number_minor"
32698c9fbc29Smrg	    revision="$number_minor"
32704e411241Smrg	    lt_irix_increment=no
32718c9fbc29Smrg	    ;;
32728c9fbc29Smrg	  esac
32738c9fbc29Smrg	  ;;
32748c9fbc29Smrg	no)
32758c9fbc29Smrg	  current="$2"
32768c9fbc29Smrg	  revision="$3"
32778c9fbc29Smrg	  age="$4"
32788c9fbc29Smrg	  ;;
32798c9fbc29Smrg	esac
32808c9fbc29Smrg
32818c9fbc29Smrg	# Check that each of the things are valid numbers.
32828c9fbc29Smrg	case $current in
32838c9fbc29Smrg	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]) ;;
32848c9fbc29Smrg	*)
32858c9fbc29Smrg	  $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
32868c9fbc29Smrg	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
32878c9fbc29Smrg	  exit $EXIT_FAILURE
32888c9fbc29Smrg	  ;;
32898c9fbc29Smrg	esac
32908c9fbc29Smrg
32918c9fbc29Smrg	case $revision in
32928c9fbc29Smrg	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]) ;;
32938c9fbc29Smrg	*)
32948c9fbc29Smrg	  $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
32958c9fbc29Smrg	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
32968c9fbc29Smrg	  exit $EXIT_FAILURE
32978c9fbc29Smrg	  ;;
32988c9fbc29Smrg	esac
32998c9fbc29Smrg
33008c9fbc29Smrg	case $age in
33018c9fbc29Smrg	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]) ;;
33028c9fbc29Smrg	*)
33038c9fbc29Smrg	  $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
33048c9fbc29Smrg	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
33058c9fbc29Smrg	  exit $EXIT_FAILURE
33068c9fbc29Smrg	  ;;
33078c9fbc29Smrg	esac
33088c9fbc29Smrg
33098c9fbc29Smrg	if test "$age" -gt "$current"; then
33108c9fbc29Smrg	  $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
33118c9fbc29Smrg	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
33128c9fbc29Smrg	  exit $EXIT_FAILURE
33138c9fbc29Smrg	fi
33148c9fbc29Smrg
33158c9fbc29Smrg	# Calculate the version variables.
33168c9fbc29Smrg	major=
33178c9fbc29Smrg	versuffix=
33188c9fbc29Smrg	verstring=
33198c9fbc29Smrg	case $version_type in
33208c9fbc29Smrg	none) ;;
33218c9fbc29Smrg
33228c9fbc29Smrg	darwin)
33238c9fbc29Smrg	  # Like Linux, but with the current version available in
33248c9fbc29Smrg	  # verstring for coding it into the library header
33258c9fbc29Smrg	  major=.`expr $current - $age`
33268c9fbc29Smrg	  versuffix="$major.$age.$revision"
33278c9fbc29Smrg	  # Darwin ld doesn't like 0 for these options...
33288c9fbc29Smrg	  minor_current=`expr $current + 1`
33294e411241Smrg	  xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
33304e411241Smrg	  verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
33318c9fbc29Smrg	  ;;
33328c9fbc29Smrg
33338c9fbc29Smrg	freebsd-aout)
33348c9fbc29Smrg	  major=".$current"
33358c9fbc29Smrg	  versuffix=".$current.$revision";
33368c9fbc29Smrg	  ;;
33378c9fbc29Smrg
33388c9fbc29Smrg	freebsd-elf)
33398c9fbc29Smrg	  major=".$current"
33408c9fbc29Smrg	  versuffix=".$current";
33418c9fbc29Smrg	  ;;
33428c9fbc29Smrg
33438c9fbc29Smrg	irix | nonstopux)
33444e411241Smrg	  if test "X$lt_irix_increment" = "Xno"; then
33454e411241Smrg	    major=`expr $current - $age`
33464e411241Smrg	  else
33474e411241Smrg	    major=`expr $current - $age + 1`
33484e411241Smrg	  fi
33498c9fbc29Smrg	  case $version_type in
33508c9fbc29Smrg	    nonstopux) verstring_prefix=nonstopux ;;
33518c9fbc29Smrg	    *)         verstring_prefix=sgi ;;
33528c9fbc29Smrg	  esac
33538c9fbc29Smrg	  verstring="$verstring_prefix$major.$revision"
33548c9fbc29Smrg
33558c9fbc29Smrg	  # Add in all the interfaces that we are compatible with.
33568c9fbc29Smrg	  loop=$revision
33578c9fbc29Smrg	  while test "$loop" -ne 0; do
33588c9fbc29Smrg	    iface=`expr $revision - $loop`
33598c9fbc29Smrg	    loop=`expr $loop - 1`
33608c9fbc29Smrg	    verstring="$verstring_prefix$major.$iface:$verstring"
33618c9fbc29Smrg	  done
33628c9fbc29Smrg
33638c9fbc29Smrg	  # Before this point, $major must not contain `.'.
33648c9fbc29Smrg	  major=.$major
33658c9fbc29Smrg	  versuffix="$major.$revision"
33668c9fbc29Smrg	  ;;
33678c9fbc29Smrg
33688c9fbc29Smrg	linux)
33698c9fbc29Smrg	  major=.`expr $current - $age`
33708c9fbc29Smrg	  versuffix="$major.$age.$revision"
33718c9fbc29Smrg	  ;;
33728c9fbc29Smrg
33738c9fbc29Smrg	osf)
33748c9fbc29Smrg	  major=.`expr $current - $age`
33758c9fbc29Smrg	  versuffix=".$current.$age.$revision"
33768c9fbc29Smrg	  verstring="$current.$age.$revision"
33778c9fbc29Smrg
33788c9fbc29Smrg	  # Add in all the interfaces that we are compatible with.
33798c9fbc29Smrg	  loop=$age
33808c9fbc29Smrg	  while test "$loop" -ne 0; do
33818c9fbc29Smrg	    iface=`expr $current - $loop`
33828c9fbc29Smrg	    loop=`expr $loop - 1`
33838c9fbc29Smrg	    verstring="$verstring:${iface}.0"
33848c9fbc29Smrg	  done
33858c9fbc29Smrg
33868c9fbc29Smrg	  # Make executables depend on our current version.
33878c9fbc29Smrg	  verstring="$verstring:${current}.0"
33888c9fbc29Smrg	  ;;
33898c9fbc29Smrg
33908c9fbc29Smrg	sunos)
33918c9fbc29Smrg	  major=".$current"
33928c9fbc29Smrg	  versuffix=".$current.$revision"
33938c9fbc29Smrg	  ;;
33948c9fbc29Smrg
33958c9fbc29Smrg	windows)
33968c9fbc29Smrg	  # Use '-' rather than '.', since we only want one
33978c9fbc29Smrg	  # extension on DOS 8.3 filesystems.
33988c9fbc29Smrg	  major=`expr $current - $age`
33998c9fbc29Smrg	  versuffix="-$major"
34008c9fbc29Smrg	  ;;
34018c9fbc29Smrg
34028c9fbc29Smrg	*)
34038c9fbc29Smrg	  $echo "$modename: unknown library version type \`$version_type'" 1>&2
34048c9fbc29Smrg	  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
34058c9fbc29Smrg	  exit $EXIT_FAILURE
34068c9fbc29Smrg	  ;;
34078c9fbc29Smrg	esac
34088c9fbc29Smrg
34098c9fbc29Smrg	# Clear the version info if we defaulted, and they specified a release.
34108c9fbc29Smrg	if test -z "$vinfo" && test -n "$release"; then
34118c9fbc29Smrg	  major=
34128c9fbc29Smrg	  case $version_type in
34138c9fbc29Smrg	  darwin)
34148c9fbc29Smrg	    # we can't check for "0.0" in archive_cmds due to quoting
34158c9fbc29Smrg	    # problems, so we reset it completely
34168c9fbc29Smrg	    verstring=
34178c9fbc29Smrg	    ;;
34188c9fbc29Smrg	  *)
34198c9fbc29Smrg	    verstring="0.0"
34208c9fbc29Smrg	    ;;
34218c9fbc29Smrg	  esac
34228c9fbc29Smrg	  if test "$need_version" = no; then
34238c9fbc29Smrg	    versuffix=
34248c9fbc29Smrg	  else
34258c9fbc29Smrg	    versuffix=".0.0"
34268c9fbc29Smrg	  fi
34278c9fbc29Smrg	fi
34288c9fbc29Smrg
34298c9fbc29Smrg	# Remove version info from name if versioning should be avoided
34308c9fbc29Smrg	if test "$avoid_version" = yes && test "$need_version" = no; then
34318c9fbc29Smrg	  major=
34328c9fbc29Smrg	  versuffix=
34338c9fbc29Smrg	  verstring=""
34348c9fbc29Smrg	fi
34358c9fbc29Smrg
34368c9fbc29Smrg	# Check to see if the archive will have undefined symbols.
34378c9fbc29Smrg	if test "$allow_undefined" = yes; then
34388c9fbc29Smrg	  if test "$allow_undefined_flag" = unsupported; then
34398c9fbc29Smrg	    $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
34408c9fbc29Smrg	    build_libtool_libs=no
34418c9fbc29Smrg	    build_old_libs=yes
34428c9fbc29Smrg	  fi
34438c9fbc29Smrg	else
34448c9fbc29Smrg	  # Don't allow undefined symbols.
34458c9fbc29Smrg	  allow_undefined_flag="$no_undefined_flag"
34468c9fbc29Smrg	fi
34478c9fbc29Smrg      fi
34488c9fbc29Smrg
34498c9fbc29Smrg      if test "$mode" != relink; then
34508c9fbc29Smrg	# Remove our outputs, but don't remove object files since they
34518c9fbc29Smrg	# may have been created when compiling PIC objects.
34528c9fbc29Smrg	removelist=
34538c9fbc29Smrg	tempremovelist=`$echo "$output_objdir/*"`
34548c9fbc29Smrg	for p in $tempremovelist; do
34558c9fbc29Smrg	  case $p in
34568c9fbc29Smrg	    *.$objext)
34578c9fbc29Smrg	       ;;
34588c9fbc29Smrg	    $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
34598c9fbc29Smrg	       if test "X$precious_files_regex" != "X"; then
34608c9fbc29Smrg	         if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
34618c9fbc29Smrg	         then
34628c9fbc29Smrg		   continue
34638c9fbc29Smrg		 fi
34648c9fbc29Smrg	       fi
34658c9fbc29Smrg	       removelist="$removelist $p"
34668c9fbc29Smrg	       ;;
34678c9fbc29Smrg	    *) ;;
34688c9fbc29Smrg	  esac
34698c9fbc29Smrg	done
34708c9fbc29Smrg	if test -n "$removelist"; then
34718c9fbc29Smrg	  $show "${rm}r $removelist"
34728c9fbc29Smrg	  $run ${rm}r $removelist
34738c9fbc29Smrg	fi
34748c9fbc29Smrg      fi
34758c9fbc29Smrg
34768c9fbc29Smrg      # Now set the variables for building old libraries.
34778c9fbc29Smrg      if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
34788c9fbc29Smrg	oldlibs="$oldlibs $output_objdir/$libname.$libext"
34798c9fbc29Smrg
34808c9fbc29Smrg	# Transform .lo files to .o files.
34818c9fbc29Smrg	oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
34828c9fbc29Smrg      fi
34838c9fbc29Smrg
34848c9fbc29Smrg      # Eliminate all temporary directories.
34854e411241Smrg      #for path in $notinst_path; do
34864e411241Smrg      #	lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
34874e411241Smrg      #	deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
34884e411241Smrg      #	dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
34894e411241Smrg      #done
34908c9fbc29Smrg
34918c9fbc29Smrg      if test -n "$xrpath"; then
34928c9fbc29Smrg	# If the user specified any rpath flags, then add them.
34938c9fbc29Smrg	temp_xrpath=
34948c9fbc29Smrg	for libdir in $xrpath; do
34958c9fbc29Smrg	  temp_xrpath="$temp_xrpath -R$libdir"
34968c9fbc29Smrg	  case "$finalize_rpath " in
34978c9fbc29Smrg	  *" $libdir "*) ;;
34988c9fbc29Smrg	  *) finalize_rpath="$finalize_rpath $libdir" ;;
34998c9fbc29Smrg	  esac
35008c9fbc29Smrg	done
35018c9fbc29Smrg	if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
35028c9fbc29Smrg	  dependency_libs="$temp_xrpath $dependency_libs"
35038c9fbc29Smrg	fi
35048c9fbc29Smrg      fi
35058c9fbc29Smrg
35068c9fbc29Smrg      # Make sure dlfiles contains only unique files that won't be dlpreopened
35078c9fbc29Smrg      old_dlfiles="$dlfiles"
35088c9fbc29Smrg      dlfiles=
35098c9fbc29Smrg      for lib in $old_dlfiles; do
35108c9fbc29Smrg	case " $dlprefiles $dlfiles " in
35118c9fbc29Smrg	*" $lib "*) ;;
35128c9fbc29Smrg	*) dlfiles="$dlfiles $lib" ;;
35138c9fbc29Smrg	esac
35148c9fbc29Smrg      done
35158c9fbc29Smrg
35168c9fbc29Smrg      # Make sure dlprefiles contains only unique files
35178c9fbc29Smrg      old_dlprefiles="$dlprefiles"
35188c9fbc29Smrg      dlprefiles=
35198c9fbc29Smrg      for lib in $old_dlprefiles; do
35208c9fbc29Smrg	case "$dlprefiles " in
35218c9fbc29Smrg	*" $lib "*) ;;
35228c9fbc29Smrg	*) dlprefiles="$dlprefiles $lib" ;;
35238c9fbc29Smrg	esac
35248c9fbc29Smrg      done
35258c9fbc29Smrg
35268c9fbc29Smrg      if test "$build_libtool_libs" = yes; then
35278c9fbc29Smrg	if test -n "$rpath"; then
35288c9fbc29Smrg	  case $host in
35298c9fbc29Smrg	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
35308c9fbc29Smrg	    # these systems don't actually have a c library (as such)!
35318c9fbc29Smrg	    ;;
35328c9fbc29Smrg	  *-*-rhapsody* | *-*-darwin1.[012])
35338c9fbc29Smrg	    # Rhapsody C library is in the System framework
35348c9fbc29Smrg	    deplibs="$deplibs -framework System"
35358c9fbc29Smrg	    ;;
35368c9fbc29Smrg	  *-*-netbsd*)
35378c9fbc29Smrg	    # Don't link with libc until the a.out ld.so is fixed.
35388c9fbc29Smrg	    ;;
35398c9fbc29Smrg	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
35408c9fbc29Smrg	    # Do not include libc due to us having libc/libc_r.
35418c9fbc29Smrg	    ;;
35428c9fbc29Smrg	  *-*-sco3.2v5* | *-*-sco5v6*)
35438c9fbc29Smrg	    # Causes problems with __ctype
35448c9fbc29Smrg	    ;;
35458c9fbc29Smrg	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
35468c9fbc29Smrg	    # Compiler inserts libc in the correct place for threads to work
35478c9fbc29Smrg	    ;;
35488c9fbc29Smrg 	  *)
35498c9fbc29Smrg	    # Add libc to deplibs on all other systems if necessary.
35508c9fbc29Smrg	    if test "$build_libtool_need_lc" = "yes"; then
35518c9fbc29Smrg	      deplibs="$deplibs -lc"
35528c9fbc29Smrg	    fi
35538c9fbc29Smrg	    ;;
35548c9fbc29Smrg	  esac
35558c9fbc29Smrg	fi
35568c9fbc29Smrg
35578c9fbc29Smrg	# Transform deplibs into only deplibs that can be linked in shared.
35588c9fbc29Smrg	name_save=$name
35598c9fbc29Smrg	libname_save=$libname
35608c9fbc29Smrg	release_save=$release
35618c9fbc29Smrg	versuffix_save=$versuffix
35628c9fbc29Smrg	major_save=$major
35638c9fbc29Smrg	# I'm not sure if I'm treating the release correctly.  I think
35648c9fbc29Smrg	# release should show up in the -l (ie -lgmp5) so we don't want to
35658c9fbc29Smrg	# add it in twice.  Is that correct?
35668c9fbc29Smrg	release=""
35678c9fbc29Smrg	versuffix=""
35688c9fbc29Smrg	major=""
35698c9fbc29Smrg	newdeplibs=
35708c9fbc29Smrg	droppeddeps=no
35718c9fbc29Smrg	case $deplibs_check_method in
35728c9fbc29Smrg	pass_all)
35738c9fbc29Smrg	  # Don't check for shared/static.  Everything works.
35748c9fbc29Smrg	  # This might be a little naive.  We might want to check
35758c9fbc29Smrg	  # whether the library exists or not.  But this is on
35768c9fbc29Smrg	  # osf3 & osf4 and I'm not really sure... Just
35778c9fbc29Smrg	  # implementing what was already the behavior.
35788c9fbc29Smrg	  newdeplibs=$deplibs
35798c9fbc29Smrg	  ;;
35808c9fbc29Smrg	test_compile)
35818c9fbc29Smrg	  # This code stresses the "libraries are programs" paradigm to its
35828c9fbc29Smrg	  # limits. Maybe even breaks it.  We compile a program, linking it
35838c9fbc29Smrg	  # against the deplibs as a proxy for the library.  Then we can check
35848c9fbc29Smrg	  # whether they linked in statically or dynamically with ldd.
35858c9fbc29Smrg	  $rm conftest.c
35868c9fbc29Smrg	  cat > conftest.c <<EOF
35878c9fbc29Smrg	  int main() { return 0; }
35888c9fbc29SmrgEOF
35898c9fbc29Smrg	  $rm conftest
35904e411241Smrg	  if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
35918c9fbc29Smrg	    ldd_output=`ldd conftest`
35928c9fbc29Smrg	    for i in $deplibs; do
35938c9fbc29Smrg	      name=`expr $i : '-l\(.*\)'`
35948c9fbc29Smrg	      # If $name is empty we are operating on a -L argument.
35954e411241Smrg              if test "$name" != "" && test "$name" != "0"; then
35968c9fbc29Smrg		if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
35978c9fbc29Smrg		  case " $predeps $postdeps " in
35988c9fbc29Smrg		  *" $i "*)
35998c9fbc29Smrg		    newdeplibs="$newdeplibs $i"
36008c9fbc29Smrg		    i=""
36018c9fbc29Smrg		    ;;
36028c9fbc29Smrg		  esac
36038c9fbc29Smrg	        fi
36048c9fbc29Smrg		if test -n "$i" ; then
36058c9fbc29Smrg		  libname=`eval \\$echo \"$libname_spec\"`
36068c9fbc29Smrg		  deplib_matches=`eval \\$echo \"$library_names_spec\"`
36078c9fbc29Smrg		  set dummy $deplib_matches
36088c9fbc29Smrg		  deplib_match=$2
36098c9fbc29Smrg		  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
36108c9fbc29Smrg		    newdeplibs="$newdeplibs $i"
36118c9fbc29Smrg		  else
36128c9fbc29Smrg		    droppeddeps=yes
36138c9fbc29Smrg		    $echo
36148c9fbc29Smrg		    $echo "*** Warning: dynamic linker does not accept needed library $i."
36158c9fbc29Smrg		    $echo "*** I have the capability to make that library automatically link in when"
36168c9fbc29Smrg		    $echo "*** you link to this library.  But I can only do this if you have a"
36178c9fbc29Smrg		    $echo "*** shared version of the library, which I believe you do not have"
36188c9fbc29Smrg		    $echo "*** because a test_compile did reveal that the linker did not use it for"
36198c9fbc29Smrg		    $echo "*** its dynamic dependency list that programs get resolved with at runtime."
36208c9fbc29Smrg		  fi
36218c9fbc29Smrg		fi
36228c9fbc29Smrg	      else
36238c9fbc29Smrg		newdeplibs="$newdeplibs $i"
36248c9fbc29Smrg	      fi
36258c9fbc29Smrg	    done
36268c9fbc29Smrg	  else
36278c9fbc29Smrg	    # Error occurred in the first compile.  Let's try to salvage
36288c9fbc29Smrg	    # the situation: Compile a separate program for each library.
36298c9fbc29Smrg	    for i in $deplibs; do
36308c9fbc29Smrg	      name=`expr $i : '-l\(.*\)'`
36318c9fbc29Smrg	      # If $name is empty we are operating on a -L argument.
36328c9fbc29Smrg              if test "$name" != "" && test "$name" != "0"; then
36338c9fbc29Smrg		$rm conftest
36344e411241Smrg		if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
36358c9fbc29Smrg		  ldd_output=`ldd conftest`
36368c9fbc29Smrg		  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
36378c9fbc29Smrg		    case " $predeps $postdeps " in
36388c9fbc29Smrg		    *" $i "*)
36398c9fbc29Smrg		      newdeplibs="$newdeplibs $i"
36408c9fbc29Smrg		      i=""
36418c9fbc29Smrg		      ;;
36428c9fbc29Smrg		    esac
36438c9fbc29Smrg		  fi
36448c9fbc29Smrg		  if test -n "$i" ; then
36458c9fbc29Smrg		    libname=`eval \\$echo \"$libname_spec\"`
36468c9fbc29Smrg		    deplib_matches=`eval \\$echo \"$library_names_spec\"`
36478c9fbc29Smrg		    set dummy $deplib_matches
36488c9fbc29Smrg		    deplib_match=$2
36498c9fbc29Smrg		    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
36508c9fbc29Smrg		      newdeplibs="$newdeplibs $i"
36518c9fbc29Smrg		    else
36528c9fbc29Smrg		      droppeddeps=yes
36538c9fbc29Smrg		      $echo
36548c9fbc29Smrg		      $echo "*** Warning: dynamic linker does not accept needed library $i."
36558c9fbc29Smrg		      $echo "*** I have the capability to make that library automatically link in when"
36568c9fbc29Smrg		      $echo "*** you link to this library.  But I can only do this if you have a"
36578c9fbc29Smrg		      $echo "*** shared version of the library, which you do not appear to have"
36588c9fbc29Smrg		      $echo "*** because a test_compile did reveal that the linker did not use this one"
36598c9fbc29Smrg		      $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
36608c9fbc29Smrg		    fi
36618c9fbc29Smrg		  fi
36628c9fbc29Smrg		else
36638c9fbc29Smrg		  droppeddeps=yes
36648c9fbc29Smrg		  $echo
36658c9fbc29Smrg		  $echo "*** Warning!  Library $i is needed by this library but I was not able to"
36664e411241Smrg		  $echo "*** make it link in!  You will probably need to install it or some"
36678c9fbc29Smrg		  $echo "*** library that it depends on before this library will be fully"
36688c9fbc29Smrg		  $echo "*** functional.  Installing it before continuing would be even better."
36698c9fbc29Smrg		fi
36708c9fbc29Smrg	      else
36718c9fbc29Smrg		newdeplibs="$newdeplibs $i"
36728c9fbc29Smrg	      fi
36738c9fbc29Smrg	    done
36748c9fbc29Smrg	  fi
36758c9fbc29Smrg	  ;;
36768c9fbc29Smrg	file_magic*)
36778c9fbc29Smrg	  set dummy $deplibs_check_method
36788c9fbc29Smrg	  file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
36798c9fbc29Smrg	  for a_deplib in $deplibs; do
36808c9fbc29Smrg	    name=`expr $a_deplib : '-l\(.*\)'`
36818c9fbc29Smrg	    # If $name is empty we are operating on a -L argument.
36828c9fbc29Smrg            if test "$name" != "" && test  "$name" != "0"; then
36838c9fbc29Smrg	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
36848c9fbc29Smrg		case " $predeps $postdeps " in
36858c9fbc29Smrg		*" $a_deplib "*)
36868c9fbc29Smrg		  newdeplibs="$newdeplibs $a_deplib"
36878c9fbc29Smrg		  a_deplib=""
36888c9fbc29Smrg		  ;;
36898c9fbc29Smrg		esac
36908c9fbc29Smrg	      fi
36918c9fbc29Smrg	      if test -n "$a_deplib" ; then
36928c9fbc29Smrg		libname=`eval \\$echo \"$libname_spec\"`
36938c9fbc29Smrg		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
36948c9fbc29Smrg		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
36958c9fbc29Smrg		  for potent_lib in $potential_libs; do
36968c9fbc29Smrg		      # Follow soft links.
36978c9fbc29Smrg		      if ls -lLd "$potent_lib" 2>/dev/null \
36988c9fbc29Smrg			 | grep " -> " >/dev/null; then
36998c9fbc29Smrg			continue
37008c9fbc29Smrg		      fi
37018c9fbc29Smrg		      # The statement above tries to avoid entering an
37028c9fbc29Smrg		      # endless loop below, in case of cyclic links.
37038c9fbc29Smrg		      # We might still enter an endless loop, since a link
37048c9fbc29Smrg		      # loop can be closed while we follow links,
37058c9fbc29Smrg		      # but so what?
37068c9fbc29Smrg		      potlib="$potent_lib"
37078c9fbc29Smrg		      while test -h "$potlib" 2>/dev/null; do
37088c9fbc29Smrg			potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
37098c9fbc29Smrg			case $potliblink in
37108c9fbc29Smrg			[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
37118c9fbc29Smrg			*) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
37128c9fbc29Smrg			esac
37138c9fbc29Smrg		      done
37148c9fbc29Smrg		      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
37158c9fbc29Smrg			 | ${SED} 10q \
37168c9fbc29Smrg			 | $EGREP "$file_magic_regex" > /dev/null; then
37178c9fbc29Smrg			newdeplibs="$newdeplibs $a_deplib"
37188c9fbc29Smrg			a_deplib=""
37198c9fbc29Smrg			break 2
37208c9fbc29Smrg		      fi
37218c9fbc29Smrg		  done
37228c9fbc29Smrg		done
37238c9fbc29Smrg	      fi
37248c9fbc29Smrg	      if test -n "$a_deplib" ; then
37258c9fbc29Smrg		droppeddeps=yes
37268c9fbc29Smrg		$echo
37278c9fbc29Smrg		$echo "*** Warning: linker path does not have real file for library $a_deplib."
37288c9fbc29Smrg		$echo "*** I have the capability to make that library automatically link in when"
37298c9fbc29Smrg		$echo "*** you link to this library.  But I can only do this if you have a"
37308c9fbc29Smrg		$echo "*** shared version of the library, which you do not appear to have"
37318c9fbc29Smrg		$echo "*** because I did check the linker path looking for a file starting"
37328c9fbc29Smrg		if test -z "$potlib" ; then
37338c9fbc29Smrg		  $echo "*** with $libname but no candidates were found. (...for file magic test)"
37348c9fbc29Smrg		else
37358c9fbc29Smrg		  $echo "*** with $libname and none of the candidates passed a file format test"
37368c9fbc29Smrg		  $echo "*** using a file magic. Last file checked: $potlib"
37378c9fbc29Smrg		fi
37388c9fbc29Smrg	      fi
37398c9fbc29Smrg	    else
37408c9fbc29Smrg	      # Add a -L argument.
37418c9fbc29Smrg	      newdeplibs="$newdeplibs $a_deplib"
37428c9fbc29Smrg	    fi
37438c9fbc29Smrg	  done # Gone through all deplibs.
37448c9fbc29Smrg	  ;;
37458c9fbc29Smrg	match_pattern*)
37468c9fbc29Smrg	  set dummy $deplibs_check_method
37478c9fbc29Smrg	  match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
37488c9fbc29Smrg	  for a_deplib in $deplibs; do
37498c9fbc29Smrg	    name=`expr $a_deplib : '-l\(.*\)'`
37508c9fbc29Smrg	    # If $name is empty we are operating on a -L argument.
37518c9fbc29Smrg	    if test -n "$name" && test "$name" != "0"; then
37528c9fbc29Smrg	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
37538c9fbc29Smrg		case " $predeps $postdeps " in
37548c9fbc29Smrg		*" $a_deplib "*)
37558c9fbc29Smrg		  newdeplibs="$newdeplibs $a_deplib"
37568c9fbc29Smrg		  a_deplib=""
37578c9fbc29Smrg		  ;;
37588c9fbc29Smrg		esac
37598c9fbc29Smrg	      fi
37608c9fbc29Smrg	      if test -n "$a_deplib" ; then
37618c9fbc29Smrg		libname=`eval \\$echo \"$libname_spec\"`
37628c9fbc29Smrg		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
37638c9fbc29Smrg		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
37648c9fbc29Smrg		  for potent_lib in $potential_libs; do
37658c9fbc29Smrg		    potlib="$potent_lib" # see symlink-check above in file_magic test
37668c9fbc29Smrg		    if eval $echo \"$potent_lib\" 2>/dev/null \
37678c9fbc29Smrg		        | ${SED} 10q \
37688c9fbc29Smrg		        | $EGREP "$match_pattern_regex" > /dev/null; then
37698c9fbc29Smrg		      newdeplibs="$newdeplibs $a_deplib"
37708c9fbc29Smrg		      a_deplib=""
37718c9fbc29Smrg		      break 2
37728c9fbc29Smrg		    fi
37738c9fbc29Smrg		  done
37748c9fbc29Smrg		done
37758c9fbc29Smrg	      fi
37768c9fbc29Smrg	      if test -n "$a_deplib" ; then
37778c9fbc29Smrg		droppeddeps=yes
37788c9fbc29Smrg		$echo
37798c9fbc29Smrg		$echo "*** Warning: linker path does not have real file for library $a_deplib."
37808c9fbc29Smrg		$echo "*** I have the capability to make that library automatically link in when"
37818c9fbc29Smrg		$echo "*** you link to this library.  But I can only do this if you have a"
37828c9fbc29Smrg		$echo "*** shared version of the library, which you do not appear to have"
37838c9fbc29Smrg		$echo "*** because I did check the linker path looking for a file starting"
37848c9fbc29Smrg		if test -z "$potlib" ; then
37858c9fbc29Smrg		  $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
37868c9fbc29Smrg		else
37878c9fbc29Smrg		  $echo "*** with $libname and none of the candidates passed a file format test"
37888c9fbc29Smrg		  $echo "*** using a regex pattern. Last file checked: $potlib"
37898c9fbc29Smrg		fi
37908c9fbc29Smrg	      fi
37918c9fbc29Smrg	    else
37928c9fbc29Smrg	      # Add a -L argument.
37938c9fbc29Smrg	      newdeplibs="$newdeplibs $a_deplib"
37948c9fbc29Smrg	    fi
37958c9fbc29Smrg	  done # Gone through all deplibs.
37968c9fbc29Smrg	  ;;
37978c9fbc29Smrg	none | unknown | *)
37988c9fbc29Smrg	  newdeplibs=""
37998c9fbc29Smrg	  tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
38008c9fbc29Smrg	    -e 's/ -[LR][^ ]*//g'`
38018c9fbc29Smrg	  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
38028c9fbc29Smrg	    for i in $predeps $postdeps ; do
38038c9fbc29Smrg	      # can't use Xsed below, because $i might contain '/'
38048c9fbc29Smrg	      tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
38058c9fbc29Smrg	    done
38068c9fbc29Smrg	  fi
38078c9fbc29Smrg	  if $echo "X $tmp_deplibs" | $Xsed -e 's/[ 	]//g' \
38088c9fbc29Smrg	    | grep . >/dev/null; then
38098c9fbc29Smrg	    $echo
38108c9fbc29Smrg	    if test "X$deplibs_check_method" = "Xnone"; then
38118c9fbc29Smrg	      $echo "*** Warning: inter-library dependencies are not supported in this platform."
38128c9fbc29Smrg	    else
38138c9fbc29Smrg	      $echo "*** Warning: inter-library dependencies are not known to be supported."
38148c9fbc29Smrg	    fi
38158c9fbc29Smrg	    $echo "*** All declared inter-library dependencies are being dropped."
38168c9fbc29Smrg	    droppeddeps=yes
38178c9fbc29Smrg	  fi
38188c9fbc29Smrg	  ;;
38198c9fbc29Smrg	esac
38208c9fbc29Smrg	versuffix=$versuffix_save
38218c9fbc29Smrg	major=$major_save
38228c9fbc29Smrg	release=$release_save
38238c9fbc29Smrg	libname=$libname_save
38248c9fbc29Smrg	name=$name_save
38258c9fbc29Smrg
38268c9fbc29Smrg	case $host in
38278c9fbc29Smrg	*-*-rhapsody* | *-*-darwin1.[012])
38288c9fbc29Smrg	  # On Rhapsody replace the C library is the System framework
38298c9fbc29Smrg	  newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
38308c9fbc29Smrg	  ;;
38318c9fbc29Smrg	esac
38328c9fbc29Smrg
38338c9fbc29Smrg	if test "$droppeddeps" = yes; then
38348c9fbc29Smrg	  if test "$module" = yes; then
38358c9fbc29Smrg	    $echo
38368c9fbc29Smrg	    $echo "*** Warning: libtool could not satisfy all declared inter-library"
38378c9fbc29Smrg	    $echo "*** dependencies of module $libname.  Therefore, libtool will create"
38388c9fbc29Smrg	    $echo "*** a static module, that should work as long as the dlopening"
38398c9fbc29Smrg	    $echo "*** application is linked with the -dlopen flag."
38408c9fbc29Smrg	    if test -z "$global_symbol_pipe"; then
38418c9fbc29Smrg	      $echo
38428c9fbc29Smrg	      $echo "*** However, this would only work if libtool was able to extract symbol"
38438c9fbc29Smrg	      $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
38448c9fbc29Smrg	      $echo "*** not find such a program.  So, this module is probably useless."
38458c9fbc29Smrg	      $echo "*** \`nm' from GNU binutils and a full rebuild may help."
38468c9fbc29Smrg	    fi
38478c9fbc29Smrg	    if test "$build_old_libs" = no; then
38488c9fbc29Smrg	      oldlibs="$output_objdir/$libname.$libext"
38498c9fbc29Smrg	      build_libtool_libs=module
38508c9fbc29Smrg	      build_old_libs=yes
38518c9fbc29Smrg	    else
38528c9fbc29Smrg	      build_libtool_libs=no
38538c9fbc29Smrg	    fi
38548c9fbc29Smrg	  else
38558c9fbc29Smrg	    $echo "*** The inter-library dependencies that have been dropped here will be"
38568c9fbc29Smrg	    $echo "*** automatically added whenever a program is linked with this library"
38578c9fbc29Smrg	    $echo "*** or is declared to -dlopen it."
38588c9fbc29Smrg
38598c9fbc29Smrg	    if test "$allow_undefined" = no; then
38608c9fbc29Smrg	      $echo
38618c9fbc29Smrg	      $echo "*** Since this library must not contain undefined symbols,"
38628c9fbc29Smrg	      $echo "*** because either the platform does not support them or"
38638c9fbc29Smrg	      $echo "*** it was explicitly requested with -no-undefined,"
38648c9fbc29Smrg	      $echo "*** libtool will only create a static version of it."
38658c9fbc29Smrg	      if test "$build_old_libs" = no; then
38668c9fbc29Smrg		oldlibs="$output_objdir/$libname.$libext"
38678c9fbc29Smrg		build_libtool_libs=module
38688c9fbc29Smrg		build_old_libs=yes
38698c9fbc29Smrg	      else
38708c9fbc29Smrg		build_libtool_libs=no
38718c9fbc29Smrg	      fi
38728c9fbc29Smrg	    fi
38738c9fbc29Smrg	  fi
38748c9fbc29Smrg	fi
38758c9fbc29Smrg	# Done checking deplibs!
38768c9fbc29Smrg	deplibs=$newdeplibs
38778c9fbc29Smrg      fi
38788c9fbc29Smrg
38798c9fbc29Smrg
38808c9fbc29Smrg      # move library search paths that coincide with paths to not yet
38818c9fbc29Smrg      # installed libraries to the beginning of the library search list
38828c9fbc29Smrg      new_libs=
38838c9fbc29Smrg      for path in $notinst_path; do
38848c9fbc29Smrg	case " $new_libs " in
38858c9fbc29Smrg	*" -L$path/$objdir "*) ;;
38868c9fbc29Smrg	*)
38878c9fbc29Smrg	  case " $deplibs " in
38888c9fbc29Smrg	  *" -L$path/$objdir "*)
38898c9fbc29Smrg	    new_libs="$new_libs -L$path/$objdir" ;;
38908c9fbc29Smrg	  esac
38918c9fbc29Smrg	  ;;
38928c9fbc29Smrg	esac
38938c9fbc29Smrg      done
38948c9fbc29Smrg      for deplib in $deplibs; do
38958c9fbc29Smrg	case $deplib in
38968c9fbc29Smrg	-L*)
38978c9fbc29Smrg	  case " $new_libs " in
38988c9fbc29Smrg	  *" $deplib "*) ;;
38998c9fbc29Smrg	  *) new_libs="$new_libs $deplib" ;;
39008c9fbc29Smrg	  esac
39018c9fbc29Smrg	  ;;
39028c9fbc29Smrg	*) new_libs="$new_libs $deplib" ;;
39038c9fbc29Smrg	esac
39048c9fbc29Smrg      done
39058c9fbc29Smrg      deplibs="$new_libs"
39068c9fbc29Smrg
39078c9fbc29Smrg
39088c9fbc29Smrg      # All the library-specific variables (install_libdir is set above).
39098c9fbc29Smrg      library_names=
39108c9fbc29Smrg      old_library=
39118c9fbc29Smrg      dlname=
39128c9fbc29Smrg
39138c9fbc29Smrg      # Test again, we may have decided not to build it any more
39148c9fbc29Smrg      if test "$build_libtool_libs" = yes; then
39158c9fbc29Smrg	if test "$hardcode_into_libs" = yes; then
39168c9fbc29Smrg	  # Hardcode the library paths
39178c9fbc29Smrg	  hardcode_libdirs=
39188c9fbc29Smrg	  dep_rpath=
39198c9fbc29Smrg	  rpath="$finalize_rpath"
39208c9fbc29Smrg	  test "$mode" != relink && rpath="$compile_rpath$rpath"
39218c9fbc29Smrg	  for libdir in $rpath; do
39228c9fbc29Smrg	    if test -n "$hardcode_libdir_flag_spec"; then
39238c9fbc29Smrg	      if test -n "$hardcode_libdir_separator"; then
39248c9fbc29Smrg		if test -z "$hardcode_libdirs"; then
39258c9fbc29Smrg		  hardcode_libdirs="$libdir"
39268c9fbc29Smrg		else
39278c9fbc29Smrg		  # Just accumulate the unique libdirs.
39288c9fbc29Smrg		  case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
39298c9fbc29Smrg		  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
39308c9fbc29Smrg		    ;;
39318c9fbc29Smrg		  *)
39328c9fbc29Smrg		    hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
39338c9fbc29Smrg		    ;;
39348c9fbc29Smrg		  esac
39358c9fbc29Smrg		fi
39368c9fbc29Smrg	      else
39378c9fbc29Smrg		eval flag=\"$hardcode_libdir_flag_spec\"
39388c9fbc29Smrg		dep_rpath="$dep_rpath $flag"
39398c9fbc29Smrg	      fi
39408c9fbc29Smrg	    elif test -n "$runpath_var"; then
39418c9fbc29Smrg	      case "$perm_rpath " in
39428c9fbc29Smrg	      *" $libdir "*) ;;
39438c9fbc29Smrg	      *) perm_rpath="$perm_rpath $libdir" ;;
39448c9fbc29Smrg	      esac
39458c9fbc29Smrg	    fi
39468c9fbc29Smrg	  done
39478c9fbc29Smrg	  # Substitute the hardcoded libdirs into the rpath.
39488c9fbc29Smrg	  if test -n "$hardcode_libdir_separator" &&
39498c9fbc29Smrg	     test -n "$hardcode_libdirs"; then
39508c9fbc29Smrg	    libdir="$hardcode_libdirs"
39518c9fbc29Smrg	    if test -n "$hardcode_libdir_flag_spec_ld"; then
39524e411241Smrg	      case $archive_cmds in
39534e411241Smrg	      *\$LD*) eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" ;;
39544e411241Smrg	      *)      eval dep_rpath=\"$hardcode_libdir_flag_spec\" ;;
39554e411241Smrg	      esac
39568c9fbc29Smrg	    else
39578c9fbc29Smrg	      eval dep_rpath=\"$hardcode_libdir_flag_spec\"
39588c9fbc29Smrg	    fi
39598c9fbc29Smrg	  fi
39608c9fbc29Smrg	  if test -n "$runpath_var" && test -n "$perm_rpath"; then
39618c9fbc29Smrg	    # We should set the runpath_var.
39628c9fbc29Smrg	    rpath=
39638c9fbc29Smrg	    for dir in $perm_rpath; do
39648c9fbc29Smrg	      rpath="$rpath$dir:"
39658c9fbc29Smrg	    done
39668c9fbc29Smrg	    eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
39678c9fbc29Smrg	  fi
39688c9fbc29Smrg	  test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
39698c9fbc29Smrg	fi
39708c9fbc29Smrg
39718c9fbc29Smrg	shlibpath="$finalize_shlibpath"
39728c9fbc29Smrg	test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
39738c9fbc29Smrg	if test -n "$shlibpath"; then
39748c9fbc29Smrg	  eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
39758c9fbc29Smrg	fi
39768c9fbc29Smrg
39778c9fbc29Smrg	# Get the real and link names of the library.
39788c9fbc29Smrg	eval shared_ext=\"$shrext_cmds\"
39798c9fbc29Smrg	eval library_names=\"$library_names_spec\"
39808c9fbc29Smrg	set dummy $library_names
39818c9fbc29Smrg	realname="$2"
39828c9fbc29Smrg	shift; shift
39838c9fbc29Smrg
39848c9fbc29Smrg	if test -n "$soname_spec"; then
39858c9fbc29Smrg	  eval soname=\"$soname_spec\"
39868c9fbc29Smrg	else
39878c9fbc29Smrg	  soname="$realname"
39888c9fbc29Smrg	fi
39898c9fbc29Smrg	if test -z "$dlname"; then
39908c9fbc29Smrg	  dlname=$soname
39918c9fbc29Smrg	fi
39928c9fbc29Smrg
39938c9fbc29Smrg	lib="$output_objdir/$realname"
39948c9fbc29Smrg	linknames=
39958c9fbc29Smrg	for link
39968c9fbc29Smrg	do
39978c9fbc29Smrg	  linknames="$linknames $link"
39988c9fbc29Smrg	done
39998c9fbc29Smrg
40008c9fbc29Smrg	# Use standard objects if they are pic
40018c9fbc29Smrg	test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
40028c9fbc29Smrg
40038c9fbc29Smrg	# Prepare the list of exported symbols
40048c9fbc29Smrg	if test -z "$export_symbols"; then
40058c9fbc29Smrg	  if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
40068c9fbc29Smrg	    $show "generating symbol list for \`$libname.la'"
40078c9fbc29Smrg	    export_symbols="$output_objdir/$libname.exp"
40088c9fbc29Smrg	    $run $rm $export_symbols
40098c9fbc29Smrg	    cmds=$export_symbols_cmds
40108c9fbc29Smrg	    save_ifs="$IFS"; IFS='~'
40118c9fbc29Smrg	    for cmd in $cmds; do
40128c9fbc29Smrg	      IFS="$save_ifs"
40138c9fbc29Smrg	      eval cmd=\"$cmd\"
40148c9fbc29Smrg	      if len=`expr "X$cmd" : ".*"` &&
40158c9fbc29Smrg	       test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
40168c9fbc29Smrg	        $show "$cmd"
40178c9fbc29Smrg	        $run eval "$cmd" || exit $?
40188c9fbc29Smrg	        skipped_export=false
40198c9fbc29Smrg	      else
40208c9fbc29Smrg	        # The command line is too long to execute in one step.
40218c9fbc29Smrg	        $show "using reloadable object file for export list..."
40228c9fbc29Smrg	        skipped_export=:
40238c9fbc29Smrg		# Break out early, otherwise skipped_export may be
40248c9fbc29Smrg		# set to false by a later but shorter cmd.
40258c9fbc29Smrg		break
40268c9fbc29Smrg	      fi
40278c9fbc29Smrg	    done
40288c9fbc29Smrg	    IFS="$save_ifs"
40298c9fbc29Smrg	    if test -n "$export_symbols_regex"; then
40308c9fbc29Smrg	      $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
40318c9fbc29Smrg	      $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
40328c9fbc29Smrg	      $show "$mv \"${export_symbols}T\" \"$export_symbols\""
40338c9fbc29Smrg	      $run eval '$mv "${export_symbols}T" "$export_symbols"'
40348c9fbc29Smrg	    fi
40358c9fbc29Smrg	  fi
40368c9fbc29Smrg	fi
40378c9fbc29Smrg
40388c9fbc29Smrg	if test -n "$export_symbols" && test -n "$include_expsyms"; then
40398c9fbc29Smrg	  $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
40408c9fbc29Smrg	fi
40418c9fbc29Smrg
40428c9fbc29Smrg	tmp_deplibs=
40438c9fbc29Smrg	for test_deplib in $deplibs; do
40448c9fbc29Smrg		case " $convenience " in
40458c9fbc29Smrg		*" $test_deplib "*) ;;
40468c9fbc29Smrg		*)
40478c9fbc29Smrg			tmp_deplibs="$tmp_deplibs $test_deplib"
40488c9fbc29Smrg			;;
40498c9fbc29Smrg		esac
40508c9fbc29Smrg	done
40518c9fbc29Smrg	deplibs="$tmp_deplibs"
40528c9fbc29Smrg
40538c9fbc29Smrg	if test -n "$convenience"; then
40548c9fbc29Smrg	  if test -n "$whole_archive_flag_spec"; then
40558c9fbc29Smrg	    save_libobjs=$libobjs
40568c9fbc29Smrg	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
40578c9fbc29Smrg	  else
40588c9fbc29Smrg	    gentop="$output_objdir/${outputname}x"
40598c9fbc29Smrg	    generated="$generated $gentop"
40608c9fbc29Smrg
40618c9fbc29Smrg	    func_extract_archives $gentop $convenience
40628c9fbc29Smrg	    libobjs="$libobjs $func_extract_archives_result"
40638c9fbc29Smrg	  fi
40648c9fbc29Smrg	fi
40658c9fbc29Smrg	
40668c9fbc29Smrg	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
40678c9fbc29Smrg	  eval flag=\"$thread_safe_flag_spec\"
40688c9fbc29Smrg	  linker_flags="$linker_flags $flag"
40698c9fbc29Smrg	fi
40708c9fbc29Smrg
40718c9fbc29Smrg	# Make a backup of the uninstalled library when relinking
40728c9fbc29Smrg	if test "$mode" = relink; then
40738c9fbc29Smrg	  $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
40748c9fbc29Smrg	fi
40758c9fbc29Smrg
40768c9fbc29Smrg	# Do each of the archive commands.
40778c9fbc29Smrg	if test "$module" = yes && test -n "$module_cmds" ; then
40788c9fbc29Smrg	  if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
40798c9fbc29Smrg	    eval test_cmds=\"$module_expsym_cmds\"
40808c9fbc29Smrg	    cmds=$module_expsym_cmds
40818c9fbc29Smrg	  else
40828c9fbc29Smrg	    eval test_cmds=\"$module_cmds\"
40838c9fbc29Smrg	    cmds=$module_cmds
40848c9fbc29Smrg	  fi
40858c9fbc29Smrg	else
40868c9fbc29Smrg	if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
40878c9fbc29Smrg	  eval test_cmds=\"$archive_expsym_cmds\"
40888c9fbc29Smrg	  cmds=$archive_expsym_cmds
40898c9fbc29Smrg	else
40908c9fbc29Smrg	  eval test_cmds=\"$archive_cmds\"
40918c9fbc29Smrg	  cmds=$archive_cmds
40928c9fbc29Smrg	  fi
40938c9fbc29Smrg	fi
40948c9fbc29Smrg
40958c9fbc29Smrg	if test "X$skipped_export" != "X:" &&
40968c9fbc29Smrg	   len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
40978c9fbc29Smrg	   test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
40988c9fbc29Smrg	  :
40998c9fbc29Smrg	else
41008c9fbc29Smrg	  # The command line is too long to link in one step, link piecewise.
41018c9fbc29Smrg	  $echo "creating reloadable object files..."
41028c9fbc29Smrg
41038c9fbc29Smrg	  # Save the value of $output and $libobjs because we want to
41048c9fbc29Smrg	  # use them later.  If we have whole_archive_flag_spec, we
41058c9fbc29Smrg	  # want to use save_libobjs as it was before
41068c9fbc29Smrg	  # whole_archive_flag_spec was expanded, because we can't
41078c9fbc29Smrg	  # assume the linker understands whole_archive_flag_spec.
41088c9fbc29Smrg	  # This may have to be revisited, in case too many
41098c9fbc29Smrg	  # convenience libraries get linked in and end up exceeding
41108c9fbc29Smrg	  # the spec.
41118c9fbc29Smrg	  if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
41128c9fbc29Smrg	    save_libobjs=$libobjs
41138c9fbc29Smrg	  fi
41148c9fbc29Smrg	  save_output=$output
41158c9fbc29Smrg	  output_la=`$echo "X$output" | $Xsed -e "$basename"`
41168c9fbc29Smrg
41178c9fbc29Smrg	  # Clear the reloadable object creation command queue and
41188c9fbc29Smrg	  # initialize k to one.
41198c9fbc29Smrg	  test_cmds=
41208c9fbc29Smrg	  concat_cmds=
41218c9fbc29Smrg	  objlist=
41228c9fbc29Smrg	  delfiles=
41238c9fbc29Smrg	  last_robj=
41248c9fbc29Smrg	  k=1
41258c9fbc29Smrg	  output=$output_objdir/$output_la-${k}.$objext
41268c9fbc29Smrg	  # Loop over the list of objects to be linked.
41278c9fbc29Smrg	  for obj in $save_libobjs
41288c9fbc29Smrg	  do
41298c9fbc29Smrg	    eval test_cmds=\"$reload_cmds $objlist $last_robj\"
41308c9fbc29Smrg	    if test "X$objlist" = X ||
41318c9fbc29Smrg	       { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
41328c9fbc29Smrg		 test "$len" -le "$max_cmd_len"; }; then
41338c9fbc29Smrg	      objlist="$objlist $obj"
41348c9fbc29Smrg	    else
41358c9fbc29Smrg	      # The command $test_cmds is almost too long, add a
41368c9fbc29Smrg	      # command to the queue.
41378c9fbc29Smrg	      if test "$k" -eq 1 ; then
41388c9fbc29Smrg		# The first file doesn't have a previous command to add.
41398c9fbc29Smrg		eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
41408c9fbc29Smrg	      else
41418c9fbc29Smrg		# All subsequent reloadable object files will link in
41428c9fbc29Smrg		# the last one created.
41438c9fbc29Smrg		eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
41448c9fbc29Smrg	      fi
41458c9fbc29Smrg	      last_robj=$output_objdir/$output_la-${k}.$objext
41468c9fbc29Smrg	      k=`expr $k + 1`
41478c9fbc29Smrg	      output=$output_objdir/$output_la-${k}.$objext
41488c9fbc29Smrg	      objlist=$obj
41498c9fbc29Smrg	      len=1
41508c9fbc29Smrg	    fi
41518c9fbc29Smrg	  done
41528c9fbc29Smrg	  # Handle the remaining objects by creating one last
41538c9fbc29Smrg	  # reloadable object file.  All subsequent reloadable object
41548c9fbc29Smrg	  # files will link in the last one created.
41558c9fbc29Smrg	  test -z "$concat_cmds" || concat_cmds=$concat_cmds~
41568c9fbc29Smrg	  eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
41578c9fbc29Smrg
41588c9fbc29Smrg	  if ${skipped_export-false}; then
41598c9fbc29Smrg	    $show "generating symbol list for \`$libname.la'"
41608c9fbc29Smrg	    export_symbols="$output_objdir/$libname.exp"
41618c9fbc29Smrg	    $run $rm $export_symbols
41628c9fbc29Smrg	    libobjs=$output
41638c9fbc29Smrg	    # Append the command to create the export file.
41648c9fbc29Smrg	    eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
41658c9fbc29Smrg          fi
41668c9fbc29Smrg
41678c9fbc29Smrg	  # Set up a command to remove the reloadable object files
41688c9fbc29Smrg	  # after they are used.
41698c9fbc29Smrg	  i=0
41708c9fbc29Smrg	  while test "$i" -lt "$k"
41718c9fbc29Smrg	  do
41728c9fbc29Smrg	    i=`expr $i + 1`
41738c9fbc29Smrg	    delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
41748c9fbc29Smrg	  done
41758c9fbc29Smrg
41768c9fbc29Smrg	  $echo "creating a temporary reloadable object file: $output"
41778c9fbc29Smrg
41788c9fbc29Smrg	  # Loop through the commands generated above and execute them.
41798c9fbc29Smrg	  save_ifs="$IFS"; IFS='~'
41808c9fbc29Smrg	  for cmd in $concat_cmds; do
41818c9fbc29Smrg	    IFS="$save_ifs"
41828c9fbc29Smrg	    $show "$cmd"
41838c9fbc29Smrg	    $run eval "$cmd" || exit $?
41848c9fbc29Smrg	  done
41858c9fbc29Smrg	  IFS="$save_ifs"
41868c9fbc29Smrg
41878c9fbc29Smrg	  libobjs=$output
41888c9fbc29Smrg	  # Restore the value of output.
41898c9fbc29Smrg	  output=$save_output
41908c9fbc29Smrg
41918c9fbc29Smrg	  if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
41928c9fbc29Smrg	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
41938c9fbc29Smrg	  fi
41948c9fbc29Smrg	  # Expand the library linking commands again to reset the
41958c9fbc29Smrg	  # value of $libobjs for piecewise linking.
41968c9fbc29Smrg
41978c9fbc29Smrg	  # Do each of the archive commands.
41988c9fbc29Smrg	  if test "$module" = yes && test -n "$module_cmds" ; then
41998c9fbc29Smrg	    if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
42008c9fbc29Smrg	      cmds=$module_expsym_cmds
42018c9fbc29Smrg	    else
42028c9fbc29Smrg	      cmds=$module_cmds
42038c9fbc29Smrg	    fi
42048c9fbc29Smrg	  else
42058c9fbc29Smrg	  if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
42068c9fbc29Smrg	    cmds=$archive_expsym_cmds
42078c9fbc29Smrg	  else
42088c9fbc29Smrg	    cmds=$archive_cmds
42098c9fbc29Smrg	    fi
42108c9fbc29Smrg	  fi
42118c9fbc29Smrg
42128c9fbc29Smrg	  # Append the command to remove the reloadable object files
42138c9fbc29Smrg	  # to the just-reset $cmds.
42148c9fbc29Smrg	  eval cmds=\"\$cmds~\$rm $delfiles\"
42158c9fbc29Smrg	fi
42168c9fbc29Smrg	save_ifs="$IFS"; IFS='~'
42178c9fbc29Smrg	for cmd in $cmds; do
42188c9fbc29Smrg	  IFS="$save_ifs"
42198c9fbc29Smrg	  eval cmd=\"$cmd\"
42208c9fbc29Smrg	  $show "$cmd"
42218c9fbc29Smrg	  $run eval "$cmd" || {
42228c9fbc29Smrg	    lt_exit=$?
42238c9fbc29Smrg
42248c9fbc29Smrg	    # Restore the uninstalled library and exit
42258c9fbc29Smrg	    if test "$mode" = relink; then
42268c9fbc29Smrg	      $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
42278c9fbc29Smrg	    fi
42288c9fbc29Smrg
42298c9fbc29Smrg	    exit $lt_exit
42308c9fbc29Smrg	  }
42318c9fbc29Smrg	done
42328c9fbc29Smrg	IFS="$save_ifs"
42338c9fbc29Smrg
42348c9fbc29Smrg	# Restore the uninstalled library and exit
42358c9fbc29Smrg	if test "$mode" = relink; then
42368c9fbc29Smrg	  $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
42378c9fbc29Smrg
42388c9fbc29Smrg	  if test -n "$convenience"; then
42398c9fbc29Smrg	    if test -z "$whole_archive_flag_spec"; then
42408c9fbc29Smrg	      $show "${rm}r $gentop"
42418c9fbc29Smrg	      $run ${rm}r "$gentop"
42428c9fbc29Smrg	    fi
42438c9fbc29Smrg	  fi
42448c9fbc29Smrg
42458c9fbc29Smrg	  exit $EXIT_SUCCESS
42468c9fbc29Smrg	fi
42478c9fbc29Smrg
42488c9fbc29Smrg	# Create links to the real library.
42498c9fbc29Smrg	for linkname in $linknames; do
42508c9fbc29Smrg	  if test "$realname" != "$linkname"; then
42518c9fbc29Smrg	    $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
42528c9fbc29Smrg	    $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
42538c9fbc29Smrg	  fi
42548c9fbc29Smrg	done
42558c9fbc29Smrg
42568c9fbc29Smrg	# If -module or -export-dynamic was specified, set the dlname.
42578c9fbc29Smrg	if test "$module" = yes || test "$export_dynamic" = yes; then
42588c9fbc29Smrg	  # On all known operating systems, these are identical.
42598c9fbc29Smrg	  dlname="$soname"
42608c9fbc29Smrg	fi
42618c9fbc29Smrg      fi
42628c9fbc29Smrg      ;;
42638c9fbc29Smrg
42648c9fbc29Smrg    obj)
42654e411241Smrg      case " $deplibs" in
42664e411241Smrg      *\ -l* | *\ -L*)
42674e411241Smrg	$echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 ;;
42684e411241Smrg      esac
42698c9fbc29Smrg
42708c9fbc29Smrg      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
42718c9fbc29Smrg	$echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
42728c9fbc29Smrg      fi
42738c9fbc29Smrg
42748c9fbc29Smrg      if test -n "$rpath"; then
42758c9fbc29Smrg	$echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
42768c9fbc29Smrg      fi
42778c9fbc29Smrg
42788c9fbc29Smrg      if test -n "$xrpath"; then
42798c9fbc29Smrg	$echo "$modename: warning: \`-R' is ignored for objects" 1>&2
42808c9fbc29Smrg      fi
42818c9fbc29Smrg
42828c9fbc29Smrg      if test -n "$vinfo"; then
42838c9fbc29Smrg	$echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
42848c9fbc29Smrg      fi
42858c9fbc29Smrg
42868c9fbc29Smrg      if test -n "$release"; then
42878c9fbc29Smrg	$echo "$modename: warning: \`-release' is ignored for objects" 1>&2
42888c9fbc29Smrg      fi
42898c9fbc29Smrg
42908c9fbc29Smrg      case $output in
42918c9fbc29Smrg      *.lo)
42928c9fbc29Smrg	if test -n "$objs$old_deplibs"; then
42938c9fbc29Smrg	  $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
42948c9fbc29Smrg	  exit $EXIT_FAILURE
42958c9fbc29Smrg	fi
42968c9fbc29Smrg	libobj="$output"
42978c9fbc29Smrg	obj=`$echo "X$output" | $Xsed -e "$lo2o"`
42988c9fbc29Smrg	;;
42998c9fbc29Smrg      *)
43008c9fbc29Smrg	libobj=
43018c9fbc29Smrg	obj="$output"
43028c9fbc29Smrg	;;
43038c9fbc29Smrg      esac
43048c9fbc29Smrg
43058c9fbc29Smrg      # Delete the old objects.
43068c9fbc29Smrg      $run $rm $obj $libobj
43078c9fbc29Smrg
43088c9fbc29Smrg      # Objects from convenience libraries.  This assumes
43098c9fbc29Smrg      # single-version convenience libraries.  Whenever we create
43108c9fbc29Smrg      # different ones for PIC/non-PIC, this we'll have to duplicate
43118c9fbc29Smrg      # the extraction.
43128c9fbc29Smrg      reload_conv_objs=
43138c9fbc29Smrg      gentop=
43148c9fbc29Smrg      # reload_cmds runs $LD directly, so let us get rid of
43154e411241Smrg      # -Wl from whole_archive_flag_spec and hope we can get by with
43164e411241Smrg      # turning comma into space..
43178c9fbc29Smrg      wl=
43188c9fbc29Smrg
43198c9fbc29Smrg      if test -n "$convenience"; then
43208c9fbc29Smrg	if test -n "$whole_archive_flag_spec"; then
43214e411241Smrg	  eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
43224e411241Smrg	  reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
43238c9fbc29Smrg	else
43248c9fbc29Smrg	  gentop="$output_objdir/${obj}x"
43258c9fbc29Smrg	  generated="$generated $gentop"
43268c9fbc29Smrg
43278c9fbc29Smrg	  func_extract_archives $gentop $convenience
43288c9fbc29Smrg	  reload_conv_objs="$reload_objs $func_extract_archives_result"
43298c9fbc29Smrg	fi
43308c9fbc29Smrg      fi
43318c9fbc29Smrg
43328c9fbc29Smrg      # Create the old-style object.
43338c9fbc29Smrg      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
43348c9fbc29Smrg
43358c9fbc29Smrg      output="$obj"
43368c9fbc29Smrg      cmds=$reload_cmds
43378c9fbc29Smrg      save_ifs="$IFS"; IFS='~'
43388c9fbc29Smrg      for cmd in $cmds; do
43398c9fbc29Smrg	IFS="$save_ifs"
43408c9fbc29Smrg	eval cmd=\"$cmd\"
43418c9fbc29Smrg	$show "$cmd"
43428c9fbc29Smrg	$run eval "$cmd" || exit $?
43438c9fbc29Smrg      done
43448c9fbc29Smrg      IFS="$save_ifs"
43458c9fbc29Smrg
43468c9fbc29Smrg      # Exit if we aren't doing a library object file.
43478c9fbc29Smrg      if test -z "$libobj"; then
43488c9fbc29Smrg	if test -n "$gentop"; then
43498c9fbc29Smrg	  $show "${rm}r $gentop"
43508c9fbc29Smrg	  $run ${rm}r $gentop
43518c9fbc29Smrg	fi
43528c9fbc29Smrg
43538c9fbc29Smrg	exit $EXIT_SUCCESS
43548c9fbc29Smrg      fi
43558c9fbc29Smrg
43568c9fbc29Smrg      if test "$build_libtool_libs" != yes; then
43578c9fbc29Smrg	if test -n "$gentop"; then
43588c9fbc29Smrg	  $show "${rm}r $gentop"
43598c9fbc29Smrg	  $run ${rm}r $gentop
43608c9fbc29Smrg	fi
43618c9fbc29Smrg
43628c9fbc29Smrg	# Create an invalid libtool object if no PIC, so that we don't
43638c9fbc29Smrg	# accidentally link it into a program.
43648c9fbc29Smrg	# $show "echo timestamp > $libobj"
43658c9fbc29Smrg	# $run eval "echo timestamp > $libobj" || exit $?
43668c9fbc29Smrg	exit $EXIT_SUCCESS
43678c9fbc29Smrg      fi
43688c9fbc29Smrg
43698c9fbc29Smrg      if test -n "$pic_flag" || test "$pic_mode" != default; then
43708c9fbc29Smrg	# Only do commands if we really have different PIC objects.
43718c9fbc29Smrg	reload_objs="$libobjs $reload_conv_objs"
43728c9fbc29Smrg	output="$libobj"
43738c9fbc29Smrg	cmds=$reload_cmds
43748c9fbc29Smrg	save_ifs="$IFS"; IFS='~'
43758c9fbc29Smrg	for cmd in $cmds; do
43768c9fbc29Smrg	  IFS="$save_ifs"
43778c9fbc29Smrg	  eval cmd=\"$cmd\"
43788c9fbc29Smrg	  $show "$cmd"
43798c9fbc29Smrg	  $run eval "$cmd" || exit $?
43808c9fbc29Smrg	done
43818c9fbc29Smrg	IFS="$save_ifs"
43828c9fbc29Smrg      fi
43838c9fbc29Smrg
43848c9fbc29Smrg      if test -n "$gentop"; then
43858c9fbc29Smrg	$show "${rm}r $gentop"
43868c9fbc29Smrg	$run ${rm}r $gentop
43878c9fbc29Smrg      fi
43888c9fbc29Smrg
43898c9fbc29Smrg      exit $EXIT_SUCCESS
43908c9fbc29Smrg      ;;
43918c9fbc29Smrg
43928c9fbc29Smrg    prog)
43938c9fbc29Smrg      case $host in
43948c9fbc29Smrg	*cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
43958c9fbc29Smrg      esac
43968c9fbc29Smrg      if test -n "$vinfo"; then
43978c9fbc29Smrg	$echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
43988c9fbc29Smrg      fi
43998c9fbc29Smrg
44008c9fbc29Smrg      if test -n "$release"; then
44018c9fbc29Smrg	$echo "$modename: warning: \`-release' is ignored for programs" 1>&2
44028c9fbc29Smrg      fi
44038c9fbc29Smrg
44048c9fbc29Smrg      if test "$preload" = yes; then
44058c9fbc29Smrg	if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
44068c9fbc29Smrg	   test "$dlopen_self_static" = unknown; then
44078c9fbc29Smrg	  $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
44088c9fbc29Smrg	fi
44098c9fbc29Smrg      fi
44108c9fbc29Smrg
44118c9fbc29Smrg      case $host in
44128c9fbc29Smrg      *-*-rhapsody* | *-*-darwin1.[012])
44138c9fbc29Smrg	# On Rhapsody replace the C library is the System framework
44148c9fbc29Smrg	compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
44158c9fbc29Smrg	finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
44168c9fbc29Smrg	;;
44178c9fbc29Smrg      esac
44188c9fbc29Smrg
44198c9fbc29Smrg      case $host in
44208c9fbc29Smrg      *darwin*)
44218c9fbc29Smrg        # Don't allow lazy linking, it breaks C++ global constructors
44228c9fbc29Smrg        if test "$tagname" = CXX ; then
44238c9fbc29Smrg        compile_command="$compile_command ${wl}-bind_at_load"
44248c9fbc29Smrg        finalize_command="$finalize_command ${wl}-bind_at_load"
44258c9fbc29Smrg        fi
44268c9fbc29Smrg        ;;
44278c9fbc29Smrg      esac
44288c9fbc29Smrg
44298c9fbc29Smrg
44308c9fbc29Smrg      # move library search paths that coincide with paths to not yet
44318c9fbc29Smrg      # installed libraries to the beginning of the library search list
44328c9fbc29Smrg      new_libs=
44338c9fbc29Smrg      for path in $notinst_path; do
44348c9fbc29Smrg	case " $new_libs " in
44358c9fbc29Smrg	*" -L$path/$objdir "*) ;;
44368c9fbc29Smrg	*)
44378c9fbc29Smrg	  case " $compile_deplibs " in
44388c9fbc29Smrg	  *" -L$path/$objdir "*)
44398c9fbc29Smrg	    new_libs="$new_libs -L$path/$objdir" ;;
44408c9fbc29Smrg	  esac
44418c9fbc29Smrg	  ;;
44428c9fbc29Smrg	esac
44438c9fbc29Smrg      done
44448c9fbc29Smrg      for deplib in $compile_deplibs; do
44458c9fbc29Smrg	case $deplib in
44468c9fbc29Smrg	-L*)
44478c9fbc29Smrg	  case " $new_libs " in
44488c9fbc29Smrg	  *" $deplib "*) ;;
44498c9fbc29Smrg	  *) new_libs="$new_libs $deplib" ;;
44508c9fbc29Smrg	  esac
44518c9fbc29Smrg	  ;;
44528c9fbc29Smrg	*) new_libs="$new_libs $deplib" ;;
44538c9fbc29Smrg	esac
44548c9fbc29Smrg      done
44558c9fbc29Smrg      compile_deplibs="$new_libs"
44568c9fbc29Smrg
44578c9fbc29Smrg
44588c9fbc29Smrg      compile_command="$compile_command $compile_deplibs"
44598c9fbc29Smrg      finalize_command="$finalize_command $finalize_deplibs"
44608c9fbc29Smrg
44618c9fbc29Smrg      if test -n "$rpath$xrpath"; then
44628c9fbc29Smrg	# If the user specified any rpath flags, then add them.
44638c9fbc29Smrg	for libdir in $rpath $xrpath; do
44648c9fbc29Smrg	  # This is the magic to use -rpath.
44658c9fbc29Smrg	  case "$finalize_rpath " in
44668c9fbc29Smrg	  *" $libdir "*) ;;
44678c9fbc29Smrg	  *) finalize_rpath="$finalize_rpath $libdir" ;;
44688c9fbc29Smrg	  esac
44698c9fbc29Smrg	done
44708c9fbc29Smrg      fi
44718c9fbc29Smrg
44728c9fbc29Smrg      # Now hardcode the library paths
44738c9fbc29Smrg      rpath=
44748c9fbc29Smrg      hardcode_libdirs=
44758c9fbc29Smrg      for libdir in $compile_rpath $finalize_rpath; do
44768c9fbc29Smrg	if test -n "$hardcode_libdir_flag_spec"; then
44778c9fbc29Smrg	  if test -n "$hardcode_libdir_separator"; then
44788c9fbc29Smrg	    if test -z "$hardcode_libdirs"; then
44798c9fbc29Smrg	      hardcode_libdirs="$libdir"
44808c9fbc29Smrg	    else
44818c9fbc29Smrg	      # Just accumulate the unique libdirs.
44828c9fbc29Smrg	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
44838c9fbc29Smrg	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
44848c9fbc29Smrg		;;
44858c9fbc29Smrg	      *)
44868c9fbc29Smrg		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
44878c9fbc29Smrg		;;
44888c9fbc29Smrg	      esac
44898c9fbc29Smrg	    fi
44908c9fbc29Smrg	  else
44918c9fbc29Smrg	    eval flag=\"$hardcode_libdir_flag_spec\"
44928c9fbc29Smrg	    rpath="$rpath $flag"
44938c9fbc29Smrg	  fi
44948c9fbc29Smrg	elif test -n "$runpath_var"; then
44958c9fbc29Smrg	  case "$perm_rpath " in
44968c9fbc29Smrg	  *" $libdir "*) ;;
44978c9fbc29Smrg	  *) perm_rpath="$perm_rpath $libdir" ;;
44988c9fbc29Smrg	  esac
44998c9fbc29Smrg	fi
45008c9fbc29Smrg	case $host in
45018c9fbc29Smrg	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
45028c9fbc29Smrg	  testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
45038c9fbc29Smrg	  case :$dllsearchpath: in
45048c9fbc29Smrg	  *":$libdir:"*) ;;
45058c9fbc29Smrg	  *) dllsearchpath="$dllsearchpath:$libdir";;
45068c9fbc29Smrg	  esac
45078c9fbc29Smrg	  case :$dllsearchpath: in
45088c9fbc29Smrg	  *":$testbindir:"*) ;;
45098c9fbc29Smrg	  *) dllsearchpath="$dllsearchpath:$testbindir";;
45108c9fbc29Smrg	  esac
45118c9fbc29Smrg	  ;;
45128c9fbc29Smrg	esac
45138c9fbc29Smrg      done
45148c9fbc29Smrg      # Substitute the hardcoded libdirs into the rpath.
45158c9fbc29Smrg      if test -n "$hardcode_libdir_separator" &&
45168c9fbc29Smrg	 test -n "$hardcode_libdirs"; then
45178c9fbc29Smrg	libdir="$hardcode_libdirs"
45188c9fbc29Smrg	eval rpath=\" $hardcode_libdir_flag_spec\"
45198c9fbc29Smrg      fi
45208c9fbc29Smrg      compile_rpath="$rpath"
45218c9fbc29Smrg
45228c9fbc29Smrg      rpath=
45238c9fbc29Smrg      hardcode_libdirs=
45248c9fbc29Smrg      for libdir in $finalize_rpath; do
45258c9fbc29Smrg	if test -n "$hardcode_libdir_flag_spec"; then
45268c9fbc29Smrg	  if test -n "$hardcode_libdir_separator"; then
45278c9fbc29Smrg	    if test -z "$hardcode_libdirs"; then
45288c9fbc29Smrg	      hardcode_libdirs="$libdir"
45298c9fbc29Smrg	    else
45308c9fbc29Smrg	      # Just accumulate the unique libdirs.
45318c9fbc29Smrg	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
45328c9fbc29Smrg	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
45338c9fbc29Smrg		;;
45348c9fbc29Smrg	      *)
45358c9fbc29Smrg		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
45368c9fbc29Smrg		;;
45378c9fbc29Smrg	      esac
45388c9fbc29Smrg	    fi
45398c9fbc29Smrg	  else
45408c9fbc29Smrg	    eval flag=\"$hardcode_libdir_flag_spec\"
45418c9fbc29Smrg	    rpath="$rpath $flag"
45428c9fbc29Smrg	  fi
45438c9fbc29Smrg	elif test -n "$runpath_var"; then
45448c9fbc29Smrg	  case "$finalize_perm_rpath " in
45458c9fbc29Smrg	  *" $libdir "*) ;;
45468c9fbc29Smrg	  *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
45478c9fbc29Smrg	  esac
45488c9fbc29Smrg	fi
45498c9fbc29Smrg      done
45508c9fbc29Smrg      # Substitute the hardcoded libdirs into the rpath.
45518c9fbc29Smrg      if test -n "$hardcode_libdir_separator" &&
45528c9fbc29Smrg	 test -n "$hardcode_libdirs"; then
45538c9fbc29Smrg	libdir="$hardcode_libdirs"
45548c9fbc29Smrg	eval rpath=\" $hardcode_libdir_flag_spec\"
45558c9fbc29Smrg      fi
45568c9fbc29Smrg      finalize_rpath="$rpath"
45578c9fbc29Smrg
45588c9fbc29Smrg      if test -n "$libobjs" && test "$build_old_libs" = yes; then
45598c9fbc29Smrg	# Transform all the library objects into standard objects.
45608c9fbc29Smrg	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
45618c9fbc29Smrg	finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
45628c9fbc29Smrg      fi
45638c9fbc29Smrg
45648c9fbc29Smrg      dlsyms=
45658c9fbc29Smrg      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
45668c9fbc29Smrg	if test -n "$NM" && test -n "$global_symbol_pipe"; then
45678c9fbc29Smrg	  dlsyms="${outputname}S.c"
45688c9fbc29Smrg	else
45698c9fbc29Smrg	  $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
45708c9fbc29Smrg	fi
45718c9fbc29Smrg      fi
45728c9fbc29Smrg
45738c9fbc29Smrg      if test -n "$dlsyms"; then
45748c9fbc29Smrg	case $dlsyms in
45758c9fbc29Smrg	"") ;;
45768c9fbc29Smrg	*.c)
45778c9fbc29Smrg	  # Discover the nlist of each of the dlfiles.
45788c9fbc29Smrg	  nlist="$output_objdir/${outputname}.nm"
45798c9fbc29Smrg
45808c9fbc29Smrg	  $show "$rm $nlist ${nlist}S ${nlist}T"
45818c9fbc29Smrg	  $run $rm "$nlist" "${nlist}S" "${nlist}T"
45828c9fbc29Smrg
45838c9fbc29Smrg	  # Parse the name list into a source file.
45848c9fbc29Smrg	  $show "creating $output_objdir/$dlsyms"
45858c9fbc29Smrg
45868c9fbc29Smrg	  test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
45878c9fbc29Smrg/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
45888c9fbc29Smrg/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
45898c9fbc29Smrg
45908c9fbc29Smrg#ifdef __cplusplus
45918c9fbc29Smrgextern \"C\" {
45928c9fbc29Smrg#endif
45938c9fbc29Smrg
45948c9fbc29Smrg/* Prevent the only kind of declaration conflicts we can make. */
45958c9fbc29Smrg#define lt_preloaded_symbols some_other_symbol
45968c9fbc29Smrg
45978c9fbc29Smrg/* External symbol declarations for the compiler. */\
45988c9fbc29Smrg"
45998c9fbc29Smrg
46008c9fbc29Smrg	  if test "$dlself" = yes; then
46018c9fbc29Smrg	    $show "generating symbol list for \`$output'"
46028c9fbc29Smrg
46038c9fbc29Smrg	    test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
46048c9fbc29Smrg
46058c9fbc29Smrg	    # Add our own program objects to the symbol list.
46068c9fbc29Smrg	    progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
46078c9fbc29Smrg	    for arg in $progfiles; do
46088c9fbc29Smrg	      $show "extracting global C symbols from \`$arg'"
46098c9fbc29Smrg	      $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
46108c9fbc29Smrg	    done
46118c9fbc29Smrg
46128c9fbc29Smrg	    if test -n "$exclude_expsyms"; then
46138c9fbc29Smrg	      $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
46148c9fbc29Smrg	      $run eval '$mv "$nlist"T "$nlist"'
46158c9fbc29Smrg	    fi
46168c9fbc29Smrg
46178c9fbc29Smrg	    if test -n "$export_symbols_regex"; then
46188c9fbc29Smrg	      $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
46198c9fbc29Smrg	      $run eval '$mv "$nlist"T "$nlist"'
46208c9fbc29Smrg	    fi
46218c9fbc29Smrg
46228c9fbc29Smrg	    # Prepare the list of exported symbols
46238c9fbc29Smrg	    if test -z "$export_symbols"; then
46248c9fbc29Smrg	      export_symbols="$output_objdir/$outputname.exp"
46258c9fbc29Smrg	      $run $rm $export_symbols
46268c9fbc29Smrg	      $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
46278c9fbc29Smrg              case $host in
46288c9fbc29Smrg              *cygwin* | *mingw* )
46298c9fbc29Smrg	        $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
46308c9fbc29Smrg		$run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
46318c9fbc29Smrg                ;;
46328c9fbc29Smrg              esac
46338c9fbc29Smrg	    else
46348c9fbc29Smrg	      $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
46358c9fbc29Smrg	      $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
46368c9fbc29Smrg	      $run eval 'mv "$nlist"T "$nlist"'
46378c9fbc29Smrg              case $host in
46388c9fbc29Smrg              *cygwin* | *mingw* )
46398c9fbc29Smrg	        $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
46408c9fbc29Smrg		$run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
46418c9fbc29Smrg                ;;
46428c9fbc29Smrg              esac
46438c9fbc29Smrg	    fi
46448c9fbc29Smrg	  fi
46458c9fbc29Smrg
46468c9fbc29Smrg	  for arg in $dlprefiles; do
46478c9fbc29Smrg	    $show "extracting global C symbols from \`$arg'"
46488c9fbc29Smrg	    name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
46498c9fbc29Smrg	    $run eval '$echo ": $name " >> "$nlist"'
46508c9fbc29Smrg	    $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
46518c9fbc29Smrg	  done
46528c9fbc29Smrg
46538c9fbc29Smrg	  if test -z "$run"; then
46548c9fbc29Smrg	    # Make sure we have at least an empty file.
46558c9fbc29Smrg	    test -f "$nlist" || : > "$nlist"
46568c9fbc29Smrg
46578c9fbc29Smrg	    if test -n "$exclude_expsyms"; then
46588c9fbc29Smrg	      $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
46598c9fbc29Smrg	      $mv "$nlist"T "$nlist"
46608c9fbc29Smrg	    fi
46618c9fbc29Smrg
46628c9fbc29Smrg	    # Try sorting and uniquifying the output.
46638c9fbc29Smrg	    if grep -v "^: " < "$nlist" |
46648c9fbc29Smrg		if sort -k 3 </dev/null >/dev/null 2>&1; then
46658c9fbc29Smrg		  sort -k 3
46668c9fbc29Smrg		else
46678c9fbc29Smrg		  sort +2
46688c9fbc29Smrg		fi |
46698c9fbc29Smrg		uniq > "$nlist"S; then
46708c9fbc29Smrg	      :
46718c9fbc29Smrg	    else
46728c9fbc29Smrg	      grep -v "^: " < "$nlist" > "$nlist"S
46738c9fbc29Smrg	    fi
46748c9fbc29Smrg
46758c9fbc29Smrg	    if test -f "$nlist"S; then
46768c9fbc29Smrg	      eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
46778c9fbc29Smrg	    else
46788c9fbc29Smrg	      $echo '/* NONE */' >> "$output_objdir/$dlsyms"
46798c9fbc29Smrg	    fi
46808c9fbc29Smrg
46818c9fbc29Smrg	    $echo >> "$output_objdir/$dlsyms" "\
46828c9fbc29Smrg
46838c9fbc29Smrg#undef lt_preloaded_symbols
46848c9fbc29Smrg
46858c9fbc29Smrg#if defined (__STDC__) && __STDC__
46868c9fbc29Smrg# define lt_ptr void *
46878c9fbc29Smrg#else
46888c9fbc29Smrg# define lt_ptr char *
46898c9fbc29Smrg# define const
46908c9fbc29Smrg#endif
46918c9fbc29Smrg
46928c9fbc29Smrg/* The mapping between symbol names and symbols. */
46938c9fbc29Smrg"
46948c9fbc29Smrg
46958c9fbc29Smrg	    case $host in
46968c9fbc29Smrg	    *cygwin* | *mingw* )
46978c9fbc29Smrg	  $echo >> "$output_objdir/$dlsyms" "\
46988c9fbc29Smrg/* DATA imports from DLLs on WIN32 can't be const, because
46998c9fbc29Smrg   runtime relocations are performed -- see ld's documentation
47008c9fbc29Smrg   on pseudo-relocs */
47018c9fbc29Smrgstruct {
47028c9fbc29Smrg"
47038c9fbc29Smrg	      ;;
47048c9fbc29Smrg	    * )
47058c9fbc29Smrg	  $echo >> "$output_objdir/$dlsyms" "\
47068c9fbc29Smrgconst struct {
47078c9fbc29Smrg"
47088c9fbc29Smrg	      ;;
47098c9fbc29Smrg	    esac
47108c9fbc29Smrg
47118c9fbc29Smrg
47128c9fbc29Smrg	  $echo >> "$output_objdir/$dlsyms" "\
47138c9fbc29Smrg  const char *name;
47148c9fbc29Smrg  lt_ptr address;
47158c9fbc29Smrg}
47168c9fbc29Smrglt_preloaded_symbols[] =
47178c9fbc29Smrg{\
47188c9fbc29Smrg"
47198c9fbc29Smrg
47208c9fbc29Smrg	    eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
47218c9fbc29Smrg
47228c9fbc29Smrg	    $echo >> "$output_objdir/$dlsyms" "\
47238c9fbc29Smrg  {0, (lt_ptr) 0}
47248c9fbc29Smrg};
47258c9fbc29Smrg
47268c9fbc29Smrg/* This works around a problem in FreeBSD linker */
47278c9fbc29Smrg#ifdef FREEBSD_WORKAROUND
47288c9fbc29Smrgstatic const void *lt_preloaded_setup() {
47298c9fbc29Smrg  return lt_preloaded_symbols;
47308c9fbc29Smrg}
47318c9fbc29Smrg#endif
47328c9fbc29Smrg
47338c9fbc29Smrg#ifdef __cplusplus
47348c9fbc29Smrg}
47358c9fbc29Smrg#endif\
47368c9fbc29Smrg"
47378c9fbc29Smrg	  fi
47388c9fbc29Smrg
47398c9fbc29Smrg	  pic_flag_for_symtable=
47408c9fbc29Smrg	  case $host in
47418c9fbc29Smrg	  # compiling the symbol table file with pic_flag works around
47428c9fbc29Smrg	  # a FreeBSD bug that causes programs to crash when -lm is
47438c9fbc29Smrg	  # linked before any other PIC object.  But we must not use
47448c9fbc29Smrg	  # pic_flag when linking with -static.  The problem exists in
47458c9fbc29Smrg	  # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
47468c9fbc29Smrg	  *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
47478c9fbc29Smrg	    case "$compile_command " in
47488c9fbc29Smrg	    *" -static "*) ;;
47498c9fbc29Smrg	    *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
47508c9fbc29Smrg	    esac;;
47518c9fbc29Smrg	  *-*-hpux*)
47528c9fbc29Smrg	    case "$compile_command " in
47538c9fbc29Smrg	    *" -static "*) ;;
47548c9fbc29Smrg	    *) pic_flag_for_symtable=" $pic_flag";;
47558c9fbc29Smrg	    esac
47568c9fbc29Smrg	  esac
47578c9fbc29Smrg
47588c9fbc29Smrg	  # Now compile the dynamic symbol file.
47598c9fbc29Smrg	  $show "(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
47608c9fbc29Smrg	  $run eval '(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
47618c9fbc29Smrg
47628c9fbc29Smrg	  # Clean up the generated files.
47638c9fbc29Smrg	  $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
47648c9fbc29Smrg	  $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
47658c9fbc29Smrg
47668c9fbc29Smrg	  # Transform the symbol file into the correct name.
47678c9fbc29Smrg          case $host in
47688c9fbc29Smrg          *cygwin* | *mingw* )
47698c9fbc29Smrg            if test -f "$output_objdir/${outputname}.def" ; then
47704e411241Smrg              compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
47714e411241Smrg              finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
47728c9fbc29Smrg            else
47734e411241Smrg              compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
47744e411241Smrg              finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
47758c9fbc29Smrg             fi
47768c9fbc29Smrg            ;;
47778c9fbc29Smrg          * )
47784e411241Smrg            compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
47794e411241Smrg            finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
47808c9fbc29Smrg            ;;
47818c9fbc29Smrg          esac
47828c9fbc29Smrg	  ;;
47838c9fbc29Smrg	*)
47848c9fbc29Smrg	  $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
47858c9fbc29Smrg	  exit $EXIT_FAILURE
47868c9fbc29Smrg	  ;;
47878c9fbc29Smrg	esac
47888c9fbc29Smrg      else
47898c9fbc29Smrg	# We keep going just in case the user didn't refer to
47908c9fbc29Smrg	# lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
47918c9fbc29Smrg	# really was required.
47928c9fbc29Smrg
47938c9fbc29Smrg	# Nullify the symbol file.
47944e411241Smrg	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
47954e411241Smrg	finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
47968c9fbc29Smrg      fi
47978c9fbc29Smrg
47988c9fbc29Smrg      if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
47998c9fbc29Smrg	# Replace the output file specification.
48004e411241Smrg	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP`
48018c9fbc29Smrg	link_command="$compile_command$compile_rpath"
48028c9fbc29Smrg
48038c9fbc29Smrg	# We have no uninstalled library dependencies, so finalize right now.
48048c9fbc29Smrg	$show "$link_command"
48058c9fbc29Smrg	$run eval "$link_command"
48068c9fbc29Smrg	exit_status=$?
48078c9fbc29Smrg
48088c9fbc29Smrg	# Delete the generated files.
48098c9fbc29Smrg	if test -n "$dlsyms"; then
48108c9fbc29Smrg	  $show "$rm $output_objdir/${outputname}S.${objext}"
48118c9fbc29Smrg	  $run $rm "$output_objdir/${outputname}S.${objext}"
48128c9fbc29Smrg	fi
48138c9fbc29Smrg
48148c9fbc29Smrg	exit $exit_status
48158c9fbc29Smrg      fi
48168c9fbc29Smrg
48178c9fbc29Smrg      if test -n "$shlibpath_var"; then
48188c9fbc29Smrg	# We should set the shlibpath_var
48198c9fbc29Smrg	rpath=
48208c9fbc29Smrg	for dir in $temp_rpath; do
48218c9fbc29Smrg	  case $dir in
48228c9fbc29Smrg	  [\\/]* | [A-Za-z]:[\\/]*)
48238c9fbc29Smrg	    # Absolute path.
48248c9fbc29Smrg	    rpath="$rpath$dir:"
48258c9fbc29Smrg	    ;;
48268c9fbc29Smrg	  *)
48278c9fbc29Smrg	    # Relative path: add a thisdir entry.
48288c9fbc29Smrg	    rpath="$rpath\$thisdir/$dir:"
48298c9fbc29Smrg	    ;;
48308c9fbc29Smrg	  esac
48318c9fbc29Smrg	done
48328c9fbc29Smrg	temp_rpath="$rpath"
48338c9fbc29Smrg      fi
48348c9fbc29Smrg
48358c9fbc29Smrg      if test -n "$compile_shlibpath$finalize_shlibpath"; then
48368c9fbc29Smrg	compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
48378c9fbc29Smrg      fi
48388c9fbc29Smrg      if test -n "$finalize_shlibpath"; then
48398c9fbc29Smrg	finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
48408c9fbc29Smrg      fi
48418c9fbc29Smrg
48428c9fbc29Smrg      compile_var=
48438c9fbc29Smrg      finalize_var=
48448c9fbc29Smrg      if test -n "$runpath_var"; then
48458c9fbc29Smrg	if test -n "$perm_rpath"; then
48468c9fbc29Smrg	  # We should set the runpath_var.
48478c9fbc29Smrg	  rpath=
48488c9fbc29Smrg	  for dir in $perm_rpath; do
48498c9fbc29Smrg	    rpath="$rpath$dir:"
48508c9fbc29Smrg	  done
48518c9fbc29Smrg	  compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
48528c9fbc29Smrg	fi
48538c9fbc29Smrg	if test -n "$finalize_perm_rpath"; then
48548c9fbc29Smrg	  # We should set the runpath_var.
48558c9fbc29Smrg	  rpath=
48568c9fbc29Smrg	  for dir in $finalize_perm_rpath; do
48578c9fbc29Smrg	    rpath="$rpath$dir:"
48588c9fbc29Smrg	  done
48598c9fbc29Smrg	  finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
48608c9fbc29Smrg	fi
48618c9fbc29Smrg      fi
48628c9fbc29Smrg
48638c9fbc29Smrg      if test "$no_install" = yes; then
48648c9fbc29Smrg	# We don't need to create a wrapper script.
48658c9fbc29Smrg	link_command="$compile_var$compile_command$compile_rpath"
48668c9fbc29Smrg	# Replace the output file specification.
48678c9fbc29Smrg	link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
48688c9fbc29Smrg	# Delete the old output file.
48698c9fbc29Smrg	$run $rm $output
48708c9fbc29Smrg	# Link the executable and exit
48718c9fbc29Smrg	$show "$link_command"
48728c9fbc29Smrg	$run eval "$link_command" || exit $?
48738c9fbc29Smrg	exit $EXIT_SUCCESS
48748c9fbc29Smrg      fi
48758c9fbc29Smrg
48768c9fbc29Smrg      if test "$hardcode_action" = relink; then
48778c9fbc29Smrg	# Fast installation is not supported
48788c9fbc29Smrg	link_command="$compile_var$compile_command$compile_rpath"
48798c9fbc29Smrg	relink_command="$finalize_var$finalize_command$finalize_rpath"
48808c9fbc29Smrg
48818c9fbc29Smrg	$echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
48828c9fbc29Smrg	$echo "$modename: \`$output' will be relinked during installation" 1>&2
48838c9fbc29Smrg      else
48848c9fbc29Smrg	if test "$fast_install" != no; then
48858c9fbc29Smrg	  link_command="$finalize_var$compile_command$finalize_rpath"
48868c9fbc29Smrg	  if test "$fast_install" = yes; then
48874e411241Smrg	    relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP`
48888c9fbc29Smrg	  else
48898c9fbc29Smrg	    # fast_install is set to needless
48908c9fbc29Smrg	    relink_command=
48918c9fbc29Smrg	  fi
48928c9fbc29Smrg	else
48938c9fbc29Smrg	  link_command="$compile_var$compile_command$compile_rpath"
48948c9fbc29Smrg	  relink_command="$finalize_var$finalize_command$finalize_rpath"
48958c9fbc29Smrg	fi
48968c9fbc29Smrg      fi
48978c9fbc29Smrg
48988c9fbc29Smrg      # Replace the output file specification.
48998c9fbc29Smrg      link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
49008c9fbc29Smrg
49018c9fbc29Smrg      # Delete the old output files.
49028c9fbc29Smrg      $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
49038c9fbc29Smrg
49048c9fbc29Smrg      $show "$link_command"
49058c9fbc29Smrg      $run eval "$link_command" || exit $?
49068c9fbc29Smrg
49078c9fbc29Smrg      # Now create the wrapper script.
49088c9fbc29Smrg      $show "creating $output"
49098c9fbc29Smrg
49108c9fbc29Smrg      # Quote the relink command for shipping.
49118c9fbc29Smrg      if test -n "$relink_command"; then
49128c9fbc29Smrg	# Preserve any variables that may affect compiler behavior
49138c9fbc29Smrg	for var in $variables_saved_for_relink; do
49148c9fbc29Smrg	  if eval test -z \"\${$var+set}\"; then
49158c9fbc29Smrg	    relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
49168c9fbc29Smrg	  elif eval var_value=\$$var; test -z "$var_value"; then
49178c9fbc29Smrg	    relink_command="$var=; export $var; $relink_command"
49188c9fbc29Smrg	  else
49198c9fbc29Smrg	    var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
49208c9fbc29Smrg	    relink_command="$var=\"$var_value\"; export $var; $relink_command"
49218c9fbc29Smrg	  fi
49228c9fbc29Smrg	done
49238c9fbc29Smrg	relink_command="(cd `pwd`; $relink_command)"
49244e411241Smrg	relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
49258c9fbc29Smrg      fi
49268c9fbc29Smrg
49278c9fbc29Smrg      # Quote $echo for shipping.
49288c9fbc29Smrg      if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
49298c9fbc29Smrg	case $progpath in
49308c9fbc29Smrg	[\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
49318c9fbc29Smrg	*) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
49328c9fbc29Smrg	esac
49338c9fbc29Smrg	qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
49348c9fbc29Smrg      else
49358c9fbc29Smrg	qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
49368c9fbc29Smrg      fi
49378c9fbc29Smrg
49388c9fbc29Smrg      # Only actually do things if our run command is non-null.
49398c9fbc29Smrg      if test -z "$run"; then
49408c9fbc29Smrg	# win32 will think the script is a binary if it has
49418c9fbc29Smrg	# a .exe suffix, so we strip it off here.
49428c9fbc29Smrg	case $output in
49438c9fbc29Smrg	  *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
49448c9fbc29Smrg	esac
49458c9fbc29Smrg	# test for cygwin because mv fails w/o .exe extensions
49468c9fbc29Smrg	case $host in
49478c9fbc29Smrg	  *cygwin*)
49488c9fbc29Smrg	    exeext=.exe
49498c9fbc29Smrg	    outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
49508c9fbc29Smrg	  *) exeext= ;;
49518c9fbc29Smrg	esac
49528c9fbc29Smrg	case $host in
49538c9fbc29Smrg	  *cygwin* | *mingw* )
49548c9fbc29Smrg            output_name=`basename $output`
49558c9fbc29Smrg            output_path=`dirname $output`
49568c9fbc29Smrg            cwrappersource="$output_path/$objdir/lt-$output_name.c"
49578c9fbc29Smrg            cwrapper="$output_path/$output_name.exe"
49588c9fbc29Smrg            $rm $cwrappersource $cwrapper
49598c9fbc29Smrg            trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
49608c9fbc29Smrg
49618c9fbc29Smrg	    cat > $cwrappersource <<EOF
49628c9fbc29Smrg
49638c9fbc29Smrg/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
49648c9fbc29Smrg   Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
49658c9fbc29Smrg
49668c9fbc29Smrg   The $output program cannot be directly executed until all the libtool
49678c9fbc29Smrg   libraries that it depends on are installed.
49688c9fbc29Smrg
49698c9fbc29Smrg   This wrapper executable should never be moved out of the build directory.
49708c9fbc29Smrg   If it is, it will not operate correctly.
49718c9fbc29Smrg
49728c9fbc29Smrg   Currently, it simply execs the wrapper *script* "/bin/sh $output",
49738c9fbc29Smrg   but could eventually absorb all of the scripts functionality and
49748c9fbc29Smrg   exec $objdir/$outputname directly.
49758c9fbc29Smrg*/
49768c9fbc29SmrgEOF
49778c9fbc29Smrg	    cat >> $cwrappersource<<"EOF"
49788c9fbc29Smrg#include <stdio.h>
49798c9fbc29Smrg#include <stdlib.h>
49808c9fbc29Smrg#include <unistd.h>
49818c9fbc29Smrg#include <malloc.h>
49828c9fbc29Smrg#include <stdarg.h>
49838c9fbc29Smrg#include <assert.h>
49848c9fbc29Smrg#include <string.h>
49858c9fbc29Smrg#include <ctype.h>
49868c9fbc29Smrg#include <sys/stat.h>
49878c9fbc29Smrg
49888c9fbc29Smrg#if defined(PATH_MAX)
49898c9fbc29Smrg# define LT_PATHMAX PATH_MAX
49908c9fbc29Smrg#elif defined(MAXPATHLEN)
49918c9fbc29Smrg# define LT_PATHMAX MAXPATHLEN
49928c9fbc29Smrg#else
49938c9fbc29Smrg# define LT_PATHMAX 1024
49948c9fbc29Smrg#endif
49958c9fbc29Smrg
49968c9fbc29Smrg#ifndef DIR_SEPARATOR
49978c9fbc29Smrg# define DIR_SEPARATOR '/'
49988c9fbc29Smrg# define PATH_SEPARATOR ':'
49998c9fbc29Smrg#endif
50008c9fbc29Smrg
50018c9fbc29Smrg#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
50028c9fbc29Smrg  defined (__OS2__)
50038c9fbc29Smrg# define HAVE_DOS_BASED_FILE_SYSTEM
50048c9fbc29Smrg# ifndef DIR_SEPARATOR_2
50058c9fbc29Smrg#  define DIR_SEPARATOR_2 '\\'
50068c9fbc29Smrg# endif
50078c9fbc29Smrg# ifndef PATH_SEPARATOR_2
50088c9fbc29Smrg#  define PATH_SEPARATOR_2 ';'
50098c9fbc29Smrg# endif
50108c9fbc29Smrg#endif
50118c9fbc29Smrg
50128c9fbc29Smrg#ifndef DIR_SEPARATOR_2
50138c9fbc29Smrg# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
50148c9fbc29Smrg#else /* DIR_SEPARATOR_2 */
50158c9fbc29Smrg# define IS_DIR_SEPARATOR(ch) \
50168c9fbc29Smrg        (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
50178c9fbc29Smrg#endif /* DIR_SEPARATOR_2 */
50188c9fbc29Smrg
50198c9fbc29Smrg#ifndef PATH_SEPARATOR_2
50208c9fbc29Smrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
50218c9fbc29Smrg#else /* PATH_SEPARATOR_2 */
50228c9fbc29Smrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
50238c9fbc29Smrg#endif /* PATH_SEPARATOR_2 */
50248c9fbc29Smrg
50258c9fbc29Smrg#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
50268c9fbc29Smrg#define XFREE(stale) do { \
50278c9fbc29Smrg  if (stale) { free ((void *) stale); stale = 0; } \
50288c9fbc29Smrg} while (0)
50298c9fbc29Smrg
50308c9fbc29Smrg/* -DDEBUG is fairly common in CFLAGS.  */
50318c9fbc29Smrg#undef DEBUG
50328c9fbc29Smrg#if defined DEBUGWRAPPER
50338c9fbc29Smrg# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
50348c9fbc29Smrg#else
50358c9fbc29Smrg# define DEBUG(format, ...)
50368c9fbc29Smrg#endif
50378c9fbc29Smrg
50388c9fbc29Smrgconst char *program_name = NULL;
50398c9fbc29Smrg
50408c9fbc29Smrgvoid * xmalloc (size_t num);
50418c9fbc29Smrgchar * xstrdup (const char *string);
50428c9fbc29Smrgconst char * base_name (const char *name);
50438c9fbc29Smrgchar * find_executable(const char *wrapper);
50448c9fbc29Smrgint    check_executable(const char *path);
50458c9fbc29Smrgchar * strendzap(char *str, const char *pat);
50468c9fbc29Smrgvoid lt_fatal (const char *message, ...);
50478c9fbc29Smrg
50488c9fbc29Smrgint
50498c9fbc29Smrgmain (int argc, char *argv[])
50508c9fbc29Smrg{
50518c9fbc29Smrg  char **newargz;
50528c9fbc29Smrg  int i;
50538c9fbc29Smrg
50548c9fbc29Smrg  program_name = (char *) xstrdup (base_name (argv[0]));
50558c9fbc29Smrg  DEBUG("(main) argv[0]      : %s\n",argv[0]);
50568c9fbc29Smrg  DEBUG("(main) program_name : %s\n",program_name);
50578c9fbc29Smrg  newargz = XMALLOC(char *, argc+2);
50588c9fbc29SmrgEOF
50598c9fbc29Smrg
50608c9fbc29Smrg            cat >> $cwrappersource <<EOF
50618c9fbc29Smrg  newargz[0] = (char *) xstrdup("$SHELL");
50628c9fbc29SmrgEOF
50638c9fbc29Smrg
50648c9fbc29Smrg            cat >> $cwrappersource <<"EOF"
50658c9fbc29Smrg  newargz[1] = find_executable(argv[0]);
50668c9fbc29Smrg  if (newargz[1] == NULL)
50678c9fbc29Smrg    lt_fatal("Couldn't find %s", argv[0]);
50688c9fbc29Smrg  DEBUG("(main) found exe at : %s\n",newargz[1]);
50698c9fbc29Smrg  /* we know the script has the same name, without the .exe */
50708c9fbc29Smrg  /* so make sure newargz[1] doesn't end in .exe */
50718c9fbc29Smrg  strendzap(newargz[1],".exe");
50728c9fbc29Smrg  for (i = 1; i < argc; i++)
50738c9fbc29Smrg    newargz[i+1] = xstrdup(argv[i]);
50748c9fbc29Smrg  newargz[argc+1] = NULL;
50758c9fbc29Smrg
50768c9fbc29Smrg  for (i=0; i<argc+1; i++)
50778c9fbc29Smrg  {
50788c9fbc29Smrg    DEBUG("(main) newargz[%d]   : %s\n",i,newargz[i]);
50798c9fbc29Smrg    ;
50808c9fbc29Smrg  }
50818c9fbc29Smrg
50828c9fbc29SmrgEOF
50838c9fbc29Smrg
50848c9fbc29Smrg            case $host_os in
50858c9fbc29Smrg              mingw*)
50868c9fbc29Smrg                cat >> $cwrappersource <<EOF
50878c9fbc29Smrg  execv("$SHELL",(char const **)newargz);
50888c9fbc29SmrgEOF
50898c9fbc29Smrg              ;;
50908c9fbc29Smrg              *)
50918c9fbc29Smrg                cat >> $cwrappersource <<EOF
50928c9fbc29Smrg  execv("$SHELL",newargz);
50938c9fbc29SmrgEOF
50948c9fbc29Smrg              ;;
50958c9fbc29Smrg            esac
50968c9fbc29Smrg
50978c9fbc29Smrg            cat >> $cwrappersource <<"EOF"
50988c9fbc29Smrg  return 127;
50998c9fbc29Smrg}
51008c9fbc29Smrg
51018c9fbc29Smrgvoid *
51028c9fbc29Smrgxmalloc (size_t num)
51038c9fbc29Smrg{
51048c9fbc29Smrg  void * p = (void *) malloc (num);
51058c9fbc29Smrg  if (!p)
51068c9fbc29Smrg    lt_fatal ("Memory exhausted");
51078c9fbc29Smrg
51088c9fbc29Smrg  return p;
51098c9fbc29Smrg}
51108c9fbc29Smrg
51118c9fbc29Smrgchar *
51128c9fbc29Smrgxstrdup (const char *string)
51138c9fbc29Smrg{
51148c9fbc29Smrg  return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
51158c9fbc29Smrg;
51168c9fbc29Smrg}
51178c9fbc29Smrg
51188c9fbc29Smrgconst char *
51198c9fbc29Smrgbase_name (const char *name)
51208c9fbc29Smrg{
51218c9fbc29Smrg  const char *base;
51228c9fbc29Smrg
51238c9fbc29Smrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
51248c9fbc29Smrg  /* Skip over the disk name in MSDOS pathnames. */
51258c9fbc29Smrg  if (isalpha ((unsigned char)name[0]) && name[1] == ':')
51268c9fbc29Smrg    name += 2;
51278c9fbc29Smrg#endif
51288c9fbc29Smrg
51298c9fbc29Smrg  for (base = name; *name; name++)
51308c9fbc29Smrg    if (IS_DIR_SEPARATOR (*name))
51318c9fbc29Smrg      base = name + 1;
51328c9fbc29Smrg  return base;
51338c9fbc29Smrg}
51348c9fbc29Smrg
51358c9fbc29Smrgint
51368c9fbc29Smrgcheck_executable(const char * path)
51378c9fbc29Smrg{
51388c9fbc29Smrg  struct stat st;
51398c9fbc29Smrg
51408c9fbc29Smrg  DEBUG("(check_executable)  : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
51418c9fbc29Smrg  if ((!path) || (!*path))
51428c9fbc29Smrg    return 0;
51438c9fbc29Smrg
51448c9fbc29Smrg  if ((stat (path, &st) >= 0) &&
51458c9fbc29Smrg      (
51468c9fbc29Smrg        /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
51478c9fbc29Smrg#if defined (S_IXOTH)
51488c9fbc29Smrg       ((st.st_mode & S_IXOTH) == S_IXOTH) ||
51498c9fbc29Smrg#endif
51508c9fbc29Smrg#if defined (S_IXGRP)
51518c9fbc29Smrg       ((st.st_mode & S_IXGRP) == S_IXGRP) ||
51528c9fbc29Smrg#endif
51538c9fbc29Smrg       ((st.st_mode & S_IXUSR) == S_IXUSR))
51548c9fbc29Smrg      )
51558c9fbc29Smrg    return 1;
51568c9fbc29Smrg  else
51578c9fbc29Smrg    return 0;
51588c9fbc29Smrg}
51598c9fbc29Smrg
51608c9fbc29Smrg/* Searches for the full path of the wrapper.  Returns
51618c9fbc29Smrg   newly allocated full path name if found, NULL otherwise */
51628c9fbc29Smrgchar *
51638c9fbc29Smrgfind_executable (const char* wrapper)
51648c9fbc29Smrg{
51658c9fbc29Smrg  int has_slash = 0;
51668c9fbc29Smrg  const char* p;
51678c9fbc29Smrg  const char* p_next;
51688c9fbc29Smrg  /* static buffer for getcwd */
51698c9fbc29Smrg  char tmp[LT_PATHMAX + 1];
51708c9fbc29Smrg  int tmp_len;
51718c9fbc29Smrg  char* concat_name;
51728c9fbc29Smrg
51738c9fbc29Smrg  DEBUG("(find_executable)  : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
51748c9fbc29Smrg
51758c9fbc29Smrg  if ((wrapper == NULL) || (*wrapper == '\0'))
51768c9fbc29Smrg    return NULL;
51778c9fbc29Smrg
51788c9fbc29Smrg  /* Absolute path? */
51798c9fbc29Smrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
51808c9fbc29Smrg  if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
51818c9fbc29Smrg  {
51828c9fbc29Smrg    concat_name = xstrdup (wrapper);
51838c9fbc29Smrg    if (check_executable(concat_name))
51848c9fbc29Smrg      return concat_name;
51858c9fbc29Smrg    XFREE(concat_name);
51868c9fbc29Smrg  }
51878c9fbc29Smrg  else
51888c9fbc29Smrg  {
51898c9fbc29Smrg#endif
51908c9fbc29Smrg    if (IS_DIR_SEPARATOR (wrapper[0]))
51918c9fbc29Smrg    {
51928c9fbc29Smrg      concat_name = xstrdup (wrapper);
51938c9fbc29Smrg      if (check_executable(concat_name))
51948c9fbc29Smrg        return concat_name;
51958c9fbc29Smrg      XFREE(concat_name);
51968c9fbc29Smrg    }
51978c9fbc29Smrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
51988c9fbc29Smrg  }
51998c9fbc29Smrg#endif
52008c9fbc29Smrg
52018c9fbc29Smrg  for (p = wrapper; *p; p++)
52028c9fbc29Smrg    if (*p == '/')
52038c9fbc29Smrg    {
52048c9fbc29Smrg      has_slash = 1;
52058c9fbc29Smrg      break;
52068c9fbc29Smrg    }
52078c9fbc29Smrg  if (!has_slash)
52088c9fbc29Smrg  {
52098c9fbc29Smrg    /* no slashes; search PATH */
52108c9fbc29Smrg    const char* path = getenv ("PATH");
52118c9fbc29Smrg    if (path != NULL)
52128c9fbc29Smrg    {
52138c9fbc29Smrg      for (p = path; *p; p = p_next)
52148c9fbc29Smrg      {
52158c9fbc29Smrg        const char* q;
52168c9fbc29Smrg        size_t p_len;
52178c9fbc29Smrg        for (q = p; *q; q++)
52188c9fbc29Smrg          if (IS_PATH_SEPARATOR(*q))
52198c9fbc29Smrg            break;
52208c9fbc29Smrg        p_len = q - p;
52218c9fbc29Smrg        p_next = (*q == '\0' ? q : q + 1);
52228c9fbc29Smrg        if (p_len == 0)
52238c9fbc29Smrg        {
52248c9fbc29Smrg          /* empty path: current directory */
52258c9fbc29Smrg          if (getcwd (tmp, LT_PATHMAX) == NULL)
52268c9fbc29Smrg            lt_fatal ("getcwd failed");
52278c9fbc29Smrg          tmp_len = strlen(tmp);
52288c9fbc29Smrg          concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
52298c9fbc29Smrg          memcpy (concat_name, tmp, tmp_len);
52308c9fbc29Smrg          concat_name[tmp_len] = '/';
52318c9fbc29Smrg          strcpy (concat_name + tmp_len + 1, wrapper);
52328c9fbc29Smrg        }
52338c9fbc29Smrg        else
52348c9fbc29Smrg        {
52358c9fbc29Smrg          concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
52368c9fbc29Smrg          memcpy (concat_name, p, p_len);
52378c9fbc29Smrg          concat_name[p_len] = '/';
52388c9fbc29Smrg          strcpy (concat_name + p_len + 1, wrapper);
52398c9fbc29Smrg        }
52408c9fbc29Smrg        if (check_executable(concat_name))
52418c9fbc29Smrg          return concat_name;
52428c9fbc29Smrg        XFREE(concat_name);
52438c9fbc29Smrg      }
52448c9fbc29Smrg    }
52458c9fbc29Smrg    /* not found in PATH; assume curdir */
52468c9fbc29Smrg  }
52478c9fbc29Smrg  /* Relative path | not found in path: prepend cwd */
52488c9fbc29Smrg  if (getcwd (tmp, LT_PATHMAX) == NULL)
52498c9fbc29Smrg    lt_fatal ("getcwd failed");
52508c9fbc29Smrg  tmp_len = strlen(tmp);
52518c9fbc29Smrg  concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
52528c9fbc29Smrg  memcpy (concat_name, tmp, tmp_len);
52538c9fbc29Smrg  concat_name[tmp_len] = '/';
52548c9fbc29Smrg  strcpy (concat_name + tmp_len + 1, wrapper);
52558c9fbc29Smrg
52568c9fbc29Smrg  if (check_executable(concat_name))
52578c9fbc29Smrg    return concat_name;
52588c9fbc29Smrg  XFREE(concat_name);
52598c9fbc29Smrg  return NULL;
52608c9fbc29Smrg}
52618c9fbc29Smrg
52628c9fbc29Smrgchar *
52638c9fbc29Smrgstrendzap(char *str, const char *pat)
52648c9fbc29Smrg{
52658c9fbc29Smrg  size_t len, patlen;
52668c9fbc29Smrg
52678c9fbc29Smrg  assert(str != NULL);
52688c9fbc29Smrg  assert(pat != NULL);
52698c9fbc29Smrg
52708c9fbc29Smrg  len = strlen(str);
52718c9fbc29Smrg  patlen = strlen(pat);
52728c9fbc29Smrg
52738c9fbc29Smrg  if (patlen <= len)
52748c9fbc29Smrg  {
52758c9fbc29Smrg    str += len - patlen;
52768c9fbc29Smrg    if (strcmp(str, pat) == 0)
52778c9fbc29Smrg      *str = '\0';
52788c9fbc29Smrg  }
52798c9fbc29Smrg  return str;
52808c9fbc29Smrg}
52818c9fbc29Smrg
52828c9fbc29Smrgstatic void
52838c9fbc29Smrglt_error_core (int exit_status, const char * mode,
52848c9fbc29Smrg          const char * message, va_list ap)
52858c9fbc29Smrg{
52868c9fbc29Smrg  fprintf (stderr, "%s: %s: ", program_name, mode);
52878c9fbc29Smrg  vfprintf (stderr, message, ap);
52888c9fbc29Smrg  fprintf (stderr, ".\n");
52898c9fbc29Smrg
52908c9fbc29Smrg  if (exit_status >= 0)
52918c9fbc29Smrg    exit (exit_status);
52928c9fbc29Smrg}
52938c9fbc29Smrg
52948c9fbc29Smrgvoid
52958c9fbc29Smrglt_fatal (const char *message, ...)
52968c9fbc29Smrg{
52978c9fbc29Smrg  va_list ap;
52988c9fbc29Smrg  va_start (ap, message);
52998c9fbc29Smrg  lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
53008c9fbc29Smrg  va_end (ap);
53018c9fbc29Smrg}
53028c9fbc29SmrgEOF
53038c9fbc29Smrg          # we should really use a build-platform specific compiler
53048c9fbc29Smrg          # here, but OTOH, the wrappers (shell script and this C one)
53058c9fbc29Smrg          # are only useful if you want to execute the "real" binary.
53068c9fbc29Smrg          # Since the "real" binary is built for $host, then this
53078c9fbc29Smrg          # wrapper might as well be built for $host, too.
53088c9fbc29Smrg          $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
53098c9fbc29Smrg          ;;
53108c9fbc29Smrg        esac
53118c9fbc29Smrg        $rm $output
53128c9fbc29Smrg        trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
53138c9fbc29Smrg
53148c9fbc29Smrg	$echo > $output "\
53158c9fbc29Smrg#! $SHELL
53168c9fbc29Smrg
53178c9fbc29Smrg# $output - temporary wrapper script for $objdir/$outputname
53188c9fbc29Smrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
53198c9fbc29Smrg#
53208c9fbc29Smrg# The $output program cannot be directly executed until all the libtool
53218c9fbc29Smrg# libraries that it depends on are installed.
53228c9fbc29Smrg#
53238c9fbc29Smrg# This wrapper script should never be moved out of the build directory.
53248c9fbc29Smrg# If it is, it will not operate correctly.
53258c9fbc29Smrg
53268c9fbc29Smrg# Sed substitution that helps us do robust quoting.  It backslashifies
53278c9fbc29Smrg# metacharacters that are still active within double-quoted strings.
53288c9fbc29SmrgXsed='${SED} -e 1s/^X//'
53298c9fbc29Smrgsed_quote_subst='$sed_quote_subst'
53308c9fbc29Smrg
53314e411241Smrg# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
53324e411241Smrgif test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
53334e411241Smrg  emulate sh
53344e411241Smrg  NULLCMD=:
53354e411241Smrg  # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
53364e411241Smrg  # is contrary to our usage.  Disable this feature.
53374e411241Smrg  alias -g '\${1+\"\$@\"}'='\"\$@\"'
53384e411241Smrg  setopt NO_GLOB_SUBST
53394e411241Smrgelse
53404e411241Smrg  case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
53414e411241Smrgfi
53424e411241SmrgBIN_SH=xpg4; export BIN_SH # for Tru64
53434e411241SmrgDUALCASE=1; export DUALCASE # for MKS sh
53444e411241Smrg
53458c9fbc29Smrg# The HP-UX ksh and POSIX shell print the target directory to stdout
53468c9fbc29Smrg# if CDPATH is set.
53478c9fbc29Smrg(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
53488c9fbc29Smrg
53498c9fbc29Smrgrelink_command=\"$relink_command\"
53508c9fbc29Smrg
53518c9fbc29Smrg# This environment variable determines our operation mode.
53528c9fbc29Smrgif test \"\$libtool_install_magic\" = \"$magic\"; then
53538c9fbc29Smrg  # install mode needs the following variable:
53548c9fbc29Smrg  notinst_deplibs='$notinst_deplibs'
53558c9fbc29Smrgelse
53568c9fbc29Smrg  # When we are sourced in execute mode, \$file and \$echo are already set.
53578c9fbc29Smrg  if test \"\$libtool_execute_magic\" != \"$magic\"; then
53588c9fbc29Smrg    echo=\"$qecho\"
53598c9fbc29Smrg    file=\"\$0\"
53608c9fbc29Smrg    # Make sure echo works.
53618c9fbc29Smrg    if test \"X\$1\" = X--no-reexec; then
53628c9fbc29Smrg      # Discard the --no-reexec flag, and continue.
53638c9fbc29Smrg      shift
53648c9fbc29Smrg    elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
53658c9fbc29Smrg      # Yippee, \$echo works!
53668c9fbc29Smrg      :
53678c9fbc29Smrg    else
53688c9fbc29Smrg      # Restart under the correct shell, and then maybe \$echo will work.
53698c9fbc29Smrg      exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
53708c9fbc29Smrg    fi
53718c9fbc29Smrg  fi\
53728c9fbc29Smrg"
53738c9fbc29Smrg	$echo >> $output "\
53748c9fbc29Smrg
53758c9fbc29Smrg  # Find the directory that this script lives in.
53768c9fbc29Smrg  thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
53778c9fbc29Smrg  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
53788c9fbc29Smrg
53798c9fbc29Smrg  # Follow symbolic links until we get to the real thisdir.
53808c9fbc29Smrg  file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
53818c9fbc29Smrg  while test -n \"\$file\"; do
53828c9fbc29Smrg    destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
53838c9fbc29Smrg
53848c9fbc29Smrg    # If there was a directory component, then change thisdir.
53858c9fbc29Smrg    if test \"x\$destdir\" != \"x\$file\"; then
53868c9fbc29Smrg      case \"\$destdir\" in
53878c9fbc29Smrg      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
53888c9fbc29Smrg      *) thisdir=\"\$thisdir/\$destdir\" ;;
53898c9fbc29Smrg      esac
53908c9fbc29Smrg    fi
53918c9fbc29Smrg
53928c9fbc29Smrg    file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
53938c9fbc29Smrg    file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
53948c9fbc29Smrg  done
53958c9fbc29Smrg
53968c9fbc29Smrg  # Try to get the absolute directory name.
53978c9fbc29Smrg  absdir=\`cd \"\$thisdir\" && pwd\`
53988c9fbc29Smrg  test -n \"\$absdir\" && thisdir=\"\$absdir\"
53998c9fbc29Smrg"
54008c9fbc29Smrg
54018c9fbc29Smrg	if test "$fast_install" = yes; then
54028c9fbc29Smrg	  $echo >> $output "\
54038c9fbc29Smrg  program=lt-'$outputname'$exeext
54048c9fbc29Smrg  progdir=\"\$thisdir/$objdir\"
54058c9fbc29Smrg
54068c9fbc29Smrg  if test ! -f \"\$progdir/\$program\" || \\
54078c9fbc29Smrg     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
54088c9fbc29Smrg       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
54098c9fbc29Smrg
54108c9fbc29Smrg    file=\"\$\$-\$program\"
54118c9fbc29Smrg
54128c9fbc29Smrg    if test ! -d \"\$progdir\"; then
54138c9fbc29Smrg      $mkdir \"\$progdir\"
54148c9fbc29Smrg    else
54158c9fbc29Smrg      $rm \"\$progdir/\$file\"
54168c9fbc29Smrg    fi"
54178c9fbc29Smrg
54188c9fbc29Smrg	  $echo >> $output "\
54198c9fbc29Smrg
54208c9fbc29Smrg    # relink executable if necessary
54218c9fbc29Smrg    if test -n \"\$relink_command\"; then
54228c9fbc29Smrg      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
54238c9fbc29Smrg      else
54248c9fbc29Smrg	$echo \"\$relink_command_output\" >&2
54258c9fbc29Smrg	$rm \"\$progdir/\$file\"
54268c9fbc29Smrg	exit $EXIT_FAILURE
54278c9fbc29Smrg      fi
54288c9fbc29Smrg    fi
54298c9fbc29Smrg
54308c9fbc29Smrg    $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
54318c9fbc29Smrg    { $rm \"\$progdir/\$program\";
54328c9fbc29Smrg      $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
54338c9fbc29Smrg    $rm \"\$progdir/\$file\"
54348c9fbc29Smrg  fi"
54358c9fbc29Smrg	else
54368c9fbc29Smrg	  $echo >> $output "\
54378c9fbc29Smrg  program='$outputname'
54388c9fbc29Smrg  progdir=\"\$thisdir/$objdir\"
54398c9fbc29Smrg"
54408c9fbc29Smrg	fi
54418c9fbc29Smrg
54428c9fbc29Smrg	$echo >> $output "\
54438c9fbc29Smrg
54448c9fbc29Smrg  if test -f \"\$progdir/\$program\"; then"
54458c9fbc29Smrg
54468c9fbc29Smrg	# Export our shlibpath_var if we have one.
54478c9fbc29Smrg	if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
54488c9fbc29Smrg	  $echo >> $output "\
54498c9fbc29Smrg    # Add our own library path to $shlibpath_var
54508c9fbc29Smrg    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
54518c9fbc29Smrg
54528c9fbc29Smrg    # Some systems cannot cope with colon-terminated $shlibpath_var
54538c9fbc29Smrg    # The second colon is a workaround for a bug in BeOS R4 sed
54548c9fbc29Smrg    $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
54558c9fbc29Smrg
54568c9fbc29Smrg    export $shlibpath_var
54578c9fbc29Smrg"
54588c9fbc29Smrg	fi
54598c9fbc29Smrg
54608c9fbc29Smrg	# fixup the dll searchpath if we need to.
54618c9fbc29Smrg	if test -n "$dllsearchpath"; then
54628c9fbc29Smrg	  $echo >> $output "\
54638c9fbc29Smrg    # Add the dll search path components to the executable PATH
54648c9fbc29Smrg    PATH=$dllsearchpath:\$PATH
54658c9fbc29Smrg"
54668c9fbc29Smrg	fi
54678c9fbc29Smrg
54688c9fbc29Smrg	$echo >> $output "\
54698c9fbc29Smrg    if test \"\$libtool_execute_magic\" != \"$magic\"; then
54708c9fbc29Smrg      # Run the actual program with our arguments.
54718c9fbc29Smrg"
54728c9fbc29Smrg	case $host in
54738c9fbc29Smrg	# Backslashes separate directories on plain windows
54748c9fbc29Smrg	*-*-mingw | *-*-os2*)
54758c9fbc29Smrg	  $echo >> $output "\
54768c9fbc29Smrg      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
54778c9fbc29Smrg"
54788c9fbc29Smrg	  ;;
54798c9fbc29Smrg
54808c9fbc29Smrg	*)
54818c9fbc29Smrg	  $echo >> $output "\
54828c9fbc29Smrg      exec \"\$progdir/\$program\" \${1+\"\$@\"}
54838c9fbc29Smrg"
54848c9fbc29Smrg	  ;;
54858c9fbc29Smrg	esac
54868c9fbc29Smrg	$echo >> $output "\
54874e411241Smrg      \$echo \"\$0: cannot exec \$program \$*\"
54888c9fbc29Smrg      exit $EXIT_FAILURE
54898c9fbc29Smrg    fi
54908c9fbc29Smrg  else
54918c9fbc29Smrg    # The program doesn't exist.
54928c9fbc29Smrg    \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
54938c9fbc29Smrg    \$echo \"This script is just a wrapper for \$program.\" 1>&2
54948c9fbc29Smrg    $echo \"See the $PACKAGE documentation for more information.\" 1>&2
54958c9fbc29Smrg    exit $EXIT_FAILURE
54968c9fbc29Smrg  fi
54978c9fbc29Smrgfi\
54988c9fbc29Smrg"
54998c9fbc29Smrg	chmod +x $output
55008c9fbc29Smrg      fi
55018c9fbc29Smrg      exit $EXIT_SUCCESS
55028c9fbc29Smrg      ;;
55038c9fbc29Smrg    esac
55048c9fbc29Smrg
55058c9fbc29Smrg    # See if we need to build an old-fashioned archive.
55068c9fbc29Smrg    for oldlib in $oldlibs; do
55078c9fbc29Smrg
55088c9fbc29Smrg      if test "$build_libtool_libs" = convenience; then
55098c9fbc29Smrg	oldobjs="$libobjs_save"
55108c9fbc29Smrg	addlibs="$convenience"
55118c9fbc29Smrg	build_libtool_libs=no
55128c9fbc29Smrg      else
55138c9fbc29Smrg	if test "$build_libtool_libs" = module; then
55148c9fbc29Smrg	  oldobjs="$libobjs_save"
55158c9fbc29Smrg	  build_libtool_libs=no
55168c9fbc29Smrg	else
55178c9fbc29Smrg	  oldobjs="$old_deplibs $non_pic_objects"
55188c9fbc29Smrg	fi
55198c9fbc29Smrg	addlibs="$old_convenience"
55208c9fbc29Smrg      fi
55218c9fbc29Smrg
55228c9fbc29Smrg      if test -n "$addlibs"; then
55238c9fbc29Smrg	gentop="$output_objdir/${outputname}x"
55248c9fbc29Smrg	generated="$generated $gentop"
55258c9fbc29Smrg
55268c9fbc29Smrg	func_extract_archives $gentop $addlibs
55278c9fbc29Smrg	oldobjs="$oldobjs $func_extract_archives_result"
55288c9fbc29Smrg      fi
55298c9fbc29Smrg
55308c9fbc29Smrg      # Do each command in the archive commands.
55318c9fbc29Smrg      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
55328c9fbc29Smrg       cmds=$old_archive_from_new_cmds
55338c9fbc29Smrg      else
55348c9fbc29Smrg	# POSIX demands no paths to be encoded in archives.  We have
55358c9fbc29Smrg	# to avoid creating archives with duplicate basenames if we
55368c9fbc29Smrg	# might have to extract them afterwards, e.g., when creating a
55378c9fbc29Smrg	# static archive out of a convenience library, or when linking
55388c9fbc29Smrg	# the entirety of a libtool archive into another (currently
55398c9fbc29Smrg	# not supported by libtool).
55408c9fbc29Smrg	if (for obj in $oldobjs
55418c9fbc29Smrg	    do
55428c9fbc29Smrg	      $echo "X$obj" | $Xsed -e 's%^.*/%%'
55438c9fbc29Smrg	    done | sort | sort -uc >/dev/null 2>&1); then
55448c9fbc29Smrg	  :
55458c9fbc29Smrg	else
55468c9fbc29Smrg	  $echo "copying selected object files to avoid basename conflicts..."
55478c9fbc29Smrg
55488c9fbc29Smrg	  if test -z "$gentop"; then
55498c9fbc29Smrg	    gentop="$output_objdir/${outputname}x"
55508c9fbc29Smrg	    generated="$generated $gentop"
55518c9fbc29Smrg
55528c9fbc29Smrg	    $show "${rm}r $gentop"
55538c9fbc29Smrg	    $run ${rm}r "$gentop"
55548c9fbc29Smrg	    $show "$mkdir $gentop"
55558c9fbc29Smrg	    $run $mkdir "$gentop"
55568c9fbc29Smrg	    exit_status=$?
55578c9fbc29Smrg	    if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
55588c9fbc29Smrg	      exit $exit_status
55598c9fbc29Smrg	    fi
55608c9fbc29Smrg	  fi
55618c9fbc29Smrg
55628c9fbc29Smrg	  save_oldobjs=$oldobjs
55638c9fbc29Smrg	  oldobjs=
55648c9fbc29Smrg	  counter=1
55658c9fbc29Smrg	  for obj in $save_oldobjs
55668c9fbc29Smrg	  do
55678c9fbc29Smrg	    objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
55688c9fbc29Smrg	    case " $oldobjs " in
55698c9fbc29Smrg	    " ") oldobjs=$obj ;;
55708c9fbc29Smrg	    *[\ /]"$objbase "*)
55718c9fbc29Smrg	      while :; do
55728c9fbc29Smrg		# Make sure we don't pick an alternate name that also
55738c9fbc29Smrg		# overlaps.
55748c9fbc29Smrg		newobj=lt$counter-$objbase
55758c9fbc29Smrg		counter=`expr $counter + 1`
55768c9fbc29Smrg		case " $oldobjs " in
55778c9fbc29Smrg		*[\ /]"$newobj "*) ;;
55788c9fbc29Smrg		*) if test ! -f "$gentop/$newobj"; then break; fi ;;
55798c9fbc29Smrg		esac
55808c9fbc29Smrg	      done
55818c9fbc29Smrg	      $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
55828c9fbc29Smrg	      $run ln "$obj" "$gentop/$newobj" ||
55838c9fbc29Smrg	      $run cp "$obj" "$gentop/$newobj"
55848c9fbc29Smrg	      oldobjs="$oldobjs $gentop/$newobj"
55858c9fbc29Smrg	      ;;
55868c9fbc29Smrg	    *) oldobjs="$oldobjs $obj" ;;
55878c9fbc29Smrg	    esac
55888c9fbc29Smrg	  done
55898c9fbc29Smrg	fi
55908c9fbc29Smrg
55918c9fbc29Smrg	eval cmds=\"$old_archive_cmds\"
55928c9fbc29Smrg
55938c9fbc29Smrg	if len=`expr "X$cmds" : ".*"` &&
55948c9fbc29Smrg	     test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
55958c9fbc29Smrg	  cmds=$old_archive_cmds
55968c9fbc29Smrg	else
55978c9fbc29Smrg	  # the command line is too long to link in one step, link in parts
55988c9fbc29Smrg	  $echo "using piecewise archive linking..."
55998c9fbc29Smrg	  save_RANLIB=$RANLIB
56008c9fbc29Smrg	  RANLIB=:
56018c9fbc29Smrg	  objlist=
56028c9fbc29Smrg	  concat_cmds=
56038c9fbc29Smrg	  save_oldobjs=$oldobjs
56048c9fbc29Smrg
56058c9fbc29Smrg	  # Is there a better way of finding the last object in the list?
56068c9fbc29Smrg	  for obj in $save_oldobjs
56078c9fbc29Smrg	  do
56088c9fbc29Smrg	    last_oldobj=$obj
56098c9fbc29Smrg	  done
56108c9fbc29Smrg	  for obj in $save_oldobjs
56118c9fbc29Smrg	  do
56128c9fbc29Smrg	    oldobjs="$objlist $obj"
56138c9fbc29Smrg	    objlist="$objlist $obj"
56148c9fbc29Smrg	    eval test_cmds=\"$old_archive_cmds\"
56158c9fbc29Smrg	    if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
56168c9fbc29Smrg	       test "$len" -le "$max_cmd_len"; then
56178c9fbc29Smrg	      :
56188c9fbc29Smrg	    else
56198c9fbc29Smrg	      # the above command should be used before it gets too long
56208c9fbc29Smrg	      oldobjs=$objlist
56218c9fbc29Smrg	      if test "$obj" = "$last_oldobj" ; then
56228c9fbc29Smrg	        RANLIB=$save_RANLIB
56238c9fbc29Smrg	      fi
56248c9fbc29Smrg	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
56258c9fbc29Smrg	      eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
56268c9fbc29Smrg	      objlist=
56278c9fbc29Smrg	    fi
56288c9fbc29Smrg	  done
56298c9fbc29Smrg	  RANLIB=$save_RANLIB
56308c9fbc29Smrg	  oldobjs=$objlist
56318c9fbc29Smrg	  if test "X$oldobjs" = "X" ; then
56328c9fbc29Smrg	    eval cmds=\"\$concat_cmds\"
56338c9fbc29Smrg	  else
56348c9fbc29Smrg	    eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
56358c9fbc29Smrg	  fi
56368c9fbc29Smrg	fi
56378c9fbc29Smrg      fi
56388c9fbc29Smrg      save_ifs="$IFS"; IFS='~'
56398c9fbc29Smrg      for cmd in $cmds; do
56408c9fbc29Smrg        eval cmd=\"$cmd\"
56418c9fbc29Smrg	IFS="$save_ifs"
56428c9fbc29Smrg	$show "$cmd"
56438c9fbc29Smrg	$run eval "$cmd" || exit $?
56448c9fbc29Smrg      done
56458c9fbc29Smrg      IFS="$save_ifs"
56468c9fbc29Smrg    done
56478c9fbc29Smrg
56488c9fbc29Smrg    if test -n "$generated"; then
56498c9fbc29Smrg      $show "${rm}r$generated"
56508c9fbc29Smrg      $run ${rm}r$generated
56518c9fbc29Smrg    fi
56528c9fbc29Smrg
56538c9fbc29Smrg    # Now create the libtool archive.
56548c9fbc29Smrg    case $output in
56558c9fbc29Smrg    *.la)
56568c9fbc29Smrg      old_library=
56578c9fbc29Smrg      test "$build_old_libs" = yes && old_library="$libname.$libext"
56588c9fbc29Smrg      $show "creating $output"
56598c9fbc29Smrg
56608c9fbc29Smrg      # Preserve any variables that may affect compiler behavior
56618c9fbc29Smrg      for var in $variables_saved_for_relink; do
56628c9fbc29Smrg	if eval test -z \"\${$var+set}\"; then
56638c9fbc29Smrg	  relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
56648c9fbc29Smrg	elif eval var_value=\$$var; test -z "$var_value"; then
56658c9fbc29Smrg	  relink_command="$var=; export $var; $relink_command"
56668c9fbc29Smrg	else
56678c9fbc29Smrg	  var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
56688c9fbc29Smrg	  relink_command="$var=\"$var_value\"; export $var; $relink_command"
56698c9fbc29Smrg	fi
56708c9fbc29Smrg      done
56718c9fbc29Smrg      # Quote the link command for shipping.
56728c9fbc29Smrg      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
56734e411241Smrg      relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
56748c9fbc29Smrg      if test "$hardcode_automatic" = yes ; then
56758c9fbc29Smrg	relink_command=
56768c9fbc29Smrg      fi
56778c9fbc29Smrg
56788c9fbc29Smrg
56798c9fbc29Smrg      # Only create the output if not a dry run.
56808c9fbc29Smrg      if test -z "$run"; then
56818c9fbc29Smrg	for installed in no yes; do
56828c9fbc29Smrg	  if test "$installed" = yes; then
56838c9fbc29Smrg	    if test -z "$install_libdir"; then
56848c9fbc29Smrg	      break
56858c9fbc29Smrg	    fi
56868c9fbc29Smrg	    output="$output_objdir/$outputname"i
56878c9fbc29Smrg	    # Replace all uninstalled libtool libraries with the installed ones
56888c9fbc29Smrg	    newdependency_libs=
56898c9fbc29Smrg	    for deplib in $dependency_libs; do
56908c9fbc29Smrg	      case $deplib in
56918c9fbc29Smrg	      *.la)
56928c9fbc29Smrg		name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
56938c9fbc29Smrg		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
56948c9fbc29Smrg		if test -z "$libdir"; then
56958c9fbc29Smrg		  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
56968c9fbc29Smrg		  exit $EXIT_FAILURE
56978c9fbc29Smrg		fi
56988c9fbc29Smrg		newdependency_libs="$newdependency_libs $libdir/$name"
56998c9fbc29Smrg		;;
57008c9fbc29Smrg	      *) newdependency_libs="$newdependency_libs $deplib" ;;
57018c9fbc29Smrg	      esac
57028c9fbc29Smrg	    done
57038c9fbc29Smrg	    dependency_libs="$newdependency_libs"
57048c9fbc29Smrg	    newdlfiles=
57058c9fbc29Smrg	    for lib in $dlfiles; do
57068c9fbc29Smrg	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
57078c9fbc29Smrg	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
57088c9fbc29Smrg	      if test -z "$libdir"; then
57098c9fbc29Smrg		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
57108c9fbc29Smrg		exit $EXIT_FAILURE
57118c9fbc29Smrg	      fi
57128c9fbc29Smrg	      newdlfiles="$newdlfiles $libdir/$name"
57138c9fbc29Smrg	    done
57148c9fbc29Smrg	    dlfiles="$newdlfiles"
57158c9fbc29Smrg	    newdlprefiles=
57168c9fbc29Smrg	    for lib in $dlprefiles; do
57178c9fbc29Smrg	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
57188c9fbc29Smrg	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
57198c9fbc29Smrg	      if test -z "$libdir"; then
57208c9fbc29Smrg		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
57218c9fbc29Smrg		exit $EXIT_FAILURE
57228c9fbc29Smrg	      fi
57238c9fbc29Smrg	      newdlprefiles="$newdlprefiles $libdir/$name"
57248c9fbc29Smrg	    done
57258c9fbc29Smrg	    dlprefiles="$newdlprefiles"
57268c9fbc29Smrg	  else
57278c9fbc29Smrg	    newdlfiles=
57288c9fbc29Smrg	    for lib in $dlfiles; do
57298c9fbc29Smrg	      case $lib in
57308c9fbc29Smrg		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
57318c9fbc29Smrg		*) abs=`pwd`"/$lib" ;;
57328c9fbc29Smrg	      esac
57338c9fbc29Smrg	      newdlfiles="$newdlfiles $abs"
57348c9fbc29Smrg	    done
57358c9fbc29Smrg	    dlfiles="$newdlfiles"
57368c9fbc29Smrg	    newdlprefiles=
57378c9fbc29Smrg	    for lib in $dlprefiles; do
57388c9fbc29Smrg	      case $lib in
57398c9fbc29Smrg		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
57408c9fbc29Smrg		*) abs=`pwd`"/$lib" ;;
57418c9fbc29Smrg	      esac
57428c9fbc29Smrg	      newdlprefiles="$newdlprefiles $abs"
57438c9fbc29Smrg	    done
57448c9fbc29Smrg	    dlprefiles="$newdlprefiles"
57458c9fbc29Smrg	  fi
57468c9fbc29Smrg	  $rm $output
57478c9fbc29Smrg	  # place dlname in correct position for cygwin
57488c9fbc29Smrg	  tdlname=$dlname
57498c9fbc29Smrg	  case $host,$output,$installed,$module,$dlname in
57508c9fbc29Smrg	    *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
57518c9fbc29Smrg	  esac
57528c9fbc29Smrg	  $echo > $output "\
57538c9fbc29Smrg# $outputname - a libtool library file
57548c9fbc29Smrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
57558c9fbc29Smrg#
57568c9fbc29Smrg# Please DO NOT delete this file!
57578c9fbc29Smrg# It is necessary for linking the library.
57588c9fbc29Smrg
57598c9fbc29Smrg# The name that we can dlopen(3).
57608c9fbc29Smrgdlname='$tdlname'
57618c9fbc29Smrg
57628c9fbc29Smrg# Names of this library.
57638c9fbc29Smrglibrary_names='$library_names'
57648c9fbc29Smrg
57658c9fbc29Smrg# The name of the static archive.
57668c9fbc29Smrgold_library='$old_library'
57678c9fbc29Smrg
57688c9fbc29Smrg# Libraries that this one depends upon.
57698c9fbc29Smrgdependency_libs='$dependency_libs'
57708c9fbc29Smrg
57718c9fbc29Smrg# Version information for $libname.
57728c9fbc29Smrgcurrent=$current
57738c9fbc29Smrgage=$age
57748c9fbc29Smrgrevision=$revision
57758c9fbc29Smrg
57768c9fbc29Smrg# Is this an already installed library?
57778c9fbc29Smrginstalled=$installed
57788c9fbc29Smrg
57798c9fbc29Smrg# Should we warn about portability when linking against -modules?
57808c9fbc29Smrgshouldnotlink=$module
57818c9fbc29Smrg
57828c9fbc29Smrg# Files to dlopen/dlpreopen
57838c9fbc29Smrgdlopen='$dlfiles'
57848c9fbc29Smrgdlpreopen='$dlprefiles'
57858c9fbc29Smrg
57868c9fbc29Smrg# Directory that this library needs to be installed in:
57878c9fbc29Smrglibdir='$install_libdir'"
57888c9fbc29Smrg	  if test "$installed" = no && test "$need_relink" = yes; then
57898c9fbc29Smrg	    $echo >> $output "\
57908c9fbc29Smrgrelink_command=\"$relink_command\""
57918c9fbc29Smrg	  fi
57928c9fbc29Smrg	done
57938c9fbc29Smrg      fi
57948c9fbc29Smrg
57958c9fbc29Smrg      # Do a symbolic link so that the libtool archive can be found in
57968c9fbc29Smrg      # LD_LIBRARY_PATH before the program is installed.
57978c9fbc29Smrg      $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
57988c9fbc29Smrg      $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
57998c9fbc29Smrg      ;;
58008c9fbc29Smrg    esac
58018c9fbc29Smrg    exit $EXIT_SUCCESS
58028c9fbc29Smrg    ;;
58038c9fbc29Smrg
58048c9fbc29Smrg  # libtool install mode
58058c9fbc29Smrg  install)
58068c9fbc29Smrg    modename="$modename: install"
58078c9fbc29Smrg
58088c9fbc29Smrg    # There may be an optional sh(1) argument at the beginning of
58098c9fbc29Smrg    # install_prog (especially on Windows NT).
58108c9fbc29Smrg    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
58118c9fbc29Smrg       # Allow the use of GNU shtool's install command.
58128c9fbc29Smrg       $echo "X$nonopt" | grep shtool > /dev/null; then
58138c9fbc29Smrg      # Aesthetically quote it.
58148c9fbc29Smrg      arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
58158c9fbc29Smrg      case $arg in
58168c9fbc29Smrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
58178c9fbc29Smrg	arg="\"$arg\""
58188c9fbc29Smrg	;;
58198c9fbc29Smrg      esac
58208c9fbc29Smrg      install_prog="$arg "
58218c9fbc29Smrg      arg="$1"
58228c9fbc29Smrg      shift
58238c9fbc29Smrg    else
58248c9fbc29Smrg      install_prog=
58258c9fbc29Smrg      arg=$nonopt
58268c9fbc29Smrg    fi
58278c9fbc29Smrg
58288c9fbc29Smrg    # The real first argument should be the name of the installation program.
58298c9fbc29Smrg    # Aesthetically quote it.
58308c9fbc29Smrg    arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
58318c9fbc29Smrg    case $arg in
58328c9fbc29Smrg    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
58338c9fbc29Smrg      arg="\"$arg\""
58348c9fbc29Smrg      ;;
58358c9fbc29Smrg    esac
58368c9fbc29Smrg    install_prog="$install_prog$arg"
58378c9fbc29Smrg
58388c9fbc29Smrg    # We need to accept at least all the BSD install flags.
58398c9fbc29Smrg    dest=
58408c9fbc29Smrg    files=
58418c9fbc29Smrg    opts=
58428c9fbc29Smrg    prev=
58438c9fbc29Smrg    install_type=
58448c9fbc29Smrg    isdir=no
58458c9fbc29Smrg    stripme=
58468c9fbc29Smrg    for arg
58478c9fbc29Smrg    do
58488c9fbc29Smrg      if test -n "$dest"; then
58498c9fbc29Smrg	files="$files $dest"
58508c9fbc29Smrg	dest=$arg
58518c9fbc29Smrg	continue
58528c9fbc29Smrg      fi
58538c9fbc29Smrg
58548c9fbc29Smrg      case $arg in
58558c9fbc29Smrg      -d) isdir=yes ;;
58568c9fbc29Smrg      -f) 
58578c9fbc29Smrg      	case " $install_prog " in
58588c9fbc29Smrg	*[\\\ /]cp\ *) ;;
58598c9fbc29Smrg	*) prev=$arg ;;
58608c9fbc29Smrg	esac
58618c9fbc29Smrg	;;
58628c9fbc29Smrg      -g | -m | -o) prev=$arg ;;
58638c9fbc29Smrg      -s)
58648c9fbc29Smrg	stripme=" -s"
58658c9fbc29Smrg	continue
58668c9fbc29Smrg	;;
58678c9fbc29Smrg      -*)
58688c9fbc29Smrg	;;
58698c9fbc29Smrg      *)
58708c9fbc29Smrg	# If the previous option needed an argument, then skip it.
58718c9fbc29Smrg	if test -n "$prev"; then
58728c9fbc29Smrg	  prev=
58738c9fbc29Smrg	else
58748c9fbc29Smrg	  dest=$arg
58758c9fbc29Smrg	  continue
58768c9fbc29Smrg	fi
58778c9fbc29Smrg	;;
58788c9fbc29Smrg      esac
58798c9fbc29Smrg
58808c9fbc29Smrg      # Aesthetically quote the argument.
58818c9fbc29Smrg      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
58828c9fbc29Smrg      case $arg in
58838c9fbc29Smrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
58848c9fbc29Smrg	arg="\"$arg\""
58858c9fbc29Smrg	;;
58868c9fbc29Smrg      esac
58878c9fbc29Smrg      install_prog="$install_prog $arg"
58888c9fbc29Smrg    done
58898c9fbc29Smrg
58908c9fbc29Smrg    if test -z "$install_prog"; then
58918c9fbc29Smrg      $echo "$modename: you must specify an install program" 1>&2
58928c9fbc29Smrg      $echo "$help" 1>&2
58938c9fbc29Smrg      exit $EXIT_FAILURE
58948c9fbc29Smrg    fi
58958c9fbc29Smrg
58968c9fbc29Smrg    if test -n "$prev"; then
58978c9fbc29Smrg      $echo "$modename: the \`$prev' option requires an argument" 1>&2
58988c9fbc29Smrg      $echo "$help" 1>&2
58998c9fbc29Smrg      exit $EXIT_FAILURE
59008c9fbc29Smrg    fi
59018c9fbc29Smrg
59028c9fbc29Smrg    if test -z "$files"; then
59038c9fbc29Smrg      if test -z "$dest"; then
59048c9fbc29Smrg	$echo "$modename: no file or destination specified" 1>&2
59058c9fbc29Smrg      else
59068c9fbc29Smrg	$echo "$modename: you must specify a destination" 1>&2
59078c9fbc29Smrg      fi
59088c9fbc29Smrg      $echo "$help" 1>&2
59098c9fbc29Smrg      exit $EXIT_FAILURE
59108c9fbc29Smrg    fi
59118c9fbc29Smrg
59128c9fbc29Smrg    # Strip any trailing slash from the destination.
59138c9fbc29Smrg    dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
59148c9fbc29Smrg
59158c9fbc29Smrg    # Check to see that the destination is a directory.
59168c9fbc29Smrg    test -d "$dest" && isdir=yes
59178c9fbc29Smrg    if test "$isdir" = yes; then
59188c9fbc29Smrg      destdir="$dest"
59198c9fbc29Smrg      destname=
59208c9fbc29Smrg    else
59218c9fbc29Smrg      destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
59228c9fbc29Smrg      test "X$destdir" = "X$dest" && destdir=.
59238c9fbc29Smrg      destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
59248c9fbc29Smrg
59258c9fbc29Smrg      # Not a directory, so check to see that there is only one file specified.
59268c9fbc29Smrg      set dummy $files
59278c9fbc29Smrg      if test "$#" -gt 2; then
59288c9fbc29Smrg	$echo "$modename: \`$dest' is not a directory" 1>&2
59298c9fbc29Smrg	$echo "$help" 1>&2
59308c9fbc29Smrg	exit $EXIT_FAILURE
59318c9fbc29Smrg      fi
59328c9fbc29Smrg    fi
59338c9fbc29Smrg    case $destdir in
59348c9fbc29Smrg    [\\/]* | [A-Za-z]:[\\/]*) ;;
59358c9fbc29Smrg    *)
59368c9fbc29Smrg      for file in $files; do
59378c9fbc29Smrg	case $file in
59388c9fbc29Smrg	*.lo) ;;
59398c9fbc29Smrg	*)
59408c9fbc29Smrg	  $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
59418c9fbc29Smrg	  $echo "$help" 1>&2
59428c9fbc29Smrg	  exit $EXIT_FAILURE
59438c9fbc29Smrg	  ;;
59448c9fbc29Smrg	esac
59458c9fbc29Smrg      done
59468c9fbc29Smrg      ;;
59478c9fbc29Smrg    esac
59488c9fbc29Smrg
59498c9fbc29Smrg    # This variable tells wrapper scripts just to set variables rather
59508c9fbc29Smrg    # than running their programs.
59518c9fbc29Smrg    libtool_install_magic="$magic"
59528c9fbc29Smrg
59538c9fbc29Smrg    staticlibs=
59548c9fbc29Smrg    future_libdirs=
59558c9fbc29Smrg    current_libdirs=
59568c9fbc29Smrg    for file in $files; do
59578c9fbc29Smrg
59588c9fbc29Smrg      # Do each installation.
59598c9fbc29Smrg      case $file in
59608c9fbc29Smrg      *.$libext)
59618c9fbc29Smrg	# Do the static libraries later.
59628c9fbc29Smrg	staticlibs="$staticlibs $file"
59638c9fbc29Smrg	;;
59648c9fbc29Smrg
59658c9fbc29Smrg      *.la)
59668c9fbc29Smrg	# Check to see that this really is a libtool archive.
59678c9fbc29Smrg	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
59688c9fbc29Smrg	else
59698c9fbc29Smrg	  $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
59708c9fbc29Smrg	  $echo "$help" 1>&2
59718c9fbc29Smrg	  exit $EXIT_FAILURE
59728c9fbc29Smrg	fi
59738c9fbc29Smrg
59748c9fbc29Smrg	library_names=
59758c9fbc29Smrg	old_library=
59768c9fbc29Smrg	relink_command=
59778c9fbc29Smrg	# If there is no directory component, then add one.
59788c9fbc29Smrg	case $file in
59798c9fbc29Smrg	*/* | *\\*) . $file ;;
59808c9fbc29Smrg	*) . ./$file ;;
59818c9fbc29Smrg	esac
59828c9fbc29Smrg
59838c9fbc29Smrg	# Add the libdir to current_libdirs if it is the destination.
59848c9fbc29Smrg	if test "X$destdir" = "X$libdir"; then
59858c9fbc29Smrg	  case "$current_libdirs " in
59868c9fbc29Smrg	  *" $libdir "*) ;;
59878c9fbc29Smrg	  *) current_libdirs="$current_libdirs $libdir" ;;
59888c9fbc29Smrg	  esac
59898c9fbc29Smrg	else
59908c9fbc29Smrg	  # Note the libdir as a future libdir.
59918c9fbc29Smrg	  case "$future_libdirs " in
59928c9fbc29Smrg	  *" $libdir "*) ;;
59938c9fbc29Smrg	  *) future_libdirs="$future_libdirs $libdir" ;;
59948c9fbc29Smrg	  esac
59958c9fbc29Smrg	fi
59968c9fbc29Smrg
59978c9fbc29Smrg	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
59988c9fbc29Smrg	test "X$dir" = "X$file/" && dir=
59998c9fbc29Smrg	dir="$dir$objdir"
60008c9fbc29Smrg
60018c9fbc29Smrg	if test -n "$relink_command"; then
60028c9fbc29Smrg	  # Determine the prefix the user has applied to our future dir.
60038c9fbc29Smrg	  inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
60048c9fbc29Smrg
60058c9fbc29Smrg	  # Don't allow the user to place us outside of our expected
60068c9fbc29Smrg	  # location b/c this prevents finding dependent libraries that
60078c9fbc29Smrg	  # are installed to the same prefix.
60088c9fbc29Smrg	  # At present, this check doesn't affect windows .dll's that
60098c9fbc29Smrg	  # are installed into $libdir/../bin (currently, that works fine)
60108c9fbc29Smrg	  # but it's something to keep an eye on.
60118c9fbc29Smrg	  if test "$inst_prefix_dir" = "$destdir"; then
60128c9fbc29Smrg	    $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
60138c9fbc29Smrg	    exit $EXIT_FAILURE
60148c9fbc29Smrg	  fi
60158c9fbc29Smrg
60168c9fbc29Smrg	  if test -n "$inst_prefix_dir"; then
60178c9fbc29Smrg	    # Stick the inst_prefix_dir data into the link command.
60184e411241Smrg	    relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP`
60198c9fbc29Smrg	  else
60204e411241Smrg	    relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP`
60218c9fbc29Smrg	  fi
60228c9fbc29Smrg
60238c9fbc29Smrg	  $echo "$modename: warning: relinking \`$file'" 1>&2
60248c9fbc29Smrg	  $show "$relink_command"
60258c9fbc29Smrg	  if $run eval "$relink_command"; then :
60268c9fbc29Smrg	  else
60278c9fbc29Smrg	    $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
60288c9fbc29Smrg	    exit $EXIT_FAILURE
60298c9fbc29Smrg	  fi
60308c9fbc29Smrg	fi
60318c9fbc29Smrg
60328c9fbc29Smrg	# See the names of the shared library.
60338c9fbc29Smrg	set dummy $library_names
60348c9fbc29Smrg	if test -n "$2"; then
60358c9fbc29Smrg	  realname="$2"
60368c9fbc29Smrg	  shift
60378c9fbc29Smrg	  shift
60388c9fbc29Smrg
60398c9fbc29Smrg	  srcname="$realname"
60408c9fbc29Smrg	  test -n "$relink_command" && srcname="$realname"T
60418c9fbc29Smrg
60428c9fbc29Smrg	  # Install the shared library and build the symlinks.
60438c9fbc29Smrg	  $show "$install_prog $dir/$srcname $destdir/$realname"
60448c9fbc29Smrg	  $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
60458c9fbc29Smrg	  if test -n "$stripme" && test -n "$striplib"; then
60468c9fbc29Smrg	    $show "$striplib $destdir/$realname"
60478c9fbc29Smrg	    $run eval "$striplib $destdir/$realname" || exit $?
60488c9fbc29Smrg	  fi
60498c9fbc29Smrg
60508c9fbc29Smrg	  if test "$#" -gt 0; then
60518c9fbc29Smrg	    # Delete the old symlinks, and create new ones.
60528c9fbc29Smrg	    # Try `ln -sf' first, because the `ln' binary might depend on
60538c9fbc29Smrg	    # the symlink we replace!  Solaris /bin/ln does not understand -f,
60548c9fbc29Smrg	    # so we also need to try rm && ln -s.
60558c9fbc29Smrg	    for linkname
60568c9fbc29Smrg	    do
60578c9fbc29Smrg	      if test "$linkname" != "$realname"; then
60588c9fbc29Smrg                $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
60598c9fbc29Smrg                $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
60608c9fbc29Smrg	      fi
60618c9fbc29Smrg	    done
60628c9fbc29Smrg	  fi
60638c9fbc29Smrg
60648c9fbc29Smrg	  # Do each command in the postinstall commands.
60658c9fbc29Smrg	  lib="$destdir/$realname"
60668c9fbc29Smrg	  cmds=$postinstall_cmds
60678c9fbc29Smrg	  save_ifs="$IFS"; IFS='~'
60688c9fbc29Smrg	  for cmd in $cmds; do
60698c9fbc29Smrg	    IFS="$save_ifs"
60708c9fbc29Smrg	    eval cmd=\"$cmd\"
60718c9fbc29Smrg	    $show "$cmd"
60728c9fbc29Smrg	    $run eval "$cmd" || {
60738c9fbc29Smrg	      lt_exit=$?
60748c9fbc29Smrg
60758c9fbc29Smrg	      # Restore the uninstalled library and exit
60768c9fbc29Smrg	      if test "$mode" = relink; then
60778c9fbc29Smrg		$run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
60788c9fbc29Smrg	      fi
60798c9fbc29Smrg
60808c9fbc29Smrg	      exit $lt_exit
60818c9fbc29Smrg	    }
60828c9fbc29Smrg	  done
60838c9fbc29Smrg	  IFS="$save_ifs"
60848c9fbc29Smrg	fi
60858c9fbc29Smrg
60868c9fbc29Smrg	# Install the pseudo-library for information purposes.
60878c9fbc29Smrg	name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
60888c9fbc29Smrg	instname="$dir/$name"i
60898c9fbc29Smrg	$show "$install_prog $instname $destdir/$name"
60908c9fbc29Smrg	$run eval "$install_prog $instname $destdir/$name" || exit $?
60918c9fbc29Smrg
60928c9fbc29Smrg	# Maybe install the static library, too.
60938c9fbc29Smrg	test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
60948c9fbc29Smrg	;;
60958c9fbc29Smrg
60968c9fbc29Smrg      *.lo)
60978c9fbc29Smrg	# Install (i.e. copy) a libtool object.
60988c9fbc29Smrg
60998c9fbc29Smrg	# Figure out destination file name, if it wasn't already specified.
61008c9fbc29Smrg	if test -n "$destname"; then
61018c9fbc29Smrg	  destfile="$destdir/$destname"
61028c9fbc29Smrg	else
61038c9fbc29Smrg	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
61048c9fbc29Smrg	  destfile="$destdir/$destfile"
61058c9fbc29Smrg	fi
61068c9fbc29Smrg
61078c9fbc29Smrg	# Deduce the name of the destination old-style object file.
61088c9fbc29Smrg	case $destfile in
61098c9fbc29Smrg	*.lo)
61108c9fbc29Smrg	  staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
61118c9fbc29Smrg	  ;;
61128c9fbc29Smrg	*.$objext)
61138c9fbc29Smrg	  staticdest="$destfile"
61148c9fbc29Smrg	  destfile=
61158c9fbc29Smrg	  ;;
61168c9fbc29Smrg	*)
61178c9fbc29Smrg	  $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
61188c9fbc29Smrg	  $echo "$help" 1>&2
61198c9fbc29Smrg	  exit $EXIT_FAILURE
61208c9fbc29Smrg	  ;;
61218c9fbc29Smrg	esac
61228c9fbc29Smrg
61238c9fbc29Smrg	# Install the libtool object if requested.
61248c9fbc29Smrg	if test -n "$destfile"; then
61258c9fbc29Smrg	  $show "$install_prog $file $destfile"
61268c9fbc29Smrg	  $run eval "$install_prog $file $destfile" || exit $?
61278c9fbc29Smrg	fi
61288c9fbc29Smrg
61298c9fbc29Smrg	# Install the old object if enabled.
61308c9fbc29Smrg	if test "$build_old_libs" = yes; then
61318c9fbc29Smrg	  # Deduce the name of the old-style object file.
61328c9fbc29Smrg	  staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
61338c9fbc29Smrg
61348c9fbc29Smrg	  $show "$install_prog $staticobj $staticdest"
61358c9fbc29Smrg	  $run eval "$install_prog \$staticobj \$staticdest" || exit $?
61368c9fbc29Smrg	fi
61378c9fbc29Smrg	exit $EXIT_SUCCESS
61388c9fbc29Smrg	;;
61398c9fbc29Smrg
61408c9fbc29Smrg      *)
61418c9fbc29Smrg	# Figure out destination file name, if it wasn't already specified.
61428c9fbc29Smrg	if test -n "$destname"; then
61438c9fbc29Smrg	  destfile="$destdir/$destname"
61448c9fbc29Smrg	else
61458c9fbc29Smrg	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
61468c9fbc29Smrg	  destfile="$destdir/$destfile"
61478c9fbc29Smrg	fi
61488c9fbc29Smrg
61498c9fbc29Smrg	# If the file is missing, and there is a .exe on the end, strip it
61508c9fbc29Smrg	# because it is most likely a libtool script we actually want to
61518c9fbc29Smrg	# install
61528c9fbc29Smrg	stripped_ext=""
61538c9fbc29Smrg	case $file in
61548c9fbc29Smrg	  *.exe)
61558c9fbc29Smrg	    if test ! -f "$file"; then
61568c9fbc29Smrg	      file=`$echo $file|${SED} 's,.exe$,,'`
61578c9fbc29Smrg	      stripped_ext=".exe"
61588c9fbc29Smrg	    fi
61598c9fbc29Smrg	    ;;
61608c9fbc29Smrg	esac
61618c9fbc29Smrg
61628c9fbc29Smrg	# Do a test to see if this is really a libtool program.
61638c9fbc29Smrg	case $host in
61648c9fbc29Smrg	*cygwin*|*mingw*)
61658c9fbc29Smrg	    wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
61668c9fbc29Smrg	    ;;
61678c9fbc29Smrg	*)
61688c9fbc29Smrg	    wrapper=$file
61698c9fbc29Smrg	    ;;
61708c9fbc29Smrg	esac
61718c9fbc29Smrg	if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
61728c9fbc29Smrg	  notinst_deplibs=
61738c9fbc29Smrg	  relink_command=
61748c9fbc29Smrg
61758c9fbc29Smrg	  # Note that it is not necessary on cygwin/mingw to append a dot to
61768c9fbc29Smrg	  # foo even if both foo and FILE.exe exist: automatic-append-.exe
61778c9fbc29Smrg	  # behavior happens only for exec(3), not for open(2)!  Also, sourcing
61788c9fbc29Smrg	  # `FILE.' does not work on cygwin managed mounts.
61798c9fbc29Smrg	  #
61808c9fbc29Smrg	  # If there is no directory component, then add one.
61818c9fbc29Smrg	  case $wrapper in
61828c9fbc29Smrg	  */* | *\\*) . ${wrapper} ;;
61838c9fbc29Smrg	  *) . ./${wrapper} ;;
61848c9fbc29Smrg	  esac
61858c9fbc29Smrg
61868c9fbc29Smrg	  # Check the variables that should have been set.
61878c9fbc29Smrg	  if test -z "$notinst_deplibs"; then
61888c9fbc29Smrg	    $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
61898c9fbc29Smrg	    exit $EXIT_FAILURE
61908c9fbc29Smrg	  fi
61918c9fbc29Smrg
61928c9fbc29Smrg	  finalize=yes
61938c9fbc29Smrg	  for lib in $notinst_deplibs; do
61948c9fbc29Smrg	    # Check to see that each library is installed.
61958c9fbc29Smrg	    libdir=
61968c9fbc29Smrg	    if test -f "$lib"; then
61978c9fbc29Smrg	      # If there is no directory component, then add one.
61988c9fbc29Smrg	      case $lib in
61998c9fbc29Smrg	      */* | *\\*) . $lib ;;
62008c9fbc29Smrg	      *) . ./$lib ;;
62018c9fbc29Smrg	      esac
62028c9fbc29Smrg	    fi
62038c9fbc29Smrg	    libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
62048c9fbc29Smrg	    if test -n "$libdir" && test ! -f "$libfile"; then
62058c9fbc29Smrg	      $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
62068c9fbc29Smrg	      finalize=no
62078c9fbc29Smrg	    fi
62088c9fbc29Smrg	  done
62098c9fbc29Smrg
62108c9fbc29Smrg	  relink_command=
62118c9fbc29Smrg	  # Note that it is not necessary on cygwin/mingw to append a dot to
62128c9fbc29Smrg	  # foo even if both foo and FILE.exe exist: automatic-append-.exe
62138c9fbc29Smrg	  # behavior happens only for exec(3), not for open(2)!  Also, sourcing
62148c9fbc29Smrg	  # `FILE.' does not work on cygwin managed mounts.
62158c9fbc29Smrg	  #
62168c9fbc29Smrg	  # If there is no directory component, then add one.
62178c9fbc29Smrg	  case $wrapper in
62188c9fbc29Smrg	  */* | *\\*) . ${wrapper} ;;
62198c9fbc29Smrg	  *) . ./${wrapper} ;;
62208c9fbc29Smrg	  esac
62218c9fbc29Smrg
62228c9fbc29Smrg	  outputname=
62238c9fbc29Smrg	  if test "$fast_install" = no && test -n "$relink_command"; then
62248c9fbc29Smrg	    if test "$finalize" = yes && test -z "$run"; then
62258c9fbc29Smrg	      tmpdir=`func_mktempdir`
62268c9fbc29Smrg	      file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
62278c9fbc29Smrg	      outputname="$tmpdir/$file"
62288c9fbc29Smrg	      # Replace the output file specification.
62294e411241Smrg	      relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP`
62308c9fbc29Smrg
62318c9fbc29Smrg	      $show "$relink_command"
62328c9fbc29Smrg	      if $run eval "$relink_command"; then :
62338c9fbc29Smrg	      else
62348c9fbc29Smrg		$echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
62358c9fbc29Smrg		${rm}r "$tmpdir"
62368c9fbc29Smrg		continue
62378c9fbc29Smrg	      fi
62388c9fbc29Smrg	      file="$outputname"
62398c9fbc29Smrg	    else
62408c9fbc29Smrg	      $echo "$modename: warning: cannot relink \`$file'" 1>&2
62418c9fbc29Smrg	    fi
62428c9fbc29Smrg	  else
62438c9fbc29Smrg	    # Install the binary that we compiled earlier.
62448c9fbc29Smrg	    file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
62458c9fbc29Smrg	  fi
62468c9fbc29Smrg	fi
62478c9fbc29Smrg
62488c9fbc29Smrg	# remove .exe since cygwin /usr/bin/install will append another
62498c9fbc29Smrg	# one anyway 
62508c9fbc29Smrg	case $install_prog,$host in
62518c9fbc29Smrg	*/usr/bin/install*,*cygwin*)
62528c9fbc29Smrg	  case $file:$destfile in
62538c9fbc29Smrg	  *.exe:*.exe)
62548c9fbc29Smrg	    # this is ok
62558c9fbc29Smrg	    ;;
62568c9fbc29Smrg	  *.exe:*)
62578c9fbc29Smrg	    destfile=$destfile.exe
62588c9fbc29Smrg	    ;;
62598c9fbc29Smrg	  *:*.exe)
62608c9fbc29Smrg	    destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
62618c9fbc29Smrg	    ;;
62628c9fbc29Smrg	  esac
62638c9fbc29Smrg	  ;;
62648c9fbc29Smrg	esac
62658c9fbc29Smrg	$show "$install_prog$stripme $file $destfile"
62668c9fbc29Smrg	$run eval "$install_prog\$stripme \$file \$destfile" || exit $?
62678c9fbc29Smrg	test -n "$outputname" && ${rm}r "$tmpdir"
62688c9fbc29Smrg	;;
62698c9fbc29Smrg      esac
62708c9fbc29Smrg    done
62718c9fbc29Smrg
62728c9fbc29Smrg    for file in $staticlibs; do
62738c9fbc29Smrg      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
62748c9fbc29Smrg
62758c9fbc29Smrg      # Set up the ranlib parameters.
62768c9fbc29Smrg      oldlib="$destdir/$name"
62778c9fbc29Smrg
62788c9fbc29Smrg      $show "$install_prog $file $oldlib"
62798c9fbc29Smrg      $run eval "$install_prog \$file \$oldlib" || exit $?
62808c9fbc29Smrg
62818c9fbc29Smrg      if test -n "$stripme" && test -n "$old_striplib"; then
62828c9fbc29Smrg	$show "$old_striplib $oldlib"
62838c9fbc29Smrg	$run eval "$old_striplib $oldlib" || exit $?
62848c9fbc29Smrg      fi
62858c9fbc29Smrg
62868c9fbc29Smrg      # Do each command in the postinstall commands.
62878c9fbc29Smrg      cmds=$old_postinstall_cmds
62888c9fbc29Smrg      save_ifs="$IFS"; IFS='~'
62898c9fbc29Smrg      for cmd in $cmds; do
62908c9fbc29Smrg	IFS="$save_ifs"
62918c9fbc29Smrg	eval cmd=\"$cmd\"
62928c9fbc29Smrg	$show "$cmd"
62938c9fbc29Smrg	$run eval "$cmd" || exit $?
62948c9fbc29Smrg      done
62958c9fbc29Smrg      IFS="$save_ifs"
62968c9fbc29Smrg    done
62978c9fbc29Smrg
62988c9fbc29Smrg    if test -n "$future_libdirs"; then
62998c9fbc29Smrg      $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
63008c9fbc29Smrg    fi
63018c9fbc29Smrg
63028c9fbc29Smrg    if test -n "$current_libdirs"; then
63038c9fbc29Smrg      # Maybe just do a dry run.
63048c9fbc29Smrg      test -n "$run" && current_libdirs=" -n$current_libdirs"
63058c9fbc29Smrg      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
63068c9fbc29Smrg    else
63078c9fbc29Smrg      exit $EXIT_SUCCESS
63088c9fbc29Smrg    fi
63098c9fbc29Smrg    ;;
63108c9fbc29Smrg
63118c9fbc29Smrg  # libtool finish mode
63128c9fbc29Smrg  finish)
63138c9fbc29Smrg    modename="$modename: finish"
63148c9fbc29Smrg    libdirs="$nonopt"
63158c9fbc29Smrg    admincmds=
63168c9fbc29Smrg
63178c9fbc29Smrg    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
63188c9fbc29Smrg      for dir
63198c9fbc29Smrg      do
63208c9fbc29Smrg	libdirs="$libdirs $dir"
63218c9fbc29Smrg      done
63228c9fbc29Smrg
63238c9fbc29Smrg      for libdir in $libdirs; do
63248c9fbc29Smrg	if test -n "$finish_cmds"; then
63258c9fbc29Smrg	  # Do each command in the finish commands.
63268c9fbc29Smrg	  cmds=$finish_cmds
63278c9fbc29Smrg	  save_ifs="$IFS"; IFS='~'
63288c9fbc29Smrg	  for cmd in $cmds; do
63298c9fbc29Smrg	    IFS="$save_ifs"
63308c9fbc29Smrg	    eval cmd=\"$cmd\"
63318c9fbc29Smrg	    $show "$cmd"
63328c9fbc29Smrg	    $run eval "$cmd" || admincmds="$admincmds
63338c9fbc29Smrg       $cmd"
63348c9fbc29Smrg	  done
63358c9fbc29Smrg	  IFS="$save_ifs"
63368c9fbc29Smrg	fi
63378c9fbc29Smrg	if test -n "$finish_eval"; then
63388c9fbc29Smrg	  # Do the single finish_eval.
63398c9fbc29Smrg	  eval cmds=\"$finish_eval\"
63408c9fbc29Smrg	  $run eval "$cmds" || admincmds="$admincmds
63418c9fbc29Smrg       $cmds"
63428c9fbc29Smrg	fi
63438c9fbc29Smrg      done
63448c9fbc29Smrg    fi
63458c9fbc29Smrg
63468c9fbc29Smrg    # Exit here if they wanted silent mode.
63478c9fbc29Smrg    test "$show" = : && exit $EXIT_SUCCESS
63488c9fbc29Smrg
63498c9fbc29Smrg    $echo "X----------------------------------------------------------------------" | $Xsed
63508c9fbc29Smrg    $echo "Libraries have been installed in:"
63518c9fbc29Smrg    for libdir in $libdirs; do
63528c9fbc29Smrg      $echo "   $libdir"
63538c9fbc29Smrg    done
63548c9fbc29Smrg    $echo
63558c9fbc29Smrg    $echo "If you ever happen to want to link against installed libraries"
63568c9fbc29Smrg    $echo "in a given directory, LIBDIR, you must either use libtool, and"
63578c9fbc29Smrg    $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
63588c9fbc29Smrg    $echo "flag during linking and do at least one of the following:"
63598c9fbc29Smrg    if test -n "$shlibpath_var"; then
63608c9fbc29Smrg      $echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
63618c9fbc29Smrg      $echo "     during execution"
63628c9fbc29Smrg    fi
63638c9fbc29Smrg    if test -n "$runpath_var"; then
63648c9fbc29Smrg      $echo "   - add LIBDIR to the \`$runpath_var' environment variable"
63658c9fbc29Smrg      $echo "     during linking"
63668c9fbc29Smrg    fi
63678c9fbc29Smrg    if test -n "$hardcode_libdir_flag_spec"; then
63688c9fbc29Smrg      libdir=LIBDIR
63698c9fbc29Smrg      eval flag=\"$hardcode_libdir_flag_spec\"
63708c9fbc29Smrg
63718c9fbc29Smrg      $echo "   - use the \`$flag' linker flag"
63728c9fbc29Smrg    fi
63738c9fbc29Smrg    if test -n "$admincmds"; then
63748c9fbc29Smrg      $echo "   - have your system administrator run these commands:$admincmds"
63758c9fbc29Smrg    fi
63768c9fbc29Smrg    if test -f /etc/ld.so.conf; then
63778c9fbc29Smrg      $echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
63788c9fbc29Smrg    fi
63798c9fbc29Smrg    $echo
63808c9fbc29Smrg    $echo "See any operating system documentation about shared libraries for"
63818c9fbc29Smrg    $echo "more information, such as the ld(1) and ld.so(8) manual pages."
63828c9fbc29Smrg    $echo "X----------------------------------------------------------------------" | $Xsed
63838c9fbc29Smrg    exit $EXIT_SUCCESS
63848c9fbc29Smrg    ;;
63858c9fbc29Smrg
63868c9fbc29Smrg  # libtool execute mode
63878c9fbc29Smrg  execute)
63888c9fbc29Smrg    modename="$modename: execute"
63898c9fbc29Smrg
63908c9fbc29Smrg    # The first argument is the command name.
63918c9fbc29Smrg    cmd="$nonopt"
63928c9fbc29Smrg    if test -z "$cmd"; then
63938c9fbc29Smrg      $echo "$modename: you must specify a COMMAND" 1>&2
63948c9fbc29Smrg      $echo "$help"
63958c9fbc29Smrg      exit $EXIT_FAILURE
63968c9fbc29Smrg    fi
63978c9fbc29Smrg
63988c9fbc29Smrg    # Handle -dlopen flags immediately.
63998c9fbc29Smrg    for file in $execute_dlfiles; do
64008c9fbc29Smrg      if test ! -f "$file"; then
64018c9fbc29Smrg	$echo "$modename: \`$file' is not a file" 1>&2
64028c9fbc29Smrg	$echo "$help" 1>&2
64038c9fbc29Smrg	exit $EXIT_FAILURE
64048c9fbc29Smrg      fi
64058c9fbc29Smrg
64068c9fbc29Smrg      dir=
64078c9fbc29Smrg      case $file in
64088c9fbc29Smrg      *.la)
64098c9fbc29Smrg	# Check to see that this really is a libtool archive.
64108c9fbc29Smrg	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
64118c9fbc29Smrg	else
64128c9fbc29Smrg	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
64138c9fbc29Smrg	  $echo "$help" 1>&2
64148c9fbc29Smrg	  exit $EXIT_FAILURE
64158c9fbc29Smrg	fi
64168c9fbc29Smrg
64178c9fbc29Smrg	# Read the libtool library.
64188c9fbc29Smrg	dlname=
64198c9fbc29Smrg	library_names=
64208c9fbc29Smrg
64218c9fbc29Smrg	# If there is no directory component, then add one.
64228c9fbc29Smrg	case $file in
64238c9fbc29Smrg	*/* | *\\*) . $file ;;
64248c9fbc29Smrg	*) . ./$file ;;
64258c9fbc29Smrg	esac
64268c9fbc29Smrg
64278c9fbc29Smrg	# Skip this library if it cannot be dlopened.
64288c9fbc29Smrg	if test -z "$dlname"; then
64298c9fbc29Smrg	  # Warn if it was a shared library.
64308c9fbc29Smrg	  test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
64318c9fbc29Smrg	  continue
64328c9fbc29Smrg	fi
64338c9fbc29Smrg
64348c9fbc29Smrg	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
64358c9fbc29Smrg	test "X$dir" = "X$file" && dir=.
64368c9fbc29Smrg
64378c9fbc29Smrg	if test -f "$dir/$objdir/$dlname"; then
64388c9fbc29Smrg	  dir="$dir/$objdir"
64398c9fbc29Smrg	else
64404e411241Smrg	  if test ! -f "$dir/$dlname"; then
64414e411241Smrg	    $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
64424e411241Smrg	    exit $EXIT_FAILURE
64434e411241Smrg	  fi
64448c9fbc29Smrg	fi
64458c9fbc29Smrg	;;
64468c9fbc29Smrg
64478c9fbc29Smrg      *.lo)
64488c9fbc29Smrg	# Just add the directory containing the .lo file.
64498c9fbc29Smrg	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
64508c9fbc29Smrg	test "X$dir" = "X$file" && dir=.
64518c9fbc29Smrg	;;
64528c9fbc29Smrg
64538c9fbc29Smrg      *)
64548c9fbc29Smrg	$echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
64558c9fbc29Smrg	continue
64568c9fbc29Smrg	;;
64578c9fbc29Smrg      esac
64588c9fbc29Smrg
64598c9fbc29Smrg      # Get the absolute pathname.
64608c9fbc29Smrg      absdir=`cd "$dir" && pwd`
64618c9fbc29Smrg      test -n "$absdir" && dir="$absdir"
64628c9fbc29Smrg
64638c9fbc29Smrg      # Now add the directory to shlibpath_var.
64648c9fbc29Smrg      if eval "test -z \"\$$shlibpath_var\""; then
64658c9fbc29Smrg	eval "$shlibpath_var=\"\$dir\""
64668c9fbc29Smrg      else
64678c9fbc29Smrg	eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
64688c9fbc29Smrg      fi
64698c9fbc29Smrg    done
64708c9fbc29Smrg
64718c9fbc29Smrg    # This variable tells wrapper scripts just to set shlibpath_var
64728c9fbc29Smrg    # rather than running their programs.
64738c9fbc29Smrg    libtool_execute_magic="$magic"
64748c9fbc29Smrg
64758c9fbc29Smrg    # Check if any of the arguments is a wrapper script.
64768c9fbc29Smrg    args=
64778c9fbc29Smrg    for file
64788c9fbc29Smrg    do
64798c9fbc29Smrg      case $file in
64808c9fbc29Smrg      -*) ;;
64818c9fbc29Smrg      *)
64828c9fbc29Smrg	# Do a test to see if this is really a libtool program.
64838c9fbc29Smrg	if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
64848c9fbc29Smrg	  # If there is no directory component, then add one.
64858c9fbc29Smrg	  case $file in
64868c9fbc29Smrg	  */* | *\\*) . $file ;;
64878c9fbc29Smrg	  *) . ./$file ;;
64888c9fbc29Smrg	  esac
64898c9fbc29Smrg
64908c9fbc29Smrg	  # Transform arg to wrapped name.
64918c9fbc29Smrg	  file="$progdir/$program"
64928c9fbc29Smrg	fi
64938c9fbc29Smrg	;;
64948c9fbc29Smrg      esac
64958c9fbc29Smrg      # Quote arguments (to preserve shell metacharacters).
64968c9fbc29Smrg      file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
64978c9fbc29Smrg      args="$args \"$file\""
64988c9fbc29Smrg    done
64998c9fbc29Smrg
65008c9fbc29Smrg    if test -z "$run"; then
65018c9fbc29Smrg      if test -n "$shlibpath_var"; then
65028c9fbc29Smrg	# Export the shlibpath_var.
65038c9fbc29Smrg	eval "export $shlibpath_var"
65048c9fbc29Smrg      fi
65058c9fbc29Smrg
65068c9fbc29Smrg      # Restore saved environment variables
65074e411241Smrg      for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
65084e411241Smrg      do
65094e411241Smrg	eval "if test \"\${save_$lt_var+set}\" = set; then
65104e411241Smrg		$lt_var=\$save_$lt_var; export $lt_var
65114e411241Smrg	      fi"
65124e411241Smrg      done
65138c9fbc29Smrg
65148c9fbc29Smrg      # Now prepare to actually exec the command.
65158c9fbc29Smrg      exec_cmd="\$cmd$args"
65168c9fbc29Smrg    else
65178c9fbc29Smrg      # Display what would be done.
65188c9fbc29Smrg      if test -n "$shlibpath_var"; then
65198c9fbc29Smrg	eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
65208c9fbc29Smrg	$echo "export $shlibpath_var"
65218c9fbc29Smrg      fi
65228c9fbc29Smrg      $echo "$cmd$args"
65238c9fbc29Smrg      exit $EXIT_SUCCESS
65248c9fbc29Smrg    fi
65258c9fbc29Smrg    ;;
65268c9fbc29Smrg
65278c9fbc29Smrg  # libtool clean and uninstall mode
65288c9fbc29Smrg  clean | uninstall)
65298c9fbc29Smrg    modename="$modename: $mode"
65308c9fbc29Smrg    rm="$nonopt"
65318c9fbc29Smrg    files=
65328c9fbc29Smrg    rmforce=
65338c9fbc29Smrg    exit_status=0
65348c9fbc29Smrg
65358c9fbc29Smrg    # This variable tells wrapper scripts just to set variables rather
65368c9fbc29Smrg    # than running their programs.
65378c9fbc29Smrg    libtool_install_magic="$magic"
65388c9fbc29Smrg
65398c9fbc29Smrg    for arg
65408c9fbc29Smrg    do
65418c9fbc29Smrg      case $arg in
65428c9fbc29Smrg      -f) rm="$rm $arg"; rmforce=yes ;;
65438c9fbc29Smrg      -*) rm="$rm $arg" ;;
65448c9fbc29Smrg      *) files="$files $arg" ;;
65458c9fbc29Smrg      esac
65468c9fbc29Smrg    done
65478c9fbc29Smrg
65488c9fbc29Smrg    if test -z "$rm"; then
65498c9fbc29Smrg      $echo "$modename: you must specify an RM program" 1>&2
65508c9fbc29Smrg      $echo "$help" 1>&2
65518c9fbc29Smrg      exit $EXIT_FAILURE
65528c9fbc29Smrg    fi
65538c9fbc29Smrg
65548c9fbc29Smrg    rmdirs=
65558c9fbc29Smrg
65568c9fbc29Smrg    origobjdir="$objdir"
65578c9fbc29Smrg    for file in $files; do
65588c9fbc29Smrg      dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
65598c9fbc29Smrg      if test "X$dir" = "X$file"; then
65608c9fbc29Smrg	dir=.
65618c9fbc29Smrg	objdir="$origobjdir"
65628c9fbc29Smrg      else
65638c9fbc29Smrg	objdir="$dir/$origobjdir"
65648c9fbc29Smrg      fi
65658c9fbc29Smrg      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
65668c9fbc29Smrg      test "$mode" = uninstall && objdir="$dir"
65678c9fbc29Smrg
65688c9fbc29Smrg      # Remember objdir for removal later, being careful to avoid duplicates
65698c9fbc29Smrg      if test "$mode" = clean; then
65708c9fbc29Smrg	case " $rmdirs " in
65718c9fbc29Smrg	  *" $objdir "*) ;;
65728c9fbc29Smrg	  *) rmdirs="$rmdirs $objdir" ;;
65738c9fbc29Smrg	esac
65748c9fbc29Smrg      fi
65758c9fbc29Smrg
65768c9fbc29Smrg      # Don't error if the file doesn't exist and rm -f was used.
65778c9fbc29Smrg      if (test -L "$file") >/dev/null 2>&1 \
65788c9fbc29Smrg	|| (test -h "$file") >/dev/null 2>&1 \
65798c9fbc29Smrg	|| test -f "$file"; then
65808c9fbc29Smrg	:
65818c9fbc29Smrg      elif test -d "$file"; then
65828c9fbc29Smrg	exit_status=1
65838c9fbc29Smrg	continue
65848c9fbc29Smrg      elif test "$rmforce" = yes; then
65858c9fbc29Smrg	continue
65868c9fbc29Smrg      fi
65878c9fbc29Smrg
65888c9fbc29Smrg      rmfiles="$file"
65898c9fbc29Smrg
65908c9fbc29Smrg      case $name in
65918c9fbc29Smrg      *.la)
65928c9fbc29Smrg	# Possibly a libtool archive, so verify it.
65938c9fbc29Smrg	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
65948c9fbc29Smrg	  . $dir/$name
65958c9fbc29Smrg
65968c9fbc29Smrg	  # Delete the libtool libraries and symlinks.
65978c9fbc29Smrg	  for n in $library_names; do
65988c9fbc29Smrg	    rmfiles="$rmfiles $objdir/$n"
65998c9fbc29Smrg	  done
66008c9fbc29Smrg	  test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
66018c9fbc29Smrg
66028c9fbc29Smrg	  case "$mode" in
66038c9fbc29Smrg	  clean)
66048c9fbc29Smrg	    case "  $library_names " in
66058c9fbc29Smrg	    # "  " in the beginning catches empty $dlname
66068c9fbc29Smrg	    *" $dlname "*) ;;
66078c9fbc29Smrg	    *) rmfiles="$rmfiles $objdir/$dlname" ;;
66088c9fbc29Smrg	    esac
66098c9fbc29Smrg	     test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
66108c9fbc29Smrg	    ;;
66118c9fbc29Smrg	  uninstall)
66128c9fbc29Smrg	    if test -n "$library_names"; then
66138c9fbc29Smrg	      # Do each command in the postuninstall commands.
66148c9fbc29Smrg	      cmds=$postuninstall_cmds
66158c9fbc29Smrg	      save_ifs="$IFS"; IFS='~'
66168c9fbc29Smrg	      for cmd in $cmds; do
66178c9fbc29Smrg		IFS="$save_ifs"
66188c9fbc29Smrg		eval cmd=\"$cmd\"
66198c9fbc29Smrg		$show "$cmd"
66208c9fbc29Smrg		$run eval "$cmd"
66218c9fbc29Smrg		if test "$?" -ne 0 && test "$rmforce" != yes; then
66228c9fbc29Smrg		  exit_status=1
66238c9fbc29Smrg		fi
66248c9fbc29Smrg	      done
66258c9fbc29Smrg	      IFS="$save_ifs"
66268c9fbc29Smrg	    fi
66278c9fbc29Smrg
66288c9fbc29Smrg	    if test -n "$old_library"; then
66298c9fbc29Smrg	      # Do each command in the old_postuninstall commands.
66308c9fbc29Smrg	      cmds=$old_postuninstall_cmds
66318c9fbc29Smrg	      save_ifs="$IFS"; IFS='~'
66328c9fbc29Smrg	      for cmd in $cmds; do
66338c9fbc29Smrg		IFS="$save_ifs"
66348c9fbc29Smrg		eval cmd=\"$cmd\"
66358c9fbc29Smrg		$show "$cmd"
66368c9fbc29Smrg		$run eval "$cmd"
66378c9fbc29Smrg		if test "$?" -ne 0 && test "$rmforce" != yes; then
66388c9fbc29Smrg		  exit_status=1
66398c9fbc29Smrg		fi
66408c9fbc29Smrg	      done
66418c9fbc29Smrg	      IFS="$save_ifs"
66428c9fbc29Smrg	    fi
66438c9fbc29Smrg	    # FIXME: should reinstall the best remaining shared library.
66448c9fbc29Smrg	    ;;
66458c9fbc29Smrg	  esac
66468c9fbc29Smrg	fi
66478c9fbc29Smrg	;;
66488c9fbc29Smrg
66498c9fbc29Smrg      *.lo)
66508c9fbc29Smrg	# Possibly a libtool object, so verify it.
66518c9fbc29Smrg	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
66528c9fbc29Smrg
66538c9fbc29Smrg	  # Read the .lo file
66548c9fbc29Smrg	  . $dir/$name
66558c9fbc29Smrg
66568c9fbc29Smrg	  # Add PIC object to the list of files to remove.
66578c9fbc29Smrg	  if test -n "$pic_object" \
66588c9fbc29Smrg	     && test "$pic_object" != none; then
66598c9fbc29Smrg	    rmfiles="$rmfiles $dir/$pic_object"
66608c9fbc29Smrg	  fi
66618c9fbc29Smrg
66628c9fbc29Smrg	  # Add non-PIC object to the list of files to remove.
66638c9fbc29Smrg	  if test -n "$non_pic_object" \
66648c9fbc29Smrg	     && test "$non_pic_object" != none; then
66658c9fbc29Smrg	    rmfiles="$rmfiles $dir/$non_pic_object"
66668c9fbc29Smrg	  fi
66678c9fbc29Smrg	fi
66688c9fbc29Smrg	;;
66698c9fbc29Smrg
66708c9fbc29Smrg      *)
66718c9fbc29Smrg	if test "$mode" = clean ; then
66728c9fbc29Smrg	  noexename=$name
66738c9fbc29Smrg	  case $file in
66748c9fbc29Smrg	  *.exe)
66758c9fbc29Smrg	    file=`$echo $file|${SED} 's,.exe$,,'`
66768c9fbc29Smrg	    noexename=`$echo $name|${SED} 's,.exe$,,'`
66778c9fbc29Smrg	    # $file with .exe has already been added to rmfiles,
66788c9fbc29Smrg	    # add $file without .exe
66798c9fbc29Smrg	    rmfiles="$rmfiles $file"
66808c9fbc29Smrg	    ;;
66818c9fbc29Smrg	  esac
66828c9fbc29Smrg	  # Do a test to see if this is a libtool program.
66838c9fbc29Smrg	  if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
66848c9fbc29Smrg	    relink_command=
66858c9fbc29Smrg	    . $dir/$noexename
66868c9fbc29Smrg
66878c9fbc29Smrg	    # note $name still contains .exe if it was in $file originally
66888c9fbc29Smrg	    # as does the version of $file that was added into $rmfiles
66898c9fbc29Smrg	    rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
66908c9fbc29Smrg	    if test "$fast_install" = yes && test -n "$relink_command"; then
66918c9fbc29Smrg	      rmfiles="$rmfiles $objdir/lt-$name"
66928c9fbc29Smrg	    fi
66938c9fbc29Smrg	    if test "X$noexename" != "X$name" ; then
66948c9fbc29Smrg	      rmfiles="$rmfiles $objdir/lt-${noexename}.c"
66958c9fbc29Smrg	    fi
66968c9fbc29Smrg	  fi
66978c9fbc29Smrg	fi
66988c9fbc29Smrg	;;
66998c9fbc29Smrg      esac
67008c9fbc29Smrg      $show "$rm $rmfiles"
67018c9fbc29Smrg      $run $rm $rmfiles || exit_status=1
67028c9fbc29Smrg    done
67038c9fbc29Smrg    objdir="$origobjdir"
67048c9fbc29Smrg
67058c9fbc29Smrg    # Try to remove the ${objdir}s in the directories where we deleted files
67068c9fbc29Smrg    for dir in $rmdirs; do
67078c9fbc29Smrg      if test -d "$dir"; then
67088c9fbc29Smrg	$show "rmdir $dir"
67098c9fbc29Smrg	$run rmdir $dir >/dev/null 2>&1
67108c9fbc29Smrg      fi
67118c9fbc29Smrg    done
67128c9fbc29Smrg
67138c9fbc29Smrg    exit $exit_status
67148c9fbc29Smrg    ;;
67158c9fbc29Smrg
67168c9fbc29Smrg  "")
67178c9fbc29Smrg    $echo "$modename: you must specify a MODE" 1>&2
67188c9fbc29Smrg    $echo "$generic_help" 1>&2
67198c9fbc29Smrg    exit $EXIT_FAILURE
67208c9fbc29Smrg    ;;
67218c9fbc29Smrg  esac
67228c9fbc29Smrg
67238c9fbc29Smrg  if test -z "$exec_cmd"; then
67248c9fbc29Smrg    $echo "$modename: invalid operation mode \`$mode'" 1>&2
67258c9fbc29Smrg    $echo "$generic_help" 1>&2
67268c9fbc29Smrg    exit $EXIT_FAILURE
67278c9fbc29Smrg  fi
67288c9fbc29Smrgfi # test -z "$show_help"
67298c9fbc29Smrg
67308c9fbc29Smrgif test -n "$exec_cmd"; then
67318c9fbc29Smrg  eval exec $exec_cmd
67328c9fbc29Smrg  exit $EXIT_FAILURE
67338c9fbc29Smrgfi
67348c9fbc29Smrg
67358c9fbc29Smrg# We need to display help for each of the modes.
67368c9fbc29Smrgcase $mode in
67378c9fbc29Smrg"") $echo \
67388c9fbc29Smrg"Usage: $modename [OPTION]... [MODE-ARG]...
67398c9fbc29Smrg
67408c9fbc29SmrgProvide generalized library-building support services.
67418c9fbc29Smrg
67428c9fbc29Smrg    --config          show all configuration variables
67438c9fbc29Smrg    --debug           enable verbose shell tracing
67448c9fbc29Smrg-n, --dry-run         display commands without modifying any files
67458c9fbc29Smrg    --features        display basic configuration information and exit
67468c9fbc29Smrg    --finish          same as \`--mode=finish'
67478c9fbc29Smrg    --help            display this help message and exit
67488c9fbc29Smrg    --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
67498c9fbc29Smrg    --quiet           same as \`--silent'
67508c9fbc29Smrg    --silent          don't print informational messages
67518c9fbc29Smrg    --tag=TAG         use configuration variables from tag TAG
67528c9fbc29Smrg    --version         print version information
67538c9fbc29Smrg
67548c9fbc29SmrgMODE must be one of the following:
67558c9fbc29Smrg
67568c9fbc29Smrg      clean           remove files from the build directory
67578c9fbc29Smrg      compile         compile a source file into a libtool object
67588c9fbc29Smrg      execute         automatically set library path, then run a program
67598c9fbc29Smrg      finish          complete the installation of libtool libraries
67608c9fbc29Smrg      install         install libraries or executables
67618c9fbc29Smrg      link            create a library or an executable
67628c9fbc29Smrg      uninstall       remove libraries from an installed directory
67638c9fbc29Smrg
67648c9fbc29SmrgMODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
67658c9fbc29Smrga more detailed description of MODE.
67668c9fbc29Smrg
67678c9fbc29SmrgReport bugs to <bug-libtool@gnu.org>."
67688c9fbc29Smrg  exit $EXIT_SUCCESS
67698c9fbc29Smrg  ;;
67708c9fbc29Smrg
67718c9fbc29Smrgclean)
67728c9fbc29Smrg  $echo \
67738c9fbc29Smrg"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
67748c9fbc29Smrg
67758c9fbc29SmrgRemove files from the build directory.
67768c9fbc29Smrg
67778c9fbc29SmrgRM is the name of the program to use to delete files associated with each FILE
67788c9fbc29Smrg(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
67798c9fbc29Smrgto RM.
67808c9fbc29Smrg
67818c9fbc29SmrgIf FILE is a libtool library, object or program, all the files associated
67828c9fbc29Smrgwith it are deleted. Otherwise, only FILE itself is deleted using RM."
67838c9fbc29Smrg  ;;
67848c9fbc29Smrg
67858c9fbc29Smrgcompile)
67868c9fbc29Smrg  $echo \
67878c9fbc29Smrg"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
67888c9fbc29Smrg
67898c9fbc29SmrgCompile a source file into a libtool library object.
67908c9fbc29Smrg
67918c9fbc29SmrgThis mode accepts the following additional options:
67928c9fbc29Smrg
67938c9fbc29Smrg  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
67948c9fbc29Smrg  -prefer-pic       try to building PIC objects only
67958c9fbc29Smrg  -prefer-non-pic   try to building non-PIC objects only
67968c9fbc29Smrg  -static           always build a \`.o' file suitable for static linking
67978c9fbc29Smrg
67988c9fbc29SmrgCOMPILE-COMMAND is a command to be used in creating a \`standard' object file
67998c9fbc29Smrgfrom the given SOURCEFILE.
68008c9fbc29Smrg
68018c9fbc29SmrgThe output file name is determined by removing the directory component from
68028c9fbc29SmrgSOURCEFILE, then substituting the C source code suffix \`.c' with the
68038c9fbc29Smrglibrary object suffix, \`.lo'."
68048c9fbc29Smrg  ;;
68058c9fbc29Smrg
68068c9fbc29Smrgexecute)
68078c9fbc29Smrg  $echo \
68088c9fbc29Smrg"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
68098c9fbc29Smrg
68108c9fbc29SmrgAutomatically set library path, then run a program.
68118c9fbc29Smrg
68128c9fbc29SmrgThis mode accepts the following additional options:
68138c9fbc29Smrg
68148c9fbc29Smrg  -dlopen FILE      add the directory containing FILE to the library path
68158c9fbc29Smrg
68168c9fbc29SmrgThis mode sets the library path environment variable according to \`-dlopen'
68178c9fbc29Smrgflags.
68188c9fbc29Smrg
68198c9fbc29SmrgIf any of the ARGS are libtool executable wrappers, then they are translated
68208c9fbc29Smrginto their corresponding uninstalled binary, and any of their required library
68218c9fbc29Smrgdirectories are added to the library path.
68228c9fbc29Smrg
68238c9fbc29SmrgThen, COMMAND is executed, with ARGS as arguments."
68248c9fbc29Smrg  ;;
68258c9fbc29Smrg
68268c9fbc29Smrgfinish)
68278c9fbc29Smrg  $echo \
68288c9fbc29Smrg"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
68298c9fbc29Smrg
68308c9fbc29SmrgComplete the installation of libtool libraries.
68318c9fbc29Smrg
68328c9fbc29SmrgEach LIBDIR is a directory that contains libtool libraries.
68338c9fbc29Smrg
68348c9fbc29SmrgThe commands that this mode executes may require superuser privileges.  Use
68358c9fbc29Smrgthe \`--dry-run' option if you just want to see what would be executed."
68368c9fbc29Smrg  ;;
68378c9fbc29Smrg
68388c9fbc29Smrginstall)
68398c9fbc29Smrg  $echo \
68408c9fbc29Smrg"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
68418c9fbc29Smrg
68428c9fbc29SmrgInstall executables or libraries.
68438c9fbc29Smrg
68448c9fbc29SmrgINSTALL-COMMAND is the installation command.  The first component should be
68458c9fbc29Smrgeither the \`install' or \`cp' program.
68468c9fbc29Smrg
68478c9fbc29SmrgThe rest of the components are interpreted as arguments to that command (only
68488c9fbc29SmrgBSD-compatible install options are recognized)."
68498c9fbc29Smrg  ;;
68508c9fbc29Smrg
68518c9fbc29Smrglink)
68528c9fbc29Smrg  $echo \
68538c9fbc29Smrg"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
68548c9fbc29Smrg
68558c9fbc29SmrgLink object files or libraries together to form another library, or to
68568c9fbc29Smrgcreate an executable program.
68578c9fbc29Smrg
68588c9fbc29SmrgLINK-COMMAND is a command using the C compiler that you would use to create
68598c9fbc29Smrga program from several object files.
68608c9fbc29Smrg
68618c9fbc29SmrgThe following components of LINK-COMMAND are treated specially:
68628c9fbc29Smrg
68638c9fbc29Smrg  -all-static       do not do any dynamic linking at all
68648c9fbc29Smrg  -avoid-version    do not add a version suffix if possible
68658c9fbc29Smrg  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
68668c9fbc29Smrg  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
68678c9fbc29Smrg  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
68688c9fbc29Smrg  -export-symbols SYMFILE
68694e411241Smrg                    try to export only the symbols listed in SYMFILE
68708c9fbc29Smrg  -export-symbols-regex REGEX
68714e411241Smrg                    try to export only the symbols matching REGEX
68728c9fbc29Smrg  -LLIBDIR          search LIBDIR for required installed libraries
68738c9fbc29Smrg  -lNAME            OUTPUT-FILE requires the installed library libNAME
68748c9fbc29Smrg  -module           build a library that can dlopened
68758c9fbc29Smrg  -no-fast-install  disable the fast-install mode
68768c9fbc29Smrg  -no-install       link a not-installable executable
68778c9fbc29Smrg  -no-undefined     declare that a library does not refer to external symbols
68788c9fbc29Smrg  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
68798c9fbc29Smrg  -objectlist FILE  Use a list of object files found in FILE to specify objects
68808c9fbc29Smrg  -precious-files-regex REGEX
68818c9fbc29Smrg                    don't remove output files matching REGEX
68828c9fbc29Smrg  -release RELEASE  specify package release information
68838c9fbc29Smrg  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
68848c9fbc29Smrg  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
68854e411241Smrg  -static           do not do any dynamic linking of uninstalled libtool libraries
68864e411241Smrg  -static-libtool-libs
68874e411241Smrg                    do not do any dynamic linking of libtool libraries
68888c9fbc29Smrg  -version-info CURRENT[:REVISION[:AGE]]
68894e411241Smrg                    specify library version info [each variable defaults to 0]
68908c9fbc29Smrg
68918c9fbc29SmrgAll other options (arguments beginning with \`-') are ignored.
68928c9fbc29Smrg
68938c9fbc29SmrgEvery other argument is treated as a filename.  Files ending in \`.la' are
68948c9fbc29Smrgtreated as uninstalled libtool libraries, other files are standard or library
68958c9fbc29Smrgobject files.
68968c9fbc29Smrg
68978c9fbc29SmrgIf the OUTPUT-FILE ends in \`.la', then a libtool library is created,
68988c9fbc29Smrgonly library objects (\`.lo' files) may be specified, and \`-rpath' is
68998c9fbc29Smrgrequired, except when creating a convenience library.
69008c9fbc29Smrg
69018c9fbc29SmrgIf OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
69028c9fbc29Smrgusing \`ar' and \`ranlib', or on Windows using \`lib'.
69038c9fbc29Smrg
69048c9fbc29SmrgIf OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
69058c9fbc29Smrgis created, otherwise an executable program is created."
69068c9fbc29Smrg  ;;
69078c9fbc29Smrg
69088c9fbc29Smrguninstall)
69098c9fbc29Smrg  $echo \
69108c9fbc29Smrg"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
69118c9fbc29Smrg
69128c9fbc29SmrgRemove libraries from an installation directory.
69138c9fbc29Smrg
69148c9fbc29SmrgRM is the name of the program to use to delete files associated with each FILE
69158c9fbc29Smrg(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
69168c9fbc29Smrgto RM.
69178c9fbc29Smrg
69188c9fbc29SmrgIf FILE is a libtool library, all the files associated with it are deleted.
69198c9fbc29SmrgOtherwise, only FILE itself is deleted using RM."
69208c9fbc29Smrg  ;;
69218c9fbc29Smrg
69228c9fbc29Smrg*)
69238c9fbc29Smrg  $echo "$modename: invalid operation mode \`$mode'" 1>&2
69248c9fbc29Smrg  $echo "$help" 1>&2
69258c9fbc29Smrg  exit $EXIT_FAILURE
69268c9fbc29Smrg  ;;
69278c9fbc29Smrgesac
69288c9fbc29Smrg
69298c9fbc29Smrg$echo
69308c9fbc29Smrg$echo "Try \`$modename --help' for more information about other modes."
69318c9fbc29Smrg
69328c9fbc29Smrgexit $?
69338c9fbc29Smrg
69348c9fbc29Smrg# The TAGs below are defined such that we never get into a situation
69358c9fbc29Smrg# in which we disable both kinds of libraries.  Given conflicting
69368c9fbc29Smrg# choices, we go for a static library, that is the most portable,
69378c9fbc29Smrg# since we can't tell whether shared libraries were disabled because
69388c9fbc29Smrg# the user asked for that or because the platform doesn't support
69398c9fbc29Smrg# them.  This is particularly important on AIX, because we don't
69408c9fbc29Smrg# support having both static and shared libraries enabled at the same
69418c9fbc29Smrg# time on that platform, so we default to a shared-only configuration.
69428c9fbc29Smrg# If a disable-shared tag is given, we'll fallback to a static-only
69438c9fbc29Smrg# configuration.  But we'll never go from static-only to shared-only.
69448c9fbc29Smrg
69458c9fbc29Smrg# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
69468c9fbc29Smrgdisable_libs=shared
69478c9fbc29Smrg# ### END LIBTOOL TAG CONFIG: disable-shared
69488c9fbc29Smrg
69498c9fbc29Smrg# ### BEGIN LIBTOOL TAG CONFIG: disable-static
69508c9fbc29Smrgdisable_libs=static
69518c9fbc29Smrg# ### END LIBTOOL TAG CONFIG: disable-static
69528c9fbc29Smrg
69538c9fbc29Smrg# Local Variables:
69548c9fbc29Smrg# mode:shell-script
69558c9fbc29Smrg# sh-indentation:2
69568c9fbc29Smrg# End:
6957