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