~gnaservicesinc/tpad-project/6.x

« back to all changes in this revision

Viewing changes to ltmain.sh

  • Committer: Andrew Joseph Smith
  • Date: 2016-08-11 02:07:54 UTC
  • Revision ID: andrew@gnaservicesinc.com-20160811020754-xbyktseivjmbuut5
Mis bug fixes

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh
 
2
## DO NOT EDIT - This file generated from ./build-aux/ltmain.in
 
3
##               by inline-source v2014-01-03.01
1
4
 
2
 
# libtool (GNU libtool) 2.4.2
 
5
# libtool (GNU libtool) 2.4.6
 
6
# Provide generalized library-building support services.
3
7
# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
4
8
 
5
 
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
6
 
# 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
 
9
# Copyright (C) 1996-2015 Free Software Foundation, Inc.
7
10
# This is free software; see the source for copying conditions.  There is NO
8
11
# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9
12
 
23
26
# General Public License for more details.
24
27
#
25
28
# You should have received a copy of the GNU General Public License
26
 
# along with GNU Libtool; see the file COPYING.  If not, a copy
27
 
# can be downloaded from http://www.gnu.org/licenses/gpl.html,
28
 
# or obtained by writing to the Free Software Foundation, Inc.,
29
 
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
29
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
30
30
 
31
 
# Usage: $progname [OPTION]... [MODE-ARG]...
32
 
#
33
 
# Provide generalized library-building support services.
34
 
#
35
 
#       --config             show all configuration variables
36
 
#       --debug              enable verbose shell tracing
37
 
#   -n, --dry-run            display commands without modifying any files
38
 
#       --features           display basic configuration information and exit
39
 
#       --mode=MODE          use operation mode MODE
40
 
#       --preserve-dup-deps  don't remove duplicate dependency libraries
41
 
#       --quiet, --silent    don't print informational messages
42
 
#       --no-quiet, --no-silent
43
 
#                            print informational messages (default)
44
 
#       --no-warn            don't display warning messages
45
 
#       --tag=TAG            use configuration variables from tag TAG
46
 
#   -v, --verbose            print more informational messages than default
47
 
#       --no-verbose         don't print the extra informational messages
48
 
#       --version            print version information
49
 
#   -h, --help, --help-all   print short, long, or detailed help message
50
 
#
51
 
# MODE must be one of the following:
52
 
#
53
 
#         clean              remove files from the build directory
54
 
#         compile            compile a source file into a libtool object
55
 
#         execute            automatically set library path, then run a program
56
 
#         finish             complete the installation of libtool libraries
57
 
#         install            install libraries or executables
58
 
#         link               create a library or an executable
59
 
#         uninstall          remove libraries from an installed directory
60
 
#
61
 
# MODE-ARGS vary depending on the MODE.  When passed as first option,
62
 
# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that.
63
 
# Try `$progname --help --mode=MODE' for a more detailed description of MODE.
64
 
#
65
 
# When reporting a bug, please describe a test case to reproduce it and
66
 
# include the following information:
67
 
#
68
 
#         host-triplet: $host
69
 
#         shell:                $SHELL
70
 
#         compiler:             $LTCC
71
 
#         compiler flags:               $LTCFLAGS
72
 
#         linker:               $LD (gnu? $with_gnu_ld)
73
 
#         $progname:    (GNU libtool) 2.4.2 Debian-2.4.2-1.11
74
 
#         automake:     $automake_version
75
 
#         autoconf:     $autoconf_version
76
 
#
77
 
# Report bugs to <bug-libtool@gnu.org>.
78
 
# GNU libtool home page: <http://www.gnu.org/software/libtool/>.
79
 
# General help using GNU software: <http://www.gnu.org/gethelp/>.
80
31
 
81
32
PROGRAM=libtool
82
33
PACKAGE=libtool
83
 
VERSION="2.4.2 Debian-2.4.2-1.11"
84
 
TIMESTAMP=""
85
 
package_revision=1.3337
86
 
 
87
 
# Be Bourne compatible
88
 
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
 
34
VERSION="2.4.6 Debian-2.4.6-0.1"
 
35
package_revision=2.4.6
 
36
 
 
37
 
 
38
## ------ ##
 
39
## Usage. ##
 
40
## ------ ##
 
41
 
 
42
# Run './libtool --help' for help with using this script from the
 
43
# command line.
 
44
 
 
45
 
 
46
## ------------------------------- ##
 
47
## User overridable command paths. ##
 
48
## ------------------------------- ##
 
49
 
 
50
# After configure completes, it has a better idea of some of the
 
51
# shell tools we need than the defaults used by the functions shared
 
52
# with bootstrap, so set those here where they can still be over-
 
53
# ridden by the user, but otherwise take precedence.
 
54
 
 
55
: ${AUTOCONF="autoconf"}
 
56
: ${AUTOMAKE="automake"}
 
57
 
 
58
 
 
59
## -------------------------- ##
 
60
## Source external libraries. ##
 
61
## -------------------------- ##
 
62
 
 
63
# Much of our low-level functionality needs to be sourced from external
 
64
# libraries, which are installed to $pkgauxdir.
 
65
 
 
66
# Set a version string for this script.
 
67
scriptversion=2015-01-20.17; # UTC
 
68
 
 
69
# General shell script boiler plate, and helper functions.
 
70
# Written by Gary V. Vaughan, 2004
 
71
 
 
72
# Copyright (C) 2004-2015 Free Software Foundation, Inc.
 
73
# This is free software; see the source for copying conditions.  There is NO
 
74
# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
75
 
 
76
# This program is free software; you can redistribute it and/or modify
 
77
# it under the terms of the GNU General Public License as published by
 
78
# the Free Software Foundation; either version 3 of the License, or
 
79
# (at your option) any later version.
 
80
 
 
81
# As a special exception to the GNU General Public License, if you distribute
 
82
# this file as part of a program or library that is built using GNU Libtool,
 
83
# you may include this file under the same distribution terms that you use
 
84
# for the rest of that program.
 
85
 
 
86
# This program is distributed in the hope that it will be useful,
 
87
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
88
# MERCHANTABILITY or FITNES FOR A PARTICULAR PURPOSE. See the GNU
 
89
# General Public License for more details.
 
90
 
 
91
# You should have received a copy of the GNU General Public License
 
92
# along with this program. If not, see <http://www.gnu.org/licenses/>.
 
93
 
 
94
# Please report bugs or propose patches to gary@gnu.org.
 
95
 
 
96
 
 
97
## ------ ##
 
98
## Usage. ##
 
99
## ------ ##
 
100
 
 
101
# Evaluate this file near the top of your script to gain access to
 
102
# the functions and variables defined here:
 
103
#
 
104
#   . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh
 
105
#
 
106
# If you need to override any of the default environment variable
 
107
# settings, do that before evaluating this file.
 
108
 
 
109
 
 
110
## -------------------- ##
 
111
## Shell normalisation. ##
 
112
## -------------------- ##
 
113
 
 
114
# Some shells need a little help to be as Bourne compatible as possible.
 
115
# Before doing anything else, make sure all that help has been provided!
 
116
 
 
117
DUALCASE=1; export DUALCASE # for MKS sh
 
118
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
89
119
  emulate sh
90
120
  NULLCMD=:
91
 
  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
 
121
  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
92
122
  # is contrary to our usage.  Disable this feature.
93
123
  alias -g '${1+"$@"}'='"$@"'
94
124
  setopt NO_GLOB_SUBST
95
125
else
96
 
  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
 
126
  case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac
97
127
fi
98
 
BIN_SH=xpg4; export BIN_SH # for Tru64
99
 
DUALCASE=1; export DUALCASE # for MKS sh
100
 
 
101
 
# A function that is used when there is no print builtin or printf.
102
 
func_fallback_echo ()
103
 
{
104
 
  eval 'cat <<_LTECHO_EOF
105
 
$1
106
 
_LTECHO_EOF'
107
 
}
108
 
 
109
 
# NLS nuisances: We save the old values to restore during execute mode.
110
 
lt_user_locale=
111
 
lt_safe_locale=
112
 
for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
 
128
 
 
129
# NLS nuisances: We save the old values in case they are required later.
 
130
_G_user_locale=
 
131
_G_safe_locale=
 
132
for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
113
133
do
114
 
  eval "if test \"\${$lt_var+set}\" = set; then
115
 
          save_$lt_var=\$$lt_var
116
 
          $lt_var=C
117
 
          export $lt_var
118
 
          lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
119
 
          lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
 
134
  eval "if test set = \"\${$_G_var+set}\"; then
 
135
          save_$_G_var=\$$_G_var
 
136
          $_G_var=C
 
137
          export $_G_var
 
138
          _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\"
 
139
          _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\"
120
140
        fi"
121
141
done
122
 
LC_ALL=C
123
 
LANGUAGE=C
124
 
export LANGUAGE LC_ALL
125
 
 
126
 
$lt_unset CDPATH
127
 
 
128
 
 
129
 
# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
130
 
# is ksh but when the shell is invoked as "sh" and the current value of
131
 
# the _XPG environment variable is not equal to 1 (one), the special
132
 
# positional parameter $0, within a function call, is the name of the
133
 
# function.
134
 
progpath="$0"
135
 
 
136
 
 
 
142
 
 
143
# CDPATH.
 
144
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
 
145
 
 
146
# Make sure IFS has a sensible default
 
147
sp=' '
 
148
nl='
 
149
'
 
150
IFS="$sp        $nl"
 
151
 
 
152
# There are apparently some retarded systems that use ';' as a PATH separator!
 
153
if test "${PATH_SEPARATOR+set}" != set; then
 
154
  PATH_SEPARATOR=:
 
155
  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
 
156
    (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
 
157
      PATH_SEPARATOR=';'
 
158
  }
 
159
fi
 
160
 
 
161
 
 
162
 
 
163
## ------------------------- ##
 
164
## Locate command utilities. ##
 
165
## ------------------------- ##
 
166
 
 
167
 
 
168
# func_executable_p FILE
 
169
# ----------------------
 
170
# Check that FILE is an executable regular file.
 
171
func_executable_p ()
 
172
{
 
173
    test -f "$1" && test -x "$1"
 
174
}
 
175
 
 
176
 
 
177
# func_path_progs PROGS_LIST CHECK_FUNC [PATH]
 
178
# --------------------------------------------
 
179
# Search for either a program that responds to --version with output
 
180
# containing "GNU", or else returned by CHECK_FUNC otherwise, by
 
181
# trying all the directories in PATH with each of the elements of
 
182
# PROGS_LIST.
 
183
#
 
184
# CHECK_FUNC should accept the path to a candidate program, and
 
185
# set $func_check_prog_result if it truncates its output less than
 
186
# $_G_path_prog_max characters.
 
187
func_path_progs ()
 
188
{
 
189
    _G_progs_list=$1
 
190
    _G_check_func=$2
 
191
    _G_PATH=${3-"$PATH"}
 
192
 
 
193
    _G_path_prog_max=0
 
194
    _G_path_prog_found=false
 
195
    _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:}
 
196
    for _G_dir in $_G_PATH; do
 
197
      IFS=$_G_save_IFS
 
198
      test -z "$_G_dir" && _G_dir=.
 
199
      for _G_prog_name in $_G_progs_list; do
 
200
        for _exeext in '' .EXE; do
 
201
          _G_path_prog=$_G_dir/$_G_prog_name$_exeext
 
202
          func_executable_p "$_G_path_prog" || continue
 
203
          case `"$_G_path_prog" --version 2>&1` in
 
204
            *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;;
 
205
            *)     $_G_check_func $_G_path_prog
 
206
                   func_path_progs_result=$func_check_prog_result
 
207
                   ;;
 
208
          esac
 
209
          $_G_path_prog_found && break 3
 
210
        done
 
211
      done
 
212
    done
 
213
    IFS=$_G_save_IFS
 
214
    test -z "$func_path_progs_result" && {
 
215
      echo "no acceptable sed could be found in \$PATH" >&2
 
216
      exit 1
 
217
    }
 
218
}
 
219
 
 
220
 
 
221
# We want to be able to use the functions in this file before configure
 
222
# has figured out where the best binaries are kept, which means we have
 
223
# to search for them ourselves - except when the results are already set
 
224
# where we skip the searches.
 
225
 
 
226
# Unless the user overrides by setting SED, search the path for either GNU
 
227
# sed, or the sed that truncates its output the least.
 
228
test -z "$SED" && {
 
229
  _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
 
230
  for _G_i in 1 2 3 4 5 6 7; do
 
231
    _G_sed_script=$_G_sed_script$nl$_G_sed_script
 
232
  done
 
233
  echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed
 
234
  _G_sed_script=
 
235
 
 
236
  func_check_prog_sed ()
 
237
  {
 
238
    _G_path_prog=$1
 
239
 
 
240
    _G_count=0
 
241
    printf 0123456789 >conftest.in
 
242
    while :
 
243
    do
 
244
      cat conftest.in conftest.in >conftest.tmp
 
245
      mv conftest.tmp conftest.in
 
246
      cp conftest.in conftest.nl
 
247
      echo '' >> conftest.nl
 
248
      "$_G_path_prog" -f conftest.sed <conftest.nl >conftest.out 2>/dev/null || break
 
249
      diff conftest.out conftest.nl >/dev/null 2>&1 || break
 
250
      _G_count=`expr $_G_count + 1`
 
251
      if test "$_G_count" -gt "$_G_path_prog_max"; then
 
252
        # Best one so far, save it but keep looking for a better one
 
253
        func_check_prog_result=$_G_path_prog
 
254
        _G_path_prog_max=$_G_count
 
255
      fi
 
256
      # 10*(2^10) chars as input seems more than enough
 
257
      test 10 -lt "$_G_count" && break
 
258
    done
 
259
    rm -f conftest.in conftest.tmp conftest.nl conftest.out
 
260
  }
 
261
 
 
262
  func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin
 
263
  rm -f conftest.sed
 
264
  SED=$func_path_progs_result
 
265
}
 
266
 
 
267
 
 
268
# Unless the user overrides by setting GREP, search the path for either GNU
 
269
# grep, or the grep that truncates its output the least.
 
270
test -z "$GREP" && {
 
271
  func_check_prog_grep ()
 
272
  {
 
273
    _G_path_prog=$1
 
274
 
 
275
    _G_count=0
 
276
    _G_path_prog_max=0
 
277
    printf 0123456789 >conftest.in
 
278
    while :
 
279
    do
 
280
      cat conftest.in conftest.in >conftest.tmp
 
281
      mv conftest.tmp conftest.in
 
282
      cp conftest.in conftest.nl
 
283
      echo 'GREP' >> conftest.nl
 
284
      "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' <conftest.nl >conftest.out 2>/dev/null || break
 
285
      diff conftest.out conftest.nl >/dev/null 2>&1 || break
 
286
      _G_count=`expr $_G_count + 1`
 
287
      if test "$_G_count" -gt "$_G_path_prog_max"; then
 
288
        # Best one so far, save it but keep looking for a better one
 
289
        func_check_prog_result=$_G_path_prog
 
290
        _G_path_prog_max=$_G_count
 
291
      fi
 
292
      # 10*(2^10) chars as input seems more than enough
 
293
      test 10 -lt "$_G_count" && break
 
294
    done
 
295
    rm -f conftest.in conftest.tmp conftest.nl conftest.out
 
296
  }
 
297
 
 
298
  func_path_progs "grep ggrep" func_check_prog_grep $PATH:/usr/xpg4/bin
 
299
  GREP=$func_path_progs_result
 
300
}
 
301
 
 
302
 
 
303
## ------------------------------- ##
 
304
## User overridable command paths. ##
 
305
## ------------------------------- ##
 
306
 
 
307
# All uppercase variable names are used for environment variables.  These
 
308
# variables can be overridden by the user before calling a script that
 
309
# uses them if a suitable command of that name is not already available
 
310
# in the command search PATH.
137
311
 
138
312
: ${CP="cp -f"}
139
 
test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
 
313
: ${ECHO="printf %s\n"}
 
314
: ${EGREP="$GREP -E"}
 
315
: ${FGREP="$GREP -F"}
 
316
: ${LN_S="ln -s"}
140
317
: ${MAKE="make"}
141
318
: ${MKDIR="mkdir"}
142
319
: ${MV="mv -f"}
143
320
: ${RM="rm -f"}
144
321
: ${SHELL="${CONFIG_SHELL-/bin/sh}"}
145
 
: ${Xsed="$SED -e 1s/^X//"}
146
 
 
147
 
# Global variables:
 
322
 
 
323
 
 
324
## -------------------- ##
 
325
## Useful sed snippets. ##
 
326
## -------------------- ##
 
327
 
 
328
sed_dirname='s|/[^/]*$||'
 
329
sed_basename='s|^.*/||'
 
330
 
 
331
# Sed substitution that helps us do robust quoting.  It backslashifies
 
332
# metacharacters that are still active within double-quoted strings.
 
333
sed_quote_subst='s|\([`"$\\]\)|\\\1|g'
 
334
 
 
335
# Same as above, but do not quote variable references.
 
336
sed_double_quote_subst='s/\(["`\\]\)/\\\1/g'
 
337
 
 
338
# Sed substitution that turns a string into a regex matching for the
 
339
# string literally.
 
340
sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g'
 
341
 
 
342
# Sed substitution that converts a w32 file name or path
 
343
# that contains forward slashes, into one that contains
 
344
# (escaped) backslashes.  A very naive implementation.
 
345
sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
 
346
 
 
347
# Re-'\' parameter expansions in output of sed_double_quote_subst that
 
348
# were '\'-ed in input to the same.  If an odd number of '\' preceded a
 
349
# '$' in input to sed_double_quote_subst, that '$' was protected from
 
350
# expansion.  Since each input '\' is now two '\'s, look for any number
 
351
# of runs of four '\'s followed by two '\'s and then a '$'.  '\' that '$'.
 
352
_G_bs='\\'
 
353
_G_bs2='\\\\'
 
354
_G_bs4='\\\\\\\\'
 
355
_G_dollar='\$'
 
356
sed_double_backslash="\
 
357
  s/$_G_bs4/&\\
 
358
/g
 
359
  s/^$_G_bs2$_G_dollar/$_G_bs&/
 
360
  s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g
 
361
  s/\n//g"
 
362
 
 
363
 
 
364
## ----------------- ##
 
365
## Global variables. ##
 
366
## ----------------- ##
 
367
 
 
368
# Except for the global variables explicitly listed below, the following
 
369
# functions in the '^func_' namespace, and the '^require_' namespace
 
370
# variables initialised in the 'Resource management' section, sourcing
 
371
# this file will not pollute your global namespace with anything
 
372
# else. There's no portable way to scope variables in Bourne shell
 
373
# though, so actually running these functions will sometimes place
 
374
# results into a variable named after the function, and often use
 
375
# temporary variables in the '^_G_' namespace. If you are careful to
 
376
# avoid using those namespaces casually in your sourcing script, things
 
377
# should continue to work as you expect. And, of course, you can freely
 
378
# overwrite any of the functions or variables defined here before
 
379
# calling anything to customize them.
 
380
 
148
381
EXIT_SUCCESS=0
149
382
EXIT_FAILURE=1
150
383
EXIT_MISMATCH=63  # $? = 63 is used to indicate version mismatch to missing.
151
384
EXIT_SKIP=77      # $? = 77 is used to indicate a skipped test to automake.
152
385
 
 
386
# Allow overriding, eg assuming that you follow the convention of
 
387
# putting '$debug_cmd' at the start of all your functions, you can get
 
388
# bash to show function call trace with:
 
389
#
 
390
#    debug_cmd='eval echo "${FUNCNAME[0]} $*" >&2' bash your-script-name
 
391
debug_cmd=${debug_cmd-":"}
 
392
exit_cmd=:
 
393
 
 
394
# By convention, finish your script with:
 
395
#
 
396
#    exit $exit_status
 
397
#
 
398
# so that you can set exit_status to non-zero if you want to indicate
 
399
# something went wrong during execution without actually bailing out at
 
400
# the point of failure.
153
401
exit_status=$EXIT_SUCCESS
154
402
 
155
 
# Make sure IFS has a sensible default
156
 
lt_nl='
157
 
'
158
 
IFS="   $lt_nl"
159
 
 
160
 
dirname="s,/[^/]*$,,"
161
 
basename="s,^.*/,,"
162
 
 
163
 
# func_dirname file append nondir_replacement
164
 
# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
165
 
# otherwise set result to NONDIR_REPLACEMENT.
166
 
func_dirname ()
167
 
{
168
 
    func_dirname_result=`$ECHO "${1}" | $SED "$dirname"`
169
 
    if test "X$func_dirname_result" = "X${1}"; then
170
 
      func_dirname_result="${3}"
171
 
    else
172
 
      func_dirname_result="$func_dirname_result${2}"
173
 
    fi
174
 
} # func_dirname may be replaced by extended shell implementation
175
 
 
176
 
 
177
 
# func_basename file
178
 
func_basename ()
179
 
{
180
 
    func_basename_result=`$ECHO "${1}" | $SED "$basename"`
181
 
} # func_basename may be replaced by extended shell implementation
182
 
 
183
 
 
184
 
# func_dirname_and_basename file append nondir_replacement
185
 
# perform func_basename and func_dirname in a single function
186
 
# call:
187
 
#   dirname:  Compute the dirname of FILE.  If nonempty,
188
 
#             add APPEND to the result, otherwise set result
189
 
#             to NONDIR_REPLACEMENT.
190
 
#             value returned in "$func_dirname_result"
191
 
#   basename: Compute filename of FILE.
192
 
#             value retuned in "$func_basename_result"
193
 
# Implementation must be kept synchronized with func_dirname
194
 
# and func_basename. For efficiency, we do not delegate to
195
 
# those functions but instead duplicate the functionality here.
196
 
func_dirname_and_basename ()
197
 
{
198
 
    # Extract subdirectory from the argument.
199
 
    func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"`
200
 
    if test "X$func_dirname_result" = "X${1}"; then
201
 
      func_dirname_result="${3}"
202
 
    else
203
 
      func_dirname_result="$func_dirname_result${2}"
204
 
    fi
205
 
    func_basename_result=`$ECHO "${1}" | $SED -e "$basename"`
206
 
} # func_dirname_and_basename may be replaced by extended shell implementation
207
 
 
208
 
 
209
 
# func_stripname prefix suffix name
210
 
# strip PREFIX and SUFFIX off of NAME.
211
 
# PREFIX and SUFFIX must not contain globbing or regex special
212
 
# characters, hashes, percent signs, but SUFFIX may contain a leading
213
 
# dot (in which case that matches only a dot).
214
 
# func_strip_suffix prefix name
215
 
func_stripname ()
216
 
{
217
 
    case ${2} in
218
 
      .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
219
 
      *)  func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
220
 
    esac
221
 
} # func_stripname may be replaced by extended shell implementation
222
 
 
223
 
 
224
 
# These SED scripts presuppose an absolute path with a trailing slash.
225
 
pathcar='s,^/\([^/]*\).*$,\1,'
226
 
pathcdr='s,^/[^/]*,,'
227
 
removedotparts=':dotsl
228
 
                s@/\./@/@g
229
 
                t dotsl
230
 
                s,/\.$,/,'
231
 
collapseslashes='s@/\{1,\}@/@g'
232
 
finalslash='s,/*$,/,'
233
 
 
234
 
# func_normal_abspath PATH
235
 
# Remove doubled-up and trailing slashes, "." path components,
236
 
# and cancel out any ".." path components in PATH after making
237
 
# it an absolute path.
238
 
#             value returned in "$func_normal_abspath_result"
239
 
func_normal_abspath ()
240
 
{
241
 
  # Start from root dir and reassemble the path.
242
 
  func_normal_abspath_result=
243
 
  func_normal_abspath_tpath=$1
244
 
  func_normal_abspath_altnamespace=
245
 
  case $func_normal_abspath_tpath in
246
 
    "")
247
 
      # Empty path, that just means $cwd.
248
 
      func_stripname '' '/' "`pwd`"
249
 
      func_normal_abspath_result=$func_stripname_result
250
 
      return
251
 
    ;;
252
 
    # The next three entries are used to spot a run of precisely
253
 
    # two leading slashes without using negated character classes;
254
 
    # we take advantage of case's first-match behaviour.
255
 
    ///*)
256
 
      # Unusual form of absolute path, do nothing.
257
 
    ;;
258
 
    //*)
259
 
      # Not necessarily an ordinary path; POSIX reserves leading '//'
260
 
      # and for example Cygwin uses it to access remote file shares
261
 
      # over CIFS/SMB, so we conserve a leading double slash if found.
262
 
      func_normal_abspath_altnamespace=/
263
 
    ;;
264
 
    /*)
265
 
      # Absolute path, do nothing.
266
 
    ;;
267
 
    *)
268
 
      # Relative path, prepend $cwd.
269
 
      func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
270
 
    ;;
271
 
  esac
272
 
  # Cancel out all the simple stuff to save iterations.  We also want
273
 
  # the path to end with a slash for ease of parsing, so make sure
274
 
  # there is one (and only one) here.
275
 
  func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
276
 
        -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
277
 
  while :; do
278
 
    # Processed it all yet?
279
 
    if test "$func_normal_abspath_tpath" = / ; then
280
 
      # If we ascended to the root using ".." the result may be empty now.
281
 
      if test -z "$func_normal_abspath_result" ; then
282
 
        func_normal_abspath_result=/
283
 
      fi
284
 
      break
285
 
    fi
286
 
    func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
287
 
        -e "$pathcar"`
288
 
    func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
289
 
        -e "$pathcdr"`
290
 
    # Figure out what to do with it
291
 
    case $func_normal_abspath_tcomponent in
292
 
      "")
293
 
        # Trailing empty path component, ignore it.
294
 
      ;;
295
 
      ..)
296
 
        # Parent dir; strip last assembled component from result.
297
 
        func_dirname "$func_normal_abspath_result"
298
 
        func_normal_abspath_result=$func_dirname_result
299
 
      ;;
300
 
      *)
301
 
        # Actual path component, append it.
302
 
        func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
303
 
      ;;
304
 
    esac
305
 
  done
306
 
  # Restore leading double-slash if one was found on entry.
307
 
  func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
308
 
}
309
 
 
310
 
# func_relative_path SRCDIR DSTDIR
311
 
# generates a relative path from SRCDIR to DSTDIR, with a trailing
312
 
# slash if non-empty, suitable for immediately appending a filename
313
 
# without needing to append a separator.
314
 
#             value returned in "$func_relative_path_result"
315
 
func_relative_path ()
316
 
{
317
 
  func_relative_path_result=
318
 
  func_normal_abspath "$1"
319
 
  func_relative_path_tlibdir=$func_normal_abspath_result
320
 
  func_normal_abspath "$2"
321
 
  func_relative_path_tbindir=$func_normal_abspath_result
322
 
 
323
 
  # Ascend the tree starting from libdir
324
 
  while :; do
325
 
    # check if we have found a prefix of bindir
326
 
    case $func_relative_path_tbindir in
327
 
      $func_relative_path_tlibdir)
328
 
        # found an exact match
329
 
        func_relative_path_tcancelled=
330
 
        break
331
 
        ;;
332
 
      $func_relative_path_tlibdir*)
333
 
        # found a matching prefix
334
 
        func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
335
 
        func_relative_path_tcancelled=$func_stripname_result
336
 
        if test -z "$func_relative_path_result"; then
337
 
          func_relative_path_result=.
338
 
        fi
339
 
        break
340
 
        ;;
341
 
      *)
342
 
        func_dirname $func_relative_path_tlibdir
343
 
        func_relative_path_tlibdir=${func_dirname_result}
344
 
        if test "x$func_relative_path_tlibdir" = x ; then
345
 
          # Have to descend all the way to the root!
346
 
          func_relative_path_result=../$func_relative_path_result
347
 
          func_relative_path_tcancelled=$func_relative_path_tbindir
348
 
          break
349
 
        fi
350
 
        func_relative_path_result=../$func_relative_path_result
351
 
        ;;
352
 
    esac
353
 
  done
354
 
 
355
 
  # Now calculate path; take care to avoid doubling-up slashes.
356
 
  func_stripname '' '/' "$func_relative_path_result"
357
 
  func_relative_path_result=$func_stripname_result
358
 
  func_stripname '/' '/' "$func_relative_path_tcancelled"
359
 
  if test "x$func_stripname_result" != x ; then
360
 
    func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
361
 
  fi
362
 
 
363
 
  # Normalisation. If bindir is libdir, return empty string,
364
 
  # else relative path ending with a slash; either way, target
365
 
  # file name can be directly appended.
366
 
  if test ! -z "$func_relative_path_result"; then
367
 
    func_stripname './' '' "$func_relative_path_result/"
368
 
    func_relative_path_result=$func_stripname_result
369
 
  fi
370
 
}
371
 
 
372
 
# The name of this program:
373
 
func_dirname_and_basename "$progpath"
374
 
progname=$func_basename_result
375
 
 
376
 
# Make sure we have an absolute path for reexecution:
 
403
# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
 
404
# is ksh but when the shell is invoked as "sh" and the current value of
 
405
# the _XPG environment variable is not equal to 1 (one), the special
 
406
# positional parameter $0, within a function call, is the name of the
 
407
# function.
 
408
progpath=$0
 
409
 
 
410
# The name of this program.
 
411
progname=`$ECHO "$progpath" |$SED "$sed_basename"`
 
412
 
 
413
# Make sure we have an absolute progpath for reexecution:
377
414
case $progpath in
378
415
  [\\/]*|[A-Za-z]:\\*) ;;
379
416
  *[\\/]*)
380
 
     progdir=$func_dirname_result
 
417
     progdir=`$ECHO "$progpath" |$SED "$sed_dirname"`
381
418
     progdir=`cd "$progdir" && pwd`
382
 
     progpath="$progdir/$progname"
 
419
     progpath=$progdir/$progname
383
420
     ;;
384
421
  *)
385
 
     save_IFS="$IFS"
 
422
     _G_IFS=$IFS
386
423
     IFS=${PATH_SEPARATOR-:}
387
424
     for progdir in $PATH; do
388
 
       IFS="$save_IFS"
 
425
       IFS=$_G_IFS
389
426
       test -x "$progdir/$progname" && break
390
427
     done
391
 
     IFS="$save_IFS"
 
428
     IFS=$_G_IFS
392
429
     test -n "$progdir" || progdir=`pwd`
393
 
     progpath="$progdir/$progname"
 
430
     progpath=$progdir/$progname
394
431
     ;;
395
432
esac
396
433
 
397
 
# Sed substitution that helps us do robust quoting.  It backslashifies
398
 
# metacharacters that are still active within double-quoted strings.
399
 
Xsed="${SED}"' -e 1s/^X//'
400
 
sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
401
 
 
402
 
# Same as above, but do not quote variable references.
403
 
double_quote_subst='s/\(["`\\]\)/\\\1/g'
404
 
 
405
 
# Sed substitution that turns a string into a regex matching for the
406
 
# string literally.
407
 
sed_make_literal_regex='s,[].[^$\\*\/],\\&,g'
408
 
 
409
 
# Sed substitution that converts a w32 file name or path
410
 
# which contains forward slashes, into one that contains
411
 
# (escaped) backslashes.  A very naive implementation.
412
 
lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
413
 
 
414
 
# Re-`\' parameter expansions in output of double_quote_subst that were
415
 
# `\'-ed in input to the same.  If an odd number of `\' preceded a '$'
416
 
# in input to double_quote_subst, that '$' was protected from expansion.
417
 
# Since each input `\' is now two `\'s, look for any number of runs of
418
 
# four `\'s followed by two `\'s and then a '$'.  `\' that '$'.
419
 
bs='\\'
420
 
bs2='\\\\'
421
 
bs4='\\\\\\\\'
422
 
dollar='\$'
423
 
sed_double_backslash="\
424
 
  s/$bs4/&\\
425
 
/g
426
 
  s/^$bs2$dollar/$bs&/
427
 
  s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
428
 
  s/\n//g"
429
 
 
430
 
# Standard options:
 
434
 
 
435
## ----------------- ##
 
436
## Standard options. ##
 
437
## ----------------- ##
 
438
 
 
439
# The following options affect the operation of the functions defined
 
440
# below, and should be set appropriately depending on run-time para-
 
441
# meters passed on the command line.
 
442
 
431
443
opt_dry_run=false
432
 
opt_help=false
433
444
opt_quiet=false
434
445
opt_verbose=false
435
 
opt_warning=:
436
 
 
437
 
# func_echo arg...
438
 
# Echo program name prefixed message, along with the current mode
439
 
# name if it has been set yet.
 
446
 
 
447
# Categories 'all' and 'none' are always available.  Append any others
 
448
# you will pass as the first argument to func_warning from your own
 
449
# code.
 
450
warning_categories=
 
451
 
 
452
# By default, display warnings according to 'opt_warning_types'.  Set
 
453
# 'warning_func'  to ':' to elide all warnings, or func_fatal_error to
 
454
# treat the next displayed warning as a fatal error.
 
455
warning_func=func_warn_and_continue
 
456
 
 
457
# Set to 'all' to display all warnings, 'none' to suppress all
 
458
# warnings, or a space delimited list of some subset of
 
459
# 'warning_categories' to display only the listed warnings.
 
460
opt_warning_types=all
 
461
 
 
462
 
 
463
## -------------------- ##
 
464
## Resource management. ##
 
465
## -------------------- ##
 
466
 
 
467
# This section contains definitions for functions that each ensure a
 
468
# particular resource (a file, or a non-empty configuration variable for
 
469
# example) is available, and if appropriate to extract default values
 
470
# from pertinent package files. Call them using their associated
 
471
# 'require_*' variable to ensure that they are executed, at most, once.
 
472
#
 
473
# It's entirely deliberate that calling these functions can set
 
474
# variables that don't obey the namespace limitations obeyed by the rest
 
475
# of this file, in order that that they be as useful as possible to
 
476
# callers.
 
477
 
 
478
 
 
479
# require_term_colors
 
480
# -------------------
 
481
# Allow display of bold text on terminals that support it.
 
482
require_term_colors=func_require_term_colors
 
483
func_require_term_colors ()
 
484
{
 
485
    $debug_cmd
 
486
 
 
487
    test -t 1 && {
 
488
      # COLORTERM and USE_ANSI_COLORS environment variables take
 
489
      # precedence, because most terminfo databases neglect to describe
 
490
      # whether color sequences are supported.
 
491
      test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"}
 
492
 
 
493
      if test 1 = "$USE_ANSI_COLORS"; then
 
494
        # Standard ANSI escape sequences
 
495
        tc_reset=''
 
496
        tc_bold='';   tc_standout=''
 
497
        tc_red='';   tc_green=''
 
498
        tc_blue='';  tc_cyan=''
 
499
      else
 
500
        # Otherwise trust the terminfo database after all.
 
501
        test -n "`tput sgr0 2>/dev/null`" && {
 
502
          tc_reset=`tput sgr0`
 
503
          test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold`
 
504
          tc_standout=$tc_bold
 
505
          test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso`
 
506
          test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1`
 
507
          test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2`
 
508
          test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4`
 
509
          test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5`
 
510
        }
 
511
      fi
 
512
    }
 
513
 
 
514
    require_term_colors=:
 
515
}
 
516
 
 
517
 
 
518
## ----------------- ##
 
519
## Function library. ##
 
520
## ----------------- ##
 
521
 
 
522
# This section contains a variety of useful functions to call in your
 
523
# scripts. Take note of the portable wrappers for features provided by
 
524
# some modern shells, which will fall back to slower equivalents on
 
525
# less featureful shells.
 
526
 
 
527
 
 
528
# func_append VAR VALUE
 
529
# ---------------------
 
530
# Append VALUE onto the existing contents of VAR.
 
531
 
 
532
  # We should try to minimise forks, especially on Windows where they are
 
533
  # unreasonably slow, so skip the feature probes when bash or zsh are
 
534
  # being used:
 
535
  if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then
 
536
    : ${_G_HAVE_ARITH_OP="yes"}
 
537
    : ${_G_HAVE_XSI_OPS="yes"}
 
538
    # The += operator was introduced in bash 3.1
 
539
    case $BASH_VERSION in
 
540
      [12].* | 3.0 | 3.0*) ;;
 
541
      *)
 
542
        : ${_G_HAVE_PLUSEQ_OP="yes"}
 
543
        ;;
 
544
    esac
 
545
  fi
 
546
 
 
547
  # _G_HAVE_PLUSEQ_OP
 
548
  # Can be empty, in which case the shell is probed, "yes" if += is
 
549
  # useable or anything else if it does not work.
 
550
  test -z "$_G_HAVE_PLUSEQ_OP" \
 
551
    && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \
 
552
    && _G_HAVE_PLUSEQ_OP=yes
 
553
 
 
554
if test yes = "$_G_HAVE_PLUSEQ_OP"
 
555
then
 
556
  # This is an XSI compatible shell, allowing a faster implementation...
 
557
  eval 'func_append ()
 
558
  {
 
559
    $debug_cmd
 
560
 
 
561
    eval "$1+=\$2"
 
562
  }'
 
563
else
 
564
  # ...otherwise fall back to using expr, which is often a shell builtin.
 
565
  func_append ()
 
566
  {
 
567
    $debug_cmd
 
568
 
 
569
    eval "$1=\$$1\$2"
 
570
  }
 
571
fi
 
572
 
 
573
 
 
574
# func_append_quoted VAR VALUE
 
575
# ----------------------------
 
576
# Quote VALUE and append to the end of shell variable VAR, separated
 
577
# by a space.
 
578
if test yes = "$_G_HAVE_PLUSEQ_OP"; then
 
579
  eval 'func_append_quoted ()
 
580
  {
 
581
    $debug_cmd
 
582
 
 
583
    func_quote_for_eval "$2"
 
584
    eval "$1+=\\ \$func_quote_for_eval_result"
 
585
  }'
 
586
else
 
587
  func_append_quoted ()
 
588
  {
 
589
    $debug_cmd
 
590
 
 
591
    func_quote_for_eval "$2"
 
592
    eval "$1=\$$1\\ \$func_quote_for_eval_result"
 
593
  }
 
594
fi
 
595
 
 
596
 
 
597
# func_append_uniq VAR VALUE
 
598
# --------------------------
 
599
# Append unique VALUE onto the existing contents of VAR, assuming
 
600
# entries are delimited by the first character of VALUE.  For example:
 
601
#
 
602
#   func_append_uniq options " --another-option option-argument"
 
603
#
 
604
# will only append to $options if " --another-option option-argument "
 
605
# is not already present somewhere in $options already (note spaces at
 
606
# each end implied by leading space in second argument).
 
607
func_append_uniq ()
 
608
{
 
609
    $debug_cmd
 
610
 
 
611
    eval _G_current_value='`$ECHO $'$1'`'
 
612
    _G_delim=`expr "$2" : '\(.\)'`
 
613
 
 
614
    case $_G_delim$_G_current_value$_G_delim in
 
615
      *"$2$_G_delim"*) ;;
 
616
      *) func_append "$@" ;;
 
617
    esac
 
618
}
 
619
 
 
620
 
 
621
# func_arith TERM...
 
622
# ------------------
 
623
# Set func_arith_result to the result of evaluating TERMs.
 
624
  test -z "$_G_HAVE_ARITH_OP" \
 
625
    && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \
 
626
    && _G_HAVE_ARITH_OP=yes
 
627
 
 
628
if test yes = "$_G_HAVE_ARITH_OP"; then
 
629
  eval 'func_arith ()
 
630
  {
 
631
    $debug_cmd
 
632
 
 
633
    func_arith_result=$(( $* ))
 
634
  }'
 
635
else
 
636
  func_arith ()
 
637
  {
 
638
    $debug_cmd
 
639
 
 
640
    func_arith_result=`expr "$@"`
 
641
  }
 
642
fi
 
643
 
 
644
 
 
645
# func_basename FILE
 
646
# ------------------
 
647
# Set func_basename_result to FILE with everything up to and including
 
648
# the last / stripped.
 
649
if test yes = "$_G_HAVE_XSI_OPS"; then
 
650
  # If this shell supports suffix pattern removal, then use it to avoid
 
651
  # forking. Hide the definitions single quotes in case the shell chokes
 
652
  # on unsupported syntax...
 
653
  _b='func_basename_result=${1##*/}'
 
654
  _d='case $1 in
 
655
        */*) func_dirname_result=${1%/*}$2 ;;
 
656
        *  ) func_dirname_result=$3        ;;
 
657
      esac'
 
658
 
 
659
else
 
660
  # ...otherwise fall back to using sed.
 
661
  _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`'
 
662
  _d='func_dirname_result=`$ECHO "$1"  |$SED "$sed_dirname"`
 
663
      if test "X$func_dirname_result" = "X$1"; then
 
664
        func_dirname_result=$3
 
665
      else
 
666
        func_append func_dirname_result "$2"
 
667
      fi'
 
668
fi
 
669
 
 
670
eval 'func_basename ()
 
671
{
 
672
    $debug_cmd
 
673
 
 
674
    '"$_b"'
 
675
}'
 
676
 
 
677
 
 
678
# func_dirname FILE APPEND NONDIR_REPLACEMENT
 
679
# -------------------------------------------
 
680
# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
 
681
# otherwise set result to NONDIR_REPLACEMENT.
 
682
eval 'func_dirname ()
 
683
{
 
684
    $debug_cmd
 
685
 
 
686
    '"$_d"'
 
687
}'
 
688
 
 
689
 
 
690
# func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT
 
691
# --------------------------------------------------------
 
692
# Perform func_basename and func_dirname in a single function
 
693
# call:
 
694
#   dirname:  Compute the dirname of FILE.  If nonempty,
 
695
#             add APPEND to the result, otherwise set result
 
696
#             to NONDIR_REPLACEMENT.
 
697
#             value returned in "$func_dirname_result"
 
698
#   basename: Compute filename of FILE.
 
699
#             value retuned in "$func_basename_result"
 
700
# For efficiency, we do not delegate to the functions above but instead
 
701
# duplicate the functionality here.
 
702
eval 'func_dirname_and_basename ()
 
703
{
 
704
    $debug_cmd
 
705
 
 
706
    '"$_b"'
 
707
    '"$_d"'
 
708
}'
 
709
 
 
710
 
 
711
# func_echo ARG...
 
712
# ----------------
 
713
# Echo program name prefixed message.
440
714
func_echo ()
441
715
{
442
 
    $ECHO "$progname: ${opt_mode+$opt_mode: }$*"
443
 
}
444
 
 
445
 
# func_verbose arg...
446
 
# Echo program name prefixed message in verbose mode only.
447
 
func_verbose ()
448
 
{
449
 
    $opt_verbose && func_echo ${1+"$@"}
450
 
 
451
 
    # A bug in bash halts the script if the last line of a function
452
 
    # fails when set -e is in force, so we need another command to
453
 
    # work around that:
454
 
    :
455
 
}
456
 
 
457
 
# func_echo_all arg...
 
716
    $debug_cmd
 
717
 
 
718
    _G_message=$*
 
719
 
 
720
    func_echo_IFS=$IFS
 
721
    IFS=$nl
 
722
    for _G_line in $_G_message; do
 
723
      IFS=$func_echo_IFS
 
724
      $ECHO "$progname: $_G_line"
 
725
    done
 
726
    IFS=$func_echo_IFS
 
727
}
 
728
 
 
729
 
 
730
# func_echo_all ARG...
 
731
# --------------------
458
732
# Invoke $ECHO with all args, space-separated.
459
733
func_echo_all ()
460
734
{
461
735
    $ECHO "$*"
462
736
}
463
737
 
464
 
# func_error arg...
 
738
 
 
739
# func_echo_infix_1 INFIX ARG...
 
740
# ------------------------------
 
741
# Echo program name, followed by INFIX on the first line, with any
 
742
# additional lines not showing INFIX.
 
743
func_echo_infix_1 ()
 
744
{
 
745
    $debug_cmd
 
746
 
 
747
    $require_term_colors
 
748
 
 
749
    _G_infix=$1; shift
 
750
    _G_indent=$_G_infix
 
751
    _G_prefix="$progname: $_G_infix: "
 
752
    _G_message=$*
 
753
 
 
754
    # Strip color escape sequences before counting printable length
 
755
    for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan"
 
756
    do
 
757
      test -n "$_G_tc" && {
 
758
        _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"`
 
759
        _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"`
 
760
      }
 
761
    done
 
762
    _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`"  " ## exclude from sc_prohibit_nested_quotes
 
763
 
 
764
    func_echo_infix_1_IFS=$IFS
 
765
    IFS=$nl
 
766
    for _G_line in $_G_message; do
 
767
      IFS=$func_echo_infix_1_IFS
 
768
      $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2
 
769
      _G_prefix=$_G_indent
 
770
    done
 
771
    IFS=$func_echo_infix_1_IFS
 
772
}
 
773
 
 
774
 
 
775
# func_error ARG...
 
776
# -----------------
465
777
# Echo program name prefixed message to standard error.
466
778
func_error ()
467
779
{
468
 
    $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2
469
 
}
470
 
 
471
 
# func_warning arg...
472
 
# Echo program name prefixed warning message to standard error.
473
 
func_warning ()
474
 
{
475
 
    $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2
476
 
 
477
 
    # bash bug again:
478
 
    :
479
 
}
480
 
 
481
 
# func_fatal_error arg...
 
780
    $debug_cmd
 
781
 
 
782
    $require_term_colors
 
783
 
 
784
    func_echo_infix_1 "  $tc_standout${tc_red}error$tc_reset" "$*" >&2
 
785
}
 
786
 
 
787
 
 
788
# func_fatal_error ARG...
 
789
# -----------------------
482
790
# Echo program name prefixed message to standard error, and exit.
483
791
func_fatal_error ()
484
792
{
485
 
    func_error ${1+"$@"}
 
793
    $debug_cmd
 
794
 
 
795
    func_error "$*"
486
796
    exit $EXIT_FAILURE
487
797
}
488
798
 
489
 
# func_fatal_help arg...
490
 
# Echo program name prefixed message to standard error, followed by
491
 
# a help hint, and exit.
492
 
func_fatal_help ()
493
 
{
494
 
    func_error ${1+"$@"}
495
 
    func_fatal_error "$help"
496
 
}
497
 
help="Try \`$progname --help' for more information."  ## default
498
 
 
499
 
 
500
 
# func_grep expression filename
 
799
 
 
800
# func_grep EXPRESSION FILENAME
 
801
# -----------------------------
501
802
# Check whether EXPRESSION matches any line of FILENAME, without output.
502
803
func_grep ()
503
804
{
 
805
    $debug_cmd
 
806
 
504
807
    $GREP "$1" "$2" >/dev/null 2>&1
505
808
}
506
809
 
507
810
 
508
 
# func_mkdir_p directory-path
 
811
# func_len STRING
 
812
# ---------------
 
813
# Set func_len_result to the length of STRING. STRING may not
 
814
# start with a hyphen.
 
815
  test -z "$_G_HAVE_XSI_OPS" \
 
816
    && (eval 'x=a/b/c;
 
817
      test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
 
818
    && _G_HAVE_XSI_OPS=yes
 
819
 
 
820
if test yes = "$_G_HAVE_XSI_OPS"; then
 
821
  eval 'func_len ()
 
822
  {
 
823
    $debug_cmd
 
824
 
 
825
    func_len_result=${#1}
 
826
  }'
 
827
else
 
828
  func_len ()
 
829
  {
 
830
    $debug_cmd
 
831
 
 
832
    func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len`
 
833
  }
 
834
fi
 
835
 
 
836
 
 
837
# func_mkdir_p DIRECTORY-PATH
 
838
# ---------------------------
509
839
# Make sure the entire path to DIRECTORY-PATH is available.
510
840
func_mkdir_p ()
511
841
{
512
 
    my_directory_path="$1"
513
 
    my_dir_list=
514
 
 
515
 
    if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
516
 
 
517
 
      # Protect directory names starting with `-'
518
 
      case $my_directory_path in
519
 
        -*) my_directory_path="./$my_directory_path" ;;
 
842
    $debug_cmd
 
843
 
 
844
    _G_directory_path=$1
 
845
    _G_dir_list=
 
846
 
 
847
    if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then
 
848
 
 
849
      # Protect directory names starting with '-'
 
850
      case $_G_directory_path in
 
851
        -*) _G_directory_path=./$_G_directory_path ;;
520
852
      esac
521
853
 
522
854
      # While some portion of DIR does not yet exist...
523
 
      while test ! -d "$my_directory_path"; do
 
855
      while test ! -d "$_G_directory_path"; do
524
856
        # ...make a list in topmost first order.  Use a colon delimited
525
857
        # list incase some portion of path contains whitespace.
526
 
        my_dir_list="$my_directory_path:$my_dir_list"
 
858
        _G_dir_list=$_G_directory_path:$_G_dir_list
527
859
 
528
860
        # If the last portion added has no slash in it, the list is done
529
 
        case $my_directory_path in */*) ;; *) break ;; esac
 
861
        case $_G_directory_path in */*) ;; *) break ;; esac
530
862
 
531
863
        # ...otherwise throw away the child directory and loop
532
 
        my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"`
 
864
        _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"`
533
865
      done
534
 
      my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'`
 
866
      _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'`
535
867
 
536
 
      save_mkdir_p_IFS="$IFS"; IFS=':'
537
 
      for my_dir in $my_dir_list; do
538
 
        IFS="$save_mkdir_p_IFS"
539
 
        # mkdir can fail with a `File exist' error if two processes
 
868
      func_mkdir_p_IFS=$IFS; IFS=:
 
869
      for _G_dir in $_G_dir_list; do
 
870
        IFS=$func_mkdir_p_IFS
 
871
        # mkdir can fail with a 'File exist' error if two processes
540
872
        # try to create one of the directories concurrently.  Don't
541
873
        # stop in that case!
542
 
        $MKDIR "$my_dir" 2>/dev/null || :
 
874
        $MKDIR "$_G_dir" 2>/dev/null || :
543
875
      done
544
 
      IFS="$save_mkdir_p_IFS"
 
876
      IFS=$func_mkdir_p_IFS
545
877
 
546
878
      # Bail out if we (or some other process) failed to create a directory.
547
 
      test -d "$my_directory_path" || \
548
 
        func_fatal_error "Failed to create \`$1'"
 
879
      test -d "$_G_directory_path" || \
 
880
        func_fatal_error "Failed to create '$1'"
549
881
    fi
550
882
}
551
883
 
552
884
 
553
 
# func_mktempdir [string]
 
885
# func_mktempdir [BASENAME]
 
886
# -------------------------
554
887
# Make a temporary directory that won't clash with other running
555
888
# libtool processes, and avoids race conditions if possible.  If
556
 
# given, STRING is the basename for that directory.
 
889
# given, BASENAME is the basename for that directory.
557
890
func_mktempdir ()
558
891
{
559
 
    my_template="${TMPDIR-/tmp}/${1-$progname}"
560
 
 
561
 
    if test "$opt_dry_run" = ":"; then
 
892
    $debug_cmd
 
893
 
 
894
    _G_template=${TMPDIR-/tmp}/${1-$progname}
 
895
 
 
896
    if test : = "$opt_dry_run"; then
562
897
      # Return a directory name, but don't create it in dry-run mode
563
 
      my_tmpdir="${my_template}-$$"
 
898
      _G_tmpdir=$_G_template-$$
564
899
    else
565
900
 
566
901
      # If mktemp works, use that first and foremost
567
 
      my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
 
902
      _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null`
568
903
 
569
 
      if test ! -d "$my_tmpdir"; then
 
904
      if test ! -d "$_G_tmpdir"; then
570
905
        # Failing that, at least try and use $RANDOM to avoid a race
571
 
        my_tmpdir="${my_template}-${RANDOM-0}$$"
 
906
        _G_tmpdir=$_G_template-${RANDOM-0}$$
572
907
 
573
 
        save_mktempdir_umask=`umask`
 
908
        func_mktempdir_umask=`umask`
574
909
        umask 0077
575
 
        $MKDIR "$my_tmpdir"
576
 
        umask $save_mktempdir_umask
 
910
        $MKDIR "$_G_tmpdir"
 
911
        umask $func_mktempdir_umask
577
912
      fi
578
913
 
579
914
      # If we're not in dry-run mode, bomb out on failure
580
 
      test -d "$my_tmpdir" || \
581
 
        func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
582
 
    fi
583
 
 
584
 
    $ECHO "$my_tmpdir"
585
 
}
586
 
 
587
 
 
588
 
# func_quote_for_eval arg
589
 
# Aesthetically quote ARG to be evaled later.
590
 
# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
591
 
# is double-quoted, suitable for a subsequent eval, whereas
592
 
# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
593
 
# which are still active within double quotes backslashified.
 
915
      test -d "$_G_tmpdir" || \
 
916
        func_fatal_error "cannot create temporary directory '$_G_tmpdir'"
 
917
    fi
 
918
 
 
919
    $ECHO "$_G_tmpdir"
 
920
}
 
921
 
 
922
 
 
923
# func_normal_abspath PATH
 
924
# ------------------------
 
925
# Remove doubled-up and trailing slashes, "." path components,
 
926
# and cancel out any ".." path components in PATH after making
 
927
# it an absolute path.
 
928
func_normal_abspath ()
 
929
{
 
930
    $debug_cmd
 
931
 
 
932
    # These SED scripts presuppose an absolute path with a trailing slash.
 
933
    _G_pathcar='s|^/\([^/]*\).*$|\1|'
 
934
    _G_pathcdr='s|^/[^/]*||'
 
935
    _G_removedotparts=':dotsl
 
936
                s|/\./|/|g
 
937
                t dotsl
 
938
                s|/\.$|/|'
 
939
    _G_collapseslashes='s|/\{1,\}|/|g'
 
940
    _G_finalslash='s|/*$|/|'
 
941
 
 
942
    # Start from root dir and reassemble the path.
 
943
    func_normal_abspath_result=
 
944
    func_normal_abspath_tpath=$1
 
945
    func_normal_abspath_altnamespace=
 
946
    case $func_normal_abspath_tpath in
 
947
      "")
 
948
        # Empty path, that just means $cwd.
 
949
        func_stripname '' '/' "`pwd`"
 
950
        func_normal_abspath_result=$func_stripname_result
 
951
        return
 
952
        ;;
 
953
      # The next three entries are used to spot a run of precisely
 
954
      # two leading slashes without using negated character classes;
 
955
      # we take advantage of case's first-match behaviour.
 
956
      ///*)
 
957
        # Unusual form of absolute path, do nothing.
 
958
        ;;
 
959
      //*)
 
960
        # Not necessarily an ordinary path; POSIX reserves leading '//'
 
961
        # and for example Cygwin uses it to access remote file shares
 
962
        # over CIFS/SMB, so we conserve a leading double slash if found.
 
963
        func_normal_abspath_altnamespace=/
 
964
        ;;
 
965
      /*)
 
966
        # Absolute path, do nothing.
 
967
        ;;
 
968
      *)
 
969
        # Relative path, prepend $cwd.
 
970
        func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
 
971
        ;;
 
972
    esac
 
973
 
 
974
    # Cancel out all the simple stuff to save iterations.  We also want
 
975
    # the path to end with a slash for ease of parsing, so make sure
 
976
    # there is one (and only one) here.
 
977
    func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
 
978
          -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"`
 
979
    while :; do
 
980
      # Processed it all yet?
 
981
      if test / = "$func_normal_abspath_tpath"; then
 
982
        # If we ascended to the root using ".." the result may be empty now.
 
983
        if test -z "$func_normal_abspath_result"; then
 
984
          func_normal_abspath_result=/
 
985
        fi
 
986
        break
 
987
      fi
 
988
      func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
 
989
          -e "$_G_pathcar"`
 
990
      func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
 
991
          -e "$_G_pathcdr"`
 
992
      # Figure out what to do with it
 
993
      case $func_normal_abspath_tcomponent in
 
994
        "")
 
995
          # Trailing empty path component, ignore it.
 
996
          ;;
 
997
        ..)
 
998
          # Parent dir; strip last assembled component from result.
 
999
          func_dirname "$func_normal_abspath_result"
 
1000
          func_normal_abspath_result=$func_dirname_result
 
1001
          ;;
 
1002
        *)
 
1003
          # Actual path component, append it.
 
1004
          func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent"
 
1005
          ;;
 
1006
      esac
 
1007
    done
 
1008
    # Restore leading double-slash if one was found on entry.
 
1009
    func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
 
1010
}
 
1011
 
 
1012
 
 
1013
# func_notquiet ARG...
 
1014
# --------------------
 
1015
# Echo program name prefixed message only when not in quiet mode.
 
1016
func_notquiet ()
 
1017
{
 
1018
    $debug_cmd
 
1019
 
 
1020
    $opt_quiet || func_echo ${1+"$@"}
 
1021
 
 
1022
    # A bug in bash halts the script if the last line of a function
 
1023
    # fails when set -e is in force, so we need another command to
 
1024
    # work around that:
 
1025
    :
 
1026
}
 
1027
 
 
1028
 
 
1029
# func_relative_path SRCDIR DSTDIR
 
1030
# --------------------------------
 
1031
# Set func_relative_path_result to the relative path from SRCDIR to DSTDIR.
 
1032
func_relative_path ()
 
1033
{
 
1034
    $debug_cmd
 
1035
 
 
1036
    func_relative_path_result=
 
1037
    func_normal_abspath "$1"
 
1038
    func_relative_path_tlibdir=$func_normal_abspath_result
 
1039
    func_normal_abspath "$2"
 
1040
    func_relative_path_tbindir=$func_normal_abspath_result
 
1041
 
 
1042
    # Ascend the tree starting from libdir
 
1043
    while :; do
 
1044
      # check if we have found a prefix of bindir
 
1045
      case $func_relative_path_tbindir in
 
1046
        $func_relative_path_tlibdir)
 
1047
          # found an exact match
 
1048
          func_relative_path_tcancelled=
 
1049
          break
 
1050
          ;;
 
1051
        $func_relative_path_tlibdir*)
 
1052
          # found a matching prefix
 
1053
          func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
 
1054
          func_relative_path_tcancelled=$func_stripname_result
 
1055
          if test -z "$func_relative_path_result"; then
 
1056
            func_relative_path_result=.
 
1057
          fi
 
1058
          break
 
1059
          ;;
 
1060
        *)
 
1061
          func_dirname $func_relative_path_tlibdir
 
1062
          func_relative_path_tlibdir=$func_dirname_result
 
1063
          if test -z "$func_relative_path_tlibdir"; then
 
1064
            # Have to descend all the way to the root!
 
1065
            func_relative_path_result=../$func_relative_path_result
 
1066
            func_relative_path_tcancelled=$func_relative_path_tbindir
 
1067
            break
 
1068
          fi
 
1069
          func_relative_path_result=../$func_relative_path_result
 
1070
          ;;
 
1071
      esac
 
1072
    done
 
1073
 
 
1074
    # Now calculate path; take care to avoid doubling-up slashes.
 
1075
    func_stripname '' '/' "$func_relative_path_result"
 
1076
    func_relative_path_result=$func_stripname_result
 
1077
    func_stripname '/' '/' "$func_relative_path_tcancelled"
 
1078
    if test -n "$func_stripname_result"; then
 
1079
      func_append func_relative_path_result "/$func_stripname_result"
 
1080
    fi
 
1081
 
 
1082
    # Normalisation. If bindir is libdir, return '.' else relative path.
 
1083
    if test -n "$func_relative_path_result"; then
 
1084
      func_stripname './' '' "$func_relative_path_result"
 
1085
      func_relative_path_result=$func_stripname_result
 
1086
    fi
 
1087
 
 
1088
    test -n "$func_relative_path_result" || func_relative_path_result=.
 
1089
 
 
1090
    :
 
1091
}
 
1092
 
 
1093
 
 
1094
# func_quote_for_eval ARG...
 
1095
# --------------------------
 
1096
# Aesthetically quote ARGs to be evaled later.
 
1097
# This function returns two values:
 
1098
#   i) func_quote_for_eval_result
 
1099
#      double-quoted, suitable for a subsequent eval
 
1100
#  ii) func_quote_for_eval_unquoted_result
 
1101
#      has all characters that are still active within double
 
1102
#      quotes backslashified.
594
1103
func_quote_for_eval ()
595
1104
{
596
 
    case $1 in
597
 
      *[\\\`\"\$]*)
598
 
        func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;;
599
 
      *)
600
 
        func_quote_for_eval_unquoted_result="$1" ;;
601
 
    esac
602
 
 
603
 
    case $func_quote_for_eval_unquoted_result in
604
 
      # Double-quote args containing shell metacharacters to delay
605
 
      # word splitting, command substitution and and variable
606
 
      # expansion for a subsequent eval.
607
 
      # Many Bourne shells cannot handle close brackets correctly
608
 
      # in scan sets, so we specify it separately.
609
 
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
610
 
        func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
611
 
        ;;
612
 
      *)
613
 
        func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
614
 
    esac
 
1105
    $debug_cmd
 
1106
 
 
1107
    func_quote_for_eval_unquoted_result=
 
1108
    func_quote_for_eval_result=
 
1109
    while test 0 -lt $#; do
 
1110
      case $1 in
 
1111
        *[\\\`\"\$]*)
 
1112
          _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;;
 
1113
        *)
 
1114
          _G_unquoted_arg=$1 ;;
 
1115
      esac
 
1116
      if test -n "$func_quote_for_eval_unquoted_result"; then
 
1117
        func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg"
 
1118
      else
 
1119
        func_append func_quote_for_eval_unquoted_result "$_G_unquoted_arg"
 
1120
      fi
 
1121
 
 
1122
      case $_G_unquoted_arg in
 
1123
        # Double-quote args containing shell metacharacters to delay
 
1124
        # word splitting, command substitution and variable expansion
 
1125
        # for a subsequent eval.
 
1126
        # Many Bourne shells cannot handle close brackets correctly
 
1127
        # in scan sets, so we specify it separately.
 
1128
        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
 
1129
          _G_quoted_arg=\"$_G_unquoted_arg\"
 
1130
          ;;
 
1131
        *)
 
1132
          _G_quoted_arg=$_G_unquoted_arg
 
1133
          ;;
 
1134
      esac
 
1135
 
 
1136
      if test -n "$func_quote_for_eval_result"; then
 
1137
        func_append func_quote_for_eval_result " $_G_quoted_arg"
 
1138
      else
 
1139
        func_append func_quote_for_eval_result "$_G_quoted_arg"
 
1140
      fi
 
1141
      shift
 
1142
    done
615
1143
}
616
1144
 
617
1145
 
618
 
# func_quote_for_expand arg
 
1146
# func_quote_for_expand ARG
 
1147
# -------------------------
619
1148
# Aesthetically quote ARG to be evaled later; same as above,
620
1149
# but do not quote variable references.
621
1150
func_quote_for_expand ()
622
1151
{
 
1152
    $debug_cmd
 
1153
 
623
1154
    case $1 in
624
1155
      *[\\\`\"]*)
625
 
        my_arg=`$ECHO "$1" | $SED \
626
 
            -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
 
1156
        _G_arg=`$ECHO "$1" | $SED \
 
1157
            -e "$sed_double_quote_subst" -e "$sed_double_backslash"` ;;
627
1158
      *)
628
 
        my_arg="$1" ;;
 
1159
        _G_arg=$1 ;;
629
1160
    esac
630
1161
 
631
 
    case $my_arg in
 
1162
    case $_G_arg in
632
1163
      # Double-quote args containing shell metacharacters to delay
633
1164
      # word splitting and command substitution for a subsequent eval.
634
1165
      # Many Bourne shells cannot handle close brackets correctly
635
1166
      # in scan sets, so we specify it separately.
636
1167
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
637
 
        my_arg="\"$my_arg\""
 
1168
        _G_arg=\"$_G_arg\"
638
1169
        ;;
639
1170
    esac
640
1171
 
641
 
    func_quote_for_expand_result="$my_arg"
 
1172
    func_quote_for_expand_result=$_G_arg
642
1173
}
643
1174
 
644
1175
 
645
 
# func_show_eval cmd [fail_exp]
646
 
# Unless opt_silent is true, then output CMD.  Then, if opt_dryrun is
 
1176
# func_stripname PREFIX SUFFIX NAME
 
1177
# ---------------------------------
 
1178
# strip PREFIX and SUFFIX from NAME, and store in func_stripname_result.
 
1179
# PREFIX and SUFFIX must not contain globbing or regex special
 
1180
# characters, hashes, percent signs, but SUFFIX may contain a leading
 
1181
# dot (in which case that matches only a dot).
 
1182
if test yes = "$_G_HAVE_XSI_OPS"; then
 
1183
  eval 'func_stripname ()
 
1184
  {
 
1185
    $debug_cmd
 
1186
 
 
1187
    # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
 
1188
    # positional parameters, so assign one to ordinary variable first.
 
1189
    func_stripname_result=$3
 
1190
    func_stripname_result=${func_stripname_result#"$1"}
 
1191
    func_stripname_result=${func_stripname_result%"$2"}
 
1192
  }'
 
1193
else
 
1194
  func_stripname ()
 
1195
  {
 
1196
    $debug_cmd
 
1197
 
 
1198
    case $2 in
 
1199
      .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;;
 
1200
      *)  func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;;
 
1201
    esac
 
1202
  }
 
1203
fi
 
1204
 
 
1205
 
 
1206
# func_show_eval CMD [FAIL_EXP]
 
1207
# -----------------------------
 
1208
# Unless opt_quiet is true, then output CMD.  Then, if opt_dryrun is
647
1209
# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
648
1210
# is given, then evaluate it.
649
1211
func_show_eval ()
650
1212
{
651
 
    my_cmd="$1"
652
 
    my_fail_exp="${2-:}"
653
 
 
654
 
    ${opt_silent-false} || {
655
 
      func_quote_for_expand "$my_cmd"
656
 
      eval "func_echo $func_quote_for_expand_result"
 
1213
    $debug_cmd
 
1214
 
 
1215
    _G_cmd=$1
 
1216
    _G_fail_exp=${2-':'}
 
1217
 
 
1218
    func_quote_for_expand "$_G_cmd"
 
1219
    eval "func_notquiet $func_quote_for_expand_result"
 
1220
 
 
1221
    $opt_dry_run || {
 
1222
      eval "$_G_cmd"
 
1223
      _G_status=$?
 
1224
      if test 0 -ne "$_G_status"; then
 
1225
        eval "(exit $_G_status); $_G_fail_exp"
 
1226
      fi
657
1227
    }
658
 
 
659
 
    if ${opt_dry_run-false}; then :; else
660
 
      eval "$my_cmd"
661
 
      my_status=$?
662
 
      if test "$my_status" -eq 0; then :; else
663
 
        eval "(exit $my_status); $my_fail_exp"
664
 
      fi
665
 
    fi
666
1228
}
667
1229
 
668
1230
 
669
 
# func_show_eval_locale cmd [fail_exp]
670
 
# Unless opt_silent is true, then output CMD.  Then, if opt_dryrun is
 
1231
# func_show_eval_locale CMD [FAIL_EXP]
 
1232
# ------------------------------------
 
1233
# Unless opt_quiet is true, then output CMD.  Then, if opt_dryrun is
671
1234
# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
672
1235
# is given, then evaluate it.  Use the saved locale for evaluation.
673
1236
func_show_eval_locale ()
674
1237
{
675
 
    my_cmd="$1"
676
 
    my_fail_exp="${2-:}"
677
 
 
678
 
    ${opt_silent-false} || {
679
 
      func_quote_for_expand "$my_cmd"
 
1238
    $debug_cmd
 
1239
 
 
1240
    _G_cmd=$1
 
1241
    _G_fail_exp=${2-':'}
 
1242
 
 
1243
    $opt_quiet || {
 
1244
      func_quote_for_expand "$_G_cmd"
680
1245
      eval "func_echo $func_quote_for_expand_result"
681
1246
    }
682
1247
 
683
 
    if ${opt_dry_run-false}; then :; else
684
 
      eval "$lt_user_locale
685
 
            $my_cmd"
686
 
      my_status=$?
687
 
      eval "$lt_safe_locale"
688
 
      if test "$my_status" -eq 0; then :; else
689
 
        eval "(exit $my_status); $my_fail_exp"
 
1248
    $opt_dry_run || {
 
1249
      eval "$_G_user_locale
 
1250
            $_G_cmd"
 
1251
      _G_status=$?
 
1252
      eval "$_G_safe_locale"
 
1253
      if test 0 -ne "$_G_status"; then
 
1254
        eval "(exit $_G_status); $_G_fail_exp"
690
1255
      fi
691
 
    fi
 
1256
    }
692
1257
}
693
1258
 
 
1259
 
694
1260
# func_tr_sh
 
1261
# ----------
695
1262
# Turn $1 into a string suitable for a shell variable name.
696
1263
# Result is stored in $func_tr_sh_result.  All characters
697
1264
# not in the set a-zA-Z0-9_ are replaced with '_'. Further,
698
1265
# if $1 begins with a digit, a '_' is prepended as well.
699
1266
func_tr_sh ()
700
1267
{
701
 
  case $1 in
702
 
  [0-9]* | *[!a-zA-Z0-9_]*)
703
 
    func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'`
704
 
    ;;
705
 
  * )
706
 
    func_tr_sh_result=$1
707
 
    ;;
708
 
  esac
709
 
}
710
 
 
711
 
 
712
 
# func_version
713
 
# Echo version message to standard output and exit.
714
 
func_version ()
715
 
{
716
 
    $opt_debug
717
 
 
718
 
    $SED -n '/(C)/!b go
719
 
        :more
720
 
        /\./!{
721
 
          N
722
 
          s/\n# / /
723
 
          b more
724
 
        }
725
 
        :go
726
 
        /^# '$PROGRAM' (GNU /,/# warranty; / {
727
 
        s/^# //
728
 
        s/^# *$//
729
 
        s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
730
 
        p
731
 
     }' < "$progpath"
732
 
     exit $?
733
 
}
734
 
 
735
 
# func_usage
736
 
# Echo short help message to standard output and exit.
737
 
func_usage ()
738
 
{
739
 
    $opt_debug
740
 
 
741
 
    $SED -n '/^# Usage:/,/^#  *.*--help/ {
742
 
        s/^# //
743
 
        s/^# *$//
744
 
        s/\$progname/'$progname'/
745
 
        p
746
 
    }' < "$progpath"
747
 
    echo
748
 
    $ECHO "run \`$progname --help | more' for full usage"
749
 
    exit $?
750
 
}
751
 
 
752
 
# func_help [NOEXIT]
753
 
# Echo long help message to standard output and exit,
754
 
# unless 'noexit' is passed as argument.
 
1268
    $debug_cmd
 
1269
 
 
1270
    case $1 in
 
1271
    [0-9]* | *[!a-zA-Z0-9_]*)
 
1272
      func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'`
 
1273
      ;;
 
1274
    * )
 
1275
      func_tr_sh_result=$1
 
1276
      ;;
 
1277
    esac
 
1278
}
 
1279
 
 
1280
 
 
1281
# func_verbose ARG...
 
1282
# -------------------
 
1283
# Echo program name prefixed message in verbose mode only.
 
1284
func_verbose ()
 
1285
{
 
1286
    $debug_cmd
 
1287
 
 
1288
    $opt_verbose && func_echo "$*"
 
1289
 
 
1290
    :
 
1291
}
 
1292
 
 
1293
 
 
1294
# func_warn_and_continue ARG...
 
1295
# -----------------------------
 
1296
# Echo program name prefixed warning message to standard error.
 
1297
func_warn_and_continue ()
 
1298
{
 
1299
    $debug_cmd
 
1300
 
 
1301
    $require_term_colors
 
1302
 
 
1303
    func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2
 
1304
}
 
1305
 
 
1306
 
 
1307
# func_warning CATEGORY ARG...
 
1308
# ----------------------------
 
1309
# Echo program name prefixed warning message to standard error. Warning
 
1310
# messages can be filtered according to CATEGORY, where this function
 
1311
# elides messages where CATEGORY is not listed in the global variable
 
1312
# 'opt_warning_types'.
 
1313
func_warning ()
 
1314
{
 
1315
    $debug_cmd
 
1316
 
 
1317
    # CATEGORY must be in the warning_categories list!
 
1318
    case " $warning_categories " in
 
1319
      *" $1 "*) ;;
 
1320
      *) func_internal_error "invalid warning category '$1'" ;;
 
1321
    esac
 
1322
 
 
1323
    _G_category=$1
 
1324
    shift
 
1325
 
 
1326
    case " $opt_warning_types " in
 
1327
      *" $_G_category "*) $warning_func ${1+"$@"} ;;
 
1328
    esac
 
1329
}
 
1330
 
 
1331
 
 
1332
# func_sort_ver VER1 VER2
 
1333
# -----------------------
 
1334
# 'sort -V' is not generally available.
 
1335
# Note this deviates from the version comparison in automake
 
1336
# in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a
 
1337
# but this should suffice as we won't be specifying old
 
1338
# version formats or redundant trailing .0 in bootstrap.conf.
 
1339
# If we did want full compatibility then we should probably
 
1340
# use m4_version_compare from autoconf.
 
1341
func_sort_ver ()
 
1342
{
 
1343
    $debug_cmd
 
1344
 
 
1345
    printf '%s\n%s\n' "$1" "$2" \
 
1346
      | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n -k 6,6n -k 7,7n -k 8,8n -k 9,9n
 
1347
}
 
1348
 
 
1349
# func_lt_ver PREV CURR
 
1350
# ---------------------
 
1351
# Return true if PREV and CURR are in the correct order according to
 
1352
# func_sort_ver, otherwise false.  Use it like this:
 
1353
#
 
1354
#  func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..."
 
1355
func_lt_ver ()
 
1356
{
 
1357
    $debug_cmd
 
1358
 
 
1359
    test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q`
 
1360
}
 
1361
 
 
1362
 
 
1363
# Local variables:
 
1364
# mode: shell-script
 
1365
# sh-indentation: 2
 
1366
# eval: (add-hook 'before-save-hook 'time-stamp)
 
1367
# time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
 
1368
# time-stamp-time-zone: "UTC"
 
1369
# End:
 
1370
#! /bin/sh
 
1371
 
 
1372
# Set a version string for this script.
 
1373
scriptversion=2014-01-07.03; # UTC
 
1374
 
 
1375
# A portable, pluggable option parser for Bourne shell.
 
1376
# Written by Gary V. Vaughan, 2010
 
1377
 
 
1378
# Copyright (C) 2010-2015 Free Software Foundation, Inc.
 
1379
# This is free software; see the source for copying conditions.  There is NO
 
1380
# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
1381
 
 
1382
# This program is free software: you can redistribute it and/or modify
 
1383
# it under the terms of the GNU General Public License as published by
 
1384
# the Free Software Foundation, either version 3 of the License, or
 
1385
# (at your option) any later version.
 
1386
 
 
1387
# This program is distributed in the hope that it will be useful,
 
1388
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
1389
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
1390
# GNU General Public License for more details.
 
1391
 
 
1392
# You should have received a copy of the GNU General Public License
 
1393
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
1394
 
 
1395
# Please report bugs or propose patches to gary@gnu.org.
 
1396
 
 
1397
 
 
1398
## ------ ##
 
1399
## Usage. ##
 
1400
## ------ ##
 
1401
 
 
1402
# This file is a library for parsing options in your shell scripts along
 
1403
# with assorted other useful supporting features that you can make use
 
1404
# of too.
 
1405
#
 
1406
# For the simplest scripts you might need only:
 
1407
#
 
1408
#   #!/bin/sh
 
1409
#   . relative/path/to/funclib.sh
 
1410
#   . relative/path/to/options-parser
 
1411
#   scriptversion=1.0
 
1412
#   func_options ${1+"$@"}
 
1413
#   eval set dummy "$func_options_result"; shift
 
1414
#   ...rest of your script...
 
1415
#
 
1416
# In order for the '--version' option to work, you will need to have a
 
1417
# suitably formatted comment like the one at the top of this file
 
1418
# starting with '# Written by ' and ending with '# warranty; '.
 
1419
#
 
1420
# For '-h' and '--help' to work, you will also need a one line
 
1421
# description of your script's purpose in a comment directly above the
 
1422
# '# Written by ' line, like the one at the top of this file.
 
1423
#
 
1424
# The default options also support '--debug', which will turn on shell
 
1425
# execution tracing (see the comment above debug_cmd below for another
 
1426
# use), and '--verbose' and the func_verbose function to allow your script
 
1427
# to display verbose messages only when your user has specified
 
1428
# '--verbose'.
 
1429
#
 
1430
# After sourcing this file, you can plug processing for additional
 
1431
# options by amending the variables from the 'Configuration' section
 
1432
# below, and following the instructions in the 'Option parsing'
 
1433
# section further down.
 
1434
 
 
1435
## -------------- ##
 
1436
## Configuration. ##
 
1437
## -------------- ##
 
1438
 
 
1439
# You should override these variables in your script after sourcing this
 
1440
# file so that they reflect the customisations you have added to the
 
1441
# option parser.
 
1442
 
 
1443
# The usage line for option parsing errors and the start of '-h' and
 
1444
# '--help' output messages. You can embed shell variables for delayed
 
1445
# expansion at the time the message is displayed, but you will need to
 
1446
# quote other shell meta-characters carefully to prevent them being
 
1447
# expanded when the contents are evaled.
 
1448
usage='$progpath [OPTION]...'
 
1449
 
 
1450
# Short help message in response to '-h' and '--help'.  Add to this or
 
1451
# override it after sourcing this library to reflect the full set of
 
1452
# options your script accepts.
 
1453
usage_message="\
 
1454
       --debug        enable verbose shell tracing
 
1455
   -W, --warnings=CATEGORY
 
1456
                      report the warnings falling in CATEGORY [all]
 
1457
   -v, --verbose      verbosely report processing
 
1458
       --version      print version information and exit
 
1459
   -h, --help         print short or long help message and exit
 
1460
"
 
1461
 
 
1462
# Additional text appended to 'usage_message' in response to '--help'.
 
1463
long_help_message="
 
1464
Warning categories include:
 
1465
       'all'          show all warnings
 
1466
       'none'         turn off all the warnings
 
1467
       'error'        warnings are treated as fatal errors"
 
1468
 
 
1469
# Help message printed before fatal option parsing errors.
 
1470
fatal_help="Try '\$progname --help' for more information."
 
1471
 
 
1472
 
 
1473
 
 
1474
## ------------------------- ##
 
1475
## Hook function management. ##
 
1476
## ------------------------- ##
 
1477
 
 
1478
# This section contains functions for adding, removing, and running hooks
 
1479
# to the main code.  A hook is just a named list of of function, that can
 
1480
# be run in order later on.
 
1481
 
 
1482
# func_hookable FUNC_NAME
 
1483
# -----------------------
 
1484
# Declare that FUNC_NAME will run hooks added with
 
1485
# 'func_add_hook FUNC_NAME ...'.
 
1486
func_hookable ()
 
1487
{
 
1488
    $debug_cmd
 
1489
 
 
1490
    func_append hookable_fns " $1"
 
1491
}
 
1492
 
 
1493
 
 
1494
# func_add_hook FUNC_NAME HOOK_FUNC
 
1495
# ---------------------------------
 
1496
# Request that FUNC_NAME call HOOK_FUNC before it returns.  FUNC_NAME must
 
1497
# first have been declared "hookable" by a call to 'func_hookable'.
 
1498
func_add_hook ()
 
1499
{
 
1500
    $debug_cmd
 
1501
 
 
1502
    case " $hookable_fns " in
 
1503
      *" $1 "*) ;;
 
1504
      *) func_fatal_error "'$1' does not accept hook functions." ;;
 
1505
    esac
 
1506
 
 
1507
    eval func_append ${1}_hooks '" $2"'
 
1508
}
 
1509
 
 
1510
 
 
1511
# func_remove_hook FUNC_NAME HOOK_FUNC
 
1512
# ------------------------------------
 
1513
# Remove HOOK_FUNC from the list of functions called by FUNC_NAME.
 
1514
func_remove_hook ()
 
1515
{
 
1516
    $debug_cmd
 
1517
 
 
1518
    eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`'
 
1519
}
 
1520
 
 
1521
 
 
1522
# func_run_hooks FUNC_NAME [ARG]...
 
1523
# ---------------------------------
 
1524
# Run all hook functions registered to FUNC_NAME.
 
1525
# It is assumed that the list of hook functions contains nothing more
 
1526
# than a whitespace-delimited list of legal shell function names, and
 
1527
# no effort is wasted trying to catch shell meta-characters or preserve
 
1528
# whitespace.
 
1529
func_run_hooks ()
 
1530
{
 
1531
    $debug_cmd
 
1532
 
 
1533
    case " $hookable_fns " in
 
1534
      *" $1 "*) ;;
 
1535
      *) func_fatal_error "'$1' does not support hook funcions.n" ;;
 
1536
    esac
 
1537
 
 
1538
    eval _G_hook_fns=\$$1_hooks; shift
 
1539
 
 
1540
    for _G_hook in $_G_hook_fns; do
 
1541
      eval $_G_hook '"$@"'
 
1542
 
 
1543
      # store returned options list back into positional
 
1544
      # parameters for next 'cmd' execution.
 
1545
      eval _G_hook_result=\$${_G_hook}_result
 
1546
      eval set dummy "$_G_hook_result"; shift
 
1547
    done
 
1548
 
 
1549
    func_quote_for_eval ${1+"$@"}
 
1550
    func_run_hooks_result=$func_quote_for_eval_result
 
1551
}
 
1552
 
 
1553
 
 
1554
 
 
1555
## --------------- ##
 
1556
## Option parsing. ##
 
1557
## --------------- ##
 
1558
 
 
1559
# In order to add your own option parsing hooks, you must accept the
 
1560
# full positional parameter list in your hook function, remove any
 
1561
# options that you action, and then pass back the remaining unprocessed
 
1562
# options in '<hooked_function_name>_result', escaped suitably for
 
1563
# 'eval'.  Like this:
 
1564
#
 
1565
#    my_options_prep ()
 
1566
#    {
 
1567
#        $debug_cmd
 
1568
#
 
1569
#        # Extend the existing usage message.
 
1570
#        usage_message=$usage_message'
 
1571
#      -s, --silent       don'\''t print informational messages
 
1572
#    '
 
1573
#
 
1574
#        func_quote_for_eval ${1+"$@"}
 
1575
#        my_options_prep_result=$func_quote_for_eval_result
 
1576
#    }
 
1577
#    func_add_hook func_options_prep my_options_prep
 
1578
#
 
1579
#
 
1580
#    my_silent_option ()
 
1581
#    {
 
1582
#        $debug_cmd
 
1583
#
 
1584
#        # Note that for efficiency, we parse as many options as we can
 
1585
#        # recognise in a loop before passing the remainder back to the
 
1586
#        # caller on the first unrecognised argument we encounter.
 
1587
#        while test $# -gt 0; do
 
1588
#          opt=$1; shift
 
1589
#          case $opt in
 
1590
#            --silent|-s) opt_silent=: ;;
 
1591
#            # Separate non-argument short options:
 
1592
#            -s*)         func_split_short_opt "$_G_opt"
 
1593
#                         set dummy "$func_split_short_opt_name" \
 
1594
#                             "-$func_split_short_opt_arg" ${1+"$@"}
 
1595
#                         shift
 
1596
#                         ;;
 
1597
#            *)            set dummy "$_G_opt" "$*"; shift; break ;;
 
1598
#          esac
 
1599
#        done
 
1600
#
 
1601
#        func_quote_for_eval ${1+"$@"}
 
1602
#        my_silent_option_result=$func_quote_for_eval_result
 
1603
#    }
 
1604
#    func_add_hook func_parse_options my_silent_option
 
1605
#
 
1606
#
 
1607
#    my_option_validation ()
 
1608
#    {
 
1609
#        $debug_cmd
 
1610
#
 
1611
#        $opt_silent && $opt_verbose && func_fatal_help "\
 
1612
#    '--silent' and '--verbose' options are mutually exclusive."
 
1613
#
 
1614
#        func_quote_for_eval ${1+"$@"}
 
1615
#        my_option_validation_result=$func_quote_for_eval_result
 
1616
#    }
 
1617
#    func_add_hook func_validate_options my_option_validation
 
1618
#
 
1619
# You'll alse need to manually amend $usage_message to reflect the extra
 
1620
# options you parse.  It's preferable to append if you can, so that
 
1621
# multiple option parsing hooks can be added safely.
 
1622
 
 
1623
 
 
1624
# func_options [ARG]...
 
1625
# ---------------------
 
1626
# All the functions called inside func_options are hookable. See the
 
1627
# individual implementations for details.
 
1628
func_hookable func_options
 
1629
func_options ()
 
1630
{
 
1631
    $debug_cmd
 
1632
 
 
1633
    func_options_prep ${1+"$@"}
 
1634
    eval func_parse_options \
 
1635
        ${func_options_prep_result+"$func_options_prep_result"}
 
1636
    eval func_validate_options \
 
1637
        ${func_parse_options_result+"$func_parse_options_result"}
 
1638
 
 
1639
    eval func_run_hooks func_options \
 
1640
        ${func_validate_options_result+"$func_validate_options_result"}
 
1641
 
 
1642
    # save modified positional parameters for caller
 
1643
    func_options_result=$func_run_hooks_result
 
1644
}
 
1645
 
 
1646
 
 
1647
# func_options_prep [ARG]...
 
1648
# --------------------------
 
1649
# All initialisations required before starting the option parse loop.
 
1650
# Note that when calling hook functions, we pass through the list of
 
1651
# positional parameters.  If a hook function modifies that list, and
 
1652
# needs to propogate that back to rest of this script, then the complete
 
1653
# modified list must be put in 'func_run_hooks_result' before
 
1654
# returning.
 
1655
func_hookable func_options_prep
 
1656
func_options_prep ()
 
1657
{
 
1658
    $debug_cmd
 
1659
 
 
1660
    # Option defaults:
 
1661
    opt_verbose=false
 
1662
    opt_warning_types=
 
1663
 
 
1664
    func_run_hooks func_options_prep ${1+"$@"}
 
1665
 
 
1666
    # save modified positional parameters for caller
 
1667
    func_options_prep_result=$func_run_hooks_result
 
1668
}
 
1669
 
 
1670
 
 
1671
# func_parse_options [ARG]...
 
1672
# ---------------------------
 
1673
# The main option parsing loop.
 
1674
func_hookable func_parse_options
 
1675
func_parse_options ()
 
1676
{
 
1677
    $debug_cmd
 
1678
 
 
1679
    func_parse_options_result=
 
1680
 
 
1681
    # this just eases exit handling
 
1682
    while test $# -gt 0; do
 
1683
      # Defer to hook functions for initial option parsing, so they
 
1684
      # get priority in the event of reusing an option name.
 
1685
      func_run_hooks func_parse_options ${1+"$@"}
 
1686
 
 
1687
      # Adjust func_parse_options positional parameters to match
 
1688
      eval set dummy "$func_run_hooks_result"; shift
 
1689
 
 
1690
      # Break out of the loop if we already parsed every option.
 
1691
      test $# -gt 0 || break
 
1692
 
 
1693
      _G_opt=$1
 
1694
      shift
 
1695
      case $_G_opt in
 
1696
        --debug|-x)   debug_cmd='set -x'
 
1697
                      func_echo "enabling shell trace mode"
 
1698
                      $debug_cmd
 
1699
                      ;;
 
1700
 
 
1701
        --no-warnings|--no-warning|--no-warn)
 
1702
                      set dummy --warnings none ${1+"$@"}
 
1703
                      shift
 
1704
                      ;;
 
1705
 
 
1706
        --warnings|--warning|-W)
 
1707
                      test $# = 0 && func_missing_arg $_G_opt && break
 
1708
                      case " $warning_categories $1" in
 
1709
                        *" $1 "*)
 
1710
                          # trailing space prevents matching last $1 above
 
1711
                          func_append_uniq opt_warning_types " $1"
 
1712
                          ;;
 
1713
                        *all)
 
1714
                          opt_warning_types=$warning_categories
 
1715
                          ;;
 
1716
                        *none)
 
1717
                          opt_warning_types=none
 
1718
                          warning_func=:
 
1719
                          ;;
 
1720
                        *error)
 
1721
                          opt_warning_types=$warning_categories
 
1722
                          warning_func=func_fatal_error
 
1723
                          ;;
 
1724
                        *)
 
1725
                          func_fatal_error \
 
1726
                             "unsupported warning category: '$1'"
 
1727
                          ;;
 
1728
                      esac
 
1729
                      shift
 
1730
                      ;;
 
1731
 
 
1732
        --verbose|-v) opt_verbose=: ;;
 
1733
        --version)    func_version ;;
 
1734
        -\?|-h)       func_usage ;;
 
1735
        --help)       func_help ;;
 
1736
 
 
1737
        # Separate optargs to long options (plugins may need this):
 
1738
        --*=*)        func_split_equals "$_G_opt"
 
1739
                      set dummy "$func_split_equals_lhs" \
 
1740
                          "$func_split_equals_rhs" ${1+"$@"}
 
1741
                      shift
 
1742
                      ;;
 
1743
 
 
1744
       # Separate optargs to short options:
 
1745
        -W*)
 
1746
                      func_split_short_opt "$_G_opt"
 
1747
                      set dummy "$func_split_short_opt_name" \
 
1748
                          "$func_split_short_opt_arg" ${1+"$@"}
 
1749
                      shift
 
1750
                      ;;
 
1751
 
 
1752
        # Separate non-argument short options:
 
1753
        -\?*|-h*|-v*|-x*)
 
1754
                      func_split_short_opt "$_G_opt"
 
1755
                      set dummy "$func_split_short_opt_name" \
 
1756
                          "-$func_split_short_opt_arg" ${1+"$@"}
 
1757
                      shift
 
1758
                      ;;
 
1759
 
 
1760
        --)           break ;;
 
1761
        -*)           func_fatal_help "unrecognised option: '$_G_opt'" ;;
 
1762
        *)            set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
 
1763
      esac
 
1764
    done
 
1765
 
 
1766
    # save modified positional parameters for caller
 
1767
    func_quote_for_eval ${1+"$@"}
 
1768
    func_parse_options_result=$func_quote_for_eval_result
 
1769
}
 
1770
 
 
1771
 
 
1772
# func_validate_options [ARG]...
 
1773
# ------------------------------
 
1774
# Perform any sanity checks on option settings and/or unconsumed
 
1775
# arguments.
 
1776
func_hookable func_validate_options
 
1777
func_validate_options ()
 
1778
{
 
1779
    $debug_cmd
 
1780
 
 
1781
    # Display all warnings if -W was not given.
 
1782
    test -n "$opt_warning_types" || opt_warning_types=" $warning_categories"
 
1783
 
 
1784
    func_run_hooks func_validate_options ${1+"$@"}
 
1785
 
 
1786
    # Bail if the options were screwed!
 
1787
    $exit_cmd $EXIT_FAILURE
 
1788
 
 
1789
    # save modified positional parameters for caller
 
1790
    func_validate_options_result=$func_run_hooks_result
 
1791
}
 
1792
 
 
1793
 
 
1794
 
 
1795
## ----------------- ##
 
1796
## Helper functions. ##
 
1797
## ----------------- ##
 
1798
 
 
1799
# This section contains the helper functions used by the rest of the
 
1800
# hookable option parser framework in ascii-betical order.
 
1801
 
 
1802
 
 
1803
# func_fatal_help ARG...
 
1804
# ----------------------
 
1805
# Echo program name prefixed message to standard error, followed by
 
1806
# a help hint, and exit.
 
1807
func_fatal_help ()
 
1808
{
 
1809
    $debug_cmd
 
1810
 
 
1811
    eval \$ECHO \""Usage: $usage"\"
 
1812
    eval \$ECHO \""$fatal_help"\"
 
1813
    func_error ${1+"$@"}
 
1814
    exit $EXIT_FAILURE
 
1815
}
 
1816
 
 
1817
 
 
1818
# func_help
 
1819
# ---------
 
1820
# Echo long help message to standard output and exit.
755
1821
func_help ()
756
1822
{
757
 
    $opt_debug
 
1823
    $debug_cmd
758
1824
 
759
 
    $SED -n '/^# Usage:/,/# Report bugs to/ {
760
 
        :print
761
 
        s/^# //
762
 
        s/^# *$//
763
 
        s*\$progname*'$progname'*
764
 
        s*\$host*'"$host"'*
765
 
        s*\$SHELL*'"$SHELL"'*
766
 
        s*\$LTCC*'"$LTCC"'*
767
 
        s*\$LTCFLAGS*'"$LTCFLAGS"'*
768
 
        s*\$LD*'"$LD"'*
769
 
        s/\$with_gnu_ld/'"$with_gnu_ld"'/
770
 
        s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/
771
 
        s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/
772
 
        p
773
 
        d
774
 
     }
775
 
     /^# .* home page:/b print
776
 
     /^# General help using/b print
777
 
     ' < "$progpath"
778
 
    ret=$?
779
 
    if test -z "$1"; then
780
 
      exit $ret
781
 
    fi
 
1825
    func_usage_message
 
1826
    $ECHO "$long_help_message"
 
1827
    exit 0
782
1828
}
783
1829
 
784
 
# func_missing_arg argname
 
1830
 
 
1831
# func_missing_arg ARGNAME
 
1832
# ------------------------
785
1833
# Echo program name prefixed message to standard error and set global
786
1834
# exit_cmd.
787
1835
func_missing_arg ()
788
1836
{
789
 
    $opt_debug
 
1837
    $debug_cmd
790
1838
 
791
 
    func_error "missing argument for $1."
 
1839
    func_error "Missing argument for '$1'."
792
1840
    exit_cmd=exit
793
1841
}
794
1842
 
795
1843
 
796
 
# func_split_short_opt shortopt
 
1844
# func_split_equals STRING
 
1845
# ------------------------
 
1846
# Set func_split_equals_lhs and func_split_equals_rhs shell variables after
 
1847
# splitting STRING at the '=' sign.
 
1848
test -z "$_G_HAVE_XSI_OPS" \
 
1849
    && (eval 'x=a/b/c;
 
1850
      test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
 
1851
    && _G_HAVE_XSI_OPS=yes
 
1852
 
 
1853
if test yes = "$_G_HAVE_XSI_OPS"
 
1854
then
 
1855
  # This is an XSI compatible shell, allowing a faster implementation...
 
1856
  eval 'func_split_equals ()
 
1857
  {
 
1858
      $debug_cmd
 
1859
 
 
1860
      func_split_equals_lhs=${1%%=*}
 
1861
      func_split_equals_rhs=${1#*=}
 
1862
      test "x$func_split_equals_lhs" = "x$1" \
 
1863
        && func_split_equals_rhs=
 
1864
  }'
 
1865
else
 
1866
  # ...otherwise fall back to using expr, which is often a shell builtin.
 
1867
  func_split_equals ()
 
1868
  {
 
1869
      $debug_cmd
 
1870
 
 
1871
      func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'`
 
1872
      func_split_equals_rhs=
 
1873
      test "x$func_split_equals_lhs" = "x$1" \
 
1874
        || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'`
 
1875
  }
 
1876
fi #func_split_equals
 
1877
 
 
1878
 
 
1879
# func_split_short_opt SHORTOPT
 
1880
# -----------------------------
797
1881
# Set func_split_short_opt_name and func_split_short_opt_arg shell
798
1882
# variables after splitting SHORTOPT after the 2nd character.
799
 
func_split_short_opt ()
800
 
{
801
 
    my_sed_short_opt='1s/^\(..\).*$/\1/;q'
802
 
    my_sed_short_rest='1s/^..\(.*\)$/\1/;q'
803
 
 
804
 
    func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"`
805
 
    func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"`
806
 
} # func_split_short_opt may be replaced by extended shell implementation
807
 
 
808
 
 
809
 
# func_split_long_opt longopt
810
 
# Set func_split_long_opt_name and func_split_long_opt_arg shell
811
 
# variables after splitting LONGOPT at the `=' sign.
812
 
func_split_long_opt ()
813
 
{
814
 
    my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q'
815
 
    my_sed_long_arg='1s/^--[^=]*=//'
816
 
 
817
 
    func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"`
818
 
    func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"`
819
 
} # func_split_long_opt may be replaced by extended shell implementation
820
 
 
821
 
exit_cmd=:
822
 
 
823
 
 
824
 
 
825
 
 
826
 
 
827
 
magic="%%%MAGIC variable%%%"
828
 
magic_exe="%%%MAGIC EXE variable%%%"
829
 
 
830
 
# Global variables.
831
 
nonopt=
832
 
preserve_args=
833
 
lo2o="s/\\.lo\$/.${objext}/"
834
 
o2lo="s/\\.${objext}\$/.lo/"
835
 
extracted_archives=
836
 
extracted_serial=0
837
 
 
838
 
# If this variable is set in any of the actions, the command in it
839
 
# will be execed at the end.  This prevents here-documents from being
840
 
# left over by shells.
841
 
exec_cmd=
842
 
 
843
 
# func_append var value
844
 
# Append VALUE to the end of shell variable VAR.
845
 
func_append ()
846
 
{
847
 
    eval "${1}=\$${1}\${2}"
848
 
} # func_append may be replaced by extended shell implementation
849
 
 
850
 
# func_append_quoted var value
851
 
# Quote VALUE and append to the end of shell variable VAR, separated
852
 
# by a space.
853
 
func_append_quoted ()
854
 
{
855
 
    func_quote_for_eval "${2}"
856
 
    eval "${1}=\$${1}\\ \$func_quote_for_eval_result"
857
 
} # func_append_quoted may be replaced by extended shell implementation
858
 
 
859
 
 
860
 
# func_arith arithmetic-term...
861
 
func_arith ()
862
 
{
863
 
    func_arith_result=`expr "${@}"`
864
 
} # func_arith may be replaced by extended shell implementation
865
 
 
866
 
 
867
 
# func_len string
868
 
# STRING may not start with a hyphen.
869
 
func_len ()
870
 
{
871
 
    func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len`
872
 
} # func_len may be replaced by extended shell implementation
873
 
 
874
 
 
875
 
# func_lo2o object
876
 
func_lo2o ()
877
 
{
878
 
    func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"`
879
 
} # func_lo2o may be replaced by extended shell implementation
880
 
 
881
 
 
882
 
# func_xform libobj-or-source
883
 
func_xform ()
884
 
{
885
 
    func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'`
886
 
} # func_xform may be replaced by extended shell implementation
887
 
 
888
 
 
889
 
# func_fatal_configuration arg...
 
1883
if test yes = "$_G_HAVE_XSI_OPS"
 
1884
then
 
1885
  # This is an XSI compatible shell, allowing a faster implementation...
 
1886
  eval 'func_split_short_opt ()
 
1887
  {
 
1888
      $debug_cmd
 
1889
 
 
1890
      func_split_short_opt_arg=${1#??}
 
1891
      func_split_short_opt_name=${1%"$func_split_short_opt_arg"}
 
1892
  }'
 
1893
else
 
1894
  # ...otherwise fall back to using expr, which is often a shell builtin.
 
1895
  func_split_short_opt ()
 
1896
  {
 
1897
      $debug_cmd
 
1898
 
 
1899
      func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'`
 
1900
      func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'`
 
1901
  }
 
1902
fi #func_split_short_opt
 
1903
 
 
1904
 
 
1905
# func_usage
 
1906
# ----------
 
1907
# Echo short help message to standard output and exit.
 
1908
func_usage ()
 
1909
{
 
1910
    $debug_cmd
 
1911
 
 
1912
    func_usage_message
 
1913
    $ECHO "Run '$progname --help |${PAGER-more}' for full usage"
 
1914
    exit 0
 
1915
}
 
1916
 
 
1917
 
 
1918
# func_usage_message
 
1919
# ------------------
 
1920
# Echo short help message to standard output.
 
1921
func_usage_message ()
 
1922
{
 
1923
    $debug_cmd
 
1924
 
 
1925
    eval \$ECHO \""Usage: $usage"\"
 
1926
    echo
 
1927
    $SED -n 's|^# ||
 
1928
        /^Written by/{
 
1929
          x;p;x
 
1930
        }
 
1931
        h
 
1932
        /^Written by/q' < "$progpath"
 
1933
    echo
 
1934
    eval \$ECHO \""$usage_message"\"
 
1935
}
 
1936
 
 
1937
 
 
1938
# func_version
 
1939
# ------------
 
1940
# Echo version message to standard output and exit.
 
1941
func_version ()
 
1942
{
 
1943
    $debug_cmd
 
1944
 
 
1945
    printf '%s\n' "$progname $scriptversion"
 
1946
    $SED -n '
 
1947
        /(C)/!b go
 
1948
        :more
 
1949
        /\./!{
 
1950
          N
 
1951
          s|\n# | |
 
1952
          b more
 
1953
        }
 
1954
        :go
 
1955
        /^# Written by /,/# warranty; / {
 
1956
          s|^# ||
 
1957
          s|^# *$||
 
1958
          s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2|
 
1959
          p
 
1960
        }
 
1961
        /^# Written by / {
 
1962
          s|^# ||
 
1963
          p
 
1964
        }
 
1965
        /^warranty; /q' < "$progpath"
 
1966
 
 
1967
    exit $?
 
1968
}
 
1969
 
 
1970
 
 
1971
# Local variables:
 
1972
# mode: shell-script
 
1973
# sh-indentation: 2
 
1974
# eval: (add-hook 'before-save-hook 'time-stamp)
 
1975
# time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
 
1976
# time-stamp-time-zone: "UTC"
 
1977
# End:
 
1978
 
 
1979
# Set a version string.
 
1980
scriptversion='(GNU libtool) 2.4.6'
 
1981
 
 
1982
 
 
1983
# func_echo ARG...
 
1984
# ----------------
 
1985
# Libtool also displays the current mode in messages, so override
 
1986
# funclib.sh func_echo with this custom definition.
 
1987
func_echo ()
 
1988
{
 
1989
    $debug_cmd
 
1990
 
 
1991
    _G_message=$*
 
1992
 
 
1993
    func_echo_IFS=$IFS
 
1994
    IFS=$nl
 
1995
    for _G_line in $_G_message; do
 
1996
      IFS=$func_echo_IFS
 
1997
      $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line"
 
1998
    done
 
1999
    IFS=$func_echo_IFS
 
2000
}
 
2001
 
 
2002
 
 
2003
# func_warning ARG...
 
2004
# -------------------
 
2005
# Libtool warnings are not categorized, so override funclib.sh
 
2006
# func_warning with this simpler definition.
 
2007
func_warning ()
 
2008
{
 
2009
    $debug_cmd
 
2010
 
 
2011
    $warning_func ${1+"$@"}
 
2012
}
 
2013
 
 
2014
 
 
2015
## ---------------- ##
 
2016
## Options parsing. ##
 
2017
## ---------------- ##
 
2018
 
 
2019
# Hook in the functions to make sure our own options are parsed during
 
2020
# the option parsing loop.
 
2021
 
 
2022
usage='$progpath [OPTION]... [MODE-ARG]...'
 
2023
 
 
2024
# Short help message in response to '-h'.
 
2025
usage_message="Options:
 
2026
       --config             show all configuration variables
 
2027
       --debug              enable verbose shell tracing
 
2028
   -n, --dry-run            display commands without modifying any files
 
2029
       --features           display basic configuration information and exit
 
2030
       --mode=MODE          use operation mode MODE
 
2031
       --no-warnings        equivalent to '-Wnone'
 
2032
       --preserve-dup-deps  don't remove duplicate dependency libraries
 
2033
       --quiet, --silent    don't print informational messages
 
2034
       --tag=TAG            use configuration variables from tag TAG
 
2035
   -v, --verbose            print more informational messages than default
 
2036
       --version            print version information
 
2037
   -W, --warnings=CATEGORY  report the warnings falling in CATEGORY [all]
 
2038
   -h, --help, --help-all   print short, long, or detailed help message
 
2039
"
 
2040
 
 
2041
# Additional text appended to 'usage_message' in response to '--help'.
 
2042
func_help ()
 
2043
{
 
2044
    $debug_cmd
 
2045
 
 
2046
    func_usage_message
 
2047
    $ECHO "$long_help_message
 
2048
 
 
2049
MODE must be one of the following:
 
2050
 
 
2051
       clean           remove files from the build directory
 
2052
       compile         compile a source file into a libtool object
 
2053
       execute         automatically set library path, then run a program
 
2054
       finish          complete the installation of libtool libraries
 
2055
       install         install libraries or executables
 
2056
       link            create a library or an executable
 
2057
       uninstall       remove libraries from an installed directory
 
2058
 
 
2059
MODE-ARGS vary depending on the MODE.  When passed as first option,
 
2060
'--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that.
 
2061
Try '$progname --help --mode=MODE' for a more detailed description of MODE.
 
2062
 
 
2063
When reporting a bug, please describe a test case to reproduce it and
 
2064
include the following information:
 
2065
 
 
2066
       host-triplet:   $host
 
2067
       shell:          $SHELL
 
2068
       compiler:       $LTCC
 
2069
       compiler flags: $LTCFLAGS
 
2070
       linker:         $LD (gnu? $with_gnu_ld)
 
2071
       version:        $progname (GNU libtool) 2.4.6
 
2072
       automake:       `($AUTOMAKE --version) 2>/dev/null |$SED 1q`
 
2073
       autoconf:       `($AUTOCONF --version) 2>/dev/null |$SED 1q`
 
2074
 
 
2075
Report bugs to <bug-libtool@gnu.org>.
 
2076
GNU libtool home page: <http://www.gnu.org/s/libtool/>.
 
2077
General help using GNU software: <http://www.gnu.org/gethelp/>."
 
2078
    exit 0
 
2079
}
 
2080
 
 
2081
 
 
2082
# func_lo2o OBJECT-NAME
 
2083
# ---------------------
 
2084
# Transform OBJECT-NAME from a '.lo' suffix to the platform specific
 
2085
# object suffix.
 
2086
 
 
2087
lo2o=s/\\.lo\$/.$objext/
 
2088
o2lo=s/\\.$objext\$/.lo/
 
2089
 
 
2090
if test yes = "$_G_HAVE_XSI_OPS"; then
 
2091
  eval 'func_lo2o ()
 
2092
  {
 
2093
    case $1 in
 
2094
      *.lo) func_lo2o_result=${1%.lo}.$objext ;;
 
2095
      *   ) func_lo2o_result=$1               ;;
 
2096
    esac
 
2097
  }'
 
2098
 
 
2099
  # func_xform LIBOBJ-OR-SOURCE
 
2100
  # ---------------------------
 
2101
  # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise)
 
2102
  # suffix to a '.lo' libtool-object suffix.
 
2103
  eval 'func_xform ()
 
2104
  {
 
2105
    func_xform_result=${1%.*}.lo
 
2106
  }'
 
2107
else
 
2108
  # ...otherwise fall back to using sed.
 
2109
  func_lo2o ()
 
2110
  {
 
2111
    func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"`
 
2112
  }
 
2113
 
 
2114
  func_xform ()
 
2115
  {
 
2116
    func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'`
 
2117
  }
 
2118
fi
 
2119
 
 
2120
 
 
2121
# func_fatal_configuration ARG...
 
2122
# -------------------------------
890
2123
# Echo program name prefixed message to standard error, followed by
891
2124
# a configuration failure hint, and exit.
892
2125
func_fatal_configuration ()
893
2126
{
894
 
    func_error ${1+"$@"}
895
 
    func_error "See the $PACKAGE documentation for more information."
896
 
    func_fatal_error "Fatal configuration error."
 
2127
    func__fatal_error ${1+"$@"} \
 
2128
      "See the $PACKAGE documentation for more information." \
 
2129
      "Fatal configuration error."
897
2130
}
898
2131
 
899
2132
 
900
2133
# func_config
 
2134
# -----------
901
2135
# Display the configuration for all the tags in this script.
902
2136
func_config ()
903
2137
{
915
2149
    exit $?
916
2150
}
917
2151
 
 
2152
 
918
2153
# func_features
 
2154
# -------------
919
2155
# Display the features supported by this script.
920
2156
func_features ()
921
2157
{
922
2158
    echo "host: $host"
923
 
    if test "$build_libtool_libs" = yes; then
 
2159
    if test yes = "$build_libtool_libs"; then
924
2160
      echo "enable shared libraries"
925
2161
    else
926
2162
      echo "disable shared libraries"
927
2163
    fi
928
 
    if test "$build_old_libs" = yes; then
 
2164
    if test yes = "$build_old_libs"; then
929
2165
      echo "enable static libraries"
930
2166
    else
931
2167
      echo "disable static libraries"
934
2170
    exit $?
935
2171
}
936
2172
 
937
 
# func_enable_tag tagname
 
2173
 
 
2174
# func_enable_tag TAGNAME
 
2175
# -----------------------
938
2176
# Verify that TAGNAME is valid, and either flag an error and exit, or
939
2177
# enable the TAGNAME tag.  We also add TAGNAME to the global $taglist
940
2178
# variable here.
941
2179
func_enable_tag ()
942
2180
{
943
 
  # Global variable:
944
 
  tagname="$1"
945
 
 
946
 
  re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
947
 
  re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
948
 
  sed_extractcf="/$re_begincf/,/$re_endcf/p"
949
 
 
950
 
  # Validate tagname.
951
 
  case $tagname in
952
 
    *[!-_A-Za-z0-9,/]*)
953
 
      func_fatal_error "invalid tag name: $tagname"
954
 
      ;;
955
 
  esac
956
 
 
957
 
  # Don't test for the "default" C tag, as we know it's
958
 
  # there but not specially marked.
959
 
  case $tagname in
960
 
    CC) ;;
 
2181
    # Global variable:
 
2182
    tagname=$1
 
2183
 
 
2184
    re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
 
2185
    re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
 
2186
    sed_extractcf=/$re_begincf/,/$re_endcf/p
 
2187
 
 
2188
    # Validate tagname.
 
2189
    case $tagname in
 
2190
      *[!-_A-Za-z0-9,/]*)
 
2191
        func_fatal_error "invalid tag name: $tagname"
 
2192
        ;;
 
2193
    esac
 
2194
 
 
2195
    # Don't test for the "default" C tag, as we know it's
 
2196
    # there but not specially marked.
 
2197
    case $tagname in
 
2198
        CC) ;;
961
2199
    *)
962
 
      if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
963
 
        taglist="$taglist $tagname"
 
2200
        if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
 
2201
          taglist="$taglist $tagname"
964
2202
 
965
 
        # Evaluate the configuration.  Be careful to quote the path
966
 
        # and the sed script, to avoid splitting on whitespace, but
967
 
        # also don't use non-portable quotes within backquotes within
968
 
        # quotes we have to do it in 2 steps:
969
 
        extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
970
 
        eval "$extractedcf"
971
 
      else
972
 
        func_error "ignoring unknown tag $tagname"
973
 
      fi
974
 
      ;;
975
 
  esac
 
2203
          # Evaluate the configuration.  Be careful to quote the path
 
2204
          # and the sed script, to avoid splitting on whitespace, but
 
2205
          # also don't use non-portable quotes within backquotes within
 
2206
          # quotes we have to do it in 2 steps:
 
2207
          extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
 
2208
          eval "$extractedcf"
 
2209
        else
 
2210
          func_error "ignoring unknown tag $tagname"
 
2211
        fi
 
2212
        ;;
 
2213
    esac
976
2214
}
977
2215
 
 
2216
 
978
2217
# func_check_version_match
 
2218
# ------------------------
979
2219
# Ensure that we are using m4 macros, and libtool script from the same
980
2220
# release of libtool.
981
2221
func_check_version_match ()
982
2222
{
983
 
  if test "$package_revision" != "$macro_revision"; then
984
 
    if test "$VERSION" != "$macro_version"; then
985
 
      if test -z "$macro_version"; then
986
 
        cat >&2 <<_LT_EOF
 
2223
    if test "$package_revision" != "$macro_revision"; then
 
2224
      if test "$VERSION" != "$macro_version"; then
 
2225
        if test -z "$macro_version"; then
 
2226
          cat >&2 <<_LT_EOF
987
2227
$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
988
2228
$progname: definition of this LT_INIT comes from an older release.
989
2229
$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
990
2230
$progname: and run autoconf again.
991
2231
_LT_EOF
992
 
      else
993
 
        cat >&2 <<_LT_EOF
 
2232
        else
 
2233
          cat >&2 <<_LT_EOF
994
2234
$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
995
2235
$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
996
2236
$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
997
2237
$progname: and run autoconf again.
998
2238
_LT_EOF
999
 
      fi
1000
 
    else
1001
 
      cat >&2 <<_LT_EOF
 
2239
        fi
 
2240
      else
 
2241
        cat >&2 <<_LT_EOF
1002
2242
$progname: Version mismatch error.  This is $PACKAGE $VERSION, revision $package_revision,
1003
2243
$progname: but the definition of this LT_INIT comes from revision $macro_revision.
1004
2244
$progname: You should recreate aclocal.m4 with macros from revision $package_revision
1005
2245
$progname: of $PACKAGE $VERSION and run autoconf again.
1006
2246
_LT_EOF
1007
 
    fi
1008
 
 
1009
 
    exit $EXIT_MISMATCH
1010
 
  fi
1011
 
}
1012
 
 
1013
 
 
1014
 
# Shorthand for --mode=foo, only valid as the first argument
1015
 
case $1 in
1016
 
clean|clea|cle|cl)
1017
 
  shift; set dummy --mode clean ${1+"$@"}; shift
1018
 
  ;;
1019
 
compile|compil|compi|comp|com|co|c)
1020
 
  shift; set dummy --mode compile ${1+"$@"}; shift
1021
 
  ;;
1022
 
execute|execut|execu|exec|exe|ex|e)
1023
 
  shift; set dummy --mode execute ${1+"$@"}; shift
1024
 
  ;;
1025
 
finish|finis|fini|fin|fi|f)
1026
 
  shift; set dummy --mode finish ${1+"$@"}; shift
1027
 
  ;;
1028
 
install|instal|insta|inst|ins|in|i)
1029
 
  shift; set dummy --mode install ${1+"$@"}; shift
1030
 
  ;;
1031
 
link|lin|li|l)
1032
 
  shift; set dummy --mode link ${1+"$@"}; shift
1033
 
  ;;
1034
 
uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
1035
 
  shift; set dummy --mode uninstall ${1+"$@"}; shift
1036
 
  ;;
1037
 
esac
1038
 
 
1039
 
 
1040
 
 
1041
 
# Option defaults:
1042
 
opt_debug=:
1043
 
opt_dry_run=false
1044
 
opt_config=false
1045
 
opt_preserve_dup_deps=false
1046
 
opt_features=false
1047
 
opt_finish=false
1048
 
opt_help=false
1049
 
opt_help_all=false
1050
 
opt_silent=:
1051
 
opt_warning=:
1052
 
opt_verbose=:
1053
 
opt_silent=false
1054
 
opt_verbose=false
1055
 
 
1056
 
 
1057
 
# Parse options once, thoroughly.  This comes as soon as possible in the
1058
 
# script to make things like `--version' happen as quickly as we can.
1059
 
{
1060
 
  # this just eases exit handling
1061
 
  while test $# -gt 0; do
1062
 
    opt="$1"
1063
 
    shift
1064
 
    case $opt in
1065
 
      --debug|-x)       opt_debug='set -x'
1066
 
                        func_echo "enabling shell trace mode"
1067
 
                        $opt_debug
1068
 
                        ;;
1069
 
      --dry-run|--dryrun|-n)
1070
 
                        opt_dry_run=:
1071
 
                        ;;
1072
 
      --config)
1073
 
                        opt_config=:
1074
 
func_config
1075
 
                        ;;
1076
 
      --dlopen|-dlopen)
1077
 
                        optarg="$1"
1078
 
                        opt_dlopen="${opt_dlopen+$opt_dlopen
1079
 
}$optarg"
1080
 
                        shift
1081
 
                        ;;
1082
 
      --preserve-dup-deps)
1083
 
                        opt_preserve_dup_deps=:
1084
 
                        ;;
1085
 
      --features)
1086
 
                        opt_features=:
1087
 
func_features
1088
 
                        ;;
1089
 
      --finish)
1090
 
                        opt_finish=:
1091
 
set dummy --mode finish ${1+"$@"}; shift
1092
 
                        ;;
1093
 
      --help)
1094
 
                        opt_help=:
1095
 
                        ;;
1096
 
      --help-all)
1097
 
                        opt_help_all=:
1098
 
opt_help=': help-all'
1099
 
                        ;;
1100
 
      --mode)
1101
 
                        test $# = 0 && func_missing_arg $opt && break
1102
 
                        optarg="$1"
1103
 
                        opt_mode="$optarg"
1104
 
case $optarg in
1105
 
  # Valid mode arguments:
1106
 
  clean|compile|execute|finish|install|link|relink|uninstall) ;;
1107
 
 
1108
 
  # Catch anything else as an error
1109
 
  *) func_error "invalid argument for $opt"
1110
 
     exit_cmd=exit
1111
 
     break
1112
 
     ;;
1113
 
esac
1114
 
                        shift
1115
 
                        ;;
1116
 
      --no-silent|--no-quiet)
1117
 
                        opt_silent=false
1118
 
func_append preserve_args " $opt"
1119
 
                        ;;
1120
 
      --no-warning|--no-warn)
1121
 
                        opt_warning=false
1122
 
func_append preserve_args " $opt"
1123
 
                        ;;
1124
 
      --no-verbose)
1125
 
                        opt_verbose=false
1126
 
func_append preserve_args " $opt"
1127
 
                        ;;
1128
 
      --silent|--quiet)
1129
 
                        opt_silent=:
1130
 
func_append preserve_args " $opt"
1131
 
        opt_verbose=false
1132
 
                        ;;
1133
 
      --verbose|-v)
1134
 
                        opt_verbose=:
1135
 
func_append preserve_args " $opt"
1136
 
opt_silent=false
1137
 
                        ;;
1138
 
      --tag)
1139
 
                        test $# = 0 && func_missing_arg $opt && break
1140
 
                        optarg="$1"
1141
 
                        opt_tag="$optarg"
1142
 
func_append preserve_args " $opt $optarg"
1143
 
func_enable_tag "$optarg"
1144
 
                        shift
1145
 
                        ;;
1146
 
 
1147
 
      -\?|-h)           func_usage                              ;;
1148
 
      --help)           func_help                               ;;
1149
 
      --version)        func_version                            ;;
1150
 
 
1151
 
      # Separate optargs to long options:
1152
 
      --*=*)
1153
 
                        func_split_long_opt "$opt"
1154
 
                        set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"}
1155
 
                        shift
1156
 
                        ;;
1157
 
 
1158
 
      # Separate non-argument short options:
1159
 
      -\?*|-h*|-n*|-v*)
1160
 
                        func_split_short_opt "$opt"
1161
 
                        set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"}
1162
 
                        shift
1163
 
                        ;;
1164
 
 
1165
 
      --)               break                                   ;;
1166
 
      -*)               func_fatal_help "unrecognized option \`$opt'" ;;
1167
 
      *)                set dummy "$opt" ${1+"$@"};     shift; break  ;;
1168
 
    esac
1169
 
  done
1170
 
 
1171
 
  # Validate options:
1172
 
 
1173
 
  # save first non-option argument
1174
 
  if test "$#" -gt 0; then
1175
 
    nonopt="$opt"
1176
 
    shift
1177
 
  fi
1178
 
 
1179
 
  # preserve --debug
1180
 
  test "$opt_debug" = : || func_append preserve_args " --debug"
1181
 
 
1182
 
  case $host in
1183
 
    *cygwin* | *mingw* | *pw32* | *cegcc*)
1184
 
      # don't eliminate duplications in $postdeps and $predeps
1185
 
      opt_duplicate_compiler_generated_deps=:
1186
 
      ;;
1187
 
    *)
1188
 
      opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
1189
 
      ;;
1190
 
  esac
1191
 
 
1192
 
  $opt_help || {
1193
 
    # Sanity checks first:
1194
 
    func_check_version_match
1195
 
 
1196
 
    if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
1197
 
      func_fatal_configuration "not configured to build any kind of library"
1198
 
    fi
1199
 
 
1200
 
    # Darwin sucks
1201
 
    eval std_shrext=\"$shrext_cmds\"
1202
 
 
1203
 
    # Only execute mode is allowed to have -dlopen flags.
1204
 
    if test -n "$opt_dlopen" && test "$opt_mode" != execute; then
1205
 
      func_error "unrecognized option \`-dlopen'"
1206
 
      $ECHO "$help" 1>&2
1207
 
      exit $EXIT_FAILURE
1208
 
    fi
1209
 
 
1210
 
    # Change the help message to a mode-specific one.
1211
 
    generic_help="$help"
1212
 
    help="Try \`$progname --help --mode=$opt_mode' for more information."
1213
 
  }
1214
 
 
1215
 
 
1216
 
  # Bail if the options were screwed
1217
 
  $exit_cmd $EXIT_FAILURE
1218
 
}
1219
 
 
 
2247
      fi
 
2248
 
 
2249
      exit $EXIT_MISMATCH
 
2250
    fi
 
2251
}
 
2252
 
 
2253
 
 
2254
# libtool_options_prep [ARG]...
 
2255
# -----------------------------
 
2256
# Preparation for options parsed by libtool.
 
2257
libtool_options_prep ()
 
2258
{
 
2259
    $debug_mode
 
2260
 
 
2261
    # Option defaults:
 
2262
    opt_config=false
 
2263
    opt_dlopen=
 
2264
    opt_dry_run=false
 
2265
    opt_help=false
 
2266
    opt_mode=
 
2267
    opt_preserve_dup_deps=false
 
2268
    opt_quiet=false
 
2269
 
 
2270
    nonopt=
 
2271
    preserve_args=
 
2272
 
 
2273
    # Shorthand for --mode=foo, only valid as the first argument
 
2274
    case $1 in
 
2275
    clean|clea|cle|cl)
 
2276
      shift; set dummy --mode clean ${1+"$@"}; shift
 
2277
      ;;
 
2278
    compile|compil|compi|comp|com|co|c)
 
2279
      shift; set dummy --mode compile ${1+"$@"}; shift
 
2280
      ;;
 
2281
    execute|execut|execu|exec|exe|ex|e)
 
2282
      shift; set dummy --mode execute ${1+"$@"}; shift
 
2283
      ;;
 
2284
    finish|finis|fini|fin|fi|f)
 
2285
      shift; set dummy --mode finish ${1+"$@"}; shift
 
2286
      ;;
 
2287
    install|instal|insta|inst|ins|in|i)
 
2288
      shift; set dummy --mode install ${1+"$@"}; shift
 
2289
      ;;
 
2290
    link|lin|li|l)
 
2291
      shift; set dummy --mode link ${1+"$@"}; shift
 
2292
      ;;
 
2293
    uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
 
2294
      shift; set dummy --mode uninstall ${1+"$@"}; shift
 
2295
      ;;
 
2296
    esac
 
2297
 
 
2298
    # Pass back the list of options.
 
2299
    func_quote_for_eval ${1+"$@"}
 
2300
    libtool_options_prep_result=$func_quote_for_eval_result
 
2301
}
 
2302
func_add_hook func_options_prep libtool_options_prep
 
2303
 
 
2304
 
 
2305
# libtool_parse_options [ARG]...
 
2306
# ---------------------------------
 
2307
# Provide handling for libtool specific options.
 
2308
libtool_parse_options ()
 
2309
{
 
2310
    $debug_cmd
 
2311
 
 
2312
    # Perform our own loop to consume as many options as possible in
 
2313
    # each iteration.
 
2314
    while test $# -gt 0; do
 
2315
      _G_opt=$1
 
2316
      shift
 
2317
      case $_G_opt in
 
2318
        --dry-run|--dryrun|-n)
 
2319
                        opt_dry_run=:
 
2320
                        ;;
 
2321
 
 
2322
        --config)       func_config ;;
 
2323
 
 
2324
        --dlopen|-dlopen)
 
2325
                        opt_dlopen="${opt_dlopen+$opt_dlopen
 
2326
}$1"
 
2327
                        shift
 
2328
                        ;;
 
2329
 
 
2330
        --preserve-dup-deps)
 
2331
                        opt_preserve_dup_deps=: ;;
 
2332
 
 
2333
        --features)     func_features ;;
 
2334
 
 
2335
        --finish)       set dummy --mode finish ${1+"$@"}; shift ;;
 
2336
 
 
2337
        --help)         opt_help=: ;;
 
2338
 
 
2339
        --help-all)     opt_help=': help-all' ;;
 
2340
 
 
2341
        --mode)         test $# = 0 && func_missing_arg $_G_opt && break
 
2342
                        opt_mode=$1
 
2343
                        case $1 in
 
2344
                          # Valid mode arguments:
 
2345
                          clean|compile|execute|finish|install|link|relink|uninstall) ;;
 
2346
 
 
2347
                          # Catch anything else as an error
 
2348
                          *) func_error "invalid argument for $_G_opt"
 
2349
                             exit_cmd=exit
 
2350
                             break
 
2351
                             ;;
 
2352
                        esac
 
2353
                        shift
 
2354
                        ;;
 
2355
 
 
2356
        --no-silent|--no-quiet)
 
2357
                        opt_quiet=false
 
2358
                        func_append preserve_args " $_G_opt"
 
2359
                        ;;
 
2360
 
 
2361
        --no-warnings|--no-warning|--no-warn)
 
2362
                        opt_warning=false
 
2363
                        func_append preserve_args " $_G_opt"
 
2364
                        ;;
 
2365
 
 
2366
        --no-verbose)
 
2367
                        opt_verbose=false
 
2368
                        func_append preserve_args " $_G_opt"
 
2369
                        ;;
 
2370
 
 
2371
        --silent|--quiet)
 
2372
                        opt_quiet=:
 
2373
                        opt_verbose=false
 
2374
                        func_append preserve_args " $_G_opt"
 
2375
                        ;;
 
2376
 
 
2377
        --tag)          test $# = 0 && func_missing_arg $_G_opt && break
 
2378
                        opt_tag=$1
 
2379
                        func_append preserve_args " $_G_opt $1"
 
2380
                        func_enable_tag "$1"
 
2381
                        shift
 
2382
                        ;;
 
2383
 
 
2384
        --verbose|-v)   opt_quiet=false
 
2385
                        opt_verbose=:
 
2386
                        func_append preserve_args " $_G_opt"
 
2387
                        ;;
 
2388
 
 
2389
        # An option not handled by this hook function:
 
2390
        *)              set dummy "$_G_opt" ${1+"$@"};  shift; break  ;;
 
2391
      esac
 
2392
    done
 
2393
 
 
2394
 
 
2395
    # save modified positional parameters for caller
 
2396
    func_quote_for_eval ${1+"$@"}
 
2397
    libtool_parse_options_result=$func_quote_for_eval_result
 
2398
}
 
2399
func_add_hook func_parse_options libtool_parse_options
 
2400
 
 
2401
 
 
2402
 
 
2403
# libtool_validate_options [ARG]...
 
2404
# ---------------------------------
 
2405
# Perform any sanity checks on option settings and/or unconsumed
 
2406
# arguments.
 
2407
libtool_validate_options ()
 
2408
{
 
2409
    # save first non-option argument
 
2410
    if test 0 -lt $#; then
 
2411
      nonopt=$1
 
2412
      shift
 
2413
    fi
 
2414
 
 
2415
    # preserve --debug
 
2416
    test : = "$debug_cmd" || func_append preserve_args " --debug"
 
2417
 
 
2418
    case $host in
 
2419
      # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452
 
2420
      # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788
 
2421
      *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*)
 
2422
        # don't eliminate duplications in $postdeps and $predeps
 
2423
        opt_duplicate_compiler_generated_deps=:
 
2424
        ;;
 
2425
      *)
 
2426
        opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
 
2427
        ;;
 
2428
    esac
 
2429
 
 
2430
    $opt_help || {
 
2431
      # Sanity checks first:
 
2432
      func_check_version_match
 
2433
 
 
2434
      test yes != "$build_libtool_libs" \
 
2435
        && test yes != "$build_old_libs" \
 
2436
        && func_fatal_configuration "not configured to build any kind of library"
 
2437
 
 
2438
      # Darwin sucks
 
2439
      eval std_shrext=\"$shrext_cmds\"
 
2440
 
 
2441
      # Only execute mode is allowed to have -dlopen flags.
 
2442
      if test -n "$opt_dlopen" && test execute != "$opt_mode"; then
 
2443
        func_error "unrecognized option '-dlopen'"
 
2444
        $ECHO "$help" 1>&2
 
2445
        exit $EXIT_FAILURE
 
2446
      fi
 
2447
 
 
2448
      # Change the help message to a mode-specific one.
 
2449
      generic_help=$help
 
2450
      help="Try '$progname --help --mode=$opt_mode' for more information."
 
2451
    }
 
2452
 
 
2453
    # Pass back the unparsed argument list
 
2454
    func_quote_for_eval ${1+"$@"}
 
2455
    libtool_validate_options_result=$func_quote_for_eval_result
 
2456
}
 
2457
func_add_hook func_validate_options libtool_validate_options
 
2458
 
 
2459
 
 
2460
# Process options as early as possible so that --help and --version
 
2461
# can return quickly.
 
2462
func_options ${1+"$@"}
 
2463
eval set dummy "$func_options_result"; shift
1220
2464
 
1221
2465
 
1222
2466
 
1224
2468
##    Main.    ##
1225
2469
## ----------- ##
1226
2470
 
 
2471
magic='%%%MAGIC variable%%%'
 
2472
magic_exe='%%%MAGIC EXE variable%%%'
 
2473
 
 
2474
# Global variables.
 
2475
extracted_archives=
 
2476
extracted_serial=0
 
2477
 
 
2478
# If this variable is set in any of the actions, the command in it
 
2479
# will be execed at the end.  This prevents here-documents from being
 
2480
# left over by shells.
 
2481
exec_cmd=
 
2482
 
 
2483
 
 
2484
# A function that is used when there is no print builtin or printf.
 
2485
func_fallback_echo ()
 
2486
{
 
2487
  eval 'cat <<_LTECHO_EOF
 
2488
$1
 
2489
_LTECHO_EOF'
 
2490
}
 
2491
 
 
2492
# func_generated_by_libtool
 
2493
# True iff stdin has been generated by Libtool. This function is only
 
2494
# a basic sanity check; it will hardly flush out determined imposters.
 
2495
func_generated_by_libtool_p ()
 
2496
{
 
2497
  $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
 
2498
}
 
2499
 
1227
2500
# func_lalib_p file
1228
 
# True iff FILE is a libtool `.la' library or `.lo' object file.
 
2501
# True iff FILE is a libtool '.la' library or '.lo' object file.
1229
2502
# This function is only a basic sanity check; it will hardly flush out
1230
2503
# determined imposters.
1231
2504
func_lalib_p ()
1232
2505
{
1233
2506
    test -f "$1" &&
1234
 
      $SED -e 4q "$1" 2>/dev/null \
1235
 
        | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
 
2507
      $SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p
1236
2508
}
1237
2509
 
1238
2510
# func_lalib_unsafe_p file
1239
 
# True iff FILE is a libtool `.la' library or `.lo' object file.
 
2511
# True iff FILE is a libtool '.la' library or '.lo' object file.
1240
2512
# This function implements the same check as func_lalib_p without
1241
2513
# resorting to external programs.  To this end, it redirects stdin and
1242
2514
# closes it afterwards, without saving the original file descriptor.
1243
2515
# As a safety measure, use it only where a negative result would be
1244
 
# fatal anyway.  Works if `file' does not exist.
 
2516
# fatal anyway.  Works if 'file' does not exist.
1245
2517
func_lalib_unsafe_p ()
1246
2518
{
1247
2519
    lalib_p=no
1249
2521
        for lalib_p_l in 1 2 3 4
1250
2522
        do
1251
2523
            read lalib_p_line
1252
 
            case "$lalib_p_line" in
 
2524
            case $lalib_p_line in
1253
2525
                \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
1254
2526
            esac
1255
2527
        done
1256
2528
        exec 0<&5 5<&-
1257
2529
    fi
1258
 
    test "$lalib_p" = yes
 
2530
    test yes = "$lalib_p"
1259
2531
}
1260
2532
 
1261
2533
# func_ltwrapper_script_p file
1264
2536
# determined imposters.
1265
2537
func_ltwrapper_script_p ()
1266
2538
{
1267
 
    func_lalib_p "$1"
 
2539
    test -f "$1" &&
 
2540
      $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p
1268
2541
}
1269
2542
 
1270
2543
# func_ltwrapper_executable_p file
1289
2562
{
1290
2563
    func_dirname_and_basename "$1" "" "."
1291
2564
    func_stripname '' '.exe' "$func_basename_result"
1292
 
    func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
 
2565
    func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper
1293
2566
}
1294
2567
 
1295
2568
# func_ltwrapper_p file
1308
2581
# FAIL_CMD may read-access the current command in variable CMD!
1309
2582
func_execute_cmds ()
1310
2583
{
1311
 
    $opt_debug
 
2584
    $debug_cmd
 
2585
 
1312
2586
    save_ifs=$IFS; IFS='~'
1313
2587
    for cmd in $1; do
 
2588
      IFS=$sp$nl
 
2589
      eval cmd=\"$cmd\"
1314
2590
      IFS=$save_ifs
1315
 
      eval cmd=\"$cmd\"
1316
2591
      func_show_eval "$cmd" "${2-:}"
1317
2592
    done
1318
2593
    IFS=$save_ifs
1324
2599
# Note that it is not necessary on cygwin/mingw to append a dot to
1325
2600
# FILE even if both FILE and FILE.exe exist: automatic-append-.exe
1326
2601
# behavior happens only for exec(3), not for open(2)!  Also, sourcing
1327
 
# `FILE.' does not work on cygwin managed mounts.
 
2602
# 'FILE.' does not work on cygwin managed mounts.
1328
2603
func_source ()
1329
2604
{
1330
 
    $opt_debug
 
2605
    $debug_cmd
 
2606
 
1331
2607
    case $1 in
1332
2608
    */* | *\\*) . "$1" ;;
1333
2609
    *)          . "./$1" ;;
1354
2630
# store the result into func_replace_sysroot_result.
1355
2631
func_replace_sysroot ()
1356
2632
{
1357
 
  case "$lt_sysroot:$1" in
 
2633
  case $lt_sysroot:$1 in
1358
2634
  ?*:"$lt_sysroot"*)
1359
2635
    func_stripname "$lt_sysroot" '' "$1"
1360
 
    func_replace_sysroot_result="=$func_stripname_result"
 
2636
    func_replace_sysroot_result='='$func_stripname_result
1361
2637
    ;;
1362
2638
  *)
1363
2639
    # Including no sysroot.
1374
2650
# arg is usually of the form 'gcc ...'
1375
2651
func_infer_tag ()
1376
2652
{
1377
 
    $opt_debug
 
2653
    $debug_cmd
 
2654
 
1378
2655
    if test -n "$available_tags" && test -z "$tagname"; then
1379
2656
      CC_quoted=
1380
2657
      for arg in $CC; do
1393
2670
        for z in $available_tags; do
1394
2671
          if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
1395
2672
            # Evaluate the configuration.
1396
 
            eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
 
2673
            eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
1397
2674
            CC_quoted=
1398
2675
            for arg in $CC; do
1399
2676
              # Double-quote args containing other shell metacharacters.
1418
2695
        # line option must be used.
1419
2696
        if test -z "$tagname"; then
1420
2697
          func_echo "unable to infer tagged configuration"
1421
 
          func_fatal_error "specify a tag with \`--tag'"
 
2698
          func_fatal_error "specify a tag with '--tag'"
1422
2699
#       else
1423
2700
#         func_verbose "using $tagname tagged configuration"
1424
2701
        fi
1434
2711
# but don't create it if we're doing a dry run.
1435
2712
func_write_libtool_object ()
1436
2713
{
1437
 
    write_libobj=${1}
1438
 
    if test "$build_libtool_libs" = yes; then
1439
 
      write_lobj=\'${2}\'
 
2714
    write_libobj=$1
 
2715
    if test yes = "$build_libtool_libs"; then
 
2716
      write_lobj=\'$2\'
1440
2717
    else
1441
2718
      write_lobj=none
1442
2719
    fi
1443
2720
 
1444
 
    if test "$build_old_libs" = yes; then
1445
 
      write_oldobj=\'${3}\'
 
2721
    if test yes = "$build_old_libs"; then
 
2722
      write_oldobj=\'$3\'
1446
2723
    else
1447
2724
      write_oldobj=none
1448
2725
    fi
1450
2727
    $opt_dry_run || {
1451
2728
      cat >${write_libobj}T <<EOF
1452
2729
# $write_libobj - a libtool object file
1453
 
# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
 
2730
# Generated by $PROGRAM (GNU $PACKAGE) $VERSION
1454
2731
#
1455
2732
# Please DO NOT delete this file!
1456
2733
# It is necessary for linking the library.
1462
2739
non_pic_object=$write_oldobj
1463
2740
 
1464
2741
EOF
1465
 
      $MV "${write_libobj}T" "${write_libobj}"
 
2742
      $MV "${write_libobj}T" "$write_libobj"
1466
2743
    }
1467
2744
}
1468
2745
 
1482
2759
# be empty on error (or when ARG is empty)
1483
2760
func_convert_core_file_wine_to_w32 ()
1484
2761
{
1485
 
  $opt_debug
1486
 
  func_convert_core_file_wine_to_w32_result="$1"
 
2762
  $debug_cmd
 
2763
 
 
2764
  func_convert_core_file_wine_to_w32_result=$1
1487
2765
  if test -n "$1"; then
1488
2766
    # Unfortunately, winepath does not exit with a non-zero error code, so we
1489
2767
    # are forced to check the contents of stdout. On the other hand, if the
1491
2769
    # *an error message* to stdout. So we must check for both error code of
1492
2770
    # zero AND non-empty stdout, which explains the odd construction:
1493
2771
    func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
1494
 
    if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then
 
2772
    if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then
1495
2773
      func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
1496
 
        $SED -e "$lt_sed_naive_backslashify"`
 
2774
        $SED -e "$sed_naive_backslashify"`
1497
2775
    else
1498
2776
      func_convert_core_file_wine_to_w32_result=
1499
2777
    fi
1514
2792
# are convertible, then the result may be empty.
1515
2793
func_convert_core_path_wine_to_w32 ()
1516
2794
{
1517
 
  $opt_debug
 
2795
  $debug_cmd
 
2796
 
1518
2797
  # unfortunately, winepath doesn't convert paths, only file names
1519
 
  func_convert_core_path_wine_to_w32_result=""
 
2798
  func_convert_core_path_wine_to_w32_result=
1520
2799
  if test -n "$1"; then
1521
2800
    oldIFS=$IFS
1522
2801
    IFS=:
1523
2802
    for func_convert_core_path_wine_to_w32_f in $1; do
1524
2803
      IFS=$oldIFS
1525
2804
      func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
1526
 
      if test -n "$func_convert_core_file_wine_to_w32_result" ; then
 
2805
      if test -n "$func_convert_core_file_wine_to_w32_result"; then
1527
2806
        if test -z "$func_convert_core_path_wine_to_w32_result"; then
1528
 
          func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result"
 
2807
          func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result
1529
2808
        else
1530
2809
          func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
1531
2810
        fi
1554
2833
# environment variable; do not put it in $PATH.
1555
2834
func_cygpath ()
1556
2835
{
1557
 
  $opt_debug
 
2836
  $debug_cmd
 
2837
 
1558
2838
  if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
1559
2839
    func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
1560
2840
    if test "$?" -ne 0; then
1563
2843
    fi
1564
2844
  else
1565
2845
    func_cygpath_result=
1566
 
    func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'"
 
2846
    func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'"
1567
2847
  fi
1568
2848
}
1569
2849
#end: func_cygpath
1574
2854
# result in func_convert_core_msys_to_w32_result.
1575
2855
func_convert_core_msys_to_w32 ()
1576
2856
{
1577
 
  $opt_debug
 
2857
  $debug_cmd
 
2858
 
1578
2859
  # awkward: cmd appends spaces to result
1579
2860
  func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
1580
 
    $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
 
2861
    $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"`
1581
2862
}
1582
2863
#end: func_convert_core_msys_to_w32
1583
2864
 
1588
2869
# func_to_host_file_result to ARG1).
1589
2870
func_convert_file_check ()
1590
2871
{
1591
 
  $opt_debug
1592
 
  if test -z "$2" && test -n "$1" ; then
 
2872
  $debug_cmd
 
2873
 
 
2874
  if test -z "$2" && test -n "$1"; then
1593
2875
    func_error "Could not determine host file name corresponding to"
1594
 
    func_error "  \`$1'"
 
2876
    func_error "  '$1'"
1595
2877
    func_error "Continuing, but uninstalled executables may not work."
1596
2878
    # Fallback:
1597
 
    func_to_host_file_result="$1"
 
2879
    func_to_host_file_result=$1
1598
2880
  fi
1599
2881
}
1600
2882
# end func_convert_file_check
1606
2888
# func_to_host_file_result to a simplistic fallback value (see below).
1607
2889
func_convert_path_check ()
1608
2890
{
1609
 
  $opt_debug
 
2891
  $debug_cmd
 
2892
 
1610
2893
  if test -z "$4" && test -n "$3"; then
1611
2894
    func_error "Could not determine the host path corresponding to"
1612
 
    func_error "  \`$3'"
 
2895
    func_error "  '$3'"
1613
2896
    func_error "Continuing, but uninstalled executables may not work."
1614
2897
    # Fallback.  This is a deliberately simplistic "conversion" and
1615
2898
    # should not be "improved".  See libtool.info.
1618
2901
      func_to_host_path_result=`echo "$3" |
1619
2902
        $SED -e "$lt_replace_pathsep_chars"`
1620
2903
    else
1621
 
      func_to_host_path_result="$3"
 
2904
      func_to_host_path_result=$3
1622
2905
    fi
1623
2906
  fi
1624
2907
}
1630
2913
# and appending REPL if ORIG matches BACKPAT.
1631
2914
func_convert_path_front_back_pathsep ()
1632
2915
{
1633
 
  $opt_debug
 
2916
  $debug_cmd
 
2917
 
1634
2918
  case $4 in
1635
 
  $1 ) func_to_host_path_result="$3$func_to_host_path_result"
 
2919
  $1 ) func_to_host_path_result=$3$func_to_host_path_result
1636
2920
    ;;
1637
2921
  esac
1638
2922
  case $4 in
1646
2930
##################################################
1647
2931
# $build to $host FILE NAME CONVERSION FUNCTIONS #
1648
2932
##################################################
1649
 
# invoked via `$to_host_file_cmd ARG'
 
2933
# invoked via '$to_host_file_cmd ARG'
1650
2934
#
1651
2935
# In each case, ARG is the path to be converted from $build to $host format.
1652
2936
# Result will be available in $func_to_host_file_result.
1657
2941
# in func_to_host_file_result.
1658
2942
func_to_host_file ()
1659
2943
{
1660
 
  $opt_debug
 
2944
  $debug_cmd
 
2945
 
1661
2946
  $to_host_file_cmd "$1"
1662
2947
}
1663
2948
# end func_to_host_file
1669
2954
# in (the comma separated) LAZY, no conversion takes place.
1670
2955
func_to_tool_file ()
1671
2956
{
1672
 
  $opt_debug
 
2957
  $debug_cmd
 
2958
 
1673
2959
  case ,$2, in
1674
2960
    *,"$to_tool_file_cmd",*)
1675
2961
      func_to_tool_file_result=$1
1687
2973
# Copy ARG to func_to_host_file_result.
1688
2974
func_convert_file_noop ()
1689
2975
{
1690
 
  func_to_host_file_result="$1"
 
2976
  func_to_host_file_result=$1
1691
2977
}
1692
2978
# end func_convert_file_noop
1693
2979
 
1698
2984
# func_to_host_file_result.
1699
2985
func_convert_file_msys_to_w32 ()
1700
2986
{
1701
 
  $opt_debug
1702
 
  func_to_host_file_result="$1"
 
2987
  $debug_cmd
 
2988
 
 
2989
  func_to_host_file_result=$1
1703
2990
  if test -n "$1"; then
1704
2991
    func_convert_core_msys_to_w32 "$1"
1705
 
    func_to_host_file_result="$func_convert_core_msys_to_w32_result"
 
2992
    func_to_host_file_result=$func_convert_core_msys_to_w32_result
1706
2993
  fi
1707
2994
  func_convert_file_check "$1" "$func_to_host_file_result"
1708
2995
}
1714
3001
# func_to_host_file_result.
1715
3002
func_convert_file_cygwin_to_w32 ()
1716
3003
{
1717
 
  $opt_debug
1718
 
  func_to_host_file_result="$1"
 
3004
  $debug_cmd
 
3005
 
 
3006
  func_to_host_file_result=$1
1719
3007
  if test -n "$1"; then
1720
3008
    # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
1721
3009
    # LT_CYGPATH in this case.
1731
3019
# and a working winepath. Returns result in func_to_host_file_result.
1732
3020
func_convert_file_nix_to_w32 ()
1733
3021
{
1734
 
  $opt_debug
1735
 
  func_to_host_file_result="$1"
 
3022
  $debug_cmd
 
3023
 
 
3024
  func_to_host_file_result=$1
1736
3025
  if test -n "$1"; then
1737
3026
    func_convert_core_file_wine_to_w32 "$1"
1738
 
    func_to_host_file_result="$func_convert_core_file_wine_to_w32_result"
 
3027
    func_to_host_file_result=$func_convert_core_file_wine_to_w32_result
1739
3028
  fi
1740
3029
  func_convert_file_check "$1" "$func_to_host_file_result"
1741
3030
}
1747
3036
# Returns result in func_to_host_file_result.
1748
3037
func_convert_file_msys_to_cygwin ()
1749
3038
{
1750
 
  $opt_debug
1751
 
  func_to_host_file_result="$1"
 
3039
  $debug_cmd
 
3040
 
 
3041
  func_to_host_file_result=$1
1752
3042
  if test -n "$1"; then
1753
3043
    func_convert_core_msys_to_w32 "$1"
1754
3044
    func_cygpath -u "$func_convert_core_msys_to_w32_result"
1755
 
    func_to_host_file_result="$func_cygpath_result"
 
3045
    func_to_host_file_result=$func_cygpath_result
1756
3046
  fi
1757
3047
  func_convert_file_check "$1" "$func_to_host_file_result"
1758
3048
}
1765
3055
# in func_to_host_file_result.
1766
3056
func_convert_file_nix_to_cygwin ()
1767
3057
{
1768
 
  $opt_debug
1769
 
  func_to_host_file_result="$1"
 
3058
  $debug_cmd
 
3059
 
 
3060
  func_to_host_file_result=$1
1770
3061
  if test -n "$1"; then
1771
3062
    # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
1772
3063
    func_convert_core_file_wine_to_w32 "$1"
1773
3064
    func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
1774
 
    func_to_host_file_result="$func_cygpath_result"
 
3065
    func_to_host_file_result=$func_cygpath_result
1775
3066
  fi
1776
3067
  func_convert_file_check "$1" "$func_to_host_file_result"
1777
3068
}
1781
3072
#############################################
1782
3073
# $build to $host PATH CONVERSION FUNCTIONS #
1783
3074
#############################################
1784
 
# invoked via `$to_host_path_cmd ARG'
 
3075
# invoked via '$to_host_path_cmd ARG'
1785
3076
#
1786
3077
# In each case, ARG is the path to be converted from $build to $host format.
1787
3078
# The result will be available in $func_to_host_path_result.
1805
3096
to_host_path_cmd=
1806
3097
func_init_to_host_path_cmd ()
1807
3098
{
1808
 
  $opt_debug
 
3099
  $debug_cmd
 
3100
 
1809
3101
  if test -z "$to_host_path_cmd"; then
1810
3102
    func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
1811
 
    to_host_path_cmd="func_convert_path_${func_stripname_result}"
 
3103
    to_host_path_cmd=func_convert_path_$func_stripname_result
1812
3104
  fi
1813
3105
}
1814
3106
 
1818
3110
# in func_to_host_path_result.
1819
3111
func_to_host_path ()
1820
3112
{
1821
 
  $opt_debug
 
3113
  $debug_cmd
 
3114
 
1822
3115
  func_init_to_host_path_cmd
1823
3116
  $to_host_path_cmd "$1"
1824
3117
}
1829
3122
# Copy ARG to func_to_host_path_result.
1830
3123
func_convert_path_noop ()
1831
3124
{
1832
 
  func_to_host_path_result="$1"
 
3125
  func_to_host_path_result=$1
1833
3126
}
1834
3127
# end func_convert_path_noop
1835
3128
 
1840
3133
# func_to_host_path_result.
1841
3134
func_convert_path_msys_to_w32 ()
1842
3135
{
1843
 
  $opt_debug
1844
 
  func_to_host_path_result="$1"
 
3136
  $debug_cmd
 
3137
 
 
3138
  func_to_host_path_result=$1
1845
3139
  if test -n "$1"; then
1846
3140
    # Remove leading and trailing path separator characters from ARG.  MSYS
1847
3141
    # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
1849
3143
    func_stripname : : "$1"
1850
3144
    func_to_host_path_tmp1=$func_stripname_result
1851
3145
    func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
1852
 
    func_to_host_path_result="$func_convert_core_msys_to_w32_result"
 
3146
    func_to_host_path_result=$func_convert_core_msys_to_w32_result
1853
3147
    func_convert_path_check : ";" \
1854
3148
      "$func_to_host_path_tmp1" "$func_to_host_path_result"
1855
3149
    func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
1863
3157
# func_to_host_file_result.
1864
3158
func_convert_path_cygwin_to_w32 ()
1865
3159
{
1866
 
  $opt_debug
1867
 
  func_to_host_path_result="$1"
 
3160
  $debug_cmd
 
3161
 
 
3162
  func_to_host_path_result=$1
1868
3163
  if test -n "$1"; then
1869
3164
    # See func_convert_path_msys_to_w32:
1870
3165
    func_stripname : : "$1"
1883
3178
# a working winepath.  Returns result in func_to_host_file_result.
1884
3179
func_convert_path_nix_to_w32 ()
1885
3180
{
1886
 
  $opt_debug
1887
 
  func_to_host_path_result="$1"
 
3181
  $debug_cmd
 
3182
 
 
3183
  func_to_host_path_result=$1
1888
3184
  if test -n "$1"; then
1889
3185
    # See func_convert_path_msys_to_w32:
1890
3186
    func_stripname : : "$1"
1891
3187
    func_to_host_path_tmp1=$func_stripname_result
1892
3188
    func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
1893
 
    func_to_host_path_result="$func_convert_core_path_wine_to_w32_result"
 
3189
    func_to_host_path_result=$func_convert_core_path_wine_to_w32_result
1894
3190
    func_convert_path_check : ";" \
1895
3191
      "$func_to_host_path_tmp1" "$func_to_host_path_result"
1896
3192
    func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
1904
3200
# Returns result in func_to_host_file_result.
1905
3201
func_convert_path_msys_to_cygwin ()
1906
3202
{
1907
 
  $opt_debug
1908
 
  func_to_host_path_result="$1"
 
3203
  $debug_cmd
 
3204
 
 
3205
  func_to_host_path_result=$1
1909
3206
  if test -n "$1"; then
1910
3207
    # See func_convert_path_msys_to_w32:
1911
3208
    func_stripname : : "$1"
1912
3209
    func_to_host_path_tmp1=$func_stripname_result
1913
3210
    func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
1914
3211
    func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
1915
 
    func_to_host_path_result="$func_cygpath_result"
 
3212
    func_to_host_path_result=$func_cygpath_result
1916
3213
    func_convert_path_check : : \
1917
3214
      "$func_to_host_path_tmp1" "$func_to_host_path_result"
1918
3215
    func_convert_path_front_back_pathsep ":*" "*:" : "$1"
1927
3224
# func_to_host_file_result.
1928
3225
func_convert_path_nix_to_cygwin ()
1929
3226
{
1930
 
  $opt_debug
1931
 
  func_to_host_path_result="$1"
 
3227
  $debug_cmd
 
3228
 
 
3229
  func_to_host_path_result=$1
1932
3230
  if test -n "$1"; then
1933
3231
    # Remove leading and trailing path separator characters from
1934
3232
    # ARG. msys behavior is inconsistent here, cygpath turns them
1937
3235
    func_to_host_path_tmp1=$func_stripname_result
1938
3236
    func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
1939
3237
    func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
1940
 
    func_to_host_path_result="$func_cygpath_result"
 
3238
    func_to_host_path_result=$func_cygpath_result
1941
3239
    func_convert_path_check : : \
1942
3240
      "$func_to_host_path_tmp1" "$func_to_host_path_result"
1943
3241
    func_convert_path_front_back_pathsep ":*" "*:" : "$1"
1946
3244
# end func_convert_path_nix_to_cygwin
1947
3245
 
1948
3246
 
 
3247
# func_dll_def_p FILE
 
3248
# True iff FILE is a Windows DLL '.def' file.
 
3249
# Keep in sync with _LT_DLL_DEF_P in libtool.m4
 
3250
func_dll_def_p ()
 
3251
{
 
3252
  $debug_cmd
 
3253
 
 
3254
  func_dll_def_p_tmp=`$SED -n \
 
3255
    -e 's/^[     ]*//' \
 
3256
    -e '/^\(;.*\)*$/d' \
 
3257
    -e 's/^\(EXPORTS\|LIBRARY\)\([       ].*\)*$/DEF/p' \
 
3258
    -e q \
 
3259
    "$1"`
 
3260
  test DEF = "$func_dll_def_p_tmp"
 
3261
}
 
3262
 
 
3263
 
1949
3264
# func_mode_compile arg...
1950
3265
func_mode_compile ()
1951
3266
{
1952
 
    $opt_debug
 
3267
    $debug_cmd
 
3268
 
1953
3269
    # Get the compilation command and the source file.
1954
3270
    base_compile=
1955
 
    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
 
3271
    srcfile=$nonopt  #  always keep a non-empty value in "srcfile"
1956
3272
    suppress_opt=yes
1957
3273
    suppress_output=
1958
3274
    arg_mode=normal
1965
3281
      case $arg_mode in
1966
3282
      arg  )
1967
3283
        # do not "continue".  Instead, add this to base_compile
1968
 
        lastarg="$arg"
 
3284
        lastarg=$arg
1969
3285
        arg_mode=normal
1970
3286
        ;;
1971
3287
 
1972
3288
      target )
1973
 
        libobj="$arg"
 
3289
        libobj=$arg
1974
3290
        arg_mode=normal
1975
3291
        continue
1976
3292
        ;;
1980
3296
        case $arg in
1981
3297
        -o)
1982
3298
          test -n "$libobj" && \
1983
 
            func_fatal_error "you cannot specify \`-o' more than once"
 
3299
            func_fatal_error "you cannot specify '-o' more than once"
1984
3300
          arg_mode=target
1985
3301
          continue
1986
3302
          ;;
2009
3325
          func_stripname '-Wc,' '' "$arg"
2010
3326
          args=$func_stripname_result
2011
3327
          lastarg=
2012
 
          save_ifs="$IFS"; IFS=','
 
3328
          save_ifs=$IFS; IFS=,
2013
3329
          for arg in $args; do
2014
 
            IFS="$save_ifs"
 
3330
            IFS=$save_ifs
2015
3331
            func_append_quoted lastarg "$arg"
2016
3332
          done
2017
 
          IFS="$save_ifs"
 
3333
          IFS=$save_ifs
2018
3334
          func_stripname ' ' '' "$lastarg"
2019
3335
          lastarg=$func_stripname_result
2020
3336
 
2027
3343
          # Accept the current argument as the source file.
2028
3344
          # The previous "srcfile" becomes the current argument.
2029
3345
          #
2030
 
          lastarg="$srcfile"
2031
 
          srcfile="$arg"
 
3346
          lastarg=$srcfile
 
3347
          srcfile=$arg
2032
3348
          ;;
2033
3349
        esac  #  case $arg
2034
3350
        ;;
2043
3359
      func_fatal_error "you must specify an argument for -Xcompile"
2044
3360
      ;;
2045
3361
    target)
2046
 
      func_fatal_error "you must specify a target with \`-o'"
 
3362
      func_fatal_error "you must specify a target with '-o'"
2047
3363
      ;;
2048
3364
    *)
2049
3365
      # Get the name of the library object.
2050
3366
      test -z "$libobj" && {
2051
3367
        func_basename "$srcfile"
2052
 
        libobj="$func_basename_result"
 
3368
        libobj=$func_basename_result
2053
3369
      }
2054
3370
      ;;
2055
3371
    esac
2069
3385
    case $libobj in
2070
3386
    *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
2071
3387
    *)
2072
 
      func_fatal_error "cannot determine name of library object from \`$libobj'"
 
3388
      func_fatal_error "cannot determine name of library object from '$libobj'"
2073
3389
      ;;
2074
3390
    esac
2075
3391
 
2078
3394
    for arg in $later; do
2079
3395
      case $arg in
2080
3396
      -shared)
2081
 
        test "$build_libtool_libs" != yes && \
2082
 
          func_fatal_configuration "can not build a shared library"
 
3397
        test yes = "$build_libtool_libs" \
 
3398
          || func_fatal_configuration "cannot build a shared library"
2083
3399
        build_old_libs=no
2084
3400
        continue
2085
3401
        ;;
2105
3421
    func_quote_for_eval "$libobj"
2106
3422
    test "X$libobj" != "X$func_quote_for_eval_result" \
2107
3423
      && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"'    &()|`$[]' \
2108
 
      && func_warning "libobj name \`$libobj' may not contain shell special characters."
 
3424
      && func_warning "libobj name '$libobj' may not contain shell special characters."
2109
3425
    func_dirname_and_basename "$obj" "/" ""
2110
 
    objname="$func_basename_result"
2111
 
    xdir="$func_dirname_result"
2112
 
    lobj=${xdir}$objdir/$objname
 
3426
    objname=$func_basename_result
 
3427
    xdir=$func_dirname_result
 
3428
    lobj=$xdir$objdir/$objname
2113
3429
 
2114
3430
    test -z "$base_compile" && \
2115
3431
      func_fatal_help "you must specify a compilation command"
2116
3432
 
2117
3433
    # Delete any leftover library objects.
2118
 
    if test "$build_old_libs" = yes; then
 
3434
    if test yes = "$build_old_libs"; then
2119
3435
      removelist="$obj $lobj $libobj ${libobj}T"
2120
3436
    else
2121
3437
      removelist="$lobj $libobj ${libobj}T"
2127
3443
      pic_mode=default
2128
3444
      ;;
2129
3445
    esac
2130
 
    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
 
3446
    if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then
2131
3447
      # non-PIC code in shared libraries is not supported
2132
3448
      pic_mode=default
2133
3449
    fi
2134
3450
 
2135
3451
    # Calculate the filename of the output object if compiler does
2136
3452
    # not support -o with -c
2137
 
    if test "$compiler_c_o" = no; then
2138
 
      output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext}
2139
 
      lockfile="$output_obj.lock"
 
3453
    if test no = "$compiler_c_o"; then
 
3454
      output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext
 
3455
      lockfile=$output_obj.lock
2140
3456
    else
2141
3457
      output_obj=
2142
3458
      need_locks=no
2145
3461
 
2146
3462
    # Lock this critical section if it is needed
2147
3463
    # We use this script file to make the link, it avoids creating a new file
2148
 
    if test "$need_locks" = yes; then
 
3464
    if test yes = "$need_locks"; then
2149
3465
      until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
2150
3466
        func_echo "Waiting for $lockfile to be removed"
2151
3467
        sleep 2
2152
3468
      done
2153
 
    elif test "$need_locks" = warn; then
 
3469
    elif test warn = "$need_locks"; then
2154
3470
      if test -f "$lockfile"; then
2155
3471
        $ECHO "\
2156
3472
*** ERROR, $lockfile exists and contains:
2158
3474
 
2159
3475
This indicates that another process is trying to use the same
2160
3476
temporary object file, and libtool could not work around it because
2161
 
your compiler does not support \`-c' and \`-o' together.  If you
 
3477
your compiler does not support '-c' and '-o' together.  If you
2162
3478
repeat this compilation, it may succeed, by chance, but you had better
2163
3479
avoid parallel builds (make -j) in this platform, or get a better
2164
3480
compiler."
2180
3496
    qsrcfile=$func_quote_for_eval_result
2181
3497
 
2182
3498
    # Only build a PIC object if we are building libtool libraries.
2183
 
    if test "$build_libtool_libs" = yes; then
 
3499
    if test yes = "$build_libtool_libs"; then
2184
3500
      # Without this assignment, base_compile gets emptied.
2185
3501
      fbsd_hideous_sh_bug=$base_compile
2186
3502
 
2187
 
      if test "$pic_mode" != no; then
 
3503
      if test no != "$pic_mode"; then
2188
3504
        command="$base_compile $qsrcfile $pic_flag"
2189
3505
      else
2190
3506
        # Don't build PIC code
2201
3517
      func_show_eval_locale "$command"  \
2202
3518
          'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
2203
3519
 
2204
 
      if test "$need_locks" = warn &&
 
3520
      if test warn = "$need_locks" &&
2205
3521
         test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
2206
3522
        $ECHO "\
2207
3523
*** ERROR, $lockfile contains:
2212
3528
 
2213
3529
This indicates that another process is trying to use the same
2214
3530
temporary object file, and libtool could not work around it because
2215
 
your compiler does not support \`-c' and \`-o' together.  If you
 
3531
your compiler does not support '-c' and '-o' together.  If you
2216
3532
repeat this compilation, it may succeed, by chance, but you had better
2217
3533
avoid parallel builds (make -j) in this platform, or get a better
2218
3534
compiler."
2228
3544
      fi
2229
3545
 
2230
3546
      # Allow error messages only from the first compilation.
2231
 
      if test "$suppress_opt" = yes; then
 
3547
      if test yes = "$suppress_opt"; then
2232
3548
        suppress_output=' >/dev/null 2>&1'
2233
3549
      fi
2234
3550
    fi
2235
3551
 
2236
3552
    # Only build a position-dependent object if we build old libraries.
2237
 
    if test "$build_old_libs" = yes; then
2238
 
      if test "$pic_mode" != yes; then
 
3553
    if test yes = "$build_old_libs"; then
 
3554
      if test yes != "$pic_mode"; then
2239
3555
        # Don't build PIC code
2240
3556
        command="$base_compile $qsrcfile$pie_flag"
2241
3557
      else
2242
3558
        command="$base_compile $qsrcfile $pic_flag"
2243
3559
      fi
2244
 
      if test "$compiler_c_o" = yes; then
 
3560
      if test yes = "$compiler_c_o"; then
2245
3561
        func_append command " -o $obj"
2246
3562
      fi
2247
3563
 
2250
3566
      func_show_eval_locale "$command" \
2251
3567
        '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
2252
3568
 
2253
 
      if test "$need_locks" = warn &&
 
3569
      if test warn = "$need_locks" &&
2254
3570
         test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
2255
3571
        $ECHO "\
2256
3572
*** ERROR, $lockfile contains:
2261
3577
 
2262
3578
This indicates that another process is trying to use the same
2263
3579
temporary object file, and libtool could not work around it because
2264
 
your compiler does not support \`-c' and \`-o' together.  If you
 
3580
your compiler does not support '-c' and '-o' together.  If you
2265
3581
repeat this compilation, it may succeed, by chance, but you had better
2266
3582
avoid parallel builds (make -j) in this platform, or get a better
2267
3583
compiler."
2281
3597
      func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
2282
3598
 
2283
3599
      # Unlock the critical section if it was locked
2284
 
      if test "$need_locks" != no; then
 
3600
      if test no != "$need_locks"; then
2285
3601
        removelist=$lockfile
2286
3602
        $RM "$lockfile"
2287
3603
      fi
2291
3607
}
2292
3608
 
2293
3609
$opt_help || {
2294
 
  test "$opt_mode" = compile && func_mode_compile ${1+"$@"}
 
3610
  test compile = "$opt_mode" && func_mode_compile ${1+"$@"}
2295
3611
}
2296
3612
 
2297
3613
func_mode_help ()
2311
3627
Remove files from the build directory.
2312
3628
 
2313
3629
RM is the name of the program to use to delete files associated with each FILE
2314
 
(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
 
3630
(typically '/bin/rm').  RM-OPTIONS are options (such as '-f') to be passed
2315
3631
to RM.
2316
3632
 
2317
3633
If FILE is a libtool library, object or program, all the files associated
2330
3646
  -no-suppress      do not suppress compiler output for multiple passes
2331
3647
  -prefer-pic       try to build PIC objects only
2332
3648
  -prefer-non-pic   try to build non-PIC objects only
2333
 
  -shared           do not build a \`.o' file suitable for static linking
2334
 
  -static           only build a \`.o' file suitable for static linking
 
3649
  -shared           do not build a '.o' file suitable for static linking
 
3650
  -static           only build a '.o' file suitable for static linking
2335
3651
  -Wc,FLAG          pass FLAG directly to the compiler
2336
3652
 
2337
 
COMPILE-COMMAND is a command to be used in creating a \`standard' object file
 
3653
COMPILE-COMMAND is a command to be used in creating a 'standard' object file
2338
3654
from the given SOURCEFILE.
2339
3655
 
2340
3656
The output file name is determined by removing the directory component from
2341
 
SOURCEFILE, then substituting the C source code suffix \`.c' with the
2342
 
library object suffix, \`.lo'."
 
3657
SOURCEFILE, then substituting the C source code suffix '.c' with the
 
3658
library object suffix, '.lo'."
2343
3659
        ;;
2344
3660
 
2345
3661
      execute)
2352
3668
 
2353
3669
  -dlopen FILE      add the directory containing FILE to the library path
2354
3670
 
2355
 
This mode sets the library path environment variable according to \`-dlopen'
 
3671
This mode sets the library path environment variable according to '-dlopen'
2356
3672
flags.
2357
3673
 
2358
3674
If any of the ARGS are libtool executable wrappers, then they are translated
2371
3687
Each LIBDIR is a directory that contains libtool libraries.
2372
3688
 
2373
3689
The commands that this mode executes may require superuser privileges.  Use
2374
 
the \`--dry-run' option if you just want to see what would be executed."
 
3690
the '--dry-run' option if you just want to see what would be executed."
2375
3691
        ;;
2376
3692
 
2377
3693
      install)
2381
3697
Install executables or libraries.
2382
3698
 
2383
3699
INSTALL-COMMAND is the installation command.  The first component should be
2384
 
either the \`install' or \`cp' program.
 
3700
either the 'install' or 'cp' program.
2385
3701
 
2386
3702
The following components of INSTALL-COMMAND are treated specially:
2387
3703
 
2407
3723
  -avoid-version    do not add a version suffix if possible
2408
3724
  -bindir BINDIR    specify path to binaries directory (for systems where
2409
3725
                    libraries must be found in the PATH setting at runtime)
2410
 
  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
 
3726
  -dlopen FILE      '-dlpreopen' FILE if it cannot be dlopened at runtime
2411
3727
  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
2412
3728
  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
2413
3729
  -export-symbols SYMFILE
2421
3737
  -no-install       link a not-installable executable
2422
3738
  -no-undefined     declare that a library does not refer to external symbols
2423
3739
  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
2424
 
  -objectlist FILE  Use a list of object files found in FILE to specify objects
 
3740
  -objectlist FILE  use a list of object files found in FILE to specify objects
 
3741
  -os2dllname NAME  force a short DLL name on OS/2 (no effect on other OSes)
2425
3742
  -precious-files-regex REGEX
2426
3743
                    don't remove output files matching REGEX
2427
3744
  -release RELEASE  specify package release information
2441
3758
  -Xlinker FLAG     pass linker-specific FLAG directly to the linker
2442
3759
  -XCClinker FLAG   pass link-specific FLAG to the compiler driver (CC)
2443
3760
 
2444
 
All other options (arguments beginning with \`-') are ignored.
 
3761
All other options (arguments beginning with '-') are ignored.
2445
3762
 
2446
 
Every other argument is treated as a filename.  Files ending in \`.la' are
 
3763
Every other argument is treated as a filename.  Files ending in '.la' are
2447
3764
treated as uninstalled libtool libraries, other files are standard or library
2448
3765
object files.
2449
3766
 
2450
 
If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
2451
 
only library objects (\`.lo' files) may be specified, and \`-rpath' is
 
3767
If the OUTPUT-FILE ends in '.la', then a libtool library is created,
 
3768
only library objects ('.lo' files) may be specified, and '-rpath' is
2452
3769
required, except when creating a convenience library.
2453
3770
 
2454
 
If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
2455
 
using \`ar' and \`ranlib', or on Windows using \`lib'.
 
3771
If OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created
 
3772
using 'ar' and 'ranlib', or on Windows using 'lib'.
2456
3773
 
2457
 
If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
 
3774
If OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file
2458
3775
is created, otherwise an executable program is created."
2459
3776
        ;;
2460
3777
 
2465
3782
Remove libraries from an installation directory.
2466
3783
 
2467
3784
RM is the name of the program to use to delete files associated with each FILE
2468
 
(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
 
3785
(typically '/bin/rm').  RM-OPTIONS are options (such as '-f') to be passed
2469
3786
to RM.
2470
3787
 
2471
3788
If FILE is a libtool library, all the files associated with it are deleted.
2473
3790
        ;;
2474
3791
 
2475
3792
      *)
2476
 
        func_fatal_help "invalid operation mode \`$opt_mode'"
 
3793
        func_fatal_help "invalid operation mode '$opt_mode'"
2477
3794
        ;;
2478
3795
    esac
2479
3796
 
2480
3797
    echo
2481
 
    $ECHO "Try \`$progname --help' for more information about other modes."
 
3798
    $ECHO "Try '$progname --help' for more information about other modes."
2482
3799
}
2483
3800
 
2484
3801
# Now that we've collected a possible --mode arg, show help if necessary
2485
3802
if $opt_help; then
2486
 
  if test "$opt_help" = :; then
 
3803
  if test : = "$opt_help"; then
2487
3804
    func_mode_help
2488
3805
  else
2489
3806
    {
2491
3808
      for opt_mode in compile link execute install finish uninstall clean; do
2492
3809
        func_mode_help
2493
3810
      done
2494
 
    } | sed -n '1p; 2,$s/^Usage:/  or: /p'
 
3811
    } | $SED -n '1p; 2,$s/^Usage:/  or: /p'
2495
3812
    {
2496
3813
      func_help noexit
2497
3814
      for opt_mode in compile link execute install finish uninstall clean; do
2499
3816
        func_mode_help
2500
3817
      done
2501
3818
    } |
2502
 
    sed '1d
 
3819
    $SED '1d
2503
3820
      /^When reporting/,/^Report/{
2504
3821
        H
2505
3822
        d
2516
3833
# func_mode_execute arg...
2517
3834
func_mode_execute ()
2518
3835
{
2519
 
    $opt_debug
 
3836
    $debug_cmd
 
3837
 
2520
3838
    # The first argument is the command name.
2521
 
    cmd="$nonopt"
 
3839
    cmd=$nonopt
2522
3840
    test -z "$cmd" && \
2523
3841
      func_fatal_help "you must specify a COMMAND"
2524
3842
 
2525
3843
    # Handle -dlopen flags immediately.
2526
3844
    for file in $opt_dlopen; do
2527
3845
      test -f "$file" \
2528
 
        || func_fatal_help "\`$file' is not a file"
 
3846
        || func_fatal_help "'$file' is not a file"
2529
3847
 
2530
3848
      dir=
2531
3849
      case $file in
2535
3853
 
2536
3854
        # Check to see that this really is a libtool archive.
2537
3855
        func_lalib_unsafe_p "$file" \
2538
 
          || func_fatal_help "\`$lib' is not a valid libtool archive"
 
3856
          || func_fatal_help "'$lib' is not a valid libtool archive"
2539
3857
 
2540
3858
        # Read the libtool library.
2541
3859
        dlname=
2546
3864
        if test -z "$dlname"; then
2547
3865
          # Warn if it was a shared library.
2548
3866
          test -n "$library_names" && \
2549
 
            func_warning "\`$file' was not linked with \`-export-dynamic'"
 
3867
            func_warning "'$file' was not linked with '-export-dynamic'"
2550
3868
          continue
2551
3869
        fi
2552
3870
 
2553
3871
        func_dirname "$file" "" "."
2554
 
        dir="$func_dirname_result"
 
3872
        dir=$func_dirname_result
2555
3873
 
2556
3874
        if test -f "$dir/$objdir/$dlname"; then
2557
3875
          func_append dir "/$objdir"
2558
3876
        else
2559
3877
          if test ! -f "$dir/$dlname"; then
2560
 
            func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
 
3878
            func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'"
2561
3879
          fi
2562
3880
        fi
2563
3881
        ;;
2565
3883
      *.lo)
2566
3884
        # Just add the directory containing the .lo file.
2567
3885
        func_dirname "$file" "" "."
2568
 
        dir="$func_dirname_result"
 
3886
        dir=$func_dirname_result
2569
3887
        ;;
2570
3888
 
2571
3889
      *)
2572
 
        func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
 
3890
        func_warning "'-dlopen' is ignored for non-libtool libraries and objects"
2573
3891
        continue
2574
3892
        ;;
2575
3893
      esac
2576
3894
 
2577
3895
      # Get the absolute pathname.
2578
3896
      absdir=`cd "$dir" && pwd`
2579
 
      test -n "$absdir" && dir="$absdir"
 
3897
      test -n "$absdir" && dir=$absdir
2580
3898
 
2581
3899
      # Now add the directory to shlibpath_var.
2582
3900
      if eval "test -z \"\$$shlibpath_var\""; then
2588
3906
 
2589
3907
    # This variable tells wrapper scripts just to set shlibpath_var
2590
3908
    # rather than running their programs.
2591
 
    libtool_execute_magic="$magic"
 
3909
    libtool_execute_magic=$magic
2592
3910
 
2593
3911
    # Check if any of the arguments is a wrapper script.
2594
3912
    args=
2601
3919
        if func_ltwrapper_script_p "$file"; then
2602
3920
          func_source "$file"
2603
3921
          # Transform arg to wrapped name.
2604
 
          file="$progdir/$program"
 
3922
          file=$progdir/$program
2605
3923
        elif func_ltwrapper_executable_p "$file"; then
2606
3924
          func_ltwrapper_scriptname "$file"
2607
3925
          func_source "$func_ltwrapper_scriptname_result"
2608
3926
          # Transform arg to wrapped name.
2609
 
          file="$progdir/$program"
 
3927
          file=$progdir/$program
2610
3928
        fi
2611
3929
        ;;
2612
3930
      esac
2614
3932
      func_append_quoted args "$file"
2615
3933
    done
2616
3934
 
2617
 
    if test "X$opt_dry_run" = Xfalse; then
 
3935
    if $opt_dry_run; then
 
3936
      # Display what would be done.
 
3937
      if test -n "$shlibpath_var"; then
 
3938
        eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
 
3939
        echo "export $shlibpath_var"
 
3940
      fi
 
3941
      $ECHO "$cmd$args"
 
3942
      exit $EXIT_SUCCESS
 
3943
    else
2618
3944
      if test -n "$shlibpath_var"; then
2619
3945
        # Export the shlibpath_var.
2620
3946
        eval "export $shlibpath_var"
2631
3957
      done
2632
3958
 
2633
3959
      # Now prepare to actually exec the command.
2634
 
      exec_cmd="\$cmd$args"
2635
 
    else
2636
 
      # Display what would be done.
2637
 
      if test -n "$shlibpath_var"; then
2638
 
        eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
2639
 
        echo "export $shlibpath_var"
2640
 
      fi
2641
 
      $ECHO "$cmd$args"
2642
 
      exit $EXIT_SUCCESS
 
3960
      exec_cmd=\$cmd$args
2643
3961
    fi
2644
3962
}
2645
3963
 
2646
 
test "$opt_mode" = execute && func_mode_execute ${1+"$@"}
 
3964
test execute = "$opt_mode" && func_mode_execute ${1+"$@"}
2647
3965
 
2648
3966
 
2649
3967
# func_mode_finish arg...
2650
3968
func_mode_finish ()
2651
3969
{
2652
 
    $opt_debug
 
3970
    $debug_cmd
 
3971
 
2653
3972
    libs=
2654
3973
    libdirs=
2655
3974
    admincmds=
2663
3982
        if func_lalib_unsafe_p "$opt"; then
2664
3983
          func_append libs " $opt"
2665
3984
        else
2666
 
          func_warning "\`$opt' is not a valid libtool archive"
 
3985
          func_warning "'$opt' is not a valid libtool archive"
2667
3986
        fi
2668
3987
 
2669
3988
      else
2670
 
        func_fatal_error "invalid argument \`$opt'"
 
3989
        func_fatal_error "invalid argument '$opt'"
2671
3990
      fi
2672
3991
    done
2673
3992
 
2682
4001
      # Remove sysroot references
2683
4002
      if $opt_dry_run; then
2684
4003
        for lib in $libs; do
2685
 
          echo "removing references to $lt_sysroot and \`=' prefixes from $lib"
 
4004
          echo "removing references to $lt_sysroot and '=' prefixes from $lib"
2686
4005
        done
2687
4006
      else
2688
4007
        tmpdir=`func_mktempdir`
2689
4008
        for lib in $libs; do
2690
 
          sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
 
4009
          $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
2691
4010
            > $tmpdir/tmp-la
2692
4011
          mv -f $tmpdir/tmp-la $lib
2693
4012
        done
2712
4031
    fi
2713
4032
 
2714
4033
    # Exit here if they wanted silent mode.
2715
 
    $opt_silent && exit $EXIT_SUCCESS
 
4034
    $opt_quiet && exit $EXIT_SUCCESS
2716
4035
 
2717
4036
    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
2718
4037
      echo "----------------------------------------------------------------------"
2723
4042
      echo
2724
4043
      echo "If you ever happen to want to link against installed libraries"
2725
4044
      echo "in a given directory, LIBDIR, you must either use libtool, and"
2726
 
      echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
 
4045
      echo "specify the full pathname of the library, or use the '-LLIBDIR'"
2727
4046
      echo "flag during linking and do at least one of the following:"
2728
4047
      if test -n "$shlibpath_var"; then
2729
 
        echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
 
4048
        echo "   - add LIBDIR to the '$shlibpath_var' environment variable"
2730
4049
        echo "     during execution"
2731
4050
      fi
2732
4051
      if test -n "$runpath_var"; then
2733
 
        echo "   - add LIBDIR to the \`$runpath_var' environment variable"
 
4052
        echo "   - add LIBDIR to the '$runpath_var' environment variable"
2734
4053
        echo "     during linking"
2735
4054
      fi
2736
4055
      if test -n "$hardcode_libdir_flag_spec"; then
2737
4056
        libdir=LIBDIR
2738
4057
        eval flag=\"$hardcode_libdir_flag_spec\"
2739
4058
 
2740
 
        $ECHO "   - use the \`$flag' linker flag"
 
4059
        $ECHO "   - use the '$flag' linker flag"
2741
4060
      fi
2742
4061
      if test -n "$admincmds"; then
2743
4062
        $ECHO "   - have your system administrator run these commands:$admincmds"
2744
4063
      fi
2745
4064
      if test -f /etc/ld.so.conf; then
2746
 
        echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
 
4065
        echo "   - have your system administrator add LIBDIR to '/etc/ld.so.conf'"
2747
4066
      fi
2748
4067
      echo
2749
4068
 
2762
4081
    exit $EXIT_SUCCESS
2763
4082
}
2764
4083
 
2765
 
test "$opt_mode" = finish && func_mode_finish ${1+"$@"}
 
4084
test finish = "$opt_mode" && func_mode_finish ${1+"$@"}
2766
4085
 
2767
4086
 
2768
4087
# func_mode_install arg...
2769
4088
func_mode_install ()
2770
4089
{
2771
 
    $opt_debug
 
4090
    $debug_cmd
 
4091
 
2772
4092
    # There may be an optional sh(1) argument at the beginning of
2773
4093
    # install_prog (especially on Windows NT).
2774
 
    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
 
4094
    if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" ||
2775
4095
       # Allow the use of GNU shtool's install command.
2776
 
       case $nonopt in *shtool*) :;; *) false;; esac; then
 
4096
       case $nonopt in *shtool*) :;; *) false;; esac
 
4097
    then
2777
4098
      # Aesthetically quote it.
2778
4099
      func_quote_for_eval "$nonopt"
2779
4100
      install_prog="$func_quote_for_eval_result "
2800
4121
    opts=
2801
4122
    prev=
2802
4123
    install_type=
2803
 
    isdir=no
 
4124
    isdir=false
2804
4125
    stripme=
2805
4126
    no_mode=:
2806
4127
    for arg
2813
4134
      fi
2814
4135
 
2815
4136
      case $arg in
2816
 
      -d) isdir=yes ;;
 
4137
      -d) isdir=: ;;
2817
4138
      -f)
2818
4139
        if $install_cp; then :; else
2819
4140
          prev=$arg
2831
4152
      *)
2832
4153
        # If the previous option needed an argument, then skip it.
2833
4154
        if test -n "$prev"; then
2834
 
          if test "x$prev" = x-m && test -n "$install_override_mode"; then
 
4155
          if test X-m = "X$prev" && test -n "$install_override_mode"; then
2835
4156
            arg2=$install_override_mode
2836
4157
            no_mode=false
2837
4158
          fi
2856
4177
      func_fatal_help "you must specify an install program"
2857
4178
 
2858
4179
    test -n "$prev" && \
2859
 
      func_fatal_help "the \`$prev' option requires an argument"
 
4180
      func_fatal_help "the '$prev' option requires an argument"
2860
4181
 
2861
4182
    if test -n "$install_override_mode" && $no_mode; then
2862
4183
      if $install_cp; then :; else
2878
4199
    dest=$func_stripname_result
2879
4200
 
2880
4201
    # Check to see that the destination is a directory.
2881
 
    test -d "$dest" && isdir=yes
2882
 
    if test "$isdir" = yes; then
2883
 
      destdir="$dest"
 
4202
    test -d "$dest" && isdir=:
 
4203
    if $isdir; then
 
4204
      destdir=$dest
2884
4205
      destname=
2885
4206
    else
2886
4207
      func_dirname_and_basename "$dest" "" "."
2887
 
      destdir="$func_dirname_result"
2888
 
      destname="$func_basename_result"
 
4208
      destdir=$func_dirname_result
 
4209
      destname=$func_basename_result
2889
4210
 
2890
4211
      # Not a directory, so check to see that there is only one file specified.
2891
4212
      set dummy $files; shift
2892
4213
      test "$#" -gt 1 && \
2893
 
        func_fatal_help "\`$dest' is not a directory"
 
4214
        func_fatal_help "'$dest' is not a directory"
2894
4215
    fi
2895
4216
    case $destdir in
2896
4217
    [\\/]* | [A-Za-z]:[\\/]*) ;;
2899
4220
        case $file in
2900
4221
        *.lo) ;;
2901
4222
        *)
2902
 
          func_fatal_help "\`$destdir' must be an absolute directory name"
 
4223
          func_fatal_help "'$destdir' must be an absolute directory name"
2903
4224
          ;;
2904
4225
        esac
2905
4226
      done
2908
4229
 
2909
4230
    # This variable tells wrapper scripts just to set variables rather
2910
4231
    # than running their programs.
2911
 
    libtool_install_magic="$magic"
 
4232
    libtool_install_magic=$magic
2912
4233
 
2913
4234
    staticlibs=
2914
4235
    future_libdirs=
2928
4249
 
2929
4250
        # Check to see that this really is a libtool archive.
2930
4251
        func_lalib_unsafe_p "$file" \
2931
 
          || func_fatal_help "\`$file' is not a valid libtool archive"
 
4252
          || func_fatal_help "'$file' is not a valid libtool archive"
2932
4253
 
2933
4254
        library_names=
2934
4255
        old_library=
2950
4271
        fi
2951
4272
 
2952
4273
        func_dirname "$file" "/" ""
2953
 
        dir="$func_dirname_result"
 
4274
        dir=$func_dirname_result
2954
4275
        func_append dir "$objdir"
2955
4276
 
2956
4277
        if test -n "$relink_command"; then
2964
4285
          # are installed into $libdir/../bin (currently, that works fine)
2965
4286
          # but it's something to keep an eye on.
2966
4287
          test "$inst_prefix_dir" = "$destdir" && \
2967
 
            func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
 
4288
            func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir"
2968
4289
 
2969
4290
          if test -n "$inst_prefix_dir"; then
2970
4291
            # Stick the inst_prefix_dir data into the link command.
2973
4294
            relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
2974
4295
          fi
2975
4296
 
2976
 
          func_warning "relinking \`$file'"
 
4297
          func_warning "relinking '$file'"
2977
4298
          func_show_eval "$relink_command" \
2978
 
            'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
 
4299
            'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"'
2979
4300
        fi
2980
4301
 
2981
4302
        # See the names of the shared library.
2982
4303
        set dummy $library_names; shift
2983
4304
        if test -n "$1"; then
2984
 
          realname="$1"
 
4305
          realname=$1
2985
4306
          shift
2986
4307
 
2987
 
          srcname="$realname"
2988
 
          test -n "$relink_command" && srcname="$realname"T
 
4308
          srcname=$realname
 
4309
          test -n "$relink_command" && srcname=${realname}T
2989
4310
 
2990
4311
          # Install the shared library and build the symlinks.
2991
4312
          func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
2992
4313
              'exit $?'
2993
 
          tstripme="$stripme"
 
4314
          tstripme=$stripme
2994
4315
          case $host_os in
2995
4316
          cygwin* | mingw* | pw32* | cegcc*)
2996
4317
            case $realname in
2997
4318
            *.dll.a)
2998
 
              tstripme=""
 
4319
              tstripme=
 
4320
              ;;
 
4321
            esac
 
4322
            ;;
 
4323
          os2*)
 
4324
            case $realname in
 
4325
            *_dll.a)
 
4326
              tstripme=
2999
4327
              ;;
3000
4328
            esac
3001
4329
            ;;
3006
4334
 
3007
4335
          if test "$#" -gt 0; then
3008
4336
            # Delete the old symlinks, and create new ones.
3009
 
            # Try `ln -sf' first, because the `ln' binary might depend on
 
4337
            # Try 'ln -sf' first, because the 'ln' binary might depend on
3010
4338
            # the symlink we replace!  Solaris /bin/ln does not understand -f,
3011
4339
            # so we also need to try rm && ln -s.
3012
4340
            for linkname
3017
4345
          fi
3018
4346
 
3019
4347
          # Do each command in the postinstall commands.
3020
 
          lib="$destdir/$realname"
 
4348
          lib=$destdir/$realname
3021
4349
          func_execute_cmds "$postinstall_cmds" 'exit $?'
3022
4350
        fi
3023
4351
 
3024
4352
        # Install the pseudo-library for information purposes.
3025
4353
        func_basename "$file"
3026
 
        name="$func_basename_result"
3027
 
        instname="$dir/$name"i
 
4354
        name=$func_basename_result
 
4355
        instname=$dir/${name}i
3028
4356
        func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
3029
4357
 
3030
4358
        # Maybe install the static library, too.
3036
4364
 
3037
4365
        # Figure out destination file name, if it wasn't already specified.
3038
4366
        if test -n "$destname"; then
3039
 
          destfile="$destdir/$destname"
 
4367
          destfile=$destdir/$destname
3040
4368
        else
3041
4369
          func_basename "$file"
3042
 
          destfile="$func_basename_result"
3043
 
          destfile="$destdir/$destfile"
 
4370
          destfile=$func_basename_result
 
4371
          destfile=$destdir/$destfile
3044
4372
        fi
3045
4373
 
3046
4374
        # Deduce the name of the destination old-style object file.
3050
4378
          staticdest=$func_lo2o_result
3051
4379
          ;;
3052
4380
        *.$objext)
3053
 
          staticdest="$destfile"
 
4381
          staticdest=$destfile
3054
4382
          destfile=
3055
4383
          ;;
3056
4384
        *)
3057
 
          func_fatal_help "cannot copy a libtool object to \`$destfile'"
 
4385
          func_fatal_help "cannot copy a libtool object to '$destfile'"
3058
4386
          ;;
3059
4387
        esac
3060
4388
 
3063
4391
          func_show_eval "$install_prog $file $destfile" 'exit $?'
3064
4392
 
3065
4393
        # Install the old object if enabled.
3066
 
        if test "$build_old_libs" = yes; then
 
4394
        if test yes = "$build_old_libs"; then
3067
4395
          # Deduce the name of the old-style object file.
3068
4396
          func_lo2o "$file"
3069
4397
          staticobj=$func_lo2o_result
3075
4403
      *)
3076
4404
        # Figure out destination file name, if it wasn't already specified.
3077
4405
        if test -n "$destname"; then
3078
 
          destfile="$destdir/$destname"
 
4406
          destfile=$destdir/$destname
3079
4407
        else
3080
4408
          func_basename "$file"
3081
 
          destfile="$func_basename_result"
3082
 
          destfile="$destdir/$destfile"
 
4409
          destfile=$func_basename_result
 
4410
          destfile=$destdir/$destfile
3083
4411
        fi
3084
4412
 
3085
4413
        # If the file is missing, and there is a .exe on the end, strip it
3086
4414
        # because it is most likely a libtool script we actually want to
3087
4415
        # install
3088
 
        stripped_ext=""
 
4416
        stripped_ext=
3089
4417
        case $file in
3090
4418
          *.exe)
3091
4419
            if test ! -f "$file"; then
3092
4420
              func_stripname '' '.exe' "$file"
3093
4421
              file=$func_stripname_result
3094
 
              stripped_ext=".exe"
 
4422
              stripped_ext=.exe
3095
4423
            fi
3096
4424
            ;;
3097
4425
        esac
3119
4447
 
3120
4448
          # Check the variables that should have been set.
3121
4449
          test -z "$generated_by_libtool_version" && \
3122
 
            func_fatal_error "invalid libtool wrapper script \`$wrapper'"
 
4450
            func_fatal_error "invalid libtool wrapper script '$wrapper'"
3123
4451
 
3124
 
          finalize=yes
 
4452
          finalize=:
3125
4453
          for lib in $notinst_deplibs; do
3126
4454
            # Check to see that each library is installed.
3127
4455
            libdir=
3128
4456
            if test -f "$lib"; then
3129
4457
              func_source "$lib"
3130
4458
            fi
3131
 
            libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test
 
4459
            libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'`
3132
4460
            if test -n "$libdir" && test ! -f "$libfile"; then
3133
 
              func_warning "\`$lib' has not been installed in \`$libdir'"
3134
 
              finalize=no
 
4461
              func_warning "'$lib' has not been installed in '$libdir'"
 
4462
              finalize=false
3135
4463
            fi
3136
4464
          done
3137
4465
 
3139
4467
          func_source "$wrapper"
3140
4468
 
3141
4469
          outputname=
3142
 
          if test "$fast_install" = no && test -n "$relink_command"; then
 
4470
          if test no = "$fast_install" && test -n "$relink_command"; then
3143
4471
            $opt_dry_run || {
3144
 
              if test "$finalize" = yes; then
 
4472
              if $finalize; then
3145
4473
                tmpdir=`func_mktempdir`
3146
4474
                func_basename "$file$stripped_ext"
3147
 
                file="$func_basename_result"
3148
 
                outputname="$tmpdir/$file"
 
4475
                file=$func_basename_result
 
4476
                outputname=$tmpdir/$file
3149
4477
                # Replace the output file specification.
3150
4478
                relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
3151
4479
 
3152
 
                $opt_silent || {
 
4480
                $opt_quiet || {
3153
4481
                  func_quote_for_expand "$relink_command"
3154
4482
                  eval "func_echo $func_quote_for_expand_result"
3155
4483
                }
3156
4484
                if eval "$relink_command"; then :
3157
4485
                  else
3158
 
                  func_error "error: relink \`$file' with the above command before installing it"
 
4486
                  func_error "error: relink '$file' with the above command before installing it"
3159
4487
                  $opt_dry_run || ${RM}r "$tmpdir"
3160
4488
                  continue
3161
4489
                fi
3162
 
                file="$outputname"
 
4490
                file=$outputname
3163
4491
              else
3164
 
                func_warning "cannot relink \`$file'"
 
4492
                func_warning "cannot relink '$file'"
3165
4493
              fi
3166
4494
            }
3167
4495
          else
3198
4526
 
3199
4527
    for file in $staticlibs; do
3200
4528
      func_basename "$file"
3201
 
      name="$func_basename_result"
 
4529
      name=$func_basename_result
3202
4530
 
3203
4531
      # Set up the ranlib parameters.
3204
 
      oldlib="$destdir/$name"
 
4532
      oldlib=$destdir/$name
3205
4533
      func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
3206
4534
      tool_oldlib=$func_to_tool_file_result
3207
4535
 
3216
4544
    done
3217
4545
 
3218
4546
    test -n "$future_libdirs" && \
3219
 
      func_warning "remember to run \`$progname --finish$future_libdirs'"
 
4547
      func_warning "remember to run '$progname --finish$future_libdirs'"
3220
4548
 
3221
4549
    if test -n "$current_libdirs"; then
3222
4550
      # Maybe just do a dry run.
3223
4551
      $opt_dry_run && current_libdirs=" -n$current_libdirs"
3224
 
      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
 
4552
      exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs'
3225
4553
    else
3226
4554
      exit $EXIT_SUCCESS
3227
4555
    fi
3228
4556
}
3229
4557
 
3230
 
test "$opt_mode" = install && func_mode_install ${1+"$@"}
 
4558
test install = "$opt_mode" && func_mode_install ${1+"$@"}
3231
4559
 
3232
4560
 
3233
4561
# func_generate_dlsyms outputname originator pic_p
3235
4563
# a dlpreopen symbol table.
3236
4564
func_generate_dlsyms ()
3237
4565
{
3238
 
    $opt_debug
3239
 
    my_outputname="$1"
3240
 
    my_originator="$2"
3241
 
    my_pic_p="${3-no}"
3242
 
    my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
 
4566
    $debug_cmd
 
4567
 
 
4568
    my_outputname=$1
 
4569
    my_originator=$2
 
4570
    my_pic_p=${3-false}
 
4571
    my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'`
3243
4572
    my_dlsyms=
3244
4573
 
3245
 
    if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
 
4574
    if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
3246
4575
      if test -n "$NM" && test -n "$global_symbol_pipe"; then
3247
 
        my_dlsyms="${my_outputname}S.c"
 
4576
        my_dlsyms=${my_outputname}S.c
3248
4577
      else
3249
4578
        func_error "not configured to extract global symbols from dlpreopened files"
3250
4579
      fi
3255
4584
      "") ;;
3256
4585
      *.c)
3257
4586
        # Discover the nlist of each of the dlfiles.
3258
 
        nlist="$output_objdir/${my_outputname}.nm"
 
4587
        nlist=$output_objdir/$my_outputname.nm
3259
4588
 
3260
4589
        func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
3261
4590
 
3263
4592
        func_verbose "creating $output_objdir/$my_dlsyms"
3264
4593
 
3265
4594
        $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
3266
 
/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
3267
 
/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
 
4595
/* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */
 
4596
/* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */
3268
4597
 
3269
4598
#ifdef __cplusplus
3270
4599
extern \"C\" {
3271
4600
#endif
3272
4601
 
3273
 
#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
 
4602
#if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
3274
4603
#pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
3275
4604
#endif
3276
4605
 
3277
4606
/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
3278
 
#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
3279
 
/* DATA imports from DLLs on WIN32 con't be const, because runtime
 
4607
#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
 
4608
/* DATA imports from DLLs on WIN32 can't be const, because runtime
3280
4609
   relocations are performed -- see ld's documentation on pseudo-relocs.  */
3281
4610
# define LT_DLSYM_CONST
3282
 
#elif defined(__osf__)
 
4611
#elif defined __osf__
3283
4612
/* This system does not cope well with relocations in const data.  */
3284
4613
# define LT_DLSYM_CONST
3285
4614
#else
3286
4615
# define LT_DLSYM_CONST const
3287
4616
#endif
3288
4617
 
 
4618
#define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
 
4619
 
3289
4620
/* External symbol declarations for the compiler. */\
3290
4621
"
3291
4622
 
3292
 
        if test "$dlself" = yes; then
3293
 
          func_verbose "generating symbol list for \`$output'"
 
4623
        if test yes = "$dlself"; then
 
4624
          func_verbose "generating symbol list for '$output'"
3294
4625
 
3295
4626
          $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
3296
4627
 
3298
4629
          progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
3299
4630
          for progfile in $progfiles; do
3300
4631
            func_to_tool_file "$progfile" func_convert_file_msys_to_w32
3301
 
            func_verbose "extracting global C symbols from \`$func_to_tool_file_result'"
 
4632
            func_verbose "extracting global C symbols from '$func_to_tool_file_result'"
3302
4633
            $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
3303
4634
          done
3304
4635
 
3318
4649
 
3319
4650
          # Prepare the list of exported symbols
3320
4651
          if test -z "$export_symbols"; then
3321
 
            export_symbols="$output_objdir/$outputname.exp"
 
4652
            export_symbols=$output_objdir/$outputname.exp
3322
4653
            $opt_dry_run || {
3323
4654
              $RM $export_symbols
3324
 
              eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
 
4655
              eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3325
4656
              case $host in
3326
4657
              *cygwin* | *mingw* | *cegcc* )
3327
4658
                eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
3331
4662
            }
3332
4663
          else
3333
4664
            $opt_dry_run || {
3334
 
              eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
 
4665
              eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
3335
4666
              eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
3336
4667
              eval '$MV "$nlist"T "$nlist"'
3337
4668
              case $host in
3345
4676
        fi
3346
4677
 
3347
4678
        for dlprefile in $dlprefiles; do
3348
 
          func_verbose "extracting global C symbols from \`$dlprefile'"
 
4679
          func_verbose "extracting global C symbols from '$dlprefile'"
3349
4680
          func_basename "$dlprefile"
3350
 
          name="$func_basename_result"
 
4681
          name=$func_basename_result
3351
4682
          case $host in
3352
4683
            *cygwin* | *mingw* | *cegcc* )
3353
4684
              # if an import library, we need to obtain dlname
3354
4685
              if func_win32_import_lib_p "$dlprefile"; then
3355
4686
                func_tr_sh "$dlprefile"
3356
4687
                eval "curr_lafile=\$libfile_$func_tr_sh_result"
3357
 
                dlprefile_dlbasename=""
 
4688
                dlprefile_dlbasename=
3358
4689
                if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
3359
4690
                  # Use subshell, to avoid clobbering current variable values
3360
4691
                  dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
3361
 
                  if test -n "$dlprefile_dlname" ; then
 
4692
                  if test -n "$dlprefile_dlname"; then
3362
4693
                    func_basename "$dlprefile_dlname"
3363
 
                    dlprefile_dlbasename="$func_basename_result"
 
4694
                    dlprefile_dlbasename=$func_basename_result
3364
4695
                  else
3365
4696
                    # no lafile. user explicitly requested -dlpreopen <import library>.
3366
4697
                    $sharedlib_from_linklib_cmd "$dlprefile"
3368
4699
                  fi
3369
4700
                fi
3370
4701
                $opt_dry_run || {
3371
 
                  if test -n "$dlprefile_dlbasename" ; then
 
4702
                  if test -n "$dlprefile_dlbasename"; then
3372
4703
                    eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
3373
4704
                  else
3374
4705
                    func_warning "Could not compute DLL name from $name"
3424
4755
            echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
3425
4756
          fi
3426
4757
 
 
4758
          func_show_eval '$RM "${nlist}I"'
 
4759
          if test -n "$global_symbol_to_import"; then
 
4760
            eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I'
 
4761
          fi
 
4762
 
3427
4763
          echo >> "$output_objdir/$my_dlsyms" "\
3428
4764
 
3429
4765
/* The mapping between symbol names and symbols.  */
3432
4768
  void *address;
3433
4769
} lt_dlsymlist;
3434
4770
extern LT_DLSYM_CONST lt_dlsymlist
3435
 
lt_${my_prefix}_LTX_preloaded_symbols[];
 
4771
lt_${my_prefix}_LTX_preloaded_symbols[];\
 
4772
"
 
4773
 
 
4774
          if test -s "$nlist"I; then
 
4775
            echo >> "$output_objdir/$my_dlsyms" "\
 
4776
static void lt_syminit(void)
 
4777
{
 
4778
  LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols;
 
4779
  for (; symbol->name; ++symbol)
 
4780
    {"
 
4781
            $SED 's/.*/      if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms"
 
4782
            echo >> "$output_objdir/$my_dlsyms" "\
 
4783
    }
 
4784
}"
 
4785
          fi
 
4786
          echo >> "$output_objdir/$my_dlsyms" "\
3436
4787
LT_DLSYM_CONST lt_dlsymlist
3437
4788
lt_${my_prefix}_LTX_preloaded_symbols[] =
3438
 
{\
3439
 
  { \"$my_originator\", (void *) 0 },"
 
4789
{ {\"$my_originator\", (void *) 0},"
 
4790
 
 
4791
          if test -s "$nlist"I; then
 
4792
            echo >> "$output_objdir/$my_dlsyms" "\
 
4793
  {\"@INIT@\", (void *) &lt_syminit},"
 
4794
          fi
3440
4795
 
3441
4796
          case $need_lib_prefix in
3442
4797
          no)
3478
4833
          *-*-hpux*)
3479
4834
            pic_flag_for_symtable=" $pic_flag"  ;;
3480
4835
          *)
3481
 
            if test "X$my_pic_p" != Xno; then
3482
 
              pic_flag_for_symtable=" $pic_flag"
3483
 
            fi
 
4836
            $my_pic_p && pic_flag_for_symtable=" $pic_flag"
3484
4837
            ;;
3485
4838
          esac
3486
4839
          ;;
3497
4850
        func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
3498
4851
 
3499
4852
        # Clean up the generated files.
3500
 
        func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
 
4853
        func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"'
3501
4854
 
3502
4855
        # Transform the symbol file into the correct name.
3503
 
        symfileobj="$output_objdir/${my_outputname}S.$objext"
 
4856
        symfileobj=$output_objdir/${my_outputname}S.$objext
3504
4857
        case $host in
3505
4858
        *cygwin* | *mingw* | *cegcc* )
3506
4859
          if test -f "$output_objdir/$my_outputname.def"; then
3518
4871
        esac
3519
4872
        ;;
3520
4873
      *)
3521
 
        func_fatal_error "unknown suffix for \`$my_dlsyms'"
 
4874
        func_fatal_error "unknown suffix for '$my_dlsyms'"
3522
4875
        ;;
3523
4876
      esac
3524
4877
    else
3532
4885
    fi
3533
4886
}
3534
4887
 
 
4888
# func_cygming_gnu_implib_p ARG
 
4889
# This predicate returns with zero status (TRUE) if
 
4890
# ARG is a GNU/binutils-style import library. Returns
 
4891
# with nonzero status (FALSE) otherwise.
 
4892
func_cygming_gnu_implib_p ()
 
4893
{
 
4894
  $debug_cmd
 
4895
 
 
4896
  func_to_tool_file "$1" func_convert_file_msys_to_w32
 
4897
  func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'`
 
4898
  test -n "$func_cygming_gnu_implib_tmp"
 
4899
}
 
4900
 
 
4901
# func_cygming_ms_implib_p ARG
 
4902
# This predicate returns with zero status (TRUE) if
 
4903
# ARG is an MS-style import library. Returns
 
4904
# with nonzero status (FALSE) otherwise.
 
4905
func_cygming_ms_implib_p ()
 
4906
{
 
4907
  $debug_cmd
 
4908
 
 
4909
  func_to_tool_file "$1" func_convert_file_msys_to_w32
 
4910
  func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
 
4911
  test -n "$func_cygming_ms_implib_tmp"
 
4912
}
 
4913
 
3535
4914
# func_win32_libid arg
3536
4915
# return the library type of file 'arg'
3537
4916
#
3541
4920
# Despite the name, also deal with 64 bit binaries.
3542
4921
func_win32_libid ()
3543
4922
{
3544
 
  $opt_debug
3545
 
  win32_libid_type="unknown"
 
4923
  $debug_cmd
 
4924
 
 
4925
  win32_libid_type=unknown
3546
4926
  win32_fileres=`file -L $1 2>/dev/null`
3547
4927
  case $win32_fileres in
3548
4928
  *ar\ archive\ import\ library*) # definitely import
3552
4932
    # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
3553
4933
    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
3554
4934
       $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
3555
 
      func_to_tool_file "$1" func_convert_file_msys_to_w32
3556
 
      win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
3557
 
        $SED -n -e '
 
4935
      case $nm_interface in
 
4936
      "MS dumpbin")
 
4937
        if func_cygming_ms_implib_p "$1" ||
 
4938
           func_cygming_gnu_implib_p "$1"
 
4939
        then
 
4940
          win32_nmres=import
 
4941
        else
 
4942
          win32_nmres=
 
4943
        fi
 
4944
        ;;
 
4945
      *)
 
4946
        func_to_tool_file "$1" func_convert_file_msys_to_w32
 
4947
        win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
 
4948
          $SED -n -e '
3558
4949
            1,100{
3559
4950
                / I /{
3560
 
                    s,.*,import,
 
4951
                    s|.*|import|
3561
4952
                    p
3562
4953
                    q
3563
4954
                }
3564
4955
            }'`
 
4956
        ;;
 
4957
      esac
3565
4958
      case $win32_nmres in
3566
4959
      import*)  win32_libid_type="x86 archive import";;
3567
4960
      *)        win32_libid_type="x86 archive static";;
3593
4986
#    $sharedlib_from_linklib_result
3594
4987
func_cygming_dll_for_implib ()
3595
4988
{
3596
 
  $opt_debug
 
4989
  $debug_cmd
 
4990
 
3597
4991
  sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
3598
4992
}
3599
4993
 
3610
5004
# specified import library.
3611
5005
func_cygming_dll_for_implib_fallback_core ()
3612
5006
{
3613
 
  $opt_debug
 
5007
  $debug_cmd
 
5008
 
3614
5009
  match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
3615
5010
  $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
3616
5011
    $SED '/^Contents of section '"$match_literal"':/{
3646
5041
      /./p' |
3647
5042
    # we now have a list, one entry per line, of the stringified
3648
5043
    # contents of the appropriate section of all members of the
3649
 
    # archive which possess that section. Heuristic: eliminate
3650
 
    # all those which have a first or second character that is
 
5044
    # archive that possess that section. Heuristic: eliminate
 
5045
    # all those that have a first or second character that is
3651
5046
    # a '.' (that is, objdump's representation of an unprintable
3652
5047
    # character.) This should work for all archives with less than
3653
5048
    # 0x302f exports -- but will fail for DLLs whose name actually
3658
5053
    $SED -e '/^\./d;/^.\./d;q'
3659
5054
}
3660
5055
 
3661
 
# func_cygming_gnu_implib_p ARG
3662
 
# This predicate returns with zero status (TRUE) if
3663
 
# ARG is a GNU/binutils-style import library. Returns
3664
 
# with nonzero status (FALSE) otherwise.
3665
 
func_cygming_gnu_implib_p ()
3666
 
{
3667
 
  $opt_debug
3668
 
  func_to_tool_file "$1" func_convert_file_msys_to_w32
3669
 
  func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'`
3670
 
  test -n "$func_cygming_gnu_implib_tmp"
3671
 
}
3672
 
 
3673
 
# func_cygming_ms_implib_p ARG
3674
 
# This predicate returns with zero status (TRUE) if
3675
 
# ARG is an MS-style import library. Returns
3676
 
# with nonzero status (FALSE) otherwise.
3677
 
func_cygming_ms_implib_p ()
3678
 
{
3679
 
  $opt_debug
3680
 
  func_to_tool_file "$1" func_convert_file_msys_to_w32
3681
 
  func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
3682
 
  test -n "$func_cygming_ms_implib_tmp"
3683
 
}
3684
 
 
3685
5056
# func_cygming_dll_for_implib_fallback ARG
3686
5057
# Platform-specific function to extract the
3687
5058
# name of the DLL associated with the specified
3695
5066
#    $sharedlib_from_linklib_result
3696
5067
func_cygming_dll_for_implib_fallback ()
3697
5068
{
3698
 
  $opt_debug
3699
 
  if func_cygming_gnu_implib_p "$1" ; then
 
5069
  $debug_cmd
 
5070
 
 
5071
  if func_cygming_gnu_implib_p "$1"; then
3700
5072
    # binutils import library
3701
5073
    sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
3702
 
  elif func_cygming_ms_implib_p "$1" ; then
 
5074
  elif func_cygming_ms_implib_p "$1"; then
3703
5075
    # ms-generated import library
3704
5076
    sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
3705
5077
  else
3706
5078
    # unknown
3707
 
    sharedlib_from_linklib_result=""
 
5079
    sharedlib_from_linklib_result=
3708
5080
  fi
3709
5081
}
3710
5082
 
3712
5084
# func_extract_an_archive dir oldlib
3713
5085
func_extract_an_archive ()
3714
5086
{
3715
 
    $opt_debug
3716
 
    f_ex_an_ar_dir="$1"; shift
3717
 
    f_ex_an_ar_oldlib="$1"
3718
 
    if test "$lock_old_archive_extraction" = yes; then
 
5087
    $debug_cmd
 
5088
 
 
5089
    f_ex_an_ar_dir=$1; shift
 
5090
    f_ex_an_ar_oldlib=$1
 
5091
    if test yes = "$lock_old_archive_extraction"; then
3719
5092
      lockfile=$f_ex_an_ar_oldlib.lock
3720
5093
      until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
3721
5094
        func_echo "Waiting for $lockfile to be removed"
3724
5097
    fi
3725
5098
    func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
3726
5099
                   'stat=$?; rm -f "$lockfile"; exit $stat'
3727
 
    if test "$lock_old_archive_extraction" = yes; then
 
5100
    if test yes = "$lock_old_archive_extraction"; then
3728
5101
      $opt_dry_run || rm -f "$lockfile"
3729
5102
    fi
3730
5103
    if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
3738
5111
# func_extract_archives gentop oldlib ...
3739
5112
func_extract_archives ()
3740
5113
{
3741
 
    $opt_debug
3742
 
    my_gentop="$1"; shift
 
5114
    $debug_cmd
 
5115
 
 
5116
    my_gentop=$1; shift
3743
5117
    my_oldlibs=${1+"$@"}
3744
 
    my_oldobjs=""
3745
 
    my_xlib=""
3746
 
    my_xabs=""
3747
 
    my_xdir=""
 
5118
    my_oldobjs=
 
5119
    my_xlib=
 
5120
    my_xabs=
 
5121
    my_xdir=
3748
5122
 
3749
5123
    for my_xlib in $my_oldlibs; do
3750
5124
      # Extract the objects.
3751
5125
      case $my_xlib in
3752
 
        [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
 
5126
        [\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;;
3753
5127
        *) my_xabs=`pwd`"/$my_xlib" ;;
3754
5128
      esac
3755
5129
      func_basename "$my_xlib"
3756
 
      my_xlib="$func_basename_result"
 
5130
      my_xlib=$func_basename_result
3757
5131
      my_xlib_u=$my_xlib
3758
5132
      while :; do
3759
5133
        case " $extracted_archives " in
3765
5139
        esac
3766
5140
      done
3767
5141
      extracted_archives="$extracted_archives $my_xlib_u"
3768
 
      my_xdir="$my_gentop/$my_xlib_u"
 
5142
      my_xdir=$my_gentop/$my_xlib_u
3769
5143
 
3770
5144
      func_mkdir_p "$my_xdir"
3771
5145
 
3778
5152
          cd $my_xdir || exit $?
3779
5153
          darwin_archive=$my_xabs
3780
5154
          darwin_curdir=`pwd`
3781
 
          darwin_base_archive=`basename "$darwin_archive"`
 
5155
          func_basename "$darwin_archive"
 
5156
          darwin_base_archive=$func_basename_result
3782
5157
          darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
3783
5158
          if test -n "$darwin_arches"; then
3784
5159
            darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
3785
5160
            darwin_arch=
3786
5161
            func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
3787
 
            for darwin_arch in  $darwin_arches ; do
3788
 
              func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
3789
 
              $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
3790
 
              cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
3791
 
              func_extract_an_archive "`pwd`" "${darwin_base_archive}"
 
5162
            for darwin_arch in  $darwin_arches; do
 
5163
              func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch"
 
5164
              $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive"
 
5165
              cd "unfat-$$/$darwin_base_archive-$darwin_arch"
 
5166
              func_extract_an_archive "`pwd`" "$darwin_base_archive"
3792
5167
              cd "$darwin_curdir"
3793
 
              $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
 
5168
              $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive"
3794
5169
            done # $darwin_arches
3795
5170
            ## Okay now we've a bunch of thin objects, gotta fatten them up :)
3796
 
            darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
 
5171
            darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u`
3797
5172
            darwin_file=
3798
5173
            darwin_files=
3799
5174
            for darwin_file in $darwin_filelist; do
3815
5190
      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
3816
5191
    done
3817
5192
 
3818
 
    func_extract_archives_result="$my_oldobjs"
 
5193
    func_extract_archives_result=$my_oldobjs
3819
5194
}
3820
5195
 
3821
5196
 
3830
5205
#
3831
5206
# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
3832
5207
# variable will take.  If 'yes', then the emitted script
3833
 
# will assume that the directory in which it is stored is
 
5208
# will assume that the directory where it is stored is
3834
5209
# the $objdir directory.  This is a cygwin/mingw-specific
3835
5210
# behavior.
3836
5211
func_emit_wrapper ()
3841
5216
#! $SHELL
3842
5217
 
3843
5218
# $output - temporary wrapper script for $objdir/$outputname
3844
 
# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
 
5219
# Generated by $PROGRAM (GNU $PACKAGE) $VERSION
3845
5220
#
3846
5221
# The $output program cannot be directly executed until all the libtool
3847
5222
# libraries that it depends on are installed.
3898
5273
 
3899
5274
# Very basic option parsing. These options are (a) specific to
3900
5275
# the libtool wrapper, (b) are identical between the wrapper
3901
 
# /script/ and the wrapper /executable/ which is used only on
 
5276
# /script/ and the wrapper /executable/ that is used only on
3902
5277
# windows platforms, and (c) all begin with the string "--lt-"
3903
 
# (application programs are unlikely to have options which match
 
5278
# (application programs are unlikely to have options that match
3904
5279
# this pattern).
3905
5280
#
3906
5281
# There are only two supported options: --lt-debug and
3933
5308
 
3934
5309
  # Print the debug banner immediately:
3935
5310
  if test -n \"\$lt_option_debug\"; then
3936
 
    echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2
 
5311
    echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2
3937
5312
  fi
3938
5313
}
3939
5314
 
3944
5319
  lt_dump_args_N=1;
3945
5320
  for lt_arg
3946
5321
  do
3947
 
    \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\"
 
5322
    \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\"
3948
5323
    lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
3949
5324
  done
3950
5325
}
3958
5333
  *-*-mingw | *-*-os2* | *-cegcc*)
3959
5334
    $ECHO "\
3960
5335
      if test -n \"\$lt_option_debug\"; then
3961
 
        \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2
 
5336
        \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2
3962
5337
        func_lt_dump_args \${1+\"\$@\"} 1>&2
3963
5338
      fi
3964
5339
      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
3968
5343
  *)
3969
5344
    $ECHO "\
3970
5345
      if test -n \"\$lt_option_debug\"; then
3971
 
        \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2
 
5346
        \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2
3972
5347
        func_lt_dump_args \${1+\"\$@\"} 1>&2
3973
5348
      fi
3974
5349
      exec \"\$progdir/\$program\" \${1+\"\$@\"}
4043
5418
  test -n \"\$absdir\" && thisdir=\"\$absdir\"
4044
5419
"
4045
5420
 
4046
 
        if test "$fast_install" = yes; then
 
5421
        if test yes = "$fast_install"; then
4047
5422
          $ECHO "\
4048
5423
  program=lt-'$outputname'$exeext
4049
5424
  progdir=\"\$thisdir/$objdir\"
4050
5425
 
4051
5426
  if test ! -f \"\$progdir/\$program\" ||
4052
 
     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
 
5427
     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\
4053
5428
       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
4054
5429
 
4055
5430
    file=\"\$\$-\$program\"
4066
5441
    if test -n \"\$relink_command\"; then
4067
5442
      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
4068
5443
      else
4069
 
        $ECHO \"\$relink_command_output\" >&2
 
5444
        \$ECHO \"\$relink_command_output\" >&2
4070
5445
        $RM \"\$progdir/\$file\"
4071
5446
        exit 1
4072
5447
      fi
4101
5476
        fi
4102
5477
 
4103
5478
        # Export our shlibpath_var if we have one.
4104
 
        if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
 
5479
        if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4105
5480
          $ECHO "\
4106
5481
    # Add our own library path to $shlibpath_var
4107
5482
    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
4121
5496
    fi
4122
5497
  else
4123
5498
    # The program doesn't exist.
4124
 
    \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
 
5499
    \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2
4125
5500
    \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
4126
5501
    \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
4127
5502
    exit 1
4140
5515
        cat <<EOF
4141
5516
 
4142
5517
/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
4143
 
   Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
 
5518
   Generated by $PROGRAM (GNU $PACKAGE) $VERSION
4144
5519
 
4145
5520
   The $output program cannot be directly executed until all the libtool
4146
5521
   libraries that it depends on are installed.
4175
5550
#include <fcntl.h>
4176
5551
#include <sys/stat.h>
4177
5552
 
 
5553
#define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
 
5554
 
4178
5555
/* declarations of non-ANSI functions */
4179
 
#if defined(__MINGW32__)
 
5556
#if defined __MINGW32__
4180
5557
# ifdef __STRICT_ANSI__
4181
5558
int _putenv (const char *);
4182
5559
# endif
4183
 
#elif defined(__CYGWIN__)
 
5560
#elif defined __CYGWIN__
4184
5561
# ifdef __STRICT_ANSI__
4185
5562
char *realpath (const char *, char *);
4186
5563
int putenv (char *);
4187
5564
int setenv (const char *, const char *, int);
4188
5565
# endif
4189
 
/* #elif defined (other platforms) ... */
 
5566
/* #elif defined other_platform || defined ... */
4190
5567
#endif
4191
5568
 
4192
5569
/* portability defines, excluding path handling macros */
4193
 
#if defined(_MSC_VER)
 
5570
#if defined _MSC_VER
4194
5571
# define setmode _setmode
4195
5572
# define stat    _stat
4196
5573
# define chmod   _chmod
4197
5574
# define getcwd  _getcwd
4198
5575
# define putenv  _putenv
4199
5576
# define S_IXUSR _S_IEXEC
4200
 
# ifndef _INTPTR_T_DEFINED
4201
 
#  define _INTPTR_T_DEFINED
4202
 
#  define intptr_t int
4203
 
# endif
4204
 
#elif defined(__MINGW32__)
 
5577
#elif defined __MINGW32__
4205
5578
# define setmode _setmode
4206
5579
# define stat    _stat
4207
5580
# define chmod   _chmod
4208
5581
# define getcwd  _getcwd
4209
5582
# define putenv  _putenv
4210
 
#elif defined(__CYGWIN__)
 
5583
#elif defined __CYGWIN__
4211
5584
# define HAVE_SETENV
4212
5585
# define FOPEN_WB "wb"
4213
 
/* #elif defined (other platforms) ... */
 
5586
/* #elif defined other platforms ... */
4214
5587
#endif
4215
5588
 
4216
 
#if defined(PATH_MAX)
 
5589
#if defined PATH_MAX
4217
5590
# define LT_PATHMAX PATH_MAX
4218
 
#elif defined(MAXPATHLEN)
 
5591
#elif defined MAXPATHLEN
4219
5592
# define LT_PATHMAX MAXPATHLEN
4220
5593
#else
4221
5594
# define LT_PATHMAX 1024
4234
5607
# define PATH_SEPARATOR ':'
4235
5608
#endif
4236
5609
 
4237
 
#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4238
 
  defined (__OS2__)
 
5610
#if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \
 
5611
  defined __OS2__
4239
5612
# define HAVE_DOS_BASED_FILE_SYSTEM
4240
5613
# define FOPEN_WB "wb"
4241
5614
# ifndef DIR_SEPARATOR_2
4268
5641
 
4269
5642
#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
4270
5643
#define XFREE(stale) do { \
4271
 
  if (stale) { free ((void *) stale); stale = 0; } \
 
5644
  if (stale) { free (stale); stale = 0; } \
4272
5645
} while (0)
4273
5646
 
4274
 
#if defined(LT_DEBUGWRAPPER)
 
5647
#if defined LT_DEBUGWRAPPER
4275
5648
static int lt_debug = 1;
4276
5649
#else
4277
5650
static int lt_debug = 0;
4300
5673
EOF
4301
5674
 
4302
5675
            cat <<EOF
4303
 
volatile const char * MAGIC_EXE = "$magic_exe";
 
5676
#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)
 
5677
# define externally_visible volatile
 
5678
#else
 
5679
# define externally_visible __attribute__((externally_visible)) volatile
 
5680
#endif
 
5681
externally_visible const char * MAGIC_EXE = "$magic_exe";
4304
5682
const char * LIB_PATH_VARNAME = "$shlibpath_var";
4305
5683
EOF
4306
5684
 
4307
 
            if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
 
5685
            if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4308
5686
              func_to_host_path "$temp_rpath"
4309
5687
              cat <<EOF
4310
5688
const char * LIB_PATH_VALUE   = "$func_to_host_path_result";
4328
5706
EOF
4329
5707
            fi
4330
5708
 
4331
 
            if test "$fast_install" = yes; then
 
5709
            if test yes = "$fast_install"; then
4332
5710
              cat <<EOF
4333
5711
const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
4334
5712
EOF
4357
5735
  char *actual_cwrapper_name;
4358
5736
  char *target_name;
4359
5737
  char *lt_argv_zero;
4360
 
  intptr_t rval = 127;
 
5738
  int rval = 127;
4361
5739
 
4362
5740
  int i;
4363
5741
 
4364
5742
  program_name = (char *) xstrdup (base_name (argv[0]));
4365
 
  newargz = XMALLOC (char *, argc + 1);
 
5743
  newargz = XMALLOC (char *, (size_t) argc + 1);
4366
5744
 
4367
5745
  /* very simple arg parsing; don't want to rely on getopt
4368
5746
   * also, copy all non cwrapper options to newargz, except
4371
5749
  newargc=0;
4372
5750
  for (i = 1; i < argc; i++)
4373
5751
    {
4374
 
      if (strcmp (argv[i], dumpscript_opt) == 0)
 
5752
      if (STREQ (argv[i], dumpscript_opt))
4375
5753
        {
4376
5754
EOF
4377
 
            case "$host" in
 
5755
            case $host in
4378
5756
              *mingw* | *cygwin* )
4379
5757
                # make stdout use "unix" line endings
4380
5758
                echo "          setmode(1,_O_BINARY);"
4385
5763
          lt_dump_script (stdout);
4386
5764
          return 0;
4387
5765
        }
4388
 
      if (strcmp (argv[i], debug_opt) == 0)
 
5766
      if (STREQ (argv[i], debug_opt))
4389
5767
        {
4390
5768
          lt_debug = 1;
4391
5769
          continue;
4392
5770
        }
4393
 
      if (strcmp (argv[i], ltwrapper_option_prefix) == 0)
 
5771
      if (STREQ (argv[i], ltwrapper_option_prefix))
4394
5772
        {
4395
5773
          /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
4396
5774
             namespace, but it is not one of the ones we know about and
4413
5791
EOF
4414
5792
            cat <<EOF
4415
5793
  /* The GNU banner must be the first non-error debug message */
4416
 
  lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n");
 
5794
  lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE) $VERSION\n");
4417
5795
EOF
4418
5796
            cat <<"EOF"
4419
5797
  lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
4524
5902
                cat <<"EOF"
4525
5903
  /* execv doesn't actually work on mingw as expected on unix */
4526
5904
  newargz = prepare_spawn (newargz);
4527
 
  rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
 
5905
  rval = (int) _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
4528
5906
  if (rval == -1)
4529
5907
    {
4530
5908
      /* failed to start process */
4569
5947
{
4570
5948
  const char *base;
4571
5949
 
4572
 
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
 
5950
#if defined HAVE_DOS_BASED_FILE_SYSTEM
4573
5951
  /* Skip over the disk name in MSDOS pathnames. */
4574
5952
  if (isalpha ((unsigned char) name[0]) && name[1] == ':')
4575
5953
    name += 2;
4628
6006
  const char *p_next;
4629
6007
  /* static buffer for getcwd */
4630
6008
  char tmp[LT_PATHMAX + 1];
4631
 
  int tmp_len;
 
6009
  size_t tmp_len;
4632
6010
  char *concat_name;
4633
6011
 
4634
6012
  lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
4638
6016
    return NULL;
4639
6017
 
4640
6018
  /* Absolute path? */
4641
 
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
 
6019
#if defined HAVE_DOS_BASED_FILE_SYSTEM
4642
6020
  if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
4643
6021
    {
4644
6022
      concat_name = xstrdup (wrapper);
4656
6034
            return concat_name;
4657
6035
          XFREE (concat_name);
4658
6036
        }
4659
 
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
 
6037
#if defined HAVE_DOS_BASED_FILE_SYSTEM
4660
6038
    }
4661
6039
#endif
4662
6040
 
4679
6057
              for (q = p; *q; q++)
4680
6058
                if (IS_PATH_SEPARATOR (*q))
4681
6059
                  break;
4682
 
              p_len = q - p;
 
6060
              p_len = (size_t) (q - p);
4683
6061
              p_next = (*q == '\0' ? q : q + 1);
4684
6062
              if (p_len == 0)
4685
6063
                {
4798
6176
  if (patlen <= len)
4799
6177
    {
4800
6178
      str += len - patlen;
4801
 
      if (strcmp (str, pat) == 0)
 
6179
      if (STREQ (str, pat))
4802
6180
        *str = '\0';
4803
6181
    }
4804
6182
  return str;
4863
6241
    char *str = xstrdup (value);
4864
6242
    setenv (name, str, 1);
4865
6243
#else
4866
 
    int len = strlen (name) + 1 + strlen (value) + 1;
 
6244
    size_t len = strlen (name) + 1 + strlen (value) + 1;
4867
6245
    char *str = XMALLOC (char, len);
4868
6246
    sprintf (str, "%s=%s", name, value);
4869
6247
    if (putenv (str) != EXIT_SUCCESS)
4880
6258
  char *new_value;
4881
6259
  if (orig_value && *orig_value)
4882
6260
    {
4883
 
      int orig_value_len = strlen (orig_value);
4884
 
      int add_len = strlen (add);
 
6261
      size_t orig_value_len = strlen (orig_value);
 
6262
      size_t add_len = strlen (add);
4885
6263
      new_value = XMALLOC (char, add_len + orig_value_len + 1);
4886
6264
      if (to_end)
4887
6265
        {
4912
6290
    {
4913
6291
      char *new_value = lt_extend_str (getenv (name), value, 0);
4914
6292
      /* some systems can't cope with a ':'-terminated path #' */
4915
 
      int len = strlen (new_value);
4916
 
      while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
 
6293
      size_t len = strlen (new_value);
 
6294
      while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
4917
6295
        {
4918
 
          new_value[len-1] = '\0';
 
6296
          new_value[--len] = '\0';
4919
6297
        }
4920
6298
      lt_setenv (name, new_value);
4921
6299
      XFREE (new_value);
5082
6460
# True if ARG is an import lib, as indicated by $file_magic_cmd
5083
6461
func_win32_import_lib_p ()
5084
6462
{
5085
 
    $opt_debug
 
6463
    $debug_cmd
 
6464
 
5086
6465
    case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
5087
6466
    *import*) : ;;
5088
6467
    *) false ;;
5089
6468
    esac
5090
6469
}
5091
6470
 
 
6471
# func_suncc_cstd_abi
 
6472
# !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!!
 
6473
# Several compiler flags select an ABI that is incompatible with the
 
6474
# Cstd library. Avoid specifying it if any are in CXXFLAGS.
 
6475
func_suncc_cstd_abi ()
 
6476
{
 
6477
    $debug_cmd
 
6478
 
 
6479
    case " $compile_command " in
 
6480
    *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*)
 
6481
      suncc_use_cstd_abi=no
 
6482
      ;;
 
6483
    *)
 
6484
      suncc_use_cstd_abi=yes
 
6485
      ;;
 
6486
    esac
 
6487
}
 
6488
 
5092
6489
# func_mode_link arg...
5093
6490
func_mode_link ()
5094
6491
{
5095
 
    $opt_debug
 
6492
    $debug_cmd
 
6493
 
5096
6494
    case $host in
5097
6495
    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
5098
6496
      # It is impossible to link a dll without this setting, and
5099
6497
      # we shouldn't force the makefile maintainer to figure out
5100
 
      # which system we are compiling for in order to pass an extra
 
6498
      # what system we are compiling for in order to pass an extra
5101
6499
      # flag for every libtool invocation.
5102
6500
      # allow_undefined=no
5103
6501
 
5104
6502
      # FIXME: Unfortunately, there are problems with the above when trying
5105
 
      # to make a dll which has undefined symbols, in which case not
 
6503
      # to make a dll that has undefined symbols, in which case not
5106
6504
      # even a static library is built.  For now, we need to specify
5107
6505
      # -no-undefined on the libtool link line when we can be certain
5108
6506
      # that all symbols are satisfied, otherwise we get a static library.
5146
6544
    module=no
5147
6545
    no_install=no
5148
6546
    objs=
 
6547
    os2dllname=
5149
6548
    non_pic_objects=
5150
6549
    precious_files_regex=
5151
6550
    prefer_static_libs=no
5152
 
    preload=no
 
6551
    preload=false
5153
6552
    prev=
5154
6553
    prevarg=
5155
6554
    release=
5161
6560
    vinfo=
5162
6561
    vinfo_number=no
5163
6562
    weak_libs=
5164
 
    single_module="${wl}-single_module"
 
6563
    single_module=$wl-single_module
5165
6564
    func_infer_tag $base_compile
5166
6565
 
5167
6566
    # We need to know -static, to get the right output filenames.
5169
6568
    do
5170
6569
      case $arg in
5171
6570
      -shared)
5172
 
        test "$build_libtool_libs" != yes && \
5173
 
          func_fatal_configuration "can not build a shared library"
 
6571
        test yes != "$build_libtool_libs" \
 
6572
          && func_fatal_configuration "cannot build a shared library"
5174
6573
        build_old_libs=no
5175
6574
        break
5176
6575
        ;;
5177
6576
      -all-static | -static | -static-libtool-libs)
5178
6577
        case $arg in
5179
6578
        -all-static)
5180
 
          if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
 
6579
          if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then
5181
6580
            func_warning "complete static linking is impossible in this configuration"
5182
6581
          fi
5183
6582
          if test -n "$link_static_flag"; then
5210
6609
 
5211
6610
    # Go through the arguments, transforming them on the way.
5212
6611
    while test "$#" -gt 0; do
5213
 
      arg="$1"
 
6612
      arg=$1
5214
6613
      shift
5215
6614
      func_quote_for_eval "$arg"
5216
6615
      qarg=$func_quote_for_eval_unquoted_result
5227
6626
 
5228
6627
        case $prev in
5229
6628
        bindir)
5230
 
          bindir="$arg"
 
6629
          bindir=$arg
5231
6630
          prev=
5232
6631
          continue
5233
6632
          ;;
5234
6633
        dlfiles|dlprefiles)
5235
 
          if test "$preload" = no; then
 
6634
          $preload || {
5236
6635
            # Add the symbol object into the linking commands.
5237
6636
            func_append compile_command " @SYMFILE@"
5238
6637
            func_append finalize_command " @SYMFILE@"
5239
 
            preload=yes
5240
 
          fi
 
6638
            preload=:
 
6639
          }
5241
6640
          case $arg in
5242
6641
          *.la | *.lo) ;;  # We handle these cases below.
5243
6642
          force)
5244
 
            if test "$dlself" = no; then
 
6643
            if test no = "$dlself"; then
5245
6644
              dlself=needless
5246
6645
              export_dynamic=yes
5247
6646
            fi
5249
6648
            continue
5250
6649
            ;;
5251
6650
          self)
5252
 
            if test "$prev" = dlprefiles; then
 
6651
            if test dlprefiles = "$prev"; then
5253
6652
              dlself=yes
5254
 
            elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
 
6653
            elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then
5255
6654
              dlself=yes
5256
6655
            else
5257
6656
              dlself=needless
5261
6660
            continue
5262
6661
            ;;
5263
6662
          *)
5264
 
            if test "$prev" = dlfiles; then
 
6663
            if test dlfiles = "$prev"; then
5265
6664
              func_append dlfiles " $arg"
5266
6665
            else
5267
6666
              func_append dlprefiles " $arg"
5272
6671
          esac
5273
6672
          ;;
5274
6673
        expsyms)
5275
 
          export_symbols="$arg"
 
6674
          export_symbols=$arg
5276
6675
          test -f "$arg" \
5277
 
            || func_fatal_error "symbol file \`$arg' does not exist"
 
6676
            || func_fatal_error "symbol file '$arg' does not exist"
5278
6677
          prev=
5279
6678
          continue
5280
6679
          ;;
5281
6680
        expsyms_regex)
5282
 
          export_symbols_regex="$arg"
 
6681
          export_symbols_regex=$arg
5283
6682
          prev=
5284
6683
          continue
5285
6684
          ;;
5297
6696
          continue
5298
6697
          ;;
5299
6698
        inst_prefix)
5300
 
          inst_prefix_dir="$arg"
 
6699
          inst_prefix_dir=$arg
 
6700
          prev=
 
6701
          continue
 
6702
          ;;
 
6703
        mllvm)
 
6704
          # Clang does not use LLVM to link, so we can simply discard any
 
6705
          # '-mllvm $arg' options when doing the link step.
5301
6706
          prev=
5302
6707
          continue
5303
6708
          ;;
5321
6726
 
5322
6727
                if test -z "$pic_object" ||
5323
6728
                   test -z "$non_pic_object" ||
5324
 
                   test "$pic_object" = none &&
5325
 
                   test "$non_pic_object" = none; then
5326
 
                  func_fatal_error "cannot find name of object for \`$arg'"
 
6729
                   test none = "$pic_object" &&
 
6730
                   test none = "$non_pic_object"; then
 
6731
                  func_fatal_error "cannot find name of object for '$arg'"
5327
6732
                fi
5328
6733
 
5329
6734
                # Extract subdirectory from the argument.
5330
6735
                func_dirname "$arg" "/" ""
5331
 
                xdir="$func_dirname_result"
 
6736
                xdir=$func_dirname_result
5332
6737
 
5333
 
                if test "$pic_object" != none; then
 
6738
                if test none != "$pic_object"; then
5334
6739
                  # Prepend the subdirectory the object is found in.
5335
 
                  pic_object="$xdir$pic_object"
 
6740
                  pic_object=$xdir$pic_object
5336
6741
 
5337
 
                  if test "$prev" = dlfiles; then
5338
 
                    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
 
6742
                  if test dlfiles = "$prev"; then
 
6743
                    if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
5339
6744
                      func_append dlfiles " $pic_object"
5340
6745
                      prev=
5341
6746
                      continue
5346
6751
                  fi
5347
6752
 
5348
6753
                  # CHECK ME:  I think I busted this.  -Ossama
5349
 
                  if test "$prev" = dlprefiles; then
 
6754
                  if test dlprefiles = "$prev"; then
5350
6755
                    # Preload the old-style object.
5351
6756
                    func_append dlprefiles " $pic_object"
5352
6757
                    prev=
5354
6759
 
5355
6760
                  # A PIC object.
5356
6761
                  func_append libobjs " $pic_object"
5357
 
                  arg="$pic_object"
 
6762
                  arg=$pic_object
5358
6763
                fi
5359
6764
 
5360
6765
                # Non-PIC object.
5361
 
                if test "$non_pic_object" != none; then
 
6766
                if test none != "$non_pic_object"; then
5362
6767
                  # Prepend the subdirectory the object is found in.
5363
 
                  non_pic_object="$xdir$non_pic_object"
 
6768
                  non_pic_object=$xdir$non_pic_object
5364
6769
 
5365
6770
                  # A standard non-PIC object
5366
6771
                  func_append non_pic_objects " $non_pic_object"
5367
 
                  if test -z "$pic_object" || test "$pic_object" = none ; then
5368
 
                    arg="$non_pic_object"
 
6772
                  if test -z "$pic_object" || test none = "$pic_object"; then
 
6773
                    arg=$non_pic_object
5369
6774
                  fi
5370
6775
                else
5371
6776
                  # If the PIC object exists, use it instead.
5372
6777
                  # $xdir was prepended to $pic_object above.
5373
 
                  non_pic_object="$pic_object"
 
6778
                  non_pic_object=$pic_object
5374
6779
                  func_append non_pic_objects " $non_pic_object"
5375
6780
                fi
5376
6781
              else
5378
6783
                if $opt_dry_run; then
5379
6784
                  # Extract subdirectory from the argument.
5380
6785
                  func_dirname "$arg" "/" ""
5381
 
                  xdir="$func_dirname_result"
 
6786
                  xdir=$func_dirname_result
5382
6787
 
5383
6788
                  func_lo2o "$arg"
5384
6789
                  pic_object=$xdir$objdir/$func_lo2o_result
5386
6791
                  func_append libobjs " $pic_object"
5387
6792
                  func_append non_pic_objects " $non_pic_object"
5388
6793
                else
5389
 
                  func_fatal_error "\`$arg' is not a valid libtool object"
 
6794
                  func_fatal_error "'$arg' is not a valid libtool object"
5390
6795
                fi
5391
6796
              fi
5392
6797
            done
5393
6798
          else
5394
 
            func_fatal_error "link input file \`$arg' does not exist"
 
6799
            func_fatal_error "link input file '$arg' does not exist"
5395
6800
          fi
5396
6801
          arg=$save_arg
5397
6802
          prev=
5398
6803
          continue
5399
6804
          ;;
 
6805
        os2dllname)
 
6806
          os2dllname=$arg
 
6807
          prev=
 
6808
          continue
 
6809
          ;;
5400
6810
        precious_regex)
5401
 
          precious_files_regex="$arg"
 
6811
          precious_files_regex=$arg
5402
6812
          prev=
5403
6813
          continue
5404
6814
          ;;
5405
6815
        release)
5406
 
          release="-$arg"
 
6816
          release=-$arg
5407
6817
          prev=
5408
6818
          continue
5409
6819
          ;;
5415
6825
            func_fatal_error "only absolute run-paths are allowed"
5416
6826
            ;;
5417
6827
          esac
5418
 
          if test "$prev" = rpath; then
 
6828
          if test rpath = "$prev"; then
5419
6829
            case "$rpath " in
5420
6830
            *" $arg "*) ;;
5421
6831
            *) func_append rpath " $arg" ;;
5430
6840
          continue
5431
6841
          ;;
5432
6842
        shrext)
5433
 
          shrext_cmds="$arg"
 
6843
          shrext_cmds=$arg
5434
6844
          prev=
5435
6845
          continue
5436
6846
          ;;
5470
6880
        esac
5471
6881
      fi # test -n "$prev"
5472
6882
 
5473
 
      prevarg="$arg"
 
6883
      prevarg=$arg
5474
6884
 
5475
6885
      case $arg in
5476
6886
      -all-static)
5484
6894
 
5485
6895
      -allow-undefined)
5486
6896
        # FIXME: remove this flag sometime in the future.
5487
 
        func_fatal_error "\`-allow-undefined' must not be used because it is the default"
 
6897
        func_fatal_error "'-allow-undefined' must not be used because it is the default"
5488
6898
        ;;
5489
6899
 
5490
6900
      -avoid-version)
5516
6926
        if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
5517
6927
          func_fatal_error "more than one -exported-symbols argument is not allowed"
5518
6928
        fi
5519
 
        if test "X$arg" = "X-export-symbols"; then
 
6929
        if test X-export-symbols = "X$arg"; then
5520
6930
          prev=expsyms
5521
6931
        else
5522
6932
          prev=expsyms_regex
5550
6960
        func_stripname "-L" '' "$arg"
5551
6961
        if test -z "$func_stripname_result"; then
5552
6962
          if test "$#" -gt 0; then
5553
 
            func_fatal_error "require no space between \`-L' and \`$1'"
 
6963
            func_fatal_error "require no space between '-L' and '$1'"
5554
6964
          else
5555
 
            func_fatal_error "need path for \`-L' option"
 
6965
            func_fatal_error "need path for '-L' option"
5556
6966
          fi
5557
6967
        fi
5558
6968
        func_resolve_sysroot "$func_stripname_result"
5563
6973
        *)
5564
6974
          absdir=`cd "$dir" && pwd`
5565
6975
          test -z "$absdir" && \
5566
 
            func_fatal_error "cannot determine absolute directory name of \`$dir'"
5567
 
          dir="$absdir"
 
6976
            func_fatal_error "cannot determine absolute directory name of '$dir'"
 
6977
          dir=$absdir
5568
6978
          ;;
5569
6979
        esac
5570
6980
        case "$deplibs " in
5599
7009
        ;;
5600
7010
 
5601
7011
      -l*)
5602
 
        if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
 
7012
        if test X-lc = "X$arg" || test X-lm = "X$arg"; then
5603
7013
          case $host in
5604
7014
          *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
5605
7015
            # These systems don't actually have a C or math library (as such)
5607
7017
            ;;
5608
7018
          *-*-os2*)
5609
7019
            # These systems don't actually have a C library (as such)
5610
 
            test "X$arg" = "X-lc" && continue
 
7020
            test X-lc = "X$arg" && continue
5611
7021
            ;;
5612
 
          *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
 
7022
          *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
5613
7023
            # Do not include libc due to us having libc/libc_r.
5614
 
            test "X$arg" = "X-lc" && continue
 
7024
            test X-lc = "X$arg" && continue
5615
7025
            ;;
5616
7026
          *-*-rhapsody* | *-*-darwin1.[012])
5617
7027
            # Rhapsody C and math libraries are in the System framework
5620
7030
            ;;
5621
7031
          *-*-sco3.2v5* | *-*-sco5v6*)
5622
7032
            # Causes problems with __ctype
5623
 
            test "X$arg" = "X-lc" && continue
 
7033
            test X-lc = "X$arg" && continue
5624
7034
            ;;
5625
7035
          *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
5626
7036
            # Compiler inserts libc in the correct place for threads to work
5627
 
            test "X$arg" = "X-lc" && continue
 
7037
            test X-lc = "X$arg" && continue
5628
7038
            ;;
5629
7039
          esac
5630
 
        elif test "X$arg" = "X-lc_r"; then
 
7040
        elif test X-lc_r = "X$arg"; then
5631
7041
         case $host in
5632
 
         *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
 
7042
         *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
5633
7043
           # Do not include libc_r directly, use -pthread flag.
5634
7044
           continue
5635
7045
           ;;
5639
7049
        continue
5640
7050
        ;;
5641
7051
 
 
7052
      -mllvm)
 
7053
        prev=mllvm
 
7054
        continue
 
7055
        ;;
 
7056
 
5642
7057
      -module)
5643
7058
        module=yes
5644
7059
        continue
5668
7083
        ;;
5669
7084
 
5670
7085
      -multi_module)
5671
 
        single_module="${wl}-multi_module"
 
7086
        single_module=$wl-multi_module
5672
7087
        continue
5673
7088
        ;;
5674
7089
 
5682
7097
        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
5683
7098
          # The PATH hackery in wrapper scripts is required on Windows
5684
7099
          # and Darwin in order for the loader to find any dlls it needs.
5685
 
          func_warning "\`-no-install' is ignored for $host"
5686
 
          func_warning "assuming \`-no-fast-install' instead"
 
7100
          func_warning "'-no-install' is ignored for $host"
 
7101
          func_warning "assuming '-no-fast-install' instead"
5687
7102
          fast_install=no
5688
7103
          ;;
5689
7104
        *) no_install=yes ;;
5701
7116
        continue
5702
7117
        ;;
5703
7118
 
 
7119
      -os2dllname)
 
7120
        prev=os2dllname
 
7121
        continue
 
7122
        ;;
 
7123
 
5704
7124
      -o) prev=output ;;
5705
7125
 
5706
7126
      -precious-files-regex)
5788
7208
        func_stripname '-Wc,' '' "$arg"
5789
7209
        args=$func_stripname_result
5790
7210
        arg=
5791
 
        save_ifs="$IFS"; IFS=','
 
7211
        save_ifs=$IFS; IFS=,
5792
7212
        for flag in $args; do
5793
 
          IFS="$save_ifs"
 
7213
          IFS=$save_ifs
5794
7214
          func_quote_for_eval "$flag"
5795
7215
          func_append arg " $func_quote_for_eval_result"
5796
7216
          func_append compiler_flags " $func_quote_for_eval_result"
5797
7217
        done
5798
 
        IFS="$save_ifs"
 
7218
        IFS=$save_ifs
5799
7219
        func_stripname ' ' '' "$arg"
5800
7220
        arg=$func_stripname_result
5801
7221
        ;;
5804
7224
        func_stripname '-Wl,' '' "$arg"
5805
7225
        args=$func_stripname_result
5806
7226
        arg=
5807
 
        save_ifs="$IFS"; IFS=','
 
7227
        save_ifs=$IFS; IFS=,
5808
7228
        for flag in $args; do
5809
 
          IFS="$save_ifs"
 
7229
          IFS=$save_ifs
5810
7230
          func_quote_for_eval "$flag"
5811
7231
          func_append arg " $wl$func_quote_for_eval_result"
5812
7232
          func_append compiler_flags " $wl$func_quote_for_eval_result"
5813
7233
          func_append linker_flags " $func_quote_for_eval_result"
5814
7234
        done
5815
 
        IFS="$save_ifs"
 
7235
        IFS=$save_ifs
5816
7236
        func_stripname ' ' '' "$arg"
5817
7237
        arg=$func_stripname_result
5818
7238
        ;;
5835
7255
      # -msg_* for osf cc
5836
7256
      -msg_*)
5837
7257
        func_quote_for_eval "$arg"
5838
 
        arg="$func_quote_for_eval_result"
 
7258
        arg=$func_quote_for_eval_result
5839
7259
        ;;
5840
7260
 
5841
7261
      # Flags to be passed through unchanged, with rationale:
5847
7267
      # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
5848
7268
      # -F/path              path to uninstalled frameworks, gcc on darwin
5849
7269
      # -p, -pg, --coverage, -fprofile-*  profiling flags for GCC
 
7270
      # -fstack-protector*   stack protector flags for GCC
5850
7271
      # @file                GCC response files
5851
7272
      # -tp=*                Portland pgcc target processor selection
5852
7273
      # --sysroot=*          for sysroot support
5853
 
      # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
 
7274
      # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
 
7275
      # -specs=*             GCC specs files
 
7276
      # -stdlib=*            select c++ std lib with clang
 
7277
      # -fsanitize=*         Clang/GCC memory and address sanitizer
5854
7278
      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
5855
7279
      -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
5856
 
      -O*|-flto*|-fwhopr*|-fuse-linker-plugin)
 
7280
      -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \
 
7281
      -specs=*|-fsanitize=*)
5857
7282
        func_quote_for_eval "$arg"
5858
 
        arg="$func_quote_for_eval_result"
 
7283
        arg=$func_quote_for_eval_result
5859
7284
        func_append compile_command " $arg"
5860
7285
        func_append finalize_command " $arg"
5861
7286
        func_append compiler_flags " $arg"
5862
7287
        continue
5863
7288
        ;;
5864
7289
 
 
7290
      -Z*)
 
7291
        if test os2 = "`expr $host : '.*\(os2\)'`"; then
 
7292
          # OS/2 uses -Zxxx to specify OS/2-specific options
 
7293
          compiler_flags="$compiler_flags $arg"
 
7294
          func_append compile_command " $arg"
 
7295
          func_append finalize_command " $arg"
 
7296
          case $arg in
 
7297
          -Zlinker | -Zstack)
 
7298
            prev=xcompiler
 
7299
            ;;
 
7300
          esac
 
7301
          continue
 
7302
        else
 
7303
          # Otherwise treat like 'Some other compiler flag' below
 
7304
          func_quote_for_eval "$arg"
 
7305
          arg=$func_quote_for_eval_result
 
7306
        fi
 
7307
        ;;
 
7308
 
5865
7309
      # Some other compiler flag.
5866
7310
      -* | +*)
5867
7311
        func_quote_for_eval "$arg"
5868
 
        arg="$func_quote_for_eval_result"
 
7312
        arg=$func_quote_for_eval_result
5869
7313
        ;;
5870
7314
 
5871
7315
      *.$objext)
5886
7330
 
5887
7331
          if test -z "$pic_object" ||
5888
7332
             test -z "$non_pic_object" ||
5889
 
             test "$pic_object" = none &&
5890
 
             test "$non_pic_object" = none; then
5891
 
            func_fatal_error "cannot find name of object for \`$arg'"
 
7333
             test none = "$pic_object" &&
 
7334
             test none = "$non_pic_object"; then
 
7335
            func_fatal_error "cannot find name of object for '$arg'"
5892
7336
          fi
5893
7337
 
5894
7338
          # Extract subdirectory from the argument.
5895
7339
          func_dirname "$arg" "/" ""
5896
 
          xdir="$func_dirname_result"
 
7340
          xdir=$func_dirname_result
5897
7341
 
5898
 
          if test "$pic_object" != none; then
 
7342
          test none = "$pic_object" || {
5899
7343
            # Prepend the subdirectory the object is found in.
5900
 
            pic_object="$xdir$pic_object"
 
7344
            pic_object=$xdir$pic_object
5901
7345
 
5902
 
            if test "$prev" = dlfiles; then
5903
 
              if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
 
7346
            if test dlfiles = "$prev"; then
 
7347
              if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
5904
7348
                func_append dlfiles " $pic_object"
5905
7349
                prev=
5906
7350
                continue
5911
7355
            fi
5912
7356
 
5913
7357
            # CHECK ME:  I think I busted this.  -Ossama
5914
 
            if test "$prev" = dlprefiles; then
 
7358
            if test dlprefiles = "$prev"; then
5915
7359
              # Preload the old-style object.
5916
7360
              func_append dlprefiles " $pic_object"
5917
7361
              prev=
5919
7363
 
5920
7364
            # A PIC object.
5921
7365
            func_append libobjs " $pic_object"
5922
 
            arg="$pic_object"
5923
 
          fi
 
7366
            arg=$pic_object
 
7367
          }
5924
7368
 
5925
7369
          # Non-PIC object.
5926
 
          if test "$non_pic_object" != none; then
 
7370
          if test none != "$non_pic_object"; then
5927
7371
            # Prepend the subdirectory the object is found in.
5928
 
            non_pic_object="$xdir$non_pic_object"
 
7372
            non_pic_object=$xdir$non_pic_object
5929
7373
 
5930
7374
            # A standard non-PIC object
5931
7375
            func_append non_pic_objects " $non_pic_object"
5932
 
            if test -z "$pic_object" || test "$pic_object" = none ; then
5933
 
              arg="$non_pic_object"
 
7376
            if test -z "$pic_object" || test none = "$pic_object"; then
 
7377
              arg=$non_pic_object
5934
7378
            fi
5935
7379
          else
5936
7380
            # If the PIC object exists, use it instead.
5937
7381
            # $xdir was prepended to $pic_object above.
5938
 
            non_pic_object="$pic_object"
 
7382
            non_pic_object=$pic_object
5939
7383
            func_append non_pic_objects " $non_pic_object"
5940
7384
          fi
5941
7385
        else
5943
7387
          if $opt_dry_run; then
5944
7388
            # Extract subdirectory from the argument.
5945
7389
            func_dirname "$arg" "/" ""
5946
 
            xdir="$func_dirname_result"
 
7390
            xdir=$func_dirname_result
5947
7391
 
5948
7392
            func_lo2o "$arg"
5949
7393
            pic_object=$xdir$objdir/$func_lo2o_result
5951
7395
            func_append libobjs " $pic_object"
5952
7396
            func_append non_pic_objects " $non_pic_object"
5953
7397
          else
5954
 
            func_fatal_error "\`$arg' is not a valid libtool object"
 
7398
            func_fatal_error "'$arg' is not a valid libtool object"
5955
7399
          fi
5956
7400
        fi
5957
7401
        ;;
5967
7411
        # A libtool-controlled library.
5968
7412
 
5969
7413
        func_resolve_sysroot "$arg"
5970
 
        if test "$prev" = dlfiles; then
 
7414
        if test dlfiles = "$prev"; then
5971
7415
          # This library was specified with -dlopen.
5972
7416
          func_append dlfiles " $func_resolve_sysroot_result"
5973
7417
          prev=
5974
 
        elif test "$prev" = dlprefiles; then
 
7418
        elif test dlprefiles = "$prev"; then
5975
7419
          # The library was specified with -dlpreopen.
5976
7420
          func_append dlprefiles " $func_resolve_sysroot_result"
5977
7421
          prev=
5986
7430
        # Unknown arguments in both finalize_command and compile_command need
5987
7431
        # to be aesthetically quoted because they are evaled later.
5988
7432
        func_quote_for_eval "$arg"
5989
 
        arg="$func_quote_for_eval_result"
 
7433
        arg=$func_quote_for_eval_result
5990
7434
        ;;
5991
7435
      esac # arg
5992
7436
 
5998
7442
    done # argument parsing loop
5999
7443
 
6000
7444
    test -n "$prev" && \
6001
 
      func_fatal_help "the \`$prevarg' option requires an argument"
 
7445
      func_fatal_help "the '$prevarg' option requires an argument"
6002
7446
 
6003
 
    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
 
7447
    if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then
6004
7448
      eval arg=\"$export_dynamic_flag_spec\"
6005
7449
      func_append compile_command " $arg"
6006
7450
      func_append finalize_command " $arg"
6009
7453
    oldlibs=
6010
7454
    # calculate the name of the file, without its directory
6011
7455
    func_basename "$output"
6012
 
    outputname="$func_basename_result"
6013
 
    libobjs_save="$libobjs"
 
7456
    outputname=$func_basename_result
 
7457
    libobjs_save=$libobjs
6014
7458
 
6015
7459
    if test -n "$shlibpath_var"; then
6016
7460
      # get the directories listed in $shlibpath_var
6017
 
      eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\`
 
7461
      eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\`
6018
7462
    else
6019
7463
      shlib_search_path=
6020
7464
    fi
6021
7465
    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
6022
7466
    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
6023
7467
 
 
7468
    # Definition is injected by LT_CONFIG during libtool generation.
 
7469
    func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH"
 
7470
 
6024
7471
    func_dirname "$output" "/" ""
6025
 
    output_objdir="$func_dirname_result$objdir"
 
7472
    output_objdir=$func_dirname_result$objdir
6026
7473
    func_to_tool_file "$output_objdir/"
6027
7474
    tool_output_objdir=$func_to_tool_file_result
6028
7475
    # Create the object directory.
6045
7492
    # Find all interdependent deplibs by searching for libraries
6046
7493
    # that are linked more than once (e.g. -la -lb -la)
6047
7494
    for deplib in $deplibs; do
6048
 
      if $opt_preserve_dup_deps ; then
 
7495
      if $opt_preserve_dup_deps; then
6049
7496
        case "$libs " in
6050
7497
        *" $deplib "*) func_append specialdeplibs " $deplib" ;;
6051
7498
        esac
6053
7500
      func_append libs " $deplib"
6054
7501
    done
6055
7502
 
6056
 
    if test "$linkmode" = lib; then
 
7503
    if test lib = "$linkmode"; then
6057
7504
      libs="$predeps $libs $compiler_lib_search_path $postdeps"
6058
7505
 
6059
7506
      # Compute libraries that are listed more than once in $predeps
6085
7532
          case $file in
6086
7533
          *.la) ;;
6087
7534
          *)
6088
 
            func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
 
7535
            func_fatal_help "libraries can '-dlopen' only libtool libraries: $file"
6089
7536
            ;;
6090
7537
          esac
6091
7538
        done
6093
7540
    prog)
6094
7541
        compile_deplibs=
6095
7542
        finalize_deplibs=
6096
 
        alldeplibs=no
 
7543
        alldeplibs=false
6097
7544
        newdlfiles=
6098
7545
        newdlprefiles=
6099
7546
        passes="conv scan dlopen dlpreopen link"
6105
7552
    for pass in $passes; do
6106
7553
      # The preopen pass in lib mode reverses $deplibs; put it back here
6107
7554
      # so that -L comes before libs that need it for instance...
6108
 
      if test "$linkmode,$pass" = "lib,link"; then
 
7555
      if test lib,link = "$linkmode,$pass"; then
6109
7556
        ## FIXME: Find the place where the list is rebuilt in the wrong
6110
7557
        ##        order, and fix it there properly
6111
7558
        tmp_deplibs=
6112
7559
        for deplib in $deplibs; do
6113
7560
          tmp_deplibs="$deplib $tmp_deplibs"
6114
7561
        done
6115
 
        deplibs="$tmp_deplibs"
 
7562
        deplibs=$tmp_deplibs
6116
7563
      fi
6117
7564
 
6118
 
      if test "$linkmode,$pass" = "lib,link" ||
6119
 
         test "$linkmode,$pass" = "prog,scan"; then
6120
 
        libs="$deplibs"
 
7565
      if test lib,link = "$linkmode,$pass" ||
 
7566
         test prog,scan = "$linkmode,$pass"; then
 
7567
        libs=$deplibs
6121
7568
        deplibs=
6122
7569
      fi
6123
 
      if test "$linkmode" = prog; then
 
7570
      if test prog = "$linkmode"; then
6124
7571
        case $pass in
6125
 
        dlopen) libs="$dlfiles" ;;
6126
 
        dlpreopen) libs="$dlprefiles" ;;
 
7572
        dlopen) libs=$dlfiles ;;
 
7573
        dlpreopen) libs=$dlprefiles ;;
6127
7574
        link)
6128
7575
          libs="$deplibs %DEPLIBS%"
6129
7576
          test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
6130
7577
          ;;
6131
7578
        esac
6132
7579
      fi
6133
 
      if test "$linkmode,$pass" = "lib,dlpreopen"; then
 
7580
      if test lib,dlpreopen = "$linkmode,$pass"; then
6134
7581
        # Collect and forward deplibs of preopened libtool libs
6135
7582
        for lib in $dlprefiles; do
6136
7583
          # Ignore non-libtool-libs
6151
7598
            esac
6152
7599
          done
6153
7600
        done
6154
 
        libs="$dlprefiles"
 
7601
        libs=$dlprefiles
6155
7602
      fi
6156
 
      if test "$pass" = dlopen; then
 
7603
      if test dlopen = "$pass"; then
6157
7604
        # Collect dlpreopened libraries
6158
 
        save_deplibs="$deplibs"
 
7605
        save_deplibs=$deplibs
6159
7606
        deplibs=
6160
7607
      fi
6161
7608
 
6162
7609
      for deplib in $libs; do
6163
7610
        lib=
6164
 
        found=no
 
7611
        found=false
6165
7612
        case $deplib in
6166
7613
        -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
6167
7614
        |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
6168
 
          if test "$linkmode,$pass" = "prog,link"; then
 
7615
          if test prog,link = "$linkmode,$pass"; then
6169
7616
            compile_deplibs="$deplib $compile_deplibs"
6170
7617
            finalize_deplibs="$deplib $finalize_deplibs"
6171
7618
          else
6172
7619
            func_append compiler_flags " $deplib"
6173
 
            if test "$linkmode" = lib ; then
 
7620
            if test lib = "$linkmode"; then
6174
7621
                case "$new_inherited_linker_flags " in
6175
7622
                    *" $deplib "*) ;;
6176
7623
                    * ) func_append new_inherited_linker_flags " $deplib" ;;
6180
7627
          continue
6181
7628
          ;;
6182
7629
        -l*)
6183
 
          if test "$linkmode" != lib && test "$linkmode" != prog; then
6184
 
            func_warning "\`-l' is ignored for archives/objects"
 
7630
          if test lib != "$linkmode" && test prog != "$linkmode"; then
 
7631
            func_warning "'-l' is ignored for archives/objects"
6185
7632
            continue
6186
7633
          fi
6187
7634
          func_stripname '-l' '' "$deplib"
6188
7635
          name=$func_stripname_result
6189
 
          if test "$linkmode" = lib; then
 
7636
          if test lib = "$linkmode"; then
6190
7637
            searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
6191
7638
          else
6192
7639
            searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
6194
7641
          for searchdir in $searchdirs; do
6195
7642
            for search_ext in .la $std_shrext .so .a; do
6196
7643
              # Search the libtool library
6197
 
              lib="$searchdir/lib${name}${search_ext}"
 
7644
              lib=$searchdir/lib$name$search_ext
6198
7645
              if test -f "$lib"; then
6199
 
                if test "$search_ext" = ".la"; then
6200
 
                  found=yes
 
7646
                if test .la = "$search_ext"; then
 
7647
                  found=:
6201
7648
                else
6202
 
                  found=no
 
7649
                  found=false
6203
7650
                fi
6204
7651
                break 2
6205
7652
              fi
6206
7653
            done
6207
7654
          done
6208
 
          if test "$found" != yes; then
6209
 
            # deplib doesn't seem to be a libtool library
6210
 
            if test "$linkmode,$pass" = "prog,link"; then
6211
 
              compile_deplibs="$deplib $compile_deplibs"
6212
 
              finalize_deplibs="$deplib $finalize_deplibs"
6213
 
            else
6214
 
              deplibs="$deplib $deplibs"
6215
 
              test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
6216
 
            fi
6217
 
            continue
6218
 
          else # deplib is a libtool library
 
7655
          if $found; then
 
7656
            # deplib is a libtool library
6219
7657
            # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
6220
7658
            # We need to do some special things here, and not later.
6221
 
            if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
7659
            if test yes = "$allow_libtool_libs_with_static_runtimes"; then
6222
7660
              case " $predeps $postdeps " in
6223
7661
              *" $deplib "*)
6224
7662
                if func_lalib_p "$lib"; then
6226
7664
                  old_library=
6227
7665
                  func_source "$lib"
6228
7666
                  for l in $old_library $library_names; do
6229
 
                    ll="$l"
 
7667
                    ll=$l
6230
7668
                  done
6231
 
                  if test "X$ll" = "X$old_library" ; then # only static version available
6232
 
                    found=no
 
7669
                  if test "X$ll" = "X$old_library"; then # only static version available
 
7670
                    found=false
6233
7671
                    func_dirname "$lib" "" "."
6234
 
                    ladir="$func_dirname_result"
 
7672
                    ladir=$func_dirname_result
6235
7673
                    lib=$ladir/$old_library
6236
 
                    if test "$linkmode,$pass" = "prog,link"; then
 
7674
                    if test prog,link = "$linkmode,$pass"; then
6237
7675
                      compile_deplibs="$deplib $compile_deplibs"
6238
7676
                      finalize_deplibs="$deplib $finalize_deplibs"
6239
7677
                    else
6240
7678
                      deplibs="$deplib $deplibs"
6241
 
                      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
 
7679
                      test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
6242
7680
                    fi
6243
7681
                    continue
6244
7682
                  fi
6247
7685
              *) ;;
6248
7686
              esac
6249
7687
            fi
 
7688
          else
 
7689
            # deplib doesn't seem to be a libtool library
 
7690
            if test prog,link = "$linkmode,$pass"; then
 
7691
              compile_deplibs="$deplib $compile_deplibs"
 
7692
              finalize_deplibs="$deplib $finalize_deplibs"
 
7693
            else
 
7694
              deplibs="$deplib $deplibs"
 
7695
              test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
 
7696
            fi
 
7697
            continue
6250
7698
          fi
6251
7699
          ;; # -l
6252
7700
        *.ltframework)
6253
 
          if test "$linkmode,$pass" = "prog,link"; then
 
7701
          if test prog,link = "$linkmode,$pass"; then
6254
7702
            compile_deplibs="$deplib $compile_deplibs"
6255
7703
            finalize_deplibs="$deplib $finalize_deplibs"
6256
7704
          else
6257
7705
            deplibs="$deplib $deplibs"
6258
 
            if test "$linkmode" = lib ; then
 
7706
            if test lib = "$linkmode"; then
6259
7707
                case "$new_inherited_linker_flags " in
6260
7708
                    *" $deplib "*) ;;
6261
7709
                    * ) func_append new_inherited_linker_flags " $deplib" ;;
6268
7716
          case $linkmode in
6269
7717
          lib)
6270
7718
            deplibs="$deplib $deplibs"
6271
 
            test "$pass" = conv && continue
 
7719
            test conv = "$pass" && continue
6272
7720
            newdependency_libs="$deplib $newdependency_libs"
6273
7721
            func_stripname '-L' '' "$deplib"
6274
7722
            func_resolve_sysroot "$func_stripname_result"
6275
7723
            func_append newlib_search_path " $func_resolve_sysroot_result"
6276
7724
            ;;
6277
7725
          prog)
6278
 
            if test "$pass" = conv; then
 
7726
            if test conv = "$pass"; then
6279
7727
              deplibs="$deplib $deplibs"
6280
7728
              continue
6281
7729
            fi
6282
 
            if test "$pass" = scan; then
 
7730
            if test scan = "$pass"; then
6283
7731
              deplibs="$deplib $deplibs"
6284
7732
            else
6285
7733
              compile_deplibs="$deplib $compile_deplibs"
6290
7738
            func_append newlib_search_path " $func_resolve_sysroot_result"
6291
7739
            ;;
6292
7740
          *)
6293
 
            func_warning "\`-L' is ignored for archives/objects"
 
7741
            func_warning "'-L' is ignored for archives/objects"
6294
7742
            ;;
6295
7743
          esac # linkmode
6296
7744
          continue
6297
7745
          ;; # -L
6298
7746
        -R*)
6299
 
          if test "$pass" = link; then
 
7747
          if test link = "$pass"; then
6300
7748
            func_stripname '-R' '' "$deplib"
6301
7749
            func_resolve_sysroot "$func_stripname_result"
6302
7750
            dir=$func_resolve_sysroot_result
6314
7762
          lib=$func_resolve_sysroot_result
6315
7763
          ;;
6316
7764
        *.$libext)
6317
 
          if test "$pass" = conv; then
 
7765
          if test conv = "$pass"; then
6318
7766
            deplibs="$deplib $deplibs"
6319
7767
            continue
6320
7768
          fi
6325
7773
            case " $dlpreconveniencelibs " in
6326
7774
            *" $deplib "*) ;;
6327
7775
            *)
6328
 
              valid_a_lib=no
 
7776
              valid_a_lib=false
6329
7777
              case $deplibs_check_method in
6330
7778
                match_pattern*)
6331
7779
                  set dummy $deplibs_check_method; shift
6332
7780
                  match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
6333
7781
                  if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
6334
7782
                    | $EGREP "$match_pattern_regex" > /dev/null; then
6335
 
                    valid_a_lib=yes
 
7783
                    valid_a_lib=:
6336
7784
                  fi
6337
7785
                ;;
6338
7786
                pass_all)
6339
 
                  valid_a_lib=yes
 
7787
                  valid_a_lib=:
6340
7788
                ;;
6341
7789
              esac
6342
 
              if test "$valid_a_lib" != yes; then
 
7790
              if $valid_a_lib; then
 
7791
                echo
 
7792
                $ECHO "*** Warning: Linking the shared library $output against the"
 
7793
                $ECHO "*** static library $deplib is not portable!"
 
7794
                deplibs="$deplib $deplibs"
 
7795
              else
6343
7796
                echo
6344
7797
                $ECHO "*** Warning: Trying to link with static lib archive $deplib."
6345
7798
                echo "*** I have the capability to make that library automatically link in when"
6347
7800
                echo "*** shared version of the library, which you do not appear to have"
6348
7801
                echo "*** because the file extensions .$libext of this argument makes me believe"
6349
7802
                echo "*** that it is just a static archive that I should not use here."
6350
 
              else
6351
 
                echo
6352
 
                $ECHO "*** Warning: Linking the shared library $output against the"
6353
 
                $ECHO "*** static library $deplib is not portable!"
6354
 
                deplibs="$deplib $deplibs"
6355
7803
              fi
6356
7804
              ;;
6357
7805
            esac
6358
7806
            continue
6359
7807
            ;;
6360
7808
          prog)
6361
 
            if test "$pass" != link; then
 
7809
            if test link != "$pass"; then
6362
7810
              deplibs="$deplib $deplibs"
6363
7811
            else
6364
7812
              compile_deplibs="$deplib $compile_deplibs"
6369
7817
          esac # linkmode
6370
7818
          ;; # *.$libext
6371
7819
        *.lo | *.$objext)
6372
 
          if test "$pass" = conv; then
 
7820
          if test conv = "$pass"; then
6373
7821
            deplibs="$deplib $deplibs"
6374
 
          elif test "$linkmode" = prog; then
6375
 
            if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
 
7822
          elif test prog = "$linkmode"; then
 
7823
            if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then
6376
7824
              # If there is no dlopen support or we're linking statically,
6377
7825
              # we need to preload.
6378
7826
              func_append newdlprefiles " $deplib"
6385
7833
          continue
6386
7834
          ;;
6387
7835
        %DEPLIBS%)
6388
 
          alldeplibs=yes
 
7836
          alldeplibs=:
6389
7837
          continue
6390
7838
          ;;
6391
7839
        esac # case $deplib
6392
7840
 
6393
 
        if test "$found" = yes || test -f "$lib"; then :
6394
 
        else
6395
 
          func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
6396
 
        fi
 
7841
        $found || test -f "$lib" \
 
7842
          || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'"
6397
7843
 
6398
7844
        # Check to see that this really is a libtool archive.
6399
7845
        func_lalib_unsafe_p "$lib" \
6400
 
          || func_fatal_error "\`$lib' is not a valid libtool archive"
 
7846
          || func_fatal_error "'$lib' is not a valid libtool archive"
6401
7847
 
6402
7848
        func_dirname "$lib" "" "."
6403
 
        ladir="$func_dirname_result"
 
7849
        ladir=$func_dirname_result
6404
7850
 
6405
7851
        dlname=
6406
7852
        dlopen=
6430
7876
          done
6431
7877
        fi
6432
7878
        dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
6433
 
        if test "$linkmode,$pass" = "lib,link" ||
6434
 
           test "$linkmode,$pass" = "prog,scan" ||
6435
 
           { test "$linkmode" != prog && test "$linkmode" != lib; }; then
 
7879
        if test lib,link = "$linkmode,$pass" ||
 
7880
           test prog,scan = "$linkmode,$pass" ||
 
7881
           { test prog != "$linkmode" && test lib != "$linkmode"; }; then
6436
7882
          test -n "$dlopen" && func_append dlfiles " $dlopen"
6437
7883
          test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
6438
7884
        fi
6439
7885
 
6440
 
        if test "$pass" = conv; then
 
7886
        if test conv = "$pass"; then
6441
7887
          # Only check for convenience libraries
6442
7888
          deplibs="$lib $deplibs"
6443
7889
          if test -z "$libdir"; then
6444
7890
            if test -z "$old_library"; then
6445
 
              func_fatal_error "cannot find name of link library for \`$lib'"
 
7891
              func_fatal_error "cannot find name of link library for '$lib'"
6446
7892
            fi
6447
7893
            # It is a libtool convenience library, so add in its objects.
6448
7894
            func_append convenience " $ladir/$objdir/$old_library"
6450
7896
            tmp_libs=
6451
7897
            for deplib in $dependency_libs; do
6452
7898
              deplibs="$deplib $deplibs"
6453
 
              if $opt_preserve_dup_deps ; then
 
7899
              if $opt_preserve_dup_deps; then
6454
7900
                case "$tmp_libs " in
6455
7901
                *" $deplib "*) func_append specialdeplibs " $deplib" ;;
6456
7902
                esac
6457
7903
              fi
6458
7904
              func_append tmp_libs " $deplib"
6459
7905
            done
6460
 
          elif test "$linkmode" != prog && test "$linkmode" != lib; then
6461
 
            func_fatal_error "\`$lib' is not a convenience library"
 
7906
          elif test prog != "$linkmode" && test lib != "$linkmode"; then
 
7907
            func_fatal_error "'$lib' is not a convenience library"
6462
7908
          fi
6463
7909
          continue
6464
7910
        fi # $pass = conv
6467
7913
        # Get the name of the library we link against.
6468
7914
        linklib=
6469
7915
        if test -n "$old_library" &&
6470
 
           { test "$prefer_static_libs" = yes ||
6471
 
             test "$prefer_static_libs,$installed" = "built,no"; }; then
 
7916
           { test yes = "$prefer_static_libs" ||
 
7917
             test built,no = "$prefer_static_libs,$installed"; }; then
6472
7918
          linklib=$old_library
6473
7919
        else
6474
7920
          for l in $old_library $library_names; do
6475
 
            linklib="$l"
 
7921
            linklib=$l
6476
7922
          done
6477
7923
        fi
6478
7924
        if test -z "$linklib"; then
6479
 
          func_fatal_error "cannot find name of link library for \`$lib'"
 
7925
          func_fatal_error "cannot find name of link library for '$lib'"
6480
7926
        fi
6481
7927
 
6482
7928
        # This library was specified with -dlopen.
6483
 
        if test "$pass" = dlopen; then
6484
 
          if test -z "$libdir"; then
6485
 
            func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
6486
 
          fi
 
7929
        if test dlopen = "$pass"; then
 
7930
          test -z "$libdir" \
 
7931
            && func_fatal_error "cannot -dlopen a convenience library: '$lib'"
6487
7932
          if test -z "$dlname" ||
6488
 
             test "$dlopen_support" != yes ||
6489
 
             test "$build_libtool_libs" = no; then
 
7933
             test yes != "$dlopen_support" ||
 
7934
             test no = "$build_libtool_libs"
 
7935
          then
6490
7936
            # If there is no dlname, no dlopen support or we're linking
6491
7937
            # statically, we need to preload.  We also need to preload any
6492
7938
            # dependent libraries so libltdl's deplib preloader doesn't
6500
7946
 
6501
7947
        # We need an absolute path.
6502
7948
        case $ladir in
6503
 
        [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
 
7949
        [\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;;
6504
7950
        *)
6505
7951
          abs_ladir=`cd "$ladir" && pwd`
6506
7952
          if test -z "$abs_ladir"; then
6507
 
            func_warning "cannot determine absolute directory name of \`$ladir'"
 
7953
            func_warning "cannot determine absolute directory name of '$ladir'"
6508
7954
            func_warning "passing it literally to the linker, although it might fail"
6509
 
            abs_ladir="$ladir"
 
7955
            abs_ladir=$ladir
6510
7956
          fi
6511
7957
          ;;
6512
7958
        esac
6513
7959
        func_basename "$lib"
6514
 
        laname="$func_basename_result"
 
7960
        laname=$func_basename_result
6515
7961
 
6516
7962
        # Find the relevant object directory and library name.
6517
 
        if test "X$installed" = Xyes; then
 
7963
        if test yes = "$installed"; then
6518
7964
          if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
6519
 
            func_warning "library \`$lib' was moved."
6520
 
            dir="$ladir"
6521
 
            absdir="$abs_ladir"
6522
 
            libdir="$abs_ladir"
 
7965
            func_warning "library '$lib' was moved."
 
7966
            dir=$ladir
 
7967
            absdir=$abs_ladir
 
7968
            libdir=$abs_ladir
6523
7969
          else
6524
 
            dir="$lt_sysroot$libdir"
6525
 
            absdir="$lt_sysroot$libdir"
 
7970
            dir=$lt_sysroot$libdir
 
7971
            absdir=$lt_sysroot$libdir
6526
7972
          fi
6527
 
          test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
 
7973
          test yes = "$hardcode_automatic" && avoidtemprpath=yes
6528
7974
        else
6529
7975
          if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
6530
 
            dir="$ladir"
6531
 
            absdir="$abs_ladir"
 
7976
            dir=$ladir
 
7977
            absdir=$abs_ladir
6532
7978
            # Remove this search path later
6533
7979
            func_append notinst_path " $abs_ladir"
6534
7980
          else
6535
 
            dir="$ladir/$objdir"
6536
 
            absdir="$abs_ladir/$objdir"
 
7981
            dir=$ladir/$objdir
 
7982
            absdir=$abs_ladir/$objdir
6537
7983
            # Remove this search path later
6538
7984
            func_append notinst_path " $abs_ladir"
6539
7985
          fi
6542
7988
        name=$func_stripname_result
6543
7989
 
6544
7990
        # This library was specified with -dlpreopen.
6545
 
        if test "$pass" = dlpreopen; then
6546
 
          if test -z "$libdir" && test "$linkmode" = prog; then
6547
 
            func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
 
7991
        if test dlpreopen = "$pass"; then
 
7992
          if test -z "$libdir" && test prog = "$linkmode"; then
 
7993
            func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'"
6548
7994
          fi
6549
 
          case "$host" in
 
7995
          case $host in
6550
7996
            # special handling for platforms with PE-DLLs.
6551
7997
            *cygwin* | *mingw* | *cegcc* )
6552
7998
              # Linker will automatically link against shared library if both
6590
8036
 
6591
8037
        if test -z "$libdir"; then
6592
8038
          # Link the convenience library
6593
 
          if test "$linkmode" = lib; then
 
8039
          if test lib = "$linkmode"; then
6594
8040
            deplibs="$dir/$old_library $deplibs"
6595
 
          elif test "$linkmode,$pass" = "prog,link"; then
 
8041
          elif test prog,link = "$linkmode,$pass"; then
6596
8042
            compile_deplibs="$dir/$old_library $compile_deplibs"
6597
8043
            finalize_deplibs="$dir/$old_library $finalize_deplibs"
6598
8044
          else
6602
8048
        fi
6603
8049
 
6604
8050
 
6605
 
        if test "$linkmode" = prog && test "$pass" != link; then
 
8051
        if test prog = "$linkmode" && test link != "$pass"; then
6606
8052
          func_append newlib_search_path " $ladir"
6607
8053
          deplibs="$lib $deplibs"
6608
8054
 
6609
 
          linkalldeplibs=no
6610
 
          if test "$link_all_deplibs" != no || test -z "$library_names" ||
6611
 
             test "$build_libtool_libs" = no; then
6612
 
            linkalldeplibs=yes
 
8055
          linkalldeplibs=false
 
8056
          if test no != "$link_all_deplibs" || test -z "$library_names" ||
 
8057
             test no = "$build_libtool_libs"; then
 
8058
            linkalldeplibs=:
6613
8059
          fi
6614
8060
 
6615
8061
          tmp_libs=
6621
8067
                 ;;
6622
8068
            esac
6623
8069
            # Need to link against all dependency_libs?
6624
 
            if test "$linkalldeplibs" = yes; then
 
8070
            if $linkalldeplibs; then
6625
8071
              deplibs="$deplib $deplibs"
6626
8072
            else
6627
8073
              # Need to hardcode shared library paths
6628
8074
              # or/and link against static libraries
6629
8075
              newdependency_libs="$deplib $newdependency_libs"
6630
8076
            fi
6631
 
            if $opt_preserve_dup_deps ; then
 
8077
            if $opt_preserve_dup_deps; then
6632
8078
              case "$tmp_libs " in
6633
8079
              *" $deplib "*) func_append specialdeplibs " $deplib" ;;
6634
8080
              esac
6638
8084
          continue
6639
8085
        fi # $linkmode = prog...
6640
8086
 
6641
 
        if test "$linkmode,$pass" = "prog,link"; then
 
8087
        if test prog,link = "$linkmode,$pass"; then
6642
8088
          if test -n "$library_names" &&
6643
 
             { { test "$prefer_static_libs" = no ||
6644
 
                 test "$prefer_static_libs,$installed" = "built,yes"; } ||
 
8089
             { { test no = "$prefer_static_libs" ||
 
8090
                 test built,yes = "$prefer_static_libs,$installed"; } ||
6645
8091
               test -z "$old_library"; }; then
6646
8092
            # We need to hardcode the library path
6647
 
            if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
 
8093
            if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then
6648
8094
              # Make sure the rpath contains only unique directories.
6649
 
              case "$temp_rpath:" in
 
8095
              case $temp_rpath: in
6650
8096
              *"$absdir:"*) ;;
6651
8097
              *) func_append temp_rpath "$absdir:" ;;
6652
8098
              esac
6675
8121
            esac
6676
8122
          fi # $linkmode,$pass = prog,link...
6677
8123
 
6678
 
          if test "$alldeplibs" = yes &&
6679
 
             { test "$deplibs_check_method" = pass_all ||
6680
 
               { test "$build_libtool_libs" = yes &&
 
8124
          if $alldeplibs &&
 
8125
             { test pass_all = "$deplibs_check_method" ||
 
8126
               { test yes = "$build_libtool_libs" &&
6681
8127
                 test -n "$library_names"; }; }; then
6682
8128
            # We only need to search for static libraries
6683
8129
            continue
6686
8132
 
6687
8133
        link_static=no # Whether the deplib will be linked statically
6688
8134
        use_static_libs=$prefer_static_libs
6689
 
        if test "$use_static_libs" = built && test "$installed" = yes; then
 
8135
        if test built = "$use_static_libs" && test yes = "$installed"; then
6690
8136
          use_static_libs=no
6691
8137
        fi
6692
8138
        if test -n "$library_names" &&
6693
 
           { test "$use_static_libs" = no || test -z "$old_library"; }; then
 
8139
           { test no = "$use_static_libs" || test -z "$old_library"; }; then
6694
8140
          case $host in
6695
 
          *cygwin* | *mingw* | *cegcc*)
 
8141
          *cygwin* | *mingw* | *cegcc* | *os2*)
6696
8142
              # No point in relinking DLLs because paths are not encoded
6697
8143
              func_append notinst_deplibs " $lib"
6698
8144
              need_relink=no
6699
8145
            ;;
6700
8146
          *)
6701
 
            if test "$installed" = no; then
 
8147
            if test no = "$installed"; then
6702
8148
              func_append notinst_deplibs " $lib"
6703
8149
              need_relink=yes
6704
8150
            fi
6708
8154
 
6709
8155
          # Warn about portability, can't link against -module's on some
6710
8156
          # systems (darwin).  Don't bleat about dlopened modules though!
6711
 
          dlopenmodule=""
 
8157
          dlopenmodule=
6712
8158
          for dlpremoduletest in $dlprefiles; do
6713
8159
            if test "X$dlpremoduletest" = "X$lib"; then
6714
 
              dlopenmodule="$dlpremoduletest"
 
8160
              dlopenmodule=$dlpremoduletest
6715
8161
              break
6716
8162
            fi
6717
8163
          done
6718
 
          if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
 
8164
          if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then
6719
8165
            echo
6720
 
            if test "$linkmode" = prog; then
 
8166
            if test prog = "$linkmode"; then
6721
8167
              $ECHO "*** Warning: Linking the executable $output against the loadable module"
6722
8168
            else
6723
8169
              $ECHO "*** Warning: Linking the shared library $output against the loadable module"
6724
8170
            fi
6725
8171
            $ECHO "*** $linklib is not portable!"
6726
8172
          fi
6727
 
          if test "$linkmode" = lib &&
6728
 
             test "$hardcode_into_libs" = yes; then
 
8173
          if test lib = "$linkmode" &&
 
8174
             test yes = "$hardcode_into_libs"; then
6729
8175
            # Hardcode the library path.
6730
8176
            # Skip directories that are in the system default run-time
6731
8177
            # search path.
6753
8199
            # figure out the soname
6754
8200
            set dummy $library_names
6755
8201
            shift
6756
 
            realname="$1"
 
8202
            realname=$1
6757
8203
            shift
6758
8204
            libname=`eval "\\$ECHO \"$libname_spec\""`
6759
8205
            # use dlname if we got it. it's perfectly good, no?
6760
8206
            if test -n "$dlname"; then
6761
 
              soname="$dlname"
 
8207
              soname=$dlname
6762
8208
            elif test -n "$soname_spec"; then
6763
8209
              # bleh windows
6764
8210
              case $host in
6765
 
              *cygwin* | mingw* | *cegcc*)
 
8211
              *cygwin* | mingw* | *cegcc* | *os2*)
6766
8212
                func_arith $current - $age
6767
8213
                major=$func_arith_result
6768
 
                versuffix="-$major"
 
8214
                versuffix=-$major
6769
8215
                ;;
6770
8216
              esac
6771
8217
              eval soname=\"$soname_spec\"
6772
8218
            else
6773
 
              soname="$realname"
 
8219
              soname=$realname
6774
8220
            fi
6775
8221
 
6776
8222
            # Make a new name for the extract_expsyms_cmds to use
6777
 
            soroot="$soname"
 
8223
            soroot=$soname
6778
8224
            func_basename "$soroot"
6779
 
            soname="$func_basename_result"
 
8225
            soname=$func_basename_result
6780
8226
            func_stripname 'lib' '.dll' "$soname"
6781
8227
            newlib=libimp-$func_stripname_result.a
6782
8228
 
6783
8229
            # If the library has no export list, then create one now
6784
8230
            if test -f "$output_objdir/$soname-def"; then :
6785
8231
            else
6786
 
              func_verbose "extracting exported symbol list from \`$soname'"
 
8232
              func_verbose "extracting exported symbol list from '$soname'"
6787
8233
              func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
6788
8234
            fi
6789
8235
 
6790
8236
            # Create $newlib
6791
8237
            if test -f "$output_objdir/$newlib"; then :; else
6792
 
              func_verbose "generating import library for \`$soname'"
 
8238
              func_verbose "generating import library for '$soname'"
6793
8239
              func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
6794
8240
            fi
6795
8241
            # make sure the library variables are pointing to the new library
6797
8243
            linklib=$newlib
6798
8244
          fi # test -n "$old_archive_from_expsyms_cmds"
6799
8245
 
6800
 
          if test "$linkmode" = prog || test "$opt_mode" != relink; then
 
8246
          if test prog = "$linkmode" || test relink != "$opt_mode"; then
6801
8247
            add_shlibpath=
6802
8248
            add_dir=
6803
8249
            add=
6804
8250
            lib_linked=yes
6805
8251
            case $hardcode_action in
6806
8252
            immediate | unsupported)
6807
 
              if test "$hardcode_direct" = no; then
6808
 
                add="$dir/$linklib"
 
8253
              if test no = "$hardcode_direct"; then
 
8254
                add=$dir/$linklib
6809
8255
                case $host in
6810
 
                  *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
6811
 
                  *-*-sysv4*uw2*) add_dir="-L$dir" ;;
 
8256
                  *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;;
 
8257
                  *-*-sysv4*uw2*) add_dir=-L$dir ;;
6812
8258
                  *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
6813
 
                    *-*-unixware7*) add_dir="-L$dir" ;;
 
8259
                    *-*-unixware7*) add_dir=-L$dir ;;
6814
8260
                  *-*-darwin* )
6815
 
                    # if the lib is a (non-dlopened) module then we can not
 
8261
                    # if the lib is a (non-dlopened) module then we cannot
6816
8262
                    # link against it, someone is ignoring the earlier warnings
6817
8263
                    if /usr/bin/file -L $add 2> /dev/null |
6818
 
                         $GREP ": [^:]* bundle" >/dev/null ; then
 
8264
                         $GREP ": [^:]* bundle" >/dev/null; then
6819
8265
                      if test "X$dlopenmodule" != "X$lib"; then
6820
8266
                        $ECHO "*** Warning: lib $linklib is a module, not a shared library"
6821
 
                        if test -z "$old_library" ; then
 
8267
                        if test -z "$old_library"; then
6822
8268
                          echo
6823
8269
                          echo "*** And there doesn't seem to be a static archive available"
6824
8270
                          echo "*** The link will probably fail, sorry"
6825
8271
                        else
6826
 
                          add="$dir/$old_library"
 
8272
                          add=$dir/$old_library
6827
8273
                        fi
6828
8274
                      elif test -n "$old_library"; then
6829
 
                        add="$dir/$old_library"
 
8275
                        add=$dir/$old_library
6830
8276
                      fi
6831
8277
                    fi
6832
8278
                esac
6833
 
              elif test "$hardcode_minus_L" = no; then
 
8279
              elif test no = "$hardcode_minus_L"; then
6834
8280
                case $host in
6835
 
                *-*-sunos*) add_shlibpath="$dir" ;;
 
8281
                *-*-sunos*) add_shlibpath=$dir ;;
6836
8282
                esac
6837
 
                add_dir="-L$dir"
6838
 
                add="-l$name"
6839
 
              elif test "$hardcode_shlibpath_var" = no; then
6840
 
                add_shlibpath="$dir"
6841
 
                add="-l$name"
 
8283
                add_dir=-L$dir
 
8284
                add=-l$name
 
8285
              elif test no = "$hardcode_shlibpath_var"; then
 
8286
                add_shlibpath=$dir
 
8287
                add=-l$name
6842
8288
              else
6843
8289
                lib_linked=no
6844
8290
              fi
6845
8291
              ;;
6846
8292
            relink)
6847
 
              if test "$hardcode_direct" = yes &&
6848
 
                 test "$hardcode_direct_absolute" = no; then
6849
 
                add="$dir/$linklib"
6850
 
              elif test "$hardcode_minus_L" = yes; then
6851
 
                add_dir="-L$absdir"
 
8293
              if test yes = "$hardcode_direct" &&
 
8294
                 test no = "$hardcode_direct_absolute"; then
 
8295
                add=$dir/$linklib
 
8296
              elif test yes = "$hardcode_minus_L"; then
 
8297
                add_dir=-L$absdir
6852
8298
                # Try looking first in the location we're being installed to.
6853
8299
                if test -n "$inst_prefix_dir"; then
6854
8300
                  case $libdir in
6857
8303
                      ;;
6858
8304
                  esac
6859
8305
                fi
6860
 
                add="-l$name"
6861
 
              elif test "$hardcode_shlibpath_var" = yes; then
6862
 
                add_shlibpath="$dir"
6863
 
                add="-l$name"
 
8306
                add=-l$name
 
8307
              elif test yes = "$hardcode_shlibpath_var"; then
 
8308
                add_shlibpath=$dir
 
8309
                add=-l$name
6864
8310
              else
6865
8311
                lib_linked=no
6866
8312
              fi
6868
8314
            *) lib_linked=no ;;
6869
8315
            esac
6870
8316
 
6871
 
            if test "$lib_linked" != yes; then
 
8317
            if test yes != "$lib_linked"; then
6872
8318
              func_fatal_configuration "unsupported hardcode properties"
6873
8319
            fi
6874
8320
 
6878
8324
              *) func_append compile_shlibpath "$add_shlibpath:" ;;
6879
8325
              esac
6880
8326
            fi
6881
 
            if test "$linkmode" = prog; then
 
8327
            if test prog = "$linkmode"; then
6882
8328
              test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
6883
8329
              test -n "$add" && compile_deplibs="$add $compile_deplibs"
6884
8330
            else
6885
8331
              test -n "$add_dir" && deplibs="$add_dir $deplibs"
6886
8332
              test -n "$add" && deplibs="$add $deplibs"
6887
 
              if test "$hardcode_direct" != yes &&
6888
 
                 test "$hardcode_minus_L" != yes &&
6889
 
                 test "$hardcode_shlibpath_var" = yes; then
 
8333
              if test yes != "$hardcode_direct" &&
 
8334
                 test yes != "$hardcode_minus_L" &&
 
8335
                 test yes = "$hardcode_shlibpath_var"; then
6890
8336
                case :$finalize_shlibpath: in
6891
8337
                *":$libdir:"*) ;;
6892
8338
                *) func_append finalize_shlibpath "$libdir:" ;;
6895
8341
            fi
6896
8342
          fi
6897
8343
 
6898
 
          if test "$linkmode" = prog || test "$opt_mode" = relink; then
 
8344
          if test prog = "$linkmode" || test relink = "$opt_mode"; then
6899
8345
            add_shlibpath=
6900
8346
            add_dir=
6901
8347
            add=
6902
8348
            # Finalize command for both is simple: just hardcode it.
6903
 
            if test "$hardcode_direct" = yes &&
6904
 
               test "$hardcode_direct_absolute" = no; then
6905
 
              add="$libdir/$linklib"
6906
 
            elif test "$hardcode_minus_L" = yes; then
6907
 
              add_dir="-L$libdir"
6908
 
              add="-l$name"
6909
 
            elif test "$hardcode_shlibpath_var" = yes; then
 
8349
            if test yes = "$hardcode_direct" &&
 
8350
               test no = "$hardcode_direct_absolute"; then
 
8351
              add=$libdir/$linklib
 
8352
            elif test yes = "$hardcode_minus_L"; then
 
8353
              add_dir=-L$libdir
 
8354
              add=-l$name
 
8355
            elif test yes = "$hardcode_shlibpath_var"; then
6910
8356
              case :$finalize_shlibpath: in
6911
8357
              *":$libdir:"*) ;;
6912
8358
              *) func_append finalize_shlibpath "$libdir:" ;;
6913
8359
              esac
6914
 
              add="-l$name"
6915
 
            elif test "$hardcode_automatic" = yes; then
 
8360
              add=-l$name
 
8361
            elif test yes = "$hardcode_automatic"; then
6916
8362
              if test -n "$inst_prefix_dir" &&
6917
 
                 test -f "$inst_prefix_dir$libdir/$linklib" ; then
6918
 
                add="$inst_prefix_dir$libdir/$linklib"
 
8363
                 test -f "$inst_prefix_dir$libdir/$linklib"; then
 
8364
                add=$inst_prefix_dir$libdir/$linklib
6919
8365
              else
6920
 
                add="$libdir/$linklib"
 
8366
                add=$libdir/$linklib
6921
8367
              fi
6922
8368
            else
6923
8369
              # We cannot seem to hardcode it, guess we'll fake it.
6924
 
              add_dir="-L$libdir"
 
8370
              add_dir=-L$libdir
6925
8371
              # Try looking first in the location we're being installed to.
6926
8372
              if test -n "$inst_prefix_dir"; then
6927
8373
                case $libdir in
6930
8376
                    ;;
6931
8377
                esac
6932
8378
              fi
6933
 
              add="-l$name"
 
8379
              add=-l$name
6934
8380
            fi
6935
8381
 
6936
 
            if test "$linkmode" = prog; then
 
8382
            if test prog = "$linkmode"; then
6937
8383
              test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
6938
8384
              test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
6939
8385
            else
6941
8387
              test -n "$add" && deplibs="$add $deplibs"
6942
8388
            fi
6943
8389
          fi
6944
 
        elif test "$linkmode" = prog; then
 
8390
        elif test prog = "$linkmode"; then
6945
8391
          # Here we assume that one of hardcode_direct or hardcode_minus_L
6946
8392
          # is not unsupported.  This is valid on all known static and
6947
8393
          # shared platforms.
6948
 
          if test "$hardcode_direct" != unsupported; then
6949
 
            test -n "$old_library" && linklib="$old_library"
 
8394
          if test unsupported != "$hardcode_direct"; then
 
8395
            test -n "$old_library" && linklib=$old_library
6950
8396
            compile_deplibs="$dir/$linklib $compile_deplibs"
6951
8397
            finalize_deplibs="$dir/$linklib $finalize_deplibs"
6952
8398
          else
6953
8399
            compile_deplibs="-l$name -L$dir $compile_deplibs"
6954
8400
            finalize_deplibs="-l$name -L$dir $finalize_deplibs"
6955
8401
          fi
6956
 
        elif test "$build_libtool_libs" = yes; then
 
8402
        elif test yes = "$build_libtool_libs"; then
6957
8403
          # Not a shared library
6958
 
          if test "$deplibs_check_method" != pass_all; then
 
8404
          if test pass_all != "$deplibs_check_method"; then
6959
8405
            # We're trying link a shared library against a static one
6960
8406
            # but the system doesn't support it.
6961
8407
 
6962
8408
            # Just print a warning and add the library to dependency_libs so
6963
8409
            # that the program can be linked against the static library.
6964
8410
            echo
6965
 
            $ECHO "*** Warning: This system can not link to static lib archive $lib."
 
8411
            $ECHO "*** Warning: This system cannot link to static lib archive $lib."
6966
8412
            echo "*** I have the capability to make that library automatically link in when"
6967
8413
            echo "*** you link to this library.  But I can only do this if you have a"
6968
8414
            echo "*** shared version of the library, which you do not appear to have."
6969
 
            if test "$module" = yes; then
 
8415
            if test yes = "$module"; then
6970
8416
              echo "*** But as you try to build a module library, libtool will still create "
6971
8417
              echo "*** a static module, that should work as long as the dlopening application"
6972
8418
              echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
6973
8419
              if test -z "$global_symbol_pipe"; then
6974
8420
                echo
6975
8421
                echo "*** However, this would only work if libtool was able to extract symbol"
6976
 
                echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
 
8422
                echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
6977
8423
                echo "*** not find such a program.  So, this module is probably useless."
6978
 
                echo "*** \`nm' from GNU binutils and a full rebuild may help."
 
8424
                echo "*** 'nm' from GNU binutils and a full rebuild may help."
6979
8425
              fi
6980
 
              if test "$build_old_libs" = no; then
 
8426
              if test no = "$build_old_libs"; then
6981
8427
                build_libtool_libs=module
6982
8428
                build_old_libs=yes
6983
8429
              else
6990
8436
          fi
6991
8437
        fi # link shared/static library?
6992
8438
 
6993
 
        if test "$linkmode" = lib; then
 
8439
        if test lib = "$linkmode"; then
6994
8440
          if test -n "$dependency_libs" &&
6995
 
             { test "$hardcode_into_libs" != yes ||
6996
 
               test "$build_old_libs" = yes ||
6997
 
               test "$link_static" = yes; }; then
 
8441
             { test yes != "$hardcode_into_libs" ||
 
8442
               test yes = "$build_old_libs" ||
 
8443
               test yes = "$link_static"; }; then
6998
8444
            # Extract -R from dependency_libs
6999
8445
            temp_deplibs=
7000
8446
            for libdir in $dependency_libs; do
7008
8454
              *) func_append temp_deplibs " $libdir";;
7009
8455
              esac
7010
8456
            done
7011
 
            dependency_libs="$temp_deplibs"
 
8457
            dependency_libs=$temp_deplibs
7012
8458
          fi
7013
8459
 
7014
8460
          func_append newlib_search_path " $absdir"
7015
8461
          # Link against this library
7016
 
          test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
 
8462
          test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
7017
8463
          # ... and its dependency_libs
7018
8464
          tmp_libs=
7019
8465
          for deplib in $dependency_libs; do
7023
8469
                   func_resolve_sysroot "$func_stripname_result";;
7024
8470
              *) func_resolve_sysroot "$deplib" ;;
7025
8471
            esac
7026
 
            if $opt_preserve_dup_deps ; then
 
8472
            if $opt_preserve_dup_deps; then
7027
8473
              case "$tmp_libs " in
7028
8474
              *" $func_resolve_sysroot_result "*)
7029
8475
                func_append specialdeplibs " $func_resolve_sysroot_result" ;;
7032
8478
            func_append tmp_libs " $func_resolve_sysroot_result"
7033
8479
          done
7034
8480
 
7035
 
          if test "$link_all_deplibs" != no; then
 
8481
          if test no != "$link_all_deplibs"; then
7036
8482
            # Add the search paths of all dependency libraries
7037
8483
            for deplib in $dependency_libs; do
7038
8484
              path=
7039
8485
              case $deplib in
7040
 
              -L*) path="$deplib" ;;
 
8486
              -L*) path=$deplib ;;
7041
8487
              *.la)
7042
8488
                func_resolve_sysroot "$deplib"
7043
8489
                deplib=$func_resolve_sysroot_result
7045
8491
                dir=$func_dirname_result
7046
8492
                # We need an absolute path.
7047
8493
                case $dir in
7048
 
                [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
 
8494
                [\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;;
7049
8495
                *)
7050
8496
                  absdir=`cd "$dir" && pwd`
7051
8497
                  if test -z "$absdir"; then
7052
 
                    func_warning "cannot determine absolute directory name of \`$dir'"
7053
 
                    absdir="$dir"
 
8498
                    func_warning "cannot determine absolute directory name of '$dir'"
 
8499
                    absdir=$dir
7054
8500
                  fi
7055
8501
                  ;;
7056
8502
                esac
7058
8504
                case $host in
7059
8505
                *-*-darwin*)
7060
8506
                  depdepl=
7061
 
                  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
7062
 
                  if test -n "$deplibrary_names" ; then
7063
 
                    for tmp in $deplibrary_names ; do
 
8507
                  eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
 
8508
                  if test -n "$deplibrary_names"; then
 
8509
                    for tmp in $deplibrary_names; do
7064
8510
                      depdepl=$tmp
7065
8511
                    done
7066
 
                    if test -f "$absdir/$objdir/$depdepl" ; then
7067
 
                      depdepl="$absdir/$objdir/$depdepl"
7068
 
                      darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
 
8512
                    if test -f "$absdir/$objdir/$depdepl"; then
 
8513
                      depdepl=$absdir/$objdir/$depdepl
 
8514
                      darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
7069
8515
                      if test -z "$darwin_install_name"; then
7070
 
                          darwin_install_name=`${OTOOL64} -L $depdepl  | awk '{if (NR == 2) {print $1;exit}}'`
 
8516
                          darwin_install_name=`$OTOOL64 -L $depdepl  | awk '{if (NR == 2) {print $1;exit}}'`
7071
8517
                      fi
7072
 
                      func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
7073
 
                      func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}"
 
8518
                      func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl"
 
8519
                      func_append linker_flags " -dylib_file $darwin_install_name:$depdepl"
7074
8520
                      path=
7075
8521
                    fi
7076
8522
                  fi
7077
8523
                  ;;
7078
8524
                *)
7079
 
                  path="-L$absdir/$objdir"
 
8525
                  path=-L$absdir/$objdir
7080
8526
                  ;;
7081
8527
                esac
7082
8528
                else
7083
 
                  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
 
8529
                  eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
7084
8530
                  test -z "$libdir" && \
7085
 
                    func_fatal_error "\`$deplib' is not a valid libtool archive"
 
8531
                    func_fatal_error "'$deplib' is not a valid libtool archive"
7086
8532
                  test "$absdir" != "$libdir" && \
7087
 
                    func_warning "\`$deplib' seems to be moved"
 
8533
                    func_warning "'$deplib' seems to be moved"
7088
8534
 
7089
 
                  path="-L$absdir"
 
8535
                  path=-L$absdir
7090
8536
                fi
7091
8537
                ;;
7092
8538
              esac
7098
8544
          fi # link_all_deplibs != no
7099
8545
        fi # linkmode = lib
7100
8546
      done # for deplib in $libs
7101
 
      if test "$pass" = link; then
7102
 
        if test "$linkmode" = "prog"; then
 
8547
      if test link = "$pass"; then
 
8548
        if test prog = "$linkmode"; then
7103
8549
          compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
7104
8550
          finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
7105
8551
        else
7106
8552
          compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
7107
8553
        fi
7108
8554
      fi
7109
 
      dependency_libs="$newdependency_libs"
7110
 
      if test "$pass" = dlpreopen; then
 
8555
      dependency_libs=$newdependency_libs
 
8556
      if test dlpreopen = "$pass"; then
7111
8557
        # Link the dlpreopened libraries before other libraries
7112
8558
        for deplib in $save_deplibs; do
7113
8559
          deplibs="$deplib $deplibs"
7114
8560
        done
7115
8561
      fi
7116
 
      if test "$pass" != dlopen; then
7117
 
        if test "$pass" != conv; then
 
8562
      if test dlopen != "$pass"; then
 
8563
        test conv = "$pass" || {
7118
8564
          # Make sure lib_search_path contains only unique directories.
7119
8565
          lib_search_path=
7120
8566
          for dir in $newlib_search_path; do
7124
8570
            esac
7125
8571
          done
7126
8572
          newlib_search_path=
7127
 
        fi
 
8573
        }
7128
8574
 
7129
 
        if test "$linkmode,$pass" != "prog,link"; then
7130
 
          vars="deplibs"
7131
 
        else
 
8575
        if test prog,link = "$linkmode,$pass"; then
7132
8576
          vars="compile_deplibs finalize_deplibs"
 
8577
        else
 
8578
          vars=deplibs
7133
8579
        fi
7134
8580
        for var in $vars dependency_libs; do
7135
8581
          # Add libraries to $var in reverse order
7187
8633
          eval $var=\"$tmp_libs\"
7188
8634
        done # for var
7189
8635
      fi
 
8636
 
 
8637
      # Add Sun CC postdeps if required:
 
8638
      test CXX = "$tagname" && {
 
8639
        case $host_os in
 
8640
        linux*)
 
8641
          case `$CC -V 2>&1 | sed 5q` in
 
8642
          *Sun\ C*) # Sun C++ 5.9
 
8643
            func_suncc_cstd_abi
 
8644
 
 
8645
            if test no != "$suncc_use_cstd_abi"; then
 
8646
              func_append postdeps ' -library=Cstd -library=Crun'
 
8647
            fi
 
8648
            ;;
 
8649
          esac
 
8650
          ;;
 
8651
 
 
8652
        solaris*)
 
8653
          func_cc_basename "$CC"
 
8654
          case $func_cc_basename_result in
 
8655
          CC* | sunCC*)
 
8656
            func_suncc_cstd_abi
 
8657
 
 
8658
            if test no != "$suncc_use_cstd_abi"; then
 
8659
              func_append postdeps ' -library=Cstd -library=Crun'
 
8660
            fi
 
8661
            ;;
 
8662
          esac
 
8663
          ;;
 
8664
        esac
 
8665
      }
 
8666
 
7190
8667
      # Last step: remove runtime libs from dependency_libs
7191
8668
      # (they stay in deplibs)
7192
8669
      tmp_libs=
7193
 
      for i in $dependency_libs ; do
 
8670
      for i in $dependency_libs; do
7194
8671
        case " $predeps $postdeps $compiler_lib_search_path " in
7195
8672
        *" $i "*)
7196
 
          i=""
 
8673
          i=
7197
8674
          ;;
7198
8675
        esac
7199
 
        if test -n "$i" ; then
 
8676
        if test -n "$i"; then
7200
8677
          func_append tmp_libs " $i"
7201
8678
        fi
7202
8679
      done
7203
8680
      dependency_libs=$tmp_libs
7204
8681
    done # for pass
7205
 
    if test "$linkmode" = prog; then
7206
 
      dlfiles="$newdlfiles"
 
8682
    if test prog = "$linkmode"; then
 
8683
      dlfiles=$newdlfiles
7207
8684
    fi
7208
 
    if test "$linkmode" = prog || test "$linkmode" = lib; then
7209
 
      dlprefiles="$newdlprefiles"
 
8685
    if test prog = "$linkmode" || test lib = "$linkmode"; then
 
8686
      dlprefiles=$newdlprefiles
7210
8687
    fi
7211
8688
 
7212
8689
    case $linkmode in
7213
8690
    oldlib)
7214
 
      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
7215
 
        func_warning "\`-dlopen' is ignored for archives"
 
8691
      if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
 
8692
        func_warning "'-dlopen' is ignored for archives"
7216
8693
      fi
7217
8694
 
7218
8695
      case " $deplibs" in
7219
8696
      *\ -l* | *\ -L*)
7220
 
        func_warning "\`-l' and \`-L' are ignored for archives" ;;
 
8697
        func_warning "'-l' and '-L' are ignored for archives" ;;
7221
8698
      esac
7222
8699
 
7223
8700
      test -n "$rpath" && \
7224
 
        func_warning "\`-rpath' is ignored for archives"
 
8701
        func_warning "'-rpath' is ignored for archives"
7225
8702
 
7226
8703
      test -n "$xrpath" && \
7227
 
        func_warning "\`-R' is ignored for archives"
 
8704
        func_warning "'-R' is ignored for archives"
7228
8705
 
7229
8706
      test -n "$vinfo" && \
7230
 
        func_warning "\`-version-info/-version-number' is ignored for archives"
 
8707
        func_warning "'-version-info/-version-number' is ignored for archives"
7231
8708
 
7232
8709
      test -n "$release" && \
7233
 
        func_warning "\`-release' is ignored for archives"
 
8710
        func_warning "'-release' is ignored for archives"
7234
8711
 
7235
8712
      test -n "$export_symbols$export_symbols_regex" && \
7236
 
        func_warning "\`-export-symbols' is ignored for archives"
 
8713
        func_warning "'-export-symbols' is ignored for archives"
7237
8714
 
7238
8715
      # Now set the variables for building old libraries.
7239
8716
      build_libtool_libs=no
7240
 
      oldlibs="$output"
 
8717
      oldlibs=$output
7241
8718
      func_append objs "$old_deplibs"
7242
8719
      ;;
7243
8720
 
7244
8721
    lib)
7245
 
      # Make sure we only generate libraries of the form `libNAME.la'.
 
8722
      # Make sure we only generate libraries of the form 'libNAME.la'.
7246
8723
      case $outputname in
7247
8724
      lib*)
7248
8725
        func_stripname 'lib' '.la' "$outputname"
7251
8728
        eval libname=\"$libname_spec\"
7252
8729
        ;;
7253
8730
      *)
7254
 
        test "$module" = no && \
7255
 
          func_fatal_help "libtool library \`$output' must begin with \`lib'"
 
8731
        test no = "$module" \
 
8732
          && func_fatal_help "libtool library '$output' must begin with 'lib'"
7256
8733
 
7257
 
        if test "$need_lib_prefix" != no; then
 
8734
        if test no != "$need_lib_prefix"; then
7258
8735
          # Add the "lib" prefix for modules if required
7259
8736
          func_stripname '' '.la' "$outputname"
7260
8737
          name=$func_stripname_result
7268
8745
      esac
7269
8746
 
7270
8747
      if test -n "$objs"; then
7271
 
        if test "$deplibs_check_method" != pass_all; then
7272
 
          func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
 
8748
        if test pass_all != "$deplibs_check_method"; then
 
8749
          func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs"
7273
8750
        else
7274
8751
          echo
7275
8752
          $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
7278
8755
        fi
7279
8756
      fi
7280
8757
 
7281
 
      test "$dlself" != no && \
7282
 
        func_warning "\`-dlopen self' is ignored for libtool libraries"
 
8758
      test no = "$dlself" \
 
8759
        || func_warning "'-dlopen self' is ignored for libtool libraries"
7283
8760
 
7284
8761
      set dummy $rpath
7285
8762
      shift
7286
 
      test "$#" -gt 1 && \
7287
 
        func_warning "ignoring multiple \`-rpath's for a libtool library"
 
8763
      test 1 -lt "$#" \
 
8764
        && func_warning "ignoring multiple '-rpath's for a libtool library"
7288
8765
 
7289
 
      install_libdir="$1"
 
8766
      install_libdir=$1
7290
8767
 
7291
8768
      oldlibs=
7292
8769
      if test -z "$rpath"; then
7293
 
        if test "$build_libtool_libs" = yes; then
 
8770
        if test yes = "$build_libtool_libs"; then
7294
8771
          # Building a libtool convenience library.
7295
 
          # Some compilers have problems with a `.al' extension so
 
8772
          # Some compilers have problems with a '.al' extension so
7296
8773
          # convenience libraries should have the same extension an
7297
8774
          # archive normally would.
7298
8775
          oldlibs="$output_objdir/$libname.$libext $oldlibs"
7301
8778
        fi
7302
8779
 
7303
8780
        test -n "$vinfo" && \
7304
 
          func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
 
8781
          func_warning "'-version-info/-version-number' is ignored for convenience libraries"
7305
8782
 
7306
8783
        test -n "$release" && \
7307
 
          func_warning "\`-release' is ignored for convenience libraries"
 
8784
          func_warning "'-release' is ignored for convenience libraries"
7308
8785
      else
7309
8786
 
7310
8787
        # Parse the version information argument.
7311
 
        save_ifs="$IFS"; IFS=':'
 
8788
        save_ifs=$IFS; IFS=:
7312
8789
        set dummy $vinfo 0 0 0
7313
8790
        shift
7314
 
        IFS="$save_ifs"
 
8791
        IFS=$save_ifs
7315
8792
 
7316
8793
        test -n "$7" && \
7317
 
          func_fatal_help "too many parameters to \`-version-info'"
 
8794
          func_fatal_help "too many parameters to '-version-info'"
7318
8795
 
7319
8796
        # convert absolute version numbers to libtool ages
7320
8797
        # this retains compatibility with .la files and attempts
7322
8799
 
7323
8800
        case $vinfo_number in
7324
8801
        yes)
7325
 
          number_major="$1"
7326
 
          number_minor="$2"
7327
 
          number_revision="$3"
 
8802
          number_major=$1
 
8803
          number_minor=$2
 
8804
          number_revision=$3
7328
8805
          #
7329
8806
          # There are really only two kinds -- those that
7330
8807
          # use the current revision as the major version
7331
8808
          # and those that subtract age and use age as
7332
8809
          # a minor version.  But, then there is irix
7333
 
          # which has an extra 1 added just for fun
 
8810
          # that has an extra 1 added just for fun
7334
8811
          #
7335
8812
          case $version_type in
7336
8813
          # correct linux to gnu/linux during the next big refactor
7337
 
          darwin|linux|osf|windows|none)
 
8814
          darwin|freebsd-elf|linux|osf|windows|none)
7338
8815
            func_arith $number_major + $number_minor
7339
8816
            current=$func_arith_result
7340
 
            age="$number_minor"
7341
 
            revision="$number_revision"
 
8817
            age=$number_minor
 
8818
            revision=$number_revision
7342
8819
            ;;
7343
 
          freebsd-aout|freebsd-elf|qnx|sunos)
7344
 
            current="$number_major"
7345
 
            revision="$number_minor"
7346
 
            age="0"
 
8820
          freebsd-aout|qnx|sunos)
 
8821
            current=$number_major
 
8822
            revision=$number_minor
 
8823
            age=0
7347
8824
            ;;
7348
8825
          irix|nonstopux)
7349
8826
            func_arith $number_major + $number_minor
7350
8827
            current=$func_arith_result
7351
 
            age="$number_minor"
7352
 
            revision="$number_minor"
 
8828
            age=$number_minor
 
8829
            revision=$number_minor
7353
8830
            lt_irix_increment=no
7354
8831
            ;;
7355
8832
          *)
7356
 
            func_fatal_configuration "$modename: unknown library version type \`$version_type'"
 
8833
            func_fatal_configuration "$modename: unknown library version type '$version_type'"
7357
8834
            ;;
7358
8835
          esac
7359
8836
          ;;
7360
8837
        no)
7361
 
          current="$1"
7362
 
          revision="$2"
7363
 
          age="$3"
 
8838
          current=$1
 
8839
          revision=$2
 
8840
          age=$3
7364
8841
          ;;
7365
8842
        esac
7366
8843
 
7368
8845
        case $current in
7369
8846
        0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
7370
8847
        *)
7371
 
          func_error "CURRENT \`$current' must be a nonnegative integer"
7372
 
          func_fatal_error "\`$vinfo' is not valid version information"
 
8848
          func_error "CURRENT '$current' must be a nonnegative integer"
 
8849
          func_fatal_error "'$vinfo' is not valid version information"
7373
8850
          ;;
7374
8851
        esac
7375
8852
 
7376
8853
        case $revision in
7377
8854
        0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
7378
8855
        *)
7379
 
          func_error "REVISION \`$revision' must be a nonnegative integer"
7380
 
          func_fatal_error "\`$vinfo' is not valid version information"
 
8856
          func_error "REVISION '$revision' must be a nonnegative integer"
 
8857
          func_fatal_error "'$vinfo' is not valid version information"
7381
8858
          ;;
7382
8859
        esac
7383
8860
 
7384
8861
        case $age in
7385
8862
        0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
7386
8863
        *)
7387
 
          func_error "AGE \`$age' must be a nonnegative integer"
7388
 
          func_fatal_error "\`$vinfo' is not valid version information"
 
8864
          func_error "AGE '$age' must be a nonnegative integer"
 
8865
          func_fatal_error "'$vinfo' is not valid version information"
7389
8866
          ;;
7390
8867
        esac
7391
8868
 
7392
8869
        if test "$age" -gt "$current"; then
7393
 
          func_error "AGE \`$age' is greater than the current interface number \`$current'"
7394
 
          func_fatal_error "\`$vinfo' is not valid version information"
 
8870
          func_error "AGE '$age' is greater than the current interface number '$current'"
 
8871
          func_fatal_error "'$vinfo' is not valid version information"
7395
8872
        fi
7396
8873
 
7397
8874
        # Calculate the version variables.
7406
8883
          # verstring for coding it into the library header
7407
8884
          func_arith $current - $age
7408
8885
          major=.$func_arith_result
7409
 
          versuffix="$major.$age.$revision"
 
8886
          versuffix=$major.$age.$revision
7410
8887
          # Darwin ld doesn't like 0 for these options...
7411
8888
          func_arith $current + 1
7412
8889
          minor_current=$func_arith_result
7413
 
          xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
 
8890
          xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
7414
8891
          verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
 
8892
          # On Darwin other compilers
 
8893
          case $CC in
 
8894
              nagfor*)
 
8895
                  verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
 
8896
                  ;;
 
8897
              *)
 
8898
                  verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
 
8899
                  ;;
 
8900
          esac
7415
8901
          ;;
7416
8902
 
7417
8903
        freebsd-aout)
7418
 
          major=".$current"
7419
 
          versuffix=".$current.$revision";
 
8904
          major=.$current
 
8905
          versuffix=.$current.$revision
7420
8906
          ;;
7421
8907
 
7422
8908
        freebsd-elf)
7423
 
          major=".$current"
7424
 
          versuffix=".$current"
 
8909
          func_arith $current - $age
 
8910
          major=.$func_arith_result
 
8911
          versuffix=$major.$age.$revision
7425
8912
          ;;
7426
8913
 
7427
8914
        irix | nonstopux)
7428
 
          if test "X$lt_irix_increment" = "Xno"; then
 
8915
          if test no = "$lt_irix_increment"; then
7429
8916
            func_arith $current - $age
7430
8917
          else
7431
8918
            func_arith $current - $age + 1
7436
8923
            nonstopux) verstring_prefix=nonstopux ;;
7437
8924
            *)         verstring_prefix=sgi ;;
7438
8925
          esac
7439
 
          verstring="$verstring_prefix$major.$revision"
 
8926
          verstring=$verstring_prefix$major.$revision
7440
8927
 
7441
8928
          # Add in all the interfaces that we are compatible with.
7442
8929
          loop=$revision
7443
 
          while test "$loop" -ne 0; do
 
8930
          while test 0 -ne "$loop"; do
7444
8931
            func_arith $revision - $loop
7445
8932
            iface=$func_arith_result
7446
8933
            func_arith $loop - 1
7447
8934
            loop=$func_arith_result
7448
 
            verstring="$verstring_prefix$major.$iface:$verstring"
 
8935
            verstring=$verstring_prefix$major.$iface:$verstring
7449
8936
          done
7450
8937
 
7451
 
          # Before this point, $major must not contain `.'.
 
8938
          # Before this point, $major must not contain '.'.
7452
8939
          major=.$major
7453
 
          versuffix="$major.$revision"
 
8940
          versuffix=$major.$revision
7454
8941
          ;;
7455
8942
 
7456
8943
        linux) # correct to gnu/linux during the next big refactor
7457
8944
          func_arith $current - $age
7458
8945
          major=.$func_arith_result
7459
 
          versuffix="$major.$age.$revision"
 
8946
          versuffix=$major.$age.$revision
7460
8947
          ;;
7461
8948
 
7462
8949
        osf)
7463
8950
          func_arith $current - $age
7464
8951
          major=.$func_arith_result
7465
 
          versuffix=".$current.$age.$revision"
7466
 
          verstring="$current.$age.$revision"
 
8952
          versuffix=.$current.$age.$revision
 
8953
          verstring=$current.$age.$revision
7467
8954
 
7468
8955
          # Add in all the interfaces that we are compatible with.
7469
8956
          loop=$age
7470
 
          while test "$loop" -ne 0; do
 
8957
          while test 0 -ne "$loop"; do
7471
8958
            func_arith $current - $loop
7472
8959
            iface=$func_arith_result
7473
8960
            func_arith $loop - 1
7474
8961
            loop=$func_arith_result
7475
 
            verstring="$verstring:${iface}.0"
 
8962
            verstring=$verstring:$iface.0
7476
8963
          done
7477
8964
 
7478
8965
          # Make executables depend on our current version.
7479
 
          func_append verstring ":${current}.0"
 
8966
          func_append verstring ":$current.0"
7480
8967
          ;;
7481
8968
 
7482
8969
        qnx)
7483
 
          major=".$current"
7484
 
          versuffix=".$current"
 
8970
          major=.$current
 
8971
          versuffix=.$current
 
8972
          ;;
 
8973
 
 
8974
        sco)
 
8975
          major=.$current
 
8976
          versuffix=.$current
7485
8977
          ;;
7486
8978
 
7487
8979
        sunos)
7488
 
          major=".$current"
7489
 
          versuffix=".$current.$revision"
 
8980
          major=.$current
 
8981
          versuffix=.$current.$revision
7490
8982
          ;;
7491
8983
 
7492
8984
        windows)
7493
8985
          # Use '-' rather than '.', since we only want one
7494
 
          # extension on DOS 8.3 filesystems.
 
8986
          # extension on DOS 8.3 file systems.
7495
8987
          func_arith $current - $age
7496
8988
          major=$func_arith_result
7497
 
          versuffix="-$major"
 
8989
          versuffix=-$major
7498
8990
          ;;
7499
8991
 
7500
8992
        *)
7501
 
          func_fatal_configuration "unknown library version type \`$version_type'"
 
8993
          func_fatal_configuration "unknown library version type '$version_type'"
7502
8994
          ;;
7503
8995
        esac
7504
8996
 
7512
9004
            verstring=
7513
9005
            ;;
7514
9006
          *)
7515
 
            verstring="0.0"
 
9007
            verstring=0.0
7516
9008
            ;;
7517
9009
          esac
7518
 
          if test "$need_version" = no; then
 
9010
          if test no = "$need_version"; then
7519
9011
            versuffix=
7520
9012
          else
7521
 
            versuffix=".0.0"
 
9013
            versuffix=.0.0
7522
9014
          fi
7523
9015
        fi
7524
9016
 
7525
9017
        # Remove version info from name if versioning should be avoided
7526
 
        if test "$avoid_version" = yes && test "$need_version" = no; then
 
9018
        if test yes,no = "$avoid_version,$need_version"; then
7527
9019
          major=
7528
9020
          versuffix=
7529
 
          verstring=""
 
9021
          verstring=
7530
9022
        fi
7531
9023
 
7532
9024
        # Check to see if the archive will have undefined symbols.
7533
 
        if test "$allow_undefined" = yes; then
7534
 
          if test "$allow_undefined_flag" = unsupported; then
7535
 
            func_warning "undefined symbols not allowed in $host shared libraries"
7536
 
            build_libtool_libs=no
7537
 
            build_old_libs=yes
 
9025
        if test yes = "$allow_undefined"; then
 
9026
          if test unsupported = "$allow_undefined_flag"; then
 
9027
            if test yes = "$build_old_libs"; then
 
9028
              func_warning "undefined symbols not allowed in $host shared libraries; building static only"
 
9029
              build_libtool_libs=no
 
9030
            else
 
9031
              func_fatal_error "can't build $host shared library unless -no-undefined is specified"
 
9032
            fi
7538
9033
          fi
7539
9034
        else
7540
9035
          # Don't allow undefined symbols.
7541
 
          allow_undefined_flag="$no_undefined_flag"
 
9036
          allow_undefined_flag=$no_undefined_flag
7542
9037
        fi
7543
9038
 
7544
9039
      fi
7545
9040
 
7546
 
      func_generate_dlsyms "$libname" "$libname" "yes"
 
9041
      func_generate_dlsyms "$libname" "$libname" :
7547
9042
      func_append libobjs " $symfileobj"
7548
 
      test "X$libobjs" = "X " && libobjs=
 
9043
      test " " = "$libobjs" && libobjs=
7549
9044
 
7550
 
      if test "$opt_mode" != relink; then
 
9045
      if test relink != "$opt_mode"; then
7551
9046
        # Remove our outputs, but don't remove object files since they
7552
9047
        # may have been created when compiling PIC objects.
7553
9048
        removelist=
7556
9051
          case $p in
7557
9052
            *.$objext | *.gcno)
7558
9053
               ;;
7559
 
            $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
7560
 
               if test "X$precious_files_regex" != "X"; then
 
9054
            $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*)
 
9055
               if test -n "$precious_files_regex"; then
7561
9056
                 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
7562
9057
                 then
7563
9058
                   continue
7573
9068
      fi
7574
9069
 
7575
9070
      # Now set the variables for building old libraries.
7576
 
      if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
 
9071
      if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then
7577
9072
        func_append oldlibs " $output_objdir/$libname.$libext"
7578
9073
 
7579
9074
        # Transform .lo files to .o files.
7580
 
        oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP`
 
9075
        oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP`
7581
9076
      fi
7582
9077
 
7583
9078
      # Eliminate all temporary directories.
7598
9093
          *) func_append finalize_rpath " $libdir" ;;
7599
9094
          esac
7600
9095
        done
7601
 
        if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
 
9096
        if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then
7602
9097
          dependency_libs="$temp_xrpath $dependency_libs"
7603
9098
        fi
7604
9099
      fi
7605
9100
 
7606
9101
      # Make sure dlfiles contains only unique files that won't be dlpreopened
7607
 
      old_dlfiles="$dlfiles"
 
9102
      old_dlfiles=$dlfiles
7608
9103
      dlfiles=
7609
9104
      for lib in $old_dlfiles; do
7610
9105
        case " $dlprefiles $dlfiles " in
7614
9109
      done
7615
9110
 
7616
9111
      # Make sure dlprefiles contains only unique files
7617
 
      old_dlprefiles="$dlprefiles"
 
9112
      old_dlprefiles=$dlprefiles
7618
9113
      dlprefiles=
7619
9114
      for lib in $old_dlprefiles; do
7620
9115
        case "$dlprefiles " in
7623
9118
        esac
7624
9119
      done
7625
9120
 
7626
 
      if test "$build_libtool_libs" = yes; then
 
9121
      if test yes = "$build_libtool_libs"; then
7627
9122
        if test -n "$rpath"; then
7628
9123
          case $host in
7629
9124
          *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
7647
9142
            ;;
7648
9143
          *)
7649
9144
            # Add libc to deplibs on all other systems if necessary.
7650
 
            if test "$build_libtool_need_lc" = "yes"; then
 
9145
            if test yes = "$build_libtool_need_lc"; then
7651
9146
              func_append deplibs " -lc"
7652
9147
            fi
7653
9148
            ;;
7663
9158
        # I'm not sure if I'm treating the release correctly.  I think
7664
9159
        # release should show up in the -l (ie -lgmp5) so we don't want to
7665
9160
        # add it in twice.  Is that correct?
7666
 
        release=""
7667
 
        versuffix=""
7668
 
        major=""
 
9161
        release=
 
9162
        versuffix=
 
9163
        major=
7669
9164
        newdeplibs=
7670
9165
        droppeddeps=no
7671
9166
        case $deplibs_check_method in
7694
9189
              -l*)
7695
9190
                func_stripname -l '' "$i"
7696
9191
                name=$func_stripname_result
7697
 
                if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
9192
                if test yes = "$allow_libtool_libs_with_static_runtimes"; then
7698
9193
                  case " $predeps $postdeps " in
7699
9194
                  *" $i "*)
7700
9195
                    func_append newdeplibs " $i"
7701
 
                    i=""
 
9196
                    i=
7702
9197
                    ;;
7703
9198
                  esac
7704
9199
                fi
7705
 
                if test -n "$i" ; then
 
9200
                if test -n "$i"; then
7706
9201
                  libname=`eval "\\$ECHO \"$libname_spec\""`
7707
9202
                  deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
7708
9203
                  set dummy $deplib_matches; shift
7709
9204
                  deplib_match=$1
7710
 
                  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
 
9205
                  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
7711
9206
                    func_append newdeplibs " $i"
7712
9207
                  else
7713
9208
                    droppeddeps=yes
7737
9232
                $opt_dry_run || $RM conftest
7738
9233
                if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
7739
9234
                  ldd_output=`ldd conftest`
7740
 
                  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
9235
                  if test yes = "$allow_libtool_libs_with_static_runtimes"; then
7741
9236
                    case " $predeps $postdeps " in
7742
9237
                    *" $i "*)
7743
9238
                      func_append newdeplibs " $i"
7744
 
                      i=""
 
9239
                      i=
7745
9240
                      ;;
7746
9241
                    esac
7747
9242
                  fi
7748
 
                  if test -n "$i" ; then
 
9243
                  if test -n "$i"; then
7749
9244
                    libname=`eval "\\$ECHO \"$libname_spec\""`
7750
9245
                    deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
7751
9246
                    set dummy $deplib_matches; shift
7752
9247
                    deplib_match=$1
7753
 
                    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
 
9248
                    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
7754
9249
                      func_append newdeplibs " $i"
7755
9250
                    else
7756
9251
                      droppeddeps=yes
7787
9282
            -l*)
7788
9283
              func_stripname -l '' "$a_deplib"
7789
9284
              name=$func_stripname_result
7790
 
              if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
9285
              if test yes = "$allow_libtool_libs_with_static_runtimes"; then
7791
9286
                case " $predeps $postdeps " in
7792
9287
                *" $a_deplib "*)
7793
9288
                  func_append newdeplibs " $a_deplib"
7794
 
                  a_deplib=""
 
9289
                  a_deplib=
7795
9290
                  ;;
7796
9291
                esac
7797
9292
              fi
7798
 
              if test -n "$a_deplib" ; then
 
9293
              if test -n "$a_deplib"; then
7799
9294
                libname=`eval "\\$ECHO \"$libname_spec\""`
7800
9295
                if test -n "$file_magic_glob"; then
7801
9296
                  libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
7802
9297
                else
7803
9298
                  libnameglob=$libname
7804
9299
                fi
7805
 
                test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob`
 
9300
                test yes = "$want_nocaseglob" && nocaseglob=`shopt -p nocaseglob`
7806
9301
                for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
7807
 
                  if test "$want_nocaseglob" = yes; then
 
9302
                  if test yes = "$want_nocaseglob"; then
7808
9303
                    shopt -s nocaseglob
7809
9304
                    potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
7810
9305
                    $nocaseglob
7822
9317
                      # We might still enter an endless loop, since a link
7823
9318
                      # loop can be closed while we follow links,
7824
9319
                      # but so what?
7825
 
                      potlib="$potent_lib"
 
9320
                      potlib=$potent_lib
7826
9321
                      while test -h "$potlib" 2>/dev/null; do
7827
 
                        potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
 
9322
                        potliblink=`ls -ld $potlib | $SED 's/.* -> //'`
7828
9323
                        case $potliblink in
7829
 
                        [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
7830
 
                        *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";;
 
9324
                        [\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;;
 
9325
                        *) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";;
7831
9326
                        esac
7832
9327
                      done
7833
9328
                      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
7834
9329
                         $SED -e 10q |
7835
9330
                         $EGREP "$file_magic_regex" > /dev/null; then
7836
9331
                        func_append newdeplibs " $a_deplib"
7837
 
                        a_deplib=""
 
9332
                        a_deplib=
7838
9333
                        break 2
7839
9334
                      fi
7840
9335
                  done
7841
9336
                done
7842
9337
              fi
7843
 
              if test -n "$a_deplib" ; then
 
9338
              if test -n "$a_deplib"; then
7844
9339
                droppeddeps=yes
7845
9340
                echo
7846
9341
                $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
7848
9343
                echo "*** you link to this library.  But I can only do this if you have a"
7849
9344
                echo "*** shared version of the library, which you do not appear to have"
7850
9345
                echo "*** because I did check the linker path looking for a file starting"
7851
 
                if test -z "$potlib" ; then
 
9346
                if test -z "$potlib"; then
7852
9347
                  $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
7853
9348
                else
7854
9349
                  $ECHO "*** with $libname and none of the candidates passed a file format test"
7871
9366
            -l*)
7872
9367
              func_stripname -l '' "$a_deplib"
7873
9368
              name=$func_stripname_result
7874
 
              if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
9369
              if test yes = "$allow_libtool_libs_with_static_runtimes"; then
7875
9370
                case " $predeps $postdeps " in
7876
9371
                *" $a_deplib "*)
7877
9372
                  func_append newdeplibs " $a_deplib"
7878
 
                  a_deplib=""
 
9373
                  a_deplib=
7879
9374
                  ;;
7880
9375
                esac
7881
9376
              fi
7882
 
              if test -n "$a_deplib" ; then
 
9377
              if test -n "$a_deplib"; then
7883
9378
                libname=`eval "\\$ECHO \"$libname_spec\""`
7884
9379
                for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
7885
9380
                  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
7886
9381
                  for potent_lib in $potential_libs; do
7887
 
                    potlib="$potent_lib" # see symlink-check above in file_magic test
 
9382
                    potlib=$potent_lib # see symlink-check above in file_magic test
7888
9383
                    if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
7889
9384
                       $EGREP "$match_pattern_regex" > /dev/null; then
7890
9385
                      func_append newdeplibs " $a_deplib"
7891
 
                      a_deplib=""
 
9386
                      a_deplib=
7892
9387
                      break 2
7893
9388
                    fi
7894
9389
                  done
7895
9390
                done
7896
9391
              fi
7897
 
              if test -n "$a_deplib" ; then
 
9392
              if test -n "$a_deplib"; then
7898
9393
                droppeddeps=yes
7899
9394
                echo
7900
9395
                $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
7902
9397
                echo "*** you link to this library.  But I can only do this if you have a"
7903
9398
                echo "*** shared version of the library, which you do not appear to have"
7904
9399
                echo "*** because I did check the linker path looking for a file starting"
7905
 
                if test -z "$potlib" ; then
 
9400
                if test -z "$potlib"; then
7906
9401
                  $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
7907
9402
                else
7908
9403
                  $ECHO "*** with $libname and none of the candidates passed a file format test"
7918
9413
          done # Gone through all deplibs.
7919
9414
          ;;
7920
9415
        none | unknown | *)
7921
 
          newdeplibs=""
 
9416
          newdeplibs=
7922
9417
          tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
7923
 
          if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7924
 
            for i in $predeps $postdeps ; do
 
9418
          if test yes = "$allow_libtool_libs_with_static_runtimes"; then
 
9419
            for i in $predeps $postdeps; do
7925
9420
              # can't use Xsed below, because $i might contain '/'
7926
 
              tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"`
 
9421
              tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"`
7927
9422
            done
7928
9423
          fi
7929
9424
          case $tmp_deplibs in
7930
9425
          *[!\  \ ]*)
7931
9426
            echo
7932
 
            if test "X$deplibs_check_method" = "Xnone"; then
 
9427
            if test none = "$deplibs_check_method"; then
7933
9428
              echo "*** Warning: inter-library dependencies are not supported in this platform."
7934
9429
            else
7935
9430
              echo "*** Warning: inter-library dependencies are not known to be supported."
7953
9448
          ;;
7954
9449
        esac
7955
9450
 
7956
 
        if test "$droppeddeps" = yes; then
7957
 
          if test "$module" = yes; then
 
9451
        if test yes = "$droppeddeps"; then
 
9452
          if test yes = "$module"; then
7958
9453
            echo
7959
9454
            echo "*** Warning: libtool could not satisfy all declared inter-library"
7960
9455
            $ECHO "*** dependencies of module $libname.  Therefore, libtool will create"
7963
9458
            if test -z "$global_symbol_pipe"; then
7964
9459
              echo
7965
9460
              echo "*** However, this would only work if libtool was able to extract symbol"
7966
 
              echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
 
9461
              echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
7967
9462
              echo "*** not find such a program.  So, this module is probably useless."
7968
 
              echo "*** \`nm' from GNU binutils and a full rebuild may help."
 
9463
              echo "*** 'nm' from GNU binutils and a full rebuild may help."
7969
9464
            fi
7970
 
            if test "$build_old_libs" = no; then
7971
 
              oldlibs="$output_objdir/$libname.$libext"
 
9465
            if test no = "$build_old_libs"; then
 
9466
              oldlibs=$output_objdir/$libname.$libext
7972
9467
              build_libtool_libs=module
7973
9468
              build_old_libs=yes
7974
9469
            else
7979
9474
            echo "*** automatically added whenever a program is linked with this library"
7980
9475
            echo "*** or is declared to -dlopen it."
7981
9476
 
7982
 
            if test "$allow_undefined" = no; then
 
9477
            if test no = "$allow_undefined"; then
7983
9478
              echo
7984
9479
              echo "*** Since this library must not contain undefined symbols,"
7985
9480
              echo "*** because either the platform does not support them or"
7986
9481
              echo "*** it was explicitly requested with -no-undefined,"
7987
9482
              echo "*** libtool will only create a static version of it."
7988
 
              if test "$build_old_libs" = no; then
7989
 
                oldlibs="$output_objdir/$libname.$libext"
 
9483
              if test no = "$build_old_libs"; then
 
9484
                oldlibs=$output_objdir/$libname.$libext
7990
9485
                build_libtool_libs=module
7991
9486
                build_old_libs=yes
7992
9487
              else
8032
9527
        *) func_append new_libs " $deplib" ;;
8033
9528
        esac
8034
9529
      done
8035
 
      deplibs="$new_libs"
 
9530
      deplibs=$new_libs
8036
9531
 
8037
9532
      # All the library-specific variables (install_libdir is set above).
8038
9533
      library_names=
8040
9535
      dlname=
8041
9536
 
8042
9537
      # Test again, we may have decided not to build it any more
8043
 
      if test "$build_libtool_libs" = yes; then
8044
 
        # Remove ${wl} instances when linking with ld.
 
9538
      if test yes = "$build_libtool_libs"; then
 
9539
        # Remove $wl instances when linking with ld.
8045
9540
        # FIXME: should test the right _cmds variable.
8046
9541
        case $archive_cmds in
8047
9542
          *\$LD\ *) wl= ;;
8048
9543
        esac
8049
 
        if test "$hardcode_into_libs" = yes; then
 
9544
        if test yes = "$hardcode_into_libs"; then
8050
9545
          # Hardcode the library paths
8051
9546
          hardcode_libdirs=
8052
9547
          dep_rpath=
8053
 
          rpath="$finalize_rpath"
8054
 
          test "$opt_mode" != relink && rpath="$compile_rpath$rpath"
 
9548
          rpath=$finalize_rpath
 
9549
          test relink = "$opt_mode" || rpath=$compile_rpath$rpath
8055
9550
          for libdir in $rpath; do
8056
9551
            if test -n "$hardcode_libdir_flag_spec"; then
8057
9552
              if test -n "$hardcode_libdir_separator"; then
8058
9553
                func_replace_sysroot "$libdir"
8059
9554
                libdir=$func_replace_sysroot_result
8060
9555
                if test -z "$hardcode_libdirs"; then
8061
 
                  hardcode_libdirs="$libdir"
 
9556
                  hardcode_libdirs=$libdir
8062
9557
                else
8063
9558
                  # Just accumulate the unique libdirs.
8064
9559
                  case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
8083
9578
          # Substitute the hardcoded libdirs into the rpath.
8084
9579
          if test -n "$hardcode_libdir_separator" &&
8085
9580
             test -n "$hardcode_libdirs"; then
8086
 
            libdir="$hardcode_libdirs"
 
9581
            libdir=$hardcode_libdirs
8087
9582
            eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
8088
9583
          fi
8089
9584
          if test -n "$runpath_var" && test -n "$perm_rpath"; then
8097
9592
          test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
8098
9593
        fi
8099
9594
 
8100
 
        shlibpath="$finalize_shlibpath"
8101
 
        test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
 
9595
        shlibpath=$finalize_shlibpath
 
9596
        test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath
8102
9597
        if test -n "$shlibpath"; then
8103
9598
          eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
8104
9599
        fi
8108
9603
        eval library_names=\"$library_names_spec\"
8109
9604
        set dummy $library_names
8110
9605
        shift
8111
 
        realname="$1"
 
9606
        realname=$1
8112
9607
        shift
8113
9608
 
8114
9609
        if test -n "$soname_spec"; then
8115
9610
          eval soname=\"$soname_spec\"
8116
9611
        else
8117
 
          soname="$realname"
 
9612
          soname=$realname
8118
9613
        fi
8119
9614
        if test -z "$dlname"; then
8120
9615
          dlname=$soname
8121
9616
        fi
8122
9617
 
8123
 
        lib="$output_objdir/$realname"
 
9618
        lib=$output_objdir/$realname
8124
9619
        linknames=
8125
9620
        for link
8126
9621
        do
8134
9629
        delfiles=
8135
9630
        if test -n "$export_symbols" && test -n "$include_expsyms"; then
8136
9631
          $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
8137
 
          export_symbols="$output_objdir/$libname.uexp"
 
9632
          export_symbols=$output_objdir/$libname.uexp
8138
9633
          func_append delfiles " $export_symbols"
8139
9634
        fi
8140
9635
 
8143
9638
        cygwin* | mingw* | cegcc*)
8144
9639
          if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
8145
9640
            # exporting using user supplied symfile
8146
 
            if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
 
9641
            func_dll_def_p "$export_symbols" || {
8147
9642
              # and it's NOT already a .def file. Must figure out
8148
9643
              # which of the given symbols are data symbols and tag
8149
9644
              # them as such. So, trigger use of export_symbols_cmds.
8150
9645
              # export_symbols gets reassigned inside the "prepare
8151
9646
              # the list of exported symbols" if statement, so the
8152
9647
              # include_expsyms logic still works.
8153
 
              orig_export_symbols="$export_symbols"
 
9648
              orig_export_symbols=$export_symbols
8154
9649
              export_symbols=
8155
9650
              always_export_symbols=yes
8156
 
            fi
 
9651
            }
8157
9652
          fi
8158
9653
          ;;
8159
9654
        esac
8160
9655
 
8161
9656
        # Prepare the list of exported symbols
8162
9657
        if test -z "$export_symbols"; then
8163
 
          if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
8164
 
            func_verbose "generating symbol list for \`$libname.la'"
8165
 
            export_symbols="$output_objdir/$libname.exp"
 
9658
          if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then
 
9659
            func_verbose "generating symbol list for '$libname.la'"
 
9660
            export_symbols=$output_objdir/$libname.exp
8166
9661
            $opt_dry_run || $RM $export_symbols
8167
9662
            cmds=$export_symbols_cmds
8168
 
            save_ifs="$IFS"; IFS='~'
 
9663
            save_ifs=$IFS; IFS='~'
8169
9664
            for cmd1 in $cmds; do
8170
 
              IFS="$save_ifs"
 
9665
              IFS=$save_ifs
8171
9666
              # Take the normal branch if the nm_file_list_spec branch
8172
9667
              # doesn't work or if tool conversion is not needed.
8173
9668
              case $nm_file_list_spec~$to_tool_file_cmd in
8181
9676
                  try_normal_branch=no
8182
9677
                  ;;
8183
9678
              esac
8184
 
              if test "$try_normal_branch" = yes \
 
9679
              if test yes = "$try_normal_branch" \
8185
9680
                 && { test "$len" -lt "$max_cmd_len" \
8186
9681
                      || test "$max_cmd_len" -le -1; }
8187
9682
              then
8192
9687
                output_la=$func_basename_result
8193
9688
                save_libobjs=$libobjs
8194
9689
                save_output=$output
8195
 
                output=${output_objdir}/${output_la}.nm
 
9690
                output=$output_objdir/$output_la.nm
8196
9691
                func_to_tool_file "$output"
8197
9692
                libobjs=$nm_file_list_spec$func_to_tool_file_result
8198
9693
                func_append delfiles " $output"
8215
9710
                break
8216
9711
              fi
8217
9712
            done
8218
 
            IFS="$save_ifs"
8219
 
            if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
 
9713
            IFS=$save_ifs
 
9714
            if test -n "$export_symbols_regex" && test : != "$skipped_export"; then
8220
9715
              func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
8221
9716
              func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
8222
9717
            fi
8224
9719
        fi
8225
9720
 
8226
9721
        if test -n "$export_symbols" && test -n "$include_expsyms"; then
8227
 
          tmp_export_symbols="$export_symbols"
8228
 
          test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
 
9722
          tmp_export_symbols=$export_symbols
 
9723
          test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
8229
9724
          $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
8230
9725
        fi
8231
9726
 
8232
 
        if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
 
9727
        if test : != "$skipped_export" && test -n "$orig_export_symbols"; then
8233
9728
          # The given exports_symbols file has to be filtered, so filter it.
8234
 
          func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
 
9729
          func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
8235
9730
          # FIXME: $output_objdir/$libname.filter potentially contains lots of
8236
 
          # 's' commands which not all seds can handle. GNU sed should be fine
 
9731
          # 's' commands, which not all seds can handle. GNU sed should be fine
8237
9732
          # though. Also, the filter scales superlinearly with the number of
8238
9733
          # global variables. join(1) would be nice here, but unfortunately
8239
9734
          # isn't a blessed tool.
8252
9747
            ;;
8253
9748
          esac
8254
9749
        done
8255
 
        deplibs="$tmp_deplibs"
 
9750
        deplibs=$tmp_deplibs
8256
9751
 
8257
9752
        if test -n "$convenience"; then
8258
9753
          if test -n "$whole_archive_flag_spec" &&
8259
 
            test "$compiler_needs_object" = yes &&
 
9754
            test yes = "$compiler_needs_object" &&
8260
9755
            test -z "$libobjs"; then
8261
9756
            # extract the archives, so we have objects to list.
8262
9757
            # TODO: could optimize this to just extract one archive.
8267
9762
            eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
8268
9763
            test "X$libobjs" = "X " && libobjs=
8269
9764
          else
8270
 
            gentop="$output_objdir/${outputname}x"
 
9765
            gentop=$output_objdir/${outputname}x
8271
9766
            func_append generated " $gentop"
8272
9767
 
8273
9768
            func_extract_archives $gentop $convenience
8276
9771
          fi
8277
9772
        fi
8278
9773
 
8279
 
        if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
 
9774
        if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then
8280
9775
          eval flag=\"$thread_safe_flag_spec\"
8281
9776
          func_append linker_flags " $flag"
8282
9777
        fi
8283
9778
 
8284
9779
        # Make a backup of the uninstalled library when relinking
8285
 
        if test "$opt_mode" = relink; then
 
9780
        if test relink = "$opt_mode"; then
8286
9781
          $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
8287
9782
        fi
8288
9783
 
8289
9784
        # Do each of the archive commands.
8290
 
        if test "$module" = yes && test -n "$module_cmds" ; then
 
9785
        if test yes = "$module" && test -n "$module_cmds"; then
8291
9786
          if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
8292
9787
            eval test_cmds=\"$module_expsym_cmds\"
8293
9788
            cmds=$module_expsym_cmds
8305
9800
          fi
8306
9801
        fi
8307
9802
 
8308
 
        if test "X$skipped_export" != "X:" &&
 
9803
        if test : != "$skipped_export" &&
8309
9804
           func_len " $test_cmds" &&
8310
9805
           len=$func_len_result &&
8311
9806
           test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
8338
9833
          last_robj=
8339
9834
          k=1
8340
9835
 
8341
 
          if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
8342
 
            output=${output_objdir}/${output_la}.lnkscript
 
9836
          if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then
 
9837
            output=$output_objdir/$output_la.lnkscript
8343
9838
            func_verbose "creating GNU ld script: $output"
8344
9839
            echo 'INPUT (' > $output
8345
9840
            for obj in $save_libobjs
8351
9846
            func_append delfiles " $output"
8352
9847
            func_to_tool_file "$output"
8353
9848
            output=$func_to_tool_file_result
8354
 
          elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
8355
 
            output=${output_objdir}/${output_la}.lnk
 
9849
          elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then
 
9850
            output=$output_objdir/$output_la.lnk
8356
9851
            func_verbose "creating linker input file list: $output"
8357
9852
            : > $output
8358
9853
            set x $save_libobjs
8359
9854
            shift
8360
9855
            firstobj=
8361
 
            if test "$compiler_needs_object" = yes; then
 
9856
            if test yes = "$compiler_needs_object"; then
8362
9857
              firstobj="$1 "
8363
9858
              shift
8364
9859
            fi
8373
9868
          else
8374
9869
            if test -n "$save_libobjs"; then
8375
9870
              func_verbose "creating reloadable object files..."
8376
 
              output=$output_objdir/$output_la-${k}.$objext
 
9871
              output=$output_objdir/$output_la-$k.$objext
8377
9872
              eval test_cmds=\"$reload_cmds\"
8378
9873
              func_len " $test_cmds"
8379
9874
              len0=$func_len_result
8385
9880
                func_len " $obj"
8386
9881
                func_arith $len + $func_len_result
8387
9882
                len=$func_arith_result
8388
 
                if test "X$objlist" = X ||
 
9883
                if test -z "$objlist" ||
8389
9884
                   test "$len" -lt "$max_cmd_len"; then
8390
9885
                  func_append objlist " $obj"
8391
9886
                else
8392
9887
                  # The command $test_cmds is almost too long, add a
8393
9888
                  # command to the queue.
8394
 
                  if test "$k" -eq 1 ; then
 
9889
                  if test 1 -eq "$k"; then
8395
9890
                    # The first file doesn't have a previous command to add.
8396
9891
                    reload_objs=$objlist
8397
9892
                    eval concat_cmds=\"$reload_cmds\"
8401
9896
                    reload_objs="$objlist $last_robj"
8402
9897
                    eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
8403
9898
                  fi
8404
 
                  last_robj=$output_objdir/$output_la-${k}.$objext
 
9899
                  last_robj=$output_objdir/$output_la-$k.$objext
8405
9900
                  func_arith $k + 1
8406
9901
                  k=$func_arith_result
8407
 
                  output=$output_objdir/$output_la-${k}.$objext
 
9902
                  output=$output_objdir/$output_la-$k.$objext
8408
9903
                  objlist=" $obj"
8409
9904
                  func_len " $last_robj"
8410
9905
                  func_arith $len0 + $func_len_result
8416
9911
              # files will link in the last one created.
8417
9912
              test -z "$concat_cmds" || concat_cmds=$concat_cmds~
8418
9913
              reload_objs="$objlist $last_robj"
8419
 
              eval concat_cmds=\"\${concat_cmds}$reload_cmds\"
 
9914
              eval concat_cmds=\"\$concat_cmds$reload_cmds\"
8420
9915
              if test -n "$last_robj"; then
8421
 
                eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
 
9916
                eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
8422
9917
              fi
8423
9918
              func_append delfiles " $output"
8424
9919
 
8426
9921
              output=
8427
9922
            fi
8428
9923
 
8429
 
            if ${skipped_export-false}; then
8430
 
              func_verbose "generating symbol list for \`$libname.la'"
8431
 
              export_symbols="$output_objdir/$libname.exp"
 
9924
            ${skipped_export-false} && {
 
9925
              func_verbose "generating symbol list for '$libname.la'"
 
9926
              export_symbols=$output_objdir/$libname.exp
8432
9927
              $opt_dry_run || $RM $export_symbols
8433
9928
              libobjs=$output
8434
9929
              # Append the command to create the export file.
8437
9932
              if test -n "$last_robj"; then
8438
9933
                eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
8439
9934
              fi
8440
 
            fi
 
9935
            }
8441
9936
 
8442
9937
            test -n "$save_libobjs" &&
8443
9938
              func_verbose "creating a temporary reloadable object file: $output"
8444
9939
 
8445
9940
            # Loop through the commands generated above and execute them.
8446
 
            save_ifs="$IFS"; IFS='~'
 
9941
            save_ifs=$IFS; IFS='~'
8447
9942
            for cmd in $concat_cmds; do
8448
 
              IFS="$save_ifs"
8449
 
              $opt_silent || {
 
9943
              IFS=$save_ifs
 
9944
              $opt_quiet || {
8450
9945
                  func_quote_for_expand "$cmd"
8451
9946
                  eval "func_echo $func_quote_for_expand_result"
8452
9947
              }
8454
9949
                lt_exit=$?
8455
9950
 
8456
9951
                # Restore the uninstalled library and exit
8457
 
                if test "$opt_mode" = relink; then
 
9952
                if test relink = "$opt_mode"; then
8458
9953
                  ( cd "$output_objdir" && \
8459
9954
                    $RM "${realname}T" && \
8460
9955
                    $MV "${realname}U" "$realname" )
8463
9958
                exit $lt_exit
8464
9959
              }
8465
9960
            done
8466
 
            IFS="$save_ifs"
 
9961
            IFS=$save_ifs
8467
9962
 
8468
9963
            if test -n "$export_symbols_regex" && ${skipped_export-false}; then
8469
9964
              func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
8471
9966
            fi
8472
9967
          fi
8473
9968
 
8474
 
          if ${skipped_export-false}; then
 
9969
          ${skipped_export-false} && {
8475
9970
            if test -n "$export_symbols" && test -n "$include_expsyms"; then
8476
 
              tmp_export_symbols="$export_symbols"
8477
 
              test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
 
9971
              tmp_export_symbols=$export_symbols
 
9972
              test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
8478
9973
              $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
8479
9974
            fi
8480
9975
 
8481
9976
            if test -n "$orig_export_symbols"; then
8482
9977
              # The given exports_symbols file has to be filtered, so filter it.
8483
 
              func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
 
9978
              func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
8484
9979
              # FIXME: $output_objdir/$libname.filter potentially contains lots of
8485
 
              # 's' commands which not all seds can handle. GNU sed should be fine
 
9980
              # 's' commands, which not all seds can handle. GNU sed should be fine
8486
9981
              # though. Also, the filter scales superlinearly with the number of
8487
9982
              # global variables. join(1) would be nice here, but unfortunately
8488
9983
              # isn't a blessed tool.
8491
9986
              export_symbols=$output_objdir/$libname.def
8492
9987
              $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
8493
9988
            fi
8494
 
          fi
 
9989
          }
8495
9990
 
8496
9991
          libobjs=$output
8497
9992
          # Restore the value of output.
8505
10000
          # value of $libobjs for piecewise linking.
8506
10001
 
8507
10002
          # Do each of the archive commands.
8508
 
          if test "$module" = yes && test -n "$module_cmds" ; then
 
10003
          if test yes = "$module" && test -n "$module_cmds"; then
8509
10004
            if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
8510
10005
              cmds=$module_expsym_cmds
8511
10006
            else
8527
10022
 
8528
10023
        # Add any objects from preloaded convenience libraries
8529
10024
        if test -n "$dlprefiles"; then
8530
 
          gentop="$output_objdir/${outputname}x"
 
10025
          gentop=$output_objdir/${outputname}x
8531
10026
          func_append generated " $gentop"
8532
10027
 
8533
10028
          func_extract_archives $gentop $dlprefiles
8535
10030
          test "X$libobjs" = "X " && libobjs=
8536
10031
        fi
8537
10032
 
8538
 
        save_ifs="$IFS"; IFS='~'
 
10033
        save_ifs=$IFS; IFS='~'
8539
10034
        for cmd in $cmds; do
8540
 
          IFS="$save_ifs"
 
10035
          IFS=$sp$nl
8541
10036
          eval cmd=\"$cmd\"
8542
 
          $opt_silent || {
 
10037
          IFS=$save_ifs
 
10038
          $opt_quiet || {
8543
10039
            func_quote_for_expand "$cmd"
8544
10040
            eval "func_echo $func_quote_for_expand_result"
8545
10041
          }
8547
10043
            lt_exit=$?
8548
10044
 
8549
10045
            # Restore the uninstalled library and exit
8550
 
            if test "$opt_mode" = relink; then
 
10046
            if test relink = "$opt_mode"; then
8551
10047
              ( cd "$output_objdir" && \
8552
10048
                $RM "${realname}T" && \
8553
10049
                $MV "${realname}U" "$realname" )
8556
10052
            exit $lt_exit
8557
10053
          }
8558
10054
        done
8559
 
        IFS="$save_ifs"
 
10055
        IFS=$save_ifs
8560
10056
 
8561
10057
        # Restore the uninstalled library and exit
8562
 
        if test "$opt_mode" = relink; then
 
10058
        if test relink = "$opt_mode"; then
8563
10059
          $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
8564
10060
 
8565
10061
          if test -n "$convenience"; then
8579
10075
        done
8580
10076
 
8581
10077
        # If -module or -export-dynamic was specified, set the dlname.
8582
 
        if test "$module" = yes || test "$export_dynamic" = yes; then
 
10078
        if test yes = "$module" || test yes = "$export_dynamic"; then
8583
10079
          # On all known operating systems, these are identical.
8584
 
          dlname="$soname"
 
10080
          dlname=$soname
8585
10081
        fi
8586
10082
      fi
8587
10083
      ;;
8588
10084
 
8589
10085
    obj)
8590
 
      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
8591
 
        func_warning "\`-dlopen' is ignored for objects"
 
10086
      if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
 
10087
        func_warning "'-dlopen' is ignored for objects"
8592
10088
      fi
8593
10089
 
8594
10090
      case " $deplibs" in
8595
10091
      *\ -l* | *\ -L*)
8596
 
        func_warning "\`-l' and \`-L' are ignored for objects" ;;
 
10092
        func_warning "'-l' and '-L' are ignored for objects" ;;
8597
10093
      esac
8598
10094
 
8599
10095
      test -n "$rpath" && \
8600
 
        func_warning "\`-rpath' is ignored for objects"
 
10096
        func_warning "'-rpath' is ignored for objects"
8601
10097
 
8602
10098
      test -n "$xrpath" && \
8603
 
        func_warning "\`-R' is ignored for objects"
 
10099
        func_warning "'-R' is ignored for objects"
8604
10100
 
8605
10101
      test -n "$vinfo" && \
8606
 
        func_warning "\`-version-info' is ignored for objects"
 
10102
        func_warning "'-version-info' is ignored for objects"
8607
10103
 
8608
10104
      test -n "$release" && \
8609
 
        func_warning "\`-release' is ignored for objects"
 
10105
        func_warning "'-release' is ignored for objects"
8610
10106
 
8611
10107
      case $output in
8612
10108
      *.lo)
8613
10109
        test -n "$objs$old_deplibs" && \
8614
 
          func_fatal_error "cannot build library object \`$output' from non-libtool objects"
 
10110
          func_fatal_error "cannot build library object '$output' from non-libtool objects"
8615
10111
 
8616
10112
        libobj=$output
8617
10113
        func_lo2o "$libobj"
8619
10115
        ;;
8620
10116
      *)
8621
10117
        libobj=
8622
 
        obj="$output"
 
10118
        obj=$output
8623
10119
        ;;
8624
10120
      esac
8625
10121
 
8632
10128
      # the extraction.
8633
10129
      reload_conv_objs=
8634
10130
      gentop=
8635
 
      # reload_cmds runs $LD directly, so let us get rid of
8636
 
      # -Wl from whole_archive_flag_spec and hope we can get by with
8637
 
      # turning comma into space..
8638
 
      wl=
8639
 
 
 
10131
      # if reload_cmds runs $LD directly, get rid of -Wl from
 
10132
      # whole_archive_flag_spec and hope we can get by with turning comma
 
10133
      # into space.
 
10134
      case $reload_cmds in
 
10135
        *\$LD[\ \$]*) wl= ;;
 
10136
      esac
8640
10137
      if test -n "$convenience"; then
8641
10138
        if test -n "$whole_archive_flag_spec"; then
8642
10139
          eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
8643
 
          reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
 
10140
          test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
 
10141
          reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags
8644
10142
        else
8645
 
          gentop="$output_objdir/${obj}x"
 
10143
          gentop=$output_objdir/${obj}x
8646
10144
          func_append generated " $gentop"
8647
10145
 
8648
10146
          func_extract_archives $gentop $convenience
8651
10149
      fi
8652
10150
 
8653
10151
      # If we're not building shared, we need to use non_pic_objs
8654
 
      test "$build_libtool_libs" != yes && libobjs="$non_pic_objects"
 
10152
      test yes = "$build_libtool_libs" || libobjs=$non_pic_objects
8655
10153
 
8656
10154
      # Create the old-style object.
8657
 
      reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
 
10155
      reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs
8658
10156
 
8659
 
      output="$obj"
 
10157
      output=$obj
8660
10158
      func_execute_cmds "$reload_cmds" 'exit $?'
8661
10159
 
8662
10160
      # Exit if we aren't doing a library object file.
8668
10166
        exit $EXIT_SUCCESS
8669
10167
      fi
8670
10168
 
8671
 
      if test "$build_libtool_libs" != yes; then
 
10169
      test yes = "$build_libtool_libs" || {
8672
10170
        if test -n "$gentop"; then
8673
10171
          func_show_eval '${RM}r "$gentop"'
8674
10172
        fi
8678
10176
        # $show "echo timestamp > $libobj"
8679
10177
        # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
8680
10178
        exit $EXIT_SUCCESS
8681
 
      fi
 
10179
      }
8682
10180
 
8683
 
      if test -n "$pic_flag" || test "$pic_mode" != default; then
 
10181
      if test -n "$pic_flag" || test default != "$pic_mode"; then
8684
10182
        # Only do commands if we really have different PIC objects.
8685
10183
        reload_objs="$libobjs $reload_conv_objs"
8686
 
        output="$libobj"
 
10184
        output=$libobj
8687
10185
        func_execute_cmds "$reload_cmds" 'exit $?'
8688
10186
      fi
8689
10187
 
8700
10198
                  output=$func_stripname_result.exe;;
8701
10199
      esac
8702
10200
      test -n "$vinfo" && \
8703
 
        func_warning "\`-version-info' is ignored for programs"
 
10201
        func_warning "'-version-info' is ignored for programs"
8704
10202
 
8705
10203
      test -n "$release" && \
8706
 
        func_warning "\`-release' is ignored for programs"
 
10204
        func_warning "'-release' is ignored for programs"
8707
10205
 
8708
 
      test "$preload" = yes \
8709
 
        && test "$dlopen_support" = unknown \
8710
 
        && test "$dlopen_self" = unknown \
8711
 
        && test "$dlopen_self_static" = unknown && \
8712
 
          func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
 
10206
      $preload \
 
10207
        && test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \
 
10208
        && func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support."
8713
10209
 
8714
10210
      case $host in
8715
10211
      *-*-rhapsody* | *-*-darwin1.[012])
8723
10219
      *-*-darwin*)
8724
10220
        # Don't allow lazy linking, it breaks C++ global constructors
8725
10221
        # But is supposedly fixed on 10.4 or later (yay!).
8726
 
        if test "$tagname" = CXX ; then
 
10222
        if test CXX = "$tagname"; then
8727
10223
          case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
8728
10224
            10.[0123])
8729
 
              func_append compile_command " ${wl}-bind_at_load"
8730
 
              func_append finalize_command " ${wl}-bind_at_load"
 
10225
              func_append compile_command " $wl-bind_at_load"
 
10226
              func_append finalize_command " $wl-bind_at_load"
8731
10227
            ;;
8732
10228
          esac
8733
10229
        fi
8763
10259
        *) func_append new_libs " $deplib" ;;
8764
10260
        esac
8765
10261
      done
8766
 
      compile_deplibs="$new_libs"
 
10262
      compile_deplibs=$new_libs
8767
10263
 
8768
10264
 
8769
10265
      func_append compile_command " $compile_deplibs"
8787
10283
        if test -n "$hardcode_libdir_flag_spec"; then
8788
10284
          if test -n "$hardcode_libdir_separator"; then
8789
10285
            if test -z "$hardcode_libdirs"; then
8790
 
              hardcode_libdirs="$libdir"
 
10286
              hardcode_libdirs=$libdir
8791
10287
            else
8792
10288
              # Just accumulate the unique libdirs.
8793
10289
              case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
8810
10306
        fi
8811
10307
        case $host in
8812
10308
        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
8813
 
          testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
 
10309
          testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'`
8814
10310
          case :$dllsearchpath: in
8815
10311
          *":$libdir:"*) ;;
8816
10312
          ::) dllsearchpath=$libdir;;
8827
10323
      # Substitute the hardcoded libdirs into the rpath.
8828
10324
      if test -n "$hardcode_libdir_separator" &&
8829
10325
         test -n "$hardcode_libdirs"; then
8830
 
        libdir="$hardcode_libdirs"
 
10326
        libdir=$hardcode_libdirs
8831
10327
        eval rpath=\" $hardcode_libdir_flag_spec\"
8832
10328
      fi
8833
 
      compile_rpath="$rpath"
 
10329
      compile_rpath=$rpath
8834
10330
 
8835
10331
      rpath=
8836
10332
      hardcode_libdirs=
8838
10334
        if test -n "$hardcode_libdir_flag_spec"; then
8839
10335
          if test -n "$hardcode_libdir_separator"; then
8840
10336
            if test -z "$hardcode_libdirs"; then
8841
 
              hardcode_libdirs="$libdir"
 
10337
              hardcode_libdirs=$libdir
8842
10338
            else
8843
10339
              # Just accumulate the unique libdirs.
8844
10340
              case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
8863
10359
      # Substitute the hardcoded libdirs into the rpath.
8864
10360
      if test -n "$hardcode_libdir_separator" &&
8865
10361
         test -n "$hardcode_libdirs"; then
8866
 
        libdir="$hardcode_libdirs"
 
10362
        libdir=$hardcode_libdirs
8867
10363
        eval rpath=\" $hardcode_libdir_flag_spec\"
8868
10364
      fi
8869
 
      finalize_rpath="$rpath"
 
10365
      finalize_rpath=$rpath
8870
10366
 
8871
 
      if test -n "$libobjs" && test "$build_old_libs" = yes; then
 
10367
      if test -n "$libobjs" && test yes = "$build_old_libs"; then
8872
10368
        # Transform all the library objects into standard objects.
8873
10369
        compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
8874
10370
        finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
8875
10371
      fi
8876
10372
 
8877
 
      func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
 
10373
      func_generate_dlsyms "$outputname" "@PROGRAM@" false
8878
10374
 
8879
10375
      # template prelinking step
8880
10376
      if test -n "$prelink_cmds"; then
8881
10377
        func_execute_cmds "$prelink_cmds" 'exit $?'
8882
10378
      fi
8883
10379
 
8884
 
      wrappers_required=yes
 
10380
      wrappers_required=:
8885
10381
      case $host in
8886
10382
      *cegcc* | *mingw32ce*)
8887
10383
        # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
8888
 
        wrappers_required=no
 
10384
        wrappers_required=false
8889
10385
        ;;
8890
10386
      *cygwin* | *mingw* )
8891
 
        if test "$build_libtool_libs" != yes; then
8892
 
          wrappers_required=no
8893
 
        fi
 
10387
        test yes = "$build_libtool_libs" || wrappers_required=false
8894
10388
        ;;
8895
10389
      *)
8896
 
        if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
8897
 
          wrappers_required=no
 
10390
        if test no = "$need_relink" || test yes != "$build_libtool_libs"; then
 
10391
          wrappers_required=false
8898
10392
        fi
8899
10393
        ;;
8900
10394
      esac
8901
 
      if test "$wrappers_required" = no; then
 
10395
      $wrappers_required || {
8902
10396
        # Replace the output file specification.
8903
10397
        compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
8904
 
        link_command="$compile_command$compile_rpath"
 
10398
        link_command=$compile_command$compile_rpath
8905
10399
 
8906
10400
        # We have no uninstalled library dependencies, so finalize right now.
8907
10401
        exit_status=0
8914
10408
        fi
8915
10409
 
8916
10410
        # Delete the generated files.
8917
 
        if test -f "$output_objdir/${outputname}S.${objext}"; then
8918
 
          func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
 
10411
        if test -f "$output_objdir/${outputname}S.$objext"; then
 
10412
          func_show_eval '$RM "$output_objdir/${outputname}S.$objext"'
8919
10413
        fi
8920
10414
 
8921
10415
        exit $exit_status
8922
 
      fi
 
10416
      }
8923
10417
 
8924
10418
      if test -n "$compile_shlibpath$finalize_shlibpath"; then
8925
10419
        compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
8949
10443
        fi
8950
10444
      fi
8951
10445
 
8952
 
      if test "$no_install" = yes; then
 
10446
      if test yes = "$no_install"; then
8953
10447
        # We don't need to create a wrapper script.
8954
 
        link_command="$compile_var$compile_command$compile_rpath"
 
10448
        link_command=$compile_var$compile_command$compile_rpath
8955
10449
        # Replace the output file specification.
8956
10450
        link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
8957
10451
        # Delete the old output file.
8968
10462
        exit $EXIT_SUCCESS
8969
10463
      fi
8970
10464
 
8971
 
      if test "$hardcode_action" = relink; then
8972
 
        # Fast installation is not supported
8973
 
        link_command="$compile_var$compile_command$compile_rpath"
8974
 
        relink_command="$finalize_var$finalize_command$finalize_rpath"
 
10465
      case $hardcode_action,$fast_install in
 
10466
        relink,*)
 
10467
          # Fast installation is not supported
 
10468
          link_command=$compile_var$compile_command$compile_rpath
 
10469
          relink_command=$finalize_var$finalize_command$finalize_rpath
8975
10470
 
8976
 
        func_warning "this platform does not like uninstalled shared libraries"
8977
 
        func_warning "\`$output' will be relinked during installation"
8978
 
      else
8979
 
        if test "$fast_install" != no; then
8980
 
          link_command="$finalize_var$compile_command$finalize_rpath"
8981
 
          if test "$fast_install" = yes; then
8982
 
            relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
8983
 
          else
8984
 
            # fast_install is set to needless
8985
 
            relink_command=
8986
 
          fi
8987
 
        else
8988
 
          link_command="$compile_var$compile_command$compile_rpath"
8989
 
          relink_command="$finalize_var$finalize_command$finalize_rpath"
8990
 
        fi
8991
 
      fi
 
10471
          func_warning "this platform does not like uninstalled shared libraries"
 
10472
          func_warning "'$output' will be relinked during installation"
 
10473
          ;;
 
10474
        *,yes)
 
10475
          link_command=$finalize_var$compile_command$finalize_rpath
 
10476
          relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
 
10477
          ;;
 
10478
        *,no)
 
10479
          link_command=$compile_var$compile_command$compile_rpath
 
10480
          relink_command=$finalize_var$finalize_command$finalize_rpath
 
10481
          ;;
 
10482
        *,needless)
 
10483
          link_command=$finalize_var$compile_command$finalize_rpath
 
10484
          relink_command=
 
10485
          ;;
 
10486
      esac
8992
10487
 
8993
10488
      # Replace the output file specification.
8994
10489
      link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
9045
10540
            func_dirname_and_basename "$output" "" "."
9046
10541
            output_name=$func_basename_result
9047
10542
            output_path=$func_dirname_result
9048
 
            cwrappersource="$output_path/$objdir/lt-$output_name.c"
9049
 
            cwrapper="$output_path/$output_name.exe"
 
10543
            cwrappersource=$output_path/$objdir/lt-$output_name.c
 
10544
            cwrapper=$output_path/$output_name.exe
9050
10545
            $RM $cwrappersource $cwrapper
9051
10546
            trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
9052
10547
 
9067
10562
            trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
9068
10563
            $opt_dry_run || {
9069
10564
              # note: this script will not be executed, so do not chmod.
9070
 
              if test "x$build" = "x$host" ; then
 
10565
              if test "x$build" = "x$host"; then
9071
10566
                $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
9072
10567
              else
9073
10568
                func_emit_wrapper no > $func_ltwrapper_scriptname_result
9090
10585
    # See if we need to build an old-fashioned archive.
9091
10586
    for oldlib in $oldlibs; do
9092
10587
 
9093
 
      if test "$build_libtool_libs" = convenience; then
9094
 
        oldobjs="$libobjs_save $symfileobj"
9095
 
        addlibs="$convenience"
9096
 
        build_libtool_libs=no
9097
 
      else
9098
 
        if test "$build_libtool_libs" = module; then
9099
 
          oldobjs="$libobjs_save"
9100
 
          build_libtool_libs=no
9101
 
        else
 
10588
      case $build_libtool_libs in
 
10589
        convenience)
 
10590
          oldobjs="$libobjs_save $symfileobj"
 
10591
          addlibs=$convenience
 
10592
          build_libtool_libs=no
 
10593
          ;;
 
10594
        module)
 
10595
          oldobjs=$libobjs_save
 
10596
          addlibs=$old_convenience
 
10597
          build_libtool_libs=no
 
10598
          ;;
 
10599
        *)
9102
10600
          oldobjs="$old_deplibs $non_pic_objects"
9103
 
          if test "$preload" = yes && test -f "$symfileobj"; then
9104
 
            func_append oldobjs " $symfileobj"
9105
 
          fi
9106
 
        fi
9107
 
        addlibs="$old_convenience"
9108
 
      fi
 
10601
          $preload && test -f "$symfileobj" \
 
10602
            && func_append oldobjs " $symfileobj"
 
10603
          addlibs=$old_convenience
 
10604
          ;;
 
10605
      esac
9109
10606
 
9110
10607
      if test -n "$addlibs"; then
9111
 
        gentop="$output_objdir/${outputname}x"
 
10608
        gentop=$output_objdir/${outputname}x
9112
10609
        func_append generated " $gentop"
9113
10610
 
9114
10611
        func_extract_archives $gentop $addlibs
9116
10613
      fi
9117
10614
 
9118
10615
      # Do each command in the archive commands.
9119
 
      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
 
10616
      if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then
9120
10617
        cmds=$old_archive_from_new_cmds
9121
10618
      else
9122
10619
 
9123
10620
        # Add any objects from preloaded convenience libraries
9124
10621
        if test -n "$dlprefiles"; then
9125
 
          gentop="$output_objdir/${outputname}x"
 
10622
          gentop=$output_objdir/${outputname}x
9126
10623
          func_append generated " $gentop"
9127
10624
 
9128
10625
          func_extract_archives $gentop $dlprefiles
9143
10640
          :
9144
10641
        else
9145
10642
          echo "copying selected object files to avoid basename conflicts..."
9146
 
          gentop="$output_objdir/${outputname}x"
 
10643
          gentop=$output_objdir/${outputname}x
9147
10644
          func_append generated " $gentop"
9148
10645
          func_mkdir_p "$gentop"
9149
10646
          save_oldobjs=$oldobjs
9152
10649
          for obj in $save_oldobjs
9153
10650
          do
9154
10651
            func_basename "$obj"
9155
 
            objbase="$func_basename_result"
 
10652
            objbase=$func_basename_result
9156
10653
            case " $oldobjs " in
9157
10654
            " ") oldobjs=$obj ;;
9158
10655
            *[\ /]"$objbase "*)
9221
10718
            else
9222
10719
              # the above command should be used before it gets too long
9223
10720
              oldobjs=$objlist
9224
 
              if test "$obj" = "$last_oldobj" ; then
 
10721
              if test "$obj" = "$last_oldobj"; then
9225
10722
                RANLIB=$save_RANLIB
9226
10723
              fi
9227
10724
              test -z "$concat_cmds" || concat_cmds=$concat_cmds~
9228
 
              eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
 
10725
              eval concat_cmds=\"\$concat_cmds$old_archive_cmds\"
9229
10726
              objlist=
9230
10727
              len=$len0
9231
10728
            fi
9232
10729
          done
9233
10730
          RANLIB=$save_RANLIB
9234
10731
          oldobjs=$objlist
9235
 
          if test "X$oldobjs" = "X" ; then
 
10732
          if test -z "$oldobjs"; then
9236
10733
            eval cmds=\"\$concat_cmds\"
9237
10734
          else
9238
10735
            eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
9249
10746
    case $output in
9250
10747
    *.la)
9251
10748
      old_library=
9252
 
      test "$build_old_libs" = yes && old_library="$libname.$libext"
 
10749
      test yes = "$build_old_libs" && old_library=$libname.$libext
9253
10750
      func_verbose "creating $output"
9254
10751
 
9255
10752
      # Preserve any variables that may affect compiler behavior
9264
10761
        fi
9265
10762
      done
9266
10763
      # Quote the link command for shipping.
9267
 
      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
 
10764
      relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
9268
10765
      relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
9269
 
      if test "$hardcode_automatic" = yes ; then
 
10766
      if test yes = "$hardcode_automatic"; then
9270
10767
        relink_command=
9271
10768
      fi
9272
10769
 
9273
10770
      # Only create the output if not a dry run.
9274
10771
      $opt_dry_run || {
9275
10772
        for installed in no yes; do
9276
 
          if test "$installed" = yes; then
 
10773
          if test yes = "$installed"; then
9277
10774
            if test -z "$install_libdir"; then
9278
10775
              break
9279
10776
            fi
9280
 
            output="$output_objdir/$outputname"i
 
10777
            output=$output_objdir/${outputname}i
9281
10778
            # Replace all uninstalled libtool libraries with the installed ones
9282
10779
            newdependency_libs=
9283
10780
            for deplib in $dependency_libs; do
9284
10781
              case $deplib in
9285
10782
              *.la)
9286
10783
                func_basename "$deplib"
9287
 
                name="$func_basename_result"
 
10784
                name=$func_basename_result
9288
10785
                func_resolve_sysroot "$deplib"
9289
 
                eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
 
10786
                eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
9290
10787
                test -z "$libdir" && \
9291
 
                  func_fatal_error "\`$deplib' is not a valid libtool archive"
 
10788
                  func_fatal_error "'$deplib' is not a valid libtool archive"
9292
10789
                func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
9293
10790
                ;;
9294
10791
              -L*)
9304
10801
              *) func_append newdependency_libs " $deplib" ;;
9305
10802
              esac
9306
10803
            done
9307
 
            dependency_libs="$newdependency_libs"
 
10804
            dependency_libs=$newdependency_libs
9308
10805
            newdlfiles=
9309
10806
 
9310
10807
            for lib in $dlfiles; do
9311
10808
              case $lib in
9312
10809
              *.la)
9313
10810
                func_basename "$lib"
9314
 
                name="$func_basename_result"
9315
 
                eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
 
10811
                name=$func_basename_result
 
10812
                eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
9316
10813
                test -z "$libdir" && \
9317
 
                  func_fatal_error "\`$lib' is not a valid libtool archive"
 
10814
                  func_fatal_error "'$lib' is not a valid libtool archive"
9318
10815
                func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
9319
10816
                ;;
9320
10817
              *) func_append newdlfiles " $lib" ;;
9321
10818
              esac
9322
10819
            done
9323
 
            dlfiles="$newdlfiles"
 
10820
            dlfiles=$newdlfiles
9324
10821
            newdlprefiles=
9325
10822
            for lib in $dlprefiles; do
9326
10823
              case $lib in
9330
10827
                # didn't already link the preopened objects directly into
9331
10828
                # the library:
9332
10829
                func_basename "$lib"
9333
 
                name="$func_basename_result"
9334
 
                eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
 
10830
                name=$func_basename_result
 
10831
                eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
9335
10832
                test -z "$libdir" && \
9336
 
                  func_fatal_error "\`$lib' is not a valid libtool archive"
 
10833
                  func_fatal_error "'$lib' is not a valid libtool archive"
9337
10834
                func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
9338
10835
                ;;
9339
10836
              esac
9340
10837
            done
9341
 
            dlprefiles="$newdlprefiles"
 
10838
            dlprefiles=$newdlprefiles
9342
10839
          else
9343
10840
            newdlfiles=
9344
10841
            for lib in $dlfiles; do
9345
10842
              case $lib in
9346
 
                [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
 
10843
                [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
9347
10844
                *) abs=`pwd`"/$lib" ;;
9348
10845
              esac
9349
10846
              func_append newdlfiles " $abs"
9350
10847
            done
9351
 
            dlfiles="$newdlfiles"
 
10848
            dlfiles=$newdlfiles
9352
10849
            newdlprefiles=
9353
10850
            for lib in $dlprefiles; do
9354
10851
              case $lib in
9355
 
                [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
 
10852
                [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
9356
10853
                *) abs=`pwd`"/$lib" ;;
9357
10854
              esac
9358
10855
              func_append newdlprefiles " $abs"
9359
10856
            done
9360
 
            dlprefiles="$newdlprefiles"
 
10857
            dlprefiles=$newdlprefiles
9361
10858
          fi
9362
10859
          $RM $output
9363
10860
          # place dlname in correct position for cygwin
9373
10870
          case $host,$output,$installed,$module,$dlname in
9374
10871
            *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
9375
10872
              # If a -bindir argument was supplied, place the dll there.
9376
 
              if test "x$bindir" != x ;
9377
 
              then
 
10873
              if test -n "$bindir"; then
9378
10874
                func_relative_path "$install_libdir" "$bindir"
9379
 
                tdlname=$func_relative_path_result$dlname
 
10875
                tdlname=$func_relative_path_result/$dlname
9380
10876
              else
9381
10877
                # Otherwise fall back on heuristic.
9382
10878
                tdlname=../bin/$dlname
9385
10881
          esac
9386
10882
          $ECHO > $output "\
9387
10883
# $outputname - a libtool library file
9388
 
# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
 
10884
# Generated by $PROGRAM (GNU $PACKAGE) $VERSION
9389
10885
#
9390
10886
# Please DO NOT delete this file!
9391
10887
# It is necessary for linking the library.
9399
10895
# The name of the static archive.
9400
10896
old_library='$old_library'
9401
10897
 
9402
 
# Linker flags that can not go in dependency_libs.
 
10898
# Linker flags that cannot go in dependency_libs.
9403
10899
inherited_linker_flags='$new_inherited_linker_flags'
9404
10900
 
9405
10901
# Libraries that this one depends upon.
9425
10921
 
9426
10922
# Directory that this library needs to be installed in:
9427
10923
libdir='$install_libdir'"
9428
 
          if test "$installed" = no && test "$need_relink" = yes; then
 
10924
          if test no,yes = "$installed,$need_relink"; then
9429
10925
            $ECHO >> $output "\
9430
10926
relink_command=\"$relink_command\""
9431
10927
          fi
9440
10936
    exit $EXIT_SUCCESS
9441
10937
}
9442
10938
 
9443
 
{ test "$opt_mode" = link || test "$opt_mode" = relink; } &&
9444
 
    func_mode_link ${1+"$@"}
 
10939
if test link = "$opt_mode" || test relink = "$opt_mode"; then
 
10940
  func_mode_link ${1+"$@"}
 
10941
fi
9445
10942
 
9446
10943
 
9447
10944
# func_mode_uninstall arg...
9448
10945
func_mode_uninstall ()
9449
10946
{
9450
 
    $opt_debug
9451
 
    RM="$nonopt"
 
10947
    $debug_cmd
 
10948
 
 
10949
    RM=$nonopt
9452
10950
    files=
9453
 
    rmforce=
 
10951
    rmforce=false
9454
10952
    exit_status=0
9455
10953
 
9456
10954
    # This variable tells wrapper scripts just to set variables rather
9457
10955
    # than running their programs.
9458
 
    libtool_install_magic="$magic"
 
10956
    libtool_install_magic=$magic
9459
10957
 
9460
10958
    for arg
9461
10959
    do
9462
10960
      case $arg in
9463
 
      -f) func_append RM " $arg"; rmforce=yes ;;
 
10961
      -f) func_append RM " $arg"; rmforce=: ;;
9464
10962
      -*) func_append RM " $arg" ;;
9465
10963
      *) func_append files " $arg" ;;
9466
10964
      esac
9473
10971
 
9474
10972
    for file in $files; do
9475
10973
      func_dirname "$file" "" "."
9476
 
      dir="$func_dirname_result"
9477
 
      if test "X$dir" = X.; then
9478
 
        odir="$objdir"
 
10974
      dir=$func_dirname_result
 
10975
      if test . = "$dir"; then
 
10976
        odir=$objdir
9479
10977
      else
9480
 
        odir="$dir/$objdir"
 
10978
        odir=$dir/$objdir
9481
10979
      fi
9482
10980
      func_basename "$file"
9483
 
      name="$func_basename_result"
9484
 
      test "$opt_mode" = uninstall && odir="$dir"
 
10981
      name=$func_basename_result
 
10982
      test uninstall = "$opt_mode" && odir=$dir
9485
10983
 
9486
10984
      # Remember odir for removal later, being careful to avoid duplicates
9487
 
      if test "$opt_mode" = clean; then
 
10985
      if test clean = "$opt_mode"; then
9488
10986
        case " $rmdirs " in
9489
10987
          *" $odir "*) ;;
9490
10988
          *) func_append rmdirs " $odir" ;;
9499
10997
      elif test -d "$file"; then
9500
10998
        exit_status=1
9501
10999
        continue
9502
 
      elif test "$rmforce" = yes; then
 
11000
      elif $rmforce; then
9503
11001
        continue
9504
11002
      fi
9505
11003
 
9506
 
      rmfiles="$file"
 
11004
      rmfiles=$file
9507
11005
 
9508
11006
      case $name in
9509
11007
      *.la)
9517
11015
          done
9518
11016
          test -n "$old_library" && func_append rmfiles " $odir/$old_library"
9519
11017
 
9520
 
          case "$opt_mode" in
 
11018
          case $opt_mode in
9521
11019
          clean)
9522
11020
            case " $library_names " in
9523
11021
            *" $dlname "*) ;;
9528
11026
          uninstall)
9529
11027
            if test -n "$library_names"; then
9530
11028
              # Do each command in the postuninstall commands.
9531
 
              func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
 
11029
              func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1'
9532
11030
            fi
9533
11031
 
9534
11032
            if test -n "$old_library"; then
9535
11033
              # Do each command in the old_postuninstall commands.
9536
 
              func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
 
11034
              func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1'
9537
11035
            fi
9538
11036
            # FIXME: should reinstall the best remaining shared library.
9539
11037
            ;;
9549
11047
          func_source $dir/$name
9550
11048
 
9551
11049
          # Add PIC object to the list of files to remove.
9552
 
          if test -n "$pic_object" &&
9553
 
             test "$pic_object" != none; then
 
11050
          if test -n "$pic_object" && test none != "$pic_object"; then
9554
11051
            func_append rmfiles " $dir/$pic_object"
9555
11052
          fi
9556
11053
 
9557
11054
          # Add non-PIC object to the list of files to remove.
9558
 
          if test -n "$non_pic_object" &&
9559
 
             test "$non_pic_object" != none; then
 
11055
          if test -n "$non_pic_object" && test none != "$non_pic_object"; then
9560
11056
            func_append rmfiles " $dir/$non_pic_object"
9561
11057
          fi
9562
11058
        fi
9563
11059
        ;;
9564
11060
 
9565
11061
      *)
9566
 
        if test "$opt_mode" = clean ; then
 
11062
        if test clean = "$opt_mode"; then
9567
11063
          noexename=$name
9568
11064
          case $file in
9569
11065
          *.exe)
9590
11086
 
9591
11087
            # note $name still contains .exe if it was in $file originally
9592
11088
            # as does the version of $file that was added into $rmfiles
9593
 
            func_append rmfiles " $odir/$name $odir/${name}S.${objext}"
9594
 
            if test "$fast_install" = yes && test -n "$relink_command"; then
 
11089
            func_append rmfiles " $odir/$name $odir/${name}S.$objext"
 
11090
            if test yes = "$fast_install" && test -n "$relink_command"; then
9595
11091
              func_append rmfiles " $odir/lt-$name"
9596
11092
            fi
9597
 
            if test "X$noexename" != "X$name" ; then
9598
 
              func_append rmfiles " $odir/lt-${noexename}.c"
 
11093
            if test "X$noexename" != "X$name"; then
 
11094
              func_append rmfiles " $odir/lt-$noexename.c"
9599
11095
            fi
9600
11096
          fi
9601
11097
        fi
9604
11100
      func_show_eval "$RM $rmfiles" 'exit_status=1'
9605
11101
    done
9606
11102
 
9607
 
    # Try to remove the ${objdir}s in the directories where we deleted files
 
11103
    # Try to remove the $objdir's in the directories where we deleted files
9608
11104
    for dir in $rmdirs; do
9609
11105
      if test -d "$dir"; then
9610
11106
        func_show_eval "rmdir $dir >/dev/null 2>&1"
9614
11110
    exit $exit_status
9615
11111
}
9616
11112
 
9617
 
{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } &&
9618
 
    func_mode_uninstall ${1+"$@"}
 
11113
if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then
 
11114
  func_mode_uninstall ${1+"$@"}
 
11115
fi
9619
11116
 
9620
11117
test -z "$opt_mode" && {
9621
 
  help="$generic_help"
 
11118
  help=$generic_help
9622
11119
  func_fatal_help "you must specify a MODE"
9623
11120
}
9624
11121
 
9625
11122
test -z "$exec_cmd" && \
9626
 
  func_fatal_help "invalid operation mode \`$opt_mode'"
 
11123
  func_fatal_help "invalid operation mode '$opt_mode'"
9627
11124
 
9628
11125
if test -n "$exec_cmd"; then
9629
11126
  eval exec "$exec_cmd"
9634
11131
 
9635
11132
 
9636
11133
# The TAGs below are defined such that we never get into a situation
9637
 
# in which we disable both kinds of libraries.  Given conflicting
 
11134
# where we disable both kinds of libraries.  Given conflicting
9638
11135
# choices, we go for a static library, that is the most portable,
9639
11136
# since we can't tell whether shared libraries were disabled because
9640
11137
# the user asked for that or because the platform doesn't support
9657
11154
# mode:shell-script
9658
11155
# sh-indentation:2
9659
11156
# End:
9660
 
# vi:sw=2
9661