ltmain.sh
author Sam Lantinga <slouken@libsdl.org>
Tue, 18 Nov 2003 14:25:12 +0000
changeset 741 97b9c301df94
parent 730 0f4f974d0201
child 789 f9d0e03fc2ff
permissions -rw-r--r--
Date: Mon, 17 Nov 2003 23:12:59 +0100
From: Max Horn
Subject: SDL building "the unix way" on OS X

I just noticed that building current SDL CVS "the unix way" (using
configure/make) is (and has been for some time, it seems) broken.
That's because Sam updated to a newer libtool version, which removed my
"-framework" patches.

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