ltmain.sh
author Sam Lantinga <slouken@libsdl.org>
Sun, 30 Apr 2006 04:53:56 +0000
changeset 127 6d3f642bec0a
parent 102 88edbd7cc3f1
child 138 f7dbbbee889b
permissions -rw-r--r--
Updated libtool to version 1.5.22
slouken@127
     1
# Based on libtool-1.5.22
slouken@0
     2
# ltmain.sh - Provide generalized library-building support services.
slouken@94
     3
# NOTE: Changing this file will not affect anything until you rerun configure.
slouken@0
     4
#
slouken@127
     5
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005
slouken@94
     6
# Free Software Foundation, Inc.
slouken@0
     7
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
slouken@0
     8
#
slouken@0
     9
# This program is free software; you can redistribute it and/or modify
slouken@0
    10
# it under the terms of the GNU General Public License as published by
slouken@0
    11
# the Free Software Foundation; either version 2 of the License, or
slouken@0
    12
# (at your option) any later version.
slouken@0
    13
#
slouken@0
    14
# This program is distributed in the hope that it will be useful, but
slouken@0
    15
# WITHOUT ANY WARRANTY; without even the implied warranty of
slouken@0
    16
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
slouken@0
    17
# General Public License for more details.
slouken@0
    18
#
slouken@0
    19
# You should have received a copy of the GNU General Public License
slouken@0
    20
# along with this program; if not, write to the Free Software
slouken@127
    21
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
slouken@0
    22
#
slouken@0
    23
# As a special exception to the GNU General Public License, if you
slouken@0
    24
# distribute this file as part of a program that contains a
slouken@0
    25
# configuration script generated by Autoconf, you may include it under
slouken@0
    26
# the same distribution terms that you use for the rest of that program.
slouken@0
    27
slouken@102
    28
basename="s,^.*/,,g"
slouken@102
    29
slouken@102
    30
# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
slouken@102
    31
# is ksh but when the shell is invoked as "sh" and the current value of
slouken@102
    32
# the _XPG environment variable is not equal to 1 (one), the special
slouken@102
    33
# positional parameter $0, within a function call, is the name of the
slouken@102
    34
# function.
slouken@102
    35
progpath="$0"
slouken@102
    36
slouken@102
    37
# The name of this program:
slouken@102
    38
progname=`echo "$progpath" | $SED $basename`
slouken@102
    39
modename="$progname"
slouken@102
    40
slouken@102
    41
# Global variables:
slouken@102
    42
EXIT_SUCCESS=0
slouken@102
    43
EXIT_FAILURE=1
slouken@102
    44
slouken@102
    45
PROGRAM=ltmain.sh
slouken@102
    46
PACKAGE=libtool
slouken@127
    47
VERSION=1.5.22
slouken@127
    48
TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)"
slouken@102
    49
slouken@102
    50
# See if we are running on zsh, and set the options which allow our
slouken@102
    51
# commands through without removal of \ escapes.
slouken@102
    52
if test -n "${ZSH_VERSION+set}" ; then
slouken@102
    53
  setopt NO_GLOB_SUBST
slouken@102
    54
fi
slouken@102
    55
slouken@0
    56
# Check that we have a working $echo.
slouken@0
    57
if test "X$1" = X--no-reexec; then
slouken@0
    58
  # Discard the --no-reexec flag, and continue.
slouken@0
    59
  shift
slouken@0
    60
elif test "X$1" = X--fallback-echo; then
slouken@0
    61
  # Avoid inline document here, it may be left over
slouken@0
    62
  :
slouken@0
    63
elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
slouken@0
    64
  # Yippee, $echo works!
slouken@0
    65
  :
slouken@0
    66
else
slouken@0
    67
  # Restart under the correct shell, and then maybe $echo will work.
slouken@102
    68
  exec $SHELL "$progpath" --no-reexec ${1+"$@"}
slouken@0
    69
fi
slouken@0
    70
slouken@0
    71
if test "X$1" = X--fallback-echo; then
slouken@0
    72
  # used as fallback echo
slouken@0
    73
  shift
slouken@0
    74
  cat <<EOF
slouken@0
    75
$*
slouken@0
    76
EOF
slouken@102
    77
  exit $EXIT_SUCCESS
slouken@0
    78
fi
slouken@0
    79
slouken@0
    80
default_mode=
slouken@0
    81
help="Try \`$progname --help' for more information."
slouken@0
    82
magic="%%%MAGIC variable%%%"
slouken@0
    83
mkdir="mkdir"
slouken@0
    84
mv="mv -f"
slouken@0
    85
rm="rm -f"
slouken@0
    86
slouken@0
    87
# Sed substitution that helps us do robust quoting.  It backslashifies
slouken@0
    88
# metacharacters that are still active within double-quoted strings.
slouken@94
    89
Xsed="${SED}"' -e 1s/^X//'
slouken@0
    90
sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
slouken@94
    91
# test EBCDIC or ASCII
slouken@127
    92
case `echo X|tr X '\101'` in
slouken@127
    93
 A) # ASCII based system
slouken@127
    94
    # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
slouken@127
    95
  SP2NL='tr \040 \012'
slouken@127
    96
  NL2SP='tr \015\012 \040\040'
slouken@94
    97
  ;;
slouken@127
    98
 *) # EBCDIC based system
slouken@127
    99
  SP2NL='tr \100 \n'
slouken@127
   100
  NL2SP='tr \r\n \100\100'
slouken@94
   101
  ;;
slouken@94
   102
esac
slouken@0
   103
slouken@0
   104
# NLS nuisances.
slouken@0
   105
# Only set LANG and LC_ALL to C if already set.
slouken@0
   106
# These must not be set unconditionally because not all systems understand
slouken@0
   107
# e.g. LANG=C (notably SCO).
slouken@0
   108
# We save the old values to restore during execute mode.
slouken@0
   109
if test "${LC_ALL+set}" = set; then
slouken@0
   110
  save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
slouken@0
   111
fi
slouken@0
   112
if test "${LANG+set}" = set; then
slouken@0
   113
  save_LANG="$LANG"; LANG=C; export LANG
slouken@0
   114
fi
slouken@0
   115
slouken@94
   116
# Make sure IFS has a sensible default
slouken@127
   117
lt_nl='
slouken@127
   118
'
slouken@127
   119
IFS=" 	$lt_nl"
slouken@0
   120
slouken@0
   121
if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
slouken@94
   122
  $echo "$modename: not configured to build any kind of library" 1>&2
slouken@94
   123
  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
slouken@102
   124
  exit $EXIT_FAILURE
slouken@0
   125
fi
slouken@0
   126
slouken@0
   127
# Global variables.
slouken@0
   128
mode=$default_mode
slouken@0
   129
nonopt=
slouken@0
   130
prev=
slouken@0
   131
prevopt=
slouken@0
   132
run=
slouken@0
   133
show="$echo"
slouken@0
   134
show_help=
slouken@0
   135
execute_dlfiles=
slouken@127
   136
duplicate_deps=no
slouken@127
   137
preserve_args=
slouken@0
   138
lo2o="s/\\.lo\$/.${objext}/"
slouken@0
   139
o2lo="s/\\.${objext}\$/.lo/"
slouken@0
   140
slouken@94
   141
#####################################
slouken@94
   142
# Shell function definitions:
slouken@94
   143
# This seems to be the best place for them
slouken@94
   144
slouken@127
   145
# func_mktempdir [string]
slouken@127
   146
# Make a temporary directory that won't clash with other running
slouken@127
   147
# libtool processes, and avoids race conditions if possible.  If
slouken@127
   148
# given, STRING is the basename for that directory.
slouken@127
   149
func_mktempdir ()
slouken@127
   150
{
slouken@127
   151
    my_template="${TMPDIR-/tmp}/${1-$progname}"
slouken@127
   152
slouken@127
   153
    if test "$run" = ":"; then
slouken@127
   154
      # Return a directory name, but don't create it in dry-run mode
slouken@127
   155
      my_tmpdir="${my_template}-$$"
slouken@127
   156
    else
slouken@127
   157
slouken@127
   158
      # If mktemp works, use that first and foremost
slouken@127
   159
      my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
slouken@127
   160
slouken@127
   161
      if test ! -d "$my_tmpdir"; then
slouken@127
   162
	# Failing that, at least try and use $RANDOM to avoid a race
slouken@127
   163
	my_tmpdir="${my_template}-${RANDOM-0}$$"
slouken@127
   164
slouken@127
   165
	save_mktempdir_umask=`umask`
slouken@127
   166
	umask 0077
slouken@127
   167
	$mkdir "$my_tmpdir"
slouken@127
   168
	umask $save_mktempdir_umask
slouken@127
   169
      fi
slouken@127
   170
slouken@127
   171
      # If we're not in dry-run mode, bomb out on failure
slouken@127
   172
      test -d "$my_tmpdir" || {
slouken@127
   173
        $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
slouken@127
   174
	exit $EXIT_FAILURE
slouken@127
   175
      }
slouken@127
   176
    fi
slouken@127
   177
slouken@127
   178
    $echo "X$my_tmpdir" | $Xsed
slouken@127
   179
}
slouken@127
   180
slouken@127
   181
slouken@102
   182
# func_win32_libid arg
slouken@102
   183
# return the library type of file 'arg'
slouken@102
   184
#
slouken@94
   185
# Need a lot of goo to handle *both* DLLs and import libs
slouken@94
   186
# Has to be a shell function in order to 'eat' the argument
slouken@94
   187
# that is supplied when $file_magic_command is called.
slouken@127
   188
func_win32_libid ()
slouken@127
   189
{
slouken@94
   190
  win32_libid_type="unknown"
slouken@94
   191
  win32_fileres=`file -L $1 2>/dev/null`
slouken@94
   192
  case $win32_fileres in
slouken@94
   193
  *ar\ archive\ import\ library*) # definitely import
slouken@94
   194
    win32_libid_type="x86 archive import"
slouken@94
   195
    ;;
slouken@94
   196
  *ar\ archive*) # could be an import, or static
slouken@94
   197
    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
slouken@102
   198
      $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
slouken@94
   199
      win32_nmres=`eval $NM -f posix -A $1 | \
slouken@127
   200
	$SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'`
slouken@127
   201
      case $win32_nmres in
slouken@127
   202
      import*)  win32_libid_type="x86 archive import";;
slouken@127
   203
      *)        win32_libid_type="x86 archive static";;
slouken@127
   204
      esac
slouken@94
   205
    fi
slouken@94
   206
    ;;
slouken@102
   207
  *DLL*)
slouken@94
   208
    win32_libid_type="x86 DLL"
slouken@94
   209
    ;;
slouken@94
   210
  *executable*) # but shell scripts are "executable" too...
slouken@94
   211
    case $win32_fileres in
slouken@94
   212
    *MS\ Windows\ PE\ Intel*)
slouken@94
   213
      win32_libid_type="x86 DLL"
slouken@94
   214
      ;;
slouken@94
   215
    esac
slouken@94
   216
    ;;
slouken@94
   217
  esac
slouken@94
   218
  $echo $win32_libid_type
slouken@94
   219
}
slouken@94
   220
slouken@102
   221
slouken@102
   222
# func_infer_tag arg
slouken@102
   223
# Infer tagged configuration to use if any are available and
slouken@102
   224
# if one wasn't chosen via the "--tag" command line option.
slouken@102
   225
# Only attempt this if the compiler in the base compile
slouken@102
   226
# command doesn't match the default compiler.
slouken@102
   227
# arg is usually of the form 'gcc ...'
slouken@127
   228
func_infer_tag ()
slouken@127
   229
{
slouken@102
   230
    if test -n "$available_tags" && test -z "$tagname"; then
slouken@102
   231
      CC_quoted=
slouken@102
   232
      for arg in $CC; do
slouken@102
   233
	case $arg in
slouken@102
   234
	  *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
slouken@102
   235
	  arg="\"$arg\""
slouken@102
   236
	  ;;
slouken@102
   237
	esac
slouken@102
   238
	CC_quoted="$CC_quoted $arg"
slouken@102
   239
      done
slouken@102
   240
      case $@ in
slouken@102
   241
      # Blanks in the command may have been stripped by the calling shell,
slouken@102
   242
      # but not from the CC environment variable when configure was run.
slouken@102
   243
      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
slouken@102
   244
      # Blanks at the start of $base_compile will cause this to fail
slouken@102
   245
      # if we don't check for them as well.
slouken@102
   246
      *)
slouken@102
   247
	for z in $available_tags; do
slouken@102
   248
	  if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
slouken@102
   249
	    # Evaluate the configuration.
slouken@102
   250
	    eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
slouken@102
   251
	    CC_quoted=
slouken@102
   252
	    for arg in $CC; do
slouken@102
   253
	    # Double-quote args containing other shell metacharacters.
slouken@102
   254
	    case $arg in
slouken@102
   255
	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
slouken@102
   256
	      arg="\"$arg\""
slouken@102
   257
	      ;;
slouken@102
   258
	    esac
slouken@102
   259
	    CC_quoted="$CC_quoted $arg"
slouken@102
   260
	  done
slouken@102
   261
	    case "$@ " in
slouken@102
   262
	      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
slouken@102
   263
	      # The compiler in the base compile command matches
slouken@102
   264
	      # the one in the tagged configuration.
slouken@102
   265
	      # Assume this is the tagged configuration we want.
slouken@102
   266
	      tagname=$z
slouken@102
   267
	      break
slouken@102
   268
	      ;;
slouken@102
   269
	    esac
slouken@102
   270
	  fi
slouken@102
   271
	done
slouken@102
   272
	# If $tagname still isn't set, then no tagged configuration
slouken@102
   273
	# was found and let the user know that the "--tag" command
slouken@102
   274
	# line option must be used.
slouken@102
   275
	if test -z "$tagname"; then
slouken@102
   276
	  $echo "$modename: unable to infer tagged configuration"
slouken@102
   277
	  $echo "$modename: specify a tag with \`--tag'" 1>&2
slouken@102
   278
	  exit $EXIT_FAILURE
slouken@102
   279
#        else
slouken@102
   280
#          $echo "$modename: using $tagname tagged configuration"
slouken@102
   281
	fi
slouken@102
   282
	;;
slouken@102
   283
      esac
slouken@102
   284
    fi
slouken@102
   285
}
slouken@102
   286
slouken@102
   287
slouken@127
   288
# func_extract_an_archive dir oldlib
slouken@127
   289
func_extract_an_archive ()
slouken@127
   290
{
slouken@127
   291
    f_ex_an_ar_dir="$1"; shift
slouken@127
   292
    f_ex_an_ar_oldlib="$1"
slouken@127
   293
slouken@127
   294
    $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
slouken@127
   295
    $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
slouken@127
   296
    if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
slouken@127
   297
     :
slouken@127
   298
    else
slouken@127
   299
      $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
slouken@127
   300
      exit $EXIT_FAILURE
slouken@127
   301
    fi
slouken@127
   302
}
slouken@127
   303
slouken@102
   304
# func_extract_archives gentop oldlib ...
slouken@127
   305
func_extract_archives ()
slouken@127
   306
{
slouken@102
   307
    my_gentop="$1"; shift
slouken@102
   308
    my_oldlibs=${1+"$@"}
slouken@102
   309
    my_oldobjs=""
slouken@102
   310
    my_xlib=""
slouken@102
   311
    my_xabs=""
slouken@102
   312
    my_xdir=""
slouken@102
   313
    my_status=""
slouken@102
   314
slouken@102
   315
    $show "${rm}r $my_gentop"
slouken@102
   316
    $run ${rm}r "$my_gentop"
slouken@102
   317
    $show "$mkdir $my_gentop"
slouken@102
   318
    $run $mkdir "$my_gentop"
slouken@102
   319
    my_status=$?
slouken@102
   320
    if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
slouken@102
   321
      exit $my_status
slouken@102
   322
    fi
slouken@102
   323
slouken@102
   324
    for my_xlib in $my_oldlibs; do
slouken@102
   325
      # Extract the objects.
slouken@102
   326
      case $my_xlib in
slouken@102
   327
	[\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
slouken@102
   328
	*) my_xabs=`pwd`"/$my_xlib" ;;
slouken@102
   329
      esac
slouken@102
   330
      my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
slouken@102
   331
      my_xdir="$my_gentop/$my_xlib"
slouken@102
   332
slouken@102
   333
      $show "${rm}r $my_xdir"
slouken@102
   334
      $run ${rm}r "$my_xdir"
slouken@102
   335
      $show "$mkdir $my_xdir"
slouken@102
   336
      $run $mkdir "$my_xdir"
slouken@127
   337
      exit_status=$?
slouken@127
   338
      if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
slouken@127
   339
	exit $exit_status
slouken@102
   340
      fi
slouken@102
   341
      case $host in
slouken@102
   342
      *-darwin*)
slouken@102
   343
	$show "Extracting $my_xabs"
slouken@102
   344
	# Do not bother doing anything if just a dry run
slouken@102
   345
	if test -z "$run"; then
slouken@102
   346
	  darwin_orig_dir=`pwd`
slouken@102
   347
	  cd $my_xdir || exit $?
slouken@102
   348
	  darwin_archive=$my_xabs
slouken@102
   349
	  darwin_curdir=`pwd`
slouken@127
   350
	  darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
slouken@102
   351
	  darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
slouken@102
   352
	  if test -n "$darwin_arches"; then 
slouken@102
   353
	    darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
slouken@102
   354
	    darwin_arch=
slouken@102
   355
	    $show "$darwin_base_archive has multiple architectures $darwin_arches"
slouken@102
   356
	    for darwin_arch in  $darwin_arches ; do
slouken@102
   357
	      mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
slouken@102
   358
	      lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
slouken@102
   359
	      cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
slouken@127
   360
	      func_extract_an_archive "`pwd`" "${darwin_base_archive}"
slouken@102
   361
	      cd "$darwin_curdir"
slouken@127
   362
	      $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
slouken@102
   363
	    done # $darwin_arches
slouken@102
   364
      ## Okay now we have a bunch of thin objects, gotta fatten them up :)
slouken@127
   365
	    darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
slouken@102
   366
	    darwin_file=
slouken@102
   367
	    darwin_files=
slouken@102
   368
	    for darwin_file in $darwin_filelist; do
slouken@102
   369
	      darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
slouken@102
   370
	      lipo -create -output "$darwin_file" $darwin_files
slouken@102
   371
	    done # $darwin_filelist
slouken@127
   372
	    ${rm}r unfat-$$
slouken@102
   373
	    cd "$darwin_orig_dir"
slouken@102
   374
	  else
slouken@127
   375
	    cd "$darwin_orig_dir"
slouken@127
   376
 	    func_extract_an_archive "$my_xdir" "$my_xabs"
slouken@102
   377
	  fi # $darwin_arches
slouken@102
   378
	fi # $run
slouken@127
   379
	;;
slouken@102
   380
      *)
slouken@127
   381
        func_extract_an_archive "$my_xdir" "$my_xabs"
slouken@127
   382
        ;;
slouken@102
   383
      esac
slouken@102
   384
      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
slouken@102
   385
    done
slouken@102
   386
    func_extract_archives_result="$my_oldobjs"
slouken@102
   387
}
slouken@94
   388
# End of Shell function definitions
slouken@94
   389
#####################################
slouken@94
   390
slouken@102
   391
# Darwin sucks
slouken@102
   392
eval std_shrext=\"$shrext_cmds\"
slouken@102
   393
slouken@127
   394
disable_libs=no
slouken@127
   395
slouken@0
   396
# Parse our command line options once, thoroughly.
slouken@94
   397
while test "$#" -gt 0
slouken@0
   398
do
slouken@0
   399
  arg="$1"
slouken@0
   400
  shift
slouken@0
   401
slouken@94
   402
  case $arg in
slouken@0
   403
  -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
slouken@0
   404
  *) optarg= ;;
slouken@0
   405
  esac
slouken@0
   406
slouken@0
   407
  # If the previous option needs an argument, assign it.
slouken@0
   408
  if test -n "$prev"; then
slouken@94
   409
    case $prev in
slouken@0
   410
    execute_dlfiles)
slouken@94
   411
      execute_dlfiles="$execute_dlfiles $arg"
slouken@94
   412
      ;;
slouken@94
   413
    tag)
slouken@94
   414
      tagname="$arg"
slouken@102
   415
      preserve_args="${preserve_args}=$arg"
slouken@94
   416
slouken@94
   417
      # Check whether tagname contains only valid characters
slouken@94
   418
      case $tagname in
slouken@94
   419
      *[!-_A-Za-z0-9,/]*)
slouken@94
   420
	$echo "$progname: invalid tag name: $tagname" 1>&2
slouken@102
   421
	exit $EXIT_FAILURE
slouken@94
   422
	;;
slouken@94
   423
      esac
slouken@94
   424
slouken@94
   425
      case $tagname in
slouken@94
   426
      CC)
slouken@94
   427
	# Don't test for the "default" C tag, as we know, it's there, but
slouken@94
   428
	# not specially marked.
slouken@94
   429
	;;
slouken@94
   430
      *)
slouken@102
   431
	if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
slouken@94
   432
	  taglist="$taglist $tagname"
slouken@94
   433
	  # Evaluate the configuration.
slouken@102
   434
	  eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
slouken@94
   435
	else
slouken@94
   436
	  $echo "$progname: ignoring unknown tag $tagname" 1>&2
slouken@94
   437
	fi
slouken@94
   438
	;;
slouken@94
   439
      esac
slouken@0
   440
      ;;
slouken@0
   441
    *)
slouken@0
   442
      eval "$prev=\$arg"
slouken@0
   443
      ;;
slouken@0
   444
    esac
slouken@0
   445
slouken@0
   446
    prev=
slouken@0
   447
    prevopt=
slouken@0
   448
    continue
slouken@0
   449
  fi
slouken@0
   450
slouken@0
   451
  # Have we seen a non-optional argument yet?
slouken@94
   452
  case $arg in
slouken@0
   453
  --help)
slouken@0
   454
    show_help=yes
slouken@0
   455
    ;;
slouken@0
   456
slouken@0
   457
  --version)
slouken@94
   458
    $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
slouken@94
   459
    $echo
slouken@127
   460
    $echo "Copyright (C) 2005  Free Software Foundation, Inc."
slouken@94
   461
    $echo "This is free software; see the source for copying conditions.  There is NO"
slouken@94
   462
    $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
slouken@127
   463
    exit $?
slouken@0
   464
    ;;
slouken@0
   465
slouken@0
   466
  --config)
slouken@102
   467
    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
slouken@94
   468
    # Now print the configurations for the tags.
slouken@94
   469
    for tagname in $taglist; do
slouken@102
   470
      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
slouken@94
   471
    done
slouken@127
   472
    exit $?
slouken@0
   473
    ;;
slouken@0
   474
slouken@0
   475
  --debug)
slouken@94
   476
    $echo "$progname: enabling shell trace mode"
slouken@0
   477
    set -x
slouken@102
   478
    preserve_args="$preserve_args $arg"
slouken@0
   479
    ;;
slouken@0
   480
slouken@0
   481
  --dry-run | -n)
slouken@0
   482
    run=:
slouken@0
   483
    ;;
slouken@0
   484
slouken@0
   485
  --features)
slouken@94
   486
    $echo "host: $host"
slouken@0
   487
    if test "$build_libtool_libs" = yes; then
slouken@94
   488
      $echo "enable shared libraries"
slouken@0
   489
    else
slouken@94
   490
      $echo "disable shared libraries"
slouken@0
   491
    fi
slouken@0
   492
    if test "$build_old_libs" = yes; then
slouken@94
   493
      $echo "enable static libraries"
slouken@0
   494
    else
slouken@94
   495
      $echo "disable static libraries"
slouken@0
   496
    fi
slouken@127
   497
    exit $?
slouken@0
   498
    ;;
slouken@0
   499
slouken@0
   500
  --finish) mode="finish" ;;
slouken@0
   501
slouken@0
   502
  --mode) prevopt="--mode" prev=mode ;;
slouken@0
   503
  --mode=*) mode="$optarg" ;;
slouken@0
   504
slouken@94
   505
  --preserve-dup-deps) duplicate_deps="yes" ;;
slouken@94
   506
slouken@0
   507
  --quiet | --silent)
slouken@0
   508
    show=:
slouken@102
   509
    preserve_args="$preserve_args $arg"
slouken@0
   510
    ;;
slouken@0
   511
slouken@127
   512
  --tag)
slouken@127
   513
    prevopt="--tag"
slouken@127
   514
    prev=tag
slouken@127
   515
    preserve_args="$preserve_args --tag"
slouken@127
   516
    ;;
slouken@94
   517
  --tag=*)
slouken@94
   518
    set tag "$optarg" ${1+"$@"}
slouken@94
   519
    shift
slouken@94
   520
    prev=tag
slouken@102
   521
    preserve_args="$preserve_args --tag"
slouken@94
   522
    ;;
slouken@94
   523
slouken@0
   524
  -dlopen)
slouken@0
   525
    prevopt="-dlopen"
slouken@0
   526
    prev=execute_dlfiles
slouken@0
   527
    ;;
slouken@0
   528
slouken@0
   529
  -*)
slouken@0
   530
    $echo "$modename: unrecognized option \`$arg'" 1>&2
slouken@0
   531
    $echo "$help" 1>&2
slouken@102
   532
    exit $EXIT_FAILURE
slouken@0
   533
    ;;
slouken@0
   534
slouken@0
   535
  *)
slouken@0
   536
    nonopt="$arg"
slouken@0
   537
    break
slouken@0
   538
    ;;
slouken@0
   539
  esac
slouken@0
   540
done
slouken@0
   541
slouken@0
   542
if test -n "$prevopt"; then
slouken@0
   543
  $echo "$modename: option \`$prevopt' requires an argument" 1>&2
slouken@0
   544
  $echo "$help" 1>&2
slouken@102
   545
  exit $EXIT_FAILURE
slouken@0
   546
fi
slouken@0
   547
slouken@127
   548
case $disable_libs in
slouken@127
   549
no) 
slouken@127
   550
  ;;
slouken@127
   551
shared)
slouken@127
   552
  build_libtool_libs=no
slouken@127
   553
  build_old_libs=yes
slouken@127
   554
  ;;
slouken@127
   555
static)
slouken@127
   556
  build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
slouken@127
   557
  ;;
slouken@127
   558
esac
slouken@127
   559
slouken@94
   560
# If this variable is set in any of the actions, the command in it
slouken@94
   561
# will be execed at the end.  This prevents here-documents from being
slouken@94
   562
# left over by shells.
slouken@94
   563
exec_cmd=
slouken@94
   564
slouken@0
   565
if test -z "$show_help"; then
slouken@0
   566
slouken@0
   567
  # Infer the operation mode.
slouken@0
   568
  if test -z "$mode"; then
slouken@94
   569
    $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
slouken@127
   570
    $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
slouken@94
   571
    case $nonopt in
slouken@94
   572
    *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
slouken@0
   573
      mode=link
slouken@0
   574
      for arg
slouken@0
   575
      do
slouken@94
   576
	case $arg in
slouken@0
   577
	-c)
slouken@0
   578
	   mode=compile
slouken@0
   579
	   break
slouken@0
   580
	   ;;
slouken@0
   581
	esac
slouken@0
   582
      done
slouken@0
   583
      ;;
slouken@0
   584
    *db | *dbx | *strace | *truss)
slouken@0
   585
      mode=execute
slouken@0
   586
      ;;
slouken@0
   587
    *install*|cp|mv)
slouken@0
   588
      mode=install
slouken@0
   589
      ;;
slouken@0
   590
    *rm)
slouken@0
   591
      mode=uninstall
slouken@0
   592
      ;;
slouken@0
   593
    *)
slouken@0
   594
      # If we have no mode, but dlfiles were specified, then do execute mode.
slouken@0
   595
      test -n "$execute_dlfiles" && mode=execute
slouken@0
   596
slouken@0
   597
      # Just use the default operation mode.
slouken@0
   598
      if test -z "$mode"; then
slouken@0
   599
	if test -n "$nonopt"; then
slouken@0
   600
	  $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
slouken@0
   601
	else
slouken@0
   602
	  $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
slouken@0
   603
	fi
slouken@0
   604
      fi
slouken@0
   605
      ;;
slouken@0
   606
    esac
slouken@0
   607
  fi
slouken@0
   608
slouken@0
   609
  # Only execute mode is allowed to have -dlopen flags.
slouken@0
   610
  if test -n "$execute_dlfiles" && test "$mode" != execute; then
slouken@0
   611
    $echo "$modename: unrecognized option \`-dlopen'" 1>&2
slouken@0
   612
    $echo "$help" 1>&2
slouken@102
   613
    exit $EXIT_FAILURE
slouken@0
   614
  fi
slouken@0
   615
slouken@0
   616
  # Change the help message to a mode-specific one.
slouken@0
   617
  generic_help="$help"
slouken@0
   618
  help="Try \`$modename --help --mode=$mode' for more information."
slouken@0
   619
slouken@0
   620
  # These modes are in order of execution frequency so that they run quickly.
slouken@94
   621
  case $mode in
slouken@0
   622
  # libtool compile mode
slouken@0
   623
  compile)
slouken@0
   624
    modename="$modename: compile"
slouken@0
   625
    # Get the compilation command and the source file.
slouken@0
   626
    base_compile=
slouken@94
   627
    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
slouken@102
   628
    suppress_opt=yes
slouken@0
   629
    suppress_output=
slouken@94
   630
    arg_mode=normal
slouken@94
   631
    libobj=
slouken@102
   632
    later=
slouken@94
   633
slouken@0
   634
    for arg
slouken@0
   635
    do
slouken@127
   636
      case $arg_mode in
slouken@94
   637
      arg  )
slouken@94
   638
	# do not "continue".  Instead, add this to base_compile
slouken@94
   639
	lastarg="$arg"
slouken@94
   640
	arg_mode=normal
slouken@0
   641
	;;
slouken@0
   642
slouken@94
   643
      target )
slouken@94
   644
	libobj="$arg"
slouken@94
   645
	arg_mode=normal
slouken@0
   646
	continue
slouken@0
   647
	;;
slouken@94
   648
slouken@94
   649
      normal )
slouken@94
   650
	# Accept any command-line options.
slouken@94
   651
	case $arg in
slouken@94
   652
	-o)
slouken@94
   653
	  if test -n "$libobj" ; then
slouken@94
   654
	    $echo "$modename: you cannot specify \`-o' more than once" 1>&2
slouken@102
   655
	    exit $EXIT_FAILURE
slouken@94
   656
	  fi
slouken@94
   657
	  arg_mode=target
slouken@94
   658
	  continue
slouken@94
   659
	  ;;
slouken@94
   660
slouken@102
   661
	-static | -prefer-pic | -prefer-non-pic)
slouken@102
   662
	  later="$later $arg"
slouken@94
   663
	  continue
slouken@94
   664
	  ;;
slouken@94
   665
slouken@102
   666
	-no-suppress)
slouken@102
   667
	  suppress_opt=no
slouken@94
   668
	  continue
slouken@94
   669
	  ;;
slouken@94
   670
slouken@94
   671
	-Xcompiler)
slouken@94
   672
	  arg_mode=arg  #  the next one goes into the "base_compile" arg list
slouken@94
   673
	  continue      #  The current "srcfile" will either be retained or
slouken@94
   674
	  ;;            #  replaced later.  I would guess that would be a bug.
slouken@94
   675
slouken@94
   676
	-Wc,*)
slouken@94
   677
	  args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
slouken@94
   678
	  lastarg=
slouken@94
   679
	  save_ifs="$IFS"; IFS=','
slouken@102
   680
 	  for arg in $args; do
slouken@94
   681
	    IFS="$save_ifs"
slouken@94
   682
slouken@94
   683
	    # Double-quote args containing other shell metacharacters.
slouken@94
   684
	    # Many Bourne shells cannot handle close brackets correctly
slouken@94
   685
	    # in scan sets, so we specify it separately.
slouken@94
   686
	    case $arg in
slouken@94
   687
	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
slouken@94
   688
	      arg="\"$arg\""
slouken@94
   689
	      ;;
slouken@94
   690
	    esac
slouken@94
   691
	    lastarg="$lastarg $arg"
slouken@94
   692
	  done
slouken@94
   693
	  IFS="$save_ifs"
slouken@94
   694
	  lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
slouken@94
   695
slouken@94
   696
	  # Add the arguments to base_compile.
slouken@94
   697
	  base_compile="$base_compile $lastarg"
slouken@94
   698
	  continue
slouken@94
   699
	  ;;
slouken@94
   700
slouken@94
   701
	* )
slouken@94
   702
	  # Accept the current argument as the source file.
slouken@94
   703
	  # The previous "srcfile" becomes the current argument.
slouken@94
   704
	  #
slouken@94
   705
	  lastarg="$srcfile"
slouken@94
   706
	  srcfile="$arg"
slouken@94
   707
	  ;;
slouken@94
   708
	esac  #  case $arg
slouken@0
   709
	;;
slouken@94
   710
      esac    #  case $arg_mode
slouken@0
   711
slouken@0
   712
      # Aesthetically quote the previous argument.
slouken@0
   713
      lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
slouken@0
   714
slouken@94
   715
      case $lastarg in
slouken@0
   716
      # Double-quote args containing other shell metacharacters.
slouken@94
   717
      # Many Bourne shells cannot handle close brackets correctly
slouken@127
   718
      # in scan sets, and some SunOS ksh mistreat backslash-escaping
slouken@127
   719
      # in scan sets (worked around with variable expansion),
slouken@127
   720
      # and furthermore cannot handle '|' '&' '(' ')' in scan sets 
slouken@127
   721
      # at all, so we specify them separately.
slouken@94
   722
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
slouken@0
   723
	lastarg="\"$lastarg\""
slouken@0
   724
	;;
slouken@0
   725
      esac
slouken@0
   726
slouken@94
   727
      base_compile="$base_compile $lastarg"
slouken@94
   728
    done # for arg
slouken@94
   729
slouken@94
   730
    case $arg_mode in
slouken@94
   731
    arg)
slouken@94
   732
      $echo "$modename: you must specify an argument for -Xcompile"
slouken@102
   733
      exit $EXIT_FAILURE
slouken@0
   734
      ;;
slouken@94
   735
    target)
slouken@0
   736
      $echo "$modename: you must specify a target with \`-o'" 1>&2
slouken@102
   737
      exit $EXIT_FAILURE
slouken@0
   738
      ;;
slouken@94
   739
    *)
slouken@94
   740
      # Get the name of the library object.
slouken@94
   741
      [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
slouken@94
   742
      ;;
slouken@0
   743
    esac
slouken@0
   744
slouken@0
   745
    # Recognize several different file suffixes.
slouken@0
   746
    # If the user specifies -o file.o, it is replaced with file.lo
slouken@94
   747
    xform='[cCFSifmso]'
slouken@94
   748
    case $libobj in
slouken@0
   749
    *.ada) xform=ada ;;
slouken@0
   750
    *.adb) xform=adb ;;
slouken@0
   751
    *.ads) xform=ads ;;
slouken@0
   752
    *.asm) xform=asm ;;
slouken@0
   753
    *.c++) xform=c++ ;;
slouken@0
   754
    *.cc) xform=cc ;;
slouken@94
   755
    *.ii) xform=ii ;;
slouken@94
   756
    *.class) xform=class ;;
slouken@0
   757
    *.cpp) xform=cpp ;;
slouken@0
   758
    *.cxx) xform=cxx ;;
slouken@0
   759
    *.f90) xform=f90 ;;
slouken@0
   760
    *.for) xform=for ;;
slouken@94
   761
    *.java) xform=java ;;
slouken@0
   762
    esac
slouken@0
   763
slouken@0
   764
    libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
slouken@0
   765
slouken@94
   766
    case $libobj in
slouken@0
   767
    *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
slouken@0
   768
    *)
slouken@0
   769
      $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
slouken@102
   770
      exit $EXIT_FAILURE
slouken@0
   771
      ;;
slouken@0
   772
    esac
slouken@0
   773
slouken@102
   774
    func_infer_tag $base_compile
slouken@102
   775
slouken@102
   776
    for arg in $later; do
slouken@102
   777
      case $arg in
slouken@102
   778
      -static)
slouken@102
   779
	build_old_libs=yes
slouken@102
   780
	continue
slouken@102
   781
	;;
slouken@102
   782
slouken@102
   783
      -prefer-pic)
slouken@102
   784
	pic_mode=yes
slouken@102
   785
	continue
slouken@102
   786
	;;
slouken@102
   787
slouken@102
   788
      -prefer-non-pic)
slouken@102
   789
	pic_mode=no
slouken@102
   790
	continue
slouken@94
   791
	;;
slouken@94
   792
      esac
slouken@102
   793
    done
slouken@94
   794
slouken@127
   795
    qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
slouken@127
   796
    case $qlibobj in
slouken@127
   797
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
slouken@127
   798
	qlibobj="\"$qlibobj\"" ;;
slouken@127
   799
    esac
slouken@127
   800
    test "X$libobj" != "X$qlibobj" \
slouken@127
   801
	&& $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' 	&()|`$[]' \
slouken@127
   802
	&& $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
slouken@94
   803
    objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
slouken@94
   804
    xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
slouken@94
   805
    if test "X$xdir" = "X$obj"; then
slouken@94
   806
      xdir=
slouken@94
   807
    else
slouken@94
   808
      xdir=$xdir/
slouken@94
   809
    fi
slouken@94
   810
    lobj=${xdir}$objdir/$objname
slouken@94
   811
slouken@0
   812
    if test -z "$base_compile"; then
slouken@0
   813
      $echo "$modename: you must specify a compilation command" 1>&2
slouken@0
   814
      $echo "$help" 1>&2
slouken@102
   815
      exit $EXIT_FAILURE
slouken@0
   816
    fi
slouken@0
   817
slouken@0
   818
    # Delete any leftover library objects.
slouken@0
   819
    if test "$build_old_libs" = yes; then
slouken@94
   820
      removelist="$obj $lobj $libobj ${libobj}T"
slouken@0
   821
    else
slouken@94
   822
      removelist="$lobj $libobj ${libobj}T"
slouken@0
   823
    fi
slouken@0
   824
slouken@0
   825
    $run $rm $removelist
slouken@102
   826
    trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
slouken@0
   827
slouken@94
   828
    # On Cygwin there's no "real" PIC flag so we must build both object types
slouken@94
   829
    case $host_os in
slouken@94
   830
    cygwin* | mingw* | pw32* | os2*)
slouken@94
   831
      pic_mode=default
slouken@94
   832
      ;;
slouken@94
   833
    esac
slouken@94
   834
    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
slouken@94
   835
      # non-PIC code in shared libraries is not supported
slouken@94
   836
      pic_mode=default
slouken@94
   837
    fi
slouken@94
   838
slouken@0
   839
    # Calculate the filename of the output object if compiler does
slouken@0
   840
    # not support -o with -c
slouken@0
   841
    if test "$compiler_c_o" = no; then
slouken@94
   842
      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
slouken@0
   843
      lockfile="$output_obj.lock"
slouken@0
   844
      removelist="$removelist $output_obj $lockfile"
slouken@102
   845
      trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
slouken@0
   846
    else
slouken@94
   847
      output_obj=
slouken@0
   848
      need_locks=no
slouken@0
   849
      lockfile=
slouken@0
   850
    fi
slouken@0
   851
slouken@0
   852
    # Lock this critical section if it is needed
slouken@0
   853
    # We use this script file to make the link, it avoids creating a new file
slouken@0
   854
    if test "$need_locks" = yes; then
slouken@102
   855
      until $run ln "$progpath" "$lockfile" 2>/dev/null; do
slouken@0
   856
	$show "Waiting for $lockfile to be removed"
slouken@0
   857
	sleep 2
slouken@0
   858
      done
slouken@0
   859
    elif test "$need_locks" = warn; then
slouken@0
   860
      if test -f "$lockfile"; then
slouken@94
   861
	$echo "\
slouken@0
   862
*** ERROR, $lockfile exists and contains:
slouken@0
   863
`cat $lockfile 2>/dev/null`
slouken@0
   864
slouken@0
   865
This indicates that another process is trying to use the same
slouken@0
   866
temporary object file, and libtool could not work around it because
slouken@0
   867
your compiler does not support \`-c' and \`-o' together.  If you
slouken@0
   868
repeat this compilation, it may succeed, by chance, but you had better
slouken@0
   869
avoid parallel builds (make -j) in this platform, or get a better
slouken@0
   870
compiler."
slouken@0
   871
slouken@0
   872
	$run $rm $removelist
slouken@102
   873
	exit $EXIT_FAILURE
slouken@0
   874
      fi
slouken@127
   875
      $echo "$srcfile" > "$lockfile"
slouken@0
   876
    fi
slouken@0
   877
slouken@0
   878
    if test -n "$fix_srcfile_path"; then
slouken@0
   879
      eval srcfile=\"$fix_srcfile_path\"
slouken@0
   880
    fi
slouken@127
   881
    qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
slouken@127
   882
    case $qsrcfile in
slouken@127
   883
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
slouken@127
   884
      qsrcfile="\"$qsrcfile\"" ;;
slouken@127
   885
    esac
slouken@0
   886
slouken@94
   887
    $run $rm "$libobj" "${libobj}T"
slouken@94
   888
slouken@94
   889
    # Create a libtool object file (analogous to a ".la" file),
slouken@94
   890
    # but don't create it if we're doing a dry run.
slouken@94
   891
    test -z "$run" && cat > ${libobj}T <<EOF
slouken@94
   892
# $libobj - a libtool object file
slouken@94
   893
# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
slouken@94
   894
#
slouken@94
   895
# Please DO NOT delete this file!
slouken@94
   896
# It is necessary for linking the library.
slouken@94
   897
slouken@94
   898
# Name of the PIC object.
slouken@94
   899
EOF
slouken@94
   900
slouken@0
   901
    # Only build a PIC object if we are building libtool libraries.
slouken@0
   902
    if test "$build_libtool_libs" = yes; then
slouken@0
   903
      # Without this assignment, base_compile gets emptied.
slouken@0
   904
      fbsd_hideous_sh_bug=$base_compile
slouken@0
   905
slouken@94
   906
      if test "$pic_mode" != no; then
slouken@127
   907
	command="$base_compile $qsrcfile $pic_flag"
slouken@94
   908
      else
slouken@94
   909
	# Don't build PIC code
slouken@127
   910
	command="$base_compile $qsrcfile"
slouken@94
   911
      fi
slouken@94
   912
slouken@94
   913
      if test ! -d "${xdir}$objdir"; then
slouken@94
   914
	$show "$mkdir ${xdir}$objdir"
slouken@94
   915
	$run $mkdir ${xdir}$objdir
slouken@127
   916
	exit_status=$?
slouken@127
   917
	if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
slouken@127
   918
	  exit $exit_status
slouken@0
   919
	fi
slouken@0
   920
      fi
slouken@94
   921
slouken@94
   922
      if test -z "$output_obj"; then
slouken@94
   923
	# Place PIC objects in $objdir
slouken@94
   924
	command="$command -o $lobj"
slouken@0
   925
      fi
slouken@0
   926
slouken@94
   927
      $run $rm "$lobj" "$output_obj"
slouken@94
   928
slouken@0
   929
      $show "$command"
slouken@0
   930
      if $run eval "$command"; then :
slouken@0
   931
      else
slouken@0
   932
	test -n "$output_obj" && $run $rm $removelist
slouken@102
   933
	exit $EXIT_FAILURE
slouken@0
   934
      fi
slouken@0
   935
slouken@0
   936
      if test "$need_locks" = warn &&
slouken@94
   937
	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
slouken@94
   938
	$echo "\
slouken@0
   939
*** ERROR, $lockfile contains:
slouken@0
   940
`cat $lockfile 2>/dev/null`
slouken@0
   941
slouken@0
   942
but it should contain:
slouken@0
   943
$srcfile
slouken@0
   944
slouken@0
   945
This indicates that another process is trying to use the same
slouken@0
   946
temporary object file, and libtool could not work around it because
slouken@0
   947
your compiler does not support \`-c' and \`-o' together.  If you
slouken@0
   948
repeat this compilation, it may succeed, by chance, but you had better
slouken@0
   949
avoid parallel builds (make -j) in this platform, or get a better
slouken@0
   950
compiler."
slouken@0
   951
slouken@0
   952
	$run $rm $removelist
slouken@102
   953
	exit $EXIT_FAILURE
slouken@0
   954
      fi
slouken@0
   955
slouken@0
   956
      # Just move the object if needed, then go on to compile the next one
slouken@94
   957
      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
slouken@94
   958
	$show "$mv $output_obj $lobj"
slouken@94
   959
	if $run $mv $output_obj $lobj; then :
slouken@0
   960
	else
slouken@0
   961
	  error=$?
slouken@0
   962
	  $run $rm $removelist
slouken@0
   963
	  exit $error
slouken@0
   964
	fi
slouken@0
   965
      fi
slouken@0
   966
slouken@94
   967
      # Append the name of the PIC object to the libtool object file.
slouken@94
   968
      test -z "$run" && cat >> ${libobj}T <<EOF
slouken@94
   969
pic_object='$objdir/$objname'
slouken@94
   970
slouken@94
   971
EOF
slouken@0
   972
slouken@0
   973
      # Allow error messages only from the first compilation.
slouken@102
   974
      if test "$suppress_opt" = yes; then
slouken@102
   975
        suppress_output=' >/dev/null 2>&1'
slouken@102
   976
      fi
slouken@94
   977
    else
slouken@94
   978
      # No PIC object so indicate it doesn't exist in the libtool
slouken@94
   979
      # object file.
slouken@94
   980
      test -z "$run" && cat >> ${libobj}T <<EOF
slouken@94
   981
pic_object=none
slouken@94
   982
slouken@94
   983
EOF
slouken@0
   984
    fi
slouken@0
   985
slouken@0
   986
    # Only build a position-dependent object if we build old libraries.
slouken@0
   987
    if test "$build_old_libs" = yes; then
slouken@94
   988
      if test "$pic_mode" != yes; then
slouken@94
   989
	# Don't build PIC code
slouken@127
   990
	command="$base_compile $qsrcfile"
slouken@94
   991
      else
slouken@127
   992
	command="$base_compile $qsrcfile $pic_flag"
slouken@94
   993
      fi
slouken@0
   994
      if test "$compiler_c_o" = yes; then
slouken@0
   995
	command="$command -o $obj"
slouken@0
   996
      fi
slouken@0
   997
slouken@0
   998
      # Suppress compiler output if we already did a PIC compilation.
slouken@0
   999
      command="$command$suppress_output"
slouken@94
  1000
      $run $rm "$obj" "$output_obj"
slouken@0
  1001
      $show "$command"
slouken@0
  1002
      if $run eval "$command"; then :
slouken@0
  1003
      else
slouken@0
  1004
	$run $rm $removelist
slouken@102
  1005
	exit $EXIT_FAILURE
slouken@0
  1006
      fi
slouken@0
  1007
slouken@0
  1008
      if test "$need_locks" = warn &&
slouken@94
  1009
	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
slouken@94
  1010
	$echo "\
slouken@0
  1011
*** ERROR, $lockfile contains:
slouken@0
  1012
`cat $lockfile 2>/dev/null`
slouken@0
  1013
slouken@0
  1014
but it should contain:
slouken@0
  1015
$srcfile
slouken@0
  1016
slouken@0
  1017
This indicates that another process is trying to use the same
slouken@0
  1018
temporary object file, and libtool could not work around it because
slouken@0
  1019
your compiler does not support \`-c' and \`-o' together.  If you
slouken@0
  1020
repeat this compilation, it may succeed, by chance, but you had better
slouken@0
  1021
avoid parallel builds (make -j) in this platform, or get a better
slouken@0
  1022
compiler."
slouken@0
  1023
slouken@0
  1024
	$run $rm $removelist
slouken@102
  1025
	exit $EXIT_FAILURE
slouken@0
  1026
      fi
slouken@0
  1027
slouken@0
  1028
      # Just move the object if needed
slouken@94
  1029
      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
slouken@0
  1030
	$show "$mv $output_obj $obj"
slouken@0
  1031
	if $run $mv $output_obj $obj; then :
slouken@0
  1032
	else
slouken@0
  1033
	  error=$?
slouken@0
  1034
	  $run $rm $removelist
slouken@0
  1035
	  exit $error
slouken@0
  1036
	fi
slouken@0
  1037
      fi
slouken@0
  1038
slouken@94
  1039
      # Append the name of the non-PIC object the libtool object file.
slouken@94
  1040
      # Only append if the libtool object file exists.
slouken@94
  1041
      test -z "$run" && cat >> ${libobj}T <<EOF
slouken@94
  1042
# Name of the non-PIC object.
slouken@94
  1043
non_pic_object='$objname'
slouken@94
  1044
slouken@94
  1045
EOF
slouken@94
  1046
    else
slouken@94
  1047
      # Append the name of the non-PIC object the libtool object file.
slouken@94
  1048
      # Only append if the libtool object file exists.
slouken@94
  1049
      test -z "$run" && cat >> ${libobj}T <<EOF
slouken@94
  1050
# Name of the non-PIC object.
slouken@94
  1051
non_pic_object=none
slouken@94
  1052
slouken@94
  1053
EOF
slouken@0
  1054
    fi
slouken@0
  1055
slouken@94
  1056
    $run $mv "${libobj}T" "${libobj}"
slouken@94
  1057
slouken@0
  1058
    # Unlock the critical section if it was locked
slouken@0
  1059
    if test "$need_locks" != no; then
slouken@94
  1060
      $run $rm "$lockfile"
slouken@0
  1061
    fi
slouken@0
  1062
slouken@102
  1063
    exit $EXIT_SUCCESS
slouken@0
  1064
    ;;
slouken@0
  1065
slouken@0
  1066
  # libtool link mode
slouken@94
  1067
  link | relink)
slouken@0
  1068
    modename="$modename: link"
slouken@94
  1069
    case $host in
slouken@94
  1070
    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
slouken@0
  1071
      # It is impossible to link a dll without this setting, and
slouken@0
  1072
      # we shouldn't force the makefile maintainer to figure out
slouken@0
  1073
      # which system we are compiling for in order to pass an extra
slouken@94
  1074
      # flag for every libtool invocation.
slouken@0
  1075
      # allow_undefined=no
slouken@0
  1076
slouken@0
  1077
      # FIXME: Unfortunately, there are problems with the above when trying
slouken@0
  1078
      # to make a dll which has undefined symbols, in which case not
slouken@0
  1079
      # even a static library is built.  For now, we need to specify
slouken@0
  1080
      # -no-undefined on the libtool link line when we can be certain
slouken@0
  1081
      # that all symbols are satisfied, otherwise we get a static library.
slouken@0
  1082
      allow_undefined=yes
slouken@0
  1083
      ;;
slouken@0
  1084
    *)
slouken@0
  1085
      allow_undefined=yes
slouken@0
  1086
      ;;
slouken@0
  1087
    esac
slouken@94
  1088
    libtool_args="$nonopt"
slouken@102
  1089
    base_compile="$nonopt $@"
slouken@0
  1090
    compile_command="$nonopt"
slouken@0
  1091
    finalize_command="$nonopt"
slouken@0
  1092
slouken@0
  1093
    compile_rpath=
slouken@0
  1094
    finalize_rpath=
slouken@0
  1095
    compile_shlibpath=
slouken@0
  1096
    finalize_shlibpath=
slouken@0
  1097
    convenience=
slouken@0
  1098
    old_convenience=
slouken@0
  1099
    deplibs=
slouken@94
  1100
    old_deplibs=
slouken@94
  1101
    compiler_flags=
slouken@94
  1102
    linker_flags=
slouken@94
  1103
    dllsearchpath=
slouken@94
  1104
    lib_search_path=`pwd`
slouken@94
  1105
    inst_prefix_dir=
slouken@94
  1106
slouken@0
  1107
    avoid_version=no
slouken@0
  1108
    dlfiles=
slouken@0
  1109
    dlprefiles=
slouken@0
  1110
    dlself=no
slouken@0
  1111
    export_dynamic=no
slouken@0
  1112
    export_symbols=
slouken@0
  1113
    export_symbols_regex=
slouken@0
  1114
    generated=
slouken@0
  1115
    libobjs=
slouken@0
  1116
    ltlibs=
slouken@0
  1117
    module=no
slouken@94
  1118
    no_install=no
slouken@0
  1119
    objs=
slouken@94
  1120
    non_pic_objects=
slouken@127
  1121
    notinst_path= # paths that contain not-installed libtool libraries
slouken@102
  1122
    precious_files_regex=
slouken@0
  1123
    prefer_static_libs=no
slouken@0
  1124
    preload=no
slouken@0
  1125
    prev=
slouken@0
  1126
    prevarg=
slouken@0
  1127
    release=
slouken@0
  1128
    rpath=
slouken@0
  1129
    xrpath=
slouken@0
  1130
    perm_rpath=
slouken@0
  1131
    temp_rpath=
slouken@0
  1132
    thread_safe=no
slouken@0
  1133
    vinfo=
slouken@94
  1134
    vinfo_number=no
slouken@0
  1135
slouken@102
  1136
    func_infer_tag $base_compile
slouken@102
  1137
slouken@0
  1138
    # We need to know -static, to get the right output filenames.
slouken@0
  1139
    for arg
slouken@0
  1140
    do
slouken@94
  1141
      case $arg in
slouken@0
  1142
      -all-static | -static)
slouken@0
  1143
	if test "X$arg" = "X-all-static"; then
slouken@0
  1144
	  if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
slouken@0
  1145
	    $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
slouken@0
  1146
	  fi
slouken@0
  1147
	  if test -n "$link_static_flag"; then
slouken@0
  1148
	    dlopen_self=$dlopen_self_static
slouken@0
  1149
	  fi
slouken@127
  1150
	  prefer_static_libs=yes
slouken@0
  1151
	else
slouken@0
  1152
	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
slouken@0
  1153
	    dlopen_self=$dlopen_self_static
slouken@0
  1154
	  fi
slouken@127
  1155
	  prefer_static_libs=built
slouken@0
  1156
	fi
slouken@0
  1157
	build_libtool_libs=no
slouken@0
  1158
	build_old_libs=yes
slouken@0
  1159
	break
slouken@0
  1160
	;;
slouken@0
  1161
      esac
slouken@0
  1162
    done
slouken@0
  1163
slouken@0
  1164
    # See if our shared archives depend on static archives.
slouken@0
  1165
    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
slouken@0
  1166
slouken@0
  1167
    # Go through the arguments, transforming them on the way.
slouken@94
  1168
    while test "$#" -gt 0; do
slouken@0
  1169
      arg="$1"
slouken@0
  1170
      shift
slouken@94
  1171
      case $arg in
slouken@94
  1172
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
slouken@94
  1173
	qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
slouken@94
  1174
	;;
slouken@94
  1175
      *) qarg=$arg ;;
slouken@94
  1176
      esac
slouken@94
  1177
      libtool_args="$libtool_args $qarg"
slouken@0
  1178
slouken@0
  1179
      # If the previous option needs an argument, assign it.
slouken@0
  1180
      if test -n "$prev"; then
slouken@94
  1181
	case $prev in
slouken@0
  1182
	output)
slouken@0
  1183
	  compile_command="$compile_command @OUTPUT@"
slouken@0
  1184
	  finalize_command="$finalize_command @OUTPUT@"
slouken@0
  1185
	  ;;
slouken@0
  1186
	esac
slouken@0
  1187
slouken@94
  1188
	case $prev in
slouken@0
  1189
	dlfiles|dlprefiles)
slouken@0
  1190
	  if test "$preload" = no; then
slouken@0
  1191
	    # Add the symbol object into the linking commands.
slouken@0
  1192
	    compile_command="$compile_command @SYMFILE@"
slouken@0
  1193
	    finalize_command="$finalize_command @SYMFILE@"
slouken@0
  1194
	    preload=yes
slouken@0
  1195
	  fi
slouken@94
  1196
	  case $arg in
slouken@0
  1197
	  *.la | *.lo) ;;  # We handle these cases below.
slouken@0
  1198
	  force)
slouken@0
  1199
	    if test "$dlself" = no; then
slouken@0
  1200
	      dlself=needless
slouken@0
  1201
	      export_dynamic=yes
slouken@0
  1202
	    fi
slouken@0
  1203
	    prev=
slouken@0
  1204
	    continue
slouken@0
  1205
	    ;;
slouken@0
  1206
	  self)
slouken@0
  1207
	    if test "$prev" = dlprefiles; then
slouken@0
  1208
	      dlself=yes
slouken@0
  1209
	    elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
slouken@0
  1210
	      dlself=yes
slouken@0
  1211
	    else
slouken@0
  1212
	      dlself=needless
slouken@0
  1213
	      export_dynamic=yes
slouken@0
  1214
	    fi
slouken@0
  1215
	    prev=
slouken@0
  1216
	    continue
slouken@0
  1217
	    ;;
slouken@0
  1218
	  *)
slouken@0
  1219
	    if test "$prev" = dlfiles; then
slouken@0
  1220
	      dlfiles="$dlfiles $arg"
slouken@0
  1221
	    else
slouken@0
  1222
	      dlprefiles="$dlprefiles $arg"
slouken@0
  1223
	    fi
slouken@0
  1224
	    prev=
slouken@94
  1225
	    continue
slouken@0
  1226
	    ;;
slouken@0
  1227
	  esac
slouken@0
  1228
	  ;;
slouken@0
  1229
	expsyms)
slouken@0
  1230
	  export_symbols="$arg"
slouken@0
  1231
	  if test ! -f "$arg"; then
slouken@0
  1232
	    $echo "$modename: symbol file \`$arg' does not exist"
slouken@102
  1233
	    exit $EXIT_FAILURE
slouken@0
  1234
	  fi
slouken@0
  1235
	  prev=
slouken@0
  1236
	  continue
slouken@0
  1237
	  ;;
slouken@0
  1238
	expsyms_regex)
slouken@0
  1239
	  export_symbols_regex="$arg"
slouken@0
  1240
	  prev=
slouken@0
  1241
	  continue
slouken@0
  1242
	  ;;
slouken@94
  1243
	inst_prefix)
slouken@94
  1244
	  inst_prefix_dir="$arg"
slouken@73
  1245
	  prev=
slouken@73
  1246
	  continue
slouken@73
  1247
	  ;;
slouken@102
  1248
	precious_regex)
slouken@102
  1249
	  precious_files_regex="$arg"
slouken@102
  1250
	  prev=
slouken@102
  1251
	  continue
slouken@102
  1252
	  ;;
slouken@0
  1253
	release)
slouken@0
  1254
	  release="-$arg"
slouken@0
  1255
	  prev=
slouken@0
  1256
	  continue
slouken@0
  1257
	  ;;
slouken@94
  1258
	objectlist)
slouken@94
  1259
	  if test -f "$arg"; then
slouken@94
  1260
	    save_arg=$arg
slouken@94
  1261
	    moreargs=
slouken@94
  1262
	    for fil in `cat $save_arg`
slouken@94
  1263
	    do
slouken@94
  1264
#	      moreargs="$moreargs $fil"
slouken@94
  1265
	      arg=$fil
slouken@94
  1266
	      # A libtool-controlled object.
slouken@94
  1267
slouken@94
  1268
	      # Check to see that this really is a libtool object.
slouken@94
  1269
	      if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
slouken@94
  1270
		pic_object=
slouken@94
  1271
		non_pic_object=
slouken@94
  1272
slouken@94
  1273
		# Read the .lo file
slouken@94
  1274
		# If there is no directory component, then add one.
slouken@94
  1275
		case $arg in
slouken@94
  1276
		*/* | *\\*) . $arg ;;
slouken@94
  1277
		*) . ./$arg ;;
slouken@94
  1278
		esac
slouken@94
  1279
slouken@94
  1280
		if test -z "$pic_object" || \
slouken@94
  1281
		   test -z "$non_pic_object" ||
slouken@94
  1282
		   test "$pic_object" = none && \
slouken@94
  1283
		   test "$non_pic_object" = none; then
slouken@94
  1284
		  $echo "$modename: cannot find name of object for \`$arg'" 1>&2
slouken@102
  1285
		  exit $EXIT_FAILURE
slouken@94
  1286
		fi
slouken@94
  1287
slouken@94
  1288
		# Extract subdirectory from the argument.
slouken@94
  1289
		xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
slouken@94
  1290
		if test "X$xdir" = "X$arg"; then
slouken@94
  1291
		  xdir=
slouken@94
  1292
		else
slouken@94
  1293
		  xdir="$xdir/"
slouken@94
  1294
		fi
slouken@94
  1295
slouken@94
  1296
		if test "$pic_object" != none; then
slouken@94
  1297
		  # Prepend the subdirectory the object is found in.
slouken@94
  1298
		  pic_object="$xdir$pic_object"
slouken@94
  1299
slouken@94
  1300
		  if test "$prev" = dlfiles; then
slouken@94
  1301
		    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
slouken@94
  1302
		      dlfiles="$dlfiles $pic_object"
slouken@94
  1303
		      prev=
slouken@94
  1304
		      continue
slouken@94
  1305
		    else
slouken@94
  1306
		      # If libtool objects are unsupported, then we need to preload.
slouken@94
  1307
		      prev=dlprefiles
slouken@94
  1308
		    fi
slouken@94
  1309
		  fi
slouken@94
  1310
slouken@94
  1311
		  # CHECK ME:  I think I busted this.  -Ossama
slouken@94
  1312
		  if test "$prev" = dlprefiles; then
slouken@94
  1313
		    # Preload the old-style object.
slouken@94
  1314
		    dlprefiles="$dlprefiles $pic_object"
slouken@94
  1315
		    prev=
slouken@94
  1316
		  fi
slouken@94
  1317
slouken@94
  1318
		  # A PIC object.
slouken@94
  1319
		  libobjs="$libobjs $pic_object"
slouken@94
  1320
		  arg="$pic_object"
slouken@94
  1321
		fi
slouken@94
  1322
slouken@94
  1323
		# Non-PIC object.
slouken@94
  1324
		if test "$non_pic_object" != none; then
slouken@94
  1325
		  # Prepend the subdirectory the object is found in.
slouken@94
  1326
		  non_pic_object="$xdir$non_pic_object"
slouken@94
  1327
slouken@94
  1328
		  # A standard non-PIC object
slouken@94
  1329
		  non_pic_objects="$non_pic_objects $non_pic_object"
slouken@94
  1330
		  if test -z "$pic_object" || test "$pic_object" = none ; then
slouken@94
  1331
		    arg="$non_pic_object"
slouken@94
  1332
		  fi
slouken@127
  1333
		else
slouken@127
  1334
		  # If the PIC object exists, use it instead.
slouken@127
  1335
		  # $xdir was prepended to $pic_object above.
slouken@127
  1336
		  non_pic_object="$pic_object"
slouken@127
  1337
		  non_pic_objects="$non_pic_objects $non_pic_object"
slouken@94
  1338
		fi
slouken@94
  1339
	      else
slouken@94
  1340
		# Only an error if not doing a dry-run.
slouken@94
  1341
		if test -z "$run"; then
slouken@94
  1342
		  $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
slouken@102
  1343
		  exit $EXIT_FAILURE
slouken@94
  1344
		else
slouken@94
  1345
		  # Dry-run case.
slouken@94
  1346
slouken@94
  1347
		  # Extract subdirectory from the argument.
slouken@94
  1348
		  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
slouken@94
  1349
		  if test "X$xdir" = "X$arg"; then
slouken@94
  1350
		    xdir=
slouken@94
  1351
		  else
slouken@94
  1352
		    xdir="$xdir/"
slouken@94
  1353
		  fi
slouken@94
  1354
slouken@94
  1355
		  pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
slouken@94
  1356
		  non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
slouken@94
  1357
		  libobjs="$libobjs $pic_object"
slouken@94
  1358
		  non_pic_objects="$non_pic_objects $non_pic_object"
slouken@94
  1359
		fi
slouken@94
  1360
	      fi
slouken@94
  1361
	    done
slouken@94
  1362
	  else
slouken@94
  1363
	    $echo "$modename: link input file \`$save_arg' does not exist"
slouken@102
  1364
	    exit $EXIT_FAILURE
slouken@94
  1365
	  fi
slouken@94
  1366
	  arg=$save_arg
slouken@94
  1367
	  prev=
slouken@94
  1368
	  continue
slouken@94
  1369
	  ;;
slouken@0
  1370
	rpath | xrpath)
slouken@0
  1371
	  # We need an absolute path.
slouken@94
  1372
	  case $arg in
slouken@0
  1373
	  [\\/]* | [A-Za-z]:[\\/]*) ;;
slouken@0
  1374
	  *)
slouken@0
  1375
	    $echo "$modename: only absolute run-paths are allowed" 1>&2
slouken@102
  1376
	    exit $EXIT_FAILURE
slouken@0
  1377
	    ;;
slouken@0
  1378
	  esac
slouken@0
  1379
	  if test "$prev" = rpath; then
slouken@0
  1380
	    case "$rpath " in
slouken@0
  1381
	    *" $arg "*) ;;
slouken@0
  1382
	    *) rpath="$rpath $arg" ;;
slouken@0
  1383
	    esac
slouken@0
  1384
	  else
slouken@0
  1385
	    case "$xrpath " in
slouken@0
  1386
	    *" $arg "*) ;;
slouken@0
  1387
	    *) xrpath="$xrpath $arg" ;;
slouken@0
  1388
	    esac
slouken@0
  1389
	  fi
slouken@0
  1390
	  prev=
slouken@0
  1391
	  continue
slouken@0
  1392
	  ;;
slouken@94
  1393
	xcompiler)
slouken@94
  1394
	  compiler_flags="$compiler_flags $qarg"
slouken@94
  1395
	  prev=
slouken@94
  1396
	  compile_command="$compile_command $qarg"
slouken@94
  1397
	  finalize_command="$finalize_command $qarg"
slouken@94
  1398
	  continue
slouken@94
  1399
	  ;;
slouken@94
  1400
	xlinker)
slouken@94
  1401
	  linker_flags="$linker_flags $qarg"
slouken@94
  1402
	  compiler_flags="$compiler_flags $wl$qarg"
slouken@94
  1403
	  prev=
slouken@94
  1404
	  compile_command="$compile_command $wl$qarg"
slouken@94
  1405
	  finalize_command="$finalize_command $wl$qarg"
slouken@94
  1406
	  continue
slouken@94
  1407
	  ;;
slouken@94
  1408
	xcclinker)
slouken@94
  1409
	  linker_flags="$linker_flags $qarg"
slouken@94
  1410
	  compiler_flags="$compiler_flags $qarg"
slouken@94
  1411
	  prev=
slouken@94
  1412
	  compile_command="$compile_command $qarg"
slouken@94
  1413
	  finalize_command="$finalize_command $qarg"
slouken@94
  1414
	  continue
slouken@94
  1415
	  ;;
slouken@102
  1416
	shrext)
slouken@102
  1417
  	  shrext_cmds="$arg"
slouken@94
  1418
	  prev=
slouken@94
  1419
	  continue
slouken@94
  1420
	  ;;
slouken@127
  1421
	darwin_framework|darwin_framework_skip)
slouken@127
  1422
	  test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
slouken@127
  1423
	  compile_command="$compile_command $arg"
slouken@127
  1424
	  finalize_command="$finalize_command $arg"
slouken@127
  1425
	  prev=
slouken@127
  1426
	  continue
slouken@127
  1427
	  ;;
slouken@0
  1428
	*)
slouken@0
  1429
	  eval "$prev=\"\$arg\""
slouken@0
  1430
	  prev=
slouken@0
  1431
	  continue
slouken@0
  1432
	  ;;
slouken@0
  1433
	esac
slouken@94
  1434
      fi # test -n "$prev"
slouken@0
  1435
slouken@0
  1436
      prevarg="$arg"
slouken@0
  1437
slouken@94
  1438
      case $arg in
slouken@0
  1439
      -all-static)
slouken@0
  1440
	if test -n "$link_static_flag"; then
slouken@0
  1441
	  compile_command="$compile_command $link_static_flag"
slouken@0
  1442
	  finalize_command="$finalize_command $link_static_flag"
slouken@0
  1443
	fi
slouken@0
  1444
	continue
slouken@0
  1445
	;;
slouken@0
  1446
slouken@0
  1447
      -allow-undefined)
slouken@0
  1448
	# FIXME: remove this flag sometime in the future.
slouken@0
  1449
	$echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
slouken@0
  1450
	continue
slouken@0
  1451
	;;
slouken@0
  1452
slouken@0
  1453
      -avoid-version)
slouken@0
  1454
	avoid_version=yes
slouken@0
  1455
	continue
slouken@0
  1456
	;;
slouken@0
  1457
slouken@0
  1458
      -dlopen)
slouken@0
  1459
	prev=dlfiles
slouken@0
  1460
	continue
slouken@0
  1461
	;;
slouken@0
  1462
slouken@0
  1463
      -dlpreopen)
slouken@0
  1464
	prev=dlprefiles
slouken@0
  1465
	continue
slouken@0
  1466
	;;
slouken@0
  1467
slouken@0
  1468
      -export-dynamic)
slouken@0
  1469
	export_dynamic=yes
slouken@0
  1470
	continue
slouken@0
  1471
	;;
slouken@0
  1472
slouken@0
  1473
      -export-symbols | -export-symbols-regex)
slouken@0
  1474
	if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
slouken@94
  1475
	  $echo "$modename: more than one -exported-symbols argument is not allowed"
slouken@102
  1476
	  exit $EXIT_FAILURE
slouken@0
  1477
	fi
slouken@0
  1478
	if test "X$arg" = "X-export-symbols"; then
slouken@0
  1479
	  prev=expsyms
slouken@0
  1480
	else
slouken@0
  1481
	  prev=expsyms_regex
slouken@0
  1482
	fi
slouken@0
  1483
	continue
slouken@0
  1484
	;;
slouken@0
  1485
slouken@127
  1486
      -framework|-arch|-isysroot)
slouken@127
  1487
	case " $CC " in
slouken@127
  1488
	  *" ${arg} ${1} "* | *" ${arg}	${1} "*) 
slouken@127
  1489
		prev=darwin_framework_skip ;;
slouken@127
  1490
	  *) compiler_flags="$compiler_flags $arg"
slouken@127
  1491
	     prev=darwin_framework ;;
slouken@127
  1492
	esac
slouken@127
  1493
	compile_command="$compile_command $arg"
slouken@127
  1494
	finalize_command="$finalize_command $arg"
slouken@127
  1495
	continue
slouken@127
  1496
	;;
slouken@127
  1497
slouken@94
  1498
      -inst-prefix-dir)
slouken@94
  1499
	prev=inst_prefix
slouken@94
  1500
	continue
slouken@94
  1501
	;;
slouken@94
  1502
slouken@94
  1503
      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
slouken@94
  1504
      # so, if we see these flags be careful not to treat them like -L
slouken@94
  1505
      -L[A-Z][A-Z]*:*)
slouken@94
  1506
	case $with_gcc/$host in
slouken@94
  1507
	no/*-*-irix* | /*-*-irix*)
slouken@94
  1508
	  compile_command="$compile_command $arg"
slouken@94
  1509
	  finalize_command="$finalize_command $arg"
slouken@94
  1510
	  ;;
slouken@94
  1511
	esac
slouken@73
  1512
	continue
slouken@73
  1513
	;;
slouken@73
  1514
slouken@0
  1515
      -L*)
slouken@0
  1516
	dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
slouken@0
  1517
	# We need an absolute path.
slouken@94
  1518
	case $dir in
slouken@0
  1519
	[\\/]* | [A-Za-z]:[\\/]*) ;;
slouken@0
  1520
	*)
slouken@0
  1521
	  absdir=`cd "$dir" && pwd`
slouken@0
  1522
	  if test -z "$absdir"; then
slouken@94
  1523
	    $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
slouken@127
  1524
	    absdir="$dir"
slouken@127
  1525
	    notinst_path="$notinst_path $dir"
slouken@0
  1526
	  fi
slouken@0
  1527
	  dir="$absdir"
slouken@0
  1528
	  ;;
slouken@0
  1529
	esac
slouken@94
  1530
	case "$deplibs " in
slouken@94
  1531
	*" -L$dir "*) ;;
slouken@94
  1532
	*)
slouken@94
  1533
	  deplibs="$deplibs -L$dir"
slouken@94
  1534
	  lib_search_path="$lib_search_path $dir"
slouken@94
  1535
	  ;;
slouken@2
  1536
	esac
slouken@94
  1537
	case $host in
slouken@94
  1538
	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
slouken@127
  1539
	  testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
slouken@94
  1540
	  case :$dllsearchpath: in
slouken@94
  1541
	  *":$dir:"*) ;;
slouken@94
  1542
	  *) dllsearchpath="$dllsearchpath:$dir";;
slouken@0
  1543
	  esac
slouken@127
  1544
	  case :$dllsearchpath: in
slouken@127
  1545
	  *":$testbindir:"*) ;;
slouken@127
  1546
	  *) dllsearchpath="$dllsearchpath:$testbindir";;
slouken@127
  1547
	  esac
slouken@0
  1548
	  ;;
slouken@0
  1549
	esac
slouken@94
  1550
	continue
slouken@0
  1551
	;;
slouken@0
  1552
slouken@0
  1553
      -l*)
slouken@94
  1554
	if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
slouken@94
  1555
	  case $host in
slouken@127
  1556
	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
slouken@94
  1557
	    # These systems don't actually have a C or math library (as such)
slouken@0
  1558
	    continue
slouken@0
  1559
	    ;;
slouken@127
  1560
	  *-*-os2*)
slouken@94
  1561
	    # These systems don't actually have a C library (as such)
slouken@94
  1562
	    test "X$arg" = "X-lc" && continue
slouken@94
  1563
	    ;;
slouken@127
  1564
	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
slouken@94
  1565
	    # Do not include libc due to us having libc/libc_r.
slouken@94
  1566
	    test "X$arg" = "X-lc" && continue
slouken@94
  1567
	    ;;
slouken@94
  1568
	  *-*-rhapsody* | *-*-darwin1.[012])
slouken@94
  1569
	    # Rhapsody C and math libraries are in the System framework
slouken@94
  1570
	    deplibs="$deplibs -framework System"
slouken@94
  1571
	    continue
slouken@127
  1572
	    ;;
slouken@127
  1573
	  *-*-sco3.2v5* | *-*-sco5v6*)
slouken@127
  1574
	    # Causes problems with __ctype
slouken@127
  1575
	    test "X$arg" = "X-lc" && continue
slouken@127
  1576
	    ;;
slouken@127
  1577
	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
slouken@127
  1578
	    # Compiler inserts libc in the correct place for threads to work
slouken@127
  1579
	    test "X$arg" = "X-lc" && continue
slouken@127
  1580
	    ;;
slouken@0
  1581
	  esac
slouken@94
  1582
	elif test "X$arg" = "X-lc_r"; then
slouken@94
  1583
	 case $host in
slouken@127
  1584
	 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
slouken@94
  1585
	   # Do not include libc_r directly, use -pthread flag.
slouken@94
  1586
	   continue
slouken@94
  1587
	   ;;
slouken@94
  1588
	 esac
slouken@0
  1589
	fi
slouken@0
  1590
	deplibs="$deplibs $arg"
slouken@94
  1591
	continue
slouken@0
  1592
	;;
slouken@0
  1593
slouken@127
  1594
      # Tru64 UNIX uses -model [arg] to determine the layout of C++
slouken@127
  1595
      # classes, name mangling, and exception handling.
slouken@127
  1596
      -model)
slouken@127
  1597
	compile_command="$compile_command $arg"
slouken@127
  1598
	compiler_flags="$compiler_flags $arg"
slouken@127
  1599
	finalize_command="$finalize_command $arg"
slouken@127
  1600
	prev=xcompiler
slouken@127
  1601
	continue
slouken@127
  1602
	;;
slouken@127
  1603
slouken@102
  1604
     -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
slouken@127
  1605
	compiler_flags="$compiler_flags $arg"
slouken@127
  1606
	compile_command="$compile_command $arg"
slouken@127
  1607
	finalize_command="$finalize_command $arg"
slouken@102
  1608
	continue
slouken@102
  1609
	;;
slouken@102
  1610
slouken@0
  1611
      -module)
slouken@0
  1612
	module=yes
slouken@0
  1613
	continue
slouken@0
  1614
	;;
slouken@0
  1615
slouken@127
  1616
      # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
slouken@127
  1617
      # -r[0-9][0-9]* specifies the processor on the SGI compiler
slouken@127
  1618
      # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
slouken@127
  1619
      # +DA*, +DD* enable 64-bit mode on the HP compiler
slouken@127
  1620
      # -q* pass through compiler args for the IBM compiler
slouken@127
  1621
      # -m* pass through architecture-specific compiler args for GCC
slouken@127
  1622
      # -m*, -t[45]*, -txscale* pass through architecture-specific
slouken@127
  1623
      # compiler args for GCC
slouken@127
  1624
      # -pg pass through profiling flag for GCC
slouken@127
  1625
      # @file GCC response files
slouken@127
  1626
      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \
slouken@127
  1627
      -t[45]*|-txscale*|@*)
slouken@127
  1628
slouken@94
  1629
	# Unknown arguments in both finalize_command and compile_command need
slouken@94
  1630
	# to be aesthetically quoted because they are evaled later.
slouken@94
  1631
	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
slouken@94
  1632
	case $arg in
slouken@94
  1633
	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
slouken@94
  1634
	  arg="\"$arg\""
slouken@94
  1635
	  ;;
slouken@94
  1636
	esac
slouken@94
  1637
        compile_command="$compile_command $arg"
slouken@94
  1638
        finalize_command="$finalize_command $arg"
slouken@127
  1639
        compiler_flags="$compiler_flags $arg"
slouken@94
  1640
        continue
slouken@94
  1641
        ;;
slouken@94
  1642
slouken@94
  1643
      -shrext)
slouken@94
  1644
	prev=shrext
slouken@94
  1645
	continue
slouken@94
  1646
	;;
slouken@94
  1647
slouken@94
  1648
      -no-fast-install)
slouken@94
  1649
	fast_install=no
slouken@94
  1650
	continue
slouken@94
  1651
	;;
slouken@94
  1652
slouken@94
  1653
      -no-install)
slouken@94
  1654
	case $host in
slouken@94
  1655
	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
slouken@94
  1656
	  # The PATH hackery in wrapper scripts is required on Windows
slouken@94
  1657
	  # in order for the loader to find any dlls it needs.
slouken@94
  1658
	  $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
slouken@94
  1659
	  $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
slouken@94
  1660
	  fast_install=no
slouken@94
  1661
	  ;;
slouken@94
  1662
	*) no_install=yes ;;
slouken@94
  1663
	esac
slouken@94
  1664
	continue
slouken@94
  1665
	;;
slouken@94
  1666
slouken@0
  1667
      -no-undefined)
slouken@0
  1668
	allow_undefined=no
slouken@0
  1669
	continue
slouken@0
  1670
	;;
slouken@0
  1671
slouken@94
  1672
      -objectlist)
slouken@94
  1673
	prev=objectlist
slouken@94
  1674
	continue
slouken@94
  1675
	;;
slouken@94
  1676
slouken@0
  1677
      -o) prev=output ;;
slouken@0
  1678
slouken@102
  1679
      -precious-files-regex)
slouken@102
  1680
	prev=precious_regex
slouken@102
  1681
	continue
slouken@102
  1682
	;;
slouken@102
  1683
slouken@0
  1684
      -release)
slouken@0
  1685
	prev=release
slouken@0
  1686
	continue
slouken@0
  1687
	;;
slouken@0
  1688
slouken@0
  1689
      -rpath)
slouken@0
  1690
	prev=rpath
slouken@0
  1691
	continue
slouken@0
  1692
	;;
slouken@0
  1693
slouken@0
  1694
      -R)
slouken@0
  1695
	prev=xrpath
slouken@0
  1696
	continue
slouken@0
  1697
	;;
slouken@0
  1698
slouken@0
  1699
      -R*)
slouken@0
  1700
	dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
slouken@0
  1701
	# We need an absolute path.
slouken@94
  1702
	case $dir in
slouken@0
  1703
	[\\/]* | [A-Za-z]:[\\/]*) ;;
slouken@0
  1704
	*)
slouken@0
  1705
	  $echo "$modename: only absolute run-paths are allowed" 1>&2
slouken@102
  1706
	  exit $EXIT_FAILURE
slouken@0
  1707
	  ;;
slouken@0
  1708
	esac
slouken@0
  1709
	case "$xrpath " in
slouken@0
  1710
	*" $dir "*) ;;
slouken@0
  1711
	*) xrpath="$xrpath $dir" ;;
slouken@0
  1712
	esac
slouken@0
  1713
	continue
slouken@0
  1714
	;;
slouken@0
  1715
slouken@0
  1716
      -static)
slouken@94
  1717
	# The effects of -static are defined in a previous loop.
slouken@94
  1718
	# We used to do the same as -all-static on platforms that
slouken@94
  1719
	# didn't have a PIC flag, but the assumption that the effects
slouken@94
  1720
	# would be equivalent was wrong.  It would break on at least
slouken@94
  1721
	# Digital Unix and AIX.
slouken@0
  1722
	continue
slouken@0
  1723
	;;
slouken@0
  1724
slouken@0
  1725
      -thread-safe)
slouken@0
  1726
	thread_safe=yes
slouken@0
  1727
	continue
slouken@0
  1728
	;;
slouken@0
  1729
slouken@0
  1730
      -version-info)
slouken@0
  1731
	prev=vinfo
slouken@0
  1732
	continue
slouken@0
  1733
	;;
slouken@94
  1734
      -version-number)
slouken@94
  1735
	prev=vinfo
slouken@94
  1736
	vinfo_number=yes
slouken@94
  1737
	continue
slouken@94
  1738
	;;
slouken@94
  1739
slouken@94
  1740
      -Wc,*)
slouken@94
  1741
	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
slouken@94
  1742
	arg=
slouken@94
  1743
	save_ifs="$IFS"; IFS=','
slouken@94
  1744
	for flag in $args; do
slouken@94
  1745
	  IFS="$save_ifs"
slouken@94
  1746
	  case $flag in
slouken@94
  1747
	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
slouken@94
  1748
	    flag="\"$flag\""
slouken@94
  1749
	    ;;
slouken@94
  1750
	  esac
slouken@94
  1751
	  arg="$arg $wl$flag"
slouken@94
  1752
	  compiler_flags="$compiler_flags $flag"
slouken@94
  1753
	done
slouken@94
  1754
	IFS="$save_ifs"
slouken@94
  1755
	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
slouken@94
  1756
	;;
slouken@94
  1757
slouken@94
  1758
      -Wl,*)
slouken@94
  1759
	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
slouken@94
  1760
	arg=
slouken@94
  1761
	save_ifs="$IFS"; IFS=','
slouken@94
  1762
	for flag in $args; do
slouken@94
  1763
	  IFS="$save_ifs"
slouken@94
  1764
	  case $flag in
slouken@94
  1765
	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
slouken@94
  1766
	    flag="\"$flag\""
slouken@94
  1767
	    ;;
slouken@94
  1768
	  esac
slouken@94
  1769
	  arg="$arg $wl$flag"
slouken@94
  1770
	  compiler_flags="$compiler_flags $wl$flag"
slouken@94
  1771
	  linker_flags="$linker_flags $flag"
slouken@94
  1772
	done
slouken@94
  1773
	IFS="$save_ifs"
slouken@94
  1774
	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
slouken@94
  1775
	;;
slouken@94
  1776
slouken@94
  1777
      -Xcompiler)
slouken@94
  1778
	prev=xcompiler
slouken@94
  1779
	continue
slouken@94
  1780
	;;
slouken@94
  1781
slouken@94
  1782
      -Xlinker)
slouken@94
  1783
	prev=xlinker
slouken@94
  1784
	continue
slouken@94
  1785
	;;
slouken@94
  1786
slouken@94
  1787
      -XCClinker)
slouken@94
  1788
	prev=xcclinker
slouken@94
  1789
	continue
slouken@94
  1790
	;;
slouken@94
  1791
slouken@0
  1792
      # Some other compiler flag.
slouken@0
  1793
      -* | +*)
slouken@0
  1794
	# Unknown arguments in both finalize_command and compile_command need
slouken@0
  1795
	# to be aesthetically quoted because they are evaled later.
slouken@0
  1796
	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
slouken@94
  1797
	case $arg in
slouken@94
  1798
	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
slouken@0
  1799
	  arg="\"$arg\""
slouken@0
  1800
	  ;;
slouken@0
  1801
	esac
slouken@0
  1802
	;;
slouken@0
  1803
slouken@94
  1804
      *.$objext)
slouken@0
  1805
	# A standard object.
slouken@0
  1806
	objs="$objs $arg"
slouken@0
  1807
	;;
slouken@0
  1808
slouken@0
  1809
      *.lo)
slouken@94
  1810
	# A libtool-controlled object.
slouken@94
  1811
slouken@94
  1812
	# Check to see that this really is a libtool object.
slouken@94
  1813
	if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
slouken@94
  1814
	  pic_object=
slouken@94
  1815
	  non_pic_object=
slouken@94
  1816
slouken@94
  1817
	  # Read the .lo file
slouken@94
  1818
	  # If there is no directory component, then add one.
slouken@94
  1819
	  case $arg in
slouken@94
  1820
	  */* | *\\*) . $arg ;;
slouken@94
  1821
	  *) . ./$arg ;;
slouken@94
  1822
	  esac
slouken@94
  1823
slouken@94
  1824
	  if test -z "$pic_object" || \
slouken@94
  1825
	     test -z "$non_pic_object" ||
slouken@94
  1826
	     test "$pic_object" = none && \
slouken@94
  1827
	     test "$non_pic_object" = none; then
slouken@94
  1828
	    $echo "$modename: cannot find name of object for \`$arg'" 1>&2
slouken@102
  1829
	    exit $EXIT_FAILURE
slouken@94
  1830
	  fi
slouken@94
  1831
slouken@94
  1832
	  # Extract subdirectory from the argument.
slouken@94
  1833
	  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
slouken@94
  1834
	  if test "X$xdir" = "X$arg"; then
slouken@94
  1835
	    xdir=
slouken@94
  1836
 	  else
slouken@94
  1837
	    xdir="$xdir/"
slouken@94
  1838
	  fi
slouken@94
  1839
slouken@94
  1840
	  if test "$pic_object" != none; then
slouken@94
  1841
	    # Prepend the subdirectory the object is found in.
slouken@94
  1842
	    pic_object="$xdir$pic_object"
slouken@94
  1843
slouken@94
  1844
	    if test "$prev" = dlfiles; then
slouken@94
  1845
	      if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
slouken@94
  1846
		dlfiles="$dlfiles $pic_object"
slouken@94
  1847
		prev=
slouken@94
  1848
		continue
slouken@94
  1849
	      else
slouken@94
  1850
		# If libtool objects are unsupported, then we need to preload.
slouken@94
  1851
		prev=dlprefiles
slouken@94
  1852
	      fi
slouken@94
  1853
	    fi
slouken@94
  1854
slouken@94
  1855
	    # CHECK ME:  I think I busted this.  -Ossama
slouken@94
  1856
	    if test "$prev" = dlprefiles; then
slouken@94
  1857
	      # Preload the old-style object.
slouken@94
  1858
	      dlprefiles="$dlprefiles $pic_object"
slouken@94
  1859
	      prev=
slouken@94
  1860
	    fi
slouken@94
  1861
slouken@94
  1862
	    # A PIC object.
slouken@94
  1863
	    libobjs="$libobjs $pic_object"
slouken@94
  1864
	    arg="$pic_object"
slouken@94
  1865
	  fi
slouken@94
  1866
slouken@94
  1867
	  # Non-PIC object.
slouken@94
  1868
	  if test "$non_pic_object" != none; then
slouken@94
  1869
	    # Prepend the subdirectory the object is found in.
slouken@94
  1870
	    non_pic_object="$xdir$non_pic_object"
slouken@94
  1871
slouken@94
  1872
	    # A standard non-PIC object
slouken@94
  1873
	    non_pic_objects="$non_pic_objects $non_pic_object"
slouken@94
  1874
	    if test -z "$pic_object" || test "$pic_object" = none ; then
slouken@94
  1875
	      arg="$non_pic_object"
slouken@94
  1876
	    fi
slouken@127
  1877
	  else
slouken@127
  1878
	    # If the PIC object exists, use it instead.
slouken@127
  1879
	    # $xdir was prepended to $pic_object above.
slouken@127
  1880
	    non_pic_object="$pic_object"
slouken@127
  1881
	    non_pic_objects="$non_pic_objects $non_pic_object"
slouken@94
  1882
	  fi
slouken@94
  1883
	else
slouken@94
  1884
	  # Only an error if not doing a dry-run.
slouken@94
  1885
	  if test -z "$run"; then
slouken@94
  1886
	    $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
slouken@102
  1887
	    exit $EXIT_FAILURE
slouken@0
  1888
	  else
slouken@94
  1889
	    # Dry-run case.
slouken@94
  1890
slouken@94
  1891
	    # Extract subdirectory from the argument.
slouken@94
  1892
	    xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
slouken@94
  1893
	    if test "X$xdir" = "X$arg"; then
slouken@94
  1894
	      xdir=
slouken@94
  1895
	    else
slouken@94
  1896
	      xdir="$xdir/"
slouken@94
  1897
	    fi
slouken@94
  1898
slouken@94
  1899
	    pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
slouken@94
  1900
	    non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
slouken@94
  1901
	    libobjs="$libobjs $pic_object"
slouken@94
  1902
	    non_pic_objects="$non_pic_objects $non_pic_object"
slouken@0
  1903
	  fi
slouken@0
  1904
	fi
slouken@94
  1905
	;;
slouken@94
  1906
slouken@94
  1907
      *.$libext)
slouken@94
  1908
	# An archive.
slouken@94
  1909
	deplibs="$deplibs $arg"
slouken@94
  1910
	old_deplibs="$old_deplibs $arg"
slouken@94
  1911
	continue
slouken@0
  1912
	;;
slouken@0
  1913
slouken@0
  1914
      *.la)
slouken@0
  1915
	# A libtool-controlled library.
slouken@0
  1916
slouken@94
  1917
	if test "$prev" = dlfiles; then
slouken@94
  1918
	  # This library was specified with -dlopen.
slouken@94
  1919
	  dlfiles="$dlfiles $arg"
slouken@94
  1920
	  prev=
slouken@94
  1921
	elif test "$prev" = dlprefiles; then
slouken@94
  1922
	  # The library was specified with -dlpreopen.
slouken@94
  1923
	  dlprefiles="$dlprefiles $arg"
slouken@94
  1924
	  prev=
slouken@94
  1925
	else
slouken@94
  1926
	  deplibs="$deplibs $arg"
slouken@94
  1927
	fi
slouken@94
  1928
	continue
slouken@94
  1929
	;;
slouken@94
  1930
slouken@94
  1931
      # Some other compiler argument.
slouken@94
  1932
      *)
slouken@94
  1933
	# Unknown arguments in both finalize_command and compile_command need
slouken@94
  1934
	# to be aesthetically quoted because they are evaled later.
slouken@94
  1935
	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
slouken@94
  1936
	case $arg in
slouken@94
  1937
	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
slouken@94
  1938
	  arg="\"$arg\""
slouken@94
  1939
	  ;;
slouken@94
  1940
	esac
slouken@94
  1941
	;;
slouken@94
  1942
      esac # arg
slouken@94
  1943
slouken@94
  1944
      # Now actually substitute the argument into the commands.
slouken@94
  1945
      if test -n "$arg"; then
slouken@94
  1946
	compile_command="$compile_command $arg"
slouken@94
  1947
	finalize_command="$finalize_command $arg"
slouken@94
  1948
      fi
slouken@94
  1949
    done # argument parsing loop
slouken@94
  1950
slouken@94
  1951
    if test -n "$prev"; then
slouken@94
  1952
      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
slouken@94
  1953
      $echo "$help" 1>&2
slouken@102
  1954
      exit $EXIT_FAILURE
slouken@94
  1955
    fi
slouken@94
  1956
slouken@94
  1957
    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
slouken@94
  1958
      eval arg=\"$export_dynamic_flag_spec\"
slouken@94
  1959
      compile_command="$compile_command $arg"
slouken@94
  1960
      finalize_command="$finalize_command $arg"
slouken@94
  1961
    fi
slouken@94
  1962
slouken@94
  1963
    oldlibs=
slouken@94
  1964
    # calculate the name of the file, without its directory
slouken@94
  1965
    outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
slouken@94
  1966
    libobjs_save="$libobjs"
slouken@94
  1967
slouken@94
  1968
    if test -n "$shlibpath_var"; then
slouken@94
  1969
      # get the directories listed in $shlibpath_var
slouken@94
  1970
      eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
slouken@94
  1971
    else
slouken@94
  1972
      shlib_search_path=
slouken@94
  1973
    fi
slouken@94
  1974
    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
slouken@94
  1975
    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
slouken@94
  1976
slouken@94
  1977
    output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
slouken@94
  1978
    if test "X$output_objdir" = "X$output"; then
slouken@94
  1979
      output_objdir="$objdir"
slouken@94
  1980
    else
slouken@94
  1981
      output_objdir="$output_objdir/$objdir"
slouken@94
  1982
    fi
slouken@94
  1983
    # Create the object directory.
slouken@94
  1984
    if test ! -d "$output_objdir"; then
slouken@94
  1985
      $show "$mkdir $output_objdir"
slouken@94
  1986
      $run $mkdir $output_objdir
slouken@127
  1987
      exit_status=$?
slouken@127
  1988
      if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
slouken@127
  1989
	exit $exit_status
slouken@94
  1990
      fi
slouken@94
  1991
    fi
slouken@94
  1992
slouken@94
  1993
    # Determine the type of output
slouken@94
  1994
    case $output in
slouken@94
  1995
    "")
slouken@94
  1996
      $echo "$modename: you must specify an output file" 1>&2
slouken@94
  1997
      $echo "$help" 1>&2
slouken@102
  1998
      exit $EXIT_FAILURE
slouken@94
  1999
      ;;
slouken@94
  2000
    *.$libext) linkmode=oldlib ;;
slouken@94
  2001
    *.lo | *.$objext) linkmode=obj ;;
slouken@94
  2002
    *.la) linkmode=lib ;;
slouken@94
  2003
    *) linkmode=prog ;; # Anything else should be a program.
slouken@94
  2004
    esac
slouken@94
  2005
slouken@94
  2006
    case $host in
slouken@94
  2007
    *cygwin* | *mingw* | *pw32*)
slouken@102
  2008
      # don't eliminate duplications in $postdeps and $predeps
slouken@94
  2009
      duplicate_compiler_generated_deps=yes
slouken@94
  2010
      ;;
slouken@94
  2011
    *)
slouken@94
  2012
      duplicate_compiler_generated_deps=$duplicate_deps
slouken@94
  2013
      ;;
slouken@94
  2014
    esac
slouken@94
  2015
    specialdeplibs=
slouken@94
  2016
slouken@94
  2017
    libs=
slouken@94
  2018
    # Find all interdependent deplibs by searching for libraries
slouken@94
  2019
    # that are linked more than once (e.g. -la -lb -la)
slouken@94
  2020
    for deplib in $deplibs; do
slouken@94
  2021
      if test "X$duplicate_deps" = "Xyes" ; then
slouken@94
  2022
	case "$libs " in
slouken@94
  2023
	*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
slouken@94
  2024
	esac
slouken@94
  2025
      fi
slouken@94
  2026
      libs="$libs $deplib"
slouken@94
  2027
    done
slouken@94
  2028
slouken@94
  2029
    if test "$linkmode" = lib; then
slouken@94
  2030
      libs="$predeps $libs $compiler_lib_search_path $postdeps"
slouken@94
  2031
slouken@94
  2032
      # Compute libraries that are listed more than once in $predeps
slouken@94
  2033
      # $postdeps and mark them as special (i.e., whose duplicates are
slouken@94
  2034
      # not to be eliminated).
slouken@94
  2035
      pre_post_deps=
slouken@94
  2036
      if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
slouken@94
  2037
	for pre_post_dep in $predeps $postdeps; do
slouken@94
  2038
	  case "$pre_post_deps " in
slouken@94
  2039
	  *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
slouken@94
  2040
	  esac
slouken@94
  2041
	  pre_post_deps="$pre_post_deps $pre_post_dep"
slouken@94
  2042
	done
slouken@94
  2043
      fi
slouken@94
  2044
      pre_post_deps=
slouken@94
  2045
    fi
slouken@94
  2046
slouken@94
  2047
    deplibs=
slouken@94
  2048
    newdependency_libs=
slouken@94
  2049
    newlib_search_path=
slouken@94
  2050
    need_relink=no # whether we're linking any uninstalled libtool libraries
slouken@94
  2051
    notinst_deplibs= # not-installed libtool libraries
slouken@94
  2052
    case $linkmode in
slouken@94
  2053
    lib)
slouken@94
  2054
	passes="conv link"
slouken@94
  2055
	for file in $dlfiles $dlprefiles; do
slouken@94
  2056
	  case $file in
slouken@94
  2057
	  *.la) ;;
slouken@94
  2058
	  *)
slouken@94
  2059
	    $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
slouken@102
  2060
	    exit $EXIT_FAILURE
slouken@94
  2061
	    ;;
slouken@94
  2062
	  esac
slouken@94
  2063
	done
slouken@94
  2064
	;;
slouken@94
  2065
    prog)
slouken@94
  2066
	compile_deplibs=
slouken@94
  2067
	finalize_deplibs=
slouken@94
  2068
	alldeplibs=no
slouken@94
  2069
	newdlfiles=
slouken@94
  2070
	newdlprefiles=
slouken@94
  2071
	passes="conv scan dlopen dlpreopen link"
slouken@94
  2072
	;;
slouken@94
  2073
    *)  passes="conv"
slouken@94
  2074
	;;
slouken@94
  2075
    esac
slouken@94
  2076
    for pass in $passes; do
slouken@94
  2077
      if test "$linkmode,$pass" = "lib,link" ||
slouken@94
  2078
	 test "$linkmode,$pass" = "prog,scan"; then
slouken@94
  2079
	libs="$deplibs"
slouken@94
  2080
	deplibs=
slouken@94
  2081
      fi
slouken@94
  2082
      if test "$linkmode" = prog; then
slouken@94
  2083
	case $pass in
slouken@94
  2084
	dlopen) libs="$dlfiles" ;;
slouken@94
  2085
	dlpreopen) libs="$dlprefiles" ;;
slouken@94
  2086
	link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
slouken@94
  2087
	esac
slouken@94
  2088
      fi
slouken@94
  2089
      if test "$pass" = dlopen; then
slouken@94
  2090
	# Collect dlpreopened libraries
slouken@94
  2091
	save_deplibs="$deplibs"
slouken@94
  2092
	deplibs=
slouken@94
  2093
      fi
slouken@94
  2094
      for deplib in $libs; do
slouken@94
  2095
	lib=
slouken@94
  2096
	found=no
slouken@94
  2097
	case $deplib in
slouken@102
  2098
	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
slouken@102
  2099
	  if test "$linkmode,$pass" = "prog,link"; then
slouken@102
  2100
	    compile_deplibs="$deplib $compile_deplibs"
slouken@102
  2101
	    finalize_deplibs="$deplib $finalize_deplibs"
slouken@102
  2102
	  else
slouken@127
  2103
	    compiler_flags="$compiler_flags $deplib"
slouken@102
  2104
	  fi
slouken@102
  2105
	  continue
slouken@102
  2106
	  ;;
slouken@94
  2107
	-l*)
slouken@94
  2108
	  if test "$linkmode" != lib && test "$linkmode" != prog; then
slouken@94
  2109
	    $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
slouken@94
  2110
	    continue
slouken@94
  2111
	  fi
slouken@94
  2112
	  name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
slouken@94
  2113
	  for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
slouken@102
  2114
	    for search_ext in .la $std_shrext .so .a; do
slouken@102
  2115
	      # Search the libtool library
slouken@102
  2116
	      lib="$searchdir/lib${name}${search_ext}"
slouken@102
  2117
	      if test -f "$lib"; then
slouken@102
  2118
		if test "$search_ext" = ".la"; then
slouken@102
  2119
		  found=yes
slouken@102
  2120
		else
slouken@102
  2121
		  found=no
slouken@102
  2122
		fi
slouken@102
  2123
		break 2
slouken@102
  2124
	      fi
slouken@102
  2125
	    done
slouken@94
  2126
	  done
slouken@94
  2127
	  if test "$found" != yes; then
slouken@94
  2128
	    # deplib doesn't seem to be a libtool library
slouken@94
  2129
	    if test "$linkmode,$pass" = "prog,link"; then
slouken@94
  2130
	      compile_deplibs="$deplib $compile_deplibs"
slouken@94
  2131
	      finalize_deplibs="$deplib $finalize_deplibs"
slouken@94
  2132
	    else
slouken@94
  2133
	      deplibs="$deplib $deplibs"
slouken@94
  2134
	      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
slouken@94
  2135
	    fi
slouken@94
  2136
	    continue
slouken@94
  2137
	  else # deplib is a libtool library
slouken@94
  2138
	    # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
slouken@94
  2139
	    # We need to do some special things here, and not later.
slouken@94
  2140
	    if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
slouken@94
  2141
	      case " $predeps $postdeps " in
slouken@94
  2142
	      *" $deplib "*)
slouken@94
  2143
		if (${SED} -e '2q' $lib |
slouken@94
  2144
                    grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
slouken@94
  2145
		  library_names=
slouken@94
  2146
		  old_library=
slouken@94
  2147
		  case $lib in
slouken@94
  2148
		  */* | *\\*) . $lib ;;
slouken@94
  2149
		  *) . ./$lib ;;
slouken@94
  2150
		  esac
slouken@94
  2151
		  for l in $old_library $library_names; do
slouken@94
  2152
		    ll="$l"
slouken@94
  2153
		  done
slouken@94
  2154
		  if test "X$ll" = "X$old_library" ; then # only static version available
slouken@94
  2155
		    found=no
slouken@94
  2156
		    ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
slouken@94
  2157
		    test "X$ladir" = "X$lib" && ladir="."
slouken@94
  2158
		    lib=$ladir/$old_library
slouken@94
  2159
		    if test "$linkmode,$pass" = "prog,link"; then
slouken@94
  2160
		      compile_deplibs="$deplib $compile_deplibs"
slouken@94
  2161
		      finalize_deplibs="$deplib $finalize_deplibs"
slouken@94
  2162
		    else
slouken@94
  2163
		      deplibs="$deplib $deplibs"
slouken@94
  2164
		      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
slouken@94
  2165
		    fi
slouken@94
  2166
		    continue
slouken@94
  2167
		  fi
slouken@94
  2168
		fi
slouken@94
  2169
	        ;;
slouken@94
  2170
	      *) ;;
slouken@94
  2171
	      esac
slouken@94
  2172
	    fi
slouken@94
  2173
	  fi
slouken@94
  2174
	  ;; # -l
slouken@94
  2175
	-L*)
slouken@94
  2176
	  case $linkmode in
slouken@94
  2177
	  lib)
slouken@94
  2178
	    deplibs="$deplib $deplibs"
slouken@94
  2179
	    test "$pass" = conv && continue
slouken@94
  2180
	    newdependency_libs="$deplib $newdependency_libs"
slouken@94
  2181
	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
slouken@94
  2182
	    ;;
slouken@94
  2183
	  prog)
slouken@94
  2184
	    if test "$pass" = conv; then
slouken@94
  2185
	      deplibs="$deplib $deplibs"
slouken@94
  2186
	      continue
slouken@94
  2187
	    fi
slouken@94
  2188
	    if test "$pass" = scan; then
slouken@94
  2189
	      deplibs="$deplib $deplibs"
slouken@94
  2190
	    else
slouken@94
  2191
	      compile_deplibs="$deplib $compile_deplibs"
slouken@94
  2192
	      finalize_deplibs="$deplib $finalize_deplibs"
slouken@94
  2193
	    fi
slouken@102
  2194
	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
slouken@94
  2195
	    ;;
slouken@94
  2196
	  *)
slouken@94
  2197
	    $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
slouken@94
  2198
	    ;;
slouken@94
  2199
	  esac # linkmode
slouken@94
  2200
	  continue
slouken@94
  2201
	  ;; # -L
slouken@94
  2202
	-R*)
slouken@94
  2203
	  if test "$pass" = link; then
slouken@94
  2204
	    dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
slouken@94
  2205
	    # Make sure the xrpath contains only unique directories.
slouken@94
  2206
	    case "$xrpath " in
slouken@94
  2207
	    *" $dir "*) ;;
slouken@94
  2208
	    *) xrpath="$xrpath $dir" ;;
slouken@94
  2209
	    esac
slouken@94
  2210
	  fi
slouken@94
  2211
	  deplibs="$deplib $deplibs"
slouken@94
  2212
	  continue
slouken@94
  2213
	  ;;
slouken@94
  2214
	*.la) lib="$deplib" ;;
slouken@94
  2215
	*.$libext)
slouken@94
  2216
	  if test "$pass" = conv; then
slouken@94
  2217
	    deplibs="$deplib $deplibs"
slouken@94
  2218
	    continue
slouken@94
  2219
	  fi
slouken@94
  2220
	  case $linkmode in
slouken@94
  2221
	  lib)
slouken@102
  2222
	    valid_a_lib=no
slouken@102
  2223
	    case $deplibs_check_method in
slouken@102
  2224
	      match_pattern*)
slouken@102
  2225
		set dummy $deplibs_check_method
slouken@102
  2226
	        match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
slouken@102
  2227
		if eval $echo \"$deplib\" 2>/dev/null \
slouken@102
  2228
		    | $SED 10q \
slouken@102
  2229
		    | $EGREP "$match_pattern_regex" > /dev/null; then
slouken@102
  2230
		  valid_a_lib=yes
slouken@102
  2231
		fi
slouken@102
  2232
		;;
slouken@102
  2233
	      pass_all)
slouken@102
  2234
		valid_a_lib=yes
slouken@102
  2235
		;;
slouken@102
  2236
            esac
slouken@102
  2237
	    if test "$valid_a_lib" != yes; then
slouken@94
  2238
	      $echo
slouken@94
  2239
	      $echo "*** Warning: Trying to link with static lib archive $deplib."
slouken@94
  2240
	      $echo "*** I have the capability to make that library automatically link in when"
slouken@94
  2241
	      $echo "*** you link to this library.  But I can only do this if you have a"
slouken@94
  2242
	      $echo "*** shared version of the library, which you do not appear to have"
slouken@94
  2243
	      $echo "*** because the file extensions .$libext of this argument makes me believe"
slouken@94
  2244
	      $echo "*** that it is just a static archive that I should not used here."
slouken@94
  2245
	    else
slouken@94
  2246
	      $echo
slouken@94
  2247
	      $echo "*** Warning: Linking the shared library $output against the"
slouken@94
  2248
	      $echo "*** static library $deplib is not portable!"
slouken@94
  2249
	      deplibs="$deplib $deplibs"
slouken@94
  2250
	    fi
slouken@94
  2251
	    continue
slouken@94
  2252
	    ;;
slouken@94
  2253
	  prog)
slouken@94
  2254
	    if test "$pass" != link; then
slouken@94
  2255
	      deplibs="$deplib $deplibs"
slouken@94
  2256
	    else
slouken@94
  2257
	      compile_deplibs="$deplib $compile_deplibs"
slouken@94
  2258
	      finalize_deplibs="$deplib $finalize_deplibs"
slouken@94
  2259
	    fi
slouken@94
  2260
	    continue
slouken@94
  2261
	    ;;
slouken@94
  2262
	  esac # linkmode
slouken@94
  2263
	  ;; # *.$libext
slouken@94
  2264
	*.lo | *.$objext)
slouken@94
  2265
	  if test "$pass" = conv; then
slouken@94
  2266
	    deplibs="$deplib $deplibs"
slouken@94
  2267
	  elif test "$linkmode" = prog; then
slouken@94
  2268
	    if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
slouken@94
  2269
	      # If there is no dlopen support or we're linking statically,
slouken@94
  2270
	      # we need to preload.
slouken@94
  2271
	      newdlprefiles="$newdlprefiles $deplib"
slouken@94
  2272
	      compile_deplibs="$deplib $compile_deplibs"
slouken@94
  2273
	      finalize_deplibs="$deplib $finalize_deplibs"
slouken@94
  2274
	    else
slouken@94
  2275
	      newdlfiles="$newdlfiles $deplib"
slouken@94
  2276
	    fi
slouken@94
  2277
	  fi
slouken@94
  2278
	  continue
slouken@94
  2279
	  ;;
slouken@94
  2280
	%DEPLIBS%)
slouken@94
  2281
	  alldeplibs=yes
slouken@94
  2282
	  continue
slouken@94
  2283
	  ;;
slouken@94
  2284
	esac # case $deplib
slouken@94
  2285
	if test "$found" = yes || test -f "$lib"; then :
slouken@94
  2286
	else
slouken@127
  2287
	  $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
slouken@102
  2288
	  exit $EXIT_FAILURE
slouken@94
  2289
	fi
slouken@94
  2290
slouken@94
  2291
	# Check to see that this really is a libtool archive.
slouken@94
  2292
	if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
slouken@94
  2293
	else
slouken@94
  2294
	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
slouken@102
  2295
	  exit $EXIT_FAILURE
slouken@94
  2296
	fi
slouken@94
  2297
slouken@94
  2298
	ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
slouken@94
  2299
	test "X$ladir" = "X$lib" && ladir="."
slouken@94
  2300
slouken@0
  2301
	dlname=
slouken@94
  2302
	dlopen=
slouken@94
  2303
	dlpreopen=
slouken@0
  2304
	libdir=
slouken@0
  2305
	library_names=
slouken@0
  2306
	old_library=
slouken@94
  2307
	# If the library was installed with an old release of libtool,
slouken@94
  2308
	# it will not redefine variables installed, or shouldnotlink
slouken@94
  2309
	installed=yes
slouken@94
  2310
	shouldnotlink=no
slouken@127
  2311
	avoidtemprpath=
slouken@127
  2312
slouken@94
  2313
slouken@94
  2314
	# Read the .la file
slouken@94
  2315
	case $lib in
slouken@94
  2316
	*/* | *\\*) . $lib ;;
slouken@94
  2317
	*) . ./$lib ;;
slouken@94
  2318
	esac
slouken@94
  2319
slouken@94
  2320
	if test "$linkmode,$pass" = "lib,link" ||
slouken@94
  2321
	   test "$linkmode,$pass" = "prog,scan" ||
slouken@94
  2322
	   { test "$linkmode" != prog && test "$linkmode" != lib; }; then
slouken@94
  2323
	  test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
slouken@94
  2324
	  test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
slouken@0
  2325
	fi
slouken@0
  2326
slouken@94
  2327
	if test "$pass" = conv; then
slouken@94
  2328
	  # Only check for convenience libraries
slouken@94
  2329
	  deplibs="$lib $deplibs"
slouken@94
  2330
	  if test -z "$libdir"; then
slouken@94
  2331
	    if test -z "$old_library"; then
slouken@94
  2332
	      $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
slouken@102
  2333
	      exit $EXIT_FAILURE
slouken@94
  2334
	    fi
slouken@94
  2335
	    # It is a libtool convenience library, so add in its objects.
slouken@94
  2336
	    convenience="$convenience $ladir/$objdir/$old_library"
slouken@94
  2337
	    old_convenience="$old_convenience $ladir/$objdir/$old_library"
slouken@94
  2338
	    tmp_libs=
slouken@94
  2339
	    for deplib in $dependency_libs; do
slouken@94
  2340
	      deplibs="$deplib $deplibs"
slouken@94
  2341
              if test "X$duplicate_deps" = "Xyes" ; then
slouken@94
  2342
	        case "$tmp_libs " in
slouken@94
  2343
	        *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
slouken@94
  2344
	        esac
slouken@94
  2345
              fi
slouken@94
  2346
	      tmp_libs="$tmp_libs $deplib"
slouken@94
  2347
	    done
slouken@94
  2348
	  elif test "$linkmode" != prog && test "$linkmode" != lib; then
slouken@94
  2349
	    $echo "$modename: \`$lib' is not a convenience library" 1>&2
slouken@102
  2350
	    exit $EXIT_FAILURE
slouken@94
  2351
	  fi
slouken@94
  2352
	  continue
slouken@94
  2353
	fi # $pass = conv
slouken@94
  2354
slouken@102
  2355
slouken@0
  2356
	# Get the name of the library we link against.
slouken@0
  2357
	linklib=
slouken@0
  2358
	for l in $old_library $library_names; do
slouken@0
  2359
	  linklib="$l"
slouken@0
  2360
	done
slouken@0
  2361
	if test -z "$linklib"; then
slouken@94
  2362
	  $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
slouken@102
  2363
	  exit $EXIT_FAILURE
slouken@0
  2364
	fi
slouken@0
  2365
slouken@94
  2366
	# This library was specified with -dlopen.
slouken@94
  2367
	if test "$pass" = dlopen; then
slouken@94
  2368
	  if test -z "$libdir"; then
slouken@94
  2369
	    $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
slouken@102
  2370
	    exit $EXIT_FAILURE
slouken@94
  2371
	  fi
slouken@102
  2372
	  if test -z "$dlname" ||
slouken@102
  2373
	     test "$dlopen_support" != yes ||
slouken@102
  2374
	     test "$build_libtool_libs" = no; then
slouken@94
  2375
	    # If there is no dlname, no dlopen support or we're linking
slouken@94
  2376
	    # statically, we need to preload.  We also need to preload any
slouken@94
  2377
	    # dependent libraries so libltdl's deplib preloader doesn't
slouken@94
  2378
	    # bomb out in the load deplibs phase.
slouken@94
  2379
	    dlprefiles="$dlprefiles $lib $dependency_libs"
slouken@94
  2380
	  else
slouken@94
  2381
	    newdlfiles="$newdlfiles $lib"
slouken@94
  2382
	  fi
slouken@94
  2383
	  continue
slouken@94
  2384
	fi # $pass = dlopen
slouken@94
  2385
slouken@94
  2386
	# We need an absolute path.
slouken@94
  2387
	case $ladir in
slouken@94
  2388
	[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
slouken@94
  2389
	*)
slouken@94
  2390
	  abs_ladir=`cd "$ladir" && pwd`
slouken@94
  2391
	  if test -z "$abs_ladir"; then
slouken@94
  2392
	    $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
slouken@94
  2393
	    $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
slouken@94
  2394
	    abs_ladir="$ladir"
slouken@94
  2395
	  fi
slouken@94
  2396
	  ;;
slouken@94
  2397
	esac
slouken@94
  2398
	laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
slouken@94
  2399
slouken@2
  2400
	# Find the relevant object directory and library name.
slouken@0
  2401
	if test "X$installed" = Xyes; then
slouken@94
  2402
	  if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
slouken@94
  2403
	    $echo "$modename: warning: library \`$lib' was moved." 1>&2
slouken@94
  2404
	    dir="$ladir"
slouken@94
  2405
	    absdir="$abs_ladir"
slouken@94
  2406
	    libdir="$abs_ladir"
slouken@94
  2407
	  else
slouken@94
  2408
	    dir="$libdir"
slouken@94
  2409
	    absdir="$libdir"
slouken@94
  2410
	  fi
slouken@127
  2411
	  test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
slouken@0
  2412
	else
slouken@102
  2413
	  if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
slouken@102
  2414
	    dir="$ladir"
slouken@102
  2415
	    absdir="$abs_ladir"
slouken@102
  2416
	    # Remove this search path later
slouken@102
  2417
	    notinst_path="$notinst_path $abs_ladir"
slouken@102
  2418
	  else
slouken@102
  2419
	    dir="$ladir/$objdir"
slouken@102
  2420
	    absdir="$abs_ladir/$objdir"
slouken@102
  2421
	    # Remove this search path later
slouken@102
  2422
	    notinst_path="$notinst_path $abs_ladir"
slouken@102
  2423
	  fi
slouken@94
  2424
	fi # $installed = yes
slouken@94
  2425
	name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
slouken@94
  2426
slouken@94
  2427
	# This library was specified with -dlpreopen.
slouken@94
  2428
	if test "$pass" = dlpreopen; then
slouken@94
  2429
	  if test -z "$libdir"; then
slouken@94
  2430
	    $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
slouken@102
  2431
	    exit $EXIT_FAILURE
slouken@94
  2432
	  fi
slouken@94
  2433
	  # Prefer using a static library (so that no silly _DYNAMIC symbols
slouken@94
  2434
	  # are required to link).
slouken@94
  2435
	  if test -n "$old_library"; then
slouken@94
  2436
	    newdlprefiles="$newdlprefiles $dir/$old_library"
slouken@94
  2437
	  # Otherwise, use the dlname, so that lt_dlopen finds it.
slouken@94
  2438
	  elif test -n "$dlname"; then
slouken@94
  2439
	    newdlprefiles="$newdlprefiles $dir/$dlname"
slouken@0
  2440
	  else
slouken@94
  2441
	    newdlprefiles="$newdlprefiles $dir/$linklib"
slouken@0
  2442
	  fi
slouken@94
  2443
	fi # $pass = dlpreopen
slouken@2
  2444
slouken@2
  2445
	if test -z "$libdir"; then
slouken@94
  2446
	  # Link the convenience library
slouken@94
  2447
	  if test "$linkmode" = lib; then
slouken@94
  2448
	    deplibs="$dir/$old_library $deplibs"
slouken@94
  2449
	  elif test "$linkmode,$pass" = "prog,link"; then
slouken@94
  2450
	    compile_deplibs="$dir/$old_library $compile_deplibs"
slouken@94
  2451
	    finalize_deplibs="$dir/$old_library $finalize_deplibs"
slouken@94
  2452
	  else
slouken@94
  2453
	    deplibs="$lib $deplibs" # used for prog,scan pass
slouken@94
  2454
	  fi
slouken@2
  2455
	  continue
slouken@2
  2456
	fi
slouken@2
  2457
slouken@102
  2458
slouken@94
  2459
	if test "$linkmode" = prog && test "$pass" != link; then
slouken@94
  2460
	  newlib_search_path="$newlib_search_path $ladir"
slouken@94
  2461
	  deplibs="$lib $deplibs"
slouken@94
  2462
slouken@94
  2463
	  linkalldeplibs=no
slouken@94
  2464
	  if test "$link_all_deplibs" != no || test -z "$library_names" ||
slouken@94
  2465
	     test "$build_libtool_libs" = no; then
slouken@94
  2466
	    linkalldeplibs=yes
slouken@94
  2467
	  fi
slouken@94
  2468
slouken@94
  2469
	  tmp_libs=
slouken@94
  2470
	  for deplib in $dependency_libs; do
slouken@94
  2471
	    case $deplib in
slouken@94
  2472
	    -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
slouken@94
  2473
	    esac
slouken@94
  2474
	    # Need to link against all dependency_libs?
slouken@94
  2475
	    if test "$linkalldeplibs" = yes; then
slouken@94
  2476
	      deplibs="$deplib $deplibs"
slouken@94
  2477
	    else
slouken@94
  2478
	      # Need to hardcode shared library paths
slouken@94
  2479
	      # or/and link against static libraries
slouken@94
  2480
	      newdependency_libs="$deplib $newdependency_libs"
slouken@94
  2481
	    fi
slouken@94
  2482
	    if test "X$duplicate_deps" = "Xyes" ; then
slouken@94
  2483
	      case "$tmp_libs " in
slouken@94
  2484
	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
slouken@94
  2485
	      esac
slouken@94
  2486
	    fi
slouken@94
  2487
	    tmp_libs="$tmp_libs $deplib"
slouken@94
  2488
	  done # for deplib
slouken@94
  2489
	  continue
slouken@94
  2490
	fi # $linkmode = prog...
slouken@94
  2491
slouken@94
  2492
	if test "$linkmode,$pass" = "prog,link"; then
slouken@94
  2493
	  if test -n "$library_names" &&
slouken@94
  2494
	     { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
slouken@94
  2495
	    # We need to hardcode the library path
slouken@127
  2496
	    if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
slouken@94
  2497
	      # Make sure the rpath contains only unique directories.
slouken@94
  2498
	      case "$temp_rpath " in
slouken@94
  2499
	      *" $dir "*) ;;
slouken@94
  2500
	      *" $absdir "*) ;;
slouken@127
  2501
	      *) temp_rpath="$temp_rpath $absdir" ;;
slouken@94
  2502
	      esac
slouken@94
  2503
	    fi
slouken@94
  2504
slouken@94
  2505
	    # Hardcode the library path.
slouken@94
  2506
	    # Skip directories that are in the system default run-time
slouken@94
  2507
	    # search path.
slouken@94
  2508
	    case " $sys_lib_dlsearch_path " in
slouken@94
  2509
	    *" $absdir "*) ;;
slouken@94
  2510
	    *)
slouken@94
  2511
	      case "$compile_rpath " in
slouken@94
  2512
	      *" $absdir "*) ;;
slouken@94
  2513
	      *) compile_rpath="$compile_rpath $absdir"
slouken@94
  2514
	      esac
slouken@94
  2515
	      ;;
slouken@94
  2516
	    esac
slouken@94
  2517
	    case " $sys_lib_dlsearch_path " in
slouken@94
  2518
	    *" $libdir "*) ;;
slouken@94
  2519
	    *)
slouken@94
  2520
	      case "$finalize_rpath " in
slouken@94
  2521
	      *" $libdir "*) ;;
slouken@94
  2522
	      *) finalize_rpath="$finalize_rpath $libdir"
slouken@94
  2523
	      esac
slouken@94
  2524
	      ;;
slouken@94
  2525
	    esac
slouken@94
  2526
	  fi # $linkmode,$pass = prog,link...
slouken@94
  2527
slouken@94
  2528
	  if test "$alldeplibs" = yes &&
slouken@94
  2529
	     { test "$deplibs_check_method" = pass_all ||
slouken@94
  2530
	       { test "$build_libtool_libs" = yes &&
slouken@94
  2531
		 test -n "$library_names"; }; }; then
slouken@94
  2532
	    # We only need to search for static libraries
slouken@0
  2533
	    continue
slouken@0
  2534
	  fi
slouken@0
  2535
	fi
slouken@0
  2536
slouken@94
  2537
	link_static=no # Whether the deplib will be linked statically
slouken@127
  2538
	use_static_libs=$prefer_static_libs
slouken@127
  2539
	if test "$use_static_libs" = built && test "$installed" = yes ; then
slouken@127
  2540
	  use_static_libs=no
slouken@127
  2541
	fi
slouken@2
  2542
	if test -n "$library_names" &&
slouken@127
  2543
	   { test "$use_static_libs" = no || test -z "$old_library"; }; then
slouken@94
  2544
	  if test "$installed" = no; then
slouken@94
  2545
	    notinst_deplibs="$notinst_deplibs $lib"
slouken@94
  2546
	    need_relink=yes
slouken@94
  2547
	  fi
slouken@94
  2548
	  # This is a shared library
slouken@102
  2549
slouken@102
  2550
	  # Warn about portability, can't link against -module's on
slouken@102
  2551
	  # some systems (darwin)
slouken@102
  2552
	  if test "$shouldnotlink" = yes && test "$pass" = link ; then
slouken@94
  2553
	    $echo
slouken@94
  2554
	    if test "$linkmode" = prog; then
slouken@94
  2555
	      $echo "*** Warning: Linking the executable $output against the loadable module"
slouken@94
  2556
	    else
slouken@94
  2557
	      $echo "*** Warning: Linking the shared library $output against the loadable module"
slouken@94
  2558
	    fi
slouken@102
  2559
	    $echo "*** $linklib is not portable!"
slouken@102
  2560
	  fi
slouken@94
  2561
	  if test "$linkmode" = lib &&
slouken@94
  2562
	     test "$hardcode_into_libs" = yes; then
slouken@94
  2563
	    # Hardcode the library path.
slouken@94
  2564
	    # Skip directories that are in the system default run-time
slouken@94
  2565
	    # search path.
slouken@94
  2566
	    case " $sys_lib_dlsearch_path " in
slouken@94
  2567
	    *" $absdir "*) ;;
slouken@94
  2568
	    *)
slouken@94
  2569
	      case "$compile_rpath " in
slouken@94
  2570
	      *" $absdir "*) ;;
slouken@94
  2571
	      *) compile_rpath="$compile_rpath $absdir"
slouken@94
  2572
	      esac
slouken@94
  2573
	      ;;
slouken@94
  2574
	    esac
slouken@94
  2575
	    case " $sys_lib_dlsearch_path " in
slouken@94
  2576
	    *" $libdir "*) ;;
slouken@94
  2577
	    *)
slouken@94
  2578
	      case "$finalize_rpath " in
slouken@94
  2579
	      *" $libdir "*) ;;
slouken@94
  2580
	      *) finalize_rpath="$finalize_rpath $libdir"
slouken@94
  2581
	      esac
slouken@94
  2582
	      ;;
slouken@2
  2583
	    esac
slouken@2
  2584
	  fi
slouken@2
  2585
slouken@94
  2586
	  if test -n "$old_archive_from_expsyms_cmds"; then
slouken@94
  2587
	    # figure out the soname
slouken@94
  2588
	    set dummy $library_names
slouken@94
  2589
	    realname="$2"
slouken@94
  2590
	    shift; shift
slouken@94
  2591
	    libname=`eval \\$echo \"$libname_spec\"`
slouken@94
  2592
	    # use dlname if we got it. it's perfectly good, no?
slouken@94
  2593
	    if test -n "$dlname"; then
slouken@94
  2594
	      soname="$dlname"
slouken@94
  2595
	    elif test -n "$soname_spec"; then
slouken@94
  2596
	      # bleh windows
slouken@94
  2597
	      case $host in
slouken@94
  2598
	      *cygwin* | mingw*)
slouken@94
  2599
		major=`expr $current - $age`
slouken@94
  2600
		versuffix="-$major"
slouken@2
  2601
		;;
slouken@2
  2602
	      esac
slouken@94
  2603
	      eval soname=\"$soname_spec\"
slouken@94
  2604
	    else
slouken@94
  2605
	      soname="$realname"
slouken@94
  2606
	    fi
slouken@94
  2607
slouken@94
  2608
	    # Make a new name for the extract_expsyms_cmds to use
slouken@94
  2609
	    soroot="$soname"
slouken@94
  2610
	    soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
slouken@94
  2611
	    newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
slouken@94
  2612
slouken@94
  2613
	    # If the library has no export list, then create one now
slouken@94
  2614
	    if test -f "$output_objdir/$soname-def"; then :
slouken@94
  2615
	    else
slouken@94
  2616
	      $show "extracting exported symbol list from \`$soname'"
slouken@94
  2617
	      save_ifs="$IFS"; IFS='~'
slouken@102
  2618
	      cmds=$extract_expsyms_cmds
slouken@94
  2619
	      for cmd in $cmds; do
slouken@94
  2620
		IFS="$save_ifs"
slouken@102
  2621
		eval cmd=\"$cmd\"
slouken@94
  2622
		$show "$cmd"
slouken@94
  2623
		$run eval "$cmd" || exit $?
slouken@94
  2624
	      done
slouken@94
  2625
	      IFS="$save_ifs"
slouken@94
  2626
	    fi
slouken@94
  2627
slouken@94
  2628
	    # Create $newlib
slouken@94
  2629
	    if test -f "$output_objdir/$newlib"; then :; else
slouken@94
  2630
	      $show "generating import library for \`$soname'"
slouken@94
  2631
	      save_ifs="$IFS"; IFS='~'
slouken@102
  2632
	      cmds=$old_archive_from_expsyms_cmds
slouken@94
  2633
	      for cmd in $cmds; do
slouken@94
  2634
		IFS="$save_ifs"
slouken@102
  2635
		eval cmd=\"$cmd\"
slouken@94
  2636
		$show "$cmd"
slouken@94
  2637
		$run eval "$cmd" || exit $?
slouken@94
  2638
	      done
slouken@94
  2639
	      IFS="$save_ifs"
slouken@94
  2640
	    fi
slouken@94
  2641
	    # make sure the library variables are pointing to the new library
slouken@94
  2642
	    dir=$output_objdir
slouken@94
  2643
	    linklib=$newlib
slouken@94
  2644
	  fi # test -n "$old_archive_from_expsyms_cmds"
slouken@94
  2645
slouken@94
  2646
	  if test "$linkmode" = prog || test "$mode" != relink; then
slouken@94
  2647
	    add_shlibpath=
slouken@94
  2648
	    add_dir=
slouken@94
  2649
	    add=
slouken@94
  2650
	    lib_linked=yes
slouken@94
  2651
	    case $hardcode_action in
slouken@94
  2652
	    immediate | unsupported)
slouken@94
  2653
	      if test "$hardcode_direct" = no; then
slouken@94
  2654
		add="$dir/$linklib"
slouken@94
  2655
		case $host in
slouken@127
  2656
		  *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
slouken@127
  2657
		  *-*-sysv4*uw2*) add_dir="-L$dir" ;;
slouken@127
  2658
		  *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
slouken@127
  2659
		    *-*-unixware7*) add_dir="-L$dir" ;;
slouken@94
  2660
		  *-*-darwin* )
slouken@102
  2661
		    # if the lib is a module then we can not link against
slouken@102
  2662
		    # it, someone is ignoring the new warnings I added
slouken@127
  2663
		    if /usr/bin/file -L $add 2> /dev/null |
slouken@127
  2664
                      $EGREP ": [^:]* bundle" >/dev/null ; then
slouken@94
  2665
		      $echo "** Warning, lib $linklib is a module, not a shared library"
slouken@94
  2666
		      if test -z "$old_library" ; then
slouken@94
  2667
		        $echo
slouken@94
  2668
		        $echo "** And there doesn't seem to be a static archive available"
slouken@94
  2669
		        $echo "** The link will probably fail, sorry"
slouken@94
  2670
		      else
slouken@94
  2671
		        add="$dir/$old_library"
slouken@102
  2672
		      fi
slouken@94
  2673
		    fi
slouken@94
  2674
		esac
slouken@94
  2675
	      elif test "$hardcode_minus_L" = no; then
slouken@94
  2676
		case $host in
slouken@94
  2677
		*-*-sunos*) add_shlibpath="$dir" ;;
slouken@94
  2678
		esac
slouken@94
  2679
		add_dir="-L$dir"
slouken@94
  2680
		add="-l$name"
slouken@94
  2681
	      elif test "$hardcode_shlibpath_var" = no; then
slouken@94
  2682
		add_shlibpath="$dir"
slouken@94
  2683
		add="-l$name"
slouken@94
  2684
	      else
slouken@94
  2685
		lib_linked=no
slouken@94
  2686
	      fi
slouken@94
  2687
	      ;;
slouken@94
  2688
	    relink)
slouken@94
  2689
	      if test "$hardcode_direct" = yes; then
slouken@94
  2690
		add="$dir/$linklib"
slouken@94
  2691
	      elif test "$hardcode_minus_L" = yes; then
slouken@94
  2692
		add_dir="-L$dir"
slouken@94
  2693
		# Try looking first in the location we're being installed to.
slouken@94
  2694
		if test -n "$inst_prefix_dir"; then
slouken@127
  2695
		  case $libdir in
slouken@94
  2696
		    [\\/]*)
slouken@102
  2697
		      add_dir="$add_dir -L$inst_prefix_dir$libdir"
slouken@94
  2698
		      ;;
slouken@94
  2699
		  esac
slouken@94
  2700
		fi
slouken@94
  2701
		add="-l$name"
slouken@94
  2702
	      elif test "$hardcode_shlibpath_var" = yes; then
slouken@94
  2703
		add_shlibpath="$dir"
slouken@94
  2704
		add="-l$name"
slouken@94
  2705
	      else
slouken@94
  2706
		lib_linked=no
slouken@94
  2707
	      fi
slouken@94
  2708
	      ;;
slouken@94
  2709
	    *) lib_linked=no ;;
slouken@94
  2710
	    esac
slouken@94
  2711
slouken@94
  2712
	    if test "$lib_linked" != yes; then
slouken@94
  2713
	      $echo "$modename: configuration error: unsupported hardcode properties"
slouken@102
  2714
	      exit $EXIT_FAILURE
slouken@94
  2715
	    fi
slouken@94
  2716
slouken@94
  2717
	    if test -n "$add_shlibpath"; then
slouken@94
  2718
	      case :$compile_shlibpath: in
slouken@94
  2719
	      *":$add_shlibpath:"*) ;;
slouken@94
  2720
	      *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
slouken@2
  2721
	      esac
slouken@94
  2722
	    fi
slouken@94
  2723
	    if test "$linkmode" = prog; then
slouken@94
  2724
	      test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
slouken@94
  2725
	      test -n "$add" && compile_deplibs="$add $compile_deplibs"
slouken@94
  2726
	    else
slouken@94
  2727
	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
slouken@94
  2728
	      test -n "$add" && deplibs="$add $deplibs"
slouken@94
  2729
	      if test "$hardcode_direct" != yes && \
slouken@94
  2730
		 test "$hardcode_minus_L" != yes && \
slouken@94
  2731
		 test "$hardcode_shlibpath_var" = yes; then
slouken@94
  2732
		case :$finalize_shlibpath: in
slouken@94
  2733
		*":$libdir:"*) ;;
slouken@94
  2734
		*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
slouken@94
  2735
		esac
slouken@94
  2736
	      fi
slouken@94
  2737
	    fi
slouken@94
  2738
	  fi
slouken@94
  2739
slouken@94
  2740
	  if test "$linkmode" = prog || test "$mode" = relink; then
slouken@94
  2741
	    add_shlibpath=
slouken@94
  2742
	    add_dir=
slouken@94
  2743
	    add=
slouken@94
  2744
	    # Finalize command for both is simple: just hardcode it.
slouken@94
  2745
	    if test "$hardcode_direct" = yes; then
slouken@94
  2746
	      add="$libdir/$linklib"
slouken@94
  2747
	    elif test "$hardcode_minus_L" = yes; then
slouken@94
  2748
	      add_dir="-L$libdir"
slouken@94
  2749
	      add="-l$name"
slouken@94
  2750
	    elif test "$hardcode_shlibpath_var" = yes; then
slouken@94
  2751
	      case :$finalize_shlibpath: in
slouken@94
  2752
	      *":$libdir:"*) ;;
slouken@94
  2753
	      *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
slouken@2
  2754
	      esac
slouken@94
  2755
	      add="-l$name"
slouken@94
  2756
	    elif test "$hardcode_automatic" = yes; then
slouken@102
  2757
	      if test -n "$inst_prefix_dir" &&
slouken@102
  2758
		 test -f "$inst_prefix_dir$libdir/$linklib" ; then
slouken@94
  2759
	        add="$inst_prefix_dir$libdir/$linklib"
slouken@94
  2760
	      else
slouken@94
  2761
	        add="$libdir/$linklib"
slouken@94
  2762
	      fi
slouken@2
  2763
	    else
slouken@94
  2764
	      # We cannot seem to hardcode it, guess we'll fake it.
slouken@94
  2765
	      add_dir="-L$libdir"
slouken@94
  2766
	      # Try looking first in the location we're being installed to.
slouken@94
  2767
	      if test -n "$inst_prefix_dir"; then
slouken@127
  2768
		case $libdir in
slouken@94
  2769
		  [\\/]*)
slouken@102
  2770
		    add_dir="$add_dir -L$inst_prefix_dir$libdir"
slouken@94
  2771
		    ;;
slouken@94
  2772
		esac
slouken@94
  2773
	      fi
slouken@94
  2774
	      add="-l$name"
slouken@2
  2775
	    fi
slouken@94
  2776
slouken@94
  2777
	    if test "$linkmode" = prog; then
slouken@94
  2778
	      test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
slouken@94
  2779
	      test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
slouken@2
  2780
	    else
slouken@94
  2781
	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
slouken@94
  2782
	      test -n "$add" && deplibs="$add $deplibs"
slouken@2
  2783
	    fi
slouken@2
  2784
	  fi
slouken@94
  2785
	elif test "$linkmode" = prog; then
slouken@2
  2786
	  # Here we assume that one of hardcode_direct or hardcode_minus_L
slouken@2
  2787
	  # is not unsupported.  This is valid on all known static and
slouken@2
  2788
	  # shared platforms.
slouken@2
  2789
	  if test "$hardcode_direct" != unsupported; then
slouken@2
  2790
	    test -n "$old_library" && linklib="$old_library"
slouken@94
  2791
	    compile_deplibs="$dir/$linklib $compile_deplibs"
slouken@94
  2792
	    finalize_deplibs="$dir/$linklib $finalize_deplibs"
slouken@2
  2793
	  else
slouken@94
  2794
	    compile_deplibs="-l$name -L$dir $compile_deplibs"
slouken@94
  2795
	    finalize_deplibs="-l$name -L$dir $finalize_deplibs"
slouken@94
  2796
	  fi
slouken@94
  2797
	elif test "$build_libtool_libs" = yes; then
slouken@94
  2798
	  # Not a shared library
slouken@94
  2799
	  if test "$deplibs_check_method" != pass_all; then
slouken@94
  2800
	    # We're trying link a shared library against a static one
slouken@94
  2801
	    # but the system doesn't support it.
slouken@94
  2802
slouken@94
  2803
	    # Just print a warning and add the library to dependency_libs so
slouken@94
  2804
	    # that the program can be linked against the static library.
slouken@94
  2805
	    $echo
slouken@94
  2806
	    $echo "*** Warning: This system can not link to static lib archive $lib."
slouken@94
  2807
	    $echo "*** I have the capability to make that library automatically link in when"
slouken@94
  2808
	    $echo "*** you link to this library.  But I can only do this if you have a"
slouken@94
  2809
	    $echo "*** shared version of the library, which you do not appear to have."
slouken@94
  2810
	    if test "$module" = yes; then
slouken@94
  2811
	      $echo "*** But as you try to build a module library, libtool will still create "
slouken@94
  2812
	      $echo "*** a static module, that should work as long as the dlopening application"
slouken@94
  2813
	      $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
slouken@94
  2814
	      if test -z "$global_symbol_pipe"; then
slouken@94
  2815
		$echo
slouken@94
  2816
		$echo "*** However, this would only work if libtool was able to extract symbol"
slouken@94
  2817
		$echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
slouken@94
  2818
		$echo "*** not find such a program.  So, this module is probably useless."
slouken@94
  2819
		$echo "*** \`nm' from GNU binutils and a full rebuild may help."
slouken@94
  2820
	      fi
slouken@94
  2821
	      if test "$build_old_libs" = no; then
slouken@94
  2822
		build_libtool_libs=module
slouken@94
  2823
		build_old_libs=yes
slouken@94
  2824
	      else
slouken@94
  2825
		build_libtool_libs=no
slouken@94
  2826
	      fi
slouken@94
  2827
	    fi
slouken@94
  2828
	  else
slouken@94
  2829
	    deplibs="$dir/$old_library $deplibs"
slouken@94
  2830
	    link_static=yes
slouken@94
  2831
	  fi
slouken@94
  2832
	fi # link shared/static library?
slouken@94
  2833
slouken@94
  2834
	if test "$linkmode" = lib; then
slouken@94
  2835
	  if test -n "$dependency_libs" &&
slouken@102
  2836
	     { test "$hardcode_into_libs" != yes ||
slouken@102
  2837
	       test "$build_old_libs" = yes ||
slouken@94
  2838
	       test "$link_static" = yes; }; then
slouken@94
  2839
	    # Extract -R from dependency_libs
slouken@94
  2840
	    temp_deplibs=
slouken@94
  2841
	    for libdir in $dependency_libs; do
slouken@94
  2842
	      case $libdir in
slouken@94
  2843
	      -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
slouken@94
  2844
		   case " $xrpath " in
slouken@94
  2845
		   *" $temp_xrpath "*) ;;
slouken@94
  2846
		   *) xrpath="$xrpath $temp_xrpath";;
slouken@94
  2847
		   esac;;
slouken@94
  2848
	      *) temp_deplibs="$temp_deplibs $libdir";;
slouken@94
  2849
	      esac
slouken@94
  2850
	    done
slouken@94
  2851
	    dependency_libs="$temp_deplibs"
slouken@94
  2852
	  fi
slouken@94
  2853
slouken@94
  2854
	  newlib_search_path="$newlib_search_path $absdir"
slouken@94
  2855
	  # Link against this library
slouken@94
  2856
	  test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
slouken@94
  2857
	  # ... and its dependency_libs
slouken@94
  2858
	  tmp_libs=