build-scripts/ltmain.sh
author Ozkan Sezer <sezeroz@gmail.com>
Wed, 14 Nov 2018 20:00:03 +0300
branchSDL-1.2
changeset 12409 67aeabf947b2
parent 12057 aad2440e3d61
permissions -rw-r--r--
revert commit aad2440e3d61 for consistency (c.f. bug #4367.)
slouken@4277
     1
# Generated from ltmain.m4sh.
slouken@4277
     2
slouken@4277
     3
# ltmain.sh (GNU libtool) 2.2.6
slouken@4277
     4
# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
slouken@4277
     5
slouken@4277
     6
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc.
slouken@4277
     7
# This is free software; see the source for copying conditions.  There is NO
slouken@4277
     8
# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
slouken@4277
     9
slouken@4277
    10
# GNU Libtool is free software; you can redistribute it and/or modify
slouken@1361
    11
# it under the terms of the GNU General Public License as published by
slouken@1361
    12
# the Free Software Foundation; either version 2 of the License, or
slouken@1361
    13
# (at your option) any later version.
slouken@1361
    14
#
slouken@4277
    15
# As a special exception to the GNU General Public License,
slouken@4277
    16
# if you distribute this file as part of a program or library that
slouken@4277
    17
# is built using GNU Libtool, you may include this file under the
slouken@4277
    18
# same distribution terms that you use for the rest of that program.
slouken@4277
    19
#
slouken@4277
    20
# GNU Libtool is distributed in the hope that it will be useful, but
slouken@1361
    21
# WITHOUT ANY WARRANTY; without even the implied warranty of
slouken@1361
    22
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
slouken@1361
    23
# General Public License for more details.
slouken@1361
    24
#
slouken@1361
    25
# You should have received a copy of the GNU General Public License
slouken@4277
    26
# along with GNU Libtool; see the file COPYING.  If not, a copy
slouken@4277
    27
# can be downloaded from http://www.gnu.org/licenses/gpl.html,
slouken@4277
    28
# or obtained by writing to the Free Software Foundation, Inc.,
slouken@4277
    29
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
slouken@4277
    30
slouken@4277
    31
# Usage: $progname [OPTION]... [MODE-ARG]...
slouken@1361
    32
#
slouken@4277
    33
# Provide generalized library-building support services.
slouken@4277
    34
#
slouken@4277
    35
#     --config             show all configuration variables
slouken@4277
    36
#     --debug              enable verbose shell tracing
slouken@4277
    37
# -n, --dry-run            display commands without modifying any files
slouken@4277
    38
#     --features           display basic configuration information and exit
slouken@4277
    39
#     --mode=MODE          use operation mode MODE
slouken@4277
    40
#     --preserve-dup-deps  don't remove duplicate dependency libraries
slouken@4277
    41
#     --quiet, --silent    don't print informational messages
slouken@4277
    42
#     --tag=TAG            use configuration variables from tag TAG
slouken@4277
    43
# -v, --verbose            print informational messages (default)
slouken@4277
    44
#     --version            print version information
slouken@4277
    45
# -h, --help               print short or long help message
slouken@4277
    46
#
slouken@4277
    47
# MODE must be one of the following:
slouken@4277
    48
#
slouken@4277
    49
#       clean              remove files from the build directory
slouken@4277
    50
#       compile            compile a source file into a libtool object
slouken@4277
    51
#       execute            automatically set library path, then run a program
slouken@4277
    52
#       finish             complete the installation of libtool libraries
slouken@4277
    53
#       install            install libraries or executables
slouken@4277
    54
#       link               create a library or an executable
slouken@4277
    55
#       uninstall          remove libraries from an installed directory
slouken@4277
    56
#
slouken@4277
    57
# MODE-ARGS vary depending on the MODE.
slouken@4277
    58
# Try `$progname --help --mode=MODE' for a more detailed description of MODE.
slouken@4277
    59
#
slouken@4277
    60
# When reporting a bug, please describe a test case to reproduce it and
slouken@4277
    61
# include the following information:
slouken@4277
    62
#
slouken@4277
    63
#       host-triplet:	$host
slouken@4277
    64
#       shell:		$SHELL
slouken@4277
    65
#       compiler:		$LTCC
slouken@4277
    66
#       compiler flags:		$LTCFLAGS
slouken@4277
    67
#       linker:		$LD (gnu? $with_gnu_ld)
slouken@4277
    68
#       $progname:		(GNU libtool) 2.2.6
slouken@4277
    69
#       automake:		$automake_version
slouken@4277
    70
#       autoconf:		$autoconf_version
slouken@4277
    71
#
slouken@4277
    72
# Report bugs to <bug-libtool@gnu.org>.
slouken@4277
    73
slouken@4277
    74
PROGRAM=ltmain.sh
slouken@4277
    75
PACKAGE=libtool
slouken@4277
    76
VERSION=2.2.6
slouken@4277
    77
TIMESTAMP=""
slouken@4277
    78
package_revision=1.3012
slouken@4277
    79
slouken@4277
    80
# Be Bourne compatible
slouken@4277
    81
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
slouken@4277
    82
  emulate sh
slouken@4277
    83
  NULLCMD=:
slouken@4277
    84
  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
slouken@4277
    85
  # is contrary to our usage.  Disable this feature.
slouken@4277
    86
  alias -g '${1+"$@"}'='"$@"'
slouken@4277
    87
  setopt NO_GLOB_SUBST
slouken@4277
    88
else
slouken@4277
    89
  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
slouken@4277
    90
fi
slouken@4277
    91
BIN_SH=xpg4; export BIN_SH # for Tru64
slouken@4277
    92
DUALCASE=1; export DUALCASE # for MKS sh
slouken@4277
    93
slouken@4277
    94
# NLS nuisances: We save the old values to restore during execute mode.
slouken@4277
    95
# Only set LANG and LC_ALL to C if already set.
slouken@4277
    96
# These must not be set unconditionally because not all systems understand
slouken@4277
    97
# e.g. LANG=C (notably SCO).
slouken@4277
    98
lt_user_locale=
slouken@4277
    99
lt_safe_locale=
slouken@4277
   100
for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
slouken@4277
   101
do
slouken@4277
   102
  eval "if test \"\${$lt_var+set}\" = set; then
slouken@4277
   103
          save_$lt_var=\$$lt_var
slouken@4277
   104
          $lt_var=C
slouken@4277
   105
	  export $lt_var
slouken@4277
   106
	  lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
slouken@4277
   107
	  lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
slouken@4277
   108
	fi"
slouken@4277
   109
done
slouken@4277
   110
slouken@4277
   111
$lt_unset CDPATH
slouken@4277
   112
slouken@4277
   113
slouken@4277
   114
slouken@4277
   115
slouken@4277
   116
slouken@4277
   117
: ${CP="cp -f"}
slouken@4277
   118
: ${ECHO="echo"}
slouken@4277
   119
: ${EGREP="/usr/bin/grep -E"}
slouken@4277
   120
: ${FGREP="/usr/bin/grep -F"}
slouken@4277
   121
: ${GREP="/usr/bin/grep"}
slouken@4277
   122
: ${LN_S="ln -s"}
slouken@4277
   123
: ${MAKE="make"}
slouken@4277
   124
: ${MKDIR="mkdir"}
slouken@4277
   125
: ${MV="mv -f"}
slouken@4277
   126
: ${RM="rm -f"}
slouken@4277
   127
: ${SED="/opt/local/bin/gsed"}
slouken@4277
   128
: ${SHELL="${CONFIG_SHELL-/bin/sh}"}
slouken@4277
   129
: ${Xsed="$SED -e 1s/^X//"}
slouken@4277
   130
slouken@4277
   131
# Global variables:
slouken@4277
   132
EXIT_SUCCESS=0
slouken@4277
   133
EXIT_FAILURE=1
slouken@4277
   134
EXIT_MISMATCH=63  # $? = 63 is used to indicate version mismatch to missing.
slouken@4277
   135
EXIT_SKIP=77	  # $? = 77 is used to indicate a skipped test to automake.
slouken@4277
   136
slouken@4277
   137
exit_status=$EXIT_SUCCESS
slouken@4277
   138
slouken@4277
   139
# Make sure IFS has a sensible default
slouken@4277
   140
lt_nl='
slouken@4277
   141
'
slouken@4277
   142
IFS=" 	$lt_nl"
slouken@4277
   143
slouken@4277
   144
dirname="s,/[^/]*$,,"
slouken@4277
   145
basename="s,^.*/,,"
slouken@4277
   146
slouken@4277
   147
# func_dirname_and_basename file append nondir_replacement
slouken@4277
   148
# perform func_basename and func_dirname in a single function
slouken@4277
   149
# call:
slouken@4277
   150
#   dirname:  Compute the dirname of FILE.  If nonempty,
slouken@4277
   151
#             add APPEND to the result, otherwise set result
slouken@4277
   152
#             to NONDIR_REPLACEMENT.
slouken@4277
   153
#             value returned in "$func_dirname_result"
slouken@4277
   154
#   basename: Compute filename of FILE.
slouken@4277
   155
#             value retuned in "$func_basename_result"
slouken@4277
   156
# Implementation must be kept synchronized with func_dirname
slouken@4277
   157
# and func_basename. For efficiency, we do not delegate to
slouken@4277
   158
# those functions but instead duplicate the functionality here.
slouken@4277
   159
func_dirname_and_basename ()
slouken@4277
   160
{
slouken@4277
   161
  # Extract subdirectory from the argument.
slouken@4277
   162
  func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
slouken@4277
   163
  if test "X$func_dirname_result" = "X${1}"; then
slouken@4277
   164
    func_dirname_result="${3}"
slouken@4277
   165
  else
slouken@4277
   166
    func_dirname_result="$func_dirname_result${2}"
slouken@4277
   167
  fi
slouken@4277
   168
  func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
slouken@4277
   169
}
slouken@4277
   170
slouken@4277
   171
# Generated shell functions inserted here.
slouken@1361
   172
slouken@1361
   173
# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
slouken@1361
   174
# is ksh but when the shell is invoked as "sh" and the current value of
slouken@1361
   175
# the _XPG environment variable is not equal to 1 (one), the special
slouken@1361
   176
# positional parameter $0, within a function call, is the name of the
slouken@1361
   177
# function.
slouken@1361
   178
progpath="$0"
slouken@1361
   179
slouken@1361
   180
# The name of this program:
slouken@4277
   181
# In the unlikely event $progname began with a '-', it would play havoc with
slouken@4277
   182
# func_echo (imagine progname=-n), so we prepend ./ in that case:
slouken@4277
   183
func_dirname_and_basename "$progpath"
slouken@4277
   184
progname=$func_basename_result
slouken@4277
   185
case $progname in
slouken@4277
   186
  -*) progname=./$progname ;;
slouken@4277
   187
esac
slouken@4277
   188
slouken@4277
   189
# Make sure we have an absolute path for reexecution:
slouken@4277
   190
case $progpath in
slouken@4277
   191
  [\\/]*|[A-Za-z]:\\*) ;;
slouken@4277
   192
  *[\\/]*)
slouken@4277
   193
     progdir=$func_dirname_result
slouken@4277
   194
     progdir=`cd "$progdir" && pwd`
slouken@4277
   195
     progpath="$progdir/$progname"
slouken@4277
   196
     ;;
slouken@4277
   197
  *)
slouken@4277
   198
     save_IFS="$IFS"
slouken@4277
   199
     IFS=:
slouken@4277
   200
     for progdir in $PATH; do
slouken@4277
   201
       IFS="$save_IFS"
slouken@4277
   202
       test -x "$progdir/$progname" && break
slouken@4277
   203
     done
slouken@4277
   204
     IFS="$save_IFS"
slouken@4277
   205
     test -n "$progdir" || progdir=`pwd`
slouken@4277
   206
     progpath="$progdir/$progname"
slouken@4277
   207
     ;;
slouken@4277
   208
esac
slouken@4277
   209
slouken@4277
   210
# Sed substitution that helps us do robust quoting.  It backslashifies
slouken@4277
   211
# metacharacters that are still active within double-quoted strings.
slouken@4277
   212
Xsed="${SED}"' -e 1s/^X//'
slouken@4277
   213
sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
slouken@4277
   214
slouken@4277
   215
# Same as above, but do not quote variable references.
slouken@4277
   216
double_quote_subst='s/\(["`\\]\)/\\\1/g'
slouken@4277
   217
slouken@4277
   218
# Re-`\' parameter expansions in output of double_quote_subst that were
slouken@4277
   219
# `\'-ed in input to the same.  If an odd number of `\' preceded a '$'
slouken@4277
   220
# in input to double_quote_subst, that '$' was protected from expansion.
slouken@4277
   221
# Since each input `\' is now two `\'s, look for any number of runs of
slouken@4277
   222
# four `\'s followed by two `\'s and then a '$'.  `\' that '$'.
slouken@4277
   223
bs='\\'
slouken@4277
   224
bs2='\\\\'
slouken@4277
   225
bs4='\\\\\\\\'
slouken@4277
   226
dollar='\$'
slouken@4277
   227
sed_double_backslash="\
slouken@4277
   228
  s/$bs4/&\\
slouken@4277
   229
/g
slouken@4277
   230
  s/^$bs2$dollar/$bs&/
slouken@4277
   231
  s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
slouken@4277
   232
  s/\n//g"
slouken@4277
   233
slouken@4277
   234
# Standard options:
slouken@4277
   235
opt_dry_run=false
slouken@4277
   236
opt_help=false
slouken@4277
   237
opt_quiet=false
slouken@4277
   238
opt_verbose=false
slouken@4277
   239
opt_warning=:
slouken@4277
   240
slouken@4277
   241
# func_echo arg...
slouken@4277
   242
# Echo program name prefixed message, along with the current mode
slouken@4277
   243
# name if it has been set yet.
slouken@4277
   244
func_echo ()
slouken@4277
   245
{
slouken@4277
   246
    $ECHO "$progname${mode+: }$mode: $*"
slouken@4277
   247
}
slouken@4277
   248
slouken@4277
   249
# func_verbose arg...
slouken@4277
   250
# Echo program name prefixed message in verbose mode only.
slouken@4277
   251
func_verbose ()
slouken@4277
   252
{
slouken@4277
   253
    $opt_verbose && func_echo ${1+"$@"}
slouken@4277
   254
slouken@4277
   255
    # A bug in bash halts the script if the last line of a function
slouken@4277
   256
    # fails when set -e is in force, so we need another command to
slouken@4277
   257
    # work around that:
slouken@4277
   258
    :
slouken@4277
   259
}
slouken@4277
   260
slouken@4277
   261
# func_error arg...
slouken@4277
   262
# Echo program name prefixed message to standard error.
slouken@4277
   263
func_error ()
slouken@4277
   264
{
slouken@4277
   265
    $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2
slouken@4277
   266
}
slouken@4277
   267
slouken@4277
   268
# func_warning arg...
slouken@4277
   269
# Echo program name prefixed warning message to standard error.
slouken@4277
   270
func_warning ()
slouken@4277
   271
{
slouken@4277
   272
    $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2
slouken@4277
   273
slouken@4277
   274
    # bash bug again:
slouken@4277
   275
    :
slouken@4277
   276
}
slouken@4277
   277
slouken@4277
   278
# func_fatal_error arg...
slouken@4277
   279
# Echo program name prefixed message to standard error, and exit.
slouken@4277
   280
func_fatal_error ()
slouken@4277
   281
{
slouken@4277
   282
    func_error ${1+"$@"}
slouken@4277
   283
    exit $EXIT_FAILURE
slouken@4277
   284
}
slouken@4277
   285
slouken@4277
   286
# func_fatal_help arg...
slouken@4277
   287
# Echo program name prefixed message to standard error, followed by
slouken@4277
   288
# a help hint, and exit.
slouken@4277
   289
func_fatal_help ()
slouken@4277
   290
{
slouken@4277
   291
    func_error ${1+"$@"}
slouken@4277
   292
    func_fatal_error "$help"
slouken@4277
   293
}
slouken@4277
   294
help="Try \`$progname --help' for more information."  ## default
slouken@4277
   295
slouken@4277
   296
slouken@4277
   297
# func_grep expression filename
slouken@4277
   298
# Check whether EXPRESSION matches any line of FILENAME, without output.
slouken@4277
   299
func_grep ()
slouken@4277
   300
{
slouken@4277
   301
    $GREP "$1" "$2" >/dev/null 2>&1
slouken@4277
   302
}
slouken@4277
   303
slouken@4277
   304
slouken@4277
   305
# func_mkdir_p directory-path
slouken@4277
   306
# Make sure the entire path to DIRECTORY-PATH is available.
slouken@4277
   307
func_mkdir_p ()
slouken@4277
   308
{
slouken@4277
   309
    my_directory_path="$1"
slouken@4277
   310
    my_dir_list=
slouken@4277
   311
slouken@4277
   312
    if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
slouken@4277
   313
slouken@4277
   314
      # Protect directory names starting with `-'
slouken@4277
   315
      case $my_directory_path in
slouken@4277
   316
        -*) my_directory_path="./$my_directory_path" ;;
slouken@4277
   317
      esac
slouken@4277
   318
slouken@4277
   319
      # While some portion of DIR does not yet exist...
slouken@4277
   320
      while test ! -d "$my_directory_path"; do
slouken@4277
   321
        # ...make a list in topmost first order.  Use a colon delimited
slouken@4277
   322
	# list incase some portion of path contains whitespace.
slouken@4277
   323
        my_dir_list="$my_directory_path:$my_dir_list"
slouken@4277
   324
slouken@4277
   325
        # If the last portion added has no slash in it, the list is done
slouken@4277
   326
        case $my_directory_path in */*) ;; *) break ;; esac
slouken@4277
   327
slouken@4277
   328
        # ...otherwise throw away the child directory and loop
slouken@4277
   329
        my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"`
slouken@4277
   330
      done
slouken@4277
   331
      my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'`
slouken@4277
   332
slouken@4277
   333
      save_mkdir_p_IFS="$IFS"; IFS=':'
slouken@4277
   334
      for my_dir in $my_dir_list; do
slouken@4277
   335
	IFS="$save_mkdir_p_IFS"
slouken@4277
   336
        # mkdir can fail with a `File exist' error if two processes
slouken@4277
   337
        # try to create one of the directories concurrently.  Don't
slouken@4277
   338
        # stop in that case!
slouken@4277
   339
        $MKDIR "$my_dir" 2>/dev/null || :
slouken@4277
   340
      done
slouken@4277
   341
      IFS="$save_mkdir_p_IFS"
slouken@4277
   342
slouken@4277
   343
      # Bail out if we (or some other process) failed to create a directory.
slouken@4277
   344
      test -d "$my_directory_path" || \
slouken@4277
   345
        func_fatal_error "Failed to create \`$1'"
slouken@4277
   346
    fi
slouken@4277
   347
}
slouken@4277
   348
slouken@4277
   349
slouken@4277
   350
# func_mktempdir [string]
slouken@4277
   351
# Make a temporary directory that won't clash with other running
slouken@4277
   352
# libtool processes, and avoids race conditions if possible.  If
slouken@4277
   353
# given, STRING is the basename for that directory.
slouken@4277
   354
func_mktempdir ()
slouken@4277
   355
{
slouken@4277
   356
    my_template="${TMPDIR-/tmp}/${1-$progname}"
slouken@4277
   357
slouken@4277
   358
    if test "$opt_dry_run" = ":"; then
slouken@4277
   359
      # Return a directory name, but don't create it in dry-run mode
slouken@4277
   360
      my_tmpdir="${my_template}-$$"
slouken@4277
   361
    else
slouken@4277
   362
slouken@4277
   363
      # If mktemp works, use that first and foremost
slouken@4277
   364
      my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
slouken@4277
   365
slouken@4277
   366
      if test ! -d "$my_tmpdir"; then
slouken@4277
   367
        # Failing that, at least try and use $RANDOM to avoid a race
slouken@4277
   368
        my_tmpdir="${my_template}-${RANDOM-0}$$"
slouken@4277
   369
slouken@4277
   370
        save_mktempdir_umask=`umask`
slouken@4277
   371
        umask 0077
slouken@4277
   372
        $MKDIR "$my_tmpdir"
slouken@4277
   373
        umask $save_mktempdir_umask
slouken@4277
   374
      fi
slouken@4277
   375
slouken@4277
   376
      # If we're not in dry-run mode, bomb out on failure
slouken@4277
   377
      test -d "$my_tmpdir" || \
slouken@4277
   378
        func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
slouken@4277
   379
    fi
slouken@4277
   380
slouken@4277
   381
    $ECHO "X$my_tmpdir" | $Xsed
slouken@4277
   382
}
slouken@4277
   383
slouken@4277
   384
slouken@4277
   385
# func_quote_for_eval arg
slouken@4277
   386
# Aesthetically quote ARG to be evaled later.
slouken@4277
   387
# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
slouken@4277
   388
# is double-quoted, suitable for a subsequent eval, whereas
slouken@4277
   389
# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
slouken@4277
   390
# which are still active within double quotes backslashified.
slouken@4277
   391
func_quote_for_eval ()
slouken@4277
   392
{
slouken@4277
   393
    case $1 in
slouken@4277
   394
      *[\\\`\"\$]*)
slouken@4277
   395
	func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;;
slouken@4277
   396
      *)
slouken@4277
   397
        func_quote_for_eval_unquoted_result="$1" ;;
slouken@4277
   398
    esac
slouken@4277
   399
slouken@4277
   400
    case $func_quote_for_eval_unquoted_result in
slouken@4277
   401
      # Double-quote args containing shell metacharacters to delay
slouken@4277
   402
      # word splitting, command substitution and and variable
slouken@4277
   403
      # expansion for a subsequent eval.
slouken@4277
   404
      # Many Bourne shells cannot handle close brackets correctly
slouken@4277
   405
      # in scan sets, so we specify it separately.
slouken@4277
   406
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
slouken@4277
   407
        func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
slouken@4277
   408
        ;;
slouken@4277
   409
      *)
slouken@4277
   410
        func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
slouken@4277
   411
    esac
slouken@4277
   412
}
slouken@4277
   413
slouken@4277
   414
slouken@4277
   415
# func_quote_for_expand arg
slouken@4277
   416
# Aesthetically quote ARG to be evaled later; same as above,
slouken@4277
   417
# but do not quote variable references.
slouken@4277
   418
func_quote_for_expand ()
slouken@4277
   419
{
slouken@4277
   420
    case $1 in
slouken@4277
   421
      *[\\\`\"]*)
slouken@4277
   422
	my_arg=`$ECHO "X$1" | $Xsed \
slouken@4277
   423
	    -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
slouken@4277
   424
      *)
slouken@4277
   425
        my_arg="$1" ;;
slouken@4277
   426
    esac
slouken@4277
   427
slouken@4277
   428
    case $my_arg in
slouken@4277
   429
      # Double-quote args containing shell metacharacters to delay
slouken@4277
   430
      # word splitting and command substitution for a subsequent eval.
slouken@4277
   431
      # Many Bourne shells cannot handle close brackets correctly
slouken@4277
   432
      # in scan sets, so we specify it separately.
slouken@4277
   433
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
slouken@4277
   434
        my_arg="\"$my_arg\""
slouken@4277
   435
        ;;
slouken@4277
   436
    esac
slouken@4277
   437
slouken@4277
   438
    func_quote_for_expand_result="$my_arg"
slouken@4277
   439
}
slouken@4277
   440
slouken@4277
   441
slouken@4277
   442
# func_show_eval cmd [fail_exp]
slouken@4277
   443
# Unless opt_silent is true, then output CMD.  Then, if opt_dryrun is
slouken@4277
   444
# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
slouken@4277
   445
# is given, then evaluate it.
slouken@4277
   446
func_show_eval ()
slouken@4277
   447
{
slouken@4277
   448
    my_cmd="$1"
slouken@4277
   449
    my_fail_exp="${2-:}"
slouken@4277
   450
slouken@4277
   451
    ${opt_silent-false} || {
slouken@4277
   452
      func_quote_for_expand "$my_cmd"
slouken@4277
   453
      eval "func_echo $func_quote_for_expand_result"
slouken@4277
   454
    }
slouken@4277
   455
slouken@4277
   456
    if ${opt_dry_run-false}; then :; else
slouken@4277
   457
      eval "$my_cmd"
slouken@4277
   458
      my_status=$?
slouken@4277
   459
      if test "$my_status" -eq 0; then :; else
slouken@4277
   460
	eval "(exit $my_status); $my_fail_exp"
slouken@4277
   461
      fi
slouken@4277
   462
    fi
slouken@4277
   463
}
slouken@4277
   464
slouken@4277
   465
slouken@4277
   466
# func_show_eval_locale cmd [fail_exp]
slouken@4277
   467
# Unless opt_silent is true, then output CMD.  Then, if opt_dryrun is
slouken@4277
   468
# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
slouken@4277
   469
# is given, then evaluate it.  Use the saved locale for evaluation.
slouken@4277
   470
func_show_eval_locale ()
slouken@4277
   471
{
slouken@4277
   472
    my_cmd="$1"
slouken@4277
   473
    my_fail_exp="${2-:}"
slouken@4277
   474
slouken@4277
   475
    ${opt_silent-false} || {
slouken@4277
   476
      func_quote_for_expand "$my_cmd"
slouken@4277
   477
      eval "func_echo $func_quote_for_expand_result"
slouken@4277
   478
    }
slouken@4277
   479
slouken@4277
   480
    if ${opt_dry_run-false}; then :; else
slouken@4277
   481
      eval "$lt_user_locale
slouken@4277
   482
	    $my_cmd"
slouken@4277
   483
      my_status=$?
slouken@4277
   484
      eval "$lt_safe_locale"
slouken@4277
   485
      if test "$my_status" -eq 0; then :; else
slouken@4277
   486
	eval "(exit $my_status); $my_fail_exp"
slouken@4277
   487
      fi
slouken@4277
   488
    fi
slouken@4277
   489
}
slouken@4277
   490
slouken@4277
   491
slouken@4277
   492
slouken@4277
   493
slouken@4277
   494
slouken@4277
   495
# func_version
slouken@4277
   496
# Echo version message to standard output and exit.
slouken@4277
   497
func_version ()
slouken@4277
   498
{
slouken@4277
   499
    $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / {
slouken@4277
   500
        s/^# //
slouken@4277
   501
	s/^# *$//
slouken@4277
   502
        s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
slouken@4277
   503
        p
slouken@4277
   504
     }' < "$progpath"
slouken@4277
   505
     exit $?
slouken@4277
   506
}
slouken@4277
   507
slouken@4277
   508
# func_usage
slouken@4277
   509
# Echo short help message to standard output and exit.
slouken@4277
   510
func_usage ()
slouken@4277
   511
{
slouken@4277
   512
    $SED -n '/^# Usage:/,/# -h/ {
slouken@4277
   513
        s/^# //
slouken@4277
   514
	s/^# *$//
slouken@4277
   515
	s/\$progname/'$progname'/
slouken@4277
   516
	p
slouken@4277
   517
    }' < "$progpath"
slouken@4277
   518
    $ECHO
slouken@4277
   519
    $ECHO "run \`$progname --help | more' for full usage"
slouken@4277
   520
    exit $?
slouken@4277
   521
}
slouken@4277
   522
slouken@4277
   523
# func_help
slouken@4277
   524
# Echo long help message to standard output and exit.
slouken@4277
   525
func_help ()
slouken@4277
   526
{
slouken@4277
   527
    $SED -n '/^# Usage:/,/# Report bugs to/ {
slouken@4277
   528
        s/^# //
slouken@4277
   529
	s/^# *$//
slouken@4277
   530
	s*\$progname*'$progname'*
slouken@4277
   531
	s*\$host*'"$host"'*
slouken@4277
   532
	s*\$SHELL*'"$SHELL"'*
slouken@4277
   533
	s*\$LTCC*'"$LTCC"'*
slouken@4277
   534
	s*\$LTCFLAGS*'"$LTCFLAGS"'*
slouken@4277
   535
	s*\$LD*'"$LD"'*
slouken@4277
   536
	s/\$with_gnu_ld/'"$with_gnu_ld"'/
slouken@4277
   537
	s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
slouken@4277
   538
	s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
slouken@4277
   539
	p
slouken@4277
   540
     }' < "$progpath"
slouken@4277
   541
    exit $?
slouken@4277
   542
}
slouken@4277
   543
slouken@4277
   544
# func_missing_arg argname
slouken@4277
   545
# Echo program name prefixed message to standard error and set global
slouken@4277
   546
# exit_cmd.
slouken@4277
   547
func_missing_arg ()
slouken@4277
   548
{
slouken@4277
   549
    func_error "missing argument for $1"
slouken@4277
   550
    exit_cmd=exit
slouken@4277
   551
}
slouken@4277
   552
slouken@4277
   553
exit_cmd=:
slouken@4277
   554
slouken@4277
   555
slouken@4277
   556
slouken@4277
   557
slouken@4277
   558
slouken@4277
   559
# Check that we have a working $ECHO.
slouken@1361
   560
if test "X$1" = X--no-reexec; then
slouken@1361
   561
  # Discard the --no-reexec flag, and continue.
slouken@1361
   562
  shift
slouken@1361
   563
elif test "X$1" = X--fallback-echo; then
slouken@1361
   564
  # Avoid inline document here, it may be left over
slouken@1361
   565
  :
slouken@4277
   566
elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then
slouken@4277
   567
  # Yippee, $ECHO works!
slouken@1361
   568
  :
slouken@1361
   569
else
slouken@4277
   570
  # Restart under the correct shell, and then maybe $ECHO will work.
slouken@1361
   571
  exec $SHELL "$progpath" --no-reexec ${1+"$@"}
slouken@1361
   572
fi
slouken@1361
   573
slouken@1361
   574
if test "X$1" = X--fallback-echo; then
slouken@1361
   575
  # used as fallback echo
slouken@1361
   576
  shift
slouken@1361
   577
  cat <<EOF
slouken@1361
   578
$*
slouken@1361
   579
EOF
slouken@1361
   580
  exit $EXIT_SUCCESS
slouken@1361
   581
fi
slouken@1361
   582
slouken@1361
   583
magic="%%%MAGIC variable%%%"
slouken@4277
   584
magic_exe="%%%MAGIC EXE variable%%%"
slouken@1361
   585
slouken@1361
   586
# Global variables.
slouken@4277
   587
# $mode is unset
slouken@1361
   588
nonopt=
slouken@1361
   589
execute_dlfiles=
slouken@1570
   590
preserve_args=
slouken@1361
   591
lo2o="s/\\.lo\$/.${objext}/"
slouken@1361
   592
o2lo="s/\\.${objext}\$/.lo/"
slouken@4277
   593
extracted_archives=
slouken@4277
   594
extracted_serial=0
slouken@4277
   595
slouken@4277
   596
opt_dry_run=false
slouken@4277
   597
opt_duplicate_deps=false
slouken@4277
   598
opt_silent=false
slouken@4277
   599
opt_debug=:
slouken@4277
   600
slouken@4277
   601
# If this variable is set in any of the actions, the command in it
slouken@4277
   602
# will be execed at the end.  This prevents here-documents from being
slouken@4277
   603
# left over by shells.
slouken@4277
   604
exec_cmd=
slouken@4277
   605
slouken@4277
   606
# func_fatal_configuration arg...
slouken@4277
   607
# Echo program name prefixed message to standard error, followed by
slouken@4277
   608
# a configuration failure hint, and exit.
slouken@4277
   609
func_fatal_configuration ()
slouken@1570
   610
{
slouken@4277
   611
    func_error ${1+"$@"}
slouken@4277
   612
    func_error "See the $PACKAGE documentation for more information."
slouken@4277
   613
    func_fatal_error "Fatal configuration error."
slouken@4277
   614
}
slouken@4277
   615
slouken@4277
   616
slouken@4277
   617
# func_config
slouken@4277
   618
# Display the configuration for all the tags in this script.
slouken@4277
   619
func_config ()
slouken@4277
   620
{
slouken@4277
   621
    re_begincf='^# ### BEGIN LIBTOOL'
slouken@4277
   622
    re_endcf='^# ### END LIBTOOL'
slouken@4277
   623
slouken@4277
   624
    # Default configuration.
slouken@4277
   625
    $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
slouken@4277
   626
slouken@4277
   627
    # Now print the configurations for the tags.
slouken@4277
   628
    for tagname in $taglist; do
slouken@4277
   629
      $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
slouken@4277
   630
    done
slouken@4277
   631
slouken@4277
   632
    exit $?
slouken@4277
   633
}
slouken@4277
   634
slouken@4277
   635
# func_features
slouken@4277
   636
# Display the features supported by this script.
slouken@4277
   637
func_features ()
slouken@4277
   638
{
slouken@4277
   639
    $ECHO "host: $host"
slouken@4277
   640
    if test "$build_libtool_libs" = yes; then
slouken@4277
   641
      $ECHO "enable shared libraries"
slouken@1570
   642
    else
slouken@4277
   643
      $ECHO "disable shared libraries"
slouken@4277
   644
    fi
slouken@4277
   645
    if test "$build_old_libs" = yes; then
slouken@4277
   646
      $ECHO "enable static libraries"
slouken@4277
   647
    else
slouken@4277
   648
      $ECHO "disable static libraries"
slouken@4277
   649
    fi
slouken@4277
   650
slouken@4277
   651
    exit $?
slouken@4277
   652
}
slouken@4277
   653
slouken@4277
   654
# func_enable_tag tagname
slouken@4277
   655
# Verify that TAGNAME is valid, and either flag an error and exit, or
slouken@4277
   656
# enable the TAGNAME tag.  We also add TAGNAME to the global $taglist
slouken@4277
   657
# variable here.
slouken@4277
   658
func_enable_tag ()
slouken@4277
   659
{
slouken@4277
   660
  # Global variable:
slouken@4277
   661
  tagname="$1"
slouken@4277
   662
slouken@4277
   663
  re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
slouken@4277
   664
  re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
slouken@4277
   665
  sed_extractcf="/$re_begincf/,/$re_endcf/p"
slouken@4277
   666
slouken@4277
   667
  # Validate tagname.
slouken@4277
   668
  case $tagname in
slouken@4277
   669
    *[!-_A-Za-z0-9,/]*)
slouken@4277
   670
      func_fatal_error "invalid tag name: $tagname"
slouken@4277
   671
      ;;
slouken@4277
   672
  esac
slouken@4277
   673
slouken@4277
   674
  # Don't test for the "default" C tag, as we know it's
slouken@4277
   675
  # there but not specially marked.
slouken@4277
   676
  case $tagname in
slouken@4277
   677
    CC) ;;
slouken@4277
   678
    *)
slouken@4277
   679
      if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
slouken@4277
   680
	taglist="$taglist $tagname"
slouken@4277
   681
slouken@4277
   682
	# Evaluate the configuration.  Be careful to quote the path
slouken@4277
   683
	# and the sed script, to avoid splitting on whitespace, but
slouken@4277
   684
	# also don't use non-portable quotes within backquotes within
slouken@4277
   685
	# quotes we have to do it in 2 steps:
slouken@4277
   686
	extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
slouken@4277
   687
	eval "$extractedcf"
slouken@4277
   688
      else
slouken@4277
   689
	func_error "ignoring unknown tag $tagname"
slouken@1570
   690
      fi
slouken@4277
   691
      ;;
slouken@4277
   692
  esac
slouken@4277
   693
}
slouken@4277
   694
slouken@4277
   695
# Parse options once, thoroughly.  This comes as soon as possible in
slouken@4277
   696
# the script to make things like `libtool --version' happen quickly.
slouken@4277
   697
{
slouken@4277
   698
slouken@4277
   699
  # Shorthand for --mode=foo, only valid as the first argument
slouken@4277
   700
  case $1 in
slouken@4277
   701
  clean|clea|cle|cl)
slouken@4277
   702
    shift; set dummy --mode clean ${1+"$@"}; shift
slouken@4277
   703
    ;;
slouken@4277
   704
  compile|compil|compi|comp|com|co|c)
slouken@4277
   705
    shift; set dummy --mode compile ${1+"$@"}; shift
slouken@4277
   706
    ;;
slouken@4277
   707
  execute|execut|execu|exec|exe|ex|e)
slouken@4277
   708
    shift; set dummy --mode execute ${1+"$@"}; shift
slouken@4277
   709
    ;;
slouken@4277
   710
  finish|finis|fini|fin|fi|f)
slouken@4277
   711
    shift; set dummy --mode finish ${1+"$@"}; shift
slouken@4277
   712
    ;;
slouken@4277
   713
  install|instal|insta|inst|ins|in|i)
slouken@4277
   714
    shift; set dummy --mode install ${1+"$@"}; shift
slouken@4277
   715
    ;;
slouken@4277
   716
  link|lin|li|l)
slouken@4277
   717
    shift; set dummy --mode link ${1+"$@"}; shift
slouken@4277
   718
    ;;
slouken@4277
   719
  uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
slouken@4277
   720
    shift; set dummy --mode uninstall ${1+"$@"}; shift
slouken@4277
   721
    ;;
slouken@4277
   722
  esac
slouken@4277
   723
slouken@4277
   724
  # Parse non-mode specific arguments:
slouken@4277
   725
  while test "$#" -gt 0; do
slouken@4277
   726
    opt="$1"
slouken@4277
   727
    shift
slouken@4277
   728
slouken@4277
   729
    case $opt in
slouken@4277
   730
      --config)		func_config					;;
slouken@4277
   731
slouken@4277
   732
      --debug)		preserve_args="$preserve_args $opt"
slouken@4277
   733
			func_echo "enabling shell trace mode"
slouken@4277
   734
			opt_debug='set -x'
slouken@4277
   735
			$opt_debug
slouken@4277
   736
			;;
slouken@4277
   737
slouken@4277
   738
      -dlopen)		test "$#" -eq 0 && func_missing_arg "$opt" && break
slouken@4277
   739
			execute_dlfiles="$execute_dlfiles $1"
slouken@4277
   740
			shift
slouken@4277
   741
			;;
slouken@4277
   742
slouken@4277
   743
      --dry-run | -n)	opt_dry_run=:					;;
slouken@4277
   744
      --features)       func_features					;;
slouken@4277
   745
      --finish)		mode="finish"					;;
slouken@4277
   746
slouken@4277
   747
      --mode)		test "$#" -eq 0 && func_missing_arg "$opt" && break
slouken@4277
   748
			case $1 in
slouken@4277
   749
			  # Valid mode arguments:
slouken@4277
   750
			  clean)	;;
slouken@4277
   751
			  compile)	;;
slouken@4277
   752
			  execute)	;;
slouken@4277
   753
			  finish)	;;
slouken@4277
   754
			  install)	;;
slouken@4277
   755
			  link)		;;
slouken@4277
   756
			  relink)	;;
slouken@4277
   757
			  uninstall)	;;
slouken@4277
   758
slouken@4277
   759
			  # Catch anything else as an error
slouken@4277
   760
			  *) func_error "invalid argument for $opt"
slouken@4277
   761
			     exit_cmd=exit
slouken@4277
   762
			     break
slouken@4277
   763
			     ;;
slouken@4277
   764
		        esac
slouken@4277
   765
slouken@4277
   766
			mode="$1"
slouken@4277
   767
			shift
slouken@4277
   768
			;;
slouken@4277
   769
slouken@4277
   770
      --preserve-dup-deps)
slouken@4277
   771
			opt_duplicate_deps=:				;;
slouken@4277
   772
slouken@4277
   773
      --quiet|--silent)	preserve_args="$preserve_args $opt"
slouken@4277
   774
			opt_silent=:
slouken@4277
   775
			;;
slouken@4277
   776
slouken@4277
   777
      --verbose| -v)	preserve_args="$preserve_args $opt"
slouken@4277
   778
			opt_silent=false
slouken@4277
   779
			;;
slouken@4277
   780
slouken@4277
   781
      --tag)		test "$#" -eq 0 && func_missing_arg "$opt" && break
slouken@4277
   782
			preserve_args="$preserve_args $opt $1"
slouken@4277
   783
			func_enable_tag "$1"	# tagname is set here
slouken@4277
   784
			shift
slouken@4277
   785
			;;
slouken@4277
   786
slouken@4277
   787
      # Separate optargs to long options:
slouken@4277
   788
      -dlopen=*|--mode=*|--tag=*)
slouken@4277
   789
			func_opt_split "$opt"
slouken@4277
   790
			set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"}
slouken@4277
   791
			shift
slouken@4277
   792
			;;
slouken@4277
   793
slouken@4277
   794
      -\?|-h)		func_usage					;;
slouken@4277
   795
      --help)		opt_help=:					;;
slouken@4277
   796
      --version)	func_version					;;
slouken@4277
   797
slouken@4277
   798
      -*)		func_fatal_help "unrecognized option \`$opt'"	;;
slouken@4277
   799
slouken@4277
   800
      *)		nonopt="$opt"
slouken@4277
   801
			break
slouken@4277
   802
			;;
slouken@4277
   803
    esac
slouken@4277
   804
  done
slouken@4277
   805
slouken@4277
   806
slouken@4277
   807
  case $host in
slouken@4277
   808
    *cygwin* | *mingw* | *pw32* | *cegcc*)
slouken@4277
   809
      # don't eliminate duplications in $postdeps and $predeps
slouken@4277
   810
      opt_duplicate_compiler_generated_deps=:
slouken@4277
   811
      ;;
slouken@4277
   812
    *)
slouken@4277
   813
      opt_duplicate_compiler_generated_deps=$opt_duplicate_deps
slouken@4277
   814
      ;;
slouken@4277
   815
  esac
slouken@4277
   816
slouken@4277
   817
  # Having warned about all mis-specified options, bail out if
slouken@4277
   818
  # anything was wrong.
slouken@4277
   819
  $exit_cmd $EXIT_FAILURE
slouken@4277
   820
}
slouken@4277
   821
slouken@4277
   822
# func_check_version_match
slouken@4277
   823
# Ensure that we are using m4 macros, and libtool script from the same
slouken@4277
   824
# release of libtool.
slouken@4277
   825
func_check_version_match ()
slouken@4277
   826
{
slouken@4277
   827
  if test "$package_revision" != "$macro_revision"; then
slouken@4277
   828
    if test "$VERSION" != "$macro_version"; then
slouken@4277
   829
      if test -z "$macro_version"; then
slouken@4277
   830
        cat >&2 <<_LT_EOF
slouken@4277
   831
$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
slouken@4277
   832
$progname: definition of this LT_INIT comes from an older release.
slouken@4277
   833
$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
slouken@4277
   834
$progname: and run autoconf again.
slouken@4277
   835
_LT_EOF
slouken@4277
   836
      else
slouken@4277
   837
        cat >&2 <<_LT_EOF
slouken@4277
   838
$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
slouken@4277
   839
$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
slouken@4277
   840
$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
slouken@4277
   841
$progname: and run autoconf again.
slouken@4277
   842
_LT_EOF
slouken@4277
   843
      fi
slouken@4277
   844
    else
slouken@4277
   845
      cat >&2 <<_LT_EOF
slouken@4277
   846
$progname: Version mismatch error.  This is $PACKAGE $VERSION, revision $package_revision,
slouken@4277
   847
$progname: but the definition of this LT_INIT comes from revision $macro_revision.
slouken@4277
   848
$progname: You should recreate aclocal.m4 with macros from revision $package_revision
slouken@4277
   849
$progname: of $PACKAGE $VERSION and run autoconf again.
slouken@4277
   850
_LT_EOF
slouken@4277
   851
    fi
slouken@4277
   852
slouken@4277
   853
    exit $EXIT_MISMATCH
slouken@4277
   854
  fi
slouken@4277
   855
}
slouken@4277
   856
slouken@4277
   857
slouken@4277
   858
## ----------- ##
slouken@4277
   859
##    Main.    ##
slouken@4277
   860
## ----------- ##
slouken@4277
   861
slouken@4277
   862
$opt_help || {
slouken@4277
   863
  # Sanity checks first:
slouken@4277
   864
  func_check_version_match
slouken@4277
   865
slouken@4277
   866
  if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
slouken@4277
   867
    func_fatal_configuration "not configured to build any kind of library"
slouken@4277
   868
  fi
slouken@4277
   869
slouken@4277
   870
  test -z "$mode" && func_fatal_error "error: you must specify a MODE."
slouken@4277
   871
slouken@4277
   872
slouken@4277
   873
  # Darwin sucks
slouken@4277
   874
  eval std_shrext=\"$shrext_cmds\"
slouken@4277
   875
slouken@4277
   876
slouken@4277
   877
  # Only execute mode is allowed to have -dlopen flags.
slouken@4277
   878
  if test -n "$execute_dlfiles" && test "$mode" != execute; then
slouken@4277
   879
    func_error "unrecognized option \`-dlopen'"
slouken@4277
   880
    $ECHO "$help" 1>&2
slouken@4277
   881
    exit $EXIT_FAILURE
slouken@4277
   882
  fi
slouken@4277
   883
slouken@4277
   884
  # Change the help message to a mode-specific one.
slouken@4277
   885
  generic_help="$help"
slouken@4277
   886
  help="Try \`$progname --help --mode=$mode' for more information."
slouken@4277
   887
}
slouken@4277
   888
slouken@4277
   889
slouken@4277
   890
# func_lalib_p file
slouken@4277
   891
# True iff FILE is a libtool `.la' library or `.lo' object file.
slouken@4277
   892
# This function is only a basic sanity check; it will hardly flush out
slouken@4277
   893
# determined imposters.
slouken@4277
   894
func_lalib_p ()
slouken@4277
   895
{
slouken@4277
   896
    test -f "$1" &&
slouken@4277
   897
      $SED -e 4q "$1" 2>/dev/null \
slouken@4277
   898
        | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
slouken@4277
   899
}
slouken@4277
   900
slouken@4277
   901
# func_lalib_unsafe_p file
slouken@4277
   902
# True iff FILE is a libtool `.la' library or `.lo' object file.
slouken@4277
   903
# This function implements the same check as func_lalib_p without
slouken@4277
   904
# resorting to external programs.  To this end, it redirects stdin and
slouken@4277
   905
# closes it afterwards, without saving the original file descriptor.
slouken@4277
   906
# As a safety measure, use it only where a negative result would be
slouken@4277
   907
# fatal anyway.  Works if `file' does not exist.
slouken@4277
   908
func_lalib_unsafe_p ()
slouken@4277
   909
{
slouken@4277
   910
    lalib_p=no
slouken@4277
   911
    if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
slouken@4277
   912
	for lalib_p_l in 1 2 3 4
slouken@4277
   913
	do
slouken@4277
   914
	    read lalib_p_line
slouken@4277
   915
	    case "$lalib_p_line" in
slouken@4277
   916
		\#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
slouken@4277
   917
	    esac
slouken@4277
   918
	done
slouken@4277
   919
	exec 0<&5 5<&-
slouken@4277
   920
    fi
slouken@4277
   921
    test "$lalib_p" = yes
slouken@4277
   922
}
slouken@4277
   923
slouken@4277
   924
# func_ltwrapper_script_p file
slouken@4277
   925
# True iff FILE is a libtool wrapper script
slouken@4277
   926
# This function is only a basic sanity check; it will hardly flush out
slouken@4277
   927
# determined imposters.
slouken@4277
   928
func_ltwrapper_script_p ()
slouken@4277
   929
{
slouken@4277
   930
    func_lalib_p "$1"
slouken@4277
   931
}
slouken@4277
   932
slouken@4277
   933
# func_ltwrapper_executable_p file
slouken@4277
   934
# True iff FILE is a libtool wrapper executable
slouken@4277
   935
# This function is only a basic sanity check; it will hardly flush out
slouken@4277
   936
# determined imposters.
slouken@4277
   937
func_ltwrapper_executable_p ()
slouken@4277
   938
{
slouken@4277
   939
    func_ltwrapper_exec_suffix=
slouken@4277
   940
    case $1 in
slouken@4277
   941
    *.exe) ;;
slouken@4277
   942
    *) func_ltwrapper_exec_suffix=.exe ;;
slouken@4277
   943
    esac
slouken@4277
   944
    $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
slouken@4277
   945
}
slouken@4277
   946
slouken@4277
   947
# func_ltwrapper_scriptname file
slouken@4277
   948
# Assumes file is an ltwrapper_executable
slouken@4277
   949
# uses $file to determine the appropriate filename for a
slouken@4277
   950
# temporary ltwrapper_script.
slouken@4277
   951
func_ltwrapper_scriptname ()
slouken@4277
   952
{
slouken@4277
   953
    func_ltwrapper_scriptname_result=""
slouken@4277
   954
    if func_ltwrapper_executable_p "$1"; then
slouken@4277
   955
	func_dirname_and_basename "$1" "" "."
slouken@4277
   956
	func_stripname '' '.exe' "$func_basename_result"
slouken@4277
   957
	func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
slouken@4277
   958
    fi
slouken@4277
   959
}
slouken@4277
   960
slouken@4277
   961
# func_ltwrapper_p file
slouken@4277
   962
# True iff FILE is a libtool wrapper script or wrapper executable
slouken@4277
   963
# This function is only a basic sanity check; it will hardly flush out
slouken@4277
   964
# determined imposters.
slouken@4277
   965
func_ltwrapper_p ()
slouken@4277
   966
{
slouken@4277
   967
    func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
slouken@4277
   968
}
slouken@4277
   969
slouken@4277
   970
slouken@4277
   971
# func_execute_cmds commands fail_cmd
slouken@4277
   972
# Execute tilde-delimited COMMANDS.
slouken@4277
   973
# If FAIL_CMD is given, eval that upon failure.
slouken@4277
   974
# FAIL_CMD may read-access the current command in variable CMD!
slouken@4277
   975
func_execute_cmds ()
slouken@4277
   976
{
slouken@4277
   977
    $opt_debug
slouken@4277
   978
    save_ifs=$IFS; IFS='~'
slouken@4277
   979
    for cmd in $1; do
slouken@4277
   980
      IFS=$save_ifs
slouken@4277
   981
      eval cmd=\"$cmd\"
slouken@4277
   982
      func_show_eval "$cmd" "${2-:}"
slouken@4277
   983
    done
slouken@4277
   984
    IFS=$save_ifs
slouken@4277
   985
}
slouken@4277
   986
slouken@4277
   987
slouken@4277
   988
# func_source file
slouken@4277
   989
# Source FILE, adding directory component if necessary.
slouken@4277
   990
# Note that it is not necessary on cygwin/mingw to append a dot to
slouken@4277
   991
# FILE even if both FILE and FILE.exe exist: automatic-append-.exe
slouken@4277
   992
# behavior happens only for exec(3), not for open(2)!  Also, sourcing
slouken@4277
   993
# `FILE.' does not work on cygwin managed mounts.
slouken@4277
   994
func_source ()
slouken@4277
   995
{
slouken@4277
   996
    $opt_debug
slouken@4277
   997
    case $1 in
slouken@4277
   998
    */* | *\\*)	. "$1" ;;
slouken@4277
   999
    *)		. "./$1" ;;
slouken@4277
  1000
    esac
slouken@4277
  1001
}
slouken@4277
  1002
slouken@4277
  1003
slouken@4277
  1004
# func_infer_tag arg
slouken@4277
  1005
# Infer tagged configuration to use if any are available and
slouken@4277
  1006
# if one wasn't chosen via the "--tag" command line option.
slouken@4277
  1007
# Only attempt this if the compiler in the base compile
slouken@4277
  1008
# command doesn't match the default compiler.
slouken@4277
  1009
# arg is usually of the form 'gcc ...'
slouken@4277
  1010
func_infer_tag ()
slouken@4277
  1011
{
slouken@4277
  1012
    $opt_debug
slouken@4277
  1013
    if test -n "$available_tags" && test -z "$tagname"; then
slouken@4277
  1014
      CC_quoted=
slouken@4277
  1015
      for arg in $CC; do
slouken@4277
  1016
        func_quote_for_eval "$arg"
slouken@4277
  1017
	CC_quoted="$CC_quoted $func_quote_for_eval_result"
slouken@4277
  1018
      done
slouken@4277
  1019
      case $@ in
slouken@4277
  1020
      # Blanks in the command may have been stripped by the calling shell,
slouken@4277
  1021
      # but not from the CC environment variable when configure was run.
slouken@4277
  1022
      " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;;
slouken@4277
  1023
      # Blanks at the start of $base_compile will cause this to fail
slouken@4277
  1024
      # if we don't check for them as well.
slouken@4277
  1025
      *)
slouken@4277
  1026
	for z in $available_tags; do
slouken@4277
  1027
	  if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
slouken@4277
  1028
	    # Evaluate the configuration.
slouken@4277
  1029
	    eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
slouken@4277
  1030
	    CC_quoted=
slouken@4277
  1031
	    for arg in $CC; do
slouken@4277
  1032
	      # Double-quote args containing other shell metacharacters.
slouken@4277
  1033
	      func_quote_for_eval "$arg"
slouken@4277
  1034
	      CC_quoted="$CC_quoted $func_quote_for_eval_result"
slouken@4277
  1035
	    done
slouken@4277
  1036
	    case "$@ " in
slouken@4277
  1037
	      " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*)
slouken@4277
  1038
	      # The compiler in the base compile command matches
slouken@4277
  1039
	      # the one in the tagged configuration.
slouken@4277
  1040
	      # Assume this is the tagged configuration we want.
slouken@4277
  1041
	      tagname=$z
slouken@4277
  1042
	      break
slouken@4277
  1043
	      ;;
slouken@4277
  1044
	    esac
slouken@4277
  1045
	  fi
slouken@4277
  1046
	done
slouken@4277
  1047
	# If $tagname still isn't set, then no tagged configuration
slouken@4277
  1048
	# was found and let the user know that the "--tag" command
slouken@4277
  1049
	# line option must be used.
slouken@4277
  1050
	if test -z "$tagname"; then
slouken@4277
  1051
	  func_echo "unable to infer tagged configuration"
slouken@4277
  1052
	  func_fatal_error "specify a tag with \`--tag'"
slouken@4277
  1053
#	else
slouken@4277
  1054
#	  func_verbose "using $tagname tagged configuration"
slouken@4277
  1055
	fi
slouken@4277
  1056
	;;
slouken@4277
  1057
      esac
slouken@4277
  1058
    fi
slouken@4277
  1059
}
slouken@4277
  1060
slouken@4277
  1061
slouken@4277
  1062
slouken@4277
  1063
# func_write_libtool_object output_name pic_name nonpic_name
slouken@4277
  1064
# Create a libtool object file (analogous to a ".la" file),
slouken@4277
  1065
# but don't create it if we're doing a dry run.
slouken@4277
  1066
func_write_libtool_object ()
slouken@4277
  1067
{
slouken@4277
  1068
    write_libobj=${1}
slouken@4277
  1069
    if test "$build_libtool_libs" = yes; then
slouken@4277
  1070
      write_lobj=\'${2}\'
slouken@4277
  1071
    else
slouken@4277
  1072
      write_lobj=none
slouken@4277
  1073
    fi
slouken@4277
  1074
slouken@4277
  1075
    if test "$build_old_libs" = yes; then
slouken@4277
  1076
      write_oldobj=\'${3}\'
slouken@4277
  1077
    else
slouken@4277
  1078
      write_oldobj=none
slouken@4277
  1079
    fi
slouken@4277
  1080
slouken@4277
  1081
    $opt_dry_run || {
slouken@4277
  1082
      cat >${write_libobj}T <<EOF
slouken@4277
  1083
# $write_libobj - a libtool object file
slouken@4277
  1084
# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
slouken@4277
  1085
#
slouken@4277
  1086
# Please DO NOT delete this file!
slouken@4277
  1087
# It is necessary for linking the library.
slouken@4277
  1088
slouken@4277
  1089
# Name of the PIC object.
slouken@4277
  1090
pic_object=$write_lobj
slouken@4277
  1091
slouken@4277
  1092
# Name of the non-PIC object
slouken@4277
  1093
non_pic_object=$write_oldobj
slouken@4277
  1094
slouken@4277
  1095
EOF
slouken@4277
  1096
      $MV "${write_libobj}T" "${write_libobj}"
slouken@4277
  1097
    }
slouken@4277
  1098
}
slouken@4277
  1099
slouken@4277
  1100
# func_mode_compile arg...
slouken@4277
  1101
func_mode_compile ()
slouken@4277
  1102
{
slouken@4277
  1103
    $opt_debug
slouken@4277
  1104
    # Get the compilation command and the source file.
slouken@4277
  1105
    base_compile=
slouken@4277
  1106
    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
slouken@4277
  1107
    suppress_opt=yes
slouken@4277
  1108
    suppress_output=
slouken@4277
  1109
    arg_mode=normal
slouken@4277
  1110
    libobj=
slouken@4277
  1111
    later=
slouken@4277
  1112
    pie_flag=
slouken@4277
  1113
slouken@4277
  1114
    for arg
slouken@4277
  1115
    do
slouken@4277
  1116
      case $arg_mode in
slouken@4277
  1117
      arg  )
slouken@4277
  1118
	# do not "continue".  Instead, add this to base_compile
slouken@4277
  1119
	lastarg="$arg"
slouken@4277
  1120
	arg_mode=normal
slouken@4277
  1121
	;;
slouken@4277
  1122
slouken@4277
  1123
      target )
slouken@4277
  1124
	libobj="$arg"
slouken@4277
  1125
	arg_mode=normal
slouken@4277
  1126
	continue
slouken@4277
  1127
	;;
slouken@4277
  1128
slouken@4277
  1129
      normal )
slouken@4277
  1130
	# Accept any command-line options.
slouken@4277
  1131
	case $arg in
slouken@4277
  1132
	-o)
slouken@4277
  1133
	  test -n "$libobj" && \
slouken@4277
  1134
	    func_fatal_error "you cannot specify \`-o' more than once"
slouken@4277
  1135
	  arg_mode=target
slouken@4277
  1136
	  continue
slouken@4277
  1137
	  ;;
slouken@4277
  1138
slouken@4277
  1139
	-pie | -fpie | -fPIE)
slouken@4277
  1140
          pie_flag="$pie_flag $arg"
slouken@4277
  1141
	  continue
slouken@4277
  1142
	  ;;
slouken@4277
  1143
slouken@4277
  1144
	-shared | -static | -prefer-pic | -prefer-non-pic)
slouken@4277
  1145
	  later="$later $arg"
slouken@4277
  1146
	  continue
slouken@4277
  1147
	  ;;
slouken@4277
  1148
slouken@4277
  1149
	-no-suppress)
slouken@4277
  1150
	  suppress_opt=no
slouken@4277
  1151
	  continue
slouken@4277
  1152
	  ;;
slouken@4277
  1153
slouken@4277
  1154
	-Xcompiler)
slouken@4277
  1155
	  arg_mode=arg  #  the next one goes into the "base_compile" arg list
slouken@4277
  1156
	  continue      #  The current "srcfile" will either be retained or
slouken@4277
  1157
	  ;;            #  replaced later.  I would guess that would be a bug.
slouken@4277
  1158
slouken@4277
  1159
	-Wc,*)
slouken@4277
  1160
	  func_stripname '-Wc,' '' "$arg"
slouken@4277
  1161
	  args=$func_stripname_result
slouken@4277
  1162
	  lastarg=
slouken@4277
  1163
	  save_ifs="$IFS"; IFS=','
slouken@4277
  1164
	  for arg in $args; do
slouken@4277
  1165
	    IFS="$save_ifs"
slouken@4277
  1166
	    func_quote_for_eval "$arg"
slouken@4277
  1167
	    lastarg="$lastarg $func_quote_for_eval_result"
slouken@4277
  1168
	  done
slouken@4277
  1169
	  IFS="$save_ifs"
slouken@4277
  1170
	  func_stripname ' ' '' "$lastarg"
slouken@4277
  1171
	  lastarg=$func_stripname_result
slouken@4277
  1172
slouken@4277
  1173
	  # Add the arguments to base_compile.
slouken@4277
  1174
	  base_compile="$base_compile $lastarg"
slouken@4277
  1175
	  continue
slouken@4277
  1176
	  ;;
slouken@4277
  1177
slouken@4277
  1178
	*)
slouken@4277
  1179
	  # Accept the current argument as the source file.
slouken@4277
  1180
	  # The previous "srcfile" becomes the current argument.
slouken@4277
  1181
	  #
slouken@4277
  1182
	  lastarg="$srcfile"
slouken@4277
  1183
	  srcfile="$arg"
slouken@4277
  1184
	  ;;
slouken@4277
  1185
	esac  #  case $arg
slouken@4277
  1186
	;;
slouken@4277
  1187
      esac    #  case $arg_mode
slouken@4277
  1188
slouken@4277
  1189
      # Aesthetically quote the previous argument.
slouken@4277
  1190
      func_quote_for_eval "$lastarg"
slouken@4277
  1191
      base_compile="$base_compile $func_quote_for_eval_result"
slouken@4277
  1192
    done # for arg
slouken@4277
  1193
slouken@4277
  1194
    case $arg_mode in
slouken@4277
  1195
    arg)
slouken@4277
  1196
      func_fatal_error "you must specify an argument for -Xcompile"
slouken@4277
  1197
      ;;
slouken@4277
  1198
    target)
slouken@4277
  1199
      func_fatal_error "you must specify a target with \`-o'"
slouken@4277
  1200
      ;;
slouken@4277
  1201
    *)
slouken@4277
  1202
      # Get the name of the library object.
slouken@4277
  1203
      test -z "$libobj" && {
slouken@4277
  1204
	func_basename "$srcfile"
slouken@4277
  1205
	libobj="$func_basename_result"
slouken@4277
  1206
      }
slouken@4277
  1207
      ;;
slouken@4277
  1208
    esac
slouken@4277
  1209
slouken@4277
  1210
    # Recognize several different file suffixes.
slouken@4277
  1211
    # If the user specifies -o file.o, it is replaced with file.lo
slouken@4277
  1212
    case $libobj in
slouken@4277
  1213
    *.[cCFSifmso] | \
slouken@4277
  1214
    *.ada | *.adb | *.ads | *.asm | \
slouken@4277
  1215
    *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
slouken@4277
  1216
    *.[fF][09]? | *.for | *.java | *.obj | *.sx)
slouken@4277
  1217
      func_xform "$libobj"
slouken@4277
  1218
      libobj=$func_xform_result
slouken@4277
  1219
      ;;
slouken@4277
  1220
    esac
slouken@4277
  1221
slouken@4277
  1222
    case $libobj in
slouken@4277
  1223
    *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
slouken@4277
  1224
    *)
slouken@4277
  1225
      func_fatal_error "cannot determine name of library object from \`$libobj'"
slouken@4277
  1226
      ;;
slouken@4277
  1227
    esac
slouken@4277
  1228
slouken@4277
  1229
    func_infer_tag $base_compile
slouken@4277
  1230
slouken@4277
  1231
    for arg in $later; do
slouken@4277
  1232
      case $arg in
slouken@4277
  1233
      -shared)
slouken@4277
  1234
	test "$build_libtool_libs" != yes && \
slouken@4277
  1235
	  func_fatal_configuration "can not build a shared library"
slouken@4277
  1236
	build_old_libs=no
slouken@4277
  1237
	continue
slouken@4277
  1238
	;;
slouken@4277
  1239
slouken@4277
  1240
      -static)
slouken@4277
  1241
	build_libtool_libs=no
slouken@4277
  1242
	build_old_libs=yes
slouken@4277
  1243
	continue
slouken@4277
  1244
	;;
slouken@4277
  1245
slouken@4277
  1246
      -prefer-pic)
slouken@4277
  1247
	pic_mode=yes
slouken@4277
  1248
	continue
slouken@4277
  1249
	;;
slouken@4277
  1250
slouken@4277
  1251
      -prefer-non-pic)
slouken@4277
  1252
	pic_mode=no
slouken@4277
  1253
	continue
slouken@4277
  1254
	;;
slouken@4277
  1255
      esac
slouken@4277
  1256
    done
slouken@4277
  1257
slouken@4277
  1258
    func_quote_for_eval "$libobj"
slouken@4277
  1259
    test "X$libobj" != "X$func_quote_for_eval_result" \
slouken@4277
  1260
      && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"'	 &()|`$[]' \
slouken@4277
  1261
      && func_warning "libobj name \`$libobj' may not contain shell special characters."
slouken@4277
  1262
    func_dirname_and_basename "$obj" "/" ""
slouken@4277
  1263
    objname="$func_basename_result"
slouken@4277
  1264
    xdir="$func_dirname_result"
slouken@4277
  1265
    lobj=${xdir}$objdir/$objname
slouken@4277
  1266
slouken@4277
  1267
    test -z "$base_compile" && \
slouken@4277
  1268
      func_fatal_help "you must specify a compilation command"
slouken@4277
  1269
slouken@4277
  1270
    # Delete any leftover library objects.
slouken@4277
  1271
    if test "$build_old_libs" = yes; then
slouken@4277
  1272
      removelist="$obj $lobj $libobj ${libobj}T"
slouken@4277
  1273
    else
slouken@4277
  1274
      removelist="$lobj $libobj ${libobj}T"
slouken@4277
  1275
    fi
slouken@4277
  1276
slouken@4277
  1277
    # On Cygwin there's no "real" PIC flag so we must build both object types
slouken@4277
  1278
    case $host_os in
slouken@4277
  1279
    cygwin* | mingw* | pw32* | os2* | cegcc*)
slouken@4277
  1280
      pic_mode=default
slouken@4277
  1281
      ;;
slouken@4277
  1282
    esac
slouken@4277
  1283
    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
slouken@4277
  1284
      # non-PIC code in shared libraries is not supported
slouken@4277
  1285
      pic_mode=default
slouken@4277
  1286
    fi
slouken@4277
  1287
slouken@4277
  1288
    # Calculate the filename of the output object if compiler does
slouken@4277
  1289
    # not support -o with -c
slouken@4277
  1290
    if test "$compiler_c_o" = no; then
slouken@4277
  1291
      output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
slouken@4277
  1292
      lockfile="$output_obj.lock"
slouken@4277
  1293
    else
slouken@4277
  1294
      output_obj=
slouken@4277
  1295
      need_locks=no
slouken@4277
  1296
      lockfile=
slouken@4277
  1297
    fi
slouken@4277
  1298
slouken@4277
  1299
    # Lock this critical section if it is needed
slouken@4277
  1300
    # We use this script file to make the link, it avoids creating a new file
slouken@4277
  1301
    if test "$need_locks" = yes; then
slouken@4277
  1302
      until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
slouken@4277
  1303
	func_echo "Waiting for $lockfile to be removed"
slouken@4277
  1304
	sleep 2
slouken@4277
  1305
      done
slouken@4277
  1306
    elif test "$need_locks" = warn; then
slouken@4277
  1307
      if test -f "$lockfile"; then
slouken@4277
  1308
	$ECHO "\
slouken@4277
  1309
*** ERROR, $lockfile exists and contains:
slouken@4277
  1310
`cat $lockfile 2>/dev/null`
slouken@4277
  1311
slouken@4277
  1312
This indicates that another process is trying to use the same
slouken@4277
  1313
temporary object file, and libtool could not work around it because
slouken@4277
  1314
your compiler does not support \`-c' and \`-o' together.  If you
slouken@4277
  1315
repeat this compilation, it may succeed, by chance, but you had better
slouken@4277
  1316
avoid parallel builds (make -j) in this platform, or get a better
slouken@4277
  1317
compiler."
slouken@4277
  1318
slouken@4277
  1319
	$opt_dry_run || $RM $removelist
slouken@1570
  1320
	exit $EXIT_FAILURE
slouken@4277
  1321
      fi
slouken@4277
  1322
      removelist="$removelist $output_obj"
slouken@4277
  1323
      $ECHO "$srcfile" > "$lockfile"
slouken@1570
  1324
    fi
slouken@1570
  1325
slouken@4277
  1326
    $opt_dry_run || $RM $removelist
slouken@4277
  1327
    removelist="$removelist $lockfile"
slouken@4277
  1328
    trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
slouken@4277
  1329
slouken@4277
  1330
    if test -n "$fix_srcfile_path"; then
slouken@4277
  1331
      eval srcfile=\"$fix_srcfile_path\"
slouken@4277
  1332
    fi
slouken@4277
  1333
    func_quote_for_eval "$srcfile"
slouken@4277
  1334
    qsrcfile=$func_quote_for_eval_result
slouken@4277
  1335
slouken@4277
  1336
    # Only build a PIC object if we are building libtool libraries.
slouken@4277
  1337
    if test "$build_libtool_libs" = yes; then
slouken@4277
  1338
      # Without this assignment, base_compile gets emptied.
slouken@4277
  1339
      fbsd_hideous_sh_bug=$base_compile
slouken@4277
  1340
slouken@4277
  1341
      if test "$pic_mode" != no; then
slouken@4277
  1342
	command="$base_compile $qsrcfile $pic_flag"
slouken@4277
  1343
      else
slouken@4277
  1344
	# Don't build PIC code
slouken@4277
  1345
	command="$base_compile $qsrcfile"
slouken@4277
  1346
      fi
slouken@4277
  1347
slouken@4277
  1348
      func_mkdir_p "$xdir$objdir"
slouken@4277
  1349
slouken@4277
  1350
      if test -z "$output_obj"; then
slouken@4277
  1351
	# Place PIC objects in $objdir
slouken@4277
  1352
	command="$command -o $lobj"
slouken@4277
  1353
      fi
slouken@4277
  1354
slouken@4277
  1355
      func_show_eval_locale "$command"	\
slouken@4277
  1356
          'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
slouken@4277
  1357
slouken@4277
  1358
      if test "$need_locks" = warn &&
slouken@4277
  1359
	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
slouken@4277
  1360
	$ECHO "\
slouken@4277
  1361
*** ERROR, $lockfile contains:
slouken@4277
  1362
`cat $lockfile 2>/dev/null`
slouken@4277
  1363
slouken@4277
  1364
but it should contain:
slouken@4277
  1365
$srcfile
slouken@4277
  1366
slouken@4277
  1367
This indicates that another process is trying to use the same
slouken@4277
  1368
temporary object file, and libtool could not work around it because
slouken@4277
  1369
your compiler does not support \`-c' and \`-o' together.  If you
slouken@4277
  1370
repeat this compilation, it may succeed, by chance, but you had better
slouken@4277
  1371
avoid parallel builds (make -j) in this platform, or get a better
slouken@4277
  1372
compiler."
slouken@4277
  1373
slouken@4277
  1374
	$opt_dry_run || $RM $removelist
slouken@4277
  1375
	exit $EXIT_FAILURE
slouken@4277
  1376
      fi
slouken@4277
  1377
slouken@4277
  1378
      # Just move the object if needed, then go on to compile the next one
slouken@4277
  1379
      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
slouken@4277
  1380
	func_show_eval '$MV "$output_obj" "$lobj"' \
slouken@4277
  1381
	  'error=$?; $opt_dry_run || $RM $removelist; exit $error'
slouken@4277
  1382
      fi
slouken@4277
  1383
slouken@4277
  1384
      # Allow error messages only from the first compilation.
slouken@4277
  1385
      if test "$suppress_opt" = yes; then
slouken@4277
  1386
	suppress_output=' >/dev/null 2>&1'
slouken@4277
  1387
      fi
slouken@4277
  1388
    fi
slouken@4277
  1389
slouken@4277
  1390
    # Only build a position-dependent object if we build old libraries.
slouken@4277
  1391
    if test "$build_old_libs" = yes; then
slouken@4277
  1392
      if test "$pic_mode" != yes; then
slouken@4277
  1393
	# Don't build PIC code
slouken@4277
  1394
	command="$base_compile $qsrcfile$pie_flag"
slouken@4277
  1395
      else
slouken@4277
  1396
	command="$base_compile $qsrcfile $pic_flag"
slouken@4277
  1397
      fi
slouken@4277
  1398
      if test "$compiler_c_o" = yes; then
slouken@4277
  1399
	command="$command -o $obj"
slouken@4277
  1400
      fi
slouken@4277
  1401
slouken@4277
  1402
      # Suppress compiler output if we already did a PIC compilation.
slouken@4277
  1403
      command="$command$suppress_output"
slouken@4277
  1404
      func_show_eval_locale "$command" \
slouken@4277
  1405
        '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
slouken@4277
  1406
slouken@4277
  1407
      if test "$need_locks" = warn &&
slouken@4277
  1408
	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
slouken@4277
  1409
	$ECHO "\
slouken@4277
  1410
*** ERROR, $lockfile contains:
slouken@4277
  1411
`cat $lockfile 2>/dev/null`
slouken@4277
  1412
slouken@4277
  1413
but it should contain:
slouken@4277
  1414
$srcfile
slouken@4277
  1415
slouken@4277
  1416
This indicates that another process is trying to use the same
slouken@4277
  1417
temporary object file, and libtool could not work around it because
slouken@4277
  1418
your compiler does not support \`-c' and \`-o' together.  If you
slouken@4277
  1419
repeat this compilation, it may succeed, by chance, but you had better
slouken@4277
  1420
avoid parallel builds (make -j) in this platform, or get a better
slouken@4277
  1421
compiler."
slouken@4277
  1422
slouken@4277
  1423
	$opt_dry_run || $RM $removelist
slouken@4277
  1424
	exit $EXIT_FAILURE
slouken@4277
  1425
      fi
slouken@4277
  1426
slouken@4277
  1427
      # Just move the object if needed
slouken@4277
  1428
      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
slouken@4277
  1429
	func_show_eval '$MV "$output_obj" "$obj"' \
slouken@4277
  1430
	  'error=$?; $opt_dry_run || $RM $removelist; exit $error'
slouken@4277
  1431
      fi
slouken@4277
  1432
    fi
slouken@4277
  1433
slouken@4277
  1434
    $opt_dry_run || {
slouken@4277
  1435
      func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
slouken@4277
  1436
slouken@4277
  1437
      # Unlock the critical section if it was locked
slouken@4277
  1438
      if test "$need_locks" != no; then
slouken@4277
  1439
	removelist=$lockfile
slouken@4277
  1440
        $RM "$lockfile"
slouken@4277
  1441
      fi
slouken@4277
  1442
    }
slouken@4277
  1443
slouken@4277
  1444
    exit $EXIT_SUCCESS
slouken@1570
  1445
}
slouken@1570
  1446
slouken@4277
  1447
$opt_help || {
slouken@4277
  1448
test "$mode" = compile && func_mode_compile ${1+"$@"}
slouken@4277
  1449
}
slouken@4277
  1450
slouken@4277
  1451
func_mode_help ()
slouken@4277
  1452
{
slouken@4277
  1453
    # We need to display help for each of the modes.
slouken@4277
  1454
    case $mode in
slouken@4277
  1455
      "")
slouken@4277
  1456
        # Generic help is extracted from the usage comments
slouken@4277
  1457
        # at the start of this file.
slouken@4277
  1458
        func_help
slouken@4277
  1459
        ;;
slouken@4277
  1460
slouken@4277
  1461
      clean)
slouken@4277
  1462
        $ECHO \
slouken@4277
  1463
"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
slouken@4277
  1464
slouken@4277
  1465
Remove files from the build directory.
slouken@4277
  1466
slouken@4277
  1467
RM is the name of the program to use to delete files associated with each FILE
slouken@4277
  1468
(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
slouken@4277
  1469
to RM.
slouken@4277
  1470
slouken@4277
  1471
If FILE is a libtool library, object or program, all the files associated
slouken@4277
  1472
with it are deleted. Otherwise, only FILE itself is deleted using RM."
slouken@4277
  1473
        ;;
slouken@4277
  1474
slouken@4277
  1475
      compile)
slouken@4277
  1476
      $ECHO \
slouken@4277
  1477
"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
slouken@4277
  1478
slouken@4277
  1479
Compile a source file into a libtool library object.
slouken@4277
  1480
slouken@4277
  1481
This mode accepts the following additional options:
slouken@4277
  1482
slouken@4277
  1483
  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
slouken@4277
  1484
  -no-suppress      do not suppress compiler output for multiple passes
slouken@4277
  1485
  -prefer-pic       try to building PIC objects only
slouken@4277
  1486
  -prefer-non-pic   try to building non-PIC objects only
slouken@4277
  1487
  -shared           do not build a \`.o' file suitable for static linking
slouken@4277
  1488
  -static           only build a \`.o' file suitable for static linking
slouken@4277
  1489
slouken@4277
  1490
COMPILE-COMMAND is a command to be used in creating a \`standard' object file
slouken@4277
  1491
from the given SOURCEFILE.
slouken@4277
  1492
slouken@4277
  1493
The output file name is determined by removing the directory component from
slouken@4277
  1494
SOURCEFILE, then substituting the C source code suffix \`.c' with the
slouken@4277
  1495
library object suffix, \`.lo'."
slouken@4277
  1496
        ;;
slouken@4277
  1497
slouken@4277
  1498
      execute)
slouken@4277
  1499
        $ECHO \
slouken@4277
  1500
"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
slouken@4277
  1501
slouken@4277
  1502
Automatically set library path, then run a program.
slouken@4277
  1503
slouken@4277
  1504
This mode accepts the following additional options:
slouken@4277
  1505
slouken@4277
  1506
  -dlopen FILE      add the directory containing FILE to the library path
slouken@4277
  1507
slouken@4277
  1508
This mode sets the library path environment variable according to \`-dlopen'
slouken@4277
  1509
flags.
slouken@4277
  1510
slouken@4277
  1511
If any of the ARGS are libtool executable wrappers, then they are translated
slouken@4277
  1512
into their corresponding uninstalled binary, and any of their required library
slouken@4277
  1513
directories are added to the library path.
slouken@4277
  1514
slouken@4277
  1515
Then, COMMAND is executed, with ARGS as arguments."
slouken@4277
  1516
        ;;
slouken@4277
  1517
slouken@4277
  1518
      finish)
slouken@4277
  1519
        $ECHO \
slouken@4277
  1520
"Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
slouken@4277
  1521
slouken@4277
  1522
Complete the installation of libtool libraries.
slouken@4277
  1523
slouken@4277
  1524
Each LIBDIR is a directory that contains libtool libraries.
slouken@4277
  1525
slouken@4277
  1526
The commands that this mode executes may require superuser privileges.  Use
slouken@4277
  1527
the \`--dry-run' option if you just want to see what would be executed."
slouken@4277
  1528
        ;;
slouken@4277
  1529
slouken@4277
  1530
      install)
slouken@4277
  1531
        $ECHO \
slouken@4277
  1532
"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
slouken@4277
  1533
slouken@4277
  1534
Install executables or libraries.
slouken@4277
  1535
slouken@4277
  1536
INSTALL-COMMAND is the installation command.  The first component should be
slouken@4277
  1537
either the \`install' or \`cp' program.
slouken@4277
  1538
slouken@4277
  1539
The following components of INSTALL-COMMAND are treated specially:
slouken@4277
  1540
slouken@4277
  1541
  -inst-prefix PREFIX-DIR  Use PREFIX-DIR as a staging area for installation
slouken@4277
  1542
slouken@4277
  1543
The rest of the components are interpreted as arguments to that command (only
slouken@4277
  1544
BSD-compatible install options are recognized)."
slouken@4277
  1545
        ;;
slouken@4277
  1546
slouken@4277
  1547
      link)
slouken@4277
  1548
        $ECHO \
slouken@4277
  1549
"Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
slouken@4277
  1550
slouken@4277
  1551
Link object files or libraries together to form another library, or to
slouken@4277
  1552
create an executable program.
slouken@4277
  1553
slouken@4277
  1554
LINK-COMMAND is a command using the C compiler that you would use to create
slouken@4277
  1555
a program from several object files.
slouken@4277
  1556
slouken@4277
  1557
The following components of LINK-COMMAND are treated specially:
slouken@4277
  1558
slouken@4277
  1559
  -all-static       do not do any dynamic linking at all
slouken@4277
  1560
  -avoid-version    do not add a version suffix if possible
slouken@4277
  1561
  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
slouken@4277
  1562
  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
slouken@4277
  1563
  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
slouken@4277
  1564
  -export-symbols SYMFILE
slouken@4277
  1565
                    try to export only the symbols listed in SYMFILE
slouken@4277
  1566
  -export-symbols-regex REGEX
slouken@4277
  1567
                    try to export only the symbols matching REGEX
slouken@4277
  1568
  -LLIBDIR          search LIBDIR for required installed libraries
slouken@4277
  1569
  -lNAME            OUTPUT-FILE requires the installed library libNAME
slouken@4277
  1570
  -module           build a library that can dlopened
slouken@4277
  1571
  -no-fast-install  disable the fast-install mode
slouken@4277
  1572
  -no-install       link a not-installable executable
slouken@4277
  1573
  -no-undefined     declare that a library does not refer to external symbols
slouken@4277
  1574
  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
slouken@4277
  1575
  -objectlist FILE  Use a list of object files found in FILE to specify objects
slouken@4277
  1576
  -precious-files-regex REGEX
slouken@4277
  1577
                    don't remove output files matching REGEX
slouken@4277
  1578
  -release RELEASE  specify package release information
slouken@4277
  1579
  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
slouken@4277
  1580
  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
slouken@4277
  1581
  -shared           only do dynamic linking of libtool libraries
slouken@4277
  1582
  -shrext SUFFIX    override the standard shared library file extension
slouken@4277
  1583
  -static           do not do any dynamic linking of uninstalled libtool libraries
slouken@4277
  1584
  -static-libtool-libs
slouken@4277
  1585
                    do not do any dynamic linking of libtool libraries
slouken@4277
  1586
  -version-info CURRENT[:REVISION[:AGE]]
slouken@4277
  1587
                    specify library version info [each variable defaults to 0]
slouken@4277
  1588
  -weak LIBNAME     declare that the target provides the LIBNAME interface
slouken@4277
  1589
slouken@4277
  1590
All other options (arguments beginning with \`-') are ignored.
slouken@4277
  1591
slouken@4277
  1592
Every other argument is treated as a filename.  Files ending in \`.la' are
slouken@4277
  1593
treated as uninstalled libtool libraries, other files are standard or library
slouken@4277
  1594
object files.
slouken@4277
  1595
slouken@4277
  1596
If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
slouken@4277
  1597
only library objects (\`.lo' files) may be specified, and \`-rpath' is
slouken@4277
  1598
required, except when creating a convenience library.
slouken@4277
  1599
slouken@4277
  1600
If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
slouken@4277
  1601
using \`ar' and \`ranlib', or on Windows using \`lib'.
slouken@4277
  1602
slouken@4277
  1603
If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
slouken@4277
  1604
is created, otherwise an executable program is created."
slouken@4277
  1605
        ;;
slouken@4277
  1606
slouken@4277
  1607
      uninstall)
slouken@4277
  1608
        $ECHO \
slouken@4277
  1609
"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
slouken@4277
  1610
slouken@4277
  1611
Remove libraries from an installation directory.
slouken@4277
  1612
slouken@4277
  1613
RM is the name of the program to use to delete files associated with each FILE
slouken@4277
  1614
(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
slouken@4277
  1615
to RM.
slouken@4277
  1616
slouken@4277
  1617
If FILE is a libtool library, all the files associated with it are deleted.
slouken@4277
  1618
Otherwise, only FILE itself is deleted using RM."
slouken@4277
  1619
        ;;
slouken@4277
  1620
slouken@4277
  1621
      *)
slouken@4277
  1622
        func_fatal_help "invalid operation mode \`$mode'"
slouken@4277
  1623
        ;;
slouken@4277
  1624
    esac
slouken@4277
  1625
slouken@4277
  1626
    $ECHO
slouken@4277
  1627
    $ECHO "Try \`$progname --help' for more information about other modes."
slouken@4277
  1628
slouken@4277
  1629
    exit $?
slouken@4277
  1630
}
slouken@4277
  1631
slouken@4277
  1632
  # Now that we've collected a possible --mode arg, show help if necessary
slouken@4277
  1633
  $opt_help && func_mode_help
slouken@4277
  1634
slouken@4277
  1635
slouken@4277
  1636
# func_mode_execute arg...
slouken@4277
  1637
func_mode_execute ()
slouken@4277
  1638
{
slouken@4277
  1639
    $opt_debug
slouken@4277
  1640
    # The first argument is the command name.
slouken@4277
  1641
    cmd="$nonopt"
slouken@4277
  1642
    test -z "$cmd" && \
slouken@4277
  1643
      func_fatal_help "you must specify a COMMAND"
slouken@4277
  1644
slouken@4277
  1645
    # Handle -dlopen flags immediately.
slouken@4277
  1646
    for file in $execute_dlfiles; do
slouken@4277
  1647
      test -f "$file" \
slouken@4277
  1648
	|| func_fatal_help "\`$file' is not a file"
slouken@4277
  1649
slouken@4277
  1650
      dir=
slouken@4277
  1651
      case $file in
slouken@4277
  1652
      *.la)
slouken@4277
  1653
	# Check to see that this really is a libtool archive.
slouken@4277
  1654
	func_lalib_unsafe_p "$file" \
slouken@4277
  1655
	  || func_fatal_help "\`$lib' is not a valid libtool archive"
slouken@4277
  1656
slouken@4277
  1657
	# Read the libtool library.
slouken@4277
  1658
	dlname=
slouken@4277
  1659
	library_names=
slouken@4277
  1660
	func_source "$file"
slouken@4277
  1661
slouken@4277
  1662
	# Skip this library if it cannot be dlopened.
slouken@4277
  1663
	if test -z "$dlname"; then
slouken@4277
  1664
	  # Warn if it was a shared library.
slouken@4277
  1665
	  test -n "$library_names" && \
slouken@4277
  1666
	    func_warning "\`$file' was not linked with \`-export-dynamic'"
slouken@4277
  1667
	  continue
slouken@4277
  1668
	fi
slouken@4277
  1669
slouken@4277
  1670
	func_dirname "$file" "" "."
slouken@4277
  1671
	dir="$func_dirname_result"
slouken@4277
  1672
slouken@4277
  1673
	if test -f "$dir/$objdir/$dlname"; then
slouken@4277
  1674
	  dir="$dir/$objdir"
slouken@4277
  1675
	else
slouken@4277
  1676
	  if test ! -f "$dir/$dlname"; then
slouken@4277
  1677
	    func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
slouken@4277
  1678
	  fi
slouken@4277
  1679
	fi
slouken@4277
  1680
	;;
slouken@4277
  1681
slouken@4277
  1682
      *.lo)
slouken@4277
  1683
	# Just add the directory containing the .lo file.
slouken@4277
  1684
	func_dirname "$file" "" "."
slouken@4277
  1685
	dir="$func_dirname_result"
slouken@4277
  1686
	;;
slouken@4277
  1687
slouken@4277
  1688
      *)
slouken@4277
  1689
	func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
slouken@4277
  1690
	continue
slouken@4277
  1691
	;;
slouken@4277
  1692
      esac
slouken@4277
  1693
slouken@4277
  1694
      # Get the absolute pathname.
slouken@4277
  1695
      absdir=`cd "$dir" && pwd`
slouken@4277
  1696
      test -n "$absdir" && dir="$absdir"
slouken@4277
  1697
slouken@4277
  1698
      # Now add the directory to shlibpath_var.
slouken@4277
  1699
      if eval "test -z \"\$$shlibpath_var\""; then
slouken@4277
  1700
	eval "$shlibpath_var=\"\$dir\""
slouken@4277
  1701
      else
slouken@4277
  1702
	eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
slouken@4277
  1703
      fi
slouken@4277
  1704
    done
slouken@4277
  1705
slouken@4277
  1706
    # This variable tells wrapper scripts just to set shlibpath_var
slouken@4277
  1707
    # rather than running their programs.
slouken@4277
  1708
    libtool_execute_magic="$magic"
slouken@4277
  1709
slouken@4277
  1710
    # Check if any of the arguments is a wrapper script.
slouken@4277
  1711
    args=
slouken@4277
  1712
    for file
slouken@4277
  1713
    do
slouken@4277
  1714
      case $file in
slouken@4277
  1715
      -*) ;;
slouken@4277
  1716
      *)
slouken@4277
  1717
	# Do a test to see if this is really a libtool program.
slouken@4277
  1718
	if func_ltwrapper_script_p "$file"; then
slouken@4277
  1719
	  func_source "$file"
slouken@4277
  1720
	  # Transform arg to wrapped name.
slouken@4277
  1721
	  file="$progdir/$program"
slouken@4277
  1722
	elif func_ltwrapper_executable_p "$file"; then
slouken@4277
  1723
	  func_ltwrapper_scriptname "$file"
slouken@4277
  1724
	  func_source "$func_ltwrapper_scriptname_result"
slouken@4277
  1725
	  # Transform arg to wrapped name.
slouken@4277
  1726
	  file="$progdir/$program"
slouken@4277
  1727
	fi
slouken@4277
  1728
	;;
slouken@4277
  1729
      esac
slouken@4277
  1730
      # Quote arguments (to preserve shell metacharacters).
slouken@4277
  1731
      func_quote_for_eval "$file"
slouken@4277
  1732
      args="$args $func_quote_for_eval_result"
slouken@4277
  1733
    done
slouken@4277
  1734
slouken@4277
  1735
    if test "X$opt_dry_run" = Xfalse; then
slouken@4277
  1736
      if test -n "$shlibpath_var"; then
slouken@4277
  1737
	# Export the shlibpath_var.
slouken@4277
  1738
	eval "export $shlibpath_var"
slouken@4277
  1739
      fi
slouken@4277
  1740
slouken@4277
  1741
      # Restore saved environment variables
slouken@4277
  1742
      for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
slouken@4277
  1743
      do
slouken@4277
  1744
	eval "if test \"\${save_$lt_var+set}\" = set; then
slouken@4277
  1745
                $lt_var=\$save_$lt_var; export $lt_var
slouken@4277
  1746
	      else
slouken@4277
  1747
		$lt_unset $lt_var
slouken@4277
  1748
	      fi"
slouken@4277
  1749
      done
slouken@4277
  1750
slouken@4277
  1751
      # Now prepare to actually exec the command.
slouken@4277
  1752
      exec_cmd="\$cmd$args"
slouken@4277
  1753
    else
slouken@4277
  1754
      # Display what would be done.
slouken@4277
  1755
      if test -n "$shlibpath_var"; then
slouken@4277
  1756
	eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
slouken@4277
  1757
	$ECHO "export $shlibpath_var"
slouken@4277
  1758
      fi
slouken@4277
  1759
      $ECHO "$cmd$args"
slouken@4277
  1760
      exit $EXIT_SUCCESS
slouken@4277
  1761
    fi
slouken@4277
  1762
}
slouken@4277
  1763
slouken@4277
  1764
test "$mode" = execute && func_mode_execute ${1+"$@"}
slouken@4277
  1765
slouken@4277
  1766
slouken@4277
  1767
# func_mode_finish arg...
slouken@4277
  1768
func_mode_finish ()
slouken@4277
  1769
{
slouken@4277
  1770
    $opt_debug
slouken@4277
  1771
    libdirs="$nonopt"
slouken@4277
  1772
    admincmds=
slouken@4277
  1773
slouken@4277
  1774
    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
slouken@4277
  1775
      for dir
slouken@4277
  1776
      do
slouken@4277
  1777
	libdirs="$libdirs $dir"
slouken@4277
  1778
      done
slouken@4277
  1779
slouken@4277
  1780
      for libdir in $libdirs; do
slouken@4277
  1781
	if test -n "$finish_cmds"; then
slouken@4277
  1782
	  # Do each command in the finish commands.
slouken@4277
  1783
	  func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
slouken@4277
  1784
'"$cmd"'"'
slouken@4277
  1785
	fi
slouken@4277
  1786
	if test -n "$finish_eval"; then
slouken@4277
  1787
	  # Do the single finish_eval.
slouken@4277
  1788
	  eval cmds=\"$finish_eval\"
slouken@4277
  1789
	  $opt_dry_run || eval "$cmds" || admincmds="$admincmds
slouken@4277
  1790
       $cmds"
slouken@4277
  1791
	fi
slouken@4277
  1792
      done
slouken@4277
  1793
    fi
slouken@4277
  1794
slouken@4277
  1795
    # Exit here if they wanted silent mode.
slouken@4277
  1796
    $opt_silent && exit $EXIT_SUCCESS
slouken@4277
  1797
slouken@4277
  1798
    $ECHO "X----------------------------------------------------------------------" | $Xsed
slouken@4277
  1799
    $ECHO "Libraries have been installed in:"
slouken@4277
  1800
    for libdir in $libdirs; do
slouken@4277
  1801
      $ECHO "   $libdir"
slouken@4277
  1802
    done
slouken@4277
  1803
    $ECHO
slouken@4277
  1804
    $ECHO "If you ever happen to want to link against installed libraries"
slouken@4277
  1805
    $ECHO "in a given directory, LIBDIR, you must either use libtool, and"
slouken@4277
  1806
    $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'"
slouken@4277
  1807
    $ECHO "flag during linking and do at least one of the following:"
slouken@4277
  1808
    if test -n "$shlibpath_var"; then
slouken@4277
  1809
      $ECHO "   - add LIBDIR to the \`$shlibpath_var' environment variable"
slouken@4277
  1810
      $ECHO "     during execution"
slouken@4277
  1811
    fi
slouken@4277
  1812
    if test -n "$runpath_var"; then
slouken@4277
  1813
      $ECHO "   - add LIBDIR to the \`$runpath_var' environment variable"
slouken@4277
  1814
      $ECHO "     during linking"
slouken@4277
  1815
    fi
slouken@4277
  1816
    if test -n "$hardcode_libdir_flag_spec"; then
slouken@4277
  1817
      libdir=LIBDIR
slouken@4277
  1818
      eval flag=\"$hardcode_libdir_flag_spec\"
slouken@4277
  1819
slouken@4277
  1820
      $ECHO "   - use the \`$flag' linker flag"
slouken@4277
  1821
    fi
slouken@4277
  1822
    if test -n "$admincmds"; then
slouken@4277
  1823
      $ECHO "   - have your system administrator run these commands:$admincmds"
slouken@4277
  1824
    fi
slouken@4277
  1825
    if test -f /etc/ld.so.conf; then
slouken@4277
  1826
      $ECHO "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
slouken@4277
  1827
    fi
slouken@4277
  1828
    $ECHO
slouken@4277
  1829
slouken@4277
  1830
    $ECHO "See any operating system documentation about shared libraries for"
slouken@4277
  1831
    case $host in
slouken@4277
  1832
      solaris2.[6789]|solaris2.1[0-9])
slouken@4277
  1833
        $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual"
slouken@4277
  1834
	$ECHO "pages."
slouken@4277
  1835
	;;
slouken@4277
  1836
      *)
slouken@4277
  1837
        $ECHO "more information, such as the ld(1) and ld.so(8) manual pages."
slouken@4277
  1838
        ;;
slouken@4277
  1839
    esac
slouken@4277
  1840
    $ECHO "X----------------------------------------------------------------------" | $Xsed
slouken@4277
  1841
    exit $EXIT_SUCCESS
slouken@4277
  1842
}
slouken@4277
  1843
slouken@4277
  1844
test "$mode" = finish && func_mode_finish ${1+"$@"}
slouken@4277
  1845
slouken@4277
  1846
slouken@4277
  1847
# func_mode_install arg...
slouken@4277
  1848
func_mode_install ()
slouken@4277
  1849
{
slouken@4277
  1850
    $opt_debug
slouken@4277
  1851
    # There may be an optional sh(1) argument at the beginning of
slouken@4277
  1852
    # install_prog (especially on Windows NT).
slouken@4277
  1853
    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
slouken@4277
  1854
       # Allow the use of GNU shtool's install command.
slouken@4277
  1855
       $ECHO "X$nonopt" | $GREP shtool >/dev/null; then
slouken@4277
  1856
      # Aesthetically quote it.
slouken@4277
  1857
      func_quote_for_eval "$nonopt"
slouken@4277
  1858
      install_prog="$func_quote_for_eval_result "
slouken@4277
  1859
      arg=$1
slouken@4277
  1860
      shift
slouken@4277
  1861
    else
slouken@4277
  1862
      install_prog=
slouken@4277
  1863
      arg=$nonopt
slouken@4277
  1864
    fi
slouken@4277
  1865
slouken@4277
  1866
    # The real first argument should be the name of the installation program.
slouken@4277
  1867
    # Aesthetically quote it.
slouken@4277
  1868
    func_quote_for_eval "$arg"
slouken@4277
  1869
    install_prog="$install_prog$func_quote_for_eval_result"
slouken@4277
  1870
slouken@4277
  1871
    # We need to accept at least all the BSD install flags.
slouken@4277
  1872
    dest=
slouken@4277
  1873
    files=
slouken@4277
  1874
    opts=
slouken@4277
  1875
    prev=
slouken@4277
  1876
    install_type=
slouken@4277
  1877
    isdir=no
slouken@4277
  1878
    stripme=
slouken@4277
  1879
    for arg
slouken@4277
  1880
    do
slouken@4277
  1881
      if test -n "$dest"; then
slouken@4277
  1882
	files="$files $dest"
slouken@4277
  1883
	dest=$arg
slouken@4277
  1884
	continue
slouken@4277
  1885
      fi
slouken@4277
  1886
slouken@4277
  1887
      case $arg in
slouken@4277
  1888
      -d) isdir=yes ;;
slouken@4277
  1889
      -f)
slouken@4277
  1890
	case " $install_prog " in
slouken@4277
  1891
	*[\\\ /]cp\ *) ;;
slouken@4277
  1892
	*) prev=$arg ;;
slouken@4277
  1893
	esac
slouken@4277
  1894
	;;
slouken@4277
  1895
      -g | -m | -o)
slouken@4277
  1896
	prev=$arg
slouken@4277
  1897
	;;
slouken@4277
  1898
      -s)
slouken@4277
  1899
	stripme=" -s"
slouken@4277
  1900
	continue
slouken@4277
  1901
	;;
slouken@4277
  1902
      -*)
slouken@4277
  1903
	;;
slouken@4277
  1904
      *)
slouken@4277
  1905
	# If the previous option needed an argument, then skip it.
slouken@4277
  1906
	if test -n "$prev"; then
slouken@4277
  1907
	  prev=
slouken@4277
  1908
	else
slouken@4277
  1909
	  dest=$arg
slouken@4277
  1910
	  continue
slouken@4277
  1911
	fi
slouken@4277
  1912
	;;
slouken@4277
  1913
      esac
slouken@4277
  1914
slouken@4277
  1915
      # Aesthetically quote the argument.
slouken@4277
  1916
      func_quote_for_eval "$arg"
slouken@4277
  1917
      install_prog="$install_prog $func_quote_for_eval_result"
slouken@4277
  1918
    done
slouken@4277
  1919
slouken@4277
  1920
    test -z "$install_prog" && \
slouken@4277
  1921
      func_fatal_help "you must specify an install program"
slouken@4277
  1922
slouken@4277
  1923
    test -n "$prev" && \
slouken@4277
  1924
      func_fatal_help "the \`$prev' option requires an argument"
slouken@4277
  1925
slouken@4277
  1926
    if test -z "$files"; then
slouken@4277
  1927
      if test -z "$dest"; then
slouken@4277
  1928
	func_fatal_help "no file or destination specified"
slouken@4277
  1929
      else
slouken@4277
  1930
	func_fatal_help "you must specify a destination"
slouken@4277
  1931
      fi
slouken@4277
  1932
    fi
slouken@4277
  1933
slouken@4277
  1934
    # Strip any trailing slash from the destination.
slouken@4277
  1935
    func_stripname '' '/' "$dest"
slouken@4277
  1936
    dest=$func_stripname_result
slouken@4277
  1937
slouken@4277
  1938
    # Check to see that the destination is a directory.
slouken@4277
  1939
    test -d "$dest" && isdir=yes
slouken@4277
  1940
    if test "$isdir" = yes; then
slouken@4277
  1941
      destdir="$dest"
slouken@4277
  1942
      destname=
slouken@4277
  1943
    else
slouken@4277
  1944
      func_dirname_and_basename "$dest" "" "."
slouken@4277
  1945
      destdir="$func_dirname_result"
slouken@4277
  1946
      destname="$func_basename_result"
slouken@4277
  1947
slouken@4277
  1948
      # Not a directory, so check to see that there is only one file specified.
slouken@4277
  1949
      set dummy $files; shift
slouken@4277
  1950
      test "$#" -gt 1 && \
slouken@4277
  1951
	func_fatal_help "\`$dest' is not a directory"
slouken@4277
  1952
    fi
slouken@4277
  1953
    case $destdir in
slouken@4277
  1954
    [\\/]* | [A-Za-z]:[\\/]*) ;;
slouken@4277
  1955
    *)
slouken@4277
  1956
      for file in $files; do
slouken@4277
  1957
	case $file in
slouken@4277
  1958
	*.lo) ;;
slouken@4277
  1959
	*)
slouken@4277
  1960
	  func_fatal_help "\`$destdir' must be an absolute directory name"
slouken@4277
  1961
	  ;;
slouken@4277
  1962
	esac
slouken@4277
  1963
      done
slouken@4277
  1964
      ;;
slouken@4277
  1965
    esac
slouken@4277
  1966
slouken@4277
  1967
    # This variable tells wrapper scripts just to set variables rather
slouken@4277
  1968
    # than running their programs.
slouken@4277
  1969
    libtool_install_magic="$magic"
slouken@4277
  1970
slouken@4277
  1971
    staticlibs=
slouken@4277
  1972
    future_libdirs=
slouken@4277
  1973
    current_libdirs=
slouken@4277
  1974
    for file in $files; do
slouken@4277
  1975
slouken@4277
  1976
      # Do each installation.
slouken@4277
  1977
      case $file in
slouken@4277
  1978
      *.$libext)
slouken@4277
  1979
	# Do the static libraries later.
slouken@4277
  1980
	staticlibs="$staticlibs $file"
slouken@4277
  1981
	;;
slouken@4277
  1982
slouken@4277
  1983
      *.la)
slouken@4277
  1984
	# Check to see that this really is a libtool archive.
slouken@4277
  1985
	func_lalib_unsafe_p "$file" \
slouken@4277
  1986
	  || func_fatal_help "\`$file' is not a valid libtool archive"
slouken@4277
  1987
slouken@4277
  1988
	library_names=
slouken@4277
  1989
	old_library=
slouken@4277
  1990
	relink_command=
slouken@4277
  1991
	func_source "$file"
slouken@4277
  1992
slouken@4277
  1993
	# Add the libdir to current_libdirs if it is the destination.
slouken@4277
  1994
	if test "X$destdir" = "X$libdir"; then
slouken@4277
  1995
	  case "$current_libdirs " in
slouken@4277
  1996
	  *" $libdir "*) ;;
slouken@4277
  1997
	  *) current_libdirs="$current_libdirs $libdir" ;;
slouken@4277
  1998
	  esac
slouken@4277
  1999
	else
slouken@4277
  2000
	  # Note the libdir as a future libdir.
slouken@4277
  2001
	  case "$future_libdirs " in
slouken@4277
  2002
	  *" $libdir "*) ;;
slouken@4277
  2003
	  *) future_libdirs="$future_libdirs $libdir" ;;
slouken@4277
  2004
	  esac
slouken@4277
  2005
	fi
slouken@4277
  2006
slouken@4277
  2007
	func_dirname "$file" "/" ""
slouken@4277
  2008
	dir="$func_dirname_result"
slouken@4277
  2009
	dir="$dir$objdir"
slouken@4277
  2010
slouken@4277
  2011
	if test -n "$relink_command"; then
slouken@4277
  2012
	  # Determine the prefix the user has applied to our future dir.
slouken@4277
  2013
	  inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"`
slouken@4277
  2014
slouken@4277
  2015
	  # Don't allow the user to place us outside of our expected
slouken@4277
  2016
	  # location b/c this prevents finding dependent libraries that
slouken@4277
  2017
	  # are installed to the same prefix.
slouken@4277
  2018
	  # At present, this check doesn't affect windows .dll's that
slouken@4277
  2019
	  # are installed into $libdir/../bin (currently, that works fine)
slouken@4277
  2020
	  # but it's something to keep an eye on.
slouken@4277
  2021
	  test "$inst_prefix_dir" = "$destdir" && \
slouken@4277
  2022
	    func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
slouken@4277
  2023
slouken@4277
  2024
	  if test -n "$inst_prefix_dir"; then
slouken@4277
  2025
	    # Stick the inst_prefix_dir data into the link command.
slouken@4277
  2026
	    relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
slouken@4277
  2027
	  else
slouken@4277
  2028
	    relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"`
slouken@4277
  2029
	  fi
slouken@4277
  2030
slouken@4277
  2031
	  func_warning "relinking \`$file'"
slouken@4277
  2032
	  func_show_eval "$relink_command" \
slouken@4277
  2033
	    'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
slouken@4277
  2034
	fi
slouken@4277
  2035
slouken@4277
  2036
	# See the names of the shared library.
slouken@4277
  2037
	set dummy $library_names; shift
slouken@4277
  2038
	if test -n "$1"; then
slouken@4277
  2039
	  realname="$1"
slouken@4277
  2040
	  shift
slouken@4277
  2041
slouken@4277
  2042
	  srcname="$realname"
slouken@4277
  2043
	  test -n "$relink_command" && srcname="$realname"T
slouken@4277
  2044
slouken@4277
  2045
	  # Install the shared library and build the symlinks.
slouken@4277
  2046
	  func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \
slouken@4277
  2047
	      'exit $?'
slouken@4277
  2048
	  tstripme="$stripme"
slouken@4277
  2049
	  case $host_os in
slouken@4277
  2050
	  cygwin* | mingw* | pw32* | cegcc*)
slouken@4277
  2051
	    case $realname in
slouken@4277
  2052
	    *.dll.a)
slouken@4277
  2053
	      tstripme=""
slouken@4277
  2054
	      ;;
slouken@4277
  2055
	    esac
slouken@4277
  2056
	    ;;
slouken@4277
  2057
	  esac
slouken@4277
  2058
	  if test -n "$tstripme" && test -n "$striplib"; then
slouken@4277
  2059
	    func_show_eval "$striplib $destdir/$realname" 'exit $?'
slouken@4277
  2060
	  fi
slouken@4277
  2061
slouken@4277
  2062
	  if test "$#" -gt 0; then
slouken@4277
  2063
	    # Delete the old symlinks, and create new ones.
slouken@4277
  2064
	    # Try `ln -sf' first, because the `ln' binary might depend on
slouken@4277
  2065
	    # the symlink we replace!  Solaris /bin/ln does not understand -f,
slouken@4277
  2066
	    # so we also need to try rm && ln -s.
slouken@4277
  2067
	    for linkname
slouken@4277
  2068
	    do
slouken@4277
  2069
	      test "$linkname" != "$realname" \
slouken@4277
  2070
		&& func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
slouken@4277
  2071
	    done
slouken@4277
  2072
	  fi
slouken@4277
  2073
slouken@4277
  2074
	  # Do each command in the postinstall commands.
slouken@4277
  2075
	  lib="$destdir/$realname"
slouken@4277
  2076
	  func_execute_cmds "$postinstall_cmds" 'exit $?'
slouken@4277
  2077
	fi
slouken@4277
  2078
slouken@4277
  2079
	# Install the pseudo-library for information purposes.
slouken@4277
  2080
	func_basename "$file"
slouken@4277
  2081
	name="$func_basename_result"
slouken@4277
  2082
	instname="$dir/$name"i
slouken@4277
  2083
	func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
slouken@4277
  2084
slouken@4277
  2085
	# Maybe install the static library, too.
slouken@4277
  2086
	test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
slouken@4277
  2087
	;;
slouken@4277
  2088
slouken@4277
  2089
      *.lo)
slouken@4277
  2090
	# Install (i.e. copy) a libtool object.
slouken@4277
  2091
slouken@4277
  2092
	# Figure out destination file name, if it wasn't already specified.
slouken@4277
  2093
	if test -n "$destname"; then
slouken@4277
  2094
	  destfile="$destdir/$destname"
slouken@4277
  2095
	else
slouken@4277
  2096
	  func_basename "$file"
slouken@4277
  2097
	  destfile="$func_basename_result"
slouken@4277
  2098
	  destfile="$destdir/$destfile"
slouken@4277
  2099
	fi
slouken@4277
  2100
slouken@4277
  2101
	# Deduce the name of the destination old-style object file.
slouken@4277
  2102
	case $destfile in
slouken@4277
  2103
	*.lo)
slouken@4277
  2104
	  func_lo2o "$destfile"
slouken@4277
  2105
	  staticdest=$func_lo2o_result
slouken@4277
  2106
	  ;;
slouken@4277
  2107
	*.$objext)
slouken@4277
  2108
	  staticdest="$destfile"
slouken@4277
  2109
	  destfile=
slouken@4277
  2110
	  ;;
slouken@4277
  2111
	*)
slouken@4277
  2112
	  func_fatal_help "cannot copy a libtool object to \`$destfile'"
slouken@4277
  2113
	  ;;
slouken@4277
  2114
	esac
slouken@4277
  2115
slouken@4277
  2116
	# Install the libtool object if requested.
slouken@4277
  2117
	test -n "$destfile" && \
slouken@4277
  2118
	  func_show_eval "$install_prog $file $destfile" 'exit $?'
slouken@4277
  2119
slouken@4277
  2120
	# Install the old object if enabled.
slouken@4277
  2121
	if test "$build_old_libs" = yes; then
slouken@4277
  2122
	  # Deduce the name of the old-style object file.
slouken@4277
  2123
	  func_lo2o "$file"
slouken@4277
  2124
	  staticobj=$func_lo2o_result
slouken@4277
  2125
	  func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
slouken@4277
  2126
	fi
slouken@4277
  2127
	exit $EXIT_SUCCESS
slouken@4277
  2128
	;;
slouken@4277
  2129
slouken@4277
  2130
      *)
slouken@4277
  2131
	# Figure out destination file name, if it wasn't already specified.
slouken@4277
  2132
	if test -n "$destname"; then
slouken@4277
  2133
	  destfile="$destdir/$destname"
slouken@4277
  2134
	else
slouken@4277
  2135
	  func_basename "$file"
slouken@4277
  2136
	  destfile="$func_basename_result"
slouken@4277
  2137
	  destfile="$destdir/$destfile"
slouken@4277
  2138
	fi
slouken@4277
  2139
slouken@4277
  2140
	# If the file is missing, and there is a .exe on the end, strip it
slouken@4277
  2141
	# because it is most likely a libtool script we actually want to
slouken@4277
  2142
	# install
slouken@4277
  2143
	stripped_ext=""
slouken@4277
  2144
	case $file in
slouken@4277
  2145
	  *.exe)
slouken@4277
  2146
	    if test ! -f "$file"; then
slouken@4277
  2147
	      func_stripname '' '.exe' "$file"
slouken@4277
  2148
	      file=$func_stripname_result
slouken@4277
  2149
	      stripped_ext=".exe"
slouken@4277
  2150
	    fi
slouken@4277
  2151
	    ;;
slouken@4277
  2152
	esac
slouken@4277
  2153
slouken@4277
  2154
	# Do a test to see if this is really a libtool program.
slouken@4277
  2155
	case $host in
slouken@4277
  2156
	*cygwin* | *mingw*)
slouken@4277
  2157
	    if func_ltwrapper_executable_p "$file"; then
slouken@4277
  2158
	      func_ltwrapper_scriptname "$file"
slouken@4277
  2159
	      wrapper=$func_ltwrapper_scriptname_result
slouken@4277
  2160
	    else
slouken@4277
  2161
	      func_stripname '' '.exe' "$file"
slouken@4277
  2162
	      wrapper=$func_stripname_result
slouken@4277
  2163
	    fi
slouken@4277
  2164
	    ;;
slouken@4277
  2165
	*)
slouken@4277
  2166
	    wrapper=$file
slouken@4277
  2167
	    ;;
slouken@4277
  2168
	esac
slouken@4277
  2169
	if func_ltwrapper_script_p "$wrapper"; then
slouken@4277
  2170
	  notinst_deplibs=
slouken@4277
  2171
	  relink_command=
slouken@4277
  2172
slouken@4277
  2173
	  func_source "$wrapper"
slouken@4277
  2174
slouken@4277
  2175
	  # Check the variables that should have been set.
slouken@4277
  2176
	  test -z "$generated_by_libtool_version" && \
slouken@4277
  2177
	    func_fatal_error "invalid libtool wrapper script \`$wrapper'"
slouken@4277
  2178
slouken@4277
  2179
	  finalize=yes
slouken@4277
  2180
	  for lib in $notinst_deplibs; do
slouken@4277
  2181
	    # Check to see that each library is installed.
slouken@4277
  2182
	    libdir=
slouken@4277
  2183
	    if test -f "$lib"; then
slouken@4277
  2184
	      func_source "$lib"
slouken@4277
  2185
	    fi
slouken@4277
  2186
	    libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
slouken@4277
  2187
	    if test -n "$libdir" && test ! -f "$libfile"; then
slouken@4277
  2188
	      func_warning "\`$lib' has not been installed in \`$libdir'"
slouken@4277
  2189
	      finalize=no
slouken@4277
  2190
	    fi
slouken@4277
  2191
	  done
slouken@4277
  2192
slouken@4277
  2193
	  relink_command=
slouken@4277
  2194
	  func_source "$wrapper"
slouken@4277
  2195
slouken@4277
  2196
	  outputname=
slouken@4277
  2197
	  if test "$fast_install" = no && test -n "$relink_command"; then
slouken@4277
  2198
	    $opt_dry_run || {
slouken@4277
  2199
	      if test "$finalize" = yes; then
slouken@4277
  2200
	        tmpdir=`func_mktempdir`
slouken@4277
  2201
		func_basename "$file$stripped_ext"
slouken@4277
  2202
		file="$func_basename_result"
slouken@4277
  2203
	        outputname="$tmpdir/$file"
slouken@4277
  2204
	        # Replace the output file specification.
slouken@4277
  2205
	        relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
slouken@4277
  2206
slouken@4277
  2207
	        $opt_silent || {
slouken@4277
  2208
	          func_quote_for_expand "$relink_command"
slouken@4277
  2209
		  eval "func_echo $func_quote_for_expand_result"
slouken@4277
  2210
	        }
slouken@4277
  2211
	        if eval "$relink_command"; then :
slouken@4277
  2212
	          else
slouken@4277
  2213
		  func_error "error: relink \`$file' with the above command before installing it"
slouken@4277
  2214
		  $opt_dry_run || ${RM}r "$tmpdir"
slouken@4277
  2215
		  continue
slouken@4277
  2216
	        fi
slouken@4277
  2217
	        file="$outputname"
slouken@4277
  2218
	      else
slouken@4277
  2219
	        func_warning "cannot relink \`$file'"
slouken@4277
  2220
	      fi
slouken@4277
  2221
	    }
slouken@4277
  2222
	  else
slouken@4277
  2223
	    # Install the binary that we compiled earlier.
slouken@4277
  2224
	    file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
slouken@4277
  2225
	  fi
slouken@4277
  2226
	fi
slouken@4277
  2227
slouken@4277
  2228
	# remove .exe since cygwin /usr/bin/install will append another
slouken@4277
  2229
	# one anyway
slouken@4277
  2230
	case $install_prog,$host in
slouken@4277
  2231
	*/usr/bin/install*,*cygwin*)
slouken@4277
  2232
	  case $file:$destfile in
slouken@4277
  2233
	  *.exe:*.exe)
slouken@4277
  2234
	    # this is ok
slouken@4277
  2235
	    ;;
slouken@4277
  2236
	  *.exe:*)
slouken@4277
  2237
	    destfile=$destfile.exe
slouken@4277
  2238
	    ;;
slouken@4277
  2239
	  *:*.exe)
slouken@4277
  2240
	    func_stripname '' '.exe' "$destfile"
slouken@4277
  2241
	    destfile=$func_stripname_result
slouken@4277
  2242
	    ;;
slouken@4277
  2243
	  esac
slouken@4277
  2244
	  ;;
slouken@4277
  2245
	esac
slouken@4277
  2246
	func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
slouken@4277
  2247
	$opt_dry_run || if test -n "$outputname"; then
slouken@4277
  2248
	  ${RM}r "$tmpdir"
slouken@4277
  2249
	fi
slouken@4277
  2250
	;;
slouken@4277
  2251
      esac
slouken@4277
  2252
    done
slouken@4277
  2253
slouken@4277
  2254
    for file in $staticlibs; do
slouken@4277
  2255
      func_basename "$file"
slouken@4277
  2256
      name="$func_basename_result"
slouken@4277
  2257
slouken@4277
  2258
      # Set up the ranlib parameters.
slouken@4277
  2259
      oldlib="$destdir/$name"
slouken@4277
  2260
slouken@4277
  2261
      func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
slouken@4277
  2262
slouken@4277
  2263
      if test -n "$stripme" && test -n "$old_striplib"; then
slouken@4277
  2264
	func_show_eval "$old_striplib $oldlib" 'exit $?'
slouken@4277
  2265
      fi
slouken@4277
  2266
slouken@4277
  2267
      # Do each command in the postinstall commands.
slouken@4277
  2268
      func_execute_cmds "$old_postinstall_cmds" 'exit $?'
slouken@4277
  2269
    done
slouken@4277
  2270
slouken@4277
  2271
    test -n "$future_libdirs" && \
slouken@4277
  2272
      func_warning "remember to run \`$progname --finish$future_libdirs'"
slouken@4277
  2273
slouken@4277
  2274
    if test -n "$current_libdirs"; then
slouken@4277
  2275
      # Maybe just do a dry run.
slouken@4277
  2276
      $opt_dry_run && current_libdirs=" -n$current_libdirs"
slouken@4277
  2277
      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
slouken@4277
  2278
    else
slouken@4277
  2279
      exit $EXIT_SUCCESS
slouken@4277
  2280
    fi
slouken@4277
  2281
}
slouken@4277
  2282
slouken@4277
  2283
test "$mode" = install && func_mode_install ${1+"$@"}
slouken@4277
  2284
slouken@4277
  2285
slouken@4277
  2286
# func_generate_dlsyms outputname originator pic_p
slouken@4277
  2287
# Extract symbols from dlprefiles and create ${outputname}S.o with
slouken@4277
  2288
# a dlpreopen symbol table.
slouken@4277
  2289
func_generate_dlsyms ()
slouken@4277
  2290
{
slouken@4277
  2291
    $opt_debug
slouken@4277
  2292
    my_outputname="$1"
slouken@4277
  2293
    my_originator="$2"
slouken@4277
  2294
    my_pic_p="${3-no}"
slouken@4277
  2295
    my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
slouken@4277
  2296
    my_dlsyms=
slouken@4277
  2297
slouken@4277
  2298
    if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
slouken@4277
  2299
      if test -n "$NM" && test -n "$global_symbol_pipe"; then
slouken@4277
  2300
	my_dlsyms="${my_outputname}S.c"
slouken@4277
  2301
      else
slouken@4277
  2302
	func_error "not configured to extract global symbols from dlpreopened files"
slouken@4277
  2303
      fi
slouken@4277
  2304
    fi
slouken@4277
  2305
slouken@4277
  2306
    if test -n "$my_dlsyms"; then
slouken@4277
  2307
      case $my_dlsyms in
slouken@4277
  2308
      "") ;;
slouken@4277
  2309
      *.c)
slouken@4277
  2310
	# Discover the nlist of each of the dlfiles.
slouken@4277
  2311
	nlist="$output_objdir/${my_outputname}.nm"
slouken@4277
  2312
slouken@4277
  2313
	func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
slouken@4277
  2314
slouken@4277
  2315
	# Parse the name list into a source file.
slouken@4277
  2316
	func_verbose "creating $output_objdir/$my_dlsyms"
slouken@4277
  2317
slouken@4277
  2318
	$opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
slouken@4277
  2319
/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
slouken@4277
  2320
/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
slouken@4277
  2321
slouken@4277
  2322
#ifdef __cplusplus
slouken@4277
  2323
extern \"C\" {
slouken@4277
  2324
#endif
slouken@4277
  2325
slouken@4277
  2326
/* External symbol declarations for the compiler. */\
slouken@4277
  2327
"
slouken@4277
  2328
slouken@4277
  2329
	if test "$dlself" = yes; then
slouken@4277
  2330
	  func_verbose "generating symbol list for \`$output'"
slouken@4277
  2331
slouken@4277
  2332
	  $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
slouken@4277
  2333
slouken@4277
  2334
	  # Add our own program objects to the symbol list.
slouken@4277
  2335
	  progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
slouken@4277
  2336
	  for progfile in $progfiles; do
slouken@4277
  2337
	    func_verbose "extracting global C symbols from \`$progfile'"
slouken@4277
  2338
	    $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'"
slouken@4277
  2339
	  done
slouken@4277
  2340
slouken@4277
  2341
	  if test -n "$exclude_expsyms"; then
slouken@4277
  2342
	    $opt_dry_run || {
slouken@4277
  2343
	      eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
slouken@4277
  2344
	      eval '$MV "$nlist"T "$nlist"'
slouken@4277
  2345
	    }
slouken@4277
  2346
	  fi
slouken@4277
  2347
slouken@4277
  2348
	  if test -n "$export_symbols_regex"; then
slouken@4277
  2349
	    $opt_dry_run || {
slouken@4277
  2350
	      eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
slouken@4277
  2351
	      eval '$MV "$nlist"T "$nlist"'
slouken@4277
  2352
	    }
slouken@4277
  2353
	  fi
slouken@4277
  2354
slouken@4277
  2355
	  # Prepare the list of exported symbols
slouken@4277
  2356
	  if test -z "$export_symbols"; then
slouken@4277
  2357
	    export_symbols="$output_objdir/$outputname.exp"
slouken@4277
  2358
	    $opt_dry_run || {
slouken@4277
  2359
	      $RM $export_symbols
slouken@4277
  2360
	      eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
slouken@4277
  2361
	      case $host in
slouken@4277
  2362
	      *cygwin* | *mingw* | *cegcc* )
slouken@4277
  2363
                eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
slouken@4277
  2364
                eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
slouken@4277
  2365
	        ;;
slouken@4277
  2366
	      esac
slouken@4277
  2367
	    }
slouken@4277
  2368
	  else
slouken@4277
  2369
	    $opt_dry_run || {
slouken@4277
  2370
	      eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
slouken@4277
  2371
	      eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
slouken@4277
  2372
	      eval '$MV "$nlist"T "$nlist"'
slouken@4277
  2373
	      case $host in
slouken@4277
  2374
	        *cygwin | *mingw* | *cegcc* )
slouken@4277
  2375
	          eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
slouken@4277
  2376
	          eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
slouken@4277
  2377
	          ;;
slouken@4277
  2378
	      esac
slouken@4277
  2379
	    }
slouken@4277
  2380
	  fi
slouken@4277
  2381
	fi
slouken@4277
  2382
slouken@4277
  2383
	for dlprefile in $dlprefiles; do
slouken@4277
  2384
	  func_verbose "extracting global C symbols from \`$dlprefile'"
slouken@4277
  2385
	  func_basename "$dlprefile"
slouken@4277
  2386
	  name="$func_basename_result"
slouken@4277
  2387
	  $opt_dry_run || {
slouken@4277
  2388
	    eval '$ECHO ": $name " >> "$nlist"'
slouken@4277
  2389
	    eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'"
slouken@4277
  2390
	  }
slouken@4277
  2391
	done
slouken@4277
  2392
slouken@4277
  2393
	$opt_dry_run || {
slouken@4277
  2394
	  # Make sure we have at least an empty file.
slouken@4277
  2395
	  test -f "$nlist" || : > "$nlist"
slouken@4277
  2396
slouken@4277
  2397
	  if test -n "$exclude_expsyms"; then
slouken@4277
  2398
	    $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
slouken@4277
  2399
	    $MV "$nlist"T "$nlist"
slouken@4277
  2400
	  fi
slouken@4277
  2401
slouken@4277
  2402
	  # Try sorting and uniquifying the output.
slouken@4277
  2403
	  if $GREP -v "^: " < "$nlist" |
slouken@4277
  2404
	      if sort -k 3 </dev/null >/dev/null 2>&1; then
slouken@4277
  2405
		sort -k 3
slouken@4277
  2406
	      else
slouken@4277
  2407
		sort +2
slouken@4277
  2408
	      fi |
slouken@4277
  2409
	      uniq > "$nlist"S; then
slouken@4277
  2410
	    :
slouken@4277
  2411
	  else
slouken@4277
  2412
	    $GREP -v "^: " < "$nlist" > "$nlist"S
slouken@4277
  2413
	  fi
slouken@4277
  2414
slouken@4277
  2415
	  if test -f "$nlist"S; then
slouken@4277
  2416
	    eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
slouken@4277
  2417
	  else
slouken@4277
  2418
	    $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms"
slouken@4277
  2419
	  fi
slouken@4277
  2420
slouken@4277
  2421
	  $ECHO >> "$output_objdir/$my_dlsyms" "\
slouken@4277
  2422
slouken@4277
  2423
/* The mapping between symbol names and symbols.  */
slouken@4277
  2424
typedef struct {
slouken@4277
  2425
  const char *name;
slouken@4277
  2426
  void *address;
slouken@4277
  2427
} lt_dlsymlist;
slouken@4277
  2428
"
slouken@4277
  2429
	  case $host in
slouken@4277
  2430
	  *cygwin* | *mingw* | *cegcc* )
slouken@4277
  2431
	    $ECHO >> "$output_objdir/$my_dlsyms" "\
slouken@4277
  2432
/* DATA imports from DLLs on WIN32 con't be const, because
slouken@4277
  2433
   runtime relocations are performed -- see ld's documentation
slouken@4277
  2434
   on pseudo-relocs.  */"
slouken@4277
  2435
	    lt_dlsym_const= ;;
slouken@4277
  2436
	  *osf5*)
slouken@4277
  2437
	    echo >> "$output_objdir/$my_dlsyms" "\
slouken@4277
  2438
/* This system does not cope well with relocations in const data */"
slouken@4277
  2439
	    lt_dlsym_const= ;;
slouken@4277
  2440
	  *)
slouken@4277
  2441
	    lt_dlsym_const=const ;;
slouken@4277
  2442
	  esac
slouken@4277
  2443
slouken@4277
  2444
	  $ECHO >> "$output_objdir/$my_dlsyms" "\
slouken@4277
  2445
extern $lt_dlsym_const lt_dlsymlist
slouken@4277
  2446
lt_${my_prefix}_LTX_preloaded_symbols[];
slouken@4277
  2447
$lt_dlsym_const lt_dlsymlist
slouken@4277
  2448
lt_${my_prefix}_LTX_preloaded_symbols[] =
slouken@4277
  2449
{\
slouken@4277
  2450
  { \"$my_originator\", (void *) 0 },"
slouken@4277
  2451
slouken@4277
  2452
	  case $need_lib_prefix in
slouken@4277
  2453
	  no)
slouken@4277
  2454
	    eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
slouken@4277
  2455
	    ;;
slouken@4277
  2456
	  *)
slouken@4277
  2457
	    eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
slouken@4277
  2458
	    ;;
slouken@4277
  2459
	  esac
slouken@4277
  2460
	  $ECHO >> "$output_objdir/$my_dlsyms" "\
slouken@4277
  2461
  {0, (void *) 0}
slouken@4277
  2462
};
slouken@4277
  2463
slouken@4277
  2464
/* This works around a problem in FreeBSD linker */
slouken@4277
  2465
#ifdef FREEBSD_WORKAROUND
slouken@4277
  2466
static const void *lt_preloaded_setup() {
slouken@4277
  2467
  return lt_${my_prefix}_LTX_preloaded_symbols;
slouken@4277
  2468
}
slouken@4277
  2469
#endif
slouken@4277
  2470
slouken@4277
  2471
#ifdef __cplusplus
slouken@4277
  2472
}
slouken@4277
  2473
#endif\
slouken@4277
  2474
"
slouken@4277
  2475
	} # !$opt_dry_run
slouken@4277
  2476
slouken@4277
  2477
	pic_flag_for_symtable=
slouken@4277
  2478
	case "$compile_command " in
slouken@4277
  2479
	*" -static "*) ;;
slouken@4277
  2480
	*)
slouken@4277
  2481
	  case $host in
slouken@4277
  2482
	  # compiling the symbol table file with pic_flag works around
slouken@4277
  2483
	  # a FreeBSD bug that causes programs to crash when -lm is
slouken@4277
  2484
	  # linked before any other PIC object.  But we must not use
slouken@4277
  2485
	  # pic_flag when linking with -static.  The problem exists in
slouken@4277
  2486
	  # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
slouken@4277
  2487
	  *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
slouken@4277
  2488
	    pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
slouken@4277
  2489
	  *-*-hpux*)
slouken@4277
  2490
	    pic_flag_for_symtable=" $pic_flag"  ;;
slouken@4277
  2491
	  *)
slouken@4277
  2492
	    if test "X$my_pic_p" != Xno; then
slouken@4277
  2493
	      pic_flag_for_symtable=" $pic_flag"
slouken@4277
  2494
	    fi
slouken@4277
  2495
	    ;;
slouken@4277
  2496
	  esac
slouken@4277
  2497
	  ;;
slouken@4277
  2498
	esac
slouken@4277
  2499
	symtab_cflags=
slouken@4277
  2500
	for arg in $LTCFLAGS; do
slouken@4277
  2501
	  case $arg in
slouken@4277
  2502
	  -pie | -fpie | -fPIE) ;;
slouken@4277
  2503
	  *) symtab_cflags="$symtab_cflags $arg" ;;
slouken@4277
  2504
	  esac
slouken@4277
  2505
	done
slouken@4277
  2506
slouken@4277
  2507
	# Now compile the dynamic symbol file.
slouken@4277
  2508
	func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
slouken@4277
  2509
slouken@4277
  2510
	# Clean up the generated files.
slouken@4277
  2511
	func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
slouken@4277
  2512
slouken@4277
  2513
	# Transform the symbol file into the correct name.
slouken@4277
  2514
	symfileobj="$output_objdir/${my_outputname}S.$objext"
slouken@4277
  2515
	case $host in
slouken@4277
  2516
	*cygwin* | *mingw* | *cegcc* )
slouken@4277
  2517
	  if test -f "$output_objdir/$my_outputname.def"; then
slouken@4277
  2518
	    compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
slouken@4277
  2519
	    finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
slouken@4277
  2520
	  else
slouken@4277
  2521
	    compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
slouken@4277
  2522
	    finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
slouken@4277
  2523
	  fi
slouken@4277
  2524
	  ;;
slouken@4277
  2525
	*)
slouken@4277
  2526
	  compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
slouken@4277
  2527
	  finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
slouken@4277
  2528
	  ;;
slouken@4277
  2529
	esac
slouken@4277
  2530
	;;
slouken@4277
  2531
      *)
slouken@4277
  2532
	func_fatal_error "unknown suffix for \`$my_dlsyms'"
slouken@4277
  2533
	;;
slouken@4277
  2534
      esac
slouken@4277
  2535
    else
slouken@4277
  2536
      # We keep going just in case the user didn't refer to
slouken@4277
  2537
      # lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
slouken@4277
  2538
      # really was required.
slouken@4277
  2539
slouken@4277
  2540
      # Nullify the symbol file.
slouken@4277
  2541
      compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
slouken@4277
  2542
      finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
slouken@4277
  2543
    fi
slouken@4277
  2544
}
slouken@1570
  2545
slouken@1361
  2546
# func_win32_libid arg
slouken@1361
  2547
# return the library type of file 'arg'
slouken@1361
  2548
#
slouken@1361
  2549
# Need a lot of goo to handle *both* DLLs and import libs
slouken@1361
  2550
# Has to be a shell function in order to 'eat' the argument
slouken@1361
  2551
# that is supplied when $file_magic_command is called.
slouken@1570
  2552
func_win32_libid ()
slouken@1570
  2553
{
slouken@4277
  2554
  $opt_debug
slouken@1361
  2555
  win32_libid_type="unknown"
slouken@1361
  2556
  win32_fileres=`file -L $1 2>/dev/null`
slouken@1361
  2557
  case $win32_fileres in
slouken@1361
  2558
  *ar\ archive\ import\ library*) # definitely import
slouken@1361
  2559
    win32_libid_type="x86 archive import"
slouken@1361
  2560
    ;;
slouken@1361
  2561
  *ar\ archive*) # could be an import, or static
slouken@4277
  2562
    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
slouken@5101
  2563
       $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null ; then
slouken@4277
  2564
      win32_nmres=`eval $NM -f posix -A $1 |
slouken@4277
  2565
	$SED -n -e '
slouken@4277
  2566
	    1,100{
slouken@4277
  2567
		/ I /{
slouken@4277
  2568
		    s,.*,import,
slouken@4277
  2569
		    p
slouken@4277
  2570
		    q
slouken@4277
  2571
		}
slouken@4277
  2572
	    }'`
slouken@1570
  2573
      case $win32_nmres in
slouken@1570
  2574
      import*)  win32_libid_type="x86 archive import";;
slouken@1570
  2575
      *)        win32_libid_type="x86 archive static";;
slouken@1570
  2576
      esac
slouken@1361
  2577
    fi
slouken@1361
  2578
    ;;
slouken@1361
  2579
  *DLL*)
slouken@1361
  2580
    win32_libid_type="x86 DLL"
slouken@1361
  2581
    ;;
slouken@1361
  2582
  *executable*) # but shell scripts are "executable" too...
slouken@1361
  2583
    case $win32_fileres in
slouken@1361
  2584
    *MS\ Windows\ PE\ Intel*)
slouken@1361
  2585
      win32_libid_type="x86 DLL"
slouken@1361
  2586
      ;;
slouken@1361
  2587
    esac
slouken@1361
  2588
    ;;
slouken@1361
  2589
  esac
slouken@4277
  2590
  $ECHO "$win32_libid_type"
slouken@1361
  2591
}
slouken@1361
  2592
slouken@1361
  2593
slouken@1361
  2594
slouken@1570
  2595
# func_extract_an_archive dir oldlib
slouken@1570
  2596
func_extract_an_archive ()
slouken@1570
  2597
{
slouken@4277
  2598
    $opt_debug
slouken@1570
  2599
    f_ex_an_ar_dir="$1"; shift
slouken@1570
  2600
    f_ex_an_ar_oldlib="$1"
slouken@4277
  2601
    func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?'
slouken@1570
  2602
    if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
slouken@1570
  2603
     :
slouken@1570
  2604
    else
slouken@4277
  2605
      func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
slouken@1570
  2606
    fi
slouken@1570
  2607
}
slouken@1570
  2608
slouken@4277
  2609
slouken@1361
  2610
# func_extract_archives gentop oldlib ...
slouken@1570
  2611
func_extract_archives ()
slouken@1570
  2612
{
slouken@4277
  2613
    $opt_debug
slouken@1361
  2614
    my_gentop="$1"; shift
slouken@1361
  2615
    my_oldlibs=${1+"$@"}
slouken@1361
  2616
    my_oldobjs=""
slouken@1361
  2617
    my_xlib=""
slouken@1361
  2618
    my_xabs=""
slouken@1361
  2619
    my_xdir=""
slouken@1361
  2620
slouken@1361
  2621
    for my_xlib in $my_oldlibs; do
slouken@1361
  2622
      # Extract the objects.
slouken@1361
  2623
      case $my_xlib in
slouken@1361
  2624
	[\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
slouken@1361
  2625
	*) my_xabs=`pwd`"/$my_xlib" ;;
slouken@1361
  2626
      esac
slouken@4277
  2627
      func_basename "$my_xlib"
slouken@4277
  2628
      my_xlib="$func_basename_result"
slouken@4277
  2629
      my_xlib_u=$my_xlib
slouken@4277
  2630
      while :; do
slouken@4277
  2631
        case " $extracted_archives " in
slouken@4277
  2632
	*" $my_xlib_u "*)
slouken@4277
  2633
	  func_arith $extracted_serial + 1
slouken@4277
  2634
	  extracted_serial=$func_arith_result
slouken@4277
  2635
	  my_xlib_u=lt$extracted_serial-$my_xlib ;;
slouken@4277
  2636
	*) break ;;
slouken@4277
  2637
	esac
slouken@4277
  2638
      done
slouken@4277
  2639
      extracted_archives="$extracted_archives $my_xlib_u"
slouken@4277
  2640
      my_xdir="$my_gentop/$my_xlib_u"
slouken@4277
  2641
slouken@4277
  2642
      func_mkdir_p "$my_xdir"
slouken@4277
  2643
slouken@1361
  2644
      case $host in
slouken@1361
  2645
      *-darwin*)
slouken@4277
  2646
	func_verbose "Extracting $my_xabs"
slouken@1361
  2647
	# Do not bother doing anything if just a dry run
slouken@4277
  2648
	$opt_dry_run || {
slouken@1361
  2649
	  darwin_orig_dir=`pwd`
slouken@1361
  2650
	  cd $my_xdir || exit $?
slouken@1361
  2651
	  darwin_archive=$my_xabs
slouken@1361
  2652
	  darwin_curdir=`pwd`
slouken@4277
  2653
	  darwin_base_archive=`basename "$darwin_archive"`
slouken@4277
  2654
	  darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
slouken@4277
  2655
	  if test -n "$darwin_arches"; then
slouken@4277
  2656
	    darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
slouken@1361
  2657
	    darwin_arch=
slouken@4277
  2658
	    func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
slouken@1361
  2659
	    for darwin_arch in  $darwin_arches ; do
slouken@4277
  2660
	      func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
slouken@4277
  2661
	      $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
slouken@1361
  2662
	      cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
slouken@1570
  2663
	      func_extract_an_archive "`pwd`" "${darwin_base_archive}"
slouken@1361
  2664
	      cd "$darwin_curdir"
slouken@4277
  2665
	      $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
slouken@1361
  2666
	    done # $darwin_arches
slouken@4277
  2667
            ## Okay now we've a bunch of thin objects, gotta fatten them up :)
slouken@4277
  2668
	    darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
slouken@1361
  2669
	    darwin_file=
slouken@1361
  2670
	    darwin_files=
slouken@1361
  2671
	    for darwin_file in $darwin_filelist; do
slouken@1361
  2672
	      darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
slouken@4277
  2673
	      $LIPO -create -output "$darwin_file" $darwin_files
slouken@1361
  2674
	    done # $darwin_filelist
slouken@4277
  2675
	    $RM -rf unfat-$$
slouken@1361
  2676
	    cd "$darwin_orig_dir"
slouken@1361
  2677
	  else
slouken@4277
  2678
	    cd $darwin_orig_dir
slouken@4277
  2679
	    func_extract_an_archive "$my_xdir" "$my_xabs"
slouken@1361
  2680
	  fi # $darwin_arches
slouken@4277
  2681
	} # !$opt_dry_run
slouken@1570
  2682
	;;
slouken@1361
  2683
      *)
slouken@1570
  2684
        func_extract_an_archive "$my_xdir" "$my_xabs"
slouken@4277
  2685
	;;
slouken@1361
  2686
      esac
slouken@1361
  2687
      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
slouken@1361
  2688
    done
slouken@4277
  2689
slouken@1361
  2690
    func_extract_archives_result="$my_oldobjs"
slouken@1361
  2691
}
slouken@4277
  2692
slouken@4277
  2693
slouken@4277
  2694
slouken@4277
  2695
# func_emit_wrapper_part1 [arg=no]
slouken@4277
  2696
#
slouken@4277
  2697
# Emit the first part of a libtool wrapper script on stdout.
slouken@4277
  2698
# For more information, see the description associated with
slouken@4277
  2699
# func_emit_wrapper(), below.
slouken@4277
  2700
func_emit_wrapper_part1 ()
slouken@4277
  2701
{
slouken@4277
  2702
	func_emit_wrapper_part1_arg1=no
slouken@4277
  2703
	if test -n "$1" ; then
slouken@4277
  2704
	  func_emit_wrapper_part1_arg1=$1
slouken@4277
  2705
	fi
slouken@4277
  2706
slouken@4277
  2707
	$ECHO "\
slouken@4277
  2708
#! $SHELL
slouken@4277
  2709
slouken@4277
  2710
# $output - temporary wrapper script for $objdir/$outputname
slouken@4277
  2711
# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
slouken@4277
  2712
#
slouken@4277
  2713
# The $output program cannot be directly executed until all the libtool
slouken@4277
  2714
# libraries that it depends on are installed.
slouken@4277
  2715
#
slouken@4277
  2716
# This wrapper script should never be moved out of the build directory.
slouken@4277
  2717
# If it is, it will not operate correctly.
slouken@4277
  2718
slouken@4277
  2719
# Sed substitution that helps us do robust quoting.  It backslashifies
slouken@4277
  2720
# metacharacters that are still active within double-quoted strings.
slouken@4277
  2721
Xsed='${SED} -e 1s/^X//'
slouken@4277
  2722
sed_quote_subst='$sed_quote_subst'
slouken@4277
  2723
slouken@4277
  2724
# Be Bourne compatible
slouken@4277
  2725
if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
slouken@4277
  2726
  emulate sh
slouken@4277
  2727
  NULLCMD=:
slouken@4277
  2728
  # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
slouken@4277
  2729
  # is contrary to our usage.  Disable this feature.
slouken@4277
  2730
  alias -g '\${1+\"\$@\"}'='\"\$@\"'
slouken@4277
  2731
  setopt NO_GLOB_SUBST
slouken@4277
  2732
else
slouken@4277
  2733
  case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
slouken@4277
  2734
fi
slouken@4277
  2735
BIN_SH=xpg4; export BIN_SH # for Tru64
slouken@4277
  2736
DUALCASE=1; export DUALCASE # for MKS sh
slouken@4277
  2737
slouken@4277
  2738
# The HP-UX ksh and POSIX shell print the target directory to stdout
slouken@4277
  2739
# if CDPATH is set.
slouken@4277
  2740
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
slouken@4277
  2741
slouken@4277
  2742
relink_command=\"$relink_command\"
slouken@4277
  2743
slouken@4277
  2744
# This environment variable determines our operation mode.
slouken@4277
  2745
if test \"\$libtool_install_magic\" = \"$magic\"; then
slouken@4277
  2746
  # install mode needs the following variables:
slouken@4277
  2747
  generated_by_libtool_version='$macro_version'
slouken@4277
  2748
  notinst_deplibs='$notinst_deplibs'
slouken@4277
  2749
else
slouken@4277
  2750
  # When we are sourced in execute mode, \$file and \$ECHO are already set.
slouken@4277
  2751
  if test \"\$libtool_execute_magic\" != \"$magic\"; then
slouken@4277
  2752
    ECHO=\"$qecho\"
slouken@4277
  2753
    file=\"\$0\"
slouken@4277
  2754
    # Make sure echo works.
slouken@4277
  2755
    if test \"X\$1\" = X--no-reexec; then
slouken@4277
  2756
      # Discard the --no-reexec flag, and continue.
slouken@4277
  2757
      shift
slouken@4277
  2758
    elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then
slouken@4277
  2759
      # Yippee, \$ECHO works!
slouken@4277
  2760
      :
slouken@4277
  2761
    else
slouken@4277
  2762
      # Restart under the correct shell, and then maybe \$ECHO will work.
slouken@4277
  2763
      exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
slouken@4277
  2764
    fi
slouken@4277
  2765
  fi\
slouken@4277
  2766
"
slouken@4277
  2767
	$ECHO "\
slouken@4277
  2768
slouken@4277
  2769
  # Find