ltmain.sh
author Sam Lantinga <slouken@libsdl.org>
Sun, 14 Oct 2001 19:49:02 +0000
changeset 205 13161d3d349d
parent 1 cf2af46e9e2a
child 387 469d5c0da01d
permissions -rw-r--r--
Added double-buffering support for SVGAlib (thanks Kutak!)
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.3.5
slouken@0
    58
TIMESTAMP=" (1.385.2.206 2000/05/27 11:12:27)"
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
      # All platforms use -DPIC, to notify preprocessed assembler code.
slouken@0
   438
      command="$base_compile $srcfile $pic_flag -DPIC"
slouken@0
   439
      if test "$build_old_libs" = yes; then
slouken@0
   440
	lo_libobj="$libobj"
slouken@0
   441
	dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
slouken@0
   442
	if test "X$dir" = "X$libobj"; then
slouken@0
   443
	  dir="$objdir"
slouken@0
   444
	else
slouken@0
   445
	  dir="$dir/$objdir"
slouken@0
   446
	fi
slouken@0
   447
	libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
slouken@0
   448
slouken@0
   449
	if test -d "$dir"; then
slouken@0
   450
	  $show "$rm $libobj"
slouken@0
   451
	  $run $rm $libobj
slouken@0
   452
	else
slouken@0
   453
	  $show "$mkdir $dir"
slouken@0
   454
	  $run $mkdir $dir
slouken@0
   455
	  status=$?
slouken@0
   456
	  if test $status -ne 0 && test ! -d $dir; then
slouken@0
   457
	    exit $status
slouken@0
   458
	  fi
slouken@0
   459
	fi
slouken@0
   460
      fi
slouken@0
   461
      if test "$compiler_o_lo" = yes; then
slouken@0
   462
	output_obj="$libobj"
slouken@0
   463
	command="$command -o $output_obj"
slouken@0
   464
      elif test "$compiler_c_o" = yes; then
slouken@0
   465
	output_obj="$obj"
slouken@0
   466
	command="$command -o $output_obj"
slouken@0
   467
      fi
slouken@0
   468
slouken@0
   469
      $run $rm "$output_obj"
slouken@0
   470
      $show "$command"
slouken@0
   471
      if $run eval "$command"; then :
slouken@0
   472
      else
slouken@0
   473
	test -n "$output_obj" && $run $rm $removelist
slouken@0
   474
	exit 1
slouken@0
   475
      fi
slouken@0
   476
slouken@0
   477
      if test "$need_locks" = warn &&
slouken@0
   478
	 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
slouken@0
   479
	echo "\
slouken@0
   480
*** ERROR, $lockfile contains:
slouken@0
   481
`cat $lockfile 2>/dev/null`
slouken@0
   482
slouken@0
   483
but it should contain:
slouken@0
   484
$srcfile
slouken@0
   485
slouken@0
   486
This indicates that another process is trying to use the same
slouken@0
   487
temporary object file, and libtool could not work around it because
slouken@0
   488
your compiler does not support \`-c' and \`-o' together.  If you
slouken@0
   489
repeat this compilation, it may succeed, by chance, but you had better
slouken@0
   490
avoid parallel builds (make -j) in this platform, or get a better
slouken@0
   491
compiler."
slouken@0
   492
slouken@0
   493
	$run $rm $removelist
slouken@0
   494
	exit 1
slouken@0
   495
      fi
slouken@0
   496
slouken@0
   497
      # Just move the object if needed, then go on to compile the next one
slouken@0
   498
      if test x"$output_obj" != x"$libobj"; then
slouken@0
   499
	$show "$mv $output_obj $libobj"
slouken@0
   500
	if $run $mv $output_obj $libobj; then :
slouken@0
   501
	else
slouken@0
   502
	  error=$?
slouken@0
   503
	  $run $rm $removelist
slouken@0
   504
	  exit $error
slouken@0
   505
	fi
slouken@0
   506
      fi
slouken@0
   507
slouken@0
   508
      # If we have no pic_flag, then copy the object into place and finish.
slouken@0
   509
      if test -z "$pic_flag" && test "$build_old_libs" = yes; then
slouken@0
   510
	# Rename the .lo from within objdir to obj
slouken@0
   511
	if test -f $obj; then
slouken@0
   512
	  $show $rm $obj
slouken@0
   513
	  $run $rm $obj
slouken@0
   514
	fi
slouken@0
   515
slouken@0
   516
	$show "$mv $libobj $obj"
slouken@0
   517
	if $run $mv $libobj $obj; then :
slouken@0
   518
	else
slouken@0
   519
	  error=$?
slouken@0
   520
	  $run $rm $removelist
slouken@0
   521
	  exit $error
slouken@0
   522
	fi
slouken@0
   523
slouken@0
   524
	xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
slouken@0
   525
	if test "X$xdir" = "X$obj"; then
slouken@0
   526
	  xdir="."
slouken@0
   527
	else
slouken@0
   528
	  xdir="$xdir"
slouken@0
   529
	fi
slouken@0
   530
	baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"`
slouken@0
   531
	libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
slouken@0
   532
	# Now arrange that obj and lo_libobj become the same file
slouken@0
   533
	$show "(cd $xdir && $LN_S $baseobj $libobj)"
slouken@0
   534
	if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then
slouken@0
   535
	  exit 0
slouken@0
   536
	else
slouken@0
   537
	  error=$?
slouken@0
   538
	  $run $rm $removelist
slouken@0
   539
	  exit $error
slouken@0
   540
	fi
slouken@0
   541
      fi
slouken@0
   542
slouken@0
   543
      # Allow error messages only from the first compilation.
slouken@0
   544
      suppress_output=' >/dev/null 2>&1'
slouken@0
   545
    fi
slouken@0
   546
slouken@0
   547
    # Only build a position-dependent object if we build old libraries.
slouken@0
   548
    if test "$build_old_libs" = yes; then
slouken@0
   549
      command="$base_compile $srcfile"
slouken@0
   550
      if test "$compiler_c_o" = yes; then
slouken@0
   551
	command="$command -o $obj"
slouken@0
   552
	output_obj="$obj"
slouken@0
   553
      fi
slouken@0
   554
slouken@0
   555
      # Suppress compiler output if we already did a PIC compilation.
slouken@0
   556
      command="$command$suppress_output"
slouken@0
   557
      $run $rm "$output_obj"
slouken@0
   558
      $show "$command"
slouken@0
   559
      if $run eval "$command"; then :
slouken@0
   560
      else
slouken@0
   561
	$run $rm $removelist
slouken@0
   562
	exit 1
slouken@0
   563
      fi
slouken@0
   564
slouken@0
   565
      if test "$need_locks" = warn &&
slouken@0
   566
	 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
slouken@0
   567
	echo "\
slouken@0
   568
*** ERROR, $lockfile contains:
slouken@0
   569
`cat $lockfile 2>/dev/null`
slouken@0
   570
slouken@0
   571
but it should contain:
slouken@0
   572
$srcfile
slouken@0
   573
slouken@0
   574
This indicates that another process is trying to use the same
slouken@0
   575
temporary object file, and libtool could not work around it because
slouken@0
   576
your compiler does not support \`-c' and \`-o' together.  If you
slouken@0
   577
repeat this compilation, it may succeed, by chance, but you had better
slouken@0
   578
avoid parallel builds (make -j) in this platform, or get a better
slouken@0
   579
compiler."
slouken@0
   580
slouken@0
   581
	$run $rm $removelist
slouken@0
   582
	exit 1
slouken@0
   583
      fi
slouken@0
   584
slouken@0
   585
      # Just move the object if needed
slouken@0
   586
      if test x"$output_obj" != x"$obj"; then
slouken@0
   587
	$show "$mv $output_obj $obj"
slouken@0
   588
	if $run $mv $output_obj $obj; then :
slouken@0
   589
	else
slouken@0
   590
	  error=$?
slouken@0
   591
	  $run $rm $removelist
slouken@0
   592
	  exit $error
slouken@0
   593
	fi
slouken@0
   594
      fi
slouken@0
   595
slouken@0
   596
      # Create an invalid libtool object if no PIC, so that we do not
slouken@0
   597
      # accidentally link it into a program.
slouken@0
   598
      if test "$build_libtool_libs" != yes; then
slouken@0
   599
	$show "echo timestamp > $libobj"
slouken@0
   600
	$run eval "echo timestamp > \$libobj" || exit $?
slouken@0
   601
      else
slouken@0
   602
	# Move the .lo from within objdir
slouken@0
   603
	$show "$mv $libobj $lo_libobj"
slouken@0
   604
	if $run $mv $libobj $lo_libobj; then :
slouken@0
   605
	else
slouken@0
   606
	  error=$?
slouken@0
   607
	  $run $rm $removelist
slouken@0
   608
	  exit $error
slouken@0
   609
	fi
slouken@0
   610
      fi
slouken@0
   611
    fi
slouken@0
   612
slouken@0
   613
    # Unlock the critical section if it was locked
slouken@0
   614
    if test "$need_locks" != no; then
slouken@0
   615
      $rm "$lockfile"
slouken@0
   616
    fi
slouken@0
   617
slouken@0
   618
    exit 0
slouken@0
   619
    ;;
slouken@0
   620
slouken@0
   621
  # libtool link mode
slouken@0
   622
  link)
slouken@0
   623
    modename="$modename: link"
slouken@0
   624
    case "$host" in
slouken@0
   625
    *-*-cygwin* | *-*-mingw* | *-*-os2*)
slouken@0
   626
      # It is impossible to link a dll without this setting, and
slouken@0
   627
      # we shouldn't force the makefile maintainer to figure out
slouken@0
   628
      # which system we are compiling for in order to pass an extra
slouken@0
   629
      # flag for every libtool invokation.
slouken@0
   630
      # allow_undefined=no
slouken@0
   631
slouken@0
   632
      # FIXME: Unfortunately, there are problems with the above when trying
slouken@0
   633
      # to make a dll which has undefined symbols, in which case not
slouken@0
   634
      # even a static library is built.  For now, we need to specify
slouken@0
   635
      # -no-undefined on the libtool link line when we can be certain
slouken@0
   636
      # that all symbols are satisfied, otherwise we get a static library.
slouken@0
   637
      allow_undefined=yes
slouken@0
   638
slouken@0
   639
      # This is a source program that is used to create dlls on Windows
slouken@0
   640
      # Don't remove nor modify the starting and closing comments
slouken@0
   641
# /* ltdll.c starts here */
slouken@0
   642
# #define WIN32_LEAN_AND_MEAN
slouken@0
   643
# #include <windows.h>
slouken@0
   644
# #undef WIN32_LEAN_AND_MEAN
slouken@0
   645
# #include <stdio.h>
slouken@0
   646
#
slouken@0
   647
# #ifndef __CYGWIN__
slouken@0
   648
# #  ifdef __CYGWIN32__
slouken@0
   649
# #    define __CYGWIN__ __CYGWIN32__
slouken@0
   650
# #  endif
slouken@0
   651
# #endif
slouken@0
   652
#
slouken@0
   653
# #ifdef __cplusplus
slouken@0
   654
# extern "C" {
slouken@0
   655
# #endif
slouken@0
   656
# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
slouken@0
   657
# #ifdef __cplusplus
slouken@0
   658
# }
slouken@0
   659
# #endif
slouken@0
   660
#
slouken@0
   661
# #ifdef __CYGWIN__
slouken@0
   662
# #include <cygwin/cygwin_dll.h>
slouken@0
   663
# DECLARE_CYGWIN_DLL( DllMain );
slouken@0
   664
# #endif
slouken@0
   665
# HINSTANCE __hDllInstance_base;
slouken@0
   666
#
slouken@0
   667
# BOOL APIENTRY
slouken@0
   668
# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
slouken@0
   669
# {
slouken@0
   670
#   __hDllInstance_base = hInst;
slouken@0
   671
#   return TRUE;
slouken@0
   672
# }
slouken@0
   673
# /* ltdll.c ends here */
slouken@0
   674
      # This is a source program that is used to create import libraries
slouken@0
   675
      # on Windows for dlls which lack them. Don't remove nor modify the
slouken@0
   676
      # starting and closing comments
slouken@0
   677
# /* impgen.c starts here */
slouken@0
   678
# /*   Copyright (C) 1999 Free Software Foundation, Inc.
slouken@0
   679
# 
slouken@0
   680
#  This file is part of GNU libtool.
slouken@0
   681
# 
slouken@0
   682
#  This program is free software; you can redistribute it and/or modify
slouken@0
   683
#  it under the terms of the GNU General Public License as published by
slouken@0
   684
#  the Free Software Foundation; either version 2 of the License, or
slouken@0
   685
#  (at your option) any later version.
slouken@0
   686
# 
slouken@0
   687
#  This program is distributed in the hope that it will be useful,
slouken@0
   688
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
slouken@0
   689
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
slouken@0
   690
#  GNU General Public License for more details.
slouken@0
   691
# 
slouken@0
   692
#  You should have received a copy of the GNU General Public License
slouken@0
   693
#  along with this program; if not, write to the Free Software
slouken@0
   694
#  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
slouken@0
   695
#  */
slouken@0
   696
# 
slouken@0
   697
#  #include <stdio.h>		/* for printf() */
slouken@0
   698
#  #include <unistd.h>		/* for open(), lseek(), read() */
slouken@0
   699
#  #include <fcntl.h>		/* for O_RDONLY, O_BINARY */
slouken@0
   700
#  #include <string.h>		/* for strdup() */
slouken@0
   701
# 
slouken@0
   702
#  static unsigned int
slouken@0
   703
#  pe_get16 (fd, offset)
slouken@0
   704
#       int fd;
slouken@0
   705
#       int offset;
slouken@0
   706
#  {
slouken@0
   707
#    unsigned char b[2];
slouken@0
   708
#    lseek (fd, offset, SEEK_SET);
slouken@0
   709
#    read (fd, b, 2);
slouken@0
   710
#    return b[0] + (b[1]<<8);
slouken@0
   711
#  }
slouken@0
   712
# 
slouken@0
   713
#  static unsigned int
slouken@0
   714
#  pe_get32 (fd, offset)
slouken@0
   715
#      int fd;
slouken@0
   716
#      int offset;
slouken@0
   717
#  {
slouken@0
   718
#    unsigned char b[4];
slouken@0
   719
#    lseek (fd, offset, SEEK_SET);
slouken@0
   720
#    read (fd, b, 4);
slouken@0
   721
#    return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
slouken@0
   722
#  }
slouken@0
   723
# 
slouken@0
   724
#  static unsigned int
slouken@0
   725
#  pe_as32 (ptr)
slouken@0
   726
#       void *ptr;
slouken@0
   727
#  {
slouken@0
   728
#    unsigned char *b = ptr;
slouken@0
   729
#    return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
slouken@0
   730
#  }
slouken@0
   731
# 
slouken@0
   732
#  int
slouken@0
   733
#  main (argc, argv)
slouken@0
   734
#      int argc;
slouken@0
   735
#      char *argv[];
slouken@0
   736
#  {
slouken@0
   737
#      int dll;
slouken@0
   738
#      unsigned long pe_header_offset, opthdr_ofs, num_entries, i;
slouken@0
   739
#      unsigned long export_rva, export_size, nsections, secptr, expptr;
slouken@0
   740
#      unsigned long name_rvas, nexp;
slouken@0
   741
#      unsigned char *expdata, *erva;
slouken@0
   742
#      char *filename, *dll_name;
slouken@0
   743
# 
slouken@0
   744
#      filename = argv[1];
slouken@0
   745
# 
slouken@0
   746
#      dll = open(filename, O_RDONLY|O_BINARY);
slouken@0
   747
#      if (!dll)
slouken@0
   748
#  	return 1;
slouken@0
   749
# 
slouken@0
   750
#      dll_name = filename;
slouken@0
   751
#    
slouken@0
   752
#      for (i=0; filename[i]; i++)
slouken@0
   753
#  	if (filename[i] == '/' || filename[i] == '\\'  || filename[i] == ':')
slouken@0
   754
#  	    dll_name = filename + i +1;
slouken@0
   755
# 
slouken@0
   756
#      pe_header_offset = pe_get32 (dll, 0x3c);
slouken@0
   757
#      opthdr_ofs = pe_header_offset + 4 + 20;
slouken@0
   758
#      num_entries = pe_get32 (dll, opthdr_ofs + 92);
slouken@0
   759
# 
slouken@0
   760
#      if (num_entries < 1) /* no exports */
slouken@0
   761
#  	return 1;
slouken@0
   762
# 
slouken@0
   763
#      export_rva = pe_get32 (dll, opthdr_ofs + 96);
slouken@0
   764
#      export_size = pe_get32 (dll, opthdr_ofs + 100);
slouken@0
   765
#      nsections = pe_get16 (dll, pe_header_offset + 4 +2);
slouken@0
   766
#      secptr = (pe_header_offset + 4 + 20 +
slouken@0
   767
#  	      pe_get16 (dll, pe_header_offset + 4 + 16));
slouken@0
   768
# 
slouken@0
   769
#      expptr = 0;
slouken@0
   770
#      for (i = 0; i < nsections; i++)
slouken@0
   771
#      {
slouken@0
   772
#  	char sname[8];
slouken@0
   773
#  	unsigned long secptr1 = secptr + 40 * i;
slouken@0
   774
#  	unsigned long vaddr = pe_get32 (dll, secptr1 + 12);
slouken@0
   775
#  	unsigned long vsize = pe_get32 (dll, secptr1 + 16);
slouken@0
   776
#  	unsigned long fptr = pe_get32 (dll, secptr1 + 20);
slouken@0
   777
#  	lseek(dll, secptr1, SEEK_SET);
slouken@0
   778
#  	read(dll, sname, 8);
slouken@0
   779
#  	if (vaddr <= export_rva && vaddr+vsize > export_rva)
slouken@0
   780
#  	{
slouken@0
   781
#  	    expptr = fptr + (export_rva - vaddr);
slouken@0
   782
#  	    if (export_rva + export_size > vaddr + vsize)
slouken@0
   783
#  		export_size = vsize - (export_rva - vaddr);
slouken@0
   784
#  	    break;
slouken@0
   785
#  	}
slouken@0
   786
#      }
slouken@0
   787
# 
slouken@0
   788
#      expdata = (unsigned char*)malloc(export_size);
slouken@0
   789
#      lseek (dll, expptr, SEEK_SET);
slouken@0
   790
#      read (dll, expdata, export_size);
slouken@0
   791
#      erva = expdata - export_rva;
slouken@0
   792
# 
slouken@0
   793
#      nexp = pe_as32 (expdata+24);
slouken@0
   794
#      name_rvas = pe_as32 (expdata+32);
slouken@0
   795
# 
slouken@0
   796
#      printf ("EXPORTS\n");
slouken@0
   797
#      for (i = 0; i<nexp; i++)
slouken@0
   798
#      {
slouken@0
   799
#  	unsigned long name_rva = pe_as32 (erva+name_rvas+i*4);
slouken@0
   800
#  	printf ("\t%s @ %ld ;\n", erva+name_rva, 1+ i);
slouken@0
   801
#      }
slouken@0
   802
# 
slouken@0
   803
#      return 0;
slouken@0
   804
#  }
slouken@0
   805
# /* impgen.c ends here */
slouken@0
   806
      ;;
slouken@0
   807
    *)
slouken@0
   808
      allow_undefined=yes
slouken@0
   809
      ;;
slouken@0
   810
    esac
slouken@0
   811
    compile_command="$nonopt"
slouken@0
   812
    finalize_command="$nonopt"
slouken@0
   813
slouken@0
   814
    compile_rpath=
slouken@0
   815
    finalize_rpath=
slouken@0
   816
    compile_shlibpath=
slouken@0
   817
    finalize_shlibpath=
slouken@0
   818
    convenience=
slouken@0
   819
    old_convenience=
slouken@0
   820
    deplibs=
slouken@0
   821
    linkopts=
slouken@0
   822
slouken@0
   823
    if test -n "$shlibpath_var"; then
slouken@0
   824
      # get the directories listed in $shlibpath_var
slouken@0
   825
      eval lib_search_path=\`\$echo \"X \${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
slouken@0
   826
    else
slouken@0
   827
      lib_search_path=
slouken@0
   828
    fi
slouken@0
   829
    # now prepend the system-specific ones
slouken@0
   830
    eval lib_search_path=\"$sys_lib_search_path_spec\$lib_search_path\"
slouken@0
   831
    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
slouken@0
   832
    
slouken@0
   833
    avoid_version=no
slouken@0
   834
    dlfiles=
slouken@0
   835
    dlprefiles=
slouken@0
   836
    dlself=no
slouken@0
   837
    export_dynamic=no
slouken@0
   838
    export_symbols=
slouken@0
   839
    export_symbols_regex=
slouken@0
   840
    generated=
slouken@0
   841
    libobjs=
slouken@0
   842
    link_against_libtool_libs=
slouken@0
   843
    ltlibs=
slouken@0
   844
    module=no
slouken@0
   845
    objs=
slouken@0
   846
    prefer_static_libs=no
slouken@0
   847
    preload=no
slouken@0
   848
    prev=
slouken@0
   849
    prevarg=
slouken@0
   850
    release=
slouken@0
   851
    rpath=
slouken@0
   852
    xrpath=
slouken@0
   853
    perm_rpath=
slouken@0
   854
    temp_rpath=
slouken@0
   855
    thread_safe=no
slouken@0
   856
    vinfo=
slouken@0
   857
slouken@0
   858
    # We need to know -static, to get the right output filenames.
slouken@0
   859
    for arg
slouken@0
   860
    do
slouken@0
   861
      case "$arg" in
slouken@0
   862
      -all-static | -static)
slouken@0
   863
	if test "X$arg" = "X-all-static"; then
slouken@0
   864
	  if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
slouken@0
   865
	    $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
slouken@0
   866
	  fi
slouken@0
   867
	  if test -n "$link_static_flag"; then
slouken@0
   868
	    dlopen_self=$dlopen_self_static
slouken@0
   869
	  fi
slouken@0
   870
	else
slouken@0
   871
	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
slouken@0
   872
	    dlopen_self=$dlopen_self_static
slouken@0
   873
	  fi
slouken@0
   874
	fi
slouken@0
   875
	build_libtool_libs=no
slouken@0
   876
	build_old_libs=yes
slouken@0
   877
	prefer_static_libs=yes
slouken@0
   878
	break
slouken@0
   879
	;;
slouken@0
   880
      esac
slouken@0
   881
    done
slouken@0
   882
slouken@0
   883
    # See if our shared archives depend on static archives.
slouken@0
   884
    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
slouken@0
   885
slouken@0
   886
    # Go through the arguments, transforming them on the way.
slouken@0
   887
    while test $# -gt 0; do
slouken@0
   888
      arg="$1"
slouken@0
   889
      shift
slouken@0
   890
slouken@0
   891
      # If the previous option needs an argument, assign it.
slouken@0
   892
      if test -n "$prev"; then
slouken@0
   893
	case "$prev" in
slouken@0
   894
	output)
slouken@0
   895
	  compile_command="$compile_command @OUTPUT@"
slouken@0
   896
	  finalize_command="$finalize_command @OUTPUT@"
slouken@0
   897
	  ;;
slouken@0
   898
	esac
slouken@0
   899
slouken@0
   900
	case "$prev" in
slouken@0
   901
	dlfiles|dlprefiles)
slouken@0
   902
	  if test "$preload" = no; then
slouken@0
   903
	    # Add the symbol object into the linking commands.
slouken@0
   904
	    compile_command="$compile_command @SYMFILE@"
slouken@0
   905
	    finalize_command="$finalize_command @SYMFILE@"
slouken@0
   906
	    preload=yes
slouken@0
   907
	  fi
slouken@0
   908
	  case "$arg" in
slouken@0
   909
	  *.la | *.lo) ;;  # We handle these cases below.
slouken@0
   910
	  force)
slouken@0
   911
	    if test "$dlself" = no; then
slouken@0
   912
	      dlself=needless
slouken@0
   913
	      export_dynamic=yes
slouken@0
   914
	    fi
slouken@0
   915
	    prev=
slouken@0
   916
	    continue
slouken@0
   917
	    ;;
slouken@0
   918
	  self)
slouken@0
   919
	    if test "$prev" = dlprefiles; then
slouken@0
   920
	      dlself=yes
slouken@0
   921
	    elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
slouken@0
   922
	      dlself=yes
slouken@0
   923
	    else
slouken@0
   924
	      dlself=needless
slouken@0
   925
	      export_dynamic=yes
slouken@0
   926
	    fi
slouken@0
   927
	    prev=
slouken@0
   928
	    continue
slouken@0
   929
	    ;;
slouken@0
   930
	  *)
slouken@0
   931
	    if test "$prev" = dlfiles; then
slouken@0
   932
	      dlfiles="$dlfiles $arg"
slouken@0
   933
	    else
slouken@0
   934
	      dlprefiles="$dlprefiles $arg"
slouken@0
   935
	    fi
slouken@0
   936
	    prev=
slouken@0
   937
	    ;;
slouken@0
   938
	  esac
slouken@0
   939
	  ;;
slouken@0
   940
	expsyms)
slouken@0
   941
	  export_symbols="$arg"
slouken@0
   942
	  if test ! -f "$arg"; then
slouken@0
   943
	    $echo "$modename: symbol file \`$arg' does not exist"
slouken@0
   944
	    exit 1
slouken@0
   945
	  fi
slouken@0
   946
	  prev=
slouken@0
   947
	  continue
slouken@0
   948
	  ;;
slouken@0
   949
	expsyms_regex)
slouken@0
   950
	  export_symbols_regex="$arg"
slouken@0
   951
	  prev=
slouken@0
   952
	  continue
slouken@0
   953
	  ;;
slouken@0
   954
	release)
slouken@0
   955
	  release="-$arg"
slouken@0
   956
	  prev=
slouken@0
   957
	  continue
slouken@0
   958
	  ;;
slouken@0
   959
	rpath | xrpath)
slouken@0
   960
	  # We need an absolute path.
slouken@0
   961
	  case "$arg" in
slouken@0
   962
	  [\\/]* | [A-Za-z]:[\\/]*) ;;
slouken@0
   963
	  *)
slouken@0
   964
	    $echo "$modename: only absolute run-paths are allowed" 1>&2
slouken@0
   965
	    exit 1
slouken@0
   966
	    ;;
slouken@0
   967
	  esac
slouken@0
   968
	  if test "$prev" = rpath; then
slouken@0
   969
	    case "$rpath " in
slouken@0
   970
	    *" $arg "*) ;;
slouken@0
   971
	    *) rpath="$rpath $arg" ;;
slouken@0
   972
	    esac
slouken@0
   973
	  else
slouken@0
   974
	    case "$xrpath " in
slouken@0
   975
	    *" $arg "*) ;;
slouken@0
   976
	    *) xrpath="$xrpath $arg" ;;
slouken@0
   977
	    esac
slouken@0
   978
	  fi
slouken@0
   979
	  prev=
slouken@0
   980
	  continue
slouken@0
   981
	  ;;
slouken@0
   982
	*)
slouken@0
   983
	  eval "$prev=\"\$arg\""
slouken@0
   984
	  prev=
slouken@0
   985
	  continue
slouken@0
   986
	  ;;
slouken@0
   987
	esac
slouken@0
   988
      fi
slouken@0
   989
slouken@0
   990
      prevarg="$arg"
slouken@0
   991
slouken@0
   992
      case "$arg" in
slouken@0
   993
      -all-static)
slouken@0
   994
	if test -n "$link_static_flag"; then
slouken@0
   995
	  compile_command="$compile_command $link_static_flag"
slouken@0
   996
	  finalize_command="$finalize_command $link_static_flag"
slouken@0
   997
	fi
slouken@0
   998
	continue
slouken@0
   999
	;;
slouken@0
  1000
slouken@0
  1001
      -allow-undefined)
slouken@0
  1002
	# FIXME: remove this flag sometime in the future.
slouken@0
  1003
	$echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
slouken@0
  1004
	continue
slouken@0
  1005
	;;
slouken@0
  1006
slouken@0
  1007
      -avoid-version)
slouken@0
  1008
	avoid_version=yes
slouken@0
  1009
	continue
slouken@0
  1010
	;;
slouken@0
  1011
slouken@0
  1012
      -dlopen)
slouken@0
  1013
	prev=dlfiles
slouken@0
  1014
	continue
slouken@0
  1015
	;;
slouken@0
  1016
slouken@0
  1017
      -dlpreopen)
slouken@0
  1018
	prev=dlprefiles
slouken@0
  1019
	continue
slouken@0
  1020
	;;
slouken@0
  1021
slouken@0
  1022
      -export-dynamic)
slouken@0
  1023
	export_dynamic=yes
slouken@0
  1024
	continue
slouken@0
  1025
	;;
slouken@0
  1026
slouken@0
  1027
      -export-symbols | -export-symbols-regex)
slouken@0
  1028
	if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
slouken@0
  1029
	  $echo "$modename: not more than one -exported-symbols argument allowed"
slouken@0
  1030
	  exit 1
slouken@0
  1031
	fi
slouken@0
  1032
	if test "X$arg" = "X-export-symbols"; then
slouken@0
  1033
	  prev=expsyms
slouken@0
  1034
	else
slouken@0
  1035
	  prev=expsyms_regex
slouken@0
  1036
	fi
slouken@0
  1037
	continue
slouken@0
  1038
	;;
slouken@0
  1039
slouken@0
  1040
      -L*)
slouken@0
  1041
	dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
slouken@0
  1042
	# We need an absolute path.
slouken@0
  1043
	case "$dir" in
slouken@0
  1044
	[\\/]* | [A-Za-z]:[\\/]*) ;;
slouken@0
  1045
	*)
slouken@0
  1046
	  absdir=`cd "$dir" && pwd`
slouken@0
  1047
	  if test -z "$absdir"; then
slouken@0
  1048
	    $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
slouken@0
  1049
	    $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
slouken@0
  1050
	    absdir="$dir"
slouken@0
  1051
	  fi
slouken@0
  1052
	  dir="$absdir"
slouken@0
  1053
	  ;;
slouken@0
  1054
	esac
slouken@0
  1055
	case " $deplibs " in
slouken@0
  1056
	*" $arg "*) ;;
slouken@0
  1057
	*) deplibs="$deplibs $arg";;
slouken@0
  1058
	esac
slouken@0
  1059
	case " $lib_search_path " in
slouken@0
  1060
	*" $dir "*) ;;
slouken@0
  1061
	*) lib_search_path="$lib_search_path $dir";;
slouken@0
  1062
	esac
slouken@0
  1063
	case "$host" in
slouken@0
  1064
	*-*-cygwin* | *-*-mingw* | *-*-os2*)
slouken@0
  1065
	  dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
slouken@0
  1066
	  case ":$dllsearchpath:" in
slouken@0
  1067
	  ::) dllsearchpath="$dllsearchdir";;
slouken@0
  1068
	  *":$dllsearchdir:"*) ;;
slouken@0
  1069
	  *) dllsearchpath="$dllsearchpath:$dllsearchdir";;
slouken@0
  1070
	  esac
slouken@0
  1071
	  ;;
slouken@0
  1072
	esac
slouken@0
  1073
	;;
slouken@0
  1074
slouken@0
  1075
      -l*)
slouken@0
  1076
	if test "$arg" = "-lc"; then
slouken@0
  1077
	  case "$host" in
slouken@0
  1078
	  *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos* |*-*-freebsd* )
slouken@0
  1079
	    # These systems don't actually have c library (as such)
slouken@0
  1080
	    continue
slouken@0
  1081
	    ;;
slouken@1
  1082
          *-*-openbsd*)
slouken@1
  1083
            # Do not include libc due to us having libc/libc_r.
slouken@1
  1084
            continue
slouken@1
  1085
            ;;
slouken@0
  1086
	  esac
slouken@1
  1087
        elif test "$arg" = "-lc_r"; then
slouken@1
  1088
          case "$host" in
slouken@1
  1089
          *-*-openbsd*)
slouken@1
  1090
            # Do not include libc_r directly, use -pthread flag.
slouken@1
  1091
            continue
slouken@1
  1092
            ;;
slouken@1
  1093
          esac
slouken@0
  1094
	elif test "$arg" = "-lm"; then
slouken@0
  1095
	  case "$host" in
slouken@0
  1096
	  *-*-cygwin* | *-*-beos*)
slouken@0
  1097
	    # These systems don't actually have math library (as such)
slouken@0
  1098
	    continue
slouken@0
  1099
	    ;;
slouken@0
  1100
	  esac
slouken@0
  1101
	fi
slouken@0
  1102
	deplibs="$deplibs $arg"
slouken@0
  1103
	;;
slouken@0
  1104
slouken@1
  1105
      -?thread)
slouken@1
  1106
        deplibs="$deplibs $arg"
slouken@1
  1107
        ;;
slouken@1
  1108
slouken@0
  1109
      -module)
slouken@0
  1110
	module=yes
slouken@0
  1111
	continue
slouken@0
  1112
	;;
slouken@0
  1113
slouken@0
  1114
      -no-undefined)
slouken@0
  1115
	allow_undefined=no
slouken@0
  1116
	continue
slouken@0
  1117
	;;
slouken@0
  1118
slouken@0
  1119
      -o) prev=output ;;
slouken@0
  1120
slouken@0
  1121
      -release)
slouken@0
  1122
	prev=release
slouken@0
  1123
	continue
slouken@0
  1124
	;;
slouken@0
  1125
slouken@0
  1126
      -rpath)
slouken@0
  1127
	prev=rpath
slouken@0
  1128
	continue
slouken@0
  1129
	;;
slouken@0
  1130
slouken@0
  1131
      -R)
slouken@0
  1132
	prev=xrpath
slouken@0
  1133
	continue
slouken@0
  1134
	;;
slouken@0
  1135
slouken@0
  1136
      -R*)
slouken@0
  1137
	dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
slouken@0
  1138
	# We need an absolute path.
slouken@0
  1139
	case "$dir" in
slouken@0
  1140
	[\\/]* | [A-Za-z]:[\\/]*) ;;
slouken@0
  1141
	*)
slouken@0
  1142
	  $echo "$modename: only absolute run-paths are allowed" 1>&2
slouken@0
  1143
	  exit 1
slouken@0
  1144
	  ;;
slouken@0
  1145
	esac
slouken@0
  1146
	case "$xrpath " in
slouken@0
  1147
	*" $dir "*) ;;
slouken@0
  1148
	*) xrpath="$xrpath $dir" ;;
slouken@0
  1149
	esac
slouken@0
  1150
	continue
slouken@0
  1151
	;;
slouken@0
  1152
slouken@0
  1153
      -static)
slouken@0
  1154
	# If we have no pic_flag, then this is the same as -all-static.
slouken@0
  1155
	if test -z "$pic_flag" && test -n "$link_static_flag"; then
slouken@0
  1156
	  compile_command="$compile_command $link_static_flag"
slouken@0
  1157
	  finalize_command="$finalize_command $link_static_flag"
slouken@0
  1158
	fi
slouken@0
  1159
	continue
slouken@0
  1160
	;;
slouken@0
  1161
slouken@0
  1162
      -thread-safe)
slouken@0
  1163
	thread_safe=yes
slouken@0
  1164
	continue
slouken@0
  1165
	;;
slouken@0
  1166
slouken@0
  1167
      -version-info)
slouken@0
  1168
	prev=vinfo
slouken@0
  1169
	continue
slouken@0
  1170
	;;
slouken@0
  1171
slouken@0
  1172
      # Some other compiler flag.
slouken@0
  1173
      -* | +*)
slouken@0
  1174
	# Unknown arguments in both finalize_command and compile_command need
slouken@0
  1175
	# to be aesthetically quoted because they are evaled later.
slouken@0
  1176
	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
slouken@0
  1177
	case "$arg" in
slouken@0
  1178
	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
slouken@0
  1179
	  arg="\"$arg\""
slouken@0
  1180
	  ;;
slouken@0
  1181
	esac
slouken@0
  1182
	;;
slouken@0
  1183
slouken@0
  1184
      *.o | *.obj | *.a | *.lib)
slouken@0
  1185
	# A standard object.
slouken@0
  1186
	objs="$objs $arg"
slouken@0
  1187
	;;
slouken@0
  1188
slouken@0
  1189
      *.lo)
slouken@0
  1190
	# A library object.
slouken@0
  1191
	if test "$prev" = dlfiles; then
slouken@0
  1192
	  dlfiles="$dlfiles $arg"
slouken@0
  1193
	  if test "$build_libtool_libs" = yes && test "$dlopen" = yes; then
slouken@0
  1194
	    prev=
slouken@0
  1195
	    continue
slouken@0
  1196
	  else
slouken@0
  1197
	    # If libtool objects are unsupported, then we need to preload.
slouken@0
  1198
	    prev=dlprefiles
slouken@0
  1199
	  fi
slouken@0
  1200
	fi
slouken@0
  1201
slouken@0
  1202
	if test "$prev" = dlprefiles; then
slouken@0
  1203
	  # Preload the old-style object.
slouken@0
  1204
	  dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
slouken@0
  1205
	  prev=
slouken@0
  1206
	fi
slouken@0
  1207
	libobjs="$libobjs $arg"
slouken@0
  1208
	;;
slouken@0
  1209
slouken@0
  1210
      *.la)
slouken@0
  1211
	# A libtool-controlled library.
slouken@0
  1212
slouken@0
  1213
	dlname=
slouken@0
  1214
	libdir=
slouken@0
  1215
	library_names=
slouken@0
  1216
	old_library=
slouken@0
  1217
slouken@0
  1218
	# Check to see that this really is a libtool archive.
slouken@0
  1219
	if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
slouken@0
  1220
	else
slouken@0
  1221
	  $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2
slouken@0
  1222
	  exit 1
slouken@0
  1223
	fi
slouken@0
  1224
slouken@0
  1225
	# If the library was installed with an old release of libtool,
slouken@0
  1226
	# it will not redefine variable installed.
slouken@0
  1227
	installed=yes
slouken@0
  1228
slouken@0
  1229
	# Read the .la file
slouken@0
  1230
	# If there is no directory component, then add one.
slouken@0
  1231
	case "$arg" in
slouken@0
  1232
	*/* | *\\*) . $arg ;;
slouken@0
  1233
	*) . ./$arg ;;
slouken@0
  1234
	esac
slouken@0
  1235
slouken@0
  1236
	# Get the name of the library we link against.
slouken@0
  1237
	linklib=
slouken@0
  1238
	for l in $old_library $library_names; do
slouken@0
  1239
	  linklib="$l"
slouken@0
  1240
	done
slouken@0
  1241
slouken@0
  1242
	if test -z "$linklib"; then
slouken@0
  1243
	  $echo "$modename: cannot find name of link library for \`$arg'" 1>&2
slouken@0
  1244
	  exit 1
slouken@0
  1245
	fi
slouken@0
  1246
slouken@0
  1247
	# Find the relevant object directory and library name.
slouken@0
  1248
	name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'`
slouken@0
  1249
slouken@0
  1250
	if test "X$installed" = Xyes; then
slouken@0
  1251
	  dir="$libdir"
slouken@0
  1252
	else
slouken@0
  1253
	  dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
slouken@0
  1254
	  if test "X$dir" = "X$arg"; then
slouken@0
  1255
	    dir="$objdir"
slouken@0
  1256
	  else
slouken@0
  1257
	    dir="$dir/$objdir"
slouken@0
  1258
	  fi
slouken@0
  1259
	fi
slouken@0
  1260
slouken@0
  1261
	if test -n "$dependency_libs"; then
slouken@0
  1262
	  # Extract -R and -L from dependency_libs
slouken@0
  1263
	  temp_deplibs=
slouken@0
  1264
	  for deplib in $dependency_libs; do
slouken@0
  1265
	    case "$deplib" in
slouken@0
  1266
	    -R*) temp_xrpath=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
slouken@0
  1267
		 case " $rpath $xrpath " in
slouken@0
  1268
		 *" $temp_xrpath "*) ;;
slouken@0
  1269
		 *) xrpath="$xrpath $temp_xrpath";;
slouken@0
  1270
		 esac;;
slouken@0
  1271
	    -L*) case "$compile_command $temp_deplibs " in
slouken@0
  1272
		 *" $deplib "*) ;;
slouken@0
  1273
		 *) temp_deplibs="$temp_deplibs $deplib";;
slouken@0
  1274
		 esac
slouken@0
  1275
		 temp_dir=`$echo "X$deplib" | $Xsed -e 's/^-L//'`
slouken@0
  1276
		 case " $lib_search_path " in
slouken@0
  1277
		 *" $temp_dir "*) ;;
slouken@0
  1278
		 *) lib_search_path="$lib_search_path $temp_dir";;
slouken@0
  1279
		 esac
slouken@0
  1280
		 ;;
slouken@0
  1281
	    *) temp_deplibs="$temp_deplibs $deplib";;
slouken@0
  1282
	    esac
slouken@0
  1283
	  done
slouken@0
  1284
	  dependency_libs="$temp_deplibs"
slouken@0
  1285
	fi
slouken@0
  1286
slouken@0
  1287
	if test -z "$libdir"; then
slouken@0
  1288
	  # It is a libtool convenience library, so add in its objects.
slouken@0
  1289
	  convenience="$convenience $dir/$old_library"
slouken@0
  1290
	  old_convenience="$old_convenience $dir/$old_library"
slouken@0
  1291
	  deplibs="$deplibs$dependency_libs"
slouken@0
  1292
	  compile_command="$compile_command $dir/$old_library$dependency_libs"
slouken@0
  1293
	  finalize_command="$finalize_command $dir/$old_library$dependency_libs"
slouken@0
  1294
	  continue
slouken@0
  1295
	fi
slouken@0
  1296
slouken@0
  1297
	# This library was specified with -dlopen.
slouken@0
  1298
	if test "$prev" = dlfiles; then
slouken@0
  1299
	  dlfiles="$dlfiles $arg"
slouken@0
  1300
	  if test -z "$dlname" || test "$dlopen" != yes || test "$build_libtool_libs" = no; then
slouken@0
  1301
	    # If there is no dlname, no dlopen support or we're linking statically,
slouken@0
  1302
	    # we need to preload.
slouken@0
  1303
	    prev=dlprefiles
slouken@0
  1304
	  else
slouken@0
  1305
	    # We should not create a dependency on this library, but we
slouken@0
  1306
	    # may need any libraries it requires.
slouken@0
  1307
	    compile_command="$compile_command$dependency_libs"
slouken@0
  1308
	    finalize_command="$finalize_command$dependency_libs"
slouken@0
  1309
	    prev=
slouken@0
  1310
	    continue
slouken@0
  1311
	  fi
slouken@0
  1312
	fi
slouken@0
  1313
slouken@0
  1314
	# The library was specified with -dlpreopen.
slouken@0
  1315
	if test "$prev" = dlprefiles; then
slouken@0
  1316
	  # Prefer using a static library (so that no silly _DYNAMIC symbols
slouken@0
  1317
	  # are required to link).
slouken@0
  1318
	  if test -n "$old_library"; then
slouken@0
  1319
	    dlprefiles="$dlprefiles $dir/$old_library"
slouken@0
  1320
	  else
slouken@0
  1321
	    dlprefiles="$dlprefiles $dir/$linklib"
slouken@0
  1322
	  fi
slouken@0
  1323
	  prev=
slouken@0
  1324
	fi
slouken@0
  1325
slouken@0
  1326
	if test -n "$library_names" &&
slouken@0
  1327
	   { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
slouken@0
  1328
	  link_against_libtool_libs="$link_against_libtool_libs $arg"
slouken@0
  1329
	  if test -n "$shlibpath_var"; then
slouken@0
  1330
	    # Make sure the rpath contains only unique directories.
slouken@0
  1331
	    case "$temp_rpath " in
slouken@0
  1332
	    *" $dir "*) ;;
slouken@0
  1333
	    *) temp_rpath="$temp_rpath $dir" ;;
slouken@0
  1334
	    esac
slouken@0
  1335
	  fi
slouken@0
  1336
slouken@0
  1337
	  # We need an absolute path.
slouken@0
  1338
	  case "$dir" in
slouken@0
  1339
	  [\\/] | [A-Za-z]:[\\/]*) absdir="$dir" ;;
slouken@0
  1340
	  *)
slouken@0
  1341
	    absdir=`cd "$dir" && pwd`
slouken@0
  1342
	    if test -z "$absdir"; then
slouken@0
  1343
	      $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
slouken@0
  1344
	      $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
slouken@0
  1345
	      absdir="$dir"
slouken@0
  1346
	    fi
slouken@0
  1347
	    ;;
slouken@0
  1348
	  esac
slouken@0
  1349
	  
slouken@0
  1350
	  # This is the magic to use -rpath.
slouken@0
  1351
	  # Skip directories that are in the system default run-time
slouken@0
  1352
	  # search path, unless they have been requested with -R.
slouken@0
  1353
	  case " $sys_lib_dlsearch_path " in
slouken@0
  1354
	  *" $absdir "*) ;;
slouken@0
  1355
	  *)
slouken@0
  1356
	    case "$compile_rpath " in
slouken@0
  1357
	    *" $absdir "*) ;;
slouken@0
  1358
	    *) compile_rpath="$compile_rpath $absdir" 
slouken@0
  1359
	    esac
slouken@0
  1360
	    ;;
slouken@0
  1361
	  esac
slouken@0
  1362
slouken@0
  1363
	  case " $sys_lib_dlsearch_path " in
slouken@0
  1364
	  *" $libdir "*) ;;
slouken@0
  1365
	  *)
slouken@0
  1366
	    case "$finalize_rpath " in
slouken@0
  1367
	    *" $libdir "*) ;;
slouken@0
  1368
	    *) finalize_rpath="$finalize_rpath $libdir"
slouken@0
  1369
	    esac
slouken@0
  1370
	    ;;
slouken@0
  1371
	  esac
slouken@0
  1372
slouken@0
  1373
	  lib_linked=yes
slouken@0
  1374
	  case "$hardcode_action" in
slouken@0
  1375
	  immediate | unsupported)
slouken@0
  1376
	    if test "$hardcode_direct" = no; then
slouken@0
  1377
	      compile_command="$compile_command $dir/$linklib"
slouken@0
  1378
	      deplibs="$deplibs $dir/$linklib"
slouken@0
  1379
	      case "$host" in
slouken@0
  1380
	      *-*-cygwin* | *-*-mingw* | *-*-os2*)
slouken@0
  1381
		dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
slouken@0
  1382
		if test -n "$dllsearchpath"; then
slouken@0
  1383
		  dllsearchpath="$dllsearchpath:$dllsearchdir"
slouken@0
  1384
		else
slouken@0
  1385
		  dllsearchpath="$dllsearchdir"
slouken@0
  1386
		fi
slouken@0
  1387
		;;
slouken@0
  1388
	      esac
slouken@0
  1389
	    elif test "$hardcode_minus_L" = no; then
slouken@0
  1390
	      case "$host" in
slouken@0
  1391
	      *-*-sunos*)
slouken@0
  1392
		compile_shlibpath="$compile_shlibpath$dir:"
slouken@0
  1393
		;;
slouken@0
  1394
	      esac
slouken@0
  1395
	      case "$compile_command " in
slouken@0
  1396
	      *" -L$dir "*) ;;
slouken@0
  1397
	      *) compile_command="$compile_command -L$dir";;
slouken@0
  1398
	      esac
slouken@0
  1399
	      compile_command="$compile_command -l$name"
slouken@0
  1400
	      deplibs="$deplibs -L$dir -l$name"
slouken@0
  1401
	    elif test "$hardcode_shlibpath_var" = no; then
slouken@0
  1402
	      case ":$compile_shlibpath:" in
slouken@0
  1403
	      *":$dir:"*) ;;
slouken@0
  1404
	      *) compile_shlibpath="$compile_shlibpath$dir:";;
slouken@0
  1405
	      esac
slouken@0
  1406
	      compile_command="$compile_command -l$name"
slouken@0
  1407
	      deplibs="$deplibs -l$name"
slouken@0
  1408
	    else
slouken@0
  1409
	      lib_linked=no
slouken@0
  1410
	    fi
slouken@0
  1411
	    ;;
slouken@0
  1412
slouken@0
  1413
	  relink)
slouken@0
  1414
	    if test "$hardcode_direct" = yes; then
slouken@0
  1415
	      compile_command="$compile_command $absdir/$linklib"
slouken@0
  1416
	      deplibs="$deplibs $absdir/$linklib"
slouken@0
  1417
	    elif test "$hardcode_minus_L" = yes; then
slouken@0
  1418
	      case "$compile_command " in
slouken@0
  1419
	      *" -L$absdir "*) ;;
slouken@0
  1420
	      *) compile_command="$compile_command -L$absdir";;
slouken@0
  1421
	      esac
slouken@0
  1422
	      compile_command="$compile_command -l$name"
slouken@0
  1423
	      deplibs="$deplibs -L$absdir -l$name"
slouken@0
  1424
	    elif test "$hardcode_shlibpath_var" = yes; then
slouken@0
  1425
	      case ":$compile_shlibpath:" in
slouken@0
  1426
	      *":$absdir:"*) ;;
slouken@0
  1427
	      *) compile_shlibpath="$compile_shlibpath$absdir:";;
slouken@0
  1428
	      esac
slouken@0
  1429
	      compile_command="$compile_command -l$name"
slouken@0
  1430
	      deplibs="$deplibs -l$name"
slouken@0
  1431
	    else
slouken@0
  1432
	      lib_linked=no
slouken@0
  1433
	    fi
slouken@0
  1434
	    ;;
slouken@0
  1435
slouken@0
  1436
	  *)
slouken@0
  1437
	    lib_linked=no
slouken@0
  1438
	    ;;
slouken@0
  1439
	  esac
slouken@0
  1440
slouken@0
  1441
	  if test "$lib_linked" != yes; then
slouken@0
  1442
	    $echo "$modename: configuration error: unsupported hardcode properties"
slouken@0
  1443
	    exit 1
slouken@0
  1444
	  fi
slouken@0
  1445
slouken@0
  1446
	  # Finalize command for both is simple: just hardcode it.
slouken@0
  1447
	  if test "$hardcode_direct" = yes; then
slouken@0
  1448
	    finalize_command="$finalize_command $libdir/$linklib"
slouken@0
  1449
	  elif test "$hardcode_minus_L" = yes; then
slouken@0
  1450
	    case "$finalize_command " in
slouken@0
  1451
	    *" -L$libdir "*) ;;
slouken@0
  1452
	    *) finalize_command="$finalize_command -L$libdir";;
slouken@0
  1453
	    esac
slouken@0
  1454
	    finalize_command="$finalize_command -l$name"
slouken@0
  1455
	  elif test "$hardcode_shlibpath_var" = yes; then
slouken@0
  1456
	    case ":$finalize_shlibpath:" in
slouken@0
  1457
	    *":$libdir:"*) ;;
slouken@0
  1458
	    *) finalize_shlibpath="$finalize_shlibpath$libdir:";;
slouken@0
  1459
	    esac
slouken@0
  1460
	    finalize_command="$finalize_command -l$name"
slouken@0
  1461
	  else
slouken@0
  1462
	    # We cannot seem to hardcode it, guess we'll fake it.
slouken@0
  1463
	    case "$finalize_command " in
slouken@0
  1464
	    *" -L$dir "*) ;;
slouken@0
  1465
	    *) finalize_command="$finalize_command -L$libdir";;
slouken@0
  1466
	    esac
slouken@0
  1467
	    finalize_command="$finalize_command -l$name"
slouken@0
  1468
	  fi
slouken@0
  1469
	else
slouken@0
  1470
	  # Transform directly to old archives if we don't build new libraries.
slouken@0
  1471
	  if test -n "$pic_flag" && test -z "$old_library"; then
slouken@0
  1472
	    $echo "$modename: cannot find static library for \`$arg'" 1>&2
slouken@0
  1473
	    exit 1
slouken@0
  1474
	  fi
slouken@0
  1475
slouken@0
  1476
	  # Here we assume that one of hardcode_direct or hardcode_minus_L
slouken@0
  1477
	  # is not unsupported.  This is valid on all known static and
slouken@0
  1478
	  # shared platforms.
slouken@0
  1479
	  if test "$hardcode_direct" != unsupported; then
slouken@0
  1480
	    test -n "$old_library" && linklib="$old_library"
slouken@0
  1481
	    compile_command="$compile_command $dir/$linklib"
slouken@0
  1482
	    finalize_command="$finalize_command $dir/$linklib"
slouken@0
  1483
	  else
slouken@0
  1484
	    case "$compile_command " in
slouken@0
  1485
	    *" -L$dir "*) ;;
slouken@0
  1486
	    *) compile_command="$compile_command -L$dir";;
slouken@0
  1487
	    esac
slouken@0
  1488
	    compile_command="$compile_command -l$name"
slouken@0
  1489
	    case "$finalize_command " in
slouken@0
  1490
	    *" -L$dir "*) ;;
slouken@0
  1491
	    *) finalize_command="$finalize_command -L$dir";;
slouken@0
  1492
	    esac
slouken@0
  1493
	    finalize_command="$finalize_command -l$name"
slouken@0
  1494
	  fi
slouken@0
  1495
	fi
slouken@0
  1496
slouken@0
  1497
	# Add in any libraries that this one depends upon.
slouken@0
  1498
	compile_command="$compile_command$dependency_libs"
slouken@0
  1499
	finalize_command="$finalize_command$dependency_libs"
slouken@0
  1500
	continue
slouken@0
  1501
	;;
slouken@0
  1502
slouken@0
  1503
      # Some other compiler argument.
slouken@0
  1504
      *)
slouken@0
  1505
	# Unknown arguments in both finalize_command and compile_command need
slouken@0
  1506
	# to be aesthetically quoted because they are evaled later.
slouken@0
  1507
	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
slouken@0
  1508
	case "$arg" in
slouken@0
  1509
	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
slouken@0
  1510
	  arg="\"$arg\""
slouken@0
  1511
	  ;;
slouken@0
  1512
	esac
slouken@0
  1513
	;;
slouken@0
  1514
      esac
slouken@0
  1515
slouken@0
  1516
      # Now actually substitute the argument into the commands.
slouken@0
  1517
      if test -n "$arg"; then
slouken@0
  1518
	compile_command="$compile_command $arg"
slouken@0
  1519
	finalize_command="$finalize_command $arg"
slouken@0
  1520
      fi
slouken@0
  1521
    done
slouken@0
  1522
slouken@0
  1523
    if test -n "$prev"; then
slouken@0
  1524
      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
slouken@0
  1525
      $echo "$help" 1>&2
slouken@0
  1526
      exit 1
slouken@0
  1527
    fi
slouken@0
  1528
slouken@0
  1529
    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
slouken@0
  1530
      eval arg=\"$export_dynamic_flag_spec\"
slouken@0
  1531
      compile_command="$compile_command $arg"
slouken@0
  1532
      finalize_command="$finalize_command $arg"
slouken@0
  1533
    fi
slouken@0
  1534
slouken@0
  1535
    oldlibs=
slouken@0
  1536
    # calculate the name of the file, without its directory
slouken@0
  1537
    outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
slouken@0
  1538
    libobjs_save="$libobjs"
slouken@0
  1539
slouken@0
  1540
    case "$output" in
slouken@0
  1541
    "")
slouken@0
  1542
      $echo "$modename: you must specify an output file" 1>&2
slouken@0
  1543
      $echo "$help" 1>&2
slouken@0
  1544
      exit 1
slouken@0
  1545
      ;;
slouken@0
  1546
slouken@0
  1547
    *.a | *.lib)
slouken@0
  1548
      if test -n "$link_against_libtool_libs"; then
slouken@0
  1549
	$echo "$modename: error: cannot link libtool libraries into archives" 1>&2
slouken@0
  1550
	exit 1
slouken@0
  1551
      fi
slouken@0
  1552
slouken@0
  1553
      if test -n "$deplibs"; then
slouken@0
  1554
	$echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
slouken@0
  1555
      fi
slouken@0
  1556
slouken@0
  1557
      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
slouken@0
  1558
	$echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
slouken@0
  1559
      fi
slouken@0
  1560
slouken@0
  1561
      if test -n "$rpath"; then
slouken@0
  1562
	$echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
slouken@0
  1563
      fi
slouken@0
  1564
slouken@0
  1565
      if test -n "$xrpath"; then
slouken@0
  1566
	$echo "$modename: warning: \`-R' is ignored for archives" 1>&2
slouken@0
  1567
      fi
slouken@0
  1568
slouken@0
  1569
      if test -n "$vinfo"; then
slouken@0
  1570
	$echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
slouken@0
  1571
      fi
slouken@0
  1572
slouken@0
  1573
      if test -n "$release"; then
slouken@0
  1574
	$echo "$modename: warning: \`-release' is ignored for archives" 1>&2
slouken@0
  1575
      fi
slouken@0
  1576
slouken@0
  1577
      if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
slouken@0
  1578
	$echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
slouken@0
  1579
      fi
slouken@0
  1580
slouken@0
  1581
      # Now set the variables for building old libraries.
slouken@0
  1582
      build_libtool_libs=no
slouken@0
  1583
      oldlibs="$output"
slouken@0
  1584
      ;;
slouken@0
  1585
slouken@0
  1586
    *.la)
slouken@0
  1587
      # Make sure we only generate libraries of the form `libNAME.la'.
slouken@0
  1588
      case "$outputname" in
slouken@0
  1589
      lib*)
slouken@0
  1590
	name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
slouken@0
  1591
	eval libname=\"$libname_spec\"
slouken@0
  1592
	;;
slouken@0
  1593
      *)
slouken@0
  1594
	if test "$module" = no; then
slouken@0
  1595
	  $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
slouken@0
  1596
	  $echo "$help" 1>&2
slouken@0
  1597
	  exit 1
slouken@0
  1598
	fi
slouken@0
  1599
	if test "$need_lib_prefix" != no; then
slouken@0
  1600
	  # Add the "lib" prefix for modules if required
slouken@0
  1601
	  name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
slouken@0
  1602
	  eval libname=\"$libname_spec\"
slouken@0
  1603
	else
slouken@0
  1604
	  libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
slouken@0
  1605
	fi
slouken@0
  1606
	;;
slouken@0
  1607
      esac
slouken@0
  1608
slouken@0
  1609
      output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
slouken@0
  1610
      if test "X$output_objdir" = "X$output"; then
slouken@0
  1611
	output_objdir="$objdir"
slouken@0
  1612
      else
slouken@0
  1613
	output_objdir="$output_objdir/$objdir"
slouken@0
  1614
      fi
slouken@0
  1615
slouken@0
  1616
      if test -n "$objs"; then
slouken@0
  1617
	$echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1
slouken@0
  1618
	exit 1
slouken@0
  1619
      fi
slouken@0
  1620
slouken@0
  1621
      # How the heck are we supposed to write a wrapper for a shared library?
slouken@0
  1622
      if test -n "$link_against_libtool_libs"; then
slouken@0
  1623
	 $echo "$modename: error: cannot link shared libraries into libtool libraries" 1>&2
slouken@0
  1624
	 exit 1
slouken@0
  1625
      fi
slouken@0
  1626
slouken@0
  1627
      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
slouken@0
  1628
	$echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2
slouken@0
  1629
      fi
slouken@0
  1630
slouken@0
  1631
      set dummy $rpath
slouken@0
  1632
      if test $# -gt 2; then
slouken@0
  1633
	$echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
slouken@0
  1634
      fi
slouken@0
  1635
      install_libdir="$2"
slouken@0
  1636
slouken@0
  1637
      oldlibs=
slouken@0
  1638
      if test -z "$rpath"; then
slouken@0
  1639
	if test "$build_libtool_libs" = yes; then
slouken@0
  1640
	  # Building a libtool convenience library.
slouken@0
  1641
	  libext=al
slouken@0
  1642
	  oldlibs="$output_objdir/$libname.$libext $oldlibs"
slouken@0
  1643
	  build_libtool_libs=convenience
slouken@0
  1644
	  build_old_libs=yes
slouken@0
  1645
	fi
slouken@0
  1646
	dependency_libs="$deplibs"
slouken@0
  1647
slouken@0
  1648
	if test -n "$vinfo"; then
slouken@0
  1649
	  $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
slouken@0
  1650
	fi
slouken@0
  1651
slouken@0
  1652
	if test -n "$release"; then
slouken@0
  1653
	  $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
slouken@0
  1654
	fi
slouken@0
  1655
      else
slouken@0
  1656
slouken@0
  1657
	# Parse the version information argument.
slouken@0
  1658
	IFS="${IFS= 	}"; save_ifs="$IFS"; IFS=':'
slouken@0
  1659
	set dummy $vinfo 0 0 0
slouken@0
  1660
	IFS="$save_ifs"
slouken@0
  1661
slouken@0
  1662
	if test -n "$8"; then
slouken@0
  1663
	  $echo "$modename: too many parameters to \`-version-info'" 1>&2
slouken@0
  1664
	  $echo "$help" 1>&2
slouken@0
  1665
	  exit 1
slouken@0
  1666
	fi
slouken@0
  1667
slouken@0
  1668
	current="$2"
slouken@0
  1669
	revision="$3"
slouken@0
  1670
	age="$4"
slouken@0
  1671
slouken@0
  1672
	# Check that each of the things are valid numbers.
slouken@0
  1673
	case "$current" in
slouken@0
  1674
	0 | [1-9] | [1-9][0-9]*) ;;
slouken@0
  1675
	*)
slouken@0
  1676
	  $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
slouken@0
  1677
	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
slouken@0
  1678
	  exit 1
slouken@0
  1679
	  ;;
slouken@0
  1680
	esac
slouken@0
  1681
slouken@0
  1682
	case "$revision" in
slouken@0
  1683
	0 | [1-9] | [1-9][0-9]*) ;;
slouken@0
  1684
	*)
slouken@0
  1685
	  $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
slouken@0
  1686
	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
slouken@0
  1687
	  exit 1
slouken@0
  1688
	  ;;
slouken@0
  1689
	esac
slouken@0
  1690
slouken@0
  1691
	case "$age" in
slouken@0
  1692
	0 | [1-9] | [1-9][0-9]*) ;;
slouken@0
  1693
	*)
slouken@0
  1694
	  $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
slouken@0
  1695
	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
slouken@0
  1696
	  exit 1
slouken@0
  1697
	  ;;
slouken@0
  1698
	esac
slouken@0
  1699
slouken@0
  1700
	if test $age -gt $current; then
slouken@0
  1701
	  $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
slouken@0
  1702
	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
slouken@0
  1703
	  exit 1
slouken@0
  1704
	fi
slouken@0
  1705
slouken@0
  1706
	# Calculate the version variables.
slouken@0
  1707
	major=
slouken@0
  1708
	versuffix=
slouken@0
  1709
	verstring=
slouken@0
  1710
	case "$version_type" in
slouken@0
  1711
	none) ;;
slouken@0
  1712
slouken@0
  1713
	irix)
slouken@0
  1714
	  major=`expr $current - $age + 1`
slouken@0
  1715
	  versuffix="$major.$revision"
slouken@0
  1716
	  verstring="sgi$major.$revision"
slouken@0
  1717
slouken@0
  1718
	  # Add in all the interfaces that we are compatible with.
slouken@0
  1719
	  loop=$revision
slouken@0
  1720
	  while test $loop != 0; do
slouken@0
  1721
	    iface=`expr $revision - $loop`
slouken@0
  1722
	    loop=`expr $loop - 1`
slouken@0
  1723
	    verstring="sgi$major.$iface:$verstring"
slouken@0
  1724
	  done
slouken@0
  1725
	  ;;
slouken@0
  1726
slouken@0
  1727
	linux)
slouken@0
  1728
	  major=.`expr $current - $age`
slouken@0
  1729
	  versuffix="$major.$age.$revision"
slouken@0
  1730
	  ;;
slouken@0
  1731
slouken@0
  1732
	osf)
slouken@0
  1733
	  major=`expr $current - $age`
slouken@0
  1734
	  versuffix=".$current.$age.$revision"
slouken@0
  1735
	  verstring="$current.$age.$revision"
slouken@0
  1736
slouken@0
  1737
	  # Add in all the interfaces that we are compatible with.
slouken@0
  1738
	  loop=$age
slouken@0
  1739
	  while test $loop != 0; do
slouken@0
  1740
	    iface=`expr $current - $loop`
slouken@0
  1741
	    loop=`expr $loop - 1`
slouken@0
  1742
	    verstring="$verstring:${iface}.0"
slouken@0
  1743
	  done
slouken@0
  1744
slouken@0
  1745
	  # Make executables depend on our current version.
slouken@0
  1746
	  verstring="$verstring:${current}.0"
slouken@0
  1747
	  ;;
slouken@0
  1748
slouken@0
  1749
	sunos)
slouken@0
  1750
	  major=".$current"
slouken@0
  1751
	  versuffix=".$current.$revision"
slouken@0
  1752
	  ;;
slouken@0
  1753
slouken@0
  1754
	freebsd-aout)
slouken@0
  1755
	  major=".$current"
slouken@0
  1756
	  versuffix=".$current.$revision";
slouken@0
  1757
	  ;;
slouken@0
  1758
slouken@0
  1759
	freebsd-elf)
slouken@0
  1760
	  major=".$current"
slouken@0
  1761
	  versuffix=".$current";
slouken@0
  1762
	  ;;
slouken@0
  1763
slouken@0
  1764
	windows)
slouken@0
  1765
	  # Like Linux, but with '-' rather than '.', since we only
slouken@0
  1766
	  # want one extension on Windows 95.
slouken@0
  1767
	  major=`expr $current - $age`
slouken@0
  1768
	  versuffix="-$major-$age-$revision"
slouken@0
  1769
	  ;;
slouken@0
  1770
slouken@0
  1771
	*)
slouken@0
  1772
	  $echo "$modename: unknown library version type \`$version_type'" 1>&2
slouken@0
  1773
	  echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
slouken@0
  1774
	  exit 1
slouken@0
  1775
	  ;;
slouken@0
  1776
	esac
slouken@0
  1777
slouken@0
  1778
	# Clear the version info if we defaulted, and they specified a release.
slouken@0
  1779
	if test -z "$vinfo" && test -n "$release"; then
slouken@0
  1780
	  major=
slouken@0
  1781
	  verstring="0.0"
slouken@0
  1782
	  if test "$need_version" = no; then
slouken@0
  1783
	    versuffix=
slouken@0
  1784
	  else
slouken@0
  1785
	    versuffix=".0.0"
slouken@0
  1786
	  fi
slouken@0
  1787
	fi
slouken@0
  1788
slouken@0
  1789
	# Remove version info from name if versioning should be avoided
slouken@0
  1790
	if test "$avoid_version" = yes && test "$need_version" = no; then
slouken@0
  1791
	  major=
slouken@0
  1792
	  versuffix=
slouken@0
  1793
	  verstring=""
slouken@0
  1794
	fi
slouken@0
  1795
	
slouken@0
  1796
	# Check to see if the archive will have undefined symbols.
slouken@0
  1797
	if test "$allow_undefined" = yes; then
slouken@0
  1798
	  if test "$allow_undefined_flag" = unsupported; then
slouken@0
  1799
	    $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
slouken@0
  1800
	    build_libtool_libs=no
slouken@0
  1801
	    build_old_libs=yes
slouken@0
  1802
	  fi
slouken@0
  1803
	else
slouken@0
  1804
	  # Don't allow undefined symbols.
slouken@0
  1805
	  allow_undefined_flag="$no_undefined_flag"
slouken@0
  1806
	fi
slouken@0
  1807
slouken@0
  1808
	dependency_libs="$deplibs"
slouken@0
  1809
	case "$host" in
slouken@0
  1810
	*-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos* | *-*-freebsd* )
slouken@0
  1811
	  # these systems don't actually have a c library (as such)!
slouken@0
  1812
	  ;;
slouken@0
  1813
        *-*-rhapsody*)
slouken@0
  1814
	  # rhapsody is a little odd...
slouken@0
  1815
	  deplibs="$deplibs -framework System"
slouken@0
  1816
	  ;;
slouken@1
  1817
	*-*-openbsd*)
slouken@1
  1818
	  # do not include libc due to us having libc/libc_r.
slouken@1
  1819
	  ;;
slouken@0
  1820
	*)
slouken@0
  1821
	  # Add libc to deplibs on all other systems.
slouken@0
  1822
	  deplibs="$deplibs -lc"
slouken@0
  1823
	  ;;
slouken@0
  1824
	esac
slouken@0
  1825
      fi
slouken@0
  1826
slouken@0
  1827
      # Create the output directory, or remove our outputs if we need to.
slouken@0
  1828
      if test -d $output_objdir; then
slouken@0
  1829
	$show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
slouken@0
  1830
	$run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
slouken@0
  1831
      else
slouken@0
  1832
	$show "$mkdir $output_objdir"
slouken@0
  1833
	$run $mkdir $output_objdir
slouken@0
  1834
	status=$?
slouken@0
  1835
	if test $status -ne 0 && test ! -d $output_objdir; then
slouken@0
  1836
	  exit $status
slouken@0
  1837
	fi
slouken@0
  1838
      fi
slouken@0
  1839
slouken@0
  1840
      # Now set the variables for building old libraries.
slouken@0
  1841
      if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
slouken@0
  1842
	oldlibs="$oldlibs $output_objdir/$libname.$libext"
slouken@0
  1843
slouken@0
  1844
	# Transform .lo files to .o files.
slouken@0
  1845
	oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
slouken@0
  1846
      fi
slouken@0
  1847
slouken@0
  1848
      if test "$build_libtool_libs" = yes; then
slouken@0
  1849
	# Transform deplibs into only deplibs that can be linked in shared.
slouken@0
  1850
	name_save=$name
slouken@0
  1851
	libname_save=$libname
slouken@0
  1852
	release_save=$release
slouken@0
  1853
	versuffix_save=$versuffix
slouken@0
  1854
	major_save=$major
slouken@0
  1855
	# I'm not sure if I'm treating the release correctly.  I think
slouken@0
  1856
	# release should show up in the -l (ie -lgmp5) so we don't want to
slouken@0
  1857
	# add it in twice.  Is that correct?
slouken@0
  1858
	release=""
slouken@0
  1859
	versuffix=""
slouken@0
  1860
	major=""
slouken@0
  1861
	newdeplibs=
slouken@0
  1862
	droppeddeps=no
slouken@0
  1863
	case "$deplibs_check_method" in
slouken@0
  1864
	pass_all)
slouken@0
  1865
	  # Don't check for shared/static.  Everything works.
slouken@0
  1866
	  # This might be a little naive.  We might want to check
slouken@0
  1867
	  # whether the library exists or not.  But this is on
slouken@0
  1868
	  # osf3 & osf4 and I'm not really sure... Just
slouken@0
  1869
	  # implementing what was already the behaviour.
slouken@0
  1870
	  newdeplibs=$deplibs
slouken@0
  1871
	  ;;
slouken@0
  1872
	test_compile)
slouken@0
  1873
	  # This code stresses the "libraries are programs" paradigm to its
slouken@0
  1874
	  # limits. Maybe even breaks it.  We compile a program, linking it
slouken@0
  1875
	  # against the deplibs as a proxy for the library.  Then we can check
slouken@0
  1876
	  # whether they linked in statically or dynamically with ldd.
slouken@0
  1877
	  $rm conftest.c
slouken@0
  1878
	  cat > conftest.c <<EOF
slouken@0
  1879
	  int main() { return 0; }
slouken@0
  1880
EOF
slouken@0
  1881
	  $rm conftest
slouken@0
  1882
	  $CC -o conftest conftest.c $deplibs
slouken@0
  1883
	  if test $? -eq 0 ; then
slouken@0
  1884
	    ldd_output=`ldd conftest`
slouken@0
  1885
	    for i in $deplibs; do
slouken@0
  1886
	      name="`expr $i : '-l\(.*\)'`"
slouken@0
  1887
	      # If $name is empty we are operating on a -L argument.
slouken@0
  1888
	      if test "$name" != "" ; then
slouken@0
  1889
		libname=`eval \\$echo \"$libname_spec\"`
slouken@0
  1890
		deplib_matches=`eval \\$echo \"$library_names_spec\"`
slouken@0
  1891
		set dummy $deplib_matches
slouken@0
  1892
		deplib_match=$2
slouken@0
  1893
		if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
slouken@0
  1894
		  newdeplibs="$newdeplibs $i"
slouken@0
  1895
		else
slouken@0
  1896
		  droppeddeps=yes
slouken@0
  1897
		  echo
slouken@0
  1898
		  echo "*** Warning: This library needs some functionality provided by $i."
slouken@0
  1899
		  echo "*** I have the capability to make that library automatically link in when"
slouken@0
  1900
		  echo "*** you link to this library.  But I can only do this if you have a"
slouken@0
  1901
		  echo "*** shared version of the library, which you do not appear to have."
slouken@0
  1902
		fi
slouken@0
  1903
	      else
slouken@0
  1904
		newdeplibs="$newdeplibs $i"
slouken@0
  1905
	      fi
slouken@0
  1906
	    done
slouken@0
  1907
	  else
slouken@0
  1908
	    # Error occured in the first compile.  Let's try to salvage the situation:
slouken@0
  1909
	    # Compile a seperate program for each library.
slouken@0
  1910
	    for i in $deplibs; do
slouken@0
  1911
	      name="`expr $i : '-l\(.*\)'`"
slouken@0
  1912
	     # If $name is empty we are operating on a -L argument.
slouken@0
  1913
	      if test "$name" != "" ; then
slouken@0
  1914
		$rm conftest
slouken@0
  1915
		$CC -o conftest conftest.c $i
slouken@0
  1916
		# Did it work?
slouken@0
  1917
		if test $? -eq 0 ; then
slouken@0
  1918
		  ldd_output=`ldd conftest`
slouken@0
  1919
		  libname=`eval \\$echo \"$libname_spec\"`
slouken@0
  1920
		  deplib_matches=`eval \\$echo \"$library_names_spec\"`
slouken@0
  1921
		  set dummy $deplib_matches
slouken@0
  1922
		  deplib_match=$2
slouken@0
  1923
		  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
slouken@0
  1924
		    newdeplibs="$newdeplibs $i"
slouken@0
  1925
		  else
slouken@0
  1926
		    droppeddeps=yes
slouken@0
  1927
		    echo
slouken@0
  1928
		    echo "*** Warning: This library needs some functionality provided by $i."
slouken@0
  1929
		    echo "*** I have the capability to make that library automatically link in when"
slouken@0
  1930
		    echo "*** you link to this library.  But I can only do this if you have a"
slouken@0
  1931
		    echo "*** shared version of the library, which you do not appear to have."
slouken@0
  1932
		  fi
slouken@0
  1933
		else
slouken@0
  1934
		  droppeddeps=yes
slouken@0
  1935
		  echo
slouken@0
  1936
		  echo "*** Warning!  Library $i is needed by this library but I was not able to"
slouken@0
  1937
		  echo "***  make it link in!  You will probably need to install it or some"
slouken@0
  1938
		  echo "*** library that it depends on before this library will be fully"
slouken@0
  1939
		  echo "*** functional.  Installing it before continuing would be even better."
slouken@0
  1940
		fi
slouken@0
  1941
	      else
slouken@0
  1942
		newdeplibs="$newdeplibs $i"
slouken@0
  1943
	      fi
slouken@0
  1944
	    done
slouken@0
  1945
	  fi
slouken@0
  1946
	  ;;
slouken@0
  1947
	file_magic*)
slouken@0
  1948
	  set dummy $deplibs_check_method
slouken@0
  1949
	  file_magic_regex="`expr \"$deplibs_check_method\" : \"$2 \(.*\)\"`"
slouken@0
  1950
	  for a_deplib in $deplibs; do
slouken@0
  1951
	    name="`expr $a_deplib : '-l\(.*\)'`"
slouken@0
  1952
	    # If $name is empty we are operating on a -L argument.
slouken@0
  1953
	    if test "$name" != "" ; then
slouken@0
  1954
	      libname=`eval \\$echo \"$libname_spec\"`
slouken@0
  1955
	      for i in $lib_search_path; do
slouken@0
  1956
		    potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
slouken@0
  1957
		    for potent_lib in $potential_libs; do
slouken@0
  1958
		      # Follow soft links.
slouken@0
  1959
		      if ls -lLd "$potent_lib" 2>/dev/null \
slouken@0
  1960
			 | grep " -> " >/dev/null; then
slouken@0
  1961
			continue 
slouken@0
  1962
		      fi
slouken@0
  1963
		      # The statement above tries to avoid entering an
slouken@0
  1964
		      # endless loop below, in case of cyclic links.
slouken@0
  1965
		      # We might still enter an endless loop, since a link
slouken@0
  1966
		      # loop can be closed while we follow links,
slouken@0
  1967
		      # but so what?
slouken@0
  1968
		      potlib="$potent_lib"
slouken@0
  1969
		      while test -h "$potlib" 2>/dev/null; do
slouken@0
  1970
			potliblink=`ls -ld $potlib | sed 's/.* -> //'`
slouken@0
  1971
			case "$potliblink" in
slouken@0
  1972
			[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
slouken@0
  1973
			*) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
slouken@0
  1974
			esac
slouken@0
  1975
		      done
slouken@0
  1976
		      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
slouken@0
  1977
			 | sed 10q \
slouken@0
  1978
			 | egrep "$file_magic_regex" > /dev/null; then
slouken@0
  1979
			newdeplibs="$newdeplibs $a_deplib"
slouken@0
  1980
			a_deplib=""
slouken@0
  1981
			break 2
slouken@0
  1982
		      fi
slouken@0
  1983
		    done
slouken@0
  1984
	      done
slouken@0
  1985
	      if test -n "$a_deplib" ; then
slouken@0
  1986
		droppeddeps=yes
slouken@0
  1987
		echo
slouken@0
  1988
		echo "*** Warning: This library needs some functionality provided by $a_deplib."
slouken@0
  1989
		echo "*** I have the capability to make that library automatically link in when"
slouken@0
  1990
		echo "*** you link to this library.  But I can only do this if you have a"
slouken@0
  1991
		echo "*** shared version of the library, which you do not appear to have."
slouken@0
  1992
	      fi
slouken@0
  1993
	    else
slouken@0
  1994
	      # Add a -L argument.
slouken@0
  1995
	      newdeplibs="$newdeplibs $a_deplib"
slouken@0
  1996
	    fi
slouken@0
  1997
	  done # Gone through all deplibs.
slouken@0
  1998
	  ;;
slouken@0
  1999
	none | unknown | *)
slouken@0
  2000
	  newdeplibs=""
slouken@0
  2001
	  if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
slouken@0
  2002
	       -e 's/ -[LR][^ ]*//g' -e 's/[ 	]//g' |
slouken@0
  2003
	     grep . >/dev/null; then
slouken@0
  2004
	    echo
slouken@0
  2005
	    if test "X$deplibs_check_method" = "Xnone"; then
slouken@0
  2006
	      echo "*** Warning: inter-library dependencies are not supported in this platform."
slouken@0
  2007
	    else
slouken@0
  2008
	      echo "*** Warning: inter-library dependencies are not known to be supported."
slouken@0
  2009
	    fi
slouken@0
  2010
	    echo "*** All declared inter-library dependencies are being dropped."
slouken@0
  2011
	    droppeddeps=yes
slouken@0
  2012
	  fi
slouken@0
  2013
	  ;;
slouken@0
  2014
	esac
slouken@0
  2015
	versuffix=$versuffix_save
slouken@0
  2016
	major=$major_save
slouken@0
  2017
	release=$release_save
slouken@0
  2018
	libname=$libname_save
slouken@0
  2019
	name=$name_save
slouken@0
  2020
slouken@0
  2021
	if test "$droppeddeps" = yes; then
slouken@0
  2022
	  if test "$module" = yes; then
slouken@0
  2023
	    echo
slouken@0
  2024
	    echo "*** Warning: libtool could not satisfy all declared inter-library"
slouken@0
  2025
	    echo "*** dependencies of module $libname.  Therefore, libtool will create"
slouken@0
  2026
	    echo "*** a static module, that should work as long as the dlopening"
slouken@0
  2027
	    echo "*** application is linked with the -dlopen flag."
slouken@0
  2028
	    if test -z "$global_symbol_pipe"; then
slouken@0
  2029
	      echo
slouken@0
  2030
	      echo "*** However, this would only work if libtool was able to extract symbol"
slouken@0
  2031
	      echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
slouken@0
  2032
	      echo "*** not find such a program.  So, this module is probably useless."
slouken@0
  2033
	      echo "*** \`nm' from GNU binutils and a full rebuild may help."
slouken@0
  2034
	    fi
slouken@0
  2035
	    if test "$build_old_libs" = no; then
slouken@0
  2036
	      oldlibs="$output_objdir/$libname.$libext"
slouken@0
  2037
	      build_libtool_libs=module
slouken@0
  2038
	      build_old_libs=yes
slouken@0
  2039
	    else
slouken@0
  2040
	      build_libtool_libs=no
slouken@0
  2041
	    fi
slouken@0
  2042
	  else
slouken@0
  2043
	    echo "*** The inter-library dependencies that have been dropped here will be"
slouken@0
  2044
	    echo "*** automatically added whenever a program is linked with this library"
slouken@0
  2045
	    echo "*** or is declared to -dlopen it."
slouken@0
  2046
	  fi
slouken@0
  2047
	fi
slouken@0
  2048
	# Done checking deplibs!
slouken@0
  2049
	deplibs=$newdeplibs
slouken@0
  2050
      fi
slouken@0
  2051
slouken@0
  2052
      # All the library-specific variables (install_libdir is set above).
slouken@0
  2053
      library_names=
slouken@0
  2054
      old_library=
slouken@0
  2055
      dlname=
slouken@0
  2056
      
slouken@0
  2057
      # Test again, we may have decided not to build it any more
slouken@0
  2058
      if test "$build_libtool_libs" = yes; then
slouken@0
  2059
	# Get the real and link names of the library.
slouken@0
  2060
	eval library_names=\"$library_names_spec\"
slouken@0
  2061
	set dummy $library_names
slouken@0
  2062
	realname="$2"
slouken@0
  2063
	shift; shift
slouken@0
  2064
slouken@0
  2065
	if test -n "$soname_spec"; then
slouken@0
  2066
	  eval soname=\"$soname_spec\"
slouken@0
  2067
	else
slouken@0
  2068
	  soname="$realname"
slouken@0
  2069
	fi
slouken@0
  2070
slouken@0
  2071
	lib="$output_objdir/$realname"
slouken@0
  2072
	for link
slouken@0
  2073
	do
slouken@0
  2074
	  linknames="$linknames $link"
slouken@0
  2075
	done
slouken@0
  2076
slouken@0
  2077
	# Ensure that we have .o objects for linkers which dislike .lo
slouken@0
  2078
	# (e.g. aix) in case we are running --disable-static
slouken@0
  2079
	for obj in $libobjs; do
slouken@0
  2080
	  xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
slouken@0
  2081
	  if test "X$xdir" = "X$obj"; then
slouken@0
  2082
	    xdir="."
slouken@0
  2083
	  else
slouken@0
  2084
	    xdir="$xdir"
slouken@0
  2085
	  fi
slouken@0
  2086
	  baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
slouken@0
  2087
	  oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
slouken@0
  2088
	  if test ! -f $xdir/$oldobj; then
slouken@0
  2089
	    $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
slouken@0
  2090
	    $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
slouken@0
  2091
	  fi
slouken@0
  2092
	done
slouken@0
  2093
slouken@0
  2094
	# Use standard objects if they are pic
slouken@0
  2095
	test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
slouken@0
  2096
slouken@0
  2097
	# Prepare the list of exported symbols
slouken@0
  2098
	if test -z "$export_symbols"; then
slouken@0
  2099
	  if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
slouken@0
  2100
	    $show "generating symbol list for \`$libname.la'"
slouken@0
  2101
	    export_symbols="$output_objdir/$libname.exp"
slouken@0
  2102
	    $run $rm $export_symbols
slouken@0
  2103
	    eval cmds=\"$export_symbols_cmds\"
slouken@0
  2104
	    IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
slouken@0
  2105
	    for cmd in $cmds; do
slouken@0
  2106
	      IFS="$save_ifs"
slouken@0
  2107
	      $show "$cmd"
slouken@0
  2108
	      $run eval "$cmd" || exit $?
slouken@0
  2109
	    done
slouken@0
  2110
	    IFS="$save_ifs"
slouken@0
  2111
	    if test -n "$export_symbols_regex"; then
slouken@0
  2112
	      $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
slouken@0
  2113
	      $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
slouken@0
  2114
	      $show "$mv \"${export_symbols}T\" \"$export_symbols\""
slouken@0
  2115
	      $run eval '$mv "${export_symbols}T" "$export_symbols"'
slouken@0
  2116
	    fi
slouken@0
  2117
	  fi
slouken@0
  2118
	fi
slouken@0
  2119
slouken@0
  2120
	if test -n "$export_symbols" && test -n "$include_expsyms"; then
slouken@0
  2121
	  $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
slouken@0
  2122
	fi
slouken@0
  2123
slouken@0
  2124
	if test -n "$convenience"; then
slouken@0
  2125
	  if test -n "$whole_archive_flag_spec"; then
slouken@0
  2126
	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
slouken@0
  2127
	  else
slouken@0
  2128
	    gentop="$output_objdir/${outputname}x"
slouken@0
  2129
	    $show "${rm}r $gentop"
slouken@0
  2130
	    $run ${rm}r "$gentop"
slouken@0
  2131
	    $show "mkdir $gentop"
slouken@0
  2132
	    $run mkdir "$gentop"
slouken@0
  2133
	    status=$?
slouken@0
  2134
	    if test $status -ne 0 && test ! -d "$gentop"; then
slouken@0
  2135
	      exit $status
slouken@0
  2136
	    fi
slouken@0
  2137
	    generated="$generated $gentop"
slouken@0
  2138
slouken@0
  2139
	    for xlib in $convenience; do
slouken@0
  2140
	      # Extract the objects.
slouken@0
  2141
	      case "$xlib" in
slouken@0
  2142
	      [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
slouken@0
  2143
	      *) xabs=`pwd`"/$xlib" ;;
slouken@0
  2144
	      esac
slouken@0
  2145
	      xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
slouken@0
  2146
	      xdir="$gentop/$xlib"
slouken@0
  2147
slouken@0
  2148
	      $show "${rm}r $xdir"
slouken@0
  2149
	      $run ${rm}r "$xdir"
slouken@0
  2150
	      $show "mkdir $xdir"
slouken@0
  2151
	      $run mkdir "$xdir"
slouken@0
  2152
	      status=$?
slouken@0
  2153
	      if test $status -ne 0 && test ! -d "$xdir"; then
slouken@0
  2154
		exit $status
slouken@0
  2155
	      fi
slouken@0
  2156
	      $show "(cd $xdir && $AR x $xabs)"
slouken@0
  2157
	      $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
slouken@0
  2158
slouken@0
  2159
	      libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
slouken@0
  2160
	    done
slouken@0
  2161
	  fi
slouken@0
  2162
	fi
slouken@0
  2163
slouken@0
  2164
	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
slouken@0
  2165
	  eval flag=\"$thread_safe_flag_spec\"
slouken@0
  2166
	  linkopts="$linkopts $flag"
slouken@0
  2167
	fi
slouken@0
  2168
slouken@0
  2169
	# Do each of the archive commands.
slouken@0
  2170
	if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
slouken@0
  2171
	  eval cmds=\"$archive_expsym_cmds\"
slouken@0
  2172
	else
slouken@0
  2173
	  eval cmds=\"$archive_cmds\"
slouken@0
  2174
	fi
slouken@0
  2175
	IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
slouken@0
  2176
	for cmd in $cmds; do
slouken@0
  2177
	  IFS="$save_ifs"
slouken@0
  2178
	  $show "$cmd"
slouken@0
  2179
	  $run eval "$cmd" || exit $?
slouken@0
  2180
	done
slouken@0
  2181
	IFS="$save_ifs"
slouken@0
  2182
slouken@0
  2183
	# Create links to the real library.
slouken@0
  2184
	for linkname in $linknames; do
slouken@0
  2185
	  if test "$realname" != "$linkname"; then
slouken@0
  2186
	    $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
slouken@0
  2187
	    $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
slouken@0
  2188
	  fi
slouken@0
  2189
	done
slouken@0
  2190
slouken@0
  2191
	# If -module or -export-dynamic was specified, set the dlname.
slouken@0
  2192
	if test "$module" = yes || test "$export_dynamic" = yes; then
slouken@0
  2193
	  # On all known operating systems, these are identical.
slouken@0
  2194
	  dlname="$soname"
slouken@0
  2195
	fi
slouken@0
  2196
      fi
slouken@0
  2197
      ;;
slouken@0
  2198
slouken@0
  2199
    *.lo | *.o | *.obj)
slouken@0
  2200
      if test -n "$link_against_libtool_libs"; then
slouken@0
  2201
	$echo "$modename: error: cannot link libtool libraries into objects" 1>&2
slouken@0
  2202
	exit 1
slouken@0
  2203
      fi
slouken@0
  2204
slouken@0
  2205
      if test -n "$deplibs"; then
slouken@0
  2206
	$echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
slouken@0
  2207
      fi
slouken@0
  2208
slouken@0
  2209
      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
slouken@0
  2210
	$echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
slouken@0
  2211
      fi
slouken@0
  2212
slouken@0
  2213
      if test -n "$rpath"; then
slouken@0
  2214
	$echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
slouken@0
  2215
      fi
slouken@0
  2216
slouken@0
  2217
      if test -n "$xrpath"; then
slouken@0
  2218
	$echo "$modename: warning: \`-R' is ignored for objects" 1>&2
slouken@0
  2219
      fi
slouken@0
  2220
slouken@0
  2221
      if test -n "$vinfo"; then
slouken@0
  2222
	$echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
slouken@0
  2223
      fi
slouken@0
  2224
slouken@0
  2225
      if test -n "$release"; then
slouken@0
  2226
	$echo "$modename: warning: \`-release' is ignored for objects" 1>&2
slouken@0
  2227
      fi
slouken@0
  2228
slouken@0
  2229
      case "$output" in
slouken@0
  2230
      *.lo)
slouken@0
  2231
	if test -n "$objs"; then
slouken@0
  2232
	  $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
slouken@0
  2233
	  exit 1
slouken@0
  2234
	fi
slouken@0
  2235
	libobj="$output"
slouken@0
  2236
	obj=`$echo "X$output" | $Xsed -e "$lo2o"`
slouken@0
  2237
	;;
slouken@0
  2238
      *)
slouken@0
  2239
	libobj=
slouken@0
  2240
	obj="$output"
slouken@0
  2241
	;;
slouken@0
  2242
      esac
slouken@0
  2243
slouken@0
  2244
      # Delete the old objects.
slouken@0
  2245
      $run $rm $obj $libobj
slouken@0
  2246
slouken@0
  2247
      # Objects from convenience libraries.  This assumes
slouken@0
  2248
      # single-version convenience libraries.  Whenever we create
slouken@0
  2249
      # different ones for PIC/non-PIC, this we'll have to duplicate
slouken@0
  2250
      # the extraction.
slouken@0
  2251
      reload_conv_objs=
slouken@0
  2252
      gentop=
slouken@0
  2253
      # reload_cmds runs $LD directly, so let us get rid of
slouken@0
  2254
      # -Wl from whole_archive_flag_spec
slouken@0
  2255
      wl= 
slouken@0
  2256
slouken@0
  2257
      if test -n "$convenience"; then
slouken@0
  2258
	if test -n "$whole_archive_flag_spec"; then
slouken@0
  2259
	  eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
slouken@0
  2260
	else
slouken@0
  2261
	  gentop="$output_objdir/${obj}x"
slouken@0
  2262
	  $show "${rm}r $gentop"
slouken@0
  2263
	  $run ${rm}r "$gentop"
slouken@0
  2264
	  $show "mkdir $gentop"
slouken@0
  2265
	  $run mkdir "$gentop"
slouken@0
  2266
	  status=$?
slouken@0
  2267
	  if test $status -ne 0 && test ! -d "$gentop"; then
slouken@0
  2268
	    exit $status
slouken@0
  2269
	  fi
slouken@0
  2270
	  generated="$generated $gentop"
slouken@0
  2271
slouken@0
  2272
	  for xlib in $convenience; do
slouken@0
  2273
	    # Extract the objects.
slouken@0
  2274
	    case "$xlib" in
slouken@0
  2275
	    [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
slouken@0
  2276
	    *) xabs=`pwd`"/$xlib" ;;
slouken@0
  2277
	    esac
slouken@0
  2278
	    xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
slouken@0
  2279
	    xdir="$gentop/$xlib"
slouken@0
  2280
slouken@0
  2281
	    $show "${rm}r $xdir"
slouken@0
  2282
	    $run ${rm}r "$xdir"
slouken@0
  2283
	    $show "mkdir $xdir"
slouken@0
  2284
	    $run mkdir "$xdir"
slouken@0
  2285
	    status=$?
slouken@0
  2286
	    if test $status -ne 0 && test ! -d "$xdir"; then
slouken@0
  2287
	      exit $status
slouken@0
  2288
	    fi
slouken@0
  2289
	    $show "(cd $xdir && $AR x $xabs)"
slouken@0
  2290
	    $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
slouken@0
  2291
slouken@0
  2292
	    reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
slouken@0
  2293
	  done
slouken@0
  2294
	fi
slouken@0
  2295
      fi
slouken@0
  2296
slouken@0
  2297
      # Create the old-style object.
slouken@0
  2298
      reload_objs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs"
slouken@0
  2299
slouken@0
  2300
      output="$obj"
slouken@0
  2301
      eval cmds=\"$reload_cmds\"
slouken@0
  2302
      IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
slouken@0
  2303
      for cmd in $cmds; do
slouken@0
  2304
	IFS="$save_ifs"
slouken@0
  2305
	$show "$cmd"
slouken@0
  2306
	$run eval "$cmd" || exit $?
slouken@0
  2307
      done
slouken@0
  2308
      IFS="$save_ifs"
slouken@0
  2309
slouken@0
  2310
      # Exit if we aren't doing a library object file.
slouken@0
  2311
      if test -z "$libobj"; then
slouken@0
  2312
	if test -n "$gentop"; then
slouken@0
  2313
	  $show "${rm}r $gentop"
slouken@0
  2314
	  $run ${rm}r $gentop
slouken@0
  2315
	fi
slouken@0
  2316
slouken@0
  2317
	exit 0
slouken@0
  2318
      fi
slouken@0
  2319
slouken@0
  2320
      if test "$build_libtool_libs" != yes; then
slouken@0
  2321
	if test -n "$gentop"; then
slouken@0
  2322
	  $show "${rm}r $gentop"
slouken@0
  2323
	  $run ${rm}r $gentop
slouken@0
  2324
	fi
slouken@0
  2325
slouken@0
  2326
	# Create an invalid libtool object if no PIC, so that we don't
slouken@0
  2327
	# accidentally link it into a program.
slouken@0
  2328
	$show "echo timestamp > $libobj"
slouken@0
  2329
	$run eval "echo timestamp > $libobj" || exit $?
slouken@0
  2330
	exit 0
slouken@0
  2331
      fi
slouken@0
  2332
slouken@0
  2333
      if test -n "$pic_flag"; then
slouken@0
  2334
	# Only do commands if we really have different PIC objects.
slouken@0
  2335
	reload_objs="$libobjs $reload_conv_objs"
slouken@0
  2336
	output="$libobj"
slouken@0
  2337
	eval cmds=\"$reload_cmds\"
slouken@0
  2338
	IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
slouken@0
  2339
	for cmd in $cmds; do
slouken@0
  2340
	  IFS="$save_ifs"
slouken@0
  2341
	  $show "$cmd"
slouken@0
  2342
	  $run eval "$cmd" || exit $?
slouken@0
  2343
	done
slouken@0
  2344
	IFS="$save_ifs"
slouken@0
  2345
      else
slouken@0
  2346
	# Just create a symlink.
slouken@0
  2347
	$show $rm $libobj
slouken@0
  2348
	$run $rm $libobj
slouken@0
  2349
	xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
slouken@0
  2350
	if test "X$xdir" = "X$libobj"; then
slouken@0
  2351
	  xdir="."
slouken@0
  2352
	else
slouken@0
  2353
	  xdir="$xdir"
slouken@0
  2354
	fi
slouken@0
  2355
	baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
slouken@0
  2356
	oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
slouken@0
  2357
	$show "(cd $xdir && $LN_S $oldobj $baseobj)"
slouken@0
  2358
	$run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
slouken@0
  2359
      fi
slouken@0
  2360
slouken@0
  2361
      if test -n "$gentop"; then
slouken@0
  2362
	$show "${rm}r $gentop"
slouken@0
  2363
	$run ${rm}r $gentop
slouken@0
  2364
      fi
slouken@0
  2365
slouken@0
  2366
      exit 0
slouken@0
  2367
      ;;
slouken@0
  2368
slouken@0
  2369
    # Anything else should be a program.
slouken@0
  2370
    *)
slouken@0
  2371
      if test -n "$vinfo"; then
slouken@0
  2372
	$echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
slouken@0
  2373
      fi
slouken@0
  2374
slouken@0
  2375
      if test -n "$release"; then
slouken@0
  2376
	$echo "$modename: warning: \`-release' is ignored for programs" 1>&2
slouken@0
  2377
      fi
slouken@0
  2378
slouken@0
  2379
      if test "$preload" = yes; then
slouken@0
  2380
	if test "$dlopen" = unknown && test "$dlopen_self" = unknown &&
slouken@0
  2381
	   test "$dlopen_self_static" = unknown; then
slouken@0
  2382
	  $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
slouken@0
  2383
	fi 
slouken@0
  2384
      fi
slouken@0
  2385
    
slouken@0
  2386
      if test -n "$rpath$xrpath"; then
slouken@0
  2387
	# If the user specified any rpath flags, then add them.
slouken@0
  2388
	for libdir in $rpath $xrpath; do
slouken@0
  2389
	  # This is the magic to use -rpath.
slouken@0
  2390
	  case "$compile_rpath " in
slouken@0
  2391
	  *" $libdir "*) ;;
slouken@0
  2392
	  *) compile_rpath="$compile_rpath $libdir" ;;
slouken@0
  2393
	  esac
slouken@0
  2394
	  case "$finalize_rpath " in
slouken@0
  2395
	  *" $libdir "*) ;;
slouken@0
  2396
	  *) finalize_rpath="$finalize_rpath $libdir" ;;
slouken@0
  2397
	  esac
slouken@0
  2398
	done
slouken@0
  2399
      fi
slouken@0
  2400
slouken@0
  2401
      # Now hardcode the library paths
slouken@0
  2402
      rpath=
slouken@0
  2403
      hardcode_libdirs=
slouken@0
  2404
      for libdir in $compile_rpath $finalize_rpath; do
slouken@0
  2405
	if test -n "$hardcode_libdir_flag_spec"; then
slouken@0
  2406
	  if test -n "$hardcode_libdir_separator"; then
slouken@0
  2407
	    if test -z "$hardcode_libdirs"; then
slouken@0
  2408
	      hardcode_libdirs="$libdir"
slouken@0
  2409
	    else
slouken@0
  2410
	      # Just accumulate the unique libdirs.
slouken@0
  2411
	      case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
slouken@0
  2412
	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
slouken@0
  2413
		;;
slouken@0
  2414
	      *)
slouken@0
  2415
		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
slouken@0
  2416
		;;
slouken@0
  2417
	      esac
slouken@0
  2418
	    fi
slouken@0
  2419
	  else
slouken@0
  2420
	    eval flag=\"$hardcode_libdir_flag_spec\"
slouken@0
  2421
	    rpath="$rpath $flag"
slouken@0
  2422
	  fi
slouken@0
  2423
	elif test -n "$runpath_var"; then
slouken@0
  2424
	  case "$perm_rpath " in
slouken@0
  2425
	  *" $libdir "*) ;;
slouken@0
  2426
	  *) perm_rpath="$perm_rpath $libdir" ;;
slouken@0
  2427
	  esac
slouken@0
  2428
	fi
slouken@0
  2429
      done
slouken@0
  2430
      # Substitute the hardcoded libdirs into the rpath.
slouken@0
  2431
      if test -n "$hardcode_libdir_separator" &&
slouken@0
  2432
	 test -n "$hardcode_libdirs"; then
slouken@0
  2433
	libdir="$hardcode_libdirs"
slouken@0
  2434
	eval rpath=\" $hardcode_libdir_flag_spec\"
slouken@0
  2435
      fi
slouken@0
  2436
      compile_rpath="$rpath"
slouken@0
  2437
slouken@0
  2438
      rpath=
slouken@0
  2439
      hardcode_libdirs=
slouken@0
  2440
      for libdir in $finalize_rpath; do
slouken@0
  2441
	if test -n "$hardcode_libdir_flag_spec"; then
slouken@0
  2442
	  if test -n "$hardcode_libdir_separator"; then
slouken@0
  2443
	    if test -z "$hardcode_libdirs"; then
slouken@0
  2444
	      hardcode_libdirs="$libdir"
slouken@0
  2445
	    else
slouken@0
  2446
	      # Just accumulate the unique libdirs.
slouken@0
  2447
	      case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
slouken@0
  2448
	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
slouken@0
  2449
		;;
slouken@0
  2450
	      *)
slouken@0
  2451
		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
slouken@0
  2452
		;;
slouken@0
  2453
	      esac
slouken@0
  2454
	    fi
slouken@0
  2455
	  else
slouken@0
  2456
	    eval flag=\"$hardcode_libdir_flag_spec\"
slouken@0
  2457
	    rpath="$rpath $flag"
slouken@0
  2458
	  fi
slouken@0
  2459
	elif test -n "$runpath_var"; then
slouken@0
  2460
	  case "$finalize_perm_rpath " in
slouken@0
  2461
	  *" $libdir "*) ;;
slouken@0
  2462
	  *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
slouken@0
  2463
	  esac
slouken@0
  2464
	fi
slouken@0
  2465
      done
slouken@0
  2466
      # Substitute the hardcoded libdirs into the rpath.
slouken@0
  2467
      if test -n "$hardcode_libdir_separator" &&
slouken@0
  2468
	 test -n "$hardcode_libdirs"; then
slouken@0
  2469
	libdir="$hardcode_libdirs"
slouken@0
  2470
	eval rpath=\" $hardcode_libdir_flag_spec\"
slouken@0
  2471
      fi
slouken@0
  2472
      finalize_rpath="$rpath"
slouken@0
  2473
slouken@0
  2474
      output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
slouken@0
  2475
      if test "X$output_objdir" = "X$output"; then
slouken@0
  2476
	output_objdir="$objdir"
slouken@0
  2477
      else
slouken@0
  2478
	output_objdir="$output_objdir/$objdir"
slouken@0
  2479
      fi
slouken@0
  2480
slouken@0
  2481
      # Create the binary in the object directory, then wrap it.
slouken@0
  2482
      if test ! -d $output_objdir; then
slouken@0
  2483
	$show "$mkdir $output_objdir"
slouken@0
  2484
	$run $mkdir $output_objdir
slouken@0
  2485
	status=$?
slouken@0
  2486
	if test $status -ne 0 && test ! -d $output_objdir; then
slouken@0
  2487
	  exit $status
slouken@0
  2488
	fi
slouken@0
  2489
      fi
slouken@0
  2490
slouken@0
  2491
      if test -n "$libobjs" && test "$build_old_libs" = yes; then
slouken@0
  2492
	# Transform all the library objects into standard objects.
slouken@0
  2493
	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
slouken@0
  2494
	finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
slouken@0
  2495
      fi
slouken@0
  2496
slouken@0
  2497
      dlsyms=
slouken@0
  2498
      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
slouken@0
  2499
	if test -n "$NM" && test -n "$global_symbol_pipe"; then
slouken@0
  2500
	  dlsyms="${outputname}S.c"
slouken@0
  2501
	else
slouken@0
  2502
	  $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
slouken@0
  2503
	fi
slouken@0
  2504
      fi
slouken@0
  2505
slouken@0
  2506
      if test -n "$dlsyms"; then
slouken@0
  2507
	case "$dlsyms" in
slouken@0
  2508
	"") ;;
slouken@0
  2509
	*.c)
slouken@0
  2510
	  # Discover the nlist of each of the dlfiles.
slouken@0
  2511
	  nlist="$output_objdir/${outputname}.nm"
slouken@0
  2512
slouken@0
  2513
	  $show "$rm $nlist ${nlist}S ${nlist}T"
slouken@0
  2514
	  $run $rm "$nlist" "${nlist}S" "${nlist}T"
slouken@0
  2515
slouken@0
  2516
	  # Parse the name list into a source file.
slouken@0
  2517
	  $show "creating $output_objdir/$dlsyms"
slouken@0
  2518
slouken@0
  2519
	  test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
slouken@0
  2520
/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
slouken@0
  2521
/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
slouken@0
  2522
slouken@0
  2523
#ifdef __cplusplus
slouken@0
  2524
extern \"C\" {
slouken@0
  2525
#endif
slouken@0
  2526
slouken@0
  2527
/* Prevent the only kind of declaration conflicts we can make. */
slouken@0
  2528
#define lt_preloaded_symbols some_other_symbol
slouken@0
  2529
slouken@0
  2530
/* External symbol declarations for the compiler. */\
slouken@0
  2531
"
slouken@0
  2532
slouken@0
  2533
	  if test "$dlself" = yes; then
slouken@0
  2534
	    $show "generating symbol list for \`$output'"
slouken@0
  2535
slouken@0
  2536
	    test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
slouken@0
  2537
slouken@0
  2538
	    # Add our own program objects to the symbol list.
slouken@0
  2539
	    progfiles=`$echo "X$objs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
slouken@0
  2540
	    for arg in $progfiles; do
slouken@0
  2541
	      $show "extracting global C symbols from \`$arg'"
slouken@0
  2542
	      $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
slouken@0
  2543
	    done
slouken@0
  2544
slouken@0
  2545
	    if test -n "$exclude_expsyms"; then
slouken@0
  2546
	      $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
slouken@0
  2547
	      $run eval '$mv "$nlist"T "$nlist"'
slouken@0
  2548
	    fi
slouken@0
  2549
	    
slouken@0
  2550
	    if test -n "$export_symbols_regex"; then
slouken@0
  2551
	      $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
slouken@0
  2552
	      $run eval '$mv "$nlist"T "$nlist"'
slouken@0
  2553
	    fi
slouken@0
  2554
slouken@0
  2555
	    # Prepare the list of exported symbols
slouken@0
  2556
	    if test -z "$export_symbols"; then
slouken@0
  2557
	      export_symbols="$output_objdir/$output.exp"
slouken@0
  2558
	      $run $rm $export_symbols
slouken@0
  2559
	      $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
slouken@0
  2560
	    else
slouken@0
  2561
	      $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
slouken@0
  2562
	      $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
slouken@0
  2563
	      $run eval 'mv "$nlist"T "$nlist"'
slouken@0
  2564
	    fi
slouken@0
  2565
	  fi
slouken@0
  2566
slouken@0
  2567
	  for arg in $dlprefiles; do
slouken@0
  2568
	    $show "extracting global C symbols from \`$arg'"
slouken@0
  2569
	    name=`echo "$arg" | sed -e 's%^.*/%%'`
slouken@0
  2570
	    $run eval 'echo ": $name " >> "$nlist"'
slouken@0
  2571
	    $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
slouken@0
  2572
	  done
slouken@0
  2573
slouken@0
  2574
	  if test -z "$run"; then
slouken@0
  2575
	    # Make sure we have at least an empty file.
slouken@0
  2576
	    test -f "$nlist" || : > "$nlist"
slouken@0
  2577
slouken@0
  2578
	    if test -n "$exclude_expsyms"; then
slouken@0
  2579
	      egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
slouken@0
  2580
	      $mv "$nlist"T "$nlist"
slouken@0
  2581
	    fi
slouken@0
  2582
slouken@0
  2583
	    # Try sorting and uniquifying the output.
slouken@0
  2584
	    if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
slouken@0
  2585
	      :
slouken@0
  2586
	    else
slouken@0
  2587
	      grep -v "^: " < "$nlist" > "$nlist"S
slouken@0
  2588
	    fi
slouken@0
  2589
slouken@0
  2590
	    if test -f "$nlist"S; then
slouken@0
  2591
	      eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
slouken@0
  2592
	    else
slouken@0
  2593
	      echo '/* NONE */' >> "$output_objdir/$dlsyms"
slouken@0
  2594
	    fi
slouken@0
  2595
slouken@0
  2596
	    $echo >> "$output_objdir/$dlsyms" "\
slouken@0
  2597
slouken@0
  2598
#undef lt_preloaded_symbols
slouken@0
  2599
slouken@0
  2600
#if defined (__STDC__) && __STDC__
slouken@0
  2601
# define lt_ptr_t void *
slouken@0
  2602
#else
slouken@0
  2603
# define lt_ptr_t char *
slouken@0
  2604
# define const
slouken@0
  2605
#endif
slouken@0
  2606
slouken@0
  2607
/* The mapping between symbol names and symbols. */
slouken@0
  2608
const struct {
slouken@0
  2609
  const char *name;
slouken@0
  2610
  lt_ptr_t address;
slouken@0
  2611
}
slouken@0
  2612
lt_preloaded_symbols[] =
slouken@0
  2613
{\
slouken@0
  2614
"
slouken@0
  2615
slouken@0
  2616
	    sed -n -e 's/^: \([^ ]*\) $/  {\"\1\", (lt_ptr_t) 0},/p' \
slouken@0
  2617
		-e 's/^. \([^ ]*\) \([^ ]*\)$/  {"\2", (lt_ptr_t) \&\2},/p' \
slouken@0
  2618
		  < "$nlist" >> "$output_objdir/$dlsyms"
slouken@0
  2619
slouken@0
  2620
	    $echo >> "$output_objdir/$dlsyms" "\
slouken@0
  2621
  {0, (lt_ptr_t) 0}
slouken@0
  2622
};
slouken@0
  2623
slouken@0
  2624
/* This works around a problem in FreeBSD linker */
slouken@0
  2625
#ifdef FREEBSD_WORKAROUND
slouken@0
  2626
static const void *lt_preloaded_setup() {
slouken@0
  2627
  return lt_preloaded_symbols;
slouken@0
  2628
}
slouken@0
  2629
#endif
slouken@0
  2630
slouken@0
  2631
#ifdef __cplusplus
slouken@0
  2632
}
slouken@0
  2633
#endif\
slouken@0
  2634
"
slouken@0
  2635
	  fi
slouken@0
  2636
slouken@0
  2637
	  pic_flag_for_symtable=
slouken@0
  2638
	  case "$host" in
slouken@0
  2639
	  # compiling the symbol table file with pic_flag works around
slouken@0
  2640
	  # a FreeBSD bug that causes programs to crash when -lm is
slouken@0
  2641
	  # linked before any other PIC object.  But we must not use
slouken@0
  2642
	  # pic_flag when linking with -static.  The problem exists in
slouken@0
  2643
	  # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
slouken@0
  2644
	  *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
slouken@0
  2645
	    case "$compile_command " in
slouken@0
  2646
	    *" -static "*) ;;
slouken@0
  2647
	    *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
slouken@0
  2648
	    esac;;
slouken@0
  2649
	  *-*-hpux*)
slouken@0
  2650
	    case "$compile_command " in
slouken@0
  2651
	    *" -static "*) ;;
slouken@0
  2652
	    *) pic_flag_for_symtable=" $pic_flag -DPIC";;
slouken@0
  2653
	    esac
slouken@0
  2654
	  esac
slouken@0
  2655
slouken@0
  2656
	  # Now compile the dynamic symbol file.
slouken@0
  2657
	  $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
slouken@0
  2658
	  $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
slouken@0
  2659
slouken@0
  2660
	  # Clean up the generated files.
slouken@0
  2661
	  $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
slouken@0
  2662
	  $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
slouken@0
  2663
slouken@0
  2664
	  # Transform the symbol file into the correct name.
slouken@0
  2665
	  compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
slouken@0
  2666
	  finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
slouken@0
  2667
	  ;;
slouken@0
  2668
	*)
slouken@0
  2669
	  $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
slouken@0
  2670
	  exit 1
slouken@0
  2671
	  ;;
slouken@0
  2672
	esac
slouken@0
  2673
      else
slouken@0
  2674
	# We keep going just in case the user didn't refer to
slouken@0
  2675
	# lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
slouken@0
  2676
	# really was required.
slouken@0
  2677
slouken@0
  2678
	# Nullify the symbol file.
slouken@0
  2679
	compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
slouken@0
  2680
	finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
slouken@0
  2681
      fi
slouken@0
  2682
slouken@0
  2683
      if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then
slouken@0
  2684
	# Replace the output file specification.
slouken@0
  2685
	compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
slouken@0
  2686
	link_command="$compile_command$compile_rpath"
slouken@0
  2687
slouken@0
  2688
	# We have no uninstalled library dependencies, so finalize right now.
slouken@0
  2689
	$show "$link_command"
slouken@0
  2690
	$run eval "$link_command"
slouken@0
  2691
	status=$?
slouken@0
  2692
	
slouken@0
  2693
	# Delete the generated files.
slouken@0
  2694
	if test -n "$dlsyms"; then
slouken@0
  2695
	  $show "$rm $output_objdir/${outputname}S.${objext}"
slouken@0
  2696
	  $run $rm "$output_objdir/${outputname}S.${objext}"
slouken@0
  2697
	fi
slouken@0
  2698
slouken@0
  2699
	exit $status
slouken@0
  2700
      fi
slouken@0
  2701
slouken@0
  2702
      if test -n "$shlibpath_var"; then
slouken@0
  2703
	# We should set the shlibpath_var
slouken@0
  2704
	rpath=
slouken@0
  2705
	for dir in $temp_rpath; do
slouken@0
  2706
	  case "$dir" in
slouken@0
  2707
	  [\\/]* | [A-Za-z]:[\\/]*)
slouken@0
  2708
	    # Absolute path.
slouken@0
  2709
	    rpath="$rpath$dir:"
slouken@0
  2710
	    ;;
slouken@0
  2711
	  *)
slouken@0
  2712
	    # Relative path: add a thisdir entry.
slouken@0
  2713
	    rpath="$rpath\$thisdir/$dir:"
slouken@0
  2714
	    ;;
slouken@0
  2715
	  esac
slouken@0
  2716
	done
slouken@0
  2717
	temp_rpath="$rpath"
slouken@0
  2718
      fi
slouken@0
  2719
slouken@0
  2720
      if test -n "$compile_shlibpath$finalize_shlibpath"; then
slouken@0
  2721
	compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
slouken@0
  2722
      fi
slouken@0
  2723
      if test -n "$finalize_shlibpath"; then
slouken@0
  2724
	finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
slouken@0
  2725
      fi
slouken@0
  2726
slouken@0
  2727
      compile_var=
slouken@0
  2728
      finalize_var=
slouken@0
  2729
      if test -n "$runpath_var"; then
slouken@0
  2730
	if test -n "$perm_rpath"; then
slouken@0
  2731
	  # We should set the runpath_var.
slouken@0
  2732
	  rpath=
slouken@0
  2733
	  for dir in $perm_rpath; do
slouken@0
  2734
	    rpath="$rpath$dir:"
slouken@0
  2735
	  done
slouken@0
  2736
	  compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
slouken@0
  2737
	fi
slouken@0
  2738
	if test -n "$finalize_perm_rpath"; then
slouken@0
  2739
	  # We should set the runpath_var.
slouken@0
  2740
	  rpath=
slouken@0
  2741
	  for dir in $finalize_perm_rpath; do
slouken@0
  2742
	    rpath="$rpath$dir:"
slouken@0
  2743
	  done
slouken@0
  2744
	  finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
slouken@0
  2745
	fi
slouken@0
  2746
      fi
slouken@0
  2747
slouken@0
  2748
      if test "$hardcode_action" = relink; then
slouken@0
  2749
	# Fast installation is not supported
slouken@0
  2750
	link_command="$compile_var$compile_command$compile_rpath"
slouken@0
  2751
	relink_command="$finalize_var$finalize_command$finalize_rpath"
slouken@0
  2752
	
slouken@0
  2753
	$echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
slouken@0
  2754
	$echo "$modename: \`$output' will be relinked during installation" 1>&2
slouken@0
  2755
      else
slouken@0
  2756
	if test "$fast_install" != no; then
slouken@0
  2757
	  link_command="$finalize_var$compile_command$finalize_rpath"
slouken@0
  2758
	  if test "$fast_install" = yes; then
slouken@0
  2759
	    relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
slouken@0
  2760
	  else
slouken@0
  2761
	    # fast_install is set to needless
slouken@0
  2762
	    relink_command=
slouken@0
  2763
	  fi
slouken@0
  2764
	else
slouken@0
  2765
	  link_command="$compile_var$compile_command$compile_rpath"
slouken@0
  2766
	  relink_command="$finalize_var$finalize_command$finalize_rpath"
slouken@0
  2767
	fi
slouken@0
  2768
      fi
slouken@0
  2769
slouken@0
  2770
      # Replace the output file specification.
slouken@0
  2771
      link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
slouken@0
  2772
      
slouken@0
  2773
      # Delete the old output files.
slouken@0
  2774
      $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
slouken@0
  2775
slouken@0
  2776
      $show "$link_command"
slouken@0
  2777
      $run eval "$link_command" || exit $?
slouken@0
  2778
slouken@0
  2779
      # Now create the wrapper script.
slouken@0
  2780
      $show "creating $output"
slouken@0
  2781
slouken@0
  2782
      # Quote the relink command for shipping.
slouken@0
  2783
      if test -n "$relink_command"; then
slouken@0
  2784
	relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
slouken@0
  2785
      fi
slouken@0
  2786
slouken@0
  2787
      # Quote $echo for shipping.
slouken@0
  2788
      if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
slouken@0
  2789
	case "$0" in
slouken@0
  2790
	[\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
slouken@0
  2791
	*) qecho="$SHELL `pwd`/$0 --fallback-echo";;
slouken@0
  2792
	esac
slouken@0
  2793
	qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
slouken@0
  2794
      else
slouken@0
  2795
	qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
slouken@0
  2796
      fi
slouken@0
  2797
slouken@0
  2798
      # Only actually do things if our run command is non-null.
slouken@0
  2799
      if test -z "$run"; then
slouken@0
  2800
	# win32 will think the script is a binary if it has
slouken@0
  2801
	# a .exe suffix, so we strip it off here.
slouken@0
  2802
	case $output in
slouken@0
  2803
	  *.exe) output=`echo $output|sed 's,.exe$,,'` ;;
slouken@0
  2804
	esac
slouken@0
  2805
	$rm $output
slouken@0
  2806
	trap "$rm $output; exit 1" 1 2 15
slouken@0
  2807
slouken@0
  2808
	$echo > $output "\
slouken@0
  2809
#! $SHELL
slouken@0
  2810
slouken@0
  2811
# $output - temporary wrapper script for $objdir/$outputname
slouken@0
  2812
# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
slouken@0
  2813
#
slouken@0
  2814
# The $output program cannot be directly executed until all the libtool
slouken@0
  2815
# libraries that it depends on are installed.
slouken@0
  2816
#
slouken@0
  2817
# This wrapper script should never be moved out of the build directory.
slouken@0
  2818
# If it is, it will not operate correctly.
slouken@0
  2819
slouken@0
  2820
# Sed substitution that helps us do robust quoting.  It backslashifies
slouken@0
  2821
# metacharacters that are still active within double-quoted strings.
slouken@0
  2822
Xsed='sed -e 1s/^X//'
slouken@0
  2823
sed_quote_subst='$sed_quote_subst'
slouken@0
  2824
slouken@0
  2825
# The HP-UX ksh and POSIX shell print the target directory to stdout
slouken@0
  2826
# if CDPATH is set.
slouken@0
  2827
if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
slouken@0
  2828
slouken@0
  2829
relink_command=\"$relink_command\"
slouken@0
  2830
slouken@0
  2831
# This environment variable determines our operation mode.
slouken@0
  2832
if test \"\$libtool_install_magic\" = \"$magic\"; then
slouken@0
  2833
  # install mode needs the following variable:
slouken@0
  2834
  link_against_libtool_libs='$link_against_libtool_libs'
slouken@0
  2835
else
slouken@0
  2836
  # When we are sourced in execute mode, \$file and \$echo are already set.
slouken@0
  2837
  if test \"\$libtool_execute_magic\" != \"$magic\"; then
slouken@0
  2838
    echo=\"$qecho\"
slouken@0
  2839
    file=\"\$0\"
slouken@0
  2840
    # Make sure echo works.
slouken@0
  2841
    if test \"X\$1\" = X--no-reexec; then
slouken@0
  2842
      # Discard the --no-reexec flag, and continue.
slouken@0
  2843
      shift
slouken@0
  2844
    elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
slouken@0
  2845
      # Yippee, \$echo works!
slouken@0
  2846
      :
slouken@0
  2847
    else
slouken@0
  2848
      # Restart under the correct shell, and then maybe \$echo will work.
slouken@0
  2849
      exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
slouken@0
  2850
    fi
slouken@0
  2851
  fi\
slouken@0
  2852
"
slouken@0
  2853
	$echo >> $output "\
slouken@0
  2854
slouken@0
  2855
  # Find the directory that this script lives in.
slouken@0
  2856
  thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
slouken@0
  2857
  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
slouken@0
  2858
slouken@0
  2859
  # Follow symbolic links until we get to the real thisdir.
slouken@0
  2860
  file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
slouken@0
  2861
  while test -n \"\$file\"; do
slouken@0
  2862
    destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
slouken@0
  2863
slouken@0
  2864
    # If there was a directory component, then change thisdir.
slouken@0
  2865
    if test \"x\$destdir\" != \"x\$file\"; then
slouken@0
  2866
      case \"\$destdir\" in
slouken@0
  2867
      [\\/]* | [A-Za-z]:[\\/]*) thisdir=\"\$destdir\" ;;
slouken@0
  2868
      *) thisdir=\"\$thisdir/\$destdir\" ;;
slouken@0
  2869
      esac
slouken@0
  2870
    fi
slouken@0
  2871
slouken@0
  2872
    file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
slouken@0
  2873
    file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
slouken@0
  2874
  done
slouken@0
  2875
slouken@0
  2876
  # Try to get the absolute directory name.
slouken@0
  2877
  absdir=\`cd \"\$thisdir\" && pwd\`
slouken@0
  2878
  test -n \"\$absdir\" && thisdir=\"\$absdir\"
slouken@0
  2879
"
slouken@0
  2880
slouken@0
  2881
	if test "$fast_install" = yes; then
slouken@0
  2882
	  echo >> $output "\
slouken@0
  2883
  program=lt-'$outputname'
slouken@0
  2884
  progdir=\"\$thisdir/$objdir\"
slouken@0
  2885
  
slouken@0
  2886
  if test ! -f \"\$progdir/\$program\" || \\
slouken@0
  2887
     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
slouken@0
  2888
       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
slouken@0
  2889
slouken@0
  2890
    file=\"\$\$-\$program\"
slouken@0
  2891
slouken@0
  2892
    if test ! -d \"\$progdir\"; then
slouken@0
  2893
      $mkdir \"\$progdir\"
slouken@0
  2894
    else
slouken@0
  2895
      $rm \"\$progdir/\$file\"
slouken@0
  2896
    fi"
slouken@0
  2897
slouken@0
  2898
	  echo >> $output "\
slouken@0
  2899
slouken@0
  2900
    # relink executable if necessary
slouken@0
  2901
    if test -n \"\$relink_command\"; then
slouken@0
  2902
      if (cd \"\$thisdir\" && eval \$relink_command); then :
slouken@0
  2903
      else
slouken@0
  2904
	$rm \"\$progdir/\$file\"
slouken@0
  2905
	exit 1
slouken@0
  2906
      fi
slouken@0
  2907
    fi
slouken@0
  2908
slouken@0
  2909
    $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
slouken@0
  2910
    { $rm \"\$progdir/\$program\";
slouken@0
  2911
      $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
slouken@0
  2912
    $rm \"\$progdir/\$file\"
slouken@0
  2913
  fi"
slouken@0
  2914
	else
slouken@0
  2915
	  echo >> $output "\
slouken@0
  2916
  program='$outputname'
slouken@0
  2917
  progdir=\"\$thisdir/$objdir\"
slouken@0
  2918
"
slouken@0
  2919
	fi
slouken@0
  2920
slouken@0
  2921
	echo >> $output "\
slouken@0
  2922
slouken@0
  2923
  if test -f \"\$progdir/\$program\"; then"
slouken@0
  2924
slouken@0
  2925
	# Export our shlibpath_var if we have one.
slouken@0
  2926
	if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
slouken@0
  2927
	  $echo >> $output "\
slouken@0
  2928
    # Add our own library path to $shlibpath_var
slouken@0
  2929
    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
slouken@0
  2930
slouken@0
  2931
    # Some systems cannot cope with colon-terminated $shlibpath_var
slouken@0
  2932
    # The second colon is a workaround for a bug in BeOS R4 sed
slouken@0
  2933
    $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
slouken@0
  2934
slouken@0
  2935
    export $shlibpath_var
slouken@0
  2936
"
slouken@0
  2937
	fi
slouken@0
  2938
slouken@0
  2939
	# fixup the dll searchpath if we need to.
slouken@0
  2940
	if test -n "$dllsearchpath"; then
slouken@0
  2941
	  $echo >> $output "\
slouken@0
  2942
    # Add the dll search path components to the executable PATH
slouken@0
  2943
    PATH=$dllsearchpath:\$PATH
slouken@0
  2944
"
slouken@0
  2945
	fi
slouken@0
  2946
slouken@0
  2947
	$echo >> $output "\
slouken@0
  2948
    if test \"\$libtool_execute_magic\" != \"$magic\"; then
slouken@0
  2949
      # Run the actual program with our arguments.
slouken@0
  2950
"
slouken@0
  2951
	case $host in
slouken@0
  2952
	  # win32 systems need to use the prog path for dll
slouken@0
  2953
	  # lookup to work
slouken@0
  2954
	*-*-cygwin*)
slouken@0
  2955
	  $echo >> $output "\
slouken@0
  2956
      exec \$progdir/\$program \${1+\"\$@\"}
slouken@0
  2957
"
slouken@0
  2958
	  ;;
slouken@0
  2959
slouken@0
  2960
	# Backslashes separate directories on plain windows
slouken@0
  2961
	*-*-mingw | *-*-os2*)
slouken@0
  2962
	  $echo >> $output "\
slouken@0
  2963
      exec \$progdir\\\\\$program \${1+\"\$@\"}
slouken@0
  2964
"
slouken@0
  2965
	  ;;
slouken@0
  2966
slouken@0
  2967
	*)
slouken@0
  2968
	  $echo >> $output "\
slouken@0
  2969
      # Export the path to the program.
slouken@0
  2970
      PATH=\"\$progdir:\$PATH\"
slouken@0
  2971
      export PATH
slouken@0
  2972
slouken@0
  2973
      exec \$program \${1+\"\$@\"}
slouken@0
  2974
"
slouken@0
  2975
	  ;;
slouken@0
  2976
	esac
slouken@0
  2977
	$echo >> $output "\
slouken@0
  2978
      \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
slouken@0
  2979
      exit 1
slouken@0
  2980
    fi
slouken@0
  2981
  else
slouken@0
  2982
    # The program doesn't exist.
slouken@0
  2983
    \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
slouken@0
  2984
    \$echo \"This script is just a wrapper for \$program.\" 1>&2
slouken@0
  2985
    echo \"See the $PACKAGE documentation for more information.\" 1>&2
slouken@0
  2986
    exit 1
slouken@0
  2987
  fi
slouken@0
  2988
fi\
slouken@0
  2989
"
slouken@0
  2990
	chmod +x $output
slouken@0
  2991
      fi
slouken@0
  2992
      exit 0
slouken@0
  2993
      ;;
slouken@0
  2994
    esac
slouken@0
  2995
slouken@0
  2996
    # See if we need to build an old-fashioned archive.
slouken@0
  2997
    for oldlib in $oldlibs; do
slouken@0
  2998
slouken@0
  2999
      if test "$build_libtool_libs" = convenience; then
slouken@0
  3000
	oldobjs="$libobjs_save"
slouken@0
  3001
	addlibs="$convenience"
slouken@0
  3002
	build_libtool_libs=no
slouken@0
  3003
      else
slouken@0
  3004
	if test "$build_libtool_libs" = module; then
slouken@0
  3005
	  oldobjs="$libobjs_save"
slouken@0
  3006
	  build_libtool_libs=no
slouken@0
  3007
	else
slouken@0
  3008
	  oldobjs="$objs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
slouken@0
  3009
	fi
slouken@0
  3010
	addlibs="$old_convenience"
slouken@0
  3011
      fi
slouken@0
  3012
slouken@0
  3013
      if test -n "$addlibs"; then
slouken@0
  3014
	gentop="$output_objdir/${outputname}x"
slouken@0
  3015
	$show "${rm}r $gentop"
slouken@0
  3016
	$run ${rm}r "$gentop"
slouken@0
  3017
	$show "mkdir $gentop"
slouken@0
  3018
	$run mkdir "$gentop"
slouken@0
  3019
	status=$?
slouken@0
  3020
	if test $status -ne 0 && test ! -d "$gentop"; then
slouken@0
  3021
	  exit $status
slouken@0
  3022
	fi
slouken@0
  3023
	generated="$generated $gentop"
slouken@0
  3024
	  
slouken@0
  3025
	# Add in members from convenience archives.
slouken@0
  3026
	for xlib in $addlibs; do
slouken@0
  3027
	  # Extract the objects.
slouken@0
  3028
	  case "$xlib" in
slouken@0
  3029
	  [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
slouken@0
  3030
	  *) xabs=`pwd`"/$xlib" ;;
slouken@0
  3031
	  esac
slouken@0
  3032
	  xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
slouken@0
  3033
	  xdir="$gentop/$xlib"
slouken@0
  3034
slouken@0
  3035
	  $show "${rm}r $xdir"
slouken@0
  3036
	  $run ${rm}r "$xdir"
slouken@0
  3037
	  $show "mkdir $xdir"
slouken@0
  3038
	  $run mkdir "$xdir"
slouken@0
  3039
	  status=$?
slouken@0
  3040
	  if test $status -ne 0 && test ! -d "$xdir"; then
slouken@0
  3041
	    exit $status
slouken@0
  3042
	  fi
slouken@0
  3043
	  $show "(cd $xdir && $AR x $xabs)"
slouken@0
  3044
	  $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
slouken@0
  3045
slouken@0
  3046
	  oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
slouken@0
  3047
	done
slouken@0
  3048
      fi
slouken@0
  3049
slouken@0
  3050
      # Do each command in the archive commands.
slouken@0
  3051
      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
slouken@0
  3052
	eval cmds=\"$old_archive_from_new_cmds\"
slouken@0
  3053
      else
slouken@0
  3054
	# Ensure that we have .o objects in place in case we decided
slouken@0
  3055
	# not to build a shared library, and have fallen back to building
slouken@0
  3056
	# static libs even though --disable-static was passed!
slouken@0
  3057
	for oldobj in $oldobjs; do