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