ltmain.sh
author Sam Lantinga <slouken@libsdl.org>
Mon, 06 Oct 2003 07:13:16 +0000
changeset 729 dac996d69abb
parent 608 d0fecf67cd93
child 730 0f4f974d0201
permissions -rw-r--r--
Updated libtool support so Mingw32 builds work.
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@0
  1151
	*)
slouken@0
  1152
	  eval "$prev=\"\$arg\""
slouken@0
  1153
	  prev=
slouken@0
  1154
	  continue
slouken@0
  1155
	  ;;
slouken@0
  1156
	esac
slouken@729
  1157
      fi # test -n "$prev"
slouken@0
  1158
slouken@0
  1159
      prevarg="$arg"
slouken@0
  1160
slouken@729
  1161
      case $arg in
slouken@0
  1162
      -all-static)
slouken@0
  1163
	if test -n "$link_static_flag"; then
slouken@0
  1164
	  compile_command="$compile_command $link_static_flag"
slouken@0
  1165
	  finalize_command="$finalize_command $link_static_flag"
slouken@0
  1166
	fi
slouken@0
  1167
	continue
slouken@0
  1168
	;;
slouken@0
  1169
slouken@0
  1170
      -allow-undefined)
slouken@0
  1171
	# FIXME: remove this flag sometime in the future.
slouken@0
  1172
	$echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
slouken@0
  1173
	continue
slouken@0
  1174
	;;
slouken@0
  1175
slouken@0
  1176
      -avoid-version)
slouken@0
  1177
	avoid_version=yes
slouken@0
  1178
	continue
slouken@0
  1179
	;;
slouken@0
  1180
slouken@0
  1181
      -dlopen)
slouken@0
  1182
	prev=dlfiles
slouken@0
  1183
	continue
slouken@0
  1184
	;;
slouken@0
  1185
slouken@0
  1186
      -dlpreopen)
slouken@0
  1187
	prev=dlprefiles
slouken@0
  1188
	continue
slouken@0
  1189
	;;
slouken@0
  1190
slouken@0
  1191
      -export-dynamic)
slouken@0
  1192
	export_dynamic=yes
slouken@0
  1193
	continue
slouken@0
  1194
	;;
slouken@0
  1195
slouken@0
  1196
      -export-symbols | -export-symbols-regex)
slouken@0
  1197
	if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
slouken@729
  1198
	  $echo "$modename: more than one -exported-symbols argument is not allowed"
slouken@0
  1199
	  exit 1
slouken@0
  1200
	fi
slouken@0
  1201
	if test "X$arg" = "X-export-symbols"; then
slouken@0
  1202
	  prev=expsyms
slouken@0
  1203
	else
slouken@0
  1204
	  prev=expsyms_regex
slouken@0
  1205
	fi
slouken@0
  1206
	continue
slouken@0
  1207
	;;
slouken@0
  1208
slouken@729
  1209
      -inst-prefix-dir)
slouken@729
  1210
	prev=inst_prefix
slouken@729
  1211
	continue
slouken@729
  1212
	;;
slouken@729
  1213
slouken@729
  1214
      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
slouken@729
  1215
      # so, if we see these flags be careful not to treat them like -L
slouken@729
  1216
      -L[A-Z][A-Z]*:*)
slouken@729
  1217
	case $with_gcc/$host in
slouken@729
  1218
	no/*-*-irix* | /*-*-irix*)
slouken@729
  1219
	  compile_command="$compile_command $arg"
slouken@729
  1220
	  finalize_command="$finalize_command $arg"
slouken@729
  1221
	  ;;
slouken@729
  1222
	esac
slouken@387
  1223
	continue
slouken@387
  1224
	;;
slouken@387
  1225
slouken@0
  1226
      -L*)
slouken@0
  1227
	dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
slouken@0
  1228
	# We need an absolute path.
slouken@729
  1229
	case $dir in
slouken@0
  1230
	[\\/]* | [A-Za-z]:[\\/]*) ;;
slouken@0
  1231
	*)
slouken@0
  1232
	  absdir=`cd "$dir" && pwd`
slouken@0
  1233
	  if test -z "$absdir"; then
slouken@729
  1234
	    $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
slouken@729
  1235
	    exit 1
slouken@0
  1236
	  fi
slouken@0
  1237
	  dir="$absdir"
slouken@0
  1238
	  ;;
slouken@0
  1239
	esac
slouken@729
  1240
	case "$deplibs " in
slouken@729
  1241
	*" -L$dir "*) ;;
slouken@729
  1242
	*)
slouken@729
  1243
	  deplibs="$deplibs -L$dir"
slouken@729
  1244
	  lib_search_path="$lib_search_path $dir"
slouken@729
  1245
	  ;;
slouken@0
  1246
	esac
slouken@729
  1247
	case $host in
slouken@729
  1248
	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
slouken@729
  1249
	  case :$dllsearchpath: in
slouken@729
  1250
	  *":$dir:"*) ;;
slouken@729
  1251
	  *) dllsearchpath="$dllsearchpath:$dir";;
slouken@0
  1252
	  esac
slouken@0
  1253
	  ;;
slouken@0
  1254
	esac
slouken@729
  1255
	continue
slouken@0
  1256
	;;
slouken@0
  1257
slouken@0
  1258
      -l*)
slouken@729
  1259
	if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
slouken@729
  1260
	  case $host in
slouken@729
  1261
	  *-*-cygwin* | *-*-pw32* | *-*-beos*)
slouken@729
  1262
	    # These systems don't actually have a C or math library (as such)
slouken@0
  1263
	    continue
slouken@0
  1264
	    ;;
slouken@729
  1265
	  *-*-mingw* | *-*-os2*)
slouken@729
  1266
	    # These systems don't actually have a C library (as such)
slouken@729
  1267
	    test "X$arg" = "X-lc" && continue
slouken@729
  1268
	    ;;
slouken@729
  1269
	  *-*-openbsd* | *-*-freebsd*)
slouken@729
  1270
	    # Do not include libc due to us having libc/libc_r.
slouken@729
  1271
	    test "X$arg" = "X-lc" && continue
slouken@729
  1272
	    ;;
slouken@729
  1273
	  *-*-rhapsody* | *-*-darwin1.[012])
slouken@729
  1274
	    # Rhapsody C and math libraries are in the System framework
slouken@729
  1275
	    deplibs="$deplibs -framework System"
slouken@729
  1276
	    continue
slouken@0
  1277
	  esac
slouken@729
  1278
	elif test "X$arg" = "X-lc_r"; then
slouken@729
  1279
	 case $host in
slouken@729
  1280
	 *-*-openbsd* | *-*-freebsd*)
slouken@729
  1281
	   # Do not include libc_r directly, use -pthread flag.
slouken@729
  1282
	   continue
slouken@729
  1283
	   ;;
slouken@729
  1284
	 esac
slouken@0
  1285
	fi
slouken@0
  1286
	deplibs="$deplibs $arg"
slouken@729
  1287
	continue
slouken@0
  1288
	;;
slouken@0
  1289
slouken@0
  1290
      -module)
slouken@0
  1291
	module=yes
slouken@0
  1292
	continue
slouken@0
  1293
	;;
slouken@0
  1294
slouken@729
  1295
      # gcc -m* arguments should be passed to the linker via $compiler_flags
slouken@729
  1296
      # in order to pass architecture information to the linker
slouken@729
  1297
      # (e.g. 32 vs 64-bit).  This may also be accomplished via -Wl,-mfoo
slouken@729
  1298
      # but this is not reliable with gcc because gcc may use -mfoo to
slouken@729
  1299
      # select a different linker, different libraries, etc, while
slouken@729
  1300
      # -Wl,-mfoo simply passes -mfoo to the linker.
slouken@729
  1301
      -m*)
slouken@729
  1302
	# Unknown arguments in both finalize_command and compile_command need
slouken@729
  1303
	# to be aesthetically quoted because they are evaled later.
slouken@729
  1304
	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
slouken@729
  1305
	case $arg in
slouken@729
  1306
	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
slouken@729
  1307
	  arg="\"$arg\""
slouken@729
  1308
	  ;;
slouken@729
  1309
	esac
slouken@729
  1310
        compile_command="$compile_command $arg"
slouken@729
  1311
        finalize_command="$finalize_command $arg"
slouken@729
  1312
        if test "$with_gcc" = "yes" ; then
slouken@729
  1313
          compiler_flags="$compiler_flags $arg"
slouken@729
  1314
        fi
slouken@729
  1315
        continue
slouken@729
  1316
        ;;
slouken@729
  1317
slouken@729
  1318
      -shrext)
slouken@729
  1319
	prev=shrext
slouken@729
  1320
	continue
slouken@729
  1321
	;;
slouken@729
  1322
slouken@729
  1323
      -no-fast-install)
slouken@729
  1324
	fast_install=no
slouken@729
  1325
	continue
slouken@729
  1326
	;;
slouken@729
  1327
slouken@729
  1328
      -no-install)
slouken@729
  1329
	case $host in
slouken@729
  1330
	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
slouken@729
  1331
	  # The PATH hackery in wrapper scripts is required on Windows
slouken@729
  1332
	  # in order for the loader to find any dlls it needs.
slouken@729
  1333
	  $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
slouken@729
  1334
	  $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
slouken@729
  1335
	  fast_install=no
slouken@729
  1336
	  ;;
slouken@729
  1337
	*) no_install=yes ;;
slouken@729
  1338
	esac
slouken@729
  1339
	continue
slouken@729
  1340
	;;
slouken@729
  1341
slouken@0
  1342
      -no-undefined)
slouken@0
  1343
	allow_undefined=no
slouken@0
  1344
	continue
slouken@0
  1345
	;;
slouken@0
  1346
slouken@729
  1347
      -objectlist)
slouken@729
  1348
	prev=objectlist
slouken@729
  1349
	continue
slouken@729
  1350
	;;
slouken@729
  1351
slouken@0
  1352
      -o) prev=output ;;
slouken@0
  1353
slouken@0
  1354
      -release)
slouken@0
  1355
	prev=release
slouken@0
  1356
	continue
slouken@0
  1357
	;;
slouken@0
  1358
slouken@0
  1359
      -rpath)
slouken@0
  1360
	prev=rpath
slouken@0
  1361
	continue
slouken@0
  1362
	;;
slouken@0
  1363
slouken@0
  1364
      -R)
slouken@0
  1365
	prev=xrpath
slouken@0
  1366
	continue
slouken@0
  1367
	;;
slouken@0
  1368
slouken@0
  1369
      -R*)
slouken@0
  1370
	dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
slouken@0
  1371
	# We need an absolute path.
slouken@729
  1372
	case $dir in
slouken@0
  1373
	[\\/]* | [A-Za-z]:[\\/]*) ;;
slouken@0
  1374
	*)
slouken@0
  1375
	  $echo "$modename: only absolute run-paths are allowed" 1>&2
slouken@0
  1376
	  exit 1
slouken@0
  1377
	  ;;
slouken@0
  1378
	esac
slouken@0
  1379
	case "$xrpath " in
slouken@0
  1380
	*" $dir "*) ;;
slouken@0
  1381
	*) xrpath="$xrpath $dir" ;;
slouken@0
  1382
	esac
slouken@0
  1383
	continue
slouken@0
  1384
	;;
slouken@0
  1385
slouken@0
  1386
      -static)
slouken@729
  1387
	# The effects of -static are defined in a previous loop.
slouken@729
  1388
	# We used to do the same as -all-static on platforms that
slouken@729
  1389
	# didn't have a PIC flag, but the assumption that the effects
slouken@729
  1390
	# would be equivalent was wrong.  It would break on at least
slouken@729
  1391
	# Digital Unix and AIX.
slouken@0
  1392
	continue
slouken@0
  1393
	;;
slouken@0
  1394
slouken@0
  1395
      -thread-safe)
slouken@0
  1396
	thread_safe=yes
slouken@0
  1397
	continue
slouken@0
  1398
	;;
slouken@0
  1399
slouken@0
  1400
      -version-info)
slouken@0
  1401
	prev=vinfo
slouken@0
  1402
	continue
slouken@0
  1403
	;;
slouken@729
  1404
      -version-number)
slouken@729
  1405
	prev=vinfo
slouken@729
  1406
	vinfo_number=yes
slouken@729
  1407
	continue
slouken@729
  1408
	;;
slouken@729
  1409
slouken@729
  1410
      -Wc,*)
slouken@729
  1411
	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
slouken@729
  1412
	arg=
slouken@729
  1413
	save_ifs="$IFS"; IFS=','
slouken@729
  1414
	for flag in $args; do
slouken@729
  1415
	  IFS="$save_ifs"
slouken@729
  1416
	  case $flag in
slouken@729
  1417
	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
slouken@729
  1418
	    flag="\"$flag\""
slouken@729
  1419
	    ;;
slouken@729
  1420
	  esac
slouken@729
  1421
	  arg="$arg $wl$flag"
slouken@729
  1422
	  compiler_flags="$compiler_flags $flag"
slouken@729
  1423
	done
slouken@729
  1424
	IFS="$save_ifs"
slouken@729
  1425
	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
slouken@729
  1426
	;;
slouken@729
  1427
slouken@729
  1428
      -Wl,*)
slouken@729
  1429
	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
slouken@729
  1430
	arg=
slouken@729
  1431
	save_ifs="$IFS"; IFS=','
slouken@729
  1432
	for flag in $args; do
slouken@729
  1433
	  IFS="$save_ifs"
slouken@729
  1434
	  case $flag in
slouken@729
  1435
	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
slouken@729
  1436
	    flag="\"$flag\""
slouken@729
  1437
	    ;;
slouken@729
  1438
	  esac
slouken@729
  1439
	  arg="$arg $wl$flag"
slouken@729
  1440
	  compiler_flags="$compiler_flags $wl$flag"
slouken@729
  1441
	  linker_flags="$linker_flags $flag"
slouken@729
  1442
	done
slouken@729
  1443
	IFS="$save_ifs"
slouken@729
  1444
	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
slouken@729
  1445
	;;
slouken@729
  1446
slouken@729
  1447
      -Xcompiler)
slouken@729
  1448
	prev=xcompiler
slouken@729
  1449
	continue
slouken@729
  1450
	;;
slouken@729
  1451
slouken@729
  1452
      -Xlinker)
slouken@729
  1453
	prev=xlinker
slouken@729
  1454
	continue
slouken@729
  1455
	;;
slouken@729
  1456
slouken@729
  1457
      -XCClinker)
slouken@729
  1458
	prev=xcclinker
slouken@729
  1459
	continue
slouken@729
  1460
	;;
slouken@0
  1461
slouken@0
  1462
      # Some other compiler flag.
slouken@0
  1463
      -* | +*)
slouken@0
  1464
	# Unknown arguments in both finalize_command and compile_command need
slouken@0
  1465
	# to be aesthetically quoted because they are evaled later.
slouken@0
  1466
	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
slouken@729
  1467
	case $arg in
slouken@729
  1468
	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
slouken@0
  1469
	  arg="\"$arg\""
slouken@0
  1470
	  ;;
slouken@0
  1471
	esac
slouken@0
  1472
	;;
slouken@0
  1473
slouken@729
  1474
      *.$objext)
slouken@0
  1475
	# A standard object.
slouken@0
  1476
	objs="$objs $arg"
slouken@0
  1477
	;;
slouken@0
  1478
slouken@0
  1479
      *.lo)
slouken@729
  1480
	# A libtool-controlled object.
slouken@729
  1481
slouken@729
  1482
	# Check to see that this really is a libtool object.
slouken@729
  1483
	if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
slouken@729
  1484
	  pic_object=
slouken@729
  1485
	  non_pic_object=
slouken@729
  1486
slouken@729
  1487
	  # Read the .lo file
slouken@729
  1488
	  # If there is no directory component, then add one.
slouken@729
  1489
	  case $arg in
slouken@729
  1490
	  */* | *\\*) . $arg ;;
slouken@729
  1491
	  *) . ./$arg ;;
slouken@729
  1492
	  esac
slouken@729
  1493
slouken@729
  1494
	  if test -z "$pic_object" || \
slouken@729
  1495
	     test -z "$non_pic_object" ||
slouken@729
  1496
	     test "$pic_object" = none && \
slouken@729
  1497
	     test "$non_pic_object" = none; then
slouken@729
  1498
	    $echo "$modename: cannot find name of object for \`$arg'" 1>&2
slouken@729
  1499
	    exit 1
slouken@729
  1500
	  fi
slouken@729
  1501
slouken@729
  1502
	  # Extract subdirectory from the argument.
slouken@729
  1503
	  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
slouken@729
  1504
	  if test "X$xdir" = "X$arg"; then
slouken@729
  1505
	    xdir=
slouken@729
  1506
 	  else
slouken@729
  1507
	    xdir="$xdir/"
slouken@729
  1508
	  fi
slouken@729
  1509
slouken@729
  1510
	  if test "$pic_object" != none; then
slouken@729
  1511
	    # Prepend the subdirectory the object is found in.
slouken@729
  1512
	    pic_object="$xdir$pic_object"
slouken@729
  1513
slouken@729
  1514
	    if test "$prev" = dlfiles; then
slouken@729
  1515
	      if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
slouken@729
  1516
		dlfiles="$dlfiles $pic_object"
slouken@729
  1517
		prev=
slouken@729
  1518
		continue
slouken@729
  1519
	      else
slouken@729
  1520
		# If libtool objects are unsupported, then we need to preload.
slouken@729
  1521
		prev=dlprefiles
slouken@729
  1522
	      fi
slouken@729
  1523
	    fi
slouken@729
  1524
slouken@729
  1525
	    # CHECK ME:  I think I busted this.  -Ossama
slouken@729
  1526
	    if test "$prev" = dlprefiles; then
slouken@729
  1527
	      # Preload the old-style object.
slouken@729
  1528
	      dlprefiles="$dlprefiles $pic_object"
slouken@729
  1529
	      prev=
slouken@729
  1530
	    fi
slouken@729
  1531
slouken@729
  1532
	    # A PIC object.
slouken@729
  1533
	    libobjs="$libobjs $pic_object"
slouken@729
  1534
	    arg="$pic_object"
slouken@729
  1535
	  fi
slouken@729
  1536
slouken@729
  1537
	  # Non-PIC object.
slouken@729
  1538
	  if test "$non_pic_object" != none; then
slouken@729
  1539
	    # Prepend the subdirectory the object is found in.
slouken@729
  1540
	    non_pic_object="$xdir$non_pic_object"
slouken@729
  1541
slouken@729
  1542
	    # A standard non-PIC object
slouken@729
  1543
	    non_pic_objects="$non_pic_objects $non_pic_object"
slouken@729
  1544
	    if test -z "$pic_object" || test "$pic_object" = none ; then
slouken@729
  1545
	      arg="$non_pic_object"
slouken@729
  1546
	    fi
slouken@729
  1547
	  fi
slouken@729
  1548
	else
slouken@729
  1549
	  # Only an error if not doing a dry-run.
slouken@729
  1550
	  if test -z "$run"; then
slouken@729
  1551
	    $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
slouken@729
  1552
	    exit 1
slouken@0
  1553
	  else
slouken@729
  1554
	    # Dry-run case.
slouken@729
  1555
slouken@729
  1556
	    # Extract subdirectory from the argument.
slouken@729
  1557
	    xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
slouken@729
  1558
	    if test "X$xdir" = "X$arg"; then
slouken@729
  1559
	      xdir=
slouken@729
  1560
	    else
slouken@729
  1561
	      xdir="$xdir/"
slouken@729
  1562
	    fi
slouken@729
  1563
slouken@729
  1564
	    pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
slouken@729
  1565
	    non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
slouken@729
  1566
	    libobjs="$libobjs $pic_object"
slouken@729
  1567
	    non_pic_objects="$non_pic_objects $non_pic_object"
slouken@0
  1568
	  fi
slouken@0
  1569
	fi
slouken@729
  1570
	;;
slouken@729
  1571
slouken@729
  1572
      *.$libext)
slouken@729
  1573
	# An archive.
slouken@729
  1574
	deplibs="$deplibs $arg"
slouken@729
  1575
	old_deplibs="$old_deplibs $arg"
slouken@729
  1576
	continue
slouken@0
  1577
	;;
slouken@0
  1578
slouken@0
  1579
      *.la)
slouken@0
  1580
	# A libtool-controlled library.
slouken@0
  1581
slouken@729
  1582
	if test "$prev" = dlfiles; then
slouken@729
  1583
	  # This library was specified with -dlopen.
slouken@729
  1584
	  dlfiles="$dlfiles $arg"
slouken@729
  1585
	  prev=
slouken@729
  1586
	elif test "$prev" = dlprefiles; then
slouken@729
  1587
	  # The library was specified with -dlpreopen.
slouken@729
  1588
	  dlprefiles="$dlprefiles $arg"
slouken@729
  1589
	  prev=
slouken@729
  1590
	else
slouken@729
  1591
	  deplibs="$deplibs $arg"
slouken@729
  1592
	fi
slouken@729
  1593
	continue
slouken@729
  1594
	;;
slouken@729
  1595
slouken@729
  1596
      # Some other compiler argument.
slouken@729
  1597
      *)
slouken@729
  1598
	# Unknown arguments in both finalize_command and compile_command need
slouken@729
  1599
	# to be aesthetically quoted because they are evaled later.
slouken@729
  1600
	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
slouken@729
  1601
	case $arg in
slouken@729
  1602
	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
slouken@729
  1603
	  arg="\"$arg\""
slouken@729
  1604
	  ;;
slouken@729
  1605
	esac
slouken@729
  1606
	;;
slouken@729
  1607
      esac # arg
slouken@729
  1608
slouken@729
  1609
      # Now actually substitute the argument into the commands.
slouken@729
  1610
      if test -n "$arg"; then
slouken@729
  1611
	compile_command="$compile_command $arg"
slouken@729
  1612
	finalize_command="$finalize_command $arg"
slouken@729
  1613
      fi
slouken@729
  1614
    done # argument parsing loop
slouken@729
  1615
slouken@729
  1616
    if test -n "$prev"; then
slouken@729
  1617
      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
slouken@729
  1618
      $echo "$help" 1>&2
slouken@729
  1619
      exit 1
slouken@729
  1620
    fi
slouken@729
  1621
slouken@729
  1622
    # Infer tagged configuration to use if any are available and
slouken@729
  1623
    # if one wasn't chosen via the "--tag" command line option.
slouken@729
  1624
    # Only attempt this if the compiler in the base link
slouken@729
  1625
    # command doesn't match the default compiler.
slouken@729
  1626
    if test -n "$available_tags" && test -z "$tagname"; then
slouken@729
  1627
      case $base_compile in
slouken@729
  1628
      # Blanks in the command may have been stripped by the calling shell,
slouken@729
  1629
      # but not from the CC environment variable when configure was run.
slouken@729
  1630
      "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) ;;
slouken@729
  1631
      # Blanks at the start of $base_compile will cause this to fail
slouken@729
  1632
      # if we don't check for them as well.
slouken@729
  1633
      *)
slouken@729
  1634
	for z in $available_tags; do
slouken@729
  1635
	  if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
slouken@729
  1636
	    # Evaluate the configuration.
slouken@729
  1637
	    eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
slouken@729
  1638
	    case $base_compile in
slouken@729
  1639
	    "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)
slouken@729
  1640
	      # The compiler in $compile_command matches
slouken@729
  1641
	      # the one in the tagged configuration.
slouken@729
  1642
	      # Assume this is the tagged configuration we want.
slouken@729
  1643
	      tagname=$z
slouken@729
  1644
	      break
slouken@729
  1645
	      ;;
slouken@729
  1646
	    esac
slouken@729
  1647
	  fi
slouken@729
  1648
	done
slouken@729
  1649
	# If $tagname still isn't set, then no tagged configuration
slouken@729
  1650
	# was found and let the user know that the "--tag" command
slouken@729
  1651
	# line option must be used.
slouken@729
  1652
	if test -z "$tagname"; then
slouken@729
  1653
	  $echo "$modename: unable to infer tagged configuration"
slouken@729
  1654
	  $echo "$modename: specify a tag with \`--tag'" 1>&2
slouken@729
  1655
	  exit 1
slouken@729
  1656
#       else
slouken@729
  1657
#         $echo "$modename: using $tagname tagged configuration"
slouken@729
  1658
	fi
slouken@729
  1659
	;;
slouken@729
  1660
      esac
slouken@729
  1661
    fi
slouken@729
  1662
slouken@729
  1663
    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
slouken@729
  1664
      eval arg=\"$export_dynamic_flag_spec\"
slouken@729
  1665
      compile_command="$compile_command $arg"
slouken@729
  1666
      finalize_command="$finalize_command $arg"
slouken@729
  1667
    fi
slouken@729
  1668
slouken@729
  1669
    oldlibs=
slouken@729
  1670
    # calculate the name of the file, without its directory
slouken@729
  1671
    outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
slouken@729
  1672
    libobjs_save="$libobjs"
slouken@729
  1673
slouken@729
  1674
    if test -n "$shlibpath_var"; then
slouken@729
  1675
      # get the directories listed in $shlibpath_var
slouken@729
  1676
      eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
slouken@729
  1677
    else
slouken@729
  1678
      shlib_search_path=
slouken@729
  1679
    fi
slouken@729
  1680
    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
slouken@729
  1681
    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
slouken@729
  1682
slouken@729
  1683
    output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
slouken@729
  1684
    if test "X$output_objdir" = "X$output"; then
slouken@729
  1685
      output_objdir="$objdir"
slouken@729
  1686
    else
slouken@729
  1687
      output_objdir="$output_objdir/$objdir"
slouken@729
  1688
    fi
slouken@729
  1689
    # Create the object directory.
slouken@729
  1690
    if test ! -d "$output_objdir"; then
slouken@729
  1691
      $show "$mkdir $output_objdir"
slouken@729
  1692
      $run $mkdir $output_objdir
slouken@729
  1693
      status=$?
slouken@729
  1694
      if test "$status" -ne 0 && test ! -d "$output_objdir"; then
slouken@729
  1695
	exit $status
slouken@729
  1696
      fi
slouken@729
  1697
    fi
slouken@729
  1698
slouken@729
  1699
    # Determine the type of output
slouken@729
  1700
    case $output in
slouken@729
  1701
    "")
slouken@729
  1702
      $echo "$modename: you must specify an output file" 1>&2
slouken@729
  1703
      $echo "$help" 1>&2
slouken@729
  1704
      exit 1
slouken@729
  1705
      ;;
slouken@729
  1706
    *.$libext) linkmode=oldlib ;;
slouken@729
  1707
    *.lo | *.$objext) linkmode=obj ;;
slouken@729
  1708
    *.la) linkmode=lib ;;
slouken@729
  1709
    *) linkmode=prog ;; # Anything else should be a program.
slouken@729
  1710
    esac
slouken@729
  1711
slouken@729
  1712
    case $host in
slouken@729
  1713
    *cygwin* | *mingw* | *pw32*)
slouken@729
  1714
      # don't eliminate duplcations in $postdeps and $predeps
slouken@729
  1715
      duplicate_compiler_generated_deps=yes
slouken@729
  1716
      ;;
slouken@729
  1717
    *)
slouken@729
  1718
      duplicate_compiler_generated_deps=$duplicate_deps
slouken@729
  1719
      ;;
slouken@729
  1720
    esac
slouken@729
  1721
    specialdeplibs=
slouken@729
  1722
slouken@729
  1723
    libs=
slouken@729
  1724
    # Find all interdependent deplibs by searching for libraries
slouken@729
  1725
    # that are linked more than once (e.g. -la -lb -la)
slouken@729
  1726
    for deplib in $deplibs; do
slouken@729
  1727
      if test "X$duplicate_deps" = "Xyes" ; then
slouken@729
  1728
	case "$libs " in
slouken@729
  1729
	*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
slouken@729
  1730
	esac
slouken@729
  1731
      fi
slouken@729
  1732
      libs="$libs $deplib"
slouken@729
  1733
    done
slouken@729
  1734
slouken@729
  1735
    if test "$linkmode" = lib; then
slouken@729
  1736
      libs="$predeps $libs $compiler_lib_search_path $postdeps"
slouken@729
  1737
slouken@729
  1738
      # Compute libraries that are listed more than once in $predeps
slouken@729
  1739
      # $postdeps and mark them as special (i.e., whose duplicates are
slouken@729
  1740
      # not to be eliminated).
slouken@729
  1741
      pre_post_deps=
slouken@729
  1742
      if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
slouken@729
  1743
	for pre_post_dep in $predeps $postdeps; do
slouken@729
  1744
	  case "$pre_post_deps " in
slouken@729
  1745
	  *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
slouken@729
  1746
	  esac
slouken@729
  1747
	  pre_post_deps="$pre_post_deps $pre_post_dep"
slouken@729
  1748
	done
slouken@729
  1749
      fi
slouken@729
  1750
      pre_post_deps=
slouken@729
  1751
    fi
slouken@729
  1752
slouken@729
  1753
    deplibs=
slouken@729
  1754
    newdependency_libs=
slouken@729
  1755
    newlib_search_path=
slouken@729
  1756
    need_relink=no # whether we're linking any uninstalled libtool libraries
slouken@729
  1757
    notinst_deplibs= # not-installed libtool libraries
slouken@729
  1758
    notinst_path= # paths that contain not-installed libtool libraries
slouken@729
  1759
    case $linkmode in
slouken@729
  1760
    lib)
slouken@729
  1761
	passes="conv link"
slouken@729
  1762
	for file in $dlfiles $dlprefiles; do
slouken@729
  1763
	  case $file in
slouken@729
  1764
	  *.la) ;;
slouken@729
  1765
	  *)
slouken@729
  1766
	    $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
slouken@729
  1767
	    exit 1
slouken@729
  1768
	    ;;
slouken@729
  1769
	  esac
slouken@729
  1770
	done
slouken@729
  1771
	;;
slouken@729
  1772
    prog)
slouken@729
  1773
	compile_deplibs=
slouken@729
  1774
	finalize_deplibs=
slouken@729
  1775
	alldeplibs=no
slouken@729
  1776
	newdlfiles=
slouken@729
  1777
	newdlprefiles=
slouken@729
  1778
	passes="conv scan dlopen dlpreopen link"
slouken@729
  1779
	;;
slouken@729
  1780
    *)  passes="conv"
slouken@729
  1781
	;;
slouken@729
  1782
    esac
slouken@729
  1783
    for pass in $passes; do
slouken@729
  1784
      if test "$linkmode,$pass" = "lib,link" ||
slouken@729
  1785
	 test "$linkmode,$pass" = "prog,scan"; then
slouken@729
  1786
	libs="$deplibs"
slouken@729
  1787
	deplibs=
slouken@729
  1788
      fi
slouken@729
  1789
      if test "$linkmode" = prog; then
slouken@729
  1790
	case $pass in
slouken@729
  1791
	dlopen) libs="$dlfiles" ;;
slouken@729
  1792
	dlpreopen) libs="$dlprefiles" ;;
slouken@729
  1793
	link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
slouken@729
  1794
	esac
slouken@729
  1795
      fi
slouken@729
  1796
      if test "$pass" = dlopen; then
slouken@729
  1797
	# Collect dlpreopened libraries
slouken@729
  1798
	save_deplibs="$deplibs"
slouken@729
  1799
	deplibs=
slouken@729
  1800
      fi
slouken@729
  1801
      for deplib in $libs; do
slouken@729
  1802
	lib=
slouken@729
  1803
	found=no
slouken@729
  1804
	case $deplib in
slouken@729
  1805
	-l*)
slouken@729
  1806
	  if test "$linkmode" != lib && test "$linkmode" != prog; then
slouken@729
  1807
	    $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
slouken@729
  1808
	    continue
slouken@729
  1809
	  fi
slouken@729
  1810
	  if test "$pass" = conv; then
slouken@729
  1811
	    deplibs="$deplib $deplibs"
slouken@729
  1812
	    continue
slouken@729
  1813
	  fi
slouken@729
  1814
	  name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
slouken@729
  1815
	  for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
slouken@729
  1816
	    # Search the libtool library
slouken@729
  1817
	    lib="$searchdir/lib${name}.la"
slouken@729
  1818
	    if test -f "$lib"; then
slouken@729
  1819
	      found=yes
slouken@729
  1820
	      break
slouken@729
  1821
	    fi
slouken@729
  1822
	  done
slouken@729
  1823
	  if test "$found" != yes; then
slouken@729
  1824
	    # deplib doesn't seem to be a libtool library
slouken@729
  1825
	    if test "$linkmode,$pass" = "prog,link"; then
slouken@729
  1826
	      compile_deplibs="$deplib $compile_deplibs"
slouken@729
  1827
	      finalize_deplibs="$deplib $finalize_deplibs"
slouken@729
  1828
	    else
slouken@729
  1829
	      deplibs="$deplib $deplibs"
slouken@729
  1830
	      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
slouken@729
  1831
	    fi
slouken@729
  1832
	    continue
slouken@729
  1833
	  else # deplib is a libtool library
slouken@729
  1834
	    # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
slouken@729
  1835
	    # We need to do some special things here, and not later.
slouken@729
  1836
	    if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
slouken@729
  1837
	      case " $predeps $postdeps " in
slouken@729
  1838
	      *" $deplib "*)
slouken@729
  1839
		if (${SED} -e '2q' $lib |
slouken@729
  1840
                    grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
slouken@729
  1841
		  library_names=
slouken@729
  1842
		  old_library=
slouken@729
  1843
		  case $lib in
slouken@729
  1844
		  */* | *\\*) . $lib ;;
slouken@729
  1845
		  *) . ./$lib ;;
slouken@729
  1846
		  esac
slouken@729
  1847
		  for l in $old_library $library_names; do
slouken@729
  1848
		    ll="$l"
slouken@729
  1849
		  done
slouken@729
  1850
		  if test "X$ll" = "X$old_library" ; then # only static version available
slouken@729
  1851
		    found=no
slouken@729
  1852
		    ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
slouken@729
  1853
		    test "X$ladir" = "X$lib" && ladir="."
slouken@729
  1854
		    lib=$ladir/$old_library
slouken@729
  1855
		    if test "$linkmode,$pass" = "prog,link"; then
slouken@729
  1856
		      compile_deplibs="$deplib $compile_deplibs"
slouken@729
  1857
		      finalize_deplibs="$deplib $finalize_deplibs"
slouken@729
  1858
		    else
slouken@729
  1859
		      deplibs="$deplib $deplibs"
slouken@729
  1860
		      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
slouken@729
  1861
		    fi
slouken@729
  1862
		    continue
slouken@729
  1863
		  fi
slouken@729
  1864
		fi
slouken@729
  1865
	        ;;
slouken@729
  1866
	      *) ;;
slouken@729
  1867
	      esac
slouken@729
  1868
	    fi
slouken@729
  1869
	  fi
slouken@729
  1870
	  ;; # -l
slouken@729
  1871
	-L*)
slouken@729
  1872
	  case $linkmode in
slouken@729
  1873
	  lib)
slouken@729
  1874
	    deplibs="$deplib $deplibs"
slouken@729
  1875
	    test "$pass" = conv && continue
slouken@729
  1876
	    newdependency_libs="$deplib $newdependency_libs"
slouken@729
  1877
	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
slouken@729
  1878
	    ;;
slouken@729
  1879
	  prog)
slouken@729
  1880
	    if test "$pass" = conv; then
slouken@729
  1881
	      deplibs="$deplib $deplibs"
slouken@729
  1882
	      continue
slouken@729
  1883
	    fi
slouken@729
  1884
	    if test "$pass" = scan; then
slouken@729
  1885
	      deplibs="$deplib $deplibs"
slouken@729
  1886
	      newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
slouken@729
  1887
	    else
slouken@729
  1888
	      compile_deplibs="$deplib $compile_deplibs"
slouken@729
  1889
	      finalize_deplibs="$deplib $finalize_deplibs"
slouken@729
  1890
	    fi
slouken@729
  1891
	    ;;
slouken@729
  1892
	  *)
slouken@729
  1893
	    $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
slouken@729
  1894
	    ;;
slouken@729
  1895
	  esac # linkmode
slouken@729
  1896
	  continue
slouken@729
  1897
	  ;; # -L
slouken@729
  1898
	-R*)
slouken@729
  1899
	  if test "$pass" = link; then
slouken@729
  1900
	    dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
slouken@729
  1901
	    # Make sure the xrpath contains only unique directories.
slouken@729
  1902
	    case "$xrpath " in
slouken@729
  1903
	    *" $dir "*) ;;
slouken@729
  1904
	    *) xrpath="$xrpath $dir" ;;
slouken@729
  1905
	    esac
slouken@729
  1906
	  fi
slouken@729
  1907
	  deplibs="$deplib $deplibs"
slouken@729
  1908
	  continue
slouken@729
  1909
	  ;;
slouken@729
  1910
	*.la) lib="$deplib" ;;
slouken@729
  1911
	*.$libext)
slouken@729
  1912
	  if test "$pass" = conv; then
slouken@729
  1913
	    deplibs="$deplib $deplibs"
slouken@729
  1914
	    continue
slouken@729
  1915
	  fi
slouken@729
  1916
	  case $linkmode in
slouken@729
  1917
	  lib)
slouken@729
  1918
	    if test "$deplibs_check_method" != pass_all; then
slouken@729
  1919
	      $echo
slouken@729
  1920
	      $echo "*** Warning: Trying to link with static lib archive $deplib."
slouken@729
  1921
	      $echo "*** I have the capability to make that library automatically link in when"
slouken@729
  1922
	      $echo "*** you link to this library.  But I can only do this if you have a"
slouken@729
  1923
	      $echo "*** shared version of the library, which you do not appear to have"
slouken@729
  1924
	      $echo "*** because the file extensions .$libext of this argument makes me believe"
slouken@729
  1925
	      $echo "*** that it is just a static archive that I should not used here."
slouken@729
  1926
	    else
slouken@729
  1927
	      $echo
slouken@729
  1928
	      $echo "*** Warning: Linking the shared library $output against the"
slouken@729
  1929
	      $echo "*** static library $deplib is not portable!"
slouken@729
  1930
	      deplibs="$deplib $deplibs"
slouken@729
  1931
	    fi
slouken@729
  1932
	    continue
slouken@729
  1933
	    ;;
slouken@729
  1934
	  prog)
slouken@729
  1935
	    if test "$pass" != link; then
slouken@729
  1936
	      deplibs="$deplib $deplibs"
slouken@729
  1937
	    else
slouken@729
  1938
	      compile_deplibs="$deplib $compile_deplibs"
slouken@729
  1939
	      finalize_deplibs="$deplib $finalize_deplibs"
slouken@729
  1940
	    fi
slouken@729
  1941
	    continue
slouken@729
  1942
	    ;;
slouken@729
  1943
	  esac # linkmode
slouken@729
  1944
	  ;; # *.$libext
slouken@729
  1945
	*.lo | *.$objext)
slouken@729
  1946
	  if test "$pass" = conv; then
slouken@729
  1947
	    deplibs="$deplib $deplibs"
slouken@729
  1948
	  elif test "$linkmode" = prog; then
slouken@729
  1949
	    if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
slouken@729
  1950
	      # If there is no dlopen support or we're linking statically,
slouken@729
  1951
	      # we need to preload.
slouken@729
  1952
	      newdlprefiles="$newdlprefiles $deplib"
slouken@729
  1953
	      compile_deplibs="$deplib $compile_deplibs"
slouken@729
  1954
	      finalize_deplibs="$deplib $finalize_deplibs"
slouken@729
  1955
	    else
slouken@729
  1956
	      newdlfiles="$newdlfiles $deplib"
slouken@729
  1957
	    fi
slouken@729
  1958
	  fi
slouken@729
  1959
	  continue
slouken@729
  1960
	  ;;
slouken@729
  1961
	%DEPLIBS%)
slouken@729
  1962
	  alldeplibs=yes
slouken@729
  1963
	  continue
slouken@729
  1964
	  ;;
slouken@729
  1965
	esac # case $deplib
slouken@729
  1966
	if test "$found" = yes || test -f "$lib"; then :
slouken@729
  1967
	else
slouken@729
  1968
	  $echo "$modename: cannot find the library \`$lib'" 1>&2
slouken@729
  1969
	  exit 1
slouken@729
  1970
	fi
slouken@729
  1971
slouken@729
  1972
	# Check to see that this really is a libtool archive.
slouken@729
  1973
	if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
slouken@729
  1974
	else
slouken@729
  1975
	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
slouken@729
  1976
	  exit 1
slouken@729
  1977
	fi
slouken@729
  1978
slouken@729
  1979
	ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
slouken@729
  1980
	test "X$ladir" = "X$lib" && ladir="."
slouken@729
  1981
slouken@0
  1982
	dlname=
slouken@729
  1983
	dlopen=
slouken@729
  1984
	dlpreopen=
slouken@0
  1985
	libdir=
slouken@0
  1986
	library_names=
slouken@0
  1987
	old_library=
slouken@729
  1988
	# If the library was installed with an old release of libtool,
slouken@729
  1989
	# it will not redefine variables installed, or shouldnotlink
slouken@729
  1990
	installed=yes
slouken@729
  1991
	shouldnotlink=no
slouken@729
  1992
slouken@729
  1993
	# Read the .la file
slouken@729
  1994
	case $lib in
slouken@729
  1995
	*/* | *\\*) . $lib ;;
slouken@729
  1996
	*) . ./$lib ;;
slouken@729
  1997
	esac
slouken@729
  1998
slouken@729
  1999
	if test "$linkmode,$pass" = "lib,link" ||
slouken@729
  2000
	   test "$linkmode,$pass" = "prog,scan" ||
slouken@729
  2001
	   { test "$linkmode" != prog && test "$linkmode" != lib; }; then
slouken@729
  2002
	  test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
slouken@729
  2003
	  test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
slouken@0
  2004
	fi
slouken@0
  2005
slouken@729
  2006
	if test "$pass" = conv; then
slouken@729
  2007
	  # Only check for convenience libraries
slouken@729
  2008
	  deplibs="$lib $deplibs"
slouken@729
  2009
	  if test -z "$libdir"; then
slouken@729
  2010
	    if test -z "$old_library"; then
slouken@729
  2011
	      $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
slouken@729
  2012
	      exit 1
slouken@729
  2013
	    fi
slouken@729
  2014
	    # It is a libtool convenience library, so add in its objects.
slouken@729
  2015
	    convenience="$convenience $ladir/$objdir/$old_library"
slouken@729
  2016
	    old_convenience="$old_convenience $ladir/$objdir/$old_library"
slouken@729
  2017
	    tmp_libs=
slouken@729
  2018
	    for deplib in $dependency_libs; do
slouken@729
  2019
	      deplibs="$deplib $deplibs"
slouken@729
  2020
              if test "X$duplicate_deps" = "Xyes" ; then
slouken@729
  2021
	        case "$tmp_libs " in
slouken@729
  2022
	        *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
slouken@729
  2023
	        esac
slouken@729
  2024
              fi
slouken@729
  2025
	      tmp_libs="$tmp_libs $deplib"
slouken@729
  2026
	    done
slouken@729
  2027
	  elif test "$linkmode" != prog && test "$linkmode" != lib; then
slouken@729
  2028
	    $echo "$modename: \`$lib' is not a convenience library" 1>&2
slouken@729
  2029
	    exit 1
slouken@729
  2030
	  fi
slouken@729
  2031
	  continue
slouken@729
  2032
	fi # $pass = conv
slouken@729
  2033
slouken@729
  2034
    
slouken@0
  2035
	# Get the name of the library we link against.
slouken@0
  2036
	linklib=
slouken@0
  2037
	for l in $old_library $library_names; do
slouken@0
  2038
	  linklib="$l"
slouken@0
  2039
	done
slouken@0
  2040
	if test -z "$linklib"; then
slouken@729
  2041
	  $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
slouken@0
  2042
	  exit 1
slouken@0
  2043
	fi
slouken@0
  2044
slouken@729
  2045
	# This library was specified with -dlopen.
slouken@729
  2046
	if test "$pass" = dlopen; then
slouken@729
  2047
	  if test -z "$libdir"; then
slouken@729
  2048
	    $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
slouken@729
  2049
	    exit 1
slouken@729
  2050
	  fi
slouken@729
  2051
	  if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
slouken@729
  2052
	    # If there is no dlname, no dlopen support or we're linking
slouken@729
  2053
	    # statically, we need to preload.  We also need to preload any
slouken@729
  2054
	    # dependent libraries so libltdl's deplib preloader doesn't
slouken@729
  2055
	    # bomb out in the load deplibs phase.
slouken@729
  2056
	    dlprefiles="$dlprefiles $lib $dependency_libs"
slouken@729
  2057
	  else
slouken@729
  2058
	    newdlfiles="$newdlfiles $lib"
slouken@729
  2059
	  fi
slouken@729
  2060
	  continue
slouken@729
  2061
	fi # $pass = dlopen
slouken@729
  2062
slouken@729
  2063
	# We need an absolute path.
slouken@729
  2064
	case $ladir in
slouken@729
  2065
	[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
slouken@729
  2066
	*)
slouken@729
  2067
	  abs_ladir=`cd "$ladir" && pwd`
slouken@729
  2068
	  if test -z "$abs_ladir"; then
slouken@729
  2069
	    $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
slouken@729
  2070
	    $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
slouken@729
  2071
	    abs_ladir="$ladir"
slouken@729
  2072
	  fi
slouken@729
  2073
	  ;;
slouken@729
  2074
	esac
slouken@729
  2075
	laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
slouken@729
  2076
slouken@0
  2077
	# Find the relevant object directory and library name.
slouken@0
  2078
	if test "X$installed" = Xyes; then
slouken@729
  2079
	  if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
slouken@729
  2080
	    $echo "$modename: warning: library \`$lib' was moved." 1>&2
slouken@729
  2081
	    dir="$ladir"
slouken@729
  2082
	    absdir="$abs_ladir"
slouken@729
  2083
	    libdir="$abs_ladir"
slouken@729
  2084
	  else
slouken@729
  2085
	    dir="$libdir"
slouken@729
  2086
	    absdir="$libdir"
slouken@729
  2087
	  fi
slouken@0
  2088
	else
slouken@729
  2089
	  dir="$ladir/$objdir"
slouken@729
  2090
	  absdir="$abs_ladir/$objdir"
slouken@729
  2091
	  # Remove this search path later
slouken@729
  2092
	  notinst_path="$notinst_path $abs_ladir"
slouken@729
  2093
	fi # $installed = yes
slouken@729
  2094
	name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
slouken@729
  2095
slouken@729
  2096
	# This library was specified with -dlpreopen.
slouken@729
  2097
	if test "$pass" = dlpreopen; then
slouken@729
  2098
	  if test -z "$libdir"; then
slouken@729
  2099
	    $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
slouken@729
  2100
	    exit 1
slouken@729
  2101
	  fi
slouken@729
  2102
	  # Prefer using a static library (so that no silly _DYNAMIC symbols
slouken@729
  2103
	  # are required to link).
slouken@729
  2104
	  if test -n "$old_library"; then
slouken@729
  2105
	    newdlprefiles="$newdlprefiles $dir/$old_library"
slouken@729
  2106
	  # Otherwise, use the dlname, so that lt_dlopen finds it.
slouken@729
  2107
	  elif test -n "$dlname"; then
slouken@729
  2108
	    newdlprefiles="$newdlprefiles $dir/$dlname"
slouken@0
  2109
	  else
slouken@729
  2110
	    newdlprefiles="$newdlprefiles $dir/$linklib"
slouken@0
  2111
	  fi
slouken@729
  2112
	fi # $pass = dlpreopen
slouken@0
  2113
slouken@0
  2114
	if test -z "$libdir"; then
slouken@729
  2115
	  # Link the convenience library
slouken@729
  2116
	  if test "$linkmode" = lib; then
slouken@729
  2117
	    deplibs="$dir/$old_library $deplibs"
slouken@729
  2118
	  elif test "$linkmode,$pass" = "prog,link"; then
slouken@729
  2119
	    compile_deplibs="$dir/$old_library $compile_deplibs"
slouken@729
  2120
	    finalize_deplibs="$dir/$old_library $finalize_deplibs"
slouken@729
  2121
	  else
slouken@729
  2122
	    deplibs="$lib $deplibs" # used for prog,scan pass
slouken@729
  2123
	  fi
slouken@0
  2124
	  continue
slouken@0
  2125
	fi
slouken@0
  2126
slouken@729
  2127
    
slouken@729
  2128
	if test "$linkmode" = prog && test "$pass" != link; then
slouken@729
  2129
	  newlib_search_path="$newlib_search_path $ladir"
slouken@729
  2130
	  deplibs="$lib $deplibs"
slouken@729
  2131
slouken@729
  2132
	  linkalldeplibs=no
slouken@729
  2133
	  if test "$link_all_deplibs" != no || test -z "$library_names" ||
slouken@729
  2134
	     test "$build_libtool_libs" = no; then
slouken@729
  2135
	    linkalldeplibs=yes
slouken@729
  2136
	  fi
slouken@729
  2137
slouken@729
  2138
	  tmp_libs=
slouken@729
  2139
	  for deplib in $dependency_libs; do
slouken@729
  2140
	    case $deplib in
slouken@729
  2141
	    -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
slouken@729
  2142
	    esac
slouken@729
  2143
	    # Need to link against all dependency_libs?
slouken@729
  2144
	    if test "$linkalldeplibs" = yes; then
slouken@729
  2145
	      deplibs="$deplib $deplibs"
slouken@729
  2146
	    else
slouken@729
  2147
	      # Need to hardcode shared library paths
slouken@729
  2148
	      # or/and link against static libraries
slouken@729
  2149
	      newdependency_libs="$deplib $newdependency_libs"
slouken@729
  2150
	    fi
slouken@729
  2151
	    if test "X$duplicate_deps" = "Xyes" ; then
slouken@729
  2152
	      case "$tmp_libs " in
slouken@729
  2153
	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
slouken@729
  2154
	      esac
slouken@729
  2155
	    fi
slouken@729
  2156
	    tmp_libs="$tmp_libs $deplib"
slouken@729
  2157
	  done # for deplib
slouken@729
  2158
	  continue
slouken@729
  2159
	fi # $linkmode = prog...
slouken@729
  2160
slouken@729
  2161
	if test "$linkmode,$pass" = "prog,link"; then
slouken@729
  2162
	  if test -n "$library_names" &&
slouken@729
  2163
	     { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
slouken@729
  2164
	    # We need to hardcode the library path
slouken@729
  2165
	    if test -n "$shlibpath_var"; then
slouken@729
  2166
	      # Make sure the rpath contains only unique directories.
slouken@729
  2167
	      case "$temp_rpath " in
slouken@729
  2168
	      *" $dir "*) ;;
slouken@729
  2169
	      *" $absdir "*) ;;
slouken@729
  2170
	      *) temp_rpath="$temp_rpath $dir" ;;
slouken@729
  2171
	      esac
slouken@729
  2172
	    fi
slouken@729
  2173
slouken@729
  2174
	    # Hardcode the library path.
slouken@729
  2175
	    # Skip directories that are in the system default run-time
slouken@729
  2176
	    # search path.
slouken@729
  2177
	    case " $sys_lib_dlsearch_path " in
slouken@729
  2178
	    *" $absdir "*) ;;
slouken@729
  2179
	    *)
slouken@729
  2180
	      case "$compile_rpath " in
slouken@729
  2181
	      *" $absdir "*) ;;
slouken@729
  2182
	      *) compile_rpath="$compile_rpath $absdir"
slouken@729
  2183
	      esac
slouken@729
  2184
	      ;;
slouken@729
  2185
	    esac
slouken@729
  2186
	    case " $sys_lib_dlsearch_path " in
slouken@729
  2187
	    *" $libdir "*) ;;
slouken@729
  2188
	    *)
slouken@729
  2189
	      case "$finalize_rpath " in
slouken@729
  2190
	      *" $libdir "*) ;;
slouken@729
  2191
	      *) finalize_rpath="$finalize_rpath $libdir"
slouken@729
  2192
	      esac
slouken@729
  2193
	      ;;
slouken@729
  2194
	    esac
slouken@729
  2195
	  fi # $linkmode,$pass = prog,link...
slouken@729
  2196
slouken@729
  2197
	  if test "$alldeplibs" = yes &&
slouken@729
  2198
	     { test "$deplibs_check_method" = pass_all ||
slouken@729
  2199
	       { test "$build_libtool_libs" = yes &&
slouken@729
  2200
		 test -n "$library_names"; }; }; then
slouken@729
  2201
	    # We only need to search for static libraries
slouken@0
  2202
	    continue
slouken@0
  2203
	  fi
slouken@0
  2204
	fi
slouken@0
  2205
slouken@729
  2206
	link_static=no # Whether the deplib will be linked statically
slouken@0
  2207
	if test -n "$library_names" &&
slouken@0
  2208
	   { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
slouken@729
  2209
	  if test "$installed" = no; then
slouken@729
  2210
	    notinst_deplibs="$notinst_deplibs $lib"
slouken@729
  2211
	    need_relink=yes
slouken@729
  2212
	  fi
slouken@729
  2213
	  # This is a shared library
slouken@729
  2214
	
slouken@729
  2215
      # Warn about portability, can't link against -module's on some systems (darwin)
slouken@729
  2216
      if test "$shouldnotlink" = yes && test "$pass" = link ; then
slouken@729
  2217
	    $echo
slouken@729
  2218
	    if test "$linkmode" = prog; then
slouken@729
  2219
	      $echo "*** Warning: Linking the executable $output against the loadable module"
slouken@729
  2220
	    else
slouken@729
  2221
	      $echo "*** Warning: Linking the shared library $output against the loadable module"
slouken@729
  2222
	    fi
slouken@729
  2223
	    $echo "*** $linklib is not portable!"    
slouken@729
  2224
      fi	  
slouken@729
  2225
	  if test "$linkmode" = lib &&
slouken@729
  2226
	     test "$hardcode_into_libs" = yes; then
slouken@729
  2227
	    # Hardcode the library path.
slouken@729
  2228
	    # Skip directories that are in the system default run-time
slouken@729
  2229
	    # search path.
slouken@729
  2230
	    case " $sys_lib_dlsearch_path " in
slouken@729
  2231
	    *" $absdir "*) ;;
slouken@729
  2232
	    *)
slouken@729
  2233
	      case "$compile_rpath " in
slouken@729
  2234
	      *" $absdir "*) ;;
slouken@729
  2235
	      *) compile_rpath="$compile_rpath $absdir"
slouken@729
  2236
	      esac
slouken@729
  2237
	      ;;
slouken@729
  2238
	    esac
slouken@729
  2239
	    case " $sys_lib_dlsearch_path " in
slouken@729
  2240
	    *" $libdir "*) ;;
slouken@729
  2241
	    *)
slouken@729
  2242
	      case "$finalize_rpath " in
slouken@729
  2243
	      *" $libdir "*) ;;
slouken@729
  2244
	      *) finalize_rpath="$finalize_rpath $libdir"
slouken@729
  2245
	      esac
slouken@729
  2246
	      ;;
slouken@0
  2247
	    esac
slouken@0
  2248
	  fi
slouken@0
  2249
slouken@729
  2250
	  if test -n "$old_archive_from_expsyms_cmds"; then
slouken@729
  2251
	    # figure out the soname
slouken@729
  2252
	    set dummy $library_names
slouken@729
  2253
	    realname="$2"
slouken@729
  2254
	    shift; shift
slouken@729
  2255
	    libname=`eval \\$echo \"$libname_spec\"`
slouken@729
  2256
	    # use dlname if we got it. it's perfectly good, no?
slouken@729
  2257
	    if test -n "$dlname"; then
slouken@729
  2258
	      soname="$dlname"
slouken@729
  2259
	    elif test -n "$soname_spec"; then
slouken@729
  2260
	      # bleh windows
slouken@729
  2261
	      case $host in
slouken@729
  2262
	      *cygwin* | mingw*)
slouken@729
  2263
		major=`expr $current - $age`
slouken@729
  2264
		versuffix="-$major"
slouken@0
  2265
		;;
slouken@0
  2266
	      esac
slouken@729
  2267
	      eval soname=\"$soname_spec\"
slouken@729
  2268
	    else
slouken@729
  2269
	      soname="$realname"
slouken@729
  2270
	    fi
slouken@729
  2271
slouken@729
  2272
	    # Make a new name for the extract_expsyms_cmds to use
slouken@729
  2273
	    soroot="$soname"
slouken@729
  2274
	    soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
slouken@729
  2275
	    newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
slouken@729
  2276
slouken@729
  2277
	    # If the library has no export list, then create one now
slouken@729
  2278
	    if test -f "$output_objdir/$soname-def"; then :
slouken@729
  2279
	    else
slouken@729
  2280
	      $show "extracting exported symbol list from \`$soname'"
slouken@729
  2281
	      save_ifs="$IFS"; IFS='~'
slouken@729
  2282
	      eval cmds=\"$extract_expsyms_cmds\"
slouken@729
  2283
	      for cmd in $cmds; do
slouken@729
  2284
		IFS="$save_ifs"
slouken@729
  2285
		$show "$cmd"
slouken@729
  2286
		$run eval "$cmd" || exit $?
slouken@729
  2287
	      done
slouken@729
  2288
	      IFS="$save_ifs"
slouken@729
  2289
	    fi
slouken@729
  2290
slouken@729
  2291
	    # Create $newlib
slouken@729
  2292
	    if test -f "$output_objdir/$newlib"; then :; else
slouken@729
  2293
	      $show "generating import library for \`$soname'"
slouken@729
  2294
	      save_ifs="$IFS"; IFS='~'
slouken@729
  2295
	      eval cmds=\"$old_archive_from_expsyms_cmds\"
slouken@729
  2296
	      for cmd in $cmds; do
slouken@729
  2297
		IFS="$save_ifs"
slouken@729
  2298
		$show "$cmd"
slouken@729
  2299
		$run eval "$cmd" || exit $?
slouken@729
  2300
	      done
slouken@729
  2301
	      IFS="$save_ifs"
slouken@729
  2302
	    fi
slouken@729
  2303
	    # make sure the library variables are pointing to the new library
slouken@729
  2304
	    dir=$output_objdir
slouken@729
  2305
	    linklib=$newlib
slouken@729
  2306
	  fi # test -n "$old_archive_from_expsyms_cmds"
slouken@729
  2307
slouken@729
  2308
	  if test "$linkmode" = prog || test "$mode" != relink; then
slouken@729
  2309
	    add_shlibpath=
slouken@729
  2310
	    add_dir=
slouken@729
  2311
	    add=
slouken@729
  2312
	    lib_linked=yes
slouken@729
  2313
	    case $hardcode_action in
slouken@729
  2314
	    immediate | unsupported)
slouken@729
  2315
	      if test "$hardcode_direct" = no; then
slouken@729
  2316
		add="$dir/$linklib"
slouken@729
  2317
		case $host in
slouken@729
  2318
		  *-*-sco3.2v5* ) add_dir="-L$dir" ;;
slouken@729
  2319
		  *-*-darwin* )
slouken@729
  2320
		    # if the lib is a module then we can not link against it, someone
slouken@729
  2321
		    # is ignoring the new warnings I added
slouken@729
  2322
		    if /usr/bin/file -L $add 2> /dev/null | grep "bundle" >/dev/null ; then
slouken@729
  2323
		      $echo "** Warning, lib $linklib is a module, not a shared library"
slouken@729
  2324
		      if test -z "$old_library" ; then
slouken@729
  2325
		        $echo
slouken@729
  2326
		        $echo "** And there doesn't seem to be a static archive available"
slouken@729
  2327
		        $echo "** The link will probably fail, sorry"
slouken@729
  2328
		      else
slouken@729
  2329
		        add="$dir/$old_library"
slouken@729
  2330
		      fi 
slouken@729
  2331
		    fi
slouken@729
  2332
		esac
slouken@729
  2333
	      elif test "$hardcode_minus_L" = no; then
slouken@729
  2334
		case $host in
slouken@729
  2335
		*-*-sunos*) add_shlibpath="$dir" ;;
slouken@729
  2336
		esac
slouken@729
  2337
		add_dir="-L$dir"
slouken@729
  2338
		add="-l$name"
slouken@729
  2339
	      elif test "$hardcode_shlibpath_var" = no; then
slouken@729
  2340
		add_shlibpath="$dir"
slouken@729
  2341
		add="-l$name"
slouken@729
  2342
	      else
slouken@729
  2343
		lib_linked=no
slouken@729
  2344
	      fi
slouken@729
  2345
	      ;;
slouken@729
  2346
	    relink)
slouken@729
  2347
	      if test "$hardcode_direct" = yes; then
slouken@729
  2348
		add="$dir/$linklib"
slouken@729
  2349
	      elif test "$hardcode_minus_L" = yes; then
slouken@729
  2350
		add_dir="-L$dir"
slouken@729
  2351
		# Try looking first in the location we're being installed to.
slouken@729
  2352
		if test -n "$inst_prefix_dir"; then
slouken@729
  2353
		  case "$libdir" in
slouken@729
  2354
		    [\\/]*)
slouken@729
  2355
		      add_dir="-L$inst_prefix_dir$libdir $add_dir"
slouken@729
  2356
		      ;;
slouken@729
  2357
		  esac
slouken@729
  2358
		fi
slouken@729
  2359
		add="-l$name"
slouken@729
  2360
	      elif test "$hardcode_shlibpath_var" = yes; then
slouken@729
  2361
		add_shlibpath="$dir"
slouken@729
  2362
		add="-l$name"
slouken@729
  2363
	      else
slouken@729
  2364
		lib_linked=no
slouken@729
  2365
	      fi
slouken@729
  2366
	      ;;
slouken@729
  2367
	    *) lib_linked=no ;;
slouken@729
  2368
	    esac
slouken@729
  2369
slouken@729
  2370
	    if test "$lib_linked" != yes; then
slouken@729
  2371
	      $echo "$modename: configuration error: unsupported hardcode properties"
slouken@729
  2372
	      exit 1
slouken@729
  2373
	    fi
slouken@729
  2374
slouken@729
  2375
	    if test -n "$add_shlibpath"; then
slouken@729
  2376
	      case :$compile_shlibpath: in
slouken@729
  2377
	      *":$add_shlibpath:"*) ;;
slouken@729
  2378
	      *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
slouken@0
  2379
	      esac
slouken@729
  2380
	    fi
slouken@729
  2381
	    if test "$linkmode" = prog; then
slouken@729
  2382
	      test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
slouken@729
  2383
	      test -n "$add" && compile_deplibs="$add $compile_deplibs"
slouken@729
  2384
	    else
slouken@729
  2385
	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
slouken@729
  2386
	      test -n "$add" && deplibs="$add $deplibs"
slouken@729
  2387
	      if test "$hardcode_direct" != yes && \
slouken@729
  2388
		 test "$hardcode_minus_L" != yes && \
slouken@729
  2389
		 test "$hardcode_shlibpath_var" = yes; then
slouken@729
  2390
		case :$finalize_shlibpath: in
slouken@729
  2391
		*":$libdir:"*) ;;
slouken@729
  2392
		*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
slouken@729
  2393
		esac
slouken@729
  2394
	      fi
slouken@729
  2395
	    fi
slouken@729
  2396
	  fi
slouken@729
  2397
slouken@729
  2398
	  if test "$linkmode" = prog || test "$mode" = relink; then
slouken@729
  2399
	    add_shlibpath=
slouken@729
  2400
	    add_dir=
slouken@729
  2401
	    add=
slouken@729
  2402
	    # Finalize command for both is simple: just hardcode it.
slouken@729
  2403
	    if test "$hardcode_direct" = yes; then
slouken@729
  2404
	      add="$libdir/$linklib"
slouken@729
  2405
	    elif test "$hardcode_minus_L" = yes; then
slouken@729
  2406
	      add_dir="-L$libdir"
slouken@729
  2407
	      add="-l$name"
slouken@729
  2408
	    elif test "$hardcode_shlibpath_var" = yes; then
slouken@729
  2409
	      case :$finalize_shlibpath: in
slouken@729
  2410
	      *":$libdir:"*) ;;
slouken@729
  2411
	      *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
slouken@0
  2412
	      esac
slouken@729
  2413
	      add="-l$name"
slouken@729
  2414
	    elif test "$hardcode_automatic" = yes; then
slouken@729
  2415
	      if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then
slouken@729
  2416
	        add="$inst_prefix_dir$libdir/$linklib"
slouken@729
  2417
	      else
slouken@729
  2418
	        add="$libdir/$linklib"
slouken@729
  2419
	      fi
slouken@0
  2420
	    else
slouken@729
  2421
	      # We cannot seem to hardcode it, guess we'll fake it.
slouken@729
  2422
	      add_dir="-L$libdir"
slouken@729
  2423
	      # Try looking first in the location we're being installed to.
slouken@729
  2424
	      if test -n "$inst_prefix_dir"; then
slouken@729
  2425
		case "$libdir" in
slouken@729
  2426
		  [\\/]*)
slouken@729
  2427
		    add_dir="-L$inst_prefix_dir$libdir $add_dir"
slouken@729
  2428
		    ;;
slouken@729
  2429
		esac
slouken@729
  2430
	      fi
slouken@729
  2431
	      add="-l$name"
slouken@0
  2432
	    fi
slouken@729
  2433
slouken@729
  2434
	    if test "$linkmode" = prog; then
slouken@729
  2435
	      test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
slouken@729
  2436
	      test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
slouken@0
  2437
	    else
slouken@729
  2438
	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
slouken@729
  2439
	      test -n "$add" && deplibs="$add $deplibs"
slouken@0
  2440
	    fi
slouken@0
  2441
	  fi
slouken@729
  2442
	elif test "$linkmode" = prog; then
slouken@0
  2443
	  # Here we assume that one of hardcode_direct or hardcode_minus_L
slouken@0
  2444
	  # is not unsupported.  This is valid on all known static and
slouken@0
  2445
	  # shared platforms.
slouken@0
  2446
	  if test "$hardcode_direct" != unsupported; then
slouken@0
  2447
	    test -n "$old_library" && linklib="$old_library"
slouken@729
  2448
	    compile_deplibs="$dir/$linklib $compile_deplibs"
slouken@729
  2449
	    finalize_deplibs="$dir/$linklib $finalize_deplibs"
slouken@0
  2450
	  else
slouken@729
  2451
	    compile_deplibs="-l$name -L$dir $compile_deplibs"
slouken@729
  2452
	    finalize_deplibs="-l$name -L$dir $finalize_deplibs"
slouken@729
  2453
	  fi
slouken@729
  2454
	elif test "$build_libtool_libs" = yes; then
slouken@729
  2455
	  # Not a shared library
slouken@729
  2456
	  if test "$deplibs_check_method" != pass_all; then
slouken@729
  2457
	    # We're trying link a shared library against a static one
slouken@729
  2458
	    # but the system doesn't support it.
slouken@729
  2459
slouken@729
  2460
	    # Just print a warning and add the library to dependency_libs so
slouken@729
  2461
	    # that the program can be linked against the static library.
slouken@729
  2462
	    $echo
slouken@729
  2463
	    $echo "*** Warning: This system can not link to static lib archive $lib."
slouken@729
  2464
	    $echo "*** I have the capability to make that library automatically link in when"
slouken@729
  2465
	    $echo "*** you link to this library.  But I can only do this if you have a"
slouken@729
  2466
	    $echo "*** shared version of the library, which you do not appear to have."
slouken@729
  2467
	    if test "$module" = yes; then
slouken@729
  2468
	      $echo "*** But as you try to build a module library, libtool will still create "
slouken@729
  2469
	      $echo "*** a static module, that should work as long as the dlopening application"
slouken@729
  2470
	      $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
slouken@729
  2471
	      if test -z "$global_symbol_pipe"; then
slouken@729
  2472
		$echo
slouken@729
  2473
		$echo "*** However, this would only work if libtool was able to extract symbol"
slouken@729
  2474
		$echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
slouken@729
  2475
		$echo "*** not find such a program.  So, this module is probably useless."
slouken@729
  2476
		$echo "*** \`nm' from GNU binutils and a full rebuild may help."
slouken@729
  2477
	      fi
slouken@729
  2478
	      if test "$build_old_libs" = no; then
slouken@729
  2479
		build_libtool_libs=module
slouken@729
  2480
		build_old_libs=yes
slouken@729
  2481
	      else
slouken@729
  2482
		build_libtool_libs=no
slouken@729
  2483
	      fi
slouken@729
  2484
	    fi
slouken@729
  2485
	  else
slouken@729
  2486
	    convenience="$convenience $dir/$old_library"
slouken@729
  2487
	    old_convenience="$old_convenience $dir/$old_library"
slouken@729
  2488
	    deplibs="$dir/$old_library $deplibs"
slouken@729
  2489
	    link_static=yes
slouken@729
  2490
	  fi
slouken@729
  2491
	fi # link shared/static library?
slouken@729
  2492
slouken@729
  2493
	if test "$linkmode" = lib; then
slouken@729
  2494
	  if test -n "$dependency_libs" &&
slouken@729
  2495
	     { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes ||
slouken@729
  2496
	       test "$link_static" = yes; }; then
slouken@729
  2497
	    # Extract -R from dependency_libs
slouken@729
  2498
	    temp_deplibs=
slouken@729
  2499
	    for libdir in $dependency_libs; do
slouken@729
  2500
	      case $libdir in
slouken@729
  2501
	      -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
slouken@729
  2502
		   case " $xrpath " in
slouken@729
  2503
		   *" $temp_xrpath "*) ;;
slouken@729
  2504
		   *) xrpath="$xrpath $temp_xrpath";;
slouken@729
  2505
		   esac;;
slouken@729
  2506
	      *) temp_deplibs="$temp_deplibs $libdir";;
slouken@729
  2507
	      esac
slouken@729
  2508
	    done
slouken@729
  2509
	    dependency_libs="$temp_deplibs"
slouken@729
  2510
	  fi
slouken@729
  2511
slouken@729
  2512
	  newlib_search_path="$newlib_search_path $absdir"
slouken@729
  2513
	  # Link against this library
slouken@729
  2514
	  test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
slouken@729
  2515
	  # ... and its dependency_libs
slouken@729
  2516
	  tmp_libs=
slouken@729
  2517
	  for deplib in $dependency_libs; do
slouken@729
  2518
	    newdependency_libs="$deplib $newdependency_libs"
slouken@729
  2519
	    if test "X$duplicate_deps" = "Xyes" ; then
slouken@729
  2520
	      case "$tmp_libs " in
slouken@729
  2521
	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
slouken@729
  2522
	      esac
slouken@729
  2523
	    fi
slouken@729
  2524
	    tmp_libs="$tmp_libs $deplib"
slouken@729
  2525
	  done
slouken@729
  2526
slouken@729
  2527
	  if test "$link_all_deplibs" != no; then
slouken@729
  2528
	    # Add the search paths of all dependency libraries
slouken@729
  2529
	    for deplib in $dependency_libs; do
slouken@729
  2530
	      case $deplib in
slouken@729
  2531
	      -L*) path="$deplib" ;;
slouken@729
  2532
	      *.la)
slouken@729
  2533
		dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
slouken@729
  2534
		test "X$dir" = "X$deplib" && dir="."
slouken@729
  2535
		# We need an absolute path.
slouken@729
  2536
		case $dir in
slouken@729
  2537
		[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
slouken@729
  2538
		*)
slouken@729
  2539
		  absdir=`cd "$dir" && pwd`
slouken@729
  2540
		  if test -z "$absdir"; then
slouken@729
  2541
		    $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
slouken@729
  2542
		    absdir="$dir"
slouken@729
  2543
		  fi
slouken@729
  2544
		  ;;
slouken@729
  2545
		esac
slouken@729
  2546
		if grep "^installed=no" $deplib > /dev/null; then
slouken@729
  2547
		  path="$absdir/$objdir"
slouken@729
  2548
		else
slouken@729
  2549
		  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
slouken@729
  2550
		  if test -z "$libdir"; then
slouken@729
  2551
		    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
slouken@729
  2552
		    exit 1
slouken@729
  2553
		  fi
slouken@729
  2554
		  if test "$absdir" != "$libdir"; then
slouken@729
  2555
		    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
slouken@729
  2556
		  fi
slouken@729
  2557
		  path="$absdir"
slouken@729
  2558
		fi
slouken@729
  2559
		depdepl=
slouken@729
  2560
		case $host in
slouken@729
  2561
		*-*-darwin*)
slouken@729
  2562
		  # we do not want to link against static libs, but need to link against shared
slouken@729
  2563
		  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
slouken@729
  2564
		  if test -n "$deplibrary_names" ; then
slouken@729
  2565
		    for tmp in $deplibrary_names ; do
slouken@729
  2566
		      depdepl=$tmp
slouken@729
  2567
		    done
slouken@729
  2568
		    if test -f "$path/$depdepl" ; then
slouken@729
  2569
		      depdepl="$path/$depdepl"
slouken@729
  2570
		   fi
slouken@729
  2571
		    newlib_search_path="$newlib_search_path $path"
slouken@729
  2572
		    path=""
slouken@729
  2573
		  fi
slouken@729
  2574
		  ;;
slouken@729
  2575
		*)
slouken@729
  2576
		path="-L$path"
slouken@729
  2577
		;;
slouken@729
  2578
		esac 
slouken@729
  2579
		
slouken@729
  2580
		;;
slouken@729
  2581
		  -l*)
slouken@729
  2582
		case $host in
slouken@729
  2583
		*-*-darwin*)
slouken@729
  2584
		 # Again, we only want to link against shared libraries
slouken@729
  2585
		 eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
slouken@729
  2586
		 for tmp in $newlib_search_path ; do
slouken@729
  2587
		     if test -f "$tmp/lib$tmp_libs.dylib" ; then
slouken@729
  2588
		       eval depdepl="$tmp/lib$tmp_libs.dylib"
slouken@729
  2589
		       break
slouken@729
  2590
		     fi  
slouken@729
  2591
         done
slouken@729
  2592
         path=""
slouken@729
  2593
		  ;;
slouken@729
  2594
		*) continue ;;
slouken@729
  2595
		esac  		  
slouken@729
  2596
		;;
slouken@729
  2597
	      *) continue ;;
slouken@729
  2598
	      esac
slouken@729
  2599
	      case " $deplibs " in
slouken@729
  2600
	      *" $depdepl "*) ;;
slouken@729
  2601
	      *) deplibs="$deplibs $depdepl" ;;
slouken@729
  2602
	      esac	      
slouken@729
  2603
	      case " $deplibs " in
slouken@729
  2604
	      *" $path "*) ;;
slouken@729
  2605
	      *) deplibs="$deplibs $path" ;;
slouken@729
  2606
	      esac
slouken@729
  2607
	    done
slouken@729
  2608
	  fi # link_all_deplibs != no
slouken@729
  2609
	fi # linkmode = lib
slouken@729
  2610
      done # for deplib in $libs
slouken@729
  2611
      dependency_libs="$newdependency_libs"
slouken@729
  2612
      if test "$pass" = dlpreopen; then
slouken@729
  2613
	# Link the dlpreopened libraries before other libraries
slouken@729
  2614
	for deplib in $save_deplibs; do
slouken@729
  2615
	  deplibs="$deplib $deplibs"
slouken@729
  2616
	done
slouken@729
  2617
      fi
slouken@729
  2618
      if test "$pass" != dlopen; then
slouken@729
  2619
	if test "$pass" != conv; then
slouken@729
  2620
	  # Make sure lib_search_path contains only unique directories.
slouken@729
  2621
	  lib_search_path=
slouken@729
  2622
	  for dir in $newlib_search_path; do
slouken@729
  2623
	    case "$lib_search_path " in
slouken@729
  2624
	    *" $dir "*) ;;
slouken@729
  2625
	    *) lib_search_path="$lib_search_path $dir" ;;
slouken@0
  2626
	    esac
slouken@729
  2627
	  done
slouken@729
  2628
	  newlib_search_path=
slouken@729
  2629
	fi
slouken@729
  2630
slouken@729
  2631
	if test "$linkmode,$pass" != "prog,link"; then
slouken@729
  2632
	  vars="deplibs"
slouken@729
  2633
	else
slouken@729
  2634
	  vars="compile_deplibs finalize_deplibs"
slouken@729
  2635
	fi
slouken@729
  2636
	for var in $vars dependency_libs; do
slouken@729
  2637
	  # Add libraries to $var in reverse order
slouken@729
  2638
	  eval tmp_libs=\"\$$var\"
slouken@729
  2639
	  new_libs=
slouken@729
  2640
	  for deplib in $tmp_libs; do
slouken@729
  2641
	    # FIXME: Pedantically, this is the right thing to do, so
slouken@729
  2642
	    #        that some nasty dependency loop isn't accidentally
slouken@729
  2643
	    #        broken:
slouken@729
  2644
	    #new_libs="$deplib $new_libs"
slouken@729
  2645
	    # Pragmatically, this seems to cause very few problems in
slouken@729
  2646
	    # practice:
slouken@729
  2647
	    case $deplib in
slouken@729
  2648
	    -L*) new_libs="$deplib $new_libs" ;;
slouken@729
  2649
	    -R*) ;;
slouken@729
  2650
	    *)
slouken@729
  2651
	      # And here is the reason: when a library appears more
slouken@729
  2652
	      # than once as an explicit dependence of a library, or
slouken@729
  2653
	      # is implicitly linked in more than once by the
slouken@729
  2654
	      # compiler, it is considered special, and multiple
slouken@729
  2655
	      # occurrences thereof are not removed.  Compare this
slouken@729
  2656
	      # with having the same library being listed as a
slouken@729
  2657
	      # dependency of multiple other libraries: in this case,
slouken@729
  2658
	      # we know (pedantically, we assume) the library does not
slouken@729
  2659
	      # need to be listed more than once, so we keep only the
slouken@729
  2660
	      # last copy.  This is not always right, but it is rare
slouken@729
  2661
	      # enough that we require users that really mean to play
slouken@729
  2662
	      # such unportable linking tricks to link the library
slouken@729
  2663
	      # using -Wl,-lname, so that libtool does not consider it
slouken@729
  2664
	      # for duplicate removal.
slouken@729
  2665
	      case " $specialdeplibs " in
slouken@729
  2666
	      *" $deplib "*) new_libs="$deplib $new_libs" ;;
slouken@729
  2667
	      *)
slouken@729
  2668
		case " $new_libs " in
slouken@729
  2669
		*" $deplib "*) ;;
slouken@729
  2670
		*) new_libs="$deplib $new_libs" ;;
slouken@729
  2671
		esac
slouken@729
  2672
		;;
slouken@729
  2673
	      esac
slouken@729
  2674
	      ;;
slouken@0
  2675
	    esac
slouken@729
  2676
	  done
slouken@729
  2677
	  tmp_libs=
slouken@729
  2678
	  for deplib in $new_libs; do
slouken@729
  2679
	    case $deplib in
slouken@729
  2680
	    -L*)
slouken@729
  2681
	      case " $tmp_libs " in
slouken@729
  2682
	      *" $deplib "*) ;;
slouken@729
  2683
	      *) tmp_libs="$tmp_libs $deplib" ;;
slouken@729
  2684
	      esac
slouken@729
  2685
	      ;;
slouken@729
  2686
	    *) tmp_libs="$tmp_libs $deplib" ;;
slouken@729
  2687
	    esac
slouken@729
  2688
	  done
slouken@729
  2689
	  eval $var=\"$tmp_libs\"
slouken@729
  2690
	done # for var
slouken@729
  2691
      fi
slouken@729
  2692
      # Last step: remove runtime libs from dependency_libs (they stay in deplibs)
slouken@729
  2693
      tmp_libs=
slouken@729
  2694
      for i in $dependency_libs ; do
slouken@729
  2695
	case " $predeps $postdeps $compiler_lib_search_path " in
slouken@729
  2696
	*" $i "*)
slouken@729
  2697
	  i=""
slouken@0
  2698
	  ;;
slouken@0
  2699
	esac
slouken@729
  2700
	if test -n "$i" ; then
slouken@729
  2701
	  tmp_libs="$tmp_libs $i"
slouken@729
  2702
	fi
slouken@729
  2703
      done
slouken@729
  2704
      dependency_libs=$tmp_libs
slouken@729
  2705
    done # for pass
slouken@729
  2706
    if test "$linkmode" = prog; then
slouken@729
  2707
      dlfiles="$newdlfiles"
slouken@729
  2708
      dlprefiles="$newdlprefiles"
slouken@0
  2709
    fi
slouken@0
  2710
slouken@729
  2711
    case $linkmode in
slouken@729
  2712
    oldlib)
slouken@0
  2713
      if test -n "$deplibs"; then
slouken@0
  2714
	$echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
slouken@0
  2715
      fi
slouken@0
  2716
slouken@0
  2717
      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
slouken@0
  2718
	$echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
slouken@0
  2719
      fi
slouken@0
  2720
slouken@0
  2721
      if test -n "$rpath"; then
slouken@0
  2722
	$echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
slouken@0
  2723
      fi
slouken@0
  2724
slouken@0
  2725
      if test -n "$xrpath"; then
slouken@0
  2726
	$echo "$modename: warning: \`-R' is ignored for archives" 1>&2
slouken@0
  2727
      fi
slouken@0
  2728
slouken@0
  2729
      if test -n "$vinfo"; then
slouken@729
  2730
	$echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
slouken@0
  2731
      fi
slouken@0
  2732
slouken@0
  2733
      if test -n "$release"; then
slouken@0
  2734
	$echo "$modename: warning: \`-release' is ignored for archives" 1>&2
slouken@0
  2735
      fi
slouken@0
  2736
slouken@0
  2737
      if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
slouken@0
  2738
	$echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
slouken@0
  2739
      fi
slouken@0
  2740
slouken@0
  2741
      # Now set the variables for building old libraries.
slouken@0
  2742
      build_libtool_libs=no
slouken@0
  2743
      oldlibs="$output"
slouken@729
  2744
      objs="$objs$old_deplibs"
slouken@0
  2745
      ;;
slouken@0
  2746
slouken@729
  2747
    lib)
slouken@0
  2748
      # Make sure we only generate libraries of the form `libNAME.la'.
slouken@729
  2749
      case $outputname in
slouken@0
  2750
      lib*)
slouken@0
  2751
	name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
slouken@729
  2752
	eval shared_ext=\"$shrext\"
slouken@0
  2753
	eval libname=\"$libname_spec\"
slouken@0
  2754
	;;
slouken@0
  2755
      *)
slouken@0
  2756
	if test "$module" = no; then
slouken@0
  2757
	  $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
slouken@0
  2758
	  $echo "$help" 1>&2
slouken@0
  2759
	  exit 1
slouken@0
  2760
	fi
slouken@0
  2761
	if test "$need_lib_prefix" != no; then
slouken@0
  2762
	  # Add the "lib" prefix for modules if required
slouken@0
  2763
	  name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
slouken@729
  2764
	  eval shared_ext=\"$shrext\"
slouken@0
  2765
	  eval libname=\"$libname_spec\"
slouken@0
  2766
	else
slouken@0
  2767
	  libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
slouken@0
  2768
	fi
slouken@0
  2769
	;;
slouken@0
  2770
      esac
slouken@0
  2771
slouken@729
  2772
      if test -n "$objs"; then
slouken@729
  2773
	if test "$deplibs_check_method" != pass_all; then
slouken@729
  2774
	  $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
slouken@729
  2775
	  exit 1
slouken@729
  2776
	else
slouken@729
  2777
	  $echo
slouken@729
  2778
	  $echo "*** Warning: Linking the shared library $output against the non-libtool"
slouken@729
  2779
	  $echo "*** objects $objs is not portable!"
slouken@729
  2780
	  libobjs="$libobjs $objs"
slouken@729
  2781
	fi
slouken@0
  2782
      fi
slouken@0
  2783
slouken@729
  2784
      if test "$dlself" != no; then
slouken@729
  2785
	$echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
slouken@0
  2786
      fi
slouken@0
  2787
slouken@0
  2788
      set dummy $rpath
slouken@729
  2789
      if test "$#" -gt 2; then
slouken@0
  2790
	$echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
slouken@0
  2791
      fi
slouken@0
  2792
      install_libdir="$2"
slouken@0
  2793
slouken@0
  2794
      oldlibs=
slouken@0
  2795
      if test -z "$rpath"; then
slouken@0
  2796
	if test "$build_libtool_libs" = yes; then
slouken@0
  2797
	  # Building a libtool convenience library.
slouken@729
  2798
	  # Some compilers have problems with a `.al' extension so
slouken@729
  2799
	  # convenience libraries should have the same extension an
slouken@729
  2800
	  # archive normally would.
slouken@0
  2801
	  oldlibs="$output_objdir/$libname.$libext $oldlibs"
slouken@0
  2802
	  build_libtool_libs=convenience
slouken@0
  2803
	  build_old_libs=yes
slouken@0
  2804
	fi
slouken@0
  2805
slouken@0
  2806
	if test -n "$vinfo"; then
slouken@729
  2807
	  $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
slouken@0
  2808
	fi
slouken@0
  2809
slouken@0
  2810
	if test -n "$release"; then
slouken@0
  2811
	  $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
slouken@0
  2812
	fi
slouken@0
  2813
      else
slouken@0
  2814
slouken@0
  2815
	# Parse the version information argument.
slouken@729
  2816
	save_ifs="$IFS"; IFS=':'
slouken@0
  2817
	set dummy $vinfo 0 0 0
slouken@0
  2818
	IFS="$save_ifs"
slouken@0
  2819
slouken@0
  2820
	if test -n "$8"; then
slouken@0
  2821
	  $echo "$modename: too many parameters to \`-version-info'" 1>&2
slouken@0
  2822
	  $echo "$help" 1>&2
slouken@0
  2823
	  exit 1
slouken@0
  2824
	fi
slouken@0
  2825
slouken@729
  2826
	# convert absolute version numbers to libtool ages
slouken@729
  2827
	# this retains compatibility with .la files and attempts
slouken@729
  2828
	# to make the code below a bit more comprehensible
slouken@729
  2829
	
slouken@729
  2830
	case $vinfo_number in
slouken@729
  2831
	yes)
slouken@729
  2832
	  number_major="$2"
slouken@729
  2833
	  number_minor="$3"
slouken@729
  2834
	  number_revision="$4"
slouken@729
  2835
	  #
slouken@729
  2836
	  # There are really only two kinds -- those that
slouken@729
  2837
	  # use the current revision as the major version
slouken@729
  2838
	  # and those that subtract age and use age as
slouken@729
  2839
	  # a minor version.  But, then there is irix
slouken@729
  2840
	  # which has an extra 1 added just for fun
slouken@729
  2841
	  #
slouken@729
  2842
	  case $version_type in
slouken@729
  2843
	  darwin|linux|osf|windows)
slouken@729
  2844
	    current=`expr $number_major + $number_minor`
slouken@729
  2845
	    age="$number_minor"
slouken@729
  2846
	    revision="$number_revision"
slouken@729
  2847
	    ;;
slouken@729
  2848
	  freebsd-aout|freebsd-elf|sunos)
slouken@729
  2849
	    current="$number_major"
slouken@729
  2850
	    revision="$number_minor"
slouken@729
  2851
	    age="0"
slouken@729
  2852
	    ;;
slouken@729
  2853
	  irix|nonstopux)
slouken@729
  2854
	    current=`expr $number_major + $number_minor - 1`
slouken@729
  2855
	    age="$number_minor"
slouken@729
  2856
	    revision="$number_minor"
slouken@729
  2857
	    ;;
slouken@729
  2858
	  esac
slouken@729
  2859
	  ;;
slouken@729
  2860
	no)
slouken@729
  2861
	  current="$2"
slouken@729
  2862
	  revision="$3"
slouken@729
  2863
	  age="$4"
slouken@729
  2864
	  ;;
slouken@729
  2865
	esac
slouken@0
  2866
slouken@0
  2867
	# Check that each of the things are valid numbers.
slouken@729
  2868
	case $current in
slouken@729
  2869
	0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
slouken@0
  2870
	*)
slouken@0
  2871
	  $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
slouken@0
  2872
	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
slouken@0
  2873
	  exit 1
slouken@0
  2874
	  ;;