ltmain.sh
author Ryan C. Gordon <icculus@icculus.org>
Mon, 12 Dec 2005 09:22:36 +0000
changeset 1200 8f418dce02b2
parent 947 3bb035750537
permissions -rw-r--r--
Date: Sun, 11 Dec 2005 20:37:04 +0100
From: Olivier Boudeville <olivier.boudeville@online.fr>
To: "A list for developers using the SDL library. \(includes SDL-announce\)" <sdl@libsdl.org>
Subject: [SDL] NetBSD build patch


Hi everybody,

apparently the SDL-1.2.9 source archive could not compile "as is" on
NetBSD 2.0_STABLE due to a pthread detection issue in the configure script.

I attached a small patch that can be applied to configure.in so that SDL
can be directly (i.e. without the NetBSD package manager) configured and
built successfully on NetBSD (at least on the one I tried !).

Hope this helps,

Olivier.
slouken@947
     1
# Based on libtool-1.5.8
slouken@0
     2
# ltmain.sh - Provide generalized library-building support services.
slouken@729
     3
# NOTE: Changing this file will not affect anything until you rerun configure.
slouken@0
     4
#
slouken@947
     5
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004
slouken@729
     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@947
    28
basename="s,^.*/,,g"
slouken@947
    29
slouken@947
    30
# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
slouken@947
    31
# is ksh but when the shell is invoked as "sh" and the current value of
slouken@947
    32
# the _XPG environment variable is not equal to 1 (one), the special
slouken@947
    33
# positional parameter $0, within a function call, is the name of the
slouken@947
    34
# function.
slouken@947
    35
progpath="$0"
slouken@947
    36
slouken@947
    37
# The name of this program:
slouken@947
    38
progname=`echo "$progpath" | $SED $basename`
slouken@947
    39
modename="$progname"
slouken@947
    40
slouken@947
    41
# Global variables:
slouken@947
    42
EXIT_SUCCESS=0
slouken@947
    43
EXIT_FAILURE=1
slouken@947
    44
slouken@947
    45
PROGRAM=ltmain.sh
slouken@947
    46
PACKAGE=libtool
slouken@947
    47
VERSION=1.5.8
slouken@947
    48
TIMESTAMP=" (1.1220.2.117 2004/08/04 14:12:05)"
slouken@947
    49
slouken@947
    50
# See if we are running on zsh, and set the options which allow our
slouken@947
    51
# commands through without removal of \ escapes.
slouken@947
    52
if test -n "${ZSH_VERSION+set}" ; then
slouken@947
    53
  setopt NO_GLOB_SUBST
slouken@947
    54
fi
slouken@947
    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@947
    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@947
    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@729
    89
Xsed="${SED}"' -e 1s/^X//'
slouken@0
    90
sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
slouken@729
    91
# test EBCDIC or ASCII
slouken@947
    92
case `echo A|tr A '\301'` in
slouken@947
    93
 A) # EBCDIC based system
slouken@729
    94
  SP2NL="tr '\100' '\n'"
slouken@729
    95
  NL2SP="tr '\r\n' '\100\100'"
slouken@729
    96
  ;;
slouken@729
    97
 *) # Assume ASCII based system
slouken@729
    98
  SP2NL="tr '\040' '\012'"
slouken@729
    99
  NL2SP="tr '\015\012' '\040\040'"
slouken@729
   100
  ;;
slouken@729
   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@729
   115
# Make sure IFS has a sensible default
slouken@947
   116
: ${IFS=" 	
slouken@947
   117
"}
slouken@0
   118
slouken@0
   119
if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
slouken@729
   120
  $echo "$modename: not configured to build any kind of library" 1>&2
slouken@729
   121
  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
slouken@947
   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@729
   137
#####################################
slouken@729
   138
# Shell function definitions:
slouken@729
   139
# This seems to be the best place for them
slouken@729
   140
slouken@947
   141
# func_win32_libid arg
slouken@947
   142
# return the library type of file 'arg'
slouken@947
   143
#
slouken@729
   144
# Need a lot of goo to handle *both* DLLs and import libs
slouken@729
   145
# Has to be a shell function in order to 'eat' the argument
slouken@729
   146
# that is supplied when $file_magic_command is called.
slouken@947
   147
func_win32_libid () {
slouken@729
   148
  win32_libid_type="unknown"
slouken@729
   149
  win32_fileres=`file -L $1 2>/dev/null`
slouken@729
   150
  case $win32_fileres in
slouken@729
   151
  *ar\ archive\ import\ library*) # definitely import
slouken@729
   152
    win32_libid_type="x86 archive import"
slouken@729
   153
    ;;
slouken@729
   154
  *ar\ archive*) # could be an import, or static
slouken@729
   155
    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
slouken@947
   156
      $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
slouken@729
   157
      win32_nmres=`eval $NM -f posix -A $1 | \
slouken@729
   158
	sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
slouken@729
   159
      if test "X$win32_nmres" = "Ximport" ; then
slouken@729
   160
        win32_libid_type="x86 archive import"
slouken@729
   161
      else
slouken@729
   162
        win32_libid_type="x86 archive static"
slouken@729
   163
      fi
slouken@729
   164
    fi
slouken@729
   165
    ;;
slouken@947
   166
  *DLL*)
slouken@729
   167
    win32_libid_type="x86 DLL"
slouken@729
   168
    ;;
slouken@729
   169
  *executable*) # but shell scripts are "executable" too...
slouken@729
   170
    case $win32_fileres in
slouken@729
   171
    *MS\ Windows\ PE\ Intel*)
slouken@729
   172
      win32_libid_type="x86 DLL"
slouken@729
   173
      ;;
slouken@729
   174
    esac
slouken@729
   175
    ;;
slouken@729
   176
  esac
slouken@729
   177
  $echo $win32_libid_type
slouken@729
   178
}
slouken@729
   179
slouken@947
   180
slouken@947
   181
# func_infer_tag arg
slouken@947
   182
# Infer tagged configuration to use if any are available and
slouken@947
   183
# if one wasn't chosen via the "--tag" command line option.
slouken@947
   184
# Only attempt this if the compiler in the base compile
slouken@947
   185
# command doesn't match the default compiler.
slouken@947
   186
# arg is usually of the form 'gcc ...'
slouken@947
   187
func_infer_tag () {
slouken@947
   188
    if test -n "$available_tags" && test -z "$tagname"; then
slouken@947
   189
      CC_quoted=
slouken@947
   190
      for arg in $CC; do
slouken@947
   191
	case $arg in
slouken@947
   192
	  *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
slouken@947
   193
	  arg="\"$arg\""
slouken@947
   194
	  ;;
slouken@947
   195
	esac
slouken@947
   196
	CC_quoted="$CC_quoted $arg"
slouken@947
   197
      done
slouken@947
   198
      case $@ in
slouken@947
   199
      # Blanks in the command may have been stripped by the calling shell,
slouken@947
   200
      # but not from the CC environment variable when configure was run.
slouken@947
   201
      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
slouken@947
   202
      # Blanks at the start of $base_compile will cause this to fail
slouken@947
   203
      # if we don't check for them as well.
slouken@947
   204
      *)
slouken@947
   205
	for z in $available_tags; do
slouken@947
   206
	  if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
slouken@947
   207
	    # Evaluate the configuration.
slouken@947
   208
	    eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
slouken@947
   209
	    CC_quoted=
slouken@947
   210
	    for arg in $CC; do
slouken@947
   211
	    # Double-quote args containing other shell metacharacters.
slouken@947
   212
	    case $arg in
slouken@947
   213
	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
slouken@947
   214
	      arg="\"$arg\""
slouken@947
   215
	      ;;
slouken@947
   216
	    esac
slouken@947
   217
	    CC_quoted="$CC_quoted $arg"
slouken@947
   218
	  done
slouken@947
   219
	    case "$@ " in
slouken@947
   220
	      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
slouken@947
   221
	      # The compiler in the base compile command matches
slouken@947
   222
	      # the one in the tagged configuration.
slouken@947
   223
	      # Assume this is the tagged configuration we want.
slouken@947
   224
	      tagname=$z
slouken@947
   225
	      break
slouken@947
   226
	      ;;
slouken@947
   227
	    esac
slouken@947
   228
	  fi
slouken@947
   229
	done
slouken@947
   230
	# If $tagname still isn't set, then no tagged configuration
slouken@947
   231
	# was found and let the user know that the "--tag" command
slouken@947
   232
	# line option must be used.
slouken@947
   233
	if test -z "$tagname"; then
slouken@947
   234
	  $echo "$modename: unable to infer tagged configuration"
slouken@947
   235
	  $echo "$modename: specify a tag with \`--tag'" 1>&2
slouken@947
   236
	  exit $EXIT_FAILURE
slouken@947
   237
#        else
slouken@947
   238
#          $echo "$modename: using $tagname tagged configuration"
slouken@947
   239
	fi
slouken@947
   240
	;;
slouken@947
   241
      esac
slouken@947
   242
    fi
slouken@947
   243
}
slouken@947
   244
slouken@947
   245
slouken@947
   246
# func_extract_archives gentop oldlib ...
slouken@947
   247
func_extract_archives () {
slouken@947
   248
    my_gentop="$1"; shift
slouken@947
   249
    my_oldlibs=${1+"$@"}
slouken@947
   250
    my_oldobjs=""
slouken@947
   251
    my_xlib=""
slouken@947
   252
    my_xabs=""
slouken@947
   253
    my_xdir=""
slouken@947
   254
    my_status=""
slouken@947
   255
slouken@947
   256
    $show "${rm}r $my_gentop"
slouken@947
   257
    $run ${rm}r "$my_gentop"
slouken@947
   258
    $show "$mkdir $my_gentop"
slouken@947
   259
    $run $mkdir "$my_gentop"
slouken@947
   260
    my_status=$?
slouken@947
   261
    if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
slouken@947
   262
      exit $my_status
slouken@947
   263
    fi
slouken@947
   264
slouken@947
   265
    for my_xlib in $my_oldlibs; do
slouken@947
   266
      # Extract the objects.
slouken@947
   267
      case $my_xlib in
slouken@947
   268
	[\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
slouken@947
   269
	*) my_xabs=`pwd`"/$my_xlib" ;;
slouken@947
   270
      esac
slouken@947
   271
      my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
slouken@947
   272
      my_xdir="$my_gentop/$my_xlib"
slouken@947
   273
slouken@947
   274
      $show "${rm}r $my_xdir"
slouken@947
   275
      $run ${rm}r "$my_xdir"
slouken@947
   276
      $show "$mkdir $my_xdir"
slouken@947
   277
      $run $mkdir "$my_xdir"
slouken@947
   278
      status=$?
slouken@947
   279
      if test "$status" -ne 0 && test ! -d "$my_xdir"; then
slouken@947
   280
	exit $status
slouken@947
   281
      fi
slouken@947
   282
      case $host in
slouken@947
   283
      *-darwin*)
slouken@947
   284
	$show "Extracting $my_xabs"
slouken@947
   285
	# Do not bother doing anything if just a dry run
slouken@947
   286
	if test -z "$run"; then
slouken@947
   287
	  darwin_orig_dir=`pwd`
slouken@947
   288
	  cd $my_xdir || exit $?
slouken@947
   289
	  darwin_archive=$my_xabs
slouken@947
   290
	  darwin_curdir=`pwd`
slouken@947
   291
	  darwin_base_archive=`basename $darwin_archive`
slouken@947
   292
	  darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
slouken@947
   293
	  if test -n "$darwin_arches"; then 
slouken@947
   294
	    darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
slouken@947
   295
	    darwin_arch=
slouken@947
   296
	    $show "$darwin_base_archive has multiple architectures $darwin_arches"
slouken@947
   297
	    for darwin_arch in  $darwin_arches ; do
slouken@947
   298
	      mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
slouken@947
   299
	      lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
slouken@947
   300
	      # Remove the table of contents from the thin files.
slouken@947
   301
	      $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF 2>/dev/null || true
slouken@947
   302
	      $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF\ SORTED 2>/dev/null || true
slouken@947
   303
	      cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
slouken@947
   304
	      $AR -xo "${darwin_base_archive}"
slouken@947
   305
	      rm "${darwin_base_archive}"
slouken@947
   306
	      cd "$darwin_curdir"
slouken@947
   307
	    done # $darwin_arches
slouken@947
   308
      ## Okay now we have a bunch of thin objects, gotta fatten them up :)
slouken@947
   309
	    darwin_filelist=`find unfat-$$ -type f | xargs basename | sort -u | $NL2SP`
slouken@947
   310
	    darwin_file=
slouken@947
   311
	    darwin_files=
slouken@947
   312
	    for darwin_file in $darwin_filelist; do
slouken@947
   313
	      darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
slouken@947
   314
	      lipo -create -output "$darwin_file" $darwin_files
slouken@947
   315
	    done # $darwin_filelist
slouken@947
   316
	    rm -rf unfat-$$
slouken@947
   317
	    cd "$darwin_orig_dir"
slouken@947
   318
	  else
slouken@947
   319
	    cd $darwin_orig_dir
slouken@947
   320
	    (cd $my_xdir && $AR x $my_xabs) || exit $?
slouken@947
   321
	  fi # $darwin_arches
slouken@947
   322
	fi # $run
slouken@947
   323
      ;;
slouken@947
   324
      *)
slouken@947
   325
	# We will extract separately just the conflicting names and we will
slouken@947
   326
	# no longer touch any unique names. It is faster to leave these
slouken@947
   327
	# extract automatically by $AR in one run.
slouken@947
   328
	$show "(cd $my_xdir && $AR x $my_xabs)"
slouken@947
   329
	$run eval "(cd \$my_xdir && $AR x \$my_xabs)" || exit $?
slouken@947
   330
	if ($AR t "$my_xabs" | sort | sort -uc >/dev/null 2>&1); then
slouken@947
   331
	  :
slouken@947
   332
	else
slouken@947
   333
	  $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
slouken@947
   334
	  $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
slouken@947
   335
	  $AR t "$my_xabs" | sort | uniq -cd | while read -r count name
slouken@947
   336
	  do
slouken@947
   337
	    i=1
slouken@947
   338
	    while test "$i" -le "$count"
slouken@947
   339
	    do
slouken@947
   340
	      # Put our $i before any first dot (extension)
slouken@947
   341
	      # Never overwrite any file
slouken@947
   342
	      name_to="$name"
slouken@947
   343
	      while test "X$name_to" = "X$name" || test -f "$my_xdir/$name_to"
slouken@947
   344
	      do
slouken@947
   345
		name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
slouken@947
   346
	      done
slouken@947
   347
	      $show "(cd $my_xdir && $AR xN $i $my_xabs '$name' && $mv '$name' '$name_to')"
slouken@947
   348
	      $run eval "(cd \$my_xdir && $AR xN $i \$my_xabs '$name' && $mv '$name' '$name_to')" || exit $?
slouken@947
   349
	      i=`expr $i + 1`
slouken@947
   350
	    done
slouken@947
   351
	  done
slouken@947
   352
	fi
slouken@947
   353
	;;
slouken@947
   354
      esac
slouken@947
   355
      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
slouken@947
   356
    done
slouken@947
   357
slouken@947
   358
    func_extract_archives_result="$my_oldobjs"
slouken@947
   359
}
slouken@729
   360
# End of Shell function definitions
slouken@729
   361
#####################################
slouken@729
   362
slouken@947
   363
# Darwin sucks
slouken@947
   364
eval std_shrext=\"$shrext_cmds\"
slouken@947
   365
slouken@0
   366
# Parse our command line options once, thoroughly.
slouken@729
   367
while test "$#" -gt 0
slouken@0
   368
do
slouken@0
   369
  arg="$1"
slouken@0
   370
  shift
slouken@0
   371
slouken@729
   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@729
   379
    case $prev in
slouken@0
   380
    execute_dlfiles)
slouken@729
   381
      execute_dlfiles="$execute_dlfiles $arg"
slouken@729
   382
      ;;
slouken@729
   383
    tag)
slouken@729
   384
      tagname="$arg"
slouken@947
   385
      preserve_args="${preserve_args}=$arg"
slouken@729
   386
slouken@729
   387
      # Check whether tagname contains only valid characters
slouken@729
   388
      case $tagname in
slouken@729
   389
      *[!-_A-Za-z0-9,/]*)
slouken@729
   390
	$echo "$progname: invalid tag name: $tagname" 1>&2
slouken@947
   391
	exit $EXIT_FAILURE
slouken@729
   392
	;;
slouken@729
   393
      esac
slouken@729
   394
slouken@729
   395
      case $tagname in
slouken@729
   396
      CC)
slouken@729
   397
	# Don't test for the "default" C tag, as we know, it's there, but
slouken@729
   398
	# not specially marked.
slouken@729
   399
	;;
slouken@729
   400
      *)
slouken@947
   401
	if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
slouken@729
   402
	  taglist="$taglist $tagname"
slouken@729
   403
	  # Evaluate the configuration.
slouken@947
   404
	  eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
slouken@729
   405
	else
slouken@729
   406
	  $echo "$progname: ignoring unknown tag $tagname" 1>&2
slouken@729
   407
	fi
slouken@729
   408
	;;
slouken@729
   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@729
   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@729
   428
    $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
slouken@729
   429
    $echo
slouken@729
   430
    $echo "Copyright (C) 2003  Free Software Foundation, Inc."
slouken@729
   431
    $echo "This is free software; see the source for copying conditions.  There is NO"
slouken@729
   432
    $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
slouken@947
   433
    exit $EXIT_SUCCESS
slouken@0
   434
    ;;
slouken@0
   435
slouken@0
   436
  --config)
slouken@947
   437
    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
slouken@729
   438
    # Now print the configurations for the tags.
slouken@729
   439
    for tagname in $taglist; do
slouken@947
   440
      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
slouken@729
   441
    done
slouken@947
   442
    exit $EXIT_SUCCESS
slouken@0
   443
    ;;
slouken@0
   444
slouken@0
   445
  --debug)
slouken@729
   446
    $echo "$progname: enabling shell trace mode"
slouken@0
   447
    set -x
slouken@947
   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@729
   456
    $echo "host: $host"
slouken@0
   457
    if test "$build_libtool_libs" = yes; then
slouken@729
   458
      $echo "enable shared libraries"
slouken@0
   459
    else
slouken@729
   460
      $echo "disable shared libraries"
slouken@0
   461
    fi
slouken@0
   462
    if test "$build_old_libs" = yes; then
slouken@729
   463
      $echo "enable static libraries"
slouken@0
   464
    else
slouken@729
   465
      $echo "disable static libraries"
slouken@0
   466
    fi
slouken@947
   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@729
   475
  --preserve-dup-deps) duplicate_deps="yes" ;;
slouken@729
   476
slouken@0
   477
  --quiet | --silent)
slouken@0
   478
    show=:
slouken@947
   479
    preserve_args="$preserve_args $arg"
slouken@0
   480
    ;;
slouken@0
   481
slouken@729
   482
  --tag) prevopt="--tag" prev=tag ;;
slouken@729
   483
  --tag=*)
slouken@729
   484
    set tag "$optarg" ${1+"$@"}
slouken@729
   485
    shift
slouken@729
   486
    prev=tag
slouken@947
   487
    preserve_args="$preserve_args --tag"
slouken@729
   488
    ;;
slouken@729
   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@947
   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@947
   511
  exit $EXIT_FAILURE
slouken@0
   512
fi
slouken@0
   513
slouken@729
   514
# If this variable is set in any of the actions, the command in it
slouken@729
   515
# will be execed at the end.  This prevents here-documents from being
slouken@729
   516
# left over by shells.
slouken@729
   517
exec_cmd=
slouken@729
   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@729
   523
    $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
slouken@729
   524
    $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2
slouken@729
   525
    case $nonopt in
slouken@729
   526
    *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
slouken@0
   527
      mode=link
slouken@0
   528
      for arg
slouken@0
   529
      do
slouken@729
   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@947
   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@729
   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@729
   581
    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
slouken@947
   582
    suppress_opt=yes
slouken@0
   583
    suppress_output=
slouken@729
   584
    arg_mode=normal
slouken@729
   585
    libobj=
slouken@947
   586
    later=
slouken@729
   587
slouken@0
   588
    for arg
slouken@0
   589
    do
slouken@729
   590
      case "$arg_mode" in
slouken@729
   591
      arg  )
slouken@729
   592
	# do not "continue".  Instead, add this to base_compile
slouken@729
   593
	lastarg="$arg"
slouken@729
   594
	arg_mode=normal
slouken@0
   595
	;;
slouken@0
   596
slouken@729
   597
      target )
slouken@729
   598
	libobj="$arg"
slouken@729
   599
	arg_mode=normal
slouken@0
   600
	continue
slouken@0
   601
	;;
slouken@729
   602
slouken@729
   603
      normal )
slouken@729
   604
	# Accept any command-line options.
slouken@729
   605
	case $arg in
slouken@729
   606
	-o)
slouken@729
   607
	  if test -n "$libobj" ; then
slouken@729
   608
	    $echo "$modename: you cannot specify \`-o' more than once" 1>&2
slouken@947
   609
	    exit $EXIT_FAILURE
slouken@729
   610
	  fi
slouken@729
   611
	  arg_mode=target
slouken@729
   612
	  continue
slouken@729
   613
	  ;;
slouken@729
   614
slouken@947
   615
	-static | -prefer-pic | -prefer-non-pic)
slouken@947
   616
	  later="$later $arg"
slouken@729
   617
	  continue
slouken@729
   618
	  ;;
slouken@729
   619
slouken@947
   620
	-no-suppress)
slouken@947
   621
	  suppress_opt=no
slouken@729
   622
	  continue
slouken@729
   623
	  ;;
slouken@729
   624
slouken@729
   625
	-Xcompiler)
slouken@729
   626
	  arg_mode=arg  #  the next one goes into the "base_compile" arg list
slouken@729
   627
	  continue      #  The current "srcfile" will either be retained or
slouken@729
   628
	  ;;            #  replaced later.  I would guess that would be a bug.
slouken@729
   629
slouken@729
   630
	-Wc,*)
slouken@729
   631
	  args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
slouken@729
   632
	  lastarg=
slouken@729
   633
	  save_ifs="$IFS"; IFS=','
slouken@947
   634
 	  for arg in $args; do
slouken@729
   635
	    IFS="$save_ifs"
slouken@729
   636
slouken@729
   637
	    # Double-quote args containing other shell metacharacters.
slouken@729
   638
	    # Many Bourne shells cannot handle close brackets correctly
slouken@729
   639
	    # in scan sets, so we specify it separately.
slouken@729
   640
	    case $arg in
slouken@729
   641
	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
slouken@729
   642
	      arg="\"$arg\""
slouken@729
   643
	      ;;
slouken@729
   644
	    esac
slouken@729
   645
	    lastarg="$lastarg $arg"
slouken@729
   646
	  done
slouken@729
   647
	  IFS="$save_ifs"
slouken@729
   648
	  lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
slouken@729
   649
slouken@729
   650
	  # Add the arguments to base_compile.
slouken@729
   651
	  base_compile="$base_compile $lastarg"
slouken@729
   652
	  continue
slouken@729
   653
	  ;;
slouken@729
   654
slouken@729
   655
	* )
slouken@729
   656
	  # Accept the current argument as the source file.
slouken@729
   657
	  # The previous "srcfile" becomes the current argument.
slouken@729
   658
	  #
slouken@729
   659
	  lastarg="$srcfile"
slouken@729
   660
	  srcfile="$arg"
slouken@729
   661
	  ;;
slouken@729
   662
	esac  #  case $arg
slouken@0
   663
	;;
slouken@729
   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@729
   669
      case $lastarg in
slouken@0
   670
      # Double-quote args containing other shell metacharacters.
slouken@729
   671
      # Many Bourne shells cannot handle close brackets correctly
slouken@729
   672
      # in scan sets, so we specify it separately.
slouken@729
   673
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
slouken@0
   674
	lastarg="\"$lastarg\""
slouken@0
   675
	;;
slouken@0
   676
      esac
slouken@0
   677
slouken@729
   678
      base_compile="$base_compile $lastarg"
slouken@729
   679
    done # for arg
slouken@729
   680
slouken@729
   681
    case $arg_mode in
slouken@729
   682
    arg)
slouken@729
   683
      $echo "$modename: you must specify an argument for -Xcompile"
slouken@947
   684
      exit $EXIT_FAILURE
slouken@0
   685
      ;;
slouken@729
   686
    target)
slouken@0
   687
      $echo "$modename: you must specify a target with \`-o'" 1>&2
slouken@947
   688
      exit $EXIT_FAILURE
slouken@0
   689
      ;;
slouken@729
   690
    *)
slouken@729
   691
      # Get the name of the library object.
slouken@729
   692
      [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
slouken@729
   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@729
   698
    xform='[cCFSifmso]'
slouken@729
   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@729
   706
    *.ii) xform=ii ;;
slouken@729
   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@729
   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@729
   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@947
   721
      exit $EXIT_FAILURE
slouken@0
   722
      ;;
slouken@0
   723
    esac
slouken@0
   724
slouken@947
   725
    func_infer_tag $base_compile
slouken@947
   726
slouken@947
   727
    for arg in $later; do
slouken@947
   728
      case $arg in
slouken@947
   729
      -static)
slouken@947
   730
	build_old_libs=yes
slouken@947
   731
	continue
slouken@947
   732
	;;
slouken@947
   733
slouken@947
   734
      -prefer-pic)
slouken@947
   735
	pic_mode=yes
slouken@947
   736
	continue
slouken@947
   737
	;;
slouken@947
   738
slouken@947
   739
      -prefer-non-pic)
slouken@947
   740
	pic_mode=no
slouken@947
   741
	continue
slouken@729
   742
	;;
slouken@729
   743
      esac
slouken@947
   744
    done
slouken@729
   745
slouken@729
   746
    objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
slouken@729
   747
    xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
slouken@729
   748
    if test "X$xdir" = "X$obj"; then
slouken@729
   749
      xdir=
slouken@729
   750
    else
slouken@729
   751
      xdir=$xdir/
slouken@729
   752
    fi
slouken@729
   753
    lobj=${xdir}$objdir/$objname
slouken@729
   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@947
   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@729
   763
      removelist="$obj $lobj $libobj ${libobj}T"
slouken@0
   764
    else
slouken@729
   765
      removelist="$lobj $libobj ${libobj}T"
slouken@0
   766
    fi
slouken@0
   767
slouken@0
   768
    $run $rm $removelist
slouken@947
   769
    trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
slouken@0
   770
slouken@729
   771
    # On Cygwin there's no "real" PIC flag so we must build both object types
slouken@729
   772
    case $host_os in
slouken@729
   773
    cygwin* | mingw* | pw32* | os2*)
slouken@729
   774
      pic_mode=default
slouken@729
   775
      ;;
slouken@729
   776
    esac
slouken@729
   777
    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
slouken@729
   778
      # non-PIC code in shared libraries is not supported
slouken@729
   779
      pic_mode=default
slouken@729
   780
    fi
slouken@729
   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@729
   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@947
   788
      trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
slouken@0
   789
    else
slouken@729
   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@947
   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@729
   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@947
   816
	exit $EXIT_FAILURE
slouken@0
   817
      fi
slouken@729
   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@729
   825
    $run $rm "$libobj" "${libobj}T"
slouken@729
   826
slouken@729
   827
    # Create a libtool object file (analogous to a ".la" file),
slouken@729
   828
    # but don't create it if we're doing a dry run.
slouken@729
   829
    test -z "$run" && cat > ${libobj}T <<EOF
slouken@729
   830
# $libobj - a libtool object file
slouken@729
   831
# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
slouken@729
   832
#
slouken@729
   833
# Please DO NOT delete this file!
slouken@729
   834
# It is necessary for linking the library.
slouken@729
   835
slouken@729
   836
# Name of the PIC object.
slouken@729
   837
EOF
slouken@729
   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@729
   844
      if test "$pic_mode" != no; then
slouken@729
   845
	command="$base_compile $srcfile $pic_flag"
slouken@729
   846
      else
slouken@729
   847
	# Don't build PIC code
slouken@729
   848
	command="$base_compile $srcfile"
slouken@729
   849
      fi
slouken@729
   850
slouken@729
   851
      if test ! -d "${xdir}$objdir"; then
slouken@729
   852
	$show "$mkdir ${xdir}$objdir"
slouken@729
   853
	$run $mkdir ${xdir}$objdir
slouken@729
   854
	status=$?
slouken@729
   855
	if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then
slouken@729
   856
	  exit $status
slouken@0
   857
	fi
slouken@0
   858
      fi
slouken@729
   859
slouken@729
   860
      if test -z "$output_obj"; then
slouken@729
   861
	# Place PIC objects in $objdir
slouken@729
   862
	command="$command -o $lobj"
slouken@0
   863
      fi
slouken@0
   864
slouken@729
   865
      $run $rm "$lobj" "$output_obj"
slouken@729
   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@947
   871
	exit $EXIT_FAILURE
slouken@0
   872
      fi
slouken@0
   873
slouken@0
   874
      if test "$need_locks" = warn &&
slouken@729
   875
	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
slouken@729
   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@947
   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@729
   895
      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
slouken@729
   896
	$show "$mv $output_obj $lobj"
slouken@729
   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@729
   905
      # Append the name of the PIC object to the libtool object file.
slouken@729
   906
      test -z "$run" && cat >> ${libobj}T <<EOF
slouken@729
   907
pic_object='$objdir/$objname'
slouken@729
   908
slouken@729
   909
EOF
slouken@0
   910
slouken@0
   911
      # Allow error messages only from the first compilation.
slouken@947
   912
      if test "$suppress_opt" = yes; then
slouken@947
   913
        suppress_output=' >/dev/null 2>&1'
slouken@947
   914
      fi
slouken@729
   915
    else
slouken@729
   916
      # No PIC object so indicate it doesn't exist in the libtool
slouken@729
   917
      # object file.
slouken@729
   918
      test -z "$run" && cat >> ${libobj}T <<EOF
slouken@729
   919
pic_object=none
slouken@729
   920
slouken@729
   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@729
   926
      if test "$pic_mode" != yes; then
slouken@729
   927
	# Don't build PIC code
slouken@729
   928
	command="$base_compile $srcfile"
slouken@729
   929
      else
slouken@729
   930
	command="$base_compile $srcfile $pic_flag"
slouken@729
   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@729
   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@947
   943
	exit $EXIT_FAILURE
slouken@0
   944
      fi
slouken@0
   945
slouken@0
   946
      if test "$need_locks" = warn &&
slouken@729
   947
	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
slouken@729
   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@947
   963
	exit $EXIT_FAILURE
slouken@0
   964
      fi
slouken@0
   965
slouken@0
   966
      # Just move the object if needed
slouken@729
   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@729
   977
      # Append the name of the non-PIC object the libtool object file.
slouken@729
   978
      # Only append if the libtool object file exists.
slouken@729
   979
      test -z "$run" && cat >> ${libobj}T <<EOF
slouken@729
   980
# Name of the non-PIC object.
slouken@729
   981
non_pic_object='$objname'
slouken@729
   982
slouken@729
   983
EOF
slouken@729
   984
    else
slouken@729
   985
      # Append the name of the non-PIC object the libtool object file.
slouken@729
   986
      # Only append if the libtool object file exists.
slouken@729
   987
      test -z "$run" && cat >> ${libobj}T <<EOF
slouken@729
   988
# Name of the non-PIC object.
slouken@729
   989
non_pic_object=none
slouken@729
   990
slouken@729
   991
EOF
slouken@0
   992
    fi
slouken@0
   993
slouken@729
   994
    $run $mv "${libobj}T" "${libobj}"
slouken@729
   995
slouken@0
   996
    # Unlock the critical section if it was locked
slouken@0
   997
    if test "$need_locks" != no; then
slouken@729
   998
      $run $rm "$lockfile"
slouken@0
   999
    fi
slouken@0
  1000
slouken@947
  1001
    exit $EXIT_SUCCESS
slouken@0
  1002
    ;;
slouken@0
  1003
slouken@0
  1004
  # libtool link mode
slouken@729
  1005
  link | relink)
slouken@0
  1006
    modename="$modename: link"
slouken@729
  1007
    case $host in
slouken@729
  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@729
  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@729
  1026
    libtool_args="$nonopt"
slouken@947
  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@729
  1038
    old_deplibs=
slouken@729
  1039
    compiler_flags=
slouken@729
  1040
    linker_flags=
slouken@729
  1041
    dllsearchpath=
slouken@729
  1042
    lib_search_path=`pwd`
slouken@729
  1043
    inst_prefix_dir=
slouken@729
  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@729
  1056
    no_install=no
slouken@0
  1057
    objs=
slouken@729
  1058
    non_pic_objects=
slouken@947
  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@729
  1071
    vinfo_number=no
slouken@0
  1072
slouken@947
  1073
    func_infer_tag $base_compile
slouken@947
  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@729
  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@729
  1104
    while test "$#" -gt 0; do
slouken@0
  1105
      arg="$1"
slouken@0
  1106
      shift
slouken@729
  1107
      case $arg in
slouken@729
  1108
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
slouken@729
  1109
	qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
slouken@729
  1110
	;;
slouken@729
  1111
      *) qarg=$arg ;;
slouken@729
  1112
      esac
slouken@729
  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@729
  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@729
  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@729
  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@729
  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@947
  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@729
  1179
	inst_prefix)
slouken@729
  1180
	  inst_prefix_dir="$arg"
slouken@387
  1181
	  prev=
slouken@387
  1182
	  continue
slouken@387
  1183
	  ;;
slouken@947
  1184
	precious_regex)
slouken@947
  1185
	  precious_files_regex="$arg"
slouken@947
  1186
	  prev=
slouken@947
  1187
	  continue
slouken@947
  1188
	  ;;
slouken@0
  1189
	release)
slouken@0
  1190
	  release="-$arg"
slouken@0
  1191
	  prev=
slouken@0
  1192
	  continue
slouken@0
  1193
	  ;;
slouken@729
  1194
	objectlist)
slouken@729
  1195
	  if test -f "$arg"; then
slouken@729
  1196
	    save_arg=$arg
slouken@729
  1197
	    moreargs=
slouken@729
  1198
	    for fil in `cat $save_arg`
slouken@729
  1199
	    do
slouken@729
  1200
#	      moreargs="$moreargs $fil"
slouken@729
  1201
	      arg=$fil
slouken@729
  1202
	      # A libtool-controlled object.
slouken@729
  1203
slouken@729
  1204
	      # Check to see that this really is a libtool object.
slouken@729
  1205
	      if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
slouken@729
  1206
		pic_object=
slouken@729
  1207
		non_pic_object=
slouken@729
  1208
slouken@729
  1209
		# Read the .lo file
slouken@729
  1210
		# If there is no directory component, then add one.
slouken@729
  1211
		case $arg in
slouken@729
  1212
		*/* | *\\*) . $arg ;;
slouken@729
  1213
		*) . ./$arg ;;
slouken@729
  1214
		esac
slouken@729
  1215
slouken@729
  1216
		if test -z "$pic_object" || \
slouken@729
  1217
		   test -z "$non_pic_object" ||
slouken@729
  1218
		   test "$pic_object" = none && \
slouken@729
  1219
		   test "$non_pic_object" = none; then
slouken@729
  1220
		  $echo "$modename: cannot find name of object for \`$arg'" 1>&2
slouken@947
  1221
		  exit $EXIT_FAILURE
slouken@729
  1222
		fi
slouken@729
  1223
slouken@729
  1224
		# Extract subdirectory from the argument.
slouken@729
  1225
		xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
slouken@729
  1226
		if test "X$xdir" = "X$arg"; then
slouken@729
  1227
		  xdir=
slouken@729
  1228
		else
slouken@729
  1229
		  xdir="$xdir/"
slouken@729
  1230
		fi
slouken@729
  1231
slouken@729
  1232
		if test "$pic_object" != none; then
slouken@729
  1233
		  # Prepend the subdirectory the object is found in.
slouken@729
  1234
		  pic_object="$xdir$pic_object"
slouken@729
  1235
slouken@729
  1236
		  if test "$prev" = dlfiles; then
slouken@729
  1237
		    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
slouken@729
  1238
		      dlfiles="$dlfiles $pic_object"
slouken@729
  1239
		      prev=
slouken@729
  1240
		      continue
slouken@729
  1241
		    else
slouken@729
  1242
		      # If libtool objects are unsupported, then we need to preload.
slouken@729
  1243
		      prev=dlprefiles
slouken@729
  1244
		    fi
slouken@729
  1245
		  fi
slouken@729
  1246
slouken@729
  1247
		  # CHECK ME:  I think I busted this.  -Ossama
slouken@729
  1248
		  if test "$prev" = dlprefiles; then
slouken@729
  1249
		    # Preload the old-style object.
slouken@729
  1250
		    dlprefiles="$dlprefiles $pic_object"
slouken@729
  1251
		    prev=
slouken@729
  1252
		  fi
slouken@729
  1253
slouken@729
  1254
		  # A PIC object.
slouken@729
  1255
		  libobjs="$libobjs $pic_object"
slouken@729
  1256
		  arg="$pic_object"
slouken@729
  1257
		fi
slouken@729
  1258
slouken@729
  1259
		# Non-PIC object.
slouken@729
  1260
		if test "$non_pic_object" != none; then
slouken@729
  1261
		  # Prepend the subdirectory the object is found in.
slouken@729
  1262
		  non_pic_object="$xdir$non_pic_object"
slouken@729
  1263
slouken@729
  1264
		  # A standard non-PIC object
slouken@729
  1265
		  non_pic_objects="$non_pic_objects $non_pic_object"
slouken@729
  1266
		  if test -z "$pic_object" || test "$pic_object" = none ; then
slouken@729
  1267
		    arg="$non_pic_object"
slouken@729
  1268
		  fi
slouken@729
  1269
		fi
slouken@729
  1270
	      else
slouken@729
  1271
		# Only an error if not doing a dry-run.
slouken@729
  1272
		if test -z "$run"; then
slouken@729
  1273
		  $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
slouken@947
  1274
		  exit $EXIT_FAILURE
slouken@729
  1275
		else
slouken@729
  1276
		  # Dry-run case.
slouken@729
  1277
slouken@729
  1278
		  # Extract subdirectory from the argument.
slouken@729
  1279
		  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
slouken@729
  1280
		  if test "X$xdir" = "X$arg"; then
slouken@729
  1281
		    xdir=
slouken@729
  1282
		  else
slouken@729
  1283
		    xdir="$xdir/"
slouken@729
  1284
		  fi
slouken@729
  1285
slouken@729
  1286
		  pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
slouken@729
  1287
		  non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
slouken@729
  1288
		  libobjs="$libobjs $pic_object"
slouken@729
  1289
		  non_pic_objects="$non_pic_objects $non_pic_object"
slouken@729
  1290
		fi
slouken@729
  1291
	      fi
slouken@729
  1292
	    done
slouken@729
  1293
	  else
slouken@729
  1294
	    $echo "$modename: link input file \`$save_arg' does not exist"
slouken@947
  1295
	    exit $EXIT_FAILURE
slouken@729
  1296
	  fi
slouken@729
  1297
	  arg=$save_arg
slouken@729
  1298
	  prev=
slouken@729
  1299
	  continue
slouken@729
  1300
	  ;;
slouken@0
  1301
	rpath | xrpath)
slouken@0
  1302
	  # We need an absolute path.
slouken@729
  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@947
  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@729
  1324
	xcompiler)
slouken@729
  1325
	  compiler_flags="$compiler_flags $qarg"
slouken@729
  1326
	  prev=
slouken@729
  1327
	  compile_command="$compile_command $qarg"
slouken@729
  1328
	  finalize_command="$finalize_command $qarg"
slouken@729
  1329
	  continue
slouken@729
  1330
	  ;;
slouken@729
  1331
	xlinker)
slouken@729
  1332
	  linker_flags="$linker_flags $qarg"
slouken@729
  1333
	  compiler_flags="$compiler_flags $wl$qarg"
slouken@729
  1334
	  prev=
slouken@729
  1335
	  compile_command="$compile_command $wl$qarg"
slouken@729
  1336
	  finalize_command="$finalize_command $wl$qarg"
slouken@729
  1337
	  continue
slouken@729
  1338
	  ;;
slouken@729
  1339
	xcclinker)
slouken@729
  1340
	  linker_flags="$linker_flags $qarg"
slouken@729
  1341
	  compiler_flags="$compiler_flags $qarg"
slouken@729
  1342
	  prev=
slouken@729
  1343
	  compile_command="$compile_command $qarg"
slouken@729
  1344
	  finalize_command="$finalize_command $qarg"
slouken@729
  1345
	  continue
slouken@729
  1346
	  ;;
slouken@741
  1347
	framework)
slouken@741
  1348
	  case $host in
slouken@741
  1349
	    *-*-darwin*)
slouken@741
  1350
	      case "$deplibs " in
slouken@741
  1351
	        *" $qarg.framework "*) ;;
slouken@741
  1352
		*) deplibs="$deplibs $qarg.framework" # this is fixed later
slouken@741
  1353
		   ;;
slouken@741
  1354
              esac
slouken@741
  1355
              ;;
slouken@741
  1356
   	  esac
slouken@947
  1357
 	  prev=
slouken@947
  1358
 	  continue
slouken@947
  1359
 	  ;;
slouken@947
  1360
	shrext)
slouken@947
  1361
  	  shrext_cmds="$arg"
slouken@741
  1362
	  prev=
slouken@741
  1363
	  continue
slouken@741
  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@729
  1371
      fi # test -n "$prev"
slouken@0
  1372
slouken@0
  1373
      prevarg="$arg"
slouken@0
  1374
slouken@729
  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@729
  1412
	  $echo "$modename: more than one -exported-symbols argument is not allowed"
slouken@947
  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@729
  1423
      -inst-prefix-dir)
slouken@729
  1424
	prev=inst_prefix
slouken@729
  1425
	continue
slouken@729
  1426
	;;
slouken@729
  1427
slouken@729
  1428
      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
slouken@729
  1429
      # so, if we see these flags be careful not to treat them like -L
slouken@729
  1430
      -L[A-Z][A-Z]*:*)
slouken@729
  1431
	case $with_gcc/$host in
slouken@729
  1432
	no/*-*-irix* | /*-*-irix*)
slouken@729
  1433
	  compile_command="$compile_command $arg"
slouken@729
  1434
	  finalize_command="$finalize_command $arg"
slouken@729
  1435
	  ;;
slouken@729
  1436
	esac
slouken@387
  1437
	continue
slouken@387
  1438
	;;
slouken@387
  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@729
  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@729
  1448
	    $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
slouken@947
  1449
	    exit $EXIT_FAILURE
slouken@0
  1450
	  fi
slouken@0
  1451
	  dir="$absdir"
slouken@0
  1452
	  ;;
slouken@0
  1453
	esac
slouken@729
  1454
	case "$deplibs " in
slouken@729
  1455
	*" -L$dir "*) ;;
slouken@729
  1456
	*)
slouken@729
  1457
	  deplibs="$deplibs -L$dir"
slouken@729
  1458
	  lib_search_path="$lib_search_path $dir"
slouken@729
  1459
	  ;;
slouken@0
  1460
	esac
slouken@729
  1461
	case $host in
slouken@729
  1462
	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
slouken@729
  1463
	  case :$dllsearchpath: in
slouken@729
  1464
	  *":$dir:"*) ;;
slouken@729
  1465
	  *) dllsearchpath="$dllsearchpath:$dir";;
slouken@0
  1466
	  esac
slouken@0
  1467
	  ;;
slouken@0
  1468
	esac
slouken@729
  1469
	continue
slouken@0
  1470
	;;
slouken@0
  1471
slouken@0
  1472
      -l*)
slouken@729
  1473
	if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
slouken@729
  1474
	  case $host in
slouken@729
  1475
	  *-*-cygwin* | *-*-pw32* | *-*-beos*)
slouken@729
  1476
	    # These systems don't actually have a C or math library (as such)
slouken@0
  1477
	    continue
slouken@0
  1478
	    ;;
slouken@729
  1479
	  *-*-mingw* | *-*-os2*)
slouken@729
  1480
	    # These systems don't actually have a C library (as such)
slouken@729
  1481
	    test "X$arg" = "X-lc" && continue
slouken@729
  1482
	    ;;
slouken@729
  1483
	  *-*-openbsd* | *-*-freebsd*)
slouken@729
  1484
	    # Do not include libc due to us having libc/libc_r.
slouken@729
  1485
	    test "X$arg" = "X-lc" && continue
slouken@729
  1486
	    ;;
slouken@729
  1487
	  *-*-rhapsody* | *-*-darwin1.[012])
slouken@729
  1488
	    # Rhapsody C and math libraries are in the System framework
slouken@729
  1489
	    deplibs="$deplibs -framework System"
slouken@729
  1490
	    continue
slouken@0
  1491
	  esac
slouken@729
  1492
	elif test "X$arg" = "X-lc_r"; then
slouken@729
  1493
	 case $host in
slouken@729
  1494
	 *-*-openbsd* | *-*-freebsd*)
slouken@729
  1495
	   # Do not include libc_r directly, use -pthread flag.
slouken@729
  1496
	   continue
slouken@729
  1497
	   ;;
slouken@729
  1498
	 esac
slouken@0
  1499
	fi
slouken@0
  1500
	deplibs="$deplibs $arg"
slouken@729
  1501
	continue
slouken@0
  1502
	;;
slouken@0
  1503
slouken@947
  1504
     -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
slouken@947
  1505
	deplibs="$deplibs $arg"
slouken@947
  1506
	continue
slouken@947
  1507
	;;
slouken@947
  1508
slouken@0
  1509
      -module)
slouken@0
  1510
	module=yes
slouken@0
  1511
	continue
slouken@0
  1512
	;;
slouken@0
  1513
slouken@729
  1514
      # gcc -m* arguments should be passed to the linker via $compiler_flags
slouken@729
  1515
      # in order to pass architecture information to the linker
slouken@729
  1516
      # (e.g. 32 vs 64-bit).  This may also be accomplished via -Wl,-mfoo
slouken@729
  1517
      # but this is not reliable with gcc because gcc may use -mfoo to
slouken@729
  1518
      # select a different linker, different libraries, etc, while
slouken@729
  1519
      # -Wl,-mfoo simply passes -mfoo to the linker.
slouken@729
  1520
      -m*)
slouken@729
  1521
	# Unknown arguments in both finalize_command and compile_command need
slouken@729
  1522
	# to be aesthetically quoted because they are evaled later.
slouken@729
  1523
	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
slouken@729
  1524
	case $arg in
slouken@729
  1525
	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
slouken@729
  1526
	  arg="\"$arg\""
slouken@729
  1527
	  ;;
slouken@729
  1528
	esac
slouken@729
  1529
        compile_command="$compile_command $arg"
slouken@729
  1530
        finalize_command="$finalize_command $arg"
slouken@729
  1531
        if test "$with_gcc" = "yes" ; then
slouken@729
  1532
          compiler_flags="$compiler_flags $arg"
slouken@729
  1533
        fi
slouken@729
  1534
        continue
slouken@729
  1535
        ;;
slouken@729
  1536
slouken@729
  1537
      -shrext)
slouken@729
  1538
	prev=shrext
slouken@729
  1539
	continue
slouken@729
  1540
	;;
slouken@729
  1541
slouken@729
  1542
      -no-fast-install)
slouken@729
  1543
	fast_install=no
slouken@729
  1544
	continue
slouken@729
  1545
	;;
slouken@729
  1546
slouken@729
  1547
      -no-install)
slouken@729
  1548
	case $host in
slouken@729
  1549
	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
slouken@729
  1550
	  # The PATH hackery in wrapper scripts is required on Windows
slouken@729
  1551
	  # in order for the loader to find any dlls it needs.
slouken@729
  1552
	  $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
slouken@729
  1553
	  $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
slouken@729
  1554
	  fast_install=no
slouken@729
  1555
	  ;;
slouken@729
  1556
	*) no_install=yes ;;
slouken@729
  1557
	esac
slouken@729
  1558
	continue
slouken@729
  1559
	;;
slouken@729
  1560
slouken@0
  1561
      -no-undefined)
slouken@0
  1562
	allow_undefined=no
slouken@0
  1563
	continue
slouken@0
  1564
	;;
slouken@0
  1565
slouken@729
  1566
      -objectlist)
slouken@729
  1567
	prev=objectlist
slouken@729
  1568
	continue
slouken@729
  1569
	;;
slouken@729
  1570
slouken@0
  1571
      -o) prev=output ;;
slouken@0
  1572
slouken@947
  1573
      -precious-files-regex)
slouken@947
  1574
	prev=precious_regex
slouken@947
  1575
	continue
slouken@947
  1576
	;;
slouken@947
  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@729
  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@947
  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@729
  1611
	# The effects of -static are defined in a previous loop.
slouken@729
  1612
	# We used to do the same as -all-static on platforms that
slouken@729
  1613
	# didn't have a PIC flag, but the assumption that the effects
slouken@729
  1614
	# would be equivalent was wrong.  It would break on at least
slouken@729
  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@729
  1628
      -version-number)
slouken@729
  1629
	prev=vinfo
slouken@729
  1630
	vinfo_number=yes
slouken@729
  1631
	continue
slouken@729
  1632
	;;
slouken@729
  1633
slouken@729
  1634
      -Wc,*)
slouken@729
  1635
	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
slouken@729
  1636
	arg=
slouken@729
  1637
	save_ifs="$IFS"; IFS=','
slouken@729
  1638
	for flag in $args; do
slouken@729
  1639
	  IFS="$save_ifs"
slouken@729
  1640
	  case $flag in
slouken@729
  1641
	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
slouken@729
  1642
	    flag="\"$flag\""
slouken@729
  1643
	    ;;
slouken@729
  1644
	  esac
slouken@729
  1645
	  arg="$arg $wl$flag"
slouken@729
  1646
	  compiler_flags="$compiler_flags $flag"
slouken@729
  1647
	done
slouken@729
  1648
	IFS="$save_ifs"
slouken@729
  1649
	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
slouken@729
  1650
	;;
slouken@729
  1651
slouken@729
  1652
      -Wl,*)
slouken@729
  1653
	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
slouken@729
  1654
	arg=
slouken@729
  1655
	save_ifs="$IFS"; IFS=','
slouken@729
  1656
	for flag in $args; do
slouken@729
  1657
	  IFS="$save_ifs"
slouken@729
  1658
	  case $flag in
slouken@729
  1659
	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
slouken@729
  1660
	    flag="\"$flag\""
slouken@729
  1661
	    ;;
slouken@729
  1662
	  esac
slouken@729
  1663
	  arg="$arg $wl$flag"
slouken@729
  1664
	  compiler_flags="$compiler_flags $wl$flag"
slouken@729
  1665
	  linker_flags="$linker_flags $flag"
slouken@729
  1666
	done
slouken@729
  1667
	IFS="$save_ifs"
slouken@729
  1668
	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
slouken@729
  1669
	;;
slouken@729
  1670
slouken@729
  1671
      -Xcompiler)
slouken@729
  1672
	prev=xcompiler
slouken@729
  1673
	continue
slouken@729
  1674
	;;
slouken@729
  1675
slouken@729
  1676
      -Xlinker)
slouken@729
  1677
	prev=xlinker
slouken@729
  1678
	continue
slouken@729
  1679
	;;
slouken@729
  1680
slouken@729
  1681
      -XCClinker)
slouken@729
  1682
	prev=xcclinker
slouken@729
  1683
	continue
slouken@729
  1684
	;;
slouken@0
  1685
slouken@741
  1686
      -framework)
slouken@741
  1687
        prev=framework
slouken@741
  1688
	continue
slouken@741
  1689
	;;
slouken@741
  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@729
  1696
	case $arg in
slouken@729
  1697
	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
slouken@0
  1698
	  arg="\"$arg\""
slouken@0
  1699
	  ;;
slouken@0
  1700
	esac
slouken@0
  1701
	;;
slouken@0
  1702
slouken@729
  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@729
  1709
	# A libtool-controlled object.
slouken@729
  1710
slouken@729
  1711
	# Check to see that this really is a libtool object.
slouken@729
  1712
	if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
slouken@729
  1713
	  pic_object=
slouken@729
  1714
	  non_pic_object=
slouken@729
  1715
slouken@729
  1716
	  # Read the .lo file
slouken@729
  1717
	  # If there is no directory component, then add one.
slouken@729
  1718
	  case $arg in
slouken@729
  1719
	  */* | *\\*) . $arg ;;
slouken@729
  1720
	  *) . ./$arg ;;
slouken@729
  1721
	  esac
slouken@729
  1722
slouken@729
  1723
	  if test -z "$pic_object" || \
slouken@729
  1724
	     test -z "$non_pic_object" ||
slouken@729
  1725
	     test "$pic_object" = none && \
slouken@729
  1726
	     test "$non_pic_object" = none; then
slouken@729
  1727
	    $echo "$modename: cannot find name of object for \`$arg'" 1>&2
slouken@947
  1728
	    exit $EXIT_FAILURE
slouken@729
  1729
	  fi
slouken@729
  1730
slouken@729
  1731
	  # Extract subdirectory from the argument.
slouken@729
  1732
	  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
slouken@729
  1733
	  if test "X$xdir" = "X$arg"; then
slouken@729
  1734
	    xdir=
slouken@729
  1735
 	  else
slouken@729
  1736
	    xdir="$xdir/"
slouken@729
  1737
	  fi
slouken@729
  1738
slouken@729
  1739
	  if test "$pic_object" != none; then
slouken@729
  1740
	    # Prepend the subdirectory the object is found in.
slouken@729
  1741
	    pic_object="$xdir$pic_object"
slouken@729
  1742
slouken@729
  1743
	    if test "$prev" = dlfiles; then
slouken@729
  1744
	      if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
slouken@729
  1745
		dlfiles="$dlfiles $pic_object"
slouken@729
  1746
		prev=
slouken@729
  1747
		continue
slouken@729
  1748
	      else
slouken@729
  1749
		# If libtool objects are unsupported, then we need to preload.
slouken@729
  1750
		prev=dlprefiles
slouken@729
  1751
	      fi
slouken@729
  1752
	    fi
slouken@729
  1753
slouken@729
  1754
	    # CHECK ME:  I think I busted this.  -Ossama
slouken@729
  1755
	    if test "$prev" = dlprefiles; then
slouken@729
  1756
	      # Preload the old-style object.
slouken@729
  1757
	      dlprefiles="$dlprefiles $pic_object"
slouken@729
  1758
	      prev=
slouken@729
  1759
	    fi
slouken@729
  1760
slouken@729
  1761
	    # A PIC object.
slouken@729
  1762
	    libobjs="$libobjs $pic_object"
slouken@729
  1763
	    arg="$pic_object"
slouken@729
  1764
	  fi
slouken@729
  1765
slouken@729
  1766
	  # Non-PIC object.
slouken@729
  1767
	  if test "$non_pic_object" != none; then
slouken@729
  1768
	    # Prepend the subdirectory the object is found in.
slouken@729
  1769
	    non_pic_object="$xdir$non_pic_object"
slouken@729
  1770
slouken@729
  1771
	    # A standard non-PIC object
slouken@729
  1772
	    non_pic_objects="$non_pic_objects $non_pic_object"
slouken@729
  1773
	    if test -z "$pic_object" || test "$pic_object" = none ; then
slouken@729
  1774
	      arg="$non_pic_object"
slouken@729
  1775
	    fi
slouken@729
  1776
	  fi
slouken@729
  1777
	else
slouken@729
  1778
	  # Only an error if not doing a dry-run.
slouken@729
  1779
	  if test -z "$run"; then
slouken@729
  1780
	    $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
slouken@947
  1781
	    exit $EXIT_FAILURE
slouken@0
  1782
	  else
slouken@729
  1783
	    # Dry-run case.
slouken@729
  1784
slouken@729
  1785
	    # Extract subdirectory from the argument.
slouken@729
  1786
	    xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
slouken@729
  1787
	    if test "X$xdir" = "X$arg"; then
slouken@729
  1788
	      xdir=
slouken@729
  1789
	    else
slouken@729
  1790
	      xdir="$xdir/"
slouken@729
  1791
	    fi
slouken@729
  1792
slouken@729
  1793
	    pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
slouken@729
  1794
	    non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
slouken@729
  1795
	    libobjs="$libobjs $pic_object"
slouken@729
  1796
	    non_pic_objects="$non_pic_objects $non_pic_object"
slouken@0
  1797
	  fi
slouken@0
  1798
	fi
slouken@729
  1799
	;;
slouken@729
  1800
slouken@729
  1801
      *.$libext)
slouken@729
  1802
	# An archive.
slouken@729
  1803
	deplibs="$deplibs $arg"
slouken@729
  1804
	old_deplibs="$old_deplibs $arg"
slouken@729
  1805
	continue
slouken@0
  1806
	;;
slouken@0
  1807
slouken@0
  1808
      *.la)
slouken@0
  1809
	# A libtool-controlled library.
slouken@0
  1810
slouken@729
  1811
	if test "$prev" = dlfiles; then
slouken@729
  1812
	  # This library was specified with -dlopen.
slouken@729
  1813
	  dlfiles="$dlfiles $arg"
slouken@729
  1814
	  prev=
slouken@729
  1815
	elif test "$prev" = dlprefiles; then
slouken@729
  1816
	  # The library was specified with -dlpreopen.
slouken@729
  1817
	  dlprefiles="$dlprefiles $arg"
slouken@729
  1818
	  prev=
slouken@729
  1819
	else
slouken@729
  1820
	  deplibs="$deplibs $arg"
slouken@729
  1821
	fi
slouken@729
  1822
	continue
slouken@729
  1823
	;;
slouken@729
  1824
slouken@729
  1825
      # Some other compiler argument.
slouken@729
  1826
      *)
slouken@729
  1827
	# Unknown arguments in both finalize_command and compile_command need
slouken@729
  1828
	# to be aesthetically quoted because they are evaled later.
slouken@729
  1829
	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
slouken@729
  1830
	case $arg in
slouken@729
  1831
	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
slouken@729
  1832
	  arg="\"$arg\""
slouken@729
  1833
	  ;;
slouken@729
  1834
	esac
slouken@729
  1835
	;;
slouken@729
  1836
      esac # arg
slouken@729
  1837
slouken@729
  1838
      # Now actually substitute the argument into the commands.
slouken@729
  1839
      if test -n "$arg"; then
slouken@729
  1840
	compile_command="$compile_command $arg"
slouken@729
  1841
	finalize_command="$finalize_command $arg"
slouken@729
  1842
      fi
slouken@729
  1843
    done # argument parsing loop
slouken@729
  1844
slouken@729
  1845
    if test -n "$prev"; then
slouken@729
  1846
      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
slouken@729
  1847
      $echo "$help" 1>&2
slouken@947
  1848
      exit $EXIT_FAILURE
slouken@729
  1849
    fi
slouken@729
  1850
slouken@729
  1851
    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
slouken@729
  1852
      eval arg=\"$export_dynamic_flag_spec\"
slouken@729
  1853
      compile_command="$compile_command $arg"
slouken@729
  1854
      finalize_command="$finalize_command $arg"
slouken@729
  1855
    fi
slouken@729
  1856
slouken@729
  1857
    oldlibs=
slouken@729
  1858
    # calculate the name of the file, without its directory
slouken@729
  1859
    outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
slouken@729
  1860
    libobjs_save="$libobjs"
slouken@729
  1861
slouken@729
  1862
    if test -n "$shlibpath_var"; then
slouken@729
  1863
      # get the directories listed in $shlibpath_var
slouken@729
  1864
      eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
slouken@729
  1865
    else
slouken@729
  1866
      shlib_search_path=
slouken@729
  1867
    fi
slouken@729
  1868
    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
slouken@729
  1869
    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
slouken@729
  1870
slouken@729
  1871
    output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
slouken@729
  1872
    if test "X$output_objdir" = "X$output"; then
slouken@729
  1873
      output_objdir="$objdir"
slouken@729
  1874
    else
slouken@729
  1875
      output_objdir="$output_objdir/$objdir"
slouken@729
  1876
    fi
slouken@729
  1877
    # Create the object directory.
slouken@729
  1878
    if test ! -d "$output_objdir"; then
slouken@729
  1879
      $show "$mkdir $output_objdir"
slouken@729
  1880
      $run $mkdir $output_objdir
slouken@729
  1881
      status=$?
slouken@729
  1882
      if test "$status" -ne 0 && test ! -d "$output_objdir"; then
slouken@729
  1883
	exit $status
slouken@729
  1884
      fi
slouken@729
  1885
    fi
slouken@729
  1886
slouken@729
  1887
    # Determine the type of output
slouken@729
  1888
    case $output in
slouken@729
  1889
    "")
slouken@729
  1890
      $echo "$modename: you must specify an output file" 1>&2
slouken@729
  1891
      $echo "$help" 1>&2
slouken@947
  1892
      exit $EXIT_FAILURE
slouken@729
  1893
      ;;
slouken@729
  1894
    *.$libext) linkmode=oldlib ;;
slouken@729
  1895
    *.lo | *.$objext) linkmode=obj ;;
slouken@729
  1896
    *.la) linkmode=lib ;;
slouken@729
  1897
    *) linkmode=prog ;; # Anything else should be a program.
slouken@729
  1898
    esac
slouken@729
  1899
slouken@729
  1900
    case $host in
slouken@729
  1901
    *cygwin* | *mingw* | *pw32*)
slouken@947
  1902
      # don't eliminate duplications in $postdeps and $predeps
slouken@729
  1903
      duplicate_compiler_generated_deps=yes
slouken@729
  1904
      ;;
slouken@729
  1905
    *)
slouken@729
  1906
      duplicate_compiler_generated_deps=$duplicate_deps
slouken@729
  1907
      ;;
slouken@729
  1908
    esac
slouken@729
  1909
    specialdeplibs=
slouken@729
  1910
slouken@729
  1911
    libs=
slouken@729
  1912
    # Find all interdependent deplibs by searching for libraries
slouken@729
  1913
    # that are linked more than once (e.g. -la -lb -la)
slouken@729
  1914
    for deplib in $deplibs; do
slouken@729
  1915
      if test "X$duplicate_deps" = "Xyes" ; then
slouken@729
  1916
	case "$libs " in
slouken@729
  1917
	*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
slouken@729
  1918
	esac
slouken@729
  1919
      fi
slouken@729
  1920
      libs="$libs $deplib"
slouken@729
  1921
    done
slouken@729
  1922
slouken@729
  1923
    if test "$linkmode" = lib; then
slouken@729
  1924
      libs="$predeps $libs $compiler_lib_search_path $postdeps"
slouken@729
  1925
slouken@729
  1926
      # Compute libraries that are listed more than once in $predeps
slouken@729
  1927
      # $postdeps and mark them as special (i.e., whose duplicates are
slouken@729
  1928
      # not to be eliminated).
slouken@729
  1929
      pre_post_deps=
slouken@729
  1930
      if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
slouken@729
  1931
	for pre_post_dep in $predeps $postdeps; do
slouken@729
  1932
	  case "$pre_post_deps " in
slouken@729
  1933
	  *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
slouken@729
  1934
	  esac
slouken@729
  1935
	  pre_post_deps="$pre_post_deps $pre_post_dep"
slouken@729
  1936
	done
slouken@729
  1937
      fi
slouken@729
  1938
      pre_post_deps=
slouken@729
  1939
    fi
slouken@729
  1940
slouken@729
  1941
    deplibs=
slouken@729
  1942
    newdependency_libs=
slouken@729
  1943
    newlib_search_path=
slouken@729
  1944
    need_relink=no # whether we're linking any uninstalled libtool libraries
slouken@729
  1945
    notinst_deplibs= # not-installed libtool libraries
slouken@729
  1946
    notinst_path= # paths that contain not-installed libtool libraries
slouken@729
  1947
    case $linkmode in
slouken@729
  1948
    lib)
slouken@729
  1949
	passes="conv link"
slouken@729
  1950
	for file in $dlfiles $dlprefiles; do
slouken@729
  1951
	  case $file in
slouken@729
  1952
	  *.la) ;;
slouken@729
  1953
	  *)
slouken@729
  1954
	    $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
slouken@947
  1955
	    exit $EXIT_FAILURE
slouken@729
  1956
	    ;;
slouken@729
  1957
	  esac
slouken@729
  1958
	done
slouken@729
  1959
	;;
slouken@729
  1960
    prog)
slouken@729
  1961
	compile_deplibs=
slouken@729
  1962
	finalize_deplibs=
slouken@729
  1963
	alldeplibs=no
slouken@729
  1964
	newdlfiles=
slouken@729
  1965
	newdlprefiles=
slouken@729
  1966
	passes="conv scan dlopen dlpreopen link"
slouken@729
  1967
	;;
slouken@729
  1968
    *)  passes="conv"
slouken@729
  1969
	;;
slouken@729
  1970
    esac
slouken@729
  1971
    for pass in $passes; do
slouken@729
  1972
      if test "$linkmode,$pass" = "lib,link" ||
slouken@729
  1973
	 test "$linkmode,$pass" = "prog,scan"; then
slouken@729
  1974
	libs="$deplibs"
slouken@729
  1975
	deplibs=
slouken@729
  1976
      fi
slouken@729
  1977
      if test "$linkmode" = prog; then
slouken@729
  1978
	case $pass in
slouken@729
  1979
	dlopen) libs="$dlfiles" ;;
slouken@729
  1980
	dlpreopen) libs="$dlprefiles" ;;
slouken@729
  1981
	link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
slouken@729
  1982
	esac
slouken@729
  1983
      fi
slouken@729
  1984
      if test "$pass" = dlopen; then
slouken@729
  1985
	# Collect dlpreopened libraries
slouken@729
  1986
	save_deplibs="$deplibs"
slouken@729
  1987
	deplibs=
slouken@729
  1988
      fi
slouken@729
  1989
      for deplib in $libs; do
slouken@729
  1990
	lib=
slouken@729
  1991
	found=no
slouken@729
  1992
	case $deplib in
slouken@947
  1993
	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
slouken@947
  1994
	  if test "$linkmode,$pass" = "prog,link"; then
slouken@947
  1995
	    compile_deplibs="$deplib $compile_deplibs"
slouken@947
  1996
	    finalize_deplibs="$deplib $finalize_deplibs"
slouken@947
  1997
	  else
slouken@947
  1998
	    deplibs="$deplib $deplibs"
slouken@947
  1999
	  fi
slouken@947
  2000
	  continue
slouken@947
  2001
	  ;;
slouken@729
  2002
	-l*)
slouken@729
  2003
	  if test "$linkmode" != lib && test "$linkmode" != prog; then
slouken@729
  2004
	    $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
slouken@729
  2005
	    continue
slouken@729
  2006
	  fi
slouken@729
  2007
	  if test "$pass" = conv; then
slouken@729
  2008
	    deplibs="$deplib $deplibs"
slouken@729
  2009
	    continue
slouken@729
  2010
	  fi
slouken@729
  2011
	  name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
slouken@729
  2012
	  for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
slouken@947
  2013
	    for search_ext in .la $std_shrext .so .a; do
slouken@947
  2014
	      # Search the libtool library
slouken@947
  2015
	      lib="$searchdir/lib${name}${search_ext}"
slouken@947
  2016
	      if test -f "$lib"; then
slouken@947
  2017
		if test "$search_ext" = ".la"; then
slouken@947
  2018
		  found=yes
slouken@947
  2019
		else
slouken@947
  2020
		  found=no
slouken@947
  2021
		fi
slouken@947
  2022
		break 2
slouken@947
  2023
	      fi
slouken@947
  2024
	    done
slouken@729
  2025
	  done
slouken@729
  2026
	  if test "$found" != yes; then
slouken@729
  2027
	    # deplib doesn't seem to be a libtool library
slouken@729
  2028
	    if test "$linkmode,$pass" = "prog,link"; then
slouken@729
  2029
	      compile_deplibs="$deplib $compile_deplibs"
slouken@729
  2030
	      finalize_deplibs="$deplib $finalize_deplibs"
slouken@729
  2031
	    else
slouken@729
  2032
	      deplibs="$deplib $deplibs"
slouken@729
  2033
	      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
slouken@729
  2034
	    fi
slouken@729
  2035
	    continue
slouken@729
  2036
	  else # deplib is a libtool library
slouken@729
  2037
	    # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
slouken@729
  2038
	    # We need to do some special things here, and not later.
slouken@729
  2039
	    if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
slouken@729
  2040
	      case " $predeps $postdeps " in
slouken@729
  2041
	      *" $deplib "*)
slouken@729
  2042
		if (${SED} -e '2q' $lib |
slouken@729
  2043
                    grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
slouken@729
  2044
		  library_names=
slouken@729
  2045
		  old_library=
slouken@729
  2046
		  case $lib in
slouken@729
  2047
		  */* | *\\*) . $lib ;;
slouken@729
  2048
		  *) . ./$lib ;;
slouken@729
  2049
		  esac
slouken@729
  2050
		  for l in $old_library $library_names; do
slouken@729
  2051
		    ll="$l"
slouken@729
  2052
		  done
slouken@729
  2053
		  if test "X$ll" = "X$old_library" ; then # only static version available
slouken@729
  2054
		    found=no
slouken@729
  2055
		    ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
slouken@729
  2056
		    test "X$ladir" = "X$lib" && ladir="."
slouken@729
  2057
		    lib=$ladir/$old_library
slouken@729
  2058
		    if test "$linkmode,$pass" = "prog,link"; then
slouken@729
  2059
		      compile_deplibs="$deplib $compile_deplibs"
slouken@729
  2060
		      finalize_deplibs="$deplib $finalize_deplibs"
slouken@729
  2061
		    else
slouken@729
  2062
		      deplibs="$deplib $deplibs"
slouken@729
  2063
		      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
slouken@729
  2064
		    fi
slouken@729
  2065
		    continue
slouken@729
  2066
		  fi
slouken@729
  2067
		fi
slouken@729
  2068
	        ;;
slouken@729
  2069
	      *) ;;
slouken@729
  2070
	      esac
slouken@729
  2071
	    fi
slouken@729
  2072
	  fi
slouken@729
  2073
	  ;; # -l
slouken@741
  2074
	*.framework)
slouken@741
  2075
	  if test "$linkmode,$pass" = "prog,link"; then
slouken@741
  2076
	    compile_deplibs="$deplib $compile_deplibs"
slouken@741
  2077
	    finalize_deplibs="$deplib $finalize_deplibs"
slouken@741
  2078
	  else
slouken@741
  2079
	    deplibs="$deplib $deplibs"
slouken@741
  2080
	    if test "$linkmode" = lib ; then
slouken@741
  2081
	      newdependency_libs="$deplib $newdependency_libs"
slouken@741
  2082
	    fi
slouken@741
  2083
	  fi
slouken@741
  2084
	  continue
slouken@741
  2085
	  ;;
slouken@729
  2086
	-L*)
slouken@729
  2087
	  case $linkmode in
slouken@729
  2088
	  lib)
slouken@729
  2089
	    deplibs="$deplib $deplibs"
slouken@729
  2090
	    test "$pass" = conv && continue
slouken@729
  2091
	    newdependency_libs="$deplib $newdependency_libs"
slouken@729
  2092
	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
slouken@729
  2093
	    ;;
slouken@729
  2094
	  prog)
slouken@729
  2095
	    if test "$pass" = conv; then
slouken@729
  2096
	      deplibs="$deplib $deplibs"
slouken@729
  2097
	      continue
slouken@729
  2098
	    fi
slouken@729
  2099
	    if test "$pass" = scan; then
slouken@729
  2100
	      deplibs="$deplib $deplibs"
slouken@729
  2101
	    else
slouken@729
  2102
	      compile_deplibs="$deplib $compile_deplibs"
slouken@729
  2103
	      finalize_deplibs="$deplib $finalize_deplibs"
slouken@729
  2104
	    fi
slouken@947
  2105
	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
slouken@729
  2106
	    ;;
slouken@729
  2107
	  *)
slouken@729
  2108
	    $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
slouken@729
  2109
	    ;;
slouken@729
  2110
	  esac # linkmode
slouken@729
  2111
	  continue
slouken@729
  2112
	  ;; # -L
slouken@729
  2113
	-R*)
slouken@729
  2114
	  if test "$pass" = link; then
slouken@729
  2115
	    dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
slouken@729
  2116
	    # Make sure the xrpath contains only unique directories.
slouken@729
  2117
	    case "$xrpath " in
slouken@729
  2118
	    *" $dir "*) ;;
slouken@729
  2119
	    *) xrpath="$xrpath $dir" ;;
slouken@729
  2120
	    esac
slouken@729
  2121
	  fi
slouken@729
  2122
	  deplibs="$deplib $deplibs"
slouken@729
  2123
	  continue
slouken@729
  2124
	  ;;
slouken@729
  2125
	*.la) lib="$deplib" ;;
slouken@729
  2126
	*.$libext)
slouken@729
  2127
	  if test "$pass" = conv; then
slouken@729
  2128
	    deplibs="$deplib $deplibs"
slouken@729
  2129
	    continue
slouken@729
  2130
	  fi
slouken@729
  2131
	  case $linkmode in
slouken@729
  2132
	  lib)
slouken@947
  2133
	    valid_a_lib=no
slouken@947
  2134
	    case $deplibs_check_method in
slouken@947
  2135
	      match_pattern*)
slouken@947
  2136
		set dummy $deplibs_check_method
slouken@947
  2137
	        match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
slouken@947
  2138
		if eval $echo \"$deplib\" 2>/dev/null \
slouken@947
  2139
		    | $SED 10q \
slouken@947
  2140
		    | $EGREP "$match_pattern_regex" > /dev/null; then
slouken@947
  2141
		  valid_a_lib=yes
slouken@947
  2142
		fi
slouken@947
  2143
		;;
slouken@947
  2144
	      pass_all)
slouken@947
  2145
		valid_a_lib=yes
slouken@947
  2146
		;;
slouken@947
  2147
            esac
slouken@947
  2148
	    if test "$valid_a_lib" != yes; then
slouken@729
  2149
	      $echo
slouken@729
  2150
	      $echo "*** Warning: Trying to link with static lib archive $deplib."
slouken@729
  2151
	      $echo "*** I have the capability to make that library automatically link in when"
slouken@729
  2152
	      $echo "*** you link to this library.  But I can only do this if you have a"
slouken@729
  2153
	      $echo "*** shared version of the library, which you do not appear to have"
slouken@729
  2154
	      $echo "*** because the file extensions .$libext of this argument makes me believe"
slouken@729
  2155
	      $echo "*** that it is just a static archive that I should not used here."
slouken@729
  2156
	    else
slouken@729
  2157
	      $echo
slouken@729
  2158
	      $echo "*** Warning: Linking the shared library $output against the"
slouken@729
  2159
	      $echo "*** static library $deplib is not portable!"
slouken@729
  2160
	      deplibs="$deplib $deplibs"
slouken@729
  2161
	    fi
slouken@729
  2162
	    continue
slouken@729
  2163
	    ;;
slouken@729
  2164
	  prog)
slouken@729
  2165
	    if test "$pass" != link; then
slouken@729
  2166
	      deplibs="$deplib $deplibs"
slouken@729
  2167
	    else
slouken@729
  2168
	      compile_deplibs="$deplib $compile_deplibs"
slouken@729
  2169
	      finalize_deplibs="$deplib $finalize_deplibs"
slouken@729
  2170
	    fi
slouken@729
  2171
	    continue
slouken@729
  2172
	    ;;
slouken@729
  2173
	  esac # linkmode
slouken@729
  2174
	  ;; # *.$libext
slouken@729
  2175
	*.lo | *.$objext)
slouken@729
  2176
	  if test "$pass" = conv; then
slouken@729
  2177
	    deplibs="$deplib $deplibs"
slouken@729
  2178
	  elif test "$linkmode" = prog; then
slouken@729
  2179
	    if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
slouken@729
  2180
	      # If there is no dlopen support or we're linking statically,
slouken@729
  2181
	      # we need to preload.
slouken@729
  2182
	      newdlprefiles="$newdlprefiles $deplib"
slouken@729
  2183
	      compile_deplibs="$deplib $compile_deplibs"
slouken@729
  2184
	      finalize_deplibs="$deplib $finalize_deplibs"
slouken@729
  2185
	    else
slouken@729
  2186
	      newdlfiles="$newdlfiles $deplib"
slouken@729
  2187
	    fi
slouken@729
  2188
	  fi
slouken@729
  2189
	  continue
slouken@729
  2190
	  ;;
slouken@729
  2191
	%DEPLIBS%)
slouken@729
  2192
	  alldeplibs=yes
slouken@729
  2193
	  continue
slouken@729
  2194
	  ;;
slouken@729
  2195
	esac # case $deplib
slouken@729
  2196
	if test "$found" = yes || test -f "$lib"; then :
slouken@729
  2197
	else
slouken@729
  2198
	  $echo "$modename: cannot find the library \`$lib'" 1>&2
slouken@947
  2199
	  exit $EXIT_FAILURE
slouken@729
  2200
	fi
slouken@729
  2201
slouken@729
  2202
	# Check to see that this really is a libtool archive.
slouken@729
  2203
	if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
slouken@729
  2204
	else
slouken@729
  2205
	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
slouken@947
  2206
	  exit $EXIT_FAILURE
slouken@729
  2207
	fi
slouken@729
  2208
slouken@729
  2209
	ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
slouken@729
  2210
	test "X$ladir" = "X$lib" && ladir="."
slouken@729
  2211
slouken@0
  2212
	dlname=
slouken@729
  2213
	dlopen=
slouken@729
  2214
	dlpreopen=
slouken@0
  2215
	libdir=
slouken@0
  2216
	library_names=
slouken@0
  2217
	old_library=
slouken@729
  2218
	# If the library was installed with an old release of libtool,
slouken@729
  2219
	# it will not redefine variables installed, or shouldnotlink
slouken@729
  2220
	installed=yes
slouken@729
  2221
	shouldnotlink=no
slouken@729
  2222
slouken@729
  2223
	# Read the .la file
slouken@729
  2224
	case $lib in
slouken@729
  2225
	*/* | *\\*) . $lib ;;
slouken@729
  2226
	*) . ./$lib ;;
slouken@729
  2227
	esac
slouken@729
  2228
slouken@741
  2229
	case $host in
slouken@741
  2230
	*-*-darwin*)
slouken@741
  2231
	  # Convert "-framework foo" to "foo.framework" in dependency_libs
slouken@741
  2232
	  test -n "$dependency_libs" && dependency_libs=`$echo "X$dependency_libs" | $Xsed -e 's/-framework \([^ $]*\)/\1.framework/g'`
slouken@741
  2233
	  ;;
slouken@741
  2234
	esac
slouken@741
  2235
slouken@729
  2236
	if test "$linkmode,$pass" = "lib,link" ||
slouken@729
  2237
	   test "$linkmode,$pass" = "prog,scan" ||
slouken@729
  2238
	   { test "$linkmode" != prog && test "$linkmode" != lib; }; then
slouken@729
  2239
	  test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
slouken@729
  2240
	  test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
slouken@0
  2241
	fi
slouken@0
  2242
slouken@729
  2243
	if test "$pass" = conv; then
slouken@729
  2244
	  # Only check for convenience libraries
slouken@729
  2245
	  deplibs="$lib $deplibs"
slouken@729
  2246
	  if test -z "$libdir"; then
slouken@729
  2247
	    if test -z "$old_library"; then
slouken@729
  2248
	      $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
slouken@947
  2249
	      exit $EXIT_FAILURE
slouken@729
  2250
	    fi
slouken@729
  2251
	    # It is a libtool convenience library, so add in its objects.
slouken@729
  2252
	    convenience="$convenience $ladir/$objdir/$old_library"
slouken@729
  2253
	    old_convenience="$old_convenience $ladir/$objdir/$old_library"
slouken@729
  2254
	    tmp_libs=
slouken@729
  2255
	    for deplib in $dependency_libs; do
slouken@729
  2256
	      deplibs="$deplib $deplibs"
slouken@729
  2257
              if test "X$duplicate_deps" = "Xyes" ; then
slouken@729
  2258
	        case "$tmp_libs " in
slouken@729
  2259
	        *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
slouken@729
  2260
	        esac
slouken@729
  2261
              fi
slouken@729
  2262
	      tmp_libs="$tmp_libs $deplib"
slouken@729
  2263
	    done
slouken@729
  2264
	  elif test "$linkmode" != prog && test "$linkmode" != lib; then
slouken@729
  2265
	    $echo "$modename: \`$lib' is not a convenience library" 1>&2
slouken@947
  2266
	    exit $EXIT_FAILURE
slouken@729
  2267
	  fi
slouken@729
  2268
	  continue
slouken@729
  2269
	fi # $pass = conv
slouken@729
  2270
slouken@947
  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@729
  2278
	  $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
slouken@947
  2279
	  exit $EXIT_FAILURE
slouken@0
  2280
	fi
slouken@0
  2281
slouken@729
  2282
	# This library was specified with -dlopen.
slouken@729
  2283
	if test "$pass" = dlopen; then
slouken@729
  2284
	  if test -z "$libdir"; then
slouken@729
  2285
	    $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
slouken@947
  2286
	    exit $EXIT_FAILURE
slouken@729
  2287
	  fi
slouken@947
  2288
	  if test -z "$dlname" ||
slouken@947
  2289
	     test "$dlopen_support" != yes ||
slouken@947
  2290
	     test "$build_libtool_libs" = no; then
slouken@729
  2291
	    # If there is no dlname, no dlopen support or we're linking
slouken@729
  2292
	    # statically, we need to preload.  We also need to preload any
slouken@729
  2293
	    # dependent libraries so libltdl's deplib preloader doesn't
slouken@729
  2294
	    # bomb out in the load deplibs phase.
slouken@729
  2295
	    dlprefiles="$dlprefiles $lib $dependency_libs"
slouken@729
  2296
	  else
slouken@729
  2297
	    newdlfiles="$newdlfiles $lib"
slouken@729
  2298
	  fi
slouken@729
  2299
	  continue
slouken@729
  2300
	fi # $pass = dlopen
slouken@729
  2301
slouken@729
  2302
	# We need an absolute path.
slouken@729
  2303
	case $ladir in
slouken@729
  2304
	[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
slouken@729
  2305
	*)
slouken@729
  2306
	  abs_ladir=`cd "$ladir" && pwd`
slouken@729
  2307
	  if test -z "$abs_ladir"; then
slouken@729
  2308
	    $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
slouken@729
  2309
	    $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
slouken@729
  2310
	    abs_ladir="$ladir"
slouken@729
  2311
	  fi
slouken@729
  2312
	  ;;
slouken@729
  2313
	esac
slouken@729
  2314
	laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
slouken@729
  2315
slouken@0
  2316
	# Find the relevant object directory and library name.
slouken@0
  2317
	if test "X$installed" = Xyes; then
slouken@729
  2318
	  if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
slouken@729
  2319
	    $echo "$modename: warning: library \`$lib' was moved." 1>&2
slouken@729
  2320
	    dir="$ladir"
slouken@729
  2321
	    absdir="$abs_ladir"
slouken@729
  2322
	    libdir="$abs_ladir"
slouken@729
  2323
	  else
slouken@729
  2324
	    dir="$libdir"
slouken@729
  2325
	    absdir="$libdir"
slouken@729
  2326
	  fi
slouken@0
  2327
	else
slouken@947
  2328
	  if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
slouken@947
  2329
	    dir="$ladir"
slouken@947
  2330
	    absdir="$abs_ladir"
slouken@947
  2331
	    # Remove this search path later
slouken@947
  2332
	    notinst_path="$notinst_path $abs_ladir"
slouken@947
  2333
	  else
slouken@947
  2334
	    dir="$ladir/$objdir"
slouken@947
  2335
	    absdir="$abs_ladir/$objdir"
slouken@947
  2336
	    # Remove this search path later
slouken@947
  2337
	    notinst_path="$notinst_path $abs_ladir"
slouken@947
  2338
	  fi
slouken@729
  2339
	fi # $installed = yes
slouken@729
  2340
	name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
slouken@729
  2341
slouken@729
  2342
	# This library was specified with -dlpreopen.
slouken@729
  2343
	if test "$pass" = dlpreopen; then
slouken@729
  2344
	  if test -z "$libdir"; then
slouken@729
  2345
	    $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
slouken@947
  2346
	    exit $EXIT_FAILURE
slouken@729
  2347
	  fi
slouken@729
  2348
	  # Prefer using a static library (so that no silly _DYNAMIC symbols
slouken@729
  2349
	  # are required to link).
slouken@729
  2350
	  if test -n "$old_library"; then
slouken@729
  2351
	    newdlprefiles="$newdlprefiles $dir/$old_library"
slouken@729
  2352
	  # Otherwise, use the dlname, so that lt_dlopen finds it.
slouken@729
  2353
	  elif test -n "$dlname"; then
slouken@729
  2354
	    newdlprefiles="$newdlprefiles $dir/$dlname"
slouken@0
  2355
	  else
slouken@729
  2356
	    newdlprefiles="$newdlprefiles $dir/$linklib"
slouken@0
  2357
	  fi
slouken@729
  2358
	fi # $pass = dlpreopen
slouken@0
  2359
slouken@0
  2360
	if test -z "$libdir"; then
slouken@729
  2361
	  # Link the convenience library
slouken@729
  2362
	  if test "$linkmode" = lib; then
slouken@729
  2363
	    deplibs="$dir/$old_library $deplibs"
slouken@729
  2364
	  elif test "$linkmode,$pass" = "prog,link"; then
slouken@729
  2365
	    compile_deplibs="$dir/$old_library $compile_deplibs"
slouken@729
  2366
	    finalize_deplibs="$dir/$old_library $finalize_deplibs"
slouken@729
  2367
	  else
slouken@729
  2368
	    deplibs="$lib $deplibs" # used for prog,scan pass
slouken@729
  2369
	  fi
slouken@0
  2370
	  continue
slouken@0
  2371
	fi
slouken@0
  2372
slouken@947
  2373
slouken@729
  2374
	if test "$linkmode" = prog && test "$pass" != link; then
slouken@729
  2375
	  newlib_search_path="$newlib_search_path $ladir"
slouken@729
  2376
	  deplibs="$lib $deplibs"
slouken@729
  2377
slouken@729
  2378
	  linkalldeplibs=no
slouken@729
  2379
	  if test "$link_all_deplibs" != no || test -z "$library_names" ||
slouken@729
  2380
	     test "$build_libtool_libs" = no; then
slouken@729
  2381
	    linkalldeplibs=yes
slouken@729
  2382
	  fi
slouken@729
  2383
slouken@729
  2384
	  tmp_libs=
slouken@729
  2385
	  for deplib in $dependency_libs; do
slouken@729
  2386
	    case $deplib in
slouken@729
  2387
	    -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
slouken@729
  2388
	    esac
slouken@729
  2389
	    # Need to link against all dependency_libs?
slouken@729
  2390
	    if test "$linkalldeplibs" = yes; then
slouken@729
  2391
	      deplibs="$deplib $deplibs"
slouken@729
  2392
	    else
slouken@729
  2393
	      # Need to hardcode shared library paths
slouken@729
  2394
	      # or/and link against static libraries
slouken@729
  2395
	      newdependency_libs="$deplib $newdependency_libs"
slouken@729
  2396
	    fi
slouken@729
  2397
	    if test "X$duplicate_deps" = "Xyes" ; then
slouken@729
  2398
	      case "$tmp_libs " in
slouken@729
  2399
	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
slouken@729
  2400
	      esac
slouken@729
  2401
	    fi
slouken@729
  2402
	    tmp_libs="$tmp_libs $deplib"
slouken@729
  2403
	  done # for deplib
slouken@729
  2404
	  continue
slouken@729
  2405
	fi # $linkmode = prog...
slouken@729
  2406
slouken@729
  2407
	if test "$linkmode,$pass" = "prog,link"; then
slouken@729
  2408
	  if test -n "$library_names" &&
slouken@729
  2409
	     { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
slouken@729
  2410
	    # We need to hardcode the library path
slouken@729
  2411
	    if test -n "$shlibpath_var"; then
slouken@729
  2412
	      # Make sure the rpath contains only unique directories.
slouken@729
  2413
	      case "$temp_rpath " in
slouken@729
  2414
	      *" $dir "*) ;;
slouken@729
  2415
	      *" $absdir "*) ;;
slouken@729
  2416
	      *) temp_rpath="$temp_rpath $dir" ;;
slouken@729
  2417
	      esac
slouken@729
  2418
	    fi
slouken@729
  2419
slouken@729
  2420
	    # Hardcode the library path.
slouken@729
  2421
	    # Skip directories that are in the system default run-time
slouken@729
  2422
	    # search path.
slouken@729
  2423
	    case " $sys_lib_dlsearch_path " in
slouken@729
  2424
	    *" $absdir "*) ;;
slouken@729
  2425
	    *)
slouken@729
  2426
	      case "$compile_rpath " in
slouken@729
  2427
	      *" $absdir "*) ;;
slouken@729
  2428
	      *) compile_rpath="$compile_rpath $absdir"
slouken@729
  2429
	      esac
slouken@729
  2430
	      ;;
slouken@729
  2431
	    esac
slouken@729
  2432
	    case " $sys_lib_dlsearch_path " in
slouken@729
  2433
	    *" $libdir "*) ;;
slouken@729
  2434
	    *)
slouken@729
  2435
	      case "$finalize_rpath " in
slouken@729
  2436
	      *" $libdir "*) ;;
slouken@729
  2437
	      *) finalize_rpath="$finalize_rpath $libdir"
slouken@729
  2438
	      esac
slouken@729
  2439
	      ;;
slouken@729
  2440
	    esac
slouken@729
  2441
	  fi # $linkmode,$pass = prog,link...
slouken@729
  2442
slouken@729
  2443
	  if test "$alldeplibs" = yes &&
slouken@729
  2444
	     { test "$deplibs_check_method" = pass_all ||
slouken@729
  2445
	       { test "$build_libtool_libs" = yes &&
slouken@729
  2446
		 test -n "$library_names"; }; }; then
slouken@729
  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@729
  2452
	link_static=no # Whether the deplib will be linked statically
slouken@0
  2453
	if test -n "$library_names" &&
slouken@0
  2454
	   { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
slouken@729
  2455
	  if test "$installed" = no; then
slouken@729
  2456
	    notinst_deplibs="$notinst_deplibs $lib"
slouken@729
  2457
	    need_relink=yes
slouken@729
  2458
	  fi
slouken@729
  2459
	  # This is a shared library
slouken@947
  2460
slouken@947
  2461
	  # Warn about portability, can't link against -module's on
slouken@947
  2462
	  # some systems (darwin)
slouken@947
  2463
	  if test "$shouldnotlink" = yes && test "$pass" = link ; then
slouken@729
  2464
	    $echo
slouken@729
  2465
	    if test "$linkmode" = prog; then
slouken@729
  2466
	      $echo "*** Warning: Linking the executable $output against the loadable module"
slouken@729
  2467
	    else
slouken@729
  2468
	      $echo "*** Warning: Linking the shared library $output against the loadable module"
slouken@729
  2469
	    fi
slouken@947
  2470
	    $echo "*** $linklib is not portable!"
slouken@947
  2471
	  fi
slouken@729
  2472
	  if test "$linkmode" = lib &&
slouken@729
  2473
	     test "$hardcode_into_libs" = yes; then
slouken@729
  2474
	    # Hardcode the library path.
slouken@729
  2475
	    # Skip directories that are in the system default run-time
slouken@729
  2476
	    # search path.
slouken@729
  2477
	    case " $sys_lib_dlsearch_path " in
slouken@729
  2478
	    *" $absdir "*) ;;
slouken@729
  2479
	    *)
slouken@729
  2480
	      case "$compile_rpath " in
slouken@729
  2481
	      *" $absdir "*) ;;
slouken@729
  2482
	      *) compile_rpath="$compile_rpath $absdir"
slouken@729
  2483
	      esac
slouken@729
  2484
	      ;;
slouken@729
  2485
	    esac
slouken@729
  2486
	    case " $sys_lib_dlsearch_path " in
slouken@729
  2487
	    *" $libdir "*) ;;
slouken@729
  2488
	    *)
slouken@729
  2489
	      case "$finalize_rpath " in
slouken@729
  2490
	      *" $libdir "*) ;;
slouken@729
  2491
	      *) finalize_rpath="$finalize_rpath $libdir"
slouken@729
  2492
	      esac
slouken@729
  2493
	      ;;
slouken@0
  2494
	    esac
slouken@0
  2495
	  fi
slouken@0
  2496
slouken@729
  2497
	  if test -n "$old_archive_from_expsyms_cmds"; then
slouken@729
  2498
	    # figure out the soname
slouken@729
  2499
	    set dummy $library_names
slouken@729
  2500
	    realname="$2"
slouken@729
  2501
	    shift; shift
slouken@729
  2502
	    libname=`eval \\$echo \"$libname_spec\"`
slouken@729
  2503
	    # use dlname if we got it. it's perfectly good, no?
slouken@729
  2504
	    if test -n "$dlname"; then
slouken@729
  2505
	      soname="$dlname"
slouken@729
  2506
	    elif test -n "$soname_spec"; then
slouken@729
  2507
	      # bleh windows
slouken@729
  2508
	      case $host in
slouken@729
  2509
	      *cygwin* | mingw*)
slouken@729
  2510
		major=`expr $current - $age`
slouken@729
  2511
		versuffix="-$major"
slouken@0
  2512
		;;
slouken@0
  2513
	      esac
slouken@729
  2514
	      eval soname=\"$soname_spec\"
slouken@729
  2515
	    else
slouken@729
  2516
	      soname="$realname"
slouken@729
  2517
	    fi
slouken@729
  2518
slouken@729
  2519
	    # Make a new name for the extract_expsyms_cmds to use
slouken@729
  2520
	    soroot="$soname"
slouken@729
  2521
	    soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
slouken@729
  2522
	    newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
slouken@729
  2523
slouken@729
  2524
	    # If the library has no export list, then create one now
slouken@729
  2525
	    if test -f "$output_objdir/$soname-def"; then :
slouken@729
  2526
	    else
slouken@729
  2527
	      $show "extracting exported symbol list from \`$soname'"
slouken@729
  2528
	      save_ifs="$IFS"; IFS='~'
slouken@947
  2529
	      cmds=$extract_expsyms_cmds
slouken@729
  2530
	      for cmd in $cmds; do
slouken@729
  2531
		IFS="$save_ifs"
slouken@947
  2532
		eval cmd=\"$cmd\"
slouken@729
  2533
		$show "$cmd"
slouken@729
  2534
		$run eval "$cmd" || exit $?
slouken@729
  2535
	      done
slouken@729
  2536
	      IFS="$save_ifs"
slouken@729
  2537
	    fi
slouken@729
  2538
slouken@729
  2539
	    # Create $newlib
slouken@729
  2540
	    if test -f "$output_objdir/$newlib"; then :; else
slouken@729
  2541
	      $show "generating import library for \`$soname'"
slouken@729
  2542
	      save_ifs="$IFS"; IFS='~'
slouken@947
  2543
	      cmds=$old_archive_from_expsyms_cmds
slouken@729
  2544
	      for cmd in $cmds; do
slouken@729
  2545
		IFS="$save_ifs"
slouken@947
  2546
		eval cmd=\"$cmd\"
slouken@729
  2547
		$show "$cmd"
slouken@729
  2548
		$run eval "$cmd" || exit $?
slouken@729
  2549
	      done
slouken@729
  2550
	      IFS="$save_ifs"
slouken@729
  2551
	    fi
slouken@729
  2552
	    # make sure the library variables are pointing to the new library
slouken@729
  2553
	    dir=$output_objdir
slouken@729
  2554
	    linklib=$newlib
slouken@729
  2555
	  fi # test -n "$old_archive_from_expsyms_cmds"
slouken@729
  2556
slouken@729
  2557
	  if test "$linkmode" = prog || test "$mode" != relink; then
slouken@729
  2558
	    add_shlibpath=
slouken@729
  2559
	    add_dir=
slouken@729
  2560
	    add=
slouken@729
  2561
	    lib_linked=yes
slouken@729
  2562
	    case $hardcode_action in
slouken@729
  2563
	    immediate | unsupported)
slouken@729
  2564
	      if test "$hardcode_direct" = no; then
slouken@729
  2565
		add="$dir/$linklib"
slouken@729
  2566
		case $host in
slouken@729
  2567
		  *-*-sco3.2v5* ) add_dir="-L$dir" ;;
slouken@729
  2568
		  *-*-darwin* )
slouken@947
  2569
		    # if the lib is a module then we can not link against
slouken@947
  2570
		    # it, someone is ignoring the new warnings I added
slouken@947
  2571
		    if /usr/bin/file -L $add 2> /dev/null | $EGREP "bundle" >/dev/null ; then
slouken@729
  2572
		      $echo "** Warning, lib $linklib is a module, not a shared library"
slouken@729
  2573
		      if test -z "$old_library" ; then
slouken@729
  2574
		        $echo
slouken@729
  2575
		        $echo "** And there doesn't seem to be a static archive available"
slouken@729
  2576
		        $echo "** The link will probably fail, sorry"
slouken@729
  2577
		      else
slouken@729
  2578
		        add="$dir/$old_library"
slouken@947
  2579
		      fi
slouken@729
  2580
		    fi
slouken@729
  2581
		esac
slouken@729
  2582
	      elif test "$hardcode_minus_L" = no; then
slouken@729
  2583
		case $host in
slouken@729
  2584
		*-*-sunos*) add_shlibpath="$dir" ;;
slouken@729
  2585
		esac
slouken@729
  2586
		add_dir="-L$dir"
slouken@729
  2587
		add="-l$name"
slouken@729
  2588
	      elif test "$hardcode_shlibpath_var" = no; then
slouken@729
  2589
		add_shlibpath="$dir"
slouken@729
  2590
		add="-l$name"
slouken@729
  2591
	      else
slouken@729
  2592
		lib_linked=no
slouken@729
  2593
	      fi
slouken@729
  2594
	      ;;
slouken@729
  2595
	    relink)
slouken@729
  2596
	      if test "$hardcode_direct" = yes; then
slouken@729
  2597
		add="$dir/$linklib"
slouken@729
  2598
	      elif test "$hardcode_minus_L" = yes; then
slouken@729
  2599
		add_dir="-L$dir"
slouken@729
  2600
		# Try looking first in the location we're being installed to.
slouken@729
  2601
		if test -n "$inst_prefix_dir"; then
slouken@729
  2602
		  case "$libdir" in
slouken@729
  2603
		    [\\/]*)
slouken@947
  2604
		      add_dir="$add_dir -L$inst_prefix_dir$libdir"
slouken@729
  2605
		      ;;
slouken@729
  2606
		  esac
slouken@729
  2607
		fi
slouken@729
  2608
		add="-l$name"
slouken@729
  2609
	      elif test "$hardcode_shlibpath_var" = yes; then
slouken@729
  2610
		add_shlibpath="$dir"
slouken@729
  2611
		add="-l$name"
slouken@729
  2612
	      else
slouken@729
  2613
		lib_linked=no
slouken@729
  2614
	      fi
slouken@729
  2615
	      ;;
slouken@729
  2616
	    *) lib_linked=no ;;
slouken@729
  2617
	    esac
slouken@729
  2618
slouken@729
  2619
	    if test "$lib_linked" != yes; then
slouken@729
  2620
	      $echo "$modename: configuration error: unsupported hardcode properties"
slouken@947
  2621
	      exit $EXIT_FAILURE
slouken@729
  2622
	    fi
slouken@729
  2623
slouken@729
  2624
	    if test -n "$add_shlibpath"; then
slouken@729
  2625
	      case :$compile_shlibpath: in
slouken@729
  2626
	      *":$add_shlibpath:"*) ;;
slouken@729
  2627
	      *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
slouken@0
  2628
	      esac
slouken@729
  2629
	    fi
slouken@729
  2630
	    if test "$linkmode" = prog; then
slouken@729
  2631
	      test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
slouken@729
  2632
	      test -n "$add" && compile_deplibs="$add $compile_deplibs"
slouken@729
  2633
	    else
slouken@729
  2634
	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
slouken@729
  2635
	      test -n "$add" && deplibs="$add $deplibs"
slouken@729
  2636
	      if test "$hardcode_direct" != yes && \
slouken@729
  2637
		 test "$hardcode_minus_L" != yes && \
slouken@729
  2638
		 test "$hardcode_shlibpath_var" = yes; then
slouken@729
  2639
		case :$finalize_shlibpath: in
slouken@729
  2640
		*":$libdir:"*) ;;
slouken@729
  2641
		*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
slouken@729
  2642
		esac
slouken@729
  2643
	      fi
slouken@729
  2644
	    fi
slouken@729
  2645
	  fi
slouken@729
  2646
slouken@729
  2647
	  if test "$linkmode" = prog || test "$mode" = relink; then
slouken@729
  2648
	    add_shlibpath=
slouken@729
  2649
	    add_dir=
slouken@729
  2650
	    add=
slouken@729
  2651
	    # Finalize command for both is simple: just hardcode it.
slouken@729
  2652
	    if test "$hardcode_direct" = yes; then
slouken@729
  2653
	      add="$libdir/$linklib"
slouken@729
  2654
	    elif test "$hardcode_minus_L" = yes; then
slouken@729
  2655
	      add_dir="-L$libdir"
slouken@729
  2656
	      add="-l$name"
slouken@729
  2657
	    elif test "$hardcode_shlibpath_var" = yes; then
slouken@729
  2658
	      case :$finalize_shlibpath: in
slouken@729
  2659
	      *":$libdir:"*) ;;
slouken@729
  2660
	      *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
slouken@0
  2661
	      esac
slouken@729
  2662
	      add="-l$name"
slouken@729
  2663
	    elif test "$hardcode_automatic" = yes; then
slouken@947
  2664
	      if test -n "$inst_prefix_dir" &&
slouken@947
  2665
		 test -f "$inst_prefix_dir$libdir/$linklib" ; then
slouken@729
  2666
	        add="$inst_prefix_dir$libdir/$linklib"
slouken@729
  2667
	      else
slouken@729
  2668
	        add="$libdir/$linklib"
slouken@729
  2669
	      fi
slouken@0
  2670
	    else
slouken@729
  2671
	      # We cannot seem to hardcode it, guess we'll fake it.
slouken@729
  2672
	      add_dir="-L$libdir"
slouken@729
  2673
	      # Try looking first in the location we're being installed to.
slouken@729
  2674
	      if test -n "$inst_prefix_dir"; then
slouken@729
  2675
		case "$libdir" in
slouken@729
  2676
		  [\\/]*)
slouken@947
  2677
		    add_dir="$add_dir -L$inst_prefix_dir$libdir"
slouken@729
  2678
		    ;;
slouken@729
  2679
		esac
slouken@729
  2680
	      fi
slouken@729
  2681
	      add="-l$name"
slouken@0
  2682
	    fi
slouken@729
  2683
slouken@729
  2684
	    if test "$linkmode" = prog; then
slouken@729
  2685
	      test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
slouken@729
  2686
	      test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
slouken@0
  2687
	    else
slouken@729
  2688
	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
slouken@729
  2689
	      test -n "$add" && deplibs="$add $deplibs"
slouken@0
  2690
	    fi
slouken@0
  2691
	  fi
slouken@729
  2692
	elif test "$linkmode" = prog; then
slouken@0
  2693
	  # Here we assume that one of hardcode_direct or hardcode_minus_L
slouken@0
  2694
	  # is not unsupported.  This is valid on all known static and
slouken@0
  2695
	  # shared platforms.
slouken@0
  2696
	  if test "$hardcode_direct" != unsupported; then
slouken@0
  2697
	    test -n "$old_library" && linklib="$old_library"
slouken@729
  2698
	    compile_deplibs="$dir/$linklib $compile_deplibs"
slouken@729
  2699
	    finalize_deplibs="$dir/$linklib $finalize_deplibs"
slouken@0
  2700
	  else
slouken@729
  2701
	    compile_deplibs="-l$name -L$dir $compile_deplibs"
slouken@729
  2702
	    finalize_deplibs="-l$name -L$dir $finalize_deplibs"
slouken@729
  2703
	  fi
slouken@729
  2704
	elif test "$build_libtool_libs" = yes; then
slouken@729
  2705
	  # Not a shared library
slouken@729
  2706
	  if test "$deplibs_check_method" != pass_all; then
slouken@729
  2707
	    # We're trying link a shared library against a static one
slouken@729
  2708
	    # but the system doesn't support it.
slouken@729
  2709
slouken@729
  2710
	    # Just print a warning and add the library to dependency_libs so
slouken@729
  2711
	    # that the program can be linked against the static library.
slouken@729
  2712
	    $echo
slouken@729
  2713
	    $echo "*** Warning: This system can not link to static lib archive $lib."
slouken@729
  2714
	    $echo "*** I have the capability to make that library automatically link in when"
slouken@729
  2715
	    $echo "*** you link to this library.  But I can only do this if you have a"
slouken@729
  2716
	    $echo "*** shared version of the library, which you do not appear to have."
slouken@729
  2717
	    if test "$module" = yes; then
slouken@729
  2718
	      $echo "*** But as you try to build a module library, libtool will still create "
slouken@729
  2719
	      $echo "*** a static module, that should work as long as the dlopening application"
slouken@729
  2720
	      $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
slouken@729
  2721
	      if test -z "$global_symbol_pipe"; then
slouken@729
  2722
		$echo
slouken@729
  2723
		$echo "*** However, this would only work if libtool was able to extract symbol"
slouken@729
  2724
		$echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
slouken@729
  2725
		$echo "*** not find such a program.  So, this module is probably useless."
slouken@729
  2726
		$echo "*** \`nm' from GNU binutils and a full rebuild may help."
slouken@729
  2727
	      fi
slouken@729
  2728
	      if test "$build_old_libs" = no; then
slouken@729
  2729
		build_libtool_libs=module
slouken@729
  2730
		build_old_libs=yes
slouken@729
  2731
	      else
slouken@729
  2732
		build_libtool_libs=no
slouken@729
  2733
	      fi
slouken@729
  2734
	    fi
slouken@729
  2735
	  else
slouken@729
  2736
	    convenience="$convenience $dir/$old_library"
slouken@729
  2737
	    old_convenience="$old_convenience $dir/$old_library"
slouken@729
  2738
	    deplibs="$dir/$old_library $deplibs"
slouken@729
  2739
	    link_static=yes
slouken@729
  2740
	  fi
slouken@729
  2741
	fi # link shared/static library?
slouken@729
  2742
slouken@729
  2743
	if test "$linkmode" = lib; then
slouken@729
  2744
	  if test -n "$dependency_libs" &&
slouken@947
  2745
	     { test "$hardcode_into_libs" != yes ||
slouken@947
  2746
	       test "$build_old_libs" = yes ||
slouken@729
  2747
	       test "$link_static" = yes; }; then
slouken@729
  2748
	    # Extract -R from dependency_libs
slouken@729
  2749
	    temp_deplibs=
slouken@729
  2750
	    for libdir in $dependency_libs; do
slouken@729
  2751
	      case $libdir in
slouken@729
  2752
	      -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
slouken@729
  2753
		   case " $xrpath " in
slouken@729
  2754
		   *" $temp_xrpath "*) ;;
slouken@729
  2755
		   *) xrpath="$xrpath $temp_xrpath";;
slouken@729
  2756
		   esac;;
slouken@729
  2757
	      *) temp_deplibs="$temp_deplibs $libdir";;
slouken@729
  2758
	      esac
slouken@729
  2759
	    done
slouken@729
  2760
	    dependency_libs="$temp_deplibs"
slouken@729
  2761
	  fi
slouken@729
  2762
slouken@729
  2763
	  newlib_search_path="$newlib_search_path $absdir"
slouken@729
  2764
	  # Link against this library
slouken@729
  2765
	  test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
slouken@729
  2766
	  # ... and its dependency_libs
slouken@729
  2767
	  tmp_libs=
slouken@729
  2768
	  for deplib in $dependency_libs; do
slouken@729
  2769
	    newdependency_libs="$deplib $newdependency_libs"
slouken@729
  2770
	    if test "X$duplicate_deps" = "Xyes" ; then
slouken@729
  2771
	      case "$tmp_libs " in
slouken@729
  2772
	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
slouken@729
  2773
	      esac
slouken@729
  2774
	    fi
slouken@729
  2775
	    tmp_libs="$tmp_libs $deplib"
slouken@729
  2776
	  done
slouken@729
  2777
slouken@729
  2778
	  if test "$link_all_deplibs" != no; then
slouken@729
  2779
	    # Add the search paths of all dependency libraries
slouken@729
  2780
	    for deplib in $dependency_libs; do
slouken@729
  2781
	      case $deplib in
slouken@729
  2782
	      -L*) path="$deplib" ;;
slouken@729
  2783
	      *.la)
slouken@729
  2784
		dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
slouken@729
  2785
		test "X$dir" = "X$deplib" && dir="."
slouken@729
  2786
		# We need an absolute path.
slouken@729
  2787
		case $dir in
slouken@729
  2788
		[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
slouken@729
  2789
		*)
slouken@729
  2790
		  absdir=`cd "$dir" && pwd`
slouken@729
  2791
		  if test -z "$absdir"; then
slouken@729
  2792
		    $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
slouken@729
  2793
		    absdir="$dir"
slouken@729
  2794
		  fi
slouken@729
  2795
		  ;;
slouken@729
  2796
		esac
slouken@729
  2797
		if grep "^installed=no" $deplib > /dev/null; then
slouken@729
  2798
		  path="$absdir/$objdir"
slouken@729
  2799
		else
slouken@729
  2800
		  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
slouken@729
  2801
		  if test -z "$libdir"; then
slouken@729
  2802
		    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
slouken@947
  2803
		    exit $EXIT_FAILURE
slouken@729
  2804
		  fi
slouken@729
  2805
		  if test "$absdir" != "$libdir"; then
slouken@729
  2806
		    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
slouken@729
  2807
		  fi
slouken@729
  2808
		  path="$absdir"
slouken@729
  2809
		fi
slouken@729
  2810
		depdepl=
slouken@729
  2811
		case $host in
slouken@729
  2812
		*-*-darwin*)
slouken@947
  2813
		  # we do not want to link against static libs,
slouken@947
  2814
		  # but need to link against shared
slouken@729
  2815
		  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
slouken@729
  2816
		  if test -n "$deplibrary_names" ; then
slouken@729
  2817
		    for tmp in $deplibrary_names ; do
slouken@729
  2818
		      depdepl=$tmp
slouken@729
  2819
		    done
slouken@729
  2820
		    if test -f "$path/$depdepl" ; then
slouken@729
  2821
		      depdepl="$path/$depdepl"
slouken@947
  2822
		    fi
slouken@741
  2823
		    # do not add paths which are already there
slouken@741
  2824
		    case " $newlib_search_path " in
slouken@741
  2825
		    *" $path "*) ;;
slouken@741
  2826
		    *) newlib_search_path="$newlib_search_path $path";;
slouken@741
  2827
		    esac
slouken@729
  2828
		  fi
slouken@741
  2829
		  path=""
slouken@729
  2830
		  ;;
slouken@729
  2831
		*)
slouken@947
  2832
		  path="-L$path"
slouken@947
  2833
		  ;;
slouken@947
  2834
		esac
slouken@729
  2835
		;;
slouken@947
  2836
	      -l*)
slouken@729
  2837
		case $host in
slouken@729
  2838
		*-*-darwin*)
slouken@947
  2839
		  # Again, we only want to link against shared libraries
slouken@947
  2840
		  eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
slouken@947
  2841
		  for tmp in $newlib_search_path ; do
slouken@947
  2842
		    if test -f "$tmp/lib$tmp_libs.dylib" ; then
slouken@947
  2843
		      eval depdepl="$tmp/lib$tmp_libs.dylib"
slouken@947
  2844
		      break
slouken@947
  2845
		    fi
slouken@947
  2846
		  done
slouken@947
  2847
		  path=""
slouken@729
  2848
		  ;;
slouken@741
  2849
	      *.framework)
slouken@741
  2850
		case $host in
slouken@741
  2851
		  *-*-darwin*)
slouken@741
  2852
		    depdepl="$deplib"
slouken@741
  2853
		    ;;
slouken@741
  2854
		esac
slouken@741
  2855
		;;
slouken@947
  2856
		*) continue ;;
slouken@947
  2857
		esac
slouken@947
  2858
		;;
slouken@729
  2859
	      *) continue ;;
slouken@729
  2860
	      esac
slouken@729
  2861
	      case " $deplibs " in
slouken@729
  2862
	      *" $depdepl "*) ;;
slouken@947
  2863
	      *) deplibs="$depdepl $deplibs" ;;
slouken@947
  2864
	      esac
slouken@729
  2865
	      case " $deplibs " in
slouken@729
  2866
	      *" $path "*) ;;
slouken@729
  2867
	      *) deplibs="$deplibs $path" ;;
slouken@729
  2868
	      esac
slouken@729
  2869
	    done
slouken@729
  2870
	  fi # link_all_deplibs != no