ltmain.sh revision 4456fccd
14456fccdSmrg# ltmain.sh - Provide generalized library-building support services.
24456fccdSmrg# NOTE: Changing this file will not affect anything until you rerun configure.
34456fccdSmrg#
44456fccdSmrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005
54456fccdSmrg# Free Software Foundation, Inc.
64456fccdSmrg# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
74456fccdSmrg#
84456fccdSmrg# This program is free software; you can redistribute it and/or modify
94456fccdSmrg# it under the terms of the GNU General Public License as published by
104456fccdSmrg# the Free Software Foundation; either version 2 of the License, or
114456fccdSmrg# (at your option) any later version.
124456fccdSmrg#
134456fccdSmrg# This program is distributed in the hope that it will be useful, but
144456fccdSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of
154456fccdSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
164456fccdSmrg# General Public License for more details.
174456fccdSmrg#
184456fccdSmrg# You should have received a copy of the GNU General Public License
194456fccdSmrg# along with this program; if not, write to the Free Software
204456fccdSmrg# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
214456fccdSmrg#
224456fccdSmrg# As a special exception to the GNU General Public License, if you
234456fccdSmrg# distribute this file as part of a program that contains a
244456fccdSmrg# configuration script generated by Autoconf, you may include it under
254456fccdSmrg# the same distribution terms that you use for the rest of that program.
264456fccdSmrg
274456fccdSmrgbasename="s,^.*/,,g"
284456fccdSmrg
294456fccdSmrg# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
304456fccdSmrg# is ksh but when the shell is invoked as "sh" and the current value of
314456fccdSmrg# the _XPG environment variable is not equal to 1 (one), the special
324456fccdSmrg# positional parameter $0, within a function call, is the name of the
334456fccdSmrg# function.
344456fccdSmrgprogpath="$0"
354456fccdSmrg
364456fccdSmrg# The name of this program:
374456fccdSmrgprogname=`echo "$progpath" | $SED $basename`
384456fccdSmrgmodename="$progname"
394456fccdSmrg
404456fccdSmrg# Global variables:
414456fccdSmrgEXIT_SUCCESS=0
424456fccdSmrgEXIT_FAILURE=1
434456fccdSmrg
444456fccdSmrgPROGRAM=ltmain.sh
454456fccdSmrgPACKAGE=libtool
464456fccdSmrgVERSION="1.5.22 Debian 1.5.22-4"
474456fccdSmrgTIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)"
484456fccdSmrg
494456fccdSmrg# See if we are running on zsh, and set the options which allow our
504456fccdSmrg# commands through without removal of \ escapes.
514456fccdSmrgif test -n "${ZSH_VERSION+set}" ; then
524456fccdSmrg  setopt NO_GLOB_SUBST
534456fccdSmrgfi
544456fccdSmrg
554456fccdSmrg# Check that we have a working $echo.
564456fccdSmrgif test "X$1" = X--no-reexec; then
574456fccdSmrg  # Discard the --no-reexec flag, and continue.
584456fccdSmrg  shift
594456fccdSmrgelif test "X$1" = X--fallback-echo; then
604456fccdSmrg  # Avoid inline document here, it may be left over
614456fccdSmrg  :
624456fccdSmrgelif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
634456fccdSmrg  # Yippee, $echo works!
644456fccdSmrg  :
654456fccdSmrgelse
664456fccdSmrg  # Restart under the correct shell, and then maybe $echo will work.
674456fccdSmrg  exec $SHELL "$progpath" --no-reexec ${1+"$@"}
684456fccdSmrgfi
694456fccdSmrg
704456fccdSmrgif test "X$1" = X--fallback-echo; then
714456fccdSmrg  # used as fallback echo
724456fccdSmrg  shift
734456fccdSmrg  cat <<EOF
744456fccdSmrg$*
754456fccdSmrgEOF
764456fccdSmrg  exit $EXIT_SUCCESS
774456fccdSmrgfi
784456fccdSmrg
794456fccdSmrgdefault_mode=
804456fccdSmrghelp="Try \`$progname --help' for more information."
814456fccdSmrgmagic="%%%MAGIC variable%%%"
824456fccdSmrgmkdir="mkdir"
834456fccdSmrgmv="mv -f"
844456fccdSmrgrm="rm -f"
854456fccdSmrg
864456fccdSmrg# Sed substitution that helps us do robust quoting.  It backslashifies
874456fccdSmrg# metacharacters that are still active within double-quoted strings.
884456fccdSmrgXsed="${SED}"' -e 1s/^X//'
894456fccdSmrgsed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
904456fccdSmrg# test EBCDIC or ASCII
914456fccdSmrgcase `echo X|tr X '\101'` in
924456fccdSmrg A) # ASCII based system
934456fccdSmrg    # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
944456fccdSmrg  SP2NL='tr \040 \012'
954456fccdSmrg  NL2SP='tr \015\012 \040\040'
964456fccdSmrg  ;;
974456fccdSmrg *) # EBCDIC based system
984456fccdSmrg  SP2NL='tr \100 \n'
994456fccdSmrg  NL2SP='tr \r\n \100\100'
1004456fccdSmrg  ;;
1014456fccdSmrgesac
1024456fccdSmrg
1034456fccdSmrg# NLS nuisances.
1044456fccdSmrg# Only set LANG and LC_ALL to C if already set.
1054456fccdSmrg# These must not be set unconditionally because not all systems understand
1064456fccdSmrg# e.g. LANG=C (notably SCO).
1074456fccdSmrg# We save the old values to restore during execute mode.
1084456fccdSmrgif test "${LC_ALL+set}" = set; then
1094456fccdSmrg  save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
1104456fccdSmrgfi
1114456fccdSmrgif test "${LANG+set}" = set; then
1124456fccdSmrg  save_LANG="$LANG"; LANG=C; export LANG
1134456fccdSmrgfi
1144456fccdSmrg
1154456fccdSmrg# Make sure IFS has a sensible default
1164456fccdSmrglt_nl='
1174456fccdSmrg'
1184456fccdSmrgIFS=" 	$lt_nl"
1194456fccdSmrg
1204456fccdSmrgif test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
1214456fccdSmrg  $echo "$modename: not configured to build any kind of library" 1>&2
1224456fccdSmrg  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
1234456fccdSmrg  exit $EXIT_FAILURE
1244456fccdSmrgfi
1254456fccdSmrg
1264456fccdSmrg# Global variables.
1274456fccdSmrgmode=$default_mode
1284456fccdSmrgnonopt=
1294456fccdSmrgprev=
1304456fccdSmrgprevopt=
1314456fccdSmrgrun=
1324456fccdSmrgshow="$echo"
1334456fccdSmrgshow_help=
1344456fccdSmrgexecute_dlfiles=
1354456fccdSmrgduplicate_deps=no
1364456fccdSmrgpreserve_args=
1374456fccdSmrglo2o="s/\\.lo\$/.${objext}/"
1384456fccdSmrgo2lo="s/\\.${objext}\$/.lo/"
1394456fccdSmrg
1404456fccdSmrg#####################################
1414456fccdSmrg# Shell function definitions:
1424456fccdSmrg# This seems to be the best place for them
1434456fccdSmrg
1444456fccdSmrg# func_mktempdir [string]
1454456fccdSmrg# Make a temporary directory that won't clash with other running
1464456fccdSmrg# libtool processes, and avoids race conditions if possible.  If
1474456fccdSmrg# given, STRING is the basename for that directory.
1484456fccdSmrgfunc_mktempdir ()
1494456fccdSmrg{
1504456fccdSmrg    my_template="${TMPDIR-/tmp}/${1-$progname}"
1514456fccdSmrg
1524456fccdSmrg    if test "$run" = ":"; then
1534456fccdSmrg      # Return a directory name, but don't create it in dry-run mode
1544456fccdSmrg      my_tmpdir="${my_template}-$$"
1554456fccdSmrg    else
1564456fccdSmrg
1574456fccdSmrg      # If mktemp works, use that first and foremost
1584456fccdSmrg      my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
1594456fccdSmrg
1604456fccdSmrg      if test ! -d "$my_tmpdir"; then
1614456fccdSmrg	# Failing that, at least try and use $RANDOM to avoid a race
1624456fccdSmrg	my_tmpdir="${my_template}-${RANDOM-0}$$"
1634456fccdSmrg
1644456fccdSmrg	save_mktempdir_umask=`umask`
1654456fccdSmrg	umask 0077
1664456fccdSmrg	$mkdir "$my_tmpdir"
1674456fccdSmrg	umask $save_mktempdir_umask
1684456fccdSmrg      fi
1694456fccdSmrg
1704456fccdSmrg      # If we're not in dry-run mode, bomb out on failure
1714456fccdSmrg      test -d "$my_tmpdir" || {
1724456fccdSmrg        $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
1734456fccdSmrg	exit $EXIT_FAILURE
1744456fccdSmrg      }
1754456fccdSmrg    fi
1764456fccdSmrg
1774456fccdSmrg    $echo "X$my_tmpdir" | $Xsed
1784456fccdSmrg}
1794456fccdSmrg
1804456fccdSmrg
1814456fccdSmrg# func_win32_libid arg
1824456fccdSmrg# return the library type of file 'arg'
1834456fccdSmrg#
1844456fccdSmrg# Need a lot of goo to handle *both* DLLs and import libs
1854456fccdSmrg# Has to be a shell function in order to 'eat' the argument
1864456fccdSmrg# that is supplied when $file_magic_command is called.
1874456fccdSmrgfunc_win32_libid ()
1884456fccdSmrg{
1894456fccdSmrg  win32_libid_type="unknown"
1904456fccdSmrg  win32_fileres=`file -L $1 2>/dev/null`
1914456fccdSmrg  case $win32_fileres in
1924456fccdSmrg  *ar\ archive\ import\ library*) # definitely import
1934456fccdSmrg    win32_libid_type="x86 archive import"
1944456fccdSmrg    ;;
1954456fccdSmrg  *ar\ archive*) # could be an import, or static
1964456fccdSmrg    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
1974456fccdSmrg      $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
1984456fccdSmrg      win32_nmres=`eval $NM -f posix -A $1 | \
1994456fccdSmrg	$SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'`
2004456fccdSmrg      case $win32_nmres in
2014456fccdSmrg      import*)  win32_libid_type="x86 archive import";;
2024456fccdSmrg      *)        win32_libid_type="x86 archive static";;
2034456fccdSmrg      esac
2044456fccdSmrg    fi
2054456fccdSmrg    ;;
2064456fccdSmrg  *DLL*)
2074456fccdSmrg    win32_libid_type="x86 DLL"
2084456fccdSmrg    ;;
2094456fccdSmrg  *executable*) # but shell scripts are "executable" too...
2104456fccdSmrg    case $win32_fileres in
2114456fccdSmrg    *MS\ Windows\ PE\ Intel*)
2124456fccdSmrg      win32_libid_type="x86 DLL"
2134456fccdSmrg      ;;
2144456fccdSmrg    esac
2154456fccdSmrg    ;;
2164456fccdSmrg  esac
2174456fccdSmrg  $echo $win32_libid_type
2184456fccdSmrg}
2194456fccdSmrg
2204456fccdSmrg
2214456fccdSmrg# func_infer_tag arg
2224456fccdSmrg# Infer tagged configuration to use if any are available and
2234456fccdSmrg# if one wasn't chosen via the "--tag" command line option.
2244456fccdSmrg# Only attempt this if the compiler in the base compile
2254456fccdSmrg# command doesn't match the default compiler.
2264456fccdSmrg# arg is usually of the form 'gcc ...'
2274456fccdSmrgfunc_infer_tag ()
2284456fccdSmrg{
2294456fccdSmrg    if test -n "$available_tags" && test -z "$tagname"; then
2304456fccdSmrg      CC_quoted=
2314456fccdSmrg      for arg in $CC; do
2324456fccdSmrg	case $arg in
2334456fccdSmrg	  *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
2344456fccdSmrg	  arg="\"$arg\""
2354456fccdSmrg	  ;;
2364456fccdSmrg	esac
2374456fccdSmrg	CC_quoted="$CC_quoted $arg"
2384456fccdSmrg      done
2394456fccdSmrg      case $@ in
2404456fccdSmrg      # Blanks in the command may have been stripped by the calling shell,
2414456fccdSmrg      # but not from the CC environment variable when configure was run.
2424456fccdSmrg      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
2434456fccdSmrg      # Blanks at the start of $base_compile will cause this to fail
2444456fccdSmrg      # if we don't check for them as well.
2454456fccdSmrg      *)
2464456fccdSmrg	for z in $available_tags; do
2474456fccdSmrg	  if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
2484456fccdSmrg	    # Evaluate the configuration.
2494456fccdSmrg	    eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
2504456fccdSmrg	    CC_quoted=
2514456fccdSmrg	    for arg in $CC; do
2524456fccdSmrg	    # Double-quote args containing other shell metacharacters.
2534456fccdSmrg	    case $arg in
2544456fccdSmrg	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
2554456fccdSmrg	      arg="\"$arg\""
2564456fccdSmrg	      ;;
2574456fccdSmrg	    esac
2584456fccdSmrg	    CC_quoted="$CC_quoted $arg"
2594456fccdSmrg	  done
2604456fccdSmrg	    case "$@ " in
2614456fccdSmrg	      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
2624456fccdSmrg	      # The compiler in the base compile command matches
2634456fccdSmrg	      # the one in the tagged configuration.
2644456fccdSmrg	      # Assume this is the tagged configuration we want.
2654456fccdSmrg	      tagname=$z
2664456fccdSmrg	      break
2674456fccdSmrg	      ;;
2684456fccdSmrg	    esac
2694456fccdSmrg	  fi
2704456fccdSmrg	done
2714456fccdSmrg	# If $tagname still isn't set, then no tagged configuration
2724456fccdSmrg	# was found and let the user know that the "--tag" command
2734456fccdSmrg	# line option must be used.
2744456fccdSmrg	if test -z "$tagname"; then
2754456fccdSmrg	  $echo "$modename: unable to infer tagged configuration"
2764456fccdSmrg	  $echo "$modename: specify a tag with \`--tag'" 1>&2
2774456fccdSmrg	  exit $EXIT_FAILURE
2784456fccdSmrg#        else
2794456fccdSmrg#          $echo "$modename: using $tagname tagged configuration"
2804456fccdSmrg	fi
2814456fccdSmrg	;;
2824456fccdSmrg      esac
2834456fccdSmrg    fi
2844456fccdSmrg}
2854456fccdSmrg
2864456fccdSmrg
2874456fccdSmrg# func_extract_an_archive dir oldlib
2884456fccdSmrgfunc_extract_an_archive ()
2894456fccdSmrg{
2904456fccdSmrg    f_ex_an_ar_dir="$1"; shift
2914456fccdSmrg    f_ex_an_ar_oldlib="$1"
2924456fccdSmrg
2934456fccdSmrg    $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
2944456fccdSmrg    $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
2954456fccdSmrg    if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
2964456fccdSmrg     :
2974456fccdSmrg    else
2984456fccdSmrg      $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
2994456fccdSmrg      exit $EXIT_FAILURE
3004456fccdSmrg    fi
3014456fccdSmrg}
3024456fccdSmrg
3034456fccdSmrg# func_extract_archives gentop oldlib ...
3044456fccdSmrgfunc_extract_archives ()
3054456fccdSmrg{
3064456fccdSmrg    my_gentop="$1"; shift
3074456fccdSmrg    my_oldlibs=${1+"$@"}
3084456fccdSmrg    my_oldobjs=""
3094456fccdSmrg    my_xlib=""
3104456fccdSmrg    my_xabs=""
3114456fccdSmrg    my_xdir=""
3124456fccdSmrg    my_status=""
3134456fccdSmrg
3144456fccdSmrg    $show "${rm}r $my_gentop"
3154456fccdSmrg    $run ${rm}r "$my_gentop"
3164456fccdSmrg    $show "$mkdir $my_gentop"
3174456fccdSmrg    $run $mkdir "$my_gentop"
3184456fccdSmrg    my_status=$?
3194456fccdSmrg    if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
3204456fccdSmrg      exit $my_status
3214456fccdSmrg    fi
3224456fccdSmrg
3234456fccdSmrg    for my_xlib in $my_oldlibs; do
3244456fccdSmrg      # Extract the objects.
3254456fccdSmrg      case $my_xlib in
3264456fccdSmrg	[\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
3274456fccdSmrg	*) my_xabs=`pwd`"/$my_xlib" ;;
3284456fccdSmrg      esac
3294456fccdSmrg      my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
3304456fccdSmrg      my_xdir="$my_gentop/$my_xlib"
3314456fccdSmrg
3324456fccdSmrg      $show "${rm}r $my_xdir"
3334456fccdSmrg      $run ${rm}r "$my_xdir"
3344456fccdSmrg      $show "$mkdir $my_xdir"
3354456fccdSmrg      $run $mkdir "$my_xdir"
3364456fccdSmrg      exit_status=$?
3374456fccdSmrg      if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
3384456fccdSmrg	exit $exit_status
3394456fccdSmrg      fi
3404456fccdSmrg      case $host in
3414456fccdSmrg      *-darwin*)
3424456fccdSmrg	$show "Extracting $my_xabs"
3434456fccdSmrg	# Do not bother doing anything if just a dry run
3444456fccdSmrg	if test -z "$run"; then
3454456fccdSmrg	  darwin_orig_dir=`pwd`
3464456fccdSmrg	  cd $my_xdir || exit $?
3474456fccdSmrg	  darwin_archive=$my_xabs
3484456fccdSmrg	  darwin_curdir=`pwd`
3494456fccdSmrg	  darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
3504456fccdSmrg	  darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
3514456fccdSmrg	  if test -n "$darwin_arches"; then 
3524456fccdSmrg	    darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
3534456fccdSmrg	    darwin_arch=
3544456fccdSmrg	    $show "$darwin_base_archive has multiple architectures $darwin_arches"
3554456fccdSmrg	    for darwin_arch in  $darwin_arches ; do
3564456fccdSmrg	      mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
3574456fccdSmrg	      lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
3584456fccdSmrg	      cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
3594456fccdSmrg	      func_extract_an_archive "`pwd`" "${darwin_base_archive}"
3604456fccdSmrg	      cd "$darwin_curdir"
3614456fccdSmrg	      $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
3624456fccdSmrg	    done # $darwin_arches
3634456fccdSmrg      ## Okay now we have a bunch of thin objects, gotta fatten them up :)
3644456fccdSmrg	    darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
3654456fccdSmrg	    darwin_file=
3664456fccdSmrg	    darwin_files=
3674456fccdSmrg	    for darwin_file in $darwin_filelist; do
3684456fccdSmrg	      darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
3694456fccdSmrg	      lipo -create -output "$darwin_file" $darwin_files
3704456fccdSmrg	    done # $darwin_filelist
3714456fccdSmrg	    ${rm}r unfat-$$
3724456fccdSmrg	    cd "$darwin_orig_dir"
3734456fccdSmrg	  else
3744456fccdSmrg	    cd "$darwin_orig_dir"
3754456fccdSmrg 	    func_extract_an_archive "$my_xdir" "$my_xabs"
3764456fccdSmrg	  fi # $darwin_arches
3774456fccdSmrg	fi # $run
3784456fccdSmrg	;;
3794456fccdSmrg      *)
3804456fccdSmrg        func_extract_an_archive "$my_xdir" "$my_xabs"
3814456fccdSmrg        ;;
3824456fccdSmrg      esac
3834456fccdSmrg      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
3844456fccdSmrg    done
3854456fccdSmrg    func_extract_archives_result="$my_oldobjs"
3864456fccdSmrg}
3874456fccdSmrg# End of Shell function definitions
3884456fccdSmrg#####################################
3894456fccdSmrg
3904456fccdSmrg# Darwin sucks
3914456fccdSmrgeval std_shrext=\"$shrext_cmds\"
3924456fccdSmrg
3934456fccdSmrgdisable_libs=no
3944456fccdSmrg
3954456fccdSmrg# Parse our command line options once, thoroughly.
3964456fccdSmrgwhile test "$#" -gt 0
3974456fccdSmrgdo
3984456fccdSmrg  arg="$1"
3994456fccdSmrg  shift
4004456fccdSmrg
4014456fccdSmrg  case $arg in
4024456fccdSmrg  -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
4034456fccdSmrg  *) optarg= ;;
4044456fccdSmrg  esac
4054456fccdSmrg
4064456fccdSmrg  # If the previous option needs an argument, assign it.
4074456fccdSmrg  if test -n "$prev"; then
4084456fccdSmrg    case $prev in
4094456fccdSmrg    execute_dlfiles)
4104456fccdSmrg      execute_dlfiles="$execute_dlfiles $arg"
4114456fccdSmrg      ;;
4124456fccdSmrg    tag)
4134456fccdSmrg      tagname="$arg"
4144456fccdSmrg      preserve_args="${preserve_args}=$arg"
4154456fccdSmrg
4164456fccdSmrg      # Check whether tagname contains only valid characters
4174456fccdSmrg      case $tagname in
4184456fccdSmrg      *[!-_A-Za-z0-9,/]*)
4194456fccdSmrg	$echo "$progname: invalid tag name: $tagname" 1>&2
4204456fccdSmrg	exit $EXIT_FAILURE
4214456fccdSmrg	;;
4224456fccdSmrg      esac
4234456fccdSmrg
4244456fccdSmrg      case $tagname in
4254456fccdSmrg      CC)
4264456fccdSmrg	# Don't test for the "default" C tag, as we know, it's there, but
4274456fccdSmrg	# not specially marked.
4284456fccdSmrg	;;
4294456fccdSmrg      *)
4304456fccdSmrg	if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
4314456fccdSmrg	  taglist="$taglist $tagname"
4324456fccdSmrg	  # Evaluate the configuration.
4334456fccdSmrg	  eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
4344456fccdSmrg	else
4354456fccdSmrg	  $echo "$progname: ignoring unknown tag $tagname" 1>&2
4364456fccdSmrg	fi
4374456fccdSmrg	;;
4384456fccdSmrg      esac
4394456fccdSmrg      ;;
4404456fccdSmrg    *)
4414456fccdSmrg      eval "$prev=\$arg"
4424456fccdSmrg      ;;
4434456fccdSmrg    esac
4444456fccdSmrg
4454456fccdSmrg    prev=
4464456fccdSmrg    prevopt=
4474456fccdSmrg    continue
4484456fccdSmrg  fi
4494456fccdSmrg
4504456fccdSmrg  # Have we seen a non-optional argument yet?
4514456fccdSmrg  case $arg in
4524456fccdSmrg  --help)
4534456fccdSmrg    show_help=yes
4544456fccdSmrg    ;;
4554456fccdSmrg
4564456fccdSmrg  --version)
4574456fccdSmrg    $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
4584456fccdSmrg    $echo
4594456fccdSmrg    $echo "Copyright (C) 2005  Free Software Foundation, Inc."
4604456fccdSmrg    $echo "This is free software; see the source for copying conditions.  There is NO"
4614456fccdSmrg    $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
4624456fccdSmrg    exit $?
4634456fccdSmrg    ;;
4644456fccdSmrg
4654456fccdSmrg  --config)
4664456fccdSmrg    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
4674456fccdSmrg    # Now print the configurations for the tags.
4684456fccdSmrg    for tagname in $taglist; do
4694456fccdSmrg      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
4704456fccdSmrg    done
4714456fccdSmrg    exit $?
4724456fccdSmrg    ;;
4734456fccdSmrg
4744456fccdSmrg  --debug)
4754456fccdSmrg    $echo "$progname: enabling shell trace mode"
4764456fccdSmrg    set -x
4774456fccdSmrg    preserve_args="$preserve_args $arg"
4784456fccdSmrg    ;;
4794456fccdSmrg
4804456fccdSmrg  --dry-run | -n)
4814456fccdSmrg    run=:
4824456fccdSmrg    ;;
4834456fccdSmrg
4844456fccdSmrg  --features)
4854456fccdSmrg    $echo "host: $host"
4864456fccdSmrg    if test "$build_libtool_libs" = yes; then
4874456fccdSmrg      $echo "enable shared libraries"
4884456fccdSmrg    else
4894456fccdSmrg      $echo "disable shared libraries"
4904456fccdSmrg    fi
4914456fccdSmrg    if test "$build_old_libs" = yes; then
4924456fccdSmrg      $echo "enable static libraries"
4934456fccdSmrg    else
4944456fccdSmrg      $echo "disable static libraries"
4954456fccdSmrg    fi
4964456fccdSmrg    exit $?
4974456fccdSmrg    ;;
4984456fccdSmrg
4994456fccdSmrg  --finish) mode="finish" ;;
5004456fccdSmrg
5014456fccdSmrg  --mode) prevopt="--mode" prev=mode ;;
5024456fccdSmrg  --mode=*) mode="$optarg" ;;
5034456fccdSmrg
5044456fccdSmrg  --preserve-dup-deps) duplicate_deps="yes" ;;
5054456fccdSmrg
5064456fccdSmrg  --quiet | --silent)
5074456fccdSmrg    show=:
5084456fccdSmrg    preserve_args="$preserve_args $arg"
5094456fccdSmrg    ;;
5104456fccdSmrg
5114456fccdSmrg  --tag)
5124456fccdSmrg    prevopt="--tag"
5134456fccdSmrg    prev=tag
5144456fccdSmrg    preserve_args="$preserve_args --tag"
5154456fccdSmrg    ;;
5164456fccdSmrg  --tag=*)
5174456fccdSmrg    set tag "$optarg" ${1+"$@"}
5184456fccdSmrg    shift
5194456fccdSmrg    prev=tag
5204456fccdSmrg    preserve_args="$preserve_args --tag"
5214456fccdSmrg    ;;
5224456fccdSmrg
5234456fccdSmrg  -dlopen)
5244456fccdSmrg    prevopt="-dlopen"
5254456fccdSmrg    prev=execute_dlfiles
5264456fccdSmrg    ;;
5274456fccdSmrg
5284456fccdSmrg  -*)
5294456fccdSmrg    $echo "$modename: unrecognized option \`$arg'" 1>&2
5304456fccdSmrg    $echo "$help" 1>&2
5314456fccdSmrg    exit $EXIT_FAILURE
5324456fccdSmrg    ;;
5334456fccdSmrg
5344456fccdSmrg  *)
5354456fccdSmrg    nonopt="$arg"
5364456fccdSmrg    break
5374456fccdSmrg    ;;
5384456fccdSmrg  esac
5394456fccdSmrgdone
5404456fccdSmrg
5414456fccdSmrgif test -n "$prevopt"; then
5424456fccdSmrg  $echo "$modename: option \`$prevopt' requires an argument" 1>&2
5434456fccdSmrg  $echo "$help" 1>&2
5444456fccdSmrg  exit $EXIT_FAILURE
5454456fccdSmrgfi
5464456fccdSmrg
5474456fccdSmrgcase $disable_libs in
5484456fccdSmrgno) 
5494456fccdSmrg  ;;
5504456fccdSmrgshared)
5514456fccdSmrg  build_libtool_libs=no
5524456fccdSmrg  build_old_libs=yes
5534456fccdSmrg  ;;
5544456fccdSmrgstatic)
5554456fccdSmrg  build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
5564456fccdSmrg  ;;
5574456fccdSmrgesac
5584456fccdSmrg
5594456fccdSmrg# If this variable is set in any of the actions, the command in it
5604456fccdSmrg# will be execed at the end.  This prevents here-documents from being
5614456fccdSmrg# left over by shells.
5624456fccdSmrgexec_cmd=
5634456fccdSmrg
5644456fccdSmrgif test -z "$show_help"; then
5654456fccdSmrg
5664456fccdSmrg  # Infer the operation mode.
5674456fccdSmrg  if test -z "$mode"; then
5684456fccdSmrg    $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
5694456fccdSmrg    $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
5704456fccdSmrg    case $nonopt in
5714456fccdSmrg    *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
5724456fccdSmrg      mode=link
5734456fccdSmrg      for arg
5744456fccdSmrg      do
5754456fccdSmrg	case $arg in
5764456fccdSmrg	-c)
5774456fccdSmrg	   mode=compile
5784456fccdSmrg	   break
5794456fccdSmrg	   ;;
5804456fccdSmrg	esac
5814456fccdSmrg      done
5824456fccdSmrg      ;;
5834456fccdSmrg    *db | *dbx | *strace | *truss)
5844456fccdSmrg      mode=execute
5854456fccdSmrg      ;;
5864456fccdSmrg    *install*|cp|mv)
5874456fccdSmrg      mode=install
5884456fccdSmrg      ;;
5894456fccdSmrg    *rm)
5904456fccdSmrg      mode=uninstall
5914456fccdSmrg      ;;
5924456fccdSmrg    *)
5934456fccdSmrg      # If we have no mode, but dlfiles were specified, then do execute mode.
5944456fccdSmrg      test -n "$execute_dlfiles" && mode=execute
5954456fccdSmrg
5964456fccdSmrg      # Just use the default operation mode.
5974456fccdSmrg      if test -z "$mode"; then
5984456fccdSmrg	if test -n "$nonopt"; then
5994456fccdSmrg	  $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
6004456fccdSmrg	else
6014456fccdSmrg	  $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
6024456fccdSmrg	fi
6034456fccdSmrg      fi
6044456fccdSmrg      ;;
6054456fccdSmrg    esac
6064456fccdSmrg  fi
6074456fccdSmrg
6084456fccdSmrg  # Only execute mode is allowed to have -dlopen flags.
6094456fccdSmrg  if test -n "$execute_dlfiles" && test "$mode" != execute; then
6104456fccdSmrg    $echo "$modename: unrecognized option \`-dlopen'" 1>&2
6114456fccdSmrg    $echo "$help" 1>&2
6124456fccdSmrg    exit $EXIT_FAILURE
6134456fccdSmrg  fi
6144456fccdSmrg
6154456fccdSmrg  # Change the help message to a mode-specific one.
6164456fccdSmrg  generic_help="$help"
6174456fccdSmrg  help="Try \`$modename --help --mode=$mode' for more information."
6184456fccdSmrg
6194456fccdSmrg  # These modes are in order of execution frequency so that they run quickly.
6204456fccdSmrg  case $mode in
6214456fccdSmrg  # libtool compile mode
6224456fccdSmrg  compile)
6234456fccdSmrg    modename="$modename: compile"
6244456fccdSmrg    # Get the compilation command and the source file.
6254456fccdSmrg    base_compile=
6264456fccdSmrg    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
6274456fccdSmrg    suppress_opt=yes
6284456fccdSmrg    suppress_output=
6294456fccdSmrg    arg_mode=normal
6304456fccdSmrg    libobj=
6314456fccdSmrg    later=
6324456fccdSmrg
6334456fccdSmrg    for arg
6344456fccdSmrg    do
6354456fccdSmrg      case $arg_mode in
6364456fccdSmrg      arg  )
6374456fccdSmrg	# do not "continue".  Instead, add this to base_compile
6384456fccdSmrg	lastarg="$arg"
6394456fccdSmrg	arg_mode=normal
6404456fccdSmrg	;;
6414456fccdSmrg
6424456fccdSmrg      target )
6434456fccdSmrg	libobj="$arg"
6444456fccdSmrg	arg_mode=normal
6454456fccdSmrg	continue
6464456fccdSmrg	;;
6474456fccdSmrg
6484456fccdSmrg      normal )
6494456fccdSmrg	# Accept any command-line options.
6504456fccdSmrg	case $arg in
6514456fccdSmrg	-o)
6524456fccdSmrg	  if test -n "$libobj" ; then
6534456fccdSmrg	    $echo "$modename: you cannot specify \`-o' more than once" 1>&2
6544456fccdSmrg	    exit $EXIT_FAILURE
6554456fccdSmrg	  fi
6564456fccdSmrg	  arg_mode=target
6574456fccdSmrg	  continue
6584456fccdSmrg	  ;;
6594456fccdSmrg
6604456fccdSmrg	-static | -prefer-pic | -prefer-non-pic)
6614456fccdSmrg	  later="$later $arg"
6624456fccdSmrg	  continue
6634456fccdSmrg	  ;;
6644456fccdSmrg
6654456fccdSmrg	-no-suppress)
6664456fccdSmrg	  suppress_opt=no
6674456fccdSmrg	  continue
6684456fccdSmrg	  ;;
6694456fccdSmrg
6704456fccdSmrg	-Xcompiler)
6714456fccdSmrg	  arg_mode=arg  #  the next one goes into the "base_compile" arg list
6724456fccdSmrg	  continue      #  The current "srcfile" will either be retained or
6734456fccdSmrg	  ;;            #  replaced later.  I would guess that would be a bug.
6744456fccdSmrg
6754456fccdSmrg	-Wc,*)
6764456fccdSmrg	  args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
6774456fccdSmrg	  lastarg=
6784456fccdSmrg	  save_ifs="$IFS"; IFS=','
6794456fccdSmrg 	  for arg in $args; do
6804456fccdSmrg	    IFS="$save_ifs"
6814456fccdSmrg
6824456fccdSmrg	    # Double-quote args containing other shell metacharacters.
6834456fccdSmrg	    # Many Bourne shells cannot handle close brackets correctly
6844456fccdSmrg	    # in scan sets, so we specify it separately.
6854456fccdSmrg	    case $arg in
6864456fccdSmrg	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
6874456fccdSmrg	      arg="\"$arg\""
6884456fccdSmrg	      ;;
6894456fccdSmrg	    esac
6904456fccdSmrg	    lastarg="$lastarg $arg"
6914456fccdSmrg	  done
6924456fccdSmrg	  IFS="$save_ifs"
6934456fccdSmrg	  lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
6944456fccdSmrg
6954456fccdSmrg	  # Add the arguments to base_compile.
6964456fccdSmrg	  base_compile="$base_compile $lastarg"
6974456fccdSmrg	  continue
6984456fccdSmrg	  ;;
6994456fccdSmrg
7004456fccdSmrg	* )
7014456fccdSmrg	  # Accept the current argument as the source file.
7024456fccdSmrg	  # The previous "srcfile" becomes the current argument.
7034456fccdSmrg	  #
7044456fccdSmrg	  lastarg="$srcfile"
7054456fccdSmrg	  srcfile="$arg"
7064456fccdSmrg	  ;;
7074456fccdSmrg	esac  #  case $arg
7084456fccdSmrg	;;
7094456fccdSmrg      esac    #  case $arg_mode
7104456fccdSmrg
7114456fccdSmrg      # Aesthetically quote the previous argument.
7124456fccdSmrg      lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
7134456fccdSmrg
7144456fccdSmrg      case $lastarg in
7154456fccdSmrg      # Double-quote args containing other shell metacharacters.
7164456fccdSmrg      # Many Bourne shells cannot handle close brackets correctly
7174456fccdSmrg      # in scan sets, and some SunOS ksh mistreat backslash-escaping
7184456fccdSmrg      # in scan sets (worked around with variable expansion),
7194456fccdSmrg      # and furthermore cannot handle '|' '&' '(' ')' in scan sets 
7204456fccdSmrg      # at all, so we specify them separately.
7214456fccdSmrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
7224456fccdSmrg	lastarg="\"$lastarg\""
7234456fccdSmrg	;;
7244456fccdSmrg      esac
7254456fccdSmrg
7264456fccdSmrg      base_compile="$base_compile $lastarg"
7274456fccdSmrg    done # for arg
7284456fccdSmrg
7294456fccdSmrg    case $arg_mode in
7304456fccdSmrg    arg)
7314456fccdSmrg      $echo "$modename: you must specify an argument for -Xcompile"
7324456fccdSmrg      exit $EXIT_FAILURE
7334456fccdSmrg      ;;
7344456fccdSmrg    target)
7354456fccdSmrg      $echo "$modename: you must specify a target with \`-o'" 1>&2
7364456fccdSmrg      exit $EXIT_FAILURE
7374456fccdSmrg      ;;
7384456fccdSmrg    *)
7394456fccdSmrg      # Get the name of the library object.
7404456fccdSmrg      [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
7414456fccdSmrg      ;;
7424456fccdSmrg    esac
7434456fccdSmrg
7444456fccdSmrg    # Recognize several different file suffixes.
7454456fccdSmrg    # If the user specifies -o file.o, it is replaced with file.lo
7464456fccdSmrg    xform='[cCFSifmso]'
7474456fccdSmrg    case $libobj in
7484456fccdSmrg    *.ada) xform=ada ;;
7494456fccdSmrg    *.adb) xform=adb ;;
7504456fccdSmrg    *.ads) xform=ads ;;
7514456fccdSmrg    *.asm) xform=asm ;;
7524456fccdSmrg    *.c++) xform=c++ ;;
7534456fccdSmrg    *.cc) xform=cc ;;
7544456fccdSmrg    *.ii) xform=ii ;;
7554456fccdSmrg    *.class) xform=class ;;
7564456fccdSmrg    *.cpp) xform=cpp ;;
7574456fccdSmrg    *.cxx) xform=cxx ;;
7584456fccdSmrg    *.f90) xform=f90 ;;
7594456fccdSmrg    *.for) xform=for ;;
7604456fccdSmrg    *.java) xform=java ;;
7614456fccdSmrg    esac
7624456fccdSmrg
7634456fccdSmrg    libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
7644456fccdSmrg
7654456fccdSmrg    case $libobj in
7664456fccdSmrg    *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
7674456fccdSmrg    *)
7684456fccdSmrg      $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
7694456fccdSmrg      exit $EXIT_FAILURE
7704456fccdSmrg      ;;
7714456fccdSmrg    esac
7724456fccdSmrg
7734456fccdSmrg    func_infer_tag $base_compile
7744456fccdSmrg
7754456fccdSmrg    for arg in $later; do
7764456fccdSmrg      case $arg in
7774456fccdSmrg      -static)
7784456fccdSmrg	build_old_libs=yes
7794456fccdSmrg	continue
7804456fccdSmrg	;;
7814456fccdSmrg
7824456fccdSmrg      -prefer-pic)
7834456fccdSmrg	pic_mode=yes
7844456fccdSmrg	continue
7854456fccdSmrg	;;
7864456fccdSmrg
7874456fccdSmrg      -prefer-non-pic)
7884456fccdSmrg	pic_mode=no
7894456fccdSmrg	continue
7904456fccdSmrg	;;
7914456fccdSmrg      esac
7924456fccdSmrg    done
7934456fccdSmrg
7944456fccdSmrg    qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
7954456fccdSmrg    case $qlibobj in
7964456fccdSmrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
7974456fccdSmrg	qlibobj="\"$qlibobj\"" ;;
7984456fccdSmrg    esac
7994456fccdSmrg    test "X$libobj" != "X$qlibobj" \
8004456fccdSmrg	&& $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' 	&()|`$[]' \
8014456fccdSmrg	&& $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
8024456fccdSmrg    objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
8034456fccdSmrg    xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
8044456fccdSmrg    if test "X$xdir" = "X$obj"; then
8054456fccdSmrg      xdir=
8064456fccdSmrg    else
8074456fccdSmrg      xdir=$xdir/
8084456fccdSmrg    fi
8094456fccdSmrg    lobj=${xdir}$objdir/$objname
8104456fccdSmrg
8114456fccdSmrg    if test -z "$base_compile"; then
8124456fccdSmrg      $echo "$modename: you must specify a compilation command" 1>&2
8134456fccdSmrg      $echo "$help" 1>&2
8144456fccdSmrg      exit $EXIT_FAILURE
8154456fccdSmrg    fi
8164456fccdSmrg
8174456fccdSmrg    # Delete any leftover library objects.
8184456fccdSmrg    if test "$build_old_libs" = yes; then
8194456fccdSmrg      removelist="$obj $lobj $libobj ${libobj}T"
8204456fccdSmrg    else
8214456fccdSmrg      removelist="$lobj $libobj ${libobj}T"
8224456fccdSmrg    fi
8234456fccdSmrg
8244456fccdSmrg    $run $rm $removelist
8254456fccdSmrg    trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
8264456fccdSmrg
8274456fccdSmrg    # On Cygwin there's no "real" PIC flag so we must build both object types
8284456fccdSmrg    case $host_os in
8294456fccdSmrg    cygwin* | mingw* | pw32* | os2*)
8304456fccdSmrg      pic_mode=default
8314456fccdSmrg      ;;
8324456fccdSmrg    esac
8334456fccdSmrg    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
8344456fccdSmrg      # non-PIC code in shared libraries is not supported
8354456fccdSmrg      pic_mode=default
8364456fccdSmrg    fi
8374456fccdSmrg
8384456fccdSmrg    # Calculate the filename of the output object if compiler does
8394456fccdSmrg    # not support -o with -c
8404456fccdSmrg    if test "$compiler_c_o" = no; then
8414456fccdSmrg      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
8424456fccdSmrg      lockfile="$output_obj.lock"
8434456fccdSmrg      removelist="$removelist $output_obj $lockfile"
8444456fccdSmrg      trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
8454456fccdSmrg    else
8464456fccdSmrg      output_obj=
8474456fccdSmrg      need_locks=no
8484456fccdSmrg      lockfile=
8494456fccdSmrg    fi
8504456fccdSmrg
8514456fccdSmrg    # Lock this critical section if it is needed
8524456fccdSmrg    # We use this script file to make the link, it avoids creating a new file
8534456fccdSmrg    if test "$need_locks" = yes; then
8544456fccdSmrg      until $run ln "$progpath" "$lockfile" 2>/dev/null; do
8554456fccdSmrg	$show "Waiting for $lockfile to be removed"
8564456fccdSmrg	sleep 2
8574456fccdSmrg      done
8584456fccdSmrg    elif test "$need_locks" = warn; then
8594456fccdSmrg      if test -f "$lockfile"; then
8604456fccdSmrg	$echo "\
8614456fccdSmrg*** ERROR, $lockfile exists and contains:
8624456fccdSmrg`cat $lockfile 2>/dev/null`
8634456fccdSmrg
8644456fccdSmrgThis indicates that another process is trying to use the same
8654456fccdSmrgtemporary object file, and libtool could not work around it because
8664456fccdSmrgyour compiler does not support \`-c' and \`-o' together.  If you
8674456fccdSmrgrepeat this compilation, it may succeed, by chance, but you had better
8684456fccdSmrgavoid parallel builds (make -j) in this platform, or get a better
8694456fccdSmrgcompiler."
8704456fccdSmrg
8714456fccdSmrg	$run $rm $removelist
8724456fccdSmrg	exit $EXIT_FAILURE
8734456fccdSmrg      fi
8744456fccdSmrg      $echo "$srcfile" > "$lockfile"
8754456fccdSmrg    fi
8764456fccdSmrg
8774456fccdSmrg    if test -n "$fix_srcfile_path"; then
8784456fccdSmrg      eval srcfile=\"$fix_srcfile_path\"
8794456fccdSmrg    fi
8804456fccdSmrg    qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
8814456fccdSmrg    case $qsrcfile in
8824456fccdSmrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
8834456fccdSmrg      qsrcfile="\"$qsrcfile\"" ;;
8844456fccdSmrg    esac
8854456fccdSmrg
8864456fccdSmrg    $run $rm "$libobj" "${libobj}T"
8874456fccdSmrg
8884456fccdSmrg    # Create a libtool object file (analogous to a ".la" file),
8894456fccdSmrg    # but don't create it if we're doing a dry run.
8904456fccdSmrg    test -z "$run" && cat > ${libobj}T <<EOF
8914456fccdSmrg# $libobj - a libtool object file
8924456fccdSmrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
8934456fccdSmrg#
8944456fccdSmrg# Please DO NOT delete this file!
8954456fccdSmrg# It is necessary for linking the library.
8964456fccdSmrg
8974456fccdSmrg# Name of the PIC object.
8984456fccdSmrgEOF
8994456fccdSmrg
9004456fccdSmrg    # Only build a PIC object if we are building libtool libraries.
9014456fccdSmrg    if test "$build_libtool_libs" = yes; then
9024456fccdSmrg      # Without this assignment, base_compile gets emptied.
9034456fccdSmrg      fbsd_hideous_sh_bug=$base_compile
9044456fccdSmrg
9054456fccdSmrg      if test "$pic_mode" != no; then
9064456fccdSmrg	command="$base_compile $qsrcfile $pic_flag"
9074456fccdSmrg      else
9084456fccdSmrg	# Don't build PIC code
9094456fccdSmrg	command="$base_compile $qsrcfile"
9104456fccdSmrg      fi
9114456fccdSmrg
9124456fccdSmrg      if test ! -d "${xdir}$objdir"; then
9134456fccdSmrg	$show "$mkdir ${xdir}$objdir"
9144456fccdSmrg	$run $mkdir ${xdir}$objdir
9154456fccdSmrg	exit_status=$?
9164456fccdSmrg	if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
9174456fccdSmrg	  exit $exit_status
9184456fccdSmrg	fi
9194456fccdSmrg      fi
9204456fccdSmrg
9214456fccdSmrg      if test -z "$output_obj"; then
9224456fccdSmrg	# Place PIC objects in $objdir
9234456fccdSmrg	command="$command -o $lobj"
9244456fccdSmrg      fi
9254456fccdSmrg
9264456fccdSmrg      $run $rm "$lobj" "$output_obj"
9274456fccdSmrg
9284456fccdSmrg      $show "$command"
9294456fccdSmrg      if $run eval "$command"; then :
9304456fccdSmrg      else
9314456fccdSmrg	test -n "$output_obj" && $run $rm $removelist
9324456fccdSmrg	exit $EXIT_FAILURE
9334456fccdSmrg      fi
9344456fccdSmrg
9354456fccdSmrg      if test "$need_locks" = warn &&
9364456fccdSmrg	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
9374456fccdSmrg	$echo "\
9384456fccdSmrg*** ERROR, $lockfile contains:
9394456fccdSmrg`cat $lockfile 2>/dev/null`
9404456fccdSmrg
9414456fccdSmrgbut it should contain:
9424456fccdSmrg$srcfile
9434456fccdSmrg
9444456fccdSmrgThis indicates that another process is trying to use the same
9454456fccdSmrgtemporary object file, and libtool could not work around it because
9464456fccdSmrgyour compiler does not support \`-c' and \`-o' together.  If you
9474456fccdSmrgrepeat this compilation, it may succeed, by chance, but you had better
9484456fccdSmrgavoid parallel builds (make -j) in this platform, or get a better
9494456fccdSmrgcompiler."
9504456fccdSmrg
9514456fccdSmrg	$run $rm $removelist
9524456fccdSmrg	exit $EXIT_FAILURE
9534456fccdSmrg      fi
9544456fccdSmrg
9554456fccdSmrg      # Just move the object if needed, then go on to compile the next one
9564456fccdSmrg      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
9574456fccdSmrg	$show "$mv $output_obj $lobj"
9584456fccdSmrg	if $run $mv $output_obj $lobj; then :
9594456fccdSmrg	else
9604456fccdSmrg	  error=$?
9614456fccdSmrg	  $run $rm $removelist
9624456fccdSmrg	  exit $error
9634456fccdSmrg	fi
9644456fccdSmrg      fi
9654456fccdSmrg
9664456fccdSmrg      # Append the name of the PIC object to the libtool object file.
9674456fccdSmrg      test -z "$run" && cat >> ${libobj}T <<EOF
9684456fccdSmrgpic_object='$objdir/$objname'
9694456fccdSmrg
9704456fccdSmrgEOF
9714456fccdSmrg
9724456fccdSmrg      # Allow error messages only from the first compilation.
9734456fccdSmrg      if test "$suppress_opt" = yes; then
9744456fccdSmrg        suppress_output=' >/dev/null 2>&1'
9754456fccdSmrg      fi
9764456fccdSmrg    else
9774456fccdSmrg      # No PIC object so indicate it doesn't exist in the libtool
9784456fccdSmrg      # object file.
9794456fccdSmrg      test -z "$run" && cat >> ${libobj}T <<EOF
9804456fccdSmrgpic_object=none
9814456fccdSmrg
9824456fccdSmrgEOF
9834456fccdSmrg    fi
9844456fccdSmrg
9854456fccdSmrg    # Only build a position-dependent object if we build old libraries.
9864456fccdSmrg    if test "$build_old_libs" = yes; then
9874456fccdSmrg      if test "$pic_mode" != yes; then
9884456fccdSmrg	# Don't build PIC code
9894456fccdSmrg	command="$base_compile $qsrcfile"
9904456fccdSmrg      else
9914456fccdSmrg	command="$base_compile $qsrcfile $pic_flag"
9924456fccdSmrg      fi
9934456fccdSmrg      if test "$compiler_c_o" = yes; then
9944456fccdSmrg	command="$command -o $obj"
9954456fccdSmrg      fi
9964456fccdSmrg
9974456fccdSmrg      # Suppress compiler output if we already did a PIC compilation.
9984456fccdSmrg      command="$command$suppress_output"
9994456fccdSmrg      $run $rm "$obj" "$output_obj"
10004456fccdSmrg      $show "$command"
10014456fccdSmrg      if $run eval "$command"; then :
10024456fccdSmrg      else
10034456fccdSmrg	$run $rm $removelist
10044456fccdSmrg	exit $EXIT_FAILURE
10054456fccdSmrg      fi
10064456fccdSmrg
10074456fccdSmrg      if test "$need_locks" = warn &&
10084456fccdSmrg	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
10094456fccdSmrg	$echo "\
10104456fccdSmrg*** ERROR, $lockfile contains:
10114456fccdSmrg`cat $lockfile 2>/dev/null`
10124456fccdSmrg
10134456fccdSmrgbut it should contain:
10144456fccdSmrg$srcfile
10154456fccdSmrg
10164456fccdSmrgThis indicates that another process is trying to use the same
10174456fccdSmrgtemporary object file, and libtool could not work around it because
10184456fccdSmrgyour compiler does not support \`-c' and \`-o' together.  If you
10194456fccdSmrgrepeat this compilation, it may succeed, by chance, but you had better
10204456fccdSmrgavoid parallel builds (make -j) in this platform, or get a better
10214456fccdSmrgcompiler."
10224456fccdSmrg
10234456fccdSmrg	$run $rm $removelist
10244456fccdSmrg	exit $EXIT_FAILURE
10254456fccdSmrg      fi
10264456fccdSmrg
10274456fccdSmrg      # Just move the object if needed
10284456fccdSmrg      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
10294456fccdSmrg	$show "$mv $output_obj $obj"
10304456fccdSmrg	if $run $mv $output_obj $obj; then :
10314456fccdSmrg	else
10324456fccdSmrg	  error=$?
10334456fccdSmrg	  $run $rm $removelist
10344456fccdSmrg	  exit $error
10354456fccdSmrg	fi
10364456fccdSmrg      fi
10374456fccdSmrg
10384456fccdSmrg      # Append the name of the non-PIC object the libtool object file.
10394456fccdSmrg      # Only append if the libtool object file exists.
10404456fccdSmrg      test -z "$run" && cat >> ${libobj}T <<EOF
10414456fccdSmrg# Name of the non-PIC object.
10424456fccdSmrgnon_pic_object='$objname'
10434456fccdSmrg
10444456fccdSmrgEOF
10454456fccdSmrg    else
10464456fccdSmrg      # Append the name of the non-PIC object the libtool object file.
10474456fccdSmrg      # Only append if the libtool object file exists.
10484456fccdSmrg      test -z "$run" && cat >> ${libobj}T <<EOF
10494456fccdSmrg# Name of the non-PIC object.
10504456fccdSmrgnon_pic_object=none
10514456fccdSmrg
10524456fccdSmrgEOF
10534456fccdSmrg    fi
10544456fccdSmrg
10554456fccdSmrg    $run $mv "${libobj}T" "${libobj}"
10564456fccdSmrg
10574456fccdSmrg    # Unlock the critical section if it was locked
10584456fccdSmrg    if test "$need_locks" != no; then
10594456fccdSmrg      $run $rm "$lockfile"
10604456fccdSmrg    fi
10614456fccdSmrg
10624456fccdSmrg    exit $EXIT_SUCCESS
10634456fccdSmrg    ;;
10644456fccdSmrg
10654456fccdSmrg  # libtool link mode
10664456fccdSmrg  link | relink)
10674456fccdSmrg    modename="$modename: link"
10684456fccdSmrg    case $host in
10694456fccdSmrg    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
10704456fccdSmrg      # It is impossible to link a dll without this setting, and
10714456fccdSmrg      # we shouldn't force the makefile maintainer to figure out
10724456fccdSmrg      # which system we are compiling for in order to pass an extra
10734456fccdSmrg      # flag for every libtool invocation.
10744456fccdSmrg      # allow_undefined=no
10754456fccdSmrg
10764456fccdSmrg      # FIXME: Unfortunately, there are problems with the above when trying
10774456fccdSmrg      # to make a dll which has undefined symbols, in which case not
10784456fccdSmrg      # even a static library is built.  For now, we need to specify
10794456fccdSmrg      # -no-undefined on the libtool link line when we can be certain
10804456fccdSmrg      # that all symbols are satisfied, otherwise we get a static library.
10814456fccdSmrg      allow_undefined=yes
10824456fccdSmrg      ;;
10834456fccdSmrg    *)
10844456fccdSmrg      allow_undefined=yes
10854456fccdSmrg      ;;
10864456fccdSmrg    esac
10874456fccdSmrg    libtool_args="$nonopt"
10884456fccdSmrg    base_compile="$nonopt $@"
10894456fccdSmrg    compile_command="$nonopt"
10904456fccdSmrg    finalize_command="$nonopt"
10914456fccdSmrg
10924456fccdSmrg    compile_rpath=
10934456fccdSmrg    finalize_rpath=
10944456fccdSmrg    compile_shlibpath=
10954456fccdSmrg    finalize_shlibpath=
10964456fccdSmrg    convenience=
10974456fccdSmrg    old_convenience=
10984456fccdSmrg    deplibs=
10994456fccdSmrg    old_deplibs=
11004456fccdSmrg    compiler_flags=
11014456fccdSmrg    linker_flags=
11024456fccdSmrg    dllsearchpath=
11034456fccdSmrg    lib_search_path=`pwd`
11044456fccdSmrg    inst_prefix_dir=
11054456fccdSmrg
11064456fccdSmrg    avoid_version=no
11074456fccdSmrg    dlfiles=
11084456fccdSmrg    dlprefiles=
11094456fccdSmrg    dlself=no
11104456fccdSmrg    export_dynamic=no
11114456fccdSmrg    export_symbols=
11124456fccdSmrg    export_symbols_regex=
11134456fccdSmrg    generated=
11144456fccdSmrg    libobjs=
11154456fccdSmrg    ltlibs=
11164456fccdSmrg    module=no
11174456fccdSmrg    no_install=no
11184456fccdSmrg    objs=
11194456fccdSmrg    non_pic_objects=
11204456fccdSmrg    notinst_path= # paths that contain not-installed libtool libraries
11214456fccdSmrg    precious_files_regex=
11224456fccdSmrg    prefer_static_libs=no
11234456fccdSmrg    preload=no
11244456fccdSmrg    prev=
11254456fccdSmrg    prevarg=
11264456fccdSmrg    release=
11274456fccdSmrg    rpath=
11284456fccdSmrg    xrpath=
11294456fccdSmrg    perm_rpath=
11304456fccdSmrg    temp_rpath=
11314456fccdSmrg    thread_safe=no
11324456fccdSmrg    vinfo=
11334456fccdSmrg    vinfo_number=no
11344456fccdSmrg
11354456fccdSmrg    func_infer_tag $base_compile
11364456fccdSmrg
11374456fccdSmrg    # We need to know -static, to get the right output filenames.
11384456fccdSmrg    for arg
11394456fccdSmrg    do
11404456fccdSmrg      case $arg in
11414456fccdSmrg      -all-static | -static)
11424456fccdSmrg	if test "X$arg" = "X-all-static"; then
11434456fccdSmrg	  if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
11444456fccdSmrg	    $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
11454456fccdSmrg	  fi
11464456fccdSmrg	  if test -n "$link_static_flag"; then
11474456fccdSmrg	    dlopen_self=$dlopen_self_static
11484456fccdSmrg	  fi
11494456fccdSmrg	  prefer_static_libs=yes
11504456fccdSmrg	else
11514456fccdSmrg	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
11524456fccdSmrg	    dlopen_self=$dlopen_self_static
11534456fccdSmrg	  fi
11544456fccdSmrg	  prefer_static_libs=built
11554456fccdSmrg	fi
11564456fccdSmrg	build_libtool_libs=no
11574456fccdSmrg	build_old_libs=yes
11584456fccdSmrg	break
11594456fccdSmrg	;;
11604456fccdSmrg      esac
11614456fccdSmrg    done
11624456fccdSmrg
11634456fccdSmrg    # See if our shared archives depend on static archives.
11644456fccdSmrg    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
11654456fccdSmrg
11664456fccdSmrg    # Go through the arguments, transforming them on the way.
11674456fccdSmrg    while test "$#" -gt 0; do
11684456fccdSmrg      arg="$1"
11694456fccdSmrg      shift
11704456fccdSmrg      case $arg in
11714456fccdSmrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
11724456fccdSmrg	qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
11734456fccdSmrg	;;
11744456fccdSmrg      *) qarg=$arg ;;
11754456fccdSmrg      esac
11764456fccdSmrg      libtool_args="$libtool_args $qarg"
11774456fccdSmrg
11784456fccdSmrg      # If the previous option needs an argument, assign it.
11794456fccdSmrg      if test -n "$prev"; then
11804456fccdSmrg	case $prev in
11814456fccdSmrg	output)
11824456fccdSmrg	  compile_command="$compile_command @OUTPUT@"
11834456fccdSmrg	  finalize_command="$finalize_command @OUTPUT@"
11844456fccdSmrg	  ;;
11854456fccdSmrg	esac
11864456fccdSmrg
11874456fccdSmrg	case $prev in
11884456fccdSmrg	dlfiles|dlprefiles)
11894456fccdSmrg	  if test "$preload" = no; then
11904456fccdSmrg	    # Add the symbol object into the linking commands.
11914456fccdSmrg	    compile_command="$compile_command @SYMFILE@"
11924456fccdSmrg	    finalize_command="$finalize_command @SYMFILE@"
11934456fccdSmrg	    preload=yes
11944456fccdSmrg	  fi
11954456fccdSmrg	  case $arg in
11964456fccdSmrg	  *.la | *.lo) ;;  # We handle these cases below.
11974456fccdSmrg	  force)
11984456fccdSmrg	    if test "$dlself" = no; then
11994456fccdSmrg	      dlself=needless
12004456fccdSmrg	      export_dynamic=yes
12014456fccdSmrg	    fi
12024456fccdSmrg	    prev=
12034456fccdSmrg	    continue
12044456fccdSmrg	    ;;
12054456fccdSmrg	  self)
12064456fccdSmrg	    if test "$prev" = dlprefiles; then
12074456fccdSmrg	      dlself=yes
12084456fccdSmrg	    elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
12094456fccdSmrg	      dlself=yes
12104456fccdSmrg	    else
12114456fccdSmrg	      dlself=needless
12124456fccdSmrg	      export_dynamic=yes
12134456fccdSmrg	    fi
12144456fccdSmrg	    prev=
12154456fccdSmrg	    continue
12164456fccdSmrg	    ;;
12174456fccdSmrg	  *)
12184456fccdSmrg	    if test "$prev" = dlfiles; then
12194456fccdSmrg	      dlfiles="$dlfiles $arg"
12204456fccdSmrg	    else
12214456fccdSmrg	      dlprefiles="$dlprefiles $arg"
12224456fccdSmrg	    fi
12234456fccdSmrg	    prev=
12244456fccdSmrg	    continue
12254456fccdSmrg	    ;;
12264456fccdSmrg	  esac
12274456fccdSmrg	  ;;
12284456fccdSmrg	expsyms)
12294456fccdSmrg	  export_symbols="$arg"
12304456fccdSmrg	  if test ! -f "$arg"; then
12314456fccdSmrg	    $echo "$modename: symbol file \`$arg' does not exist"
12324456fccdSmrg	    exit $EXIT_FAILURE
12334456fccdSmrg	  fi
12344456fccdSmrg	  prev=
12354456fccdSmrg	  continue
12364456fccdSmrg	  ;;
12374456fccdSmrg	expsyms_regex)
12384456fccdSmrg	  export_symbols_regex="$arg"
12394456fccdSmrg	  prev=
12404456fccdSmrg	  continue
12414456fccdSmrg	  ;;
12424456fccdSmrg	inst_prefix)
12434456fccdSmrg	  inst_prefix_dir="$arg"
12444456fccdSmrg	  prev=
12454456fccdSmrg	  continue
12464456fccdSmrg	  ;;
12474456fccdSmrg	precious_regex)
12484456fccdSmrg	  precious_files_regex="$arg"
12494456fccdSmrg	  prev=
12504456fccdSmrg	  continue
12514456fccdSmrg	  ;;
12524456fccdSmrg	release)
12534456fccdSmrg	  release="-$arg"
12544456fccdSmrg	  prev=
12554456fccdSmrg	  continue
12564456fccdSmrg	  ;;
12574456fccdSmrg	objectlist)
12584456fccdSmrg	  if test -f "$arg"; then
12594456fccdSmrg	    save_arg=$arg
12604456fccdSmrg	    moreargs=
12614456fccdSmrg	    for fil in `cat $save_arg`
12624456fccdSmrg	    do
12634456fccdSmrg#	      moreargs="$moreargs $fil"
12644456fccdSmrg	      arg=$fil
12654456fccdSmrg	      # A libtool-controlled object.
12664456fccdSmrg
12674456fccdSmrg	      # Check to see that this really is a libtool object.
12684456fccdSmrg	      if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
12694456fccdSmrg		pic_object=
12704456fccdSmrg		non_pic_object=
12714456fccdSmrg
12724456fccdSmrg		# Read the .lo file
12734456fccdSmrg		# If there is no directory component, then add one.
12744456fccdSmrg		case $arg in
12754456fccdSmrg		*/* | *\\*) . $arg ;;
12764456fccdSmrg		*) . ./$arg ;;
12774456fccdSmrg		esac
12784456fccdSmrg
12794456fccdSmrg		if test -z "$pic_object" || \
12804456fccdSmrg		   test -z "$non_pic_object" ||
12814456fccdSmrg		   test "$pic_object" = none && \
12824456fccdSmrg		   test "$non_pic_object" = none; then
12834456fccdSmrg		  $echo "$modename: cannot find name of object for \`$arg'" 1>&2
12844456fccdSmrg		  exit $EXIT_FAILURE
12854456fccdSmrg		fi
12864456fccdSmrg
12874456fccdSmrg		# Extract subdirectory from the argument.
12884456fccdSmrg		xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
12894456fccdSmrg		if test "X$xdir" = "X$arg"; then
12904456fccdSmrg		  xdir=
12914456fccdSmrg		else
12924456fccdSmrg		  xdir="$xdir/"
12934456fccdSmrg		fi
12944456fccdSmrg
12954456fccdSmrg		if test "$pic_object" != none; then
12964456fccdSmrg		  # Prepend the subdirectory the object is found in.
12974456fccdSmrg		  pic_object="$xdir$pic_object"
12984456fccdSmrg
12994456fccdSmrg		  if test "$prev" = dlfiles; then
13004456fccdSmrg		    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
13014456fccdSmrg		      dlfiles="$dlfiles $pic_object"
13024456fccdSmrg		      prev=
13034456fccdSmrg		      continue
13044456fccdSmrg		    else
13054456fccdSmrg		      # If libtool objects are unsupported, then we need to preload.
13064456fccdSmrg		      prev=dlprefiles
13074456fccdSmrg		    fi
13084456fccdSmrg		  fi
13094456fccdSmrg
13104456fccdSmrg		  # CHECK ME:  I think I busted this.  -Ossama
13114456fccdSmrg		  if test "$prev" = dlprefiles; then
13124456fccdSmrg		    # Preload the old-style object.
13134456fccdSmrg		    dlprefiles="$dlprefiles $pic_object"
13144456fccdSmrg		    prev=
13154456fccdSmrg		  fi
13164456fccdSmrg
13174456fccdSmrg		  # A PIC object.
13184456fccdSmrg		  libobjs="$libobjs $pic_object"
13194456fccdSmrg		  arg="$pic_object"
13204456fccdSmrg		fi
13214456fccdSmrg
13224456fccdSmrg		# Non-PIC object.
13234456fccdSmrg		if test "$non_pic_object" != none; then
13244456fccdSmrg		  # Prepend the subdirectory the object is found in.
13254456fccdSmrg		  non_pic_object="$xdir$non_pic_object"
13264456fccdSmrg
13274456fccdSmrg		  # A standard non-PIC object
13284456fccdSmrg		  non_pic_objects="$non_pic_objects $non_pic_object"
13294456fccdSmrg		  if test -z "$pic_object" || test "$pic_object" = none ; then
13304456fccdSmrg		    arg="$non_pic_object"
13314456fccdSmrg		  fi
13324456fccdSmrg		else
13334456fccdSmrg		  # If the PIC object exists, use it instead.
13344456fccdSmrg		  # $xdir was prepended to $pic_object above.
13354456fccdSmrg		  non_pic_object="$pic_object"
13364456fccdSmrg		  non_pic_objects="$non_pic_objects $non_pic_object"
13374456fccdSmrg		fi
13384456fccdSmrg	      else
13394456fccdSmrg		# Only an error if not doing a dry-run.
13404456fccdSmrg		if test -z "$run"; then
13414456fccdSmrg		  $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
13424456fccdSmrg		  exit $EXIT_FAILURE
13434456fccdSmrg		else
13444456fccdSmrg		  # Dry-run case.
13454456fccdSmrg
13464456fccdSmrg		  # Extract subdirectory from the argument.
13474456fccdSmrg		  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
13484456fccdSmrg		  if test "X$xdir" = "X$arg"; then
13494456fccdSmrg		    xdir=
13504456fccdSmrg		  else
13514456fccdSmrg		    xdir="$xdir/"
13524456fccdSmrg		  fi
13534456fccdSmrg
13544456fccdSmrg		  pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
13554456fccdSmrg		  non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
13564456fccdSmrg		  libobjs="$libobjs $pic_object"
13574456fccdSmrg		  non_pic_objects="$non_pic_objects $non_pic_object"
13584456fccdSmrg		fi
13594456fccdSmrg	      fi
13604456fccdSmrg	    done
13614456fccdSmrg	  else
13624456fccdSmrg	    $echo "$modename: link input file \`$save_arg' does not exist"
13634456fccdSmrg	    exit $EXIT_FAILURE
13644456fccdSmrg	  fi
13654456fccdSmrg	  arg=$save_arg
13664456fccdSmrg	  prev=
13674456fccdSmrg	  continue
13684456fccdSmrg	  ;;
13694456fccdSmrg	rpath | xrpath)
13704456fccdSmrg	  # We need an absolute path.
13714456fccdSmrg	  case $arg in
13724456fccdSmrg	  [\\/]* | [A-Za-z]:[\\/]*) ;;
13734456fccdSmrg	  *)
13744456fccdSmrg	    $echo "$modename: only absolute run-paths are allowed" 1>&2
13754456fccdSmrg	    exit $EXIT_FAILURE
13764456fccdSmrg	    ;;
13774456fccdSmrg	  esac
13784456fccdSmrg	  if test "$prev" = rpath; then
13794456fccdSmrg	    case "$rpath " in
13804456fccdSmrg	    *" $arg "*) ;;
13814456fccdSmrg	    *) rpath="$rpath $arg" ;;
13824456fccdSmrg	    esac
13834456fccdSmrg	  else
13844456fccdSmrg	    case "$xrpath " in
13854456fccdSmrg	    *" $arg "*) ;;
13864456fccdSmrg	    *) xrpath="$xrpath $arg" ;;
13874456fccdSmrg	    esac
13884456fccdSmrg	  fi
13894456fccdSmrg	  prev=
13904456fccdSmrg	  continue
13914456fccdSmrg	  ;;
13924456fccdSmrg	xcompiler)
13934456fccdSmrg	  compiler_flags="$compiler_flags $qarg"
13944456fccdSmrg	  prev=
13954456fccdSmrg	  compile_command="$compile_command $qarg"
13964456fccdSmrg	  finalize_command="$finalize_command $qarg"
13974456fccdSmrg	  continue
13984456fccdSmrg	  ;;
13994456fccdSmrg	xlinker)
14004456fccdSmrg	  linker_flags="$linker_flags $qarg"
14014456fccdSmrg	  compiler_flags="$compiler_flags $wl$qarg"
14024456fccdSmrg	  prev=
14034456fccdSmrg	  compile_command="$compile_command $wl$qarg"
14044456fccdSmrg	  finalize_command="$finalize_command $wl$qarg"
14054456fccdSmrg	  continue
14064456fccdSmrg	  ;;
14074456fccdSmrg	xcclinker)
14084456fccdSmrg	  linker_flags="$linker_flags $qarg"
14094456fccdSmrg	  compiler_flags="$compiler_flags $qarg"
14104456fccdSmrg	  prev=
14114456fccdSmrg	  compile_command="$compile_command $qarg"
14124456fccdSmrg	  finalize_command="$finalize_command $qarg"
14134456fccdSmrg	  continue
14144456fccdSmrg	  ;;
14154456fccdSmrg	shrext)
14164456fccdSmrg  	  shrext_cmds="$arg"
14174456fccdSmrg	  prev=
14184456fccdSmrg	  continue
14194456fccdSmrg	  ;;
14204456fccdSmrg	darwin_framework|darwin_framework_skip)
14214456fccdSmrg	  test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
14224456fccdSmrg	  compile_command="$compile_command $arg"
14234456fccdSmrg	  finalize_command="$finalize_command $arg"
14244456fccdSmrg	  prev=
14254456fccdSmrg	  continue
14264456fccdSmrg	  ;;
14274456fccdSmrg	*)
14284456fccdSmrg	  eval "$prev=\"\$arg\""
14294456fccdSmrg	  prev=
14304456fccdSmrg	  continue
14314456fccdSmrg	  ;;
14324456fccdSmrg	esac
14334456fccdSmrg      fi # test -n "$prev"
14344456fccdSmrg
14354456fccdSmrg      prevarg="$arg"
14364456fccdSmrg
14374456fccdSmrg      case $arg in
14384456fccdSmrg      -all-static)
14394456fccdSmrg	if test -n "$link_static_flag"; then
14404456fccdSmrg	  compile_command="$compile_command $link_static_flag"
14414456fccdSmrg	  finalize_command="$finalize_command $link_static_flag"
14424456fccdSmrg	fi
14434456fccdSmrg	continue
14444456fccdSmrg	;;
14454456fccdSmrg
14464456fccdSmrg      -allow-undefined)
14474456fccdSmrg	# FIXME: remove this flag sometime in the future.
14484456fccdSmrg	$echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
14494456fccdSmrg	continue
14504456fccdSmrg	;;
14514456fccdSmrg
14524456fccdSmrg      -avoid-version)
14534456fccdSmrg	avoid_version=yes
14544456fccdSmrg	continue
14554456fccdSmrg	;;
14564456fccdSmrg
14574456fccdSmrg      -dlopen)
14584456fccdSmrg	prev=dlfiles
14594456fccdSmrg	continue
14604456fccdSmrg	;;
14614456fccdSmrg
14624456fccdSmrg      -dlpreopen)
14634456fccdSmrg	prev=dlprefiles
14644456fccdSmrg	continue
14654456fccdSmrg	;;
14664456fccdSmrg
14674456fccdSmrg      -export-dynamic)
14684456fccdSmrg	export_dynamic=yes
14694456fccdSmrg	continue
14704456fccdSmrg	;;
14714456fccdSmrg
14724456fccdSmrg      -export-symbols | -export-symbols-regex)
14734456fccdSmrg	if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
14744456fccdSmrg	  $echo "$modename: more than one -exported-symbols argument is not allowed"
14754456fccdSmrg	  exit $EXIT_FAILURE
14764456fccdSmrg	fi
14774456fccdSmrg	if test "X$arg" = "X-export-symbols"; then
14784456fccdSmrg	  prev=expsyms
14794456fccdSmrg	else
14804456fccdSmrg	  prev=expsyms_regex
14814456fccdSmrg	fi
14824456fccdSmrg	continue
14834456fccdSmrg	;;
14844456fccdSmrg
14854456fccdSmrg      -framework|-arch|-isysroot)
14864456fccdSmrg	case " $CC " in
14874456fccdSmrg	  *" ${arg} ${1} "* | *" ${arg}	${1} "*) 
14884456fccdSmrg		prev=darwin_framework_skip ;;
14894456fccdSmrg	  *) compiler_flags="$compiler_flags $arg"
14904456fccdSmrg	     prev=darwin_framework ;;
14914456fccdSmrg	esac
14924456fccdSmrg	compile_command="$compile_command $arg"
14934456fccdSmrg	finalize_command="$finalize_command $arg"
14944456fccdSmrg	continue
14954456fccdSmrg	;;
14964456fccdSmrg
14974456fccdSmrg      -inst-prefix-dir)
14984456fccdSmrg	prev=inst_prefix
14994456fccdSmrg	continue
15004456fccdSmrg	;;
15014456fccdSmrg
15024456fccdSmrg      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
15034456fccdSmrg      # so, if we see these flags be careful not to treat them like -L
15044456fccdSmrg      -L[A-Z][A-Z]*:*)
15054456fccdSmrg	case $with_gcc/$host in
15064456fccdSmrg	no/*-*-irix* | /*-*-irix*)
15074456fccdSmrg	  compile_command="$compile_command $arg"
15084456fccdSmrg	  finalize_command="$finalize_command $arg"
15094456fccdSmrg	  ;;
15104456fccdSmrg	esac
15114456fccdSmrg	continue
15124456fccdSmrg	;;
15134456fccdSmrg
15144456fccdSmrg      -L*)
15154456fccdSmrg	dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
15164456fccdSmrg	# We need an absolute path.
15174456fccdSmrg	case $dir in
15184456fccdSmrg	[\\/]* | [A-Za-z]:[\\/]*) ;;
15194456fccdSmrg	*)
15204456fccdSmrg	  absdir=`cd "$dir" && pwd`
15214456fccdSmrg	  if test -z "$absdir"; then
15224456fccdSmrg	    $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
15234456fccdSmrg	    absdir="$dir"
15244456fccdSmrg	    notinst_path="$notinst_path $dir"
15254456fccdSmrg	  fi
15264456fccdSmrg	  dir="$absdir"
15274456fccdSmrg	  ;;
15284456fccdSmrg	esac
15294456fccdSmrg	case "$deplibs " in
15304456fccdSmrg	*" -L$dir "*) ;;
15314456fccdSmrg	*)
15324456fccdSmrg	  deplibs="$deplibs -L$dir"
15334456fccdSmrg	  lib_search_path="$lib_search_path $dir"
15344456fccdSmrg	  ;;
15354456fccdSmrg	esac
15364456fccdSmrg	case $host in
15374456fccdSmrg	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
15384456fccdSmrg	  testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
15394456fccdSmrg	  case :$dllsearchpath: in
15404456fccdSmrg	  *":$dir:"*) ;;
15414456fccdSmrg	  *) dllsearchpath="$dllsearchpath:$dir";;
15424456fccdSmrg	  esac
15434456fccdSmrg	  case :$dllsearchpath: in
15444456fccdSmrg	  *":$testbindir:"*) ;;
15454456fccdSmrg	  *) dllsearchpath="$dllsearchpath:$testbindir";;
15464456fccdSmrg	  esac
15474456fccdSmrg	  ;;
15484456fccdSmrg	esac
15494456fccdSmrg	continue
15504456fccdSmrg	;;
15514456fccdSmrg
15524456fccdSmrg      -l*)
15534456fccdSmrg	if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
15544456fccdSmrg	  case $host in
15554456fccdSmrg	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
15564456fccdSmrg	    # These systems don't actually have a C or math library (as such)
15574456fccdSmrg	    continue
15584456fccdSmrg	    ;;
15594456fccdSmrg	  *-*-os2*)
15604456fccdSmrg	    # These systems don't actually have a C library (as such)
15614456fccdSmrg	    test "X$arg" = "X-lc" && continue
15624456fccdSmrg	    ;;
15634456fccdSmrg	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
15644456fccdSmrg	    # Do not include libc due to us having libc/libc_r.
15654456fccdSmrg	    test "X$arg" = "X-lc" && continue
15664456fccdSmrg	    ;;
15674456fccdSmrg	  *-*-rhapsody* | *-*-darwin1.[012])
15684456fccdSmrg	    # Rhapsody C and math libraries are in the System framework
15694456fccdSmrg	    deplibs="$deplibs -framework System"
15704456fccdSmrg	    continue
15714456fccdSmrg	    ;;
15724456fccdSmrg	  *-*-sco3.2v5* | *-*-sco5v6*)
15734456fccdSmrg	    # Causes problems with __ctype
15744456fccdSmrg	    test "X$arg" = "X-lc" && continue
15754456fccdSmrg	    ;;
15764456fccdSmrg	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
15774456fccdSmrg	    # Compiler inserts libc in the correct place for threads to work
15784456fccdSmrg	    test "X$arg" = "X-lc" && continue
15794456fccdSmrg	    ;;
15804456fccdSmrg	  esac
15814456fccdSmrg	elif test "X$arg" = "X-lc_r"; then
15824456fccdSmrg	 case $host in
15834456fccdSmrg	 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
15844456fccdSmrg	   # Do not include libc_r directly, use -pthread flag.
15854456fccdSmrg	   continue
15864456fccdSmrg	   ;;
15874456fccdSmrg	 esac
15884456fccdSmrg	fi
15894456fccdSmrg	deplibs="$deplibs $arg"
15904456fccdSmrg	continue
15914456fccdSmrg	;;
15924456fccdSmrg
15934456fccdSmrg      # Tru64 UNIX uses -model [arg] to determine the layout of C++
15944456fccdSmrg      # classes, name mangling, and exception handling.
15954456fccdSmrg      -model)
15964456fccdSmrg	compile_command="$compile_command $arg"
15974456fccdSmrg	compiler_flags="$compiler_flags $arg"
15984456fccdSmrg	finalize_command="$finalize_command $arg"
15994456fccdSmrg	prev=xcompiler
16004456fccdSmrg	continue
16014456fccdSmrg	;;
16024456fccdSmrg
16034456fccdSmrg     -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
16044456fccdSmrg	compiler_flags="$compiler_flags $arg"
16054456fccdSmrg	compile_command="$compile_command $arg"
16064456fccdSmrg	finalize_command="$finalize_command $arg"
16074456fccdSmrg	continue
16084456fccdSmrg	;;
16094456fccdSmrg
16104456fccdSmrg      -module)
16114456fccdSmrg	module=yes
16124456fccdSmrg	continue
16134456fccdSmrg	;;
16144456fccdSmrg
16154456fccdSmrg      # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
16164456fccdSmrg      # -r[0-9][0-9]* specifies the processor on the SGI compiler
16174456fccdSmrg      # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
16184456fccdSmrg      # +DA*, +DD* enable 64-bit mode on the HP compiler
16194456fccdSmrg      # -q* pass through compiler args for the IBM compiler
16204456fccdSmrg      # -m* pass through architecture-specific compiler args for GCC
16214456fccdSmrg      # -m*, -t[45]*, -txscale* pass through architecture-specific
16224456fccdSmrg      # compiler args for GCC
16234456fccdSmrg      # -pg pass through profiling flag for GCC
16244456fccdSmrg      # @file GCC response files
16254456fccdSmrg      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \
16264456fccdSmrg      -t[45]*|-txscale*|@*)
16274456fccdSmrg
16284456fccdSmrg	# Unknown arguments in both finalize_command and compile_command need
16294456fccdSmrg	# to be aesthetically quoted because they are evaled later.
16304456fccdSmrg	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
16314456fccdSmrg	case $arg in
16324456fccdSmrg	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
16334456fccdSmrg	  arg="\"$arg\""
16344456fccdSmrg	  ;;
16354456fccdSmrg	esac
16364456fccdSmrg        compile_command="$compile_command $arg"
16374456fccdSmrg        finalize_command="$finalize_command $arg"
16384456fccdSmrg        compiler_flags="$compiler_flags $arg"
16394456fccdSmrg        continue
16404456fccdSmrg        ;;
16414456fccdSmrg
16424456fccdSmrg      -shrext)
16434456fccdSmrg	prev=shrext
16444456fccdSmrg	continue
16454456fccdSmrg	;;
16464456fccdSmrg
16474456fccdSmrg      -no-fast-install)
16484456fccdSmrg	fast_install=no
16494456fccdSmrg	continue
16504456fccdSmrg	;;
16514456fccdSmrg
16524456fccdSmrg      -no-install)
16534456fccdSmrg	case $host in
16544456fccdSmrg	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
16554456fccdSmrg	  # The PATH hackery in wrapper scripts is required on Windows
16564456fccdSmrg	  # in order for the loader to find any dlls it needs.
16574456fccdSmrg	  $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
16584456fccdSmrg	  $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
16594456fccdSmrg	  fast_install=no
16604456fccdSmrg	  ;;
16614456fccdSmrg	*) no_install=yes ;;
16624456fccdSmrg	esac
16634456fccdSmrg	continue
16644456fccdSmrg	;;
16654456fccdSmrg
16664456fccdSmrg      -no-undefined)
16674456fccdSmrg	allow_undefined=no
16684456fccdSmrg	continue
16694456fccdSmrg	;;
16704456fccdSmrg
16714456fccdSmrg      -objectlist)
16724456fccdSmrg	prev=objectlist
16734456fccdSmrg	continue
16744456fccdSmrg	;;
16754456fccdSmrg
16764456fccdSmrg      -o) prev=output ;;
16774456fccdSmrg
16784456fccdSmrg      -precious-files-regex)
16794456fccdSmrg	prev=precious_regex
16804456fccdSmrg	continue
16814456fccdSmrg	;;
16824456fccdSmrg
16834456fccdSmrg      -release)
16844456fccdSmrg	prev=release
16854456fccdSmrg	continue
16864456fccdSmrg	;;
16874456fccdSmrg
16884456fccdSmrg      -rpath)
16894456fccdSmrg	prev=rpath
16904456fccdSmrg	continue
16914456fccdSmrg	;;
16924456fccdSmrg
16934456fccdSmrg      -R)
16944456fccdSmrg	prev=xrpath
16954456fccdSmrg	continue
16964456fccdSmrg	;;
16974456fccdSmrg
16984456fccdSmrg      -R*)
16994456fccdSmrg	dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
17004456fccdSmrg	# We need an absolute path.
17014456fccdSmrg	case $dir in
17024456fccdSmrg	[\\/]* | [A-Za-z]:[\\/]*) ;;
17034456fccdSmrg	*)
17044456fccdSmrg	  $echo "$modename: only absolute run-paths are allowed" 1>&2
17054456fccdSmrg	  exit $EXIT_FAILURE
17064456fccdSmrg	  ;;
17074456fccdSmrg	esac
17084456fccdSmrg	case "$xrpath " in
17094456fccdSmrg	*" $dir "*) ;;
17104456fccdSmrg	*) xrpath="$xrpath $dir" ;;
17114456fccdSmrg	esac
17124456fccdSmrg	continue
17134456fccdSmrg	;;
17144456fccdSmrg
17154456fccdSmrg      -static)
17164456fccdSmrg	# The effects of -static are defined in a previous loop.
17174456fccdSmrg	# We used to do the same as -all-static on platforms that
17184456fccdSmrg	# didn't have a PIC flag, but the assumption that the effects
17194456fccdSmrg	# would be equivalent was wrong.  It would break on at least
17204456fccdSmrg	# Digital Unix and AIX.
17214456fccdSmrg	continue
17224456fccdSmrg	;;
17234456fccdSmrg
17244456fccdSmrg      -thread-safe)
17254456fccdSmrg	thread_safe=yes
17264456fccdSmrg	continue
17274456fccdSmrg	;;
17284456fccdSmrg
17294456fccdSmrg      -version-info)
17304456fccdSmrg	prev=vinfo
17314456fccdSmrg	continue
17324456fccdSmrg	;;
17334456fccdSmrg      -version-number)
17344456fccdSmrg	prev=vinfo
17354456fccdSmrg	vinfo_number=yes
17364456fccdSmrg	continue
17374456fccdSmrg	;;
17384456fccdSmrg
17394456fccdSmrg      -Wc,*)
17404456fccdSmrg	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
17414456fccdSmrg	arg=
17424456fccdSmrg	save_ifs="$IFS"; IFS=','
17434456fccdSmrg	for flag in $args; do
17444456fccdSmrg	  IFS="$save_ifs"
17454456fccdSmrg	  case $flag in
17464456fccdSmrg	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
17474456fccdSmrg	    flag="\"$flag\""
17484456fccdSmrg	    ;;
17494456fccdSmrg	  esac
17504456fccdSmrg	  arg="$arg $wl$flag"
17514456fccdSmrg	  compiler_flags="$compiler_flags $flag"
17524456fccdSmrg	done
17534456fccdSmrg	IFS="$save_ifs"
17544456fccdSmrg	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
17554456fccdSmrg	;;
17564456fccdSmrg
17574456fccdSmrg      -Wl,*)
17584456fccdSmrg	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
17594456fccdSmrg	arg=
17604456fccdSmrg	save_ifs="$IFS"; IFS=','
17614456fccdSmrg	for flag in $args; do
17624456fccdSmrg	  IFS="$save_ifs"
17634456fccdSmrg	  case $flag in
17644456fccdSmrg	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
17654456fccdSmrg	    flag="\"$flag\""
17664456fccdSmrg	    ;;
17674456fccdSmrg	  esac
17684456fccdSmrg	  arg="$arg $wl$flag"
17694456fccdSmrg	  compiler_flags="$compiler_flags $wl$flag"
17704456fccdSmrg	  linker_flags="$linker_flags $flag"
17714456fccdSmrg	done
17724456fccdSmrg	IFS="$save_ifs"
17734456fccdSmrg	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
17744456fccdSmrg	;;
17754456fccdSmrg
17764456fccdSmrg      -Xcompiler)
17774456fccdSmrg	prev=xcompiler
17784456fccdSmrg	continue
17794456fccdSmrg	;;
17804456fccdSmrg
17814456fccdSmrg      -Xlinker)
17824456fccdSmrg	prev=xlinker
17834456fccdSmrg	continue
17844456fccdSmrg	;;
17854456fccdSmrg
17864456fccdSmrg      -XCClinker)
17874456fccdSmrg	prev=xcclinker
17884456fccdSmrg	continue
17894456fccdSmrg	;;
17904456fccdSmrg
17914456fccdSmrg      # Some other compiler flag.
17924456fccdSmrg      -* | +*)
17934456fccdSmrg	# Unknown arguments in both finalize_command and compile_command need
17944456fccdSmrg	# to be aesthetically quoted because they are evaled later.
17954456fccdSmrg	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
17964456fccdSmrg	case $arg in
17974456fccdSmrg	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
17984456fccdSmrg	  arg="\"$arg\""
17994456fccdSmrg	  ;;
18004456fccdSmrg	esac
18014456fccdSmrg	;;
18024456fccdSmrg
18034456fccdSmrg      *.$objext)
18044456fccdSmrg	# A standard object.
18054456fccdSmrg	objs="$objs $arg"
18064456fccdSmrg	;;
18074456fccdSmrg
18084456fccdSmrg      *.lo)
18094456fccdSmrg	# A libtool-controlled object.
18104456fccdSmrg
18114456fccdSmrg	# Check to see that this really is a libtool object.
18124456fccdSmrg	if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
18134456fccdSmrg	  pic_object=
18144456fccdSmrg	  non_pic_object=
18154456fccdSmrg
18164456fccdSmrg	  # Read the .lo file
18174456fccdSmrg	  # If there is no directory component, then add one.
18184456fccdSmrg	  case $arg in
18194456fccdSmrg	  */* | *\\*) . $arg ;;
18204456fccdSmrg	  *) . ./$arg ;;
18214456fccdSmrg	  esac
18224456fccdSmrg
18234456fccdSmrg	  if test -z "$pic_object" || \
18244456fccdSmrg	     test -z "$non_pic_object" ||
18254456fccdSmrg	     test "$pic_object" = none && \
18264456fccdSmrg	     test "$non_pic_object" = none; then
18274456fccdSmrg	    $echo "$modename: cannot find name of object for \`$arg'" 1>&2
18284456fccdSmrg	    exit $EXIT_FAILURE
18294456fccdSmrg	  fi
18304456fccdSmrg
18314456fccdSmrg	  # Extract subdirectory from the argument.
18324456fccdSmrg	  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
18334456fccdSmrg	  if test "X$xdir" = "X$arg"; then
18344456fccdSmrg	    xdir=
18354456fccdSmrg 	  else
18364456fccdSmrg	    xdir="$xdir/"
18374456fccdSmrg	  fi
18384456fccdSmrg
18394456fccdSmrg	  if test "$pic_object" != none; then
18404456fccdSmrg	    # Prepend the subdirectory the object is found in.
18414456fccdSmrg	    pic_object="$xdir$pic_object"
18424456fccdSmrg
18434456fccdSmrg	    if test "$prev" = dlfiles; then
18444456fccdSmrg	      if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
18454456fccdSmrg		dlfiles="$dlfiles $pic_object"
18464456fccdSmrg		prev=
18474456fccdSmrg		continue
18484456fccdSmrg	      else
18494456fccdSmrg		# If libtool objects are unsupported, then we need to preload.
18504456fccdSmrg		prev=dlprefiles
18514456fccdSmrg	      fi
18524456fccdSmrg	    fi
18534456fccdSmrg
18544456fccdSmrg	    # CHECK ME:  I think I busted this.  -Ossama
18554456fccdSmrg	    if test "$prev" = dlprefiles; then
18564456fccdSmrg	      # Preload the old-style object.
18574456fccdSmrg	      dlprefiles="$dlprefiles $pic_object"
18584456fccdSmrg	      prev=
18594456fccdSmrg	    fi
18604456fccdSmrg
18614456fccdSmrg	    # A PIC object.
18624456fccdSmrg	    libobjs="$libobjs $pic_object"
18634456fccdSmrg	    arg="$pic_object"
18644456fccdSmrg	  fi
18654456fccdSmrg
18664456fccdSmrg	  # Non-PIC object.
18674456fccdSmrg	  if test "$non_pic_object" != none; then
18684456fccdSmrg	    # Prepend the subdirectory the object is found in.
18694456fccdSmrg	    non_pic_object="$xdir$non_pic_object"
18704456fccdSmrg
18714456fccdSmrg	    # A standard non-PIC object
18724456fccdSmrg	    non_pic_objects="$non_pic_objects $non_pic_object"
18734456fccdSmrg	    if test -z "$pic_object" || test "$pic_object" = none ; then
18744456fccdSmrg	      arg="$non_pic_object"
18754456fccdSmrg	    fi
18764456fccdSmrg	  else
18774456fccdSmrg	    # If the PIC object exists, use it instead.
18784456fccdSmrg	    # $xdir was prepended to $pic_object above.
18794456fccdSmrg	    non_pic_object="$pic_object"
18804456fccdSmrg	    non_pic_objects="$non_pic_objects $non_pic_object"
18814456fccdSmrg	  fi
18824456fccdSmrg	else
18834456fccdSmrg	  # Only an error if not doing a dry-run.
18844456fccdSmrg	  if test -z "$run"; then
18854456fccdSmrg	    $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
18864456fccdSmrg	    exit $EXIT_FAILURE
18874456fccdSmrg	  else
18884456fccdSmrg	    # Dry-run case.
18894456fccdSmrg
18904456fccdSmrg	    # Extract subdirectory from the argument.
18914456fccdSmrg	    xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
18924456fccdSmrg	    if test "X$xdir" = "X$arg"; then
18934456fccdSmrg	      xdir=
18944456fccdSmrg	    else
18954456fccdSmrg	      xdir="$xdir/"
18964456fccdSmrg	    fi
18974456fccdSmrg
18984456fccdSmrg	    pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
18994456fccdSmrg	    non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
19004456fccdSmrg	    libobjs="$libobjs $pic_object"
19014456fccdSmrg	    non_pic_objects="$non_pic_objects $non_pic_object"
19024456fccdSmrg	  fi
19034456fccdSmrg	fi
19044456fccdSmrg	;;
19054456fccdSmrg
19064456fccdSmrg      *.$libext)
19074456fccdSmrg	# An archive.
19084456fccdSmrg	deplibs="$deplibs $arg"
19094456fccdSmrg	old_deplibs="$old_deplibs $arg"
19104456fccdSmrg	continue
19114456fccdSmrg	;;
19124456fccdSmrg
19134456fccdSmrg      *.la)
19144456fccdSmrg	# A libtool-controlled library.
19154456fccdSmrg
19164456fccdSmrg	if test "$prev" = dlfiles; then
19174456fccdSmrg	  # This library was specified with -dlopen.
19184456fccdSmrg	  dlfiles="$dlfiles $arg"
19194456fccdSmrg	  prev=
19204456fccdSmrg	elif test "$prev" = dlprefiles; then
19214456fccdSmrg	  # The library was specified with -dlpreopen.
19224456fccdSmrg	  dlprefiles="$dlprefiles $arg"
19234456fccdSmrg	  prev=
19244456fccdSmrg	else
19254456fccdSmrg	  deplibs="$deplibs $arg"
19264456fccdSmrg	fi
19274456fccdSmrg	continue
19284456fccdSmrg	;;
19294456fccdSmrg
19304456fccdSmrg      # Some other compiler argument.
19314456fccdSmrg      *)
19324456fccdSmrg	# Unknown arguments in both finalize_command and compile_command need
19334456fccdSmrg	# to be aesthetically quoted because they are evaled later.
19344456fccdSmrg	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
19354456fccdSmrg	case $arg in
19364456fccdSmrg	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
19374456fccdSmrg	  arg="\"$arg\""
19384456fccdSmrg	  ;;
19394456fccdSmrg	esac
19404456fccdSmrg	;;
19414456fccdSmrg      esac # arg
19424456fccdSmrg
19434456fccdSmrg      # Now actually substitute the argument into the commands.
19444456fccdSmrg      if test -n "$arg"; then
19454456fccdSmrg	compile_command="$compile_command $arg"
19464456fccdSmrg	finalize_command="$finalize_command $arg"
19474456fccdSmrg      fi
19484456fccdSmrg    done # argument parsing loop
19494456fccdSmrg
19504456fccdSmrg    if test -n "$prev"; then
19514456fccdSmrg      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
19524456fccdSmrg      $echo "$help" 1>&2
19534456fccdSmrg      exit $EXIT_FAILURE
19544456fccdSmrg    fi
19554456fccdSmrg
19564456fccdSmrg    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
19574456fccdSmrg      eval arg=\"$export_dynamic_flag_spec\"
19584456fccdSmrg      compile_command="$compile_command $arg"
19594456fccdSmrg      finalize_command="$finalize_command $arg"
19604456fccdSmrg    fi
19614456fccdSmrg
19624456fccdSmrg    oldlibs=
19634456fccdSmrg    # calculate the name of the file, without its directory
19644456fccdSmrg    outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
19654456fccdSmrg    libobjs_save="$libobjs"
19664456fccdSmrg
19674456fccdSmrg    if test -n "$shlibpath_var"; then
19684456fccdSmrg      # get the directories listed in $shlibpath_var
19694456fccdSmrg      eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
19704456fccdSmrg    else
19714456fccdSmrg      shlib_search_path=
19724456fccdSmrg    fi
19734456fccdSmrg    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
19744456fccdSmrg    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
19754456fccdSmrg
19764456fccdSmrg    output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
19774456fccdSmrg    if test "X$output_objdir" = "X$output"; then
19784456fccdSmrg      output_objdir="$objdir"
19794456fccdSmrg    else
19804456fccdSmrg      output_objdir="$output_objdir/$objdir"
19814456fccdSmrg    fi
19824456fccdSmrg    # Create the object directory.
19834456fccdSmrg    if test ! -d "$output_objdir"; then
19844456fccdSmrg      $show "$mkdir $output_objdir"
19854456fccdSmrg      $run $mkdir $output_objdir
19864456fccdSmrg      exit_status=$?
19874456fccdSmrg      if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
19884456fccdSmrg	exit $exit_status
19894456fccdSmrg      fi
19904456fccdSmrg    fi
19914456fccdSmrg
19924456fccdSmrg    # Determine the type of output
19934456fccdSmrg    case $output in
19944456fccdSmrg    "")
19954456fccdSmrg      $echo "$modename: you must specify an output file" 1>&2
19964456fccdSmrg      $echo "$help" 1>&2
19974456fccdSmrg      exit $EXIT_FAILURE
19984456fccdSmrg      ;;
19994456fccdSmrg    *.$libext) linkmode=oldlib ;;
20004456fccdSmrg    *.lo | *.$objext) linkmode=obj ;;
20014456fccdSmrg    *.la) linkmode=lib ;;
20024456fccdSmrg    *) linkmode=prog ;; # Anything else should be a program.
20034456fccdSmrg    esac
20044456fccdSmrg
20054456fccdSmrg    case $host in
20064456fccdSmrg    *cygwin* | *mingw* | *pw32*)
20074456fccdSmrg      # don't eliminate duplications in $postdeps and $predeps
20084456fccdSmrg      duplicate_compiler_generated_deps=yes
20094456fccdSmrg      ;;
20104456fccdSmrg    *)
20114456fccdSmrg      duplicate_compiler_generated_deps=$duplicate_deps
20124456fccdSmrg      ;;
20134456fccdSmrg    esac
20144456fccdSmrg    specialdeplibs=
20154456fccdSmrg
20164456fccdSmrg    libs=
20174456fccdSmrg    # Find all interdependent deplibs by searching for libraries
20184456fccdSmrg    # that are linked more than once (e.g. -la -lb -la)
20194456fccdSmrg    for deplib in $deplibs; do
20204456fccdSmrg      if test "X$duplicate_deps" = "Xyes" ; then
20214456fccdSmrg	case "$libs " in
20224456fccdSmrg	*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
20234456fccdSmrg	esac
20244456fccdSmrg      fi
20254456fccdSmrg      libs="$libs $deplib"
20264456fccdSmrg    done
20274456fccdSmrg
20284456fccdSmrg    if test "$linkmode" = lib; then
20294456fccdSmrg      libs="$predeps $libs $compiler_lib_search_path $postdeps"
20304456fccdSmrg
20314456fccdSmrg      # Compute libraries that are listed more than once in $predeps
20324456fccdSmrg      # $postdeps and mark them as special (i.e., whose duplicates are
20334456fccdSmrg      # not to be eliminated).
20344456fccdSmrg      pre_post_deps=
20354456fccdSmrg      if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
20364456fccdSmrg	for pre_post_dep in $predeps $postdeps; do
20374456fccdSmrg	  case "$pre_post_deps " in
20384456fccdSmrg	  *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
20394456fccdSmrg	  esac
20404456fccdSmrg	  pre_post_deps="$pre_post_deps $pre_post_dep"
20414456fccdSmrg	done
20424456fccdSmrg      fi
20434456fccdSmrg      pre_post_deps=
20444456fccdSmrg    fi
20454456fccdSmrg
20464456fccdSmrg    deplibs=
20474456fccdSmrg    newdependency_libs=
20484456fccdSmrg    newlib_search_path=
20494456fccdSmrg    need_relink=no # whether we're linking any uninstalled libtool libraries
20504456fccdSmrg    notinst_deplibs= # not-installed libtool libraries
20514456fccdSmrg    case $linkmode in
20524456fccdSmrg    lib)
20534456fccdSmrg	passes="conv link"
20544456fccdSmrg	for file in $dlfiles $dlprefiles; do
20554456fccdSmrg	  case $file in
20564456fccdSmrg	  *.la) ;;
20574456fccdSmrg	  *)
20584456fccdSmrg	    $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
20594456fccdSmrg	    exit $EXIT_FAILURE
20604456fccdSmrg	    ;;
20614456fccdSmrg	  esac
20624456fccdSmrg	done
20634456fccdSmrg	;;
20644456fccdSmrg    prog)
20654456fccdSmrg	compile_deplibs=
20664456fccdSmrg	finalize_deplibs=
20674456fccdSmrg	alldeplibs=no
20684456fccdSmrg	newdlfiles=
20694456fccdSmrg	newdlprefiles=
20704456fccdSmrg	passes="conv scan dlopen dlpreopen link"
20714456fccdSmrg	;;
20724456fccdSmrg    *)  passes="conv"
20734456fccdSmrg	;;
20744456fccdSmrg    esac
20754456fccdSmrg    for pass in $passes; do
20764456fccdSmrg      if test "$linkmode,$pass" = "lib,link" ||
20774456fccdSmrg	 test "$linkmode,$pass" = "prog,scan"; then
20784456fccdSmrg	libs="$deplibs"
20794456fccdSmrg	deplibs=
20804456fccdSmrg      fi
20814456fccdSmrg      if test "$linkmode" = prog; then
20824456fccdSmrg	case $pass in
20834456fccdSmrg	dlopen) libs="$dlfiles" ;;
20844456fccdSmrg	dlpreopen) libs="$dlprefiles" ;;
20854456fccdSmrg	link)
20864456fccdSmrg	  libs="$deplibs %DEPLIBS%"
20874456fccdSmrg	  test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
20884456fccdSmrg	  ;;
20894456fccdSmrg	esac
20904456fccdSmrg      fi
20914456fccdSmrg      if test "$pass" = dlopen; then
20924456fccdSmrg	# Collect dlpreopened libraries
20934456fccdSmrg	save_deplibs="$deplibs"
20944456fccdSmrg	deplibs=
20954456fccdSmrg      fi
20964456fccdSmrg      for deplib in $libs; do
20974456fccdSmrg	lib=
20984456fccdSmrg	found=no
20994456fccdSmrg	case $deplib in
21004456fccdSmrg	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
21014456fccdSmrg	  if test "$linkmode,$pass" = "prog,link"; then
21024456fccdSmrg	    compile_deplibs="$deplib $compile_deplibs"
21034456fccdSmrg	    finalize_deplibs="$deplib $finalize_deplibs"
21044456fccdSmrg	  else
21054456fccdSmrg	    compiler_flags="$compiler_flags $deplib"
21064456fccdSmrg	  fi
21074456fccdSmrg	  continue
21084456fccdSmrg	  ;;
21094456fccdSmrg	-l*)
21104456fccdSmrg	  if test "$linkmode" != lib && test "$linkmode" != prog; then
21114456fccdSmrg	    $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
21124456fccdSmrg	    continue
21134456fccdSmrg	  fi
21144456fccdSmrg	  name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
21154456fccdSmrg	  for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
21164456fccdSmrg	    for search_ext in .la $std_shrext .so .a; do
21174456fccdSmrg	      # Search the libtool library
21184456fccdSmrg	      lib="$searchdir/lib${name}${search_ext}"
21194456fccdSmrg	      if test -f "$lib"; then
21204456fccdSmrg		if test "$search_ext" = ".la"; then
21214456fccdSmrg		  found=yes
21224456fccdSmrg		else
21234456fccdSmrg		  found=no
21244456fccdSmrg		fi
21254456fccdSmrg		break 2
21264456fccdSmrg	      fi
21274456fccdSmrg	    done
21284456fccdSmrg	  done
21294456fccdSmrg	  if test "$found" != yes; then
21304456fccdSmrg	    # deplib doesn't seem to be a libtool library
21314456fccdSmrg	    if test "$linkmode,$pass" = "prog,link"; then
21324456fccdSmrg	      compile_deplibs="$deplib $compile_deplibs"
21334456fccdSmrg	      finalize_deplibs="$deplib $finalize_deplibs"
21344456fccdSmrg	    else
21354456fccdSmrg	      deplibs="$deplib $deplibs"
21364456fccdSmrg	      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
21374456fccdSmrg	    fi
21384456fccdSmrg	    continue
21394456fccdSmrg	  else # deplib is a libtool library
21404456fccdSmrg	    # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
21414456fccdSmrg	    # We need to do some special things here, and not later.
21424456fccdSmrg	    if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
21434456fccdSmrg	      case " $predeps $postdeps " in
21444456fccdSmrg	      *" $deplib "*)
21454456fccdSmrg		if (${SED} -e '2q' $lib |
21464456fccdSmrg                    grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
21474456fccdSmrg		  library_names=
21484456fccdSmrg		  old_library=
21494456fccdSmrg		  case $lib in
21504456fccdSmrg		  */* | *\\*) . $lib ;;
21514456fccdSmrg		  *) . ./$lib ;;
21524456fccdSmrg		  esac
21534456fccdSmrg		  for l in $old_library $library_names; do
21544456fccdSmrg		    ll="$l"
21554456fccdSmrg		  done
21564456fccdSmrg		  if test "X$ll" = "X$old_library" ; then # only static version available
21574456fccdSmrg		    found=no
21584456fccdSmrg		    ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
21594456fccdSmrg		    test "X$ladir" = "X$lib" && ladir="."
21604456fccdSmrg		    lib=$ladir/$old_library
21614456fccdSmrg		    if test "$linkmode,$pass" = "prog,link"; then
21624456fccdSmrg		      compile_deplibs="$deplib $compile_deplibs"
21634456fccdSmrg		      finalize_deplibs="$deplib $finalize_deplibs"
21644456fccdSmrg		    else
21654456fccdSmrg		      deplibs="$deplib $deplibs"
21664456fccdSmrg		      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
21674456fccdSmrg		    fi
21684456fccdSmrg		    continue
21694456fccdSmrg		  fi
21704456fccdSmrg		fi
21714456fccdSmrg	        ;;
21724456fccdSmrg	      *) ;;
21734456fccdSmrg	      esac
21744456fccdSmrg	    fi
21754456fccdSmrg	  fi
21764456fccdSmrg	  ;; # -l
21774456fccdSmrg	-L*)
21784456fccdSmrg	  case $linkmode in
21794456fccdSmrg	  lib)
21804456fccdSmrg	    deplibs="$deplib $deplibs"
21814456fccdSmrg	    test "$pass" = conv && continue
21824456fccdSmrg	    newdependency_libs="$deplib $newdependency_libs"
21834456fccdSmrg	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
21844456fccdSmrg	    ;;
21854456fccdSmrg	  prog)
21864456fccdSmrg	    if test "$pass" = conv; then
21874456fccdSmrg	      deplibs="$deplib $deplibs"
21884456fccdSmrg	      continue
21894456fccdSmrg	    fi
21904456fccdSmrg	    if test "$pass" = scan; then
21914456fccdSmrg	      deplibs="$deplib $deplibs"
21924456fccdSmrg	    else
21934456fccdSmrg	      compile_deplibs="$deplib $compile_deplibs"
21944456fccdSmrg	      finalize_deplibs="$deplib $finalize_deplibs"
21954456fccdSmrg	    fi
21964456fccdSmrg	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
21974456fccdSmrg	    ;;
21984456fccdSmrg	  *)
21994456fccdSmrg	    $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
22004456fccdSmrg	    ;;
22014456fccdSmrg	  esac # linkmode
22024456fccdSmrg	  continue
22034456fccdSmrg	  ;; # -L
22044456fccdSmrg	-R*)
22054456fccdSmrg	  if test "$pass" = link; then
22064456fccdSmrg	    dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
22074456fccdSmrg	    # Make sure the xrpath contains only unique directories.
22084456fccdSmrg	    case "$xrpath " in
22094456fccdSmrg	    *" $dir "*) ;;
22104456fccdSmrg	    *) xrpath="$xrpath $dir" ;;
22114456fccdSmrg	    esac
22124456fccdSmrg	  fi
22134456fccdSmrg	  deplibs="$deplib $deplibs"
22144456fccdSmrg	  continue
22154456fccdSmrg	  ;;
22164456fccdSmrg	*.la) lib="$deplib" ;;
22174456fccdSmrg	*.$libext)
22184456fccdSmrg	  if test "$pass" = conv; then
22194456fccdSmrg	    deplibs="$deplib $deplibs"
22204456fccdSmrg	    continue
22214456fccdSmrg	  fi
22224456fccdSmrg	  case $linkmode in
22234456fccdSmrg	  lib)
22244456fccdSmrg	    valid_a_lib=no
22254456fccdSmrg	    case $deplibs_check_method in
22264456fccdSmrg	      match_pattern*)
22274456fccdSmrg		set dummy $deplibs_check_method
22284456fccdSmrg	        match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
22294456fccdSmrg		if eval $echo \"$deplib\" 2>/dev/null \
22304456fccdSmrg		    | $SED 10q \
22314456fccdSmrg		    | $EGREP "$match_pattern_regex" > /dev/null; then
22324456fccdSmrg		  valid_a_lib=yes
22334456fccdSmrg		fi
22344456fccdSmrg		;;
22354456fccdSmrg	      pass_all)
22364456fccdSmrg		valid_a_lib=yes
22374456fccdSmrg		;;
22384456fccdSmrg            esac
22394456fccdSmrg	    if test "$valid_a_lib" != yes; then
22404456fccdSmrg	      $echo
22414456fccdSmrg	      $echo "*** Warning: Trying to link with static lib archive $deplib."
22424456fccdSmrg	      $echo "*** I have the capability to make that library automatically link in when"
22434456fccdSmrg	      $echo "*** you link to this library.  But I can only do this if you have a"
22444456fccdSmrg	      $echo "*** shared version of the library, which you do not appear to have"
22454456fccdSmrg	      $echo "*** because the file extensions .$libext of this argument makes me believe"
22464456fccdSmrg	      $echo "*** that it is just a static archive that I should not used here."
22474456fccdSmrg	    else
22484456fccdSmrg	      $echo
22494456fccdSmrg	      $echo "*** Warning: Linking the shared library $output against the"
22504456fccdSmrg	      $echo "*** static library $deplib is not portable!"
22514456fccdSmrg	      deplibs="$deplib $deplibs"
22524456fccdSmrg	    fi
22534456fccdSmrg	    continue
22544456fccdSmrg	    ;;
22554456fccdSmrg	  prog)
22564456fccdSmrg	    if test "$pass" != link; then
22574456fccdSmrg	      deplibs="$deplib $deplibs"
22584456fccdSmrg	    else
22594456fccdSmrg	      compile_deplibs="$deplib $compile_deplibs"
22604456fccdSmrg	      finalize_deplibs="$deplib $finalize_deplibs"
22614456fccdSmrg	    fi
22624456fccdSmrg	    continue
22634456fccdSmrg	    ;;
22644456fccdSmrg	  esac # linkmode
22654456fccdSmrg	  ;; # *.$libext
22664456fccdSmrg	*.lo | *.$objext)
22674456fccdSmrg	  if test "$pass" = conv; then
22684456fccdSmrg	    deplibs="$deplib $deplibs"
22694456fccdSmrg	  elif test "$linkmode" = prog; then
22704456fccdSmrg	    if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
22714456fccdSmrg	      # If there is no dlopen support or we're linking statically,
22724456fccdSmrg	      # we need to preload.
22734456fccdSmrg	      newdlprefiles="$newdlprefiles $deplib"
22744456fccdSmrg	      compile_deplibs="$deplib $compile_deplibs"
22754456fccdSmrg	      finalize_deplibs="$deplib $finalize_deplibs"
22764456fccdSmrg	    else
22774456fccdSmrg	      newdlfiles="$newdlfiles $deplib"
22784456fccdSmrg	    fi
22794456fccdSmrg	  fi
22804456fccdSmrg	  continue
22814456fccdSmrg	  ;;
22824456fccdSmrg	%DEPLIBS%)
22834456fccdSmrg	  alldeplibs=yes
22844456fccdSmrg	  continue
22854456fccdSmrg	  ;;
22864456fccdSmrg	esac # case $deplib
22874456fccdSmrg	if test "$found" = yes || test -f "$lib"; then :
22884456fccdSmrg	else
22894456fccdSmrg	  $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
22904456fccdSmrg	  exit $EXIT_FAILURE
22914456fccdSmrg	fi
22924456fccdSmrg
22934456fccdSmrg	# Check to see that this really is a libtool archive.
22944456fccdSmrg	if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
22954456fccdSmrg	else
22964456fccdSmrg	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
22974456fccdSmrg	  exit $EXIT_FAILURE
22984456fccdSmrg	fi
22994456fccdSmrg
23004456fccdSmrg	ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
23014456fccdSmrg	test "X$ladir" = "X$lib" && ladir="."
23024456fccdSmrg
23034456fccdSmrg	dlname=
23044456fccdSmrg	dlopen=
23054456fccdSmrg	dlpreopen=
23064456fccdSmrg	libdir=
23074456fccdSmrg	library_names=
23084456fccdSmrg	old_library=
23094456fccdSmrg	# If the library was installed with an old release of libtool,
23104456fccdSmrg	# it will not redefine variables installed, or shouldnotlink
23114456fccdSmrg	installed=yes
23124456fccdSmrg	shouldnotlink=no
23134456fccdSmrg	avoidtemprpath=
23144456fccdSmrg
23154456fccdSmrg
23164456fccdSmrg	# Read the .la file
23174456fccdSmrg	case $lib in
23184456fccdSmrg	*/* | *\\*) . $lib ;;
23194456fccdSmrg	*) . ./$lib ;;
23204456fccdSmrg	esac
23214456fccdSmrg
23224456fccdSmrg	if test "$linkmode,$pass" = "lib,link" ||
23234456fccdSmrg	   test "$linkmode,$pass" = "prog,scan" ||
23244456fccdSmrg	   { test "$linkmode" != prog && test "$linkmode" != lib; }; then
23254456fccdSmrg	  test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
23264456fccdSmrg	  test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
23274456fccdSmrg	fi
23284456fccdSmrg
23294456fccdSmrg	if test "$pass" = conv; then
23304456fccdSmrg	  # Only check for convenience libraries
23314456fccdSmrg	  deplibs="$lib $deplibs"
23324456fccdSmrg	  if test -z "$libdir"; then
23334456fccdSmrg	    if test -z "$old_library"; then
23344456fccdSmrg	      $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
23354456fccdSmrg	      exit $EXIT_FAILURE
23364456fccdSmrg	    fi
23374456fccdSmrg	    # It is a libtool convenience library, so add in its objects.
23384456fccdSmrg	    convenience="$convenience $ladir/$objdir/$old_library"
23394456fccdSmrg	    old_convenience="$old_convenience $ladir/$objdir/$old_library"
23404456fccdSmrg	    tmp_libs=
23414456fccdSmrg	    for deplib in $dependency_libs; do
23424456fccdSmrg	      deplibs="$deplib $deplibs"
23434456fccdSmrg              if test "X$duplicate_deps" = "Xyes" ; then
23444456fccdSmrg	        case "$tmp_libs " in
23454456fccdSmrg	        *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
23464456fccdSmrg	        esac
23474456fccdSmrg              fi
23484456fccdSmrg	      tmp_libs="$tmp_libs $deplib"
23494456fccdSmrg	    done
23504456fccdSmrg	  elif test "$linkmode" != prog && test "$linkmode" != lib; then
23514456fccdSmrg	    $echo "$modename: \`$lib' is not a convenience library" 1>&2
23524456fccdSmrg	    exit $EXIT_FAILURE
23534456fccdSmrg	  fi
23544456fccdSmrg	  continue
23554456fccdSmrg	fi # $pass = conv
23564456fccdSmrg
23574456fccdSmrg
23584456fccdSmrg	# Get the name of the library we link against.
23594456fccdSmrg	linklib=
23604456fccdSmrg	for l in $old_library $library_names; do
23614456fccdSmrg	  linklib="$l"
23624456fccdSmrg	done
23634456fccdSmrg	if test -z "$linklib"; then
23644456fccdSmrg	  $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
23654456fccdSmrg	  exit $EXIT_FAILURE
23664456fccdSmrg	fi
23674456fccdSmrg
23684456fccdSmrg	# This library was specified with -dlopen.
23694456fccdSmrg	if test "$pass" = dlopen; then
23704456fccdSmrg	  if test -z "$libdir"; then
23714456fccdSmrg	    $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
23724456fccdSmrg	    exit $EXIT_FAILURE
23734456fccdSmrg	  fi
23744456fccdSmrg	  if test -z "$dlname" ||
23754456fccdSmrg	     test "$dlopen_support" != yes ||
23764456fccdSmrg	     test "$build_libtool_libs" = no; then
23774456fccdSmrg	    # If there is no dlname, no dlopen support or we're linking
23784456fccdSmrg	    # statically, we need to preload.  We also need to preload any
23794456fccdSmrg	    # dependent libraries so libltdl's deplib preloader doesn't
23804456fccdSmrg	    # bomb out in the load deplibs phase.
23814456fccdSmrg	    dlprefiles="$dlprefiles $lib $dependency_libs"
23824456fccdSmrg	  else
23834456fccdSmrg	    newdlfiles="$newdlfiles $lib"
23844456fccdSmrg	  fi
23854456fccdSmrg	  continue
23864456fccdSmrg	fi # $pass = dlopen
23874456fccdSmrg
23884456fccdSmrg	# We need an absolute path.
23894456fccdSmrg	case $ladir in
23904456fccdSmrg	[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
23914456fccdSmrg	*)
23924456fccdSmrg	  abs_ladir=`cd "$ladir" && pwd`
23934456fccdSmrg	  if test -z "$abs_ladir"; then
23944456fccdSmrg	    $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
23954456fccdSmrg	    $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
23964456fccdSmrg	    abs_ladir="$ladir"
23974456fccdSmrg	  fi
23984456fccdSmrg	  ;;
23994456fccdSmrg	esac
24004456fccdSmrg	laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
24014456fccdSmrg
24024456fccdSmrg	# Find the relevant object directory and library name.
24034456fccdSmrg	if test "X$installed" = Xyes; then
24044456fccdSmrg	  if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
24054456fccdSmrg	    $echo "$modename: warning: library \`$lib' was moved." 1>&2
24064456fccdSmrg	    dir="$ladir"
24074456fccdSmrg	    absdir="$abs_ladir"
24084456fccdSmrg	    libdir="$abs_ladir"
24094456fccdSmrg	  else
24104456fccdSmrg	    dir="$libdir"
24114456fccdSmrg	    absdir="$libdir"
24124456fccdSmrg	  fi
24134456fccdSmrg	  test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
24144456fccdSmrg	else
24154456fccdSmrg	  if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
24164456fccdSmrg	    dir="$ladir"
24174456fccdSmrg	    absdir="$abs_ladir"
24184456fccdSmrg	    # Remove this search path later
24194456fccdSmrg	    notinst_path="$notinst_path $abs_ladir"
24204456fccdSmrg	  else
24214456fccdSmrg	    dir="$ladir/$objdir"
24224456fccdSmrg	    absdir="$abs_ladir/$objdir"
24234456fccdSmrg	    # Remove this search path later
24244456fccdSmrg	    notinst_path="$notinst_path $abs_ladir"
24254456fccdSmrg	  fi
24264456fccdSmrg	fi # $installed = yes
24274456fccdSmrg	name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
24284456fccdSmrg
24294456fccdSmrg	# This library was specified with -dlpreopen.
24304456fccdSmrg	if test "$pass" = dlpreopen; then
24314456fccdSmrg	  if test -z "$libdir"; then
24324456fccdSmrg	    $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
24334456fccdSmrg	    exit $EXIT_FAILURE
24344456fccdSmrg	  fi
24354456fccdSmrg	  # Prefer using a static library (so that no silly _DYNAMIC symbols
24364456fccdSmrg	  # are required to link).
24374456fccdSmrg	  if test -n "$old_library"; then
24384456fccdSmrg	    newdlprefiles="$newdlprefiles $dir/$old_library"
24394456fccdSmrg	  # Otherwise, use the dlname, so that lt_dlopen finds it.
24404456fccdSmrg	  elif test -n "$dlname"; then
24414456fccdSmrg	    newdlprefiles="$newdlprefiles $dir/$dlname"
24424456fccdSmrg	  else
24434456fccdSmrg	    newdlprefiles="$newdlprefiles $dir/$linklib"
24444456fccdSmrg	  fi
24454456fccdSmrg	fi # $pass = dlpreopen
24464456fccdSmrg
24474456fccdSmrg	if test -z "$libdir"; then
24484456fccdSmrg	  # Link the convenience library
24494456fccdSmrg	  if test "$linkmode" = lib; then
24504456fccdSmrg	    deplibs="$dir/$old_library $deplibs"
24514456fccdSmrg	  elif test "$linkmode,$pass" = "prog,link"; then
24524456fccdSmrg	    compile_deplibs="$dir/$old_library $compile_deplibs"
24534456fccdSmrg	    finalize_deplibs="$dir/$old_library $finalize_deplibs"
24544456fccdSmrg	  else
24554456fccdSmrg	    deplibs="$lib $deplibs" # used for prog,scan pass
24564456fccdSmrg	  fi
24574456fccdSmrg	  continue
24584456fccdSmrg	fi
24594456fccdSmrg
24604456fccdSmrg
24614456fccdSmrg	if test "$linkmode" = prog && test "$pass" != link; then
24624456fccdSmrg	  newlib_search_path="$newlib_search_path $ladir"
24634456fccdSmrg	  deplibs="$lib $deplibs"
24644456fccdSmrg
24654456fccdSmrg	  linkalldeplibs=no
24664456fccdSmrg	  if test "$link_all_deplibs" != no || test -z "$library_names" ||
24674456fccdSmrg	     test "$build_libtool_libs" = no; then
24684456fccdSmrg	    linkalldeplibs=yes
24694456fccdSmrg	  fi
24704456fccdSmrg
24714456fccdSmrg	  tmp_libs=
24724456fccdSmrg	  for deplib in $dependency_libs; do
24734456fccdSmrg	    case $deplib in
24744456fccdSmrg	    -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
24754456fccdSmrg	    esac
24764456fccdSmrg	    # Need to link against all dependency_libs?
24774456fccdSmrg	    if test "$linkalldeplibs" = yes; then
24784456fccdSmrg	      deplibs="$deplib $deplibs"
24794456fccdSmrg	    else
24804456fccdSmrg	      # Need to hardcode shared library paths
24814456fccdSmrg	      # or/and link against static libraries
24824456fccdSmrg	      newdependency_libs="$deplib $newdependency_libs"
24834456fccdSmrg	    fi
24844456fccdSmrg	    if test "X$duplicate_deps" = "Xyes" ; then
24854456fccdSmrg	      case "$tmp_libs " in
24864456fccdSmrg	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
24874456fccdSmrg	      esac
24884456fccdSmrg	    fi
24894456fccdSmrg	    tmp_libs="$tmp_libs $deplib"
24904456fccdSmrg	  done # for deplib
24914456fccdSmrg	  continue
24924456fccdSmrg	fi # $linkmode = prog...
24934456fccdSmrg
24944456fccdSmrg	if test "$linkmode,$pass" = "prog,link"; then
24954456fccdSmrg	  if test -n "$library_names" &&
24964456fccdSmrg	     { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
24974456fccdSmrg	    # We need to hardcode the library path
24984456fccdSmrg	    if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
24994456fccdSmrg	      # Make sure the rpath contains only unique directories.
25004456fccdSmrg	      case "$temp_rpath " in
25014456fccdSmrg	      *" $dir "*) ;;
25024456fccdSmrg	      *" $absdir "*) ;;
25034456fccdSmrg	      *) temp_rpath="$temp_rpath $absdir" ;;
25044456fccdSmrg	      esac
25054456fccdSmrg	    fi
25064456fccdSmrg
25074456fccdSmrg	    # Hardcode the library path.
25084456fccdSmrg	    # Skip directories that are in the system default run-time
25094456fccdSmrg	    # search path.
25104456fccdSmrg	    case " $sys_lib_dlsearch_path " in
25114456fccdSmrg	    *" $absdir "*) ;;
25124456fccdSmrg	    *)
25134456fccdSmrg	      case "$compile_rpath " in
25144456fccdSmrg	      *" $absdir "*) ;;
25154456fccdSmrg	      *) compile_rpath="$compile_rpath $absdir"
25164456fccdSmrg	      esac
25174456fccdSmrg	      ;;
25184456fccdSmrg	    esac
25194456fccdSmrg	    case " $sys_lib_dlsearch_path " in
25204456fccdSmrg	    *" $libdir "*) ;;
25214456fccdSmrg	    *)
25224456fccdSmrg	      case "$finalize_rpath " in
25234456fccdSmrg	      *" $libdir "*) ;;
25244456fccdSmrg	      *) finalize_rpath="$finalize_rpath $libdir"
25254456fccdSmrg	      esac
25264456fccdSmrg	      ;;
25274456fccdSmrg	    esac
25284456fccdSmrg	  fi # $linkmode,$pass = prog,link...
25294456fccdSmrg
25304456fccdSmrg	  if test "$alldeplibs" = yes &&
25314456fccdSmrg	     { test "$deplibs_check_method" = pass_all ||
25324456fccdSmrg	       { test "$build_libtool_libs" = yes &&
25334456fccdSmrg		 test -n "$library_names"; }; }; then
25344456fccdSmrg	    # We only need to search for static libraries
25354456fccdSmrg	    continue
25364456fccdSmrg	  fi
25374456fccdSmrg	fi
25384456fccdSmrg
25394456fccdSmrg	link_static=no # Whether the deplib will be linked statically
25404456fccdSmrg	use_static_libs=$prefer_static_libs
25414456fccdSmrg	if test "$use_static_libs" = built && test "$installed" = yes ; then
25424456fccdSmrg	  use_static_libs=no
25434456fccdSmrg	fi
25444456fccdSmrg	if test -n "$library_names" &&
25454456fccdSmrg	   { test "$use_static_libs" = no || test -z "$old_library"; }; then
25464456fccdSmrg	  if test "$installed" = no; then
25474456fccdSmrg	    notinst_deplibs="$notinst_deplibs $lib"
25484456fccdSmrg	    need_relink=yes
25494456fccdSmrg	  fi
25504456fccdSmrg	  # This is a shared library
25514456fccdSmrg
25524456fccdSmrg	  # Warn about portability, can't link against -module's on
25534456fccdSmrg	  # some systems (darwin)
25544456fccdSmrg	  if test "$shouldnotlink" = yes && test "$pass" = link ; then
25554456fccdSmrg	    $echo
25564456fccdSmrg	    if test "$linkmode" = prog; then
25574456fccdSmrg	      $echo "*** Warning: Linking the executable $output against the loadable module"
25584456fccdSmrg	    else
25594456fccdSmrg	      $echo "*** Warning: Linking the shared library $output against the loadable module"
25604456fccdSmrg	    fi
25614456fccdSmrg	    $echo "*** $linklib is not portable!"
25624456fccdSmrg	  fi
25634456fccdSmrg	  if test "$linkmode" = lib &&
25644456fccdSmrg	     test "$hardcode_into_libs" = yes; then
25654456fccdSmrg	    # Hardcode the library path.
25664456fccdSmrg	    # Skip directories that are in the system default run-time
25674456fccdSmrg	    # search path.
25684456fccdSmrg	    case " $sys_lib_dlsearch_path " in
25694456fccdSmrg	    *" $absdir "*) ;;
25704456fccdSmrg	    *)
25714456fccdSmrg	      case "$compile_rpath " in
25724456fccdSmrg	      *" $absdir "*) ;;
25734456fccdSmrg	      *) compile_rpath="$compile_rpath $absdir"
25744456fccdSmrg	      esac
25754456fccdSmrg	      ;;
25764456fccdSmrg	    esac
25774456fccdSmrg	    case " $sys_lib_dlsearch_path " in
25784456fccdSmrg	    *" $libdir "*) ;;
25794456fccdSmrg	    *)
25804456fccdSmrg	      case "$finalize_rpath " in
25814456fccdSmrg	      *" $libdir "*) ;;
25824456fccdSmrg	      *) finalize_rpath="$finalize_rpath $libdir"
25834456fccdSmrg	      esac
25844456fccdSmrg	      ;;
25854456fccdSmrg	    esac
25864456fccdSmrg	  fi
25874456fccdSmrg
25884456fccdSmrg	  if test -n "$old_archive_from_expsyms_cmds"; then
25894456fccdSmrg	    # figure out the soname
25904456fccdSmrg	    set dummy $library_names
25914456fccdSmrg	    realname="$2"
25924456fccdSmrg	    shift; shift
25934456fccdSmrg	    libname=`eval \\$echo \"$libname_spec\"`
25944456fccdSmrg	    # use dlname if we got it. it's perfectly good, no?
25954456fccdSmrg	    if test -n "$dlname"; then
25964456fccdSmrg	      soname="$dlname"
25974456fccdSmrg	    elif test -n "$soname_spec"; then
25984456fccdSmrg	      # bleh windows
25994456fccdSmrg	      case $host in
26004456fccdSmrg	      *cygwin* | mingw*)
26014456fccdSmrg		major=`expr $current - $age`
26024456fccdSmrg		versuffix="-$major"
26034456fccdSmrg		;;
26044456fccdSmrg	      esac
26054456fccdSmrg	      eval soname=\"$soname_spec\"
26064456fccdSmrg	    else
26074456fccdSmrg	      soname="$realname"
26084456fccdSmrg	    fi
26094456fccdSmrg
26104456fccdSmrg	    # Make a new name for the extract_expsyms_cmds to use
26114456fccdSmrg	    soroot="$soname"
26124456fccdSmrg	    soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
26134456fccdSmrg	    newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
26144456fccdSmrg
26154456fccdSmrg	    # If the library has no export list, then create one now
26164456fccdSmrg	    if test -f "$output_objdir/$soname-def"; then :
26174456fccdSmrg	    else
26184456fccdSmrg	      $show "extracting exported symbol list from \`$soname'"
26194456fccdSmrg	      save_ifs="$IFS"; IFS='~'
26204456fccdSmrg	      cmds=$extract_expsyms_cmds
26214456fccdSmrg	      for cmd in $cmds; do
26224456fccdSmrg		IFS="$save_ifs"
26234456fccdSmrg		eval cmd=\"$cmd\"
26244456fccdSmrg		$show "$cmd"
26254456fccdSmrg		$run eval "$cmd" || exit $?
26264456fccdSmrg	      done
26274456fccdSmrg	      IFS="$save_ifs"
26284456fccdSmrg	    fi
26294456fccdSmrg
26304456fccdSmrg	    # Create $newlib
26314456fccdSmrg	    if test -f "$output_objdir/$newlib"; then :; else
26324456fccdSmrg	      $show "generating import library for \`$soname'"
26334456fccdSmrg	      save_ifs="$IFS"; IFS='~'
26344456fccdSmrg	      cmds=$old_archive_from_expsyms_cmds
26354456fccdSmrg	      for cmd in $cmds; do
26364456fccdSmrg		IFS="$save_ifs"
26374456fccdSmrg		eval cmd=\"$cmd\"
26384456fccdSmrg		$show "$cmd"
26394456fccdSmrg		$run eval "$cmd" || exit $?
26404456fccdSmrg	      done
26414456fccdSmrg	      IFS="$save_ifs"
26424456fccdSmrg	    fi
26434456fccdSmrg	    # make sure the library variables are pointing to the new library
26444456fccdSmrg	    dir=$output_objdir
26454456fccdSmrg	    linklib=$newlib
26464456fccdSmrg	  fi # test -n "$old_archive_from_expsyms_cmds"
26474456fccdSmrg
26484456fccdSmrg	  if test "$linkmode" = prog || test "$mode" != relink; then
26494456fccdSmrg	    add_shlibpath=
26504456fccdSmrg	    add_dir=
26514456fccdSmrg	    add=
26524456fccdSmrg	    lib_linked=yes
26534456fccdSmrg	    case $hardcode_action in
26544456fccdSmrg	    immediate | unsupported)
26554456fccdSmrg	      if test "$hardcode_direct" = no; then
26564456fccdSmrg		add="$dir/$linklib"
26574456fccdSmrg		case $host in
26584456fccdSmrg		  *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
26594456fccdSmrg		  *-*-sysv4*uw2*) add_dir="-L$dir" ;;
26604456fccdSmrg		  *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
26614456fccdSmrg		    *-*-unixware7*) add_dir="-L$dir" ;;
26624456fccdSmrg		  *-*-darwin* )
26634456fccdSmrg		    # if the lib is a module then we can not link against
26644456fccdSmrg		    # it, someone is ignoring the new warnings I added
26654456fccdSmrg		    if /usr/bin/file -L $add 2> /dev/null |
26664456fccdSmrg                      $EGREP ": [^:]* bundle" >/dev/null ; then
26674456fccdSmrg		      $echo "** Warning, lib $linklib is a module, not a shared library"
26684456fccdSmrg		      if test -z "$old_library" ; then
26694456fccdSmrg		        $echo
26704456fccdSmrg		        $echo "** And there doesn't seem to be a static archive available"
26714456fccdSmrg		        $echo "** The link will probably fail, sorry"
26724456fccdSmrg		      else
26734456fccdSmrg		        add="$dir/$old_library"
26744456fccdSmrg		      fi
26754456fccdSmrg		    fi
26764456fccdSmrg		esac
26774456fccdSmrg	      elif test "$hardcode_minus_L" = no; then
26784456fccdSmrg		case $host in
26794456fccdSmrg		*-*-sunos*) add_shlibpath="$dir" ;;
26804456fccdSmrg		esac
26814456fccdSmrg		add_dir="-L$dir"
26824456fccdSmrg		add="-l$name"
26834456fccdSmrg	      elif test "$hardcode_shlibpath_var" = no; then
26844456fccdSmrg		add_shlibpath="$dir"
26854456fccdSmrg		add="-l$name"
26864456fccdSmrg	      else
26874456fccdSmrg		lib_linked=no
26884456fccdSmrg	      fi
26894456fccdSmrg	      ;;
26904456fccdSmrg	    relink)
26914456fccdSmrg	      if test "$hardcode_direct" = yes; then
26924456fccdSmrg		add="$dir/$linklib"
26934456fccdSmrg	      elif test "$hardcode_minus_L" = yes; then
26944456fccdSmrg		add_dir="-L$dir"
26954456fccdSmrg		# Try looking first in the location we're being installed to.
26964456fccdSmrg		if test -n "$inst_prefix_dir"; then
26974456fccdSmrg		  case $libdir in
26984456fccdSmrg		    [\\/]*)
26994456fccdSmrg		      add_dir="$add_dir -L$inst_prefix_dir$libdir"
27004456fccdSmrg		      ;;
27014456fccdSmrg		  esac
27024456fccdSmrg		fi
27034456fccdSmrg		add="-l$name"
27044456fccdSmrg	      elif test "$hardcode_shlibpath_var" = yes; then
27054456fccdSmrg		add_shlibpath="$dir"
27064456fccdSmrg		add="-l$name"
27074456fccdSmrg	      else
27084456fccdSmrg		lib_linked=no
27094456fccdSmrg	      fi
27104456fccdSmrg	      ;;
27114456fccdSmrg	    *) lib_linked=no ;;
27124456fccdSmrg	    esac
27134456fccdSmrg
27144456fccdSmrg	    if test "$lib_linked" != yes; then
27154456fccdSmrg	      $echo "$modename: configuration error: unsupported hardcode properties"
27164456fccdSmrg	      exit $EXIT_FAILURE
27174456fccdSmrg	    fi
27184456fccdSmrg
27194456fccdSmrg	    if test -n "$add_shlibpath"; then
27204456fccdSmrg	      case :$compile_shlibpath: in
27214456fccdSmrg	      *":$add_shlibpath:"*) ;;
27224456fccdSmrg	      *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
27234456fccdSmrg	      esac
27244456fccdSmrg	    fi
27254456fccdSmrg	    if test "$linkmode" = prog; then
27264456fccdSmrg	      test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
27274456fccdSmrg	      test -n "$add" && compile_deplibs="$add $compile_deplibs"
27284456fccdSmrg	    else
27294456fccdSmrg	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
27304456fccdSmrg	      test -n "$add" && deplibs="$add $deplibs"
27314456fccdSmrg	      if test "$hardcode_direct" != yes && \
27324456fccdSmrg		 test "$hardcode_minus_L" != yes && \
27334456fccdSmrg		 test "$hardcode_shlibpath_var" = yes; then
27344456fccdSmrg		case :$finalize_shlibpath: in
27354456fccdSmrg		*":$libdir:"*) ;;
27364456fccdSmrg		*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
27374456fccdSmrg		esac
27384456fccdSmrg	      fi
27394456fccdSmrg	    fi
27404456fccdSmrg	  fi
27414456fccdSmrg
27424456fccdSmrg	  if test "$linkmode" = prog || test "$mode" = relink; then
27434456fccdSmrg	    add_shlibpath=
27444456fccdSmrg	    add_dir=
27454456fccdSmrg	    add=
27464456fccdSmrg	    # Finalize command for both is simple: just hardcode it.
27474456fccdSmrg	    if test "$hardcode_direct" = yes; then
27484456fccdSmrg	      add="$libdir/$linklib"
27494456fccdSmrg	    elif test "$hardcode_minus_L" = yes; then
27504456fccdSmrg	      add_dir="-L$libdir"
27514456fccdSmrg	      add="-l$name"
27524456fccdSmrg	    elif test "$hardcode_shlibpath_var" = yes; then
27534456fccdSmrg	      case :$finalize_shlibpath: in
27544456fccdSmrg	      *":$libdir:"*) ;;
27554456fccdSmrg	      *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
27564456fccdSmrg	      esac
27574456fccdSmrg	      add="-l$name"
27584456fccdSmrg	    elif test "$hardcode_automatic" = yes; then
27594456fccdSmrg	      if test -n "$inst_prefix_dir" &&
27604456fccdSmrg		 test -f "$inst_prefix_dir$libdir/$linklib" ; then
27614456fccdSmrg	        add="$inst_prefix_dir$libdir/$linklib"
27624456fccdSmrg	      else
27634456fccdSmrg	        add="$libdir/$linklib"
27644456fccdSmrg	      fi
27654456fccdSmrg	    else
27664456fccdSmrg	      # We cannot seem to hardcode it, guess we'll fake it.
27674456fccdSmrg	      add_dir="-L$libdir"
27684456fccdSmrg	      # Try looking first in the location we're being installed to.
27694456fccdSmrg	      if test -n "$inst_prefix_dir"; then
27704456fccdSmrg		case $libdir in
27714456fccdSmrg		  [\\/]*)
27724456fccdSmrg		    add_dir="$add_dir -L$inst_prefix_dir$libdir"
27734456fccdSmrg		    ;;
27744456fccdSmrg		esac
27754456fccdSmrg	      fi
27764456fccdSmrg	      add="-l$name"
27774456fccdSmrg	    fi
27784456fccdSmrg
27794456fccdSmrg	    if test "$linkmode" = prog; then
27804456fccdSmrg	      test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
27814456fccdSmrg	      test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
27824456fccdSmrg	    else
27834456fccdSmrg	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
27844456fccdSmrg	      test -n "$add" && deplibs="$add $deplibs"
27854456fccdSmrg	    fi
27864456fccdSmrg	  fi
27874456fccdSmrg	elif test "$linkmode" = prog; then
27884456fccdSmrg	  # Here we assume that one of hardcode_direct or hardcode_minus_L
27894456fccdSmrg	  # is not unsupported.  This is valid on all known static and
27904456fccdSmrg	  # shared platforms.
27914456fccdSmrg	  if test "$hardcode_direct" != unsupported; then
27924456fccdSmrg	    test -n "$old_library" && linklib="$old_library"
27934456fccdSmrg	    compile_deplibs="$dir/$linklib $compile_deplibs"
27944456fccdSmrg	    finalize_deplibs="$dir/$linklib $finalize_deplibs"
27954456fccdSmrg	  else
27964456fccdSmrg	    compile_deplibs="-l$name -L$dir $compile_deplibs"
27974456fccdSmrg	    finalize_deplibs="-l$name -L$dir $finalize_deplibs"
27984456fccdSmrg	  fi
27994456fccdSmrg	elif test "$build_libtool_libs" = yes; then
28004456fccdSmrg	  # Not a shared library
28014456fccdSmrg	  if test "$deplibs_check_method" != pass_all; then
28024456fccdSmrg	    # We're trying link a shared library against a static one
28034456fccdSmrg	    # but the system doesn't support it.
28044456fccdSmrg
28054456fccdSmrg	    # Just print a warning and add the library to dependency_libs so
28064456fccdSmrg	    # that the program can be linked against the static library.
28074456fccdSmrg	    $echo
28084456fccdSmrg	    $echo "*** Warning: This system can not link to static lib archive $lib."
28094456fccdSmrg	    $echo "*** I have the capability to make that library automatically link in when"
28104456fccdSmrg	    $echo "*** you link to this library.  But I can only do this if you have a"
28114456fccdSmrg	    $echo "*** shared version of the library, which you do not appear to have."
28124456fccdSmrg	    if test "$module" = yes; then
28134456fccdSmrg	      $echo "*** But as you try to build a module library, libtool will still create "
28144456fccdSmrg	      $echo "*** a static module, that should work as long as the dlopening application"
28154456fccdSmrg	      $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
28164456fccdSmrg	      if test -z "$global_symbol_pipe"; then
28174456fccdSmrg		$echo
28184456fccdSmrg		$echo "*** However, this would only work if libtool was able to extract symbol"
28194456fccdSmrg		$echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
28204456fccdSmrg		$echo "*** not find such a program.  So, this module is probably useless."
28214456fccdSmrg		$echo "*** \`nm' from GNU binutils and a full rebuild may help."
28224456fccdSmrg	      fi
28234456fccdSmrg	      if test "$build_old_libs" = no; then
28244456fccdSmrg		build_libtool_libs=module
28254456fccdSmrg		build_old_libs=yes
28264456fccdSmrg	      else
28274456fccdSmrg		build_libtool_libs=no
28284456fccdSmrg	      fi
28294456fccdSmrg	    fi
28304456fccdSmrg	  else
28314456fccdSmrg	    deplibs="$dir/$old_library $deplibs"
28324456fccdSmrg	    link_static=yes
28334456fccdSmrg	  fi
28344456fccdSmrg	fi # link shared/static library?
28354456fccdSmrg
28364456fccdSmrg	if test "$linkmode" = lib; then
28374456fccdSmrg	  if test -n "$dependency_libs" &&
28384456fccdSmrg	     { test "$hardcode_into_libs" != yes ||
28394456fccdSmrg	       test "$build_old_libs" = yes ||
28404456fccdSmrg	       test "$link_static" = yes; }; then
28414456fccdSmrg	    # Extract -R from dependency_libs
28424456fccdSmrg	    temp_deplibs=
28434456fccdSmrg	    for libdir in $dependency_libs; do
28444456fccdSmrg	      case $libdir in
28454456fccdSmrg	      -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
28464456fccdSmrg		   case " $xrpath " in
28474456fccdSmrg		   *" $temp_xrpath "*) ;;
28484456fccdSmrg		   *) xrpath="$xrpath $temp_xrpath";;
28494456fccdSmrg		   esac;;
28504456fccdSmrg	      *) temp_deplibs="$temp_deplibs $libdir";;
28514456fccdSmrg	      esac
28524456fccdSmrg	    done
28534456fccdSmrg	    dependency_libs="$temp_deplibs"
28544456fccdSmrg	  fi
28554456fccdSmrg
28564456fccdSmrg	  newlib_search_path="$newlib_search_path $absdir"
28574456fccdSmrg	  # Link against this library
28584456fccdSmrg	  test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
28594456fccdSmrg	  # ... and its dependency_libs
28604456fccdSmrg	  tmp_libs=
28614456fccdSmrg	  for deplib in $dependency_libs; do
28624456fccdSmrg	    newdependency_libs="$deplib $newdependency_libs"
28634456fccdSmrg	    if test "X$duplicate_deps" = "Xyes" ; then
28644456fccdSmrg	      case "$tmp_libs " in
28654456fccdSmrg	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
28664456fccdSmrg	      esac
28674456fccdSmrg	    fi
28684456fccdSmrg	    tmp_libs="$tmp_libs $deplib"
28694456fccdSmrg	  done
28704456fccdSmrg
28714456fccdSmrg	  if test "$link_all_deplibs" != no; then
28724456fccdSmrg	    # Add the search paths of all dependency libraries
28734456fccdSmrg	    for deplib in $dependency_libs; do
28744456fccdSmrg	      case $deplib in
28754456fccdSmrg	      -L*) path="$deplib" ;;
28764456fccdSmrg	      *.la)
28774456fccdSmrg		dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
28784456fccdSmrg		test "X$dir" = "X$deplib" && dir="."
28794456fccdSmrg		# We need an absolute path.
28804456fccdSmrg		case $dir in
28814456fccdSmrg		[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
28824456fccdSmrg		*)
28834456fccdSmrg		  absdir=`cd "$dir" && pwd`
28844456fccdSmrg		  if test -z "$absdir"; then
28854456fccdSmrg		    $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
28864456fccdSmrg		    absdir="$dir"
28874456fccdSmrg		  fi
28884456fccdSmrg		  ;;
28894456fccdSmrg		esac
28904456fccdSmrg		if grep "^installed=no" $deplib > /dev/null; then
28914456fccdSmrg		  path="$absdir/$objdir"
28924456fccdSmrg		else
28934456fccdSmrg		  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
28944456fccdSmrg		  if test -z "$libdir"; then
28954456fccdSmrg		    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
28964456fccdSmrg		    exit $EXIT_FAILURE
28974456fccdSmrg		  fi
28984456fccdSmrg		  if test "$absdir" != "$libdir"; then
28994456fccdSmrg		    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
29004456fccdSmrg		  fi
29014456fccdSmrg		  path="$absdir"
29024456fccdSmrg		fi
29034456fccdSmrg		depdepl=
29044456fccdSmrg		case $host in
29054456fccdSmrg		*-*-darwin*)
29064456fccdSmrg		  # we do not want to link against static libs,
29074456fccdSmrg		  # but need to link against shared
29084456fccdSmrg		  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
29094456fccdSmrg		  if test -n "$deplibrary_names" ; then
29104456fccdSmrg		    for tmp in $deplibrary_names ; do
29114456fccdSmrg		      depdepl=$tmp
29124456fccdSmrg		    done
29134456fccdSmrg		    if test -f "$path/$depdepl" ; then
29144456fccdSmrg		      depdepl="$path/$depdepl"
29154456fccdSmrg		    fi
29164456fccdSmrg		    # do not add paths which are already there
29174456fccdSmrg		    case " $newlib_search_path " in
29184456fccdSmrg		    *" $path "*) ;;
29194456fccdSmrg		    *) newlib_search_path="$newlib_search_path $path";;
29204456fccdSmrg		    esac
29214456fccdSmrg		  fi
29224456fccdSmrg		  path=""
29234456fccdSmrg		  ;;
29244456fccdSmrg		*)
29254456fccdSmrg		  path="-L$path"
29264456fccdSmrg		  ;;
29274456fccdSmrg		esac
29284456fccdSmrg		;;
29294456fccdSmrg	      -l*)
29304456fccdSmrg		case $host in
29314456fccdSmrg		*-*-darwin*)
29324456fccdSmrg		  # Again, we only want to link against shared libraries
29334456fccdSmrg		  eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
29344456fccdSmrg		  for tmp in $newlib_search_path ; do
29354456fccdSmrg		    if test -f "$tmp/lib$tmp_libs.dylib" ; then
29364456fccdSmrg		      eval depdepl="$tmp/lib$tmp_libs.dylib"
29374456fccdSmrg		      break
29384456fccdSmrg		    fi
29394456fccdSmrg		  done
29404456fccdSmrg		  path=""
29414456fccdSmrg		  ;;
29424456fccdSmrg		*) continue ;;
29434456fccdSmrg		esac
29444456fccdSmrg		;;
29454456fccdSmrg	      *) continue ;;
29464456fccdSmrg	      esac
29474456fccdSmrg	      case " $deplibs " in
29484456fccdSmrg	      *" $path "*) ;;
29494456fccdSmrg	      *) deplibs="$path $deplibs" ;;
29504456fccdSmrg	      esac
29514456fccdSmrg	      case " $deplibs " in
29524456fccdSmrg	      *" $depdepl "*) ;;
29534456fccdSmrg	      *) deplibs="$depdepl $deplibs" ;;
29544456fccdSmrg	      esac
29554456fccdSmrg	    done
29564456fccdSmrg	  fi # link_all_deplibs != no
29574456fccdSmrg	fi # linkmode = lib
29584456fccdSmrg      done # for deplib in $libs
29594456fccdSmrg      dependency_libs="$newdependency_libs"
29604456fccdSmrg      if test "$pass" = dlpreopen; then
29614456fccdSmrg	# Link the dlpreopened libraries before other libraries
29624456fccdSmrg	for deplib in $save_deplibs; do
29634456fccdSmrg	  deplibs="$deplib $deplibs"
29644456fccdSmrg	done
29654456fccdSmrg      fi
29664456fccdSmrg      if test "$pass" != dlopen; then
29674456fccdSmrg	if test "$pass" != conv; then
29684456fccdSmrg	  # Make sure lib_search_path contains only unique directories.
29694456fccdSmrg	  lib_search_path=
29704456fccdSmrg	  for dir in $newlib_search_path; do
29714456fccdSmrg	    case "$lib_search_path " in
29724456fccdSmrg	    *" $dir "*) ;;
29734456fccdSmrg	    *) lib_search_path="$lib_search_path $dir" ;;
29744456fccdSmrg	    esac
29754456fccdSmrg	  done
29764456fccdSmrg	  newlib_search_path=
29774456fccdSmrg	fi
29784456fccdSmrg
29794456fccdSmrg	if test "$linkmode,$pass" != "prog,link"; then
29804456fccdSmrg	  vars="deplibs"
29814456fccdSmrg	else
29824456fccdSmrg	  vars="compile_deplibs finalize_deplibs"
29834456fccdSmrg	fi
29844456fccdSmrg	for var in $vars dependency_libs; do
29854456fccdSmrg	  # Add libraries to $var in reverse order
29864456fccdSmrg	  eval tmp_libs=\"\$$var\"
29874456fccdSmrg	  new_libs=
29884456fccdSmrg	  for deplib in $tmp_libs; do
29894456fccdSmrg	    # FIXME: Pedantically, this is the right thing to do, so
29904456fccdSmrg	    #        that some nasty dependency loop isn't accidentally
29914456fccdSmrg	    #        broken:
29924456fccdSmrg	    #new_libs="$deplib $new_libs"
29934456fccdSmrg	    # Pragmatically, this seems to cause very few problems in
29944456fccdSmrg	    # practice:
29954456fccdSmrg	    case $deplib in
29964456fccdSmrg	    -L*) new_libs="$deplib $new_libs" ;;
29974456fccdSmrg	    -R*) ;;
29984456fccdSmrg	    *)
29994456fccdSmrg	      # And here is the reason: when a library appears more
30004456fccdSmrg	      # than once as an explicit dependence of a library, or
30014456fccdSmrg	      # is implicitly linked in more than once by the
30024456fccdSmrg	      # compiler, it is considered special, and multiple
30034456fccdSmrg	      # occurrences thereof are not removed.  Compare this
30044456fccdSmrg	      # with having the same library being listed as a
30054456fccdSmrg	      # dependency of multiple other libraries: in this case,
30064456fccdSmrg	      # we know (pedantically, we assume) the library does not
30074456fccdSmrg	      # need to be listed more than once, so we keep only the
30084456fccdSmrg	      # last copy.  This is not always right, but it is rare
30094456fccdSmrg	      # enough that we require users that really mean to play
30104456fccdSmrg	      # such unportable linking tricks to link the library
30114456fccdSmrg	      # using -Wl,-lname, so that libtool does not consider it
30124456fccdSmrg	      # for duplicate removal.
30134456fccdSmrg	      case " $specialdeplibs " in
30144456fccdSmrg	      *" $deplib "*) new_libs="$deplib $new_libs" ;;
30154456fccdSmrg	      *)
30164456fccdSmrg		case " $new_libs " in
30174456fccdSmrg		*" $deplib "*) ;;
30184456fccdSmrg		*) new_libs="$deplib $new_libs" ;;
30194456fccdSmrg		esac
30204456fccdSmrg		;;
30214456fccdSmrg	      esac
30224456fccdSmrg	      ;;
30234456fccdSmrg	    esac
30244456fccdSmrg	  done
30254456fccdSmrg	  tmp_libs=
30264456fccdSmrg	  for deplib in $new_libs; do
30274456fccdSmrg	    case $deplib in
30284456fccdSmrg	    -L*)
30294456fccdSmrg	      case " $tmp_libs " in
30304456fccdSmrg	      *" $deplib "*) ;;
30314456fccdSmrg	      *) tmp_libs="$tmp_libs $deplib" ;;
30324456fccdSmrg	      esac
30334456fccdSmrg	      ;;
30344456fccdSmrg	    *) tmp_libs="$tmp_libs $deplib" ;;
30354456fccdSmrg	    esac
30364456fccdSmrg	  done
30374456fccdSmrg	  eval $var=\"$tmp_libs\"
30384456fccdSmrg	done # for var
30394456fccdSmrg      fi
30404456fccdSmrg      # Last step: remove runtime libs from dependency_libs
30414456fccdSmrg      # (they stay in deplibs)
30424456fccdSmrg      tmp_libs=
30434456fccdSmrg      for i in $dependency_libs ; do
30444456fccdSmrg	case " $predeps $postdeps $compiler_lib_search_path " in
30454456fccdSmrg	*" $i "*)
30464456fccdSmrg	  i=""
30474456fccdSmrg	  ;;
30484456fccdSmrg	esac
30494456fccdSmrg	if test -n "$i" ; then
30504456fccdSmrg	  tmp_libs="$tmp_libs $i"
30514456fccdSmrg	fi
30524456fccdSmrg      done
30534456fccdSmrg      dependency_libs=$tmp_libs
30544456fccdSmrg    done # for pass
30554456fccdSmrg    if test "$linkmode" = prog; then
30564456fccdSmrg      dlfiles="$newdlfiles"
30574456fccdSmrg      dlprefiles="$newdlprefiles"
30584456fccdSmrg    fi
30594456fccdSmrg
30604456fccdSmrg    case $linkmode in
30614456fccdSmrg    oldlib)
30624456fccdSmrg      if test -n "$deplibs"; then
30634456fccdSmrg	$echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
30644456fccdSmrg      fi
30654456fccdSmrg
30664456fccdSmrg      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
30674456fccdSmrg	$echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
30684456fccdSmrg      fi
30694456fccdSmrg
30704456fccdSmrg      if test -n "$rpath"; then
30714456fccdSmrg	$echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
30724456fccdSmrg      fi
30734456fccdSmrg
30744456fccdSmrg      if test -n "$xrpath"; then
30754456fccdSmrg	$echo "$modename: warning: \`-R' is ignored for archives" 1>&2
30764456fccdSmrg      fi
30774456fccdSmrg
30784456fccdSmrg      if test -n "$vinfo"; then
30794456fccdSmrg	$echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
30804456fccdSmrg      fi
30814456fccdSmrg
30824456fccdSmrg      if test -n "$release"; then
30834456fccdSmrg	$echo "$modename: warning: \`-release' is ignored for archives" 1>&2
30844456fccdSmrg      fi
30854456fccdSmrg
30864456fccdSmrg      if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
30874456fccdSmrg	$echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
30884456fccdSmrg      fi
30894456fccdSmrg
30904456fccdSmrg      # Now set the variables for building old libraries.
30914456fccdSmrg      build_libtool_libs=no
30924456fccdSmrg      oldlibs="$output"
30934456fccdSmrg      objs="$objs$old_deplibs"
30944456fccdSmrg      ;;
30954456fccdSmrg
30964456fccdSmrg    lib)
30974456fccdSmrg      # Make sure we only generate libraries of the form `libNAME.la'.
30984456fccdSmrg      case $outputname in
30994456fccdSmrg      lib*)
31004456fccdSmrg	name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
31014456fccdSmrg	eval shared_ext=\"$shrext_cmds\"
31024456fccdSmrg	eval libname=\"$libname_spec\"
31034456fccdSmrg	;;
31044456fccdSmrg      *)
31054456fccdSmrg	if test "$module" = no; then
31064456fccdSmrg	  $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
31074456fccdSmrg	  $echo "$help" 1>&2
31084456fccdSmrg	  exit $EXIT_FAILURE
31094456fccdSmrg	fi
31104456fccdSmrg	if test "$need_lib_prefix" != no; then
31114456fccdSmrg	  # Add the "lib" prefix for modules if required
31124456fccdSmrg	  name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
31134456fccdSmrg	  eval shared_ext=\"$shrext_cmds\"
31144456fccdSmrg	  eval libname=\"$libname_spec\"
31154456fccdSmrg	else
31164456fccdSmrg	  libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
31174456fccdSmrg	fi
31184456fccdSmrg	;;
31194456fccdSmrg      esac
31204456fccdSmrg
31214456fccdSmrg      if test -n "$objs"; then
31224456fccdSmrg	if test "$deplibs_check_method" != pass_all; then
31234456fccdSmrg	  $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
31244456fccdSmrg	  exit $EXIT_FAILURE
31254456fccdSmrg	else
31264456fccdSmrg	  $echo
31274456fccdSmrg	  $echo "*** Warning: Linking the shared library $output against the non-libtool"
31284456fccdSmrg	  $echo "*** objects $objs is not portable!"
31294456fccdSmrg	  libobjs="$libobjs $objs"
31304456fccdSmrg	fi
31314456fccdSmrg      fi
31324456fccdSmrg
31334456fccdSmrg      if test "$dlself" != no; then
31344456fccdSmrg	$echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
31354456fccdSmrg      fi
31364456fccdSmrg
31374456fccdSmrg      set dummy $rpath
31384456fccdSmrg      if test "$#" -gt 2; then
31394456fccdSmrg	$echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
31404456fccdSmrg      fi
31414456fccdSmrg      install_libdir="$2"
31424456fccdSmrg
31434456fccdSmrg      oldlibs=
31444456fccdSmrg      if test -z "$rpath"; then
31454456fccdSmrg	if test "$build_libtool_libs" = yes; then
31464456fccdSmrg	  # Building a libtool convenience library.
31474456fccdSmrg	  # Some compilers have problems with a `.al' extension so
31484456fccdSmrg	  # convenience libraries should have the same extension an
31494456fccdSmrg	  # archive normally would.
31504456fccdSmrg	  oldlibs="$output_objdir/$libname.$libext $oldlibs"
31514456fccdSmrg	  build_libtool_libs=convenience
31524456fccdSmrg	  build_old_libs=yes
31534456fccdSmrg	fi
31544456fccdSmrg
31554456fccdSmrg	if test -n "$vinfo"; then
31564456fccdSmrg	  $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
31574456fccdSmrg	fi
31584456fccdSmrg
31594456fccdSmrg	if test -n "$release"; then
31604456fccdSmrg	  $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
31614456fccdSmrg	fi
31624456fccdSmrg      else
31634456fccdSmrg
31644456fccdSmrg	# Parse the version information argument.
31654456fccdSmrg	save_ifs="$IFS"; IFS=':'
31664456fccdSmrg	set dummy $vinfo 0 0 0
31674456fccdSmrg	IFS="$save_ifs"
31684456fccdSmrg
31694456fccdSmrg	if test -n "$8"; then
31704456fccdSmrg	  $echo "$modename: too many parameters to \`-version-info'" 1>&2
31714456fccdSmrg	  $echo "$help" 1>&2
31724456fccdSmrg	  exit $EXIT_FAILURE
31734456fccdSmrg	fi
31744456fccdSmrg
31754456fccdSmrg	# convert absolute version numbers to libtool ages
31764456fccdSmrg	# this retains compatibility with .la files and attempts
31774456fccdSmrg	# to make the code below a bit more comprehensible
31784456fccdSmrg
31794456fccdSmrg	case $vinfo_number in
31804456fccdSmrg	yes)
31814456fccdSmrg	  number_major="$2"
31824456fccdSmrg	  number_minor="$3"
31834456fccdSmrg	  number_revision="$4"
31844456fccdSmrg	  #
31854456fccdSmrg	  # There are really only two kinds -- those that
31864456fccdSmrg	  # use the current revision as the major version
31874456fccdSmrg	  # and those that subtract age and use age as
31884456fccdSmrg	  # a minor version.  But, then there is irix
31894456fccdSmrg	  # which has an extra 1 added just for fun
31904456fccdSmrg	  #
31914456fccdSmrg	  case $version_type in
31924456fccdSmrg	  darwin|linux|osf|windows)
31934456fccdSmrg	    current=`expr $number_major + $number_minor`
31944456fccdSmrg	    age="$number_minor"
31954456fccdSmrg	    revision="$number_revision"
31964456fccdSmrg	    ;;
31974456fccdSmrg	  freebsd-aout|freebsd-elf|sunos)
31984456fccdSmrg	    current="$number_major"
31994456fccdSmrg	    revision="$number_minor"
32004456fccdSmrg	    age="0"
32014456fccdSmrg	    ;;
32024456fccdSmrg	  irix|nonstopux)
32034456fccdSmrg	    current=`expr $number_major + $number_minor - 1`
32044456fccdSmrg	    age="$number_minor"
32054456fccdSmrg	    revision="$number_minor"
32064456fccdSmrg	    ;;
32074456fccdSmrg	  *)
32084456fccdSmrg	    $echo "$modename: unknown library version type \`$version_type'" 1>&2
32094456fccdSmrg	    $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
32104456fccdSmrg	    exit $EXIT_FAILURE
32114456fccdSmrg	    ;;
32124456fccdSmrg	  esac
32134456fccdSmrg	  ;;
32144456fccdSmrg	no)
32154456fccdSmrg	  current="$2"
32164456fccdSmrg	  revision="$3"
32174456fccdSmrg	  age="$4"
32184456fccdSmrg	  ;;
32194456fccdSmrg	esac
32204456fccdSmrg
32214456fccdSmrg	# Check that each of the things are valid numbers.
32224456fccdSmrg	case $current in
32234456fccdSmrg	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]) ;;
32244456fccdSmrg	*)
32254456fccdSmrg	  $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
32264456fccdSmrg	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
32274456fccdSmrg	  exit $EXIT_FAILURE
32284456fccdSmrg	  ;;
32294456fccdSmrg	esac
32304456fccdSmrg
32314456fccdSmrg	case $revision in
32324456fccdSmrg	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]) ;;
32334456fccdSmrg	*)
32344456fccdSmrg	  $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
32354456fccdSmrg	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
32364456fccdSmrg	  exit $EXIT_FAILURE
32374456fccdSmrg	  ;;
32384456fccdSmrg	esac
32394456fccdSmrg
32404456fccdSmrg	case $age in
32414456fccdSmrg	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]) ;;
32424456fccdSmrg	*)
32434456fccdSmrg	  $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
32444456fccdSmrg	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
32454456fccdSmrg	  exit $EXIT_FAILURE
32464456fccdSmrg	  ;;
32474456fccdSmrg	esac
32484456fccdSmrg
32494456fccdSmrg	if test "$age" -gt "$current"; then
32504456fccdSmrg	  $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
32514456fccdSmrg	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
32524456fccdSmrg	  exit $EXIT_FAILURE
32534456fccdSmrg	fi
32544456fccdSmrg
32554456fccdSmrg	# Calculate the version variables.
32564456fccdSmrg	major=
32574456fccdSmrg	versuffix=
32584456fccdSmrg	verstring=
32594456fccdSmrg	case $version_type in
32604456fccdSmrg	none) ;;
32614456fccdSmrg
32624456fccdSmrg	darwin)
32634456fccdSmrg	  # Like Linux, but with the current version available in
32644456fccdSmrg	  # verstring for coding it into the library header
32654456fccdSmrg	  major=.`expr $current - $age`
32664456fccdSmrg	  versuffix="$major.$age.$revision"
32674456fccdSmrg	  # Darwin ld doesn't like 0 for these options...
32684456fccdSmrg	  minor_current=`expr $current + 1`
32694456fccdSmrg	  verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
32704456fccdSmrg	  ;;
32714456fccdSmrg
32724456fccdSmrg	freebsd-aout)
32734456fccdSmrg	  major=".$current"
32744456fccdSmrg	  versuffix=".$current.$revision";
32754456fccdSmrg	  ;;
32764456fccdSmrg
32774456fccdSmrg	freebsd-elf)
32784456fccdSmrg	  major=".$current"
32794456fccdSmrg	  versuffix=".$current";
32804456fccdSmrg	  ;;
32814456fccdSmrg
32824456fccdSmrg	irix | nonstopux)
32834456fccdSmrg	  major=`expr $current - $age + 1`
32844456fccdSmrg
32854456fccdSmrg	  case $version_type in
32864456fccdSmrg	    nonstopux) verstring_prefix=nonstopux ;;
32874456fccdSmrg	    *)         verstring_prefix=sgi ;;
32884456fccdSmrg	  esac
32894456fccdSmrg	  verstring="$verstring_prefix$major.$revision"
32904456fccdSmrg
32914456fccdSmrg	  # Add in all the interfaces that we are compatible with.
32924456fccdSmrg	  loop=$revision
32934456fccdSmrg	  while test "$loop" -ne 0; do
32944456fccdSmrg	    iface=`expr $revision - $loop`
32954456fccdSmrg	    loop=`expr $loop - 1`
32964456fccdSmrg	    verstring="$verstring_prefix$major.$iface:$verstring"
32974456fccdSmrg	  done
32984456fccdSmrg
32994456fccdSmrg	  # Before this point, $major must not contain `.'.
33004456fccdSmrg	  major=.$major
33014456fccdSmrg	  versuffix="$major.$revision"
33024456fccdSmrg	  ;;
33034456fccdSmrg
33044456fccdSmrg	linux)
33054456fccdSmrg	  major=.`expr $current - $age`
33064456fccdSmrg	  versuffix="$major.$age.$revision"
33074456fccdSmrg	  ;;
33084456fccdSmrg
33094456fccdSmrg	osf)
33104456fccdSmrg	  major=.`expr $current - $age`
33114456fccdSmrg	  versuffix=".$current.$age.$revision"
33124456fccdSmrg	  verstring="$current.$age.$revision"
33134456fccdSmrg
33144456fccdSmrg	  # Add in all the interfaces that we are compatible with.
33154456fccdSmrg	  loop=$age
33164456fccdSmrg	  while test "$loop" -ne 0; do
33174456fccdSmrg	    iface=`expr $current - $loop`
33184456fccdSmrg	    loop=`expr $loop - 1`
33194456fccdSmrg	    verstring="$verstring:${iface}.0"
33204456fccdSmrg	  done
33214456fccdSmrg
33224456fccdSmrg	  # Make executables depend on our current version.
33234456fccdSmrg	  verstring="$verstring:${current}.0"
33244456fccdSmrg	  ;;
33254456fccdSmrg
33264456fccdSmrg	sunos)
33274456fccdSmrg	  major=".$current"
33284456fccdSmrg	  versuffix=".$current.$revision"
33294456fccdSmrg	  ;;
33304456fccdSmrg
33314456fccdSmrg	windows)
33324456fccdSmrg	  # Use '-' rather than '.', since we only want one
33334456fccdSmrg	  # extension on DOS 8.3 filesystems.
33344456fccdSmrg	  major=`expr $current - $age`
33354456fccdSmrg	  versuffix="-$major"
33364456fccdSmrg	  ;;
33374456fccdSmrg
33384456fccdSmrg	*)
33394456fccdSmrg	  $echo "$modename: unknown library version type \`$version_type'" 1>&2
33404456fccdSmrg	  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
33414456fccdSmrg	  exit $EXIT_FAILURE
33424456fccdSmrg	  ;;
33434456fccdSmrg	esac
33444456fccdSmrg
33454456fccdSmrg	# Clear the version info if we defaulted, and they specified a release.
33464456fccdSmrg	if test -z "$vinfo" && test -n "$release"; then
33474456fccdSmrg	  major=
33484456fccdSmrg	  case $version_type in
33494456fccdSmrg	  darwin)
33504456fccdSmrg	    # we can't check for "0.0" in archive_cmds due to quoting
33514456fccdSmrg	    # problems, so we reset it completely
33524456fccdSmrg	    verstring=
33534456fccdSmrg	    ;;
33544456fccdSmrg	  *)
33554456fccdSmrg	    verstring="0.0"
33564456fccdSmrg	    ;;
33574456fccdSmrg	  esac
33584456fccdSmrg	  if test "$need_version" = no; then
33594456fccdSmrg	    versuffix=
33604456fccdSmrg	  else
33614456fccdSmrg	    versuffix=".0.0"
33624456fccdSmrg	  fi
33634456fccdSmrg	fi
33644456fccdSmrg
33654456fccdSmrg	# Remove version info from name if versioning should be avoided
33664456fccdSmrg	if test "$avoid_version" = yes && test "$need_version" = no; then
33674456fccdSmrg	  major=
33684456fccdSmrg	  versuffix=
33694456fccdSmrg	  verstring=""
33704456fccdSmrg	fi
33714456fccdSmrg
33724456fccdSmrg	# Check to see if the archive will have undefined symbols.
33734456fccdSmrg	if test "$allow_undefined" = yes; then
33744456fccdSmrg	  if test "$allow_undefined_flag" = unsupported; then
33754456fccdSmrg	    $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
33764456fccdSmrg	    build_libtool_libs=no
33774456fccdSmrg	    build_old_libs=yes
33784456fccdSmrg	  fi
33794456fccdSmrg	else
33804456fccdSmrg	  # Don't allow undefined symbols.
33814456fccdSmrg	  allow_undefined_flag="$no_undefined_flag"
33824456fccdSmrg	fi
33834456fccdSmrg      fi
33844456fccdSmrg
33854456fccdSmrg      if test "$mode" != relink; then
33864456fccdSmrg	# Remove our outputs, but don't remove object files since they
33874456fccdSmrg	# may have been created when compiling PIC objects.
33884456fccdSmrg	removelist=
33894456fccdSmrg	tempremovelist=`$echo "$output_objdir/*"`
33904456fccdSmrg	for p in $tempremovelist; do
33914456fccdSmrg	  case $p in
33924456fccdSmrg	    *.$objext)
33934456fccdSmrg	       ;;
33944456fccdSmrg	    $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
33954456fccdSmrg	       if test "X$precious_files_regex" != "X"; then
33964456fccdSmrg	         if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
33974456fccdSmrg	         then
33984456fccdSmrg		   continue
33994456fccdSmrg		 fi
34004456fccdSmrg	       fi
34014456fccdSmrg	       removelist="$removelist $p"
34024456fccdSmrg	       ;;
34034456fccdSmrg	    *) ;;
34044456fccdSmrg	  esac
34054456fccdSmrg	done
34064456fccdSmrg	if test -n "$removelist"; then
34074456fccdSmrg	  $show "${rm}r $removelist"
34084456fccdSmrg	  $run ${rm}r $removelist
34094456fccdSmrg	fi
34104456fccdSmrg      fi
34114456fccdSmrg
34124456fccdSmrg      # Now set the variables for building old libraries.
34134456fccdSmrg      if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
34144456fccdSmrg	oldlibs="$oldlibs $output_objdir/$libname.$libext"
34154456fccdSmrg
34164456fccdSmrg	# Transform .lo files to .o files.
34174456fccdSmrg	oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
34184456fccdSmrg      fi
34194456fccdSmrg
34204456fccdSmrg      # Eliminate all temporary directories.
34214456fccdSmrg      for path in $notinst_path; do
34224456fccdSmrg	lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
34234456fccdSmrg	deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
34244456fccdSmrg	dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
34254456fccdSmrg      done
34264456fccdSmrg
34274456fccdSmrg      if test -n "$xrpath"; then
34284456fccdSmrg	# If the user specified any rpath flags, then add them.
34294456fccdSmrg	temp_xrpath=
34304456fccdSmrg	for libdir in $xrpath; do
34314456fccdSmrg	  temp_xrpath="$temp_xrpath -R$libdir"
34324456fccdSmrg	  case "$finalize_rpath " in
34334456fccdSmrg	  *" $libdir "*) ;;
34344456fccdSmrg	  *) finalize_rpath="$finalize_rpath $libdir" ;;
34354456fccdSmrg	  esac
34364456fccdSmrg	done
34374456fccdSmrg	if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
34384456fccdSmrg	  dependency_libs="$temp_xrpath $dependency_libs"
34394456fccdSmrg	fi
34404456fccdSmrg      fi
34414456fccdSmrg
34424456fccdSmrg      # Make sure dlfiles contains only unique files that won't be dlpreopened
34434456fccdSmrg      old_dlfiles="$dlfiles"
34444456fccdSmrg      dlfiles=
34454456fccdSmrg      for lib in $old_dlfiles; do
34464456fccdSmrg	case " $dlprefiles $dlfiles " in
34474456fccdSmrg	*" $lib "*) ;;
34484456fccdSmrg	*) dlfiles="$dlfiles $lib" ;;
34494456fccdSmrg	esac
34504456fccdSmrg      done
34514456fccdSmrg
34524456fccdSmrg      # Make sure dlprefiles contains only unique files
34534456fccdSmrg      old_dlprefiles="$dlprefiles"
34544456fccdSmrg      dlprefiles=
34554456fccdSmrg      for lib in $old_dlprefiles; do
34564456fccdSmrg	case "$dlprefiles " in
34574456fccdSmrg	*" $lib "*) ;;
34584456fccdSmrg	*) dlprefiles="$dlprefiles $lib" ;;
34594456fccdSmrg	esac
34604456fccdSmrg      done
34614456fccdSmrg
34624456fccdSmrg      if test "$build_libtool_libs" = yes; then
34634456fccdSmrg	if test -n "$rpath"; then
34644456fccdSmrg	  case $host in
34654456fccdSmrg	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
34664456fccdSmrg	    # these systems don't actually have a c library (as such)!
34674456fccdSmrg	    ;;
34684456fccdSmrg	  *-*-rhapsody* | *-*-darwin1.[012])
34694456fccdSmrg	    # Rhapsody C library is in the System framework
34704456fccdSmrg	    deplibs="$deplibs -framework System"
34714456fccdSmrg	    ;;
34724456fccdSmrg	  *-*-netbsd*)
34734456fccdSmrg	    # Don't link with libc until the a.out ld.so is fixed.
34744456fccdSmrg	    ;;
34754456fccdSmrg	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
34764456fccdSmrg	    # Do not include libc due to us having libc/libc_r.
34774456fccdSmrg	    ;;
34784456fccdSmrg	  *-*-sco3.2v5* | *-*-sco5v6*)
34794456fccdSmrg	    # Causes problems with __ctype
34804456fccdSmrg	    ;;
34814456fccdSmrg	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
34824456fccdSmrg	    # Compiler inserts libc in the correct place for threads to work
34834456fccdSmrg	    ;;
34844456fccdSmrg 	  *)
34854456fccdSmrg	    # Add libc to deplibs on all other systems if necessary.
34864456fccdSmrg	    if test "$build_libtool_need_lc" = "yes"; then
34874456fccdSmrg	      deplibs="$deplibs -lc"
34884456fccdSmrg	    fi
34894456fccdSmrg	    ;;
34904456fccdSmrg	  esac
34914456fccdSmrg	fi
34924456fccdSmrg
34934456fccdSmrg	# Transform deplibs into only deplibs that can be linked in shared.
34944456fccdSmrg	name_save=$name
34954456fccdSmrg	libname_save=$libname
34964456fccdSmrg	release_save=$release
34974456fccdSmrg	versuffix_save=$versuffix
34984456fccdSmrg	major_save=$major
34994456fccdSmrg	# I'm not sure if I'm treating the release correctly.  I think
35004456fccdSmrg	# release should show up in the -l (ie -lgmp5) so we don't want to
35014456fccdSmrg	# add it in twice.  Is that correct?
35024456fccdSmrg	release=""
35034456fccdSmrg	versuffix=""
35044456fccdSmrg	major=""
35054456fccdSmrg	newdeplibs=
35064456fccdSmrg	droppeddeps=no
35074456fccdSmrg	case $deplibs_check_method in
35084456fccdSmrg	pass_all)
35094456fccdSmrg	  # Don't check for shared/static.  Everything works.
35104456fccdSmrg	  # This might be a little naive.  We might want to check
35114456fccdSmrg	  # whether the library exists or not.  But this is on
35124456fccdSmrg	  # osf3 & osf4 and I'm not really sure... Just
35134456fccdSmrg	  # implementing what was already the behavior.
35144456fccdSmrg	  newdeplibs=$deplibs
35154456fccdSmrg	  ;;
35164456fccdSmrg	test_compile)
35174456fccdSmrg	  # This code stresses the "libraries are programs" paradigm to its
35184456fccdSmrg	  # limits. Maybe even breaks it.  We compile a program, linking it
35194456fccdSmrg	  # against the deplibs as a proxy for the library.  Then we can check
35204456fccdSmrg	  # whether they linked in statically or dynamically with ldd.
35214456fccdSmrg	  $rm conftest.c
35224456fccdSmrg	  cat > conftest.c <<EOF
35234456fccdSmrg	  int main() { return 0; }
35244456fccdSmrgEOF
35254456fccdSmrg	  $rm conftest
35264456fccdSmrg	  $LTCC $LTCFLAGS -o conftest conftest.c $deplibs
35274456fccdSmrg	  if test "$?" -eq 0 ; then
35284456fccdSmrg	    ldd_output=`ldd conftest`
35294456fccdSmrg	    for i in $deplibs; do
35304456fccdSmrg	      name=`expr $i : '-l\(.*\)'`
35314456fccdSmrg	      # If $name is empty we are operating on a -L argument.
35324456fccdSmrg              if test "$name" != "" && test "$name" -ne "0"; then
35334456fccdSmrg		if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
35344456fccdSmrg		  case " $predeps $postdeps " in
35354456fccdSmrg		  *" $i "*)
35364456fccdSmrg		    newdeplibs="$newdeplibs $i"
35374456fccdSmrg		    i=""
35384456fccdSmrg		    ;;
35394456fccdSmrg		  esac
35404456fccdSmrg	        fi
35414456fccdSmrg		if test -n "$i" ; then
35424456fccdSmrg		  libname=`eval \\$echo \"$libname_spec\"`
35434456fccdSmrg		  deplib_matches=`eval \\$echo \"$library_names_spec\"`
35444456fccdSmrg		  set dummy $deplib_matches
35454456fccdSmrg		  deplib_match=$2
35464456fccdSmrg		  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
35474456fccdSmrg		    newdeplibs="$newdeplibs $i"
35484456fccdSmrg		  else
35494456fccdSmrg		    droppeddeps=yes
35504456fccdSmrg		    $echo
35514456fccdSmrg		    $echo "*** Warning: dynamic linker does not accept needed library $i."
35524456fccdSmrg		    $echo "*** I have the capability to make that library automatically link in when"
35534456fccdSmrg		    $echo "*** you link to this library.  But I can only do this if you have a"
35544456fccdSmrg		    $echo "*** shared version of the library, which I believe you do not have"
35554456fccdSmrg		    $echo "*** because a test_compile did reveal that the linker did not use it for"
35564456fccdSmrg		    $echo "*** its dynamic dependency list that programs get resolved with at runtime."
35574456fccdSmrg		  fi
35584456fccdSmrg		fi
35594456fccdSmrg	      else
35604456fccdSmrg		newdeplibs="$newdeplibs $i"
35614456fccdSmrg	      fi
35624456fccdSmrg	    done
35634456fccdSmrg	  else
35644456fccdSmrg	    # Error occurred in the first compile.  Let's try to salvage
35654456fccdSmrg	    # the situation: Compile a separate program for each library.
35664456fccdSmrg	    for i in $deplibs; do
35674456fccdSmrg	      name=`expr $i : '-l\(.*\)'`
35684456fccdSmrg	      # If $name is empty we are operating on a -L argument.
35694456fccdSmrg              if test "$name" != "" && test "$name" != "0"; then
35704456fccdSmrg		$rm conftest
35714456fccdSmrg		$LTCC $LTCFLAGS -o conftest conftest.c $i
35724456fccdSmrg		# Did it work?
35734456fccdSmrg		if test "$?" -eq 0 ; then
35744456fccdSmrg		  ldd_output=`ldd conftest`
35754456fccdSmrg		  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
35764456fccdSmrg		    case " $predeps $postdeps " in
35774456fccdSmrg		    *" $i "*)
35784456fccdSmrg		      newdeplibs="$newdeplibs $i"
35794456fccdSmrg		      i=""
35804456fccdSmrg		      ;;
35814456fccdSmrg		    esac
35824456fccdSmrg		  fi
35834456fccdSmrg		  if test -n "$i" ; then
35844456fccdSmrg		    libname=`eval \\$echo \"$libname_spec\"`
35854456fccdSmrg		    deplib_matches=`eval \\$echo \"$library_names_spec\"`
35864456fccdSmrg		    set dummy $deplib_matches
35874456fccdSmrg		    deplib_match=$2
35884456fccdSmrg		    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
35894456fccdSmrg		      newdeplibs="$newdeplibs $i"
35904456fccdSmrg		    else
35914456fccdSmrg		      droppeddeps=yes
35924456fccdSmrg		      $echo
35934456fccdSmrg		      $echo "*** Warning: dynamic linker does not accept needed library $i."
35944456fccdSmrg		      $echo "*** I have the capability to make that library automatically link in when"
35954456fccdSmrg		      $echo "*** you link to this library.  But I can only do this if you have a"
35964456fccdSmrg		      $echo "*** shared version of the library, which you do not appear to have"
35974456fccdSmrg		      $echo "*** because a test_compile did reveal that the linker did not use this one"
35984456fccdSmrg		      $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
35994456fccdSmrg		    fi
36004456fccdSmrg		  fi
36014456fccdSmrg		else
36024456fccdSmrg		  droppeddeps=yes
36034456fccdSmrg		  $echo
36044456fccdSmrg		  $echo "*** Warning!  Library $i is needed by this library but I was not able to"
36054456fccdSmrg		  $echo "***  make it link in!  You will probably need to install it or some"
36064456fccdSmrg		  $echo "*** library that it depends on before this library will be fully"
36074456fccdSmrg		  $echo "*** functional.  Installing it before continuing would be even better."
36084456fccdSmrg		fi
36094456fccdSmrg	      else
36104456fccdSmrg		newdeplibs="$newdeplibs $i"
36114456fccdSmrg	      fi
36124456fccdSmrg	    done
36134456fccdSmrg	  fi
36144456fccdSmrg	  ;;
36154456fccdSmrg	file_magic*)
36164456fccdSmrg	  set dummy $deplibs_check_method
36174456fccdSmrg	  file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
36184456fccdSmrg	  for a_deplib in $deplibs; do
36194456fccdSmrg	    name=`expr $a_deplib : '-l\(.*\)'`
36204456fccdSmrg	    # If $name is empty we are operating on a -L argument.
36214456fccdSmrg            if test "$name" != "" && test  "$name" != "0"; then
36224456fccdSmrg	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
36234456fccdSmrg		case " $predeps $postdeps " in
36244456fccdSmrg		*" $a_deplib "*)
36254456fccdSmrg		  newdeplibs="$newdeplibs $a_deplib"
36264456fccdSmrg		  a_deplib=""
36274456fccdSmrg		  ;;
36284456fccdSmrg		esac
36294456fccdSmrg	      fi
36304456fccdSmrg	      if test -n "$a_deplib" ; then
36314456fccdSmrg		libname=`eval \\$echo \"$libname_spec\"`
36324456fccdSmrg		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
36334456fccdSmrg		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
36344456fccdSmrg		  for potent_lib in $potential_libs; do
36354456fccdSmrg		      # Follow soft links.
36364456fccdSmrg		      if ls -lLd "$potent_lib" 2>/dev/null \
36374456fccdSmrg			 | grep " -> " >/dev/null; then
36384456fccdSmrg			continue
36394456fccdSmrg		      fi
36404456fccdSmrg		      # The statement above tries to avoid entering an
36414456fccdSmrg		      # endless loop below, in case of cyclic links.
36424456fccdSmrg		      # We might still enter an endless loop, since a link
36434456fccdSmrg		      # loop can be closed while we follow links,
36444456fccdSmrg		      # but so what?
36454456fccdSmrg		      potlib="$potent_lib"
36464456fccdSmrg		      while test -h "$potlib" 2>/dev/null; do
36474456fccdSmrg			potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
36484456fccdSmrg			case $potliblink in
36494456fccdSmrg			[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
36504456fccdSmrg			*) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
36514456fccdSmrg			esac
36524456fccdSmrg		      done
36534456fccdSmrg		      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
36544456fccdSmrg			 | ${SED} 10q \
36554456fccdSmrg			 | $EGREP "$file_magic_regex" > /dev/null; then
36564456fccdSmrg			newdeplibs="$newdeplibs $a_deplib"
36574456fccdSmrg			a_deplib=""
36584456fccdSmrg			break 2
36594456fccdSmrg		      fi
36604456fccdSmrg		  done
36614456fccdSmrg		done
36624456fccdSmrg	      fi
36634456fccdSmrg	      if test -n "$a_deplib" ; then
36644456fccdSmrg		droppeddeps=yes
36654456fccdSmrg		$echo
36664456fccdSmrg		$echo "*** Warning: linker path does not have real file for library $a_deplib."
36674456fccdSmrg		$echo "*** I have the capability to make that library automatically link in when"
36684456fccdSmrg		$echo "*** you link to this library.  But I can only do this if you have a"
36694456fccdSmrg		$echo "*** shared version of the library, which you do not appear to have"
36704456fccdSmrg		$echo "*** because I did check the linker path looking for a file starting"
36714456fccdSmrg		if test -z "$potlib" ; then
36724456fccdSmrg		  $echo "*** with $libname but no candidates were found. (...for file magic test)"
36734456fccdSmrg		else
36744456fccdSmrg		  $echo "*** with $libname and none of the candidates passed a file format test"
36754456fccdSmrg		  $echo "*** using a file magic. Last file checked: $potlib"
36764456fccdSmrg		fi
36774456fccdSmrg	      fi
36784456fccdSmrg	    else
36794456fccdSmrg	      # Add a -L argument.
36804456fccdSmrg	      newdeplibs="$newdeplibs $a_deplib"
36814456fccdSmrg	    fi
36824456fccdSmrg	  done # Gone through all deplibs.
36834456fccdSmrg	  ;;
36844456fccdSmrg	match_pattern*)
36854456fccdSmrg	  set dummy $deplibs_check_method
36864456fccdSmrg	  match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
36874456fccdSmrg	  for a_deplib in $deplibs; do
36884456fccdSmrg	    name=`expr $a_deplib : '-l\(.*\)'`
36894456fccdSmrg	    # If $name is empty we are operating on a -L argument.
36904456fccdSmrg	    if test -n "$name" && test "$name" != "0"; then
36914456fccdSmrg	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
36924456fccdSmrg		case " $predeps $postdeps " in
36934456fccdSmrg		*" $a_deplib "*)
36944456fccdSmrg		  newdeplibs="$newdeplibs $a_deplib"
36954456fccdSmrg		  a_deplib=""
36964456fccdSmrg		  ;;
36974456fccdSmrg		esac
36984456fccdSmrg	      fi
36994456fccdSmrg	      if test -n "$a_deplib" ; then
37004456fccdSmrg		libname=`eval \\$echo \"$libname_spec\"`
37014456fccdSmrg		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
37024456fccdSmrg		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
37034456fccdSmrg		  for potent_lib in $potential_libs; do
37044456fccdSmrg		    potlib="$potent_lib" # see symlink-check above in file_magic test
37054456fccdSmrg		    if eval $echo \"$potent_lib\" 2>/dev/null \
37064456fccdSmrg		        | ${SED} 10q \
37074456fccdSmrg		        | $EGREP "$match_pattern_regex" > /dev/null; then
37084456fccdSmrg		      newdeplibs="$newdeplibs $a_deplib"
37094456fccdSmrg		      a_deplib=""
37104456fccdSmrg		      break 2
37114456fccdSmrg		    fi
37124456fccdSmrg		  done
37134456fccdSmrg		done
37144456fccdSmrg	      fi
37154456fccdSmrg	      if test -n "$a_deplib" ; then
37164456fccdSmrg		droppeddeps=yes
37174456fccdSmrg		$echo
37184456fccdSmrg		$echo "*** Warning: linker path does not have real file for library $a_deplib."
37194456fccdSmrg		$echo "*** I have the capability to make that library automatically link in when"
37204456fccdSmrg		$echo "*** you link to this library.  But I can only do this if you have a"
37214456fccdSmrg		$echo "*** shared version of the library, which you do not appear to have"
37224456fccdSmrg		$echo "*** because I did check the linker path looking for a file starting"
37234456fccdSmrg		if test -z "$potlib" ; then
37244456fccdSmrg		  $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
37254456fccdSmrg		else
37264456fccdSmrg		  $echo "*** with $libname and none of the candidates passed a file format test"
37274456fccdSmrg		  $echo "*** using a regex pattern. Last file checked: $potlib"
37284456fccdSmrg		fi
37294456fccdSmrg	      fi
37304456fccdSmrg	    else
37314456fccdSmrg	      # Add a -L argument.
37324456fccdSmrg	      newdeplibs="$newdeplibs $a_deplib"
37334456fccdSmrg	    fi
37344456fccdSmrg	  done # Gone through all deplibs.
37354456fccdSmrg	  ;;
37364456fccdSmrg	none | unknown | *)
37374456fccdSmrg	  newdeplibs=""
37384456fccdSmrg	  tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
37394456fccdSmrg	    -e 's/ -[LR][^ ]*//g'`
37404456fccdSmrg	  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
37414456fccdSmrg	    for i in $predeps $postdeps ; do
37424456fccdSmrg	      # can't use Xsed below, because $i might contain '/'
37434456fccdSmrg	      tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
37444456fccdSmrg	    done
37454456fccdSmrg	  fi
37464456fccdSmrg	  if $echo "X $tmp_deplibs" | $Xsed -e 's/[ 	]//g' \
37474456fccdSmrg	    | grep . >/dev/null; then
37484456fccdSmrg	    $echo
37494456fccdSmrg	    if test "X$deplibs_check_method" = "Xnone"; then
37504456fccdSmrg	      $echo "*** Warning: inter-library dependencies are not supported in this platform."
37514456fccdSmrg	    else
37524456fccdSmrg	      $echo "*** Warning: inter-library dependencies are not known to be supported."
37534456fccdSmrg	    fi
37544456fccdSmrg	    $echo "*** All declared inter-library dependencies are being dropped."
37554456fccdSmrg	    droppeddeps=yes
37564456fccdSmrg	  fi
37574456fccdSmrg	  ;;
37584456fccdSmrg	esac
37594456fccdSmrg	versuffix=$versuffix_save
37604456fccdSmrg	major=$major_save
37614456fccdSmrg	release=$release_save
37624456fccdSmrg	libname=$libname_save
37634456fccdSmrg	name=$name_save
37644456fccdSmrg
37654456fccdSmrg	case $host in
37664456fccdSmrg	*-*-rhapsody* | *-*-darwin1.[012])
37674456fccdSmrg	  # On Rhapsody replace the C library is the System framework
37684456fccdSmrg	  newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
37694456fccdSmrg	  ;;
37704456fccdSmrg	esac
37714456fccdSmrg
37724456fccdSmrg	if test "$droppeddeps" = yes; then
37734456fccdSmrg	  if test "$module" = yes; then
37744456fccdSmrg	    $echo
37754456fccdSmrg	    $echo "*** Warning: libtool could not satisfy all declared inter-library"
37764456fccdSmrg	    $echo "*** dependencies of module $libname.  Therefore, libtool will create"
37774456fccdSmrg	    $echo "*** a static module, that should work as long as the dlopening"
37784456fccdSmrg	    $echo "*** application is linked with the -dlopen flag."
37794456fccdSmrg	    if test -z "$global_symbol_pipe"; then
37804456fccdSmrg	      $echo
37814456fccdSmrg	      $echo "*** However, this would only work if libtool was able to extract symbol"
37824456fccdSmrg	      $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
37834456fccdSmrg	      $echo "*** not find such a program.  So, this module is probably useless."
37844456fccdSmrg	      $echo "*** \`nm' from GNU binutils and a full rebuild may help."
37854456fccdSmrg	    fi
37864456fccdSmrg	    if test "$build_old_libs" = no; then
37874456fccdSmrg	      oldlibs="$output_objdir/$libname.$libext"
37884456fccdSmrg	      build_libtool_libs=module
37894456fccdSmrg	      build_old_libs=yes
37904456fccdSmrg	    else
37914456fccdSmrg	      build_libtool_libs=no
37924456fccdSmrg	    fi
37934456fccdSmrg	  else
37944456fccdSmrg	    $echo "*** The inter-library dependencies that have been dropped here will be"
37954456fccdSmrg	    $echo "*** automatically added whenever a program is linked with this library"
37964456fccdSmrg	    $echo "*** or is declared to -dlopen it."
37974456fccdSmrg
37984456fccdSmrg	    if test "$allow_undefined" = no; then
37994456fccdSmrg	      $echo
38004456fccdSmrg	      $echo "*** Since this library must not contain undefined symbols,"
38014456fccdSmrg	      $echo "*** because either the platform does not support them or"
38024456fccdSmrg	      $echo "*** it was explicitly requested with -no-undefined,"
38034456fccdSmrg	      $echo "*** libtool will only create a static version of it."
38044456fccdSmrg	      if test "$build_old_libs" = no; then
38054456fccdSmrg		oldlibs="$output_objdir/$libname.$libext"
38064456fccdSmrg		build_libtool_libs=module
38074456fccdSmrg		build_old_libs=yes
38084456fccdSmrg	      else
38094456fccdSmrg		build_libtool_libs=no
38104456fccdSmrg	      fi
38114456fccdSmrg	    fi
38124456fccdSmrg	  fi
38134456fccdSmrg	fi
38144456fccdSmrg	# Done checking deplibs!
38154456fccdSmrg	deplibs=$newdeplibs
38164456fccdSmrg      fi
38174456fccdSmrg
38184456fccdSmrg
38194456fccdSmrg      # move library search paths that coincide with paths to not yet
38204456fccdSmrg      # installed libraries to the beginning of the library search list
38214456fccdSmrg      new_libs=
38224456fccdSmrg      for path in $notinst_path; do
38234456fccdSmrg	case " $new_libs " in
38244456fccdSmrg	*" -L$path/$objdir "*) ;;
38254456fccdSmrg	*)
38264456fccdSmrg	  case " $deplibs " in
38274456fccdSmrg	  *" -L$path/$objdir "*)
38284456fccdSmrg	    new_libs="$new_libs -L$path/$objdir" ;;
38294456fccdSmrg	  esac
38304456fccdSmrg	  ;;
38314456fccdSmrg	esac
38324456fccdSmrg      done
38334456fccdSmrg      for deplib in $deplibs; do
38344456fccdSmrg	case $deplib in
38354456fccdSmrg	-L*)
38364456fccdSmrg	  case " $new_libs " in
38374456fccdSmrg	  *" $deplib "*) ;;
38384456fccdSmrg	  *) new_libs="$new_libs $deplib" ;;
38394456fccdSmrg	  esac
38404456fccdSmrg	  ;;
38414456fccdSmrg	*) new_libs="$new_libs $deplib" ;;
38424456fccdSmrg	esac
38434456fccdSmrg      done
38444456fccdSmrg      deplibs="$new_libs"
38454456fccdSmrg
38464456fccdSmrg
38474456fccdSmrg      # All the library-specific variables (install_libdir is set above).
38484456fccdSmrg      library_names=
38494456fccdSmrg      old_library=
38504456fccdSmrg      dlname=
38514456fccdSmrg
38524456fccdSmrg      # Test again, we may have decided not to build it any more
38534456fccdSmrg      if test "$build_libtool_libs" = yes; then
38544456fccdSmrg	if test "$hardcode_into_libs" = yes; then
38554456fccdSmrg	  # Hardcode the library paths
38564456fccdSmrg	  hardcode_libdirs=
38574456fccdSmrg	  dep_rpath=
38584456fccdSmrg	  rpath="$finalize_rpath"
38594456fccdSmrg	  test "$mode" != relink && rpath="$compile_rpath$rpath"
38604456fccdSmrg	  for libdir in $rpath; do
38614456fccdSmrg	    if test -n "$hardcode_libdir_flag_spec"; then
38624456fccdSmrg	      if test -n "$hardcode_libdir_separator"; then
38634456fccdSmrg		if test -z "$hardcode_libdirs"; then
38644456fccdSmrg		  hardcode_libdirs="$libdir"
38654456fccdSmrg		else
38664456fccdSmrg		  # Just accumulate the unique libdirs.
38674456fccdSmrg		  case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
38684456fccdSmrg		  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
38694456fccdSmrg		    ;;
38704456fccdSmrg		  *)
38714456fccdSmrg		    hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
38724456fccdSmrg		    ;;
38734456fccdSmrg		  esac
38744456fccdSmrg		fi
38754456fccdSmrg	      else
38764456fccdSmrg		eval flag=\"$hardcode_libdir_flag_spec\"
38774456fccdSmrg		dep_rpath="$dep_rpath $flag"
38784456fccdSmrg	      fi
38794456fccdSmrg	    elif test -n "$runpath_var"; then
38804456fccdSmrg	      case "$perm_rpath " in
38814456fccdSmrg	      *" $libdir "*) ;;
38824456fccdSmrg	      *) perm_rpath="$perm_rpath $libdir" ;;
38834456fccdSmrg	      esac
38844456fccdSmrg	    fi
38854456fccdSmrg	  done
38864456fccdSmrg	  # Substitute the hardcoded libdirs into the rpath.
38874456fccdSmrg	  if test -n "$hardcode_libdir_separator" &&
38884456fccdSmrg	     test -n "$hardcode_libdirs"; then
38894456fccdSmrg	    libdir="$hardcode_libdirs"
38904456fccdSmrg	    if test -n "$hardcode_libdir_flag_spec_ld"; then
38914456fccdSmrg	      eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
38924456fccdSmrg	    else
38934456fccdSmrg	      eval dep_rpath=\"$hardcode_libdir_flag_spec\"
38944456fccdSmrg	    fi
38954456fccdSmrg	  fi
38964456fccdSmrg	  if test -n "$runpath_var" && test -n "$perm_rpath"; then
38974456fccdSmrg	    # We should set the runpath_var.
38984456fccdSmrg	    rpath=
38994456fccdSmrg	    for dir in $perm_rpath; do
39004456fccdSmrg	      rpath="$rpath$dir:"
39014456fccdSmrg	    done
39024456fccdSmrg	    eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
39034456fccdSmrg	  fi
39044456fccdSmrg	  test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
39054456fccdSmrg	fi
39064456fccdSmrg
39074456fccdSmrg	shlibpath="$finalize_shlibpath"
39084456fccdSmrg	test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
39094456fccdSmrg	if test -n "$shlibpath"; then
39104456fccdSmrg	  eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
39114456fccdSmrg	fi
39124456fccdSmrg
39134456fccdSmrg	# Get the real and link names of the library.
39144456fccdSmrg	eval shared_ext=\"$shrext_cmds\"
39154456fccdSmrg	eval library_names=\"$library_names_spec\"
39164456fccdSmrg	set dummy $library_names
39174456fccdSmrg	realname="$2"
39184456fccdSmrg	shift; shift
39194456fccdSmrg
39204456fccdSmrg	if test -n "$soname_spec"; then
39214456fccdSmrg	  eval soname=\"$soname_spec\"
39224456fccdSmrg	else
39234456fccdSmrg	  soname="$realname"
39244456fccdSmrg	fi
39254456fccdSmrg	if test -z "$dlname"; then
39264456fccdSmrg	  dlname=$soname
39274456fccdSmrg	fi
39284456fccdSmrg
39294456fccdSmrg	lib="$output_objdir/$realname"
39304456fccdSmrg	linknames=
39314456fccdSmrg	for link
39324456fccdSmrg	do
39334456fccdSmrg	  linknames="$linknames $link"
39344456fccdSmrg	done
39354456fccdSmrg
39364456fccdSmrg	# Use standard objects if they are pic
39374456fccdSmrg	test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
39384456fccdSmrg
39394456fccdSmrg	# Prepare the list of exported symbols
39404456fccdSmrg	if test -z "$export_symbols"; then
39414456fccdSmrg	  if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
39424456fccdSmrg	    $show "generating symbol list for \`$libname.la'"
39434456fccdSmrg	    export_symbols="$output_objdir/$libname.exp"
39444456fccdSmrg	    $run $rm $export_symbols
39454456fccdSmrg	    cmds=$export_symbols_cmds
39464456fccdSmrg	    save_ifs="$IFS"; IFS='~'
39474456fccdSmrg	    for cmd in $cmds; do
39484456fccdSmrg	      IFS="$save_ifs"
39494456fccdSmrg	      eval cmd=\"$cmd\"
39504456fccdSmrg	      if len=`expr "X$cmd" : ".*"` &&
39514456fccdSmrg	       test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
39524456fccdSmrg	        $show "$cmd"
39534456fccdSmrg	        $run eval "$cmd" || exit $?
39544456fccdSmrg	        skipped_export=false
39554456fccdSmrg	      else
39564456fccdSmrg	        # The command line is too long to execute in one step.
39574456fccdSmrg	        $show "using reloadable object file for export list..."
39584456fccdSmrg	        skipped_export=:
39594456fccdSmrg		# Break out early, otherwise skipped_export may be
39604456fccdSmrg		# set to false by a later but shorter cmd.
39614456fccdSmrg		break
39624456fccdSmrg	      fi
39634456fccdSmrg	    done
39644456fccdSmrg	    IFS="$save_ifs"
39654456fccdSmrg	    if test -n "$export_symbols_regex"; then
39664456fccdSmrg	      $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
39674456fccdSmrg	      $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
39684456fccdSmrg	      $show "$mv \"${export_symbols}T\" \"$export_symbols\""
39694456fccdSmrg	      $run eval '$mv "${export_symbols}T" "$export_symbols"'
39704456fccdSmrg	    fi
39714456fccdSmrg	  fi
39724456fccdSmrg	fi
39734456fccdSmrg
39744456fccdSmrg	if test -n "$export_symbols" && test -n "$include_expsyms"; then
39754456fccdSmrg	  $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
39764456fccdSmrg	fi
39774456fccdSmrg
39784456fccdSmrg	tmp_deplibs=
39794456fccdSmrg	for test_deplib in $deplibs; do
39804456fccdSmrg		case " $convenience " in
39814456fccdSmrg		*" $test_deplib "*) ;;
39824456fccdSmrg		*)
39834456fccdSmrg			tmp_deplibs="$tmp_deplibs $test_deplib"
39844456fccdSmrg			;;
39854456fccdSmrg		esac
39864456fccdSmrg	done
39874456fccdSmrg	deplibs="$tmp_deplibs"
39884456fccdSmrg
39894456fccdSmrg	if test -n "$convenience"; then
39904456fccdSmrg	  if test -n "$whole_archive_flag_spec"; then
39914456fccdSmrg	    save_libobjs=$libobjs
39924456fccdSmrg	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
39934456fccdSmrg	  else
39944456fccdSmrg	    gentop="$output_objdir/${outputname}x"
39954456fccdSmrg	    generated="$generated $gentop"
39964456fccdSmrg
39974456fccdSmrg	    func_extract_archives $gentop $convenience
39984456fccdSmrg	    libobjs="$libobjs $func_extract_archives_result"
39994456fccdSmrg	  fi
40004456fccdSmrg	fi
40014456fccdSmrg	
40024456fccdSmrg	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
40034456fccdSmrg	  eval flag=\"$thread_safe_flag_spec\"
40044456fccdSmrg	  linker_flags="$linker_flags $flag"
40054456fccdSmrg	fi
40064456fccdSmrg
40074456fccdSmrg	# Make a backup of the uninstalled library when relinking
40084456fccdSmrg	if test "$mode" = relink; then
40094456fccdSmrg	  $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
40104456fccdSmrg	fi
40114456fccdSmrg
40124456fccdSmrg	# Do each of the archive commands.
40134456fccdSmrg	if test "$module" = yes && test -n "$module_cmds" ; then
40144456fccdSmrg	  if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
40154456fccdSmrg	    eval test_cmds=\"$module_expsym_cmds\"
40164456fccdSmrg	    cmds=$module_expsym_cmds
40174456fccdSmrg	  else
40184456fccdSmrg	    eval test_cmds=\"$module_cmds\"
40194456fccdSmrg	    cmds=$module_cmds
40204456fccdSmrg	  fi
40214456fccdSmrg	else
40224456fccdSmrg	if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
40234456fccdSmrg	  eval test_cmds=\"$archive_expsym_cmds\"
40244456fccdSmrg	  cmds=$archive_expsym_cmds
40254456fccdSmrg	else
40264456fccdSmrg	  eval test_cmds=\"$archive_cmds\"
40274456fccdSmrg	  cmds=$archive_cmds
40284456fccdSmrg	  fi
40294456fccdSmrg	fi
40304456fccdSmrg
40314456fccdSmrg	if test "X$skipped_export" != "X:" &&
40324456fccdSmrg	   len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
40334456fccdSmrg	   test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
40344456fccdSmrg	  :
40354456fccdSmrg	else
40364456fccdSmrg	  # The command line is too long to link in one step, link piecewise.
40374456fccdSmrg	  $echo "creating reloadable object files..."
40384456fccdSmrg
40394456fccdSmrg	  # Save the value of $output and $libobjs because we want to
40404456fccdSmrg	  # use them later.  If we have whole_archive_flag_spec, we
40414456fccdSmrg	  # want to use save_libobjs as it was before
40424456fccdSmrg	  # whole_archive_flag_spec was expanded, because we can't
40434456fccdSmrg	  # assume the linker understands whole_archive_flag_spec.
40444456fccdSmrg	  # This may have to be revisited, in case too many
40454456fccdSmrg	  # convenience libraries get linked in and end up exceeding
40464456fccdSmrg	  # the spec.
40474456fccdSmrg	  if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
40484456fccdSmrg	    save_libobjs=$libobjs
40494456fccdSmrg	  fi
40504456fccdSmrg	  save_output=$output
40514456fccdSmrg	  output_la=`$echo "X$output" | $Xsed -e "$basename"`
40524456fccdSmrg
40534456fccdSmrg	  # Clear the reloadable object creation command queue and
40544456fccdSmrg	  # initialize k to one.
40554456fccdSmrg	  test_cmds=
40564456fccdSmrg	  concat_cmds=
40574456fccdSmrg	  objlist=
40584456fccdSmrg	  delfiles=
40594456fccdSmrg	  last_robj=
40604456fccdSmrg	  k=1
40614456fccdSmrg	  output=$output_objdir/$output_la-${k}.$objext
40624456fccdSmrg	  # Loop over the list of objects to be linked.
40634456fccdSmrg	  for obj in $save_libobjs
40644456fccdSmrg	  do
40654456fccdSmrg	    eval test_cmds=\"$reload_cmds $objlist $last_robj\"
40664456fccdSmrg	    if test "X$objlist" = X ||
40674456fccdSmrg	       { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
40684456fccdSmrg		 test "$len" -le "$max_cmd_len"; }; then
40694456fccdSmrg	      objlist="$objlist $obj"
40704456fccdSmrg	    else
40714456fccdSmrg	      # The command $test_cmds is almost too long, add a
40724456fccdSmrg	      # command to the queue.
40734456fccdSmrg	      if test "$k" -eq 1 ; then
40744456fccdSmrg		# The first file doesn't have a previous command to add.
40754456fccdSmrg		eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
40764456fccdSmrg	      else
40774456fccdSmrg		# All subsequent reloadable object files will link in
40784456fccdSmrg		# the last one created.
40794456fccdSmrg		eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
40804456fccdSmrg	      fi
40814456fccdSmrg	      last_robj=$output_objdir/$output_la-${k}.$objext
40824456fccdSmrg	      k=`expr $k + 1`
40834456fccdSmrg	      output=$output_objdir/$output_la-${k}.$objext
40844456fccdSmrg	      objlist=$obj
40854456fccdSmrg	      len=1
40864456fccdSmrg	    fi
40874456fccdSmrg	  done
40884456fccdSmrg	  # Handle the remaining objects by creating one last
40894456fccdSmrg	  # reloadable object file.  All subsequent reloadable object
40904456fccdSmrg	  # files will link in the last one created.
40914456fccdSmrg	  test -z "$concat_cmds" || concat_cmds=$concat_cmds~
40924456fccdSmrg	  eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
40934456fccdSmrg
40944456fccdSmrg	  if ${skipped_export-false}; then
40954456fccdSmrg	    $show "generating symbol list for \`$libname.la'"
40964456fccdSmrg	    export_symbols="$output_objdir/$libname.exp"
40974456fccdSmrg	    $run $rm $export_symbols
40984456fccdSmrg	    libobjs=$output
40994456fccdSmrg	    # Append the command to create the export file.
41004456fccdSmrg	    eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
41014456fccdSmrg          fi
41024456fccdSmrg
41034456fccdSmrg	  # Set up a command to remove the reloadable object files
41044456fccdSmrg	  # after they are used.
41054456fccdSmrg	  i=0
41064456fccdSmrg	  while test "$i" -lt "$k"
41074456fccdSmrg	  do
41084456fccdSmrg	    i=`expr $i + 1`
41094456fccdSmrg	    delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
41104456fccdSmrg	  done
41114456fccdSmrg
41124456fccdSmrg	  $echo "creating a temporary reloadable object file: $output"
41134456fccdSmrg
41144456fccdSmrg	  # Loop through the commands generated above and execute them.
41154456fccdSmrg	  save_ifs="$IFS"; IFS='~'
41164456fccdSmrg	  for cmd in $concat_cmds; do
41174456fccdSmrg	    IFS="$save_ifs"
41184456fccdSmrg	    $show "$cmd"
41194456fccdSmrg	    $run eval "$cmd" || exit $?
41204456fccdSmrg	  done
41214456fccdSmrg	  IFS="$save_ifs"
41224456fccdSmrg
41234456fccdSmrg	  libobjs=$output
41244456fccdSmrg	  # Restore the value of output.
41254456fccdSmrg	  output=$save_output
41264456fccdSmrg
41274456fccdSmrg	  if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
41284456fccdSmrg	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
41294456fccdSmrg	  fi
41304456fccdSmrg	  # Expand the library linking commands again to reset the
41314456fccdSmrg	  # value of $libobjs for piecewise linking.
41324456fccdSmrg
41334456fccdSmrg	  # Do each of the archive commands.
41344456fccdSmrg	  if test "$module" = yes && test -n "$module_cmds" ; then
41354456fccdSmrg	    if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
41364456fccdSmrg	      cmds=$module_expsym_cmds
41374456fccdSmrg	    else
41384456fccdSmrg	      cmds=$module_cmds
41394456fccdSmrg	    fi
41404456fccdSmrg	  else
41414456fccdSmrg	  if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
41424456fccdSmrg	    cmds=$archive_expsym_cmds
41434456fccdSmrg	  else
41444456fccdSmrg	    cmds=$archive_cmds
41454456fccdSmrg	    fi
41464456fccdSmrg	  fi
41474456fccdSmrg
41484456fccdSmrg	  # Append the command to remove the reloadable object files
41494456fccdSmrg	  # to the just-reset $cmds.
41504456fccdSmrg	  eval cmds=\"\$cmds~\$rm $delfiles\"
41514456fccdSmrg	fi
41524456fccdSmrg	save_ifs="$IFS"; IFS='~'
41534456fccdSmrg	for cmd in $cmds; do
41544456fccdSmrg	  IFS="$save_ifs"
41554456fccdSmrg	  eval cmd=\"$cmd\"
41564456fccdSmrg	  $show "$cmd"
41574456fccdSmrg	  $run eval "$cmd" || {
41584456fccdSmrg	    lt_exit=$?
41594456fccdSmrg
41604456fccdSmrg	    # Restore the uninstalled library and exit
41614456fccdSmrg	    if test "$mode" = relink; then
41624456fccdSmrg	      $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
41634456fccdSmrg	    fi
41644456fccdSmrg
41654456fccdSmrg	    exit $lt_exit
41664456fccdSmrg	  }
41674456fccdSmrg	done
41684456fccdSmrg	IFS="$save_ifs"
41694456fccdSmrg
41704456fccdSmrg	# Restore the uninstalled library and exit
41714456fccdSmrg	if test "$mode" = relink; then
41724456fccdSmrg	  $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
41734456fccdSmrg
41744456fccdSmrg	  if test -n "$convenience"; then
41754456fccdSmrg	    if test -z "$whole_archive_flag_spec"; then
41764456fccdSmrg	      $show "${rm}r $gentop"
41774456fccdSmrg	      $run ${rm}r "$gentop"
41784456fccdSmrg	    fi
41794456fccdSmrg	  fi
41804456fccdSmrg
41814456fccdSmrg	  exit $EXIT_SUCCESS
41824456fccdSmrg	fi
41834456fccdSmrg
41844456fccdSmrg	# Create links to the real library.
41854456fccdSmrg	for linkname in $linknames; do
41864456fccdSmrg	  if test "$realname" != "$linkname"; then
41874456fccdSmrg	    $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
41884456fccdSmrg	    $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
41894456fccdSmrg	  fi
41904456fccdSmrg	done
41914456fccdSmrg
41924456fccdSmrg	# If -module or -export-dynamic was specified, set the dlname.
41934456fccdSmrg	if test "$module" = yes || test "$export_dynamic" = yes; then
41944456fccdSmrg	  # On all known operating systems, these are identical.
41954456fccdSmrg	  dlname="$soname"
41964456fccdSmrg	fi
41974456fccdSmrg      fi
41984456fccdSmrg      ;;
41994456fccdSmrg
42004456fccdSmrg    obj)
42014456fccdSmrg      if test -n "$deplibs"; then
42024456fccdSmrg	$echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
42034456fccdSmrg      fi
42044456fccdSmrg
42054456fccdSmrg      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
42064456fccdSmrg	$echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
42074456fccdSmrg      fi
42084456fccdSmrg
42094456fccdSmrg      if test -n "$rpath"; then
42104456fccdSmrg	$echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
42114456fccdSmrg      fi
42124456fccdSmrg
42134456fccdSmrg      if test -n "$xrpath"; then
42144456fccdSmrg	$echo "$modename: warning: \`-R' is ignored for objects" 1>&2
42154456fccdSmrg      fi
42164456fccdSmrg
42174456fccdSmrg      if test -n "$vinfo"; then
42184456fccdSmrg	$echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
42194456fccdSmrg      fi
42204456fccdSmrg
42214456fccdSmrg      if test -n "$release"; then
42224456fccdSmrg	$echo "$modename: warning: \`-release' is ignored for objects" 1>&2
42234456fccdSmrg      fi
42244456fccdSmrg
42254456fccdSmrg      case $output in
42264456fccdSmrg      *.lo)
42274456fccdSmrg	if test -n "$objs$old_deplibs"; then
42284456fccdSmrg	  $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
42294456fccdSmrg	  exit $EXIT_FAILURE
42304456fccdSmrg	fi
42314456fccdSmrg	libobj="$output"
42324456fccdSmrg	obj=`$echo "X$output" | $Xsed -e "$lo2o"`
42334456fccdSmrg	;;
42344456fccdSmrg      *)
42354456fccdSmrg	libobj=
42364456fccdSmrg	obj="$output"
42374456fccdSmrg	;;
42384456fccdSmrg      esac
42394456fccdSmrg
42404456fccdSmrg      # Delete the old objects.
42414456fccdSmrg      $run $rm $obj $libobj
42424456fccdSmrg
42434456fccdSmrg      # Objects from convenience libraries.  This assumes
42444456fccdSmrg      # single-version convenience libraries.  Whenever we create
42454456fccdSmrg      # different ones for PIC/non-PIC, this we'll have to duplicate
42464456fccdSmrg      # the extraction.
42474456fccdSmrg      reload_conv_objs=
42484456fccdSmrg      gentop=
42494456fccdSmrg      # reload_cmds runs $LD directly, so let us get rid of
42504456fccdSmrg      # -Wl from whole_archive_flag_spec
42514456fccdSmrg      wl=
42524456fccdSmrg
42534456fccdSmrg      if test -n "$convenience"; then
42544456fccdSmrg	if test -n "$whole_archive_flag_spec"; then
42554456fccdSmrg	  eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
42564456fccdSmrg	else
42574456fccdSmrg	  gentop="$output_objdir/${obj}x"
42584456fccdSmrg	  generated="$generated $gentop"
42594456fccdSmrg
42604456fccdSmrg	  func_extract_archives $gentop $convenience
42614456fccdSmrg	  reload_conv_objs="$reload_objs $func_extract_archives_result"
42624456fccdSmrg	fi
42634456fccdSmrg      fi
42644456fccdSmrg
42654456fccdSmrg      # Create the old-style object.
42664456fccdSmrg      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
42674456fccdSmrg
42684456fccdSmrg      output="$obj"
42694456fccdSmrg      cmds=$reload_cmds
42704456fccdSmrg      save_ifs="$IFS"; IFS='~'
42714456fccdSmrg      for cmd in $cmds; do
42724456fccdSmrg	IFS="$save_ifs"
42734456fccdSmrg	eval cmd=\"$cmd\"
42744456fccdSmrg	$show "$cmd"
42754456fccdSmrg	$run eval "$cmd" || exit $?
42764456fccdSmrg      done
42774456fccdSmrg      IFS="$save_ifs"
42784456fccdSmrg
42794456fccdSmrg      # Exit if we aren't doing a library object file.
42804456fccdSmrg      if test -z "$libobj"; then
42814456fccdSmrg	if test -n "$gentop"; then
42824456fccdSmrg	  $show "${rm}r $gentop"
42834456fccdSmrg	  $run ${rm}r $gentop
42844456fccdSmrg	fi
42854456fccdSmrg
42864456fccdSmrg	exit $EXIT_SUCCESS
42874456fccdSmrg      fi
42884456fccdSmrg
42894456fccdSmrg      if test "$build_libtool_libs" != yes; then
42904456fccdSmrg	if test -n "$gentop"; then
42914456fccdSmrg	  $show "${rm}r $gentop"
42924456fccdSmrg	  $run ${rm}r $gentop
42934456fccdSmrg	fi
42944456fccdSmrg
42954456fccdSmrg	# Create an invalid libtool object if no PIC, so that we don't
42964456fccdSmrg	# accidentally link it into a program.
42974456fccdSmrg	# $show "echo timestamp > $libobj"
42984456fccdSmrg	# $run eval "echo timestamp > $libobj" || exit $?
42994456fccdSmrg	exit $EXIT_SUCCESS
43004456fccdSmrg      fi
43014456fccdSmrg
43024456fccdSmrg      if test -n "$pic_flag" || test "$pic_mode" != default; then
43034456fccdSmrg	# Only do commands if we really have different PIC objects.
43044456fccdSmrg	reload_objs="$libobjs $reload_conv_objs"
43054456fccdSmrg	output="$libobj"
43064456fccdSmrg	cmds=$reload_cmds
43074456fccdSmrg	save_ifs="$IFS"; IFS='~'
43084456fccdSmrg	for cmd in $cmds; do
43094456fccdSmrg	  IFS="$save_ifs"
43104456fccdSmrg	  eval cmd=\"$cmd\"
43114456fccdSmrg	  $show "$cmd"
43124456fccdSmrg	  $run eval "$cmd" || exit $?
43134456fccdSmrg	done
43144456fccdSmrg	IFS="$save_ifs"
43154456fccdSmrg      fi
43164456fccdSmrg
43174456fccdSmrg      if test -n "$gentop"; then
43184456fccdSmrg	$show "${rm}r $gentop"
43194456fccdSmrg	$run ${rm}r $gentop
43204456fccdSmrg      fi
43214456fccdSmrg
43224456fccdSmrg      exit $EXIT_SUCCESS
43234456fccdSmrg      ;;
43244456fccdSmrg
43254456fccdSmrg    prog)
43264456fccdSmrg      case $host in
43274456fccdSmrg	*cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
43284456fccdSmrg      esac
43294456fccdSmrg      if test -n "$vinfo"; then
43304456fccdSmrg	$echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
43314456fccdSmrg      fi
43324456fccdSmrg
43334456fccdSmrg      if test -n "$release"; then
43344456fccdSmrg	$echo "$modename: warning: \`-release' is ignored for programs" 1>&2
43354456fccdSmrg      fi
43364456fccdSmrg
43374456fccdSmrg      if test "$preload" = yes; then
43384456fccdSmrg	if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
43394456fccdSmrg	   test "$dlopen_self_static" = unknown; then
43404456fccdSmrg	  $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
43414456fccdSmrg	fi
43424456fccdSmrg      fi
43434456fccdSmrg
43444456fccdSmrg      case $host in
43454456fccdSmrg      *-*-rhapsody* | *-*-darwin1.[012])
43464456fccdSmrg	# On Rhapsody replace the C library is the System framework
43474456fccdSmrg	compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
43484456fccdSmrg	finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
43494456fccdSmrg	;;
43504456fccdSmrg      esac
43514456fccdSmrg
43524456fccdSmrg      case $host in
43534456fccdSmrg      *darwin*)
43544456fccdSmrg        # Don't allow lazy linking, it breaks C++ global constructors
43554456fccdSmrg        if test "$tagname" = CXX ; then
43564456fccdSmrg        compile_command="$compile_command ${wl}-bind_at_load"
43574456fccdSmrg        finalize_command="$finalize_command ${wl}-bind_at_load"
43584456fccdSmrg        fi
43594456fccdSmrg        ;;
43604456fccdSmrg      esac
43614456fccdSmrg
43624456fccdSmrg
43634456fccdSmrg      # move library search paths that coincide with paths to not yet
43644456fccdSmrg      # installed libraries to the beginning of the library search list
43654456fccdSmrg      new_libs=
43664456fccdSmrg      for path in $notinst_path; do
43674456fccdSmrg	case " $new_libs " in
43684456fccdSmrg	*" -L$path/$objdir "*) ;;
43694456fccdSmrg	*)
43704456fccdSmrg	  case " $compile_deplibs " in
43714456fccdSmrg	  *" -L$path/$objdir "*)
43724456fccdSmrg	    new_libs="$new_libs -L$path/$objdir" ;;
43734456fccdSmrg	  esac
43744456fccdSmrg	  ;;
43754456fccdSmrg	esac
43764456fccdSmrg      done
43774456fccdSmrg      for deplib in $compile_deplibs; do
43784456fccdSmrg	case $deplib in
43794456fccdSmrg	-L*)
43804456fccdSmrg	  case " $new_libs " in
43814456fccdSmrg	  *" $deplib "*) ;;
43824456fccdSmrg	  *) new_libs="$new_libs $deplib" ;;
43834456fccdSmrg	  esac
43844456fccdSmrg	  ;;
43854456fccdSmrg	*) new_libs="$new_libs $deplib" ;;
43864456fccdSmrg	esac
43874456fccdSmrg      done
43884456fccdSmrg      compile_deplibs="$new_libs"
43894456fccdSmrg
43904456fccdSmrg
43914456fccdSmrg      compile_command="$compile_command $compile_deplibs"
43924456fccdSmrg      finalize_command="$finalize_command $finalize_deplibs"
43934456fccdSmrg
43944456fccdSmrg      if test -n "$rpath$xrpath"; then
43954456fccdSmrg	# If the user specified any rpath flags, then add them.
43964456fccdSmrg	for libdir in $rpath $xrpath; do
43974456fccdSmrg	  # This is the magic to use -rpath.
43984456fccdSmrg	  case "$finalize_rpath " in
43994456fccdSmrg	  *" $libdir "*) ;;
44004456fccdSmrg	  *) finalize_rpath="$finalize_rpath $libdir" ;;
44014456fccdSmrg	  esac
44024456fccdSmrg	done
44034456fccdSmrg      fi
44044456fccdSmrg
44054456fccdSmrg      # Now hardcode the library paths
44064456fccdSmrg      rpath=
44074456fccdSmrg      hardcode_libdirs=
44084456fccdSmrg      for libdir in $compile_rpath $finalize_rpath; do
44094456fccdSmrg	if test -n "$hardcode_libdir_flag_spec"; then
44104456fccdSmrg	  if test -n "$hardcode_libdir_separator"; then
44114456fccdSmrg	    if test -z "$hardcode_libdirs"; then
44124456fccdSmrg	      hardcode_libdirs="$libdir"
44134456fccdSmrg	    else
44144456fccdSmrg	      # Just accumulate the unique libdirs.
44154456fccdSmrg	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
44164456fccdSmrg	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
44174456fccdSmrg		;;
44184456fccdSmrg	      *)
44194456fccdSmrg		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
44204456fccdSmrg		;;
44214456fccdSmrg	      esac
44224456fccdSmrg	    fi
44234456fccdSmrg	  else
44244456fccdSmrg	    eval flag=\"$hardcode_libdir_flag_spec\"
44254456fccdSmrg	    rpath="$rpath $flag"
44264456fccdSmrg	  fi
44274456fccdSmrg	elif test -n "$runpath_var"; then
44284456fccdSmrg	  case "$perm_rpath " in
44294456fccdSmrg	  *" $libdir "*) ;;
44304456fccdSmrg	  *) perm_rpath="$perm_rpath $libdir" ;;
44314456fccdSmrg	  esac
44324456fccdSmrg	fi
44334456fccdSmrg	case $host in
44344456fccdSmrg	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
44354456fccdSmrg	  testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
44364456fccdSmrg	  case :$dllsearchpath: in
44374456fccdSmrg	  *":$libdir:"*) ;;
44384456fccdSmrg	  *) dllsearchpath="$dllsearchpath:$libdir";;
44394456fccdSmrg	  esac
44404456fccdSmrg	  case :$dllsearchpath: in
44414456fccdSmrg	  *":$testbindir:"*) ;;
44424456fccdSmrg	  *) dllsearchpath="$dllsearchpath:$testbindir";;
44434456fccdSmrg	  esac
44444456fccdSmrg	  ;;
44454456fccdSmrg	esac
44464456fccdSmrg      done
44474456fccdSmrg      # Substitute the hardcoded libdirs into the rpath.
44484456fccdSmrg      if test -n "$hardcode_libdir_separator" &&
44494456fccdSmrg	 test -n "$hardcode_libdirs"; then
44504456fccdSmrg	libdir="$hardcode_libdirs"
44514456fccdSmrg	eval rpath=\" $hardcode_libdir_flag_spec\"
44524456fccdSmrg      fi
44534456fccdSmrg      compile_rpath="$rpath"
44544456fccdSmrg
44554456fccdSmrg      rpath=
44564456fccdSmrg      hardcode_libdirs=
44574456fccdSmrg      for libdir in $finalize_rpath; do
44584456fccdSmrg	if test -n "$hardcode_libdir_flag_spec"; then
44594456fccdSmrg	  if test -n "$hardcode_libdir_separator"; then
44604456fccdSmrg	    if test -z "$hardcode_libdirs"; then
44614456fccdSmrg	      hardcode_libdirs="$libdir"
44624456fccdSmrg	    else
44634456fccdSmrg	      # Just accumulate the unique libdirs.
44644456fccdSmrg	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
44654456fccdSmrg	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
44664456fccdSmrg		;;
44674456fccdSmrg	      *)
44684456fccdSmrg		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
44694456fccdSmrg		;;
44704456fccdSmrg	      esac
44714456fccdSmrg	    fi
44724456fccdSmrg	  else
44734456fccdSmrg	    eval flag=\"$hardcode_libdir_flag_spec\"
44744456fccdSmrg	    rpath="$rpath $flag"
44754456fccdSmrg	  fi
44764456fccdSmrg	elif test -n "$runpath_var"; then
44774456fccdSmrg	  case "$finalize_perm_rpath " in
44784456fccdSmrg	  *" $libdir "*) ;;
44794456fccdSmrg	  *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
44804456fccdSmrg	  esac
44814456fccdSmrg	fi
44824456fccdSmrg      done
44834456fccdSmrg      # Substitute the hardcoded libdirs into the rpath.
44844456fccdSmrg      if test -n "$hardcode_libdir_separator" &&
44854456fccdSmrg	 test -n "$hardcode_libdirs"; then
44864456fccdSmrg	libdir="$hardcode_libdirs"
44874456fccdSmrg	eval rpath=\" $hardcode_libdir_flag_spec\"
44884456fccdSmrg      fi
44894456fccdSmrg      finalize_rpath="$rpath"
44904456fccdSmrg
44914456fccdSmrg      if test -n "$libobjs" && test "$build_old_libs" = yes; then
44924456fccdSmrg	# Transform all the library objects into standard objects.
44934456fccdSmrg	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
44944456fccdSmrg	finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
44954456fccdSmrg      fi
44964456fccdSmrg
44974456fccdSmrg      dlsyms=
44984456fccdSmrg      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
44994456fccdSmrg	if test -n "$NM" && test -n "$global_symbol_pipe"; then
45004456fccdSmrg	  dlsyms="${outputname}S.c"
45014456fccdSmrg	else
45024456fccdSmrg	  $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
45034456fccdSmrg	fi
45044456fccdSmrg      fi
45054456fccdSmrg
45064456fccdSmrg      if test -n "$dlsyms"; then
45074456fccdSmrg	case $dlsyms in
45084456fccdSmrg	"") ;;
45094456fccdSmrg	*.c)
45104456fccdSmrg	  # Discover the nlist of each of the dlfiles.
45114456fccdSmrg	  nlist="$output_objdir/${outputname}.nm"
45124456fccdSmrg
45134456fccdSmrg	  $show "$rm $nlist ${nlist}S ${nlist}T"
45144456fccdSmrg	  $run $rm "$nlist" "${nlist}S" "${nlist}T"
45154456fccdSmrg
45164456fccdSmrg	  # Parse the name list into a source file.
45174456fccdSmrg	  $show "creating $output_objdir/$dlsyms"
45184456fccdSmrg
45194456fccdSmrg	  test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
45204456fccdSmrg/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
45214456fccdSmrg/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
45224456fccdSmrg
45234456fccdSmrg#ifdef __cplusplus
45244456fccdSmrgextern \"C\" {
45254456fccdSmrg#endif
45264456fccdSmrg
45274456fccdSmrg/* Prevent the only kind of declaration conflicts we can make. */
45284456fccdSmrg#define lt_preloaded_symbols some_other_symbol
45294456fccdSmrg
45304456fccdSmrg/* External symbol declarations for the compiler. */\
45314456fccdSmrg"
45324456fccdSmrg
45334456fccdSmrg	  if test "$dlself" = yes; then
45344456fccdSmrg	    $show "generating symbol list for \`$output'"
45354456fccdSmrg
45364456fccdSmrg	    test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
45374456fccdSmrg
45384456fccdSmrg	    # Add our own program objects to the symbol list.
45394456fccdSmrg	    progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
45404456fccdSmrg	    for arg in $progfiles; do
45414456fccdSmrg	      $show "extracting global C symbols from \`$arg'"
45424456fccdSmrg	      $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
45434456fccdSmrg	    done
45444456fccdSmrg
45454456fccdSmrg	    if test -n "$exclude_expsyms"; then
45464456fccdSmrg	      $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
45474456fccdSmrg	      $run eval '$mv "$nlist"T "$nlist"'
45484456fccdSmrg	    fi
45494456fccdSmrg
45504456fccdSmrg	    if test -n "$export_symbols_regex"; then
45514456fccdSmrg	      $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
45524456fccdSmrg	      $run eval '$mv "$nlist"T "$nlist"'
45534456fccdSmrg	    fi
45544456fccdSmrg
45554456fccdSmrg	    # Prepare the list of exported symbols
45564456fccdSmrg	    if test -z "$export_symbols"; then
45574456fccdSmrg	      export_symbols="$output_objdir/$outputname.exp"
45584456fccdSmrg	      $run $rm $export_symbols
45594456fccdSmrg	      $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
45604456fccdSmrg              case $host in
45614456fccdSmrg              *cygwin* | *mingw* )
45624456fccdSmrg	        $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
45634456fccdSmrg		$run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
45644456fccdSmrg                ;;
45654456fccdSmrg              esac
45664456fccdSmrg	    else
45674456fccdSmrg	      $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
45684456fccdSmrg	      $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
45694456fccdSmrg	      $run eval 'mv "$nlist"T "$nlist"'
45704456fccdSmrg              case $host in
45714456fccdSmrg              *cygwin* | *mingw* )
45724456fccdSmrg	        $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
45734456fccdSmrg		$run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
45744456fccdSmrg                ;;
45754456fccdSmrg              esac
45764456fccdSmrg	    fi
45774456fccdSmrg	  fi
45784456fccdSmrg
45794456fccdSmrg	  for arg in $dlprefiles; do
45804456fccdSmrg	    $show "extracting global C symbols from \`$arg'"
45814456fccdSmrg	    name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
45824456fccdSmrg	    $run eval '$echo ": $name " >> "$nlist"'
45834456fccdSmrg	    $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
45844456fccdSmrg	  done
45854456fccdSmrg
45864456fccdSmrg	  if test -z "$run"; then
45874456fccdSmrg	    # Make sure we have at least an empty file.
45884456fccdSmrg	    test -f "$nlist" || : > "$nlist"
45894456fccdSmrg
45904456fccdSmrg	    if test -n "$exclude_expsyms"; then
45914456fccdSmrg	      $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
45924456fccdSmrg	      $mv "$nlist"T "$nlist"
45934456fccdSmrg	    fi
45944456fccdSmrg
45954456fccdSmrg	    # Try sorting and uniquifying the output.
45964456fccdSmrg	    if grep -v "^: " < "$nlist" |
45974456fccdSmrg		if sort -k 3 </dev/null >/dev/null 2>&1; then
45984456fccdSmrg		  sort -k 3
45994456fccdSmrg		else
46004456fccdSmrg		  sort +2
46014456fccdSmrg		fi |
46024456fccdSmrg		uniq > "$nlist"S; then
46034456fccdSmrg	      :
46044456fccdSmrg	    else
46054456fccdSmrg	      grep -v "^: " < "$nlist" > "$nlist"S
46064456fccdSmrg	    fi
46074456fccdSmrg
46084456fccdSmrg	    if test -f "$nlist"S; then
46094456fccdSmrg	      eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
46104456fccdSmrg	    else
46114456fccdSmrg	      $echo '/* NONE */' >> "$output_objdir/$dlsyms"
46124456fccdSmrg	    fi
46134456fccdSmrg
46144456fccdSmrg	    $echo >> "$output_objdir/$dlsyms" "\
46154456fccdSmrg
46164456fccdSmrg#undef lt_preloaded_symbols
46174456fccdSmrg
46184456fccdSmrg#if defined (__STDC__) && __STDC__
46194456fccdSmrg# define lt_ptr void *
46204456fccdSmrg#else
46214456fccdSmrg# define lt_ptr char *
46224456fccdSmrg# define const
46234456fccdSmrg#endif
46244456fccdSmrg
46254456fccdSmrg/* The mapping between symbol names and symbols. */
46264456fccdSmrg"
46274456fccdSmrg
46284456fccdSmrg	    case $host in
46294456fccdSmrg	    *cygwin* | *mingw* )
46304456fccdSmrg	  $echo >> "$output_objdir/$dlsyms" "\
46314456fccdSmrg/* DATA imports from DLLs on WIN32 can't be const, because
46324456fccdSmrg   runtime relocations are performed -- see ld's documentation
46334456fccdSmrg   on pseudo-relocs */
46344456fccdSmrgstruct {
46354456fccdSmrg"
46364456fccdSmrg	      ;;
46374456fccdSmrg	    * )
46384456fccdSmrg	  $echo >> "$output_objdir/$dlsyms" "\
46394456fccdSmrgconst struct {
46404456fccdSmrg"
46414456fccdSmrg	      ;;
46424456fccdSmrg	    esac
46434456fccdSmrg
46444456fccdSmrg
46454456fccdSmrg	  $echo >> "$output_objdir/$dlsyms" "\
46464456fccdSmrg  const char *name;
46474456fccdSmrg  lt_ptr address;
46484456fccdSmrg}
46494456fccdSmrglt_preloaded_symbols[] =
46504456fccdSmrg{\
46514456fccdSmrg"
46524456fccdSmrg
46534456fccdSmrg	    eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
46544456fccdSmrg
46554456fccdSmrg	    $echo >> "$output_objdir/$dlsyms" "\
46564456fccdSmrg  {0, (lt_ptr) 0}
46574456fccdSmrg};
46584456fccdSmrg
46594456fccdSmrg/* This works around a problem in FreeBSD linker */
46604456fccdSmrg#ifdef FREEBSD_WORKAROUND
46614456fccdSmrgstatic const void *lt_preloaded_setup() {
46624456fccdSmrg  return lt_preloaded_symbols;
46634456fccdSmrg}
46644456fccdSmrg#endif
46654456fccdSmrg
46664456fccdSmrg#ifdef __cplusplus
46674456fccdSmrg}
46684456fccdSmrg#endif\
46694456fccdSmrg"
46704456fccdSmrg	  fi
46714456fccdSmrg
46724456fccdSmrg	  pic_flag_for_symtable=
46734456fccdSmrg	  case $host in
46744456fccdSmrg	  # compiling the symbol table file with pic_flag works around
46754456fccdSmrg	  # a FreeBSD bug that causes programs to crash when -lm is
46764456fccdSmrg	  # linked before any other PIC object.  But we must not use
46774456fccdSmrg	  # pic_flag when linking with -static.  The problem exists in
46784456fccdSmrg	  # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
46794456fccdSmrg	  *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
46804456fccdSmrg	    case "$compile_command " in
46814456fccdSmrg	    *" -static "*) ;;
46824456fccdSmrg	    *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
46834456fccdSmrg	    esac;;
46844456fccdSmrg	  *-*-hpux*)
46854456fccdSmrg	    case "$compile_command " in
46864456fccdSmrg	    *" -static "*) ;;
46874456fccdSmrg	    *) pic_flag_for_symtable=" $pic_flag";;
46884456fccdSmrg	    esac
46894456fccdSmrg	  esac
46904456fccdSmrg
46914456fccdSmrg	  # Now compile the dynamic symbol file.
46924456fccdSmrg	  $show "(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
46934456fccdSmrg	  $run eval '(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
46944456fccdSmrg
46954456fccdSmrg	  # Clean up the generated files.
46964456fccdSmrg	  $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
46974456fccdSmrg	  $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
46984456fccdSmrg
46994456fccdSmrg	  # Transform the symbol file into the correct name.
47004456fccdSmrg          case $host in
47014456fccdSmrg          *cygwin* | *mingw* )
47024456fccdSmrg            if test -f "$output_objdir/${outputname}.def" ; then
47034456fccdSmrg              compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
47044456fccdSmrg              finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
47054456fccdSmrg            else
47064456fccdSmrg              compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
47074456fccdSmrg              finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
47084456fccdSmrg             fi
47094456fccdSmrg            ;;
47104456fccdSmrg          * )
47114456fccdSmrg            compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
47124456fccdSmrg            finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
47134456fccdSmrg            ;;
47144456fccdSmrg          esac
47154456fccdSmrg	  ;;
47164456fccdSmrg	*)
47174456fccdSmrg	  $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
47184456fccdSmrg	  exit $EXIT_FAILURE
47194456fccdSmrg	  ;;
47204456fccdSmrg	esac
47214456fccdSmrg      else
47224456fccdSmrg	# We keep going just in case the user didn't refer to
47234456fccdSmrg	# lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
47244456fccdSmrg	# really was required.
47254456fccdSmrg
47264456fccdSmrg	# Nullify the symbol file.
47274456fccdSmrg	compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
47284456fccdSmrg	finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
47294456fccdSmrg      fi
47304456fccdSmrg
47314456fccdSmrg      if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
47324456fccdSmrg	# Replace the output file specification.
47334456fccdSmrg	compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
47344456fccdSmrg	link_command="$compile_command$compile_rpath"
47354456fccdSmrg
47364456fccdSmrg	# We have no uninstalled library dependencies, so finalize right now.
47374456fccdSmrg	$show "$link_command"
47384456fccdSmrg	$run eval "$link_command"
47394456fccdSmrg	exit_status=$?
47404456fccdSmrg
47414456fccdSmrg	# Delete the generated files.
47424456fccdSmrg	if test -n "$dlsyms"; then
47434456fccdSmrg	  $show "$rm $output_objdir/${outputname}S.${objext}"
47444456fccdSmrg	  $run $rm "$output_objdir/${outputname}S.${objext}"
47454456fccdSmrg	fi
47464456fccdSmrg
47474456fccdSmrg	exit $exit_status
47484456fccdSmrg      fi
47494456fccdSmrg
47504456fccdSmrg      if test -n "$shlibpath_var"; then
47514456fccdSmrg	# We should set the shlibpath_var
47524456fccdSmrg	rpath=
47534456fccdSmrg	for dir in $temp_rpath; do
47544456fccdSmrg	  case $dir in
47554456fccdSmrg	  [\\/]* | [A-Za-z]:[\\/]*)
47564456fccdSmrg	    # Absolute path.
47574456fccdSmrg	    rpath="$rpath$dir:"
47584456fccdSmrg	    ;;
47594456fccdSmrg	  *)
47604456fccdSmrg	    # Relative path: add a thisdir entry.
47614456fccdSmrg	    rpath="$rpath\$thisdir/$dir:"
47624456fccdSmrg	    ;;
47634456fccdSmrg	  esac
47644456fccdSmrg	done
47654456fccdSmrg	temp_rpath="$rpath"
47664456fccdSmrg      fi
47674456fccdSmrg
47684456fccdSmrg      if test -n "$compile_shlibpath$finalize_shlibpath"; then
47694456fccdSmrg	compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
47704456fccdSmrg      fi
47714456fccdSmrg      if test -n "$finalize_shlibpath"; then
47724456fccdSmrg	finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
47734456fccdSmrg      fi
47744456fccdSmrg
47754456fccdSmrg      compile_var=
47764456fccdSmrg      finalize_var=
47774456fccdSmrg      if test -n "$runpath_var"; then
47784456fccdSmrg	if test -n "$perm_rpath"; then
47794456fccdSmrg	  # We should set the runpath_var.
47804456fccdSmrg	  rpath=
47814456fccdSmrg	  for dir in $perm_rpath; do
47824456fccdSmrg	    rpath="$rpath$dir:"
47834456fccdSmrg	  done
47844456fccdSmrg	  compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
47854456fccdSmrg	fi
47864456fccdSmrg	if test -n "$finalize_perm_rpath"; then
47874456fccdSmrg	  # We should set the runpath_var.
47884456fccdSmrg	  rpath=
47894456fccdSmrg	  for dir in $finalize_perm_rpath; do
47904456fccdSmrg	    rpath="$rpath$dir:"
47914456fccdSmrg	  done
47924456fccdSmrg	  finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
47934456fccdSmrg	fi
47944456fccdSmrg      fi
47954456fccdSmrg
47964456fccdSmrg      if test "$no_install" = yes; then
47974456fccdSmrg	# We don't need to create a wrapper script.
47984456fccdSmrg	link_command="$compile_var$compile_command$compile_rpath"
47994456fccdSmrg	# Replace the output file specification.
48004456fccdSmrg	link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
48014456fccdSmrg	# Delete the old output file.
48024456fccdSmrg	$run $rm $output
48034456fccdSmrg	# Link the executable and exit
48044456fccdSmrg	$show "$link_command"
48054456fccdSmrg	$run eval "$link_command" || exit $?
48064456fccdSmrg	exit $EXIT_SUCCESS
48074456fccdSmrg      fi
48084456fccdSmrg
48094456fccdSmrg      if test "$hardcode_action" = relink; then
48104456fccdSmrg	# Fast installation is not supported
48114456fccdSmrg	link_command="$compile_var$compile_command$compile_rpath"
48124456fccdSmrg	relink_command="$finalize_var$finalize_command$finalize_rpath"
48134456fccdSmrg
48144456fccdSmrg	$echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
48154456fccdSmrg	$echo "$modename: \`$output' will be relinked during installation" 1>&2
48164456fccdSmrg      else
48174456fccdSmrg	if test "$fast_install" != no; then
48184456fccdSmrg	  link_command="$finalize_var$compile_command$finalize_rpath"
48194456fccdSmrg	  if test "$fast_install" = yes; then
48204456fccdSmrg	    relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
48214456fccdSmrg	  else
48224456fccdSmrg	    # fast_install is set to needless
48234456fccdSmrg	    relink_command=
48244456fccdSmrg	  fi
48254456fccdSmrg	else
48264456fccdSmrg	  link_command="$compile_var$compile_command$compile_rpath"
48274456fccdSmrg	  relink_command="$finalize_var$finalize_command$finalize_rpath"
48284456fccdSmrg	fi
48294456fccdSmrg      fi
48304456fccdSmrg
48314456fccdSmrg      # Replace the output file specification.
48324456fccdSmrg      link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
48334456fccdSmrg
48344456fccdSmrg      # Delete the old output files.
48354456fccdSmrg      $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
48364456fccdSmrg
48374456fccdSmrg      $show "$link_command"
48384456fccdSmrg      $run eval "$link_command" || exit $?
48394456fccdSmrg
48404456fccdSmrg      # Now create the wrapper script.
48414456fccdSmrg      $show "creating $output"
48424456fccdSmrg
48434456fccdSmrg      # Quote the relink command for shipping.
48444456fccdSmrg      if test -n "$relink_command"; then
48454456fccdSmrg	# Preserve any variables that may affect compiler behavior
48464456fccdSmrg	for var in $variables_saved_for_relink; do
48474456fccdSmrg	  if eval test -z \"\${$var+set}\"; then
48484456fccdSmrg	    relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
48494456fccdSmrg	  elif eval var_value=\$$var; test -z "$var_value"; then
48504456fccdSmrg	    relink_command="$var=; export $var; $relink_command"
48514456fccdSmrg	  else
48524456fccdSmrg	    var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
48534456fccdSmrg	    relink_command="$var=\"$var_value\"; export $var; $relink_command"
48544456fccdSmrg	  fi
48554456fccdSmrg	done
48564456fccdSmrg	relink_command="(cd `pwd`; $relink_command)"
48574456fccdSmrg	relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
48584456fccdSmrg      fi
48594456fccdSmrg
48604456fccdSmrg      # Quote $echo for shipping.
48614456fccdSmrg      if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
48624456fccdSmrg	case $progpath in
48634456fccdSmrg	[\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
48644456fccdSmrg	*) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
48654456fccdSmrg	esac
48664456fccdSmrg	qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
48674456fccdSmrg      else
48684456fccdSmrg	qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
48694456fccdSmrg      fi
48704456fccdSmrg
48714456fccdSmrg      # Only actually do things if our run command is non-null.
48724456fccdSmrg      if test -z "$run"; then
48734456fccdSmrg	# win32 will think the script is a binary if it has
48744456fccdSmrg	# a .exe suffix, so we strip it off here.
48754456fccdSmrg	case $output in
48764456fccdSmrg	  *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
48774456fccdSmrg	esac
48784456fccdSmrg	# test for cygwin because mv fails w/o .exe extensions
48794456fccdSmrg	case $host in
48804456fccdSmrg	  *cygwin*)
48814456fccdSmrg	    exeext=.exe
48824456fccdSmrg	    outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
48834456fccdSmrg	  *) exeext= ;;
48844456fccdSmrg	esac
48854456fccdSmrg	case $host in
48864456fccdSmrg	  *cygwin* | *mingw* )
48874456fccdSmrg            output_name=`basename $output`
48884456fccdSmrg            output_path=`dirname $output`
48894456fccdSmrg            cwrappersource="$output_path/$objdir/lt-$output_name.c"
48904456fccdSmrg            cwrapper="$output_path/$output_name.exe"
48914456fccdSmrg            $rm $cwrappersource $cwrapper
48924456fccdSmrg            trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
48934456fccdSmrg
48944456fccdSmrg	    cat > $cwrappersource <<EOF
48954456fccdSmrg
48964456fccdSmrg/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
48974456fccdSmrg   Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
48984456fccdSmrg
48994456fccdSmrg   The $output program cannot be directly executed until all the libtool
49004456fccdSmrg   libraries that it depends on are installed.
49014456fccdSmrg
49024456fccdSmrg   This wrapper executable should never be moved out of the build directory.
49034456fccdSmrg   If it is, it will not operate correctly.
49044456fccdSmrg
49054456fccdSmrg   Currently, it simply execs the wrapper *script* "/bin/sh $output",
49064456fccdSmrg   but could eventually absorb all of the scripts functionality and
49074456fccdSmrg   exec $objdir/$outputname directly.
49084456fccdSmrg*/
49094456fccdSmrgEOF
49104456fccdSmrg	    cat >> $cwrappersource<<"EOF"
49114456fccdSmrg#include <stdio.h>
49124456fccdSmrg#include <stdlib.h>
49134456fccdSmrg#include <unistd.h>
49144456fccdSmrg#include <malloc.h>
49154456fccdSmrg#include <stdarg.h>
49164456fccdSmrg#include <assert.h>
49174456fccdSmrg#include <string.h>
49184456fccdSmrg#include <ctype.h>
49194456fccdSmrg#include <sys/stat.h>
49204456fccdSmrg
49214456fccdSmrg#if defined(PATH_MAX)
49224456fccdSmrg# define LT_PATHMAX PATH_MAX
49234456fccdSmrg#elif defined(MAXPATHLEN)
49244456fccdSmrg# define LT_PATHMAX MAXPATHLEN
49254456fccdSmrg#else
49264456fccdSmrg# define LT_PATHMAX 1024
49274456fccdSmrg#endif
49284456fccdSmrg
49294456fccdSmrg#ifndef DIR_SEPARATOR
49304456fccdSmrg# define DIR_SEPARATOR '/'
49314456fccdSmrg# define PATH_SEPARATOR ':'
49324456fccdSmrg#endif
49334456fccdSmrg
49344456fccdSmrg#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
49354456fccdSmrg  defined (__OS2__)
49364456fccdSmrg# define HAVE_DOS_BASED_FILE_SYSTEM
49374456fccdSmrg# ifndef DIR_SEPARATOR_2
49384456fccdSmrg#  define DIR_SEPARATOR_2 '\\'
49394456fccdSmrg# endif
49404456fccdSmrg# ifndef PATH_SEPARATOR_2
49414456fccdSmrg#  define PATH_SEPARATOR_2 ';'
49424456fccdSmrg# endif
49434456fccdSmrg#endif
49444456fccdSmrg
49454456fccdSmrg#ifndef DIR_SEPARATOR_2
49464456fccdSmrg# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
49474456fccdSmrg#else /* DIR_SEPARATOR_2 */
49484456fccdSmrg# define IS_DIR_SEPARATOR(ch) \
49494456fccdSmrg        (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
49504456fccdSmrg#endif /* DIR_SEPARATOR_2 */
49514456fccdSmrg
49524456fccdSmrg#ifndef PATH_SEPARATOR_2
49534456fccdSmrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
49544456fccdSmrg#else /* PATH_SEPARATOR_2 */
49554456fccdSmrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
49564456fccdSmrg#endif /* PATH_SEPARATOR_2 */
49574456fccdSmrg
49584456fccdSmrg#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
49594456fccdSmrg#define XFREE(stale) do { \
49604456fccdSmrg  if (stale) { free ((void *) stale); stale = 0; } \
49614456fccdSmrg} while (0)
49624456fccdSmrg
49634456fccdSmrg/* -DDEBUG is fairly common in CFLAGS.  */
49644456fccdSmrg#undef DEBUG
49654456fccdSmrg#if defined DEBUGWRAPPER
49664456fccdSmrg# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
49674456fccdSmrg#else
49684456fccdSmrg# define DEBUG(format, ...)
49694456fccdSmrg#endif
49704456fccdSmrg
49714456fccdSmrgconst char *program_name = NULL;
49724456fccdSmrg
49734456fccdSmrgvoid * xmalloc (size_t num);
49744456fccdSmrgchar * xstrdup (const char *string);
49754456fccdSmrgconst char * base_name (const char *name);
49764456fccdSmrgchar * find_executable(const char *wrapper);
49774456fccdSmrgint    check_executable(const char *path);
49784456fccdSmrgchar * strendzap(char *str, const char *pat);
49794456fccdSmrgvoid lt_fatal (const char *message, ...);
49804456fccdSmrg
49814456fccdSmrgint
49824456fccdSmrgmain (int argc, char *argv[])
49834456fccdSmrg{
49844456fccdSmrg  char **newargz;
49854456fccdSmrg  int i;
49864456fccdSmrg
49874456fccdSmrg  program_name = (char *) xstrdup (base_name (argv[0]));
49884456fccdSmrg  DEBUG("(main) argv[0]      : %s\n",argv[0]);
49894456fccdSmrg  DEBUG("(main) program_name : %s\n",program_name);
49904456fccdSmrg  newargz = XMALLOC(char *, argc+2);
49914456fccdSmrgEOF
49924456fccdSmrg
49934456fccdSmrg            cat >> $cwrappersource <<EOF
49944456fccdSmrg  newargz[0] = (char *) xstrdup("$SHELL");
49954456fccdSmrgEOF
49964456fccdSmrg
49974456fccdSmrg            cat >> $cwrappersource <<"EOF"
49984456fccdSmrg  newargz[1] = find_executable(argv[0]);
49994456fccdSmrg  if (newargz[1] == NULL)
50004456fccdSmrg    lt_fatal("Couldn't find %s", argv[0]);
50014456fccdSmrg  DEBUG("(main) found exe at : %s\n",newargz[1]);
50024456fccdSmrg  /* we know the script has the same name, without the .exe */
50034456fccdSmrg  /* so make sure newargz[1] doesn't end in .exe */
50044456fccdSmrg  strendzap(newargz[1],".exe");
50054456fccdSmrg  for (i = 1; i < argc; i++)
50064456fccdSmrg    newargz[i+1] = xstrdup(argv[i]);
50074456fccdSmrg  newargz[argc+1] = NULL;
50084456fccdSmrg
50094456fccdSmrg  for (i=0; i<argc+1; i++)
50104456fccdSmrg  {
50114456fccdSmrg    DEBUG("(main) newargz[%d]   : %s\n",i,newargz[i]);
50124456fccdSmrg    ;
50134456fccdSmrg  }
50144456fccdSmrg
50154456fccdSmrgEOF
50164456fccdSmrg
50174456fccdSmrg            case $host_os in
50184456fccdSmrg              mingw*)
50194456fccdSmrg                cat >> $cwrappersource <<EOF
50204456fccdSmrg  execv("$SHELL",(char const **)newargz);
50214456fccdSmrgEOF
50224456fccdSmrg              ;;
50234456fccdSmrg              *)
50244456fccdSmrg                cat >> $cwrappersource <<EOF
50254456fccdSmrg  execv("$SHELL",newargz);
50264456fccdSmrgEOF
50274456fccdSmrg              ;;
50284456fccdSmrg            esac
50294456fccdSmrg
50304456fccdSmrg            cat >> $cwrappersource <<"EOF"
50314456fccdSmrg  return 127;
50324456fccdSmrg}
50334456fccdSmrg
50344456fccdSmrgvoid *
50354456fccdSmrgxmalloc (size_t num)
50364456fccdSmrg{
50374456fccdSmrg  void * p = (void *) malloc (num);
50384456fccdSmrg  if (!p)
50394456fccdSmrg    lt_fatal ("Memory exhausted");
50404456fccdSmrg
50414456fccdSmrg  return p;
50424456fccdSmrg}
50434456fccdSmrg
50444456fccdSmrgchar *
50454456fccdSmrgxstrdup (const char *string)
50464456fccdSmrg{
50474456fccdSmrg  return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
50484456fccdSmrg;
50494456fccdSmrg}
50504456fccdSmrg
50514456fccdSmrgconst char *
50524456fccdSmrgbase_name (const char *name)
50534456fccdSmrg{
50544456fccdSmrg  const char *base;
50554456fccdSmrg
50564456fccdSmrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
50574456fccdSmrg  /* Skip over the disk name in MSDOS pathnames. */
50584456fccdSmrg  if (isalpha ((unsigned char)name[0]) && name[1] == ':')
50594456fccdSmrg    name += 2;
50604456fccdSmrg#endif
50614456fccdSmrg
50624456fccdSmrg  for (base = name; *name; name++)
50634456fccdSmrg    if (IS_DIR_SEPARATOR (*name))
50644456fccdSmrg      base = name + 1;
50654456fccdSmrg  return base;
50664456fccdSmrg}
50674456fccdSmrg
50684456fccdSmrgint
50694456fccdSmrgcheck_executable(const char * path)
50704456fccdSmrg{
50714456fccdSmrg  struct stat st;
50724456fccdSmrg
50734456fccdSmrg  DEBUG("(check_executable)  : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
50744456fccdSmrg  if ((!path) || (!*path))
50754456fccdSmrg    return 0;
50764456fccdSmrg
50774456fccdSmrg  if ((stat (path, &st) >= 0) &&
50784456fccdSmrg      (
50794456fccdSmrg        /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
50804456fccdSmrg#if defined (S_IXOTH)
50814456fccdSmrg       ((st.st_mode & S_IXOTH) == S_IXOTH) ||
50824456fccdSmrg#endif
50834456fccdSmrg#if defined (S_IXGRP)
50844456fccdSmrg       ((st.st_mode & S_IXGRP) == S_IXGRP) ||
50854456fccdSmrg#endif
50864456fccdSmrg       ((st.st_mode & S_IXUSR) == S_IXUSR))
50874456fccdSmrg      )
50884456fccdSmrg    return 1;
50894456fccdSmrg  else
50904456fccdSmrg    return 0;
50914456fccdSmrg}
50924456fccdSmrg
50934456fccdSmrg/* Searches for the full path of the wrapper.  Returns
50944456fccdSmrg   newly allocated full path name if found, NULL otherwise */
50954456fccdSmrgchar *
50964456fccdSmrgfind_executable (const char* wrapper)
50974456fccdSmrg{
50984456fccdSmrg  int has_slash = 0;
50994456fccdSmrg  const char* p;
51004456fccdSmrg  const char* p_next;
51014456fccdSmrg  /* static buffer for getcwd */
51024456fccdSmrg  char tmp[LT_PATHMAX + 1];
51034456fccdSmrg  int tmp_len;
51044456fccdSmrg  char* concat_name;
51054456fccdSmrg
51064456fccdSmrg  DEBUG("(find_executable)  : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
51074456fccdSmrg
51084456fccdSmrg  if ((wrapper == NULL) || (*wrapper == '\0'))
51094456fccdSmrg    return NULL;
51104456fccdSmrg
51114456fccdSmrg  /* Absolute path? */
51124456fccdSmrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
51134456fccdSmrg  if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
51144456fccdSmrg  {
51154456fccdSmrg    concat_name = xstrdup (wrapper);
51164456fccdSmrg    if (check_executable(concat_name))
51174456fccdSmrg      return concat_name;
51184456fccdSmrg    XFREE(concat_name);
51194456fccdSmrg  }
51204456fccdSmrg  else
51214456fccdSmrg  {
51224456fccdSmrg#endif
51234456fccdSmrg    if (IS_DIR_SEPARATOR (wrapper[0]))
51244456fccdSmrg    {
51254456fccdSmrg      concat_name = xstrdup (wrapper);
51264456fccdSmrg      if (check_executable(concat_name))
51274456fccdSmrg        return concat_name;
51284456fccdSmrg      XFREE(concat_name);
51294456fccdSmrg    }
51304456fccdSmrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
51314456fccdSmrg  }
51324456fccdSmrg#endif
51334456fccdSmrg
51344456fccdSmrg  for (p = wrapper; *p; p++)
51354456fccdSmrg    if (*p == '/')
51364456fccdSmrg    {
51374456fccdSmrg      has_slash = 1;
51384456fccdSmrg      break;
51394456fccdSmrg    }
51404456fccdSmrg  if (!has_slash)
51414456fccdSmrg  {
51424456fccdSmrg    /* no slashes; search PATH */
51434456fccdSmrg    const char* path = getenv ("PATH");
51444456fccdSmrg    if (path != NULL)
51454456fccdSmrg    {
51464456fccdSmrg      for (p = path; *p; p = p_next)
51474456fccdSmrg      {
51484456fccdSmrg        const char* q;
51494456fccdSmrg        size_t p_len;
51504456fccdSmrg        for (q = p; *q; q++)
51514456fccdSmrg          if (IS_PATH_SEPARATOR(*q))
51524456fccdSmrg            break;
51534456fccdSmrg        p_len = q - p;
51544456fccdSmrg        p_next = (*q == '\0' ? q : q + 1);
51554456fccdSmrg        if (p_len == 0)
51564456fccdSmrg        {
51574456fccdSmrg          /* empty path: current directory */
51584456fccdSmrg          if (getcwd (tmp, LT_PATHMAX) == NULL)
51594456fccdSmrg            lt_fatal ("getcwd failed");
51604456fccdSmrg          tmp_len = strlen(tmp);
51614456fccdSmrg          concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
51624456fccdSmrg          memcpy (concat_name, tmp, tmp_len);
51634456fccdSmrg          concat_name[tmp_len] = '/';
51644456fccdSmrg          strcpy (concat_name + tmp_len + 1, wrapper);
51654456fccdSmrg        }
51664456fccdSmrg        else
51674456fccdSmrg        {
51684456fccdSmrg          concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
51694456fccdSmrg          memcpy (concat_name, p, p_len);
51704456fccdSmrg          concat_name[p_len] = '/';
51714456fccdSmrg          strcpy (concat_name + p_len + 1, wrapper);
51724456fccdSmrg        }
51734456fccdSmrg        if (check_executable(concat_name))
51744456fccdSmrg          return concat_name;
51754456fccdSmrg        XFREE(concat_name);
51764456fccdSmrg      }
51774456fccdSmrg    }
51784456fccdSmrg    /* not found in PATH; assume curdir */
51794456fccdSmrg  }
51804456fccdSmrg  /* Relative path | not found in path: prepend cwd */
51814456fccdSmrg  if (getcwd (tmp, LT_PATHMAX) == NULL)
51824456fccdSmrg    lt_fatal ("getcwd failed");
51834456fccdSmrg  tmp_len = strlen(tmp);
51844456fccdSmrg  concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
51854456fccdSmrg  memcpy (concat_name, tmp, tmp_len);
51864456fccdSmrg  concat_name[tmp_len] = '/';
51874456fccdSmrg  strcpy (concat_name + tmp_len + 1, wrapper);
51884456fccdSmrg
51894456fccdSmrg  if (check_executable(concat_name))
51904456fccdSmrg    return concat_name;
51914456fccdSmrg  XFREE(concat_name);
51924456fccdSmrg  return NULL;
51934456fccdSmrg}
51944456fccdSmrg
51954456fccdSmrgchar *
51964456fccdSmrgstrendzap(char *str, const char *pat)
51974456fccdSmrg{
51984456fccdSmrg  size_t len, patlen;
51994456fccdSmrg
52004456fccdSmrg  assert(str != NULL);
52014456fccdSmrg  assert(pat != NULL);
52024456fccdSmrg
52034456fccdSmrg  len = strlen(str);
52044456fccdSmrg  patlen = strlen(pat);
52054456fccdSmrg
52064456fccdSmrg  if (patlen <= len)
52074456fccdSmrg  {
52084456fccdSmrg    str += len - patlen;
52094456fccdSmrg    if (strcmp(str, pat) == 0)
52104456fccdSmrg      *str = '\0';
52114456fccdSmrg  }
52124456fccdSmrg  return str;
52134456fccdSmrg}
52144456fccdSmrg
52154456fccdSmrgstatic void
52164456fccdSmrglt_error_core (int exit_status, const char * mode,
52174456fccdSmrg          const char * message, va_list ap)
52184456fccdSmrg{
52194456fccdSmrg  fprintf (stderr, "%s: %s: ", program_name, mode);
52204456fccdSmrg  vfprintf (stderr, message, ap);
52214456fccdSmrg  fprintf (stderr, ".\n");
52224456fccdSmrg
52234456fccdSmrg  if (exit_status >= 0)
52244456fccdSmrg    exit (exit_status);
52254456fccdSmrg}
52264456fccdSmrg
52274456fccdSmrgvoid
52284456fccdSmrglt_fatal (const char *message, ...)
52294456fccdSmrg{
52304456fccdSmrg  va_list ap;
52314456fccdSmrg  va_start (ap, message);
52324456fccdSmrg  lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
52334456fccdSmrg  va_end (ap);
52344456fccdSmrg}
52354456fccdSmrgEOF
52364456fccdSmrg          # we should really use a build-platform specific compiler
52374456fccdSmrg          # here, but OTOH, the wrappers (shell script and this C one)
52384456fccdSmrg          # are only useful if you want to execute the "real" binary.
52394456fccdSmrg          # Since the "real" binary is built for $host, then this
52404456fccdSmrg          # wrapper might as well be built for $host, too.
52414456fccdSmrg          $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
52424456fccdSmrg          ;;
52434456fccdSmrg        esac
52444456fccdSmrg        $rm $output
52454456fccdSmrg        trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
52464456fccdSmrg
52474456fccdSmrg	$echo > $output "\
52484456fccdSmrg#! $SHELL
52494456fccdSmrg
52504456fccdSmrg# $output - temporary wrapper script for $objdir/$outputname
52514456fccdSmrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
52524456fccdSmrg#
52534456fccdSmrg# The $output program cannot be directly executed until all the libtool
52544456fccdSmrg# libraries that it depends on are installed.
52554456fccdSmrg#
52564456fccdSmrg# This wrapper script should never be moved out of the build directory.
52574456fccdSmrg# If it is, it will not operate correctly.
52584456fccdSmrg
52594456fccdSmrg# Sed substitution that helps us do robust quoting.  It backslashifies
52604456fccdSmrg# metacharacters that are still active within double-quoted strings.
52614456fccdSmrgXsed='${SED} -e 1s/^X//'
52624456fccdSmrgsed_quote_subst='$sed_quote_subst'
52634456fccdSmrg
52644456fccdSmrg# The HP-UX ksh and POSIX shell print the target directory to stdout
52654456fccdSmrg# if CDPATH is set.
52664456fccdSmrg(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
52674456fccdSmrg
52684456fccdSmrgrelink_command=\"$relink_command\"
52694456fccdSmrg
52704456fccdSmrg# This environment variable determines our operation mode.
52714456fccdSmrgif test \"\$libtool_install_magic\" = \"$magic\"; then
52724456fccdSmrg  # install mode needs the following variable:
52734456fccdSmrg  notinst_deplibs='$notinst_deplibs'
52744456fccdSmrgelse
52754456fccdSmrg  # When we are sourced in execute mode, \$file and \$echo are already set.
52764456fccdSmrg  if test \"\$libtool_execute_magic\" != \"$magic\"; then
52774456fccdSmrg    echo=\"$qecho\"
52784456fccdSmrg    file=\"\$0\"
52794456fccdSmrg    # Make sure echo works.
52804456fccdSmrg    if test \"X\$1\" = X--no-reexec; then
52814456fccdSmrg      # Discard the --no-reexec flag, and continue.
52824456fccdSmrg      shift
52834456fccdSmrg    elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
52844456fccdSmrg      # Yippee, \$echo works!
52854456fccdSmrg      :
52864456fccdSmrg    else
52874456fccdSmrg      # Restart under the correct shell, and then maybe \$echo will work.
52884456fccdSmrg      exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
52894456fccdSmrg    fi
52904456fccdSmrg  fi\
52914456fccdSmrg"
52924456fccdSmrg	$echo >> $output "\
52934456fccdSmrg
52944456fccdSmrg  # Find the directory that this script lives in.
52954456fccdSmrg  thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
52964456fccdSmrg  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
52974456fccdSmrg
52984456fccdSmrg  # Follow symbolic links until we get to the real thisdir.
52994456fccdSmrg  file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
53004456fccdSmrg  while test -n \"\$file\"; do
53014456fccdSmrg    destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
53024456fccdSmrg
53034456fccdSmrg    # If there was a directory component, then change thisdir.
53044456fccdSmrg    if test \"x\$destdir\" != \"x\$file\"; then
53054456fccdSmrg      case \"\$destdir\" in
53064456fccdSmrg      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
53074456fccdSmrg      *) thisdir=\"\$thisdir/\$destdir\" ;;
53084456fccdSmrg      esac
53094456fccdSmrg    fi
53104456fccdSmrg
53114456fccdSmrg    file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
53124456fccdSmrg    file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
53134456fccdSmrg  done
53144456fccdSmrg
53154456fccdSmrg  # Try to get the absolute directory name.
53164456fccdSmrg  absdir=\`cd \"\$thisdir\" && pwd\`
53174456fccdSmrg  test -n \"\$absdir\" && thisdir=\"\$absdir\"
53184456fccdSmrg"
53194456fccdSmrg
53204456fccdSmrg	if test "$fast_install" = yes; then
53214456fccdSmrg	  $echo >> $output "\
53224456fccdSmrg  program=lt-'$outputname'$exeext
53234456fccdSmrg  progdir=\"\$thisdir/$objdir\"
53244456fccdSmrg
53254456fccdSmrg  if test ! -f \"\$progdir/\$program\" || \\
53264456fccdSmrg     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
53274456fccdSmrg       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
53284456fccdSmrg
53294456fccdSmrg    file=\"\$\$-\$program\"
53304456fccdSmrg
53314456fccdSmrg    if test ! -d \"\$progdir\"; then
53324456fccdSmrg      $mkdir \"\$progdir\"
53334456fccdSmrg    else
53344456fccdSmrg      $rm \"\$progdir/\$file\"
53354456fccdSmrg    fi"
53364456fccdSmrg
53374456fccdSmrg	  $echo >> $output "\
53384456fccdSmrg
53394456fccdSmrg    # relink executable if necessary
53404456fccdSmrg    if test -n \"\$relink_command\"; then
53414456fccdSmrg      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
53424456fccdSmrg      else
53434456fccdSmrg	$echo \"\$relink_command_output\" >&2
53444456fccdSmrg	$rm \"\$progdir/\$file\"
53454456fccdSmrg	exit $EXIT_FAILURE
53464456fccdSmrg      fi
53474456fccdSmrg    fi
53484456fccdSmrg
53494456fccdSmrg    $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
53504456fccdSmrg    { $rm \"\$progdir/\$program\";
53514456fccdSmrg      $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
53524456fccdSmrg    $rm \"\$progdir/\$file\"
53534456fccdSmrg  fi"
53544456fccdSmrg	else
53554456fccdSmrg	  $echo >> $output "\
53564456fccdSmrg  program='$outputname'
53574456fccdSmrg  progdir=\"\$thisdir/$objdir\"
53584456fccdSmrg"
53594456fccdSmrg	fi
53604456fccdSmrg
53614456fccdSmrg	$echo >> $output "\
53624456fccdSmrg
53634456fccdSmrg  if test -f \"\$progdir/\$program\"; then"
53644456fccdSmrg
53654456fccdSmrg	# Export our shlibpath_var if we have one.
53664456fccdSmrg	if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
53674456fccdSmrg	  $echo >> $output "\
53684456fccdSmrg    # Add our own library path to $shlibpath_var
53694456fccdSmrg    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
53704456fccdSmrg
53714456fccdSmrg    # Some systems cannot cope with colon-terminated $shlibpath_var
53724456fccdSmrg    # The second colon is a workaround for a bug in BeOS R4 sed
53734456fccdSmrg    $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
53744456fccdSmrg
53754456fccdSmrg    export $shlibpath_var
53764456fccdSmrg"
53774456fccdSmrg	fi
53784456fccdSmrg
53794456fccdSmrg	# fixup the dll searchpath if we need to.
53804456fccdSmrg	if test -n "$dllsearchpath"; then
53814456fccdSmrg	  $echo >> $output "\
53824456fccdSmrg    # Add the dll search path components to the executable PATH
53834456fccdSmrg    PATH=$dllsearchpath:\$PATH
53844456fccdSmrg"
53854456fccdSmrg	fi
53864456fccdSmrg
53874456fccdSmrg	$echo >> $output "\
53884456fccdSmrg    if test \"\$libtool_execute_magic\" != \"$magic\"; then
53894456fccdSmrg      # Run the actual program with our arguments.
53904456fccdSmrg"
53914456fccdSmrg	case $host in
53924456fccdSmrg	# Backslashes separate directories on plain windows
53934456fccdSmrg	*-*-mingw | *-*-os2*)
53944456fccdSmrg	  $echo >> $output "\
53954456fccdSmrg      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
53964456fccdSmrg"
53974456fccdSmrg	  ;;
53984456fccdSmrg
53994456fccdSmrg	*)
54004456fccdSmrg	  $echo >> $output "\
54014456fccdSmrg      exec \"\$progdir/\$program\" \${1+\"\$@\"}
54024456fccdSmrg"
54034456fccdSmrg	  ;;
54044456fccdSmrg	esac
54054456fccdSmrg	$echo >> $output "\
54064456fccdSmrg      \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
54074456fccdSmrg      exit $EXIT_FAILURE
54084456fccdSmrg    fi
54094456fccdSmrg  else
54104456fccdSmrg    # The program doesn't exist.
54114456fccdSmrg    \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
54124456fccdSmrg    \$echo \"This script is just a wrapper for \$program.\" 1>&2
54134456fccdSmrg    $echo \"See the $PACKAGE documentation for more information.\" 1>&2
54144456fccdSmrg    exit $EXIT_FAILURE
54154456fccdSmrg  fi
54164456fccdSmrgfi\
54174456fccdSmrg"
54184456fccdSmrg	chmod +x $output
54194456fccdSmrg      fi
54204456fccdSmrg      exit $EXIT_SUCCESS
54214456fccdSmrg      ;;
54224456fccdSmrg    esac
54234456fccdSmrg
54244456fccdSmrg    # See if we need to build an old-fashioned archive.
54254456fccdSmrg    for oldlib in $oldlibs; do
54264456fccdSmrg
54274456fccdSmrg      if test "$build_libtool_libs" = convenience; then
54284456fccdSmrg	oldobjs="$libobjs_save"
54294456fccdSmrg	addlibs="$convenience"
54304456fccdSmrg	build_libtool_libs=no
54314456fccdSmrg      else
54324456fccdSmrg	if test "$build_libtool_libs" = module; then
54334456fccdSmrg	  oldobjs="$libobjs_save"
54344456fccdSmrg	  build_libtool_libs=no
54354456fccdSmrg	else
54364456fccdSmrg	  oldobjs="$old_deplibs $non_pic_objects"
54374456fccdSmrg	fi
54384456fccdSmrg	addlibs="$old_convenience"
54394456fccdSmrg      fi
54404456fccdSmrg
54414456fccdSmrg      if test -n "$addlibs"; then
54424456fccdSmrg	gentop="$output_objdir/${outputname}x"
54434456fccdSmrg	generated="$generated $gentop"
54444456fccdSmrg
54454456fccdSmrg	func_extract_archives $gentop $addlibs
54464456fccdSmrg	oldobjs="$oldobjs $func_extract_archives_result"
54474456fccdSmrg      fi
54484456fccdSmrg
54494456fccdSmrg      # Do each command in the archive commands.
54504456fccdSmrg      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
54514456fccdSmrg       cmds=$old_archive_from_new_cmds
54524456fccdSmrg      else
54534456fccdSmrg	# POSIX demands no paths to be encoded in archives.  We have
54544456fccdSmrg	# to avoid creating archives with duplicate basenames if we
54554456fccdSmrg	# might have to extract them afterwards, e.g., when creating a
54564456fccdSmrg	# static archive out of a convenience library, or when linking
54574456fccdSmrg	# the entirety of a libtool archive into another (currently
54584456fccdSmrg	# not supported by libtool).
54594456fccdSmrg	if (for obj in $oldobjs
54604456fccdSmrg	    do
54614456fccdSmrg	      $echo "X$obj" | $Xsed -e 's%^.*/%%'
54624456fccdSmrg	    done | sort | sort -uc >/dev/null 2>&1); then
54634456fccdSmrg	  :
54644456fccdSmrg	else
54654456fccdSmrg	  $echo "copying selected object files to avoid basename conflicts..."
54664456fccdSmrg
54674456fccdSmrg	  if test -z "$gentop"; then
54684456fccdSmrg	    gentop="$output_objdir/${outputname}x"
54694456fccdSmrg	    generated="$generated $gentop"
54704456fccdSmrg
54714456fccdSmrg	    $show "${rm}r $gentop"
54724456fccdSmrg	    $run ${rm}r "$gentop"
54734456fccdSmrg	    $show "$mkdir $gentop"
54744456fccdSmrg	    $run $mkdir "$gentop"
54754456fccdSmrg	    exit_status=$?
54764456fccdSmrg	    if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
54774456fccdSmrg	      exit $exit_status
54784456fccdSmrg	    fi
54794456fccdSmrg	  fi
54804456fccdSmrg
54814456fccdSmrg	  save_oldobjs=$oldobjs
54824456fccdSmrg	  oldobjs=
54834456fccdSmrg	  counter=1
54844456fccdSmrg	  for obj in $save_oldobjs
54854456fccdSmrg	  do
54864456fccdSmrg	    objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
54874456fccdSmrg	    case " $oldobjs " in
54884456fccdSmrg	    " ") oldobjs=$obj ;;
54894456fccdSmrg	    *[\ /]"$objbase "*)
54904456fccdSmrg	      while :; do
54914456fccdSmrg		# Make sure we don't pick an alternate name that also
54924456fccdSmrg		# overlaps.
54934456fccdSmrg		newobj=lt$counter-$objbase
54944456fccdSmrg		counter=`expr $counter + 1`
54954456fccdSmrg		case " $oldobjs " in
54964456fccdSmrg		*[\ /]"$newobj "*) ;;
54974456fccdSmrg		*) if test ! -f "$gentop/$newobj"; then break; fi ;;
54984456fccdSmrg		esac
54994456fccdSmrg	      done
55004456fccdSmrg	      $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
55014456fccdSmrg	      $run ln "$obj" "$gentop/$newobj" ||
55024456fccdSmrg	      $run cp "$obj" "$gentop/$newobj"
55034456fccdSmrg	      oldobjs="$oldobjs $gentop/$newobj"
55044456fccdSmrg	      ;;
55054456fccdSmrg	    *) oldobjs="$oldobjs $obj" ;;
55064456fccdSmrg	    esac
55074456fccdSmrg	  done
55084456fccdSmrg	fi
55094456fccdSmrg
55104456fccdSmrg	eval cmds=\"$old_archive_cmds\"
55114456fccdSmrg
55124456fccdSmrg	if len=`expr "X$cmds" : ".*"` &&
55134456fccdSmrg	     test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
55144456fccdSmrg	  cmds=$old_archive_cmds
55154456fccdSmrg	else
55164456fccdSmrg	  # the command line is too long to link in one step, link in parts
55174456fccdSmrg	  $echo "using piecewise archive linking..."
55184456fccdSmrg	  save_RANLIB=$RANLIB
55194456fccdSmrg	  RANLIB=:
55204456fccdSmrg	  objlist=
55214456fccdSmrg	  concat_cmds=
55224456fccdSmrg	  save_oldobjs=$oldobjs
55234456fccdSmrg
55244456fccdSmrg	  # Is there a better way of finding the last object in the list?
55254456fccdSmrg	  for obj in $save_oldobjs
55264456fccdSmrg	  do
55274456fccdSmrg	    last_oldobj=$obj
55284456fccdSmrg	  done
55294456fccdSmrg	  for obj in $save_oldobjs
55304456fccdSmrg	  do
55314456fccdSmrg	    oldobjs="$objlist $obj"
55324456fccdSmrg	    objlist="$objlist $obj"
55334456fccdSmrg	    eval test_cmds=\"$old_archive_cmds\"
55344456fccdSmrg	    if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
55354456fccdSmrg	       test "$len" -le "$max_cmd_len"; then
55364456fccdSmrg	      :
55374456fccdSmrg	    else
55384456fccdSmrg	      # the above command should be used before it gets too long
55394456fccdSmrg	      oldobjs=$objlist
55404456fccdSmrg	      if test "$obj" = "$last_oldobj" ; then
55414456fccdSmrg	        RANLIB=$save_RANLIB
55424456fccdSmrg	      fi
55434456fccdSmrg	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
55444456fccdSmrg	      eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
55454456fccdSmrg	      objlist=
55464456fccdSmrg	    fi
55474456fccdSmrg	  done
55484456fccdSmrg	  RANLIB=$save_RANLIB
55494456fccdSmrg	  oldobjs=$objlist
55504456fccdSmrg	  if test "X$oldobjs" = "X" ; then
55514456fccdSmrg	    eval cmds=\"\$concat_cmds\"
55524456fccdSmrg	  else
55534456fccdSmrg	    eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
55544456fccdSmrg	  fi
55554456fccdSmrg	fi
55564456fccdSmrg      fi
55574456fccdSmrg      save_ifs="$IFS"; IFS='~'
55584456fccdSmrg      for cmd in $cmds; do
55594456fccdSmrg        eval cmd=\"$cmd\"
55604456fccdSmrg	IFS="$save_ifs"
55614456fccdSmrg	$show "$cmd"
55624456fccdSmrg	$run eval "$cmd" || exit $?
55634456fccdSmrg      done
55644456fccdSmrg      IFS="$save_ifs"
55654456fccdSmrg    done
55664456fccdSmrg
55674456fccdSmrg    if test -n "$generated"; then
55684456fccdSmrg      $show "${rm}r$generated"
55694456fccdSmrg      $run ${rm}r$generated
55704456fccdSmrg    fi
55714456fccdSmrg
55724456fccdSmrg    # Now create the libtool archive.
55734456fccdSmrg    case $output in
55744456fccdSmrg    *.la)
55754456fccdSmrg      old_library=
55764456fccdSmrg      test "$build_old_libs" = yes && old_library="$libname.$libext"
55774456fccdSmrg      $show "creating $output"
55784456fccdSmrg
55794456fccdSmrg      # Preserve any variables that may affect compiler behavior
55804456fccdSmrg      for var in $variables_saved_for_relink; do
55814456fccdSmrg	if eval test -z \"\${$var+set}\"; then
55824456fccdSmrg	  relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
55834456fccdSmrg	elif eval var_value=\$$var; test -z "$var_value"; then
55844456fccdSmrg	  relink_command="$var=; export $var; $relink_command"
55854456fccdSmrg	else
55864456fccdSmrg	  var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
55874456fccdSmrg	  relink_command="$var=\"$var_value\"; export $var; $relink_command"
55884456fccdSmrg	fi
55894456fccdSmrg      done
55904456fccdSmrg      # Quote the link command for shipping.
55914456fccdSmrg      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
55924456fccdSmrg      relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
55934456fccdSmrg      if test "$hardcode_automatic" = yes ; then
55944456fccdSmrg	relink_command=
55954456fccdSmrg      fi
55964456fccdSmrg
55974456fccdSmrg
55984456fccdSmrg      # Only create the output if not a dry run.
55994456fccdSmrg      if test -z "$run"; then
56004456fccdSmrg	for installed in no yes; do
56014456fccdSmrg	  if test "$installed" = yes; then
56024456fccdSmrg	    if test -z "$install_libdir"; then
56034456fccdSmrg	      break
56044456fccdSmrg	    fi
56054456fccdSmrg	    output="$output_objdir/$outputname"i
56064456fccdSmrg	    # Replace all uninstalled libtool libraries with the installed ones
56074456fccdSmrg	    newdependency_libs=
56084456fccdSmrg	    for deplib in $dependency_libs; do
56094456fccdSmrg	      case $deplib in
56104456fccdSmrg	      *.la)
56114456fccdSmrg		name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
56124456fccdSmrg		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
56134456fccdSmrg		if test -z "$libdir"; then
56144456fccdSmrg		  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
56154456fccdSmrg		  exit $EXIT_FAILURE
56164456fccdSmrg		fi
56174456fccdSmrg		newdependency_libs="$newdependency_libs $libdir/$name"
56184456fccdSmrg		;;
56194456fccdSmrg	      *) newdependency_libs="$newdependency_libs $deplib" ;;
56204456fccdSmrg	      esac
56214456fccdSmrg	    done
56224456fccdSmrg	    dependency_libs="$newdependency_libs"
56234456fccdSmrg	    newdlfiles=
56244456fccdSmrg	    for lib in $dlfiles; do
56254456fccdSmrg	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
56264456fccdSmrg	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
56274456fccdSmrg	      if test -z "$libdir"; then
56284456fccdSmrg		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
56294456fccdSmrg		exit $EXIT_FAILURE
56304456fccdSmrg	      fi
56314456fccdSmrg	      newdlfiles="$newdlfiles $libdir/$name"
56324456fccdSmrg	    done
56334456fccdSmrg	    dlfiles="$newdlfiles"
56344456fccdSmrg	    newdlprefiles=
56354456fccdSmrg	    for lib in $dlprefiles; do
56364456fccdSmrg	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
56374456fccdSmrg	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
56384456fccdSmrg	      if test -z "$libdir"; then
56394456fccdSmrg		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
56404456fccdSmrg		exit $EXIT_FAILURE
56414456fccdSmrg	      fi
56424456fccdSmrg	      newdlprefiles="$newdlprefiles $libdir/$name"
56434456fccdSmrg	    done
56444456fccdSmrg	    dlprefiles="$newdlprefiles"
56454456fccdSmrg	  else
56464456fccdSmrg	    newdlfiles=
56474456fccdSmrg	    for lib in $dlfiles; do
56484456fccdSmrg	      case $lib in
56494456fccdSmrg		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
56504456fccdSmrg		*) abs=`pwd`"/$lib" ;;
56514456fccdSmrg	      esac
56524456fccdSmrg	      newdlfiles="$newdlfiles $abs"
56534456fccdSmrg	    done
56544456fccdSmrg	    dlfiles="$newdlfiles"
56554456fccdSmrg	    newdlprefiles=
56564456fccdSmrg	    for lib in $dlprefiles; do
56574456fccdSmrg	      case $lib in
56584456fccdSmrg		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
56594456fccdSmrg		*) abs=`pwd`"/$lib" ;;
56604456fccdSmrg	      esac
56614456fccdSmrg	      newdlprefiles="$newdlprefiles $abs"
56624456fccdSmrg	    done
56634456fccdSmrg	    dlprefiles="$newdlprefiles"
56644456fccdSmrg	  fi
56654456fccdSmrg	  $rm $output
56664456fccdSmrg	  # place dlname in correct position for cygwin
56674456fccdSmrg	  tdlname=$dlname
56684456fccdSmrg	  case $host,$output,$installed,$module,$dlname in
56694456fccdSmrg	    *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
56704456fccdSmrg	  esac
56714456fccdSmrg	  $echo > $output "\
56724456fccdSmrg# $outputname - a libtool library file
56734456fccdSmrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
56744456fccdSmrg#
56754456fccdSmrg# Please DO NOT delete this file!
56764456fccdSmrg# It is necessary for linking the library.
56774456fccdSmrg
56784456fccdSmrg# The name that we can dlopen(3).
56794456fccdSmrgdlname='$tdlname'
56804456fccdSmrg
56814456fccdSmrg# Names of this library.
56824456fccdSmrglibrary_names='$library_names'
56834456fccdSmrg
56844456fccdSmrg# The name of the static archive.
56854456fccdSmrgold_library='$old_library'
56864456fccdSmrg
56874456fccdSmrg# Libraries that this one depends upon.
56884456fccdSmrgdependency_libs='$dependency_libs'
56894456fccdSmrg
56904456fccdSmrg# Version information for $libname.
56914456fccdSmrgcurrent=$current
56924456fccdSmrgage=$age
56934456fccdSmrgrevision=$revision
56944456fccdSmrg
56954456fccdSmrg# Is this an already installed library?
56964456fccdSmrginstalled=$installed
56974456fccdSmrg
56984456fccdSmrg# Should we warn about portability when linking against -modules?
56994456fccdSmrgshouldnotlink=$module
57004456fccdSmrg
57014456fccdSmrg# Files to dlopen/dlpreopen
57024456fccdSmrgdlopen='$dlfiles'
57034456fccdSmrgdlpreopen='$dlprefiles'
57044456fccdSmrg
57054456fccdSmrg# Directory that this library needs to be installed in:
57064456fccdSmrglibdir='$install_libdir'"
57074456fccdSmrg	  if test "$installed" = no && test "$need_relink" = yes; then
57084456fccdSmrg	    $echo >> $output "\
57094456fccdSmrgrelink_command=\"$relink_command\""
57104456fccdSmrg	  fi
57114456fccdSmrg	done
57124456fccdSmrg      fi
57134456fccdSmrg
57144456fccdSmrg      # Do a symbolic link so that the libtool archive can be found in
57154456fccdSmrg      # LD_LIBRARY_PATH before the program is installed.
57164456fccdSmrg      $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
57174456fccdSmrg      $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
57184456fccdSmrg      ;;
57194456fccdSmrg    esac
57204456fccdSmrg    exit $EXIT_SUCCESS
57214456fccdSmrg    ;;
57224456fccdSmrg
57234456fccdSmrg  # libtool install mode
57244456fccdSmrg  install)
57254456fccdSmrg    modename="$modename: install"
57264456fccdSmrg
57274456fccdSmrg    # There may be an optional sh(1) argument at the beginning of
57284456fccdSmrg    # install_prog (especially on Windows NT).
57294456fccdSmrg    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
57304456fccdSmrg       # Allow the use of GNU shtool's install command.
57314456fccdSmrg       $echo "X$nonopt" | grep shtool > /dev/null; then
57324456fccdSmrg      # Aesthetically quote it.
57334456fccdSmrg      arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
57344456fccdSmrg      case $arg in
57354456fccdSmrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
57364456fccdSmrg	arg="\"$arg\""
57374456fccdSmrg	;;
57384456fccdSmrg      esac
57394456fccdSmrg      install_prog="$arg "
57404456fccdSmrg      arg="$1"
57414456fccdSmrg      shift
57424456fccdSmrg    else
57434456fccdSmrg      install_prog=
57444456fccdSmrg      arg=$nonopt
57454456fccdSmrg    fi
57464456fccdSmrg
57474456fccdSmrg    # The real first argument should be the name of the installation program.
57484456fccdSmrg    # Aesthetically quote it.
57494456fccdSmrg    arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
57504456fccdSmrg    case $arg in
57514456fccdSmrg    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
57524456fccdSmrg      arg="\"$arg\""
57534456fccdSmrg      ;;
57544456fccdSmrg    esac
57554456fccdSmrg    install_prog="$install_prog$arg"
57564456fccdSmrg
57574456fccdSmrg    # We need to accept at least all the BSD install flags.
57584456fccdSmrg    dest=
57594456fccdSmrg    files=
57604456fccdSmrg    opts=
57614456fccdSmrg    prev=
57624456fccdSmrg    install_type=
57634456fccdSmrg    isdir=no
57644456fccdSmrg    stripme=
57654456fccdSmrg    for arg
57664456fccdSmrg    do
57674456fccdSmrg      if test -n "$dest"; then
57684456fccdSmrg	files="$files $dest"
57694456fccdSmrg	dest=$arg
57704456fccdSmrg	continue
57714456fccdSmrg      fi
57724456fccdSmrg
57734456fccdSmrg      case $arg in
57744456fccdSmrg      -d) isdir=yes ;;
57754456fccdSmrg      -f) 
57764456fccdSmrg      	case " $install_prog " in
57774456fccdSmrg	*[\\\ /]cp\ *) ;;
57784456fccdSmrg	*) prev=$arg ;;
57794456fccdSmrg	esac
57804456fccdSmrg	;;
57814456fccdSmrg      -g | -m | -o) prev=$arg ;;
57824456fccdSmrg      -s)
57834456fccdSmrg	stripme=" -s"
57844456fccdSmrg	continue
57854456fccdSmrg	;;
57864456fccdSmrg      -*)
57874456fccdSmrg	;;
57884456fccdSmrg      *)
57894456fccdSmrg	# If the previous option needed an argument, then skip it.
57904456fccdSmrg	if test -n "$prev"; then
57914456fccdSmrg	  prev=
57924456fccdSmrg	else
57934456fccdSmrg	  dest=$arg
57944456fccdSmrg	  continue
57954456fccdSmrg	fi
57964456fccdSmrg	;;
57974456fccdSmrg      esac
57984456fccdSmrg
57994456fccdSmrg      # Aesthetically quote the argument.
58004456fccdSmrg      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
58014456fccdSmrg      case $arg in
58024456fccdSmrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
58034456fccdSmrg	arg="\"$arg\""
58044456fccdSmrg	;;
58054456fccdSmrg      esac
58064456fccdSmrg      install_prog="$install_prog $arg"
58074456fccdSmrg    done
58084456fccdSmrg
58094456fccdSmrg    if test -z "$install_prog"; then
58104456fccdSmrg      $echo "$modename: you must specify an install program" 1>&2
58114456fccdSmrg      $echo "$help" 1>&2
58124456fccdSmrg      exit $EXIT_FAILURE
58134456fccdSmrg    fi
58144456fccdSmrg
58154456fccdSmrg    if test -n "$prev"; then
58164456fccdSmrg      $echo "$modename: the \`$prev' option requires an argument" 1>&2
58174456fccdSmrg      $echo "$help" 1>&2
58184456fccdSmrg      exit $EXIT_FAILURE
58194456fccdSmrg    fi
58204456fccdSmrg
58214456fccdSmrg    if test -z "$files"; then
58224456fccdSmrg      if test -z "$dest"; then
58234456fccdSmrg	$echo "$modename: no file or destination specified" 1>&2
58244456fccdSmrg      else
58254456fccdSmrg	$echo "$modename: you must specify a destination" 1>&2
58264456fccdSmrg      fi
58274456fccdSmrg      $echo "$help" 1>&2
58284456fccdSmrg      exit $EXIT_FAILURE
58294456fccdSmrg    fi
58304456fccdSmrg
58314456fccdSmrg    # Strip any trailing slash from the destination.
58324456fccdSmrg    dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
58334456fccdSmrg
58344456fccdSmrg    # Check to see that the destination is a directory.
58354456fccdSmrg    test -d "$dest" && isdir=yes
58364456fccdSmrg    if test "$isdir" = yes; then
58374456fccdSmrg      destdir="$dest"
58384456fccdSmrg      destname=
58394456fccdSmrg    else
58404456fccdSmrg      destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
58414456fccdSmrg      test "X$destdir" = "X$dest" && destdir=.
58424456fccdSmrg      destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
58434456fccdSmrg
58444456fccdSmrg      # Not a directory, so check to see that there is only one file specified.
58454456fccdSmrg      set dummy $files
58464456fccdSmrg      if test "$#" -gt 2; then
58474456fccdSmrg	$echo "$modename: \`$dest' is not a directory" 1>&2
58484456fccdSmrg	$echo "$help" 1>&2
58494456fccdSmrg	exit $EXIT_FAILURE
58504456fccdSmrg      fi
58514456fccdSmrg    fi
58524456fccdSmrg    case $destdir in
58534456fccdSmrg    [\\/]* | [A-Za-z]:[\\/]*) ;;
58544456fccdSmrg    *)
58554456fccdSmrg      for file in $files; do
58564456fccdSmrg	case $file in
58574456fccdSmrg	*.lo) ;;
58584456fccdSmrg	*)
58594456fccdSmrg	  $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
58604456fccdSmrg	  $echo "$help" 1>&2
58614456fccdSmrg	  exit $EXIT_FAILURE
58624456fccdSmrg	  ;;
58634456fccdSmrg	esac
58644456fccdSmrg      done
58654456fccdSmrg      ;;
58664456fccdSmrg    esac
58674456fccdSmrg
58684456fccdSmrg    # This variable tells wrapper scripts just to set variables rather
58694456fccdSmrg    # than running their programs.
58704456fccdSmrg    libtool_install_magic="$magic"
58714456fccdSmrg
58724456fccdSmrg    staticlibs=
58734456fccdSmrg    future_libdirs=
58744456fccdSmrg    current_libdirs=
58754456fccdSmrg    for file in $files; do
58764456fccdSmrg
58774456fccdSmrg      # Do each installation.
58784456fccdSmrg      case $file in
58794456fccdSmrg      *.$libext)
58804456fccdSmrg	# Do the static libraries later.
58814456fccdSmrg	staticlibs="$staticlibs $file"
58824456fccdSmrg	;;
58834456fccdSmrg
58844456fccdSmrg      *.la)
58854456fccdSmrg	# Check to see that this really is a libtool archive.
58864456fccdSmrg	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
58874456fccdSmrg	else
58884456fccdSmrg	  $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
58894456fccdSmrg	  $echo "$help" 1>&2
58904456fccdSmrg	  exit $EXIT_FAILURE
58914456fccdSmrg	fi
58924456fccdSmrg
58934456fccdSmrg	library_names=
58944456fccdSmrg	old_library=
58954456fccdSmrg	relink_command=
58964456fccdSmrg	# If there is no directory component, then add one.
58974456fccdSmrg	case $file in
58984456fccdSmrg	*/* | *\\*) . $file ;;
58994456fccdSmrg	*) . ./$file ;;
59004456fccdSmrg	esac
59014456fccdSmrg
59024456fccdSmrg	# Add the libdir to current_libdirs if it is the destination.
59034456fccdSmrg	if test "X$destdir" = "X$libdir"; then
59044456fccdSmrg	  case "$current_libdirs " in
59054456fccdSmrg	  *" $libdir "*) ;;
59064456fccdSmrg	  *) current_libdirs="$current_libdirs $libdir" ;;
59074456fccdSmrg	  esac
59084456fccdSmrg	else
59094456fccdSmrg	  # Note the libdir as a future libdir.
59104456fccdSmrg	  case "$future_libdirs " in
59114456fccdSmrg	  *" $libdir "*) ;;
59124456fccdSmrg	  *) future_libdirs="$future_libdirs $libdir" ;;
59134456fccdSmrg	  esac
59144456fccdSmrg	fi
59154456fccdSmrg
59164456fccdSmrg	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
59174456fccdSmrg	test "X$dir" = "X$file/" && dir=
59184456fccdSmrg	dir="$dir$objdir"
59194456fccdSmrg
59204456fccdSmrg	if test -n "$relink_command"; then
59214456fccdSmrg	  # Determine the prefix the user has applied to our future dir.
59224456fccdSmrg	  inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
59234456fccdSmrg
59244456fccdSmrg	  # Don't allow the user to place us outside of our expected
59254456fccdSmrg	  # location b/c this prevents finding dependent libraries that
59264456fccdSmrg	  # are installed to the same prefix.
59274456fccdSmrg	  # At present, this check doesn't affect windows .dll's that
59284456fccdSmrg	  # are installed into $libdir/../bin (currently, that works fine)
59294456fccdSmrg	  # but it's something to keep an eye on.
59304456fccdSmrg	  if test "$inst_prefix_dir" = "$destdir"; then
59314456fccdSmrg	    $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
59324456fccdSmrg	    exit $EXIT_FAILURE
59334456fccdSmrg	  fi
59344456fccdSmrg
59354456fccdSmrg	  if test -n "$inst_prefix_dir"; then
59364456fccdSmrg	    # Stick the inst_prefix_dir data into the link command.
59374456fccdSmrg	    relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
59384456fccdSmrg	  else
59394456fccdSmrg	    relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
59404456fccdSmrg	  fi
59414456fccdSmrg
59424456fccdSmrg	  $echo "$modename: warning: relinking \`$file'" 1>&2
59434456fccdSmrg	  $show "$relink_command"
59444456fccdSmrg	  if $run eval "$relink_command"; then :
59454456fccdSmrg	  else
59464456fccdSmrg	    $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
59474456fccdSmrg	    exit $EXIT_FAILURE
59484456fccdSmrg	  fi
59494456fccdSmrg	fi
59504456fccdSmrg
59514456fccdSmrg	# See the names of the shared library.
59524456fccdSmrg	set dummy $library_names
59534456fccdSmrg	if test -n "$2"; then
59544456fccdSmrg	  realname="$2"
59554456fccdSmrg	  shift
59564456fccdSmrg	  shift
59574456fccdSmrg
59584456fccdSmrg	  srcname="$realname"
59594456fccdSmrg	  test -n "$relink_command" && srcname="$realname"T
59604456fccdSmrg
59614456fccdSmrg	  # Install the shared library and build the symlinks.
59624456fccdSmrg	  $show "$install_prog $dir/$srcname $destdir/$realname"
59634456fccdSmrg	  $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
59644456fccdSmrg	  if test -n "$stripme" && test -n "$striplib"; then
59654456fccdSmrg	    $show "$striplib $destdir/$realname"
59664456fccdSmrg	    $run eval "$striplib $destdir/$realname" || exit $?
59674456fccdSmrg	  fi
59684456fccdSmrg
59694456fccdSmrg	  if test "$#" -gt 0; then
59704456fccdSmrg	    # Delete the old symlinks, and create new ones.
59714456fccdSmrg	    # Try `ln -sf' first, because the `ln' binary might depend on
59724456fccdSmrg	    # the symlink we replace!  Solaris /bin/ln does not understand -f,
59734456fccdSmrg	    # so we also need to try rm && ln -s.
59744456fccdSmrg	    for linkname
59754456fccdSmrg	    do
59764456fccdSmrg	      if test "$linkname" != "$realname"; then
59774456fccdSmrg                $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
59784456fccdSmrg                $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
59794456fccdSmrg	      fi
59804456fccdSmrg	    done
59814456fccdSmrg	  fi
59824456fccdSmrg
59834456fccdSmrg	  # Do each command in the postinstall commands.
59844456fccdSmrg	  lib="$destdir/$realname"
59854456fccdSmrg	  cmds=$postinstall_cmds
59864456fccdSmrg	  save_ifs="$IFS"; IFS='~'
59874456fccdSmrg	  for cmd in $cmds; do
59884456fccdSmrg	    IFS="$save_ifs"
59894456fccdSmrg	    eval cmd=\"$cmd\"
59904456fccdSmrg	    $show "$cmd"
59914456fccdSmrg	    $run eval "$cmd" || {
59924456fccdSmrg	      lt_exit=$?
59934456fccdSmrg
59944456fccdSmrg	      # Restore the uninstalled library and exit
59954456fccdSmrg	      if test "$mode" = relink; then
59964456fccdSmrg		$run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
59974456fccdSmrg	      fi
59984456fccdSmrg
59994456fccdSmrg	      exit $lt_exit
60004456fccdSmrg	    }
60014456fccdSmrg	  done
60024456fccdSmrg	  IFS="$save_ifs"
60034456fccdSmrg	fi
60044456fccdSmrg
60054456fccdSmrg	# Install the pseudo-library for information purposes.
60064456fccdSmrg	name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
60074456fccdSmrg	instname="$dir/$name"i
60084456fccdSmrg	$show "$install_prog $instname $destdir/$name"
60094456fccdSmrg	$run eval "$install_prog $instname $destdir/$name" || exit $?
60104456fccdSmrg
60114456fccdSmrg	# Maybe install the static library, too.
60124456fccdSmrg	test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
60134456fccdSmrg	;;
60144456fccdSmrg
60154456fccdSmrg      *.lo)
60164456fccdSmrg	# Install (i.e. copy) a libtool object.
60174456fccdSmrg
60184456fccdSmrg	# Figure out destination file name, if it wasn't already specified.
60194456fccdSmrg	if test -n "$destname"; then
60204456fccdSmrg	  destfile="$destdir/$destname"
60214456fccdSmrg	else
60224456fccdSmrg	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
60234456fccdSmrg	  destfile="$destdir/$destfile"
60244456fccdSmrg	fi
60254456fccdSmrg
60264456fccdSmrg	# Deduce the name of the destination old-style object file.
60274456fccdSmrg	case $destfile in
60284456fccdSmrg	*.lo)
60294456fccdSmrg	  staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
60304456fccdSmrg	  ;;
60314456fccdSmrg	*.$objext)
60324456fccdSmrg	  staticdest="$destfile"
60334456fccdSmrg	  destfile=
60344456fccdSmrg	  ;;
60354456fccdSmrg	*)
60364456fccdSmrg	  $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
60374456fccdSmrg	  $echo "$help" 1>&2
60384456fccdSmrg	  exit $EXIT_FAILURE
60394456fccdSmrg	  ;;
60404456fccdSmrg	esac
60414456fccdSmrg
60424456fccdSmrg	# Install the libtool object if requested.
60434456fccdSmrg	if test -n "$destfile"; then
60444456fccdSmrg	  $show "$install_prog $file $destfile"
60454456fccdSmrg	  $run eval "$install_prog $file $destfile" || exit $?
60464456fccdSmrg	fi
60474456fccdSmrg
60484456fccdSmrg	# Install the old object if enabled.
60494456fccdSmrg	if test "$build_old_libs" = yes; then
60504456fccdSmrg	  # Deduce the name of the old-style object file.
60514456fccdSmrg	  staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
60524456fccdSmrg
60534456fccdSmrg	  $show "$install_prog $staticobj $staticdest"
60544456fccdSmrg	  $run eval "$install_prog \$staticobj \$staticdest" || exit $?
60554456fccdSmrg	fi
60564456fccdSmrg	exit $EXIT_SUCCESS
60574456fccdSmrg	;;
60584456fccdSmrg
60594456fccdSmrg      *)
60604456fccdSmrg	# Figure out destination file name, if it wasn't already specified.
60614456fccdSmrg	if test -n "$destname"; then
60624456fccdSmrg	  destfile="$destdir/$destname"
60634456fccdSmrg	else
60644456fccdSmrg	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
60654456fccdSmrg	  destfile="$destdir/$destfile"
60664456fccdSmrg	fi
60674456fccdSmrg
60684456fccdSmrg	# If the file is missing, and there is a .exe on the end, strip it
60694456fccdSmrg	# because it is most likely a libtool script we actually want to
60704456fccdSmrg	# install
60714456fccdSmrg	stripped_ext=""
60724456fccdSmrg	case $file in
60734456fccdSmrg	  *.exe)
60744456fccdSmrg	    if test ! -f "$file"; then
60754456fccdSmrg	      file=`$echo $file|${SED} 's,.exe$,,'`
60764456fccdSmrg	      stripped_ext=".exe"
60774456fccdSmrg	    fi
60784456fccdSmrg	    ;;
60794456fccdSmrg	esac
60804456fccdSmrg
60814456fccdSmrg	# Do a test to see if this is really a libtool program.
60824456fccdSmrg	case $host in
60834456fccdSmrg	*cygwin*|*mingw*)
60844456fccdSmrg	    wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
60854456fccdSmrg	    ;;
60864456fccdSmrg	*)
60874456fccdSmrg	    wrapper=$file
60884456fccdSmrg	    ;;
60894456fccdSmrg	esac
60904456fccdSmrg	if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
60914456fccdSmrg	  notinst_deplibs=
60924456fccdSmrg	  relink_command=
60934456fccdSmrg
60944456fccdSmrg	  # Note that it is not necessary on cygwin/mingw to append a dot to
60954456fccdSmrg	  # foo even if both foo and FILE.exe exist: automatic-append-.exe
60964456fccdSmrg	  # behavior happens only for exec(3), not for open(2)!  Also, sourcing
60974456fccdSmrg	  # `FILE.' does not work on cygwin managed mounts.
60984456fccdSmrg	  #
60994456fccdSmrg	  # If there is no directory component, then add one.
61004456fccdSmrg	  case $wrapper in
61014456fccdSmrg	  */* | *\\*) . ${wrapper} ;;
61024456fccdSmrg	  *) . ./${wrapper} ;;
61034456fccdSmrg	  esac
61044456fccdSmrg
61054456fccdSmrg	  # Check the variables that should have been set.
61064456fccdSmrg	  if test -z "$notinst_deplibs"; then
61074456fccdSmrg	    $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
61084456fccdSmrg	    exit $EXIT_FAILURE
61094456fccdSmrg	  fi
61104456fccdSmrg
61114456fccdSmrg	  finalize=yes
61124456fccdSmrg	  for lib in $notinst_deplibs; do
61134456fccdSmrg	    # Check to see that each library is installed.
61144456fccdSmrg	    libdir=
61154456fccdSmrg	    if test -f "$lib"; then
61164456fccdSmrg	      # If there is no directory component, then add one.
61174456fccdSmrg	      case $lib in
61184456fccdSmrg	      */* | *\\*) . $lib ;;
61194456fccdSmrg	      *) . ./$lib ;;
61204456fccdSmrg	      esac
61214456fccdSmrg	    fi
61224456fccdSmrg	    libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
61234456fccdSmrg	    if test -n "$libdir" && test ! -f "$libfile"; then
61244456fccdSmrg	      $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
61254456fccdSmrg	      finalize=no
61264456fccdSmrg	    fi
61274456fccdSmrg	  done
61284456fccdSmrg
61294456fccdSmrg	  relink_command=
61304456fccdSmrg	  # Note that it is not necessary on cygwin/mingw to append a dot to
61314456fccdSmrg	  # foo even if both foo and FILE.exe exist: automatic-append-.exe
61324456fccdSmrg	  # behavior happens only for exec(3), not for open(2)!  Also, sourcing
61334456fccdSmrg	  # `FILE.' does not work on cygwin managed mounts.
61344456fccdSmrg	  #
61354456fccdSmrg	  # If there is no directory component, then add one.
61364456fccdSmrg	  case $wrapper in
61374456fccdSmrg	  */* | *\\*) . ${wrapper} ;;
61384456fccdSmrg	  *) . ./${wrapper} ;;
61394456fccdSmrg	  esac
61404456fccdSmrg
61414456fccdSmrg	  outputname=
61424456fccdSmrg	  if test "$fast_install" = no && test -n "$relink_command"; then
61434456fccdSmrg	    if test "$finalize" = yes && test -z "$run"; then
61444456fccdSmrg	      tmpdir=`func_mktempdir`
61454456fccdSmrg	      file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
61464456fccdSmrg	      outputname="$tmpdir/$file"
61474456fccdSmrg	      # Replace the output file specification.
61484456fccdSmrg	      relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
61494456fccdSmrg
61504456fccdSmrg	      $show "$relink_command"
61514456fccdSmrg	      if $run eval "$relink_command"; then :
61524456fccdSmrg	      else
61534456fccdSmrg		$echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
61544456fccdSmrg		${rm}r "$tmpdir"
61554456fccdSmrg		continue
61564456fccdSmrg	      fi
61574456fccdSmrg	      file="$outputname"
61584456fccdSmrg	    else
61594456fccdSmrg	      $echo "$modename: warning: cannot relink \`$file'" 1>&2
61604456fccdSmrg	    fi
61614456fccdSmrg	  else
61624456fccdSmrg	    # Install the binary that we compiled earlier.
61634456fccdSmrg	    file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
61644456fccdSmrg	  fi
61654456fccdSmrg	fi
61664456fccdSmrg
61674456fccdSmrg	# remove .exe since cygwin /usr/bin/install will append another
61684456fccdSmrg	# one anyway 
61694456fccdSmrg	case $install_prog,$host in
61704456fccdSmrg	*/usr/bin/install*,*cygwin*)
61714456fccdSmrg	  case $file:$destfile in
61724456fccdSmrg	  *.exe:*.exe)
61734456fccdSmrg	    # this is ok
61744456fccdSmrg	    ;;
61754456fccdSmrg	  *.exe:*)
61764456fccdSmrg	    destfile=$destfile.exe
61774456fccdSmrg	    ;;
61784456fccdSmrg	  *:*.exe)
61794456fccdSmrg	    destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
61804456fccdSmrg	    ;;
61814456fccdSmrg	  esac
61824456fccdSmrg	  ;;
61834456fccdSmrg	esac
61844456fccdSmrg	$show "$install_prog$stripme $file $destfile"
61854456fccdSmrg	$run eval "$install_prog\$stripme \$file \$destfile" || exit $?
61864456fccdSmrg	test -n "$outputname" && ${rm}r "$tmpdir"
61874456fccdSmrg	;;
61884456fccdSmrg      esac
61894456fccdSmrg    done
61904456fccdSmrg
61914456fccdSmrg    for file in $staticlibs; do
61924456fccdSmrg      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
61934456fccdSmrg
61944456fccdSmrg      # Set up the ranlib parameters.
61954456fccdSmrg      oldlib="$destdir/$name"
61964456fccdSmrg
61974456fccdSmrg      $show "$install_prog $file $oldlib"
61984456fccdSmrg      $run eval "$install_prog \$file \$oldlib" || exit $?
61994456fccdSmrg
62004456fccdSmrg      if test -n "$stripme" && test -n "$old_striplib"; then
62014456fccdSmrg	$show "$old_striplib $oldlib"
62024456fccdSmrg	$run eval "$old_striplib $oldlib" || exit $?
62034456fccdSmrg      fi
62044456fccdSmrg
62054456fccdSmrg      # Do each command in the postinstall commands.
62064456fccdSmrg      cmds=$old_postinstall_cmds
62074456fccdSmrg      save_ifs="$IFS"; IFS='~'
62084456fccdSmrg      for cmd in $cmds; do
62094456fccdSmrg	IFS="$save_ifs"
62104456fccdSmrg	eval cmd=\"$cmd\"
62114456fccdSmrg	$show "$cmd"
62124456fccdSmrg	$run eval "$cmd" || exit $?
62134456fccdSmrg      done
62144456fccdSmrg      IFS="$save_ifs"
62154456fccdSmrg    done
62164456fccdSmrg
62174456fccdSmrg    if test -n "$future_libdirs"; then
62184456fccdSmrg      $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
62194456fccdSmrg    fi
62204456fccdSmrg
62214456fccdSmrg    if test -n "$current_libdirs"; then
62224456fccdSmrg      # Maybe just do a dry run.
62234456fccdSmrg      test -n "$run" && current_libdirs=" -n$current_libdirs"
62244456fccdSmrg      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
62254456fccdSmrg    else
62264456fccdSmrg      exit $EXIT_SUCCESS
62274456fccdSmrg    fi
62284456fccdSmrg    ;;
62294456fccdSmrg
62304456fccdSmrg  # libtool finish mode
62314456fccdSmrg  finish)
62324456fccdSmrg    modename="$modename: finish"
62334456fccdSmrg    libdirs="$nonopt"
62344456fccdSmrg    admincmds=
62354456fccdSmrg
62364456fccdSmrg    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
62374456fccdSmrg      for dir
62384456fccdSmrg      do
62394456fccdSmrg	libdirs="$libdirs $dir"
62404456fccdSmrg      done
62414456fccdSmrg
62424456fccdSmrg      for libdir in $libdirs; do
62434456fccdSmrg	if test -n "$finish_cmds"; then
62444456fccdSmrg	  # Do each command in the finish commands.
62454456fccdSmrg	  cmds=$finish_cmds
62464456fccdSmrg	  save_ifs="$IFS"; IFS='~'
62474456fccdSmrg	  for cmd in $cmds; do
62484456fccdSmrg	    IFS="$save_ifs"
62494456fccdSmrg	    eval cmd=\"$cmd\"
62504456fccdSmrg	    $show "$cmd"
62514456fccdSmrg	    $run eval "$cmd" || admincmds="$admincmds
62524456fccdSmrg       $cmd"
62534456fccdSmrg	  done
62544456fccdSmrg	  IFS="$save_ifs"
62554456fccdSmrg	fi
62564456fccdSmrg	if test -n "$finish_eval"; then
62574456fccdSmrg	  # Do the single finish_eval.
62584456fccdSmrg	  eval cmds=\"$finish_eval\"
62594456fccdSmrg	  $run eval "$cmds" || admincmds="$admincmds
62604456fccdSmrg       $cmds"
62614456fccdSmrg	fi
62624456fccdSmrg      done
62634456fccdSmrg    fi
62644456fccdSmrg
62654456fccdSmrg    # Exit here if they wanted silent mode.
62664456fccdSmrg    test "$show" = : && exit $EXIT_SUCCESS
62674456fccdSmrg
62684456fccdSmrg    $echo "X----------------------------------------------------------------------" | $Xsed
62694456fccdSmrg    $echo "Libraries have been installed in:"
62704456fccdSmrg    for libdir in $libdirs; do
62714456fccdSmrg      $echo "   $libdir"
62724456fccdSmrg    done
62734456fccdSmrg    $echo
62744456fccdSmrg    $echo "If you ever happen to want to link against installed libraries"
62754456fccdSmrg    $echo "in a given directory, LIBDIR, you must either use libtool, and"
62764456fccdSmrg    $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
62774456fccdSmrg    $echo "flag during linking and do at least one of the following:"
62784456fccdSmrg    if test -n "$shlibpath_var"; then
62794456fccdSmrg      $echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
62804456fccdSmrg      $echo "     during execution"
62814456fccdSmrg    fi
62824456fccdSmrg    if test -n "$runpath_var"; then
62834456fccdSmrg      $echo "   - add LIBDIR to the \`$runpath_var' environment variable"
62844456fccdSmrg      $echo "     during linking"
62854456fccdSmrg    fi
62864456fccdSmrg    if test -n "$hardcode_libdir_flag_spec"; then
62874456fccdSmrg      libdir=LIBDIR
62884456fccdSmrg      eval flag=\"$hardcode_libdir_flag_spec\"
62894456fccdSmrg
62904456fccdSmrg      $echo "   - use the \`$flag' linker flag"
62914456fccdSmrg    fi
62924456fccdSmrg    if test -n "$admincmds"; then
62934456fccdSmrg      $echo "   - have your system administrator run these commands:$admincmds"
62944456fccdSmrg    fi
62954456fccdSmrg    if test -f /etc/ld.so.conf; then
62964456fccdSmrg      $echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
62974456fccdSmrg    fi
62984456fccdSmrg    $echo
62994456fccdSmrg    $echo "See any operating system documentation about shared libraries for"
63004456fccdSmrg    $echo "more information, such as the ld(1) and ld.so(8) manual pages."
63014456fccdSmrg    $echo "X----------------------------------------------------------------------" | $Xsed
63024456fccdSmrg    exit $EXIT_SUCCESS
63034456fccdSmrg    ;;
63044456fccdSmrg
63054456fccdSmrg  # libtool execute mode
63064456fccdSmrg  execute)
63074456fccdSmrg    modename="$modename: execute"
63084456fccdSmrg
63094456fccdSmrg    # The first argument is the command name.
63104456fccdSmrg    cmd="$nonopt"
63114456fccdSmrg    if test -z "$cmd"; then
63124456fccdSmrg      $echo "$modename: you must specify a COMMAND" 1>&2
63134456fccdSmrg      $echo "$help"
63144456fccdSmrg      exit $EXIT_FAILURE
63154456fccdSmrg    fi
63164456fccdSmrg
63174456fccdSmrg    # Handle -dlopen flags immediately.
63184456fccdSmrg    for file in $execute_dlfiles; do
63194456fccdSmrg      if test ! -f "$file"; then
63204456fccdSmrg	$echo "$modename: \`$file' is not a file" 1>&2
63214456fccdSmrg	$echo "$help" 1>&2
63224456fccdSmrg	exit $EXIT_FAILURE
63234456fccdSmrg      fi
63244456fccdSmrg
63254456fccdSmrg      dir=
63264456fccdSmrg      case $file in
63274456fccdSmrg      *.la)
63284456fccdSmrg	# Check to see that this really is a libtool archive.
63294456fccdSmrg	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
63304456fccdSmrg	else
63314456fccdSmrg	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
63324456fccdSmrg	  $echo "$help" 1>&2
63334456fccdSmrg	  exit $EXIT_FAILURE
63344456fccdSmrg	fi
63354456fccdSmrg
63364456fccdSmrg	# Read the libtool library.
63374456fccdSmrg	dlname=
63384456fccdSmrg	library_names=
63394456fccdSmrg
63404456fccdSmrg	# If there is no directory component, then add one.
63414456fccdSmrg	case $file in
63424456fccdSmrg	*/* | *\\*) . $file ;;
63434456fccdSmrg	*) . ./$file ;;
63444456fccdSmrg	esac
63454456fccdSmrg
63464456fccdSmrg	# Skip this library if it cannot be dlopened.
63474456fccdSmrg	if test -z "$dlname"; then
63484456fccdSmrg	  # Warn if it was a shared library.
63494456fccdSmrg	  test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
63504456fccdSmrg	  continue
63514456fccdSmrg	fi
63524456fccdSmrg
63534456fccdSmrg	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
63544456fccdSmrg	test "X$dir" = "X$file" && dir=.
63554456fccdSmrg
63564456fccdSmrg	if test -f "$dir/$objdir/$dlname"; then
63574456fccdSmrg	  dir="$dir/$objdir"
63584456fccdSmrg	else
63594456fccdSmrg	  $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
63604456fccdSmrg	  exit $EXIT_FAILURE
63614456fccdSmrg	fi
63624456fccdSmrg	;;
63634456fccdSmrg
63644456fccdSmrg      *.lo)
63654456fccdSmrg	# Just add the directory containing the .lo file.
63664456fccdSmrg	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
63674456fccdSmrg	test "X$dir" = "X$file" && dir=.
63684456fccdSmrg	;;
63694456fccdSmrg
63704456fccdSmrg      *)
63714456fccdSmrg	$echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
63724456fccdSmrg	continue
63734456fccdSmrg	;;
63744456fccdSmrg      esac
63754456fccdSmrg
63764456fccdSmrg      # Get the absolute pathname.
63774456fccdSmrg      absdir=`cd "$dir" && pwd`
63784456fccdSmrg      test -n "$absdir" && dir="$absdir"
63794456fccdSmrg
63804456fccdSmrg      # Now add the directory to shlibpath_var.
63814456fccdSmrg      if eval "test -z \"\$$shlibpath_var\""; then
63824456fccdSmrg	eval "$shlibpath_var=\"\$dir\""
63834456fccdSmrg      else
63844456fccdSmrg	eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
63854456fccdSmrg      fi
63864456fccdSmrg    done
63874456fccdSmrg
63884456fccdSmrg    # This variable tells wrapper scripts just to set shlibpath_var
63894456fccdSmrg    # rather than running their programs.
63904456fccdSmrg    libtool_execute_magic="$magic"
63914456fccdSmrg
63924456fccdSmrg    # Check if any of the arguments is a wrapper script.
63934456fccdSmrg    args=
63944456fccdSmrg    for file
63954456fccdSmrg    do
63964456fccdSmrg      case $file in
63974456fccdSmrg      -*) ;;
63984456fccdSmrg      *)
63994456fccdSmrg	# Do a test to see if this is really a libtool program.
64004456fccdSmrg	if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
64014456fccdSmrg	  # If there is no directory component, then add one.
64024456fccdSmrg	  case $file in
64034456fccdSmrg	  */* | *\\*) . $file ;;
64044456fccdSmrg	  *) . ./$file ;;
64054456fccdSmrg	  esac
64064456fccdSmrg
64074456fccdSmrg	  # Transform arg to wrapped name.
64084456fccdSmrg	  file="$progdir/$program"
64094456fccdSmrg	fi
64104456fccdSmrg	;;
64114456fccdSmrg      esac
64124456fccdSmrg      # Quote arguments (to preserve shell metacharacters).
64134456fccdSmrg      file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
64144456fccdSmrg      args="$args \"$file\""
64154456fccdSmrg    done
64164456fccdSmrg
64174456fccdSmrg    if test -z "$run"; then
64184456fccdSmrg      if test -n "$shlibpath_var"; then
64194456fccdSmrg	# Export the shlibpath_var.
64204456fccdSmrg	eval "export $shlibpath_var"
64214456fccdSmrg      fi
64224456fccdSmrg
64234456fccdSmrg      # Restore saved environment variables
64244456fccdSmrg      if test "${save_LC_ALL+set}" = set; then
64254456fccdSmrg	LC_ALL="$save_LC_ALL"; export LC_ALL
64264456fccdSmrg      fi
64274456fccdSmrg      if test "${save_LANG+set}" = set; then
64284456fccdSmrg	LANG="$save_LANG"; export LANG
64294456fccdSmrg      fi
64304456fccdSmrg
64314456fccdSmrg      # Now prepare to actually exec the command.
64324456fccdSmrg      exec_cmd="\$cmd$args"
64334456fccdSmrg    else
64344456fccdSmrg      # Display what would be done.
64354456fccdSmrg      if test -n "$shlibpath_var"; then
64364456fccdSmrg	eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
64374456fccdSmrg	$echo "export $shlibpath_var"
64384456fccdSmrg      fi
64394456fccdSmrg      $echo "$cmd$args"
64404456fccdSmrg      exit $EXIT_SUCCESS
64414456fccdSmrg    fi
64424456fccdSmrg    ;;
64434456fccdSmrg
64444456fccdSmrg  # libtool clean and uninstall mode
64454456fccdSmrg  clean | uninstall)
64464456fccdSmrg    modename="$modename: $mode"
64474456fccdSmrg    rm="$nonopt"
64484456fccdSmrg    files=
64494456fccdSmrg    rmforce=
64504456fccdSmrg    exit_status=0
64514456fccdSmrg
64524456fccdSmrg    # This variable tells wrapper scripts just to set variables rather
64534456fccdSmrg    # than running their programs.
64544456fccdSmrg    libtool_install_magic="$magic"
64554456fccdSmrg
64564456fccdSmrg    for arg
64574456fccdSmrg    do
64584456fccdSmrg      case $arg in
64594456fccdSmrg      -f) rm="$rm $arg"; rmforce=yes ;;
64604456fccdSmrg      -*) rm="$rm $arg" ;;
64614456fccdSmrg      *) files="$files $arg" ;;
64624456fccdSmrg      esac
64634456fccdSmrg    done
64644456fccdSmrg
64654456fccdSmrg    if test -z "$rm"; then
64664456fccdSmrg      $echo "$modename: you must specify an RM program" 1>&2
64674456fccdSmrg      $echo "$help" 1>&2
64684456fccdSmrg      exit $EXIT_FAILURE
64694456fccdSmrg    fi
64704456fccdSmrg
64714456fccdSmrg    rmdirs=
64724456fccdSmrg
64734456fccdSmrg    origobjdir="$objdir"
64744456fccdSmrg    for file in $files; do
64754456fccdSmrg      dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
64764456fccdSmrg      if test "X$dir" = "X$file"; then
64774456fccdSmrg	dir=.
64784456fccdSmrg	objdir="$origobjdir"
64794456fccdSmrg      else
64804456fccdSmrg	objdir="$dir/$origobjdir"
64814456fccdSmrg      fi
64824456fccdSmrg      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
64834456fccdSmrg      test "$mode" = uninstall && objdir="$dir"
64844456fccdSmrg
64854456fccdSmrg      # Remember objdir for removal later, being careful to avoid duplicates
64864456fccdSmrg      if test "$mode" = clean; then
64874456fccdSmrg	case " $rmdirs " in
64884456fccdSmrg	  *" $objdir "*) ;;
64894456fccdSmrg	  *) rmdirs="$rmdirs $objdir" ;;
64904456fccdSmrg	esac
64914456fccdSmrg      fi
64924456fccdSmrg
64934456fccdSmrg      # Don't error if the file doesn't exist and rm -f was used.
64944456fccdSmrg      if (test -L "$file") >/dev/null 2>&1 \
64954456fccdSmrg	|| (test -h "$file") >/dev/null 2>&1 \
64964456fccdSmrg	|| test -f "$file"; then
64974456fccdSmrg	:
64984456fccdSmrg      elif test -d "$file"; then
64994456fccdSmrg	exit_status=1
65004456fccdSmrg	continue
65014456fccdSmrg      elif test "$rmforce" = yes; then
65024456fccdSmrg	continue
65034456fccdSmrg      fi
65044456fccdSmrg
65054456fccdSmrg      rmfiles="$file"
65064456fccdSmrg
65074456fccdSmrg      case $name in
65084456fccdSmrg      *.la)
65094456fccdSmrg	# Possibly a libtool archive, so verify it.
65104456fccdSmrg	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
65114456fccdSmrg	  . $dir/$name
65124456fccdSmrg
65134456fccdSmrg	  # Delete the libtool libraries and symlinks.
65144456fccdSmrg	  for n in $library_names; do
65154456fccdSmrg	    rmfiles="$rmfiles $objdir/$n"
65164456fccdSmrg	  done
65174456fccdSmrg	  test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
65184456fccdSmrg
65194456fccdSmrg	  case "$mode" in
65204456fccdSmrg	  clean)
65214456fccdSmrg	    case "  $library_names " in
65224456fccdSmrg	    # "  " in the beginning catches empty $dlname
65234456fccdSmrg	    *" $dlname "*) ;;
65244456fccdSmrg	    *) rmfiles="$rmfiles $objdir/$dlname" ;;
65254456fccdSmrg	    esac
65264456fccdSmrg	     test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
65274456fccdSmrg	    ;;
65284456fccdSmrg	  uninstall)
65294456fccdSmrg	    if test -n "$library_names"; then
65304456fccdSmrg	      # Do each command in the postuninstall commands.
65314456fccdSmrg	      cmds=$postuninstall_cmds
65324456fccdSmrg	      save_ifs="$IFS"; IFS='~'
65334456fccdSmrg	      for cmd in $cmds; do
65344456fccdSmrg		IFS="$save_ifs"
65354456fccdSmrg		eval cmd=\"$cmd\"
65364456fccdSmrg		$show "$cmd"
65374456fccdSmrg		$run eval "$cmd"
65384456fccdSmrg		if test "$?" -ne 0 && test "$rmforce" != yes; then
65394456fccdSmrg		  exit_status=1
65404456fccdSmrg		fi
65414456fccdSmrg	      done
65424456fccdSmrg	      IFS="$save_ifs"
65434456fccdSmrg	    fi
65444456fccdSmrg
65454456fccdSmrg	    if test -n "$old_library"; then
65464456fccdSmrg	      # Do each command in the old_postuninstall commands.
65474456fccdSmrg	      cmds=$old_postuninstall_cmds
65484456fccdSmrg	      save_ifs="$IFS"; IFS='~'
65494456fccdSmrg	      for cmd in $cmds; do
65504456fccdSmrg		IFS="$save_ifs"
65514456fccdSmrg		eval cmd=\"$cmd\"
65524456fccdSmrg		$show "$cmd"
65534456fccdSmrg		$run eval "$cmd"
65544456fccdSmrg		if test "$?" -ne 0 && test "$rmforce" != yes; then
65554456fccdSmrg		  exit_status=1
65564456fccdSmrg		fi
65574456fccdSmrg	      done
65584456fccdSmrg	      IFS="$save_ifs"
65594456fccdSmrg	    fi
65604456fccdSmrg	    # FIXME: should reinstall the best remaining shared library.
65614456fccdSmrg	    ;;
65624456fccdSmrg	  esac
65634456fccdSmrg	fi
65644456fccdSmrg	;;
65654456fccdSmrg
65664456fccdSmrg      *.lo)
65674456fccdSmrg	# Possibly a libtool object, so verify it.
65684456fccdSmrg	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
65694456fccdSmrg
65704456fccdSmrg	  # Read the .lo file
65714456fccdSmrg	  . $dir/$name
65724456fccdSmrg
65734456fccdSmrg	  # Add PIC object to the list of files to remove.
65744456fccdSmrg	  if test -n "$pic_object" \
65754456fccdSmrg	     && test "$pic_object" != none; then
65764456fccdSmrg	    rmfiles="$rmfiles $dir/$pic_object"
65774456fccdSmrg	  fi
65784456fccdSmrg
65794456fccdSmrg	  # Add non-PIC object to the list of files to remove.
65804456fccdSmrg	  if test -n "$non_pic_object" \
65814456fccdSmrg	     && test "$non_pic_object" != none; then
65824456fccdSmrg	    rmfiles="$rmfiles $dir/$non_pic_object"
65834456fccdSmrg	  fi
65844456fccdSmrg	fi
65854456fccdSmrg	;;
65864456fccdSmrg
65874456fccdSmrg      *)
65884456fccdSmrg	if test "$mode" = clean ; then
65894456fccdSmrg	  noexename=$name
65904456fccdSmrg	  case $file in
65914456fccdSmrg	  *.exe)
65924456fccdSmrg	    file=`$echo $file|${SED} 's,.exe$,,'`
65934456fccdSmrg	    noexename=`$echo $name|${SED} 's,.exe$,,'`
65944456fccdSmrg	    # $file with .exe has already been added to rmfiles,
65954456fccdSmrg	    # add $file without .exe
65964456fccdSmrg	    rmfiles="$rmfiles $file"
65974456fccdSmrg	    ;;
65984456fccdSmrg	  esac
65994456fccdSmrg	  # Do a test to see if this is a libtool program.
66004456fccdSmrg	  if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
66014456fccdSmrg	    relink_command=
66024456fccdSmrg	    . $dir/$noexename
66034456fccdSmrg
66044456fccdSmrg	    # note $name still contains .exe if it was in $file originally
66054456fccdSmrg	    # as does the version of $file that was added into $rmfiles
66064456fccdSmrg	    rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
66074456fccdSmrg	    if test "$fast_install" = yes && test -n "$relink_command"; then
66084456fccdSmrg	      rmfiles="$rmfiles $objdir/lt-$name"
66094456fccdSmrg	    fi
66104456fccdSmrg	    if test "X$noexename" != "X$name" ; then
66114456fccdSmrg	      rmfiles="$rmfiles $objdir/lt-${noexename}.c"
66124456fccdSmrg	    fi
66134456fccdSmrg	  fi
66144456fccdSmrg	fi
66154456fccdSmrg	;;
66164456fccdSmrg      esac
66174456fccdSmrg      $show "$rm $rmfiles"
66184456fccdSmrg      $run $rm $rmfiles || exit_status=1
66194456fccdSmrg    done
66204456fccdSmrg    objdir="$origobjdir"
66214456fccdSmrg
66224456fccdSmrg    # Try to remove the ${objdir}s in the directories where we deleted files
66234456fccdSmrg    for dir in $rmdirs; do
66244456fccdSmrg      if test -d "$dir"; then
66254456fccdSmrg	$show "rmdir $dir"
66264456fccdSmrg	$run rmdir $dir >/dev/null 2>&1
66274456fccdSmrg      fi
66284456fccdSmrg    done
66294456fccdSmrg
66304456fccdSmrg    exit $exit_status
66314456fccdSmrg    ;;
66324456fccdSmrg
66334456fccdSmrg  "")
66344456fccdSmrg    $echo "$modename: you must specify a MODE" 1>&2
66354456fccdSmrg    $echo "$generic_help" 1>&2
66364456fccdSmrg    exit $EXIT_FAILURE
66374456fccdSmrg    ;;
66384456fccdSmrg  esac
66394456fccdSmrg
66404456fccdSmrg  if test -z "$exec_cmd"; then
66414456fccdSmrg    $echo "$modename: invalid operation mode \`$mode'" 1>&2
66424456fccdSmrg    $echo "$generic_help" 1>&2
66434456fccdSmrg    exit $EXIT_FAILURE
66444456fccdSmrg  fi
66454456fccdSmrgfi # test -z "$show_help"
66464456fccdSmrg
66474456fccdSmrgif test -n "$exec_cmd"; then
66484456fccdSmrg  eval exec $exec_cmd
66494456fccdSmrg  exit $EXIT_FAILURE
66504456fccdSmrgfi
66514456fccdSmrg
66524456fccdSmrg# We need to display help for each of the modes.
66534456fccdSmrgcase $mode in
66544456fccdSmrg"") $echo \
66554456fccdSmrg"Usage: $modename [OPTION]... [MODE-ARG]...
66564456fccdSmrg
66574456fccdSmrgProvide generalized library-building support services.
66584456fccdSmrg
66594456fccdSmrg    --config          show all configuration variables
66604456fccdSmrg    --debug           enable verbose shell tracing
66614456fccdSmrg-n, --dry-run         display commands without modifying any files
66624456fccdSmrg    --features        display basic configuration information and exit
66634456fccdSmrg    --finish          same as \`--mode=finish'
66644456fccdSmrg    --help            display this help message and exit
66654456fccdSmrg    --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
66664456fccdSmrg    --quiet           same as \`--silent'
66674456fccdSmrg    --silent          don't print informational messages
66684456fccdSmrg    --tag=TAG         use configuration variables from tag TAG
66694456fccdSmrg    --version         print version information
66704456fccdSmrg
66714456fccdSmrgMODE must be one of the following:
66724456fccdSmrg
66734456fccdSmrg      clean           remove files from the build directory
66744456fccdSmrg      compile         compile a source file into a libtool object
66754456fccdSmrg      execute         automatically set library path, then run a program
66764456fccdSmrg      finish          complete the installation of libtool libraries
66774456fccdSmrg      install         install libraries or executables
66784456fccdSmrg      link            create a library or an executable
66794456fccdSmrg      uninstall       remove libraries from an installed directory
66804456fccdSmrg
66814456fccdSmrgMODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
66824456fccdSmrga more detailed description of MODE.
66834456fccdSmrg
66844456fccdSmrgReport bugs to <bug-libtool@gnu.org>."
66854456fccdSmrg  exit $EXIT_SUCCESS
66864456fccdSmrg  ;;
66874456fccdSmrg
66884456fccdSmrgclean)
66894456fccdSmrg  $echo \
66904456fccdSmrg"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
66914456fccdSmrg
66924456fccdSmrgRemove files from the build directory.
66934456fccdSmrg
66944456fccdSmrgRM is the name of the program to use to delete files associated with each FILE
66954456fccdSmrg(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
66964456fccdSmrgto RM.
66974456fccdSmrg
66984456fccdSmrgIf FILE is a libtool library, object or program, all the files associated
66994456fccdSmrgwith it are deleted. Otherwise, only FILE itself is deleted using RM."
67004456fccdSmrg  ;;
67014456fccdSmrg
67024456fccdSmrgcompile)
67034456fccdSmrg  $echo \
67044456fccdSmrg"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
67054456fccdSmrg
67064456fccdSmrgCompile a source file into a libtool library object.
67074456fccdSmrg
67084456fccdSmrgThis mode accepts the following additional options:
67094456fccdSmrg
67104456fccdSmrg  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
67114456fccdSmrg  -prefer-pic       try to building PIC objects only
67124456fccdSmrg  -prefer-non-pic   try to building non-PIC objects only
67134456fccdSmrg  -static           always build a \`.o' file suitable for static linking
67144456fccdSmrg
67154456fccdSmrgCOMPILE-COMMAND is a command to be used in creating a \`standard' object file
67164456fccdSmrgfrom the given SOURCEFILE.
67174456fccdSmrg
67184456fccdSmrgThe output file name is determined by removing the directory component from
67194456fccdSmrgSOURCEFILE, then substituting the C source code suffix \`.c' with the
67204456fccdSmrglibrary object suffix, \`.lo'."
67214456fccdSmrg  ;;
67224456fccdSmrg
67234456fccdSmrgexecute)
67244456fccdSmrg  $echo \
67254456fccdSmrg"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
67264456fccdSmrg
67274456fccdSmrgAutomatically set library path, then run a program.
67284456fccdSmrg
67294456fccdSmrgThis mode accepts the following additional options:
67304456fccdSmrg
67314456fccdSmrg  -dlopen FILE      add the directory containing FILE to the library path
67324456fccdSmrg
67334456fccdSmrgThis mode sets the library path environment variable according to \`-dlopen'
67344456fccdSmrgflags.
67354456fccdSmrg
67364456fccdSmrgIf any of the ARGS are libtool executable wrappers, then they are translated
67374456fccdSmrginto their corresponding uninstalled binary, and any of their required library
67384456fccdSmrgdirectories are added to the library path.
67394456fccdSmrg
67404456fccdSmrgThen, COMMAND is executed, with ARGS as arguments."
67414456fccdSmrg  ;;
67424456fccdSmrg
67434456fccdSmrgfinish)
67444456fccdSmrg  $echo \
67454456fccdSmrg"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
67464456fccdSmrg
67474456fccdSmrgComplete the installation of libtool libraries.
67484456fccdSmrg
67494456fccdSmrgEach LIBDIR is a directory that contains libtool libraries.
67504456fccdSmrg
67514456fccdSmrgThe commands that this mode executes may require superuser privileges.  Use
67524456fccdSmrgthe \`--dry-run' option if you just want to see what would be executed."
67534456fccdSmrg  ;;
67544456fccdSmrg
67554456fccdSmrginstall)
67564456fccdSmrg  $echo \
67574456fccdSmrg"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
67584456fccdSmrg
67594456fccdSmrgInstall executables or libraries.
67604456fccdSmrg
67614456fccdSmrgINSTALL-COMMAND is the installation command.  The first component should be
67624456fccdSmrgeither the \`install' or \`cp' program.
67634456fccdSmrg
67644456fccdSmrgThe rest of the components are interpreted as arguments to that command (only
67654456fccdSmrgBSD-compatible install options are recognized)."
67664456fccdSmrg  ;;
67674456fccdSmrg
67684456fccdSmrglink)
67694456fccdSmrg  $echo \
67704456fccdSmrg"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
67714456fccdSmrg
67724456fccdSmrgLink object files or libraries together to form another library, or to
67734456fccdSmrgcreate an executable program.
67744456fccdSmrg
67754456fccdSmrgLINK-COMMAND is a command using the C compiler that you would use to create
67764456fccdSmrga program from several object files.
67774456fccdSmrg
67784456fccdSmrgThe following components of LINK-COMMAND are treated specially:
67794456fccdSmrg
67804456fccdSmrg  -all-static       do not do any dynamic linking at all
67814456fccdSmrg  -avoid-version    do not add a version suffix if possible
67824456fccdSmrg  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
67834456fccdSmrg  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
67844456fccdSmrg  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
67854456fccdSmrg  -export-symbols SYMFILE
67864456fccdSmrg		    try to export only the symbols listed in SYMFILE
67874456fccdSmrg  -export-symbols-regex REGEX
67884456fccdSmrg		    try to export only the symbols matching REGEX
67894456fccdSmrg  -LLIBDIR          search LIBDIR for required installed libraries
67904456fccdSmrg  -lNAME            OUTPUT-FILE requires the installed library libNAME
67914456fccdSmrg  -module           build a library that can dlopened
67924456fccdSmrg  -no-fast-install  disable the fast-install mode
67934456fccdSmrg  -no-install       link a not-installable executable
67944456fccdSmrg  -no-undefined     declare that a library does not refer to external symbols
67954456fccdSmrg  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
67964456fccdSmrg  -objectlist FILE  Use a list of object files found in FILE to specify objects
67974456fccdSmrg  -precious-files-regex REGEX
67984456fccdSmrg                    don't remove output files matching REGEX
67994456fccdSmrg  -release RELEASE  specify package release information
68004456fccdSmrg  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
68014456fccdSmrg  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
68024456fccdSmrg  -static           do not do any dynamic linking of libtool libraries
68034456fccdSmrg  -version-info CURRENT[:REVISION[:AGE]]
68044456fccdSmrg		    specify library version info [each variable defaults to 0]
68054456fccdSmrg
68064456fccdSmrgAll other options (arguments beginning with \`-') are ignored.
68074456fccdSmrg
68084456fccdSmrgEvery other argument is treated as a filename.  Files ending in \`.la' are
68094456fccdSmrgtreated as uninstalled libtool libraries, other files are standard or library
68104456fccdSmrgobject files.
68114456fccdSmrg
68124456fccdSmrgIf the OUTPUT-FILE ends in \`.la', then a libtool library is created,
68134456fccdSmrgonly library objects (\`.lo' files) may be specified, and \`-rpath' is
68144456fccdSmrgrequired, except when creating a convenience library.
68154456fccdSmrg
68164456fccdSmrgIf OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
68174456fccdSmrgusing \`ar' and \`ranlib', or on Windows using \`lib'.
68184456fccdSmrg
68194456fccdSmrgIf OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
68204456fccdSmrgis created, otherwise an executable program is created."
68214456fccdSmrg  ;;
68224456fccdSmrg
68234456fccdSmrguninstall)
68244456fccdSmrg  $echo \
68254456fccdSmrg"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
68264456fccdSmrg
68274456fccdSmrgRemove libraries from an installation directory.
68284456fccdSmrg
68294456fccdSmrgRM is the name of the program to use to delete files associated with each FILE
68304456fccdSmrg(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
68314456fccdSmrgto RM.
68324456fccdSmrg
68334456fccdSmrgIf FILE is a libtool library, all the files associated with it are deleted.
68344456fccdSmrgOtherwise, only FILE itself is deleted using RM."
68354456fccdSmrg  ;;
68364456fccdSmrg
68374456fccdSmrg*)
68384456fccdSmrg  $echo "$modename: invalid operation mode \`$mode'" 1>&2
68394456fccdSmrg  $echo "$help" 1>&2
68404456fccdSmrg  exit $EXIT_FAILURE
68414456fccdSmrg  ;;
68424456fccdSmrgesac
68434456fccdSmrg
68444456fccdSmrg$echo
68454456fccdSmrg$echo "Try \`$modename --help' for more information about other modes."
68464456fccdSmrg
68474456fccdSmrgexit $?
68484456fccdSmrg
68494456fccdSmrg# The TAGs below are defined such that we never get into a situation
68504456fccdSmrg# in which we disable both kinds of libraries.  Given conflicting
68514456fccdSmrg# choices, we go for a static library, that is the most portable,
68524456fccdSmrg# since we can't tell whether shared libraries were disabled because
68534456fccdSmrg# the user asked for that or because the platform doesn't support
68544456fccdSmrg# them.  This is particularly important on AIX, because we don't
68554456fccdSmrg# support having both static and shared libraries enabled at the same
68564456fccdSmrg# time on that platform, so we default to a shared-only configuration.
68574456fccdSmrg# If a disable-shared tag is given, we'll fallback to a static-only
68584456fccdSmrg# configuration.  But we'll never go from static-only to shared-only.
68594456fccdSmrg
68604456fccdSmrg# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
68614456fccdSmrgdisable_libs=shared
68624456fccdSmrg# ### END LIBTOOL TAG CONFIG: disable-shared
68634456fccdSmrg
68644456fccdSmrg# ### BEGIN LIBTOOL TAG CONFIG: disable-static
68654456fccdSmrgdisable_libs=static
68664456fccdSmrg# ### END LIBTOOL TAG CONFIG: disable-static
68674456fccdSmrg
68684456fccdSmrg# Local Variables:
68694456fccdSmrg# mode:shell-script
68704456fccdSmrg# sh-indentation:2
68714456fccdSmrg# End:
6872