ltmain.sh
author Sam Lantinga <slouken@libsdl.org>
Sun, 09 Feb 2003 02:58:40 +0000
changeset 596 475f969e8c01
parent 581 844addcf125e
child 608 d0fecf67cd93
permissions -rw-r--r--
CVS should ignore files automatically generated by building on MacOS X
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@387
   954
	framework)
slouken@393
   955
	  linkopts="$linkopts -framework $arg"
slouken@581
   956
	  compile_command="$compile_command -framework $arg"
slouken@387
   957
	  prev=
slouken@387
   958
	  continue
slouken@387
   959
	  ;;
slouken@0
   960
	release)
slouken@0
   961
	  release="-$arg"
slouken@0
   962
	  prev=
slouken@0
   963
	  continue
slouken@0
   964
	  ;;
slouken@0
   965
	rpath | xrpath)
slouken@0
   966
	  # We need an absolute path.
slouken@0
   967
	  case "$arg" in
slouken@0
   968
	  [\\/]* | [A-Za-z]:[\\/]*) ;;
slouken@0
   969
	  *)
slouken@0
   970
	    $echo "$modename: only absolute run-paths are allowed" 1>&2
slouken@0
   971
	    exit 1
slouken@0
   972
	    ;;
slouken@0
   973
	  esac
slouken@0
   974
	  if test "$prev" = rpath; then
slouken@0
   975
	    case "$rpath " in
slouken@0
   976
	    *" $arg "*) ;;
slouken@0
   977
	    *) rpath="$rpath $arg" ;;
slouken@0
   978
	    esac
slouken@0
   979
	  else
slouken@0
   980
	    case "$xrpath " in
slouken@0
   981
	    *" $arg "*) ;;
slouken@0
   982
	    *) xrpath="$xrpath $arg" ;;
slouken@0
   983
	    esac
slouken@0
   984
	  fi
slouken@0
   985
	  prev=
slouken@0
   986
	  continue
slouken@0
   987
	  ;;
slouken@0
   988
	*)
slouken@0
   989
	  eval "$prev=\"\$arg\""
slouken@0
   990
	  prev=
slouken@0
   991
	  continue
slouken@0
   992
	  ;;
slouken@0
   993
	esac
slouken@0
   994
      fi
slouken@0
   995
slouken@0
   996
      prevarg="$arg"
slouken@0
   997
slouken@0
   998
      case "$arg" in
slouken@0
   999
      -all-static)
slouken@0
  1000
	if test -n "$link_static_flag"; then
slouken@0
  1001
	  compile_command="$compile_command $link_static_flag"
slouken@0
  1002
	  finalize_command="$finalize_command $link_static_flag"
slouken@0
  1003
	fi
slouken@0
  1004
	continue
slouken@0
  1005
	;;
slouken@0
  1006
slouken@0
  1007
      -allow-undefined)
slouken@0
  1008
	# FIXME: remove this flag sometime in the future.
slouken@0
  1009
	$echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
slouken@0
  1010
	continue
slouken@0
  1011
	;;
slouken@0
  1012
slouken@0
  1013
      -avoid-version)
slouken@0
  1014
	avoid_version=yes
slouken@0
  1015
	continue
slouken@0
  1016
	;;
slouken@0
  1017
slouken@0
  1018
      -dlopen)
slouken@0
  1019
	prev=dlfiles
slouken@0
  1020
	continue
slouken@0
  1021
	;;
slouken@0
  1022
slouken@0
  1023
      -dlpreopen)
slouken@0
  1024
	prev=dlprefiles
slouken@0
  1025
	continue
slouken@0
  1026
	;;
slouken@0
  1027
slouken@0
  1028
      -export-dynamic)
slouken@0
  1029
	export_dynamic=yes
slouken@0
  1030
	continue
slouken@0
  1031
	;;
slouken@0
  1032
slouken@0
  1033
      -export-symbols | -export-symbols-regex)
slouken@0
  1034
	if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
slouken@0
  1035
	  $echo "$modename: not more than one -exported-symbols argument allowed"
slouken@0
  1036
	  exit 1
slouken@0
  1037
	fi
slouken@0
  1038
	if test "X$arg" = "X-export-symbols"; then
slouken@0
  1039
	  prev=expsyms
slouken@0
  1040
	else
slouken@0
  1041
	  prev=expsyms_regex
slouken@0
  1042
	fi
slouken@0
  1043
	continue
slouken@0
  1044
	;;
slouken@0
  1045
slouken@387
  1046
      -framework)
slouken@387
  1047
	prev=framework
slouken@387
  1048
	continue
slouken@387
  1049
	;;
slouken@387
  1050
slouken@0
  1051
      -L*)
slouken@0
  1052
	dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
slouken@0
  1053
	# We need an absolute path.
slouken@0
  1054
	case "$dir" in
slouken@0
  1055
	[\\/]* | [A-Za-z]:[\\/]*) ;;
slouken@0
  1056
	*)
slouken@0
  1057
	  absdir=`cd "$dir" && pwd`
slouken@0
  1058
	  if test -z "$absdir"; then
slouken@0
  1059
	    $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
slouken@0
  1060
	    $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
slouken@0
  1061
	    absdir="$dir"
slouken@0
  1062
	  fi
slouken@0
  1063
	  dir="$absdir"
slouken@0
  1064
	  ;;
slouken@0
  1065
	esac
slouken@0
  1066
	case " $deplibs " in
slouken@0
  1067
	*" $arg "*) ;;
slouken@0
  1068
	*) deplibs="$deplibs $arg";;
slouken@0
  1069
	esac
slouken@0
  1070
	case " $lib_search_path " in
slouken@0
  1071
	*" $dir "*) ;;
slouken@0
  1072
	*) lib_search_path="$lib_search_path $dir";;
slouken@0
  1073
	esac
slouken@0
  1074
	case "$host" in
slouken@0
  1075
	*-*-cygwin* | *-*-mingw* | *-*-os2*)
slouken@0
  1076
	  dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
slouken@0
  1077
	  case ":$dllsearchpath:" in
slouken@0
  1078
	  ::) dllsearchpath="$dllsearchdir";;
slouken@0
  1079
	  *":$dllsearchdir:"*) ;;
slouken@0
  1080
	  *) dllsearchpath="$dllsearchpath:$dllsearchdir";;
slouken@0
  1081
	  esac
slouken@0
  1082
	  ;;
slouken@0
  1083
	esac
slouken@0
  1084
	;;
slouken@0
  1085
slouken@0
  1086
      -l*)
slouken@0
  1087
	if test "$arg" = "-lc"; then
slouken@0
  1088
	  case "$host" in
slouken@0
  1089
	  *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos* |*-*-freebsd* )
slouken@0
  1090
	    # These systems don't actually have c library (as such)
slouken@0
  1091
	    continue
slouken@0
  1092
	    ;;
slouken@1
  1093
          *-*-openbsd*)
slouken@1
  1094
            # Do not include libc due to us having libc/libc_r.
slouken@1
  1095
            continue
slouken@1
  1096
            ;;
slouken@0
  1097
	  esac
slouken@1
  1098
        elif test "$arg" = "-lc_r"; then
slouken@1
  1099
          case "$host" in
slouken@1
  1100
          *-*-openbsd*)
slouken@1
  1101
            # Do not include libc_r directly, use -pthread flag.
slouken@1
  1102
            continue
slouken@1
  1103
            ;;
slouken@1
  1104
          esac
slouken@0
  1105
	elif test "$arg" = "-lm"; then
slouken@0
  1106
	  case "$host" in
slouken@0
  1107
	  *-*-cygwin* | *-*-beos*)
slouken@0
  1108
	    # These systems don't actually have math library (as such)
slouken@0
  1109
	    continue
slouken@0
  1110
	    ;;
slouken@0
  1111
	  esac
slouken@0
  1112
	fi
slouken@0
  1113
	deplibs="$deplibs $arg"
slouken@0
  1114
	;;
slouken@0
  1115
slouken@1
  1116
      -?thread)
slouken@1
  1117
        deplibs="$deplibs $arg"
slouken@1
  1118
        ;;
slouken@1
  1119
slouken@0
  1120
      -module)
slouken@0
  1121
	module=yes
slouken@0
  1122
	continue
slouken@0
  1123
	;;
slouken@0
  1124
slouken@0
  1125
      -no-undefined)
slouken@0
  1126
	allow_undefined=no
slouken@0
  1127
	continue
slouken@0
  1128
	;;
slouken@0
  1129
slouken@0
  1130
      -o) prev=output ;;
slouken@0
  1131
slouken@0
  1132
      -release)
slouken@0
  1133
	prev=release
slouken@0
  1134
	continue
slouken@0
  1135
	;;
slouken@0
  1136
slouken@0
  1137
      -rpath)
slouken@0
  1138
	prev=rpath
slouken@0
  1139
	continue
slouken@0
  1140
	;;
slouken@0
  1141
slouken@0
  1142
      -R)
slouken@0
  1143
	prev=xrpath
slouken@0
  1144
	continue
slouken@0
  1145
	;;
slouken@0
  1146
slouken@0
  1147
      -R*)
slouken@0
  1148
	dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
slouken@0
  1149
	# We need an absolute path.
slouken@0
  1150
	case "$dir" in
slouken@0
  1151
	[\\/]* | [A-Za-z]:[\\/]*) ;;
slouken@0
  1152
	*)
slouken@0
  1153
	  $echo "$modename: only absolute run-paths are allowed" 1>&2
slouken@0
  1154
	  exit 1
slouken@0
  1155
	  ;;
slouken@0
  1156
	esac
slouken@0
  1157
	case "$xrpath " in
slouken@0
  1158
	*" $dir "*) ;;
slouken@0
  1159
	*) xrpath="$xrpath $dir" ;;
slouken@0
  1160
	esac
slouken@0
  1161
	continue
slouken@0
  1162
	;;
slouken@0
  1163
slouken@0
  1164
      -static)
slouken@0
  1165
	# If we have no pic_flag, then this is the same as -all-static.
slouken@0
  1166
	if test -z "$pic_flag" && test -n "$link_static_flag"; then
slouken@0
  1167
	  compile_command="$compile_command $link_static_flag"
slouken@0
  1168
	  finalize_command="$finalize_command $link_static_flag"
slouken@0
  1169
	fi
slouken@0
  1170
	continue
slouken@0
  1171
	;;
slouken@0
  1172
slouken@0
  1173
      -thread-safe)
slouken@0
  1174
	thread_safe=yes
slouken@0
  1175
	continue
slouken@0
  1176
	;;
slouken@0
  1177
slouken@0
  1178
      -version-info)
slouken@0
  1179
	prev=vinfo
slouken@0
  1180
	continue
slouken@0
  1181
	;;
slouken@0
  1182
slouken@0
  1183
      # Some other compiler flag.
slouken@0
  1184
      -* | +*)
slouken@0
  1185
	# Unknown arguments in both finalize_command and compile_command need
slouken@0
  1186
	# to be aesthetically quoted because they are evaled later.
slouken@0
  1187
	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
slouken@0
  1188
	case "$arg" in
slouken@0
  1189
	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
slouken@0
  1190
	  arg="\"$arg\""
slouken@0
  1191
	  ;;
slouken@0
  1192
	esac
slouken@0
  1193
	;;
slouken@0
  1194
slouken@0
  1195
      *.o | *.obj | *.a | *.lib)
slouken@0
  1196
	# A standard object.
slouken@0
  1197
	objs="$objs $arg"
slouken@0
  1198
	;;
slouken@0
  1199
slouken@0
  1200
      *.lo)
slouken@0
  1201
	# A library object.
slouken@0
  1202
	if test "$prev" = dlfiles; then
slouken@0
  1203
	  dlfiles="$dlfiles $arg"
slouken@0
  1204
	  if test "$build_libtool_libs" = yes && test "$dlopen" = yes; then
slouken@0
  1205
	    prev=
slouken@0
  1206
	    continue
slouken@0
  1207
	  else
slouken@0
  1208
	    # If libtool objects are unsupported, then we need to preload.
slouken@0
  1209
	    prev=dlprefiles
slouken@0
  1210
	  fi
slouken@0
  1211
	fi
slouken@0
  1212
slouken@0
  1213
	if test "$prev" = dlprefiles; then
slouken@0
  1214
	  # Preload the old-style object.
slouken@0
  1215
	  dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
slouken@0
  1216
	  prev=
slouken@0
  1217
	fi
slouken@0
  1218
	libobjs="$libobjs $arg"
slouken@0
  1219
	;;
slouken@0
  1220
slouken@0
  1221
      *.la)
slouken@0
  1222
	# A libtool-controlled library.
slouken@0
  1223
slouken@0
  1224
	dlname=
slouken@0
  1225
	libdir=
slouken@0
  1226
	library_names=
slouken@0
  1227
	old_library=
slouken@0
  1228
slouken@0
  1229
	# Check to see that this really is a libtool archive.
slouken@0
  1230
	if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
slouken@0
  1231
	else
slouken@0
  1232
	  $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2
slouken@0
  1233
	  exit 1
slouken@0
  1234
	fi
slouken@0
  1235
slouken@0
  1236
	# If the library was installed with an old release of libtool,
slouken@0
  1237
	# it will not redefine variable installed.
slouken@0
  1238
	installed=yes
slouken@0
  1239
slouken@0
  1240
	# Read the .la file
slouken@0
  1241
	# If there is no directory component, then add one.
slouken@0
  1242
	case "$arg" in
slouken@0
  1243
	*/* | *\\*) . $arg ;;
slouken@0
  1244
	*) . ./$arg ;;
slouken@0
  1245
	esac
slouken@0
  1246
slouken@0
  1247
	# Get the name of the library we link against.
slouken@0
  1248
	linklib=
slouken@0
  1249
	for l in $old_library $library_names; do
slouken@0
  1250
	  linklib="$l"
slouken@0
  1251
	done
slouken@0
  1252
slouken@0
  1253
	if test -z "$linklib"; then
slouken@0
  1254
	  $echo "$modename: cannot find name of link library for \`$arg'" 1>&2
slouken@0
  1255
	  exit 1
slouken@0
  1256
	fi
slouken@0
  1257
slouken@0
  1258
	# Find the relevant object directory and library name.
slouken@0
  1259
	name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'`
slouken@0
  1260
slouken@0
  1261
	if test "X$installed" = Xyes; then
slouken@0
  1262
	  dir="$libdir"
slouken@0
  1263
	else
slouken@0
  1264
	  dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
slouken@0
  1265
	  if test "X$dir" = "X$arg"; then
slouken@0
  1266
	    dir="$objdir"
slouken@0
  1267
	  else
slouken@0
  1268
	    dir="$dir/$objdir"
slouken@0
  1269
	  fi
slouken@0
  1270
	fi
slouken@0
  1271
slouken@0
  1272
	if test -n "$dependency_libs"; then
slouken@0
  1273
	  # Extract -R and -L from dependency_libs
slouken@0
  1274
	  temp_deplibs=
slouken@0
  1275
	  for deplib in $dependency_libs; do
slouken@0
  1276
	    case "$deplib" in
slouken@0
  1277
	    -R*) temp_xrpath=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
slouken@0
  1278
		 case " $rpath $xrpath " in
slouken@0
  1279
		 *" $temp_xrpath "*) ;;
slouken@0
  1280
		 *) xrpath="$xrpath $temp_xrpath";;
slouken@0
  1281
		 esac;;
slouken@0
  1282
	    -L*) case "$compile_command $temp_deplibs " in
slouken@0
  1283
		 *" $deplib "*) ;;
slouken@0
  1284
		 *) temp_deplibs="$temp_deplibs $deplib";;
slouken@0
  1285
		 esac
slouken@0
  1286
		 temp_dir=`$echo "X$deplib" | $Xsed -e 's/^-L//'`
slouken@0
  1287
		 case " $lib_search_path " in
slouken@0
  1288
		 *" $temp_dir "*) ;;
slouken@0
  1289
		 *) lib_search_path="$lib_search_path $temp_dir";;
slouken@0
  1290
		 esac
slouken@0
  1291
		 ;;
slouken@0
  1292
	    *) temp_deplibs="$temp_deplibs $deplib";;
slouken@0
  1293
	    esac
slouken@0
  1294
	  done
slouken@0
  1295
	  dependency_libs="$temp_deplibs"
slouken@0
  1296
	fi
slouken@0
  1297
slouken@0
  1298
	if test -z "$libdir"; then
slouken@0
  1299
	  # It is a libtool convenience library, so add in its objects.
slouken@0
  1300
	  convenience="$convenience $dir/$old_library"
slouken@0
  1301
	  old_convenience="$old_convenience $dir/$old_library"
slouken@0
  1302
	  deplibs="$deplibs$dependency_libs"
slouken@0
  1303
	  compile_command="$compile_command $dir/$old_library$dependency_libs"
slouken@0
  1304
	  finalize_command="$finalize_command $dir/$old_library$dependency_libs"
slouken@0
  1305
	  continue
slouken@0
  1306
	fi
slouken@0
  1307
slouken@0
  1308
	# This library was specified with -dlopen.
slouken@0
  1309
	if test "$prev" = dlfiles; then
slouken@0
  1310
	  dlfiles="$dlfiles $arg"
slouken@0
  1311
	  if test -z "$dlname" || test "$dlopen" != yes || test "$build_libtool_libs" = no; then
slouken@0
  1312
	    # If there is no dlname, no dlopen support or we're linking statically,
slouken@0
  1313
	    # we need to preload.
slouken@0
  1314
	    prev=dlprefiles
slouken@0
  1315
	  else
slouken@0
  1316
	    # We should not create a dependency on this library, but we
slouken@0
  1317
	    # may need any libraries it requires.
slouken@0
  1318
	    compile_command="$compile_command$dependency_libs"
slouken@0
  1319
	    finalize_command="$finalize_command$dependency_libs"
slouken@0
  1320
	    prev=
slouken@0
  1321
	    continue
slouken@0
  1322
	  fi
slouken@0
  1323
	fi
slouken@0
  1324
slouken@0
  1325
	# The library was specified with -dlpreopen.
slouken@0
  1326
	if test "$prev" = dlprefiles; then
slouken@0
  1327
	  # Prefer using a static library (so that no silly _DYNAMIC symbols
slouken@0
  1328
	  # are required to link).
slouken@0
  1329
	  if test -n "$old_library"; then
slouken@0
  1330
	    dlprefiles="$dlprefiles $dir/$old_library"
slouken@0
  1331
	  else
slouken@0
  1332
	    dlprefiles="$dlprefiles $dir/$linklib"
slouken@0
  1333
	  fi
slouken@0
  1334
	  prev=
slouken@0
  1335
	fi
slouken@0
  1336
slouken@0
  1337
	if test -n "$library_names" &&
slouken@0
  1338
	   { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
slouken@0
  1339
	  link_against_libtool_libs="$link_against_libtool_libs $arg"
slouken@0
  1340
	  if test -n "$shlibpath_var"; then
slouken@0
  1341
	    # Make sure the rpath contains only unique directories.
slouken@0
  1342
	    case "$temp_rpath " in
slouken@0
  1343
	    *" $dir "*) ;;
slouken@0
  1344
	    *) temp_rpath="$temp_rpath $dir" ;;
slouken@0
  1345
	    esac
slouken@0
  1346
	  fi
slouken@0
  1347
slouken@0
  1348
	  # We need an absolute path.
slouken@0
  1349
	  case "$dir" in
slouken@0
  1350
	  [\\/] | [A-Za-z]:[\\/]*) absdir="$dir" ;;
slouken@0
  1351
	  *)
slouken@0
  1352
	    absdir=`cd "$dir" && pwd`
slouken@0
  1353
	    if test -z "$absdir"; then
slouken@0
  1354
	      $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
slouken@0
  1355
	      $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
slouken@0
  1356
	      absdir="$dir"
slouken@0
  1357
	    fi
slouken@0
  1358
	    ;;
slouken@0
  1359
	  esac
slouken@0
  1360
	  
slouken@0
  1361
	  # This is the magic to use -rpath.
slouken@0
  1362
	  # Skip directories that are in the system default run-time
slouken@0
  1363
	  # search path, unless they have been requested with -R.
slouken@0
  1364
	  case " $sys_lib_dlsearch_path " in
slouken@0
  1365
	  *" $absdir "*) ;;
slouken@0
  1366
	  *)
slouken@0
  1367
	    case "$compile_rpath " in
slouken@0
  1368
	    *" $absdir "*) ;;
slouken@0
  1369
	    *) compile_rpath="$compile_rpath $absdir" 
slouken@0
  1370
	    esac
slouken@0
  1371
	    ;;
slouken@0
  1372
	  esac
slouken@0
  1373
slouken@0
  1374
	  case " $sys_lib_dlsearch_path " in
slouken@0
  1375
	  *" $libdir "*) ;;
slouken@0
  1376
	  *)
slouken@0
  1377
	    case "$finalize_rpath " in
slouken@0
  1378
	    *" $libdir "*) ;;
slouken@0
  1379
	    *) finalize_rpath="$finalize_rpath $libdir"
slouken@0
  1380
	    esac
slouken@0
  1381
	    ;;
slouken@0
  1382
	  esac
slouken@0
  1383
slouken@0
  1384
	  lib_linked=yes
slouken@0
  1385
	  case "$hardcode_action" in
slouken@0
  1386
	  immediate | unsupported)
slouken@0
  1387
	    if test "$hardcode_direct" = no; then
slouken@0
  1388
	      compile_command="$compile_command $dir/$linklib"
slouken@0
  1389
	      deplibs="$deplibs $dir/$linklib"
slouken@0
  1390
	      case "$host" in
slouken@0
  1391
	      *-*-cygwin* | *-*-mingw* | *-*-os2*)
slouken@0
  1392
		dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
slouken@0
  1393
		if test -n "$dllsearchpath"; then
slouken@0
  1394
		  dllsearchpath="$dllsearchpath:$dllsearchdir"
slouken@0
  1395
		else
slouken@0
  1396
		  dllsearchpath="$dllsearchdir"
slouken@0
  1397
		fi
slouken@0
  1398
		;;
slouken@0
  1399
	      esac
slouken@0
  1400
	    elif test "$hardcode_minus_L" = no; then
slouken@0
  1401
	      case "$host" in
slouken@0
  1402
	      *-*-sunos*)
slouken@0
  1403
		compile_shlibpath="$compile_shlibpath$dir:"
slouken@0
  1404
		;;
slouken@0
  1405
	      esac
slouken@0
  1406
	      case "$compile_command " in
slouken@0
  1407
	      *" -L$dir "*) ;;
slouken@0
  1408
	      *) compile_command="$compile_command -L$dir";;
slouken@0
  1409
	      esac
slouken@0
  1410
	      compile_command="$compile_command -l$name"
slouken@0
  1411
	      deplibs="$deplibs -L$dir -l$name"
slouken@0
  1412
	    elif test "$hardcode_shlibpath_var" = no; then
slouken@0
  1413
	      case ":$compile_shlibpath:" in
slouken@0
  1414
	      *":$dir:"*) ;;
slouken@0
  1415
	      *) compile_shlibpath="$compile_shlibpath$dir:";;
slouken@0
  1416
	      esac
slouken@0
  1417
	      compile_command="$compile_command -l$name"
slouken@0
  1418
	      deplibs="$deplibs -l$name"
slouken@0
  1419
	    else
slouken@0
  1420
	      lib_linked=no
slouken@0
  1421
	    fi
slouken@0
  1422
	    ;;
slouken@0
  1423
slouken@0
  1424
	  relink)
slouken@0
  1425
	    if test "$hardcode_direct" = yes; then
slouken@0
  1426
	      compile_command="$compile_command $absdir/$linklib"
slouken@0
  1427
	      deplibs="$deplibs $absdir/$linklib"
slouken@0
  1428
	    elif test "$hardcode_minus_L" = yes; then
slouken@0
  1429
	      case "$compile_command " in
slouken@0
  1430
	      *" -L$absdir "*) ;;
slouken@0
  1431
	      *) compile_command="$compile_command -L$absdir";;
slouken@0
  1432
	      esac
slouken@0
  1433
	      compile_command="$compile_command -l$name"
slouken@0
  1434
	      deplibs="$deplibs -L$absdir -l$name"
slouken@0
  1435
	    elif test "$hardcode_shlibpath_var" = yes; then
slouken@0
  1436
	      case ":$compile_shlibpath:" in
slouken@0
  1437
	      *":$absdir:"*) ;;
slouken@0
  1438
	      *) compile_shlibpath="$compile_shlibpath$absdir:";;
slouken@0
  1439
	      esac
slouken@0
  1440
	      compile_command="$compile_command -l$name"
slouken@0
  1441
	      deplibs="$deplibs -l$name"
slouken@0
  1442
	    else
slouken@0
  1443
	      lib_linked=no
slouken@0
  1444
	    fi
slouken@0
  1445
	    ;;
slouken@0
  1446
slouken@0
  1447
	  *)
slouken@0
  1448
	    lib_linked=no
slouken@0
  1449
	    ;;
slouken@0
  1450
	  esac
slouken@0
  1451
slouken@0
  1452
	  if test "$lib_linked" != yes; then
slouken@0
  1453
	    $echo "$modename: configuration error: unsupported hardcode properties"
slouken@0
  1454
	    exit 1
slouken@0
  1455
	  fi
slouken@0
  1456
slouken@0
  1457
	  # Finalize command for both is simple: just hardcode it.
slouken@0
  1458
	  if test "$hardcode_direct" = yes; then
slouken@0
  1459
	    finalize_command="$finalize_command $libdir/$linklib"
slouken@0
  1460
	  elif test "$hardcode_minus_L" = yes; then
slouken@0
  1461
	    case "$finalize_command " in
slouken@0
  1462
	    *" -L$libdir "*) ;;
slouken@0
  1463
	    *) finalize_command="$finalize_command -L$libdir";;
slouken@0
  1464
	    esac
slouken@0
  1465
	    finalize_command="$finalize_command -l$name"
slouken@0
  1466
	  elif test "$hardcode_shlibpath_var" = yes; then
slouken@0
  1467
	    case ":$finalize_shlibpath:" in
slouken@0
  1468
	    *":$libdir:"*) ;;
slouken@0
  1469
	    *) finalize_shlibpath="$finalize_shlibpath$libdir:";;
slouken@0
  1470
	    esac
slouken@0
  1471
	    finalize_command="$finalize_command -l$name"
slouken@0
  1472
	  else
slouken@0
  1473
	    # We cannot seem to hardcode it, guess we'll fake it.
slouken@0
  1474
	    case "$finalize_command " in
slouken@0
  1475
	    *" -L$dir "*) ;;
slouken@0
  1476
	    *) finalize_command="$finalize_command -L$libdir";;
slouken@0
  1477
	    esac
slouken@0
  1478
	    finalize_command="$finalize_command -l$name"
slouken@0
  1479
	  fi
slouken@0
  1480
	else
slouken@0
  1481
	  # Transform directly to old archives if we don't build new libraries.
slouken@0
  1482
	  if test -n "$pic_flag" && test -z "$old_library"; then
slouken@0
  1483
	    $echo "$modename: cannot find static library for \`$arg'" 1>&2
slouken@0
  1484
	    exit 1
slouken@0
  1485
	  fi
slouken@0
  1486
slouken@0
  1487
	  # Here we assume that one of hardcode_direct or hardcode_minus_L
slouken@0
  1488
	  # is not unsupported.  This is valid on all known static and
slouken@0
  1489
	  # shared platforms.
slouken@0
  1490
	  if test "$hardcode_direct" != unsupported; then
slouken@0
  1491
	    test -n "$old_library" && linklib="$old_library"
slouken@0
  1492
	    compile_command="$compile_command $dir/$linklib"
slouken@0
  1493
	    finalize_command="$finalize_command $dir/$linklib"
slouken@0
  1494
	  else
slouken@0
  1495
	    case "$compile_command " in
slouken@0
  1496
	    *" -L$dir "*) ;;
slouken@0
  1497
	    *) compile_command="$compile_command -L$dir";;
slouken@0
  1498
	    esac
slouken@0
  1499
	    compile_command="$compile_command -l$name"
slouken@0
  1500
	    case "$finalize_command " in
slouken@0
  1501
	    *" -L$dir "*) ;;
slouken@0
  1502
	    *) finalize_command="$finalize_command -L$dir";;
slouken@0
  1503
	    esac
slouken@0
  1504
	    finalize_command="$finalize_command -l$name"
slouken@0
  1505
	  fi
slouken@0
  1506
	fi
slouken@0
  1507
slouken@0
  1508
	# Add in any libraries that this one depends upon.
slouken@0
  1509
	compile_command="$compile_command$dependency_libs"
slouken@0
  1510
	finalize_command="$finalize_command$dependency_libs"
slouken@0
  1511
	continue
slouken@0
  1512
	;;
slouken@0
  1513
slouken@0
  1514
      # Some other compiler argument.
slouken@0
  1515
      *)
slouken@0
  1516
	# Unknown arguments in both finalize_command and compile_command need
slouken@0
  1517
	# to be aesthetically quoted because they are evaled later.
slouken@0
  1518
	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
slouken@0
  1519
	case "$arg" in
slouken@0
  1520
	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
slouken@0
  1521
	  arg="\"$arg\""
slouken@0
  1522
	  ;;
slouken@0
  1523
	esac
slouken@0
  1524
	;;
slouken@0
  1525
      esac
slouken@0
  1526
slouken@0
  1527
      # Now actually substitute the argument into the commands.
slouken@0
  1528
      if test -n "$arg"; then
slouken@0
  1529
	compile_command="$compile_command $arg"
slouken@0
  1530
	finalize_command="$finalize_command $arg"
slouken@0
  1531
      fi
slouken@0
  1532
    done
slouken@0
  1533
slouken@0
  1534
    if test -n "$prev"; then
slouken@0
  1535
      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
slouken@0
  1536
      $echo "$help" 1>&2
slouken@0
  1537
      exit 1
slouken@0
  1538
    fi
slouken@0
  1539
slouken@0
  1540
    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
slouken@0
  1541
      eval arg=\"$export_dynamic_flag_spec\"
slouken@0
  1542
      compile_command="$compile_command $arg"
slouken@0
  1543
      finalize_command="$finalize_command $arg"
slouken@0
  1544
    fi
slouken@0
  1545
slouken@0
  1546
    oldlibs=
slouken@0
  1547
    # calculate the name of the file, without its directory
slouken@0
  1548
    outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
slouken@0
  1549
    libobjs_save="$libobjs"
slouken@0
  1550
slouken@0
  1551
    case "$output" in
slouken@0
  1552
    "")
slouken@0
  1553
      $echo "$modename: you must specify an output file" 1>&2
slouken@0
  1554
      $echo "$help" 1>&2
slouken@0
  1555
      exit 1
slouken@0
  1556
      ;;
slouken@0
  1557
slouken@0
  1558
    *.a | *.lib)
slouken@0
  1559
      if test -n "$link_against_libtool_libs"; then
slouken@0
  1560
	$echo "$modename: error: cannot link libtool libraries into archives" 1>&2
slouken@0
  1561
	exit 1
slouken@0
  1562
      fi
slouken@0
  1563
slouken@0
  1564
      if test -n "$deplibs"; then
slouken@0
  1565
	$echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
slouken@0
  1566
      fi
slouken@0
  1567
slouken@0
  1568
      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
slouken@0
  1569
	$echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
slouken@0
  1570
      fi
slouken@0
  1571
slouken@0
  1572
      if test -n "$rpath"; then
slouken@0
  1573
	$echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
slouken@0
  1574
      fi
slouken@0
  1575
slouken@0
  1576
      if test -n "$xrpath"; then
slouken@0
  1577
	$echo "$modename: warning: \`-R' is ignored for archives" 1>&2
slouken@0
  1578
      fi
slouken@0
  1579
slouken@0
  1580
      if test -n "$vinfo"; then
slouken@0
  1581
	$echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
slouken@0
  1582
      fi
slouken@0
  1583
slouken@0
  1584
      if test -n "$release"; then
slouken@0
  1585
	$echo "$modename: warning: \`-release' is ignored for archives" 1>&2
slouken@0
  1586
      fi
slouken@0
  1587
slouken@0
  1588
      if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
slouken@0
  1589
	$echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
slouken@0
  1590
      fi
slouken@0
  1591
slouken@0
  1592
      # Now set the variables for building old libraries.
slouken@0
  1593
      build_libtool_libs=no
slouken@0
  1594
      oldlibs="$output"
slouken@0
  1595
      ;;
slouken@0
  1596
slouken@0
  1597
    *.la)
slouken@0
  1598
      # Make sure we only generate libraries of the form `libNAME.la'.
slouken@0
  1599
      case "$outputname" in
slouken@0
  1600
      lib*)
slouken@0
  1601
	name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
slouken@0
  1602
	eval libname=\"$libname_spec\"
slouken@0
  1603
	;;
slouken@0
  1604
      *)
slouken@0
  1605
	if test "$module" = no; then
slouken@0
  1606
	  $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
slouken@0
  1607
	  $echo "$help" 1>&2
slouken@0
  1608
	  exit 1
slouken@0
  1609
	fi
slouken@0
  1610
	if test "$need_lib_prefix" != no; then
slouken@0
  1611
	  # Add the "lib" prefix for modules if required
slouken@0
  1612
	  name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
slouken@0
  1613
	  eval libname=\"$libname_spec\"
slouken@0
  1614
	else
slouken@0
  1615
	  libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
slouken@0
  1616
	fi
slouken@0
  1617
	;;
slouken@0
  1618
      esac
slouken@0
  1619
slouken@0
  1620
      output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
slouken@0
  1621
      if test "X$output_objdir" = "X$output"; then
slouken@0
  1622
	output_objdir="$objdir"
slouken@0
  1623
      else
slouken@0
  1624
	output_objdir="$output_objdir/$objdir"
slouken@0
  1625
      fi
slouken@0
  1626
slouken@0
  1627
      if test -n "$objs"; then
slouken@0
  1628
	$echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1
slouken@0
  1629
	exit 1
slouken@0
  1630
      fi
slouken@0
  1631
slouken@0
  1632
      # How the heck are we supposed to write a wrapper for a shared library?
slouken@0
  1633
      if test -n "$link_against_libtool_libs"; then
slouken@0
  1634
	 $echo "$modename: error: cannot link shared libraries into libtool libraries" 1>&2
slouken@0
  1635
	 exit 1
slouken@0
  1636
      fi
slouken@0
  1637
slouken@0
  1638
      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
slouken@0
  1639
	$echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2
slouken@0
  1640
      fi
slouken@0
  1641
slouken@0
  1642
      set dummy $rpath
slouken@0
  1643
      if test $# -gt 2; then
slouken@0
  1644
	$echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
slouken@0
  1645
      fi
slouken@0
  1646
      install_libdir="$2"
slouken@0
  1647
slouken@0
  1648
      oldlibs=
slouken@0
  1649
      if test -z "$rpath"; then
slouken@0
  1650
	if test "$build_libtool_libs" = yes; then
slouken@0
  1651
	  # Building a libtool convenience library.
slouken@0
  1652
	  libext=al
slouken@0
  1653
	  oldlibs="$output_objdir/$libname.$libext $oldlibs"
slouken@0
  1654
	  build_libtool_libs=convenience
slouken@0
  1655
	  build_old_libs=yes
slouken@0
  1656
	fi
slouken@0
  1657
	dependency_libs="$deplibs"
slouken@0
  1658
slouken@0
  1659
	if test -n "$vinfo"; then
slouken@0
  1660
	  $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
slouken@0
  1661
	fi
slouken@0
  1662
slouken@0
  1663
	if test -n "$release"; then
slouken@0
  1664
	  $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
slouken@0
  1665
	fi
slouken@0
  1666
      else
slouken@0
  1667
slouken@0
  1668
	# Parse the version information argument.
slouken@0
  1669
	IFS="${IFS= 	}"; save_ifs="$IFS"; IFS=':'
slouken@0
  1670
	set dummy $vinfo 0 0 0
slouken@0
  1671
	IFS="$save_ifs"
slouken@0
  1672
slouken@0
  1673
	if test -n "$8"; then
slouken@0
  1674
	  $echo "$modename: too many parameters to \`-version-info'" 1>&2
slouken@0
  1675
	  $echo "$help" 1>&2
slouken@0
  1676
	  exit 1
slouken@0
  1677
	fi
slouken@0
  1678
slouken@0
  1679
	current="$2"
slouken@0
  1680
	revision="$3"
slouken@0
  1681
	age="$4"
slouken@0
  1682
slouken@0
  1683
	# Check that each of the things are valid numbers.
slouken@0
  1684
	case "$current" in
slouken@0
  1685
	0 | [1-9] | [1-9][0-9]*) ;;
slouken@0
  1686
	*)
slouken@0
  1687
	  $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
slouken@0
  1688
	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
slouken@0
  1689
	  exit 1
slouken@0
  1690
	  ;;
slouken@0
  1691
	esac
slouken@0
  1692
slouken@0
  1693
	case "$revision" in
slouken@0
  1694
	0 | [1-9] | [1-9][0-9]*) ;;
slouken@0
  1695
	*)
slouken@0
  1696
	  $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
slouken@0
  1697
	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
slouken@0
  1698
	  exit 1
slouken@0
  1699
	  ;;
slouken@0
  1700
	esac
slouken@0
  1701
slouken@0
  1702
	case "$age" in
slouken@0
  1703
	0 | [1-9] | [1-9][0-9]*) ;;
slouken@0
  1704
	*)
slouken@0
  1705
	  $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
slouken@0
  1706
	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
slouken@0
  1707
	  exit 1
slouken@0
  1708
	  ;;
slouken@0
  1709
	esac
slouken@0
  1710
slouken@0
  1711
	if test $age -gt $current; then
slouken@0
  1712
	  $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
slouken@0
  1713
	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
slouken@0
  1714
	  exit 1
slouken@0
  1715
	fi
slouken@0
  1716
slouken@0
  1717
	# Calculate the version variables.
slouken@0
  1718
	major=
slouken@0
  1719
	versuffix=
slouken@0
  1720
	verstring=
slouken@0
  1721
	case "$version_type" in
slouken@0
  1722
	none) ;;
slouken@0
  1723
slouken@0
  1724
	irix)
slouken@0
  1725
	  major=`expr $current - $age + 1`
slouken@0
  1726
	  versuffix="$major.$revision"
slouken@0
  1727
	  verstring="sgi$major.$revision"
slouken@0
  1728
slouken@0
  1729
	  # Add in all the interfaces that we are compatible with.
slouken@0
  1730
	  loop=$revision
slouken@0
  1731
	  while test $loop != 0; do
slouken@0
  1732
	    iface=`expr $revision - $loop`
slouken@0
  1733
	    loop=`expr $loop - 1`
slouken@0
  1734
	    verstring="sgi$major.$iface:$verstring"
slouken@0
  1735
	  done
slouken@0
  1736
	  ;;
slouken@0
  1737
slouken@0
  1738
	linux)
slouken@0
  1739
	  major=.`expr $current - $age`
slouken@0
  1740
	  versuffix="$major.$age.$revision"
slouken@0
  1741
	  ;;
slouken@0
  1742
slouken@0
  1743
	osf)
slouken@0
  1744
	  major=`expr $current - $age`
slouken@0
  1745
	  versuffix=".$current.$age.$revision"
slouken@0
  1746
	  verstring="$current.$age.$revision"
slouken@0
  1747
slouken@0
  1748
	  # Add in all the interfaces that we are compatible with.
slouken@0
  1749
	  loop=$age
slouken@0
  1750
	  while test $loop != 0; do
slouken@0
  1751
	    iface=`expr $current - $loop`
slouken@0
  1752
	    loop=`expr $loop - 1`
slouken@0
  1753
	    verstring="$verstring:${iface}.0"
slouken@0
  1754
	  done
slouken@0
  1755
slouken@0
  1756
	  # Make executables depend on our current version.
slouken@0
  1757
	  verstring="$verstring:${current}.0"
slouken@0
  1758
	  ;;
slouken@0
  1759
slouken@0
  1760
	sunos)
slouken@0
  1761
	  major=".$current"
slouken@0
  1762
	  versuffix=".$current.$revision"
slouken@0
  1763
	  ;;
slouken@0
  1764
slouken@0
  1765
	freebsd-aout)
slouken@0
  1766
	  major=".$current"
slouken@0
  1767
	  versuffix=".$current.$revision";
slouken@0
  1768
	  ;;
slouken@0
  1769
slouken@0
  1770
	freebsd-elf)
slouken@0
  1771
	  major=".$current"
slouken@0
  1772
	  versuffix=".$current";
slouken@0
  1773
	  ;;
slouken@0
  1774
slouken@0
  1775
	windows)
slouken@0
  1776
	  # Like Linux, but with '-' rather than '.', since we only
slouken@0
  1777
	  # want one extension on Windows 95.
slouken@0
  1778
	  major=`expr $current - $age`
slouken@0
  1779
	  versuffix="-$major-$age-$revision"
slouken@0
  1780
	  ;;
slouken@0
  1781
slouken@387
  1782
	darwin)
slouken@387
  1783
	  # Like Linux, but with the current version available in
slouken@387
  1784
	  # verstring for coding it into the library header
slouken@387
  1785
	  major=.`expr $current - $age`
slouken@387
  1786
	  versuffix="$major.$age.$revision"
slouken@387
  1787
	  # Darwin ld doesn't like 0 for these options...
slouken@387
  1788
	  minor_current=`expr $current + 1`
slouken@387
  1789
	  verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
slouken@387
  1790
	  ;;
slouken@387
  1791
slouken@0
  1792
	*)
slouken@0
  1793
	  $echo "$modename: unknown library version type \`$version_type'" 1>&2
slouken@0
  1794
	  echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
slouken@0
  1795
	  exit 1
slouken@0
  1796
	  ;;
slouken@0
  1797
	esac
slouken@0
  1798
slouken@0
  1799
	# Clear the version info if we defaulted, and they specified a release.
slouken@0
  1800
	if test -z "$vinfo" && test -n "$release"; then
slouken@0
  1801
	  major=
slouken@387
  1802
	  case "$version_type" in
slouken@387
  1803
	  darwin)
slouken@387
  1804
	    # we can't check for "0.0" in archive_cmds due to quoting
slouken@387
  1805
	    # problems, so we reset it completely
slouken@387
  1806
	    verstring=""
slouken@387
  1807
	    ;;
slouken@387
  1808
	  *)
slouken@0
  1809
	  verstring="0.0"
slouken@387
  1810
	    ;;
slouken@387
  1811
	  esac
slouken@0
  1812
	  if test "$need_version" = no; then
slouken@0
  1813
	    versuffix=
slouken@0
  1814
	  else
slouken@0
  1815
	    versuffix=".0.0"
slouken@0
  1816
	  fi
slouken@0
  1817
	fi
slouken@0
  1818
slouken@0
  1819
	# Remove version info from name if versioning should be avoided
slouken@0
  1820
	if test "$avoid_version" = yes && test "$need_version" = no; then
slouken@0
  1821
	  major=
slouken@0
  1822
	  versuffix=
slouken@0
  1823
	  verstring=""
slouken@0
  1824
	fi
slouken@0
  1825
	
slouken@0
  1826
	# Check to see if the archive will have undefined symbols.
slouken@0
  1827
	if test "$allow_undefined" = yes; then
slouken@0
  1828
	  if test "$allow_undefined_flag" = unsupported; then
slouken@0
  1829
	    $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
slouken@0
  1830
	    build_libtool_libs=no
slouken@0
  1831
	    build_old_libs=yes
slouken@0
  1832
	  fi
slouken@0
  1833
	else
slouken@0
  1834
	  # Don't allow undefined symbols.
slouken@0
  1835
	  allow_undefined_flag="$no_undefined_flag"
slouken@0
  1836
	fi
slouken@0
  1837
slouken@0
  1838
	dependency_libs="$deplibs"
slouken@0
  1839
	case "$host" in
slouken@0
  1840
	*-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos* | *-*-freebsd* )
slouken@0
  1841
	  # these systems don't actually have a c library (as such)!
slouken@0
  1842
	  ;;
slouken@0
  1843
        *-*-rhapsody*)
slouken@0
  1844
	  # rhapsody is a little odd...
slouken@0
  1845
	  deplibs="$deplibs -framework System"
slouken@0
  1846
	  ;;
slouken@1
  1847
	*-*-openbsd*)
slouken@1
  1848
	  # do not include libc due to us having libc/libc_r.
slouken@1
  1849
	  ;;
slouken@0
  1850
	*)
slouken@0
  1851
	  # Add libc to deplibs on all other systems.
slouken@0
  1852
	  deplibs="$deplibs -lc"
slouken@0
  1853
	  ;;
slouken@0
  1854
	esac
slouken@0
  1855
      fi
slouken@0
  1856
slouken@0
  1857
      # Create the output directory, or remove our outputs if we need to.
slouken@0
  1858
      if test -d $output_objdir; then
slouken@0
  1859
	$show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
slouken@0
  1860
	$run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
slouken@0
  1861
      else
slouken@0
  1862
	$show "$mkdir $output_objdir"
slouken@0
  1863
	$run $mkdir $output_objdir
slouken@0
  1864
	status=$?
slouken@0
  1865
	if test $status -ne 0 && test ! -d $output_objdir; then
slouken@0
  1866
	  exit $status
slouken@0
  1867
	fi
slouken@0
  1868
      fi
slouken@0
  1869
slouken@0
  1870
      # Now set the variables for building old libraries.
slouken@0
  1871
      if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
slouken@0
  1872
	oldlibs="$oldlibs $output_objdir/$libname.$libext"
slouken@0
  1873
slouken@0
  1874
	# Transform .lo files to .o files.
slouken@0
  1875
	oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
slouken@0
  1876
      fi
slouken@0
  1877
slouken@0
  1878
      if test "$build_libtool_libs" = yes; then
slouken@0
  1879
	# Transform deplibs into only deplibs that can be linked in shared.
slouken@0
  1880
	name_save=$name
slouken@0
  1881
	libname_save=$libname
slouken@0
  1882
	release_save=$release
slouken@0
  1883
	versuffix_save=$versuffix
slouken@0
  1884
	major_save=$major
slouken@0
  1885
	# I'm not sure if I'm treating the release correctly.  I think
slouken@0
  1886
	# release should show up in the -l (ie -lgmp5) so we don't want to
slouken@0
  1887
	# add it in twice.  Is that correct?
slouken@0
  1888
	release=""
slouken@0
  1889
	versuffix=""
slouken@0
  1890
	major=""
slouken@0
  1891
	newdeplibs=
slouken@0
  1892
	droppeddeps=no
slouken@0
  1893
	case "$deplibs_check_method" in
slouken@0
  1894
	pass_all)
slouken@0
  1895
	  # Don't check for shared/static.  Everything works.
slouken@0
  1896
	  # This might be a little naive.  We might want to check
slouken@0
  1897
	  # whether the library exists or not.  But this is on
slouken@0
  1898
	  # osf3 & osf4 and I'm not really sure... Just
slouken@0
  1899
	  # implementing what was already the behaviour.
slouken@0
  1900
	  newdeplibs=$deplibs
slouken@0
  1901
	  ;;
slouken@0
  1902
	test_compile)
slouken@0
  1903
	  # This code stresses the "libraries are programs" paradigm to its
slouken@0
  1904
	  # limits. Maybe even breaks it.  We compile a program, linking it
slouken@0
  1905
	  # against the deplibs as a proxy for the library.  Then we can check
slouken@0
  1906
	  # whether they linked in statically or dynamically with ldd.
slouken@0
  1907
	  $rm conftest.c
slouken@0
  1908
	  cat > conftest.c <<EOF
slouken@0
  1909
	  int main() { return 0; }
slouken@0
  1910
EOF
slouken@0
  1911
	  $rm conftest
slouken@0
  1912
	  $CC -o conftest conftest.c $deplibs
slouken@0
  1913
	  if test $? -eq 0 ; then
slouken@0
  1914
	    ldd_output=`ldd conftest`
slouken@0
  1915
	    for i in $deplibs; do
slouken@0
  1916
	      name="`expr $i : '-l\(.*\)'`"
slouken@0
  1917
	      # If $name is empty we are operating on a -L argument.
slouken@0
  1918
	      if test "$name" != "" ; then
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
		newdeplibs="$newdeplibs $i"
slouken@0
  1935
	      fi
slouken@0
  1936
	    done
slouken@0
  1937
	  else
slouken@0
  1938
	    # Error occured in the first compile.  Let's try to salvage the situation:
slouken@0
  1939
	    # Compile a seperate program for each library.
slouken@0
  1940
	    for i in $deplibs; do
slouken@0
  1941
	      name="`expr $i : '-l\(.*\)'`"
slouken@0
  1942
	     # If $name is empty we are operating on a -L argument.
slouken@0
  1943
	      if test "$name" != "" ; then
slouken@0
  1944
		$rm conftest
slouken@0
  1945
		$CC -o conftest conftest.c $i
slouken@0
  1946
		# Did it work?
slouken@0
  1947
		if test $? -eq 0 ; then
slouken@0
  1948
		  ldd_output=`ldd conftest`
slouken@0
  1949
		  libname=`eval \\$echo \"$libname_spec\"`
slouken@0
  1950
		  deplib_matches=`eval \\$echo \"$library_names_spec\"`
slouken@0
  1951
		  set dummy $deplib_matches
slouken@0
  1952
		  deplib_match=$2
slouken@0
  1953
		  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
slouken@0
  1954
		    newdeplibs="$newdeplibs $i"
slouken@0
  1955
		  else
slouken@0
  1956
		    droppeddeps=yes
slouken@0
  1957
		    echo
slouken@0
  1958
		    echo "*** Warning: This library needs some functionality provided by $i."
slouken@0
  1959
		    echo "*** I have the capability to make that library automatically link in when"
slouken@0
  1960
		    echo "*** you link to this library.  But I can only do this if you have a"
slouken@0
  1961
		    echo "*** shared version of the library, which you do not appear to have."
slouken@0
  1962
		  fi
slouken@0
  1963
		else
slouken@0
  1964
		  droppeddeps=yes
slouken@0
  1965
		  echo
slouken@0
  1966
		  echo "*** Warning!  Library $i is needed by this library but I was not able to"
slouken@0
  1967
		  echo "***  make it link in!  You will probably need to install it or some"
slouken@0
  1968
		  echo "*** library that it depends on before this library will be fully"
slouken@0
  1969
		  echo "*** functional.  Installing it before continuing would be even better."
slouken@0
  1970
		fi
slouken@0
  1971
	      else
slouken@0
  1972
		newdeplibs="$newdeplibs $i"
slouken@0
  1973
	      fi
slouken@0
  1974
	    done
slouken@0
  1975
	  fi
slouken@0
  1976
	  ;;
slouken@0
  1977
	file_magic*)
slouken@0
  1978
	  set dummy $deplibs_check_method
slouken@0
  1979
	  file_magic_regex="`expr \"$deplibs_check_method\" : \"$2 \(.*\)\"`"
slouken@0
  1980
	  for a_deplib in $deplibs; do
slouken@0
  1981
	    name="`expr $a_deplib : '-l\(.*\)'`"
slouken@0
  1982
	    # If $name is empty we are operating on a -L argument.
slouken@0
  1983
	    if test "$name" != "" ; then
slouken@0
  1984
	      libname=`eval \\$echo \"$libname_spec\"`
slouken@0
  1985
	      for i in $lib_search_path; do
slouken@0
  1986
		    potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
slouken@0
  1987
		    for potent_lib in $potential_libs; do
slouken@0
  1988
		      # Follow soft links.
slouken@0
  1989
		      if ls -lLd "$potent_lib" 2>/dev/null \
slouken@0
  1990
			 | grep " -> " >/dev/null; then
slouken@0
  1991
			continue 
slouken@0
  1992
		      fi
slouken@0
  1993
		      # The statement above tries to avoid entering an
slouken@0
  1994
		      # endless loop below, in case of cyclic links.
slouken@0
  1995
		      # We might still enter an endless loop, since a link
slouken@0
  1996
		      # loop can be closed while we follow links,
slouken@0
  1997
		      # but so what?
slouken@0
  1998
		      potlib="$potent_lib"
slouken@0
  1999
		      while test -h "$potlib" 2>/dev/null; do
slouken@0
  2000
			potliblink=`ls -ld $potlib | sed 's/.* -> //'`
slouken@0
  2001
			case "$potliblink" in
slouken@0
  2002
			[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
slouken@0
  2003
			*) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
slouken@0
  2004
			esac
slouken@0
  2005
		      done
slouken@0
  2006
		      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
slouken@0
  2007
			 | sed 10q \
slouken@0
  2008
			 | egrep "$file_magic_regex" > /dev/null; then
slouken@0
  2009
			newdeplibs="$newdeplibs $a_deplib"
slouken@0
  2010
			a_deplib=""
slouken@0
  2011
			break 2
slouken@0
  2012
		      fi
slouken@0
  2013
		    done
slouken@0
  2014
	      done
slouken@0
  2015
	      if test -n "$a_deplib" ; then
slouken@0
  2016
		droppeddeps=yes
slouken@0
  2017
		echo
slouken@0
  2018
		echo "*** Warning: This library needs some functionality provided by $a_deplib."
slouken@0
  2019
		echo "*** I have the capability to make that library automatically link in when"
slouken@0
  2020
		echo "*** you link to this library.  But I can only do this if you have a"
slouken@0
  2021
		echo "*** shared version of the library, which you do not appear to have."
slouken@0
  2022
	      fi
slouken@0
  2023
	    else
slouken@0
  2024
	      # Add a -L argument.
slouken@0
  2025
	      newdeplibs="$newdeplibs $a_deplib"
slouken@0
  2026
	    fi
slouken@0
  2027
	  done # Gone through all deplibs.
slouken@0
  2028
	  ;;
slouken@0
  2029
	none | unknown | *)
slouken@0
  2030
	  newdeplibs=""
slouken@0
  2031
	  if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
slouken@0
  2032
	       -e 's/ -[LR][^ ]*//g' -e 's/[ 	]//g' |
slouken@0
  2033
	     grep . >/dev/null; then
slouken@0
  2034
	    echo
slouken@0
  2035
	    if test "X$deplibs_check_method" = "Xnone"; then
slouken@0
  2036
	      echo "*** Warning: inter-library dependencies are not supported in this platform."
slouken@0
  2037
	    else
slouken@0
  2038
	      echo "*** Warning: inter-library dependencies are not known to be supported."
slouken@0
  2039
	    fi
slouken@0
  2040
	    echo "*** All declared inter-library dependencies are being dropped."
slouken@0
  2041
	    droppeddeps=yes
slouken@0
  2042
	  fi
slouken@0
  2043
	  ;;
slouken@0
  2044
	esac
slouken@0
  2045
	versuffix=$versuffix_save
slouken@0
  2046
	major=$major_save
slouken@0
  2047
	release=$release_save
slouken@0
  2048
	libname=$libname_save
slouken@0
  2049
	name=$name_save
slouken@0
  2050
slouken@0
  2051
	if test "$droppeddeps" = yes; then
slouken@0
  2052
	  if test "$module" = yes; then
slouken@0
  2053
	    echo
slouken@0
  2054
	    echo "*** Warning: libtool could not satisfy all declared inter-library"
slouken@0
  2055
	    echo "*** dependencies of module $libname.  Therefore, libtool will create"
slouken@0
  2056
	    echo "*** a static module, that should work as long as the dlopening"
slouken@0
  2057
	    echo "*** application is linked with the -dlopen flag."
slouken@0
  2058
	    if test -z "$global_symbol_pipe"; then
slouken@0
  2059
	      echo
slouken@0
  2060
	      echo "*** However, this would only work if libtool was able to extract symbol"
slouken@0
  2061
	      echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
slouken@0
  2062
	      echo "*** not find such a program.  So, this module is probably useless."
slouken@0
  2063
	      echo "*** \`nm' from GNU binutils and a full rebuild may help."
slouken@0
  2064
	    fi
slouken@0
  2065
	    if test "$build_old_libs" = no; then
slouken@0
  2066
	      oldlibs="$output_objdir/$libname.$libext"
slouken@0
  2067
	      build_libtool_libs=module
slouken@0
  2068
	      build_old_libs=yes
slouken@0
  2069
	    else
slouken@0
  2070
	      build_libtool_libs=no
slouken@0
  2071
	    fi
slouken@0
  2072
	  else
slouken@0
  2073
	    echo "*** The inter-library dependencies that have been dropped here will be"
slouken@0
  2074
	    echo "*** automatically added whenever a program is linked with this library"
slouken@0
  2075
	    echo "*** or is declared to -dlopen it."
slouken@0
  2076
	  fi
slouken@0
  2077
	fi
slouken@0
  2078
	# Done checking deplibs!
slouken@0
  2079
	deplibs=$newdeplibs
slouken@0
  2080
      fi
slouken@0
  2081
slouken@0
  2082
      # All the library-specific variables (install_libdir is set above).
slouken@0
  2083
      library_names=
slouken@0
  2084
      old_library=
slouken@0
  2085
      dlname=
slouken@0
  2086
      
slouken@0
  2087
      # Test again, we may have decided not to build it any more
slouken@0
  2088
      if test "$build_libtool_libs" = yes; then
slouken@0
  2089
	# Get the real and link names of the library.
slouken@0
  2090
	eval library_names=\"$library_names_spec\"
slouken@0
  2091
	set dummy $library_names
slouken@0
  2092
	realname="$2"
slouken@0
  2093
	shift; shift
slouken@0
  2094
slouken@0
  2095
	if test -n "$soname_spec"; then
slouken@0
  2096
	  eval soname=\"$soname_spec\"
slouken@0
  2097
	else
slouken@0
  2098
	  soname="$realname"
slouken@0
  2099
	fi
slouken@0
  2100
slouken@0
  2101
	lib="$output_objdir/$realname"
slouken@0
  2102
	for link
slouken@0
  2103
	do
slouken@0
  2104
	  linknames="$linknames $link"
slouken@0
  2105
	done
slouken@0
  2106
slouken@0
  2107
	# Ensure that we have .o objects for linkers which dislike .lo
slouken@0
  2108
	# (e.g. aix) in case we are running --disable-static
slouken@0
  2109
	for obj in $libobjs; do
slouken@0
  2110
	  xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
slouken@0
  2111
	  if test "X$xdir" = "X$obj"; then
slouken@0
  2112
	    xdir="."
slouken@0
  2113
	  else
slouken@0
  2114
	    xdir="$xdir"
slouken@0
  2115
	  fi
slouken@0
  2116
	  baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
slouken@0
  2117
	  oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
slouken@0
  2118
	  if test ! -f $xdir/$oldobj; then
slouken@0
  2119
	    $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
slouken@0
  2120
	    $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
slouken@0
  2121
	  fi
slouken@0
  2122
	done
slouken@0
  2123
slouken@0
  2124
	# Use standard objects if they are pic
slouken@0
  2125
	test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
slouken@0
  2126
slouken@0
  2127
	# Prepare the list of exported symbols
slouken@0
  2128
	if test -z "$export_symbols"; then
slouken@0
  2129
	  if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
slouken@0
  2130
	    $show "generating symbol list for \`$libname.la'"
slouken@0
  2131
	    export_symbols="$output_objdir/$libname.exp"
slouken@0
  2132
	    $run $rm $export_symbols
slouken@0
  2133
	    eval cmds=\"$export_symbols_cmds\"
slouken@0
  2134
	    IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
slouken@0
  2135
	    for cmd in $cmds; do
slouken@0
  2136
	      IFS="$save_ifs"
slouken@0
  2137
	      $show "$cmd"
slouken@0
  2138
	      $run eval "$cmd" || exit $?
slouken@0
  2139
	    done
slouken@0
  2140
	    IFS="$save_ifs"
slouken@0
  2141
	    if test -n "$export_symbols_regex"; then
slouken@0
  2142
	      $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
slouken@0
  2143
	      $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
slouken@0
  2144
	      $show "$mv \"${export_symbols}T\" \"$export_symbols\""
slouken@0
  2145
	      $run eval '$mv "${export_symbols}T" "$export_symbols"'
slouken@0
  2146
	    fi
slouken@0
  2147
	  fi
slouken@0
  2148
	fi
slouken@0
  2149
slouken@0
  2150
	if test -n "$export_symbols" && test -n "$include_expsyms"; then
slouken@0
  2151
	  $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
slouken@0
  2152
	fi
slouken@0
  2153
slouken@0
  2154
	if test -n "$convenience"; then
slouken@0
  2155
	  if test -n "$whole_archive_flag_spec"; then
slouken@0
  2156
	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
slouken@0
  2157
	  else
slouken@0
  2158
	    gentop="$output_objdir/${outputname}x"
slouken@0
  2159
	    $show "${rm}r $gentop"
slouken@0
  2160
	    $run ${rm}r "$gentop"
slouken@0
  2161
	    $show "mkdir $gentop"
slouken@0
  2162
	    $run mkdir "$gentop"
slouken@0
  2163
	    status=$?
slouken@0
  2164
	    if test $status -ne 0 && test ! -d "$gentop"; then
slouken@0
  2165
	      exit $status
slouken@0
  2166
	    fi
slouken@0
  2167
	    generated="$generated $gentop"
slouken@0
  2168
slouken@0
  2169
	    for xlib in $convenience; do
slouken@0
  2170
	      # Extract the objects.
slouken@0
  2171
	      case "$xlib" in
slouken@0
  2172
	      [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
slouken@0
  2173
	      *) xabs=`pwd`"/$xlib" ;;
slouken@0
  2174
	      esac
slouken@0
  2175
	      xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
slouken@0
  2176
	      xdir="$gentop/$xlib"
slouken@0
  2177
slouken@0
  2178
	      $show "${rm}r $xdir"
slouken@0
  2179
	      $run ${rm}r "$xdir"
slouken@0
  2180
	      $show "mkdir $xdir"
slouken@0
  2181
	      $run mkdir "$xdir"
slouken@0
  2182
	      status=$?
slouken@0
  2183
	      if test $status -ne 0 && test ! -d "$xdir"; then
slouken@0
  2184
		exit $status
slouken@0
  2185
	      fi
slouken@0
  2186
	      $show "(cd $xdir && $AR x $xabs)"
slouken@0
  2187
	      $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
slouken@0
  2188
slouken@0
  2189
	      libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
slouken@0
  2190
	    done
slouken@0
  2191
	  fi
slouken@0
  2192
	fi
slouken@0
  2193
slouken@0
  2194
	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
slouken@0
  2195
	  eval flag=\"$thread_safe_flag_spec\"
slouken@0
  2196
	  linkopts="$linkopts $flag"
slouken@0
  2197
	fi
slouken@0
  2198
slouken@0
  2199
	# Do each of the archive commands.
slouken@0
  2200
	if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
slouken@0
  2201
	  eval cmds=\"$archive_expsym_cmds\"
slouken@0
  2202
	else
slouken@0
  2203
	  eval cmds=\"$archive_cmds\"
slouken@0
  2204
	fi
slouken@0
  2205
	IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
slouken@0
  2206
	for cmd in $cmds; do
slouken@0
  2207
	  IFS="$save_ifs"
slouken@0
  2208
	  $show "$cmd"
slouken@0
  2209
	  $run eval "$cmd" || exit $?
slouken@0
  2210
	done
slouken@0
  2211
	IFS="$save_ifs"
slouken@0
  2212
slouken@0
  2213
	# Create links to the real library.
slouken@0
  2214
	for linkname in $linknames; do
slouken@0
  2215
	  if test "$realname" != "$linkname"; then
slouken@0
  2216
	    $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
slouken@0
  2217
	    $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
slouken@0
  2218
	  fi
slouken@0
  2219
	done
slouken@0
  2220
slouken@0
  2221
	# If -module or -export-dynamic was specified, set the dlname.
slouken@0
  2222
	if test "$module" = yes || test "$export_dynamic" = yes; then
slouken@0
  2223
	  # On all known operating systems, these are identical.
slouken@0
  2224
	  dlname="$soname"
slouken@0
  2225
	fi
slouken@0
  2226
      fi
slouken@0
  2227
      ;;
slouken@0
  2228
slouken@0
  2229
    *.lo | *.o | *.obj)
slouken@0
  2230
      if test -n "$link_against_libtool_libs"; then
slouken@0
  2231
	$echo "$modename: error: cannot link libtool libraries into objects" 1>&2
slouken@0
  2232
	exit 1
slouken@0
  2233
      fi
slouken@0
  2234
slouken@0
  2235
      if test -n "$deplibs"; then
slouken@0
  2236
	$echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
slouken@0
  2237
      fi
slouken@0
  2238
slouken@0
  2239
      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
slouken@0
  2240
	$echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
slouken@0
  2241
      fi
slouken@0
  2242
slouken@0
  2243
      if test -n "$rpath"; then
slouken@0
  2244
	$echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
slouken@0
  2245
      fi
slouken@0
  2246
slouken@0
  2247
      if test -n "$xrpath"; then
slouken@0
  2248
	$echo "$modename: warning: \`-R' is ignored for objects" 1>&2
slouken@0
  2249
      fi
slouken@0
  2250
slouken@0
  2251
      if test -n "$vinfo"; then
slouken@0
  2252
	$echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
slouken@0
  2253
      fi
slouken@0
  2254
slouken@0
  2255
      if test -n "$release"; then
slouken@0
  2256
	$echo "$modename: warning: \`-release' is ignored for objects" 1>&2
slouken@0
  2257
      fi
slouken@0
  2258
slouken@0
  2259
      case "$output" in
slouken@0
  2260
      *.lo)
slouken@0
  2261
	if test -n "$objs"; then
slouken@0
  2262
	  $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
slouken@0
  2263
	  exit 1
slouken@0
  2264
	fi
slouken@0
  2265
	libobj="$output"
slouken@0
  2266
	obj=`$echo "X$output" | $Xsed -e "$lo2o"`
slouken@0
  2267
	;;
slouken@0
  2268
      *)
slouken@0
  2269
	libobj=
slouken@0
  2270
	obj="$output"
slouken@0
  2271
	;;
slouken@0
  2272
      esac
slouken@0
  2273
slouken@0
  2274
      # Delete the old objects.
slouken@0
  2275
      $run $rm $obj $libobj
slouken@0
  2276
slouken@0
  2277
      # Objects from convenience libraries.  This assumes
slouken@0
  2278
      # single-version convenience libraries.  Whenever we create
slouken@0
  2279
      # different ones for PIC/non-PIC, this we'll have to duplicate
slouken@0
  2280
      # the extraction.
slouken@0
  2281
      reload_conv_objs=
slouken@0
  2282
      gentop=
slouken@0
  2283
      # reload_cmds runs $LD directly, so let us get rid of
slouken@0
  2284
      # -Wl from whole_archive_flag_spec
slouken@0
  2285
      wl= 
slouken@0
  2286
slouken@0
  2287
      if test -n "$convenience"; then
slouken@0
  2288
	if test -n "$whole_archive_flag_spec"; then
slouken@0
  2289
	  eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
slouken@0
  2290
	else
slouken@0
  2291
	  gentop="$output_objdir/${obj}x"
slouken@0
  2292
	  $show "${rm}r $gentop"
slouken@0
  2293
	  $run ${rm}r "$gentop"
slouken@0
  2294
	  $show "mkdir $gentop"
slouken@0
  2295
	  $run mkdir "$gentop"
slouken@0
  2296
	  status=$?
slouken@0
  2297
	  if test $status -ne 0 && test ! -d "$gentop"; then
slouken@0
  2298
	    exit $status
slouken@0
  2299
	  fi
slouken@0
  2300
	  generated="$generated $gentop"
slouken@0
  2301
slouken@0
  2302
	  for xlib in $convenience; do
slouken@0
  2303
	    # Extract the objects.
slouken@0
  2304
	    case "$xlib" in
slouken@0
  2305
	    [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
slouken@0
  2306
	    *) xabs=`pwd`"/$xlib" ;;
slouken@0
  2307
	    esac
slouken@0
  2308
	    xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
slouken@0
  2309
	    xdir="$gentop/$xlib"
slouken@0
  2310
slouken@0
  2311
	    $show "${rm}r $xdir"
slouken@0
  2312
	    $run ${rm}r "$xdir"
slouken@0
  2313
	    $show "mkdir $xdir"
slouken@0
  2314
	    $run mkdir "$xdir"
slouken@0
  2315
	    status=$?
slouken@0
  2316
	    if test $status -ne 0 && test ! -d "$xdir"; then
slouken@0
  2317
	      exit $status
slouken@0
  2318
	    fi
slouken@0
  2319
	    $show "(cd $xdir && $AR x $xabs)"
slouken@0
  2320
	    $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
slouken@0
  2321
slouken@0
  2322
	    reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
slouken@0
  2323
	  done
slouken@0
  2324
	fi
slouken@0
  2325
      fi
slouken@0
  2326
slouken@0
  2327
      # Create the old-style object.
slouken@0
  2328
      reload_objs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs"
slouken@0
  2329
slouken@0
  2330
      output="$obj"
slouken@0
  2331
      eval cmds=\"$reload_cmds\"
slouken@0
  2332
      IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
slouken@0
  2333
      for cmd in $cmds; do
slouken@0
  2334
	IFS="$save_ifs"
slouken@0
  2335
	$show "$cmd"
slouken@0
  2336
	$run eval "$cmd" || exit $?
slouken@0
  2337
      done
slouken@0
  2338
      IFS="$save_ifs"
slouken@0
  2339
slouken@0
  2340
      # Exit if we aren't doing a library object file.
slouken@0
  2341
      if test -z "$libobj"; then
slouken@0
  2342
	if test -n "$gentop"; then
slouken@0
  2343
	  $show "${rm}r $gentop"
slouken@0
  2344
	  $run ${rm}r $gentop
slouken@0
  2345
	fi
slouken@0
  2346
slouken@0
  2347
	exit 0
slouken@0
  2348
      fi
slouken@0
  2349
slouken@0
  2350
      if test "$build_libtool_libs" != yes; then
slouken@0
  2351
	if test -n "$gentop"; then
slouken@0
  2352
	  $show "${rm}r $gentop"
slouken@0
  2353
	  $run ${rm}r $gentop
slouken@0
  2354
	fi
slouken@0
  2355
slouken@0
  2356
	# Create an invalid libtool object if no PIC, so that we don't
slouken@0
  2357
	# accidentally link it into a program.
slouken@0
  2358
	$show "echo timestamp > $libobj"
slouken@0
  2359
	$run eval "echo timestamp > $libobj" || exit $?
slouken@0
  2360
	exit 0
slouken@0
  2361
      fi
slouken@0
  2362
slouken@0
  2363
      if test -n "$pic_flag"; then
slouken@0
  2364
	# Only do commands if we really have different PIC objects.
slouken@0
  2365
	reload_objs="$libobjs $reload_conv_objs"
slouken@0
  2366
	output="$libobj"
slouken@0
  2367
	eval cmds=\"$reload_cmds\"
slouken@0
  2368
	IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
slouken@0
  2369
	for cmd in $cmds; do
slouken@0
  2370
	  IFS="$save_ifs"
slouken@0
  2371
	  $show "$cmd"
slouken@0
  2372
	  $run eval "$cmd" || exit $?
slouken@0
  2373
	done
slouken@0
  2374
	IFS="$save_ifs"
slouken@0
  2375
      else
slouken@0
  2376
	# Just create a symlink.
slouken@0
  2377
	$show $rm $libobj
slouken@0
  2378
	$run $rm $libobj
slouken@0
  2379
	xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
slouken@0
  2380
	if test "X$xdir" = "X$libobj"; then
slouken@0
  2381
	  xdir="."
slouken@0
  2382
	else
slouken@0
  2383
	  xdir="$xdir"
slouken@0
  2384
	fi
slouken@0
  2385
	baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
slouken@0
  2386
	oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
slouken@0
  2387
	$show "(cd $xdir && $LN_S $oldobj $baseobj)"
slouken@0
  2388
	$run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
slouken@0
  2389
      fi
slouken@0
  2390
slouken@0
  2391
      if test -n "$gentop"; then
slouken@0
  2392
	$show "${rm}r $gentop"
slouken@0
  2393
	$run ${rm}r $gentop
slouken@0
  2394
      fi
slouken@0
  2395
slouken@0
  2396
      exit 0
slouken@0
  2397
      ;;
slouken@0
  2398
slouken@0
  2399
    # Anything else should be a program.
slouken@0
  2400
    *)
slouken@0
  2401
      if test -n "$vinfo"; then
slouken@0
  2402
	$echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
slouken@0
  2403
      fi
slouken@0
  2404
slouken@0
  2405
      if test -n "$release"; then
slouken@0
  2406
	$echo "$modename: warning: \`-release' is ignored for programs" 1>&2
slouken@0
  2407
      fi
slouken@0
  2408
slouken@0
  2409
      if test "$preload" = yes; then
slouken@0
  2410
	if test "$dlopen" = unknown && test "$dlopen_self" = unknown &&
slouken@0
  2411
	   test "$dlopen_self_static" = unknown; then
slouken@0
  2412
	  $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
slouken@0
  2413
	fi 
slouken@0
  2414
      fi
slouken@0
  2415
    
slouken@0
  2416
      if test -n "$rpath$xrpath"; then
slouken@0
  2417
	# If the user specified any rpath flags, then add them.
slouken@0
  2418
	for libdir in $rpath $xrpath; do
slouken@0
  2419
	  # This is the magic to use -rpath.
slouken@0
  2420
	  case "$compile_rpath " in
slouken@0
  2421
	  *" $libdir "*) ;;
slouken@0
  2422
	  *) compile_rpath="$compile_rpath $libdir" ;;
slouken@0
  2423
	  esac
slouken@0
  2424
	  case "$finalize_rpath " in
slouken@0
  2425
	  *" $libdir "*) ;;
slouken@0
  2426
	  *) finalize_rpath="$finalize_rpath $libdir" ;;
slouken@0
  2427
	  esac
slouken@0
  2428
	done
slouken@0
  2429
      fi
slouken@0
  2430
slouken@0
  2431
      # Now hardcode the library paths
slouken@0
  2432
      rpath=
slouken@0
  2433
      hardcode_libdirs=
slouken@0
  2434
      for libdir in $compile_rpath $finalize_rpath; do
slouken@0
  2435
	if test -n "$hardcode_libdir_flag_spec"; then
slouken@0
  2436
	  if test -n "$hardcode_libdir_separator"; then
slouken@0
  2437
	    if test -z "$hardcode_libdirs"; then
slouken@0
  2438
	      hardcode_libdirs="$libdir"
slouken@0
  2439
	    else
slouken@0
  2440
	      # Just accumulate the unique libdirs.
slouken@0
  2441
	      case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
slouken@0
  2442
	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
slouken@0
  2443
		;;
slouken@0
  2444
	      *)
slouken@0
  2445
		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
slouken@0
  2446
		;;
slouken@0
  2447
	      esac
slouken@0
  2448
	    fi
slouken@0
  2449
	  else
slouken@0
  2450
	    eval flag=\"$hardcode_libdir_flag_spec\"
slouken@0
  2451
	    rpath="$rpath $flag"
slouken@0
  2452
	  fi
slouken@0
  2453
	elif test -n "$runpath_var"; then
slouken@0
  2454
	  case "$perm_rpath " in
slouken@0
  2455
	  *" $libdir "*) ;;
slouken@0
  2456
	  *) perm_rpath="$perm_rpath $libdir" ;;
slouken@0
  2457
	  esac
slouken@0
  2458
	fi
slouken@0
  2459
      done
slouken@0
  2460
      # Substitute the hardcoded libdirs into the rpath.
slouken@0
  2461
      if test -n "$hardcode_libdir_separator" &&
slouken@0
  2462
	 test -n "$hardcode_libdirs"; then
slouken@0
  2463
	libdir="$hardcode_libdirs"
slouken@0
  2464
	eval rpath=\" $hardcode_libdir_flag_spec\"
slouken@0
  2465
      fi
slouken@0
  2466
      compile_rpath="$rpath"
slouken@0
  2467
slouken@0
  2468
      rpath=
slouken@0
  2469
      hardcode_libdirs=
slouken@0
  2470
      for libdir in $finalize_rpath; do
slouken@0
  2471
	if test -n "$hardcode_libdir_flag_spec"; then
slouken@0
  2472
	  if test -n "$hardcode_libdir_separator"; then
slouken@0
  2473
	    if test -z "$hardcode_libdirs"; then
slouken@0
  2474
	      hardcode_libdirs="$libdir"
slouken@0
  2475
	    else
slouken@0
  2476
	      # Just accumulate the unique libdirs.
slouken@0
  2477
	      case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
slouken@0
  2478
	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
slouken@0
  2479
		;;
slouken@0
  2480
	      *)
slouken@0
  2481
		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
slouken@0
  2482
		;;
slouken@0
  2483
	      esac
slouken@0
  2484
	    fi
slouken@0
  2485
	  else
slouken@0
  2486
	    eval flag=\"$hardcode_libdir_flag_spec\"
slouken@0
  2487
	    rpath="$rpath $flag"
slouken@0
  2488
	  fi
slouken@0
  2489
	elif test -n "$runpath_var"; then
slouken@0
  2490
	  case "$finalize_perm_rpath " in
slouken@0
  2491
	  *" $libdir "*) ;;
slouken@0
  2492
	  *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
slouken@0
  2493
	  esac
slouken@0
  2494
	fi
slouken@0
  2495
      done
slouken@0
  2496
      # Substitute the hardcoded libdirs into the rpath.
slouken@0
  2497
      if test -n "$hardcode_libdir_separator" &&
slouken@0
  2498
	 test -n "$hardcode_libdirs"; then
slouken@0
  2499
	libdir="$hardcode_libdirs"
slouken@0
  2500
	eval rpath=\" $hardcode_libdir_flag_spec\"
slouken@0
  2501
      fi
slouken@0
  2502
      finalize_rpath="$rpath"
slouken@0
  2503
slouken@0
  2504
      output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
slouken@0
  2505
      if test "X$output_objdir" = "X$output"; then
slouken@0
  2506
	output_objdir="$objdir"
slouken@0
  2507
      else
slouken@0
  2508
	output_objdir="$output_objdir/$objdir"
slouken@0
  2509
      fi
slouken@0
  2510
slouken@0
  2511
      # Create the binary in the object directory, then wrap it.
slouken@0
  2512
      if test ! -d $output_objdir; then
slouken@0
  2513
	$show "$mkdir $output_objdir"
slouken@0
  2514
	$run $mkdir $output_objdir
slouken@0
  2515
	status=$?
slouken@0
  2516
	if test $status -ne 0 && test ! -d $output_objdir; then
slouken@0
  2517
	  exit $status
slouken@0
  2518
	fi
slouken@0
  2519
      fi
slouken@0
  2520
slouken@0
  2521
      if test -n "$libobjs" && test "$build_old_libs" = yes; then
slouken@0
  2522
	# Transform all the library objects into standard objects.
slouken@0
  2523
	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
slouken@0
  2524
	finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
slouken@0
  2525
      fi
slouken@0
  2526
slouken@0
  2527
      dlsyms=
slouken@0
  2528
      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
slouken@0
  2529
	if test -n "$NM" && test -n "$global_symbol_pipe"; then
slouken@0
  2530
	  dlsyms="${outputname}S.c"
slouken@0
  2531
	else
slouken@0
  2532
	  $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
slouken@0
  2533
	fi
slouken@0
  2534
      fi
slouken@0
  2535
slouken@0
  2536
      if test -n "$dlsyms"; then
slouken@0
  2537
	case "$dlsyms" in
slouken@0
  2538
	"") ;;
slouken@0
  2539
	*.c)
slouken@0
  2540
	  # Discover the nlist of each of the dlfiles.
slouken@0
  2541
	  nlist="$output_objdir/${outputname}.nm"
slouken@0
  2542
slouken@0
  2543
	  $show "$rm $nlist ${nlist}S ${nlist}T"
slouken@0
  2544
	  $run $rm "$nlist" "${nlist}S" "${nlist}T"
slouken@0
  2545
slouken@0
  2546
	  # Parse the name list into a source file.
slouken@0
  2547
	  $show "creating $output_objdir/$dlsyms"
slouken@0
  2548
slouken@0
  2549
	  test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
slouken@0
  2550
/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
slouken@0
  2551
/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
slouken@0
  2552
slouken@0
  2553
#ifdef __cplusplus
slouken@0
  2554
extern \"C\" {
slouken@0
  2555
#endif
slouken@0
  2556
slouken@0
  2557
/* Prevent the only kind of declaration conflicts we can make. */
slouken@0
  2558
#define lt_preloaded_symbols some_other_symbol
slouken@0
  2559
slouken@0
  2560
/* External symbol declarations for the compiler. */\
slouken@0
  2561
"
slouken@0
  2562
slouken@0
  2563
	  if test "$dlself" = yes; then
slouken@0
  2564
	    $show "generating symbol list for \`$output'"
slouken@0
  2565
slouken@0
  2566
	    test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
slouken@0
  2567
slouken@0
  2568
	    # Add our own program objects to the symbol list.
slouken@0
  2569
	    progfiles=`$echo "X$objs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
slouken@0
  2570
	    for arg in $progfiles; do
slouken@0
  2571
	      $show "extracting global C symbols from \`$arg'"
slouken@0
  2572
	      $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
slouken@0
  2573
	    done
slouken@0
  2574
slouken@0
  2575
	    if test -n "$exclude_expsyms"; then
slouken@0
  2576
	      $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
slouken@0
  2577
	      $run eval '$mv "$nlist"T "$nlist"'
slouken@0
  2578
	    fi
slouken@0
  2579
	    
slouken@0
  2580
	    if test -n "$export_symbols_regex"; then
slouken@0
  2581
	      $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
slouken@0
  2582
	      $run eval '$mv "$nlist"T "$nlist"'
slouken@0
  2583
	    fi
slouken@0
  2584
slouken@0
  2585
	    # Prepare the list of exported symbols
slouken@0
  2586
	    if test -z "$export_symbols"; then
slouken@0
  2587
	      export_symbols="$output_objdir/$output.exp"
slouken@0
  2588
	      $run $rm $export_symbols
slouken@0
  2589
	      $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
slouken@0
  2590
	    else
slouken@0
  2591
	      $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
slouken@0
  2592
	      $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
slouken@0
  2593
	      $run eval 'mv "$nlist"T "$nlist"'
slouken@0
  2594
	    fi
slouken@0
  2595
	  fi
slouken@0
  2596
slouken@0
  2597
	  for arg in $dlprefiles; do
slouken@0
  2598
	    $show "extracting global C symbols from \`$arg'"
slouken@0
  2599
	    name=`echo "$arg" | sed -e 's%^.*/%%'`
slouken@0
  2600
	    $run eval 'echo ": $name " >> "$nlist"'
slouken@0
  2601
	    $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
slouken@0
  2602
	  done
slouken@0
  2603
slouken@0
  2604
	  if test -z "$run"; then
slouken@0
  2605
	    # Make sure we have at least an empty file.
slouken@0
  2606
	    test -f "$nlist" || : > "$nlist"
slouken@0
  2607
slouken@0
  2608
	    if test -n "$exclude_expsyms"; then
slouken@0
  2609
	      egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
slouken@0
  2610
	      $mv "$nlist"T "$nlist"
slouken@0
  2611
	    fi
slouken@0
  2612
slouken@0
  2613
	    # Try sorting and uniquifying the output.
slouken@0
  2614
	    if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
slouken@0
  2615
	      :
slouken@0
  2616
	    else
slouken@0
  2617
	      grep -v "^: " < "$nlist" > "$nlist"S
slouken@0
  2618
	    fi
slouken@0
  2619
slouken@0
  2620
	    if test -f "$nlist"S; then
slouken@0
  2621
	      eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
slouken@0
  2622
	    else
slouken@0
  2623
	      echo '/* NONE */' >> "$output_objdir/$dlsyms"
slouken@0
  2624
	    fi
slouken@0
  2625
slouken@0
  2626
	    $echo >> "$output_objdir/$dlsyms" "\
slouken@0
  2627
slouken@0
  2628
#undef lt_preloaded_symbols
slouken@0
  2629
slouken@0
  2630
#if defined (__STDC__) && __STDC__
slouken@0
  2631
# define lt_ptr_t void *
slouken@0
  2632
#else
slouken@0
  2633
# define lt_ptr_t char *
slouken@0
  2634
# define const
slouken@0
  2635
#endif
slouken@0
  2636
slouken@0
  2637
/* The mapping between symbol names and symbols. */
slouken@0
  2638
const struct {
slouken@0
  2639
  const char *name;
slouken@0
  2640
  lt_ptr_t address;
slouken@0
  2641
}
slouken@0
  2642
lt_preloaded_symbols[] =
slouken@0
  2643
{\
slouken@0
  2644
"
slouken@0
  2645
slouken@0
  2646
	    sed -n -e 's/^: \([^ ]*\) $/  {\"\1\", (lt_ptr_t) 0},/p' \
slouken@0
  2647
		-e 's/^. \([^ ]*\) \([^ ]*\)$/  {"\2", (lt_ptr_t) \&\2},/p' \
slouken@0
  2648
		  < "$nlist" >> "$output_objdir/$dlsyms"
slouken@0
  2649
slouken@0
  2650
	    $echo >> "$output_objdir/$dlsyms" "\
slouken@0
  2651
  {0, (lt_ptr_t) 0}
slouken@0
  2652
};
slouken@0
  2653
slouken@0
  2654
/* This works around a problem in FreeBSD linker */
slouken@0
  2655
#ifdef FREEBSD_WORKAROUND
slouken@0
  2656
static const void *lt_preloaded_setup() {
slouken@0
  2657
  return lt_preloaded_symbols;
slouken@0
  2658
}
slouken@0
  2659
#endif
slouken@0
  2660
slouken@0
  2661
#ifdef __cplusplus
slouken@0
  2662
}
slouken@0
  2663
#endif\
slouken@0
  2664
"
slouken@0
  2665
	  fi
slouken@0
  2666
slouken@0
  2667
	  pic_flag_for_symtable=
slouken@0
  2668
	  case "$host" in
slouken@0
  2669
	  # compiling the symbol table file with pic_flag works around
slouken@0
  2670
	  # a FreeBSD bug that causes programs to crash when -lm is
slouken@0
  2671
	  # linked before any other PIC object.  But we must not use
slouken@0
  2672
	  # pic_flag when linking with -static.  The problem exists in
slouken@0
  2673
	  # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
slouken@0
  2674
	  *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
slouken@0
  2675
	    case "$compile_command " in
slouken@0
  2676
	    *" -static "*) ;;
slouken@0
  2677
	    *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
slouken@0
  2678
	    esac;;
slouken@0
  2679
	  *-*-hpux*)
slouken@0
  2680
	    case "$compile_command " in
slouken@0
  2681
	    *" -static "*) ;;
slouken@0
  2682
	    *) pic_flag_for_symtable=" $pic_flag -DPIC";;
slouken@0
  2683
	    esac
slouken@0
  2684
	  esac
slouken@0
  2685
slouken@0
  2686
	  # Now compile the dynamic symbol file.
slouken@0
  2687
	  $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
slouken@0
  2688
	  $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
slouken@0
  2689
slouken@0
  2690
	  # Clean up the generated files.
slouken@0
  2691
	  $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
slouken@0
  2692
	  $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
slouken@0
  2693
slouken@0
  2694
	  # Transform the symbol file into the correct name.
slouken@0
  2695
	  compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
slouken@0
  2696
	  finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
slouken@0
  2697
	  ;;
slouken@0
  2698
	*)
slouken@0
  2699
	  $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
slouken@0
  2700
	  exit 1
slouken@0
  2701
	  ;;
slouken@0
  2702
	esac
slouken@0
  2703
      else
slouken@0
  2704
	# We keep going just in case the user didn't refer to
slouken@0
  2705
	# lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
slouken@0
  2706
	# really was required.
slouken@0
  2707
slouken@0
  2708
	# Nullify the symbol file.
slouken@0
  2709
	compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
slouken@0
  2710
	finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
slouken@0
  2711
      fi
slouken@0
  2712
slouken@0
  2713
      if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then
slouken@0
  2714
	# Replace the output file specification.
slouken@0
  2715
	compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
slouken@0
  2716
	link_command="$compile_command$compile_rpath"
slouken@0
  2717
slouken@0
  2718
	# We have no uninstalled library dependencies, so finalize right now.
slouken@0
  2719
	$show "$link_command"
slouken@0
  2720
	$run eval "$link_command"
slouken@0
  2721
	status=$?
slouken@0
  2722
	
slouken@0
  2723
	# Delete the generated files.
slouken@0
  2724
	if test -n "$dlsyms"; then
slouken@0
  2725
	  $show "$rm $output_objdir/${outputname}S.${objext}"
slouken@0
  2726
	  $run $rm "$output_objdir/${outputname}S.${objext}"
slouken@0
  2727
	fi
slouken@0
  2728
slouken@0
  2729
	exit $status
slouken@0
  2730
      fi
slouken@0
  2731
slouken@0
  2732
      if test -n "$shlibpath_var"; then
slouken@0
  2733
	# We should set the shlibpath_var
slouken@0
  2734
	rpath=
slouken@0
  2735
	for dir in $temp_rpath; do
slouken@0
  2736
	  case "$dir" in
slouken@0
  2737
	  [\\/]* | [A-Za-z]:[\\/]*)
slouken@0
  2738
	    # Absolute path.
slouken@0
  2739
	    rpath="$rpath$dir:"
slouken@0
  2740
	    ;;
slouken@0
  2741
	  *)
slouken@0
  2742
	    # Relative path: add a thisdir entry.
slouken@0
  2743
	    rpath="$rpath\$thisdir/$dir:"
slouken@0
  2744
	    ;;
slouken@0
  2745
	  esac
slouken@0
  2746
	done
slouken@0
  2747
	temp_rpath="$rpath"
slouken@0
  2748
      fi
slouken@0
  2749
slouken@0
  2750
      if test -n "$compile_shlibpath$finalize_shlibpath"; then
slouken@0
  2751
	compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
slouken@0
  2752
      fi
slouken@0
  2753
      if test -n "$finalize_shlibpath"; then
slouken@0
  2754
	finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
slouken@0
  2755
      fi
slouken@0
  2756
slouken@0
  2757
      compile_var=
slouken@0
  2758
      finalize_var=
slouken@0
  2759
      if test -n "$runpath_var"; then
slouken@0
  2760
	if test -n "$perm_rpath"; then
slouken@0
  2761
	  # We should set the runpath_var.
slouken@0
  2762
	  rpath=
slouken@0
  2763
	  for dir in $perm_rpath; do
slouken@0
  2764
	    rpath="$rpath$dir:"
slouken@0
  2765
	  done
slouken@0
  2766
	  compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
slouken@0
  2767
	fi
slouken@0
  2768
	if test -n "$finalize_perm_rpath"; then
slouken@0
  2769
	  # We should set the runpath_var.
slouken@0
  2770
	  rpath=
slouken@0
  2771
	  for dir in $finalize_perm_rpath; do
slouken@0
  2772
	    rpath="$rpath$dir:"
slouken@0
  2773
	  done
slouken@0
  2774
	  finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
slouken@0
  2775
	fi
slouken@0
  2776
      fi
slouken@0
  2777
slouken@0
  2778
      if test "$hardcode_action" = relink; then
slouken@0
  2779
	# Fast installation is not supported
slouken@0
  2780
	link_command="$compile_var$compile_command$compile_rpath"
slouken@0
  2781
	relink_command="$finalize_var$finalize_command$finalize_rpath"
slouken@0
  2782
	
slouken@0
  2783
	$echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
slouken@0
  2784
	$echo "$modename: \`$output' will be relinked during installation" 1>&2
slouken@0
  2785
      else
slouken@0
  2786
	if test "$fast_install" != no; then
slouken@0
  2787
	  link_command="$finalize_var$compile_command$finalize_rpath"
slouken@0
  2788
	  if test "$fast_install" = yes; then
slouken@0
  2789
	    relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
slouken@0
  2790
	  else
slouken@0
  2791
	    # fast_install is set to needless
slouken@0
  2792
	    relink_command=
slouken@0
  2793
	  fi
slouken@0
  2794
	else
slouken@0
  2795
	  link_command="$compile_var$compile_command$compile_rpath"
slouken@0
  2796
	  relink_command="$finalize_var$finalize_command$finalize_rpath"
slouken@0
  2797
	fi
slouken@0
  2798
      fi
slouken@0
  2799
slouken@0
  2800
      # Replace the output file specification.
slouken@0
  2801
      link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
slouken@0
  2802
      
slouken@0
  2803
      # Delete the old output files.
slouken@0
  2804
      $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
slouken@0
  2805
slouken@0
  2806
      $show "$link_command"
slouken@0
  2807
      $run eval "$link_command" || exit $?
slouken@0
  2808
slouken@0
  2809
      # Now create the wrapper script.
slouken@0
  2810
      $show "creating $output"
slouken@0
  2811
slouken@0
  2812
      # Quote the relink command for shipping.
slouken@0
  2813
      if test -n "$relink_command"; then
slouken@0
  2814
	relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
slouken@0
  2815
      fi
slouken@0
  2816
slouken@0
  2817
      # Quote $echo for shipping.
slouken@0
  2818
      if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
slouken@0
  2819
	case "$0" in
slouken@0
  2820
	[\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
slouken@0
  2821
	*) qecho="$SHELL `pwd`/$0 --fallback-echo";;
slouken@0
  2822
	esac
slouken@0
  2823
	qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
slouken@0
  2824
      else
slouken@0
  2825
	qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
slouken@0
  2826
      fi
slouken@0
  2827
slouken@0
  2828
      # Only actually do things if our run command is non-null.
slouken@0
  2829
      if test -z "$run"; then
slouken@0
  2830
	# win32 will think the script is a binary if it has
slouken@0
  2831
	# a .exe suffix, so we strip it off here.
slouken@0
  2832
	case $output in
slouken@0
  2833
	  *.exe) output=`echo $output|sed 's,.exe$,,'` ;;
slouken@0
  2834
	esac
slouken@0
  2835
	$rm $output
slouken@0
  2836
	trap "$rm $output; exit 1" 1 2 15
slouken@0
  2837
slouken@0
  2838
	$echo > $output "\
slouken@0
  2839
#! $SHELL
slouken@0
  2840
slouken@0
  2841
# $output - temporary wrapper script for $objdir/$outputname
slouken@0
  2842
# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
slouken@0
  2843
#
slouken@0
  2844
# The $output program cannot be directly executed until all the libtool
slouken@0
  2845
# libraries that it depends on are installed.
slouken@0
  2846
#
slouken@0
  2847
# This wrapper script should never be moved out of the build directory.
slouken@0
  2848
# If it is, it will not operate correctly.
slouken@0
  2849
slouken@0
  2850
# Sed substitution that helps us do robust quoting.  It backslashifies
slouken@0
  2851
# metacharacters that are still active within double-quoted strings.
slouken@0
  2852
Xsed='sed -e 1s/^X//'
slouken@0
  2853
sed_quote_subst='$sed_quote_subst'
slouken@0
  2854
slouken@0
  2855
# The HP-UX ksh and POSIX shell print the target directory to stdout
slouken@0
  2856
# if CDPATH is set.
slouken@0
  2857
if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
slouken@0
  2858
slouken@0
  2859
relink_command=\"$relink_command\"
slouken@0
  2860
slouken@0
  2861
# This environment variable determines our operation mode.
slouken@0
  2862
if test \"\$libtool_install_magic\" = \"$magic\"; then
slouken@0
  2863
  # install mode needs the following variable:
slouken@0
  2864
  link_against_libtool_libs='$link_against_libtool_libs'
slouken@0
  2865
else
slouken@0
  2866
  # When we are sourced in execute mode, \$file and \$echo are already set.
slouken@0
  2867
  if test \"\$libtool_execute_magic\" != \"$magic\"; then
slouken@0
  2868
    echo=\"$qecho\"
slouken@0
  2869
    file=\"\$0\"
slouken@0
  2870
    # Make sure echo works.
slouken@0
  2871
    if test \"X\$1\" = X--no-reexec; then
slouken@0
  2872
      # Discard the --no-reexec flag, and continue.
slouken@0
  2873
      shift
slouken@0
  2874
    elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
slouken@0
  2875
      # Yippee, \$echo works!
slouken@0
  2876
      :
slouken@0
  2877
    else
slouken@0
  2878
      # Restart under the correct shell, and then maybe \$echo will work.
slouken@0
  2879
      exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
slouken@0
  2880
    fi
slouken@0
  2881
  fi\
slouken@0
  2882
"
slouken@0
  2883
	$echo >> $output "\
slouken@0
  2884
slouken@0
  2885
  # Find the directory that this script lives in.
slouken@0
  2886
  thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
slouken@0
  2887
  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
slouken@0
  2888
slouken@0
  2889
  # Follow symbolic links until we get to the real thisdir.
slouken@0
  2890
  file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
slouken@0
  2891
  while test -n \"\$file\"; do
slouken@0
  2892
    destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
slouken@0
  2893
slouken@0
  2894
    # If there was a directory component, then change thisdir.
slouken@0
  2895
    if test \"x\$destdir\" != \"x\$file\"; then
slouken@0
  2896
      case \"\$destdir\" in
slouken@0
  2897
      [\\/]* | [A-Za-z]:[\\/]*) thisdir=\"\$destdir\" ;;
slouken@0
  2898
      *) thisdir=\"\$thisdir/\$destdir\" ;;
slouken@0
  2899
      esac
slouken@0
  2900
    fi
slouken@0
  2901
slouken@0
  2902
    file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
slouken@0
  2903
    file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
slouken@0
  2904
  done
slouken@0
  2905
slouken@0
  2906
  # Try to get the absolute directory name.
slouken@0
  2907
  absdir=\`cd \"\$thisdir\" && pwd\`
slouken@0
  2908
  test -n \"\$absdir\" && thisdir=\"\$absdir\"
slouken@0
  2909
"
slouken@0
  2910
slouken@0
  2911
	if test "$fast_install" = yes; then
slouken@0
  2912
	  echo >> $output "\
slouken@0
  2913
  program=lt-'$outputname'
slouken@0
  2914
  progdir=\"\$thisdir/$objdir\"
slouken@0
  2915
  
slouken@0
  2916
  if test ! -f \"\$progdir/\$program\" || \\
slouken@0
  2917
     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
slouken@0
  2918
       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
slouken@0
  2919
slouken@0
  2920
    file=\"\$\$-\$program\"
slouken@0
  2921
slouken@0
  2922
    if test ! -d \"\$progdir\"; then
slouken@0
  2923
      $mkdir \"\$progdir\"
slouken@0
  2924
    else
slouken@0
  2925
      $rm \"\$progdir/\$file\"
slouken@0
  2926
    fi"
slouken@0
  2927
slouken@0
  2928
	  echo >> $output "\
slouken@0
  2929
slouken@0
  2930
    # relink executable if necessary
slouken@0
  2931
    if test -n \"\$relink_command\"; then
slouken@0
  2932
      if (cd \"\$thisdir\" && eval \$relink_command); then :
slouken@0
  2933
      else
slouken@0
  2934
	$rm \"\$progdir/\$file\"
slouken@0
  2935
	exit 1
slouken@0
  2936
      fi
slouken@0
  2937
    fi
slouken@0
  2938
slouken@0
  2939
    $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
slouken@0
  2940
    { $rm \"\$progdir/\$program\";
slouken@0
  2941
      $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
slouken@0
  2942
    $rm \"\$progdir/\$file\"
slouken@0
  2943
  fi"
slouken@0
  2944
	else
slouken@0
  2945
	  echo >> $output "\
slouken@0
  2946
  program='$outputname'
slouken@0
  2947
  progdir=\"\$thisdir/$objdir\"
slouken@0
  2948
"
slouken@0
  2949
	fi
slouken@0
  2950
slouken@0
  2951
	echo >> $output "\
slouken@0
  2952
slouken@0
  2953
  if test -f \"\$progdir/\$program\"; then"
slouken@0
  2954
slouken@0
  2955
	# Export our shlibpath_var if we have one.
slouken@0
  2956
	if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
slouken@0
  2957
	  $echo >> $output "\
slouken@0
  2958
    # Add our own library path to $shlibpath_var
slouken@0
  2959
    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
slouken@0
  2960
slouken@0
  2961
    # Some systems cannot cope with colon-terminated $shlibpath_var
slouken@0
  2962
    # The second colon is a workaround for a bug in BeOS R4 sed
slouken@0
  2963
    $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
slouken@0
  2964
slouken@0
  2965
    export $shlibpath_var
slouken@0
  2966
"
slouken@0
  2967
	fi
slouken@0
  2968
slouken@0
  2969
	# fixup the dll searchpath if we need to.
slouken@0
  2970
	if test -n "$dllsearchpath"; then
slouken@0
  2971
	  $echo >> $output "\
slouken@0
  2972
    # Add the dll search path components to the executable PATH
slouken@0
  2973
    PATH=$dllsearchpath:\$PATH
slouken@0
  2974
"
slouken@0
  2975
	fi
slouken@0
  2976
slouken@0
  2977
	$echo >> $output "\
slouken@0
  2978
    if test \"\$libtool_execute_magic\" != \"$magic\"; then
slouken@0
  2979
      # Run the actual program with our arguments.
slouken@0
  2980
"
slouken@0
  2981
	case $host in
slouken@0
  2982
	  # win32 systems need to use the prog path for dll
slouken@0
  2983
	  # lookup to work
slouken@0
  2984
	*-*-cygwin*)
slouken@0
  2985
	  $echo >> $output "\
slouken@0
  2986
      exec \$progdir/\$program \${1+\"\$@\"}
slouken@0
  2987
"
slouken@0
  2988
	  ;;
slouken@0
  2989
slouken@0
  2990
	# Backslashes separate directories on plain windows
slouken@0
  2991
	*-*-mingw | *-*-os2*)
slouken@0
  2992
	  $echo >> $output "\
slouken@0
  2993
      exec \$progdir\\\\\$program \${1+\"\$@\"}
slouken@0
  2994
"
slouken@0
  2995
	  ;;
slouken@0
  2996
slouken@0
  2997
	*)
slouken@0
  2998
	  $echo >> $output "\
slouken@0
  2999
      # Export the path to the program.
slouken@0
  3000
      PATH=\"\$progdir:\$PATH\"
slouken@0
  3001
      export PATH
slouken@0
  3002
slouken@0
  3003
      exec \$program \${1+\"\$@\"}
slouken@0
  3004
"
slouken@0
  3005
	  ;;
slouken@0
  3006
	esac
slouken@0
  3007
	$echo >> $output "\
slouken@0
  3008
      \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
slouken@0
  3009
      exit 1
slouken@0
  3010
    fi
slouken@0
  3011
  else
slouken@0
  3012
    # The program doesn't exist.
slouken@0
  3013
    \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
slouken@0
  3014
    \$echo \"This script is just a wrapper for \$program.\" 1>&2
slouken@0
  3015
    echo \"See the $PACKAGE documentation for more information.\" 1>&2
slouken@0
  3016
    exit 1
slouken@0
  3017
  fi
slouken@0
  3018
fi\
slouken@0
  3019
"
slouken@0
  3020
	chmod +x $output
slouken@0
  3021
      fi
slouken@0
  3022
      exit 0
slouken@0
  3023
      ;;
slouken@0
  3024
    esac
slouken@0
  3025
slouken@0
  3026
    # See if we need to build an old-fashioned archive.
slouken@0
  3027
    for oldlib in $oldlibs; do
slouken@0
  3028
slouken@0
  3029
      if test "$build_libtool_libs" = convenience; then
slouken@0
  3030
	oldobjs="$libobjs_save"
slouken@0
  3031
	addlibs="$convenience"
slouken@0
  3032
	build_libtool_libs=no
slouken@0
  3033
      else
slouken@0
  3034
	if test "$build_libtool_libs" = module; then
slouken@0
  3035
	  oldobjs="$libobjs_save"
slouken@0
  3036
	  build_libtool_libs=no
slouken@0
  3037
	else
slouken@0
  3038
	  oldobjs="$objs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
slouken@0
  3039
	fi
slouken@0
  3040
	addlibs="$old_convenience"
slouken@0
  3041
      fi
slouken@0
  3042
slouken@0
  3043
      if test -n "$addlibs"; then
slouken@0
  3044
	gentop="$output_objdir/${outputname}x"
slouken@0
  3045
	$show "${rm}r $gentop"
slouken@0
  3046
	$run ${rm}r "$gentop"
slouken@0
  3047
	$show "mkdir $gentop"
slouken@0
  3048
	$run mkdir "$gentop"
slouken@0
  3049
	status=$?
slouken@0
  3050
	if test $status -ne 0 && test ! -d "$gentop"; then
slouken@0
  3051
	  exit $status
slouken@0
  3052
	fi
slouken@0
  3053
	generated="$generated $gentop"
slouken@0
  3054
	  
slouken@0
  3055
	# Add in members from convenience archives.