build-scripts/ltmain.sh
author Sam Lantinga <slouken@libsdl.org>
Sat, 26 Sep 2009 23:17:08 +0000
branchSDL-1.2
changeset 4246 8b8314cc34a6
parent 1761 39715a34a0be
child 3085 4800979de337
child 4277 803eeeeaa8a0
permissions -rw-r--r--
Fixed bug #810

Lauri Kenttรค 2009-09-26 06:42:23 PDT

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