gst-plugins-nuvdemux/ltmain.sh
author melunko
Tue Oct 24 15:34:48 2006 +0100 (2006-10-24)
branchtrunk
changeset 48 a30f59f76bda
permissions -rw-r--r--
[svn r49] myth_file_transfer renamed to gmyth_file_transfer
melunko@47
     1
# ltmain.sh - Provide generalized library-building support services.
melunko@47
     2
# NOTE: Changing this file will not affect anything until you rerun configure.
melunko@47
     3
#
melunko@47
     4
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005
melunko@47
     5
# Free Software Foundation, Inc.
melunko@47
     6
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
melunko@47
     7
#
melunko@47
     8
# This program is free software; you can redistribute it and/or modify
melunko@47
     9
# it under the terms of the GNU General Public License as published by
melunko@47
    10
# the Free Software Foundation; either version 2 of the License, or
melunko@47
    11
# (at your option) any later version.
melunko@47
    12
#
melunko@47
    13
# This program is distributed in the hope that it will be useful, but
melunko@47
    14
# WITHOUT ANY WARRANTY; without even the implied warranty of
melunko@47
    15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
melunko@47
    16
# General Public License for more details.
melunko@47
    17
#
melunko@47
    18
# You should have received a copy of the GNU General Public License
melunko@47
    19
# along with this program; if not, write to the Free Software
melunko@47
    20
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
melunko@47
    21
#
melunko@47
    22
# As a special exception to the GNU General Public License, if you
melunko@47
    23
# distribute this file as part of a program that contains a
melunko@47
    24
# configuration script generated by Autoconf, you may include it under
melunko@47
    25
# the same distribution terms that you use for the rest of that program.
melunko@47
    26
melunko@47
    27
basename="s,^.*/,,g"
melunko@47
    28
melunko@47
    29
# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
melunko@47
    30
# is ksh but when the shell is invoked as "sh" and the current value of
melunko@47
    31
# the _XPG environment variable is not equal to 1 (one), the special
melunko@47
    32
# positional parameter $0, within a function call, is the name of the
melunko@47
    33
# function.
melunko@47
    34
progpath="$0"
melunko@47
    35
melunko@47
    36
# The name of this program:
melunko@47
    37
progname=`echo "$progpath" | $SED $basename`
melunko@47
    38
modename="$progname"
melunko@47
    39
melunko@47
    40
# Global variables:
melunko@47
    41
EXIT_SUCCESS=0
melunko@47
    42
EXIT_FAILURE=1
melunko@47
    43
melunko@47
    44
PROGRAM=ltmain.sh
melunko@47
    45
PACKAGE=libtool
melunko@47
    46
VERSION=1.5.20
melunko@47
    47
TIMESTAMP=" (1.1220.2.287 2005/08/31 18:54:15)"
melunko@47
    48
melunko@47
    49
# See if we are running on zsh, and set the options which allow our
melunko@47
    50
# commands through without removal of \ escapes.
melunko@47
    51
if test -n "${ZSH_VERSION+set}" ; then
melunko@47
    52
  setopt NO_GLOB_SUBST
melunko@47
    53
fi
melunko@47
    54
melunko@47
    55
# Check that we have a working $echo.
melunko@47
    56
if test "X$1" = X--no-reexec; then
melunko@47
    57
  # Discard the --no-reexec flag, and continue.
melunko@47
    58
  shift
melunko@47
    59
elif test "X$1" = X--fallback-echo; then
melunko@47
    60
  # Avoid inline document here, it may be left over
melunko@47
    61
  :
melunko@47
    62
elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
melunko@47
    63
  # Yippee, $echo works!
melunko@47
    64
  :
melunko@47
    65
else
melunko@47
    66
  # Restart under the correct shell, and then maybe $echo will work.
melunko@47
    67
  exec $SHELL "$progpath" --no-reexec ${1+"$@"}
melunko@47
    68
fi
melunko@47
    69
melunko@47
    70
if test "X$1" = X--fallback-echo; then
melunko@47
    71
  # used as fallback echo
melunko@47
    72
  shift
melunko@47
    73
  cat <<EOF
melunko@47
    74
$*
melunko@47
    75
EOF
melunko@47
    76
  exit $EXIT_SUCCESS
melunko@47
    77
fi
melunko@47
    78
melunko@47
    79
default_mode=
melunko@47
    80
help="Try \`$progname --help' for more information."
melunko@47
    81
magic="%%%MAGIC variable%%%"
melunko@47
    82
mkdir="mkdir"
melunko@47
    83
mv="mv -f"
melunko@47
    84
rm="rm -f"
melunko@47
    85
melunko@47
    86
# Sed substitution that helps us do robust quoting.  It backslashifies
melunko@47
    87
# metacharacters that are still active within double-quoted strings.
melunko@47
    88
Xsed="${SED}"' -e 1s/^X//'
melunko@47
    89
sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
melunko@47
    90
# test EBCDIC or ASCII
melunko@47
    91
case `echo X|tr X '\101'` in
melunko@47
    92
 A) # ASCII based system
melunko@47
    93
    # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
melunko@47
    94
  SP2NL='tr \040 \012'
melunko@47
    95
  NL2SP='tr \015\012 \040\040'
melunko@47
    96
  ;;
melunko@47
    97
 *) # EBCDIC based system
melunko@47
    98
  SP2NL='tr \100 \n'
melunko@47
    99
  NL2SP='tr \r\n \100\100'
melunko@47
   100
  ;;
melunko@47
   101
esac
melunko@47
   102
melunko@47
   103
# NLS nuisances.
melunko@47
   104
# Only set LANG and LC_ALL to C if already set.
melunko@47
   105
# These must not be set unconditionally because not all systems understand
melunko@47
   106
# e.g. LANG=C (notably SCO).
melunko@47
   107
# We save the old values to restore during execute mode.
melunko@47
   108
if test "${LC_ALL+set}" = set; then
melunko@47
   109
  save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
melunko@47
   110
fi
melunko@47
   111
if test "${LANG+set}" = set; then
melunko@47
   112
  save_LANG="$LANG"; LANG=C; export LANG
melunko@47
   113
fi
melunko@47
   114
melunko@47
   115
# Make sure IFS has a sensible default
melunko@47
   116
lt_nl='
melunko@47
   117
'
melunko@47
   118
IFS=" 	$lt_nl"
melunko@47
   119
melunko@47
   120
if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
melunko@47
   121
  $echo "$modename: not configured to build any kind of library" 1>&2
melunko@47
   122
  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
melunko@47
   123
  exit $EXIT_FAILURE
melunko@47
   124
fi
melunko@47
   125
melunko@47
   126
# Global variables.
melunko@47
   127
mode=$default_mode
melunko@47
   128
nonopt=
melunko@47
   129
prev=
melunko@47
   130
prevopt=
melunko@47
   131
run=
melunko@47
   132
show="$echo"
melunko@47
   133
show_help=
melunko@47
   134
execute_dlfiles=
melunko@47
   135
lo2o="s/\\.lo\$/.${objext}/"
melunko@47
   136
o2lo="s/\\.${objext}\$/.lo/"
melunko@47
   137
melunko@47
   138
#####################################
melunko@47
   139
# Shell function definitions:
melunko@47
   140
# This seems to be the best place for them
melunko@47
   141
melunko@47
   142
# func_win32_libid arg
melunko@47
   143
# return the library type of file 'arg'
melunko@47
   144
#
melunko@47
   145
# Need a lot of goo to handle *both* DLLs and import libs
melunko@47
   146
# Has to be a shell function in order to 'eat' the argument
melunko@47
   147
# that is supplied when $file_magic_command is called.
melunko@47
   148
func_win32_libid ()
melunko@47
   149
{
melunko@47
   150
  win32_libid_type="unknown"
melunko@47
   151
  win32_fileres=`file -L $1 2>/dev/null`
melunko@47
   152
  case $win32_fileres in
melunko@47
   153
  *ar\ archive\ import\ library*) # definitely import
melunko@47
   154
    win32_libid_type="x86 archive import"
melunko@47
   155
    ;;
melunko@47
   156
  *ar\ archive*) # could be an import, or static
melunko@47
   157
    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
melunko@47
   158
      $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
melunko@47
   159
      win32_nmres=`eval $NM -f posix -A $1 | \
melunko@47
   160
	sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
melunko@47
   161
      if test "X$win32_nmres" = "Ximport" ; then
melunko@47
   162
        win32_libid_type="x86 archive import"
melunko@47
   163
      else
melunko@47
   164
        win32_libid_type="x86 archive static"
melunko@47
   165
      fi
melunko@47
   166
    fi
melunko@47
   167
    ;;
melunko@47
   168
  *DLL*)
melunko@47
   169
    win32_libid_type="x86 DLL"
melunko@47
   170
    ;;
melunko@47
   171
  *executable*) # but shell scripts are "executable" too...
melunko@47
   172
    case $win32_fileres in
melunko@47
   173
    *MS\ Windows\ PE\ Intel*)
melunko@47
   174
      win32_libid_type="x86 DLL"
melunko@47
   175
      ;;
melunko@47
   176
    esac
melunko@47
   177
    ;;
melunko@47
   178
  esac
melunko@47
   179
  $echo $win32_libid_type
melunko@47
   180
}
melunko@47
   181
melunko@47
   182
melunko@47
   183
# func_infer_tag arg
melunko@47
   184
# Infer tagged configuration to use if any are available and
melunko@47
   185
# if one wasn't chosen via the "--tag" command line option.
melunko@47
   186
# Only attempt this if the compiler in the base compile
melunko@47
   187
# command doesn't match the default compiler.
melunko@47
   188
# arg is usually of the form 'gcc ...'
melunko@47
   189
func_infer_tag ()
melunko@47
   190
{
melunko@47
   191
    if test -n "$available_tags" && test -z "$tagname"; then
melunko@47
   192
      CC_quoted=
melunko@47
   193
      for arg in $CC; do
melunko@47
   194
	case $arg in
melunko@47
   195
	  *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
melunko@47
   196
	  arg="\"$arg\""
melunko@47
   197
	  ;;
melunko@47
   198
	esac
melunko@47
   199
	CC_quoted="$CC_quoted $arg"
melunko@47
   200
      done
melunko@47
   201
      case $@ in
melunko@47
   202
      # Blanks in the command may have been stripped by the calling shell,
melunko@47
   203
      # but not from the CC environment variable when configure was run.
melunko@47
   204
      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
melunko@47
   205
      # Blanks at the start of $base_compile will cause this to fail
melunko@47
   206
      # if we don't check for them as well.
melunko@47
   207
      *)
melunko@47
   208
	for z in $available_tags; do
melunko@47
   209
	  if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
melunko@47
   210
	    # Evaluate the configuration.
melunko@47
   211
	    eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
melunko@47
   212
	    CC_quoted=
melunko@47
   213
	    for arg in $CC; do
melunko@47
   214
	    # Double-quote args containing other shell metacharacters.
melunko@47
   215
	    case $arg in
melunko@47
   216
	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
melunko@47
   217
	      arg="\"$arg\""
melunko@47
   218
	      ;;
melunko@47
   219
	    esac
melunko@47
   220
	    CC_quoted="$CC_quoted $arg"
melunko@47
   221
	  done
melunko@47
   222
	    case "$@ " in
melunko@47
   223
	      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
melunko@47
   224
	      # The compiler in the base compile command matches
melunko@47
   225
	      # the one in the tagged configuration.
melunko@47
   226
	      # Assume this is the tagged configuration we want.
melunko@47
   227
	      tagname=$z
melunko@47
   228
	      break
melunko@47
   229
	      ;;
melunko@47
   230
	    esac
melunko@47
   231
	  fi
melunko@47
   232
	done
melunko@47
   233
	# If $tagname still isn't set, then no tagged configuration
melunko@47
   234
	# was found and let the user know that the "--tag" command
melunko@47
   235
	# line option must be used.
melunko@47
   236
	if test -z "$tagname"; then
melunko@47
   237
	  $echo "$modename: unable to infer tagged configuration"
melunko@47
   238
	  $echo "$modename: specify a tag with \`--tag'" 1>&2
melunko@47
   239
	  exit $EXIT_FAILURE
melunko@47
   240
#        else
melunko@47
   241
#          $echo "$modename: using $tagname tagged configuration"
melunko@47
   242
	fi
melunko@47
   243
	;;
melunko@47
   244
      esac
melunko@47
   245
    fi
melunko@47
   246
}
melunko@47
   247
melunko@47
   248
melunko@47
   249
# func_extract_an_archive dir oldlib
melunko@47
   250
func_extract_an_archive ()
melunko@47
   251
{
melunko@47
   252
    f_ex_an_ar_dir="$1"; shift
melunko@47
   253
    f_ex_an_ar_oldlib="$1"
melunko@47
   254
melunko@47
   255
    $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
melunko@47
   256
    $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
melunko@47
   257
    if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
melunko@47
   258
     :
melunko@47
   259
    else
melunko@47
   260
      $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
melunko@47
   261
      exit $EXIT_FAILURE
melunko@47
   262
    fi
melunko@47
   263
}
melunko@47
   264
melunko@47
   265
# func_extract_archives gentop oldlib ...
melunko@47
   266
func_extract_archives ()
melunko@47
   267
{
melunko@47
   268
    my_gentop="$1"; shift
melunko@47
   269
    my_oldlibs=${1+"$@"}
melunko@47
   270
    my_oldobjs=""
melunko@47
   271
    my_xlib=""
melunko@47
   272
    my_xabs=""
melunko@47
   273
    my_xdir=""
melunko@47
   274
    my_status=""
melunko@47
   275
melunko@47
   276
    $show "${rm}r $my_gentop"
melunko@47
   277
    $run ${rm}r "$my_gentop"
melunko@47
   278
    $show "$mkdir $my_gentop"
melunko@47
   279
    $run $mkdir "$my_gentop"
melunko@47
   280
    my_status=$?
melunko@47
   281
    if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
melunko@47
   282
      exit $my_status
melunko@47
   283
    fi
melunko@47
   284
melunko@47
   285
    for my_xlib in $my_oldlibs; do
melunko@47
   286
      # Extract the objects.
melunko@47
   287
      case $my_xlib in
melunko@47
   288
	[\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
melunko@47
   289
	*) my_xabs=`pwd`"/$my_xlib" ;;
melunko@47
   290
      esac
melunko@47
   291
      my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
melunko@47
   292
      my_xdir="$my_gentop/$my_xlib"
melunko@47
   293
melunko@47
   294
      $show "${rm}r $my_xdir"
melunko@47
   295
      $run ${rm}r "$my_xdir"
melunko@47
   296
      $show "$mkdir $my_xdir"
melunko@47
   297
      $run $mkdir "$my_xdir"
melunko@47
   298
      status=$?
melunko@47
   299
      if test "$status" -ne 0 && test ! -d "$my_xdir"; then
melunko@47
   300
	exit $status
melunko@47
   301
      fi
melunko@47
   302
      case $host in
melunko@47
   303
      *-darwin*)
melunko@47
   304
	$show "Extracting $my_xabs"
melunko@47
   305
	# Do not bother doing anything if just a dry run
melunko@47
   306
	if test -z "$run"; then
melunko@47
   307
	  darwin_orig_dir=`pwd`
melunko@47
   308
	  cd $my_xdir || exit $?
melunko@47
   309
	  darwin_archive=$my_xabs
melunko@47
   310
	  darwin_curdir=`pwd`
melunko@47
   311
	  darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
melunko@47
   312
	  darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
melunko@47
   313
	  if test -n "$darwin_arches"; then 
melunko@47
   314
	    darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
melunko@47
   315
	    darwin_arch=
melunko@47
   316
	    $show "$darwin_base_archive has multiple architectures $darwin_arches"
melunko@47
   317
	    for darwin_arch in  $darwin_arches ; do
melunko@47
   318
	      mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
melunko@47
   319
	      lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
melunko@47
   320
	      cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
melunko@47
   321
	      func_extract_an_archive "`pwd`" "${darwin_base_archive}"
melunko@47
   322
	      cd "$darwin_curdir"
melunko@47
   323
	      $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
melunko@47
   324
	    done # $darwin_arches
melunko@47
   325
      ## Okay now we have a bunch of thin objects, gotta fatten them up :)
melunko@47
   326
	    darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
melunko@47
   327
	    darwin_file=
melunko@47
   328
	    darwin_files=
melunko@47
   329
	    for darwin_file in $darwin_filelist; do
melunko@47
   330
	      darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
melunko@47
   331
	      lipo -create -output "$darwin_file" $darwin_files
melunko@47
   332
	    done # $darwin_filelist
melunko@47
   333
	    ${rm}r unfat-$$
melunko@47
   334
	    cd "$darwin_orig_dir"
melunko@47
   335
	  else
melunko@47
   336
	    cd "$darwin_orig_dir"
melunko@47
   337
 	    func_extract_an_archive "$my_xdir" "$my_xabs"
melunko@47
   338
	  fi # $darwin_arches
melunko@47
   339
	fi # $run
melunko@47
   340
	;;
melunko@47
   341
      *)
melunko@47
   342
        func_extract_an_archive "$my_xdir" "$my_xabs"
melunko@47
   343
        ;;
melunko@47
   344
      esac
melunko@47
   345
      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
melunko@47
   346
    done
melunko@47
   347
    func_extract_archives_result="$my_oldobjs"
melunko@47
   348
}
melunko@47
   349
# End of Shell function definitions
melunko@47
   350
#####################################
melunko@47
   351
melunko@47
   352
# Darwin sucks
melunko@47
   353
eval std_shrext=\"$shrext_cmds\"
melunko@47
   354
melunko@47
   355
# Parse our command line options once, thoroughly.
melunko@47
   356
while test "$#" -gt 0
melunko@47
   357
do
melunko@47
   358
  arg="$1"
melunko@47
   359
  shift
melunko@47
   360
melunko@47
   361
  case $arg in
melunko@47
   362
  -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
melunko@47
   363
  *) optarg= ;;
melunko@47
   364
  esac
melunko@47
   365
melunko@47
   366
  # If the previous option needs an argument, assign it.
melunko@47
   367
  if test -n "$prev"; then
melunko@47
   368
    case $prev in
melunko@47
   369
    execute_dlfiles)
melunko@47
   370
      execute_dlfiles="$execute_dlfiles $arg"
melunko@47
   371
      ;;
melunko@47
   372
    tag)
melunko@47
   373
      tagname="$arg"
melunko@47
   374
      preserve_args="${preserve_args}=$arg"
melunko@47
   375
melunko@47
   376
      # Check whether tagname contains only valid characters
melunko@47
   377
      case $tagname in
melunko@47
   378
      *[!-_A-Za-z0-9,/]*)
melunko@47
   379
	$echo "$progname: invalid tag name: $tagname" 1>&2
melunko@47
   380
	exit $EXIT_FAILURE
melunko@47
   381
	;;
melunko@47
   382
      esac
melunko@47
   383
melunko@47
   384
      case $tagname in
melunko@47
   385
      CC)
melunko@47
   386
	# Don't test for the "default" C tag, as we know, it's there, but
melunko@47
   387
	# not specially marked.
melunko@47
   388
	;;
melunko@47
   389
      *)
melunko@47
   390
	if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
melunko@47
   391
	  taglist="$taglist $tagname"
melunko@47
   392
	  # Evaluate the configuration.
melunko@47
   393
	  eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
melunko@47
   394
	else
melunko@47
   395
	  $echo "$progname: ignoring unknown tag $tagname" 1>&2
melunko@47
   396
	fi
melunko@47
   397
	;;
melunko@47
   398
      esac
melunko@47
   399
      ;;
melunko@47
   400
    *)
melunko@47
   401
      eval "$prev=\$arg"
melunko@47
   402
      ;;
melunko@47
   403
    esac
melunko@47
   404
melunko@47
   405
    prev=
melunko@47
   406
    prevopt=
melunko@47
   407
    continue
melunko@47
   408
  fi
melunko@47
   409
melunko@47
   410
  # Have we seen a non-optional argument yet?
melunko@47
   411
  case $arg in
melunko@47
   412
  --help)
melunko@47
   413
    show_help=yes
melunko@47
   414
    ;;
melunko@47
   415
melunko@47
   416
  --version)
melunko@47
   417
    $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
melunko@47
   418
    $echo
melunko@47
   419
    $echo "Copyright (C) 2005  Free Software Foundation, Inc."
melunko@47
   420
    $echo "This is free software; see the source for copying conditions.  There is NO"
melunko@47
   421
    $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
melunko@47
   422
    exit $?
melunko@47
   423
    ;;
melunko@47
   424
melunko@47
   425
  --config)
melunko@47
   426
    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
melunko@47
   427
    # Now print the configurations for the tags.
melunko@47
   428
    for tagname in $taglist; do
melunko@47
   429
      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
melunko@47
   430
    done
melunko@47
   431
    exit $?
melunko@47
   432
    ;;
melunko@47
   433
melunko@47
   434
  --debug)
melunko@47
   435
    $echo "$progname: enabling shell trace mode"
melunko@47
   436
    set -x
melunko@47
   437
    preserve_args="$preserve_args $arg"
melunko@47
   438
    ;;
melunko@47
   439
melunko@47
   440
  --dry-run | -n)
melunko@47
   441
    run=:
melunko@47
   442
    ;;
melunko@47
   443
melunko@47
   444
  --features)
melunko@47
   445
    $echo "host: $host"
melunko@47
   446
    if test "$build_libtool_libs" = yes; then
melunko@47
   447
      $echo "enable shared libraries"
melunko@47
   448
    else
melunko@47
   449
      $echo "disable shared libraries"
melunko@47
   450
    fi
melunko@47
   451
    if test "$build_old_libs" = yes; then
melunko@47
   452
      $echo "enable static libraries"
melunko@47
   453
    else
melunko@47
   454
      $echo "disable static libraries"
melunko@47
   455
    fi
melunko@47
   456
    exit $?
melunko@47
   457
    ;;
melunko@47
   458
melunko@47
   459
  --finish) mode="finish" ;;
melunko@47
   460
melunko@47
   461
  --mode) prevopt="--mode" prev=mode ;;
melunko@47
   462
  --mode=*) mode="$optarg" ;;
melunko@47
   463
melunko@47
   464
  --preserve-dup-deps) duplicate_deps="yes" ;;
melunko@47
   465
melunko@47
   466
  --quiet | --silent)
melunko@47
   467
    show=:
melunko@47
   468
    preserve_args="$preserve_args $arg"
melunko@47
   469
    ;;
melunko@47
   470
melunko@47
   471
  --tag) prevopt="--tag" prev=tag ;;
melunko@47
   472
  --tag=*)
melunko@47
   473
    set tag "$optarg" ${1+"$@"}
melunko@47
   474
    shift
melunko@47
   475
    prev=tag
melunko@47
   476
    preserve_args="$preserve_args --tag"
melunko@47
   477
    ;;
melunko@47
   478
melunko@47
   479
  -dlopen)
melunko@47
   480
    prevopt="-dlopen"
melunko@47
   481
    prev=execute_dlfiles
melunko@47
   482
    ;;
melunko@47
   483
melunko@47
   484
  -*)
melunko@47
   485
    $echo "$modename: unrecognized option \`$arg'" 1>&2
melunko@47
   486
    $echo "$help" 1>&2
melunko@47
   487
    exit $EXIT_FAILURE
melunko@47
   488
    ;;
melunko@47
   489
melunko@47
   490
  *)
melunko@47
   491
    nonopt="$arg"
melunko@47
   492
    break
melunko@47
   493
    ;;
melunko@47
   494
  esac
melunko@47
   495
done
melunko@47
   496
melunko@47
   497
if test -n "$prevopt"; then
melunko@47
   498
  $echo "$modename: option \`$prevopt' requires an argument" 1>&2
melunko@47
   499
  $echo "$help" 1>&2
melunko@47
   500
  exit $EXIT_FAILURE
melunko@47
   501
fi
melunko@47
   502
melunko@47
   503
# If this variable is set in any of the actions, the command in it
melunko@47
   504
# will be execed at the end.  This prevents here-documents from being
melunko@47
   505
# left over by shells.
melunko@47
   506
exec_cmd=
melunko@47
   507
melunko@47
   508
if test -z "$show_help"; then
melunko@47
   509
melunko@47
   510
  # Infer the operation mode.
melunko@47
   511
  if test -z "$mode"; then
melunko@47
   512
    $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
melunko@47
   513
    $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
melunko@47
   514
    case $nonopt in
melunko@47
   515
    *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
melunko@47
   516
      mode=link
melunko@47
   517
      for arg
melunko@47
   518
      do
melunko@47
   519
	case $arg in
melunko@47
   520
	-c)
melunko@47
   521
	   mode=compile
melunko@47
   522
	   break
melunko@47
   523
	   ;;
melunko@47
   524
	esac
melunko@47
   525
      done
melunko@47
   526
      ;;
melunko@47
   527
    *db | *dbx | *strace | *truss)
melunko@47
   528
      mode=execute
melunko@47
   529
      ;;
melunko@47
   530
    *install*|cp|mv)
melunko@47
   531
      mode=install
melunko@47
   532
      ;;
melunko@47
   533
    *rm)
melunko@47
   534
      mode=uninstall
melunko@47
   535
      ;;
melunko@47
   536
    *)
melunko@47
   537
      # If we have no mode, but dlfiles were specified, then do execute mode.
melunko@47
   538
      test -n "$execute_dlfiles" && mode=execute
melunko@47
   539
melunko@47
   540
      # Just use the default operation mode.
melunko@47
   541
      if test -z "$mode"; then
melunko@47
   542
	if test -n "$nonopt"; then
melunko@47
   543
	  $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
melunko@47
   544
	else
melunko@47
   545
	  $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
melunko@47
   546
	fi
melunko@47
   547
      fi
melunko@47
   548
      ;;
melunko@47
   549
    esac
melunko@47
   550
  fi
melunko@47
   551
melunko@47
   552
  # Only execute mode is allowed to have -dlopen flags.
melunko@47
   553
  if test -n "$execute_dlfiles" && test "$mode" != execute; then
melunko@47
   554
    $echo "$modename: unrecognized option \`-dlopen'" 1>&2
melunko@47
   555
    $echo "$help" 1>&2
melunko@47
   556
    exit $EXIT_FAILURE
melunko@47
   557
  fi
melunko@47
   558
melunko@47
   559
  # Change the help message to a mode-specific one.
melunko@47
   560
  generic_help="$help"
melunko@47
   561
  help="Try \`$modename --help --mode=$mode' for more information."
melunko@47
   562
melunko@47
   563
  # These modes are in order of execution frequency so that they run quickly.
melunko@47
   564
  case $mode in
melunko@47
   565
  # libtool compile mode
melunko@47
   566
  compile)
melunko@47
   567
    modename="$modename: compile"
melunko@47
   568
    # Get the compilation command and the source file.
melunko@47
   569
    base_compile=
melunko@47
   570
    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
melunko@47
   571
    suppress_opt=yes
melunko@47
   572
    suppress_output=
melunko@47
   573
    arg_mode=normal
melunko@47
   574
    libobj=
melunko@47
   575
    later=
melunko@47
   576
melunko@47
   577
    for arg
melunko@47
   578
    do
melunko@47
   579
      case $arg_mode in
melunko@47
   580
      arg  )
melunko@47
   581
	# do not "continue".  Instead, add this to base_compile
melunko@47
   582
	lastarg="$arg"
melunko@47
   583
	arg_mode=normal
melunko@47
   584
	;;
melunko@47
   585
melunko@47
   586
      target )
melunko@47
   587
	libobj="$arg"
melunko@47
   588
	arg_mode=normal
melunko@47
   589
	continue
melunko@47
   590
	;;
melunko@47
   591
melunko@47
   592
      normal )
melunko@47
   593
	# Accept any command-line options.
melunko@47
   594
	case $arg in
melunko@47
   595
	-o)
melunko@47
   596
	  if test -n "$libobj" ; then
melunko@47
   597
	    $echo "$modename: you cannot specify \`-o' more than once" 1>&2
melunko@47
   598
	    exit $EXIT_FAILURE
melunko@47
   599
	  fi
melunko@47
   600
	  arg_mode=target
melunko@47
   601
	  continue
melunko@47
   602
	  ;;
melunko@47
   603
melunko@47
   604
	-static | -prefer-pic | -prefer-non-pic)
melunko@47
   605
	  later="$later $arg"
melunko@47
   606
	  continue
melunko@47
   607
	  ;;
melunko@47
   608
melunko@47
   609
	-no-suppress)
melunko@47
   610
	  suppress_opt=no
melunko@47
   611
	  continue
melunko@47
   612
	  ;;
melunko@47
   613
melunko@47
   614
	-Xcompiler)
melunko@47
   615
	  arg_mode=arg  #  the next one goes into the "base_compile" arg list
melunko@47
   616
	  continue      #  The current "srcfile" will either be retained or
melunko@47
   617
	  ;;            #  replaced later.  I would guess that would be a bug.
melunko@47
   618
melunko@47
   619
	-Wc,*)
melunko@47
   620
	  args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
melunko@47
   621
	  lastarg=
melunko@47
   622
	  save_ifs="$IFS"; IFS=','
melunko@47
   623
 	  for arg in $args; do
melunko@47
   624
	    IFS="$save_ifs"
melunko@47
   625
melunko@47
   626
	    # Double-quote args containing other shell metacharacters.
melunko@47
   627
	    # Many Bourne shells cannot handle close brackets correctly
melunko@47
   628
	    # in scan sets, so we specify it separately.
melunko@47
   629
	    case $arg in
melunko@47
   630
	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
melunko@47
   631
	      arg="\"$arg\""
melunko@47
   632
	      ;;
melunko@47
   633
	    esac
melunko@47
   634
	    lastarg="$lastarg $arg"
melunko@47
   635
	  done
melunko@47
   636
	  IFS="$save_ifs"
melunko@47
   637
	  lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
melunko@47
   638
melunko@47
   639
	  # Add the arguments to base_compile.
melunko@47
   640
	  base_compile="$base_compile $lastarg"
melunko@47
   641
	  continue
melunko@47
   642
	  ;;
melunko@47
   643
melunko@47
   644
	* )
melunko@47
   645
	  # Accept the current argument as the source file.
melunko@47
   646
	  # The previous "srcfile" becomes the current argument.
melunko@47
   647
	  #
melunko@47
   648
	  lastarg="$srcfile"
melunko@47
   649
	  srcfile="$arg"
melunko@47
   650
	  ;;
melunko@47
   651
	esac  #  case $arg
melunko@47
   652
	;;
melunko@47
   653
      esac    #  case $arg_mode
melunko@47
   654
melunko@47
   655
      # Aesthetically quote the previous argument.
melunko@47
   656
      lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
melunko@47
   657
melunko@47
   658
      case $lastarg in
melunko@47
   659
      # Double-quote args containing other shell metacharacters.
melunko@47
   660
      # Many Bourne shells cannot handle close brackets correctly
melunko@47
   661
      # in scan sets, and some SunOS ksh mistreat backslash-escaping
melunko@47
   662
      # in scan sets (worked around with variable expansion),
melunko@47
   663
      # and furthermore cannot handle '|' '&' '(' ')' in scan sets 
melunko@47
   664
      # at all, so we specify them separately.
melunko@47
   665
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
melunko@47
   666
	lastarg="\"$lastarg\""
melunko@47
   667
	;;
melunko@47
   668
      esac
melunko@47
   669
melunko@47
   670
      base_compile="$base_compile $lastarg"
melunko@47
   671
    done # for arg
melunko@47
   672
melunko@47
   673
    case $arg_mode in
melunko@47
   674
    arg)
melunko@47
   675
      $echo "$modename: you must specify an argument for -Xcompile"
melunko@47
   676
      exit $EXIT_FAILURE
melunko@47
   677
      ;;
melunko@47
   678
    target)
melunko@47
   679
      $echo "$modename: you must specify a target with \`-o'" 1>&2
melunko@47
   680
      exit $EXIT_FAILURE
melunko@47
   681
      ;;
melunko@47
   682
    *)
melunko@47
   683
      # Get the name of the library object.
melunko@47
   684
      [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
melunko@47
   685
      ;;
melunko@47
   686
    esac
melunko@47
   687
melunko@47
   688
    # Recognize several different file suffixes.
melunko@47
   689
    # If the user specifies -o file.o, it is replaced with file.lo
melunko@47
   690
    xform='[cCFSifmso]'
melunko@47
   691
    case $libobj in
melunko@47
   692
    *.ada) xform=ada ;;
melunko@47
   693
    *.adb) xform=adb ;;
melunko@47
   694
    *.ads) xform=ads ;;
melunko@47
   695
    *.asm) xform=asm ;;
melunko@47
   696
    *.c++) xform=c++ ;;
melunko@47
   697
    *.cc) xform=cc ;;
melunko@47
   698
    *.ii) xform=ii ;;
melunko@47
   699
    *.class) xform=class ;;
melunko@47
   700
    *.cpp) xform=cpp ;;
melunko@47
   701
    *.cxx) xform=cxx ;;
melunko@47
   702
    *.f90) xform=f90 ;;
melunko@47
   703
    *.for) xform=for ;;
melunko@47
   704
    *.java) xform=java ;;
melunko@47
   705
    esac
melunko@47
   706
melunko@47
   707
    libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
melunko@47
   708
melunko@47
   709
    case $libobj in
melunko@47
   710
    *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
melunko@47
   711
    *)
melunko@47
   712
      $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
melunko@47
   713
      exit $EXIT_FAILURE
melunko@47
   714
      ;;
melunko@47
   715
    esac
melunko@47
   716
melunko@47
   717
    func_infer_tag $base_compile
melunko@47
   718
melunko@47
   719
    for arg in $later; do
melunko@47
   720
      case $arg in
melunko@47
   721
      -static)
melunko@47
   722
	build_old_libs=yes
melunko@47
   723
	continue
melunko@47
   724
	;;
melunko@47
   725
melunko@47
   726
      -prefer-pic)
melunko@47
   727
	pic_mode=yes
melunko@47
   728
	continue
melunko@47
   729
	;;
melunko@47
   730
melunko@47
   731
      -prefer-non-pic)
melunko@47
   732
	pic_mode=no
melunko@47
   733
	continue
melunko@47
   734
	;;
melunko@47
   735
      esac
melunko@47
   736
    done
melunko@47
   737
melunko@47
   738
    qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
melunko@47
   739
    case $qlibobj in
melunko@47
   740
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
melunko@47
   741
	qlibobj="\"$qlibobj\"" ;;
melunko@47
   742
    esac
melunko@47
   743
    test "X$libobj" != "X$qlibobj" \
melunko@47
   744
	&& $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' 	&()|`$[]' \
melunko@47
   745
	&& $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
melunko@47
   746
    objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
melunko@47
   747
    xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
melunko@47
   748
    if test "X$xdir" = "X$obj"; then
melunko@47
   749
      xdir=
melunko@47
   750
    else
melunko@47
   751
      xdir=$xdir/
melunko@47
   752
    fi
melunko@47
   753
    lobj=${xdir}$objdir/$objname
melunko@47
   754
melunko@47
   755
    if test -z "$base_compile"; then
melunko@47
   756
      $echo "$modename: you must specify a compilation command" 1>&2
melunko@47
   757
      $echo "$help" 1>&2
melunko@47
   758
      exit $EXIT_FAILURE
melunko@47
   759
    fi
melunko@47
   760
melunko@47
   761
    # Delete any leftover library objects.
melunko@47
   762
    if test "$build_old_libs" = yes; then
melunko@47
   763
      removelist="$obj $lobj $libobj ${libobj}T"
melunko@47
   764
    else
melunko@47
   765
      removelist="$lobj $libobj ${libobj}T"
melunko@47
   766
    fi
melunko@47
   767
melunko@47
   768
    $run $rm $removelist
melunko@47
   769
    trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
melunko@47
   770
melunko@47
   771
    # On Cygwin there's no "real" PIC flag so we must build both object types
melunko@47
   772
    case $host_os in
melunko@47
   773
    cygwin* | mingw* | pw32* | os2*)
melunko@47
   774
      pic_mode=default
melunko@47
   775
      ;;
melunko@47
   776
    esac
melunko@47
   777
    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
melunko@47
   778
      # non-PIC code in shared libraries is not supported
melunko@47
   779
      pic_mode=default
melunko@47
   780
    fi
melunko@47
   781
melunko@47
   782
    # Calculate the filename of the output object if compiler does
melunko@47
   783
    # not support -o with -c
melunko@47
   784
    if test "$compiler_c_o" = no; then
melunko@47
   785
      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
melunko@47
   786
      lockfile="$output_obj.lock"
melunko@47
   787
      removelist="$removelist $output_obj $lockfile"
melunko@47
   788
      trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
melunko@47
   789
    else
melunko@47
   790
      output_obj=
melunko@47
   791
      need_locks=no
melunko@47
   792
      lockfile=
melunko@47
   793
    fi
melunko@47
   794
melunko@47
   795
    # Lock this critical section if it is needed
melunko@47
   796
    # We use this script file to make the link, it avoids creating a new file
melunko@47
   797
    if test "$need_locks" = yes; then
melunko@47
   798
      until $run ln "$progpath" "$lockfile" 2>/dev/null; do
melunko@47
   799
	$show "Waiting for $lockfile to be removed"
melunko@47
   800
	sleep 2
melunko@47
   801
      done
melunko@47
   802
    elif test "$need_locks" = warn; then
melunko@47
   803
      if test -f "$lockfile"; then
melunko@47
   804
	$echo "\
melunko@47
   805
*** ERROR, $lockfile exists and contains:
melunko@47
   806
`cat $lockfile 2>/dev/null`
melunko@47
   807
melunko@47
   808
This indicates that another process is trying to use the same
melunko@47
   809
temporary object file, and libtool could not work around it because
melunko@47
   810
your compiler does not support \`-c' and \`-o' together.  If you
melunko@47
   811
repeat this compilation, it may succeed, by chance, but you had better
melunko@47
   812
avoid parallel builds (make -j) in this platform, or get a better
melunko@47
   813
compiler."
melunko@47
   814
melunko@47
   815
	$run $rm $removelist
melunko@47
   816
	exit $EXIT_FAILURE
melunko@47
   817
      fi
melunko@47
   818
      $echo "$srcfile" > "$lockfile"
melunko@47
   819
    fi
melunko@47
   820
melunko@47
   821
    if test -n "$fix_srcfile_path"; then
melunko@47
   822
      eval srcfile=\"$fix_srcfile_path\"
melunko@47
   823
    fi
melunko@47
   824
    qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
melunko@47
   825
    case $qsrcfile in
melunko@47
   826
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
melunko@47
   827
      qsrcfile="\"$qsrcfile\"" ;;
melunko@47
   828
    esac
melunko@47
   829
melunko@47
   830
    $run $rm "$libobj" "${libobj}T"
melunko@47
   831
melunko@47
   832
    # Create a libtool object file (analogous to a ".la" file),
melunko@47
   833
    # but don't create it if we're doing a dry run.
melunko@47
   834
    test -z "$run" && cat > ${libobj}T <<EOF
melunko@47
   835
# $libobj - a libtool object file
melunko@47
   836
# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
melunko@47
   837
#
melunko@47
   838
# Please DO NOT delete this file!
melunko@47
   839
# It is necessary for linking the library.
melunko@47
   840
melunko@47
   841
# Name of the PIC object.
melunko@47
   842
EOF
melunko@47
   843
melunko@47
   844
    # Only build a PIC object if we are building libtool libraries.
melunko@47
   845
    if test "$build_libtool_libs" = yes; then
melunko@47
   846
      # Without this assignment, base_compile gets emptied.
melunko@47
   847
      fbsd_hideous_sh_bug=$base_compile
melunko@47
   848
melunko@47
   849
      if test "$pic_mode" != no; then
melunko@47
   850
	command="$base_compile $qsrcfile $pic_flag"
melunko@47
   851
      else
melunko@47
   852
	# Don't build PIC code
melunko@47
   853
	command="$base_compile $qsrcfile"
melunko@47
   854
      fi
melunko@47
   855
melunko@47
   856
      if test ! -d "${xdir}$objdir"; then
melunko@47
   857
	$show "$mkdir ${xdir}$objdir"
melunko@47
   858
	$run $mkdir ${xdir}$objdir
melunko@47
   859
	status=$?
melunko@47
   860
	if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then
melunko@47
   861
	  exit $status
melunko@47
   862
	fi
melunko@47
   863
      fi
melunko@47
   864
melunko@47
   865
      if test -z "$output_obj"; then
melunko@47
   866
	# Place PIC objects in $objdir
melunko@47
   867
	command="$command -o $lobj"
melunko@47
   868
      fi
melunko@47
   869
melunko@47
   870
      $run $rm "$lobj" "$output_obj"
melunko@47
   871
melunko@47
   872
      $show "$command"
melunko@47
   873
      if $run eval "$command"; then :
melunko@47
   874
      else
melunko@47
   875
	test -n "$output_obj" && $run $rm $removelist
melunko@47
   876
	exit $EXIT_FAILURE
melunko@47
   877
      fi
melunko@47
   878
melunko@47
   879
      if test "$need_locks" = warn &&
melunko@47
   880
	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
melunko@47
   881
	$echo "\
melunko@47
   882
*** ERROR, $lockfile contains:
melunko@47
   883
`cat $lockfile 2>/dev/null`
melunko@47
   884
melunko@47
   885
but it should contain:
melunko@47
   886
$srcfile
melunko@47
   887
melunko@47
   888
This indicates that another process is trying to use the same
melunko@47
   889
temporary object file, and libtool could not work around it because
melunko@47
   890
your compiler does not support \`-c' and \`-o' together.  If you
melunko@47
   891
repeat this compilation, it may succeed, by chance, but you had better
melunko@47
   892
avoid parallel builds (make -j) in this platform, or get a better
melunko@47
   893
compiler."
melunko@47
   894
melunko@47
   895
	$run $rm $removelist
melunko@47
   896
	exit $EXIT_FAILURE
melunko@47
   897
      fi
melunko@47
   898
melunko@47
   899
      # Just move the object if needed, then go on to compile the next one
melunko@47
   900
      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
melunko@47
   901
	$show "$mv $output_obj $lobj"
melunko@47
   902
	if $run $mv $output_obj $lobj; then :
melunko@47
   903
	else
melunko@47
   904
	  error=$?
melunko@47
   905
	  $run $rm $removelist
melunko@47
   906
	  exit $error
melunko@47
   907
	fi
melunko@47
   908
      fi
melunko@47
   909
melunko@47
   910
      # Append the name of the PIC object to the libtool object file.
melunko@47
   911
      test -z "$run" && cat >> ${libobj}T <<EOF
melunko@47
   912
pic_object='$objdir/$objname'
melunko@47
   913
melunko@47
   914
EOF
melunko@47
   915
melunko@47
   916
      # Allow error messages only from the first compilation.
melunko@47
   917
      if test "$suppress_opt" = yes; then
melunko@47
   918
        suppress_output=' >/dev/null 2>&1'
melunko@47
   919
      fi
melunko@47
   920
    else
melunko@47
   921
      # No PIC object so indicate it doesn't exist in the libtool
melunko@47
   922
      # object file.
melunko@47
   923
      test -z "$run" && cat >> ${libobj}T <<EOF
melunko@47
   924
pic_object=none
melunko@47
   925
melunko@47
   926
EOF
melunko@47
   927
    fi
melunko@47
   928
melunko@47
   929
    # Only build a position-dependent object if we build old libraries.
melunko@47
   930
    if test "$build_old_libs" = yes; then
melunko@47
   931
      if test "$pic_mode" != yes; then
melunko@47
   932
	# Don't build PIC code
melunko@47
   933
	command="$base_compile $qsrcfile"
melunko@47
   934
      else
melunko@47
   935
	command="$base_compile $qsrcfile $pic_flag"
melunko@47
   936
      fi
melunko@47
   937
      if test "$compiler_c_o" = yes; then
melunko@47
   938
	command="$command -o $obj"
melunko@47
   939
      fi
melunko@47
   940
melunko@47
   941
      # Suppress compiler output if we already did a PIC compilation.
melunko@47
   942
      command="$command$suppress_output"
melunko@47
   943
      $run $rm "$obj" "$output_obj"
melunko@47
   944
      $show "$command"
melunko@47
   945
      if $run eval "$command"; then :
melunko@47
   946
      else
melunko@47
   947
	$run $rm $removelist
melunko@47
   948
	exit $EXIT_FAILURE
melunko@47
   949
      fi
melunko@47
   950
melunko@47
   951
      if test "$need_locks" = warn &&
melunko@47
   952
	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
melunko@47
   953
	$echo "\
melunko@47
   954
*** ERROR, $lockfile contains:
melunko@47
   955
`cat $lockfile 2>/dev/null`
melunko@47
   956
melunko@47
   957
but it should contain:
melunko@47
   958
$srcfile
melunko@47
   959
melunko@47
   960
This indicates that another process is trying to use the same
melunko@47
   961
temporary object file, and libtool could not work around it because
melunko@47
   962
your compiler does not support \`-c' and \`-o' together.  If you
melunko@47
   963
repeat this compilation, it may succeed, by chance, but you had better
melunko@47
   964
avoid parallel builds (make -j) in this platform, or get a better
melunko@47
   965
compiler."
melunko@47
   966
melunko@47
   967
	$run $rm $removelist
melunko@47
   968
	exit $EXIT_FAILURE
melunko@47
   969
      fi
melunko@47
   970
melunko@47
   971
      # Just move the object if needed
melunko@47
   972
      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
melunko@47
   973
	$show "$mv $output_obj $obj"
melunko@47
   974
	if $run $mv $output_obj $obj; then :
melunko@47
   975
	else
melunko@47
   976
	  error=$?
melunko@47
   977
	  $run $rm $removelist
melunko@47
   978
	  exit $error
melunko@47
   979
	fi
melunko@47
   980
      fi
melunko@47
   981
melunko@47
   982
      # Append the name of the non-PIC object the libtool object file.
melunko@47
   983
      # Only append if the libtool object file exists.
melunko@47
   984
      test -z "$run" && cat >> ${libobj}T <<EOF
melunko@47
   985
# Name of the non-PIC object.
melunko@47
   986
non_pic_object='$objname'
melunko@47
   987
melunko@47
   988
EOF
melunko@47
   989
    else
melunko@47
   990
      # Append the name of the non-PIC object the libtool object file.
melunko@47
   991
      # Only append if the libtool object file exists.
melunko@47
   992
      test -z "$run" && cat >> ${libobj}T <<EOF
melunko@47
   993
# Name of the non-PIC object.
melunko@47
   994
non_pic_object=none
melunko@47
   995
melunko@47
   996
EOF
melunko@47
   997
    fi
melunko@47
   998
melunko@47
   999
    $run $mv "${libobj}T" "${libobj}"
melunko@47
  1000
melunko@47
  1001
    # Unlock the critical section if it was locked
melunko@47
  1002
    if test "$need_locks" != no; then
melunko@47
  1003
      $run $rm "$lockfile"
melunko@47
  1004
    fi
melunko@47
  1005
melunko@47
  1006
    exit $EXIT_SUCCESS
melunko@47
  1007
    ;;
melunko@47
  1008
melunko@47
  1009
  # libtool link mode
melunko@47
  1010
  link | relink)
melunko@47
  1011
    modename="$modename: link"
melunko@47
  1012
    case $host in
melunko@47
  1013
    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
melunko@47
  1014
      # It is impossible to link a dll without this setting, and
melunko@47
  1015
      # we shouldn't force the makefile maintainer to figure out
melunko@47
  1016
      # which system we are compiling for in order to pass an extra
melunko@47
  1017
      # flag for every libtool invocation.
melunko@47
  1018
      # allow_undefined=no
melunko@47
  1019
melunko@47
  1020
      # FIXME: Unfortunately, there are problems with the above when trying
melunko@47
  1021
      # to make a dll which has undefined symbols, in which case not
melunko@47
  1022
      # even a static library is built.  For now, we need to specify
melunko@47
  1023
      # -no-undefined on the libtool link line when we can be certain
melunko@47
  1024
      # that all symbols are satisfied, otherwise we get a static library.
melunko@47
  1025
      allow_undefined=yes
melunko@47
  1026
      ;;
melunko@47
  1027
    *)
melunko@47
  1028
      allow_undefined=yes
melunko@47
  1029
      ;;
melunko@47
  1030
    esac
melunko@47
  1031
    libtool_args="$nonopt"
melunko@47
  1032
    base_compile="$nonopt $@"
melunko@47
  1033
    compile_command="$nonopt"
melunko@47
  1034
    finalize_command="$nonopt"
melunko@47
  1035
melunko@47
  1036
    compile_rpath=
melunko@47
  1037
    finalize_rpath=
melunko@47
  1038
    compile_shlibpath=
melunko@47
  1039
    finalize_shlibpath=
melunko@47
  1040
    convenience=
melunko@47
  1041
    old_convenience=
melunko@47
  1042
    deplibs=
melunko@47
  1043
    old_deplibs=
melunko@47
  1044
    compiler_flags=
melunko@47
  1045
    linker_flags=
melunko@47
  1046
    dllsearchpath=
melunko@47
  1047
    lib_search_path=`pwd`
melunko@47
  1048
    inst_prefix_dir=
melunko@47
  1049
melunko@47
  1050
    avoid_version=no
melunko@47
  1051
    dlfiles=
melunko@47
  1052
    dlprefiles=
melunko@47
  1053
    dlself=no
melunko@47
  1054
    export_dynamic=no
melunko@47
  1055
    export_symbols=
melunko@47
  1056
    export_symbols_regex=
melunko@47
  1057
    generated=
melunko@47
  1058
    libobjs=
melunko@47
  1059
    ltlibs=
melunko@47
  1060
    module=no
melunko@47
  1061
    no_install=no
melunko@47
  1062
    objs=
melunko@47
  1063
    non_pic_objects=
melunko@47
  1064
    precious_files_regex=
melunko@47
  1065
    prefer_static_libs=no
melunko@47
  1066
    preload=no
melunko@47
  1067
    prev=
melunko@47
  1068
    prevarg=
melunko@47
  1069
    release=
melunko@47
  1070
    rpath=
melunko@47
  1071
    xrpath=
melunko@47
  1072
    perm_rpath=
melunko@47
  1073
    temp_rpath=
melunko@47
  1074
    thread_safe=no
melunko@47
  1075
    vinfo=
melunko@47
  1076
    vinfo_number=no
melunko@47
  1077
melunko@47
  1078
    func_infer_tag $base_compile
melunko@47
  1079
melunko@47
  1080
    # We need to know -static, to get the right output filenames.
melunko@47
  1081
    for arg
melunko@47
  1082
    do
melunko@47
  1083
      case $arg in
melunko@47
  1084
      -all-static | -static)
melunko@47
  1085
	if test "X$arg" = "X-all-static"; then
melunko@47
  1086
	  if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
melunko@47
  1087
	    $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
melunko@47
  1088
	  fi
melunko@47
  1089
	  if test -n "$link_static_flag"; then
melunko@47
  1090
	    dlopen_self=$dlopen_self_static
melunko@47
  1091
	  fi
melunko@47
  1092
	else
melunko@47
  1093
	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
melunko@47
  1094
	    dlopen_self=$dlopen_self_static
melunko@47
  1095
	  fi
melunko@47
  1096
	fi
melunko@47
  1097
	build_libtool_libs=no
melunko@47
  1098
	build_old_libs=yes
melunko@47
  1099
	prefer_static_libs=yes
melunko@47
  1100
	break
melunko@47
  1101
	;;
melunko@47
  1102
      esac
melunko@47
  1103
    done
melunko@47
  1104
melunko@47
  1105
    # See if our shared archives depend on static archives.
melunko@47
  1106
    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
melunko@47
  1107
melunko@47
  1108
    # Go through the arguments, transforming them on the way.
melunko@47
  1109
    while test "$#" -gt 0; do
melunko@47
  1110
      arg="$1"
melunko@47
  1111
      shift
melunko@47
  1112
      case $arg in
melunko@47
  1113
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
melunko@47
  1114
	qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
melunko@47
  1115
	;;
melunko@47
  1116
      *) qarg=$arg ;;
melunko@47
  1117
      esac
melunko@47
  1118
      libtool_args="$libtool_args $qarg"
melunko@47
  1119
melunko@47
  1120
      # If the previous option needs an argument, assign it.
melunko@47
  1121
      if test -n "$prev"; then
melunko@47
  1122
	case $prev in
melunko@47
  1123
	output)
melunko@47
  1124
	  compile_command="$compile_command @OUTPUT@"
melunko@47
  1125
	  finalize_command="$finalize_command @OUTPUT@"
melunko@47
  1126
	  ;;
melunko@47
  1127
	esac
melunko@47
  1128
melunko@47
  1129
	case $prev in
melunko@47
  1130
	dlfiles|dlprefiles)
melunko@47
  1131
	  if test "$preload" = no; then
melunko@47
  1132
	    # Add the symbol object into the linking commands.
melunko@47
  1133
	    compile_command="$compile_command @SYMFILE@"
melunko@47
  1134
	    finalize_command="$finalize_command @SYMFILE@"
melunko@47
  1135
	    preload=yes
melunko@47
  1136
	  fi
melunko@47
  1137
	  case $arg in
melunko@47
  1138
	  *.la | *.lo) ;;  # We handle these cases below.
melunko@47
  1139
	  force)
melunko@47
  1140
	    if test "$dlself" = no; then
melunko@47
  1141
	      dlself=needless
melunko@47
  1142
	      export_dynamic=yes
melunko@47
  1143
	    fi
melunko@47
  1144
	    prev=
melunko@47
  1145
	    continue
melunko@47
  1146
	    ;;
melunko@47
  1147
	  self)
melunko@47
  1148
	    if test "$prev" = dlprefiles; then
melunko@47
  1149
	      dlself=yes
melunko@47
  1150
	    elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
melunko@47
  1151
	      dlself=yes
melunko@47
  1152
	    else
melunko@47
  1153
	      dlself=needless
melunko@47
  1154
	      export_dynamic=yes
melunko@47
  1155
	    fi
melunko@47
  1156
	    prev=
melunko@47
  1157
	    continue
melunko@47
  1158
	    ;;
melunko@47
  1159
	  *)
melunko@47
  1160
	    if test "$prev" = dlfiles; then
melunko@47
  1161
	      dlfiles="$dlfiles $arg"
melunko@47
  1162
	    else
melunko@47
  1163
	      dlprefiles="$dlprefiles $arg"
melunko@47
  1164
	    fi
melunko@47
  1165
	    prev=
melunko@47
  1166
	    continue
melunko@47
  1167
	    ;;
melunko@47
  1168
	  esac
melunko@47
  1169
	  ;;
melunko@47
  1170
	expsyms)
melunko@47
  1171
	  export_symbols="$arg"
melunko@47
  1172
	  if test ! -f "$arg"; then
melunko@47
  1173
	    $echo "$modename: symbol file \`$arg' does not exist"
melunko@47
  1174
	    exit $EXIT_FAILURE
melunko@47
  1175
	  fi
melunko@47
  1176
	  prev=
melunko@47
  1177
	  continue
melunko@47
  1178
	  ;;
melunko@47
  1179
	expsyms_regex)
melunko@47
  1180
	  export_symbols_regex="$arg"
melunko@47
  1181
	  prev=
melunko@47
  1182
	  continue
melunko@47
  1183
	  ;;
melunko@47
  1184
	inst_prefix)
melunko@47
  1185
	  inst_prefix_dir="$arg"
melunko@47
  1186
	  prev=
melunko@47
  1187
	  continue
melunko@47
  1188
	  ;;
melunko@47
  1189
	precious_regex)
melunko@47
  1190
	  precious_files_regex="$arg"
melunko@47
  1191
	  prev=
melunko@47
  1192
	  continue
melunko@47
  1193
	  ;;
melunko@47
  1194
	release)
melunko@47
  1195
	  release="-$arg"
melunko@47
  1196
	  prev=
melunko@47
  1197
	  continue
melunko@47
  1198
	  ;;
melunko@47
  1199
	objectlist)
melunko@47
  1200
	  if test -f "$arg"; then
melunko@47
  1201
	    save_arg=$arg
melunko@47
  1202
	    moreargs=
melunko@47
  1203
	    for fil in `cat $save_arg`
melunko@47
  1204
	    do
melunko@47
  1205
#	      moreargs="$moreargs $fil"
melunko@47
  1206
	      arg=$fil
melunko@47
  1207
	      # A libtool-controlled object.
melunko@47
  1208
melunko@47
  1209
	      # Check to see that this really is a libtool object.
melunko@47
  1210
	      if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
melunko@47
  1211
		pic_object=
melunko@47
  1212
		non_pic_object=
melunko@47
  1213
melunko@47
  1214
		# Read the .lo file
melunko@47
  1215
		# If there is no directory component, then add one.
melunko@47
  1216
		case $arg in
melunko@47
  1217
		*/* | *\\*) . $arg ;;
melunko@47
  1218
		*) . ./$arg ;;
melunko@47
  1219
		esac
melunko@47
  1220
melunko@47
  1221
		if test -z "$pic_object" || \
melunko@47
  1222
		   test -z "$non_pic_object" ||
melunko@47
  1223
		   test "$pic_object" = none && \
melunko@47
  1224
		   test "$non_pic_object" = none; then
melunko@47
  1225
		  $echo "$modename: cannot find name of object for \`$arg'" 1>&2
melunko@47
  1226
		  exit $EXIT_FAILURE
melunko@47
  1227
		fi
melunko@47
  1228
melunko@47
  1229
		# Extract subdirectory from the argument.
melunko@47
  1230
		xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
melunko@47
  1231
		if test "X$xdir" = "X$arg"; then
melunko@47
  1232
		  xdir=
melunko@47
  1233
		else
melunko@47
  1234
		  xdir="$xdir/"
melunko@47
  1235
		fi
melunko@47
  1236
melunko@47
  1237
		if test "$pic_object" != none; then
melunko@47
  1238
		  # Prepend the subdirectory the object is found in.
melunko@47
  1239
		  pic_object="$xdir$pic_object"
melunko@47
  1240
melunko@47
  1241
		  if test "$prev" = dlfiles; then
melunko@47
  1242
		    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
melunko@47
  1243
		      dlfiles="$dlfiles $pic_object"
melunko@47
  1244
		      prev=
melunko@47
  1245
		      continue
melunko@47
  1246
		    else
melunko@47
  1247
		      # If libtool objects are unsupported, then we need to preload.
melunko@47
  1248
		      prev=dlprefiles
melunko@47
  1249
		    fi
melunko@47
  1250
		  fi
melunko@47
  1251
melunko@47
  1252
		  # CHECK ME:  I think I busted this.  -Ossama
melunko@47
  1253
		  if test "$prev" = dlprefiles; then
melunko@47
  1254
		    # Preload the old-style object.
melunko@47
  1255
		    dlprefiles="$dlprefiles $pic_object"
melunko@47
  1256
		    prev=
melunko@47
  1257
		  fi
melunko@47
  1258
melunko@47
  1259
		  # A PIC object.
melunko@47
  1260
		  libobjs="$libobjs $pic_object"
melunko@47
  1261
		  arg="$pic_object"
melunko@47
  1262
		fi
melunko@47
  1263
melunko@47
  1264
		# Non-PIC object.
melunko@47
  1265
		if test "$non_pic_object" != none; then
melunko@47
  1266
		  # Prepend the subdirectory the object is found in.
melunko@47
  1267
		  non_pic_object="$xdir$non_pic_object"
melunko@47
  1268
melunko@47
  1269
		  # A standard non-PIC object
melunko@47
  1270
		  non_pic_objects="$non_pic_objects $non_pic_object"
melunko@47
  1271
		  if test -z "$pic_object" || test "$pic_object" = none ; then
melunko@47
  1272
		    arg="$non_pic_object"
melunko@47
  1273
		  fi
melunko@47
  1274
		fi
melunko@47
  1275
	      else
melunko@47
  1276
		# Only an error if not doing a dry-run.
melunko@47
  1277
		if test -z "$run"; then
melunko@47
  1278
		  $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
melunko@47
  1279
		  exit $EXIT_FAILURE
melunko@47
  1280
		else
melunko@47
  1281
		  # Dry-run case.
melunko@47
  1282
melunko@47
  1283
		  # Extract subdirectory from the argument.
melunko@47
  1284
		  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
melunko@47
  1285
		  if test "X$xdir" = "X$arg"; then
melunko@47
  1286
		    xdir=
melunko@47
  1287
		  else
melunko@47
  1288
		    xdir="$xdir/"
melunko@47
  1289
		  fi
melunko@47
  1290
melunko@47
  1291
		  pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
melunko@47
  1292
		  non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
melunko@47
  1293
		  libobjs="$libobjs $pic_object"
melunko@47
  1294
		  non_pic_objects="$non_pic_objects $non_pic_object"
melunko@47
  1295
		fi
melunko@47
  1296
	      fi
melunko@47
  1297
	    done
melunko@47
  1298
	  else
melunko@47
  1299
	    $echo "$modename: link input file \`$save_arg' does not exist"
melunko@47
  1300
	    exit $EXIT_FAILURE
melunko@47
  1301
	  fi
melunko@47
  1302
	  arg=$save_arg
melunko@47
  1303
	  prev=
melunko@47
  1304
	  continue
melunko@47
  1305
	  ;;
melunko@47
  1306
	rpath | xrpath)
melunko@47
  1307
	  # We need an absolute path.
melunko@47
  1308
	  case $arg in
melunko@47
  1309
	  [\\/]* | [A-Za-z]:[\\/]*) ;;
melunko@47
  1310
	  *)
melunko@47
  1311
	    $echo "$modename: only absolute run-paths are allowed" 1>&2
melunko@47
  1312
	    exit $EXIT_FAILURE
melunko@47
  1313
	    ;;
melunko@47
  1314
	  esac
melunko@47
  1315
	  if test "$prev" = rpath; then
melunko@47
  1316
	    case "$rpath " in
melunko@47
  1317
	    *" $arg "*) ;;
melunko@47
  1318
	    *) rpath="$rpath $arg" ;;
melunko@47
  1319
	    esac
melunko@47
  1320
	  else
melunko@47
  1321
	    case "$xrpath " in
melunko@47
  1322
	    *" $arg "*) ;;
melunko@47
  1323
	    *) xrpath="$xrpath $arg" ;;
melunko@47
  1324
	    esac
melunko@47
  1325
	  fi
melunko@47
  1326
	  prev=
melunko@47
  1327
	  continue
melunko@47
  1328
	  ;;
melunko@47
  1329
	xcompiler)
melunko@47
  1330
	  compiler_flags="$compiler_flags $qarg"
melunko@47
  1331
	  prev=
melunko@47
  1332
	  compile_command="$compile_command $qarg"
melunko@47
  1333
	  finalize_command="$finalize_command $qarg"
melunko@47
  1334
	  continue
melunko@47
  1335
	  ;;
melunko@47
  1336
	xlinker)
melunko@47
  1337
	  linker_flags="$linker_flags $qarg"
melunko@47
  1338
	  compiler_flags="$compiler_flags $wl$qarg"
melunko@47
  1339
	  prev=
melunko@47
  1340
	  compile_command="$compile_command $wl$qarg"
melunko@47
  1341
	  finalize_command="$finalize_command $wl$qarg"
melunko@47
  1342
	  continue
melunko@47
  1343
	  ;;
melunko@47
  1344
	xcclinker)
melunko@47
  1345
	  linker_flags="$linker_flags $qarg"
melunko@47
  1346
	  compiler_flags="$compiler_flags $qarg"
melunko@47
  1347
	  prev=
melunko@47
  1348
	  compile_command="$compile_command $qarg"
melunko@47
  1349
	  finalize_command="$finalize_command $qarg"
melunko@47
  1350
	  continue
melunko@47
  1351
	  ;;
melunko@47
  1352
	shrext)
melunko@47
  1353
  	  shrext_cmds="$arg"
melunko@47
  1354
	  prev=
melunko@47
  1355
	  continue
melunko@47
  1356
	  ;;
melunko@47
  1357
        darwin_framework)
melunko@47
  1358
	  compiler_flags="$compiler_flags $arg"
melunko@47
  1359
	  compile_command="$compile_command $arg"
melunko@47
  1360
	  finalize_command="$finalize_command $arg"
melunko@47
  1361
	  prev=
melunko@47
  1362
	  continue
melunko@47
  1363
	  ;;
melunko@47
  1364
	*)
melunko@47
  1365
	  eval "$prev=\"\$arg\""
melunko@47
  1366
	  prev=
melunko@47
  1367
	  continue
melunko@47
  1368
	  ;;
melunko@47
  1369
	esac
melunko@47
  1370
      fi # test -n "$prev"
melunko@47
  1371
melunko@47
  1372
      prevarg="$arg"
melunko@47
  1373
melunko@47
  1374
      case $arg in
melunko@47
  1375
      -all-static)
melunko@47
  1376
	if test -n "$link_static_flag"; then
melunko@47
  1377
	  compile_command="$compile_command $link_static_flag"
melunko@47
  1378
	  finalize_command="$finalize_command $link_static_flag"
melunko@47
  1379
	fi
melunko@47
  1380
	continue
melunko@47
  1381
	;;
melunko@47
  1382
melunko@47
  1383
      -allow-undefined)
melunko@47
  1384
	# FIXME: remove this flag sometime in the future.
melunko@47
  1385
	$echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
melunko@47
  1386
	continue
melunko@47
  1387
	;;
melunko@47
  1388
melunko@47
  1389
      -avoid-version)
melunko@47
  1390
	avoid_version=yes
melunko@47
  1391
	continue
melunko@47
  1392
	;;
melunko@47
  1393
melunko@47
  1394
      -dlopen)
melunko@47
  1395
	prev=dlfiles
melunko@47
  1396
	continue
melunko@47
  1397
	;;
melunko@47
  1398
melunko@47
  1399
      -dlpreopen)
melunko@47
  1400
	prev=dlprefiles
melunko@47
  1401
	continue
melunko@47
  1402
	;;
melunko@47
  1403
melunko@47
  1404
      -export-dynamic)
melunko@47
  1405
	export_dynamic=yes
melunko@47
  1406
	continue
melunko@47
  1407
	;;
melunko@47
  1408
melunko@47
  1409
      -export-symbols | -export-symbols-regex)
melunko@47
  1410
	if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
melunko@47
  1411
	  $echo "$modename: more than one -exported-symbols argument is not allowed"
melunko@47
  1412
	  exit $EXIT_FAILURE
melunko@47
  1413
	fi
melunko@47
  1414
	if test "X$arg" = "X-export-symbols"; then
melunko@47
  1415
	  prev=expsyms
melunko@47
  1416
	else
melunko@47
  1417
	  prev=expsyms_regex
melunko@47
  1418
	fi
melunko@47
  1419
	continue
melunko@47
  1420
	;;
melunko@47
  1421
melunko@47
  1422
      -framework|-arch)
melunko@47
  1423
        prev=darwin_framework
melunko@47
  1424
        compiler_flags="$compiler_flags $arg"
melunko@47
  1425
	compile_command="$compile_command $arg"
melunko@47
  1426
	finalize_command="$finalize_command $arg"
melunko@47
  1427
        continue
melunko@47
  1428
        ;;
melunko@47
  1429
melunko@47
  1430
      -inst-prefix-dir)
melunko@47
  1431
	prev=inst_prefix
melunko@47
  1432
	continue
melunko@47
  1433
	;;
melunko@47
  1434
melunko@47
  1435
      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
melunko@47
  1436
      # so, if we see these flags be careful not to treat them like -L
melunko@47
  1437
      -L[A-Z][A-Z]*:*)
melunko@47
  1438
	case $with_gcc/$host in
melunko@47
  1439
	no/*-*-irix* | /*-*-irix*)
melunko@47
  1440
	  compile_command="$compile_command $arg"
melunko@47
  1441
	  finalize_command="$finalize_command $arg"
melunko@47
  1442
	  ;;
melunko@47
  1443
	esac
melunko@47
  1444
	continue
melunko@47
  1445
	;;
melunko@47
  1446
melunko@47
  1447
      -L*)
melunko@47
  1448
	dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
melunko@47
  1449
	# We need an absolute path.
melunko@47
  1450
	case $dir in
melunko@47
  1451
	[\\/]* | [A-Za-z]:[\\/]*) ;;
melunko@47
  1452
	*)
melunko@47
  1453
	  absdir=`cd "$dir" && pwd`
melunko@47
  1454
	  if test -z "$absdir"; then
melunko@47
  1455
	    $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
melunko@47
  1456
	    exit $EXIT_FAILURE
melunko@47
  1457
	  fi
melunko@47
  1458
	  dir="$absdir"
melunko@47
  1459
	  ;;
melunko@47
  1460
	esac
melunko@47
  1461
	case "$deplibs " in
melunko@47
  1462
	*" -L$dir "*) ;;
melunko@47
  1463
	*)
melunko@47
  1464
	  deplibs="$deplibs -L$dir"
melunko@47
  1465
	  lib_search_path="$lib_search_path $dir"
melunko@47
  1466
	  ;;
melunko@47
  1467
	esac
melunko@47
  1468
	case $host in
melunko@47
  1469
	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
melunko@47
  1470
	  case :$dllsearchpath: in
melunko@47
  1471
	  *":$dir:"*) ;;
melunko@47
  1472
	  *) dllsearchpath="$dllsearchpath:$dir";;
melunko@47
  1473
	  esac
melunko@47
  1474
	  ;;
melunko@47
  1475
	esac
melunko@47
  1476
	continue
melunko@47
  1477
	;;
melunko@47
  1478
melunko@47
  1479
      -l*)
melunko@47
  1480
	if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
melunko@47
  1481
	  case $host in
melunko@47
  1482
	  *-*-cygwin* | *-*-pw32* | *-*-beos*)
melunko@47
  1483
	    # These systems don't actually have a C or math library (as such)
melunko@47
  1484
	    continue
melunko@47
  1485
	    ;;
melunko@47
  1486
	  *-*-mingw* | *-*-os2*)
melunko@47
  1487
	    # These systems don't actually have a C library (as such)
melunko@47
  1488
	    test "X$arg" = "X-lc" && continue
melunko@47
  1489
	    ;;
melunko@47
  1490
	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
melunko@47
  1491
	    # Do not include libc due to us having libc/libc_r.
melunko@47
  1492
	    test "X$arg" = "X-lc" && continue
melunko@47
  1493
	    ;;
melunko@47
  1494
	  *-*-rhapsody* | *-*-darwin1.[012])
melunko@47
  1495
	    # Rhapsody C and math libraries are in the System framework
melunko@47
  1496
	    deplibs="$deplibs -framework System"
melunko@47
  1497
	    continue
melunko@47
  1498
	  esac
melunko@47
  1499
	elif test "X$arg" = "X-lc_r"; then
melunko@47
  1500
	 case $host in
melunko@47
  1501
	 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
melunko@47
  1502
	   # Do not include libc_r directly, use -pthread flag.
melunko@47
  1503
	   continue
melunko@47
  1504
	   ;;
melunko@47
  1505
	 esac
melunko@47
  1506
	fi
melunko@47
  1507
	deplibs="$deplibs $arg"
melunko@47
  1508
	continue
melunko@47
  1509
	;;
melunko@47
  1510
melunko@47
  1511
      # Tru64 UNIX uses -model [arg] to determine the layout of C++
melunko@47
  1512
      # classes, name mangling, and exception handling.
melunko@47
  1513
      -model)
melunko@47
  1514
	compile_command="$compile_command $arg"
melunko@47
  1515
	compiler_flags="$compiler_flags $arg"
melunko@47
  1516
	finalize_command="$finalize_command $arg"
melunko@47
  1517
	prev=xcompiler
melunko@47
  1518
	continue
melunko@47
  1519
	;;
melunko@47
  1520
melunko@47
  1521
     -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
melunko@47
  1522
	compiler_flags="$compiler_flags $arg"
melunko@47
  1523
	compile_command="$compile_command $arg"
melunko@47
  1524
	finalize_command="$finalize_command $arg"
melunko@47
  1525
	continue
melunko@47
  1526
	;;
melunko@47
  1527
melunko@47
  1528
      -module)
melunko@47
  1529
	module=yes
melunko@47
  1530
	continue
melunko@47
  1531
	;;
melunko@47
  1532
melunko@47
  1533
      # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
melunko@47
  1534
      # -r[0-9][0-9]* specifies the processor on the SGI compiler
melunko@47
  1535
      # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
melunko@47
  1536
      # +DA*, +DD* enable 64-bit mode on the HP compiler
melunko@47
  1537
      # -q* pass through compiler args for the IBM compiler
melunko@47
  1538
      # -m* pass through architecture-specific compiler args for GCC
melunko@47
  1539
      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*)
melunko@47
  1540
melunko@47
  1541
	# Unknown arguments in both finalize_command and compile_command need
melunko@47
  1542
	# to be aesthetically quoted because they are evaled later.
melunko@47
  1543
	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
melunko@47
  1544
	case $arg in
melunko@47
  1545
	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
melunko@47
  1546
	  arg="\"$arg\""
melunko@47
  1547
	  ;;
melunko@47
  1548
	esac
melunko@47
  1549
        compile_command="$compile_command $arg"
melunko@47
  1550
        finalize_command="$finalize_command $arg"
melunko@47
  1551
        if test "$with_gcc" = "yes" ; then
melunko@47
  1552
          compiler_flags="$compiler_flags $arg"
melunko@47
  1553
        fi
melunko@47
  1554
        continue
melunko@47
  1555
        ;;
melunko@47
  1556
melunko@47
  1557
      -shrext)
melunko@47
  1558
	prev=shrext
melunko@47
  1559
	continue
melunko@47
  1560
	;;
melunko@47
  1561
melunko@47
  1562
      -no-fast-install)
melunko@47
  1563
	fast_install=no
melunko@47
  1564
	continue
melunko@47
  1565
	;;
melunko@47
  1566
melunko@47
  1567
      -no-install)
melunko@47
  1568
	case $host in
melunko@47
  1569
	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
melunko@47
  1570
	  # The PATH hackery in wrapper scripts is required on Windows
melunko@47
  1571
	  # in order for the loader to find any dlls it needs.
melunko@47
  1572
	  $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
melunko@47
  1573
	  $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
melunko@47
  1574
	  fast_install=no
melunko@47
  1575
	  ;;
melunko@47
  1576
	*) no_install=yes ;;
melunko@47
  1577
	esac
melunko@47
  1578
	continue
melunko@47
  1579
	;;
melunko@47
  1580
melunko@47
  1581
      -no-undefined)
melunko@47
  1582
	allow_undefined=no
melunko@47
  1583
	continue
melunko@47
  1584
	;;
melunko@47
  1585
melunko@47
  1586
      -objectlist)
melunko@47
  1587
	prev=objectlist
melunko@47
  1588
	continue
melunko@47
  1589
	;;
melunko@47
  1590
melunko@47
  1591
      -o) prev=output ;;
melunko@47
  1592
melunko@47
  1593
      -precious-files-regex)
melunko@47
  1594
	prev=precious_regex
melunko@47
  1595
	continue
melunko@47
  1596
	;;
melunko@47
  1597
melunko@47
  1598
      -release)
melunko@47
  1599
	prev=release
melunko@47
  1600
	continue
melunko@47
  1601
	;;
melunko@47
  1602
melunko@47
  1603
      -rpath)
melunko@47
  1604
	prev=rpath
melunko@47
  1605
	continue
melunko@47
  1606
	;;
melunko@47
  1607
melunko@47
  1608
      -R)
melunko@47
  1609
	prev=xrpath
melunko@47
  1610
	continue
melunko@47
  1611
	;;
melunko@47
  1612
melunko@47
  1613
      -R*)
melunko@47
  1614
	dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
melunko@47
  1615
	# We need an absolute path.
melunko@47
  1616
	case $dir in
melunko@47
  1617
	[\\/]* | [A-Za-z]:[\\/]*) ;;
melunko@47
  1618
	*)
melunko@47
  1619
	  $echo "$modename: only absolute run-paths are allowed" 1>&2
melunko@47
  1620
	  exit $EXIT_FAILURE
melunko@47
  1621
	  ;;
melunko@47
  1622
	esac
melunko@47
  1623
	case "$xrpath " in
melunko@47
  1624
	*" $dir "*) ;;
melunko@47
  1625
	*) xrpath="$xrpath $dir" ;;
melunko@47
  1626
	esac
melunko@47
  1627
	continue
melunko@47
  1628
	;;
melunko@47
  1629
melunko@47
  1630
      -static)
melunko@47
  1631
	# The effects of -static are defined in a previous loop.
melunko@47
  1632
	# We used to do the same as -all-static on platforms that
melunko@47
  1633
	# didn't have a PIC flag, but the assumption that the effects
melunko@47
  1634
	# would be equivalent was wrong.  It would break on at least
melunko@47
  1635
	# Digital Unix and AIX.
melunko@47
  1636
	continue
melunko@47
  1637
	;;
melunko@47
  1638
melunko@47
  1639
      -thread-safe)
melunko@47
  1640
	thread_safe=yes
melunko@47
  1641
	continue
melunko@47
  1642
	;;
melunko@47
  1643
melunko@47
  1644
      -version-info)
melunko@47
  1645
	prev=vinfo
melunko@47
  1646
	continue
melunko@47
  1647
	;;
melunko@47
  1648
      -version-number)
melunko@47
  1649
	prev=vinfo
melunko@47
  1650
	vinfo_number=yes
melunko@47
  1651
	continue
melunko@47
  1652
	;;
melunko@47
  1653
melunko@47
  1654
      -Wc,*)
melunko@47
  1655
	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
melunko@47
  1656
	arg=
melunko@47
  1657
	save_ifs="$IFS"; IFS=','
melunko@47
  1658
	for flag in $args; do
melunko@47
  1659
	  IFS="$save_ifs"
melunko@47
  1660
	  case $flag in
melunko@47
  1661
	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
melunko@47
  1662
	    flag="\"$flag\""
melunko@47
  1663
	    ;;
melunko@47
  1664
	  esac
melunko@47
  1665
	  arg="$arg $wl$flag"
melunko@47
  1666
	  compiler_flags="$compiler_flags $flag"
melunko@47
  1667
	done
melunko@47
  1668
	IFS="$save_ifs"
melunko@47
  1669
	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
melunko@47
  1670
	;;
melunko@47
  1671
melunko@47
  1672
      -Wl,*)
melunko@47
  1673
	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
melunko@47
  1674
	arg=
melunko@47
  1675
	save_ifs="$IFS"; IFS=','
melunko@47
  1676
	for flag in $args; do
melunko@47
  1677
	  IFS="$save_ifs"
melunko@47
  1678
	  case $flag in
melunko@47
  1679
	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
melunko@47
  1680
	    flag="\"$flag\""
melunko@47
  1681
	    ;;
melunko@47
  1682
	  esac
melunko@47
  1683
	  arg="$arg $wl$flag"
melunko@47
  1684
	  compiler_flags="$compiler_flags $wl$flag"
melunko@47
  1685
	  linker_flags="$linker_flags $flag"
melunko@47
  1686
	done
melunko@47
  1687
	IFS="$save_ifs"
melunko@47
  1688
	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
melunko@47
  1689
	;;
melunko@47
  1690
melunko@47
  1691
      -Xcompiler)
melunko@47
  1692
	prev=xcompiler
melunko@47
  1693
	continue
melunko@47
  1694
	;;
melunko@47
  1695
melunko@47
  1696
      -Xlinker)
melunko@47
  1697
	prev=xlinker
melunko@47
  1698
	continue
melunko@47
  1699
	;;
melunko@47
  1700
melunko@47
  1701
      -XCClinker)
melunko@47
  1702
	prev=xcclinker
melunko@47
  1703
	continue
melunko@47
  1704
	;;
melunko@47
  1705
melunko@47
  1706
      # Some other compiler flag.
melunko@47
  1707
      -* | +*)
melunko@47
  1708
	# Unknown arguments in both finalize_command and compile_command need
melunko@47
  1709
	# to be aesthetically quoted because they are evaled later.
melunko@47
  1710
	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
melunko@47
  1711
	case $arg in
melunko@47
  1712
	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
melunko@47
  1713
	  arg="\"$arg\""
melunko@47
  1714
	  ;;
melunko@47
  1715
	esac
melunko@47
  1716
	;;
melunko@47
  1717
melunko@47
  1718
      *.$objext)
melunko@47
  1719
	# A standard object.
melunko@47
  1720
	objs="$objs $arg"
melunko@47
  1721
	;;
melunko@47
  1722
melunko@47
  1723
      *.lo)
melunko@47
  1724
	# A libtool-controlled object.
melunko@47
  1725
melunko@47
  1726
	# Check to see that this really is a libtool object.
melunko@47
  1727
	if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
melunko@47
  1728
	  pic_object=
melunko@47
  1729
	  non_pic_object=
melunko@47
  1730
melunko@47
  1731
	  # Read the .lo file
melunko@47
  1732
	  # If there is no directory component, then add one.
melunko@47
  1733
	  case $arg in
melunko@47
  1734
	  */* | *\\*) . $arg ;;
melunko@47
  1735
	  *) . ./$arg ;;
melunko@47
  1736
	  esac
melunko@47
  1737
melunko@47
  1738
	  if test -z "$pic_object" || \
melunko@47
  1739
	     test -z "$non_pic_object" ||
melunko@47
  1740
	     test "$pic_object" = none && \
melunko@47
  1741
	     test "$non_pic_object" = none; then
melunko@47
  1742
	    $echo "$modename: cannot find name of object for \`$arg'" 1>&2
melunko@47
  1743
	    exit $EXIT_FAILURE
melunko@47
  1744
	  fi
melunko@47
  1745
melunko@47
  1746
	  # Extract subdirectory from the argument.
melunko@47
  1747
	  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
melunko@47
  1748
	  if test "X$xdir" = "X$arg"; then
melunko@47
  1749
	    xdir=
melunko@47
  1750
 	  else
melunko@47
  1751
	    xdir="$xdir/"
melunko@47
  1752
	  fi
melunko@47
  1753
melunko@47
  1754
	  if test "$pic_object" != none; then
melunko@47
  1755
	    # Prepend the subdirectory the object is found in.
melunko@47
  1756
	    pic_object="$xdir$pic_object"
melunko@47
  1757
melunko@47
  1758
	    if test "$prev" = dlfiles; then
melunko@47
  1759
	      if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
melunko@47
  1760
		dlfiles="$dlfiles $pic_object"
melunko@47
  1761
		prev=
melunko@47
  1762
		continue
melunko@47
  1763
	      else
melunko@47
  1764
		# If libtool objects are unsupported, then we need to preload.
melunko@47
  1765
		prev=dlprefiles
melunko@47
  1766
	      fi
melunko@47
  1767
	    fi
melunko@47
  1768
melunko@47
  1769
	    # CHECK ME:  I think I busted this.  -Ossama
melunko@47
  1770
	    if test "$prev" = dlprefiles; then
melunko@47
  1771
	      # Preload the old-style object.
melunko@47
  1772
	      dlprefiles="$dlprefiles $pic_object"
melunko@47
  1773
	      prev=
melunko@47
  1774
	    fi
melunko@47
  1775
melunko@47
  1776
	    # A PIC object.
melunko@47
  1777
	    libobjs="$libobjs $pic_object"
melunko@47
  1778
	    arg="$pic_object"
melunko@47
  1779
	  fi
melunko@47
  1780
melunko@47
  1781
	  # Non-PIC object.
melunko@47
  1782
	  if test "$non_pic_object" != none; then
melunko@47
  1783
	    # Prepend the subdirectory the object is found in.
melunko@47
  1784
	    non_pic_object="$xdir$non_pic_object"
melunko@47
  1785
melunko@47
  1786
	    # A standard non-PIC object
melunko@47
  1787
	    non_pic_objects="$non_pic_objects $non_pic_object"
melunko@47
  1788
	    if test -z "$pic_object" || test "$pic_object" = none ; then
melunko@47
  1789
	      arg="$non_pic_object"
melunko@47
  1790
	    fi
melunko@47
  1791
	  fi
melunko@47
  1792
	else
melunko@47
  1793
	  # Only an error if not doing a dry-run.
melunko@47
  1794
	  if test -z "$run"; then
melunko@47
  1795
	    $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
melunko@47
  1796
	    exit $EXIT_FAILURE
melunko@47
  1797
	  else
melunko@47
  1798
	    # Dry-run case.
melunko@47
  1799
melunko@47
  1800
	    # Extract subdirectory from the argument.
melunko@47
  1801
	    xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
melunko@47
  1802
	    if test "X$xdir" = "X$arg"; then
melunko@47
  1803
	      xdir=
melunko@47
  1804
	    else
melunko@47
  1805
	      xdir="$xdir/"
melunko@47
  1806
	    fi
melunko@47
  1807
melunko@47
  1808
	    pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
melunko@47
  1809
	    non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
melunko@47
  1810
	    libobjs="$libobjs $pic_object"
melunko@47
  1811
	    non_pic_objects="$non_pic_objects $non_pic_object"
melunko@47
  1812
	  fi
melunko@47
  1813
	fi
melunko@47
  1814
	;;
melunko@47
  1815
melunko@47
  1816
      *.$libext)
melunko@47
  1817
	# An archive.
melunko@47
  1818
	deplibs="$deplibs $arg"
melunko@47
  1819
	old_deplibs="$old_deplibs $arg"
melunko@47
  1820
	continue
melunko@47
  1821
	;;
melunko@47
  1822
melunko@47
  1823
      *.la)
melunko@47
  1824
	# A libtool-controlled library.
melunko@47
  1825
melunko@47
  1826
	if test "$prev" = dlfiles; then
melunko@47
  1827
	  # This library was specified with -dlopen.
melunko@47
  1828
	  dlfiles="$dlfiles $arg"
melunko@47
  1829
	  prev=
melunko@47
  1830
	elif test "$prev" = dlprefiles; then
melunko@47
  1831
	  # The library was specified with -dlpreopen.
melunko@47
  1832
	  dlprefiles="$dlprefiles $arg"
melunko@47
  1833
	  prev=
melunko@47
  1834
	else
melunko@47
  1835
	  deplibs="$deplibs $arg"
melunko@47
  1836
	fi
melunko@47
  1837
	continue
melunko@47
  1838
	;;
melunko@47
  1839
melunko@47
  1840
      # Some other compiler argument.
melunko@47
  1841
      *)
melunko@47
  1842
	# Unknown arguments in both finalize_command and compile_command need
melunko@47
  1843
	# to be aesthetically quoted because they are evaled later.
melunko@47
  1844
	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
melunko@47
  1845
	case $arg in
melunko@47
  1846
	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
melunko@47
  1847
	  arg="\"$arg\""
melunko@47
  1848
	  ;;
melunko@47
  1849
	esac
melunko@47
  1850
	;;
melunko@47
  1851
      esac # arg
melunko@47
  1852
melunko@47
  1853
      # Now actually substitute the argument into the commands.
melunko@47
  1854
      if test -n "$arg"; then
melunko@47
  1855
	compile_command="$compile_command $arg"
melunko@47
  1856
	finalize_command="$finalize_command $arg"
melunko@47
  1857
      fi
melunko@47
  1858
    done # argument parsing loop
melunko@47
  1859
melunko@47
  1860
    if test -n "$prev"; then
melunko@47
  1861
      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
melunko@47
  1862
      $echo "$help" 1>&2
melunko@47
  1863
      exit $EXIT_FAILURE
melunko@47
  1864
    fi
melunko@47
  1865
melunko@47
  1866
    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
melunko@47
  1867
      eval arg=\"$export_dynamic_flag_spec\"
melunko@47
  1868
      compile_command="$compile_command $arg"
melunko@47
  1869
      finalize_command="$finalize_command $arg"
melunko@47
  1870
    fi
melunko@47
  1871
melunko@47
  1872
    oldlibs=
melunko@47
  1873
    # calculate the name of the file, without its directory
melunko@47
  1874
    outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
melunko@47
  1875
    libobjs_save="$libobjs"
melunko@47
  1876
melunko@47
  1877
    if test -n "$shlibpath_var"; then
melunko@47
  1878
      # get the directories listed in $shlibpath_var
melunko@47
  1879
      eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
melunko@47
  1880
    else
melunko@47
  1881
      shlib_search_path=
melunko@47
  1882
    fi
melunko@47
  1883
    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
melunko@47
  1884
    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
melunko@47
  1885
melunko@47
  1886
    output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
melunko@47
  1887
    if test "X$output_objdir" = "X$output"; then
melunko@47
  1888
      output_objdir="$objdir"
melunko@47
  1889
    else
melunko@47
  1890
      output_objdir="$output_objdir/$objdir"
melunko@47
  1891
    fi
melunko@47
  1892
    # Create the object directory.
melunko@47
  1893
    if test ! -d "$output_objdir"; then
melunko@47
  1894
      $show "$mkdir $output_objdir"
melunko@47
  1895
      $run $mkdir $output_objdir
melunko@47
  1896
      status=$?
melunko@47
  1897
      if test "$status" -ne 0 && test ! -d "$output_objdir"; then
melunko@47
  1898
	exit $status
melunko@47
  1899
      fi
melunko@47
  1900
    fi
melunko@47
  1901
melunko@47
  1902
    # Determine the type of output
melunko@47
  1903
    case $output in
melunko@47
  1904
    "")
melunko@47
  1905
      $echo "$modename: you must specify an output file" 1>&2
melunko@47
  1906
      $echo "$help" 1>&2
melunko@47
  1907
      exit $EXIT_FAILURE
melunko@47
  1908
      ;;
melunko@47
  1909
    *.$libext) linkmode=oldlib ;;
melunko@47
  1910
    *.lo | *.$objext) linkmode=obj ;;
melunko@47
  1911
    *.la) linkmode=lib ;;
melunko@47
  1912
    *) linkmode=prog ;; # Anything else should be a program.
melunko@47
  1913
    esac
melunko@47
  1914
melunko@47
  1915
    case $host in
melunko@47
  1916
    *cygwin* | *mingw* | *pw32*)
melunko@47
  1917
      # don't eliminate duplications in $postdeps and $predeps
melunko@47
  1918
      duplicate_compiler_generated_deps=yes
melunko@47
  1919
      ;;
melunko@47
  1920
    *)
melunko@47
  1921
      duplicate_compiler_generated_deps=$duplicate_deps
melunko@47
  1922
      ;;
melunko@47
  1923
    esac
melunko@47
  1924
    specialdeplibs=
melunko@47
  1925
melunko@47
  1926
    libs=
melunko@47
  1927
    # Find all interdependent deplibs by searching for libraries
melunko@47
  1928
    # that are linked more than once (e.g. -la -lb -la)
melunko@47
  1929
    for deplib in $deplibs; do
melunko@47
  1930
      if test "X$duplicate_deps" = "Xyes" ; then
melunko@47
  1931
	case "$libs " in
melunko@47
  1932
	*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
melunko@47
  1933
	esac
melunko@47
  1934
      fi
melunko@47
  1935
      libs="$libs $deplib"
melunko@47
  1936
    done
melunko@47
  1937
melunko@47
  1938
    if test "$linkmode" = lib; then
melunko@47
  1939
      libs="$predeps $libs $compiler_lib_search_path $postdeps"
melunko@47
  1940
melunko@47
  1941
      # Compute libraries that are listed more than once in $predeps
melunko@47
  1942
      # $postdeps and mark them as special (i.e., whose duplicates are
melunko@47
  1943
      # not to be eliminated).
melunko@47
  1944
      pre_post_deps=
melunko@47
  1945
      if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
melunko@47
  1946
	for pre_post_dep in $predeps $postdeps; do
melunko@47
  1947
	  case "$pre_post_deps " in
melunko@47
  1948
	  *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
melunko@47
  1949
	  esac
melunko@47
  1950
	  pre_post_deps="$pre_post_deps $pre_post_dep"
melunko@47
  1951
	done
melunko@47
  1952
      fi
melunko@47
  1953
      pre_post_deps=
melunko@47
  1954
    fi
melunko@47
  1955
melunko@47
  1956
    deplibs=
melunko@47
  1957
    newdependency_libs=
melunko@47
  1958
    newlib_search_path=
melunko@47
  1959
    need_relink=no # whether we're linking any uninstalled libtool libraries
melunko@47
  1960
    notinst_deplibs= # not-installed libtool libraries
melunko@47
  1961
    notinst_path= # paths that contain not-installed libtool libraries
melunko@47
  1962
    case $linkmode in
melunko@47
  1963
    lib)
melunko@47
  1964
	passes="conv link"
melunko@47
  1965
	for file in $dlfiles $dlprefiles; do
melunko@47
  1966
	  case $file in
melunko@47
  1967
	  *.la) ;;
melunko@47
  1968
	  *)
melunko@47
  1969
	    $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
melunko@47
  1970
	    exit $EXIT_FAILURE
melunko@47
  1971
	    ;;
melunko@47
  1972
	  esac
melunko@47
  1973
	done
melunko@47
  1974
	;;
melunko@47
  1975
    prog)
melunko@47
  1976
	compile_deplibs=
melunko@47
  1977
	finalize_deplibs=
melunko@47
  1978
	alldeplibs=no
melunko@47
  1979
	newdlfiles=
melunko@47
  1980
	newdlprefiles=
melunko@47
  1981
	passes="conv scan dlopen dlpreopen link"
melunko@47
  1982
	;;
melunko@47
  1983
    *)  passes="conv"
melunko@47
  1984
	;;
melunko@47
  1985
    esac
melunko@47
  1986
    for pass in $passes; do
melunko@47
  1987
      if test "$linkmode,$pass" = "lib,link" ||
melunko@47
  1988
	 test "$linkmode,$pass" = "prog,scan"; then
melunko@47
  1989
	libs="$deplibs"
melunko@47
  1990
	deplibs=
melunko@47
  1991
      fi
melunko@47
  1992
      if test "$linkmode" = prog; then
melunko@47
  1993
	case $pass in
melunko@47
  1994
	dlopen) libs="$dlfiles" ;;
melunko@47
  1995
	dlpreopen) libs="$dlprefiles" ;;
melunko@47
  1996
	link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
melunko@47
  1997
	esac
melunko@47
  1998
      fi
melunko@47
  1999
      if test "$pass" = dlopen; then
melunko@47
  2000
	# Collect dlpreopened libraries
melunko@47
  2001
	save_deplibs="$deplibs"
melunko@47
  2002
	deplibs=
melunko@47
  2003
      fi
melunko@47
  2004
      for deplib in $libs; do
melunko@47
  2005
	lib=
melunko@47
  2006
	found=no
melunko@47
  2007
	case $deplib in
melunko@47
  2008
	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
melunko@47
  2009
	  if test "$linkmode,$pass" = "prog,link"; then
melunko@47
  2010
	    compile_deplibs="$deplib $compile_deplibs"
melunko@47
  2011
	    finalize_deplibs="$deplib $finalize_deplibs"
melunko@47
  2012
	  else
melunko@47
  2013
	    compiler_flags="$compiler_flags $deplib"
melunko@47
  2014
	  fi
melunko@47
  2015
	  continue
melunko@47
  2016
	  ;;
melunko@47
  2017
	-l*)
melunko@47
  2018
	  if test "$linkmode" != lib && test "$linkmode" != prog; then
melunko@47
  2019
	    $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
melunko@47
  2020
	    continue
melunko@47
  2021
	  fi
melunko@47
  2022
	  name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
melunko@47
  2023
	  for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
melunko@47
  2024
	    for search_ext in .la $std_shrext .so .a; do
melunko@47
  2025
	      # Search the libtool library
melunko@47
  2026
	      lib="$searchdir/lib${name}${search_ext}"
melunko@47
  2027
	      if test -f "$lib"; then
melunko@47
  2028
		if test "$search_ext" = ".la"; then
melunko@47
  2029
		  found=yes
melunko@47
  2030
		else
melunko@47
  2031
		  found=no
melunko@47
  2032
		fi
melunko@47
  2033
		break 2
melunko@47
  2034
	      fi
melunko@47
  2035
	    done
melunko@47
  2036
	  done
melunko@47
  2037
	  if test "$found" != yes; then
melunko@47
  2038
	    # deplib doesn't seem to be a libtool library
melunko@47
  2039
	    if test "$linkmode,$pass" = "prog,link"; then
melunko@47
  2040
	      compile_deplibs="$deplib $compile_deplibs"
melunko@47
  2041
	      finalize_deplibs="$deplib $finalize_deplibs"
melunko@47
  2042
	    else
melunko@47
  2043
	      deplibs="$deplib $deplibs"
melunko@47
  2044
	      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
melunko@47
  2045
	    fi
melunko@47
  2046
	    continue
melunko@47
  2047
	  else # deplib is a libtool library
melunko@47
  2048
	    # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
melunko@47
  2049
	    # We need to do some special things here, and not later.
melunko@47
  2050
	    if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
melunko@47
  2051
	      case " $predeps $postdeps " in
melunko@47
  2052
	      *" $deplib "*)
melunko@47
  2053
		if (${SED} -e '2q' $lib |
melunko@47
  2054
                    grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
melunko@47
  2055
		  library_names=
melunko@47
  2056
		  old_library=
melunko@47
  2057
		  case $lib in
melunko@47
  2058
		  */* | *\\*) . $lib ;;
melunko@47
  2059
		  *) . ./$lib ;;
melunko@47
  2060
		  esac
melunko@47
  2061
		  for l in $old_library $library_names; do
melunko@47
  2062
		    ll="$l"
melunko@47
  2063
		  done
melunko@47
  2064
		  if test "X$ll" = "X$old_library" ; then # only static version available
melunko@47
  2065
		    found=no
melunko@47
  2066
		    ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
melunko@47
  2067
		    test "X$ladir" = "X$lib" && ladir="."
melunko@47
  2068
		    lib=$ladir/$old_library
melunko@47
  2069
		    if test "$linkmode,$pass" = "prog,link"; then
melunko@47
  2070
		      compile_deplibs="$deplib $compile_deplibs"
melunko@47
  2071
		      finalize_deplibs="$deplib $finalize_deplibs"
melunko@47
  2072
		    else
melunko@47
  2073
		      deplibs="$deplib $deplibs"
melunko@47
  2074
		      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
melunko@47
  2075
		    fi
melunko@47
  2076
		    continue
melunko@47
  2077
		  fi
melunko@47
  2078
		fi
melunko@47
  2079
	        ;;
melunko@47
  2080
	      *) ;;
melunko@47
  2081
	      esac
melunko@47
  2082
	    fi
melunko@47
  2083
	  fi
melunko@47
  2084
	  ;; # -l
melunko@47
  2085
	-L*)
melunko@47
  2086
	  case $linkmode in
melunko@47
  2087
	  lib)
melunko@47
  2088
	    deplibs="$deplib $deplibs"
melunko@47
  2089
	    test "$pass" = conv && continue
melunko@47
  2090
	    newdependency_libs="$deplib $newdependency_libs"
melunko@47
  2091
	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
melunko@47
  2092
	    ;;
melunko@47
  2093
	  prog)
melunko@47
  2094
	    if test "$pass" = conv; then
melunko@47
  2095
	      deplibs="$deplib $deplibs"
melunko@47
  2096
	      continue
melunko@47
  2097
	    fi
melunko@47
  2098
	    if test "$pass" = scan; then
melunko@47
  2099
	      deplibs="$deplib $deplibs"
melunko@47
  2100
	    else
melunko@47
  2101
	      compile_deplibs="$deplib $compile_deplibs"
melunko@47
  2102
	      finalize_deplibs="$deplib $finalize_deplibs"
melunko@47
  2103
	    fi
melunko@47
  2104
	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
melunko@47
  2105
	    ;;
melunko@47
  2106
	  *)
melunko@47
  2107
	    $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
melunko@47
  2108
	    ;;
melunko@47
  2109
	  esac # linkmode
melunko@47
  2110
	  continue
melunko@47
  2111
	  ;; # -L
melunko@47
  2112
	-R*)
melunko@47
  2113
	  if test "$pass" = link; then
melunko@47
  2114
	    dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
melunko@47
  2115
	    # Make sure the xrpath contains only unique directories.
melunko@47
  2116
	    case "$xrpath " in
melunko@47
  2117
	    *" $dir "*) ;;
melunko@47
  2118
	    *) xrpath="$xrpath $dir" ;;
melunko@47
  2119
	    esac
melunko@47
  2120
	  fi
melunko@47
  2121
	  deplibs="$deplib $deplibs"
melunko@47
  2122
	  continue
melunko@47
  2123
	  ;;
melunko@47
  2124
	*.la) lib="$deplib" ;;
melunko@47
  2125
	*.$libext)
melunko@47
  2126
	  if test "$pass" = conv; then
melunko@47
  2127
	    deplibs="$deplib $deplibs"
melunko@47
  2128
	    continue
melunko@47
  2129
	  fi
melunko@47
  2130
	  case $linkmode in
melunko@47
  2131
	  lib)
melunko@47
  2132
	    valid_a_lib=no
melunko@47
  2133
	    case $deplibs_check_method in
melunko@47
  2134
	      match_pattern*)
melunko@47
  2135
		set dummy $deplibs_check_method
melunko@47
  2136
	        match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
melunko@47
  2137
		if eval $echo \"$deplib\" 2>/dev/null \
melunko@47
  2138
		    | $SED 10q \
melunko@47
  2139
		    | $EGREP "$match_pattern_regex" > /dev/null; then
melunko@47
  2140
		  valid_a_lib=yes
melunko@47
  2141
		fi
melunko@47
  2142
		;;
melunko@47
  2143
	      pass_all)
melunko@47
  2144
		valid_a_lib=yes
melunko@47
  2145
		;;
melunko@47
  2146
            esac
melunko@47
  2147
	    if test "$valid_a_lib" != yes; then
melunko@47
  2148
	      $echo
melunko@47
  2149
	      $echo "*** Warning: Trying to link with static lib archive $deplib."
melunko@47
  2150
	      $echo "*** I have the capability to make that library automatically link in when"
melunko@47
  2151
	      $echo "*** you link to this library.  But I can only do this if you have a"
melunko@47
  2152
	      $echo "*** shared version of the library, which you do not appear to have"
melunko@47
  2153
	      $echo "*** because the file extensions .$libext of this argument makes me believe"
melunko@47
  2154
	      $echo "*** that it is just a static archive that I should not used here."
melunko@47
  2155
	    else
melunko@47
  2156
	      $echo
melunko@47
  2157
	      $echo "*** Warning: Linking the shared library $output against the"
melunko@47
  2158
	      $echo "*** static library $deplib is not portable!"
melunko@47
  2159
	      deplibs="$deplib $deplibs"
melunko@47
  2160
	    fi
melunko@47
  2161
	    continue
melunko@47
  2162
	    ;;
melunko@47
  2163
	  prog)
melunko@47
  2164
	    if test "$pass" != link; then
melunko@47
  2165
	      deplibs="$deplib $deplibs"
melunko@47
  2166
	    else
melunko@47
  2167
	      compile_deplibs="$deplib $compile_deplibs"
melunko@47
  2168
	      finalize_deplibs="$deplib $finalize_deplibs"
melunko@47
  2169
	    fi
melunko@47
  2170
	    continue
melunko@47
  2171
	    ;;
melunko@47
  2172
	  esac # linkmode
melunko@47
  2173
	  ;; # *.$libext
melunko@47
  2174
	*.lo | *.$objext)
melunko@47
  2175
	  if test "$pass" = conv; then
melunko@47
  2176
	    deplibs="$deplib $deplibs"
melunko@47
  2177
	  elif test "$linkmode" = prog; then
melunko@47
  2178
	    if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
melunko@47
  2179
	      # If there is no dlopen support or we're linking statically,
melunko@47
  2180
	      # we need to preload.
melunko@47
  2181
	      newdlprefiles="$newdlprefiles $deplib"
melunko@47
  2182
	      compile_deplibs="$deplib $compile_deplibs"
melunko@47
  2183
	      finalize_deplibs="$deplib $finalize_deplibs"
melunko@47
  2184
	    else
melunko@47
  2185
	      newdlfiles="$newdlfiles $deplib"
melunko@47
  2186
	    fi
melunko@47
  2187
	  fi
melunko@47
  2188
	  continue
melunko@47
  2189
	  ;;
melunko@47
  2190
	%DEPLIBS%)
melunko@47
  2191
	  alldeplibs=yes
melunko@47
  2192
	  continue
melunko@47
  2193
	  ;;
melunko@47
  2194
	esac # case $deplib
melunko@47
  2195
	if test "$found" = yes || test -f "$lib"; then :
melunko@47
  2196
	else
melunko@47
  2197
	  $echo "$modename: cannot find the library \`$lib'" 1>&2
melunko@47
  2198
	  exit $EXIT_FAILURE
melunko@47
  2199
	fi
melunko@47
  2200
melunko@47
  2201
	# Check to see that this really is a libtool archive.
melunko@47
  2202
	if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
melunko@47
  2203
	else
melunko@47
  2204
	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
melunko@47
  2205
	  exit $EXIT_FAILURE
melunko@47
  2206
	fi
melunko@47
  2207
melunko@47
  2208
	ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
melunko@47
  2209
	test "X$ladir" = "X$lib" && ladir="."
melunko@47
  2210
melunko@47
  2211
	dlname=
melunko@47
  2212
	dlopen=
melunko@47
  2213
	dlpreopen=
melunko@47
  2214
	libdir=
melunko@47
  2215
	library_names=
melunko@47
  2216
	old_library=
melunko@47
  2217
	# If the library was installed with an old release of libtool,
melunko@47
  2218
	# it will not redefine variables installed, or shouldnotlink
melunko@47
  2219
	installed=yes
melunko@47
  2220
	shouldnotlink=no
melunko@47
  2221
	avoidtemprpath=
melunko@47
  2222
melunko@47
  2223
melunko@47
  2224
	# Read the .la file
melunko@47
  2225
	case $lib in
melunko@47
  2226
	*/* | *\\*) . $lib ;;
melunko@47
  2227
	*) . ./$lib ;;
melunko@47
  2228
	esac
melunko@47
  2229
melunko@47
  2230
	if test "$linkmode,$pass" = "lib,link" ||
melunko@47
  2231
	   test "$linkmode,$pass" = "prog,scan" ||
melunko@47
  2232
	   { test "$linkmode" != prog && test "$linkmode" != lib; }; then
melunko@47
  2233
	  test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
melunko@47
  2234
	  test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
melunko@47
  2235
	fi
melunko@47
  2236
melunko@47
  2237
	if test "$pass" = conv; then
melunko@47
  2238
	  # Only check for convenience libraries
melunko@47
  2239
	  deplibs="$lib $deplibs"
melunko@47
  2240
	  if test -z "$libdir"; then
melunko@47
  2241
	    if test -z "$old_library"; then
melunko@47
  2242
	      $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
melunko@47
  2243
	      exit $EXIT_FAILURE
melunko@47
  2244
	    fi
melunko@47
  2245
	    # It is a libtool convenience library, so add in its objects.
melunko@47
  2246
	    convenience="$convenience $ladir/$objdir/$old_library"
melunko@47
  2247
	    old_convenience="$old_convenience $ladir/$objdir/$old_library"
melunko@47
  2248
	    tmp_libs=
melunko@47
  2249
	    for deplib in $dependency_libs; do
melunko@47
  2250
	      deplibs="$deplib $deplibs"
melunko@47
  2251
              if test "X$duplicate_deps" = "Xyes" ; then
melunko@47
  2252
	        case "$tmp_libs " in
melunko@47
  2253
	        *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
melunko@47
  2254
	        esac
melunko@47
  2255
              fi
melunko@47
  2256
	      tmp_libs="$tmp_libs $deplib"
melunko@47
  2257
	    done
melunko@47
  2258
	  elif test "$linkmode" != prog && test "$linkmode" != lib; then
melunko@47
  2259
	    $echo "$modename: \`$lib' is not a convenience library" 1>&2
melunko@47
  2260
	    exit $EXIT_FAILURE
melunko@47
  2261
	  fi
melunko@47
  2262
	  continue
melunko@47
  2263
	fi # $pass = conv
melunko@47
  2264
melunko@47
  2265
melunko@47
  2266
	# Get the name of the library we link against.
melunko@47
  2267
	linklib=
melunko@47
  2268
	for l in $old_library $library_names; do
melunko@47
  2269
	  linklib="$l"
melunko@47
  2270
	done
melunko@47
  2271
	if test -z "$linklib"; then
melunko@47
  2272
	  $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
melunko@47
  2273
	  exit $EXIT_FAILURE
melunko@47
  2274
	fi
melunko@47
  2275
melunko@47
  2276
	# This library was specified with -dlopen.
melunko@47
  2277
	if test "$pass" = dlopen; then
melunko@47
  2278
	  if test -z "$libdir"; then
melunko@47
  2279
	    $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
melunko@47
  2280
	    exit $EXIT_FAILURE
melunko@47
  2281
	  fi
melunko@47
  2282
	  if test -z "$dlname" ||
melunko@47
  2283
	     test "$dlopen_support" != yes ||
melunko@47
  2284
	     test "$build_libtool_libs" = no; then
melunko@47
  2285
	    # If there is no dlname, no dlopen support or we're linking
melunko@47
  2286
	    # statically, we need to preload.  We also need to preload any
melunko@47
  2287
	    # dependent libraries so libltdl's deplib preloader doesn't
melunko@47
  2288
	    # bomb out in the load deplibs phase.
melunko@47
  2289
	    dlprefiles="$dlprefiles $lib $dependency_libs"
melunko@47
  2290
	  else
melunko@47
  2291
	    newdlfiles="$newdlfiles $lib"
melunko@47
  2292
	  fi
melunko@47
  2293
	  continue
melunko@47
  2294
	fi # $pass = dlopen
melunko@47
  2295
melunko@47
  2296
	# We need an absolute path.
melunko@47
  2297
	case $ladir in
melunko@47
  2298
	[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
melunko@47
  2299
	*)
melunko@47
  2300
	  abs_ladir=`cd "$ladir" && pwd`
melunko@47
  2301
	  if test -z "$abs_ladir"; then
melunko@47
  2302
	    $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
melunko@47
  2303
	    $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
melunko@47
  2304
	    abs_ladir="$ladir"
melunko@47
  2305
	  fi
melunko@47
  2306
	  ;;
melunko@47
  2307
	esac
melunko@47
  2308
	laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
melunko@47
  2309
melunko@47
  2310
	# Find the relevant object directory and library name.
melunko@47
  2311
	if test "X$installed" = Xyes; then
melunko@47
  2312
	  if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
melunko@47
  2313
	    $echo "$modename: warning: library \`$lib' was moved." 1>&2
melunko@47
  2314
	    dir="$ladir"
melunko@47
  2315
	    absdir="$abs_ladir"
melunko@47
  2316
	    libdir="$abs_ladir"
melunko@47
  2317
	  else
melunko@47
  2318
	    dir="$libdir"
melunko@47
  2319
	    absdir="$libdir"
melunko@47
  2320
	  fi
melunko@47
  2321
	  test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
melunko@47
  2322
	else
melunko@47
  2323
	  if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
melunko@47
  2324
	    dir="$ladir"
melunko@47
  2325
	    absdir="$abs_ladir"
melunko@47
  2326
	    # Remove this search path later
melunko@47
  2327
	    notinst_path="$notinst_path $abs_ladir"
melunko@47
  2328
	  else
melunko@47
  2329
	    dir="$ladir/$objdir"
melunko@47
  2330
	    absdir="$abs_ladir/$objdir"
melunko@47
  2331
	    # Remove this search path later
melunko@47
  2332
	    notinst_path="$notinst_path $abs_ladir"
melunko@47
  2333
	  fi
melunko@47
  2334
	fi # $installed = yes
melunko@47
  2335
	name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
melunko@47
  2336
melunko@47
  2337
	# This library was specified with -dlpreopen.
melunko@47
  2338
	if test "$pass" = dlpreopen; then
melunko@47
  2339
	  if test -z "$libdir"; then
melunko@47
  2340
	    $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
melunko@47
  2341
	    exit $EXIT_FAILURE
melunko@47
  2342
	  fi
melunko@47
  2343
	  # Prefer using a static library (so that no silly _DYNAMIC symbols
melunko@47
  2344
	  # are required to link).
melunko@47
  2345
	  if test -n "$old_library"; then
melunko@47
  2346
	    newdlprefiles="$newdlprefiles $dir/$old_library"
melunko@47
  2347
	  # Otherwise, use the dlname, so that lt_dlopen finds it.
melunko@47
  2348
	  elif test -n "$dlname"; then
melunko@47
  2349
	    newdlprefiles="$newdlprefiles $dir/$dlname"
melunko@47
  2350
	  else
melunko@47
  2351
	    newdlprefiles="$newdlprefiles $dir/$linklib"
melunko@47
  2352
	  fi
melunko@47
  2353
	fi # $pass = dlpreopen
melunko@47
  2354
melunko@47
  2355
	if test -z "$libdir"; then
melunko@47
  2356
	  # Link the convenience library
melunko@47
  2357
	  if test "$linkmode" = lib; then
melunko@47
  2358
	    deplibs="$dir/$old_library $deplibs"
melunko@47
  2359
	  elif test "$linkmode,$pass" = "prog,link"; then
melunko@47
  2360
	    compile_deplibs="$dir/$old_library $compile_deplibs"
melunko@47
  2361
	    finalize_deplibs="$dir/$old_library $finalize_deplibs"
melunko@47
  2362
	  else
melunko@47
  2363
	    deplibs="$lib $deplibs" # used for prog,scan pass
melunko@47
  2364
	  fi
melunko@47
  2365
	  continue
melunko@47
  2366
	fi
melunko@47
  2367
melunko@47
  2368
melunko@47
  2369
	if test "$linkmode" = prog && test "$pass" != link; then
melunko@47
  2370
	  newlib_search_path="$newlib_search_path $ladir"
melunko@47
  2371
	  deplibs="$lib $deplibs"
melunko@47
  2372
melunko@47
  2373
	  linkalldeplibs=no
melunko@47
  2374
	  if test "$link_all_deplibs" != no || test -z "$library_names" ||
melunko@47
  2375
	     test "$build_libtool_libs" = no; then
melunko@47
  2376
	    linkalldeplibs=yes
melunko@47
  2377
	  fi
melunko@47
  2378
melunko@47
  2379
	  tmp_libs=
melunko@47
  2380
	  for deplib in $dependency_libs; do
melunko@47
  2381
	    case $deplib in
melunko@47
  2382
	    -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
melunko@47
  2383
	    esac
melunko@47
  2384
	    # Need to link against all dependency_libs?
melunko@47
  2385
	    if test "$linkalldeplibs" = yes; then
melunko@47
  2386
	      deplibs="$deplib $deplibs"
melunko@47
  2387
	    else
melunko@47
  2388
	      # Need to hardcode shared library paths
melunko@47
  2389
	      # or/and link against static libraries
melunko@47
  2390
	      newdependency_libs="$deplib $newdependency_libs"
melunko@47
  2391
	    fi
melunko@47
  2392
	    if test "X$duplicate_deps" = "Xyes" ; then
melunko@47
  2393
	      case "$tmp_libs " in
melunko@47
  2394
	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
melunko@47
  2395
	      esac
melunko@47
  2396
	    fi
melunko@47
  2397
	    tmp_libs="$tmp_libs $deplib"
melunko@47
  2398
	  done # for deplib
melunko@47
  2399
	  continue
melunko@47
  2400
	fi # $linkmode = prog...
melunko@47
  2401
melunko@47
  2402
	if test "$linkmode,$pass" = "prog,link"; then
melunko@47
  2403
	  if test -n "$library_names" &&
melunko@47
  2404
	     { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
melunko@47
  2405
	    # We need to hardcode the library path
melunko@47
  2406
	    if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
melunko@47
  2407
	      # Make sure the rpath contains only unique directories.
melunko@47
  2408
	      case "$temp_rpath " in
melunko@47
  2409
	      *" $dir "*) ;;
melunko@47
  2410
	      *" $absdir "*) ;;
melunko@47
  2411
	      *) temp_rpath="$temp_rpath $absdir" ;;
melunko@47
  2412
	      esac
melunko@47
  2413
	    fi
melunko@47
  2414
melunko@47
  2415
	    # Hardcode the library path.
melunko@47
  2416
	    # Skip directories that are in the system default run-time
melunko@47
  2417
	    # search path.
melunko@47
  2418
	    case " $sys_lib_dlsearch_path " in
melunko@47
  2419
	    *" $absdir "*) ;;
melunko@47
  2420
	    *)
melunko@47
  2421
	      case "$compile_rpath " in
melunko@47
  2422
	      *" $absdir "*) ;;
melunko@47
  2423
	      *) compile_rpath="$compile_rpath $absdir"
melunko@47
  2424
	      esac
melunko@47
  2425
	      ;;
melunko@47
  2426
	    esac
melunko@47
  2427
	    case " $sys_lib_dlsearch_path " in
melunko@47
  2428
	    *" $libdir "*) ;;
melunko@47
  2429
	    *)
melunko@47
  2430
	      case "$finalize_rpath " in
melunko@47
  2431
	      *" $libdir "*) ;;
melunko@47
  2432
	      *) finalize_rpath="$finalize_rpath $libdir"
melunko@47
  2433
	      esac
melunko@47
  2434
	      ;;
melunko@47
  2435
	    esac
melunko@47
  2436
	  fi # $linkmode,$pass = prog,link...
melunko@47
  2437
melunko@47
  2438
	  if test "$alldeplibs" = yes &&
melunko@47
  2439
	     { test "$deplibs_check_method" = pass_all ||
melunko@47
  2440
	       { test "$build_libtool_libs" = yes &&
melunko@47
  2441
		 test -n "$library_names"; }; }; then
melunko@47
  2442
	    # We only need to search for static libraries
melunko@47
  2443
	    continue
melunko@47
  2444
	  fi
melunko@47
  2445
	fi
melunko@47
  2446
melunko@47
  2447
	link_static=no # Whether the deplib will be linked statically
melunko@47
  2448
	if test -n "$library_names" &&
melunko@47
  2449
	   { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
melunko@47
  2450
	  if test "$installed" = no; then
melunko@47
  2451
	    notinst_deplibs="$notinst_deplibs $lib"
melunko@47
  2452
	    need_relink=yes
melunko@47
  2453
	  fi
melunko@47
  2454
	  # This is a shared library
melunko@47
  2455
melunko@47
  2456
	  # Warn about portability, can't link against -module's on
melunko@47
  2457
	  # some systems (darwin)
melunko@47
  2458
	  if test "$shouldnotlink" = yes && test "$pass" = link ; then
melunko@47
  2459
	    $echo
melunko@47
  2460
	    if test "$linkmode" = prog; then
melunko@47
  2461
	      $echo "*** Warning: Linking the executable $output against the loadable module"
melunko@47
  2462
	    else
melunko@47
  2463
	      $echo "*** Warning: Linking the shared library $output against the loadable module"
melunko@47
  2464
	    fi
melunko@47
  2465
	    $echo "*** $linklib is not portable!"
melunko@47
  2466
	  fi
melunko@47
  2467
	  if test "$linkmode" = lib &&
melunko@47
  2468
	     test "$hardcode_into_libs" = yes; then
melunko@47
  2469
	    # Hardcode the library path.
melunko@47
  2470
	    # Skip directories that are in the system default run-time
melunko@47
  2471
	    # search path.
melunko@47
  2472
	    case " $sys_lib_dlsearch_path " in
melunko@47
  2473
	    *" $absdir "*) ;;
melunko@47
  2474
	    *)
melunko@47
  2475
	      case "$compile_rpath " in
melunko@47
  2476
	      *" $absdir "*) ;;
melunko@47
  2477
	      *) compile_rpath="$compile_rpath $absdir"
melunko@47
  2478
	      esac
melunko@47
  2479
	      ;;
melunko@47
  2480
	    esac
melunko@47
  2481
	    case " $sys_lib_dlsearch_path " in
melunko@47
  2482
	    *" $libdir "*) ;;
melunko@47
  2483
	    *)
melunko@47
  2484
	      case "$finalize_rpath " in
melunko@47
  2485
	      *" $libdir "*) ;;
melunko@47
  2486
	      *) finalize_rpath="$finalize_rpath $libdir"
melunko@47
  2487
	      esac
melunko@47
  2488
	      ;;
melunko@47
  2489
	    esac
melunko@47
  2490
	  fi
melunko@47
  2491
melunko@47
  2492
	  if test -n "$old_archive_from_expsyms_cmds"; then
melunko@47
  2493
	    # figure out the soname
melunko@47
  2494
	    set dummy $library_names
melunko@47
  2495
	    realname="$2"
melunko@47
  2496
	    shift; shift
melunko@47
  2497
	    libname=`eval \\$echo \"$libname_spec\"`
melunko@47
  2498
	    # use dlname if we got it. it's perfectly good, no?
melunko@47
  2499
	    if test -n "$dlname"; then
melunko@47
  2500
	      soname="$dlname"
melunko@47
  2501
	    elif test -n "$soname_spec"; then
melunko@47
  2502
	      # bleh windows
melunko@47
  2503
	      case $host in
melunko@47
  2504
	      *cygwin* | mingw*)
melunko@47
  2505
		major=`expr $current - $age`
melunko@47
  2506
		versuffix="-$major"
melunko@47
  2507
		;;
melunko@47
  2508
	      esac
melunko@47
  2509
	      eval soname=\"$soname_spec\"
melunko@47
  2510
	    else
melunko@47
  2511
	      soname="$realname"
melunko@47
  2512
	    fi
melunko@47
  2513
melunko@47
  2514
	    # Make a new name for the extract_expsyms_cmds to use
melunko@47
  2515
	    soroot="$soname"
melunko@47
  2516
	    soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
melunko@47
  2517
	    newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
melunko@47
  2518
melunko@47
  2519
	    # If the library has no export list, then create one now
melunko@47
  2520
	    if test -f "$output_objdir/$soname-def"; then :
melunko@47
  2521
	    else
melunko@47
  2522
	      $show "extracting exported symbol list from \`$soname'"
melunko@47
  2523
	      save_ifs="$IFS"; IFS='~'
melunko@47
  2524
	      cmds=$extract_expsyms_cmds
melunko@47
  2525
	      for cmd in $cmds; do
melunko@47
  2526
		IFS="$save_ifs"
melunko@47
  2527
		eval cmd=\"$cmd\"
melunko@47
  2528
		$show "$cmd"
melunko@47
  2529
		$run eval "$cmd" || exit $?
melunko@47
  2530
	      done
melunko@47
  2531
	      IFS="$save_ifs"
melunko@47
  2532
	    fi
melunko@47
  2533
melunko@47
  2534
	    # Create $newlib
melunko@47
  2535
	    if test -f "$output_objdir/$newlib"; then :; else
melunko@47
  2536
	      $show "generating import library for \`$soname'"
melunko@47
  2537
	      save_ifs="$IFS"; IFS='~'
melunko@47
  2538
	      cmds=$old_archive_from_expsyms_cmds
melunko@47
  2539
	      for cmd in $cmds; do
melunko@47
  2540
		IFS="$save_ifs"
melunko@47
  2541
		eval cmd=\"$cmd\"
melunko@47
  2542
		$show "$cmd"
melunko@47
  2543
		$run eval "$cmd" || exit $?
melunko@47
  2544
	      done
melunko@47
  2545
	      IFS="$save_ifs"
melunko@47
  2546
	    fi
melunko@47
  2547
	    # make sure the library variables are pointing to the new library
melunko@47
  2548
	    dir=$output_objdir
melunko@47
  2549
	    linklib=$newlib
melunko@47
  2550
	  fi # test -n "$old_archive_from_expsyms_cmds"
melunko@47
  2551
melunko@47
  2552
	  if test "$linkmode" = prog || test "$mode" != relink; then
melunko@47
  2553
	    add_shlibpath=
melunko@47
  2554
	    add_dir=
melunko@47
  2555
	    add=
melunko@47
  2556
	    lib_linked=yes
melunko@47
  2557
	    case $hardcode_action in
melunko@47
  2558
	    immediate | unsupported)
melunko@47
  2559
	      if test "$hardcode_direct" = no; then
melunko@47
  2560
		add="$dir/$linklib"
melunko@47
  2561
		case $host in
melunko@47
  2562
		  *-*-sco3.2v5* ) add_dir="-L$dir" ;;
melunko@47
  2563
		  *-*-darwin* )
melunko@47
  2564
		    # if the lib is a module then we can not link against
melunko@47
  2565
		    # it, someone is ignoring the new warnings I added
melunko@47
  2566
		    if /usr/bin/file -L $add 2> /dev/null | $EGREP "bundle" >/dev/null ; then
melunko@47
  2567
		      $echo "** Warning, lib $linklib is a module, not a shared library"
melunko@47
  2568
		      if test -z "$old_library" ; then
melunko@47
  2569
		        $echo
melunko@47
  2570
		        $echo "** And there doesn't seem to be a static archive available"
melunko@47
  2571
		        $echo "** The link will probably fail, sorry"
melunko@47
  2572
		      else
melunko@47
  2573
		        add="$dir/$old_library"
melunko@47
  2574
		      fi
melunko@47
  2575
		    fi
melunko@47
  2576
		esac
melunko@47
  2577
	      elif test "$hardcode_minus_L" = no; then
melunko@47
  2578
		case $host in
melunko@47
  2579
		*-*-sunos*) add_shlibpath="$dir" ;;
melunko@47
  2580
		esac
melunko@47
  2581
		add_dir="-L$dir"
melunko@47
  2582
		add="-l$name"
melunko@47
  2583
	      elif test "$hardcode_shlibpath_var" = no; then
melunko@47
  2584
		add_shlibpath="$dir"
melunko@47
  2585
		add="-l$name"
melunko@47
  2586
	      else
melunko@47
  2587
		lib_linked=no
melunko@47
  2588
	      fi
melunko@47
  2589
	      ;;
melunko@47
  2590
	    relink)
melunko@47
  2591
	      if test "$hardcode_direct" = yes; then
melunko@47
  2592
		add="$dir/$linklib"
melunko@47
  2593
	      elif test "$hardcode_minus_L" = yes; then
melunko@47
  2594
		add_dir="-L$dir"
melunko@47
  2595
		# Try looking first in the location we're being installed to.
melunko@47
  2596
		if test -n "$inst_prefix_dir"; then
melunko@47
  2597
		  case $libdir in
melunko@47
  2598
		    [\\/]*)
melunko@47
  2599
		      add_dir="$add_dir -L$inst_prefix_dir$libdir"
melunko@47
  2600
		      ;;
melunko@47
  2601
		  esac
melunko@47
  2602
		fi
melunko@47
  2603
		add="-l$name"
melunko@47
  2604
	      elif test "$hardcode_shlibpath_var" = yes; then
melunko@47
  2605
		add_shlibpath="$dir"
melunko@47
  2606
		add="-l$name"
melunko@47
  2607
	      else
melunko@47
  2608
		lib_linked=no
melunko@47
  2609
	      fi
melunko@47
  2610
	      ;;
melunko@47
  2611
	    *) lib_linked=no ;;
melunko@47
  2612
	    esac
melunko@47
  2613
melunko@47
  2614
	    if test "$lib_linked" != yes; then
melunko@47
  2615
	      $echo "$modename: configuration error: unsupported hardcode properties"
melunko@47
  2616
	      exit $EXIT_FAILURE
melunko@47
  2617
	    fi
melunko@47
  2618
melunko@47
  2619
	    if test -n "$add_shlibpath"; then
melunko@47
  2620
	      case :$compile_shlibpath: in
melunko@47
  2621
	      *":$add_shlibpath:"*) ;;
melunko@47
  2622
	      *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
melunko@47
  2623
	      esac
melunko@47
  2624
	    fi
melunko@47
  2625
	    if test "$linkmode" = prog; then
melunko@47
  2626
	      test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
melunko@47
  2627
	      test -n "$add" && compile_deplibs="$add $compile_deplibs"
melunko@47
  2628
	    else
melunko@47
  2629
	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
melunko@47
  2630
	      test -n "$add" && deplibs="$add $deplibs"
melunko@47
  2631
	      if test "$hardcode_direct" != yes && \
melunko@47
  2632
		 test "$hardcode_minus_L" != yes && \
melunko@47
  2633
		 test "$hardcode_shlibpath_var" = yes; then
melunko@47
  2634
		case :$finalize_shlibpath: in
melunko@47
  2635
		*":$libdir:"*) ;;
melunko@47
  2636
		*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
melunko@47
  2637
		esac
melunko@47
  2638
	      fi
melunko@47
  2639
	    fi
melunko@47
  2640
	  fi
melunko@47
  2641
melunko@47
  2642
	  if test "$linkmode" = prog || test "$mode" = relink; then
melunko@47
  2643
	    add_shlibpath=
melunko@47
  2644
	    add_dir=
melunko@47
  2645
	    add=
melunko@47
  2646
	    # Finalize command for both is simple: just hardcode it.
melunko@47
  2647
	    if test "$hardcode_direct" = yes; then
melunko@47
  2648
	      add="$libdir/$linklib"
melunko@47
  2649
	    elif test "$hardcode_minus_L" = yes; then
melunko@47
  2650
	      add_dir="-L$libdir"
melunko@47
  2651
	      add="-l$name"
melunko@47
  2652
	    elif test "$hardcode_shlibpath_var" = yes; then
melunko@47
  2653
	      case :$finalize_shlibpath: in
melunko@47
  2654
	      *":$libdir:"*) ;;
melunko@47
  2655
	      *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
melunko@47
  2656
	      esac
melunko@47
  2657
	      add="-l$name"
melunko@47
  2658
	    elif test "$hardcode_automatic" = yes; then
melunko@47
  2659
	      if test -n "$inst_prefix_dir" &&
melunko@47
  2660
		 test -f "$inst_prefix_dir$libdir/$linklib" ; then
melunko@47
  2661
	        add="$inst_prefix_dir$libdir/$linklib"
melunko@47
  2662
	      else
melunko@47
  2663
	        add="$libdir/$linklib"
melunko@47
  2664
	      fi
melunko@47
  2665
	    else
melunko@47
  2666
	      # We cannot seem to hardcode it, guess we'll fake it.
melunko@47
  2667
	      add_dir="-L$libdir"
melunko@47
  2668
	      # Try looking first in the location we're being installed to.
melunko@47
  2669
	      if test -n "$inst_prefix_dir"; then
melunko@47
  2670
		case $libdir in
melunko@47
  2671
		  [\\/]*)
melunko@47
  2672
		    add_dir="$add_dir -L$inst_prefix_dir$libdir"
melunko@47
  2673
		    ;;
melunko@47
  2674
		esac
melunko@47
  2675
	      fi
melunko@47
  2676
	      add="-l$name"
melunko@47
  2677
	    fi
melunko@47
  2678
melunko@47
  2679
	    if test "$linkmode" = prog; then
melunko@47
  2680
	      test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
melunko@47
  2681
	      test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
melunko@47
  2682
	    else
melunko@47
  2683
	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
melunko@47
  2684
	      test -n "$add" && deplibs="$add $deplibs"
melunko@47
  2685
	    fi
melunko@47
  2686
	  fi
melunko@47
  2687
	elif test "$linkmode" = prog; then
melunko@47
  2688
	  # Here we assume that one of hardcode_direct or hardcode_minus_L
melunko@47
  2689
	  # is not unsupported.  This is valid on all known static and
melunko@47
  2690
	  # shared platforms.
melunko@47
  2691
	  if test "$hardcode_direct" != unsupported; then
melunko@47
  2692
	    test -n "$old_library" && linklib="$old_library"
melunko@47
  2693
	    compile_deplibs="$dir/$linklib $compile_deplibs"
melunko@47
  2694
	    finalize_deplibs="$dir/$linklib $finalize_deplibs"
melunko@47
  2695
	  else
melunko@47
  2696
	    compile_deplibs="-l$name -L$dir $compile_deplibs"
melunko@47
  2697
	    finalize_deplibs="-l$name -L$dir $finalize_deplibs"
melunko@47
  2698
	  fi
melunko@47
  2699
	elif test "$build_libtool_libs" = yes; then
melunko@47
  2700
	  # Not a shared library
melunko@47
  2701
	  if test "$deplibs_check_method" != pass_all; then
melunko@47
  2702
	    # We're trying link a shared library against a static one
melunko@47
  2703
	    # but the system doesn't support it.
melunko@47
  2704
melunko@47
  2705
	    # Just print a warning and add the library to dependency_libs so
melunko@47
  2706
	    # that the program can be linked against the static library.
melunko@47
  2707
	    $echo
melunko@47
  2708
	    $echo "*** Warning: This system can not link to static lib archive $lib."
melunko@47
  2709
	    $echo "*** I have the capability to make that library automatically link in when"
melunko@47
  2710
	    $echo "*** you link to this library.  But I can only do this if you have a"
melunko@47
  2711
	    $echo "*** shared version of the library, which you do not appear to have."
melunko@47
  2712
	    if test "$module" = yes; then
melunko@47
  2713
	      $echo "*** But as you try to build a module library, libtool will still create "
melunko@47
  2714
	      $echo "*** a static module, that should work as long as the dlopening application"
melunko@47
  2715
	      $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
melunko@47
  2716
	      if test -z "$global_symbol_pipe"; then
melunko@47
  2717
		$echo
melunko@47
  2718
		$echo "*** However, this would only work if libtool was able to extract symbol"
melunko@47
  2719
		$echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
melunko@47
  2720
		$echo "*** not find such a program.  So, this module is probably useless."
melunko@47
  2721
		$echo "*** \`nm' from GNU binutils and a full rebuild may help."
melunko@47
  2722
	      fi
melunko@47
  2723
	      if test "$build_old_libs" = no; then
melunko@47
  2724
		build_libtool_libs=module
melunko@47
  2725
		build_old_libs=yes
melunko@47
  2726
	      else
melunko@47
  2727
		build_libtool_libs=no
melunko@47
  2728
	      fi
melunko@47
  2729
	    fi
melunko@47
  2730
	  else
melunko@47
  2731
	    deplibs="$dir/$old_library $deplibs"
melunko@47
  2732
	    link_static=yes
melunko@47
  2733
	  fi
melunko@47
  2734
	fi # link shared/static library?
melunko@47
  2735
melunko@47
  2736
	if test "$linkmode" = lib; then
melunko@47
  2737
	  if test -n "$dependency_libs" &&
melunko@47
  2738
	     { test "$hardcode_into_libs" != yes ||
melunko@47
  2739
	       test "$build_old_libs" = yes ||
melunko@47
  2740
	       test "$link_static" = yes; }; then
melunko@47
  2741
	    # Extract -R from dependency_libs
melunko@47
  2742
	    temp_deplibs=
melunko@47
  2743
	    for libdir in $dependency_libs; do
melunko@47
  2744
	      case $libdir in
melunko@47
  2745
	      -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
melunko@47
  2746
		   case " $xrpath " in
melunko@47
  2747
		   *" $temp_xrpath "*) ;;
melunko@47
  2748
		   *) xrpath="$xrpath $temp_xrpath";;
melunko@47
  2749
		   esac;;
melunko@47
  2750
	      *) temp_deplibs="$temp_deplibs $libdir";;
melunko@47
  2751
	      esac
melunko@47
  2752
	    done
melunko@47
  2753
	    dependency_libs="$temp_deplibs"
melunko@47
  2754
	  fi
melunko@47
  2755
melunko@47
  2756
	  newlib_search_path="$newlib_search_path $absdir"
melunko@47
  2757
	  # Link against this library
melunko@47
  2758
	  test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
melunko@47
  2759
	  # ... and its dependency_libs
melunko@47
  2760
	  tmp_libs=
melunko@47
  2761
	  for deplib in $dependency_libs; do
melunko@47
  2762
	    newdependency_libs="$deplib $newdependency_libs"
melunko@47
  2763
	    if test "X$duplicate_deps" = "Xyes" ; then
melunko@47
  2764
	      case "$tmp_libs " in
melunko@47
  2765
	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
melunko@47
  2766
	      esac
melunko@47
  2767
	    fi
melunko@47
  2768
	    tmp_libs="$tmp_libs $deplib"
melunko@47
  2769
	  done
melunko@47
  2770
melunko@47
  2771
	  if test "$link_all_deplibs" != no; then
melunko@47
  2772
	    # Add the search paths of all dependency libraries
melunko@47
  2773
	    for deplib in $dependency_libs; do
melunko@47
  2774
	      case $deplib in
melunko@47
  2775
	      -L*) path="$deplib" ;;
melunko@47
  2776
	      *.la)
melunko@47
  2777
		dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
melunko@47
  2778
		test "X$dir" = "X$deplib" && dir="."
melunko@47
  2779
		# We need an absolute path.
melunko@47
  2780
		case $dir in
melunko@47
  2781
		[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
melunko@47
  2782
		*)
melunko@47
  2783
		  absdir=`cd "$dir" && pwd`
melunko@47
  2784
		  if test -z "$absdir"; then
melunko@47
  2785
		    $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
melunko@47
  2786
		    absdir="$dir"
melunko@47
  2787
		  fi
melunko@47
  2788
		  ;;
melunko@47
  2789
		esac
melunko@47
  2790
		if grep "^installed=no" $deplib > /dev/null; then
melunko@47
  2791
		  path="$absdir/$objdir"
melunko@47
  2792
		else
melunko@47
  2793
		  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
melunko@47
  2794
		  if test -z "$libdir"; then
melunko@47
  2795
		    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
melunko@47
  2796
		    exit $EXIT_FAILURE
melunko@47
  2797
		  fi
melunko@47
  2798
		  if test "$absdir" != "$libdir"; then
melunko@47
  2799
		    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
melunko@47
  2800
		  fi
melunko@47
  2801
		  path="$absdir"
melunko@47
  2802
		fi
melunko@47
  2803
		depdepl=
melunko@47
  2804
		case $host in
melunko@47
  2805
		*-*-darwin*)
melunko@47
  2806
		  # we do not want to link against static libs,
melunko@47
  2807
		  # but need to link against shared
melunko@47
  2808
		  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
melunko@47
  2809
		  if test -n "$deplibrary_names" ; then
melunko@47
  2810
		    for tmp in $deplibrary_names ; do
melunko@47
  2811
		      depdepl=$tmp
melunko@47
  2812
		    done
melunko@47
  2813
		    if test -f "$path/$depdepl" ; then
melunko@47
  2814
		      depdepl="$path/$depdepl"
melunko@47
  2815
		    fi
melunko@47
  2816
		    # do not add paths which are already there
melunko@47
  2817
		    case " $newlib_search_path " in
melunko@47
  2818
		    *" $path "*) ;;
melunko@47
  2819
		    *) newlib_search_path="$newlib_search_path $path";;
melunko@47
  2820
		    esac
melunko@47
  2821
		  fi
melunko@47
  2822
		  path=""
melunko@47
  2823
		  ;;
melunko@47
  2824
		*)
melunko@47
  2825
		  path="-L$path"
melunko@47
  2826
		  ;;
melunko@47
  2827
		esac
melunko@47
  2828
		;;
melunko@47
  2829
	      -l*)
melunko@47
  2830
		case $host in
melunko@47
  2831
		*-*-darwin*)
melunko@47
  2832
		  # Again, we only want to link against shared libraries
melunko@47
  2833
		  eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
melunko@47
  2834
		  for tmp in $newlib_search_path ; do
melunko@47
  2835
		    if test -f "$tmp/lib$tmp_libs.dylib" ; then
melunko@47
  2836
		      eval depdepl="$tmp/lib$tmp_libs.dylib"
melunko@47
  2837
		      break
melunko@47
  2838
		    fi
melunko@47
  2839
		  done
melunko@47
  2840
		  path=""
melunko@47
  2841
		  ;;
melunko@47
  2842
		*) continue ;;
melunko@47
  2843
		esac
melunko@47
  2844
		;;
melunko@47
  2845
	      *) continue ;;
melunko@47
  2846
	      esac
melunko@47
  2847
	      case " $deplibs " in
melunko@47
  2848
	      *" $path "*) ;;
melunko@47
  2849
	      *) deplibs="$path $deplibs" ;;
melunko@47
  2850
	      esac
melunko@47
  2851
	      case " $deplibs " in
melunko@47
  2852
	      *" $depdepl "*) ;;
melunko@47
  2853
	      *) deplibs="$depdepl $deplibs" ;;
melunko@47
  2854
	      esac
melunko@47
  2855
	    done
melunko@47
  2856
	  fi # link_all_deplibs != no
melunko@47
  2857
	fi # linkmode = lib
melunko@47
  2858
      done # for deplib in $libs
melunko@47
  2859
      dependency_libs="$newdependency_libs"
melunko@47
  2860
      if test "$pass" = dlpreopen; then
melunko@47
  2861
	# Link the dlpreopened libraries before other libraries
melunko@47
  2862
	for deplib in $save_deplibs; do
melunko@47
  2863
	  deplibs="$deplib $deplibs"
melunko@47
  2864
	done
melunko@47
  2865
      fi
melunko@47
  2866
      if test "$pass" != dlopen; then
melunko@47
  2867
	if test "$pass" != conv; then
melunko@47
  2868
	  # Make sure lib_search_path contains only unique directories.
melunko@47
  2869
	  lib_search_path=
melunko@47
  2870
	  for dir in $newlib_search_path; do
melunko@47
  2871
	    case "$lib_search_path " in
melunko@47
  2872
	    *" $dir "*) ;;
melunko@47
  2873
	    *) lib_search_path="$lib_search_path $dir" ;;
melunko@47
  2874
	    esac
melunko@47
  2875
	  done
melunko@47
  2876
	  newlib_search_path=
melunko@47
  2877
	fi
melunko@47
  2878
melunko@47
  2879
	if test "$linkmode,$pass" != "prog,link"; then
melunko@47
  2880
	  vars="deplibs"
melunko@47
  2881
	else
melunko@47
  2882
	  vars="compile_deplibs finalize_deplibs"
melunko@47
  2883
	fi
melunko@47
  2884
	for var in $vars dependency_libs; do
melunko@47
  2885
	  # Add libraries to $var in reverse order
melunko@47
  2886
	  eval tmp_libs=\"\$$var\"
melunko@47
  2887
	  new_libs=
melunko@47
  2888
	  for deplib in $tmp_libs; do
melunko@47
  2889
	    # FIXME: Pedantically, this is the right thing to do, so
melunko@47
  2890
	    #        that some nasty dependency loop isn't accidentally
melunko@47
  2891
	    #        broken:
melunko@47
  2892
	    #new_libs="$deplib $new_libs"
melunko@47
  2893
	    # Pragmatically, this seems to cause very few problems in
melunko@47
  2894
	    # practice:
melunko@47
  2895
	    case $deplib in
melunko@47
  2896
	    -L*) new_libs="$deplib $new_libs" ;;
melunko@47
  2897
	    -R*) ;;
melunko@47
  2898
	    *)
melunko@47
  2899
	      # And here is the reason: when a library appears more
melunko@47
  2900
	      # than once as an explicit dependence of a library, or
melunko@47
  2901
	      # is implicitly linked in more than once by the
melunko@47
  2902
	      # compiler, it is considered special, and multiple
melunko@47
  2903
	      # occurrences thereof are not removed.  Compare this
melunko@47
  2904
	      # with having the same library being listed as a
melunko@47
  2905
	      # dependency of multiple other libraries: in this case,
melunko@47
  2906
	      # we know (pedantically, we assume) the library does not
melunko@47
  2907
	      # need to be listed more than once, so we keep only the
melunko@47
  2908
	      # last copy.  This is not always right, but it is rare
melunko@47
  2909
	      # enough that we require users that really mean to play
melunko@47
  2910
	      # such unportable linking tricks to link the library
melunko@47
  2911
	      # using -Wl,-lname, so that libtool does not consider it
melunko@47
  2912
	      # for duplicate removal.
melunko@47
  2913
	      case " $specialdeplibs " in
melunko@47
  2914
	      *" $deplib "*) new_libs="$deplib $new_libs" ;;
melunko@47
  2915
	      *)
melunko@47
  2916
		case " $new_libs " in
melunko@47
  2917
		*" $deplib "*) ;;
melunko@47
  2918
		*) new_libs="$deplib $new_libs" ;;
melunko@47
  2919
		esac
melunko@47
  2920
		;;
melunko@47
  2921
	      esac
melunko@47
  2922
	      ;;
melunko@47
  2923
	    esac
melunko@47
  2924
	  done
melunko@47
  2925
	  tmp_libs=
melunko@47
  2926
	  for deplib in $new_libs; do
melunko@47
  2927
	    case $deplib in
melunko@47
  2928
	    -L*)
melunko@47
  2929
	      case " $tmp_libs " in
melunko@47
  2930
	      *" $deplib "*) ;;
melunko@47
  2931
	      *) tmp_libs="$tmp_libs $deplib" ;;
melunko@47
  2932
	      esac
melunko@47
  2933
	      ;;
melunko@47
  2934
	    *) tmp_libs="$tmp_libs $deplib" ;;
melunko@47
  2935
	    esac
melunko@47
  2936
	  done
melunko@47
  2937
	  eval $var=\"$tmp_libs\"
melunko@47
  2938
	done # for var
melunko@47
  2939
      fi
melunko@47
  2940
      # Last step: remove runtime libs from dependency_libs
melunko@47
  2941
      # (they stay in deplibs)
melunko@47
  2942
      tmp_libs=
melunko@47
  2943
      for i in $dependency_libs ; do
melunko@47
  2944
	case " $predeps $postdeps $compiler_lib_search_path " in
melunko@47
  2945
	*" $i "*)
melunko@47
  2946
	  i=""
melunko@47
  2947
	  ;;
melunko@47
  2948
	esac
melunko@47
  2949
	if test -n "$i" ; then
melunko@47
  2950
	  tmp_libs="$tmp_libs $i"
melunko@47
  2951
	fi
melunko@47
  2952
      done
melunko@47
  2953
      dependency_libs=$tmp_libs
melunko@47
  2954
    done # for pass
melunko@47
  2955
    if test "$linkmode" = prog; then
melunko@47
  2956
      dlfiles="$newdlfiles"
melunko@47
  2957
      dlprefiles="$newdlprefiles"
melunko@47
  2958
    fi
melunko@47
  2959
melunko@47
  2960
    case $linkmode in
melunko@47
  2961
    oldlib)
melunko@47
  2962
      if test -n "$deplibs"; then
melunko@47
  2963
	$echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
melunko@47
  2964
      fi
melunko@47
  2965
melunko@47
  2966
      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
melunko@47
  2967
	$echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
melunko@47
  2968
      fi
melunko@47
  2969
melunko@47
  2970
      if test -n "$rpath"; then
melunko@47
  2971
	$echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
melunko@47
  2972
      fi
melunko@47
  2973
melunko@47
  2974
      if test -n "$xrpath"; then
melunko@47
  2975
	$echo "$modename: warning: \`-R' is ignored for archives" 1>&2
melunko@47
  2976
      fi
melunko@47
  2977
melunko@47
  2978
      if test -n "$vinfo"; then
melunko@47
  2979
	$echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
melunko@47
  2980
      fi
melunko@47
  2981
melunko@47
  2982
      if test -n "$release"; then
melunko@47
  2983
	$echo "$modename: warning: \`-release' is ignored for archives" 1>&2
melunko@47
  2984
      fi
melunko@47
  2985
melunko@47
  2986
      if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
melunko@47
  2987
	$echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
melunko@47
  2988
      fi
melunko@47
  2989
melunko@47
  2990
      # Now set the variables for building old libraries.
melunko@47
  2991
      build_libtool_libs=no
melunko@47
  2992
      oldlibs="$output"
melunko@47
  2993
      objs="$objs$old_deplibs"
melunko@47
  2994
      ;;
melunko@47
  2995
melunko@47
  2996
    lib)
melunko@47
  2997
      # Make sure we only generate libraries of the form `libNAME.la'.
melunko@47
  2998
      case $outputname in
melunko@47
  2999
      lib*)
melunko@47
  3000
	name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
melunko@47
  3001
	eval shared_ext=\"$shrext_cmds\"
melunko@47
  3002
	eval libname=\"$libname_spec\"
melunko@47
  3003
	;;
melunko@47
  3004
      *)
melunko@47
  3005
	if test "$module" = no; then
melunko@47
  3006
	  $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
melunko@47
  3007
	  $echo "$help" 1>&2
melunko@47
  3008
	  exit $EXIT_FAILURE
melunko@47
  3009
	fi
melunko@47
  3010
	if test "$need_lib_prefix" != no; then
melunko@47
  3011
	  # Add the "lib" prefix for modules if required
melunko@47
  3012
	  name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
melunko@47
  3013
	  eval shared_ext=\"$shrext_cmds\"
melunko@47
  3014
	  eval libname=\"$libname_spec\"
melunko@47
  3015
	else
melunko@47
  3016
	  libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
melunko@47
  3017
	fi
melunko@47
  3018
	;;
melunko@47
  3019
      esac
melunko@47
  3020
melunko@47
  3021
      if test -n "$objs"; then
melunko@47
  3022
	if test "$deplibs_check_method" != pass_all; then
melunko@47
  3023
	  $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
melunko@47
  3024
	  exit $EXIT_FAILURE
melunko@47
  3025
	else
melunko@47
  3026
	  $echo
melunko@47
  3027
	  $echo "*** Warning: Linking the shared library $output against the non-libtool"
melunko@47
  3028
	  $echo "*** objects $objs is not portable!"
melunko@47
  3029
	  libobjs="$libobjs $objs"
melunko@47
  3030
	fi
melunko@47
  3031
      fi
melunko@47
  3032
melunko@47
  3033
      if test "$dlself" != no; then
melunko@47
  3034
	$echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
melunko@47
  3035
      fi
melunko@47
  3036
melunko@47
  3037
      set dummy $rpath
melunko@47
  3038
      if test "$#" -gt 2; then
melunko@47
  3039
	$echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
melunko@47
  3040
      fi
melunko@47
  3041
      install_libdir="$2"
melunko@47
  3042
melunko@47
  3043
      oldlibs=
melunko@47
  3044
      if test -z "$rpath"; then
melunko@47
  3045
	if test "$build_libtool_libs" = yes; then
melunko@47
  3046
	  # Building a libtool convenience library.
melunko@47
  3047
	  # Some compilers have problems with a `.al' extension so
melunko@47
  3048
	  # convenience libraries should have the same extension an
melunko@47
  3049
	  # archive normally would.
melunko@47
  3050
	  oldlibs="$output_objdir/$libname.$libext $oldlibs"
melunko@47
  3051
	  build_libtool_libs=convenience
melunko@47
  3052
	  build_old_libs=yes
melunko@47
  3053
	fi
melunko@47
  3054
melunko@47
  3055
	if test -n "$vinfo"; then
melunko@47
  3056
	  $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
melunko@47
  3057
	fi
melunko@47
  3058
melunko@47
  3059
	if test -n "$release"; then
melunko@47
  3060
	  $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
melunko@47
  3061
	fi
melunko@47
  3062
      else
melunko@47
  3063
melunko@47
  3064
	# Parse the version information argument.
melunko@47
  3065
	save_ifs="$IFS"; IFS=':'
melunko@47
  3066
	set dummy $vinfo 0 0 0
melunko@47
  3067
	IFS="$save_ifs"
melunko@47
  3068
melunko@47
  3069
	if test -n "$8"; then
melunko@47
  3070
	  $echo "$modename: too many parameters to \`-version-info'" 1>&2
melunko@47
  3071
	  $echo "$help" 1>&2
melunko@47
  3072
	  exit $EXIT_FAILURE
melunko@47
  3073
	fi
melunko@47
  3074
melunko@47
  3075
	# convert absolute version numbers to libtool ages
melunko@47
  3076
	# this retains compatibility with .la files and attempts
melunko@47
  3077
	# to make the code below a bit more comprehensible
melunko@47
  3078
melunko@47
  3079
	case $vinfo_number in
melunko@47
  3080
	yes)
melunko@47
  3081
	  number_major="$2"
melunko@47
  3082
	  number_minor="$3"
melunko@47
  3083
	  number_revision="$4"
melunko@47
  3084
	  #
melunko@47
  3085
	  # There are really only two kinds -- those that
melunko@47
  3086
	  # use the current revision as the major version
melunko@47
  3087
	  # and those that subtract age and use age as
melunko@47
  3088
	  # a minor version.  But, then there is irix
melunko@47
  3089
	  # which has an extra 1 added just for fun
melunko@47
  3090
	  #
melunko@47
  3091
	  case $version_type in
melunko@47
  3092
	  darwin|linux|osf|windows)
melunko@47
  3093
	    current=`expr $number_major + $number_minor`
melunko@47
  3094
	    age="$number_minor"
melunko@47
  3095
	    revision="$number_revision"
melunko@47
  3096
	    ;;
melunko@47
  3097
	  freebsd-aout|freebsd-elf|sunos)
melunko@47
  3098
	    current="$number_major"
melunko@47
  3099
	    revision="$number_minor"
melunko@47
  3100
	    age="0"
melunko@47
  3101
	    ;;
melunko@47
  3102
	  irix|nonstopux)
melunko@47
  3103
	    current=`expr $number_major + $number_minor - 1`
melunko@47
  3104
	    age="$number_minor"
melunko@47
  3105
	    revision="$number_minor"
melunko@47
  3106
	    ;;
melunko@47
  3107
	  esac
melunko@47
  3108
	  ;;
melunko@47
  3109
	no)
melunko@47
  3110
	  current="$2"
melunko@47
  3111
	  revision="$3"
melunko@47
  3112
	  age="$4"
melunko@47
  3113
	  ;;
melunko@47
  3114
	esac
melunko@47
  3115
melunko@47
  3116
	# Check that each of the things are valid numbers.
melunko@47
  3117
	case $current in
melunko@47
  3118
	0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
melunko@47
  3119
	*)
melunko@47
  3120
	  $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
melunko@47
  3121
	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
melunko@47
  3122
	  exit $EXIT_FAILURE
melunko@47
  3123
	  ;;
melunko@47
  3124
	esac
melunko@47
  3125
melunko@47
  3126
	case $revision in
melunko@47
  3127
	0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
melunko@47
  3128
	*)
melunko@47
  3129
	  $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
melunko@47
  3130
	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
melunko@47
  3131
	  exit $EXIT_FAILURE
melunko@47
  3132
	  ;;
melunko@47
  3133
	esac
melunko@47
  3134
melunko@47
  3135
	case $age in
melunko@47
  3136
	0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
melunko@47
  3137
	*)
melunko@47
  3138
	  $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
melunko@47
  3139
	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
melunko@47
  3140
	  exit $EXIT_FAILURE
melunko@47
  3141
	  ;;
melunko@47
  3142
	esac
melunko@47
  3143
melunko@47
  3144
	if test "$age" -gt "$current"; then
melunko@47
  3145
	  $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
melunko@47
  3146
	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
melunko@47
  3147
	  exit $EXIT_FAILURE
melunko@47
  3148
	fi
melunko@47
  3149
melunko@47
  3150
	# Calculate the version variables.
melunko@47
  3151
	major=
melunko@47
  3152
	versuffix=
melunko@47
  3153
	verstring=
melunko@47
  3154
	case $version_type in
melunko@47
  3155
	none) ;;
melunko@47
  3156
melunko@47
  3157
	darwin)
melunko@47
  3158
	  # Like Linux, but with the current version available in
melunko@47
  3159
	  # verstring for coding it into the library header
melunko@47
  3160
	  major=.`expr $current - $age`
melunko@47
  3161
	  versuffix="$major.$age.$revision"
melunko@47
  3162
	  # Darwin ld doesn't like 0 for these options...
melunko@47
  3163
	  minor_current=`expr $current + 1`
melunko@47
  3164
	  verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
melunko@47
  3165
	  ;;
melunko@47
  3166
melunko@47
  3167
	freebsd-aout)
melunko@47
  3168
	  major=".$current"
melunko@47
  3169
	  versuffix=".$current.$revision";
melunko@47
  3170
	  ;;
melunko@47
  3171
melunko@47
  3172
	freebsd-elf)
melunko@47
  3173
	  major=".$current"
melunko@47
  3174
	  versuffix=".$current";
melunko@47
  3175
	  ;;
melunko@47
  3176
melunko@47
  3177
	irix | nonstopux)
melunko@47
  3178
	  major=`expr $current - $age + 1`
melunko@47
  3179
melunko@47
  3180
	  case $version_type in
melunko@47
  3181
	    nonstopux) verstring_prefix=nonstopux ;;
melunko@47
  3182
	    *)         verstring_prefix=sgi ;;
melunko@47
  3183
	  esac
melunko@47
  3184
	  verstring="$verstring_prefix$major.$revision"
melunko@47
  3185
melunko@47
  3186
	  # Add in all the interfaces that we are compatible with.
melunko@47
  3187
	  loop=$revision
melunko@47
  3188
	  while test "$loop" -ne 0; do
melunko@47
  3189
	    iface=`expr $revision - $loop`
melunko@47
  3190
	    loop=`expr $loop - 1`
melunko@47
  3191
	    verstring="$verstring_prefix$major.$iface:$verstring"
melunko@47
  3192
	  done
melunko@47
  3193
melunko@47
  3194
	  # Before this point, $major must not contain `.'.
melunko@47
  3195
	  major=.$major
melunko@47
  3196
	  versuffix="$major.$revision"
melunko@47
  3197
	  ;;
melunko@47
  3198
melunko@47
  3199
	linux)
melunko@47
  3200
	  major=.`expr $current - $age`
melunko@47
  3201
	  versuffix="$major.$age.$revision"
melunko@47
  3202
	  ;;
melunko@47
  3203
melunko@47
  3204
	osf)
melunko@47
  3205
	  major=.`expr $current - $age`
melunko@47
  3206
	  versuffix=".$current.$age.$revision"
melunko@47
  3207
	  verstring="$current.$age.$revision"
melunko@47
  3208
melunko@47
  3209
	  # Add in all the interfaces that we are compatible with.
melunko@47
  3210
	  loop=$age
melunko@47
  3211
	  while test "$loop" -ne 0; do
melunko@47
  3212
	    iface=`expr $current - $loop`
melunko@47
  3213
	    loop=`expr $loop - 1`
melunko@47
  3214
	    verstring="$verstring:${iface}.0"
melunko@47
  3215
	  done
melunko@47
  3216
melunko@47
  3217
	  # Make executables depend on our current version.
melunko@47
  3218
	  verstring="$verstring:${current}.0"
melunko@47
  3219
	  ;;
melunko@47
  3220
melunko@47
  3221
	sunos)
melunko@47
  3222
	  major=".$current"
melunko@47
  3223
	  versuffix=".$current.$revision"
melunko@47
  3224
	  ;;
melunko@47
  3225
melunko@47
  3226
	windows)
melunko@47
  3227
	  # Use '-' rather than '.', since we only want one
melunko@47
  3228
	  # extension on DOS 8.3 filesystems.
melunko@47
  3229
	  major=`expr $current - $age`
melunko@47
  3230
	  versuffix="-$major"
melunko@47
  3231
	  ;;
melunko@47
  3232
melunko@47
  3233
	*)
melunko@47
  3234
	  $echo "$modename: unknown library version type \`$version_type'" 1>&2
melunko@47
  3235
	  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
melunko@47
  3236
	  exit $EXIT_FAILURE
melunko@47
  3237
	  ;;
melunko@47
  3238
	esac
melunko@47
  3239
melunko@47
  3240
	# Clear the version info if we defaulted, and they specified a release.
melunko@47
  3241
	if test -z "$vinfo" && test -n "$release"; then
melunko@47
  3242
	  major=
melunko@47
  3243
	  case $version_type in
melunko@47
  3244
	  darwin)
melunko@47
  3245
	    # we can't check for "0.0" in archive_cmds due to quoting
melunko@47
  3246
	    # problems, so we reset it completely
melunko@47
  3247
	    verstring=
melunko@47
  3248
	    ;;
melunko@47
  3249
	  *)
melunko@47
  3250
	    verstring="0.0"
melunko@47
  3251
	    ;;
melunko@47
  3252
	  esac
melunko@47
  3253
	  if test "$need_version" = no; then
melunko@47
  3254
	    versuffix=
melunko@47
  3255
	  else
melunko@47
  3256
	    versuffix=".0.0"
melunko@47
  3257
	  fi
melunko@47
  3258
	fi
melunko@47
  3259
melunko@47
  3260
	# Remove version info from name if versioning should be avoided
melunko@47
  3261
	if test "$avoid_version" = yes && test "$need_version" = no; then
melunko@47
  3262
	  major=
melunko@47
  3263
	  versuffix=
melunko@47
  3264
	  verstring=""
melunko@47
  3265
	fi
melunko@47
  3266
melunko@47
  3267
	# Check to see if the archive will have undefined symbols.
melunko@47
  3268
	if test "$allow_undefined" = yes; then
melunko@47
  3269
	  if test "$allow_undefined_flag" = unsupported; then
melunko@47
  3270
	    $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
melunko@47
  3271
	    build_libtool_libs=no
melunko@47
  3272
	    build_old_libs=yes
melunko@47
  3273
	  fi
melunko@47
  3274
	else
melunko@47
  3275
	  # Don't allow undefined symbols.
melunko@47
  3276
	  allow_undefined_flag="$no_undefined_flag"
melunko@47
  3277
	fi
melunko@47
  3278
      fi
melunko@47
  3279
melunko@47
  3280
      if test "$mode" != relink; then
melunko@47
  3281
	# Remove our outputs, but don't remove object files since they
melunko@47
  3282
	# may have been created when compiling PIC objects.
melunko@47
  3283
	removelist=
melunko@47
  3284
	tempremovelist=`$echo "$output_objdir/*"`
melunko@47
  3285
	for p in $tempremovelist; do
melunko@47
  3286
	  case $p in
melunko@47
  3287
	    *.$objext)
melunko@47
  3288
	       ;;
melunko@47
  3289
	    $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
melunko@47
  3290
	       if test "X$precious_files_regex" != "X"; then
melunko@47
  3291
	         if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
melunko@47
  3292
	         then
melunko@47
  3293
		   continue
melunko@47
  3294
		 fi
melunko@47
  3295
	       fi
melunko@47
  3296
	       removelist="$removelist $p"
melunko@47
  3297
	       ;;
melunko@47
  3298
	    *) ;;
melunko@47
  3299
	  esac
melunko@47
  3300
	done
melunko@47
  3301
	if test -n "$removelist"; then
melunko@47
  3302
	  $show "${rm}r $removelist"
melunko@47
  3303
	  $run ${rm}r $removelist
melunko@47
  3304
	fi
melunko@47
  3305
      fi
melunko@47
  3306
melunko@47
  3307
      # Now set the variables for building old libraries.
melunko@47
  3308
      if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
melunko@47
  3309
	oldlibs="$oldlibs $output_objdir/$libname.$libext"
melunko@47
  3310
melunko@47
  3311
	# Transform .lo files to .o files.
melunko@47
  3312
	oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
melunko@47
  3313
      fi
melunko@47
  3314
melunko@47
  3315
      # Eliminate all temporary directories.
melunko@47
  3316
      for path in $notinst_path; do
melunko@47
  3317
	lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
melunko@47
  3318
	deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
melunko@47
  3319
	dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
melunko@47
  3320
      done
melunko@47
  3321
melunko@47
  3322
      if test -n "$xrpath"; then
melunko@47
  3323
	# If the user specified any rpath flags, then add them.
melunko@47
  3324
	temp_xrpath=
melunko@47
  3325
	for libdir in $xrpath; do
melunko@47
  3326
	  temp_xrpath="$temp_xrpath -R$libdir"
melunko@47
  3327
	  case "$finalize_rpath " in
melunko@47
  3328
	  *" $libdir "*) ;;
melunko@47
  3329
	  *) finalize_rpath="$finalize_rpath $libdir" ;;
melunko@47
  3330
	  esac
melunko@47
  3331
	done
melunko@47
  3332
	if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
melunko@47
  3333
	  dependency_libs="$temp_xrpath $dependency_libs"
melunko@47
  3334
	fi
melunko@47
  3335
      fi
melunko@47
  3336
melunko@47
  3337
      # Make sure dlfiles contains only unique files that won't be dlpreopened
melunko@47
  3338
      old_dlfiles="$dlfiles"
melunko@47
  3339
      dlfiles=
melunko@47
  3340
      for lib in $old_dlfiles; do
melunko@47
  3341
	case " $dlprefiles $dlfiles " in
melunko@47
  3342
	*" $lib "*) ;;
melunko@47
  3343
	*) dlfiles="$dlfiles $lib" ;;
melunko@47
  3344
	esac
melunko@47
  3345
      done
melunko@47
  3346
melunko@47
  3347
      # Make sure dlprefiles contains only unique files
melunko@47
  3348
      old_dlprefiles="$dlprefiles"
melunko@47
  3349
      dlprefiles=
melunko@47
  3350
      for lib in $old_dlprefiles; do
melunko@47
  3351
	case "$dlprefiles " in
melunko@47
  3352
	*" $lib "*) ;;
melunko@47
  3353
	*) dlprefiles="$dlprefiles $lib" ;;
melunko@47
  3354
	esac
melunko@47
  3355
      done
melunko@47
  3356
melunko@47
  3357
      if test "$build_libtool_libs" = yes; then
melunko@47
  3358
	if test -n "$rpath"; then
melunko@47
  3359
	  case $host in
melunko@47
  3360
	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
melunko@47
  3361
	    # these systems don't actually have a c library (as such)!
melunko@47
  3362
	    ;;
melunko@47
  3363
	  *-*-rhapsody* | *-*-darwin1.[012])
melunko@47
  3364
	    # Rhapsody C library is in the System framework
melunko@47
  3365
	    deplibs="$deplibs -framework System"
melunko@47
  3366
	    ;;
melunko@47
  3367
	  *-*-netbsd*)
melunko@47
  3368
	    # Don't link with libc until the a.out ld.so is fixed.
melunko@47
  3369
	    ;;
melunko@47
  3370
	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
melunko@47
  3371
	    # Do not include libc due to us having libc/libc_r.
melunko@47
  3372
	    test "X$arg" = "X-lc" && continue
melunko@47
  3373
	    ;;
melunko@47
  3374
 	  *)
melunko@47
  3375
	    # Add libc to deplibs on all other systems if necessary.
melunko@47
  3376
	    if test "$build_libtool_need_lc" = "yes"; then
melunko@47
  3377
	      deplibs="$deplibs -lc"
melunko@47
  3378
	    fi
melunko@47
  3379
	    ;;
melunko@47
  3380
	  esac
melunko@47
  3381
	fi
melunko@47
  3382
melunko@47
  3383
	# Transform deplibs into only deplibs that can be linked in shared.
melunko@47
  3384
	name_save=$name
melunko@47
  3385
	libname_save=$libname
melunko@47
  3386
	release_save=$release
melunko@47
  3387
	versuffix_save=$versuffix
melunko@47
  3388
	major_save=$major
melunko@47
  3389
	# I'm not sure if I'm treating the release correctly.  I think
melunko@47
  3390
	# release should show up in the -l (ie -lgmp5) so we don't want to
melunko@47
  3391
	# add it in twice.  Is that correct?
melunko@47
  3392
	release=""
melunko@47
  3393
	versuffix=""
melunko@47
  3394
	major=""
melunko@47
  3395
	newdeplibs=
melunko@47
  3396
	droppeddeps=no
melunko@47
  3397
	case $deplibs_check_method in
melunko@47
  3398
	pass_all)
melunko@47
  3399
	  # Don't check for shared/static.  Everything works.
melunko@47
  3400
	  # This might be a little naive.  We might want to check
melunko@47
  3401
	  # whether the library exists or not.  But this is on
melunko@47
  3402
	  # osf3 & osf4 and I'm not really sure... Just
melunko@47
  3403
	  # implementing what was already the behavior.
melunko@47
  3404
	  newdeplibs=$deplibs
melunko@47
  3405
	  ;;
melunko@47
  3406
	test_compile)
melunko@47
  3407
	  # This code stresses the "libraries are programs" paradigm to its
melunko@47
  3408
	  # limits. Maybe even breaks it.  We compile a program, linking it
melunko@47
  3409
	  # against the deplibs as a proxy for the library.  Then we can check
melunko@47
  3410
	  # whether they linked in statically or dynamically with ldd.
melunko@47
  3411
	  $rm conftest.c
melunko@47
  3412
	  cat > conftest.c <<EOF
melunko@47
  3413
	  int main() { return 0; }
melunko@47
  3414
EOF
melunko@47
  3415
	  $rm conftest
melunko@47
  3416
	  $LTCC -o conftest conftest.c $deplibs
melunko@47
  3417
	  if test "$?" -eq 0 ; then
melunko@47
  3418
	    ldd_output=`ldd conftest`
melunko@47
  3419
	    for i in $deplibs; do
melunko@47
  3420
	      name=`expr $i : '-l\(.*\)'`
melunko@47
  3421
	      # If $name is empty we are operating on a -L argument.
melunko@47
  3422
              if test "$name" != "" && test "$name" -ne "0"; then
melunko@47
  3423
		if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
melunko@47
  3424
		  case " $predeps $postdeps " in
melunko@47
  3425
		  *" $i "*)
melunko@47
  3426
		    newdeplibs="$newdeplibs $i"
melunko@47
  3427
		    i=""
melunko@47
  3428
		    ;;
melunko@47
  3429
		  esac
melunko@47
  3430
	        fi
melunko@47
  3431
		if test -n "$i" ; then
melunko@47
  3432
		  libname=`eval \\$echo \"$libname_spec\"`
melunko@47
  3433
		  deplib_matches=`eval \\$echo \"$library_names_spec\"`
melunko@47
  3434
		  set dummy $deplib_matches
melunko@47
  3435
		  deplib_match=$2
melunko@47
  3436
		  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
melunko@47
  3437
		    newdeplibs="$newdeplibs $i"
melunko@47
  3438
		  else
melunko@47
  3439
		    droppeddeps=yes
melunko@47
  3440
		    $echo
melunko@47
  3441
		    $echo "*** Warning: dynamic linker does not accept needed library $i."
melunko@47
  3442
		    $echo "*** I have the capability to make that library automatically link in when"
melunko@47
  3443
		    $echo "*** you link to this library.  But I can only do this if you have a"
melunko@47
  3444
		    $echo "*** shared version of the library, which I believe you do not have"
melunko@47
  3445
		    $echo "*** because a test_compile did reveal that the linker did not use it for"
melunko@47
  3446
		    $echo "*** its dynamic dependency list that programs get resolved with at runtime."
melunko@47
  3447
		  fi
melunko@47
  3448
		fi
melunko@47
  3449
	      else
melunko@47
  3450
		newdeplibs="$newdeplibs $i"
melunko@47
  3451
	      fi
melunko@47
  3452
	    done
melunko@47
  3453
	  else
melunko@47
  3454
	    # Error occurred in the first compile.  Let's try to salvage
melunko@47
  3455
	    # the situation: Compile a separate program for each library.
melunko@47
  3456
	    for i in $deplibs; do
melunko@47
  3457
	      name=`expr $i : '-l\(.*\)'`
melunko@47
  3458
	      # If $name is empty we are operating on a -L argument.
melunko@47
  3459
              if test "$name" != "" && test "$name" != "0"; then
melunko@47
  3460
		$rm conftest
melunko@47
  3461
		$LTCC -o conftest conftest.c $i
melunko@47
  3462
		# Did it work?
melunko@47
  3463
		if test "$?" -eq 0 ; then
melunko@47
  3464
		  ldd_output=`ldd conftest`
melunko@47
  3465
		  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
melunko@47
  3466
		    case " $predeps $postdeps " in
melunko@47
  3467
		    *" $i "*)
melunko@47
  3468
		      newdeplibs="$newdeplibs $i"
melunko@47
  3469
		      i=""
melunko@47
  3470
		      ;;
melunko@47
  3471
		    esac
melunko@47
  3472
		  fi
melunko@47
  3473
		  if test -n "$i" ; then
melunko@47
  3474
		    libname=`eval \\$echo \"$libname_spec\"`
melunko@47
  3475
		    deplib_matches=`eval \\$echo \"$library_names_spec\"`
melunko@47
  3476
		    set dummy $deplib_matches
melunko@47
  3477
		    deplib_match=$2
melunko@47
  3478
		    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
melunko@47
  3479
		      newdeplibs="$newdeplibs $i"
melunko@47
  3480
		    else
melunko@47
  3481
		      droppeddeps=yes
melunko@47
  3482
		      $echo
melunko@47
  3483
		      $echo "*** Warning: dynamic linker does not accept needed library $i."
melunko@47
  3484
		      $echo "*** I have the capability to make that library automatically link in when"
melunko@47
  3485
		      $echo "*** you link to this library.  But I can only do this if you have a"
melunko@47
  3486
		      $echo "*** shared version of the library, which you do not appear to have"
melunko@47
  3487
		      $echo "*** because a test_compile did reveal that the linker did not use this one"
melunko@47
  3488
		      $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
melunko@47
  3489
		    fi
melunko@47
  3490
		  fi
melunko@47
  3491
		else
melunko@47
  3492
		  droppeddeps=yes
melunko@47
  3493
		  $echo
melunko@47
  3494
		  $echo "*** Warning!  Library $i is needed by this library but I was not able to"
melunko@47
  3495
		  $echo "***  make it link in!  You will probably need to install it or some"
melunko@47
  3496
		  $echo "*** library that it depends on before this library will be fully"
melunko@47
  3497
		  $echo "*** functional.  Installing it before continuing would be even better."
melunko@47
  3498
		fi
melunko@47
  3499
	      else
melunko@47
  3500
		newdeplibs="$newdeplibs $i"
melunko@47
  3501
	      fi
melunko@47
  3502
	    done
melunko@47
  3503
	  fi
melunko@47
  3504
	  ;;
melunko@47
  3505
	file_magic*)
melunko@47
  3506
	  set dummy $deplibs_check_method
melunko@47
  3507
	  file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
melunko@47
  3508
	  for a_deplib in $deplibs; do
melunko@47
  3509
	    name=`expr $a_deplib : '-l\(.*\)'`
melunko@47
  3510
	    # If $name is empty we are operating on a -L argument.
melunko@47
  3511
            if test "$name" != "" && test  "$name" != "0"; then
melunko@47
  3512
	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
melunko@47
  3513
		case " $predeps $postdeps " in
melunko@47
  3514
		*" $a_deplib "*)
melunko@47
  3515
		  newdeplibs="$newdeplibs $a_deplib"
melunko@47
  3516
		  a_deplib=""
melunko@47
  3517
		  ;;
melunko@47
  3518
		esac
melunko@47
  3519
	      fi
melunko@47
  3520
	      if test -n "$a_deplib" ; then
melunko@47
  3521
		libname=`eval \\$echo \"$libname_spec\"`
melunko@47
  3522
		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
melunko@47
  3523
		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
melunko@47
  3524
		  for potent_lib in $potential_libs; do
melunko@47
  3525
		      # Follow soft links.
melunko@47
  3526
		      if ls -lLd "$potent_lib" 2>/dev/null \
melunko@47
  3527
			 | grep " -> " >/dev/null; then
melunko@47
  3528
			continue
melunko@47
  3529
		      fi
melunko@47
  3530
		      # The statement above tries to avoid entering an
melunko@47
  3531
		      # endless loop below, in case of cyclic links.
melunko@47
  3532
		      # We might still enter an endless loop, since a link
melunko@47
  3533
		      # loop can be closed while we follow links,
melunko@47
  3534
		      # but so what?
melunko@47
  3535
		      potlib="$potent_lib"
melunko@47
  3536
		      while test -h "$potlib" 2>/dev/null; do
melunko@47
  3537
			potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
melunko@47
  3538
			case $potliblink in
melunko@47
  3539
			[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
melunko@47
  3540
			*) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
melunko@47
  3541
			esac
melunko@47
  3542
		      done
melunko@47
  3543
		      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
melunko@47
  3544
			 | ${SED} 10q \
melunko@47
  3545
			 | $EGREP "$file_magic_regex" > /dev/null; then
melunko@47
  3546
			newdeplibs="$newdeplibs $a_deplib"
melunko@47
  3547
			a_deplib=""
melunko@47
  3548
			break 2
melunko@47
  3549
		      fi
melunko@47
  3550
		  done
melunko@47
  3551
		done
melunko@47
  3552
	      fi
melunko@47
  3553
	      if test -n "$a_deplib" ; then
melunko@47
  3554
		droppeddeps=yes
melunko@47
  3555
		$echo
melunko@47
  3556
		$echo "*** Warning: linker path does not have real file for library $a_deplib."
melunko@47
  3557
		$echo "*** I have the capability to make that library automatically link in when"
melunko@47
  3558
		$echo "*** you link to this library.  But I can only do this if you have a"
melunko@47
  3559
		$echo "*** shared version of the library, which you do not appear to have"
melunko@47
  3560
		$echo "*** because I did check the linker path looking for a file starting"
melunko@47
  3561
		if test -z "$potlib" ; then
melunko@47
  3562
		  $echo "*** with $libname but no candidates were found. (...for file magic test)"
melunko@47
  3563
		else
melunko@47
  3564
		  $echo "*** with $libname and none of the candidates passed a file format test"
melunko@47
  3565
		  $echo "*** using a file magic. Last file checked: $potlib"
melunko@47
  3566
		fi
melunko@47
  3567
	      fi
melunko@47
  3568
	    else
melunko@47
  3569
	      # Add a -L argument.
melunko@47
  3570
	      newdeplibs="$newdeplibs $a_deplib"
melunko@47
  3571
	    fi
melunko@47
  3572
	  done # Gone through all deplibs.
melunko@47
  3573
	  ;;
melunko@47
  3574
	match_pattern*)
melunko@47
  3575
	  set dummy $deplibs_check_method
melunko@47
  3576
	  match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
melunko@47
  3577
	  for a_deplib in $deplibs; do
melunko@47
  3578
	    name=`expr $a_deplib : '-l\(.*\)'`
melunko@47
  3579
	    # If $name is empty we are operating on a -L argument.
melunko@47
  3580
	    if test -n "$name" && test "$name" != "0"; then
melunko@47
  3581
	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
melunko@47
  3582
		case " $predeps $postdeps " in
melunko@47
  3583
		*" $a_deplib "*)
melunko@47
  3584
		  newdeplibs="$newdeplibs $a_deplib"
melunko@47
  3585
		  a_deplib=""
melunko@47
  3586
		  ;;
melunko@47
  3587
		esac
melunko@47
  3588
	      fi
melunko@47
  3589
	      if test -n "$a_deplib" ; then
melunko@47
  3590
		libname=`eval \\$echo \"$libname_spec\"`
melunko@47
  3591
		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
melunko@47
  3592
		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
melunko@47
  3593
		  for potent_lib in $potential_libs; do
melunko@47
  3594
		    potlib="$potent_lib" # see symlink-check above in file_magic test
melunko@47
  3595
		    if eval $echo \"$potent_lib\" 2>/dev/null \
melunko@47
  3596
		        | ${SED} 10q \
melunko@47
  3597
		        | $EGREP "$match_pattern_regex" > /dev/null; then
melunko@47
  3598
		      newdeplibs="$newdeplibs $a_deplib"
melunko@47
  3599
		      a_deplib=""
melunko@47
  3600
		      break 2
melunko@47
  3601
		    fi
melunko@47
  3602
		  done
melunko@47
  3603
		done
melunko@47
  3604
	      fi
melunko@47
  3605
	      if test -n "$a_deplib" ; then
melunko@47
  3606
		droppeddeps=yes
melunko@47
  3607
		$echo
melunko@47
  3608
		$echo "*** Warning: linker path does not have real file for library $a_deplib."
melunko@47
  3609
		$echo "*** I have the capability to make that library automatically link in when"
melunko@47
  3610
		$echo "*** you link to this library.  But I can only do this if you have a"
melunko@47
  3611
		$echo "*** shared version of the library, which you do not appear to have"
melunko@47
  3612
		$echo "*** because I did check the linker path looking for a file starting"
melunko@47
  3613
		if test -z "$potlib" ; then
melunko@47
  3614
		  $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
melunko@47
  3615
		else
melunko@47
  3616
		  $echo "*** with $libname and none of the candidates passed a file format test"
melunko@47
  3617
		  $echo "*** using a regex pattern. Last file checked: $potlib"
melunko@47
  3618
		fi
melunko@47
  3619
	      fi
melunko@47
  3620
	    else
melunko@47
  3621
	      # Add a -L argument.
melunko@47
  3622
	      newdeplibs="$newdeplibs $a_deplib"
melunko@47
  3623
	    fi
melunko@47
  3624
	  done # Gone through all deplibs.
melunko@47
  3625
	  ;;
melunko@47
  3626
	none | unknown | *)
melunko@47
  3627
	  newdeplibs=""
melunko@47
  3628
	  tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
melunko@47
  3629
	    -e 's/ -[LR][^ ]*//g'`
melunko@47
  3630
	  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
melunko@47
  3631
	    for i in $predeps $postdeps ; do
melunko@47
  3632
	      # can't use Xsed below, because $i might contain '/'
melunko@47
  3633
	      tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
melunko@47
  3634
	    done
melunko@47
  3635
	  fi
melunko@47
  3636
	  if $echo "X $tmp_deplibs" | $Xsed -e 's/[ 	]//g' \
melunko@47
  3637
	    | grep . >/dev/null; then
melunko@47
  3638
	    $echo
melunko@47
  3639
	    if test "X$deplibs_check_method" = "Xnone"; then
melunko@47
  3640
	      $echo "*** Warning: inter-library dependencies are not supported in this platform."
melunko@47
  3641
	    else
melunko@47
  3642
	      $echo "*** Warning: inter-library dependencies are not known to be supported."
melunko@47
  3643
	    fi
melunko@47
  3644
	    $echo "*** All declared inter-library dependencies are being dropped."
melunko@47
  3645
	    droppeddeps=yes
melunko@47
  3646
	  fi
melunko@47
  3647
	  ;;
melunko@47
  3648
	esac
melunko@47
  3649
	versuffix=$versuffix_save
melunko@47
  3650
	major=$major_save
melunko@47
  3651
	release=$release_save
melunko@47
  3652
	libname=$libname_save
melunko@47
  3653
	name=$name_save
melunko@47
  3654
melunko@47
  3655
	case $host in
melunko@47
  3656
	*-*-rhapsody* | *-*-darwin1.[012])
melunko@47
  3657
	  # On Rhapsody replace the C library is the System framework
melunko@47
  3658
	  newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
melunko@47
  3659
	  ;;
melunko@47
  3660
	esac
melunko@47
  3661
melunko@47
  3662
	if test "$droppeddeps" = yes; then
melunko@47
  3663
	  if test "$module" = yes; then
melunko@47
  3664
	    $echo
melunko@47
  3665
	    $echo "*** Warning: libtool could not satisfy all declared inter-library"
melunko@47
  3666
	    $echo "*** dependencies of module $libname.  Therefore, libtool will create"
melunko@47
  3667
	    $echo "*** a static module, that should work as long as the dlopening"
melunko@47
  3668
	    $echo "*** application is linked with the -dlopen flag."
melunko@47
  3669
	    if test -z "$global_symbol_pipe"; then
melunko@47
  3670
	      $echo
melunko@47
  3671
	      $echo "*** However, this would only work if libtool was able to extract symbol"
melunko@47
  3672
	      $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
melunko@47
  3673
	      $echo "*** not find such a program.  So, this module is probably useless."
melunko@47
  3674
	      $echo "*** \`nm' from GNU binutils and a full rebuild may help."
melunko@47
  3675
	    fi
melunko@47
  3676
	    if test "$build_old_libs" = no; then
melunko@47
  3677
	      oldlibs="$output_objdir/$libname.$libext"
melunko@47
  3678
	      build_libtool_libs=module
melunko@47
  3679
	      build_old_libs=yes
melunko@47
  3680
	    else
melunko@47
  3681
	      build_libtool_libs=no
melunko@47
  3682
	    fi
melunko@47
  3683
	  else
melunko@47
  3684
	    $echo "*** The inter-library dependencies that have been dropped here will be"
melunko@47
  3685
	    $echo "*** automatically added whenever a program is linked with this library"
melunko@47
  3686
	    $echo "*** or is declared to -dlopen it."
melunko@47
  3687
melunko@47
  3688
	    if test "$allow_undefined" = no; then
melunko@47
  3689
	      $echo
melunko@47
  3690
	      $echo "*** Since this library must not contain undefined symbols,"
melunko@47
  3691
	      $echo "*** because either the platform does not support them or"
melunko@47
  3692
	      $echo "*** it was explicitly requested with -no-undefined,"
melunko@47
  3693
	      $echo "*** libtool will only create a static version of it."
melunko@47
  3694
	      if test "$build_old_libs" = no; then
melunko@47
  3695
		oldlibs="$output_objdir/$libname.$libext"
melunko@47
  3696
		build_libtool_libs=module
melunko@47
  3697
		build_old_libs=yes
melunko@47
  3698
	      else
melunko@47
  3699
		build_libtool_libs=no
melunko@47
  3700
	      fi
melunko@47
  3701
	    fi
melunko@47
  3702
	  fi
melunko@47
  3703
	fi
melunko@47
  3704
	# Done checking deplibs!
melunko@47
  3705
	deplibs=$newdeplibs
melunko@47
  3706
      fi
melunko@47
  3707
melunko@47
  3708
      # All the library-specific variables (install_libdir is set above).
melunko@47
  3709
      library_names=
melunko@47
  3710
      old_library=
melunko@47
  3711
      dlname=
melunko@47
  3712
melunko@47
  3713
      # Test again, we may have decided not to build it any more
melunko@47
  3714
      if test "$build_libtool_libs" = yes; then
melunko@47
  3715
	if test "$hardcode_into_libs" = yes; then
melunko@47
  3716
	  # Hardcode the library paths
melunko@47
  3717
	  hardcode_libdirs=
melunko@47
  3718
	  dep_rpath=
melunko@47
  3719
	  rpath="$finalize_rpath"
melunko@47
  3720
	  test "$mode" != relink && rpath="$compile_rpath$rpath"
melunko@47
  3721
	  for libdir in $rpath; do
melunko@47
  3722
	    if test -n "$hardcode_libdir_flag_spec"; then
melunko@47
  3723
	      if test -n "$hardcode_libdir_separator"; then
melunko@47
  3724
		if test -z "$hardcode_libdirs"; then
melunko@47
  3725
		  hardcode_libdirs="$libdir"
melunko@47
  3726
		else
melunko@47
  3727
		  # Just accumulate the unique libdirs.
melunko@47
  3728
		  case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
melunko@47
  3729
		  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
melunko@47
  3730
		    ;;
melunko@47
  3731
		  *)
melunko@47
  3732
		    hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
melunko@47
  3733
		    ;;
melunko@47
  3734
		  esac
melunko@47
  3735
		fi
melunko@47
  3736
	      else
melunko@47
  3737
		eval flag=\"$hardcode_libdir_flag_spec\"
melunko@47
  3738
		dep_rpath="$dep_rpath $flag"
melunko@47
  3739
	      fi
melunko@47
  3740
	    elif test -n "$runpath_var"; then
melunko@47
  3741
	      case "$perm_rpath " in
melunko@47
  3742
	      *" $libdir "*) ;;
melunko@47
  3743
	      *) perm_rpath="$perm_rpath $libdir" ;;
melunko@47
  3744
	      esac
melunko@47
  3745
	    fi
melunko@47
  3746
	  done
melunko@47
  3747
	  # Substitute the hardcoded libdirs into the rpath.
melunko@47
  3748
	  if test -n "$hardcode_libdir_separator" &&
melunko@47
  3749
	     test -n "$hardcode_libdirs"; then
melunko@47
  3750
	    libdir="$hardcode_libdirs"
melunko@47
  3751
	    if test -n "$hardcode_libdir_flag_spec_ld"; then
melunko@47
  3752
	      eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
melunko@47
  3753
	    else
melunko@47
  3754
	      eval dep_rpath=\"$hardcode_libdir_flag_spec\"
melunko@47
  3755
	    fi
melunko@47
  3756
	  fi
melunko@47
  3757
	  if test -n "$runpath_var" && test -n "$perm_rpath"; then
melunko@47
  3758
	    # We should set the runpath_var.
melunko@47
  3759
	    rpath=
melunko@47
  3760
	    for dir in $perm_rpath; do
melunko@47
  3761
	      rpath="$rpath$dir:"
melunko@47
  3762
	    done
melunko@47
  3763
	    eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
melunko@47
  3764
	  fi
melunko@47
  3765
	  test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
melunko@47
  3766
	fi
melunko@47
  3767
melunko@47
  3768
	shlibpath="$finalize_shlibpath"
melunko@47
  3769
	test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
melunko@47
  3770
	if test -n "$shlibpath"; then
melunko@47
  3771
	  eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
melunko@47
  3772
	fi
melunko@47
  3773
melunko@47
  3774
	# Get the real and link names of the library.
melunko@47
  3775
	eval shared_ext=\"$shrext_cmds\"
melunko@47
  3776
	eval library_names=\"$library_names_spec\"
melunko@47
  3777
	set dummy $library_names
melunko@47
  3778
	realname="$2"
melunko@47
  3779
	shift; shift
melunko@47
  3780
melunko@47
  3781
	if test -n "$soname_spec"; then
melunko@47
  3782
	  eval soname=\"$soname_spec\"
melunko@47
  3783
	else
melunko@47
  3784
	  soname="$realname"
melunko@47
  3785
	fi
melunko@47
  3786
	if test -z "$dlname"; then
melunko@47
  3787
	  dlname=$soname
melunko@47
  3788
	fi
melunko@47
  3789
melunko@47
  3790
	lib="$output_objdir/$realname"
melunko@47
  3791
	for link
melunko@47
  3792
	do
melunko@47
  3793
	  linknames="$linknames $link"
melunko@47
  3794
	done
melunko@47
  3795
melunko@47
  3796
	# Use standard objects if they are pic
melunko@47
  3797
	test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
melunko@47
  3798
melunko@47
  3799
	# Prepare the list of exported symbols
melunko@47
  3800
	if test -z "$export_symbols"; then
melunko@47
  3801
	  if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
melunko@47
  3802
	    $show "generating symbol list for \`$libname.la'"
melunko@47
  3803
	    export_symbols="$output_objdir/$libname.exp"
melunko@47
  3804
	    $run $rm $export_symbols
melunko@47
  3805
	    cmds=$export_symbols_cmds
melunko@47
  3806
	    save_ifs="$IFS"; IFS='~'
melunko@47
  3807
	    for cmd in $cmds; do
melunko@47
  3808
	      IFS="$save_ifs"
melunko@47
  3809
	      eval cmd=\"$cmd\"
melunko@47
  3810
	      if len=`expr "X$cmd" : ".*"` &&
melunko@47
  3811
	       test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
melunko@47
  3812
	        $show "$cmd"
melunko@47
  3813
	        $run eval "$cmd" || exit $?
melunko@47
  3814
	        skipped_export=false
melunko@47
  3815
	      else
melunko@47
  3816
	        # The command line is too long to execute in one step.
melunko@47
  3817
	        $show "using reloadable object file for export list..."
melunko@47
  3818
	        skipped_export=:
melunko@47
  3819
		# Break out early, otherwise skipped_export may be
melunko@47
  3820
		# set to false by a later but shorter cmd.
melunko@47
  3821
		break
melunko@47
  3822
	      fi
melunko@47
  3823
	    done
melunko@47
  3824
	    IFS="$save_ifs"
melunko@47
  3825
	    if test -n "$export_symbols_regex"; then
melunko@47
  3826
	      $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
melunko@47
  3827
	      $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
melunko@47
  3828
	      $show "$mv \"${export_symbols}T\" \"$export_symbols\""
melunko@47
  3829
	      $run eval '$mv "${export_symbols}T" "$export_symbols"'
melunko@47
  3830
	    fi
melunko@47
  3831
	  fi
melunko@47
  3832
	fi
melunko@47
  3833
melunko@47
  3834
	if test -n "$export_symbols" && test -n "$include_expsyms"; then
melunko@47
  3835
	  $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
melunko@47
  3836
	fi
melunko@47
  3837
melunko@47
  3838
	tmp_deplibs=
melunko@47
  3839
	for test_deplib in $deplibs; do
melunko@47
  3840
		case " $convenience " in
melunko@47
  3841
		*" $test_deplib "*) ;;
melunko@47
  3842
		*)
melunko@47
  3843
			tmp_deplibs="$tmp_deplibs $test_deplib"
melunko@47
  3844
			;;
melunko@47
  3845
		esac
melunko@47
  3846
	done
melunko@47
  3847
	deplibs="$tmp_deplibs"
melunko@47
  3848
melunko@47
  3849
	if test -n "$convenience"; then
melunko@47
  3850
	  if test -n "$whole_archive_flag_spec"; then
melunko@47
  3851
	    save_libobjs=$libobjs
melunko@47
  3852
	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
melunko@47
  3853
	  else
melunko@47
  3854
	    gentop="$output_objdir/${outputname}x"
melunko@47
  3855
	    generated="$generated $gentop"
melunko@47
  3856
melunko@47
  3857
	    func_extract_archives $gentop $convenience
melunko@47
  3858
	    libobjs="$libobjs $func_extract_archives_result"
melunko@47
  3859
	  fi
melunko@47
  3860
	fi
melunko@47
  3861
	
melunko@47
  3862
	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
melunko@47
  3863
	  eval flag=\"$thread_safe_flag_spec\"
melunko@47
  3864
	  linker_flags="$linker_flags $flag"
melunko@47
  3865
	fi
melunko@47
  3866
melunko@47
  3867
	# Make a backup of the uninstalled library when relinking
melunko@47
  3868
	if test "$mode" = relink; then
melunko@47
  3869
	  $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
melunko@47
  3870
	fi
melunko@47
  3871
melunko@47
  3872
	# Do each of the archive commands.
melunko@47
  3873
	if test "$module" = yes && test -n "$module_cmds" ; then
melunko@47
  3874
	  if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
melunko@47
  3875
	    eval test_cmds=\"$module_expsym_cmds\"
melunko@47
  3876
	    cmds=$module_expsym_cmds
melunko@47
  3877
	  else
melunko@47
  3878
	    eval test_cmds=\"$module_cmds\"
melunko@47
  3879
	    cmds=$module_cmds
melunko@47
  3880
	  fi
melunko@47
  3881
	else
melunko@47
  3882
	if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
melunko@47
  3883
	  eval test_cmds=\"$archive_expsym_cmds\"
melunko@47
  3884
	  cmds=$archive_expsym_cmds
melunko@47
  3885
	else
melunko@47
  3886
	  eval test_cmds=\"$archive_cmds\"
melunko@47
  3887
	  cmds=$archive_cmds
melunko@47
  3888
	  fi
melunko@47
  3889
	fi
melunko@47
  3890
melunko@47
  3891
	if test "X$skipped_export" != "X:" &&
melunko@47
  3892
	   len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
melunko@47
  3893
	   test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
melunko@47
  3894
	  :
melunko@47
  3895
	else
melunko@47
  3896
	  # The command line is too long to link in one step, link piecewise.
melunko@47
  3897
	  $echo "creating reloadable object files..."
melunko@47
  3898
melunko@47
  3899
	  # Save the value of $output and $libobjs because we want to
melunko@47
  3900
	  # use them later.  If we have whole_archive_flag_spec, we
melunko@47
  3901
	  # want to use save_libobjs as it was before
melunko@47
  3902
	  # whole_archive_flag_spec was expanded, because we can't
melunko@47
  3903
	  # assume the linker understands whole_archive_flag_spec.
melunko@47
  3904
	  # This may have to be revisited, in case too many
melunko@47
  3905
	  # convenience libraries get linked in and end up exceeding
melunko@47
  3906
	  # the spec.
melunko@47
  3907
	  if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
melunko@47
  3908
	    save_libobjs=$libobjs
melunko@47
  3909
	  fi
melunko@47
  3910
	  save_output=$output
melunko@47
  3911
	  output_la=`$echo "X$output" | $Xsed -e "$basename"`
melunko@47
  3912
melunko@47
  3913
	  # Clear the reloadable object creation command queue and
melunko@47
  3914
	  # initialize k to one.
melunko@47
  3915
	  test_cmds=
melunko@47
  3916
	  concat_cmds=
melunko@47
  3917
	  objlist=
melunko@47
  3918
	  delfiles=
melunko@47
  3919
	  last_robj=
melunko@47
  3920
	  k=1
melunko@47
  3921
	  output=$output_objdir/$output_la-${k}.$objext
melunko@47
  3922
	  # Loop over the list of objects to be linked.
melunko@47
  3923
	  for obj in $save_libobjs
melunko@47
  3924
	  do
melunko@47
  3925
	    eval test_cmds=\"$reload_cmds $objlist $last_robj\"
melunko@47
  3926
	    if test "X$objlist" = X ||
melunko@47
  3927
	       { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
melunko@47
  3928
		 test "$len" -le "$max_cmd_len"; }; then
melunko@47
  3929
	      objlist="$objlist $obj"
melunko@47
  3930
	    else
melunko@47
  3931
	      # The command $test_cmds is almost too long, add a
melunko@47
  3932
	      # command to the queue.
melunko@47
  3933
	      if test "$k" -eq 1 ; then
melunko@47
  3934
		# The first file doesn't have a previous command to add.
melunko@47
  3935
		eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
melunko@47
  3936
	      else
melunko@47
  3937
		# All subsequent reloadable object files will link in
melunko@47
  3938
		# the last one created.
melunko@47
  3939
		eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
melunko@47
  3940
	      fi
melunko@47
  3941
	      last_robj=$output_objdir/$output_la-${k}.$objext
melunko@47
  3942
	      k=`expr $k + 1`
melunko@47
  3943
	      output=$output_objdir/$output_la-${k}.$objext
melunko@47
  3944
	      objlist=$obj
melunko@47
  3945
	      len=1
melunko@47
  3946
	    fi
melunko@47
  3947
	  done
melunko@47
  3948
	  # Handle the remaining objects by creating one last
melunko@47
  3949
	  # reloadable object file.  All subsequent reloadable object
melunko@47
  3950
	  # files will link in the last one created.
melunko@47
  3951
	  test -z "$concat_cmds" || concat_cmds=$concat_cmds~
melunko@47
  3952
	  eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
melunko@47
  3953
melunko@47
  3954
	  if ${skipped_export-false}; then
melunko@47
  3955
	    $show "generating symbol list for \`$libname.la'"
melunko@47
  3956
	    export_symbols="$output_objdir/$libname.exp"
melunko@47
  3957
	    $run $rm $export_symbols
melunko@47
  3958
	    libobjs=$output
melunko@47
  3959
	    # Append the command to create the export file.
melunko@47
  3960
	    eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
melunko@47
  3961
          fi
melunko@47
  3962
melunko@47
  3963
	  # Set up a command to remove the reloadable object files
melunko@47
  3964
	  # after they are used.
melunko@47
  3965
	  i=0
melunko@47
  3966
	  while test "$i" -lt "$k"
melunko@47
  3967
	  do
melunko@47
  3968
	    i=`expr $i + 1`
melunko@47
  3969
	    delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
melunko@47
  3970
	  done
melunko@47
  3971
melunko@47
  3972
	  $echo "creating a temporary reloadable object file: $output"
melunko@47
  3973
melunko@47
  3974
	  # Loop through the commands generated above and execute them.
melunko@47
  3975
	  save_ifs="$IFS"; IFS='~'
melunko@47
  3976
	  for cmd in $concat_cmds; do
melunko@47
  3977
	    IFS="$save_ifs"
melunko@47
  3978
	    $show "$cmd"
melunko@47
  3979
	    $run eval "$cmd" || exit $?
melunko@47
  3980
	  done
melunko@47
  3981
	  IFS="$save_ifs"
melunko@47
  3982
melunko@47
  3983
	  libobjs=$output
melunko@47
  3984
	  # Restore the value of output.
melunko@47
  3985
	  output=$save_output
melunko@47
  3986
melunko@47
  3987
	  if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
melunko@47
  3988
	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
melunko@47
  3989
	  fi
melunko@47
  3990
	  # Expand the library linking commands again to reset the
melunko@47
  3991
	  # value of $libobjs for piecewise linking.
melunko@47
  3992
melunko@47
  3993
	  # Do each of the archive commands.
melunko@47
  3994
	  if test "$module" = yes && test -n "$module_cmds" ; then
melunko@47
  3995
	    if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
melunko@47
  3996
	      cmds=$module_expsym_cmds
melunko@47
  3997
	    else
melunko@47
  3998
	      cmds=$module_cmds
melunko@47
  3999
	    fi
melunko@47
  4000
	  else
melunko@47
  4001
	  if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
melunko@47
  4002
	    cmds=$archive_expsym_cmds
melunko@47
  4003
	  else
melunko@47
  4004
	    cmds=$archive_cmds
melunko@47
  4005
	    fi
melunko@47
  4006
	  fi
melunko@47
  4007
melunko@47
  4008
	  # Append the command to remove the reloadable object files
melunko@47
  4009
	  # to the just-reset $cmds.
melunko@47
  4010
	  eval cmds=\"\$cmds~\$rm $delfiles\"
melunko@47
  4011
	fi
melunko@47
  4012
	save_ifs="$IFS"; IFS='~'
melunko@47
  4013
	for cmd in $cmds; do
melunko@47
  4014
	  IFS="$save_ifs"
melunko@47
  4015
	  eval cmd=\"$cmd\"
melunko@47
  4016
	  $show "$cmd"
melunko@47
  4017
	  $run eval "$cmd" || {
melunko@47
  4018
	    lt_exit=$?
melunko@47
  4019
melunko@47
  4020
	    # Restore the uninstalled library and exit
melunko@47
  4021
	    if test "$mode" = relink; then
melunko@47
  4022
	      $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
melunko@47
  4023
	    fi
melunko@47
  4024
melunko@47
  4025
	    exit $lt_exit
melunko@47
  4026
	  }
melunko@47
  4027
	done
melunko@47
  4028
	IFS="$save_ifs"
melunko@47
  4029
melunko@47
  4030
	# Restore the uninstalled library and exit
melunko@47
  4031
	if test "$mode" = relink; then
melunko@47
  4032
	  $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
melunko@47
  4033
melunko@47
  4034
	  if test -n "$convenience"; then
melunko@47
  4035
	    if test -z "$whole_archive_flag_spec"; then
melunko@47
  4036
	      $show "${rm}r $gentop"
melunko@47
  4037
	      $run ${rm}r "$gentop"
melunko@47
  4038
	    fi
melunko@47
  4039
	  fi
melunko@47
  4040
melunko@47
  4041
	  exit $EXIT_SUCCESS
melunko@47
  4042
	fi
melunko@47
  4043
melunko@47
  4044
	# Create links to the real library.
melunko@47
  4045
	for linkname in $linknames; do
melunko@47
  4046
	  if test "$realname" != "$linkname"; then
melunko@47
  4047
	    $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
melunko@47
  4048
	    $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
melunko@47
  4049
	  fi
melunko@47
  4050
	done
melunko@47
  4051
melunko@47
  4052
	# If -module or -export-dynamic was specified, set the dlname.
melunko@47
  4053
	if test "$module" = yes || test "$export_dynamic" = yes; then
melunko@47
  4054
	  # On all known operating systems, these are identical.
melunko@47
  4055
	  dlname="$soname"
melunko@47
  4056
	fi
melunko@47
  4057
      fi
melunko@47
  4058
      ;;
melunko@47
  4059
melunko@47
  4060
    obj)
melunko@47
  4061
      if test -n "$deplibs"; then
melunko@47
  4062
	$echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
melunko@47
  4063
      fi
melunko@47
  4064
melunko@47
  4065
      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
melunko@47
  4066
	$echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
melunko@47
  4067
      fi
melunko@47
  4068
melunko@47
  4069
      if test -n "$rpath"; then
melunko@47
  4070
	$echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
melunko@47
  4071
      fi
melunko@47
  4072
melunko@47
  4073
      if test -n "$xrpath"; then
melunko@47
  4074
	$echo "$modename: warning: \`-R' is ignored for objects" 1>&2
melunko@47
  4075
      fi
melunko@47
  4076
melunko@47
  4077
      if test -n "$vinfo"; then
melunko@47
  4078
	$echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
melunko@47
  4079
      fi
melunko@47
  4080
melunko@47
  4081
      if test -n "$release"; then
melunko@47
  4082
	$echo "$modename: warning: \`-release' is ignored for objects" 1>&2
melunko@47
  4083
      fi
melunko@47
  4084
melunko@47
  4085
      case $output in
melunko@47
  4086
      *.lo)
melunko@47
  4087
	if test -n "$objs$old_deplibs"; then
melunko@47
  4088
	  $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
melunko@47
  4089
	  exit $EXIT_FAILURE
melunko@47
  4090
	fi
melunko@47
  4091
	libobj="$output"
melunko@47
  4092
	obj=`$echo "X$output" | $Xsed -e "$lo2o"`
melunko@47
  4093
	;;
melunko@47
  4094
      *)
melunko@47
  4095
	libobj=
melunko@47
  4096
	obj="$output"
melunko@47
  4097
	;;
melunko@47
  4098
      esac
melunko@47
  4099
melunko@47
  4100
      # Delete the old objects.
melunko@47
  4101
      $run $rm $obj $libobj
melunko@47
  4102
melunko@47
  4103
      # Objects from convenience libraries.  This assumes
melunko@47
  4104
      # single-version convenience libraries.  Whenever we create
melunko@47
  4105
      # different ones for PIC/non-PIC, this we'll have to duplicate
melunko@47
  4106
      # the extraction.
melunko@47
  4107
      reload_conv_objs=
melunko@47
  4108
      gentop=
melunko@47
  4109
      # reload_cmds runs $LD directly, so let us get rid of
melunko@47
  4110
      # -Wl from whole_archive_flag_spec
melunko@47
  4111
      wl=
melunko@47
  4112
melunko@47
  4113
      if test -n "$convenience"; then
melunko@47
  4114
	if test -n "$whole_archive_flag_spec"; then
melunko@47
  4115
	  eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
melunko@47
  4116
	else
melunko@47
  4117
	  gentop="$output_objdir/${obj}x"
melunko@47
  4118
	  generated="$generated $gentop"
melunko@47
  4119
melunko@47
  4120
	  func_extract_archives $gentop $convenience
melunko@47
  4121
	  reload_conv_objs="$reload_objs $func_extract_archives_result"
melunko@47
  4122
	fi
melunko@47
  4123
      fi
melunko@47
  4124
melunko@47
  4125
      # Create the old-style object.
melunko@47
  4126
      reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
melunko@47
  4127
melunko@47
  4128
      output="$obj"
melunko@47
  4129
      cmds=$reload_cmds
melunko@47
  4130
      save_ifs="$IFS"; IFS='~'
melunko@47
  4131
      for cmd in $cmds; do
melunko@47
  4132
	IFS="$save_ifs"
melunko@47
  4133
	eval cmd=\"$cmd\"
melunko@47
  4134
	$show "$cmd"
melunko@47
  4135
	$run eval "$cmd" || exit $?
melunko@47
  4136
      done
melunko@47
  4137
      IFS="$save_ifs"
melunko@47
  4138
melunko@47
  4139
      # Exit if we aren't doing a library object file.
melunko@47
  4140
      if test -z "$libobj"; then
melunko@47
  4141
	if test -n "$gentop"; then
melunko@47
  4142
	  $show "${rm}r $gentop"
melunko@47
  4143
	  $run ${rm}r $gentop
melunko@47
  4144
	fi
melunko@47
  4145
melunko@47
  4146
	exit $EXIT_SUCCESS
melunko@47
  4147
      fi
melunko@47
  4148
melunko@47
  4149
      if test "$build_libtool_libs" != yes; then
melunko@47
  4150
	if test -n "$gentop"; then
melunko@47
  4151
	  $show "${rm}r $gentop"
melunko@47
  4152
	  $run ${rm}r $gentop
melunko@47
  4153
	fi
melunko@47
  4154
melunko@47
  4155
	# Create an invalid libtool object if no PIC, so that we don't
melunko@47
  4156
	# accidentally link it into a program.
melunko@47
  4157
	# $show "echo timestamp > $libobj"
melunko@47
  4158
	# $run eval "echo timestamp > $libobj" || exit $?
melunko@47
  4159
	exit $EXIT_SUCCESS
melunko@47
  4160
      fi
melunko@47
  4161
melunko@47
  4162
      if test -n "$pic_flag" || test "$pic_mode" != default; then
melunko@47
  4163
	# Only do commands if we really have different PIC objects.
melunko@47
  4164
	reload_objs="$libobjs $reload_conv_objs"
melunko@47
  4165
	output="$libobj"
melunko@47
  4166
	cmds=$reload_cmds
melunko@47
  4167
	save_ifs="$IFS"; IFS='~'
melunko@47
  4168
	for cmd in $cmds; do
melunko@47
  4169
	  IFS="$save_ifs"
melunko@47
  4170
	  eval cmd=\"$cmd\"
melunko@47
  4171
	  $show "$cmd"
melunko@47
  4172
	  $run eval "$cmd" || exit $?
melunko@47
  4173
	done
melunko@47
  4174
	IFS="$save_ifs"
melunko@47
  4175
      fi
melunko@47
  4176
melunko@47
  4177
      if test -n "$gentop"; then
melunko@47
  4178
	$show "${rm}r $gentop"
melunko@47
  4179
	$run ${rm}r $gentop
melunko@47
  4180
      fi
melunko@47
  4181
melunko@47
  4182
      exit $EXIT_SUCCESS
melunko@47
  4183
      ;;
melunko@47
  4184
melunko@47
  4185
    prog)
melunko@47
  4186
      case $host in
melunko@47
  4187
	*cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
melunko@47
  4188
      esac
melunko@47
  4189
      if test -n "$vinfo"; then
melunko@47
  4190
	$echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
melunko@47
  4191
      fi
melunko@47
  4192
melunko@47
  4193
      if test -n "$release"; then
melunko@47
  4194
	$echo "$modename: warning: \`-release' is ignored for programs" 1>&2
melunko@47
  4195
      fi
melunko@47
  4196
melunko@47
  4197
      if test "$preload" = yes; then
melunko@47
  4198
	if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
melunko@47
  4199
	   test "$dlopen_self_static" = unknown; then
melunko@47
  4200
	  $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
melunko@47
  4201
	fi
melunko@47
  4202
      fi
melunko@47
  4203
melunko@47
  4204
      case $host in
melunko@47
  4205
      *-*-rhapsody* | *-*-darwin1.[012])
melunko@47
  4206
	# On Rhapsody replace the C library is the System framework
melunko@47
  4207
	compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
melunko@47
  4208
	finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
melunko@47
  4209
	;;
melunko@47
  4210
      esac
melunko@47
  4211
melunko@47
  4212
      case $host in
melunko@47
  4213
      *darwin*)
melunko@47
  4214
        # Don't allow lazy linking, it breaks C++ global constructors
melunko@47
  4215
        if test "$tagname" = CXX ; then
melunko@47
  4216
        compile_command="$compile_command ${wl}-bind_at_load"
melunko@47
  4217
        finalize_command="$finalize_command ${wl}-bind_at_load"
melunko@47
  4218
        fi
melunko@47
  4219
        ;;
melunko@47
  4220
      esac
melunko@47
  4221
melunko@47
  4222
      compile_command="$compile_command $compile_deplibs"
melunko@47
  4223
      finalize_command="$finalize_command $finalize_deplibs"
melunko@47
  4224
melunko@47
  4225
      if test -n "$rpath$xrpath"; then
melunko@47
  4226
	# If the user specified any rpath flags, then add them.
melunko@47
  4227
	for libdir in $rpath $xrpath; do
melunko@47
  4228
	  # This is the magic to use -rpath.
melunko@47
  4229
	  case "$finalize_rpath " in
melunko@47
  4230
	  *" $libdir "*) ;;
melunko@47
  4231
	  *) finalize_rpath="$finalize_rpath $libdir" ;;
melunko@47
  4232
	  esac
melunko@47
  4233
	done
melunko@47
  4234
      fi
melunko@47
  4235
melunko@47
  4236
      # Now hardcode the library paths
melunko@47
  4237
      rpath=
melunko@47
  4238
      hardcode_libdirs=
melunko@47
  4239
      for libdir in $compile_rpath $finalize_rpath; do
melunko@47
  4240
	if test -n "$hardcode_libdir_flag_spec"; then
melunko@47
  4241
	  if test -n "$hardcode_libdir_separator"; then
melunko@47
  4242
	    if test -z "$hardcode_libdirs"; then
melunko@47
  4243
	      hardcode_libdirs="$libdir"
melunko@47
  4244
	    else
melunko@47
  4245
	      # Just accumulate the unique libdirs.
melunko@47
  4246
	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
melunko@47
  4247
	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
melunko@47
  4248
		;;
melunko@47
  4249
	      *)
melunko@47
  4250
		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
melunko@47
  4251
		;;
melunko@47
  4252
	      esac
melunko@47
  4253
	    fi
melunko@47
  4254
	  else
melunko@47
  4255
	    eval flag=\"$hardcode_libdir_flag_spec\"
melunko@47
  4256
	    rpath="$rpath $flag"
melunko@47
  4257
	  fi
melunko@47
  4258
	elif test -n "$runpath_var"; then
melunko@47
  4259
	  case "$perm_rpath " in
melunko@47
  4260
	  *" $libdir "*) ;;
melunko@47
  4261
	  *) perm_rpath="$perm_rpath $libdir" ;;
melunko@47
  4262
	  esac
melunko@47
  4263
	fi
melunko@47
  4264
	case $host in
melunko@47
  4265
	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
melunko@47
  4266
	  case :$dllsearchpath: in
melunko@47
  4267
	  *":$libdir:"*) ;;
melunko@47
  4268
	  *) dllsearchpath="$dllsearchpath:$libdir";;
melunko@47
  4269
	  esac
melunko@47
  4270
	  ;;
melunko@47
  4271
	esac
melunko@47
  4272
      done
melunko@47
  4273
      # Substitute the hardcoded libdirs into the rpath.
melunko@47
  4274
      if test -n "$hardcode_libdir_separator" &&
melunko@47
  4275
	 test -n "$hardcode_libdirs"; then
melunko@47
  4276
	libdir="$hardcode_libdirs"
melunko@47
  4277
	eval rpath=\" $hardcode_libdir_flag_spec\"
melunko@47
  4278
      fi
melunko@47
  4279
      compile_rpath="$rpath"
melunko@47
  4280
melunko@47
  4281
      rpath=
melunko@47
  4282
      hardcode_libdirs=
melunko@47
  4283
      for libdir in $finalize_rpath; do
melunko@47
  4284
	if test -n "$hardcode_libdir_flag_spec"; then
melunko@47
  4285
	  if test -n "$hardcode_libdir_separator"; then
melunko@47
  4286
	    if test -z "$hardcode_libdirs"; then
melunko@47
  4287
	      hardcode_libdirs="$libdir"
melunko@47
  4288
	    else
melunko@47
  4289
	      # Just accumulate the unique libdirs.
melunko@47
  4290
	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
melunko@47
  4291
	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
melunko@47
  4292
		;;
melunko@47
  4293
	      *)
melunko@47
  4294
		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
melunko@47
  4295
		;;
melunko@47
  4296
	      esac
melunko@47
  4297
	    fi
melunko@47
  4298
	  else
melunko@47
  4299
	    eval flag=\"$hardcode_libdir_flag_spec\"
melunko@47
  4300
	    rpath="$rpath $flag"
melunko@47
  4301
	  fi
melunko@47
  4302
	elif test -n "$runpath_var"; then
melunko@47
  4303
	  case "$finalize_perm_rpath " in
melunko@47
  4304
	  *" $libdir "*) ;;
melunko@47
  4305
	  *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
melunko@47
  4306
	  esac
melunko@47
  4307
	fi
melunko@47
  4308
      done
melunko@47
  4309
      # Substitute the hardcoded libdirs into the rpath.
melunko@47
  4310
      if test -n "$hardcode_libdir_separator" &&
melunko@47
  4311
	 test -n "$hardcode_libdirs"; then
melunko@47
  4312
	libdir="$hardcode_libdirs"
melunko@47
  4313
	eval rpath=\" $hardcode_libdir_flag_spec\"
melunko@47
  4314
      fi
melunko@47
  4315
      finalize_rpath="$rpath"
melunko@47
  4316
melunko@47
  4317
      if test -n "$libobjs" && test "$build_old_libs" = yes; then
melunko@47
  4318
	# Transform all the library objects into standard objects.
melunko@47
  4319
	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
melunko@47
  4320
	finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
melunko@47
  4321
      fi
melunko@47
  4322
melunko@47
  4323
      dlsyms=
melunko@47
  4324
      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
melunko@47
  4325
	if test -n "$NM" && test -n "$global_symbol_pipe"; then
melunko@47
  4326
	  dlsyms="${outputname}S.c"
melunko@47
  4327
	else
melunko@47
  4328
	  $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
melunko@47
  4329
	fi
melunko@47
  4330
      fi
melunko@47
  4331
melunko@47
  4332
      if test -n "$dlsyms"; then
melunko@47
  4333
	case $dlsyms in
melunko@47
  4334
	"") ;;
melunko@47
  4335
	*.c)
melunko@47
  4336
	  # Discover the nlist of each of the dlfiles.
melunko@47
  4337
	  nlist="$output_objdir/${outputname}.nm"
melunko@47
  4338
melunko@47
  4339
	  $show "$rm $nlist ${nlist}S ${nlist}T"
melunko@47
  4340
	  $run $rm "$nlist" "${nlist}S" "${nlist}T"
melunko@47
  4341
melunko@47
  4342
	  # Parse the name list into a source file.
melunko@47
  4343
	  $show "creating $output_objdir/$dlsyms"
melunko@47
  4344
melunko@47
  4345
	  test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
melunko@47
  4346
/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
melunko@47
  4347
/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
melunko@47
  4348
melunko@47
  4349
#ifdef __cplusplus
melunko@47
  4350
extern \"C\" {
melunko@47
  4351
#endif
melunko@47
  4352
melunko@47
  4353
/* Prevent the only kind of declaration conflicts we can make. */
melunko@47
  4354
#define lt_preloaded_symbols some_other_symbol
melunko@47
  4355
melunko@47
  4356
/* External symbol declarations for the compiler. */\
melunko@47
  4357
"
melunko@47
  4358
melunko@47
  4359
	  if test "$dlself" = yes; then
melunko@47
  4360
	    $show "generating symbol list for \`$output'"
melunko@47
  4361
melunko@47
  4362
	    test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
melunko@47
  4363
melunko@47
  4364
	    # Add our own program objects to the symbol list.
melunko@47
  4365
	    progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
melunko@47
  4366
	    for arg in $progfiles; do
melunko@47
  4367
	      $show "extracting global C symbols from \`$arg'"
melunko@47
  4368
	      $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
melunko@47
  4369
	    done
melunko@47
  4370
melunko@47
  4371
	    if test -n "$exclude_expsyms"; then
melunko@47
  4372
	      $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
melunko@47
  4373
	      $run eval '$mv "$nlist"T "$nlist"'
melunko@47
  4374
	    fi
melunko@47
  4375
melunko@47
  4376
	    if test -n "$export_symbols_regex"; then
melunko@47
  4377
	      $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
melunko@47
  4378
	      $run eval '$mv "$nlist"T "$nlist"'
melunko@47
  4379
	    fi
melunko@47
  4380
melunko@47
  4381
	    # Prepare the list of exported symbols
melunko@47
  4382
	    if test -z "$export_symbols"; then
melunko@47
  4383
	      export_symbols="$output_objdir/$outputname.exp"
melunko@47
  4384
	      $run $rm $export_symbols
melunko@47
  4385
	      $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
melunko@47
  4386
	    else
melunko@47
  4387
	      $run eval "${SED} -e 's/\([ ][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
melunko@47
  4388
	      $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
melunko@47
  4389
	      $run eval 'mv "$nlist"T "$nlist"'
melunko@47
  4390
	    fi
melunko@47
  4391
	  fi
melunko@47
  4392
melunko@47
  4393
	  for arg in $dlprefiles; do
melunko@47
  4394
	    $show "extracting global C symbols from \`$arg'"
melunko@47
  4395
	    name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
melunko@47
  4396
	    $run eval '$echo ": $name " >> "$nlist"'
melunko@47
  4397
	    $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
melunko@47
  4398
	  done
melunko@47
  4399
melunko@47
  4400
	  if test -z "$run"; then
melunko@47
  4401
	    # Make sure we have at least an empty file.
melunko@47
  4402
	    test -f "$nlist" || : > "$nlist"
melunko@47
  4403
melunko@47
  4404
	    if test -n "$exclude_expsyms"; then
melunko@47
  4405
	      $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
melunko@47
  4406
	      $mv "$nlist"T "$nlist"
melunko@47
  4407
	    fi
melunko@47
  4408
melunko@47
  4409
	    # Try sorting and uniquifying the output.
melunko@47
  4410
	    if grep -v "^: " < "$nlist" |
melunko@47
  4411
		if sort -k 3 </dev/null >/dev/null 2>&1; then
melunko@47
  4412
		  sort -k 3
melunko@47
  4413
		else
melunko@47
  4414
		  sort +2
melunko@47
  4415
		fi |
melunko@47
  4416
		uniq > "$nlist"S; then
melunko@47
  4417
	      :
melunko@47
  4418
	    else
melunko@47
  4419
	      grep -v "^: " < "$nlist" > "$nlist"S
melunko@47
  4420
	    fi
melunko@47
  4421
melunko@47
  4422
	    if test -f "$nlist"S; then
melunko@47
  4423
	      eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
melunko@47
  4424
	    else
melunko@47
  4425
	      $echo '/* NONE */' >> "$output_objdir/$dlsyms"
melunko@47
  4426
	    fi
melunko@47
  4427
melunko@47
  4428
	    $echo >> "$output_objdir/$dlsyms" "\
melunko@47
  4429
melunko@47
  4430
#undef lt_preloaded_symbols
melunko@47
  4431
melunko@47
  4432
#if defined (__STDC__) && __STDC__
melunko@47
  4433
# define lt_ptr void *
melunko@47
  4434
#else
melunko@47
  4435
# define lt_ptr char *
melunko@47
  4436
# define const
melunko@47
  4437
#endif
melunko@47
  4438
melunko@47
  4439
/* The mapping between symbol names and symbols. */
melunko@47
  4440
"
melunko@47
  4441
melunko@47
  4442
	    case $host in
melunko@47
  4443
	    *cygwin* | *mingw* )
melunko@47
  4444
	  $echo >> "$output_objdir/$dlsyms" "\
melunko@47
  4445
/* DATA imports from DLLs on WIN32 can't be const, because
melunko@47
  4446
   runtime relocations are performed -- see ld's documentation
melunko@47
  4447
   on pseudo-relocs */
melunko@47
  4448
struct {
melunko@47
  4449
"
melunko@47
  4450
	      ;;
melunko@47
  4451
	    * )
melunko@47
  4452
	  $echo >> "$output_objdir/$dlsyms" "\
melunko@47
  4453
const struct {
melunko@47
  4454
"
melunko@47
  4455
	      ;;
melunko@47
  4456
	    esac
melunko@47
  4457
melunko@47
  4458
melunko@47
  4459
	  $echo >> "$output_objdir/$dlsyms" "\
melunko@47
  4460
  const char *name;
melunko@47
  4461
  lt_ptr address;
melunko@47
  4462
}
melunko@47
  4463
lt_preloaded_symbols[] =
melunko@47
  4464
{\
melunko@47
  4465
"
melunko@47
  4466
melunko@47
  4467
	    eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
melunko@47
  4468
melunko@47
  4469
	    $echo >> "$output_objdir/$dlsyms" "\
melunko@47
  4470
  {0, (lt_ptr) 0}
melunko@47
  4471
};
melunko@47
  4472
melunko@47
  4473
/* This works around a problem in FreeBSD linker */
melunko@47
  4474
#ifdef FREEBSD_WORKAROUND
melunko@47
  4475
static const void *lt_preloaded_setup() {
melunko@47
  4476
  return lt_preloaded_symbols;
melunko@47
  4477
}
melunko@47
  4478
#endif
melunko@47
  4479
melunko@47
  4480
#ifdef __cplusplus
melunko@47
  4481
}
melunko@47
  4482
#endif\
melunko@47
  4483
"
melunko@47
  4484
	  fi
melunko@47
  4485
melunko@47
  4486
	  pic_flag_for_symtable=
melunko@47
  4487
	  case $host in
melunko@47
  4488
	  # compiling the symbol table file with pic_flag works around
melunko@47
  4489
	  # a FreeBSD bug that causes programs to crash when -lm is
melunko@47
  4490
	  # linked before any other PIC object.  But we must not use
melunko@47
  4491
	  # pic_flag when linking with -static.  The problem exists in
melunko@47
  4492
	  # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
melunko@47
  4493
	  *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
melunko@47
  4494
	    case "$compile_command " in
melunko@47
  4495
	    *" -static "*) ;;
melunko@47
  4496
	    *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
melunko@47
  4497
	    esac;;
melunko@47
  4498
	  *-*-hpux*)
melunko@47
  4499
	    case "$compile_command " in
melunko@47
  4500
	    *" -static "*) ;;
melunko@47
  4501
	    *) pic_flag_for_symtable=" $pic_flag";;
melunko@47
  4502
	    esac
melunko@47
  4503
	  esac
melunko@47
  4504
melunko@47
  4505
	  # Now compile the dynamic symbol file.
melunko@47
  4506
	  $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
melunko@47
  4507
	  $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
melunko@47
  4508
melunko@47
  4509
	  # Clean up the generated files.
melunko@47
  4510
	  $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
melunko@47
  4511
	  $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
melunko@47
  4512
melunko@47
  4513
	  # Transform the symbol file into the correct name.
melunko@47
  4514
	  compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
melunko@47
  4515
	  finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
melunko@47
  4516
	  ;;
melunko@47
  4517
	*)
melunko@47
  4518
	  $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
melunko@47
  4519
	  exit $EXIT_FAILURE
melunko@47
  4520
	  ;;
melunko@47
  4521
	esac
melunko@47
  4522
      else
melunko@47
  4523
	# We keep going just in case the user didn't refer to
melunko@47
  4524
	# lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
melunko@47
  4525
	# really was required.
melunko@47
  4526
melunko@47
  4527
	# Nullify the symbol file.
melunko@47
  4528
	compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
melunko@47
  4529
	finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
melunko@47
  4530
      fi
melunko@47
  4531
melunko@47
  4532
      if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
melunko@47
  4533
	# Replace the output file specification.
melunko@47
  4534
	compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
melunko@47
  4535
	link_command="$compile_command$compile_rpath"
melunko@47
  4536
melunko@47
  4537
	# We have no uninstalled library dependencies, so finalize right now.
melunko@47
  4538
	$show "$link_command"
melunko@47
  4539
	$run eval "$link_command"
melunko@47
  4540
	status=$?
melunko@47
  4541
melunko@47
  4542
	# Delete the generated files.
melunko@47
  4543
	if test -n "$dlsyms"; then
melunko@47
  4544
	  $show "$rm $output_objdir/${outputname}S.${objext}"
melunko@47
  4545
	  $run $rm "$output_objdir/${outputname}S.${objext}"
melunko@47
  4546
	fi
melunko@47
  4547
melunko@47
  4548
	exit $status
melunko@47
  4549
      fi
melunko@47
  4550
melunko@47
  4551
      if test -n "$shlibpath_var"; then
melunko@47
  4552
	# We should set the shlibpath_var
melunko@47
  4553
	rpath=
melunko@47
  4554
	for dir in $temp_rpath; do
melunko@47
  4555
	  case $dir in
melunko@47
  4556
	  [\\/]* | [A-Za-z]:[\\/]*)
melunko@47
  4557
	    # Absolute path.
melunko@47
  4558
	    rpath="$rpath$dir:"
melunko@47
  4559
	    ;;
melunko@47
  4560
	  *)
melunko@47
  4561
	    # Relative path: add a thisdir entry.
melunko@47
  4562
	    rpath="$rpath\$thisdir/$dir:"
melunko@47
  4563
	    ;;
melunko@47
  4564
	  esac
melunko@47
  4565
	done
melunko@47
  4566
	temp_rpath="$rpath"
melunko@47
  4567
      fi
melunko@47
  4568
melunko@47
  4569
      if test -n "$compile_shlibpath$finalize_shlibpath"; then
melunko@47
  4570
	compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
melunko@47
  4571
      fi
melunko@47
  4572
      if test -n "$finalize_shlibpath"; then
melunko@47
  4573
	finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
melunko@47
  4574
      fi
melunko@47
  4575
melunko@47
  4576
      compile_var=
melunko@47
  4577
      finalize_var=
melunko@47
  4578
      if test -n "$runpath_var"; then
melunko@47
  4579
	if test -n "$perm_rpath"; then
melunko@47
  4580
	  # We should set the runpath_var.
melunko@47
  4581
	  rpath=
melunko@47
  4582
	  for dir in $perm_rpath; do
melunko@47
  4583
	    rpath="$rpath$dir:"
melunko@47
  4584
	  done
melunko@47
  4585
	  compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
melunko@47
  4586
	fi
melunko@47
  4587
	if test -n "$finalize_perm_rpath"; then
melunko@47
  4588
	  # We should set the runpath_var.
melunko@47
  4589
	  rpath=
melunko@47
  4590
	  for dir in $finalize_perm_rpath; do
melunko@47
  4591
	    rpath="$rpath$dir:"
melunko@47
  4592
	  done
melunko@47
  4593
	  finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
melunko@47
  4594
	fi
melunko@47
  4595
      fi
melunko@47
  4596
melunko@47
  4597
      if test "$no_install" = yes; then
melunko@47
  4598
	# We don't need to create a wrapper script.
melunko@47
  4599
	link_command="$compile_var$compile_command$compile_rpath"
melunko@47
  4600
	# Replace the output file specification.
melunko@47
  4601
	link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
melunko@47
  4602
	# Delete the old output file.
melunko@47
  4603
	$run $rm $output
melunko@47
  4604
	# Link the executable and exit
melunko@47
  4605
	$show "$link_command"
melunko@47
  4606
	$run eval "$link_command" || exit $?
melunko@47
  4607
	exit $EXIT_SUCCESS
melunko@47
  4608
      fi
melunko@47
  4609
melunko@47
  4610
      if test "$hardcode_action" = relink; then
melunko@47
  4611
	# Fast installation is not supported
melunko@47
  4612
	link_command="$compile_var$compile_command$compile_rpath"
melunko@47
  4613
	relink_command="$finalize_var$finalize_command$finalize_rpath"
melunko@47
  4614
melunko@47
  4615
	$echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
melunko@47
  4616
	$echo "$modename: \`$output' will be relinked during installation" 1>&2
melunko@47
  4617
      else
melunko@47
  4618
	if test "$fast_install" != no; then
melunko@47
  4619
	  link_command="$finalize_var$compile_command$finalize_rpath"
melunko@47
  4620
	  if test "$fast_install" = yes; then
melunko@47
  4621
	    relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
melunko@47
  4622
	  else
melunko@47
  4623
	    # fast_install is set to needless
melunko@47
  4624
	    relink_command=
melunko@47
  4625
	  fi
melunko@47
  4626
	else
melunko@47
  4627
	  link_command="$compile_var$compile_command$compile_rpath"
melunko@47
  4628
	  relink_command="$finalize_var$finalize_command$finalize_rpath"
melunko@47
  4629
	fi
melunko@47
  4630
      fi
melunko@47
  4631
melunko@47
  4632
      # Replace the output file specification.
melunko@47
  4633
      link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
melunko@47
  4634
melunko@47
  4635
      # Delete the old output files.
melunko@47
  4636
      $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
melunko@47
  4637
melunko@47
  4638
      $show "$link_command"
melunko@47
  4639
      $run eval "$link_command" || exit $?
melunko@47
  4640
melunko@47
  4641
      # Now create the wrapper script.
melunko@47
  4642
      $show "creating $output"
melunko@47
  4643
melunko@47
  4644
      # Quote the relink command for shipping.
melunko@47
  4645
      if test -n "$relink_command"; then
melunko@47
  4646
	# Preserve any variables that may affect compiler behavior
melunko@47
  4647
	for var in $variables_saved_for_relink; do
melunko@47
  4648
	  if eval test -z \"\${$var+set}\"; then
melunko@47
  4649
	    relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
melunko@47
  4650
	  elif eval var_value=\$$var; test -z "$var_value"; then
melunko@47
  4651
	    relink_command="$var=; export $var; $relink_command"
melunko@47
  4652
	  else
melunko@47
  4653
	    var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
melunko@47
  4654
	    relink_command="$var=\"$var_value\"; export $var; $relink_command"
melunko@47
  4655
	  fi
melunko@47
  4656
	done
melunko@47
  4657
	relink_command="(cd `pwd`; $relink_command)"
melunko@47
  4658
	relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
melunko@47
  4659
      fi
melunko@47
  4660
melunko@47
  4661
      # Quote $echo for shipping.
melunko@47
  4662
      if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
melunko@47
  4663
	case $progpath in
melunko@47
  4664
	[\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
melunko@47
  4665
	*) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
melunko@47
  4666
	esac
melunko@47
  4667
	qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
melunko@47
  4668
      else
melunko@47
  4669
	qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
melunko@47
  4670
      fi
melunko@47
  4671
melunko@47
  4672
      # Only actually do things if our run command is non-null.
melunko@47
  4673
      if test -z "$run"; then
melunko@47
  4674
	# win32 will think the script is a binary if it has
melunko@47
  4675
	# a .exe suffix, so we strip it off here.
melunko@47
  4676
	case $output in
melunko@47
  4677
	  *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
melunko@47
  4678
	esac
melunko@47
  4679
	# test for cygwin because mv fails w/o .exe extensions
melunko@47
  4680
	case $host in
melunko@47
  4681
	  *cygwin*)
melunko@47
  4682
	    exeext=.exe
melunko@47
  4683
	    outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
melunko@47
  4684
	  *) exeext= ;;
melunko@47
  4685
	esac
melunko@47
  4686
	case $host in
melunko@47
  4687
	  *cygwin* | *mingw* )
melunko@47
  4688
	    cwrappersource=`$echo ${objdir}/lt-${outputname}.c`
melunko@47
  4689
	    cwrapper=`$echo ${output}.exe`
melunko@47
  4690
	    $rm $cwrappersource $cwrapper
melunko@47
  4691
	    trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
melunko@47
  4692
melunko@47
  4693
	    cat > $cwrappersource <<EOF
melunko@47
  4694
melunko@47
  4695
/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
melunko@47
  4696
   Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
melunko@47
  4697
melunko@47
  4698
   The $output program cannot be directly executed until all the libtool
melunko@47
  4699
   libraries that it depends on are installed.
melunko@47
  4700
melunko@47
  4701
   This wrapper executable should never be moved out of the build directory.
melunko@47
  4702
   If it is, it will not operate correctly.
melunko@47
  4703
melunko@47
  4704
   Currently, it simply execs the wrapper *script* "/bin/sh $output",
melunko@47
  4705
   but could eventually absorb all of the scripts functionality and
melunko@47
  4706
   exec $objdir/$outputname directly.
melunko@47
  4707
*/
melunko@47
  4708
EOF
melunko@47
  4709
	    cat >> $cwrappersource<<"EOF"
melunko@47
  4710
#include <stdio.h>
melunko@47
  4711
#include <stdlib.h>
melunko@47
  4712
#include <unistd.h>
melunko@47
  4713
#include <malloc.h>
melunko@47
  4714
#include <stdarg.h>
melunko@47
  4715
#include <assert.h>
melunko@47
  4716
melunko@47
  4717
#if defined(PATH_MAX)
melunko@47
  4718
# define LT_PATHMAX PATH_MAX
melunko@47
  4719
#elif defined(MAXPATHLEN)
melunko@47
  4720
# define LT_PATHMAX MAXPATHLEN
melunko@47
  4721
#else
melunko@47
  4722
# define LT_PATHMAX 1024
melunko@47
  4723
#endif
melunko@47
  4724
melunko@47
  4725
#ifndef DIR_SEPARATOR
melunko@47
  4726
#define DIR_SEPARATOR '/'
melunko@47
  4727
#endif
melunko@47
  4728
melunko@47
  4729
#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
melunko@47
  4730
  defined (__OS2__)
melunko@47
  4731
#define HAVE_DOS_BASED_FILE_SYSTEM
melunko@47
  4732
#ifndef DIR_SEPARATOR_2
melunko@47
  4733
#define DIR_SEPARATOR_2 '\\'
melunko@47
  4734
#endif
melunko@47
  4735
#endif
melunko@47
  4736
melunko@47
  4737
#ifndef DIR_SEPARATOR_2
melunko@47
  4738
# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
melunko@47
  4739
#else /* DIR_SEPARATOR_2 */
melunko@47
  4740
# define IS_DIR_SEPARATOR(ch) \
melunko@47
  4741
        (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
melunko@47
  4742
#endif /* DIR_SEPARATOR_2 */
melunko@47
  4743
melunko@47
  4744
#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
melunko@47
  4745
#define XFREE(stale) do { \
melunko@47
  4746
  if (stale) { free ((void *) stale); stale = 0; } \
melunko@47
  4747
} while (0)
melunko@47
  4748
melunko@47
  4749
const char *program_name = NULL;
melunko@47
  4750
melunko@47
  4751
void * xmalloc (size_t num);
melunko@47
  4752
char * xstrdup (const char *string);
melunko@47
  4753
char * basename (const char *name);
melunko@47
  4754
char * fnqualify(const char *path);
melunko@47
  4755
char * strendzap(char *str, const char *pat);
melunko@47
  4756
void lt_fatal (const char *message, ...);
melunko@47
  4757
melunko@47
  4758
int
melunko@47
  4759
main (int argc, char *argv[])
melunko@47
  4760
{
melunko@47
  4761
  char **newargz;
melunko@47
  4762
  int i;
melunko@47
  4763
melunko@47
  4764
  program_name = (char *) xstrdup ((char *) basename (argv[0]));
melunko@47
  4765
  newargz = XMALLOC(char *, argc+2);
melunko@47
  4766
EOF
melunko@47
  4767
melunko@47
  4768
	    cat >> $cwrappersource <<EOF
melunko@47
  4769
  newargz[0] = "$SHELL";
melunko@47
  4770
EOF
melunko@47
  4771
melunko@47
  4772
	    cat >> $cwrappersource <<"EOF"
melunko@47
  4773
  newargz[1] = fnqualify(argv[0]);
melunko@47
  4774
  /* we know the script has the same name, without the .exe */
melunko@47
  4775
  /* so make sure newargz[1] doesn't end in .exe */
melunko@47
  4776
  strendzap(newargz[1],".exe");
melunko@47
  4777
  for (i = 1; i < argc; i++)
melunko@47
  4778
    newargz[i+1] = xstrdup(argv[i]);
melunko@47
  4779
  newargz[argc+1] = NULL;
melunko@47
  4780
EOF
melunko@47
  4781
melunko@47
  4782
	    cat >> $cwrappersource <<EOF
melunko@47
  4783
  execv("$SHELL",newargz);
melunko@47
  4784
EOF
melunko@47
  4785
melunko@47
  4786
	    cat >> $cwrappersource <<"EOF"
melunko@47
  4787
  return 127;
melunko@47
  4788
}
melunko@47
  4789
melunko@47
  4790
void *
melunko@47
  4791
xmalloc (size_t num)
melunko@47
  4792
{
melunko@47
  4793
  void * p = (void *) malloc (num);
melunko@47
  4794
  if (!p)
melunko@47
  4795
    lt_fatal ("Memory exhausted");
melunko@47
  4796
melunko@47
  4797
  return p;
melunko@47
  4798
}
melunko@47
  4799
melunko@47
  4800
char *
melunko@47
  4801
xstrdup (const char *string)
melunko@47
  4802
{
melunko@47
  4803
  return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
melunko@47
  4804
;
melunko@47
  4805
}
melunko@47
  4806
melunko@47
  4807
char *
melunko@47
  4808
basename (const char *name)
melunko@47
  4809
{
melunko@47
  4810
  const char *base;
melunko@47
  4811
melunko@47
  4812
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
melunko@47
  4813
  /* Skip over the disk name in MSDOS pathnames. */
melunko@47
  4814
  if (isalpha (name[0]) && name[1] == ':')
melunko@47
  4815
    name += 2;
melunko@47
  4816
#endif
melunko@47
  4817
melunko@47
  4818
  for (base = name; *name; name++)
melunko@47
  4819
    if (IS_DIR_SEPARATOR (*name))
melunko@47
  4820
      base = name + 1;
melunko@47
  4821
  return (char *) base;
melunko@47
  4822
}
melunko@47
  4823
melunko@47
  4824
char *
melunko@47
  4825
fnqualify(const char *path)
melunko@47
  4826
{
melunko@47
  4827
  size_t size;
melunko@47
  4828
  char *p;
melunko@47
  4829
  char tmp[LT_PATHMAX + 1];
melunko@47
  4830
melunko@47
  4831
  assert(path != NULL);
melunko@47
  4832
melunko@47
  4833
  /* Is it qualified already? */
melunko@47
  4834
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
melunko@47
  4835
  if (isalpha (path[0]) && path[1] == ':')
melunko@47
  4836
    return xstrdup (path);
melunko@47
  4837
#endif
melunko@47
  4838
  if (IS_DIR_SEPARATOR (path[0]))
melunko@47
  4839
    return xstrdup (path);
melunko@47
  4840
melunko@47
  4841
  /* prepend the current directory */
melunko@47
  4842
  /* doesn't handle '~' */
melunko@47
  4843
  if (getcwd (tmp, LT_PATHMAX) == NULL)
melunko@47
  4844
    lt_fatal ("getcwd failed");
melunko@47
  4845
  size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */
melunko@47
  4846
  p = XMALLOC(char, size);
melunko@47
  4847
  sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path);
melunko@47
  4848
  return p;
melunko@47
  4849
}
melunko@47
  4850
melunko@47
  4851
char *
melunko@47
  4852
strendzap(char *str, const char *pat)
melunko@47
  4853
{
melunko@47
  4854
  size_t len, patlen;
melunko@47
  4855
melunko@47
  4856
  assert(str != NULL);
melunko@47
  4857
  assert(pat != NULL);
melunko@47
  4858
melunko@47
  4859
  len = strlen(str);
melunko@47
  4860
  patlen = strlen(pat);
melunko@47
  4861
melunko@47
  4862
  if (patlen <= len)
melunko@47
  4863
  {
melunko@47
  4864
    str += len - patlen;
melunko@47
  4865
    if (strcmp(str, pat) == 0)
melunko@47
  4866
      *str = '\0';
melunko@47
  4867
  }
melunko@47
  4868
  return str;
melunko@47
  4869
}
melunko@47
  4870
melunko@47
  4871
static void
melunko@47
  4872
lt_error_core (int exit_status, const char * mode,
melunko@47
  4873
          const char * message, va_list ap)
melunko@47
  4874
{
melunko@47
  4875
  fprintf (stderr, "%s: %s: ", program_name, mode);
melunko@47
  4876
  vfprintf (stderr, message, ap);
melunko@47
  4877
  fprintf (stderr, ".\n");
melunko@47
  4878
melunko@47
  4879
  if (exit_status >= 0)
melunko@47
  4880
    exit (exit_status);
melunko@47
  4881
}
melunko@47
  4882
melunko@47
  4883
void
melunko@47
  4884
lt_fatal (const char *message, ...)
melunko@47
  4885
{
melunko@47
  4886
  va_list ap;
melunko@47
  4887
  va_start (ap, message);
melunko@47
  4888
  lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
melunko@47
  4889
  va_end (ap);
melunko@47
  4890
}
melunko@47
  4891
EOF
melunko@47
  4892
	  # we should really use a build-platform specific compiler
melunko@47
  4893
	  # here, but OTOH, the wrappers (shell script and this C one)
melunko@47
  4894
	  # are only useful if you want to execute the "real" binary.
melunko@47
  4895
	  # Since the "real" binary is built for $host, then this
melunko@47
  4896
	  # wrapper might as well be built for $host, too.
melunko@47
  4897
	  $run $LTCC -s -o $cwrapper $cwrappersource
melunko@47
  4898
	  ;;
melunko@47
  4899
	esac
melunko@47
  4900
	$rm $output
melunko@47
  4901
	trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
melunko@47
  4902
melunko@47
  4903
	$echo > $output "\
melunko@47
  4904
#! $SHELL
melunko@47
  4905
melunko@47
  4906
# $output - temporary wrapper script for $objdir/$outputname
melunko@47
  4907
# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
melunko@47
  4908
#
melunko@47
  4909
# The $output program cannot be directly executed until all the libtool
melunko@47
  4910
# libraries that it depends on are installed.
melunko@47
  4911
#
melunko@47
  4912
# This wrapper script should never be moved out of the build directory.
melunko@47
  4913
# If it is, it will not operate correctly.
melunko@47
  4914
melunko@47
  4915
# Sed substitution that helps us do robust quoting.  It backslashifies
melunko@47
  4916
# metacharacters that are still active within double-quoted strings.
melunko@47
  4917
Xsed='${SED} -e 1s/^X//'
melunko@47
  4918
sed_quote_subst='$sed_quote_subst'
melunko@47
  4919
melunko@47
  4920
# The HP-UX ksh and POSIX shell print the target directory to stdout
melunko@47
  4921
# if CDPATH is set.
melunko@47
  4922
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
melunko@47
  4923
melunko@47
  4924
relink_command=\"$relink_command\"
melunko@47
  4925
melunko@47
  4926
# This environment variable determines our operation mode.
melunko@47
  4927
if test \"\$libtool_install_magic\" = \"$magic\"; then
melunko@47
  4928
  # install mode needs the following variable:
melunko@47
  4929
  notinst_deplibs='$notinst_deplibs'
melunko@47
  4930
else
melunko@47
  4931
  # When we are sourced in execute mode, \$file and \$echo are already set.
melunko@47
  4932
  if test \"\$libtool_execute_magic\" != \"$magic\"; then
melunko@47
  4933
    echo=\"$qecho\"
melunko@47
  4934
    file=\"\$0\"
melunko@47
  4935
    # Make sure echo works.
melunko@47
  4936
    if test \"X\$1\" = X--no-reexec; then
melunko@47
  4937
      # Discard the --no-reexec flag, and continue.
melunko@47
  4938
      shift
melunko@47
  4939
    elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
melunko@47
  4940
      # Yippee, \$echo works!
melunko@47
  4941
      :
melunko@47
  4942
    else
melunko@47
  4943
      # Restart under the correct shell, and then maybe \$echo will work.
melunko@47
  4944
      exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
melunko@47
  4945
    fi
melunko@47
  4946
  fi\
melunko@47
  4947
"
melunko@47
  4948
	$echo >> $output "\
melunko@47
  4949
melunko@47
  4950
  # Find the directory that this script lives in.
melunko@47
  4951
  thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
melunko@47
  4952
  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
melunko@47
  4953
melunko@47
  4954
  # Follow symbolic links until we get to the real thisdir.
melunko@47
  4955
  file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
melunko@47
  4956
  while test -n \"\$file\"; do
melunko@47
  4957
    destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
melunko@47
  4958
melunko@47
  4959
    # If there was a directory component, then change thisdir.
melunko@47
  4960
    if test \"x\$destdir\" != \"x\$file\"; then
melunko@47
  4961
      case \"\$destdir\" in
melunko@47
  4962
      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
melunko@47
  4963
      *) thisdir=\"\$thisdir/\$destdir\" ;;
melunko@47
  4964
      esac
melunko@47
  4965
    fi
melunko@47
  4966
melunko@47
  4967
    file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
melunko@47
  4968
    file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
melunko@47
  4969
  done
melunko@47
  4970
melunko@47
  4971
  # Try to get the absolute directory name.
melunko@47
  4972
  absdir=\`cd \"\$thisdir\" && pwd\`
melunko@47
  4973
  test -n \"\$absdir\" && thisdir=\"\$absdir\"
melunko@47
  4974
"
melunko@47
  4975
melunko@47
  4976
	if test "$fast_install" = yes; then
melunko@47
  4977
	  $echo >> $output "\
melunko@47
  4978
  program=lt-'$outputname'$exeext
melunko@47
  4979
  progdir=\"\$thisdir/$objdir\"
melunko@47
  4980
melunko@47
  4981
  if test ! -f \"\$progdir/\$program\" || \\
melunko@47
  4982
     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
melunko@47
  4983
       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
melunko@47
  4984
melunko@47
  4985
    file=\"\$\$-\$program\"
melunko@47
  4986
melunko@47
  4987
    if test ! -d \"\$progdir\"; then
melunko@47
  4988
      $mkdir \"\$progdir\"
melunko@47
  4989
    else
melunko@47
  4990
      $rm \"\$progdir/\$file\"
melunko@47
  4991
    fi"
melunko@47
  4992
melunko@47
  4993
	  $echo >> $output "\
melunko@47
  4994
melunko@47
  4995
    # relink executable if necessary
melunko@47
  4996
    if test -n \"\$relink_command\"; then
melunko@47
  4997
      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
melunko@47
  4998
      else
melunko@47
  4999
	$echo \"\$relink_command_output\" >&2
melunko@47
  5000
	$rm \"\$progdir/\$file\"
melunko@47
  5001
	exit $EXIT_FAILURE
melunko@47
  5002
      fi
melunko@47
  5003
    fi
melunko@47
  5004
melunko@47
  5005
    $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
melunko@47
  5006
    { $rm \"\$progdir/\$program\";
melunko@47
  5007
      $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
melunko@47
  5008
    $rm \"\$progdir/\$file\"
melunko@47
  5009
  fi"
melunko@47
  5010
	else
melunko@47
  5011
	  $echo >> $output "\
melunko@47
  5012
  program='$outputname'
melunko@47
  5013
  progdir=\"\$thisdir/$objdir\"
melunko@47
  5014
"
melunko@47
  5015
	fi
melunko@47
  5016
melunko@47
  5017
	$echo >> $output "\
melunko@47
  5018
melunko@47
  5019
  if test -f \"\$progdir/\$program\"; then"
melunko@47
  5020
melunko@47
  5021
	# Export our shlibpath_var if we have one.
melunko@47
  5022
	if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
melunko@47
  5023
	  $echo >> $output "\
melunko@47
  5024
    # Add our own library path to $shlibpath_var
melunko@47
  5025
    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
melunko@47
  5026
melunko@47
  5027
    # Some systems cannot cope with colon-terminated $shlibpath_var
melunko@47
  5028
    # The second colon is a workaround for a bug in BeOS R4 sed
melunko@47
  5029
    $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
melunko@47
  5030
melunko@47
  5031
    export $shlibpath_var
melunko@47
  5032
"
melunko@47
  5033
	fi
melunko@47
  5034
melunko@47
  5035
	# fixup the dll searchpath if we need to.
melunko@47
  5036
	if test -n "$dllsearchpath"; then
melunko@47
  5037
	  $echo >> $output "\
melunko@47
  5038
    # Add the dll search path components to the executable PATH
melunko@47
  5039
    PATH=$dllsearchpath:\$PATH
melunko@47
  5040
"
melunko@47
  5041
	fi
melunko@47
  5042
melunko@47
  5043
	$echo >> $output "\
melunko@47
  5044
    if test \"\$libtool_execute_magic\" != \"$magic\"; then
melunko@47
  5045
      # Run the actual program with our arguments.
melunko@47
  5046
"
melunko@47
  5047
	case $host in
melunko@47
  5048
	# Backslashes separate directories on plain windows
melunko@47
  5049
	*-*-mingw | *-*-os2*)
melunko@47
  5050
	  $echo >> $output "\
melunko@47
  5051
      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
melunko@47
  5052
"
melunko@47
  5053
	  ;;
melunko@47
  5054
melunko@47
  5055
	*)
melunko@47
  5056
	  $echo >> $output "\
melunko@47
  5057
      exec \"\$progdir/\$program\" \${1+\"\$@\"}
melunko@47
  5058
"
melunko@47
  5059
	  ;;
melunko@47
  5060
	esac
melunko@47
  5061
	$echo >> $output "\
melunko@47
  5062
      \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
melunko@47
  5063
      exit $EXIT_FAILURE
melunko@47
  5064
    fi
melunko@47
  5065
  else
melunko@47
  5066
    # The program doesn't exist.
melunko@47
  5067
    \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
melunko@47
  5068
    \$echo \"This script is just a wrapper for \$program.\" 1>&2
melunko@47
  5069
    $echo \"See the $PACKAGE documentation for more information.\" 1>&2
melunko@47
  5070
    exit $EXIT_FAILURE
melunko@47
  5071
  fi
melunko@47
  5072
fi\
melunko@47
  5073
"
melunko@47
  5074
	chmod +x $output
melunko@47
  5075
      fi
melunko@47
  5076
      exit $EXIT_SUCCESS
melunko@47
  5077
      ;;
melunko@47
  5078
    esac
melunko@47
  5079
melunko@47
  5080
    # See if we need to build an old-fashioned archive.
melunko@47
  5081
    for oldlib in $oldlibs; do
melunko@47
  5082
melunko@47
  5083
      if test "$build_libtool_libs" = convenience; then
melunko@47
  5084
	oldobjs="$libobjs_save"
melunko@47
  5085
	addlibs="$convenience"
melunko@47
  5086
	build_libtool_libs=no
melunko@47
  5087
      else
melunko@47
  5088
	if test "$build_libtool_libs" = module; then
melunko@47
  5089
	  oldobjs="$libobjs_save"
melunko@47
  5090
	  build_libtool_libs=no
melunko@47
  5091
	else
melunko@47
  5092
	  oldobjs="$old_deplibs $non_pic_objects"
melunko@47
  5093
	fi
melunko@47
  5094
	addlibs="$old_convenience"
melunko@47
  5095
      fi
melunko@47
  5096
melunko@47
  5097
      if test -n "$addlibs"; then
melunko@47
  5098
	gentop="$output_objdir/${outputname}x"
melunko@47
  5099
	generated="$generated $gentop"
melunko@47
  5100
melunko@47
  5101
	func_extract_archives $gentop $addlibs
melunko@47
  5102
	oldobjs="$oldobjs $func_extract_archives_result"
melunko@47
  5103
      fi
melunko@47
  5104
melunko@47
  5105
      # Do each command in the archive commands.
melunko@47
  5106
      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
melunko@47
  5107
       cmds=$old_archive_from_new_cmds
melunko@47
  5108
      else
melunko@47
  5109
	# POSIX demands no paths to be encoded in archives.  We have
melunko@47
  5110
	# to avoid creating archives with duplicate basenames if we
melunko@47
  5111
	# might have to extract them afterwards, e.g., when creating a
melunko@47
  5112
	# static archive out of a convenience library, or when linking
melunko@47
  5113
	# the entirety of a libtool archive into another (currently
melunko@47
  5114
	# not supported by libtool).
melunko@47
  5115
	if (for obj in $oldobjs
melunko@47
  5116
	    do
melunko@47
  5117
	      $echo "X$obj" | $Xsed -e 's%^.*/%%'
melunko@47
  5118
	    done | sort | sort -uc >/dev/null 2>&1); then
melunko@47
  5119
	  :
melunko@47
  5120
	else
melunko@47
  5121
	  $echo "copying selected object files to avoid basename conflicts..."
melunko@47
  5122
melunko@47
  5123
	  if test -z "$gentop"; then
melunko@47
  5124
	    gentop="$output_objdir/${outputname}x"
melunko@47
  5125
	    generated="$generated $gentop"
melunko@47
  5126
melunko@47
  5127
	    $show "${rm}r $gentop"
melunko@47
  5128
	    $run ${rm}r "$gentop"
melunko@47
  5129
	    $show "$mkdir $gentop"
melunko@47
  5130
	    $run $mkdir "$gentop"
melunko@47
  5131
	    status=$?
melunko@47
  5132
	    if test "$status" -ne 0 && test ! -d "$gentop"; then
melunko@47
  5133
	      exit $status
melunko@47
  5134
	    fi
melunko@47
  5135
	  fi
melunko@47
  5136
melunko@47
  5137
	  save_oldobjs=$oldobjs
melunko@47
  5138
	  oldobjs=
melunko@47
  5139
	  counter=1
melunko@47
  5140
	  for obj in $save_oldobjs
melunko@47
  5141
	  do
melunko@47
  5142
	    objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
melunko@47
  5143
	    case " $oldobjs " in
melunko@47
  5144
	    " ") oldobjs=$obj ;;
melunko@47
  5145
	    *[\ /]"$objbase "*)
melunko@47
  5146
	      while :; do
melunko@47
  5147
		# Make sure we don't pick an alternate name that also
melunko@47
  5148
		# overlaps.
melunko@47
  5149
		newobj=lt$counter-$objbase
melunko@47
  5150
		counter=`expr $counter + 1`
melunko@47
  5151
		case " $oldobjs " in
melunko@47
  5152
		*[\ /]"$newobj "*) ;;
melunko@47
  5153
		*) if test ! -f "$gentop/$newobj"; then break; fi ;;
melunko@47
  5154
		esac
melunko@47
  5155
	      done
melunko@47
  5156
	      $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
melunko@47
  5157
	      $run ln "$obj" "$gentop/$newobj" ||
melunko@47
  5158
	      $run cp "$obj" "$gentop/$newobj"
melunko@47
  5159
	      oldobjs="$oldobjs $gentop/$newobj"
melunko@47
  5160
	      ;;
melunko@47
  5161
	    *) oldobjs="$oldobjs $obj" ;;
melunko@47
  5162
	    esac
melunko@47
  5163
	  done
melunko@47
  5164
	fi
melunko@47
  5165
melunko@47
  5166
	eval cmds=\"$old_archive_cmds\"
melunko@47
  5167
melunko@47
  5168
	if len=`expr "X$cmds" : ".*"` &&
melunko@47
  5169
	     test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
melunko@47
  5170
	  cmds=$old_archive_cmds
melunko@47
  5171
	else
melunko@47
  5172
	  # the command line is too long to link in one step, link in parts
melunko@47
  5173
	  $echo "using piecewise archive linking..."
melunko@47
  5174
	  save_RANLIB=$RANLIB
melunko@47
  5175
	  RANLIB=:
melunko@47
  5176
	  objlist=
melunko@47
  5177
	  concat_cmds=
melunko@47
  5178
	  save_oldobjs=$oldobjs
melunko@47
  5179
melunko@47
  5180
	  # Is there a better way of finding the last object in the list?
melunko@47
  5181
	  for obj in $save_oldobjs
melunko@47
  5182
	  do
melunko@47
  5183
	    last_oldobj=$obj
melunko@47
  5184
	  done
melunko@47
  5185
	  for obj in $save_oldobjs
melunko@47
  5186
	  do
melunko@47
  5187
	    oldobjs="$objlist $obj"
melunko@47
  5188
	    objlist="$objlist $obj"
melunko@47
  5189
	    eval test_cmds=\"$old_archive_cmds\"
melunko@47
  5190
	    if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
melunko@47
  5191
	       test "$len" -le "$max_cmd_len"; then
melunko@47
  5192
	      :
melunko@47
  5193
	    else
melunko@47
  5194
	      # the above command should be used before it gets too long
melunko@47
  5195
	      oldobjs=$objlist
melunko@47
  5196
	      if test "$obj" = "$last_oldobj" ; then
melunko@47
  5197
	        RANLIB=$save_RANLIB
melunko@47
  5198
	      fi
melunko@47
  5199
	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
melunko@47
  5200
	      eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
melunko@47
  5201
	      objlist=
melunko@47
  5202
	    fi
melunko@47
  5203
	  done
melunko@47
  5204
	  RANLIB=$save_RANLIB
melunko@47
  5205
	  oldobjs=$objlist
melunko@47
  5206
	  if test "X$oldobjs" = "X" ; then
melunko@47
  5207
	    eval cmds=\"\$concat_cmds\"
melunko@47
  5208
	  else
melunko@47
  5209
	    eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
melunko@47
  5210
	  fi
melunko@47
  5211
	fi
melunko@47
  5212
      fi
melunko@47
  5213
      save_ifs="$IFS"; IFS='~'
melunko@47
  5214
      for cmd in $cmds; do
melunko@47
  5215
        eval cmd=\"$cmd\"
melunko@47
  5216
	IFS="$save_ifs"
melunko@47
  5217
	$show "$cmd"
melunko@47
  5218
	$run eval "$cmd" || exit $?
melunko@47
  5219
      done
melunko@47
  5220
      IFS="$save_ifs"
melunko@47
  5221
    done
melunko@47
  5222
melunko@47
  5223
    if test -n "$generated"; then
melunko@47
  5224
      $show "${rm}r$generated"
melunko@47
  5225
      $run ${rm}r$generated
melunko@47
  5226
    fi
melunko@47
  5227
melunko@47
  5228
    # Now create the libtool archive.
melunko@47
  5229
    case $output in
melunko@47
  5230
    *.la)
melunko@47
  5231
      old_library=
melunko@47
  5232
      test "$build_old_libs" = yes && old_library="$libname.$libext"
melunko@47
  5233
      $show "creating $output"
melunko@47
  5234
melunko@47
  5235
      # Preserve any variables that may affect compiler behavior
melunko@47
  5236
      for var in $variables_saved_for_relink; do
melunko@47
  5237
	if eval test -z \"\${$var+set}\"; then
melunko@47
  5238
	  relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
melunko@47
  5239
	elif eval var_value=\$$var; test -z "$var_value"; then
melunko@47
  5240
	  relink_command="$var=; export $var; $relink_command"
melunko@47
  5241
	else
melunko@47
  5242
	  var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
melunko@47
  5243
	  relink_command="$var=\"$var_value\"; export $var; $relink_command"
melunko@47
  5244
	fi
melunko@47
  5245
      done
melunko@47
  5246
      # Quote the link command for shipping.
melunko@47
  5247
      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
melunko@47
  5248
      relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
melunko@47
  5249
      if test "$hardcode_automatic" = yes ; then
melunko@47
  5250
	relink_command=
melunko@47
  5251
      fi
melunko@47
  5252
melunko@47
  5253
melunko@47
  5254
      # Only create the output if not a dry run.
melunko@47
  5255
      if test -z "$run"; then
melunko@47
  5256
	for installed in no yes; do
melunko@47
  5257
	  if test "$installed" = yes; then
melunko@47
  5258
	    if test -z "$install_libdir"; then
melunko@47
  5259
	      break
melunko@47
  5260
	    fi
melunko@47
  5261
	    output="$output_objdir/$outputname"i
melunko@47
  5262
	    # Replace all uninstalled libtool libraries with the installed ones
melunko@47
  5263
	    newdependency_libs=
melunko@47
  5264
	    for deplib in $dependency_libs; do
melunko@47
  5265
	      case $deplib in
melunko@47
  5266
	      *.la)
melunko@47
  5267
		name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
melunko@47
  5268
		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
melunko@47
  5269
		if test -z "$libdir"; then
melunko@47
  5270
		  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
melunko@47
  5271
		  exit $EXIT_FAILURE
melunko@47
  5272
		fi
melunko@47
  5273
		newdependency_libs="$newdependency_libs $libdir/$name"
melunko@47
  5274
		;;
melunko@47
  5275
	      *) newdependency_libs="$newdependency_libs $deplib" ;;
melunko@47
  5276
	      esac
melunko@47
  5277
	    done
melunko@47
  5278
	    dependency_libs="$newdependency_libs"
melunko@47
  5279
	    newdlfiles=
melunko@47
  5280
	    for lib in $dlfiles; do
melunko@47
  5281
	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
melunko@47
  5282
	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
melunko@47
  5283
	      if test -z "$libdir"; then
melunko@47
  5284
		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
melunko@47
  5285
		exit $EXIT_FAILURE
melunko@47
  5286
	      fi
melunko@47
  5287
	      newdlfiles="$newdlfiles $libdir/$name"
melunko@47
  5288
	    done
melunko@47
  5289
	    dlfiles="$newdlfiles"
melunko@47
  5290
	    newdlprefiles=
melunko@47
  5291
	    for lib in $dlprefiles; do
melunko@47
  5292
	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
melunko@47
  5293
	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
melunko@47
  5294
	      if test -z "$libdir"; then
melunko@47
  5295
		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
melunko@47
  5296
		exit $EXIT_FAILURE
melunko@47
  5297
	      fi
melunko@47
  5298
	      newdlprefiles="$newdlprefiles $libdir/$name"
melunko@47
  5299
	    done
melunko@47
  5300
	    dlprefiles="$newdlprefiles"
melunko@47
  5301
	  else
melunko@47
  5302
	    newdlfiles=
melunko@47
  5303
	    for lib in $dlfiles; do
melunko@47
  5304
	      case $lib in
melunko@47
  5305
		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
melunko@47
  5306
		*) abs=`pwd`"/$lib" ;;
melunko@47
  5307
	      esac
melunko@47
  5308
	      newdlfiles="$newdlfiles $abs"
melunko@47
  5309
	    done
melunko@47
  5310
	    dlfiles="$newdlfiles"
melunko@47
  5311
	    newdlprefiles=
melunko@47
  5312
	    for lib in $dlprefiles; do
melunko@47
  5313
	      case $lib in
melunko@47
  5314
		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
melunko@47
  5315
		*) abs=`pwd`"/$lib" ;;
melunko@47
  5316
	      esac
melunko@47
  5317
	      newdlprefiles="$newdlprefiles $abs"
melunko@47
  5318
	    done
melunko@47
  5319
	    dlprefiles="$newdlprefiles"
melunko@47
  5320
	  fi
melunko@47
  5321
	  $rm $output
melunko@47
  5322
	  # place dlname in correct position for cygwin
melunko@47
  5323
	  tdlname=$dlname
melunko@47
  5324
	  case $host,$output,$installed,$module,$dlname in
melunko@47
  5325
	    *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
melunko@47
  5326
	  esac
melunko@47
  5327
	  $echo > $output "\
melunko@47
  5328
# $outputname - a libtool library file
melunko@47
  5329
# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
melunko@47
  5330
#
melunko@47
  5331
# Please DO NOT delete this file!
melunko@47
  5332
# It is necessary for linking the library.
melunko@47
  5333
melunko@47
  5334
# The name that we can dlopen(3).
melunko@47
  5335
dlname='$tdlname'
melunko@47
  5336
melunko@47
  5337
# Names of this library.
melunko@47
  5338
library_names='$library_names'
melunko@47
  5339
melunko@47
  5340
# The name of the static archive.
melunko@47
  5341
old_library='$old_library'
melunko@47
  5342
melunko@47
  5343
# Libraries that this one depends upon.
melunko@47
  5344
dependency_libs='$dependency_libs'
melunko@47
  5345
melunko@47
  5346
# Version information for $libname.
melunko@47
  5347
current=$current
melunko@47
  5348
age=$age
melunko@47
  5349
revision=$revision
melunko@47
  5350
melunko@47
  5351
# Is this an already installed library?
melunko@47
  5352
installed=$installed
melunko@47
  5353
melunko@47
  5354
# Should we warn about portability when linking against -modules?
melunko@47
  5355
shouldnotlink=$module
melunko@47
  5356
melunko@47
  5357
# Files to dlopen/dlpreopen
melunko@47
  5358
dlopen='$dlfiles'
melunko@47
  5359
dlpreopen='$dlprefiles'
melunko@47
  5360
melunko@47
  5361
# Directory that this library needs to be installed in:
melunko@47
  5362
libdir='$install_libdir'"
melunko@47
  5363
	  if test "$installed" = no && test "$need_relink" = yes; then
melunko@47
  5364
	    $echo >> $output "\
melunko@47
  5365
relink_command=\"$relink_command\""
melunko@47
  5366
	  fi
melunko@47
  5367
	done
melunko@47
  5368
      fi
melunko@47
  5369
melunko@47
  5370
      # Do a symbolic link so that the libtool archive can be found in
melunko@47
  5371
      # LD_LIBRARY_PATH before the program is installed.
melunko@47
  5372
      $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
melunko@47
  5373
      $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
melunko@47
  5374
      ;;
melunko@47
  5375
    esac
melunko@47
  5376
    exit $EXIT_SUCCESS
melunko@47
  5377
    ;;
melunko@47
  5378
melunko@47
  5379
  # libtool install mode
melunko@47
  5380
  install)
melunko@47
  5381
    modename="$modename: install"
melunko@47
  5382
melunko@47
  5383
    # There may be an optional sh(1) argument at the beginning of
melunko@47
  5384
    # install_prog (especially on Windows NT).
melunko@47
  5385
    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
melunko@47
  5386
       # Allow the use of GNU shtool's install command.
melunko@47
  5387
       $echo "X$nonopt" | grep shtool > /dev/null; then
melunko@47
  5388
      # Aesthetically quote it.
melunko@47
  5389
      arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
melunko@47
  5390
      case $arg in
melunko@47
  5391
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
melunko@47
  5392
	arg="\"$arg\""
melunko@47
  5393
	;;
melunko@47
  5394
      esac
melunko@47
  5395
      install_prog="$arg "
melunko@47
  5396
      arg="$1"
melunko@47
  5397
      shift
melunko@47
  5398
    else
melunko@47
  5399
      install_prog=
melunko@47
  5400
      arg=$nonopt
melunko@47
  5401
    fi
melunko@47
  5402
melunko@47
  5403
    # The real first argument should be the name of the installation program.
melunko@47
  5404
    # Aesthetically quote it.
melunko@47
  5405
    arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
melunko@47
  5406
    case $arg in
melunko@47
  5407
    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
melunko@47
  5408
      arg="\"$arg\""
melunko@47
  5409
      ;;
melunko@47
  5410
    esac
melunko@47
  5411
    install_prog="$install_prog$arg"
melunko@47
  5412
melunko@47
  5413
    # We need to accept at least all the BSD install flags.
melunko@47
  5414
    dest=
melunko@47
  5415
    files=
melunko@47
  5416
    opts=
melunko@47
  5417
    prev=
melunko@47
  5418
    install_type=
melunko@47
  5419
    isdir=no
melunko@47
  5420
    stripme=
melunko@47
  5421
    for arg
melunko@47
  5422
    do
melunko@47
  5423
      if test -n "$dest"; then
melunko@47
  5424
	files="$files $dest"
melunko@47
  5425
	dest=$arg
melunko@47
  5426
	continue
melunko@47
  5427
      fi
melunko@47
  5428
melunko@47
  5429
      case $arg in
melunko@47
  5430
      -d) isdir=yes ;;
melunko@47
  5431
      -f) 
melunko@47
  5432
      	case " $install_prog " in
melunko@47
  5433
	*[\\\ /]cp\ *) ;;
melunko@47
  5434
	*) prev=$arg ;;
melunko@47
  5435
	esac
melunko@47
  5436
	;;
melunko@47
  5437
      -g | -m | -o) prev=$arg ;;
melunko@47
  5438
      -s)
melunko@47
  5439
	stripme=" -s"
melunko@47
  5440
	continue
melunko@47
  5441
	;;
melunko@47
  5442
      -*)
melunko@47
  5443
	;;
melunko@47
  5444
      *)
melunko@47
  5445
	# If the previous option needed an argument, then skip it.
melunko@47
  5446
	if test -n "$prev"; then
melunko@47
  5447
	  prev=
melunko@47
  5448
	else
melunko@47
  5449
	  dest=$arg
melunko@47
  5450
	  continue
melunko@47
  5451
	fi
melunko@47
  5452
	;;
melunko@47
  5453
      esac
melunko@47
  5454
melunko@47
  5455
      # Aesthetically quote the argument.
melunko@47
  5456
      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
melunko@47
  5457
      case $arg in
melunko@47
  5458
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
melunko@47
  5459
	arg="\"$arg\""
melunko@47
  5460
	;;
melunko@47
  5461
      esac
melunko@47
  5462
      install_prog="$install_prog $arg"
melunko@47
  5463
    done
melunko@47
  5464
melunko@47
  5465
    if test -z "$install_prog"; then
melunko@47
  5466
      $echo "$modename: you must specify an install program" 1>&2
melunko@47
  5467
      $echo "$help" 1>&2
melunko@47
  5468
      exit $EXIT_FAILURE
melunko@47
  5469
    fi
melunko@47
  5470
melunko@47
  5471
    if test -n "$prev"; then
melunko@47
  5472
      $echo "$modename: the \`$prev' option requires an argument" 1>&2
melunko@47
  5473
      $echo "$help" 1>&2
melunko@47
  5474
      exit $EXIT_FAILURE
melunko@47
  5475
    fi
melunko@47
  5476
melunko@47
  5477
    if test -z "$files"; then
melunko@47
  5478
      if test -z "$dest"; then
melunko@47
  5479
	$echo "$modename: no file or destination specified" 1>&2
melunko@47
  5480
      else
melunko@47
  5481
	$echo "$modename: you must specify a destination" 1>&2
melunko@47
  5482
      fi
melunko@47
  5483
      $echo "$help" 1>&2
melunko@47
  5484
      exit $EXIT_FAILURE
melunko@47
  5485
    fi
melunko@47
  5486
melunko@47
  5487
    # Strip any trailing slash from the destination.
melunko@47
  5488
    dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
melunko@47
  5489
melunko@47
  5490
    # Check to see that the destination is a directory.
melunko@47
  5491
    test -d "$dest" && isdir=yes
melunko@47
  5492
    if test "$isdir" = yes; then
melunko@47
  5493
      destdir="$dest"
melunko@47
  5494
      destname=
melunko@47
  5495
    else
melunko@47
  5496
      destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
melunko@47
  5497
      test "X$destdir" = "X$dest" && destdir=.
melunko@47
  5498
      destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
melunko@47
  5499
melunko@47
  5500
      # Not a directory, so check to see that there is only one file specified.
melunko@47
  5501
      set dummy $files
melunko@47
  5502
      if test "$#" -gt 2; then
melunko@47
  5503
	$echo "$modename: \`$dest' is not a directory" 1>&2
melunko@47
  5504
	$echo "$help" 1>&2
melunko@47
  5505
	exit $EXIT_FAILURE
melunko@47
  5506
      fi
melunko@47
  5507
    fi
melunko@47
  5508
    case $destdir in
melunko@47
  5509
    [\\/]* | [A-Za-z]:[\\/]*) ;;
melunko@47
  5510
    *)
melunko@47
  5511
      for file in $files; do
melunko@47
  5512
	case $file in
melunko@47
  5513
	*.lo) ;;
melunko@47
  5514
	*)
melunko@47
  5515
	  $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
melunko@47
  5516
	  $echo "$help" 1>&2
melunko@47
  5517
	  exit $EXIT_FAILURE
melunko@47
  5518
	  ;;
melunko@47
  5519
	esac
melunko@47
  5520
      done
melunko@47
  5521
      ;;
melunko@47
  5522
    esac
melunko@47
  5523
melunko@47
  5524
    # This variable tells wrapper scripts just to set variables rather
melunko@47
  5525
    # than running their programs.
melunko@47
  5526
    libtool_install_magic="$magic"
melunko@47
  5527
melunko@47
  5528
    staticlibs=
melunko@47
  5529
    future_libdirs=
melunko@47
  5530
    current_libdirs=
melunko@47
  5531
    for file in $files; do
melunko@47
  5532
melunko@47
  5533
      # Do each installation.
melunko@47
  5534
      case $file in
melunko@47
  5535
      *.$libext)
melunko@47
  5536
	# Do the static libraries later.
melunko@47
  5537
	staticlibs="$staticlibs $file"
melunko@47
  5538
	;;
melunko@47
  5539
melunko@47
  5540
      *.la)
melunko@47
  5541
	# Check to see that this really is a libtool archive.
melunko@47
  5542
	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
melunko@47
  5543
	else
melunko@47
  5544
	  $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
melunko@47
  5545
	  $echo "$help" 1>&2
melunko@47
  5546
	  exit $EXIT_FAILURE
melunko@47
  5547
	fi
melunko@47
  5548
melunko@47
  5549
	library_names=
melunko@47
  5550
	old_library=
melunko@47
  5551
	relink_command=
melunko@47
  5552
	# If there is no directory component, then add one.
melunko@47
  5553
	case $file in
melunko@47
  5554
	*/* | *\\*) . $file ;;
melunko@47
  5555
	*) . ./$file ;;
melunko@47
  5556
	esac
melunko@47
  5557
melunko@47
  5558
	# Add the libdir to current_libdirs if it is the destination.
melunko@47
  5559
	if test "X$destdir" = "X$libdir"; then
melunko@47
  5560
	  case "$current_libdirs " in
melunko@47
  5561
	  *" $libdir "*) ;;
melunko@47
  5562
	  *) current_libdirs="$current_libdirs $libdir" ;;
melunko@47
  5563
	  esac
melunko@47
  5564
	else
melunko@47
  5565
	  # Note the libdir as a future libdir.
melunko@47
  5566
	  case "$future_libdirs " in
melunko@47
  5567
	  *" $libdir "*) ;;
melunko@47
  5568
	  *) future_libdirs="$future_libdirs $libdir" ;;
melunko@47
  5569
	  esac
melunko@47
  5570
	fi
melunko@47
  5571
melunko@47
  5572
	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
melunko@47
  5573
	test "X$dir" = "X$file/" && dir=
melunko@47
  5574
	dir="$dir$objdir"
melunko@47
  5575
melunko@47
  5576
	if test -n "$relink_command"; then
melunko@47
  5577
	  # Determine the prefix the user has applied to our future dir.
melunko@47
  5578
	  inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
melunko@47
  5579
melunko@47
  5580
	  # Don't allow the user to place us outside of our expected
melunko@47
  5581
	  # location b/c this prevents finding dependent libraries that
melunko@47
  5582
	  # are installed to the same prefix.
melunko@47
  5583
	  # At present, this check doesn't affect windows .dll's that
melunko@47
  5584
	  # are installed into $libdir/../bin (currently, that works fine)
melunko@47
  5585
	  # but it's something to keep an eye on.
melunko@47
  5586
	  if test "$inst_prefix_dir" = "$destdir"; then
melunko@47
  5587
	    $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
melunko@47
  5588
	    exit $EXIT_FAILURE
melunko@47
  5589
	  fi
melunko@47
  5590
melunko@47
  5591
	  if test -n "$inst_prefix_dir"; then
melunko@47
  5592
	    # Stick the inst_prefix_dir data into the link command.
melunko@47
  5593
	    relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
melunko@47
  5594
	  else
melunko@47
  5595
	    relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
melunko@47
  5596
	  fi
melunko@47
  5597
melunko@47
  5598
	  $echo "$modename: warning: relinking \`$file'" 1>&2
melunko@47
  5599
	  $show "$relink_command"
melunko@47
  5600
	  if $run eval "$relink_command"; then :
melunko@47
  5601
	  else
melunko@47
  5602
	    $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
melunko@47
  5603
	    exit $EXIT_FAILURE
melunko@47
  5604
	  fi
melunko@47
  5605
	fi
melunko@47
  5606
melunko@47
  5607
	# See the names of the shared library.
melunko@47
  5608
	set dummy $library_names
melunko@47
  5609
	if test -n "$2"; then
melunko@47
  5610
	  realname="$2"
melunko@47
  5611
	  shift
melunko@47
  5612
	  shift
melunko@47
  5613
melunko@47
  5614
	  srcname="$realname"
melunko@47
  5615
	  test -n "$relink_command" && srcname="$realname"T
melunko@47
  5616
melunko@47
  5617
	  # Install the shared library and build the symlinks.
melunko@47
  5618
	  $show "$install_prog $dir/$srcname $destdir/$realname"
melunko@47
  5619
	  $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
melunko@47
  5620
	  if test -n "$stripme" && test -n "$striplib"; then
melunko@47
  5621
	    $show "$striplib $destdir/$realname"
melunko@47
  5622
	    $run eval "$striplib $destdir/$realname" || exit $?
melunko@47
  5623
	  fi
melunko@47
  5624
melunko@47
  5625
	  if test "$#" -gt 0; then
melunko@47
  5626
	    # Delete the old symlinks, and create new ones.
melunko@47
  5627
	    # Try `ln -sf' first, because the `ln' binary might depend on
melunko@47
  5628
	    # the symlink we replace!  Solaris /bin/ln does not understand -f,
melunko@47
  5629
	    # so we also need to try rm && ln -s.
melunko@47
  5630
	    for linkname
melunko@47
  5631
	    do
melunko@47
  5632
	      if test "$linkname" != "$realname"; then
melunko@47
  5633
                $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
melunko@47
  5634
                $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
melunko@47
  5635
	      fi
melunko@47
  5636
	    done
melunko@47
  5637
	  fi
melunko@47
  5638
melunko@47
  5639
	  # Do each command in the postinstall commands.
melunko@47
  5640
	  lib="$destdir/$realname"
melunko@47
  5641
	  cmds=$postinstall_cmds
melunko@47
  5642
	  save_ifs="$IFS"; IFS='~'
melunko@47
  5643
	  for cmd in $cmds; do
melunko@47
  5644
	    IFS="$save_ifs"
melunko@47
  5645
	    eval cmd=\"$cmd\"
melunko@47
  5646
	    $show "$cmd"
melunko@47
  5647
	    $run eval "$cmd" || {
melunko@47
  5648
	      lt_exit=$?
melunko@47
  5649
melunko@47
  5650
	      # Restore the uninstalled library and exit
melunko@47
  5651
	      if test "$mode" = relink; then
melunko@47
  5652
		$run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
melunko@47
  5653
	      fi
melunko@47
  5654
melunko@47
  5655
	      exit $lt_exit
melunko@47
  5656
	    }
melunko@47
  5657
	  done
melunko@47
  5658
	  IFS="$save_ifs"
melunko@47
  5659
	fi
melunko@47
  5660
melunko@47
  5661
	# Install the pseudo-library for information purposes.
melunko@47
  5662
	name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
melunko@47
  5663
	instname="$dir/$name"i
melunko@47
  5664
	$show "$install_prog $instname $destdir/$name"
melunko@47
  5665
	$run eval "$install_prog $instname $destdir/$name" || exit $?
melunko@47
  5666
melunko@47
  5667
	# Maybe install the static library, too.
melunko@47
  5668
	test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
melunko@47
  5669
	;;
melunko@47
  5670
melunko@47
  5671
      *.lo)
melunko@47
  5672
	# Install (i.e. copy) a libtool object.
melunko@47
  5673
melunko@47
  5674
	# Figure out destination file name, if it wasn't already specified.
melunko@47
  5675
	if test -n "$destname"; then
melunko@47
  5676
	  destfile="$destdir/$destname"
melunko@47
  5677
	else
melunko@47
  5678
	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
melunko@47
  5679
	  destfile="$destdir/$destfile"
melunko@47
  5680
	fi
melunko@47
  5681
melunko@47
  5682
	# Deduce the name of the destination old-style object file.
melunko@47
  5683
	case $destfile in
melunko@47
  5684
	*.lo)
melunko@47
  5685
	  staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
melunko@47
  5686
	  ;;
melunko@47
  5687
	*.$objext)
melunko@47
  5688
	  staticdest="$destfile"
melunko@47
  5689
	  destfile=
melunko@47
  5690
	  ;;
melunko@47
  5691
	*)
melunko@47
  5692
	  $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
melunko@47
  5693
	  $echo "$help" 1>&2
melunko@47
  5694
	  exit $EXIT_FAILURE
melunko@47
  5695
	  ;;
melunko@47
  5696
	esac
melunko@47
  5697
melunko@47
  5698
	# Install the libtool object if requested.
melunko@47
  5699
	if test -n "$destfile"; then
melunko@47
  5700
	  $show "$install_prog $file $destfile"
melunko@47
  5701
	  $run eval "$install_prog $file $destfile" || exit $?
melunko@47
  5702
	fi
melunko@47
  5703
melunko@47
  5704
	# Install the old object if enabled.
melunko@47
  5705
	if test "$build_old_libs" = yes; then
melunko@47
  5706
	  # Deduce the name of the old-style object file.
melunko@47
  5707
	  staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
melunko@47
  5708
melunko@47
  5709
	  $show "$install_prog $staticobj $staticdest"
melunko@47
  5710
	  $run eval "$install_prog \$staticobj \$staticdest" || exit $?
melunko@47
  5711
	fi
melunko@47
  5712
	exit $EXIT_SUCCESS
melunko@47
  5713
	;;
melunko@47
  5714
melunko@47
  5715
      *)
melunko@47
  5716
	# Figure out destination file name, if it wasn't already specified.
melunko@47
  5717
	if test -n "$destname"; then
melunko@47
  5718
	  destfile="$destdir/$destname"
melunko@47
  5719
	else
melunko@47
  5720
	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
melunko@47
  5721
	  destfile="$destdir/$destfile"
melunko@47
  5722
	fi
melunko@47
  5723
melunko@47
  5724
	# If the file is missing, and there is a .exe on the end, strip it
melunko@47
  5725
	# because it is most likely a libtool script we actually want to
melunko@47
  5726
	# install
melunko@47
  5727
	stripped_ext=""
melunko@47
  5728
	case $file in
melunko@47
  5729
	  *.exe)
melunko@47
  5730
	    if test ! -f "$file"; then
melunko@47
  5731
	      file=`$echo $file|${SED} 's,.exe$,,'`
melunko@47
  5732
	      stripped_ext=".exe"
melunko@47
  5733
	    fi
melunko@47
  5734
	    ;;
melunko@47
  5735
	esac
melunko@47
  5736
melunko@47
  5737
	# Do a test to see if this is really a libtool program.
melunko@47
  5738
	case $host in
melunko@47
  5739
	*cygwin*|*mingw*)
melunko@47
  5740
	    wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
melunko@47
  5741
	    ;;
melunko@47
  5742
	*)
melunko@47
  5743
	    wrapper=$file
melunko@47
  5744
	    ;;
melunko@47
  5745
	esac
melunko@47
  5746
	if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
melunko@47
  5747
	  notinst_deplibs=
melunko@47
  5748
	  relink_command=
melunko@47
  5749
melunko@47
  5750
	  # Note that it is not necessary on cygwin/mingw to append a dot to
melunko@47
  5751
	  # foo even if both foo and FILE.exe exist: automatic-append-.exe
melunko@47
  5752
	  # behavior happens only for exec(3), not for open(2)!  Also, sourcing
melunko@47
  5753
	  # `FILE.' does not work on cygwin managed mounts.
melunko@47
  5754
	  #
melunko@47
  5755
	  # If there is no directory component, then add one.
melunko@47
  5756
	  case $wrapper in
melunko@47
  5757
	  */* | *\\*) . ${wrapper} ;;
melunko@47
  5758
	  *) . ./${wrapper} ;;
melunko@47
  5759
	  esac
melunko@47
  5760
melunko@47
  5761
	  # Check the variables that should have been set.
melunko@47
  5762
	  if test -z "$notinst_deplibs"; then
melunko@47
  5763
	    $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
melunko@47
  5764
	    exit $EXIT_FAILURE
melunko@47
  5765
	  fi
melunko@47
  5766
melunko@47
  5767
	  finalize=yes
melunko@47
  5768
	  for lib in $notinst_deplibs; do
melunko@47
  5769
	    # Check to see that each library is installed.
melunko@47
  5770
	    libdir=
melunko@47
  5771
	    if test -f "$lib"; then
melunko@47
  5772
	      # If there is no directory component, then add one.
melunko@47
  5773
	      case $lib in
melunko@47
  5774
	      */* | *\\*) . $lib ;;
melunko@47
  5775
	      *) . ./$lib ;;
melunko@47
  5776
	      esac
melunko@47
  5777
	    fi
melunko@47
  5778
	    libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
melunko@47
  5779
	    if test -n "$libdir" && test ! -f "$libfile"; then
melunko@47
  5780
	      $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
melunko@47
  5781
	      finalize=no
melunko@47
  5782
	    fi
melunko@47
  5783
	  done
melunko@47
  5784
melunko@47
  5785
	  relink_command=
melunko@47
  5786
	  # Note that it is not necessary on cygwin/mingw to append a dot to
melunko@47
  5787
	  # foo even if both foo and FILE.exe exist: automatic-append-.exe
melunko@47
  5788
	  # behavior happens only for exec(3), not for open(2)!  Also, sourcing
melunko@47
  5789
	  # `FILE.' does not work on cygwin managed mounts.
melunko@47
  5790
	  #
melunko@47
  5791
	  # If there is no directory component, then add one.
melunko@47
  5792
	  case $wrapper in
melunko@47
  5793
	  */* | *\\*) . ${wrapper} ;;
melunko@47
  5794
	  *) . ./${wrapper} ;;
melunko@47
  5795
	  esac
melunko@47
  5796
melunko@47
  5797
	  outputname=
melunko@47
  5798
	  if test "$fast_install" = no && test -n "$relink_command"; then
melunko@47
  5799
	    if test "$finalize" = yes && test -z "$run"; then
melunko@47
  5800
	      tmpdir="/tmp"
melunko@47
  5801
	      test -n "$TMPDIR" && tmpdir="$TMPDIR"
melunko@47
  5802
	      tmpdir="$tmpdir/libtool-$$"
melunko@47
  5803
	      save_umask=`umask`
melunko@47
  5804
	      umask 0077
melunko@47
  5805
	      if $mkdir "$tmpdir"; then
melunko@47
  5806
	        umask $save_umask
melunko@47
  5807
	      else
melunko@47
  5808
	        umask $save_umask
melunko@47
  5809
		$echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
melunko@47
  5810
		continue
melunko@47
  5811
	      fi
melunko@47
  5812
	      file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
melunko@47
  5813
	      outputname="$tmpdir/$file"
melunko@47
  5814
	      # Replace the output file specification.
melunko@47
  5815
	      relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
melunko@47
  5816
melunko@47
  5817
	      $show "$relink_command"
melunko@47
  5818
	      if $run eval "$relink_command"; then :
melunko@47
  5819
	      else
melunko@47
  5820
		$echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
melunko@47
  5821
		${rm}r "$tmpdir"
melunko@47
  5822
		continue
melunko@47
  5823
	      fi
melunko@47
  5824
	      file="$outputname"
melunko@47
  5825
	    else
melunko@47
  5826
	      $echo "$modename: warning: cannot relink \`$file'" 1>&2
melunko@47
  5827
	    fi
melunko@47
  5828
	  else
melunko@47
  5829
	    # Install the binary that we compiled earlier.
melunko@47
  5830
	    file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
melunko@47
  5831
	  fi
melunko@47
  5832
	fi
melunko@47
  5833
melunko@47
  5834
	# remove .exe since cygwin /usr/bin/install will append another
melunko@47
  5835
	# one anyway 
melunko@47
  5836
	case $install_prog,$host in
melunko@47
  5837
	*/usr/bin/install*,*cygwin*)
melunko@47
  5838
	  case $file:$destfile in
melunko@47
  5839
	  *.exe:*.exe)
melunko@47
  5840
	    # this is ok
melunko@47
  5841
	    ;;
melunko@47
  5842
	  *.exe:*)
melunko@47
  5843
	    destfile=$destfile.exe
melunko@47
  5844
	    ;;
melunko@47
  5845
	  *:*.exe)
melunko@47
  5846
	    destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
melunko@47
  5847
	    ;;
melunko@47
  5848
	  esac
melunko@47
  5849
	  ;;
melunko@47
  5850
	esac
melunko@47
  5851
	$show "$install_prog$stripme $file $destfile"
melunko@47
  5852
	$run eval "$install_prog\$stripme \$file \$destfile" || exit $?
melunko@47
  5853
	test -n "$outputname" && ${rm}r "$tmpdir"
melunko@47
  5854
	;;
melunko@47
  5855
      esac
melunko@47
  5856
    done
melunko@47
  5857
melunko@47
  5858
    for file in $staticlibs; do
melunko@47
  5859
      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
melunko@47
  5860
melunko@47
  5861
      # Set up the ranlib parameters.
melunko@47
  5862
      oldlib="$destdir/$name"
melunko@47
  5863
melunko@47
  5864
      $show "$install_prog $file $oldlib"
melunko@47
  5865
      $run eval "$install_prog \$file \$oldlib" || exit $?
melunko@47
  5866
melunko@47
  5867
      if test -n "$stripme" && test -n "$old_striplib"; then
melunko@47
  5868
	$show "$old_striplib $oldlib"
melunko@47
  5869
	$run eval "$old_striplib $oldlib" || exit $?
melunko@47
  5870
      fi
melunko@47
  5871
melunko@47
  5872
      # Do each command in the postinstall commands.
melunko@47
  5873
      cmds=$old_postinstall_cmds
melunko@47
  5874
      save_ifs="$IFS"; IFS='~'
melunko@47
  5875
      for cmd in $cmds; do
melunko@47
  5876
	IFS="$save_ifs"
melunko@47
  5877
	eval cmd=\"$cmd\"
melunko@47
  5878
	$show "$cmd"
melunko@47
  5879
	$run eval "$cmd" || exit $?
melunko@47
  5880
      done
melunko@47
  5881
      IFS="$save_ifs"
melunko@47
  5882
    done
melunko@47
  5883
melunko@47
  5884
    if test -n "$future_libdirs"; then
melunko@47
  5885
      $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
melunko@47
  5886
    fi
melunko@47
  5887
melunko@47
  5888
    if test -n "$current_libdirs"; then
melunko@47
  5889
      # Maybe just do a dry run.
melunko@47
  5890
      test -n "$run" && current_libdirs=" -n$current_libdirs"
melunko@47
  5891
      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
melunko@47
  5892
    else
melunko@47
  5893
      exit $EXIT_SUCCESS
melunko@47
  5894
    fi
melunko@47
  5895
    ;;
melunko@47
  5896
melunko@47
  5897
  # libtool finish mode
melunko@47
  5898
  finish)
melunko@47
  5899
    modename="$modename: finish"
melunko@47
  5900
    libdirs="$nonopt"
melunko@47
  5901
    admincmds=
melunko@47
  5902
melunko@47
  5903
    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
melunko@47
  5904
      for dir
melunko@47
  5905
      do
melunko@47
  5906
	libdirs="$libdirs $dir"
melunko@47
  5907
      done
melunko@47
  5908
melunko@47
  5909
      for libdir in $libdirs; do
melunko@47
  5910
	if test -n "$finish_cmds"; then
melunko@47
  5911
	  # Do each command in the finish commands.
melunko@47
  5912
	  cmds=$finish_cmds
melunko@47
  5913
	  save_ifs="$IFS"; IFS='~'
melunko@47
  5914
	  for cmd in $cmds; do
melunko@47
  5915
	    IFS="$save_ifs"
melunko@47
  5916
	    eval cmd=\"$cmd\"
melunko@47
  5917
	    $show "$cmd"
melunko@47
  5918
	    $run eval "$cmd" || admincmds="$admincmds
melunko@47
  5919
       $cmd"
melunko@47
  5920
	  done
melunko@47
  5921
	  IFS="$save_ifs"
melunko@47
  5922
	fi
melunko@47
  5923
	if test -n "$finish_eval"; then
melunko@47
  5924
	  # Do the single finish_eval.
melunko@47
  5925
	  eval cmds=\"$finish_eval\"
melunko@47
  5926
	  $run eval "$cmds" || admincmds="$admincmds
melunko@47
  5927
       $cmds"
melunko@47
  5928
	fi
melunko@47
  5929
      done
melunko@47
  5930
    fi
melunko@47
  5931
melunko@47
  5932
    # Exit here if they wanted silent mode.
melunko@47
  5933
    test "$show" = : && exit $EXIT_SUCCESS
melunko@47
  5934
melunko@47
  5935
    $echo "----------------------------------------------------------------------"
melunko@47
  5936
    $echo "Libraries have been installed in:"
melunko@47
  5937
    for libdir in $libdirs; do
melunko@47
  5938
      $echo "   $libdir"
melunko@47
  5939
    done
melunko@47
  5940
    $echo
melunko@47
  5941
    $echo "If you ever happen to want to link against installed libraries"
melunko@47
  5942
    $echo "in a given directory, LIBDIR, you must either use libtool, and"
melunko@47
  5943
    $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
melunko@47
  5944
    $echo "flag during linking and do at least one of the following:"
melunko@47
  5945
    if test -n "$shlibpath_var"; then
melunko@47
  5946
      $echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
melunko@47
  5947
      $echo "     during execution"
melunko@47
  5948
    fi
melunko@47
  5949
    if test -n "$runpath_var"; then
melunko@47
  5950
      $echo "   - add LIBDIR to the \`$runpath_var' environment variable"
melunko@47
  5951
      $echo "     during linking"
melunko@47
  5952
    fi
melunko@47
  5953
    if test -n "$hardcode_libdir_flag_spec"; then
melunko@47
  5954
      libdir=LIBDIR
melunko@47
  5955
      eval flag=\"$hardcode_libdir_flag_spec\"
melunko@47
  5956
melunko@47
  5957
      $echo "   - use the \`$flag' linker flag"
melunko@47
  5958
    fi
melunko@47
  5959
    if test -n "$admincmds"; then
melunko@47
  5960
      $echo "   - have your system administrator run these commands:$admincmds"
melunko@47
  5961
    fi
melunko@47
  5962
    if test -f /etc/ld.so.conf; then
melunko@47
  5963
      $echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
melunko@47
  5964
    fi
melunko@47
  5965
    $echo
melunko@47
  5966
    $echo "See any operating system documentation about shared libraries for"
melunko@47
  5967
    $echo "more information, such as the ld(1) and ld.so(8) manual pages."
melunko@47
  5968
    $echo "----------------------------------------------------------------------"
melunko@47
  5969
    exit $EXIT_SUCCESS
melunko@47
  5970
    ;;
melunko@47
  5971
melunko@47
  5972
  # libtool execute mode
melunko@47
  5973
  execute)
melunko@47
  5974
    modename="$modename: execute"
melunko@47
  5975
melunko@47
  5976
    # The first argument is the command name.
melunko@47
  5977
    cmd="$nonopt"
melunko@47
  5978
    if test -z "$cmd"; then
melunko@47
  5979
      $echo "$modename: you must specify a COMMAND" 1>&2
melunko@47
  5980
      $echo "$help"
melunko@47
  5981
      exit $EXIT_FAILURE
melunko@47
  5982
    fi
melunko@47
  5983
melunko@47
  5984
    # Handle -dlopen flags immediately.
melunko@47
  5985
    for file in $execute_dlfiles; do
melunko@47
  5986
      if test ! -f "$file"; then
melunko@47
  5987
	$echo "$modename: \`$file' is not a file" 1>&2
melunko@47
  5988
	$echo "$help" 1>&2
melunko@47
  5989
	exit $EXIT_FAILURE
melunko@47
  5990
      fi
melunko@47
  5991
melunko@47
  5992
      dir=
melunko@47
  5993
      case $file in
melunko@47
  5994
      *.la)
melunko@47
  5995
	# Check to see that this really is a libtool archive.
melunko@47
  5996
	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
melunko@47
  5997
	else
melunko@47
  5998
	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
melunko@47
  5999
	  $echo "$help" 1>&2
melunko@47
  6000
	  exit $EXIT_FAILURE
melunko@47
  6001
	fi
melunko@47
  6002
melunko@47
  6003
	# Read the libtool library.
melunko@47
  6004
	dlname=
melunko@47
  6005
	library_names=
melunko@47
  6006
melunko@47
  6007
	# If there is no directory component, then add one.
melunko@47
  6008
	case $file in
melunko@47
  6009
	*/* | *\\*) . $file ;;
melunko@47
  6010
	*) . ./$file ;;
melunko@47
  6011
	esac
melunko@47
  6012
melunko@47
  6013
	# Skip this library if it cannot be dlopened.
melunko@47
  6014
	if test -z "$dlname"; then
melunko@47
  6015
	  # Warn if it was a shared library.
melunko@47
  6016
	  test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
melunko@47
  6017
	  continue
melunko@47
  6018
	fi
melunko@47
  6019
melunko@47
  6020
	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
melunko@47
  6021
	test "X$dir" = "X$file" && dir=.
melunko@47
  6022
melunko@47
  6023
	if test -f "$dir/$objdir/$dlname"; then
melunko@47
  6024
	  dir="$dir/$objdir"
melunko@47
  6025
	else
melunko@47
  6026
	  $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
melunko@47
  6027
	  exit $EXIT_FAILURE
melunko@47
  6028
	fi
melunko@47
  6029
	;;
melunko@47
  6030
melunko@47
  6031
      *.lo)
melunko@47
  6032
	# Just add the directory containing the .lo file.
melunko@47
  6033
	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
melunko@47
  6034
	test "X$dir" = "X$file" && dir=.
melunko@47
  6035
	;;
melunko@47
  6036
melunko@47
  6037
      *)
melunko@47
  6038
	$echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
melunko@47
  6039
	continue
melunko@47
  6040
	;;
melunko@47
  6041
      esac
melunko@47
  6042
melunko@47
  6043
      # Get the absolute pathname.
melunko@47
  6044
      absdir=`cd "$dir" && pwd`
melunko@47
  6045
      test -n "$absdir" && dir="$absdir"
melunko@47
  6046
melunko@47
  6047
      # Now add the directory to shlibpath_var.
melunko@47
  6048
      if eval "test -z \"\$$shlibpath_var\""; then
melunko@47
  6049
	eval "$shlibpath_var=\"\$dir\""
melunko@47
  6050
      else
melunko@47
  6051
	eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
melunko@47
  6052
      fi
melunko@47
  6053
    done
melunko@47
  6054
melunko@47
  6055
    # This variable tells wrapper scripts just to set shlibpath_var
melunko@47
  6056
    # rather than running their programs.
melunko@47
  6057
    libtool_execute_magic="$magic"
melunko@47
  6058
melunko@47
  6059
    # Check if any of the arguments is a wrapper script.
melunko@47
  6060
    args=
melunko@47
  6061
    for file
melunko@47
  6062
    do
melunko@47
  6063
      case $file in
melunko@47
  6064
      -*) ;;
melunko@47
  6065
      *)
melunko@47
  6066
	# Do a test to see if this is really a libtool program.
melunko@47
  6067
	if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
melunko@47
  6068
	  # If there is no directory component, then add one.
melunko@47
  6069
	  case $file in
melunko@47
  6070
	  */* | *\\*) . $file ;;
melunko@47
  6071
	  *) . ./$file ;;
melunko@47
  6072
	  esac
melunko@47
  6073
melunko@47
  6074
	  # Transform arg to wrapped name.
melunko@47
  6075
	  file="$progdir/$program"
melunko@47
  6076
	fi
melunko@47
  6077
	;;
melunko@47
  6078
      esac
melunko@47
  6079
      # Quote arguments (to preserve shell metacharacters).
melunko@47
  6080
      file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
melunko@47
  6081
      args="$args \"$file\""
melunko@47
  6082
    done
melunko@47
  6083
melunko@47
  6084
    if test -z "$run"; then
melunko@47
  6085
      if test -n "$shlibpath_var"; then
melunko@47
  6086
	# Export the shlibpath_var.
melunko@47
  6087
	eval "export $shlibpath_var"
melunko@47
  6088
      fi
melunko@47
  6089
melunko@47
  6090
      # Restore saved environment variables
melunko@47
  6091
      if test "${save_LC_ALL+set}" = set; then
melunko@47
  6092
	LC_ALL="$save_LC_ALL"; export LC_ALL
melunko@47
  6093
      fi
melunko@47
  6094
      if test "${save_LANG+set}" = set; then
melunko@47
  6095
	LANG="$save_LANG"; export LANG
melunko@47
  6096
      fi
melunko@47
  6097
melunko@47
  6098
      # Now prepare to actually exec the command.
melunko@47
  6099
      exec_cmd="\$cmd$args"
melunko@47
  6100
    else
melunko@47
  6101
      # Display what would be done.
melunko@47
  6102
      if test -n "$shlibpath_var"; then
melunko@47
  6103
	eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
melunko@47
  6104
	$echo "export $shlibpath_var"
melunko@47
  6105
      fi
melunko@47
  6106
      $echo "$cmd$args"
melunko@47
  6107
      exit $EXIT_SUCCESS
melunko@47
  6108
    fi
melunko@47
  6109
    ;;
melunko@47
  6110
melunko@47
  6111
  # libtool clean and uninstall mode
melunko@47
  6112
  clean | uninstall)
melunko@47
  6113
    modename="$modename: $mode"
melunko@47
  6114
    rm="$nonopt"
melunko@47
  6115
    files=
melunko@47
  6116
    rmforce=
melunko@47
  6117
    exit_status=0
melunko@47
  6118
melunko@47
  6119
    # This variable tells wrapper scripts just to set variables rather
melunko@47
  6120
    # than running their programs.
melunko@47
  6121
    libtool_install_magic="$magic"
melunko@47
  6122
melunko@47
  6123
    for arg
melunko@47
  6124
    do
melunko@47
  6125
      case $arg in
melunko@47
  6126
      -f) rm="$rm $arg"; rmforce=yes ;;
melunko@47
  6127
      -*) rm="$rm $arg" ;;
melunko@47
  6128
      *) files="$files $arg" ;;
melunko@47
  6129
      esac
melunko@47
  6130
    done
melunko@47
  6131
melunko@47
  6132
    if test -z "$rm"; then
melunko@47
  6133
      $echo "$modename: you must specify an RM program" 1>&2
melunko@47
  6134
      $echo "$help" 1>&2
melunko@47
  6135
      exit $EXIT_FAILURE
melunko@47
  6136
    fi
melunko@47
  6137
melunko@47
  6138
    rmdirs=
melunko@47
  6139
melunko@47
  6140
    origobjdir="$objdir"
melunko@47
  6141
    for file in $files; do
melunko@47
  6142
      dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
melunko@47
  6143
      if test "X$dir" = "X$file"; then
melunko@47
  6144
	dir=.
melunko@47
  6145
	objdir="$origobjdir"
melunko@47
  6146
      else
melunko@47
  6147
	objdir="$dir/$origobjdir"
melunko@47
  6148
      fi
melunko@47
  6149
      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
melunko@47
  6150
      test "$mode" = uninstall && objdir="$dir"
melunko@47
  6151
melunko@47
  6152
      # Remember objdir for removal later, being careful to avoid duplicates
melunko@47
  6153
      if test "$mode" = clean; then
melunko@47
  6154
	case " $rmdirs " in
melunko@47
  6155
	  *" $objdir "*) ;;
melunko@47
  6156
	  *) rmdirs="$rmdirs $objdir" ;;
melunko@47
  6157
	esac
melunko@47
  6158
      fi
melunko@47
  6159
melunko@47
  6160
      # Don't error if the file doesn't exist and rm -f was used.
melunko@47
  6161
      if (test -L "$file") >/dev/null 2>&1 \
melunko@47
  6162
	|| (test -h "$file") >/dev/null 2>&1 \
melunko@47
  6163
	|| test -f "$file"; then
melunko@47
  6164
	:
melunko@47
  6165
      elif test -d "$file"; then
melunko@47
  6166
	exit_status=1
melunko@47
  6167
	continue
melunko@47
  6168
      elif test "$rmforce" = yes; then
melunko@47
  6169
	continue
melunko@47
  6170
      fi
melunko@47
  6171
melunko@47
  6172
      rmfiles="$file"
melunko@47
  6173
melunko@47
  6174
      case $name in
melunko@47
  6175
      *.la)
melunko@47
  6176
	# Possibly a libtool archive, so verify it.
melunko@47
  6177
	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
melunko@47
  6178
	  . $dir/$name
melunko@47
  6179
melunko@47
  6180
	  # Delete the libtool libraries and symlinks.
melunko@47
  6181
	  for n in $library_names; do
melunko@47
  6182
	    rmfiles="$rmfiles $objdir/$n"
melunko@47
  6183
	  done
melunko@47
  6184
	  test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
melunko@47
  6185
	  test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
melunko@47
  6186
melunko@47
  6187
	  if test "$mode" = uninstall; then
melunko@47
  6188
	    if test -n "$library_names"; then
melunko@47
  6189
	      # Do each command in the postuninstall commands.
melunko@47
  6190
	      cmds=$postuninstall_cmds
melunko@47
  6191
	      save_ifs="$IFS"; IFS='~'
melunko@47
  6192
	      for cmd in $cmds; do
melunko@47
  6193
		IFS="$save_ifs"
melunko@47
  6194
		eval cmd=\"$cmd\"
melunko@47
  6195
		$show "$cmd"
melunko@47
  6196
		$run eval "$cmd"
melunko@47
  6197
		if test "$?" -ne 0 && test "$rmforce" != yes; then
melunko@47
  6198
		  exit_status=1
melunko@47
  6199
		fi
melunko@47
  6200
	      done
melunko@47
  6201
	      IFS="$save_ifs"
melunko@47
  6202
	    fi
melunko@47
  6203
melunko@47
  6204
	    if test -n "$old_library"; then
melunko@47
  6205
	      # Do each command in the old_postuninstall commands.
melunko@47
  6206
	      cmds=$old_postuninstall_cmds
melunko@47
  6207
	      save_ifs="$IFS"; IFS='~'
melunko@47
  6208
	      for cmd in $cmds; do
melunko@47
  6209
		IFS="$save_ifs"
melunko@47
  6210
		eval cmd=\"$cmd\"
melunko@47
  6211
		$show "$cmd"
melunko@47
  6212
		$run eval "$cmd"
melunko@47
  6213
		if test "$?" -ne 0 && test "$rmforce" != yes; then
melunko@47
  6214
		  exit_status=1
melunko@47
  6215
		fi
melunko@47
  6216
	      done
melunko@47
  6217
	      IFS="$save_ifs"
melunko@47
  6218
	    fi
melunko@47
  6219
	    # FIXME: should reinstall the best remaining shared library.
melunko@47
  6220
	  fi
melunko@47
  6221
	fi
melunko@47
  6222
	;;
melunko@47
  6223
melunko@47
  6224
      *.lo)
melunko@47
  6225
	# Possibly a libtool object, so verify it.
melunko@47
  6226
	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
melunko@47
  6227
melunko@47
  6228
	  # Read the .lo file
melunko@47
  6229
	  . $dir/$name
melunko@47
  6230
melunko@47
  6231
	  # Add PIC object to the list of files to remove.
melunko@47
  6232
	  if test -n "$pic_object" \
melunko@47
  6233
	     && test "$pic_object" != none; then
melunko@47
  6234
	    rmfiles="$rmfiles $dir/$pic_object"
melunko@47
  6235
	  fi
melunko@47
  6236
melunko@47
  6237
	  # Add non-PIC object to the list of files to remove.
melunko@47
  6238
	  if test -n "$non_pic_object" \
melunko@47
  6239
	     && test "$non_pic_object" != none; then
melunko@47
  6240
	    rmfiles="$rmfiles $dir/$non_pic_object"
melunko@47
  6241
	  fi
melunko@47
  6242
	fi
melunko@47
  6243
	;;
melunko@47
  6244
melunko@47
  6245
      *)
melunko@47
  6246
	if test "$mode" = clean ; then
melunko@47
  6247
	  noexename=$name
melunko@47
  6248
	  case $file in
melunko@47
  6249
	  *.exe)
melunko@47
  6250
	    file=`$echo $file|${SED} 's,.exe$,,'`
melunko@47
  6251
	    noexename=`$echo $name|${SED} 's,.exe$,,'`
melunko@47
  6252
	    # $file with .exe has already been added to rmfiles,
melunko@47
  6253
	    # add $file without .exe
melunko@47
  6254
	    rmfiles="$rmfiles $file"
melunko@47
  6255
	    ;;
melunko@47
  6256
	  esac
melunko@47
  6257
	  # Do a test to see if this is a libtool program.
melunko@47
  6258
	  if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
melunko@47
  6259
	    relink_command=
melunko@47
  6260
	    . $dir/$noexename
melunko@47
  6261
melunko@47
  6262
	    # note $name still contains .exe if it was in $file originally
melunko@47
  6263
	    # as does the version of $file that was added into $rmfiles
melunko@47
  6264
	    rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
melunko@47
  6265
	    if test "$fast_install" = yes && test -n "$relink_command"; then
melunko@47
  6266
	      rmfiles="$rmfiles $objdir/lt-$name"
melunko@47
  6267
	    fi
melunko@47
  6268
	    if test "X$noexename" != "X$name" ; then
melunko@47
  6269
	      rmfiles="$rmfiles $objdir/lt-${noexename}.c"
melunko@47
  6270
	    fi
melunko@47
  6271
	  fi
melunko@47
  6272
	fi
melunko@47
  6273
	;;
melunko@47
  6274
      esac
melunko@47
  6275
      $show "$rm $rmfiles"
melunko@47
  6276
      $run $rm $rmfiles || exit_status=1
melunko@47
  6277
    done
melunko@47
  6278
    objdir="$origobjdir"
melunko@47
  6279
melunko@47
  6280
    # Try to remove the ${objdir}s in the directories where we deleted files
melunko@47
  6281
    for dir in $rmdirs; do
melunko@47
  6282
      if test -d "$dir"; then
melunko@47
  6283
	$show "rmdir $dir"
melunko@47
  6284
	$run rmdir $dir >/dev/null 2>&1
melunko@47
  6285
      fi
melunko@47
  6286
    done
melunko@47
  6287
melunko@47
  6288
    exit $exit_status
melunko@47
  6289
    ;;
melunko@47
  6290
melunko@47
  6291
  "")
melunko@47
  6292
    $echo "$modename: you must specify a MODE" 1>&2
melunko@47
  6293
    $echo "$generic_help" 1>&2
melunko@47
  6294
    exit $EXIT_FAILURE
melunko@47
  6295
    ;;
melunko@47
  6296
  esac
melunko@47
  6297
melunko@47
  6298
  if test -z "$exec_cmd"; then
melunko@47
  6299
    $echo "$modename: invalid operation mode \`$mode'" 1>&2
melunko@47
  6300
    $echo "$generic_help" 1>&2
melunko@47
  6301
    exit $EXIT_FAILURE
melunko@47
  6302
  fi
melunko@47
  6303
fi # test -z "$show_help"
melunko@47
  6304
melunko@47
  6305
if test -n "$exec_cmd"; then
melunko@47
  6306
  eval exec $exec_cmd
melunko@47
  6307
  exit $EXIT_FAILURE
melunko@47
  6308
fi
melunko@47
  6309
melunko@47
  6310
# We need to display help for each of the modes.
melunko@47
  6311
case $mode in
melunko@47
  6312
"") $echo \
melunko@47
  6313
"Usage: $modename [OPTION]... [MODE-ARG]...
melunko@47
  6314
melunko@47
  6315
Provide generalized library-building support services.
melunko@47
  6316
melunko@47
  6317
    --config          show all configuration variables
melunko@47
  6318
    --debug           enable verbose shell tracing
melunko@47
  6319
-n, --dry-run         display commands without modifying any files
melunko@47
  6320
    --features        display basic configuration information and exit
melunko@47
  6321
    --finish          same as \`--mode=finish'
melunko@47
  6322
    --help            display this help message and exit
melunko@47
  6323
    --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
melunko@47
  6324
    --quiet           same as \`--silent'
melunko@47
  6325
    --silent          don't print informational messages
melunko@47
  6326
    --tag=TAG         use configuration variables from tag TAG
melunko@47
  6327
    --version         print version information
melunko@47
  6328
melunko@47
  6329
MODE must be one of the following:
melunko@47
  6330
melunko@47
  6331
      clean           remove files from the build directory
melunko@47
  6332
      compile         compile a source file into a libtool object
melunko@47
  6333
      execute         automatically set library path, then run a program
melunko@47
  6334
      finish          complete the installation of libtool libraries
melunko@47
  6335
      install         install libraries or executables
melunko@47
  6336
      link            create a library or an executable
melunko@47
  6337
      uninstall       remove libraries from an installed directory
melunko@47
  6338
melunko@47
  6339
MODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
melunko@47
  6340
a more detailed description of MODE.
melunko@47
  6341
melunko@47
  6342
Report bugs to <bug-libtool@gnu.org>."
melunko@47
  6343
  exit $EXIT_SUCCESS
melunko@47
  6344
  ;;
melunko@47
  6345
melunko@47
  6346
clean)
melunko@47
  6347
  $echo \
melunko@47
  6348
"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
melunko@47
  6349
melunko@47
  6350
Remove files from the build directory.
melunko@47
  6351
melunko@47
  6352
RM is the name of the program to use to delete files associated with each FILE
melunko@47
  6353
(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
melunko@47
  6354
to RM.
melunko@47
  6355
melunko@47
  6356
If FILE is a libtool library, object or program, all the files associated
melunko@47
  6357
with it are deleted. Otherwise, only FILE itself is deleted using RM."
melunko@47
  6358
  ;;
melunko@47
  6359
melunko@47
  6360
compile)
melunko@47
  6361
  $echo \
melunko@47
  6362
"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
melunko@47
  6363
melunko@47
  6364
Compile a source file into a libtool library object.
melunko@47
  6365
melunko@47
  6366
This mode accepts the following additional options:
melunko@47
  6367
melunko@47
  6368
  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
melunko@47
  6369
  -prefer-pic       try to building PIC objects only
melunko@47
  6370
  -prefer-non-pic   try to building non-PIC objects only
melunko@47
  6371
  -static           always build a \`.o' file suitable for static linking
melunko@47
  6372
melunko@47
  6373
COMPILE-COMMAND is a command to be used in creating a \`standard' object file
melunko@47
  6374
from the given SOURCEFILE.
melunko@47
  6375
melunko@47
  6376
The output file name is determined by removing the directory component from
melunko@47
  6377
SOURCEFILE, then substituting the C source code suffix \`.c' with the
melunko@47
  6378
library object suffix, \`.lo'."
melunko@47
  6379
  ;;
melunko@47
  6380
melunko@47
  6381
execute)
melunko@47
  6382
  $echo \
melunko@47
  6383
"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
melunko@47
  6384
melunko@47
  6385
Automatically set library path, then run a program.
melunko@47
  6386
melunko@47
  6387
This mode accepts the following additional options:
melunko@47
  6388
melunko@47
  6389
  -dlopen FILE      add the directory containing FILE to the library path
melunko@47
  6390
melunko@47
  6391
This mode sets the library path environment variable according to \`-dlopen'
melunko@47
  6392
flags.
melunko@47
  6393
melunko@47
  6394
If any of the ARGS are libtool executable wrappers, then they are translated
melunko@47
  6395
into their corresponding uninstalled binary, and any of their required library
melunko@47
  6396
directories are added to the library path.
melunko@47
  6397
melunko@47
  6398
Then, COMMAND is executed, with ARGS as arguments."
melunko@47
  6399
  ;;
melunko@47
  6400
melunko@47
  6401
finish)
melunko@47
  6402
  $echo \
melunko@47
  6403
"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
melunko@47
  6404
melunko@47
  6405
Complete the installation of libtool libraries.
melunko@47
  6406
melunko@47
  6407
Each LIBDIR is a directory that contains libtool libraries.
melunko@47
  6408
melunko@47
  6409
The commands that this mode executes may require superuser privileges.  Use
melunko@47
  6410
the \`--dry-run' option if you just want to see what would be executed."
melunko@47
  6411
  ;;
melunko@47
  6412
melunko@47
  6413
install)
melunko@47
  6414
  $echo \
melunko@47
  6415
"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
melunko@47
  6416
melunko@47
  6417
Install executables or libraries.
melunko@47
  6418
melunko@47
  6419
INSTALL-COMMAND is the installation command.  The first component should be
melunko@47
  6420
either the \`install' or \`cp' program.
melunko@47
  6421
melunko@47
  6422
The rest of the components are interpreted as arguments to that command (only
melunko@47
  6423
BSD-compatible install options are recognized)."
melunko@47
  6424
  ;;
melunko@47
  6425
melunko@47
  6426
link)
melunko@47
  6427
  $echo \
melunko@47
  6428
"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
melunko@47
  6429
melunko@47
  6430
Link object files or libraries together to form another library, or to
melunko@47
  6431
create an executable program.
melunko@47
  6432
melunko@47
  6433
LINK-COMMAND is a command using the C compiler that you would use to create
melunko@47
  6434
a program from several object files.
melunko@47
  6435
melunko@47
  6436
The following components of LINK-COMMAND are treated specially:
melunko@47
  6437
melunko@47
  6438
  -all-static       do not do any dynamic linking at all
melunko@47
  6439
  -avoid-version    do not add a version suffix if possible
melunko@47
  6440
  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
melunko@47
  6441
  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
melunko@47
  6442
  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
melunko@47
  6443
  -export-symbols SYMFILE
melunko@47
  6444
		    try to export only the symbols listed in SYMFILE
melunko@47
  6445
  -export-symbols-regex REGEX
melunko@47
  6446
		    try to export only the symbols matching REGEX
melunko@47
  6447
  -LLIBDIR          search LIBDIR for required installed libraries
melunko@47
  6448
  -lNAME            OUTPUT-FILE requires the installed library libNAME
melunko@47
  6449
  -module           build a library that can dlopened
melunko@47
  6450
  -no-fast-install  disable the fast-install mode
melunko@47
  6451
  -no-install       link a not-installable executable
melunko@47
  6452
  -no-undefined     declare that a library does not refer to external symbols
melunko@47
  6453
  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
melunko@47
  6454
  -objectlist FILE  Use a list of object files found in FILE to specify objects
melunko@47
  6455
  -precious-files-regex REGEX
melunko@47
  6456
                    don't remove output files matching REGEX
melunko@47
  6457
  -release RELEASE  specify package release information
melunko@47
  6458
  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
melunko@47
  6459
  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
melunko@47
  6460
  -static           do not do any dynamic linking of libtool libraries
melunko@47
  6461
  -version-info CURRENT[:REVISION[:AGE]]
melunko@47
  6462
		    specify library version info [each variable defaults to 0]
melunko@47
  6463
melunko@47
  6464
All other options (arguments beginning with \`-') are ignored.
melunko@47
  6465
melunko@47
  6466
Every other argument is treated as a filename.  Files ending in \`.la' are
melunko@47
  6467
treated as uninstalled libtool libraries, other files are standard or library
melunko@47
  6468
object files.
melunko@47
  6469
melunko@47
  6470
If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
melunko@47
  6471
only library objects (\`.lo' files) may be specified, and \`-rpath' is
melunko@47
  6472
required, except when creating a convenience library.
melunko@47
  6473
melunko@47
  6474
If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
melunko@47
  6475
using \`ar' and \`ranlib', or on Windows using \`lib'.
melunko@47
  6476
melunko@47
  6477
If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
melunko@47
  6478
is created, otherwise an executable program is created."
melunko@47
  6479
  ;;
melunko@47
  6480
melunko@47
  6481
uninstall)
melunko@47
  6482
  $echo \
melunko@47
  6483
"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
melunko@47
  6484
melunko@47
  6485
Remove libraries from an installation directory.
melunko@47
  6486
melunko@47
  6487
RM is the name of the program to use to delete files associated with each FILE
melunko@47
  6488
(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
melunko@47
  6489
to RM.
melunko@47
  6490
melunko@47
  6491
If FILE is a libtool library, all the files associated with it are deleted.
melunko@47
  6492
Otherwise, only FILE itself is deleted using RM."
melunko@47
  6493
  ;;
melunko@47
  6494
melunko@47
  6495
*)
melunko@47
  6496
  $echo "$modename: invalid operation mode \`$mode'" 1>&2
melunko@47
  6497
  $echo "$help" 1>&2
melunko@47
  6498
  exit $EXIT_FAILURE
melunko@47
  6499
  ;;
melunko@47
  6500
esac
melunko@47
  6501
melunko@47
  6502
$echo
melunko@47
  6503
$echo "Try \`$modename --help' for more information about other modes."
melunko@47
  6504
melunko@47
  6505
exit $?
melunko@47
  6506
melunko@47
  6507
# The TAGs below are defined such that we never get into a situation
melunko@47
  6508
# in which we disable both kinds of libraries.  Given conflicting
melunko@47
  6509
# choices, we go for a static library, that is the most portable,
melunko@47
  6510
# since we can't tell whether shared libraries were disabled because
melunko@47
  6511
# the user asked for that or because the platform doesn't support
melunko@47
  6512
# them.  This is particularly important on AIX, because we don't
melunko@47
  6513
# support having both static and shared libraries enabled at the same
melunko@47
  6514
# time on that platform, so we default to a shared-only configuration.
melunko@47
  6515
# If a disable-shared tag is given, we'll fallback to a static-only
melunko@47
  6516
# configuration.  But we'll never go from static-only to shared-only.
melunko@47
  6517
melunko@47
  6518
# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
melunko@47
  6519
build_libtool_libs=no
melunko@47
  6520
build_old_libs=yes
melunko@47
  6521
# ### END LIBTOOL TAG CONFIG: disable-shared
melunko@47
  6522
melunko@47
  6523
# ### BEGIN LIBTOOL TAG CONFIG: disable-static
melunko@47
  6524
build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac`
melunko@47
  6525
# ### END LIBTOOL TAG CONFIG: disable-static
melunko@47
  6526
melunko@47
  6527
# Local Variables:
melunko@47
  6528
# mode:shell-script
melunko@47
  6529
# sh-indentation:2
melunko@47
  6530
# End: