~ubuntu-branches/ubuntu/trusty/log4shib/trusty

« back to all changes in this revision

Viewing changes to config/ltmain.sh

  • Committer: Package Import Robot
  • Author(s): Russ Allbery
  • Date: 2013-05-22 20:21:15 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20130522202115-2qzanli9fue82x24
Tags: 1.0.5-1
* New upstream release.
* Switch to xz compression for *.debian.tar and the *.deb packages.
* Use canonical URLs for Vcs-Browser and Vcs-Git.
* Update standards version to 3.9.4 (no changes required).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# ltmain.sh - Provide generalized library-building support services.
2
 
# NOTE: Changing this file will not affect anything until you rerun configure.
3
 
#
4
 
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003
5
 
# Free Software Foundation, Inc.
6
 
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
7
 
#
8
 
# This program is free software; you can redistribute it and/or modify
 
1
 
 
2
# libtool (GNU libtool) 2.4.2
 
3
# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
 
4
 
 
5
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
 
6
# 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
 
7
# This is free software; see the source for copying conditions.  There is NO
 
8
# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
9
 
 
10
# GNU Libtool is free software; you can redistribute it and/or modify
9
11
# it under the terms of the GNU General Public License as published by
10
12
# the Free Software Foundation; either version 2 of the License, or
11
13
# (at your option) any later version.
12
14
#
13
 
# This program is distributed in the hope that it will be useful, but
 
15
# As a special exception to the GNU General Public License,
 
16
# if you distribute this file as part of a program or library that
 
17
# is built using GNU Libtool, you may include this file under the
 
18
# same distribution terms that you use for the rest of that program.
 
19
#
 
20
# GNU Libtool is distributed in the hope that it will be useful, but
14
21
# WITHOUT ANY WARRANTY; without even the implied warranty of
15
22
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
23
# General Public License for more details.
17
24
#
18
25
# You should have received a copy of the GNU General Public License
19
 
# along with this program; if not, write to the Free Software
20
 
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21
 
#
22
 
# As a special exception to the GNU General Public License, if you
23
 
# distribute this file as part of a program that contains a
24
 
# configuration script generated by Autoconf, you may include it under
25
 
# the same distribution terms that you use for the rest of that program.
26
 
 
27
 
# Check that we have a working $echo.
28
 
if test "X$1" = X--no-reexec; then
29
 
  # Discard the --no-reexec flag, and continue.
30
 
  shift
31
 
elif test "X$1" = X--fallback-echo; then
32
 
  # Avoid inline document here, it may be left over
33
 
  :
34
 
elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
35
 
  # Yippee, $echo works!
36
 
  :
37
 
else
38
 
  # Restart under the correct shell, and then maybe $echo will work.
39
 
  exec $SHELL "$0" --no-reexec ${1+"$@"}
40
 
fi
41
 
 
42
 
if test "X$1" = X--fallback-echo; then
43
 
  # used as fallback echo
44
 
  shift
45
 
  cat <<EOF
46
 
$*
47
 
EOF
48
 
  exit 0
49
 
fi
50
 
 
51
 
# The name of this program.
52
 
progname=`$echo "$0" | ${SED} 's%^.*/%%'`
53
 
modename="$progname"
54
 
 
55
 
# Constants.
56
 
PROGRAM=ltmain.sh
 
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.
 
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
 
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
 
 
81
PROGRAM=libtool
57
82
PACKAGE=libtool
58
 
VERSION=1.5.2
59
 
TIMESTAMP=" (1.1220.2.60 2004/01/25 12:25:08)"
60
 
 
61
 
default_mode=
62
 
help="Try \`$progname --help' for more information."
 
83
VERSION=2.4.2
 
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
 
89
  emulate sh
 
90
  NULLCMD=:
 
91
  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
 
92
  # is contrary to our usage.  Disable this feature.
 
93
  alias -g '${1+"$@"}'='"$@"'
 
94
  setopt NO_GLOB_SUBST
 
95
else
 
96
  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
 
97
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
 
113
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\"
 
120
        fi"
 
121
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
 
 
137
 
 
138
: ${CP="cp -f"}
 
139
test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
 
140
: ${MAKE="make"}
 
141
: ${MKDIR="mkdir"}
 
142
: ${MV="mv -f"}
 
143
: ${RM="rm -f"}
 
144
: ${SHELL="${CONFIG_SHELL-/bin/sh}"}
 
145
: ${Xsed="$SED -e 1s/^X//"}
 
146
 
 
147
# Global variables:
 
148
EXIT_SUCCESS=0
 
149
EXIT_FAILURE=1
 
150
EXIT_MISMATCH=63  # $? = 63 is used to indicate version mismatch to missing.
 
151
EXIT_SKIP=77      # $? = 77 is used to indicate a skipped test to automake.
 
152
 
 
153
exit_status=$EXIT_SUCCESS
 
154
 
 
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:
 
377
case $progpath in
 
378
  [\\/]*|[A-Za-z]:\\*) ;;
 
379
  *[\\/]*)
 
380
     progdir=$func_dirname_result
 
381
     progdir=`cd "$progdir" && pwd`
 
382
     progpath="$progdir/$progname"
 
383
     ;;
 
384
  *)
 
385
     save_IFS="$IFS"
 
386
     IFS=${PATH_SEPARATOR-:}
 
387
     for progdir in $PATH; do
 
388
       IFS="$save_IFS"
 
389
       test -x "$progdir/$progname" && break
 
390
     done
 
391
     IFS="$save_IFS"
 
392
     test -n "$progdir" || progdir=`pwd`
 
393
     progpath="$progdir/$progname"
 
394
     ;;
 
395
esac
 
396
 
 
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:
 
431
opt_dry_run=false
 
432
opt_help=false
 
433
opt_quiet=false
 
434
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.
 
440
func_echo ()
 
441
{
 
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...
 
458
# Invoke $ECHO with all args, space-separated.
 
459
func_echo_all ()
 
460
{
 
461
    $ECHO "$*"
 
462
}
 
463
 
 
464
# func_error arg...
 
465
# Echo program name prefixed message to standard error.
 
466
func_error ()
 
467
{
 
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...
 
482
# Echo program name prefixed message to standard error, and exit.
 
483
func_fatal_error ()
 
484
{
 
485
    func_error ${1+"$@"}
 
486
    exit $EXIT_FAILURE
 
487
}
 
488
 
 
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
 
501
# Check whether EXPRESSION matches any line of FILENAME, without output.
 
502
func_grep ()
 
503
{
 
504
    $GREP "$1" "$2" >/dev/null 2>&1
 
505
}
 
506
 
 
507
 
 
508
# func_mkdir_p directory-path
 
509
# Make sure the entire path to DIRECTORY-PATH is available.
 
510
func_mkdir_p ()
 
511
{
 
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" ;;
 
520
      esac
 
521
 
 
522
      # While some portion of DIR does not yet exist...
 
523
      while test ! -d "$my_directory_path"; do
 
524
        # ...make a list in topmost first order.  Use a colon delimited
 
525
        # list incase some portion of path contains whitespace.
 
526
        my_dir_list="$my_directory_path:$my_dir_list"
 
527
 
 
528
        # If the last portion added has no slash in it, the list is done
 
529
        case $my_directory_path in */*) ;; *) break ;; esac
 
530
 
 
531
        # ...otherwise throw away the child directory and loop
 
532
        my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"`
 
533
      done
 
534
      my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'`
 
535
 
 
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
 
540
        # try to create one of the directories concurrently.  Don't
 
541
        # stop in that case!
 
542
        $MKDIR "$my_dir" 2>/dev/null || :
 
543
      done
 
544
      IFS="$save_mkdir_p_IFS"
 
545
 
 
546
      # 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'"
 
549
    fi
 
550
}
 
551
 
 
552
 
 
553
# func_mktempdir [string]
 
554
# Make a temporary directory that won't clash with other running
 
555
# libtool processes, and avoids race conditions if possible.  If
 
556
# given, STRING is the basename for that directory.
 
557
func_mktempdir ()
 
558
{
 
559
    my_template="${TMPDIR-/tmp}/${1-$progname}"
 
560
 
 
561
    if test "$opt_dry_run" = ":"; then
 
562
      # Return a directory name, but don't create it in dry-run mode
 
563
      my_tmpdir="${my_template}-$$"
 
564
    else
 
565
 
 
566
      # If mktemp works, use that first and foremost
 
567
      my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
 
568
 
 
569
      if test ! -d "$my_tmpdir"; then
 
570
        # Failing that, at least try and use $RANDOM to avoid a race
 
571
        my_tmpdir="${my_template}-${RANDOM-0}$$"
 
572
 
 
573
        save_mktempdir_umask=`umask`
 
574
        umask 0077
 
575
        $MKDIR "$my_tmpdir"
 
576
        umask $save_mktempdir_umask
 
577
      fi
 
578
 
 
579
      # 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.
 
594
func_quote_for_eval ()
 
595
{
 
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
 
615
}
 
616
 
 
617
 
 
618
# func_quote_for_expand arg
 
619
# Aesthetically quote ARG to be evaled later; same as above,
 
620
# but do not quote variable references.
 
621
func_quote_for_expand ()
 
622
{
 
623
    case $1 in
 
624
      *[\\\`\"]*)
 
625
        my_arg=`$ECHO "$1" | $SED \
 
626
            -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
 
627
      *)
 
628
        my_arg="$1" ;;
 
629
    esac
 
630
 
 
631
    case $my_arg in
 
632
      # Double-quote args containing shell metacharacters to delay
 
633
      # word splitting and command substitution for a subsequent eval.
 
634
      # Many Bourne shells cannot handle close brackets correctly
 
635
      # in scan sets, so we specify it separately.
 
636
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
 
637
        my_arg="\"$my_arg\""
 
638
        ;;
 
639
    esac
 
640
 
 
641
    func_quote_for_expand_result="$my_arg"
 
642
}
 
643
 
 
644
 
 
645
# func_show_eval cmd [fail_exp]
 
646
# Unless opt_silent is true, then output CMD.  Then, if opt_dryrun is
 
647
# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
 
648
# is given, then evaluate it.
 
649
func_show_eval ()
 
650
{
 
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"
 
657
    }
 
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
}
 
667
 
 
668
 
 
669
# func_show_eval_locale cmd [fail_exp]
 
670
# Unless opt_silent is true, then output CMD.  Then, if opt_dryrun is
 
671
# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
 
672
# is given, then evaluate it.  Use the saved locale for evaluation.
 
673
func_show_eval_locale ()
 
674
{
 
675
    my_cmd="$1"
 
676
    my_fail_exp="${2-:}"
 
677
 
 
678
    ${opt_silent-false} || {
 
679
      func_quote_for_expand "$my_cmd"
 
680
      eval "func_echo $func_quote_for_expand_result"
 
681
    }
 
682
 
 
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"
 
690
      fi
 
691
    fi
 
692
}
 
693
 
 
694
# func_tr_sh
 
695
# Turn $1 into a string suitable for a shell variable name.
 
696
# Result is stored in $func_tr_sh_result.  All characters
 
697
# not in the set a-zA-Z0-9_ are replaced with '_'. Further,
 
698
# if $1 begins with a digit, a '_' is prepended as well.
 
699
func_tr_sh ()
 
700
{
 
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.
 
755
func_help ()
 
756
{
 
757
    $opt_debug
 
758
 
 
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
 
782
}
 
783
 
 
784
# func_missing_arg argname
 
785
# Echo program name prefixed message to standard error and set global
 
786
# exit_cmd.
 
787
func_missing_arg ()
 
788
{
 
789
    $opt_debug
 
790
 
 
791
    func_error "missing argument for $1."
 
792
    exit_cmd=exit
 
793
}
 
794
 
 
795
 
 
796
# func_split_short_opt shortopt
 
797
# Set func_split_short_opt_name and func_split_short_opt_arg shell
 
798
# 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
 
63
827
magic="%%%MAGIC variable%%%"
64
 
mkdir="mkdir"
65
 
mv="mv -f"
66
 
rm="rm -f"
67
 
 
68
 
# Sed substitution that helps us do robust quoting.  It backslashifies
69
 
# metacharacters that are still active within double-quoted strings.
70
 
Xsed="${SED}"' -e 1s/^X//'
71
 
sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
72
 
# test EBCDIC or ASCII
73
 
case `echo A|tr A '\301'` in
74
 
 A) # EBCDIC based system
75
 
  SP2NL="tr '\100' '\n'"
76
 
  NL2SP="tr '\r\n' '\100\100'"
77
 
  ;;
78
 
 *) # Assume ASCII based system
79
 
  SP2NL="tr '\040' '\012'"
80
 
  NL2SP="tr '\015\012' '\040\040'"
81
 
  ;;
82
 
esac
83
 
 
84
 
# NLS nuisances.
85
 
# Only set LANG and LC_ALL to C if already set.
86
 
# These must not be set unconditionally because not all systems understand
87
 
# e.g. LANG=C (notably SCO).
88
 
# We save the old values to restore during execute mode.
89
 
if test "${LC_ALL+set}" = set; then
90
 
  save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
91
 
fi
92
 
if test "${LANG+set}" = set; then
93
 
  save_LANG="$LANG"; LANG=C; export LANG
94
 
fi
95
 
 
96
 
# Make sure IFS has a sensible default
97
 
: ${IFS="       
98
 
"}
99
 
 
100
 
if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
101
 
  $echo "$modename: not configured to build any kind of library" 1>&2
102
 
  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
103
 
  exit 1
104
 
fi
 
828
magic_exe="%%%MAGIC EXE variable%%%"
105
829
 
106
830
# Global variables.
107
 
mode=$default_mode
108
831
nonopt=
109
 
prev=
110
 
prevopt=
111
 
run=
112
 
show="$echo"
113
 
show_help=
114
 
execute_dlfiles=
 
832
preserve_args=
115
833
lo2o="s/\\.lo\$/.${objext}/"
116
834
o2lo="s/\\.${objext}\$/.lo/"
117
 
 
118
 
#####################################
119
 
# Shell function definitions:
120
 
# This seems to be the best place for them
121
 
 
122
 
# Need a lot of goo to handle *both* DLLs and import libs
123
 
# Has to be a shell function in order to 'eat' the argument
124
 
# that is supplied when $file_magic_command is called.
125
 
win32_libid () {
126
 
  win32_libid_type="unknown"
127
 
  win32_fileres=`file -L $1 2>/dev/null`
128
 
  case $win32_fileres in
129
 
  *ar\ archive\ import\ library*) # definitely import
130
 
    win32_libid_type="x86 archive import"
131
 
    ;;
132
 
  *ar\ archive*) # could be an import, or static
133
 
    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
134
 
      grep -E 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
135
 
      win32_nmres=`eval $NM -f posix -A $1 | \
136
 
        sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
137
 
      if test "X$win32_nmres" = "Ximport" ; then
138
 
        win32_libid_type="x86 archive import"
139
 
      else
140
 
        win32_libid_type="x86 archive static"
141
 
      fi
142
 
    fi
143
 
    ;;
144
 
  *DLL*) 
145
 
    win32_libid_type="x86 DLL"
146
 
    ;;
147
 
  *executable*) # but shell scripts are "executable" too...
148
 
    case $win32_fileres in
149
 
    *MS\ Windows\ PE\ Intel*)
150
 
      win32_libid_type="x86 DLL"
151
 
      ;;
152
 
    esac
153
 
    ;;
154
 
  esac
155
 
  $echo $win32_libid_type
156
 
}
157
 
 
158
 
# End of Shell function definitions
159
 
#####################################
160
 
 
161
 
# Parse our command line options once, thoroughly.
162
 
while test "$#" -gt 0
163
 
do
164
 
  arg="$1"
165
 
  shift
166
 
 
167
 
  case $arg in
168
 
  -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
169
 
  *) optarg= ;;
170
 
  esac
171
 
 
172
 
  # If the previous option needs an argument, assign it.
173
 
  if test -n "$prev"; then
174
 
    case $prev in
175
 
    execute_dlfiles)
176
 
      execute_dlfiles="$execute_dlfiles $arg"
177
 
      ;;
178
 
    tag)
179
 
      tagname="$arg"
180
 
      preserve_args="${preserve_args}=$arg"
181
 
 
182
 
      # Check whether tagname contains only valid characters
183
 
      case $tagname in
184
 
      *[!-_A-Za-z0-9,/]*)
185
 
        $echo "$progname: invalid tag name: $tagname" 1>&2
186
 
        exit 1
187
 
        ;;
188
 
      esac
189
 
 
190
 
      case $tagname in
191
 
      CC)
192
 
        # Don't test for the "default" C tag, as we know, it's there, but
193
 
        # not specially marked.
194
 
        ;;
195
 
      *)
196
 
        if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$0" > /dev/null; then
197
 
          taglist="$taglist $tagname"
198
 
          # Evaluate the configuration.
199
 
          eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $0`"
200
 
        else
201
 
          $echo "$progname: ignoring unknown tag $tagname" 1>&2
202
 
        fi
203
 
        ;;
204
 
      esac
205
 
      ;;
206
 
    *)
207
 
      eval "$prev=\$arg"
208
 
      ;;
209
 
    esac
210
 
 
211
 
    prev=
212
 
    prevopt=
213
 
    continue
214
 
  fi
215
 
 
216
 
  # Have we seen a non-optional argument yet?
217
 
  case $arg in
218
 
  --help)
219
 
    show_help=yes
220
 
    ;;
221
 
 
222
 
  --version)
223
 
    $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
224
 
    $echo
225
 
    $echo "Copyright (C) 2003  Free Software Foundation, Inc."
226
 
    $echo "This is free software; see the source for copying conditions.  There is NO"
227
 
    $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
228
 
    exit 0
229
 
    ;;
230
 
 
231
 
  --config)
232
 
    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
233
 
    # Now print the configurations for the tags.
234
 
    for tagname in $taglist; do
235
 
      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$0"
236
 
    done
237
 
    exit 0
238
 
    ;;
239
 
 
240
 
  --debug)
241
 
    $echo "$progname: enabling shell trace mode"
242
 
    set -x
243
 
    preserve_args="$preserve_args $arg"
244
 
    ;;
245
 
 
246
 
  --dry-run | -n)
247
 
    run=:
248
 
    ;;
249
 
 
250
 
  --features)
251
 
    $echo "host: $host"
252
 
    if test "$build_libtool_libs" = yes; then
253
 
      $echo "enable shared libraries"
254
 
    else
255
 
      $echo "disable shared libraries"
256
 
    fi
257
 
    if test "$build_old_libs" = yes; then
258
 
      $echo "enable static libraries"
259
 
    else
260
 
      $echo "disable static libraries"
261
 
    fi
262
 
    exit 0
263
 
    ;;
264
 
 
265
 
  --finish) mode="finish" ;;
266
 
 
267
 
  --mode) prevopt="--mode" prev=mode ;;
268
 
  --mode=*) mode="$optarg" ;;
269
 
 
270
 
  --preserve-dup-deps) duplicate_deps="yes" ;;
271
 
 
272
 
  --quiet | --silent)
273
 
    show=:
274
 
    preserve_args="$preserve_args $arg"
275
 
    ;;
276
 
 
277
 
  --tag) prevopt="--tag" prev=tag ;;
278
 
  --tag=*)
279
 
    set tag "$optarg" ${1+"$@"}
280
 
    shift
281
 
    prev=tag
282
 
    preserve_args="$preserve_args --tag"
283
 
    ;;
284
 
 
285
 
  -dlopen)
286
 
    prevopt="-dlopen"
287
 
    prev=execute_dlfiles
288
 
    ;;
289
 
 
290
 
  -*)
291
 
    $echo "$modename: unrecognized option \`$arg'" 1>&2
292
 
    $echo "$help" 1>&2
293
 
    exit 1
294
 
    ;;
295
 
 
296
 
  *)
297
 
    nonopt="$arg"
298
 
    break
299
 
    ;;
300
 
  esac
301
 
done
302
 
 
303
 
if test -n "$prevopt"; then
304
 
  $echo "$modename: option \`$prevopt' requires an argument" 1>&2
305
 
  $echo "$help" 1>&2
306
 
  exit 1
307
 
fi
 
835
extracted_archives=
 
836
extracted_serial=0
308
837
 
309
838
# If this variable is set in any of the actions, the command in it
310
839
# will be execed at the end.  This prevents here-documents from being
311
840
# left over by shells.
312
841
exec_cmd=
313
842
 
314
 
if test -z "$show_help"; then
315
 
 
316
 
  # Infer the operation mode.
317
 
  if test -z "$mode"; then
318
 
    $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
319
 
    $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2
320
 
    case $nonopt in
321
 
    *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
322
 
      mode=link
323
 
      for arg
324
 
      do
325
 
        case $arg in
326
 
        -c)
327
 
           mode=compile
328
 
           break
329
 
           ;;
 
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...
 
890
# Echo program name prefixed message to standard error, followed by
 
891
# a configuration failure hint, and exit.
 
892
func_fatal_configuration ()
 
893
{
 
894
    func_error ${1+"$@"}
 
895
    func_error "See the $PACKAGE documentation for more information."
 
896
    func_fatal_error "Fatal configuration error."
 
897
}
 
898
 
 
899
 
 
900
# func_config
 
901
# Display the configuration for all the tags in this script.
 
902
func_config ()
 
903
{
 
904
    re_begincf='^# ### BEGIN LIBTOOL'
 
905
    re_endcf='^# ### END LIBTOOL'
 
906
 
 
907
    # Default configuration.
 
908
    $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
 
909
 
 
910
    # Now print the configurations for the tags.
 
911
    for tagname in $taglist; do
 
912
      $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
 
913
    done
 
914
 
 
915
    exit $?
 
916
}
 
917
 
 
918
# func_features
 
919
# Display the features supported by this script.
 
920
func_features ()
 
921
{
 
922
    echo "host: $host"
 
923
    if test "$build_libtool_libs" = yes; then
 
924
      echo "enable shared libraries"
 
925
    else
 
926
      echo "disable shared libraries"
 
927
    fi
 
928
    if test "$build_old_libs" = yes; then
 
929
      echo "enable static libraries"
 
930
    else
 
931
      echo "disable static libraries"
 
932
    fi
 
933
 
 
934
    exit $?
 
935
}
 
936
 
 
937
# func_enable_tag tagname
 
938
# Verify that TAGNAME is valid, and either flag an error and exit, or
 
939
# enable the TAGNAME tag.  We also add TAGNAME to the global $taglist
 
940
# variable here.
 
941
func_enable_tag ()
 
942
{
 
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) ;;
 
961
    *)
 
962
      if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
 
963
        taglist="$taglist $tagname"
 
964
 
 
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
 
976
}
 
977
 
 
978
# func_check_version_match
 
979
# Ensure that we are using m4 macros, and libtool script from the same
 
980
# release of libtool.
 
981
func_check_version_match ()
 
982
{
 
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
 
987
$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
 
988
$progname: definition of this LT_INIT comes from an older release.
 
989
$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
 
990
$progname: and run autoconf again.
 
991
_LT_EOF
 
992
      else
 
993
        cat >&2 <<_LT_EOF
 
994
$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
 
995
$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
 
996
$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
 
997
$progname: and run autoconf again.
 
998
_LT_EOF
 
999
      fi
 
1000
    else
 
1001
      cat >&2 <<_LT_EOF
 
1002
$progname: Version mismatch error.  This is $PACKAGE $VERSION, revision $package_revision,
 
1003
$progname: but the definition of this LT_INIT comes from revision $macro_revision.
 
1004
$progname: You should recreate aclocal.m4 with macros from revision $package_revision
 
1005
$progname: of $PACKAGE $VERSION and run autoconf again.
 
1006
_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
 
 
1220
 
 
1221
 
 
1222
 
 
1223
## ----------- ##
 
1224
##    Main.    ##
 
1225
## ----------- ##
 
1226
 
 
1227
# func_lalib_p file
 
1228
# True iff FILE is a libtool `.la' library or `.lo' object file.
 
1229
# This function is only a basic sanity check; it will hardly flush out
 
1230
# determined imposters.
 
1231
func_lalib_p ()
 
1232
{
 
1233
    test -f "$1" &&
 
1234
      $SED -e 4q "$1" 2>/dev/null \
 
1235
        | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
 
1236
}
 
1237
 
 
1238
# func_lalib_unsafe_p file
 
1239
# True iff FILE is a libtool `.la' library or `.lo' object file.
 
1240
# This function implements the same check as func_lalib_p without
 
1241
# resorting to external programs.  To this end, it redirects stdin and
 
1242
# closes it afterwards, without saving the original file descriptor.
 
1243
# As a safety measure, use it only where a negative result would be
 
1244
# fatal anyway.  Works if `file' does not exist.
 
1245
func_lalib_unsafe_p ()
 
1246
{
 
1247
    lalib_p=no
 
1248
    if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
 
1249
        for lalib_p_l in 1 2 3 4
 
1250
        do
 
1251
            read lalib_p_line
 
1252
            case "$lalib_p_line" in
 
1253
                \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
 
1254
            esac
 
1255
        done
 
1256
        exec 0<&5 5<&-
 
1257
    fi
 
1258
    test "$lalib_p" = yes
 
1259
}
 
1260
 
 
1261
# func_ltwrapper_script_p file
 
1262
# True iff FILE is a libtool wrapper script
 
1263
# This function is only a basic sanity check; it will hardly flush out
 
1264
# determined imposters.
 
1265
func_ltwrapper_script_p ()
 
1266
{
 
1267
    func_lalib_p "$1"
 
1268
}
 
1269
 
 
1270
# func_ltwrapper_executable_p file
 
1271
# True iff FILE is a libtool wrapper executable
 
1272
# This function is only a basic sanity check; it will hardly flush out
 
1273
# determined imposters.
 
1274
func_ltwrapper_executable_p ()
 
1275
{
 
1276
    func_ltwrapper_exec_suffix=
 
1277
    case $1 in
 
1278
    *.exe) ;;
 
1279
    *) func_ltwrapper_exec_suffix=.exe ;;
 
1280
    esac
 
1281
    $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
 
1282
}
 
1283
 
 
1284
# func_ltwrapper_scriptname file
 
1285
# Assumes file is an ltwrapper_executable
 
1286
# uses $file to determine the appropriate filename for a
 
1287
# temporary ltwrapper_script.
 
1288
func_ltwrapper_scriptname ()
 
1289
{
 
1290
    func_dirname_and_basename "$1" "" "."
 
1291
    func_stripname '' '.exe' "$func_basename_result"
 
1292
    func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
 
1293
}
 
1294
 
 
1295
# func_ltwrapper_p file
 
1296
# True iff FILE is a libtool wrapper script or wrapper executable
 
1297
# This function is only a basic sanity check; it will hardly flush out
 
1298
# determined imposters.
 
1299
func_ltwrapper_p ()
 
1300
{
 
1301
    func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
 
1302
}
 
1303
 
 
1304
 
 
1305
# func_execute_cmds commands fail_cmd
 
1306
# Execute tilde-delimited COMMANDS.
 
1307
# If FAIL_CMD is given, eval that upon failure.
 
1308
# FAIL_CMD may read-access the current command in variable CMD!
 
1309
func_execute_cmds ()
 
1310
{
 
1311
    $opt_debug
 
1312
    save_ifs=$IFS; IFS='~'
 
1313
    for cmd in $1; do
 
1314
      IFS=$save_ifs
 
1315
      eval cmd=\"$cmd\"
 
1316
      func_show_eval "$cmd" "${2-:}"
 
1317
    done
 
1318
    IFS=$save_ifs
 
1319
}
 
1320
 
 
1321
 
 
1322
# func_source file
 
1323
# Source FILE, adding directory component if necessary.
 
1324
# Note that it is not necessary on cygwin/mingw to append a dot to
 
1325
# FILE even if both FILE and FILE.exe exist: automatic-append-.exe
 
1326
# behavior happens only for exec(3), not for open(2)!  Also, sourcing
 
1327
# `FILE.' does not work on cygwin managed mounts.
 
1328
func_source ()
 
1329
{
 
1330
    $opt_debug
 
1331
    case $1 in
 
1332
    */* | *\\*) . "$1" ;;
 
1333
    *)          . "./$1" ;;
 
1334
    esac
 
1335
}
 
1336
 
 
1337
 
 
1338
# func_resolve_sysroot PATH
 
1339
# Replace a leading = in PATH with a sysroot.  Store the result into
 
1340
# func_resolve_sysroot_result
 
1341
func_resolve_sysroot ()
 
1342
{
 
1343
  func_resolve_sysroot_result=$1
 
1344
  case $func_resolve_sysroot_result in
 
1345
  =*)
 
1346
    func_stripname '=' '' "$func_resolve_sysroot_result"
 
1347
    func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
 
1348
    ;;
 
1349
  esac
 
1350
}
 
1351
 
 
1352
# func_replace_sysroot PATH
 
1353
# If PATH begins with the sysroot, replace it with = and
 
1354
# store the result into func_replace_sysroot_result.
 
1355
func_replace_sysroot ()
 
1356
{
 
1357
  case "$lt_sysroot:$1" in
 
1358
  ?*:"$lt_sysroot"*)
 
1359
    func_stripname "$lt_sysroot" '' "$1"
 
1360
    func_replace_sysroot_result="=$func_stripname_result"
 
1361
    ;;
 
1362
  *)
 
1363
    # Including no sysroot.
 
1364
    func_replace_sysroot_result=$1
 
1365
    ;;
 
1366
  esac
 
1367
}
 
1368
 
 
1369
# func_infer_tag arg
 
1370
# Infer tagged configuration to use if any are available and
 
1371
# if one wasn't chosen via the "--tag" command line option.
 
1372
# Only attempt this if the compiler in the base compile
 
1373
# command doesn't match the default compiler.
 
1374
# arg is usually of the form 'gcc ...'
 
1375
func_infer_tag ()
 
1376
{
 
1377
    $opt_debug
 
1378
 
 
1379
    # FreeBSD-specific: where we install compilers with non-standard names
 
1380
    tag_compilers_CC="*cc cc* *gcc gcc* clang"
 
1381
    tag_compilers_CXX="*c++ c++* *g++ g++* clang++"
 
1382
    base_compiler=`set -- "$@"; echo $1`
 
1383
 
 
1384
    # If $tagname isn't set, then try to infer if the default "CC" tag applies
 
1385
    if test -z "$tagname"; then
 
1386
      for zp in $tag_compilers_CC; do
 
1387
        case $base_compiler in
 
1388
         $zp) tagname="CC"; break;;
330
1389
        esac
331
1390
      done
332
 
      ;;
333
 
    *db | *dbx | *strace | *truss)
334
 
      mode=execute
335
 
      ;;
336
 
    *install*|cp|mv)
337
 
      mode=install
338
 
      ;;
339
 
    *rm)
340
 
      mode=uninstall
341
 
      ;;
342
 
    *)
343
 
      # If we have no mode, but dlfiles were specified, then do execute mode.
344
 
      test -n "$execute_dlfiles" && mode=execute
345
 
 
346
 
      # Just use the default operation mode.
347
 
      if test -z "$mode"; then
348
 
        if test -n "$nonopt"; then
349
 
          $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
350
 
        else
351
 
          $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
 
1391
    fi
 
1392
 
 
1393
    if test -n "$available_tags" && test -z "$tagname"; then
 
1394
      CC_quoted=
 
1395
      for arg in $CC; do
 
1396
        func_append_quoted CC_quoted "$arg"
 
1397
      done
 
1398
      CC_expanded=`func_echo_all $CC`
 
1399
      CC_quoted_expanded=`func_echo_all $CC_quoted`
 
1400
      case $@ in
 
1401
      # Blanks in the command may have been stripped by the calling shell,
 
1402
      # but not from the CC environment variable when configure was run.
 
1403
      " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
 
1404
      " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
 
1405
      # Blanks at the start of $base_compile will cause this to fail
 
1406
      # if we don't check for them as well.
 
1407
      *)
 
1408
        for z in $available_tags; do
 
1409
          if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
 
1410
            # Evaluate the configuration.
 
1411
            eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
 
1412
            CC_quoted=
 
1413
            for arg in $CC; do
 
1414
              # Double-quote args containing other shell metacharacters.
 
1415
              func_append_quoted CC_quoted "$arg"
 
1416
            done
 
1417
            CC_expanded=`func_echo_all $CC`
 
1418
            CC_quoted_expanded=`func_echo_all $CC_quoted`
 
1419
            case "$@ " in
 
1420
            " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
 
1421
            " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
 
1422
              # The compiler in the base compile command matches
 
1423
              # the one in the tagged configuration.
 
1424
              # Assume this is the tagged configuration we want.
 
1425
              tagname=$z
 
1426
              break
 
1427
              ;;
 
1428
            esac
 
1429
 
 
1430
            # FreeBSD-specific: try compilers based on inferred tag
 
1431
            if test -z "$tagname"; then
 
1432
              eval "tag_compilers=\$tag_compilers_${z}"
 
1433
              if test -n "$tag_compilers"; then
 
1434
                for zp in $tag_compilers; do
 
1435
                  case $base_compiler in   
 
1436
                    $zp) tagname=$z; break;;
 
1437
                  esac
 
1438
                done
 
1439
                if test -n "$tagname"; then
 
1440
                  break
 
1441
                fi
 
1442
              fi
 
1443
            fi
 
1444
          fi
 
1445
        done
 
1446
        # If $tagname still isn't set, then no tagged configuration
 
1447
        # was found and let the user know that the "--tag" command
 
1448
        # line option must be used.
 
1449
        if test -z "$tagname"; then
 
1450
          func_echo "unable to infer tagged configuration"
 
1451
          func_fatal_error "specify a tag with \`--tag'"
 
1452
#       else
 
1453
#         func_verbose "using $tagname tagged configuration"
352
1454
        fi
 
1455
        ;;
 
1456
      esac
 
1457
    fi
 
1458
}
 
1459
 
 
1460
 
 
1461
 
 
1462
# func_write_libtool_object output_name pic_name nonpic_name
 
1463
# Create a libtool object file (analogous to a ".la" file),
 
1464
# but don't create it if we're doing a dry run.
 
1465
func_write_libtool_object ()
 
1466
{
 
1467
    write_libobj=${1}
 
1468
    if test "$build_libtool_libs" = yes; then
 
1469
      write_lobj=\'${2}\'
 
1470
    else
 
1471
      write_lobj=none
 
1472
    fi
 
1473
 
 
1474
    if test "$build_old_libs" = yes; then
 
1475
      write_oldobj=\'${3}\'
 
1476
    else
 
1477
      write_oldobj=none
 
1478
    fi
 
1479
 
 
1480
    $opt_dry_run || {
 
1481
      cat >${write_libobj}T <<EOF
 
1482
# $write_libobj - a libtool object file
 
1483
# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
 
1484
#
 
1485
# Please DO NOT delete this file!
 
1486
# It is necessary for linking the library.
 
1487
 
 
1488
# Name of the PIC object.
 
1489
pic_object=$write_lobj
 
1490
 
 
1491
# Name of the non-PIC object
 
1492
non_pic_object=$write_oldobj
 
1493
 
 
1494
EOF
 
1495
      $MV "${write_libobj}T" "${write_libobj}"
 
1496
    }
 
1497
}
 
1498
 
 
1499
 
 
1500
##################################################
 
1501
# FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
 
1502
##################################################
 
1503
 
 
1504
# func_convert_core_file_wine_to_w32 ARG
 
1505
# Helper function used by file name conversion functions when $build is *nix,
 
1506
# and $host is mingw, cygwin, or some other w32 environment. Relies on a
 
1507
# correctly configured wine environment available, with the winepath program
 
1508
# in $build's $PATH.
 
1509
#
 
1510
# ARG is the $build file name to be converted to w32 format.
 
1511
# Result is available in $func_convert_core_file_wine_to_w32_result, and will
 
1512
# be empty on error (or when ARG is empty)
 
1513
func_convert_core_file_wine_to_w32 ()
 
1514
{
 
1515
  $opt_debug
 
1516
  func_convert_core_file_wine_to_w32_result="$1"
 
1517
  if test -n "$1"; then
 
1518
    # Unfortunately, winepath does not exit with a non-zero error code, so we
 
1519
    # are forced to check the contents of stdout. On the other hand, if the
 
1520
    # command is not found, the shell will set an exit code of 127 and print
 
1521
    # *an error message* to stdout. So we must check for both error code of
 
1522
    # zero AND non-empty stdout, which explains the odd construction:
 
1523
    func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
 
1524
    if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then
 
1525
      func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
 
1526
        $SED -e "$lt_sed_naive_backslashify"`
 
1527
    else
 
1528
      func_convert_core_file_wine_to_w32_result=
 
1529
    fi
 
1530
  fi
 
1531
}
 
1532
# end: func_convert_core_file_wine_to_w32
 
1533
 
 
1534
 
 
1535
# func_convert_core_path_wine_to_w32 ARG
 
1536
# Helper function used by path conversion functions when $build is *nix, and
 
1537
# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
 
1538
# configured wine environment available, with the winepath program in $build's
 
1539
# $PATH. Assumes ARG has no leading or trailing path separator characters.
 
1540
#
 
1541
# ARG is path to be converted from $build format to win32.
 
1542
# Result is available in $func_convert_core_path_wine_to_w32_result.
 
1543
# Unconvertible file (directory) names in ARG are skipped; if no directory names
 
1544
# are convertible, then the result may be empty.
 
1545
func_convert_core_path_wine_to_w32 ()
 
1546
{
 
1547
  $opt_debug
 
1548
  # unfortunately, winepath doesn't convert paths, only file names
 
1549
  func_convert_core_path_wine_to_w32_result=""
 
1550
  if test -n "$1"; then
 
1551
    oldIFS=$IFS
 
1552
    IFS=:
 
1553
    for func_convert_core_path_wine_to_w32_f in $1; do
 
1554
      IFS=$oldIFS
 
1555
      func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
 
1556
      if test -n "$func_convert_core_file_wine_to_w32_result" ; then
 
1557
        if test -z "$func_convert_core_path_wine_to_w32_result"; then
 
1558
          func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result"
 
1559
        else
 
1560
          func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
 
1561
        fi
353
1562
      fi
354
 
      ;;
355
 
    esac
356
 
  fi
357
 
 
358
 
  # Only execute mode is allowed to have -dlopen flags.
359
 
  if test -n "$execute_dlfiles" && test "$mode" != execute; then
360
 
    $echo "$modename: unrecognized option \`-dlopen'" 1>&2
361
 
    $echo "$help" 1>&2
362
 
    exit 1
363
 
  fi
364
 
 
365
 
  # Change the help message to a mode-specific one.
366
 
  generic_help="$help"
367
 
  help="Try \`$modename --help --mode=$mode' for more information."
368
 
 
369
 
  # These modes are in order of execution frequency so that they run quickly.
370
 
  case $mode in
371
 
  # libtool compile mode
372
 
  compile)
373
 
    modename="$modename: compile"
 
1563
    done
 
1564
    IFS=$oldIFS
 
1565
  fi
 
1566
}
 
1567
# end: func_convert_core_path_wine_to_w32
 
1568
 
 
1569
 
 
1570
# func_cygpath ARGS...
 
1571
# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
 
1572
# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
 
1573
# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
 
1574
# (2), returns the Cygwin file name or path in func_cygpath_result (input
 
1575
# file name or path is assumed to be in w32 format, as previously converted
 
1576
# from $build's *nix or MSYS format). In case (3), returns the w32 file name
 
1577
# or path in func_cygpath_result (input file name or path is assumed to be in
 
1578
# Cygwin format). Returns an empty string on error.
 
1579
#
 
1580
# ARGS are passed to cygpath, with the last one being the file name or path to
 
1581
# be converted.
 
1582
#
 
1583
# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
 
1584
# environment variable; do not put it in $PATH.
 
1585
func_cygpath ()
 
1586
{
 
1587
  $opt_debug
 
1588
  if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
 
1589
    func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
 
1590
    if test "$?" -ne 0; then
 
1591
      # on failure, ensure result is empty
 
1592
      func_cygpath_result=
 
1593
    fi
 
1594
  else
 
1595
    func_cygpath_result=
 
1596
    func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'"
 
1597
  fi
 
1598
}
 
1599
#end: func_cygpath
 
1600
 
 
1601
 
 
1602
# func_convert_core_msys_to_w32 ARG
 
1603
# Convert file name or path ARG from MSYS format to w32 format.  Return
 
1604
# result in func_convert_core_msys_to_w32_result.
 
1605
func_convert_core_msys_to_w32 ()
 
1606
{
 
1607
  $opt_debug
 
1608
  # awkward: cmd appends spaces to result
 
1609
  func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
 
1610
    $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
 
1611
}
 
1612
#end: func_convert_core_msys_to_w32
 
1613
 
 
1614
 
 
1615
# func_convert_file_check ARG1 ARG2
 
1616
# Verify that ARG1 (a file name in $build format) was converted to $host
 
1617
# format in ARG2. Otherwise, emit an error message, but continue (resetting
 
1618
# func_to_host_file_result to ARG1).
 
1619
func_convert_file_check ()
 
1620
{
 
1621
  $opt_debug
 
1622
  if test -z "$2" && test -n "$1" ; then
 
1623
    func_error "Could not determine host file name corresponding to"
 
1624
    func_error "  \`$1'"
 
1625
    func_error "Continuing, but uninstalled executables may not work."
 
1626
    # Fallback:
 
1627
    func_to_host_file_result="$1"
 
1628
  fi
 
1629
}
 
1630
# end func_convert_file_check
 
1631
 
 
1632
 
 
1633
# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
 
1634
# Verify that FROM_PATH (a path in $build format) was converted to $host
 
1635
# format in TO_PATH. Otherwise, emit an error message, but continue, resetting
 
1636
# func_to_host_file_result to a simplistic fallback value (see below).
 
1637
func_convert_path_check ()
 
1638
{
 
1639
  $opt_debug
 
1640
  if test -z "$4" && test -n "$3"; then
 
1641
    func_error "Could not determine the host path corresponding to"
 
1642
    func_error "  \`$3'"
 
1643
    func_error "Continuing, but uninstalled executables may not work."
 
1644
    # Fallback.  This is a deliberately simplistic "conversion" and
 
1645
    # should not be "improved".  See libtool.info.
 
1646
    if test "x$1" != "x$2"; then
 
1647
      lt_replace_pathsep_chars="s|$1|$2|g"
 
1648
      func_to_host_path_result=`echo "$3" |
 
1649
        $SED -e "$lt_replace_pathsep_chars"`
 
1650
    else
 
1651
      func_to_host_path_result="$3"
 
1652
    fi
 
1653
  fi
 
1654
}
 
1655
# end func_convert_path_check
 
1656
 
 
1657
 
 
1658
# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
 
1659
# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
 
1660
# and appending REPL if ORIG matches BACKPAT.
 
1661
func_convert_path_front_back_pathsep ()
 
1662
{
 
1663
  $opt_debug
 
1664
  case $4 in
 
1665
  $1 ) func_to_host_path_result="$3$func_to_host_path_result"
 
1666
    ;;
 
1667
  esac
 
1668
  case $4 in
 
1669
  $2 ) func_append func_to_host_path_result "$3"
 
1670
    ;;
 
1671
  esac
 
1672
}
 
1673
# end func_convert_path_front_back_pathsep
 
1674
 
 
1675
 
 
1676
##################################################
 
1677
# $build to $host FILE NAME CONVERSION FUNCTIONS #
 
1678
##################################################
 
1679
# invoked via `$to_host_file_cmd ARG'
 
1680
#
 
1681
# In each case, ARG is the path to be converted from $build to $host format.
 
1682
# Result will be available in $func_to_host_file_result.
 
1683
 
 
1684
 
 
1685
# func_to_host_file ARG
 
1686
# Converts the file name ARG from $build format to $host format. Return result
 
1687
# in func_to_host_file_result.
 
1688
func_to_host_file ()
 
1689
{
 
1690
  $opt_debug
 
1691
  $to_host_file_cmd "$1"
 
1692
}
 
1693
# end func_to_host_file
 
1694
 
 
1695
 
 
1696
# func_to_tool_file ARG LAZY
 
1697
# converts the file name ARG from $build format to toolchain format. Return
 
1698
# result in func_to_tool_file_result.  If the conversion in use is listed
 
1699
# in (the comma separated) LAZY, no conversion takes place.
 
1700
func_to_tool_file ()
 
1701
{
 
1702
  $opt_debug
 
1703
  case ,$2, in
 
1704
    *,"$to_tool_file_cmd",*)
 
1705
      func_to_tool_file_result=$1
 
1706
      ;;
 
1707
    *)
 
1708
      $to_tool_file_cmd "$1"
 
1709
      func_to_tool_file_result=$func_to_host_file_result
 
1710
      ;;
 
1711
  esac
 
1712
}
 
1713
# end func_to_tool_file
 
1714
 
 
1715
 
 
1716
# func_convert_file_noop ARG
 
1717
# Copy ARG to func_to_host_file_result.
 
1718
func_convert_file_noop ()
 
1719
{
 
1720
  func_to_host_file_result="$1"
 
1721
}
 
1722
# end func_convert_file_noop
 
1723
 
 
1724
 
 
1725
# func_convert_file_msys_to_w32 ARG
 
1726
# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
 
1727
# conversion to w32 is not available inside the cwrapper.  Returns result in
 
1728
# func_to_host_file_result.
 
1729
func_convert_file_msys_to_w32 ()
 
1730
{
 
1731
  $opt_debug
 
1732
  func_to_host_file_result="$1"
 
1733
  if test -n "$1"; then
 
1734
    func_convert_core_msys_to_w32 "$1"
 
1735
    func_to_host_file_result="$func_convert_core_msys_to_w32_result"
 
1736
  fi
 
1737
  func_convert_file_check "$1" "$func_to_host_file_result"
 
1738
}
 
1739
# end func_convert_file_msys_to_w32
 
1740
 
 
1741
 
 
1742
# func_convert_file_cygwin_to_w32 ARG
 
1743
# Convert file name ARG from Cygwin to w32 format.  Returns result in
 
1744
# func_to_host_file_result.
 
1745
func_convert_file_cygwin_to_w32 ()
 
1746
{
 
1747
  $opt_debug
 
1748
  func_to_host_file_result="$1"
 
1749
  if test -n "$1"; then
 
1750
    # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
 
1751
    # LT_CYGPATH in this case.
 
1752
    func_to_host_file_result=`cygpath -m "$1"`
 
1753
  fi
 
1754
  func_convert_file_check "$1" "$func_to_host_file_result"
 
1755
}
 
1756
# end func_convert_file_cygwin_to_w32
 
1757
 
 
1758
 
 
1759
# func_convert_file_nix_to_w32 ARG
 
1760
# Convert file name ARG from *nix to w32 format.  Requires a wine environment
 
1761
# and a working winepath. Returns result in func_to_host_file_result.
 
1762
func_convert_file_nix_to_w32 ()
 
1763
{
 
1764
  $opt_debug
 
1765
  func_to_host_file_result="$1"
 
1766
  if test -n "$1"; then
 
1767
    func_convert_core_file_wine_to_w32 "$1"
 
1768
    func_to_host_file_result="$func_convert_core_file_wine_to_w32_result"
 
1769
  fi
 
1770
  func_convert_file_check "$1" "$func_to_host_file_result"
 
1771
}
 
1772
# end func_convert_file_nix_to_w32
 
1773
 
 
1774
 
 
1775
# func_convert_file_msys_to_cygwin ARG
 
1776
# Convert file name ARG from MSYS to Cygwin format.  Requires LT_CYGPATH set.
 
1777
# Returns result in func_to_host_file_result.
 
1778
func_convert_file_msys_to_cygwin ()
 
1779
{
 
1780
  $opt_debug
 
1781
  func_to_host_file_result="$1"
 
1782
  if test -n "$1"; then
 
1783
    func_convert_core_msys_to_w32 "$1"
 
1784
    func_cygpath -u "$func_convert_core_msys_to_w32_result"
 
1785
    func_to_host_file_result="$func_cygpath_result"
 
1786
  fi
 
1787
  func_convert_file_check "$1" "$func_to_host_file_result"
 
1788
}
 
1789
# end func_convert_file_msys_to_cygwin
 
1790
 
 
1791
 
 
1792
# func_convert_file_nix_to_cygwin ARG
 
1793
# Convert file name ARG from *nix to Cygwin format.  Requires Cygwin installed
 
1794
# in a wine environment, working winepath, and LT_CYGPATH set.  Returns result
 
1795
# in func_to_host_file_result.
 
1796
func_convert_file_nix_to_cygwin ()
 
1797
{
 
1798
  $opt_debug
 
1799
  func_to_host_file_result="$1"
 
1800
  if test -n "$1"; then
 
1801
    # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
 
1802
    func_convert_core_file_wine_to_w32 "$1"
 
1803
    func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
 
1804
    func_to_host_file_result="$func_cygpath_result"
 
1805
  fi
 
1806
  func_convert_file_check "$1" "$func_to_host_file_result"
 
1807
}
 
1808
# end func_convert_file_nix_to_cygwin
 
1809
 
 
1810
 
 
1811
#############################################
 
1812
# $build to $host PATH CONVERSION FUNCTIONS #
 
1813
#############################################
 
1814
# invoked via `$to_host_path_cmd ARG'
 
1815
#
 
1816
# In each case, ARG is the path to be converted from $build to $host format.
 
1817
# The result will be available in $func_to_host_path_result.
 
1818
#
 
1819
# Path separators are also converted from $build format to $host format.  If
 
1820
# ARG begins or ends with a path separator character, it is preserved (but
 
1821
# converted to $host format) on output.
 
1822
#
 
1823
# All path conversion functions are named using the following convention:
 
1824
#   file name conversion function    : func_convert_file_X_to_Y ()
 
1825
#   path conversion function         : func_convert_path_X_to_Y ()
 
1826
# where, for any given $build/$host combination the 'X_to_Y' value is the
 
1827
# same.  If conversion functions are added for new $build/$host combinations,
 
1828
# the two new functions must follow this pattern, or func_init_to_host_path_cmd
 
1829
# will break.
 
1830
 
 
1831
 
 
1832
# func_init_to_host_path_cmd
 
1833
# Ensures that function "pointer" variable $to_host_path_cmd is set to the
 
1834
# appropriate value, based on the value of $to_host_file_cmd.
 
1835
to_host_path_cmd=
 
1836
func_init_to_host_path_cmd ()
 
1837
{
 
1838
  $opt_debug
 
1839
  if test -z "$to_host_path_cmd"; then
 
1840
    func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
 
1841
    to_host_path_cmd="func_convert_path_${func_stripname_result}"
 
1842
  fi
 
1843
}
 
1844
 
 
1845
 
 
1846
# func_to_host_path ARG
 
1847
# Converts the path ARG from $build format to $host format. Return result
 
1848
# in func_to_host_path_result.
 
1849
func_to_host_path ()
 
1850
{
 
1851
  $opt_debug
 
1852
  func_init_to_host_path_cmd
 
1853
  $to_host_path_cmd "$1"
 
1854
}
 
1855
# end func_to_host_path
 
1856
 
 
1857
 
 
1858
# func_convert_path_noop ARG
 
1859
# Copy ARG to func_to_host_path_result.
 
1860
func_convert_path_noop ()
 
1861
{
 
1862
  func_to_host_path_result="$1"
 
1863
}
 
1864
# end func_convert_path_noop
 
1865
 
 
1866
 
 
1867
# func_convert_path_msys_to_w32 ARG
 
1868
# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
 
1869
# conversion to w32 is not available inside the cwrapper.  Returns result in
 
1870
# func_to_host_path_result.
 
1871
func_convert_path_msys_to_w32 ()
 
1872
{
 
1873
  $opt_debug
 
1874
  func_to_host_path_result="$1"
 
1875
  if test -n "$1"; then
 
1876
    # Remove leading and trailing path separator characters from ARG.  MSYS
 
1877
    # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
 
1878
    # and winepath ignores them completely.
 
1879
    func_stripname : : "$1"
 
1880
    func_to_host_path_tmp1=$func_stripname_result
 
1881
    func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
 
1882
    func_to_host_path_result="$func_convert_core_msys_to_w32_result"
 
1883
    func_convert_path_check : ";" \
 
1884
      "$func_to_host_path_tmp1" "$func_to_host_path_result"
 
1885
    func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
 
1886
  fi
 
1887
}
 
1888
# end func_convert_path_msys_to_w32
 
1889
 
 
1890
 
 
1891
# func_convert_path_cygwin_to_w32 ARG
 
1892
# Convert path ARG from Cygwin to w32 format.  Returns result in
 
1893
# func_to_host_file_result.
 
1894
func_convert_path_cygwin_to_w32 ()
 
1895
{
 
1896
  $opt_debug
 
1897
  func_to_host_path_result="$1"
 
1898
  if test -n "$1"; then
 
1899
    # See func_convert_path_msys_to_w32:
 
1900
    func_stripname : : "$1"
 
1901
    func_to_host_path_tmp1=$func_stripname_result
 
1902
    func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
 
1903
    func_convert_path_check : ";" \
 
1904
      "$func_to_host_path_tmp1" "$func_to_host_path_result"
 
1905
    func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
 
1906
  fi
 
1907
}
 
1908
# end func_convert_path_cygwin_to_w32
 
1909
 
 
1910
 
 
1911
# func_convert_path_nix_to_w32 ARG
 
1912
# Convert path ARG from *nix to w32 format.  Requires a wine environment and
 
1913
# a working winepath.  Returns result in func_to_host_file_result.
 
1914
func_convert_path_nix_to_w32 ()
 
1915
{
 
1916
  $opt_debug
 
1917
  func_to_host_path_result="$1"
 
1918
  if test -n "$1"; then
 
1919
    # See func_convert_path_msys_to_w32:
 
1920
    func_stripname : : "$1"
 
1921
    func_to_host_path_tmp1=$func_stripname_result
 
1922
    func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
 
1923
    func_to_host_path_result="$func_convert_core_path_wine_to_w32_result"
 
1924
    func_convert_path_check : ";" \
 
1925
      "$func_to_host_path_tmp1" "$func_to_host_path_result"
 
1926
    func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
 
1927
  fi
 
1928
}
 
1929
# end func_convert_path_nix_to_w32
 
1930
 
 
1931
 
 
1932
# func_convert_path_msys_to_cygwin ARG
 
1933
# Convert path ARG from MSYS to Cygwin format.  Requires LT_CYGPATH set.
 
1934
# Returns result in func_to_host_file_result.
 
1935
func_convert_path_msys_to_cygwin ()
 
1936
{
 
1937
  $opt_debug
 
1938
  func_to_host_path_result="$1"
 
1939
  if test -n "$1"; then
 
1940
    # See func_convert_path_msys_to_w32:
 
1941
    func_stripname : : "$1"
 
1942
    func_to_host_path_tmp1=$func_stripname_result
 
1943
    func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
 
1944
    func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
 
1945
    func_to_host_path_result="$func_cygpath_result"
 
1946
    func_convert_path_check : : \
 
1947
      "$func_to_host_path_tmp1" "$func_to_host_path_result"
 
1948
    func_convert_path_front_back_pathsep ":*" "*:" : "$1"
 
1949
  fi
 
1950
}
 
1951
# end func_convert_path_msys_to_cygwin
 
1952
 
 
1953
 
 
1954
# func_convert_path_nix_to_cygwin ARG
 
1955
# Convert path ARG from *nix to Cygwin format.  Requires Cygwin installed in a
 
1956
# a wine environment, working winepath, and LT_CYGPATH set.  Returns result in
 
1957
# func_to_host_file_result.
 
1958
func_convert_path_nix_to_cygwin ()
 
1959
{
 
1960
  $opt_debug
 
1961
  func_to_host_path_result="$1"
 
1962
  if test -n "$1"; then
 
1963
    # Remove leading and trailing path separator characters from
 
1964
    # ARG. msys behavior is inconsistent here, cygpath turns them
 
1965
    # into '.;' and ';.', and winepath ignores them completely.
 
1966
    func_stripname : : "$1"
 
1967
    func_to_host_path_tmp1=$func_stripname_result
 
1968
    func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
 
1969
    func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
 
1970
    func_to_host_path_result="$func_cygpath_result"
 
1971
    func_convert_path_check : : \
 
1972
      "$func_to_host_path_tmp1" "$func_to_host_path_result"
 
1973
    func_convert_path_front_back_pathsep ":*" "*:" : "$1"
 
1974
  fi
 
1975
}
 
1976
# end func_convert_path_nix_to_cygwin
 
1977
 
 
1978
 
 
1979
# func_mode_compile arg...
 
1980
func_mode_compile ()
 
1981
{
 
1982
    $opt_debug
374
1983
    # Get the compilation command and the source file.
375
1984
    base_compile=
376
1985
    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
379
1988
    arg_mode=normal
380
1989
    libobj=
381
1990
    later=
 
1991
    pie_flag=
382
1992
 
383
1993
    for arg
384
1994
    do
385
 
      case "$arg_mode" in
 
1995
      case $arg_mode in
386
1996
      arg  )
387
1997
        # do not "continue".  Instead, add this to base_compile
388
1998
        lastarg="$arg"
399
2009
        # Accept any command-line options.
400
2010
        case $arg in
401
2011
        -o)
402
 
          if test -n "$libobj" ; then
403
 
            $echo "$modename: you cannot specify \`-o' more than once" 1>&2
404
 
            exit 1
405
 
          fi
 
2012
          test -n "$libobj" && \
 
2013
            func_fatal_error "you cannot specify \`-o' more than once"
406
2014
          arg_mode=target
407
2015
          continue
408
2016
          ;;
409
2017
 
410
 
        -static | -prefer-pic | -prefer-non-pic)
411
 
          later="$later $arg"
 
2018
        -pie | -fpie | -fPIE)
 
2019
          func_append pie_flag " $arg"
 
2020
          continue
 
2021
          ;;
 
2022
 
 
2023
        -shared | -static | -prefer-pic | -prefer-non-pic)
 
2024
          func_append later " $arg"
412
2025
          continue
413
2026
          ;;
414
2027
 
423
2036
          ;;            #  replaced later.  I would guess that would be a bug.
424
2037
 
425
2038
        -Wc,*)
426
 
          args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
 
2039
          func_stripname '-Wc,' '' "$arg"
 
2040
          args=$func_stripname_result
427
2041
          lastarg=
428
2042
          save_ifs="$IFS"; IFS=','
429
2043
          for arg in $args; do
430
2044
            IFS="$save_ifs"
431
 
 
432
 
            # Double-quote args containing other shell metacharacters.
433
 
            # Many Bourne shells cannot handle close brackets correctly
434
 
            # in scan sets, so we specify it separately.
435
 
            case $arg in
436
 
              *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
437
 
              arg="\"$arg\""
438
 
              ;;
439
 
            esac
440
 
            lastarg="$lastarg $arg"
 
2045
            func_append_quoted lastarg "$arg"
441
2046
          done
442
2047
          IFS="$save_ifs"
443
 
          lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
 
2048
          func_stripname ' ' '' "$lastarg"
 
2049
          lastarg=$func_stripname_result
444
2050
 
445
2051
          # Add the arguments to base_compile.
446
 
          base_compile="$base_compile $lastarg"
 
2052
          func_append base_compile " $lastarg"
447
2053
          continue
448
2054
          ;;
449
2055
 
450
 
        * )
 
2056
        *)
451
2057
          # Accept the current argument as the source file.
452
2058
          # The previous "srcfile" becomes the current argument.
453
2059
          #
459
2065
      esac    #  case $arg_mode
460
2066
 
461
2067
      # Aesthetically quote the previous argument.
462
 
      lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
463
 
 
464
 
      case $lastarg in
465
 
      # Double-quote args containing other shell metacharacters.
466
 
      # Many Bourne shells cannot handle close brackets correctly
467
 
      # in scan sets, so we specify it separately.
468
 
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
469
 
        lastarg="\"$lastarg\""
470
 
        ;;
471
 
      esac
472
 
 
473
 
      base_compile="$base_compile $lastarg"
 
2068
      func_append_quoted base_compile "$lastarg"
474
2069
    done # for arg
475
2070
 
476
2071
    case $arg_mode in
477
2072
    arg)
478
 
      $echo "$modename: you must specify an argument for -Xcompile"
479
 
      exit 1
 
2073
      func_fatal_error "you must specify an argument for -Xcompile"
480
2074
      ;;
481
2075
    target)
482
 
      $echo "$modename: you must specify a target with \`-o'" 1>&2
483
 
      exit 1
 
2076
      func_fatal_error "you must specify a target with \`-o'"
484
2077
      ;;
485
2078
    *)
486
2079
      # Get the name of the library object.
487
 
      [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
 
2080
      test -z "$libobj" && {
 
2081
        func_basename "$srcfile"
 
2082
        libobj="$func_basename_result"
 
2083
      }
488
2084
      ;;
489
2085
    esac
490
2086
 
491
2087
    # Recognize several different file suffixes.
492
2088
    # If the user specifies -o file.o, it is replaced with file.lo
493
 
    xform='[cCFSifmso]'
494
2089
    case $libobj in
495
 
    *.ada) xform=ada ;;
496
 
    *.adb) xform=adb ;;
497
 
    *.ads) xform=ads ;;
498
 
    *.asm) xform=asm ;;
499
 
    *.c++) xform=c++ ;;
500
 
    *.cc) xform=cc ;;
501
 
    *.ii) xform=ii ;;
502
 
    *.class) xform=class ;;
503
 
    *.cpp) xform=cpp ;;
504
 
    *.cxx) xform=cxx ;;
505
 
    *.f90) xform=f90 ;;
506
 
    *.for) xform=for ;;
507
 
    *.java) xform=java ;;
 
2090
    *.[cCFSifmso] | \
 
2091
    *.ada | *.adb | *.ads | *.asm | \
 
2092
    *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
 
2093
    *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
 
2094
      func_xform "$libobj"
 
2095
      libobj=$func_xform_result
 
2096
      ;;
508
2097
    esac
509
2098
 
510
 
    libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
511
 
 
512
2099
    case $libobj in
513
 
    *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
 
2100
    *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
514
2101
    *)
515
 
      $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
516
 
      exit 1
 
2102
      func_fatal_error "cannot determine name of library object from \`$libobj'"
517
2103
      ;;
518
2104
    esac
519
2105
 
520
 
    # Infer tagged configuration to use if any are available and
521
 
    # if one wasn't chosen via the "--tag" command line option.
522
 
    # Only attempt this if the compiler in the base compile
523
 
    # command doesn't match the default compiler.
524
 
    if test -n "$available_tags" && test -z "$tagname"; then
525
 
      case $base_compile in
526
 
      # Blanks in the command may have been stripped by the calling shell,
527
 
      # but not from the CC environment variable when configure was run.
528
 
      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "*) ;;
529
 
      # Blanks at the start of $base_compile will cause this to fail
530
 
      # if we don't check for them as well.
531
 
      *)
532
 
        for z in $available_tags; do
533
 
          if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
534
 
            # Evaluate the configuration.
535
 
            eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
536
 
            case "$base_compile " in
537
 
            "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)
538
 
              # The compiler in the base compile command matches
539
 
              # the one in the tagged configuration.
540
 
              # Assume this is the tagged configuration we want.
541
 
              tagname=$z
542
 
              break
543
 
              ;;
544
 
            esac
545
 
          fi
546
 
        done
547
 
        # If $tagname still isn't set, then no tagged configuration
548
 
        # was found and let the user know that the "--tag" command
549
 
        # line option must be used.
550
 
        if test -z "$tagname"; then
551
 
          $echo "$modename: unable to infer tagged configuration"
552
 
          $echo "$modename: specify a tag with \`--tag'" 1>&2
553
 
          exit 1
554
 
#        else
555
 
#          $echo "$modename: using $tagname tagged configuration"
556
 
        fi
557
 
        ;;
558
 
      esac
559
 
    fi
 
2106
    func_infer_tag $base_compile
560
2107
 
561
2108
    for arg in $later; do
562
2109
      case $arg in
 
2110
      -shared)
 
2111
        test "$build_libtool_libs" != yes && \
 
2112
          func_fatal_configuration "can not build a shared library"
 
2113
        build_old_libs=no
 
2114
        continue
 
2115
        ;;
 
2116
 
563
2117
      -static)
 
2118
        build_libtool_libs=no
564
2119
        build_old_libs=yes
565
2120
        continue
566
2121
        ;;
577
2132
      esac
578
2133
    done
579
2134
 
580
 
    objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
581
 
    xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
582
 
    if test "X$xdir" = "X$obj"; then
583
 
      xdir=
584
 
    else
585
 
      xdir=$xdir/
586
 
    fi
 
2135
    func_quote_for_eval "$libobj"
 
2136
    test "X$libobj" != "X$func_quote_for_eval_result" \
 
2137
      && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"'    &()|`$[]' \
 
2138
      && func_warning "libobj name \`$libobj' may not contain shell special characters."
 
2139
    func_dirname_and_basename "$obj" "/" ""
 
2140
    objname="$func_basename_result"
 
2141
    xdir="$func_dirname_result"
587
2142
    lobj=${xdir}$objdir/$objname
588
2143
 
589
 
    if test -z "$base_compile"; then
590
 
      $echo "$modename: you must specify a compilation command" 1>&2
591
 
      $echo "$help" 1>&2
592
 
      exit 1
593
 
    fi
 
2144
    test -z "$base_compile" && \
 
2145
      func_fatal_help "you must specify a compilation command"
594
2146
 
595
2147
    # Delete any leftover library objects.
596
2148
    if test "$build_old_libs" = yes; then
599
2151
      removelist="$lobj $libobj ${libobj}T"
600
2152
    fi
601
2153
 
602
 
    $run $rm $removelist
603
 
    trap "$run $rm $removelist; exit 1" 1 2 15
604
 
 
605
2154
    # On Cygwin there's no "real" PIC flag so we must build both object types
606
2155
    case $host_os in
607
 
    cygwin* | mingw* | pw32* | os2*)
 
2156
    cygwin* | mingw* | pw32* | os2* | cegcc*)
608
2157
      pic_mode=default
609
2158
      ;;
610
2159
    esac
616
2165
    # Calculate the filename of the output object if compiler does
617
2166
    # not support -o with -c
618
2167
    if test "$compiler_c_o" = no; then
619
 
      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
 
2168
      output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext}
620
2169
      lockfile="$output_obj.lock"
621
 
      removelist="$removelist $output_obj $lockfile"
622
 
      trap "$run $rm $removelist; exit 1" 1 2 15
623
2170
    else
624
2171
      output_obj=
625
2172
      need_locks=no
629
2176
    # Lock this critical section if it is needed
630
2177
    # We use this script file to make the link, it avoids creating a new file
631
2178
    if test "$need_locks" = yes; then
632
 
      until $run ln "$0" "$lockfile" 2>/dev/null; do
633
 
        $show "Waiting for $lockfile to be removed"
 
2179
      until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
 
2180
        func_echo "Waiting for $lockfile to be removed"
634
2181
        sleep 2
635
2182
      done
636
2183
    elif test "$need_locks" = warn; then
637
2184
      if test -f "$lockfile"; then
638
 
        $echo "\
 
2185
        $ECHO "\
639
2186
*** ERROR, $lockfile exists and contains:
640
2187
`cat $lockfile 2>/dev/null`
641
2188
 
646
2193
avoid parallel builds (make -j) in this platform, or get a better
647
2194
compiler."
648
2195
 
649
 
        $run $rm $removelist
650
 
        exit 1
 
2196
        $opt_dry_run || $RM $removelist
 
2197
        exit $EXIT_FAILURE
651
2198
      fi
652
 
      $echo $srcfile > "$lockfile"
653
 
    fi
654
 
 
655
 
    if test -n "$fix_srcfile_path"; then
656
 
      eval srcfile=\"$fix_srcfile_path\"
657
 
    fi
658
 
 
659
 
    $run $rm "$libobj" "${libobj}T"
660
 
 
661
 
    # Create a libtool object file (analogous to a ".la" file),
662
 
    # but don't create it if we're doing a dry run.
663
 
    test -z "$run" && cat > ${libobj}T <<EOF
664
 
# $libobj - a libtool object file
665
 
# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
666
 
#
667
 
# Please DO NOT delete this file!
668
 
# It is necessary for linking the library.
669
 
 
670
 
# Name of the PIC object.
671
 
EOF
 
2199
      func_append removelist " $output_obj"
 
2200
      $ECHO "$srcfile" > "$lockfile"
 
2201
    fi
 
2202
 
 
2203
    $opt_dry_run || $RM $removelist
 
2204
    func_append removelist " $lockfile"
 
2205
    trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
 
2206
 
 
2207
    func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
 
2208
    srcfile=$func_to_tool_file_result
 
2209
    func_quote_for_eval "$srcfile"
 
2210
    qsrcfile=$func_quote_for_eval_result
672
2211
 
673
2212
    # Only build a PIC object if we are building libtool libraries.
674
2213
    if test "$build_libtool_libs" = yes; then
676
2215
      fbsd_hideous_sh_bug=$base_compile
677
2216
 
678
2217
      if test "$pic_mode" != no; then
679
 
        command="$base_compile $srcfile $pic_flag"
 
2218
        command="$base_compile $qsrcfile $pic_flag"
680
2219
      else
681
2220
        # Don't build PIC code
682
 
        command="$base_compile $srcfile"
 
2221
        command="$base_compile $qsrcfile"
683
2222
      fi
684
2223
 
685
 
      if test ! -d "${xdir}$objdir"; then
686
 
        $show "$mkdir ${xdir}$objdir"
687
 
        $run $mkdir ${xdir}$objdir
688
 
        status=$?
689
 
        if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then
690
 
          exit $status
691
 
        fi
692
 
      fi
 
2224
      func_mkdir_p "$xdir$objdir"
693
2225
 
694
2226
      if test -z "$output_obj"; then
695
2227
        # Place PIC objects in $objdir
696
 
        command="$command -o $lobj"
697
 
      fi
698
 
 
699
 
      $run $rm "$lobj" "$output_obj"
700
 
 
701
 
      $show "$command"
702
 
      if $run eval "$command"; then :
703
 
      else
704
 
        test -n "$output_obj" && $run $rm $removelist
705
 
        exit 1
706
 
      fi
 
2228
        func_append command " -o $lobj"
 
2229
      fi
 
2230
 
 
2231
      func_show_eval_locale "$command"  \
 
2232
          'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
707
2233
 
708
2234
      if test "$need_locks" = warn &&
709
2235
         test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
710
 
        $echo "\
 
2236
        $ECHO "\
711
2237
*** ERROR, $lockfile contains:
712
2238
`cat $lockfile 2>/dev/null`
713
2239
 
721
2247
avoid parallel builds (make -j) in this platform, or get a better
722
2248
compiler."
723
2249
 
724
 
        $run $rm $removelist
725
 
        exit 1
 
2250
        $opt_dry_run || $RM $removelist
 
2251
        exit $EXIT_FAILURE
726
2252
      fi
727
2253
 
728
2254
      # Just move the object if needed, then go on to compile the next one
729
2255
      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
730
 
        $show "$mv $output_obj $lobj"
731
 
        if $run $mv $output_obj $lobj; then :
732
 
        else
733
 
          error=$?
734
 
          $run $rm $removelist
735
 
          exit $error
736
 
        fi
 
2256
        func_show_eval '$MV "$output_obj" "$lobj"' \
 
2257
          'error=$?; $opt_dry_run || $RM $removelist; exit $error'
737
2258
      fi
738
2259
 
739
 
      # Append the name of the PIC object to the libtool object file.
740
 
      test -z "$run" && cat >> ${libobj}T <<EOF
741
 
pic_object='$objdir/$objname'
742
 
 
743
 
EOF
744
 
 
745
2260
      # Allow error messages only from the first compilation.
746
2261
      if test "$suppress_opt" = yes; then
747
 
        suppress_output=' >/dev/null 2>&1'
 
2262
        suppress_output=' >/dev/null 2>&1'
748
2263
      fi
749
 
    else
750
 
      # No PIC object so indicate it doesn't exist in the libtool
751
 
      # object file.
752
 
      test -z "$run" && cat >> ${libobj}T <<EOF
753
 
pic_object=none
754
 
 
755
 
EOF
756
2264
    fi
757
2265
 
758
2266
    # Only build a position-dependent object if we build old libraries.
759
2267
    if test "$build_old_libs" = yes; then
760
2268
      if test "$pic_mode" != yes; then
761
2269
        # Don't build PIC code
762
 
        command="$base_compile $srcfile"
 
2270
        command="$base_compile $qsrcfile$pie_flag"
763
2271
      else
764
 
        command="$base_compile $srcfile $pic_flag"
 
2272
        command="$base_compile $qsrcfile $pic_flag"
765
2273
      fi
766
2274
      if test "$compiler_c_o" = yes; then
767
 
        command="$command -o $obj"
 
2275
        func_append command " -o $obj"
768
2276
      fi
769
2277
 
770
2278
      # Suppress compiler output if we already did a PIC compilation.
771
 
      command="$command$suppress_output"
772
 
      $run $rm "$obj" "$output_obj"
773
 
      $show "$command"
774
 
      if $run eval "$command"; then :
775
 
      else
776
 
        $run $rm $removelist
777
 
        exit 1
778
 
      fi
 
2279
      func_append command "$suppress_output"
 
2280
      func_show_eval_locale "$command" \
 
2281
        '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
779
2282
 
780
2283
      if test "$need_locks" = warn &&
781
2284
         test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
782
 
        $echo "\
 
2285
        $ECHO "\
783
2286
*** ERROR, $lockfile contains:
784
2287
`cat $lockfile 2>/dev/null`
785
2288
 
793
2296
avoid parallel builds (make -j) in this platform, or get a better
794
2297
compiler."
795
2298
 
796
 
        $run $rm $removelist
797
 
        exit 1
 
2299
        $opt_dry_run || $RM $removelist
 
2300
        exit $EXIT_FAILURE
798
2301
      fi
799
2302
 
800
2303
      # Just move the object if needed
801
2304
      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
802
 
        $show "$mv $output_obj $obj"
803
 
        if $run $mv $output_obj $obj; then :
804
 
        else
805
 
          error=$?
806
 
          $run $rm $removelist
807
 
          exit $error
808
 
        fi
809
 
      fi
810
 
 
811
 
      # Append the name of the non-PIC object the libtool object file.
812
 
      # Only append if the libtool object file exists.
813
 
      test -z "$run" && cat >> ${libobj}T <<EOF
814
 
# Name of the non-PIC object.
815
 
non_pic_object='$objname'
816
 
 
817
 
EOF
818
 
    else
819
 
      # Append the name of the non-PIC object the libtool object file.
820
 
      # Only append if the libtool object file exists.
821
 
      test -z "$run" && cat >> ${libobj}T <<EOF
822
 
# Name of the non-PIC object.
823
 
non_pic_object=none
824
 
 
825
 
EOF
826
 
    fi
827
 
 
828
 
    $run $mv "${libobj}T" "${libobj}"
829
 
 
830
 
    # Unlock the critical section if it was locked
831
 
    if test "$need_locks" != no; then
832
 
      $run $rm "$lockfile"
833
 
    fi
834
 
 
835
 
    exit 0
836
 
    ;;
837
 
 
838
 
  # libtool link mode
839
 
  link | relink)
840
 
    modename="$modename: link"
 
2305
        func_show_eval '$MV "$output_obj" "$obj"' \
 
2306
          'error=$?; $opt_dry_run || $RM $removelist; exit $error'
 
2307
      fi
 
2308
    fi
 
2309
 
 
2310
    $opt_dry_run || {
 
2311
      func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
 
2312
 
 
2313
      # Unlock the critical section if it was locked
 
2314
      if test "$need_locks" != no; then
 
2315
        removelist=$lockfile
 
2316
        $RM "$lockfile"
 
2317
      fi
 
2318
    }
 
2319
 
 
2320
    exit $EXIT_SUCCESS
 
2321
}
 
2322
 
 
2323
$opt_help || {
 
2324
  test "$opt_mode" = compile && func_mode_compile ${1+"$@"}
 
2325
}
 
2326
 
 
2327
func_mode_help ()
 
2328
{
 
2329
    # We need to display help for each of the modes.
 
2330
    case $opt_mode in
 
2331
      "")
 
2332
        # Generic help is extracted from the usage comments
 
2333
        # at the start of this file.
 
2334
        func_help
 
2335
        ;;
 
2336
 
 
2337
      clean)
 
2338
        $ECHO \
 
2339
"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
 
2340
 
 
2341
Remove files from the build directory.
 
2342
 
 
2343
RM is the name of the program to use to delete files associated with each FILE
 
2344
(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
 
2345
to RM.
 
2346
 
 
2347
If FILE is a libtool library, object or program, all the files associated
 
2348
with it are deleted. Otherwise, only FILE itself is deleted using RM."
 
2349
        ;;
 
2350
 
 
2351
      compile)
 
2352
      $ECHO \
 
2353
"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
 
2354
 
 
2355
Compile a source file into a libtool library object.
 
2356
 
 
2357
This mode accepts the following additional options:
 
2358
 
 
2359
  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
 
2360
  -no-suppress      do not suppress compiler output for multiple passes
 
2361
  -prefer-pic       try to build PIC objects only
 
2362
  -prefer-non-pic   try to build non-PIC objects only
 
2363
  -shared           do not build a \`.o' file suitable for static linking
 
2364
  -static           only build a \`.o' file suitable for static linking
 
2365
  -Wc,FLAG          pass FLAG directly to the compiler
 
2366
 
 
2367
COMPILE-COMMAND is a command to be used in creating a \`standard' object file
 
2368
from the given SOURCEFILE.
 
2369
 
 
2370
The output file name is determined by removing the directory component from
 
2371
SOURCEFILE, then substituting the C source code suffix \`.c' with the
 
2372
library object suffix, \`.lo'."
 
2373
        ;;
 
2374
 
 
2375
      execute)
 
2376
        $ECHO \
 
2377
"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
 
2378
 
 
2379
Automatically set library path, then run a program.
 
2380
 
 
2381
This mode accepts the following additional options:
 
2382
 
 
2383
  -dlopen FILE      add the directory containing FILE to the library path
 
2384
 
 
2385
This mode sets the library path environment variable according to \`-dlopen'
 
2386
flags.
 
2387
 
 
2388
If any of the ARGS are libtool executable wrappers, then they are translated
 
2389
into their corresponding uninstalled binary, and any of their required library
 
2390
directories are added to the library path.
 
2391
 
 
2392
Then, COMMAND is executed, with ARGS as arguments."
 
2393
        ;;
 
2394
 
 
2395
      finish)
 
2396
        $ECHO \
 
2397
"Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
 
2398
 
 
2399
Complete the installation of libtool libraries.
 
2400
 
 
2401
Each LIBDIR is a directory that contains libtool libraries.
 
2402
 
 
2403
The commands that this mode executes may require superuser privileges.  Use
 
2404
the \`--dry-run' option if you just want to see what would be executed."
 
2405
        ;;
 
2406
 
 
2407
      install)
 
2408
        $ECHO \
 
2409
"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
 
2410
 
 
2411
Install executables or libraries.
 
2412
 
 
2413
INSTALL-COMMAND is the installation command.  The first component should be
 
2414
either the \`install' or \`cp' program.
 
2415
 
 
2416
The following components of INSTALL-COMMAND are treated specially:
 
2417
 
 
2418
  -inst-prefix-dir PREFIX-DIR  Use PREFIX-DIR as a staging area for installation
 
2419
 
 
2420
The rest of the components are interpreted as arguments to that command (only
 
2421
BSD-compatible install options are recognized)."
 
2422
        ;;
 
2423
 
 
2424
      link)
 
2425
        $ECHO \
 
2426
"Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
 
2427
 
 
2428
Link object files or libraries together to form another library, or to
 
2429
create an executable program.
 
2430
 
 
2431
LINK-COMMAND is a command using the C compiler that you would use to create
 
2432
a program from several object files.
 
2433
 
 
2434
The following components of LINK-COMMAND are treated specially:
 
2435
 
 
2436
  -all-static       do not do any dynamic linking at all
 
2437
  -avoid-version    do not add a version suffix if possible
 
2438
  -bindir BINDIR    specify path to binaries directory (for systems where
 
2439
                    libraries must be found in the PATH setting at runtime)
 
2440
  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
 
2441
  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
 
2442
  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
 
2443
  -export-symbols SYMFILE
 
2444
                    try to export only the symbols listed in SYMFILE
 
2445
  -export-symbols-regex REGEX
 
2446
                    try to export only the symbols matching REGEX
 
2447
  -LLIBDIR          search LIBDIR for required installed libraries
 
2448
  -lNAME            OUTPUT-FILE requires the installed library libNAME
 
2449
  -module           build a library that can dlopened
 
2450
  -no-fast-install  disable the fast-install mode
 
2451
  -no-install       link a not-installable executable
 
2452
  -no-undefined     declare that a library does not refer to external symbols
 
2453
  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
 
2454
  -objectlist FILE  Use a list of object files found in FILE to specify objects
 
2455
  -precious-files-regex REGEX
 
2456
                    don't remove output files matching REGEX
 
2457
  -release RELEASE  specify package release information
 
2458
  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
 
2459
  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
 
2460
  -shared           only do dynamic linking of libtool libraries
 
2461
  -shrext SUFFIX    override the standard shared library file extension
 
2462
  -static           do not do any dynamic linking of uninstalled libtool libraries
 
2463
  -static-libtool-libs
 
2464
                    do not do any dynamic linking of libtool libraries
 
2465
  -version-info CURRENT[:REVISION[:AGE]]
 
2466
                    specify library version info [each variable defaults to 0]
 
2467
  -weak LIBNAME     declare that the target provides the LIBNAME interface
 
2468
  -Wc,FLAG
 
2469
  -Xcompiler FLAG   pass linker-specific FLAG directly to the compiler
 
2470
  -Wl,FLAG
 
2471
  -Xlinker FLAG     pass linker-specific FLAG directly to the linker
 
2472
  -XCClinker FLAG   pass link-specific FLAG to the compiler driver (CC)
 
2473
 
 
2474
All other options (arguments beginning with \`-') are ignored.
 
2475
 
 
2476
Every other argument is treated as a filename.  Files ending in \`.la' are
 
2477
treated as uninstalled libtool libraries, other files are standard or library
 
2478
object files.
 
2479
 
 
2480
If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
 
2481
only library objects (\`.lo' files) may be specified, and \`-rpath' is
 
2482
required, except when creating a convenience library.
 
2483
 
 
2484
If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
 
2485
using \`ar' and \`ranlib', or on Windows using \`lib'.
 
2486
 
 
2487
If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
 
2488
is created, otherwise an executable program is created."
 
2489
        ;;
 
2490
 
 
2491
      uninstall)
 
2492
        $ECHO \
 
2493
"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
 
2494
 
 
2495
Remove libraries from an installation directory.
 
2496
 
 
2497
RM is the name of the program to use to delete files associated with each FILE
 
2498
(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
 
2499
to RM.
 
2500
 
 
2501
If FILE is a libtool library, all the files associated with it are deleted.
 
2502
Otherwise, only FILE itself is deleted using RM."
 
2503
        ;;
 
2504
 
 
2505
      *)
 
2506
        func_fatal_help "invalid operation mode \`$opt_mode'"
 
2507
        ;;
 
2508
    esac
 
2509
 
 
2510
    echo
 
2511
    $ECHO "Try \`$progname --help' for more information about other modes."
 
2512
}
 
2513
 
 
2514
# Now that we've collected a possible --mode arg, show help if necessary
 
2515
if $opt_help; then
 
2516
  if test "$opt_help" = :; then
 
2517
    func_mode_help
 
2518
  else
 
2519
    {
 
2520
      func_help noexit
 
2521
      for opt_mode in compile link execute install finish uninstall clean; do
 
2522
        func_mode_help
 
2523
      done
 
2524
    } | sed -n '1p; 2,$s/^Usage:/  or: /p'
 
2525
    {
 
2526
      func_help noexit
 
2527
      for opt_mode in compile link execute install finish uninstall clean; do
 
2528
        echo
 
2529
        func_mode_help
 
2530
      done
 
2531
    } |
 
2532
    sed '1d
 
2533
      /^When reporting/,/^Report/{
 
2534
        H
 
2535
        d
 
2536
      }
 
2537
      $x
 
2538
      /information about other modes/d
 
2539
      /more detailed .*MODE/d
 
2540
      s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
 
2541
  fi
 
2542
  exit $?
 
2543
fi
 
2544
 
 
2545
 
 
2546
# func_mode_execute arg...
 
2547
func_mode_execute ()
 
2548
{
 
2549
    $opt_debug
 
2550
    # The first argument is the command name.
 
2551
    cmd="$nonopt"
 
2552
    test -z "$cmd" && \
 
2553
      func_fatal_help "you must specify a COMMAND"
 
2554
 
 
2555
    # Handle -dlopen flags immediately.
 
2556
    for file in $opt_dlopen; do
 
2557
      test -f "$file" \
 
2558
        || func_fatal_help "\`$file' is not a file"
 
2559
 
 
2560
      dir=
 
2561
      case $file in
 
2562
      *.la)
 
2563
        func_resolve_sysroot "$file"
 
2564
        file=$func_resolve_sysroot_result
 
2565
 
 
2566
        # Check to see that this really is a libtool archive.
 
2567
        func_lalib_unsafe_p "$file" \
 
2568
          || func_fatal_help "\`$lib' is not a valid libtool archive"
 
2569
 
 
2570
        # Read the libtool library.
 
2571
        dlname=
 
2572
        library_names=
 
2573
        func_source "$file"
 
2574
 
 
2575
        # Skip this library if it cannot be dlopened.
 
2576
        if test -z "$dlname"; then
 
2577
          # Warn if it was a shared library.
 
2578
          test -n "$library_names" && \
 
2579
            func_warning "\`$file' was not linked with \`-export-dynamic'"
 
2580
          continue
 
2581
        fi
 
2582
 
 
2583
        func_dirname "$file" "" "."
 
2584
        dir="$func_dirname_result"
 
2585
 
 
2586
        if test -f "$dir/$objdir/$dlname"; then
 
2587
          func_append dir "/$objdir"
 
2588
        else
 
2589
          if test ! -f "$dir/$dlname"; then
 
2590
            func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
 
2591
          fi
 
2592
        fi
 
2593
        ;;
 
2594
 
 
2595
      *.lo)
 
2596
        # Just add the directory containing the .lo file.
 
2597
        func_dirname "$file" "" "."
 
2598
        dir="$func_dirname_result"
 
2599
        ;;
 
2600
 
 
2601
      *)
 
2602
        func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
 
2603
        continue
 
2604
        ;;
 
2605
      esac
 
2606
 
 
2607
      # Get the absolute pathname.
 
2608
      absdir=`cd "$dir" && pwd`
 
2609
      test -n "$absdir" && dir="$absdir"
 
2610
 
 
2611
      # Now add the directory to shlibpath_var.
 
2612
      if eval "test -z \"\$$shlibpath_var\""; then
 
2613
        eval "$shlibpath_var=\"\$dir\""
 
2614
      else
 
2615
        eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
 
2616
      fi
 
2617
    done
 
2618
 
 
2619
    # This variable tells wrapper scripts just to set shlibpath_var
 
2620
    # rather than running their programs.
 
2621
    libtool_execute_magic="$magic"
 
2622
 
 
2623
    # Check if any of the arguments is a wrapper script.
 
2624
    args=
 
2625
    for file
 
2626
    do
 
2627
      case $file in
 
2628
      -* | *.la | *.lo ) ;;
 
2629
      *)
 
2630
        # Do a test to see if this is really a libtool program.
 
2631
        if func_ltwrapper_script_p "$file"; then
 
2632
          func_source "$file"
 
2633
          # Transform arg to wrapped name.
 
2634
          file="$progdir/$program"
 
2635
        elif func_ltwrapper_executable_p "$file"; then
 
2636
          func_ltwrapper_scriptname "$file"
 
2637
          func_source "$func_ltwrapper_scriptname_result"
 
2638
          # Transform arg to wrapped name.
 
2639
          file="$progdir/$program"
 
2640
        fi
 
2641
        ;;
 
2642
      esac
 
2643
      # Quote arguments (to preserve shell metacharacters).
 
2644
      func_append_quoted args "$file"
 
2645
    done
 
2646
 
 
2647
    if test "X$opt_dry_run" = Xfalse; then
 
2648
      if test -n "$shlibpath_var"; then
 
2649
        # Export the shlibpath_var.
 
2650
        eval "export $shlibpath_var"
 
2651
      fi
 
2652
 
 
2653
      # Restore saved environment variables
 
2654
      for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
 
2655
      do
 
2656
        eval "if test \"\${save_$lt_var+set}\" = set; then
 
2657
                $lt_var=\$save_$lt_var; export $lt_var
 
2658
              else
 
2659
                $lt_unset $lt_var
 
2660
              fi"
 
2661
      done
 
2662
 
 
2663
      # Now prepare to actually exec the command.
 
2664
      exec_cmd="\$cmd$args"
 
2665
    else
 
2666
      # Display what would be done.
 
2667
      if test -n "$shlibpath_var"; then
 
2668
        eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
 
2669
        echo "export $shlibpath_var"
 
2670
      fi
 
2671
      $ECHO "$cmd$args"
 
2672
      exit $EXIT_SUCCESS
 
2673
    fi
 
2674
}
 
2675
 
 
2676
test "$opt_mode" = execute && func_mode_execute ${1+"$@"}
 
2677
 
 
2678
 
 
2679
# func_mode_finish arg...
 
2680
func_mode_finish ()
 
2681
{
 
2682
    $opt_debug
 
2683
    libs=
 
2684
    libdirs=
 
2685
    admincmds=
 
2686
 
 
2687
    for opt in "$nonopt" ${1+"$@"}
 
2688
    do
 
2689
      if test -d "$opt"; then
 
2690
        func_append libdirs " $opt"
 
2691
 
 
2692
      elif test -f "$opt"; then
 
2693
        if func_lalib_unsafe_p "$opt"; then
 
2694
          func_append libs " $opt"
 
2695
        else
 
2696
          func_warning "\`$opt' is not a valid libtool archive"
 
2697
        fi
 
2698
 
 
2699
      else
 
2700
        func_fatal_error "invalid argument \`$opt'"
 
2701
      fi
 
2702
    done
 
2703
 
 
2704
    if test -n "$libs"; then
 
2705
      if test -n "$lt_sysroot"; then
 
2706
        sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
 
2707
        sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
 
2708
      else
 
2709
        sysroot_cmd=
 
2710
      fi
 
2711
 
 
2712
      # Remove sysroot references
 
2713
      if $opt_dry_run; then
 
2714
        for lib in $libs; do
 
2715
          echo "removing references to $lt_sysroot and \`=' prefixes from $lib"
 
2716
        done
 
2717
      else
 
2718
        tmpdir=`func_mktempdir`
 
2719
        for lib in $libs; do
 
2720
          sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
 
2721
            > $tmpdir/tmp-la
 
2722
          mv -f $tmpdir/tmp-la $lib
 
2723
        done
 
2724
        ${RM}r "$tmpdir"
 
2725
      fi
 
2726
    fi
 
2727
 
 
2728
    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
 
2729
      for libdir in $libdirs; do
 
2730
        if test -n "$finish_cmds"; then
 
2731
          # Do each command in the finish commands.
 
2732
          func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
 
2733
'"$cmd"'"'
 
2734
        fi
 
2735
        if test -n "$finish_eval"; then
 
2736
          # Do the single finish_eval.
 
2737
          eval cmds=\"$finish_eval\"
 
2738
          $opt_dry_run || eval "$cmds" || func_append admincmds "
 
2739
       $cmds"
 
2740
        fi
 
2741
      done
 
2742
    fi
 
2743
 
 
2744
    # Exit here if they wanted silent mode.
 
2745
    $opt_silent && exit $EXIT_SUCCESS
 
2746
 
 
2747
    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
 
2748
      echo "----------------------------------------------------------------------"
 
2749
      echo "Libraries have been installed in:"
 
2750
      for libdir in $libdirs; do
 
2751
        $ECHO "   $libdir"
 
2752
      done
 
2753
      echo
 
2754
      echo "If you ever happen to want to link against installed libraries"
 
2755
      echo "in a given directory, LIBDIR, you must either use libtool, and"
 
2756
      echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
 
2757
      echo "flag during linking and do at least one of the following:"
 
2758
      if test -n "$shlibpath_var"; then
 
2759
        echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
 
2760
        echo "     during execution"
 
2761
      fi
 
2762
      if test -n "$runpath_var"; then
 
2763
        echo "   - add LIBDIR to the \`$runpath_var' environment variable"
 
2764
        echo "     during linking"
 
2765
      fi
 
2766
      if test -n "$hardcode_libdir_flag_spec"; then
 
2767
        libdir=LIBDIR
 
2768
        eval flag=\"$hardcode_libdir_flag_spec\"
 
2769
 
 
2770
        $ECHO "   - use the \`$flag' linker flag"
 
2771
      fi
 
2772
      if test -n "$admincmds"; then
 
2773
        $ECHO "   - have your system administrator run these commands:$admincmds"
 
2774
      fi
 
2775
      if test -f /etc/ld.so.conf; then
 
2776
        echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
 
2777
      fi
 
2778
      echo
 
2779
 
 
2780
      echo "See any operating system documentation about shared libraries for"
 
2781
      case $host in
 
2782
        solaris2.[6789]|solaris2.1[0-9])
 
2783
          echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
 
2784
          echo "pages."
 
2785
          ;;
 
2786
        *)
 
2787
          echo "more information, such as the ld(1) and ld.so(8) manual pages."
 
2788
          ;;
 
2789
      esac
 
2790
      echo "----------------------------------------------------------------------"
 
2791
    fi
 
2792
    exit $EXIT_SUCCESS
 
2793
}
 
2794
 
 
2795
test "$opt_mode" = finish && func_mode_finish ${1+"$@"}
 
2796
 
 
2797
 
 
2798
# func_mode_install arg...
 
2799
func_mode_install ()
 
2800
{
 
2801
    $opt_debug
 
2802
    # There may be an optional sh(1) argument at the beginning of
 
2803
    # install_prog (especially on Windows NT).
 
2804
    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
 
2805
       # Allow the use of GNU shtool's install command.
 
2806
       case $nonopt in *shtool*) :;; *) false;; esac; then
 
2807
      # Aesthetically quote it.
 
2808
      func_quote_for_eval "$nonopt"
 
2809
      install_prog="$func_quote_for_eval_result "
 
2810
      arg=$1
 
2811
      shift
 
2812
    else
 
2813
      install_prog=
 
2814
      arg=$nonopt
 
2815
    fi
 
2816
 
 
2817
    # The real first argument should be the name of the installation program.
 
2818
    # Aesthetically quote it.
 
2819
    func_quote_for_eval "$arg"
 
2820
    func_append install_prog "$func_quote_for_eval_result"
 
2821
    install_shared_prog=$install_prog
 
2822
    case " $install_prog " in
 
2823
      *[\\\ /]cp\ *) install_cp=: ;;
 
2824
      *) install_cp=false ;;
 
2825
    esac
 
2826
 
 
2827
    # We need to accept at least all the BSD install flags.
 
2828
    dest=
 
2829
    files=
 
2830
    opts=
 
2831
    prev=
 
2832
    install_type=
 
2833
    isdir=no
 
2834
    stripme=
 
2835
    no_mode=:
 
2836
    for arg
 
2837
    do
 
2838
      arg2=
 
2839
      if test -n "$dest"; then
 
2840
        func_append files " $dest"
 
2841
        dest=$arg
 
2842
        continue
 
2843
      fi
 
2844
 
 
2845
      case $arg in
 
2846
      -d) isdir=yes ;;
 
2847
      -f)
 
2848
        if $install_cp; then :; else
 
2849
          prev=$arg
 
2850
        fi
 
2851
        ;;
 
2852
      -g | -m | -o)
 
2853
        prev=$arg
 
2854
        ;;
 
2855
      -s)
 
2856
        stripme=" -s"
 
2857
        continue
 
2858
        ;;
 
2859
      -*)
 
2860
        ;;
 
2861
      *)
 
2862
        # If the previous option needed an argument, then skip it.
 
2863
        if test -n "$prev"; then
 
2864
          if test "x$prev" = x-m && test -n "$install_override_mode"; then
 
2865
            arg2=$install_override_mode
 
2866
            no_mode=false
 
2867
          fi
 
2868
          prev=
 
2869
        else
 
2870
          dest=$arg
 
2871
          continue
 
2872
        fi
 
2873
        ;;
 
2874
      esac
 
2875
 
 
2876
      # Aesthetically quote the argument.
 
2877
      func_quote_for_eval "$arg"
 
2878
      func_append install_prog " $func_quote_for_eval_result"
 
2879
      if test -n "$arg2"; then
 
2880
        func_quote_for_eval "$arg2"
 
2881
      fi
 
2882
      func_append install_shared_prog " $func_quote_for_eval_result"
 
2883
    done
 
2884
 
 
2885
    test -z "$install_prog" && \
 
2886
      func_fatal_help "you must specify an install program"
 
2887
 
 
2888
    test -n "$prev" && \
 
2889
      func_fatal_help "the \`$prev' option requires an argument"
 
2890
 
 
2891
    if test -n "$install_override_mode" && $no_mode; then
 
2892
      if $install_cp; then :; else
 
2893
        func_quote_for_eval "$install_override_mode"
 
2894
        func_append install_shared_prog " -m $func_quote_for_eval_result"
 
2895
      fi
 
2896
    fi
 
2897
 
 
2898
    if test -z "$files"; then
 
2899
      if test -z "$dest"; then
 
2900
        func_fatal_help "no file or destination specified"
 
2901
      else
 
2902
        func_fatal_help "you must specify a destination"
 
2903
      fi
 
2904
    fi
 
2905
 
 
2906
    # Strip any trailing slash from the destination.
 
2907
    func_stripname '' '/' "$dest"
 
2908
    dest=$func_stripname_result
 
2909
 
 
2910
    # Check to see that the destination is a directory.
 
2911
    test -d "$dest" && isdir=yes
 
2912
    if test "$isdir" = yes; then
 
2913
      destdir="$dest"
 
2914
      destname=
 
2915
    else
 
2916
      func_dirname_and_basename "$dest" "" "."
 
2917
      destdir="$func_dirname_result"
 
2918
      destname="$func_basename_result"
 
2919
 
 
2920
      # Not a directory, so check to see that there is only one file specified.
 
2921
      set dummy $files; shift
 
2922
      test "$#" -gt 1 && \
 
2923
        func_fatal_help "\`$dest' is not a directory"
 
2924
    fi
 
2925
    case $destdir in
 
2926
    [\\/]* | [A-Za-z]:[\\/]*) ;;
 
2927
    *)
 
2928
      for file in $files; do
 
2929
        case $file in
 
2930
        *.lo) ;;
 
2931
        *)
 
2932
          func_fatal_help "\`$destdir' must be an absolute directory name"
 
2933
          ;;
 
2934
        esac
 
2935
      done
 
2936
      ;;
 
2937
    esac
 
2938
 
 
2939
    # This variable tells wrapper scripts just to set variables rather
 
2940
    # than running their programs.
 
2941
    libtool_install_magic="$magic"
 
2942
 
 
2943
    staticlibs=
 
2944
    future_libdirs=
 
2945
    current_libdirs=
 
2946
    for file in $files; do
 
2947
 
 
2948
      # Do each installation.
 
2949
      case $file in
 
2950
      *.$libext)
 
2951
        # Do the static libraries later.
 
2952
        func_append staticlibs " $file"
 
2953
        ;;
 
2954
 
 
2955
      *.la)
 
2956
        func_resolve_sysroot "$file"
 
2957
        file=$func_resolve_sysroot_result
 
2958
 
 
2959
        # Check to see that this really is a libtool archive.
 
2960
        func_lalib_unsafe_p "$file" \
 
2961
          || func_fatal_help "\`$file' is not a valid libtool archive"
 
2962
 
 
2963
        library_names=
 
2964
        old_library=
 
2965
        relink_command=
 
2966
        func_source "$file"
 
2967
 
 
2968
        # Add the libdir to current_libdirs if it is the destination.
 
2969
        if test "X$destdir" = "X$libdir"; then
 
2970
          case "$current_libdirs " in
 
2971
          *" $libdir "*) ;;
 
2972
          *) func_append current_libdirs " $libdir" ;;
 
2973
          esac
 
2974
        else
 
2975
          # Note the libdir as a future libdir.
 
2976
          case "$future_libdirs " in
 
2977
          *" $libdir "*) ;;
 
2978
          *) func_append future_libdirs " $libdir" ;;
 
2979
          esac
 
2980
        fi
 
2981
 
 
2982
        func_dirname "$file" "/" ""
 
2983
        dir="$func_dirname_result"
 
2984
        func_append dir "$objdir"
 
2985
 
 
2986
        if test -n "$relink_command"; then
 
2987
          # Determine the prefix the user has applied to our future dir.
 
2988
          inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
 
2989
 
 
2990
          # Don't allow the user to place us outside of our expected
 
2991
          # location b/c this prevents finding dependent libraries that
 
2992
          # are installed to the same prefix.
 
2993
          # At present, this check doesn't affect windows .dll's that
 
2994
          # are installed into $libdir/../bin (currently, that works fine)
 
2995
          # but it's something to keep an eye on.
 
2996
          test "$inst_prefix_dir" = "$destdir" && \
 
2997
            func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
 
2998
 
 
2999
          if test -n "$inst_prefix_dir"; then
 
3000
            # Stick the inst_prefix_dir data into the link command.
 
3001
            relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
 
3002
          else
 
3003
            relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
 
3004
          fi
 
3005
 
 
3006
          func_warning "relinking \`$file'"
 
3007
          func_show_eval "$relink_command" \
 
3008
            'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
 
3009
        fi
 
3010
 
 
3011
        # See the names of the shared library.
 
3012
        set dummy $library_names; shift
 
3013
        if test -n "$1"; then
 
3014
          realname="$1"
 
3015
          shift
 
3016
 
 
3017
          srcname="$realname"
 
3018
          test -n "$relink_command" && srcname="$realname"T
 
3019
 
 
3020
          # Install the shared library and build the symlinks.
 
3021
          func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
 
3022
              'exit $?'
 
3023
          tstripme="$stripme"
 
3024
          case $host_os in
 
3025
          cygwin* | mingw* | pw32* | cegcc*)
 
3026
            case $realname in
 
3027
            *.dll.a)
 
3028
              tstripme=""
 
3029
              ;;
 
3030
            esac
 
3031
            ;;
 
3032
          esac
 
3033
          if test -n "$tstripme" && test -n "$striplib"; then
 
3034
            func_show_eval "$striplib $destdir/$realname" 'exit $?'
 
3035
          fi
 
3036
 
 
3037
          if test "$#" -gt 0; then
 
3038
            # Delete the old symlinks, and create new ones.
 
3039
            # Try `ln -sf' first, because the `ln' binary might depend on
 
3040
            # the symlink we replace!  Solaris /bin/ln does not understand -f,
 
3041
            # so we also need to try rm && ln -s.
 
3042
            for linkname
 
3043
            do
 
3044
              test "$linkname" != "$realname" \
 
3045
                && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
 
3046
            done
 
3047
          fi
 
3048
 
 
3049
          # Do each command in the postinstall commands.
 
3050
          lib="$destdir/$realname"
 
3051
          func_execute_cmds "$postinstall_cmds" 'exit $?'
 
3052
        fi
 
3053
 
 
3054
        # Install the pseudo-library for information purposes.
 
3055
        func_basename "$file"
 
3056
        name="$func_basename_result"
 
3057
        instname="$dir/$name"i
 
3058
        func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
 
3059
 
 
3060
        # Maybe install the static library, too.
 
3061
        test -n "$old_library" && func_append staticlibs " $dir/$old_library"
 
3062
        ;;
 
3063
 
 
3064
      *.lo)
 
3065
        # Install (i.e. copy) a libtool object.
 
3066
 
 
3067
        # Figure out destination file name, if it wasn't already specified.
 
3068
        if test -n "$destname"; then
 
3069
          destfile="$destdir/$destname"
 
3070
        else
 
3071
          func_basename "$file"
 
3072
          destfile="$func_basename_result"
 
3073
          destfile="$destdir/$destfile"
 
3074
        fi
 
3075
 
 
3076
        # Deduce the name of the destination old-style object file.
 
3077
        case $destfile in
 
3078
        *.lo)
 
3079
          func_lo2o "$destfile"
 
3080
          staticdest=$func_lo2o_result
 
3081
          ;;
 
3082
        *.$objext)
 
3083
          staticdest="$destfile"
 
3084
          destfile=
 
3085
          ;;
 
3086
        *)
 
3087
          func_fatal_help "cannot copy a libtool object to \`$destfile'"
 
3088
          ;;
 
3089
        esac
 
3090
 
 
3091
        # Install the libtool object if requested.
 
3092
        test -n "$destfile" && \
 
3093
          func_show_eval "$install_prog $file $destfile" 'exit $?'
 
3094
 
 
3095
        # Install the old object if enabled.
 
3096
        if test "$build_old_libs" = yes; then
 
3097
          # Deduce the name of the old-style object file.
 
3098
          func_lo2o "$file"
 
3099
          staticobj=$func_lo2o_result
 
3100
          func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
 
3101
        fi
 
3102
        exit $EXIT_SUCCESS
 
3103
        ;;
 
3104
 
 
3105
      *)
 
3106
        # Figure out destination file name, if it wasn't already specified.
 
3107
        if test -n "$destname"; then
 
3108
          destfile="$destdir/$destname"
 
3109
        else
 
3110
          func_basename "$file"
 
3111
          destfile="$func_basename_result"
 
3112
          destfile="$destdir/$destfile"
 
3113
        fi
 
3114
 
 
3115
        # If the file is missing, and there is a .exe on the end, strip it
 
3116
        # because it is most likely a libtool script we actually want to
 
3117
        # install
 
3118
        stripped_ext=""
 
3119
        case $file in
 
3120
          *.exe)
 
3121
            if test ! -f "$file"; then
 
3122
              func_stripname '' '.exe' "$file"
 
3123
              file=$func_stripname_result
 
3124
              stripped_ext=".exe"
 
3125
            fi
 
3126
            ;;
 
3127
        esac
 
3128
 
 
3129
        # Do a test to see if this is really a libtool program.
 
3130
        case $host in
 
3131
        *cygwin* | *mingw*)
 
3132
            if func_ltwrapper_executable_p "$file"; then
 
3133
              func_ltwrapper_scriptname "$file"
 
3134
              wrapper=$func_ltwrapper_scriptname_result
 
3135
            else
 
3136
              func_stripname '' '.exe' "$file"
 
3137
              wrapper=$func_stripname_result
 
3138
            fi
 
3139
            ;;
 
3140
        *)
 
3141
            wrapper=$file
 
3142
            ;;
 
3143
        esac
 
3144
        if func_ltwrapper_script_p "$wrapper"; then
 
3145
          notinst_deplibs=
 
3146
          relink_command=
 
3147
 
 
3148
          func_source "$wrapper"
 
3149
 
 
3150
          # Check the variables that should have been set.
 
3151
          test -z "$generated_by_libtool_version" && \
 
3152
            func_fatal_error "invalid libtool wrapper script \`$wrapper'"
 
3153
 
 
3154
          finalize=yes
 
3155
          for lib in $notinst_deplibs; do
 
3156
            # Check to see that each library is installed.
 
3157
            libdir=
 
3158
            if test -f "$lib"; then
 
3159
              func_source "$lib"
 
3160
            fi
 
3161
            libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test
 
3162
            if test -n "$libdir" && test ! -f "$libfile"; then
 
3163
              func_warning "\`$lib' has not been installed in \`$libdir'"
 
3164
              finalize=no
 
3165
            fi
 
3166
          done
 
3167
 
 
3168
          relink_command=
 
3169
          func_source "$wrapper"
 
3170
 
 
3171
          outputname=
 
3172
          if test "$fast_install" = no && test -n "$relink_command"; then
 
3173
            $opt_dry_run || {
 
3174
              if test "$finalize" = yes; then
 
3175
                tmpdir=`func_mktempdir`
 
3176
                func_basename "$file$stripped_ext"
 
3177
                file="$func_basename_result"
 
3178
                outputname="$tmpdir/$file"
 
3179
                # Replace the output file specification.
 
3180
                relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
 
3181
 
 
3182
                $opt_silent || {
 
3183
                  func_quote_for_expand "$relink_command"
 
3184
                  eval "func_echo $func_quote_for_expand_result"
 
3185
                }
 
3186
                if eval "$relink_command"; then :
 
3187
                  else
 
3188
                  func_error "error: relink \`$file' with the above command before installing it"
 
3189
                  $opt_dry_run || ${RM}r "$tmpdir"
 
3190
                  continue
 
3191
                fi
 
3192
                file="$outputname"
 
3193
              else
 
3194
                func_warning "cannot relink \`$file'"
 
3195
              fi
 
3196
            }
 
3197
          else
 
3198
            # Install the binary that we compiled earlier.
 
3199
            file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
 
3200
          fi
 
3201
        fi
 
3202
 
 
3203
        # remove .exe since cygwin /usr/bin/install will append another
 
3204
        # one anyway
 
3205
        case $install_prog,$host in
 
3206
        */usr/bin/install*,*cygwin*)
 
3207
          case $file:$destfile in
 
3208
          *.exe:*.exe)
 
3209
            # this is ok
 
3210
            ;;
 
3211
          *.exe:*)
 
3212
            destfile=$destfile.exe
 
3213
            ;;
 
3214
          *:*.exe)
 
3215
            func_stripname '' '.exe' "$destfile"
 
3216
            destfile=$func_stripname_result
 
3217
            ;;
 
3218
          esac
 
3219
          ;;
 
3220
        esac
 
3221
        func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
 
3222
        $opt_dry_run || if test -n "$outputname"; then
 
3223
          ${RM}r "$tmpdir"
 
3224
        fi
 
3225
        ;;
 
3226
      esac
 
3227
    done
 
3228
 
 
3229
    for file in $staticlibs; do
 
3230
      func_basename "$file"
 
3231
      name="$func_basename_result"
 
3232
 
 
3233
      # Set up the ranlib parameters.
 
3234
      oldlib="$destdir/$name"
 
3235
      func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
 
3236
      tool_oldlib=$func_to_tool_file_result
 
3237
 
 
3238
      func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
 
3239
 
 
3240
      if test -n "$stripme" && test -n "$old_striplib"; then
 
3241
        func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
 
3242
      fi
 
3243
 
 
3244
      # Do each command in the postinstall commands.
 
3245
      func_execute_cmds "$old_postinstall_cmds" 'exit $?'
 
3246
    done
 
3247
 
 
3248
    test -n "$future_libdirs" && \
 
3249
      func_warning "remember to run \`$progname --finish$future_libdirs'"
 
3250
 
 
3251
    if test -n "$current_libdirs"; then
 
3252
      # Maybe just do a dry run.
 
3253
      $opt_dry_run && current_libdirs=" -n$current_libdirs"
 
3254
      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
 
3255
    else
 
3256
      exit $EXIT_SUCCESS
 
3257
    fi
 
3258
}
 
3259
 
 
3260
test "$opt_mode" = install && func_mode_install ${1+"$@"}
 
3261
 
 
3262
 
 
3263
# func_generate_dlsyms outputname originator pic_p
 
3264
# Extract symbols from dlprefiles and create ${outputname}S.o with
 
3265
# a dlpreopen symbol table.
 
3266
func_generate_dlsyms ()
 
3267
{
 
3268
    $opt_debug
 
3269
    my_outputname="$1"
 
3270
    my_originator="$2"
 
3271
    my_pic_p="${3-no}"
 
3272
    my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
 
3273
    my_dlsyms=
 
3274
 
 
3275
    if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
 
3276
      if test -n "$NM" && test -n "$global_symbol_pipe"; then
 
3277
        my_dlsyms="${my_outputname}S.c"
 
3278
      else
 
3279
        func_error "not configured to extract global symbols from dlpreopened files"
 
3280
      fi
 
3281
    fi
 
3282
 
 
3283
    if test -n "$my_dlsyms"; then
 
3284
      case $my_dlsyms in
 
3285
      "") ;;
 
3286
      *.c)
 
3287
        # Discover the nlist of each of the dlfiles.
 
3288
        nlist="$output_objdir/${my_outputname}.nm"
 
3289
 
 
3290
        func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
 
3291
 
 
3292
        # Parse the name list into a source file.
 
3293
        func_verbose "creating $output_objdir/$my_dlsyms"
 
3294
 
 
3295
        $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
 
3296
/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
 
3297
/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
 
3298
 
 
3299
#ifdef __cplusplus
 
3300
extern \"C\" {
 
3301
#endif
 
3302
 
 
3303
#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
 
3304
#pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
 
3305
#endif
 
3306
 
 
3307
/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
 
3308
#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
 
3309
/* DATA imports from DLLs on WIN32 con't be const, because runtime
 
3310
   relocations are performed -- see ld's documentation on pseudo-relocs.  */
 
3311
# define LT_DLSYM_CONST
 
3312
#elif defined(__osf__)
 
3313
/* This system does not cope well with relocations in const data.  */
 
3314
# define LT_DLSYM_CONST
 
3315
#else
 
3316
# define LT_DLSYM_CONST const
 
3317
#endif
 
3318
 
 
3319
/* External symbol declarations for the compiler. */\
 
3320
"
 
3321
 
 
3322
        if test "$dlself" = yes; then
 
3323
          func_verbose "generating symbol list for \`$output'"
 
3324
 
 
3325
          $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
 
3326
 
 
3327
          # Add our own program objects to the symbol list.
 
3328
          progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
 
3329
          for progfile in $progfiles; do
 
3330
            func_to_tool_file "$progfile" func_convert_file_msys_to_w32
 
3331
            func_verbose "extracting global C symbols from \`$func_to_tool_file_result'"
 
3332
            $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
 
3333
          done
 
3334
 
 
3335
          if test -n "$exclude_expsyms"; then
 
3336
            $opt_dry_run || {
 
3337
              eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
 
3338
              eval '$MV "$nlist"T "$nlist"'
 
3339
            }
 
3340
          fi
 
3341
 
 
3342
          if test -n "$export_symbols_regex"; then
 
3343
            $opt_dry_run || {
 
3344
              eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
 
3345
              eval '$MV "$nlist"T "$nlist"'
 
3346
            }
 
3347
          fi
 
3348
 
 
3349
          # Prepare the list of exported symbols
 
3350
          if test -z "$export_symbols"; then
 
3351
            export_symbols="$output_objdir/$outputname.exp"
 
3352
            $opt_dry_run || {
 
3353
              $RM $export_symbols
 
3354
              eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
 
3355
              case $host in
 
3356
              *cygwin* | *mingw* | *cegcc* )
 
3357
                eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
 
3358
                eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
 
3359
                ;;
 
3360
              esac
 
3361
            }
 
3362
          else
 
3363
            $opt_dry_run || {
 
3364
              eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
 
3365
              eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
 
3366
              eval '$MV "$nlist"T "$nlist"'
 
3367
              case $host in
 
3368
                *cygwin* | *mingw* | *cegcc* )
 
3369
                  eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
 
3370
                  eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
 
3371
                  ;;
 
3372
              esac
 
3373
            }
 
3374
          fi
 
3375
        fi
 
3376
 
 
3377
        for dlprefile in $dlprefiles; do
 
3378
          func_verbose "extracting global C symbols from \`$dlprefile'"
 
3379
          func_basename "$dlprefile"
 
3380
          name="$func_basename_result"
 
3381
          case $host in
 
3382
            *cygwin* | *mingw* | *cegcc* )
 
3383
              # if an import library, we need to obtain dlname
 
3384
              if func_win32_import_lib_p "$dlprefile"; then
 
3385
                func_tr_sh "$dlprefile"
 
3386
                eval "curr_lafile=\$libfile_$func_tr_sh_result"
 
3387
                dlprefile_dlbasename=""
 
3388
                if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
 
3389
                  # Use subshell, to avoid clobbering current variable values
 
3390
                  dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
 
3391
                  if test -n "$dlprefile_dlname" ; then
 
3392
                    func_basename "$dlprefile_dlname"
 
3393
                    dlprefile_dlbasename="$func_basename_result"
 
3394
                  else
 
3395
                    # no lafile. user explicitly requested -dlpreopen <import library>.
 
3396
                    $sharedlib_from_linklib_cmd "$dlprefile"
 
3397
                    dlprefile_dlbasename=$sharedlib_from_linklib_result
 
3398
                  fi
 
3399
                fi
 
3400
                $opt_dry_run || {
 
3401
                  if test -n "$dlprefile_dlbasename" ; then
 
3402
                    eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
 
3403
                  else
 
3404
                    func_warning "Could not compute DLL name from $name"
 
3405
                    eval '$ECHO ": $name " >> "$nlist"'
 
3406
                  fi
 
3407
                  func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
 
3408
                  eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
 
3409
                    $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
 
3410
                }
 
3411
              else # not an import lib
 
3412
                $opt_dry_run || {
 
3413
                  eval '$ECHO ": $name " >> "$nlist"'
 
3414
                  func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
 
3415
                  eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
 
3416
                }
 
3417
              fi
 
3418
            ;;
 
3419
            *)
 
3420
              $opt_dry_run || {
 
3421
                eval '$ECHO ": $name " >> "$nlist"'
 
3422
                func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
 
3423
                eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
 
3424
              }
 
3425
            ;;
 
3426
          esac
 
3427
        done
 
3428
 
 
3429
        $opt_dry_run || {
 
3430
          # Make sure we have at least an empty file.
 
3431
          test -f "$nlist" || : > "$nlist"
 
3432
 
 
3433
          if test -n "$exclude_expsyms"; then
 
3434
            $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
 
3435
            $MV "$nlist"T "$nlist"
 
3436
          fi
 
3437
 
 
3438
          # Try sorting and uniquifying the output.
 
3439
          if $GREP -v "^: " < "$nlist" |
 
3440
              if sort -k 3 </dev/null >/dev/null 2>&1; then
 
3441
                sort -k 3
 
3442
              else
 
3443
                sort +2
 
3444
              fi |
 
3445
              uniq > "$nlist"S; then
 
3446
            :
 
3447
          else
 
3448
            $GREP -v "^: " < "$nlist" > "$nlist"S
 
3449
          fi
 
3450
 
 
3451
          if test -f "$nlist"S; then
 
3452
            eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
 
3453
          else
 
3454
            echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
 
3455
          fi
 
3456
 
 
3457
          echo >> "$output_objdir/$my_dlsyms" "\
 
3458
 
 
3459
/* The mapping between symbol names and symbols.  */
 
3460
typedef struct {
 
3461
  const char *name;
 
3462
  void *address;
 
3463
} lt_dlsymlist;
 
3464
extern LT_DLSYM_CONST lt_dlsymlist
 
3465
lt_${my_prefix}_LTX_preloaded_symbols[];
 
3466
LT_DLSYM_CONST lt_dlsymlist
 
3467
lt_${my_prefix}_LTX_preloaded_symbols[] =
 
3468
{\
 
3469
  { \"$my_originator\", (void *) 0 },"
 
3470
 
 
3471
          case $need_lib_prefix in
 
3472
          no)
 
3473
            eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
 
3474
            ;;
 
3475
          *)
 
3476
            eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
 
3477
            ;;
 
3478
          esac
 
3479
          echo >> "$output_objdir/$my_dlsyms" "\
 
3480
  {0, (void *) 0}
 
3481
};
 
3482
 
 
3483
/* This works around a problem in FreeBSD linker */
 
3484
#ifdef FREEBSD_WORKAROUND
 
3485
static const void *lt_preloaded_setup() {
 
3486
  return lt_${my_prefix}_LTX_preloaded_symbols;
 
3487
}
 
3488
#endif
 
3489
 
 
3490
#ifdef __cplusplus
 
3491
}
 
3492
#endif\
 
3493
"
 
3494
        } # !$opt_dry_run
 
3495
 
 
3496
        pic_flag_for_symtable=
 
3497
        case "$compile_command " in
 
3498
        *" -static "*) ;;
 
3499
        *)
 
3500
          case $host in
 
3501
          # compiling the symbol table file with pic_flag works around
 
3502
          # a FreeBSD bug that causes programs to crash when -lm is
 
3503
          # linked before any other PIC object.  But we must not use
 
3504
          # pic_flag when linking with -static.  The problem exists in
 
3505
          # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
 
3506
          *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
 
3507
            pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
 
3508
          *-*-hpux*)
 
3509
            pic_flag_for_symtable=" $pic_flag"  ;;
 
3510
          *)
 
3511
            if test "X$my_pic_p" != Xno; then
 
3512
              pic_flag_for_symtable=" $pic_flag"
 
3513
            fi
 
3514
            ;;
 
3515
          esac
 
3516
          ;;
 
3517
        esac
 
3518
        symtab_cflags=
 
3519
        for arg in $LTCFLAGS; do
 
3520
          case $arg in
 
3521
          -pie | -fpie | -fPIE) ;;
 
3522
          *) func_append symtab_cflags " $arg" ;;
 
3523
          esac
 
3524
        done
 
3525
 
 
3526
        # Now compile the dynamic symbol file.
 
3527
        func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
 
3528
 
 
3529
        # Clean up the generated files.
 
3530
        func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
 
3531
 
 
3532
        # Transform the symbol file into the correct name.
 
3533
        symfileobj="$output_objdir/${my_outputname}S.$objext"
 
3534
        case $host in
 
3535
        *cygwin* | *mingw* | *cegcc* )
 
3536
          if test -f "$output_objdir/$my_outputname.def"; then
 
3537
            compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
 
3538
            finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
 
3539
          else
 
3540
            compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
 
3541
            finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
 
3542
          fi
 
3543
          ;;
 
3544
        *)
 
3545
          compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
 
3546
          finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
 
3547
          ;;
 
3548
        esac
 
3549
        ;;
 
3550
      *-*-freebsd*)
 
3551
        # FreeBSD doesn't need this...
 
3552
        ;;
 
3553
      *)
 
3554
        func_fatal_error "unknown suffix for \`$my_dlsyms'"
 
3555
        ;;
 
3556
      esac
 
3557
    else
 
3558
      # We keep going just in case the user didn't refer to
 
3559
      # lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
 
3560
      # really was required.
 
3561
 
 
3562
      # Nullify the symbol file.
 
3563
      compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
 
3564
      finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
 
3565
    fi
 
3566
}
 
3567
 
 
3568
# func_win32_libid arg
 
3569
# return the library type of file 'arg'
 
3570
#
 
3571
# Need a lot of goo to handle *both* DLLs and import libs
 
3572
# Has to be a shell function in order to 'eat' the argument
 
3573
# that is supplied when $file_magic_command is called.
 
3574
# Despite the name, also deal with 64 bit binaries.
 
3575
func_win32_libid ()
 
3576
{
 
3577
  $opt_debug
 
3578
  win32_libid_type="unknown"
 
3579
  win32_fileres=`file -L $1 2>/dev/null`
 
3580
  case $win32_fileres in
 
3581
  *ar\ archive\ import\ library*) # definitely import
 
3582
    win32_libid_type="x86 archive import"
 
3583
    ;;
 
3584
  *ar\ archive*) # could be an import, or static
 
3585
    # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
 
3586
    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
 
3587
       $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
 
3588
      func_to_tool_file "$1" func_convert_file_msys_to_w32
 
3589
      win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
 
3590
        $SED -n -e '
 
3591
            1,100{
 
3592
                / I /{
 
3593
                    s,.*,import,
 
3594
                    p
 
3595
                    q
 
3596
                }
 
3597
            }'`
 
3598
      case $win32_nmres in
 
3599
      import*)  win32_libid_type="x86 archive import";;
 
3600
      *)        win32_libid_type="x86 archive static";;
 
3601
      esac
 
3602
    fi
 
3603
    ;;
 
3604
  *DLL*)
 
3605
    win32_libid_type="x86 DLL"
 
3606
    ;;
 
3607
  *executable*) # but shell scripts are "executable" too...
 
3608
    case $win32_fileres in
 
3609
    *MS\ Windows\ PE\ Intel*)
 
3610
      win32_libid_type="x86 DLL"
 
3611
      ;;
 
3612
    esac
 
3613
    ;;
 
3614
  esac
 
3615
  $ECHO "$win32_libid_type"
 
3616
}
 
3617
 
 
3618
# func_cygming_dll_for_implib ARG
 
3619
#
 
3620
# Platform-specific function to extract the
 
3621
# name of the DLL associated with the specified
 
3622
# import library ARG.
 
3623
# Invoked by eval'ing the libtool variable
 
3624
#    $sharedlib_from_linklib_cmd
 
3625
# Result is available in the variable
 
3626
#    $sharedlib_from_linklib_result
 
3627
func_cygming_dll_for_implib ()
 
3628
{
 
3629
  $opt_debug
 
3630
  sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
 
3631
}
 
3632
 
 
3633
# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
 
3634
#
 
3635
# The is the core of a fallback implementation of a
 
3636
# platform-specific function to extract the name of the
 
3637
# DLL associated with the specified import library LIBNAME.
 
3638
#
 
3639
# SECTION_NAME is either .idata$6 or .idata$7, depending
 
3640
# on the platform and compiler that created the implib.
 
3641
#
 
3642
# Echos the name of the DLL associated with the
 
3643
# specified import library.
 
3644
func_cygming_dll_for_implib_fallback_core ()
 
3645
{
 
3646
  $opt_debug
 
3647
  match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
 
3648
  $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
 
3649
    $SED '/^Contents of section '"$match_literal"':/{
 
3650
      # Place marker at beginning of archive member dllname section
 
3651
      s/.*/====MARK====/
 
3652
      p
 
3653
      d
 
3654
    }
 
3655
    # These lines can sometimes be longer than 43 characters, but
 
3656
    # are always uninteresting
 
3657
    /:[  ]*file format pe[i]\{,1\}-/d
 
3658
    /^In archive [^:]*:/d
 
3659
    # Ensure marker is printed
 
3660
    /^====MARK====/p
 
3661
    # Remove all lines with less than 43 characters
 
3662
    /^.\{43\}/!d
 
3663
    # From remaining lines, remove first 43 characters
 
3664
    s/^.\{43\}//' |
 
3665
    $SED -n '
 
3666
      # Join marker and all lines until next marker into a single line
 
3667
      /^====MARK====/ b para
 
3668
      H
 
3669
      $ b para
 
3670
      b
 
3671
      :para
 
3672
      x
 
3673
      s/\n//g
 
3674
      # Remove the marker
 
3675
      s/^====MARK====//
 
3676
      # Remove trailing dots and whitespace
 
3677
      s/[\. \t]*$//
 
3678
      # Print
 
3679
      /./p' |
 
3680
    # we now have a list, one entry per line, of the stringified
 
3681
    # contents of the appropriate section of all members of the
 
3682
    # archive which possess that section. Heuristic: eliminate
 
3683
    # all those which have a first or second character that is
 
3684
    # a '.' (that is, objdump's representation of an unprintable
 
3685
    # character.) This should work for all archives with less than
 
3686
    # 0x302f exports -- but will fail for DLLs whose name actually
 
3687
    # begins with a literal '.' or a single character followed by
 
3688
    # a '.'.
 
3689
    #
 
3690
    # Of those that remain, print the first one.
 
3691
    $SED -e '/^\./d;/^.\./d;q'
 
3692
}
 
3693
 
 
3694
# func_cygming_gnu_implib_p ARG
 
3695
# This predicate returns with zero status (TRUE) if
 
3696
# ARG is a GNU/binutils-style import library. Returns
 
3697
# with nonzero status (FALSE) otherwise.
 
3698
func_cygming_gnu_implib_p ()
 
3699
{
 
3700
  $opt_debug
 
3701
  func_to_tool_file "$1" func_convert_file_msys_to_w32
 
3702
  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)$'`
 
3703
  test -n "$func_cygming_gnu_implib_tmp"
 
3704
}
 
3705
 
 
3706
# func_cygming_ms_implib_p ARG
 
3707
# This predicate returns with zero status (TRUE) if
 
3708
# ARG is an MS-style import library. Returns
 
3709
# with nonzero status (FALSE) otherwise.
 
3710
func_cygming_ms_implib_p ()
 
3711
{
 
3712
  $opt_debug
 
3713
  func_to_tool_file "$1" func_convert_file_msys_to_w32
 
3714
  func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
 
3715
  test -n "$func_cygming_ms_implib_tmp"
 
3716
}
 
3717
 
 
3718
# func_cygming_dll_for_implib_fallback ARG
 
3719
# Platform-specific function to extract the
 
3720
# name of the DLL associated with the specified
 
3721
# import library ARG.
 
3722
#
 
3723
# This fallback implementation is for use when $DLLTOOL
 
3724
# does not support the --identify-strict option.
 
3725
# Invoked by eval'ing the libtool variable
 
3726
#    $sharedlib_from_linklib_cmd
 
3727
# Result is available in the variable
 
3728
#    $sharedlib_from_linklib_result
 
3729
func_cygming_dll_for_implib_fallback ()
 
3730
{
 
3731
  $opt_debug
 
3732
  if func_cygming_gnu_implib_p "$1" ; then
 
3733
    # binutils import library
 
3734
    sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
 
3735
  elif func_cygming_ms_implib_p "$1" ; then
 
3736
    # ms-generated import library
 
3737
    sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
 
3738
  else
 
3739
    # unknown
 
3740
    sharedlib_from_linklib_result=""
 
3741
  fi
 
3742
}
 
3743
 
 
3744
 
 
3745
# func_extract_an_archive dir oldlib
 
3746
func_extract_an_archive ()
 
3747
{
 
3748
    $opt_debug
 
3749
    f_ex_an_ar_dir="$1"; shift
 
3750
    f_ex_an_ar_oldlib="$1"
 
3751
    if test "$lock_old_archive_extraction" = yes; then
 
3752
      lockfile=$f_ex_an_ar_oldlib.lock
 
3753
      until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
 
3754
        func_echo "Waiting for $lockfile to be removed"
 
3755
        sleep 2
 
3756
      done
 
3757
    fi
 
3758
    func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
 
3759
                   'stat=$?; rm -f "$lockfile"; exit $stat'
 
3760
    if test "$lock_old_archive_extraction" = yes; then
 
3761
      $opt_dry_run || rm -f "$lockfile"
 
3762
    fi
 
3763
    if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
 
3764
     :
 
3765
    else
 
3766
      func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
 
3767
    fi
 
3768
}
 
3769
 
 
3770
 
 
3771
# func_extract_archives gentop oldlib ...
 
3772
func_extract_archives ()
 
3773
{
 
3774
    $opt_debug
 
3775
    my_gentop="$1"; shift
 
3776
    my_oldlibs=${1+"$@"}
 
3777
    my_oldobjs=""
 
3778
    my_xlib=""
 
3779
    my_xabs=""
 
3780
    my_xdir=""
 
3781
 
 
3782
    for my_xlib in $my_oldlibs; do
 
3783
      # Extract the objects.
 
3784
      case $my_xlib in
 
3785
        [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
 
3786
        *) my_xabs=`pwd`"/$my_xlib" ;;
 
3787
      esac
 
3788
      func_basename "$my_xlib"
 
3789
      my_xlib="$func_basename_result"
 
3790
      my_xlib_u=$my_xlib
 
3791
      while :; do
 
3792
        case " $extracted_archives " in
 
3793
        *" $my_xlib_u "*)
 
3794
          func_arith $extracted_serial + 1
 
3795
          extracted_serial=$func_arith_result
 
3796
          my_xlib_u=lt$extracted_serial-$my_xlib ;;
 
3797
        *) break ;;
 
3798
        esac
 
3799
      done
 
3800
      extracted_archives="$extracted_archives $my_xlib_u"
 
3801
      my_xdir="$my_gentop/$my_xlib_u"
 
3802
 
 
3803
      func_mkdir_p "$my_xdir"
 
3804
 
 
3805
      case $host in
 
3806
      *-darwin*)
 
3807
        func_verbose "Extracting $my_xabs"
 
3808
        # Do not bother doing anything if just a dry run
 
3809
        $opt_dry_run || {
 
3810
          darwin_orig_dir=`pwd`
 
3811
          cd $my_xdir || exit $?
 
3812
          darwin_archive=$my_xabs
 
3813
          darwin_curdir=`pwd`
 
3814
          darwin_base_archive=`basename "$darwin_archive"`
 
3815
          darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
 
3816
          if test -n "$darwin_arches"; then
 
3817
            darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
 
3818
            darwin_arch=
 
3819
            func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
 
3820
            for darwin_arch in  $darwin_arches ; do
 
3821
              func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
 
3822
              $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
 
3823
              cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
 
3824
              func_extract_an_archive "`pwd`" "${darwin_base_archive}"
 
3825
              cd "$darwin_curdir"
 
3826
              $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
 
3827
            done # $darwin_arches
 
3828
            ## Okay now we've a bunch of thin objects, gotta fatten them up :)
 
3829
            darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
 
3830
            darwin_file=
 
3831
            darwin_files=
 
3832
            for darwin_file in $darwin_filelist; do
 
3833
              darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
 
3834
              $LIPO -create -output "$darwin_file" $darwin_files
 
3835
            done # $darwin_filelist
 
3836
            $RM -rf unfat-$$
 
3837
            cd "$darwin_orig_dir"
 
3838
          else
 
3839
            cd $darwin_orig_dir
 
3840
            func_extract_an_archive "$my_xdir" "$my_xabs"
 
3841
          fi # $darwin_arches
 
3842
        } # !$opt_dry_run
 
3843
        ;;
 
3844
      *)
 
3845
        func_extract_an_archive "$my_xdir" "$my_xabs"
 
3846
        ;;
 
3847
      esac
 
3848
      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
 
3849
    done
 
3850
 
 
3851
    func_extract_archives_result="$my_oldobjs"
 
3852
}
 
3853
 
 
3854
 
 
3855
# func_emit_wrapper [arg=no]
 
3856
#
 
3857
# Emit a libtool wrapper script on stdout.
 
3858
# Don't directly open a file because we may want to
 
3859
# incorporate the script contents within a cygwin/mingw
 
3860
# wrapper executable.  Must ONLY be called from within
 
3861
# func_mode_link because it depends on a number of variables
 
3862
# set therein.
 
3863
#
 
3864
# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
 
3865
# variable will take.  If 'yes', then the emitted script
 
3866
# will assume that the directory in which it is stored is
 
3867
# the $objdir directory.  This is a cygwin/mingw-specific
 
3868
# behavior.
 
3869
func_emit_wrapper ()
 
3870
{
 
3871
        func_emit_wrapper_arg1=${1-no}
 
3872
 
 
3873
        $ECHO "\
 
3874
#! $SHELL
 
3875
 
 
3876
# $output - temporary wrapper script for $objdir/$outputname
 
3877
# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
 
3878
#
 
3879
# The $output program cannot be directly executed until all the libtool
 
3880
# libraries that it depends on are installed.
 
3881
#
 
3882
# This wrapper script should never be moved out of the build directory.
 
3883
# If it is, it will not operate correctly.
 
3884
 
 
3885
# Sed substitution that helps us do robust quoting.  It backslashifies
 
3886
# metacharacters that are still active within double-quoted strings.
 
3887
sed_quote_subst='$sed_quote_subst'
 
3888
 
 
3889
# Be Bourne compatible
 
3890
if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
 
3891
  emulate sh
 
3892
  NULLCMD=:
 
3893
  # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
 
3894
  # is contrary to our usage.  Disable this feature.
 
3895
  alias -g '\${1+\"\$@\"}'='\"\$@\"'
 
3896
  setopt NO_GLOB_SUBST
 
3897
else
 
3898
  case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
 
3899
fi
 
3900
BIN_SH=xpg4; export BIN_SH # for Tru64
 
3901
DUALCASE=1; export DUALCASE # for MKS sh
 
3902
 
 
3903
# The HP-UX ksh and POSIX shell print the target directory to stdout
 
3904
# if CDPATH is set.
 
3905
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
 
3906
 
 
3907
relink_command=\"$relink_command\"
 
3908
 
 
3909
# This environment variable determines our operation mode.
 
3910
if test \"\$libtool_install_magic\" = \"$magic\"; then
 
3911
  # install mode needs the following variables:
 
3912
  generated_by_libtool_version='$macro_version'
 
3913
  notinst_deplibs='$notinst_deplibs'
 
3914
else
 
3915
  # When we are sourced in execute mode, \$file and \$ECHO are already set.
 
3916
  if test \"\$libtool_execute_magic\" != \"$magic\"; then
 
3917
    file=\"\$0\""
 
3918
 
 
3919
    qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
 
3920
    $ECHO "\
 
3921
 
 
3922
# A function that is used when there is no print builtin or printf.
 
3923
func_fallback_echo ()
 
3924
{
 
3925
  eval 'cat <<_LTECHO_EOF
 
3926
\$1
 
3927
_LTECHO_EOF'
 
3928
}
 
3929
    ECHO=\"$qECHO\"
 
3930
  fi
 
3931
 
 
3932
# Very basic option parsing. These options are (a) specific to
 
3933
# the libtool wrapper, (b) are identical between the wrapper
 
3934
# /script/ and the wrapper /executable/ which is used only on
 
3935
# windows platforms, and (c) all begin with the string "--lt-"
 
3936
# (application programs are unlikely to have options which match
 
3937
# this pattern).
 
3938
#
 
3939
# There are only two supported options: --lt-debug and
 
3940
# --lt-dump-script. There is, deliberately, no --lt-help.
 
3941
#
 
3942
# The first argument to this parsing function should be the
 
3943
# script's $0 value, followed by "$@".
 
3944
lt_option_debug=
 
3945
func_parse_lt_options ()
 
3946
{
 
3947
  lt_script_arg0=\$0
 
3948
  shift
 
3949
  for lt_opt
 
3950
  do
 
3951
    case \"\$lt_opt\" in
 
3952
    --lt-debug) lt_option_debug=1 ;;
 
3953
    --lt-dump-script)
 
3954
        lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
 
3955
        test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
 
3956
        lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
 
3957
        cat \"\$lt_dump_D/\$lt_dump_F\"
 
3958
        exit 0
 
3959
      ;;
 
3960
    --lt-*)
 
3961
        \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
 
3962
        exit 1
 
3963
      ;;
 
3964
    esac
 
3965
  done
 
3966
 
 
3967
  # Print the debug banner immediately:
 
3968
  if test -n \"\$lt_option_debug\"; then
 
3969
    echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2
 
3970
  fi
 
3971
}
 
3972
 
 
3973
# Used when --lt-debug. Prints its arguments to stdout
 
3974
# (redirection is the responsibility of the caller)
 
3975
func_lt_dump_args ()
 
3976
{
 
3977
  lt_dump_args_N=1;
 
3978
  for lt_arg
 
3979
  do
 
3980
    \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\"
 
3981
    lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
 
3982
  done
 
3983
}
 
3984
 
 
3985
# Core function for launching the target application
 
3986
func_exec_program_core ()
 
3987
{
 
3988
"
 
3989
  case $host in
 
3990
  # Backslashes separate directories on plain windows
 
3991
  *-*-mingw | *-*-os2* | *-cegcc*)
 
3992
    $ECHO "\
 
3993
      if test -n \"\$lt_option_debug\"; then
 
3994
        \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2
 
3995
        func_lt_dump_args \${1+\"\$@\"} 1>&2
 
3996
      fi
 
3997
      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
 
3998
"
 
3999
    ;;
 
4000
 
 
4001
  *)
 
4002
    $ECHO "\
 
4003
      if test -n \"\$lt_option_debug\"; then
 
4004
        \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2
 
4005
        func_lt_dump_args \${1+\"\$@\"} 1>&2
 
4006
      fi
 
4007
      exec \"\$progdir/\$program\" \${1+\"\$@\"}
 
4008
"
 
4009
    ;;
 
4010
  esac
 
4011
  $ECHO "\
 
4012
      \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
 
4013
      exit 1
 
4014
}
 
4015
 
 
4016
# A function to encapsulate launching the target application
 
4017
# Strips options in the --lt-* namespace from \$@ and
 
4018
# launches target application with the remaining arguments.
 
4019
func_exec_program ()
 
4020
{
 
4021
  case \" \$* \" in
 
4022
  *\\ --lt-*)
 
4023
    for lt_wr_arg
 
4024
    do
 
4025
      case \$lt_wr_arg in
 
4026
      --lt-*) ;;
 
4027
      *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
 
4028
      esac
 
4029
      shift
 
4030
    done ;;
 
4031
  esac
 
4032
  func_exec_program_core \${1+\"\$@\"}
 
4033
}
 
4034
 
 
4035
  # Parse options
 
4036
  func_parse_lt_options \"\$0\" \${1+\"\$@\"}
 
4037
 
 
4038
  # Find the directory that this script lives in.
 
4039
  thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
 
4040
  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
 
4041
 
 
4042
  # Follow symbolic links until we get to the real thisdir.
 
4043
  file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
 
4044
  while test -n \"\$file\"; do
 
4045
    destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
 
4046
 
 
4047
    # If there was a directory component, then change thisdir.
 
4048
    if test \"x\$destdir\" != \"x\$file\"; then
 
4049
      case \"\$destdir\" in
 
4050
      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
 
4051
      *) thisdir=\"\$thisdir/\$destdir\" ;;
 
4052
      esac
 
4053
    fi
 
4054
 
 
4055
    file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
 
4056
    file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
 
4057
  done
 
4058
 
 
4059
  # Usually 'no', except on cygwin/mingw when embedded into
 
4060
  # the cwrapper.
 
4061
  WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
 
4062
  if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
 
4063
    # special case for '.'
 
4064
    if test \"\$thisdir\" = \".\"; then
 
4065
      thisdir=\`pwd\`
 
4066
    fi
 
4067
    # remove .libs from thisdir
 
4068
    case \"\$thisdir\" in
 
4069
    *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
 
4070
    $objdir )   thisdir=. ;;
 
4071
    esac
 
4072
  fi
 
4073
 
 
4074
  # Try to get the absolute directory name.
 
4075
  absdir=\`cd \"\$thisdir\" && pwd\`
 
4076
  test -n \"\$absdir\" && thisdir=\"\$absdir\"
 
4077
"
 
4078
 
 
4079
        if test "$fast_install" = yes; then
 
4080
          $ECHO "\
 
4081
  program=lt-'$outputname'$exeext
 
4082
  progdir=\"\$thisdir/$objdir\"
 
4083
 
 
4084
  if test ! -f \"\$progdir/\$program\" ||
 
4085
     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
 
4086
       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
 
4087
 
 
4088
    file=\"\$\$-\$program\"
 
4089
 
 
4090
    if test ! -d \"\$progdir\"; then
 
4091
      $MKDIR \"\$progdir\"
 
4092
    else
 
4093
      $RM \"\$progdir/\$file\"
 
4094
    fi"
 
4095
 
 
4096
          $ECHO "\
 
4097
 
 
4098
    # relink executable if necessary
 
4099
    if test -n \"\$relink_command\"; then
 
4100
      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
 
4101
      else
 
4102
        $ECHO \"\$relink_command_output\" >&2
 
4103
        $RM \"\$progdir/\$file\"
 
4104
        exit 1
 
4105
      fi
 
4106
    fi
 
4107
 
 
4108
    $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
 
4109
    { $RM \"\$progdir/\$program\";
 
4110
      $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
 
4111
    $RM \"\$progdir/\$file\"
 
4112
  fi"
 
4113
        else
 
4114
          $ECHO "\
 
4115
  program='$outputname'
 
4116
  progdir=\"\$thisdir/$objdir\"
 
4117
"
 
4118
        fi
 
4119
 
 
4120
        $ECHO "\
 
4121
 
 
4122
  if test -f \"\$progdir/\$program\"; then"
 
4123
 
 
4124
        # fixup the dll searchpath if we need to.
 
4125
        #
 
4126
        # Fix the DLL searchpath if we need to.  Do this before prepending
 
4127
        # to shlibpath, because on Windows, both are PATH and uninstalled
 
4128
        # libraries must come first.
 
4129
        if test -n "$dllsearchpath"; then
 
4130
          $ECHO "\
 
4131
    # Add the dll search path components to the executable PATH
 
4132
    PATH=$dllsearchpath:\$PATH
 
4133
"
 
4134
        fi
 
4135
 
 
4136
        # Export our shlibpath_var if we have one.
 
4137
        if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
 
4138
          $ECHO "\
 
4139
    # Add our own library path to $shlibpath_var
 
4140
    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
 
4141
 
 
4142
    # Some systems cannot cope with colon-terminated $shlibpath_var
 
4143
    # The second colon is a workaround for a bug in BeOS R4 sed
 
4144
    $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
 
4145
 
 
4146
    export $shlibpath_var
 
4147
"
 
4148
        fi
 
4149
 
 
4150
        $ECHO "\
 
4151
    if test \"\$libtool_execute_magic\" != \"$magic\"; then
 
4152
      # Run the actual program with our arguments.
 
4153
      func_exec_program \${1+\"\$@\"}
 
4154
    fi
 
4155
  else
 
4156
    # The program doesn't exist.
 
4157
    \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
 
4158
    \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
 
4159
    \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
 
4160
    exit 1
 
4161
  fi
 
4162
fi\
 
4163
"
 
4164
}
 
4165
 
 
4166
 
 
4167
# func_emit_cwrapperexe_src
 
4168
# emit the source code for a wrapper executable on stdout
 
4169
# Must ONLY be called from within func_mode_link because
 
4170
# it depends on a number of variable set therein.
 
4171
func_emit_cwrapperexe_src ()
 
4172
{
 
4173
        cat <<EOF
 
4174
 
 
4175
/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
 
4176
   Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
 
4177
 
 
4178
   The $output program cannot be directly executed until all the libtool
 
4179
   libraries that it depends on are installed.
 
4180
 
 
4181
   This wrapper executable should never be moved out of the build directory.
 
4182
   If it is, it will not operate correctly.
 
4183
*/
 
4184
EOF
 
4185
            cat <<"EOF"
 
4186
#ifdef _MSC_VER
 
4187
# define _CRT_SECURE_NO_DEPRECATE 1
 
4188
#endif
 
4189
#include <stdio.h>
 
4190
#include <stdlib.h>
 
4191
#ifdef _MSC_VER
 
4192
# include <direct.h>
 
4193
# include <process.h>
 
4194
# include <io.h>
 
4195
#else
 
4196
# include <unistd.h>
 
4197
# include <stdint.h>
 
4198
# ifdef __CYGWIN__
 
4199
#  include <io.h>
 
4200
# endif
 
4201
#endif
 
4202
#include <malloc.h>
 
4203
#include <stdarg.h>
 
4204
#include <assert.h>
 
4205
#include <string.h>
 
4206
#include <ctype.h>
 
4207
#include <errno.h>
 
4208
#include <fcntl.h>
 
4209
#include <sys/stat.h>
 
4210
 
 
4211
/* declarations of non-ANSI functions */
 
4212
#if defined(__MINGW32__)
 
4213
# ifdef __STRICT_ANSI__
 
4214
int _putenv (const char *);
 
4215
# endif
 
4216
#elif defined(__CYGWIN__)
 
4217
# ifdef __STRICT_ANSI__
 
4218
char *realpath (const char *, char *);
 
4219
int putenv (char *);
 
4220
int setenv (const char *, const char *, int);
 
4221
# endif
 
4222
/* #elif defined (other platforms) ... */
 
4223
#endif
 
4224
 
 
4225
/* portability defines, excluding path handling macros */
 
4226
#if defined(_MSC_VER)
 
4227
# define setmode _setmode
 
4228
# define stat    _stat
 
4229
# define chmod   _chmod
 
4230
# define getcwd  _getcwd
 
4231
# define putenv  _putenv
 
4232
# define S_IXUSR _S_IEXEC
 
4233
# ifndef _INTPTR_T_DEFINED
 
4234
#  define _INTPTR_T_DEFINED
 
4235
#  define intptr_t int
 
4236
# endif
 
4237
#elif defined(__MINGW32__)
 
4238
# define setmode _setmode
 
4239
# define stat    _stat
 
4240
# define chmod   _chmod
 
4241
# define getcwd  _getcwd
 
4242
# define putenv  _putenv
 
4243
#elif defined(__CYGWIN__)
 
4244
# define HAVE_SETENV
 
4245
# define FOPEN_WB "wb"
 
4246
/* #elif defined (other platforms) ... */
 
4247
#endif
 
4248
 
 
4249
#if defined(PATH_MAX)
 
4250
# define LT_PATHMAX PATH_MAX
 
4251
#elif defined(MAXPATHLEN)
 
4252
# define LT_PATHMAX MAXPATHLEN
 
4253
#else
 
4254
# define LT_PATHMAX 1024
 
4255
#endif
 
4256
 
 
4257
#ifndef S_IXOTH
 
4258
# define S_IXOTH 0
 
4259
#endif
 
4260
#ifndef S_IXGRP
 
4261
# define S_IXGRP 0
 
4262
#endif
 
4263
 
 
4264
/* path handling portability macros */
 
4265
#ifndef DIR_SEPARATOR
 
4266
# define DIR_SEPARATOR '/'
 
4267
# define PATH_SEPARATOR ':'
 
4268
#endif
 
4269
 
 
4270
#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
 
4271
  defined (__OS2__)
 
4272
# define HAVE_DOS_BASED_FILE_SYSTEM
 
4273
# define FOPEN_WB "wb"
 
4274
# ifndef DIR_SEPARATOR_2
 
4275
#  define DIR_SEPARATOR_2 '\\'
 
4276
# endif
 
4277
# ifndef PATH_SEPARATOR_2
 
4278
#  define PATH_SEPARATOR_2 ';'
 
4279
# endif
 
4280
#endif
 
4281
 
 
4282
#ifndef DIR_SEPARATOR_2
 
4283
# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
 
4284
#else /* DIR_SEPARATOR_2 */
 
4285
# define IS_DIR_SEPARATOR(ch) \
 
4286
        (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
 
4287
#endif /* DIR_SEPARATOR_2 */
 
4288
 
 
4289
#ifndef PATH_SEPARATOR_2
 
4290
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
 
4291
#else /* PATH_SEPARATOR_2 */
 
4292
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
 
4293
#endif /* PATH_SEPARATOR_2 */
 
4294
 
 
4295
#ifndef FOPEN_WB
 
4296
# define FOPEN_WB "w"
 
4297
#endif
 
4298
#ifndef _O_BINARY
 
4299
# define _O_BINARY 0
 
4300
#endif
 
4301
 
 
4302
#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
 
4303
#define XFREE(stale) do { \
 
4304
  if (stale) { free ((void *) stale); stale = 0; } \
 
4305
} while (0)
 
4306
 
 
4307
#if defined(LT_DEBUGWRAPPER)
 
4308
static int lt_debug = 1;
 
4309
#else
 
4310
static int lt_debug = 0;
 
4311
#endif
 
4312
 
 
4313
const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
 
4314
 
 
4315
void *xmalloc (size_t num);
 
4316
char *xstrdup (const char *string);
 
4317
const char *base_name (const char *name);
 
4318
char *find_executable (const char *wrapper);
 
4319
char *chase_symlinks (const char *pathspec);
 
4320
int make_executable (const char *path);
 
4321
int check_executable (const char *path);
 
4322
char *strendzap (char *str, const char *pat);
 
4323
void lt_debugprintf (const char *file, int line, const char *fmt, ...);
 
4324
void lt_fatal (const char *file, int line, const char *message, ...);
 
4325
static const char *nonnull (const char *s);
 
4326
static const char *nonempty (const char *s);
 
4327
void lt_setenv (const char *name, const char *value);
 
4328
char *lt_extend_str (const char *orig_value, const char *add, int to_end);
 
4329
void lt_update_exe_path (const char *name, const char *value);
 
4330
void lt_update_lib_path (const char *name, const char *value);
 
4331
char **prepare_spawn (char **argv);
 
4332
void lt_dump_script (FILE *f);
 
4333
EOF
 
4334
 
 
4335
            cat <<EOF
 
4336
volatile const char * MAGIC_EXE = "$magic_exe";
 
4337
const char * LIB_PATH_VARNAME = "$shlibpath_var";
 
4338
EOF
 
4339
 
 
4340
            if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
 
4341
              func_to_host_path "$temp_rpath"
 
4342
              cat <<EOF
 
4343
const char * LIB_PATH_VALUE   = "$func_to_host_path_result";
 
4344
EOF
 
4345
            else
 
4346
              cat <<"EOF"
 
4347
const char * LIB_PATH_VALUE   = "";
 
4348
EOF
 
4349
            fi
 
4350
 
 
4351
            if test -n "$dllsearchpath"; then
 
4352
              func_to_host_path "$dllsearchpath:"
 
4353
              cat <<EOF
 
4354
const char * EXE_PATH_VARNAME = "PATH";
 
4355
const char * EXE_PATH_VALUE   = "$func_to_host_path_result";
 
4356
EOF
 
4357
            else
 
4358
              cat <<"EOF"
 
4359
const char * EXE_PATH_VARNAME = "";
 
4360
const char * EXE_PATH_VALUE   = "";
 
4361
EOF
 
4362
            fi
 
4363
 
 
4364
            if test "$fast_install" = yes; then
 
4365
              cat <<EOF
 
4366
const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
 
4367
EOF
 
4368
            else
 
4369
              cat <<EOF
 
4370
const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
 
4371
EOF
 
4372
            fi
 
4373
 
 
4374
 
 
4375
            cat <<"EOF"
 
4376
 
 
4377
#define LTWRAPPER_OPTION_PREFIX         "--lt-"
 
4378
 
 
4379
static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
 
4380
static const char *dumpscript_opt       = LTWRAPPER_OPTION_PREFIX "dump-script";
 
4381
static const char *debug_opt            = LTWRAPPER_OPTION_PREFIX "debug";
 
4382
 
 
4383
int
 
4384
main (int argc, char *argv[])
 
4385
{
 
4386
  char **newargz;
 
4387
  int  newargc;
 
4388
  char *tmp_pathspec;
 
4389
  char *actual_cwrapper_path;
 
4390
  char *actual_cwrapper_name;
 
4391
  char *target_name;
 
4392
  char *lt_argv_zero;
 
4393
  intptr_t rval = 127;
 
4394
 
 
4395
  int i;
 
4396
 
 
4397
  program_name = (char *) xstrdup (base_name (argv[0]));
 
4398
  newargz = XMALLOC (char *, argc + 1);
 
4399
 
 
4400
  /* very simple arg parsing; don't want to rely on getopt
 
4401
   * also, copy all non cwrapper options to newargz, except
 
4402
   * argz[0], which is handled differently
 
4403
   */
 
4404
  newargc=0;
 
4405
  for (i = 1; i < argc; i++)
 
4406
    {
 
4407
      if (strcmp (argv[i], dumpscript_opt) == 0)
 
4408
        {
 
4409
EOF
 
4410
            case "$host" in
 
4411
              *mingw* | *cygwin* )
 
4412
                # make stdout use "unix" line endings
 
4413
                echo "          setmode(1,_O_BINARY);"
 
4414
                ;;
 
4415
              esac
 
4416
 
 
4417
            cat <<"EOF"
 
4418
          lt_dump_script (stdout);
 
4419
          return 0;
 
4420
        }
 
4421
      if (strcmp (argv[i], debug_opt) == 0)
 
4422
        {
 
4423
          lt_debug = 1;
 
4424
          continue;
 
4425
        }
 
4426
      if (strcmp (argv[i], ltwrapper_option_prefix) == 0)
 
4427
        {
 
4428
          /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
 
4429
             namespace, but it is not one of the ones we know about and
 
4430
             have already dealt with, above (inluding dump-script), then
 
4431
             report an error. Otherwise, targets might begin to believe
 
4432
             they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
 
4433
             namespace. The first time any user complains about this, we'll
 
4434
             need to make LTWRAPPER_OPTION_PREFIX a configure-time option
 
4435
             or a configure.ac-settable value.
 
4436
           */
 
4437
          lt_fatal (__FILE__, __LINE__,
 
4438
                    "unrecognized %s option: '%s'",
 
4439
                    ltwrapper_option_prefix, argv[i]);
 
4440
        }
 
4441
      /* otherwise ... */
 
4442
      newargz[++newargc] = xstrdup (argv[i]);
 
4443
    }
 
4444
  newargz[++newargc] = NULL;
 
4445
 
 
4446
EOF
 
4447
            cat <<EOF
 
4448
  /* The GNU banner must be the first non-error debug message */
 
4449
  lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n");
 
4450
EOF
 
4451
            cat <<"EOF"
 
4452
  lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
 
4453
  lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
 
4454
 
 
4455
  tmp_pathspec = find_executable (argv[0]);
 
4456
  if (tmp_pathspec == NULL)
 
4457
    lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
 
4458
  lt_debugprintf (__FILE__, __LINE__,
 
4459
                  "(main) found exe (before symlink chase) at: %s\n",
 
4460
                  tmp_pathspec);
 
4461
 
 
4462
  actual_cwrapper_path = chase_symlinks (tmp_pathspec);
 
4463
  lt_debugprintf (__FILE__, __LINE__,
 
4464
                  "(main) found exe (after symlink chase) at: %s\n",
 
4465
                  actual_cwrapper_path);
 
4466
  XFREE (tmp_pathspec);
 
4467
 
 
4468
  actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
 
4469
  strendzap (actual_cwrapper_path, actual_cwrapper_name);
 
4470
 
 
4471
  /* wrapper name transforms */
 
4472
  strendzap (actual_cwrapper_name, ".exe");
 
4473
  tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
 
4474
  XFREE (actual_cwrapper_name);
 
4475
  actual_cwrapper_name = tmp_pathspec;
 
4476
  tmp_pathspec = 0;
 
4477
 
 
4478
  /* target_name transforms -- use actual target program name; might have lt- prefix */
 
4479
  target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
 
4480
  strendzap (target_name, ".exe");
 
4481
  tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
 
4482
  XFREE (target_name);
 
4483
  target_name = tmp_pathspec;
 
4484
  tmp_pathspec = 0;
 
4485
 
 
4486
  lt_debugprintf (__FILE__, __LINE__,
 
4487
                  "(main) libtool target name: %s\n",
 
4488
                  target_name);
 
4489
EOF
 
4490
 
 
4491
            cat <<EOF
 
4492
  newargz[0] =
 
4493
    XMALLOC (char, (strlen (actual_cwrapper_path) +
 
4494
                    strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
 
4495
  strcpy (newargz[0], actual_cwrapper_path);
 
4496
  strcat (newargz[0], "$objdir");
 
4497
  strcat (newargz[0], "/");
 
4498
EOF
 
4499
 
 
4500
            cat <<"EOF"
 
4501
  /* stop here, and copy so we don't have to do this twice */
 
4502
  tmp_pathspec = xstrdup (newargz[0]);
 
4503
 
 
4504
  /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
 
4505
  strcat (newargz[0], actual_cwrapper_name);
 
4506
 
 
4507
  /* DO want the lt- prefix here if it exists, so use target_name */
 
4508
  lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
 
4509
  XFREE (tmp_pathspec);
 
4510
  tmp_pathspec = NULL;
 
4511
EOF
 
4512
 
 
4513
            case $host_os in
 
4514
              mingw*)
 
4515
            cat <<"EOF"
 
4516
  {
 
4517
    char* p;
 
4518
    while ((p = strchr (newargz[0], '\\')) != NULL)
 
4519
      {
 
4520
        *p = '/';
 
4521
      }
 
4522
    while ((p = strchr (lt_argv_zero, '\\')) != NULL)
 
4523
      {
 
4524
        *p = '/';
 
4525
      }
 
4526
  }
 
4527
EOF
 
4528
            ;;
 
4529
            esac
 
4530
 
 
4531
            cat <<"EOF"
 
4532
  XFREE (target_name);
 
4533
  XFREE (actual_cwrapper_path);
 
4534
  XFREE (actual_cwrapper_name);
 
4535
 
 
4536
  lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
 
4537
  lt_setenv ("DUALCASE", "1");  /* for MSK sh */
 
4538
  /* Update the DLL searchpath.  EXE_PATH_VALUE ($dllsearchpath) must
 
4539
     be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
 
4540
     because on Windows, both *_VARNAMEs are PATH but uninstalled
 
4541
     libraries must come first. */
 
4542
  lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
 
4543
  lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
 
4544
 
 
4545
  lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
 
4546
                  nonnull (lt_argv_zero));
 
4547
  for (i = 0; i < newargc; i++)
 
4548
    {
 
4549
      lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
 
4550
                      i, nonnull (newargz[i]));
 
4551
    }
 
4552
 
 
4553
EOF
 
4554
 
 
4555
            case $host_os in
 
4556
              mingw*)
 
4557
                cat <<"EOF"
 
4558
  /* execv doesn't actually work on mingw as expected on unix */
 
4559
  newargz = prepare_spawn (newargz);
 
4560
  rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
 
4561
  if (rval == -1)
 
4562
    {
 
4563
      /* failed to start process */
 
4564
      lt_debugprintf (__FILE__, __LINE__,
 
4565
                      "(main) failed to launch target \"%s\": %s\n",
 
4566
                      lt_argv_zero, nonnull (strerror (errno)));
 
4567
      return 127;
 
4568
    }
 
4569
  return rval;
 
4570
EOF
 
4571
                ;;
 
4572
              *)
 
4573
                cat <<"EOF"
 
4574
  execv (lt_argv_zero, newargz);
 
4575
  return rval; /* =127, but avoids unused variable warning */
 
4576
EOF
 
4577
                ;;
 
4578
            esac
 
4579
 
 
4580
            cat <<"EOF"
 
4581
}
 
4582
 
 
4583
void *
 
4584
xmalloc (size_t num)
 
4585
{
 
4586
  void *p = (void *) malloc (num);
 
4587
  if (!p)
 
4588
    lt_fatal (__FILE__, __LINE__, "memory exhausted");
 
4589
 
 
4590
  return p;
 
4591
}
 
4592
 
 
4593
char *
 
4594
xstrdup (const char *string)
 
4595
{
 
4596
  return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
 
4597
                          string) : NULL;
 
4598
}
 
4599
 
 
4600
const char *
 
4601
base_name (const char *name)
 
4602
{
 
4603
  const char *base;
 
4604
 
 
4605
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
 
4606
  /* Skip over the disk name in MSDOS pathnames. */
 
4607
  if (isalpha ((unsigned char) name[0]) && name[1] == ':')
 
4608
    name += 2;
 
4609
#endif
 
4610
 
 
4611
  for (base = name; *name; name++)
 
4612
    if (IS_DIR_SEPARATOR (*name))
 
4613
      base = name + 1;
 
4614
  return base;
 
4615
}
 
4616
 
 
4617
int
 
4618
check_executable (const char *path)
 
4619
{
 
4620
  struct stat st;
 
4621
 
 
4622
  lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
 
4623
                  nonempty (path));
 
4624
  if ((!path) || (!*path))
 
4625
    return 0;
 
4626
 
 
4627
  if ((stat (path, &st) >= 0)
 
4628
      && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
 
4629
    return 1;
 
4630
  else
 
4631
    return 0;
 
4632
}
 
4633
 
 
4634
int
 
4635
make_executable (const char *path)
 
4636
{
 
4637
  int rval = 0;
 
4638
  struct stat st;
 
4639
 
 
4640
  lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
 
4641
                  nonempty (path));
 
4642
  if ((!path) || (!*path))
 
4643
    return 0;
 
4644
 
 
4645
  if (stat (path, &st) >= 0)
 
4646
    {
 
4647
      rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
 
4648
    }
 
4649
  return rval;
 
4650
}
 
4651
 
 
4652
/* Searches for the full path of the wrapper.  Returns
 
4653
   newly allocated full path name if found, NULL otherwise
 
4654
   Does not chase symlinks, even on platforms that support them.
 
4655
*/
 
4656
char *
 
4657
find_executable (const char *wrapper)
 
4658
{
 
4659
  int has_slash = 0;
 
4660
  const char *p;
 
4661
  const char *p_next;
 
4662
  /* static buffer for getcwd */
 
4663
  char tmp[LT_PATHMAX + 1];
 
4664
  int tmp_len;
 
4665
  char *concat_name;
 
4666
 
 
4667
  lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
 
4668
                  nonempty (wrapper));
 
4669
 
 
4670
  if ((wrapper == NULL) || (*wrapper == '\0'))
 
4671
    return NULL;
 
4672
 
 
4673
  /* Absolute path? */
 
4674
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
 
4675
  if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
 
4676
    {
 
4677
      concat_name = xstrdup (wrapper);
 
4678
      if (check_executable (concat_name))
 
4679
        return concat_name;
 
4680
      XFREE (concat_name);
 
4681
    }
 
4682
  else
 
4683
    {
 
4684
#endif
 
4685
      if (IS_DIR_SEPARATOR (wrapper[0]))
 
4686
        {
 
4687
          concat_name = xstrdup (wrapper);
 
4688
          if (check_executable (concat_name))
 
4689
            return concat_name;
 
4690
          XFREE (concat_name);
 
4691
        }
 
4692
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
 
4693
    }
 
4694
#endif
 
4695
 
 
4696
  for (p = wrapper; *p; p++)
 
4697
    if (*p == '/')
 
4698
      {
 
4699
        has_slash = 1;
 
4700
        break;
 
4701
      }
 
4702
  if (!has_slash)
 
4703
    {
 
4704
      /* no slashes; search PATH */
 
4705
      const char *path = getenv ("PATH");
 
4706
      if (path != NULL)
 
4707
        {
 
4708
          for (p = path; *p; p = p_next)
 
4709
            {
 
4710
              const char *q;
 
4711
              size_t p_len;
 
4712
              for (q = p; *q; q++)
 
4713
                if (IS_PATH_SEPARATOR (*q))
 
4714
                  break;
 
4715
              p_len = q - p;
 
4716
              p_next = (*q == '\0' ? q : q + 1);
 
4717
              if (p_len == 0)
 
4718
                {
 
4719
                  /* empty path: current directory */
 
4720
                  if (getcwd (tmp, LT_PATHMAX) == NULL)
 
4721
                    lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
 
4722
                              nonnull (strerror (errno)));
 
4723
                  tmp_len = strlen (tmp);
 
4724
                  concat_name =
 
4725
                    XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
 
4726
                  memcpy (concat_name, tmp, tmp_len);
 
4727
                  concat_name[tmp_len] = '/';
 
4728
                  strcpy (concat_name + tmp_len + 1, wrapper);
 
4729
                }
 
4730
              else
 
4731
                {
 
4732
                  concat_name =
 
4733
                    XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
 
4734
                  memcpy (concat_name, p, p_len);
 
4735
                  concat_name[p_len] = '/';
 
4736
                  strcpy (concat_name + p_len + 1, wrapper);
 
4737
                }
 
4738
              if (check_executable (concat_name))
 
4739
                return concat_name;
 
4740
              XFREE (concat_name);
 
4741
            }
 
4742
        }
 
4743
      /* not found in PATH; assume curdir */
 
4744
    }
 
4745
  /* Relative path | not found in path: prepend cwd */
 
4746
  if (getcwd (tmp, LT_PATHMAX) == NULL)
 
4747
    lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
 
4748
              nonnull (strerror (errno)));
 
4749
  tmp_len = strlen (tmp);
 
4750
  concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
 
4751
  memcpy (concat_name, tmp, tmp_len);
 
4752
  concat_name[tmp_len] = '/';
 
4753
  strcpy (concat_name + tmp_len + 1, wrapper);
 
4754
 
 
4755
  if (check_executable (concat_name))
 
4756
    return concat_name;
 
4757
  XFREE (concat_name);
 
4758
  return NULL;
 
4759
}
 
4760
 
 
4761
char *
 
4762
chase_symlinks (const char *pathspec)
 
4763
{
 
4764
#ifndef S_ISLNK
 
4765
  return xstrdup (pathspec);
 
4766
#else
 
4767
  char buf[LT_PATHMAX];
 
4768
  struct stat s;
 
4769
  char *tmp_pathspec = xstrdup (pathspec);
 
4770
  char *p;
 
4771
  int has_symlinks = 0;
 
4772
  while (strlen (tmp_pathspec) && !has_symlinks)
 
4773
    {
 
4774
      lt_debugprintf (__FILE__, __LINE__,
 
4775
                      "checking path component for symlinks: %s\n",
 
4776
                      tmp_pathspec);
 
4777
      if (lstat (tmp_pathspec, &s) == 0)
 
4778
        {
 
4779
          if (S_ISLNK (s.st_mode) != 0)
 
4780
            {
 
4781
              has_symlinks = 1;
 
4782
              break;
 
4783
            }
 
4784
 
 
4785
          /* search backwards for last DIR_SEPARATOR */
 
4786
          p = tmp_pathspec + strlen (tmp_pathspec) - 1;
 
4787
          while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
 
4788
            p--;
 
4789
          if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
 
4790
            {
 
4791
              /* no more DIR_SEPARATORS left */
 
4792
              break;
 
4793
            }
 
4794
          *p = '\0';
 
4795
        }
 
4796
      else
 
4797
        {
 
4798
          lt_fatal (__FILE__, __LINE__,
 
4799
                    "error accessing file \"%s\": %s",
 
4800
                    tmp_pathspec, nonnull (strerror (errno)));
 
4801
        }
 
4802
    }
 
4803
  XFREE (tmp_pathspec);
 
4804
 
 
4805
  if (!has_symlinks)
 
4806
    {
 
4807
      return xstrdup (pathspec);
 
4808
    }
 
4809
 
 
4810
  tmp_pathspec = realpath (pathspec, buf);
 
4811
  if (tmp_pathspec == 0)
 
4812
    {
 
4813
      lt_fatal (__FILE__, __LINE__,
 
4814
                "could not follow symlinks for %s", pathspec);
 
4815
    }
 
4816
  return xstrdup (tmp_pathspec);
 
4817
#endif
 
4818
}
 
4819
 
 
4820
char *
 
4821
strendzap (char *str, const char *pat)
 
4822
{
 
4823
  size_t len, patlen;
 
4824
 
 
4825
  assert (str != NULL);
 
4826
  assert (pat != NULL);
 
4827
 
 
4828
  len = strlen (str);
 
4829
  patlen = strlen (pat);
 
4830
 
 
4831
  if (patlen <= len)
 
4832
    {
 
4833
      str += len - patlen;
 
4834
      if (strcmp (str, pat) == 0)
 
4835
        *str = '\0';
 
4836
    }
 
4837
  return str;
 
4838
}
 
4839
 
 
4840
void
 
4841
lt_debugprintf (const char *file, int line, const char *fmt, ...)
 
4842
{
 
4843
  va_list args;
 
4844
  if (lt_debug)
 
4845
    {
 
4846
      (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
 
4847
      va_start (args, fmt);
 
4848
      (void) vfprintf (stderr, fmt, args);
 
4849
      va_end (args);
 
4850
    }
 
4851
}
 
4852
 
 
4853
static void
 
4854
lt_error_core (int exit_status, const char *file,
 
4855
               int line, const char *mode,
 
4856
               const char *message, va_list ap)
 
4857
{
 
4858
  fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
 
4859
  vfprintf (stderr, message, ap);
 
4860
  fprintf (stderr, ".\n");
 
4861
 
 
4862
  if (exit_status >= 0)
 
4863
    exit (exit_status);
 
4864
}
 
4865
 
 
4866
void
 
4867
lt_fatal (const char *file, int line, const char *message, ...)
 
4868
{
 
4869
  va_list ap;
 
4870
  va_start (ap, message);
 
4871
  lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
 
4872
  va_end (ap);
 
4873
}
 
4874
 
 
4875
static const char *
 
4876
nonnull (const char *s)
 
4877
{
 
4878
  return s ? s : "(null)";
 
4879
}
 
4880
 
 
4881
static const char *
 
4882
nonempty (const char *s)
 
4883
{
 
4884
  return (s && !*s) ? "(empty)" : nonnull (s);
 
4885
}
 
4886
 
 
4887
void
 
4888
lt_setenv (const char *name, const char *value)
 
4889
{
 
4890
  lt_debugprintf (__FILE__, __LINE__,
 
4891
                  "(lt_setenv) setting '%s' to '%s'\n",
 
4892
                  nonnull (name), nonnull (value));
 
4893
  {
 
4894
#ifdef HAVE_SETENV
 
4895
    /* always make a copy, for consistency with !HAVE_SETENV */
 
4896
    char *str = xstrdup (value);
 
4897
    setenv (name, str, 1);
 
4898
#else
 
4899
    int len = strlen (name) + 1 + strlen (value) + 1;
 
4900
    char *str = XMALLOC (char, len);
 
4901
    sprintf (str, "%s=%s", name, value);
 
4902
    if (putenv (str) != EXIT_SUCCESS)
 
4903
      {
 
4904
        XFREE (str);
 
4905
      }
 
4906
#endif
 
4907
  }
 
4908
}
 
4909
 
 
4910
char *
 
4911
lt_extend_str (const char *orig_value, const char *add, int to_end)
 
4912
{
 
4913
  char *new_value;
 
4914
  if (orig_value && *orig_value)
 
4915
    {
 
4916
      int orig_value_len = strlen (orig_value);
 
4917
      int add_len = strlen (add);
 
4918
      new_value = XMALLOC (char, add_len + orig_value_len + 1);
 
4919
      if (to_end)
 
4920
        {
 
4921
          strcpy (new_value, orig_value);
 
4922
          strcpy (new_value + orig_value_len, add);
 
4923
        }
 
4924
      else
 
4925
        {
 
4926
          strcpy (new_value, add);
 
4927
          strcpy (new_value + add_len, orig_value);
 
4928
        }
 
4929
    }
 
4930
  else
 
4931
    {
 
4932
      new_value = xstrdup (add);
 
4933
    }
 
4934
  return new_value;
 
4935
}
 
4936
 
 
4937
void
 
4938
lt_update_exe_path (const char *name, const char *value)
 
4939
{
 
4940
  lt_debugprintf (__FILE__, __LINE__,
 
4941
                  "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
 
4942
                  nonnull (name), nonnull (value));
 
4943
 
 
4944
  if (name && *name && value && *value)
 
4945
    {
 
4946
      char *new_value = lt_extend_str (getenv (name), value, 0);
 
4947
      /* some systems can't cope with a ':'-terminated path #' */
 
4948
      int len = strlen (new_value);
 
4949
      while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
 
4950
        {
 
4951
          new_value[len-1] = '\0';
 
4952
        }
 
4953
      lt_setenv (name, new_value);
 
4954
      XFREE (new_value);
 
4955
    }
 
4956
}
 
4957
 
 
4958
void
 
4959
lt_update_lib_path (const char *name, const char *value)
 
4960
{
 
4961
  lt_debugprintf (__FILE__, __LINE__,
 
4962
                  "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
 
4963
                  nonnull (name), nonnull (value));
 
4964
 
 
4965
  if (name && *name && value && *value)
 
4966
    {
 
4967
      char *new_value = lt_extend_str (getenv (name), value, 0);
 
4968
      lt_setenv (name, new_value);
 
4969
      XFREE (new_value);
 
4970
    }
 
4971
}
 
4972
 
 
4973
EOF
 
4974
            case $host_os in
 
4975
              mingw*)
 
4976
                cat <<"EOF"
 
4977
 
 
4978
/* Prepares an argument vector before calling spawn().
 
4979
   Note that spawn() does not by itself call the command interpreter
 
4980
     (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
 
4981
      ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
 
4982
         GetVersionEx(&v);
 
4983
         v.dwPlatformId == VER_PLATFORM_WIN32_NT;
 
4984
      }) ? "cmd.exe" : "command.com").
 
4985
   Instead it simply concatenates the arguments, separated by ' ', and calls
 
4986
   CreateProcess().  We must quote the arguments since Win32 CreateProcess()
 
4987
   interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
 
4988
   special way:
 
4989
   - Space and tab are interpreted as delimiters. They are not treated as
 
4990
     delimiters if they are surrounded by double quotes: "...".
 
4991
   - Unescaped double quotes are removed from the input. Their only effect is
 
4992
     that within double quotes, space and tab are treated like normal
 
4993
     characters.
 
4994
   - Backslashes not followed by double quotes are not special.
 
4995
   - But 2*n+1 backslashes followed by a double quote become
 
4996
     n backslashes followed by a double quote (n >= 0):
 
4997
       \" -> "
 
4998
       \\\" -> \"
 
4999
       \\\\\" -> \\"
 
5000
 */
 
5001
#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
 
5002
#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
 
5003
char **
 
5004
prepare_spawn (char **argv)
 
5005
{
 
5006
  size_t argc;
 
5007
  char **new_argv;
 
5008
  size_t i;
 
5009
 
 
5010
  /* Count number of arguments.  */
 
5011
  for (argc = 0; argv[argc] != NULL; argc++)
 
5012
    ;
 
5013
 
 
5014
  /* Allocate new argument vector.  */
 
5015
  new_argv = XMALLOC (char *, argc + 1);
 
5016
 
 
5017
  /* Put quoted arguments into the new argument vector.  */
 
5018
  for (i = 0; i < argc; i++)
 
5019
    {
 
5020
      const char *string = argv[i];
 
5021
 
 
5022
      if (string[0] == '\0')
 
5023
        new_argv[i] = xstrdup ("\"\"");
 
5024
      else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
 
5025
        {
 
5026
          int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
 
5027
          size_t length;
 
5028
          unsigned int backslashes;
 
5029
          const char *s;
 
5030
          char *quoted_string;
 
5031
          char *p;
 
5032
 
 
5033
          length = 0;
 
5034
          backslashes = 0;
 
5035
          if (quote_around)
 
5036
            length++;
 
5037
          for (s = string; *s != '\0'; s++)
 
5038
            {
 
5039
              char c = *s;
 
5040
              if (c == '"')
 
5041
                length += backslashes + 1;
 
5042
              length++;
 
5043
              if (c == '\\')
 
5044
                backslashes++;
 
5045
              else
 
5046
                backslashes = 0;
 
5047
            }
 
5048
          if (quote_around)
 
5049
            length += backslashes + 1;
 
5050
 
 
5051
          quoted_string = XMALLOC (char, length + 1);
 
5052
 
 
5053
          p = quoted_string;
 
5054
          backslashes = 0;
 
5055
          if (quote_around)
 
5056
            *p++ = '"';
 
5057
          for (s = string; *s != '\0'; s++)
 
5058
            {
 
5059
              char c = *s;
 
5060
              if (c == '"')
 
5061
                {
 
5062
                  unsigned int j;
 
5063
                  for (j = backslashes + 1; j > 0; j--)
 
5064
                    *p++ = '\\';
 
5065
                }
 
5066
              *p++ = c;
 
5067
              if (c == '\\')
 
5068
                backslashes++;
 
5069
              else
 
5070
                backslashes = 0;
 
5071
            }
 
5072
          if (quote_around)
 
5073
            {
 
5074
              unsigned int j;
 
5075
              for (j = backslashes; j > 0; j--)
 
5076
                *p++ = '\\';
 
5077
              *p++ = '"';
 
5078
            }
 
5079
          *p = '\0';
 
5080
 
 
5081
          new_argv[i] = quoted_string;
 
5082
        }
 
5083
      else
 
5084
        new_argv[i] = (char *) string;
 
5085
    }
 
5086
  new_argv[argc] = NULL;
 
5087
 
 
5088
  return new_argv;
 
5089
}
 
5090
EOF
 
5091
                ;;
 
5092
            esac
 
5093
 
 
5094
            cat <<"EOF"
 
5095
void lt_dump_script (FILE* f)
 
5096
{
 
5097
EOF
 
5098
            func_emit_wrapper yes |
 
5099
              $SED -n -e '
 
5100
s/^\(.\{79\}\)\(..*\)/\1\
 
5101
\2/
 
5102
h
 
5103
s/\([\\"]\)/\\\1/g
 
5104
s/$/\\n/
 
5105
s/\([^\n]*\).*/  fputs ("\1", f);/p
 
5106
g
 
5107
D'
 
5108
            cat <<"EOF"
 
5109
}
 
5110
EOF
 
5111
}
 
5112
# end: func_emit_cwrapperexe_src
 
5113
 
 
5114
# func_win32_import_lib_p ARG
 
5115
# True if ARG is an import lib, as indicated by $file_magic_cmd
 
5116
func_win32_import_lib_p ()
 
5117
{
 
5118
    $opt_debug
 
5119
    case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
 
5120
    *import*) : ;;
 
5121
    *) false ;;
 
5122
    esac
 
5123
}
 
5124
 
 
5125
# func_mode_link arg...
 
5126
func_mode_link ()
 
5127
{
 
5128
    $opt_debug
841
5129
    case $host in
842
 
    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
 
5130
    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
843
5131
      # It is impossible to link a dll without this setting, and
844
5132
      # we shouldn't force the makefile maintainer to figure out
845
5133
      # which system we are compiling for in order to pass an extra
857
5145
      allow_undefined=yes
858
5146
      ;;
859
5147
    esac
860
 
    libtool_args="$nonopt"
 
5148
    libtool_args=$nonopt
861
5149
    base_compile="$nonopt $@"
862
 
    compile_command="$nonopt"
863
 
    finalize_command="$nonopt"
 
5150
    compile_command=$nonopt
 
5151
    finalize_command=$nonopt
864
5152
 
865
5153
    compile_rpath=
866
5154
    finalize_rpath=
875
5163
    dllsearchpath=
876
5164
    lib_search_path=`pwd`
877
5165
    inst_prefix_dir=
 
5166
    new_inherited_linker_flags=
878
5167
 
879
5168
    avoid_version=no
 
5169
    bindir=
880
5170
    dlfiles=
881
5171
    dlprefiles=
882
5172
    dlself=no
903
5193
    thread_safe=no
904
5194
    vinfo=
905
5195
    vinfo_number=no
906
 
 
907
 
    # Infer tagged configuration to use if any are available and
908
 
    # if one wasn't chosen via the "--tag" command line option.
909
 
    # Only attempt this if the compiler in the base link
910
 
    # command doesn't match the default compiler.
911
 
    if test -n "$available_tags" && test -z "$tagname"; then
912
 
      case $base_compile in
913
 
      # Blanks in the command may have been stripped by the calling shell,
914
 
      # but not from the CC environment variable when configure was run.
915
 
      "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) ;;
916
 
      # Blanks at the start of $base_compile will cause this to fail
917
 
      # if we don't check for them as well.
918
 
      *)
919
 
        for z in $available_tags; do
920
 
          if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
921
 
            # Evaluate the configuration.
922
 
            eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
923
 
            case $base_compile in
924
 
            "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)
925
 
              # The compiler in $compile_command matches
926
 
              # the one in the tagged configuration.
927
 
              # Assume this is the tagged configuration we want.
928
 
              tagname=$z
929
 
              break
930
 
              ;;
931
 
            esac
932
 
          fi
933
 
        done
934
 
        # If $tagname still isn't set, then no tagged configuration
935
 
        # was found and let the user know that the "--tag" command
936
 
        # line option must be used.
937
 
        if test -z "$tagname"; then
938
 
          $echo "$modename: unable to infer tagged configuration"
939
 
          $echo "$modename: specify a tag with \`--tag'" 1>&2
940
 
          exit 1
941
 
#       else
942
 
#         $echo "$modename: using $tagname tagged configuration"
943
 
        fi
944
 
        ;;
945
 
      esac
946
 
    fi
 
5196
    weak_libs=
 
5197
    single_module="${wl}-single_module"
 
5198
    func_infer_tag $base_compile
947
5199
 
948
5200
    # We need to know -static, to get the right output filenames.
949
5201
    for arg
950
5202
    do
951
5203
      case $arg in
952
 
      -all-static | -static)
953
 
        if test "X$arg" = "X-all-static"; then
 
5204
      -shared)
 
5205
        test "$build_libtool_libs" != yes && \
 
5206
          func_fatal_configuration "can not build a shared library"
 
5207
        build_old_libs=no
 
5208
        break
 
5209
        ;;
 
5210
      -all-static | -static | -static-libtool-libs)
 
5211
        case $arg in
 
5212
        -all-static)
954
5213
          if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
955
 
            $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
 
5214
            func_warning "complete static linking is impossible in this configuration"
956
5215
          fi
957
5216
          if test -n "$link_static_flag"; then
958
5217
            dlopen_self=$dlopen_self_static
959
5218
          fi
960
 
        else
961
 
          if test -z "$pic_flag" && test -n "$link_static_flag"; then
962
 
            dlopen_self=$dlopen_self_static
963
 
          fi
964
 
        fi
 
5219
          prefer_static_libs=yes
 
5220
          ;;
 
5221
        -static)
 
5222
          if test -z "$pic_flag" && test -n "$link_static_flag"; then
 
5223
            dlopen_self=$dlopen_self_static
 
5224
          fi
 
5225
          prefer_static_libs=built
 
5226
          ;;
 
5227
        -static-libtool-libs)
 
5228
          if test -z "$pic_flag" && test -n "$link_static_flag"; then
 
5229
            dlopen_self=$dlopen_self_static
 
5230
          fi
 
5231
          prefer_static_libs=yes
 
5232
          ;;
 
5233
        esac
965
5234
        build_libtool_libs=no
966
5235
        build_old_libs=yes
967
 
        prefer_static_libs=yes
968
5236
        break
969
5237
        ;;
970
5238
      esac
977
5245
    while test "$#" -gt 0; do
978
5246
      arg="$1"
979
5247
      shift
980
 
      case $arg in
981
 
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
982
 
        qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
983
 
        ;;
984
 
      *) qarg=$arg ;;
985
 
      esac
986
 
      libtool_args="$libtool_args $qarg"
 
5248
      func_quote_for_eval "$arg"
 
5249
      qarg=$func_quote_for_eval_unquoted_result
 
5250
      func_append libtool_args " $func_quote_for_eval_result"
987
5251
 
988
5252
      # If the previous option needs an argument, assign it.
989
5253
      if test -n "$prev"; then
990
5254
        case $prev in
991
5255
        output)
992
 
          compile_command="$compile_command @OUTPUT@"
993
 
          finalize_command="$finalize_command @OUTPUT@"
 
5256
          func_append compile_command " @OUTPUT@"
 
5257
          func_append finalize_command " @OUTPUT@"
994
5258
          ;;
995
5259
        esac
996
5260
 
997
5261
        case $prev in
 
5262
        bindir)
 
5263
          bindir="$arg"
 
5264
          prev=
 
5265
          continue
 
5266
          ;;
998
5267
        dlfiles|dlprefiles)
999
5268
          if test "$preload" = no; then
1000
5269
            # Add the symbol object into the linking commands.
1001
 
            compile_command="$compile_command @SYMFILE@"
1002
 
            finalize_command="$finalize_command @SYMFILE@"
 
5270
            func_append compile_command " @SYMFILE@"
 
5271
            func_append finalize_command " @SYMFILE@"
1003
5272
            preload=yes
1004
5273
          fi
1005
5274
          case $arg in
1026
5295
            ;;
1027
5296
          *)
1028
5297
            if test "$prev" = dlfiles; then
1029
 
              dlfiles="$dlfiles $arg"
 
5298
              func_append dlfiles " $arg"
1030
5299
            else
1031
 
              dlprefiles="$dlprefiles $arg"
 
5300
              func_append dlprefiles " $arg"
1032
5301
            fi
1033
5302
            prev=
1034
5303
            continue
1037
5306
          ;;
1038
5307
        expsyms)
1039
5308
          export_symbols="$arg"
1040
 
          if test ! -f "$arg"; then
1041
 
            $echo "$modename: symbol file \`$arg' does not exist"
1042
 
            exit 1
1043
 
          fi
 
5309
          test -f "$arg" \
 
5310
            || func_fatal_error "symbol file \`$arg' does not exist"
1044
5311
          prev=
1045
5312
          continue
1046
5313
          ;;
1049
5316
          prev=
1050
5317
          continue
1051
5318
          ;;
 
5319
        framework)
 
5320
          case $host in
 
5321
            *-*-darwin*)
 
5322
              case "$deplibs " in
 
5323
                *" $qarg.ltframework "*) ;;
 
5324
                *) func_append deplibs " $qarg.ltframework" # this is fixed later
 
5325
                   ;;
 
5326
              esac
 
5327
              ;;
 
5328
          esac
 
5329
          prev=
 
5330
          continue
 
5331
          ;;
1052
5332
        inst_prefix)
1053
5333
          inst_prefix_dir="$arg"
1054
5334
          prev=
1055
5335
          continue
1056
5336
          ;;
1057
 
        precious_regex)
1058
 
          precious_files_regex="$arg"
1059
 
          prev=
1060
 
          continue
1061
 
          ;;
1062
 
        release)
1063
 
          release="-$arg"
1064
 
          prev=
1065
 
          continue
1066
 
          ;;
1067
5337
        objectlist)
1068
5338
          if test -f "$arg"; then
1069
5339
            save_arg=$arg
1070
5340
            moreargs=
1071
 
            for fil in `cat $save_arg`
 
5341
            for fil in `cat "$save_arg"`
1072
5342
            do
1073
 
#             moreargs="$moreargs $fil"
 
5343
#             func_append moreargs " $fil"
1074
5344
              arg=$fil
1075
5345
              # A libtool-controlled object.
1076
5346
 
1077
5347
              # Check to see that this really is a libtool object.
1078
 
              if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
5348
              if func_lalib_unsafe_p "$arg"; then
1079
5349
                pic_object=
1080
5350
                non_pic_object=
1081
5351
 
1082
5352
                # Read the .lo file
1083
 
                # If there is no directory component, then add one.
1084
 
                case $arg in
1085
 
                */* | *\\*) . $arg ;;
1086
 
                *) . ./$arg ;;
1087
 
                esac
 
5353
                func_source "$arg"
1088
5354
 
1089
 
                if test -z "$pic_object" || \
 
5355
                if test -z "$pic_object" ||
1090
5356
                   test -z "$non_pic_object" ||
1091
 
                   test "$pic_object" = none && \
 
5357
                   test "$pic_object" = none &&
1092
5358
                   test "$non_pic_object" = none; then
1093
 
                  $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1094
 
                  exit 1
 
5359
                  func_fatal_error "cannot find name of object for \`$arg'"
1095
5360
                fi
1096
5361
 
1097
5362
                # Extract subdirectory from the argument.
1098
 
                xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1099
 
                if test "X$xdir" = "X$arg"; then
1100
 
                  xdir=
1101
 
                else
1102
 
                  xdir="$xdir/"
1103
 
                fi
 
5363
                func_dirname "$arg" "/" ""
 
5364
                xdir="$func_dirname_result"
1104
5365
 
1105
5366
                if test "$pic_object" != none; then
1106
5367
                  # Prepend the subdirectory the object is found in.
1108
5369
 
1109
5370
                  if test "$prev" = dlfiles; then
1110
5371
                    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1111
 
                      dlfiles="$dlfiles $pic_object"
 
5372
                      func_append dlfiles " $pic_object"
1112
5373
                      prev=
1113
5374
                      continue
1114
5375
                    else
1120
5381
                  # CHECK ME:  I think I busted this.  -Ossama
1121
5382
                  if test "$prev" = dlprefiles; then
1122
5383
                    # Preload the old-style object.
1123
 
                    dlprefiles="$dlprefiles $pic_object"
 
5384
                    func_append dlprefiles " $pic_object"
1124
5385
                    prev=
1125
5386
                  fi
1126
5387
 
1127
5388
                  # A PIC object.
1128
 
                  libobjs="$libobjs $pic_object"
 
5389
                  func_append libobjs " $pic_object"
1129
5390
                  arg="$pic_object"
1130
5391
                fi
1131
5392
 
1135
5396
                  non_pic_object="$xdir$non_pic_object"
1136
5397
 
1137
5398
                  # A standard non-PIC object
1138
 
                  non_pic_objects="$non_pic_objects $non_pic_object"
 
5399
                  func_append non_pic_objects " $non_pic_object"
1139
5400
                  if test -z "$pic_object" || test "$pic_object" = none ; then
1140
5401
                    arg="$non_pic_object"
1141
5402
                  fi
 
5403
                else
 
5404
                  # If the PIC object exists, use it instead.
 
5405
                  # $xdir was prepended to $pic_object above.
 
5406
                  non_pic_object="$pic_object"
 
5407
                  func_append non_pic_objects " $non_pic_object"
1142
5408
                fi
1143
5409
              else
1144
5410
                # Only an error if not doing a dry-run.
1145
 
                if test -z "$run"; then
1146
 
                  $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1147
 
                  exit 1
1148
 
                else
1149
 
                  # Dry-run case.
1150
 
 
 
5411
                if $opt_dry_run; then
1151
5412
                  # Extract subdirectory from the argument.
1152
 
                  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1153
 
                  if test "X$xdir" = "X$arg"; then
1154
 
                    xdir=
1155
 
                  else
1156
 
                    xdir="$xdir/"
1157
 
                  fi
 
5413
                  func_dirname "$arg" "/" ""
 
5414
                  xdir="$func_dirname_result"
1158
5415
 
1159
 
                  pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1160
 
                  non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1161
 
                  libobjs="$libobjs $pic_object"
1162
 
                  non_pic_objects="$non_pic_objects $non_pic_object"
 
5416
                  func_lo2o "$arg"
 
5417
                  pic_object=$xdir$objdir/$func_lo2o_result
 
5418
                  non_pic_object=$xdir$func_lo2o_result
 
5419
                  func_append libobjs " $pic_object"
 
5420
                  func_append non_pic_objects " $non_pic_object"
 
5421
                else
 
5422
                  func_fatal_error "\`$arg' is not a valid libtool object"
1163
5423
                fi
1164
5424
              fi
1165
5425
            done
1166
5426
          else
1167
 
            $echo "$modename: link input file \`$save_arg' does not exist"
1168
 
            exit 1
 
5427
            func_fatal_error "link input file \`$arg' does not exist"
1169
5428
          fi
1170
5429
          arg=$save_arg
1171
5430
          prev=
1172
5431
          continue
1173
5432
          ;;
 
5433
        precious_regex)
 
5434
          precious_files_regex="$arg"
 
5435
          prev=
 
5436
          continue
 
5437
          ;;
 
5438
        release)
 
5439
          release="-$arg"
 
5440
          prev=
 
5441
          continue
 
5442
          ;;
1174
5443
        rpath | xrpath)
1175
5444
          # We need an absolute path.
1176
5445
          case $arg in
1177
5446
          [\\/]* | [A-Za-z]:[\\/]*) ;;
1178
5447
          *)
1179
 
            $echo "$modename: only absolute run-paths are allowed" 1>&2
1180
 
            exit 1
 
5448
            func_fatal_error "only absolute run-paths are allowed"
1181
5449
            ;;
1182
5450
          esac
1183
5451
          if test "$prev" = rpath; then
1184
5452
            case "$rpath " in
1185
5453
            *" $arg "*) ;;
1186
 
            *) rpath="$rpath $arg" ;;
 
5454
            *) func_append rpath " $arg" ;;
1187
5455
            esac
1188
5456
          else
1189
5457
            case "$xrpath " in
1190
5458
            *" $arg "*) ;;
1191
 
            *) xrpath="$xrpath $arg" ;;
 
5459
            *) func_append xrpath " $arg" ;;
1192
5460
            esac
1193
5461
          fi
1194
5462
          prev=
1195
5463
          continue
1196
5464
          ;;
 
5465
        shrext)
 
5466
          shrext_cmds="$arg"
 
5467
          prev=
 
5468
          continue
 
5469
          ;;
 
5470
        weak)
 
5471
          func_append weak_libs " $arg"
 
5472
          prev=
 
5473
          continue
 
5474
          ;;
 
5475
        xcclinker)
 
5476
          func_append linker_flags " $qarg"
 
5477
          func_append compiler_flags " $qarg"
 
5478
          prev=
 
5479
          func_append compile_command " $qarg"
 
5480
          func_append finalize_command " $qarg"
 
5481
          continue
 
5482
          ;;
1197
5483
        xcompiler)
1198
 
          compiler_flags="$compiler_flags $qarg"
 
5484
          func_append compiler_flags " $qarg"
1199
5485
          prev=
1200
 
          compile_command="$compile_command $qarg"
1201
 
          finalize_command="$finalize_command $qarg"
 
5486
          func_append compile_command " $qarg"
 
5487
          func_append finalize_command " $qarg"
1202
5488
          continue
1203
5489
          ;;
1204
5490
        xlinker)
1205
 
          linker_flags="$linker_flags $qarg"
1206
 
          compiler_flags="$compiler_flags $wl$qarg"
1207
 
          prev=
1208
 
          compile_command="$compile_command $wl$qarg"
1209
 
          finalize_command="$finalize_command $wl$qarg"
1210
 
          continue
1211
 
          ;;
1212
 
        xcclinker)
1213
 
          linker_flags="$linker_flags $qarg"
1214
 
          compiler_flags="$compiler_flags $qarg"
1215
 
          prev=
1216
 
          compile_command="$compile_command $qarg"
1217
 
          finalize_command="$finalize_command $qarg"
 
5491
          func_append linker_flags " $qarg"
 
5492
          func_append compiler_flags " $wl$qarg"
 
5493
          prev=
 
5494
          func_append compile_command " $wl$qarg"
 
5495
          func_append finalize_command " $wl$qarg"
1218
5496
          continue
1219
5497
          ;;
1220
5498
        *)
1230
5508
      case $arg in
1231
5509
      -all-static)
1232
5510
        if test -n "$link_static_flag"; then
1233
 
          compile_command="$compile_command $link_static_flag"
1234
 
          finalize_command="$finalize_command $link_static_flag"
 
5511
          # See comment for -static flag below, for more details.
 
5512
          func_append compile_command " $link_static_flag"
 
5513
          func_append finalize_command " $link_static_flag"
1235
5514
        fi
1236
5515
        continue
1237
5516
        ;;
1238
5517
 
1239
5518
      -allow-undefined)
1240
5519
        # FIXME: remove this flag sometime in the future.
1241
 
        $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1242
 
        continue
 
5520
        func_fatal_error "\`-allow-undefined' must not be used because it is the default"
1243
5521
        ;;
1244
5522
 
1245
5523
      -avoid-version)
1247
5525
        continue
1248
5526
        ;;
1249
5527
 
 
5528
      -bindir)
 
5529
        prev=bindir
 
5530
        continue
 
5531
        ;;
 
5532
 
1250
5533
      -dlopen)
1251
5534
        prev=dlfiles
1252
5535
        continue
1264
5547
 
1265
5548
      -export-symbols | -export-symbols-regex)
1266
5549
        if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1267
 
          $echo "$modename: more than one -exported-symbols argument is not allowed"
1268
 
          exit 1
 
5550
          func_fatal_error "more than one -exported-symbols argument is not allowed"
1269
5551
        fi
1270
5552
        if test "X$arg" = "X-export-symbols"; then
1271
5553
          prev=expsyms
1275
5557
        continue
1276
5558
        ;;
1277
5559
 
 
5560
      -framework)
 
5561
        prev=framework
 
5562
        continue
 
5563
        ;;
 
5564
 
1278
5565
      -inst-prefix-dir)
1279
5566
        prev=inst_prefix
1280
5567
        continue
1285
5572
      -L[A-Z][A-Z]*:*)
1286
5573
        case $with_gcc/$host in
1287
5574
        no/*-*-irix* | /*-*-irix*)
1288
 
          compile_command="$compile_command $arg"
1289
 
          finalize_command="$finalize_command $arg"
 
5575
          func_append compile_command " $arg"
 
5576
          func_append finalize_command " $arg"
1290
5577
          ;;
1291
5578
        esac
1292
5579
        continue
1293
5580
        ;;
1294
5581
 
1295
5582
      -L*)
1296
 
        dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
 
5583
        func_stripname "-L" '' "$arg"
 
5584
        if test -z "$func_stripname_result"; then
 
5585
          if test "$#" -gt 0; then
 
5586
            func_fatal_error "require no space between \`-L' and \`$1'"
 
5587
          else
 
5588
            func_fatal_error "need path for \`-L' option"
 
5589
          fi
 
5590
        fi
 
5591
        func_resolve_sysroot "$func_stripname_result"
 
5592
        dir=$func_resolve_sysroot_result
1297
5593
        # We need an absolute path.
1298
5594
        case $dir in
1299
5595
        [\\/]* | [A-Za-z]:[\\/]*) ;;
1300
5596
        *)
1301
5597
          absdir=`cd "$dir" && pwd`
1302
 
          if test -z "$absdir"; then
1303
 
            $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1304
 
            exit 1
1305
 
          fi
 
5598
          test -z "$absdir" && \
 
5599
            func_fatal_error "cannot determine absolute directory name of \`$dir'"
1306
5600
          dir="$absdir"
1307
5601
          ;;
1308
5602
        esac
1309
5603
        case "$deplibs " in
1310
 
        *" -L$dir "*) ;;
 
5604
        *" -L$dir "* | *" $arg "*)
 
5605
          # Will only happen for absolute or sysroot arguments
 
5606
          ;;
1311
5607
        *)
1312
 
          deplibs="$deplibs -L$dir"
1313
 
          lib_search_path="$lib_search_path $dir"
 
5608
          # Preserve sysroot, but never include relative directories
 
5609
          case $dir in
 
5610
            [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
 
5611
            *) func_append deplibs " -L$dir" ;;
 
5612
          esac
 
5613
          func_append lib_search_path " $dir"
1314
5614
          ;;
1315
5615
        esac
1316
5616
        case $host in
1317
 
        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
 
5617
        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
 
5618
          testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
1318
5619
          case :$dllsearchpath: in
1319
5620
          *":$dir:"*) ;;
1320
 
          *) dllsearchpath="$dllsearchpath:$dir";;
 
5621
          ::) dllsearchpath=$dir;;
 
5622
          *) func_append dllsearchpath ":$dir";;
 
5623
          esac
 
5624
          case :$dllsearchpath: in
 
5625
          *":$testbindir:"*) ;;
 
5626
          ::) dllsearchpath=$testbindir;;
 
5627
          *) func_append dllsearchpath ":$testbindir";;
1321
5628
          esac
1322
5629
          ;;
1323
5630
        esac
 
5631
        deplibs="$deplibs $arg"
1324
5632
        continue
1325
5633
        ;;
1326
5634
 
1327
5635
      -l*)
1328
5636
        if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1329
5637
          case $host in
1330
 
          *-*-cygwin* | *-*-pw32* | *-*-beos*)
 
5638
          *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
1331
5639
            # These systems don't actually have a C or math library (as such)
1332
5640
            continue
1333
5641
            ;;
1334
 
          *-*-mingw* | *-*-os2*)
 
5642
          *-*-os2*)
1335
5643
            # These systems don't actually have a C library (as such)
1336
5644
            test "X$arg" = "X-lc" && continue
1337
5645
            ;;
1338
 
          *-*-openbsd* | *-*-freebsd*)
 
5646
          *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1339
5647
            # Do not include libc due to us having libc/libc_r.
1340
5648
            test "X$arg" = "X-lc" && continue
1341
5649
            ;;
1342
5650
          *-*-rhapsody* | *-*-darwin1.[012])
1343
5651
            # Rhapsody C and math libraries are in the System framework
1344
 
            deplibs="$deplibs -framework System"
 
5652
            func_append deplibs " System.ltframework"
1345
5653
            continue
 
5654
            ;;
 
5655
          *-*-sco3.2v5* | *-*-sco5v6*)
 
5656
            # Causes problems with __ctype
 
5657
            test "X$arg" = "X-lc" && continue
 
5658
            ;;
 
5659
          *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
 
5660
            # Compiler inserts libc in the correct place for threads to work
 
5661
            test "X$arg" = "X-lc" && continue
 
5662
            ;;
1346
5663
          esac
1347
5664
        elif test "X$arg" = "X-lc_r"; then
1348
5665
         case $host in
1349
 
         *-*-openbsd* | *-*-freebsd*)
 
5666
         *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1350
5667
           # Do not include libc_r directly, use -pthread flag.
1351
5668
           continue
1352
5669
           ;;
1353
5670
         esac
1354
5671
        fi
1355
 
        deplibs="$deplibs $arg"
1356
 
        continue
1357
 
        ;;
1358
 
 
1359
 
     -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
1360
 
        deplibs="$deplibs $arg"
 
5672
        func_append deplibs " $arg"
1361
5673
        continue
1362
5674
        ;;
1363
5675
 
1366
5678
        continue
1367
5679
        ;;
1368
5680
 
1369
 
      # gcc -m* arguments should be passed to the linker via $compiler_flags
1370
 
      # in order to pass architecture information to the linker
1371
 
      # (e.g. 32 vs 64-bit).  This may also be accomplished via -Wl,-mfoo
1372
 
      # but this is not reliable with gcc because gcc may use -mfoo to
1373
 
      # select a different linker, different libraries, etc, while
1374
 
      # -Wl,-mfoo simply passes -mfoo to the linker.
1375
 
      -m*)
1376
 
        # Unknown arguments in both finalize_command and compile_command need
1377
 
        # to be aesthetically quoted because they are evaled later.
1378
 
        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1379
 
        case $arg in
1380
 
        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
1381
 
          arg="\"$arg\""
1382
 
          ;;
 
5681
      # Tru64 UNIX uses -model [arg] to determine the layout of C++
 
5682
      # classes, name mangling, and exception handling.
 
5683
      # Darwin uses the -arch flag to determine output architecture.
 
5684
      -model|-arch|-isysroot|--sysroot)
 
5685
        func_append compiler_flags " $arg"
 
5686
        func_append compile_command " $arg"
 
5687
        func_append finalize_command " $arg"
 
5688
        prev=xcompiler
 
5689
        continue
 
5690
        ;;
 
5691
 
 
5692
      -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
 
5693
      |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
 
5694
        func_append compiler_flags " $arg"
 
5695
        func_append compile_command " $arg"
 
5696
        func_append finalize_command " $arg"
 
5697
        case "$new_inherited_linker_flags " in
 
5698
            *" $arg "*) ;;
 
5699
            * ) func_append new_inherited_linker_flags " $arg" ;;
1383
5700
        esac
1384
 
        compile_command="$compile_command $arg"
1385
 
        finalize_command="$finalize_command $arg"
1386
 
        if test "$with_gcc" = "yes" ; then
1387
 
          compiler_flags="$compiler_flags $arg"
1388
 
        fi
1389
 
        continue
1390
 
        ;;
 
5701
        continue
 
5702
        ;;
1391
5703
 
1392
 
      -shrext)
1393
 
        prev=shrext
 
5704
      -multi_module)
 
5705
        single_module="${wl}-multi_module"
1394
5706
        continue
1395
5707
        ;;
1396
5708
 
1401
5713
 
1402
5714
      -no-install)
1403
5715
        case $host in
1404
 
        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
 
5716
        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
1405
5717
          # The PATH hackery in wrapper scripts is required on Windows
1406
 
          # in order for the loader to find any dlls it needs.
1407
 
          $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1408
 
          $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
 
5718
          # and Darwin in order for the loader to find any dlls it needs.
 
5719
          func_warning "\`-no-install' is ignored for $host"
 
5720
          func_warning "assuming \`-no-fast-install' instead"
1409
5721
          fast_install=no
1410
5722
          ;;
1411
5723
        *) no_install=yes ;;
1446
5758
        ;;
1447
5759
 
1448
5760
      -R*)
1449
 
        dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
 
5761
        func_stripname '-R' '' "$arg"
 
5762
        dir=$func_stripname_result
1450
5763
        # We need an absolute path.
1451
5764
        case $dir in
1452
5765
        [\\/]* | [A-Za-z]:[\\/]*) ;;
 
5766
        =*)
 
5767
          func_stripname '=' '' "$dir"
 
5768
          dir=$lt_sysroot$func_stripname_result
 
5769
          ;;
1453
5770
        *)
1454
 
          $echo "$modename: only absolute run-paths are allowed" 1>&2
1455
 
          exit 1
 
5771
          func_fatal_error "only absolute run-paths are allowed"
1456
5772
          ;;
1457
5773
        esac
1458
5774
        case "$xrpath " in
1459
5775
        *" $dir "*) ;;
1460
 
        *) xrpath="$xrpath $dir" ;;
 
5776
        *) func_append xrpath " $dir" ;;
1461
5777
        esac
1462
5778
        continue
1463
5779
        ;;
1464
5780
 
1465
 
      -static)
 
5781
      -shared)
 
5782
        # The effects of -shared are defined in a previous loop.
 
5783
        continue
 
5784
        ;;
 
5785
 
 
5786
      -shrext)
 
5787
        prev=shrext
 
5788
        continue
 
5789
        ;;
 
5790
 
 
5791
      -static | -static-libtool-libs)
1466
5792
        # The effects of -static are defined in a previous loop.
1467
5793
        # We used to do the same as -all-static on platforms that
1468
5794
        # didn't have a PIC flag, but the assumption that the effects
1480
5806
        prev=vinfo
1481
5807
        continue
1482
5808
        ;;
 
5809
 
1483
5810
      -version-number)
1484
5811
        prev=vinfo
1485
5812
        vinfo_number=yes
1486
5813
        continue
1487
5814
        ;;
1488
5815
 
 
5816
      -weak)
 
5817
        prev=weak
 
5818
        continue
 
5819
        ;;
 
5820
 
1489
5821
      -Wc,*)
1490
 
        args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
 
5822
        func_stripname '-Wc,' '' "$arg"
 
5823
        args=$func_stripname_result
1491
5824
        arg=
1492
5825
        save_ifs="$IFS"; IFS=','
1493
5826
        for flag in $args; do
1494
5827
          IFS="$save_ifs"
1495
 
          case $flag in
1496
 
            *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
1497
 
            flag="\"$flag\""
1498
 
            ;;
1499
 
          esac
1500
 
          arg="$arg $wl$flag"
1501
 
          compiler_flags="$compiler_flags $flag"
 
5828
          func_quote_for_eval "$flag"
 
5829
          func_append arg " $func_quote_for_eval_result"
 
5830
          func_append compiler_flags " $func_quote_for_eval_result"
1502
5831
        done
1503
5832
        IFS="$save_ifs"
1504
 
        arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
 
5833
        func_stripname ' ' '' "$arg"
 
5834
        arg=$func_stripname_result
1505
5835
        ;;
1506
5836
 
1507
5837
      -Wl,*)
1508
 
        args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
 
5838
        func_stripname '-Wl,' '' "$arg"
 
5839
        args=$func_stripname_result
1509
5840
        arg=
1510
5841
        save_ifs="$IFS"; IFS=','
1511
5842
        for flag in $args; do
1512
5843
          IFS="$save_ifs"
1513
 
          case $flag in
1514
 
            *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
1515
 
            flag="\"$flag\""
1516
 
            ;;
1517
 
          esac
1518
 
          arg="$arg $wl$flag"
1519
 
          compiler_flags="$compiler_flags $wl$flag"
1520
 
          linker_flags="$linker_flags $flag"
 
5844
          func_quote_for_eval "$flag"
 
5845
          func_append arg " $wl$func_quote_for_eval_result"
 
5846
          func_append compiler_flags " $wl$func_quote_for_eval_result"
 
5847
          func_append linker_flags " $func_quote_for_eval_result"
1521
5848
        done
1522
5849
        IFS="$save_ifs"
1523
 
        arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
 
5850
        func_stripname ' ' '' "$arg"
 
5851
        arg=$func_stripname_result
1524
5852
        ;;
1525
5853
 
1526
5854
      -Xcompiler)
1538
5866
        continue
1539
5867
        ;;
1540
5868
 
 
5869
      # -msg_* for osf cc
 
5870
      -msg_*)
 
5871
        func_quote_for_eval "$arg"
 
5872
        arg="$func_quote_for_eval_result"
 
5873
        ;;
 
5874
 
 
5875
      # Flags to be passed through unchanged, with rationale:
 
5876
      # -64, -mips[0-9]      enable 64-bit mode for the SGI compiler
 
5877
      # -r[0-9][0-9]*        specify processor for the SGI compiler
 
5878
      # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
 
5879
      # +DA*, +DD*           enable 64-bit mode for the HP compiler
 
5880
      # -q*                  compiler args for the IBM compiler
 
5881
      # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
 
5882
      # -F/path              path to uninstalled frameworks, gcc on darwin
 
5883
      # -p, -pg, --coverage, -fprofile-*  profiling flags for GCC
 
5884
      # @file                GCC response files
 
5885
      # -tp=*                Portland pgcc target processor selection
 
5886
      # --sysroot=*          for sysroot support
 
5887
      # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
 
5888
      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
 
5889
      -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
 
5890
      -O*|-flto*|-fwhopr*|-fuse-linker-plugin)
 
5891
        func_quote_for_eval "$arg"
 
5892
        arg="$func_quote_for_eval_result"
 
5893
        func_append compile_command " $arg"
 
5894
        func_append finalize_command " $arg"
 
5895
        func_append compiler_flags " $arg"
 
5896
        continue
 
5897
        ;;
 
5898
 
1541
5899
      # Some other compiler flag.
1542
5900
      -* | +*)
1543
 
        # Unknown arguments in both finalize_command and compile_command need
1544
 
        # to be aesthetically quoted because they are evaled later.
1545
 
        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1546
 
        case $arg in
1547
 
        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
1548
 
          arg="\"$arg\""
1549
 
          ;;
1550
 
        esac
 
5901
        func_quote_for_eval "$arg"
 
5902
        arg="$func_quote_for_eval_result"
1551
5903
        ;;
1552
5904
 
1553
5905
      *.$objext)
1554
5906
        # A standard object.
1555
 
        objs="$objs $arg"
 
5907
        func_append objs " $arg"
1556
5908
        ;;
1557
5909
 
1558
5910
      *.lo)
1559
5911
        # A libtool-controlled object.
1560
5912
 
1561
5913
        # Check to see that this really is a libtool object.
1562
 
        if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
5914
        if func_lalib_unsafe_p "$arg"; then
1563
5915
          pic_object=
1564
5916
          non_pic_object=
1565
5917
 
1566
5918
          # Read the .lo file
1567
 
          # If there is no directory component, then add one.
1568
 
          case $arg in
1569
 
          */* | *\\*) . $arg ;;
1570
 
          *) . ./$arg ;;
1571
 
          esac
 
5919
          func_source "$arg"
1572
5920
 
1573
 
          if test -z "$pic_object" || \
 
5921
          if test -z "$pic_object" ||
1574
5922
             test -z "$non_pic_object" ||
1575
 
             test "$pic_object" = none && \
 
5923
             test "$pic_object" = none &&
1576
5924
             test "$non_pic_object" = none; then
1577
 
            $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1578
 
            exit 1
 
5925
            func_fatal_error "cannot find name of object for \`$arg'"
1579
5926
          fi
1580
5927
 
1581
5928
          # Extract subdirectory from the argument.
1582
 
          xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1583
 
          if test "X$xdir" = "X$arg"; then
1584
 
            xdir=
1585
 
          else
1586
 
            xdir="$xdir/"
1587
 
          fi
 
5929
          func_dirname "$arg" "/" ""
 
5930
          xdir="$func_dirname_result"
1588
5931
 
1589
5932
          if test "$pic_object" != none; then
1590
5933
            # Prepend the subdirectory the object is found in.
1592
5935
 
1593
5936
            if test "$prev" = dlfiles; then
1594
5937
              if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1595
 
                dlfiles="$dlfiles $pic_object"
 
5938
                func_append dlfiles " $pic_object"
1596
5939
                prev=
1597
5940
                continue
1598
5941
              else
1604
5947
            # CHECK ME:  I think I busted this.  -Ossama
1605
5948
            if test "$prev" = dlprefiles; then
1606
5949
              # Preload the old-style object.
1607
 
              dlprefiles="$dlprefiles $pic_object"
 
5950
              func_append dlprefiles " $pic_object"
1608
5951
              prev=
1609
5952
            fi
1610
5953
 
1611
5954
            # A PIC object.
1612
 
            libobjs="$libobjs $pic_object"
 
5955
            func_append libobjs " $pic_object"
1613
5956
            arg="$pic_object"
1614
5957
          fi
1615
5958
 
1619
5962
            non_pic_object="$xdir$non_pic_object"
1620
5963
 
1621
5964
            # A standard non-PIC object
1622
 
            non_pic_objects="$non_pic_objects $non_pic_object"
 
5965
            func_append non_pic_objects " $non_pic_object"
1623
5966
            if test -z "$pic_object" || test "$pic_object" = none ; then
1624
5967
              arg="$non_pic_object"
1625
5968
            fi
 
5969
          else
 
5970
            # If the PIC object exists, use it instead.
 
5971
            # $xdir was prepended to $pic_object above.
 
5972
            non_pic_object="$pic_object"
 
5973
            func_append non_pic_objects " $non_pic_object"
1626
5974
          fi
1627
5975
        else
1628
5976
          # Only an error if not doing a dry-run.
1629
 
          if test -z "$run"; then
1630
 
            $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1631
 
            exit 1
1632
 
          else
1633
 
            # Dry-run case.
1634
 
 
 
5977
          if $opt_dry_run; then
1635
5978
            # Extract subdirectory from the argument.
1636
 
            xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1637
 
            if test "X$xdir" = "X$arg"; then
1638
 
              xdir=
1639
 
            else
1640
 
              xdir="$xdir/"
1641
 
            fi
 
5979
            func_dirname "$arg" "/" ""
 
5980
            xdir="$func_dirname_result"
1642
5981
 
1643
 
            pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1644
 
            non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1645
 
            libobjs="$libobjs $pic_object"
1646
 
            non_pic_objects="$non_pic_objects $non_pic_object"
 
5982
            func_lo2o "$arg"
 
5983
            pic_object=$xdir$objdir/$func_lo2o_result
 
5984
            non_pic_object=$xdir$func_lo2o_result
 
5985
            func_append libobjs " $pic_object"
 
5986
            func_append non_pic_objects " $non_pic_object"
 
5987
          else
 
5988
            func_fatal_error "\`$arg' is not a valid libtool object"
1647
5989
          fi
1648
5990
        fi
1649
5991
        ;;
1650
5992
 
1651
5993
      *.$libext)
1652
5994
        # An archive.
1653
 
        deplibs="$deplibs $arg"
1654
 
        old_deplibs="$old_deplibs $arg"
 
5995
        func_append deplibs " $arg"
 
5996
        func_append old_deplibs " $arg"
1655
5997
        continue
1656
5998
        ;;
1657
5999
 
1658
6000
      *.la)
1659
6001
        # A libtool-controlled library.
1660
6002
 
 
6003
        func_resolve_sysroot "$arg"
1661
6004
        if test "$prev" = dlfiles; then
1662
6005
          # This library was specified with -dlopen.
1663
 
          dlfiles="$dlfiles $arg"
 
6006
          func_append dlfiles " $func_resolve_sysroot_result"
1664
6007
          prev=
1665
6008
        elif test "$prev" = dlprefiles; then
1666
6009
          # The library was specified with -dlpreopen.
1667
 
          dlprefiles="$dlprefiles $arg"
 
6010
          func_append dlprefiles " $func_resolve_sysroot_result"
1668
6011
          prev=
1669
6012
        else
1670
 
          deplibs="$deplibs $arg"
 
6013
          func_append deplibs " $func_resolve_sysroot_result"
1671
6014
        fi
1672
6015
        continue
1673
6016
        ;;
1676
6019
      *)
1677
6020
        # Unknown arguments in both finalize_command and compile_command need
1678
6021
        # to be aesthetically quoted because they are evaled later.
1679
 
        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1680
 
        case $arg in
1681
 
        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
1682
 
          arg="\"$arg\""
1683
 
          ;;
1684
 
        esac
 
6022
        func_quote_for_eval "$arg"
 
6023
        arg="$func_quote_for_eval_result"
1685
6024
        ;;
1686
6025
      esac # arg
1687
6026
 
1688
6027
      # Now actually substitute the argument into the commands.
1689
6028
      if test -n "$arg"; then
1690
 
        compile_command="$compile_command $arg"
1691
 
        finalize_command="$finalize_command $arg"
 
6029
        func_append compile_command " $arg"
 
6030
        func_append finalize_command " $arg"
1692
6031
      fi
1693
6032
    done # argument parsing loop
1694
6033
 
1695
 
    if test -n "$prev"; then
1696
 
      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1697
 
      $echo "$help" 1>&2
1698
 
      exit 1
1699
 
    fi
 
6034
    test -n "$prev" && \
 
6035
      func_fatal_help "the \`$prevarg' option requires an argument"
1700
6036
 
1701
6037
    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1702
6038
      eval arg=\"$export_dynamic_flag_spec\"
1703
 
      compile_command="$compile_command $arg"
1704
 
      finalize_command="$finalize_command $arg"
 
6039
      func_append compile_command " $arg"
 
6040
      func_append finalize_command " $arg"
1705
6041
    fi
1706
6042
 
1707
6043
    oldlibs=
1708
6044
    # calculate the name of the file, without its directory
1709
 
    outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
 
6045
    func_basename "$output"
 
6046
    outputname="$func_basename_result"
1710
6047
    libobjs_save="$libobjs"
1711
6048
 
1712
6049
    if test -n "$shlibpath_var"; then
1713
6050
      # get the directories listed in $shlibpath_var
1714
 
      eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
 
6051
      eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\`
1715
6052
    else
1716
6053
      shlib_search_path=
1717
6054
    fi
1718
6055
    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
1719
6056
    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
1720
6057
 
1721
 
    output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1722
 
    if test "X$output_objdir" = "X$output"; then
1723
 
      output_objdir="$objdir"
1724
 
    else
1725
 
      output_objdir="$output_objdir/$objdir"
1726
 
    fi
 
6058
    func_dirname "$output" "/" ""
 
6059
    output_objdir="$func_dirname_result$objdir"
 
6060
    func_to_tool_file "$output_objdir/"
 
6061
    tool_output_objdir=$func_to_tool_file_result
1727
6062
    # Create the object directory.
1728
 
    if test ! -d "$output_objdir"; then
1729
 
      $show "$mkdir $output_objdir"
1730
 
      $run $mkdir $output_objdir
1731
 
      status=$?
1732
 
      if test "$status" -ne 0 && test ! -d "$output_objdir"; then
1733
 
        exit $status
1734
 
      fi
1735
 
    fi
 
6063
    func_mkdir_p "$output_objdir"
1736
6064
 
1737
6065
    # Determine the type of output
1738
6066
    case $output in
1739
6067
    "")
1740
 
      $echo "$modename: you must specify an output file" 1>&2
1741
 
      $echo "$help" 1>&2
1742
 
      exit 1
 
6068
      func_fatal_help "you must specify an output file"
1743
6069
      ;;
1744
6070
    *.$libext) linkmode=oldlib ;;
1745
6071
    *.lo | *.$objext) linkmode=obj ;;
1747
6073
    *) linkmode=prog ;; # Anything else should be a program.
1748
6074
    esac
1749
6075
 
1750
 
    case $host in
1751
 
    *cygwin* | *mingw* | *pw32*)
1752
 
      # don't eliminate duplcations in $postdeps and $predeps
1753
 
      duplicate_compiler_generated_deps=yes
1754
 
      ;;
1755
 
    *)
1756
 
      duplicate_compiler_generated_deps=$duplicate_deps
1757
 
      ;;
1758
 
    esac
1759
6076
    specialdeplibs=
1760
6077
 
1761
6078
    libs=
1762
6079
    # Find all interdependent deplibs by searching for libraries
1763
6080
    # that are linked more than once (e.g. -la -lb -la)
1764
6081
    for deplib in $deplibs; do
1765
 
      if test "X$duplicate_deps" = "Xyes" ; then
 
6082
      if $opt_preserve_dup_deps ; then
1766
6083
        case "$libs " in
1767
 
        *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
 
6084
        *" $deplib "*) func_append specialdeplibs " $deplib" ;;
1768
6085
        esac
1769
6086
      fi
1770
 
      libs="$libs $deplib"
 
6087
      func_append libs " $deplib"
1771
6088
    done
1772
6089
 
1773
6090
    if test "$linkmode" = lib; then
1777
6094
      # $postdeps and mark them as special (i.e., whose duplicates are
1778
6095
      # not to be eliminated).
1779
6096
      pre_post_deps=
1780
 
      if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
 
6097
      if $opt_duplicate_compiler_generated_deps; then
1781
6098
        for pre_post_dep in $predeps $postdeps; do
1782
6099
          case "$pre_post_deps " in
1783
 
          *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
 
6100
          *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
1784
6101
          esac
1785
 
          pre_post_deps="$pre_post_deps $pre_post_dep"
 
6102
          func_append pre_post_deps " $pre_post_dep"
1786
6103
        done
1787
6104
      fi
1788
6105
      pre_post_deps=
1794
6111
    need_relink=no # whether we're linking any uninstalled libtool libraries
1795
6112
    notinst_deplibs= # not-installed libtool libraries
1796
6113
    notinst_path= # paths that contain not-installed libtool libraries
 
6114
 
1797
6115
    case $linkmode in
1798
6116
    lib)
1799
 
        passes="conv link"
 
6117
        passes="conv dlpreopen link"
1800
6118
        for file in $dlfiles $dlprefiles; do
1801
6119
          case $file in
1802
6120
          *.la) ;;
1803
6121
          *)
1804
 
            $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
1805
 
            exit 1
 
6122
            func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
1806
6123
            ;;
1807
6124
          esac
1808
6125
        done
1818
6135
    *)  passes="conv"
1819
6136
        ;;
1820
6137
    esac
 
6138
 
1821
6139
    for pass in $passes; do
 
6140
      # The preopen pass in lib mode reverses $deplibs; put it back here
 
6141
      # so that -L comes before libs that need it for instance...
 
6142
      if test "$linkmode,$pass" = "lib,link"; then
 
6143
        ## FIXME: Find the place where the list is rebuilt in the wrong
 
6144
        ##        order, and fix it there properly
 
6145
        tmp_deplibs=
 
6146
        for deplib in $deplibs; do
 
6147
          tmp_deplibs="$deplib $tmp_deplibs"
 
6148
        done
 
6149
        deplibs="$tmp_deplibs"
 
6150
      fi
 
6151
 
1822
6152
      if test "$linkmode,$pass" = "lib,link" ||
1823
6153
         test "$linkmode,$pass" = "prog,scan"; then
1824
6154
        libs="$deplibs"
1831
6161
        link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
1832
6162
        esac
1833
6163
      fi
 
6164
      if test "$linkmode,$pass" = "lib,dlpreopen"; then
 
6165
        # Collect and forward deplibs of preopened libtool libs
 
6166
        for lib in $dlprefiles; do
 
6167
          # Ignore non-libtool-libs
 
6168
          dependency_libs=
 
6169
          func_resolve_sysroot "$lib"
 
6170
          case $lib in
 
6171
          *.la) func_source "$func_resolve_sysroot_result" ;;
 
6172
          esac
 
6173
 
 
6174
          # Collect preopened libtool deplibs, except any this library
 
6175
          # has declared as weak libs
 
6176
          for deplib in $dependency_libs; do
 
6177
            func_basename "$deplib"
 
6178
            deplib_base=$func_basename_result
 
6179
            case " $weak_libs " in
 
6180
            *" $deplib_base "*) ;;
 
6181
            *) func_append deplibs " $deplib" ;;
 
6182
            esac
 
6183
          done
 
6184
        done
 
6185
        libs="$dlprefiles"
 
6186
      fi
1834
6187
      if test "$pass" = dlopen; then
1835
6188
        # Collect dlpreopened libraries
1836
6189
        save_deplibs="$deplibs"
1837
6190
        deplibs=
1838
6191
      fi
 
6192
 
1839
6193
      for deplib in $libs; do
1840
6194
        lib=
1841
6195
        found=no
1842
6196
        case $deplib in
1843
 
        -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
 
6197
        -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
 
6198
        |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
1844
6199
          if test "$linkmode,$pass" = "prog,link"; then
1845
6200
            compile_deplibs="$deplib $compile_deplibs"
1846
6201
            finalize_deplibs="$deplib $finalize_deplibs"
1847
6202
          else
 
6203
            func_append compiler_flags " $deplib"
 
6204
          fi
 
6205
 
 
6206
          case $linkmode in
 
6207
          lib)
1848
6208
            deplibs="$deplib $deplibs"
1849
 
          fi
 
6209
            test "$pass" = conv && continue
 
6210
            newdependency_libs="$deplib $newdependency_libs"
 
6211
            ;;
 
6212
          prog)
 
6213
            if test "$pass" = conv; then
 
6214
              deplibs="$deplib $deplibs"
 
6215
              continue
 
6216
            fi
 
6217
            if test "$pass" = scan; then
 
6218
              deplibs="$deplib $deplibs"
 
6219
            else
 
6220
              compile_deplibs="$deplib $compile_deplibs"
 
6221
              finalize_deplibs="$deplib $finalize_deplibs"
 
6222
            fi
 
6223
            ;;
 
6224
          *)
 
6225
            ;;
 
6226
          esac # linkmode
 
6227
 
1850
6228
          continue
1851
6229
          ;;
1852
6230
        -l*)
1853
6231
          if test "$linkmode" != lib && test "$linkmode" != prog; then
1854
 
            $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
1855
 
            continue
1856
 
          fi
1857
 
          if test "$pass" = conv; then
1858
 
            deplibs="$deplib $deplibs"
1859
 
            continue
1860
 
          fi
1861
 
          name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
1862
 
          for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
1863
 
            for search_ext in .la $shrext .so .a; do
 
6232
            func_warning "\`-l' is ignored for archives/objects"
 
6233
            continue
 
6234
          fi
 
6235
          func_stripname '-l' '' "$deplib"
 
6236
          name=$func_stripname_result
 
6237
          if test "$linkmode" = lib; then
 
6238
            searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
 
6239
          else
 
6240
            searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
 
6241
          fi
 
6242
          for searchdir in $searchdirs; do
 
6243
            for search_ext in .la $std_shrext .so .a; do
1864
6244
              # Search the libtool library
1865
6245
              lib="$searchdir/lib${name}${search_ext}"
1866
6246
              if test -f "$lib"; then
1889
6269
            if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
1890
6270
              case " $predeps $postdeps " in
1891
6271
              *" $deplib "*)
1892
 
                if (${SED} -e '2q' $lib |
1893
 
                    grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
6272
                if func_lalib_p "$lib"; then
1894
6273
                  library_names=
1895
6274
                  old_library=
1896
 
                  case $lib in
1897
 
                  */* | *\\*) . $lib ;;
1898
 
                  *) . ./$lib ;;
1899
 
                  esac
 
6275
                  func_source "$lib"
1900
6276
                  for l in $old_library $library_names; do
1901
6277
                    ll="$l"
1902
6278
                  done
1903
6279
                  if test "X$ll" = "X$old_library" ; then # only static version available
1904
6280
                    found=no
1905
 
                    ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
1906
 
                    test "X$ladir" = "X$lib" && ladir="."
 
6281
                    func_dirname "$lib" "" "."
 
6282
                    ladir="$func_dirname_result"
1907
6283
                    lib=$ladir/$old_library
1908
6284
                    if test "$linkmode,$pass" = "prog,link"; then
1909
6285
                      compile_deplibs="$deplib $compile_deplibs"
1915
6291
                    continue
1916
6292
                  fi
1917
6293
                fi
1918
 
                ;;
 
6294
                ;;
1919
6295
              *) ;;
1920
6296
              esac
1921
6297
            fi
1922
6298
          fi
1923
6299
          ;; # -l
 
6300
        *.ltframework)
 
6301
          if test "$linkmode,$pass" = "prog,link"; then
 
6302
            compile_deplibs="$deplib $compile_deplibs"
 
6303
            finalize_deplibs="$deplib $finalize_deplibs"
 
6304
          else
 
6305
            deplibs="$deplib $deplibs"
 
6306
            if test "$linkmode" = lib ; then
 
6307
                case "$new_inherited_linker_flags " in
 
6308
                    *" $deplib "*) ;;
 
6309
                    * ) func_append new_inherited_linker_flags " $deplib" ;;
 
6310
                esac
 
6311
            fi
 
6312
          fi
 
6313
          continue
 
6314
          ;;
1924
6315
        -L*)
1925
6316
          case $linkmode in
1926
6317
          lib)
1927
6318
            deplibs="$deplib $deplibs"
1928
6319
            test "$pass" = conv && continue
1929
6320
            newdependency_libs="$deplib $newdependency_libs"
1930
 
            newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
 
6321
            func_stripname '-L' '' "$deplib"
 
6322
            func_resolve_sysroot "$func_stripname_result"
 
6323
            func_append newlib_search_path " $func_resolve_sysroot_result"
1931
6324
            ;;
1932
6325
          prog)
1933
6326
            if test "$pass" = conv; then
1936
6329
            fi
1937
6330
            if test "$pass" = scan; then
1938
6331
              deplibs="$deplib $deplibs"
1939
 
              newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1940
6332
            else
1941
6333
              compile_deplibs="$deplib $compile_deplibs"
1942
6334
              finalize_deplibs="$deplib $finalize_deplibs"
1943
6335
            fi
 
6336
            func_stripname '-L' '' "$deplib"
 
6337
            func_resolve_sysroot "$func_stripname_result"
 
6338
            func_append newlib_search_path " $func_resolve_sysroot_result"
1944
6339
            ;;
1945
6340
          *)
1946
 
            $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
 
6341
            func_warning "\`-L' is ignored for archives/objects"
1947
6342
            ;;
1948
6343
          esac # linkmode
1949
6344
          continue
1950
6345
          ;; # -L
1951
6346
        -R*)
1952
6347
          if test "$pass" = link; then
1953
 
            dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
 
6348
            func_stripname '-R' '' "$deplib"
 
6349
            func_resolve_sysroot "$func_stripname_result"
 
6350
            dir=$func_resolve_sysroot_result
1954
6351
            # Make sure the xrpath contains only unique directories.
1955
6352
            case "$xrpath " in
1956
6353
            *" $dir "*) ;;
1957
 
            *) xrpath="$xrpath $dir" ;;
 
6354
            *) func_append xrpath " $dir" ;;
1958
6355
            esac
1959
6356
          fi
1960
6357
          deplibs="$deplib $deplibs"
1961
6358
          continue
1962
6359
          ;;
1963
 
        *.la) lib="$deplib" ;;
 
6360
        *.la)
 
6361
          func_resolve_sysroot "$deplib"
 
6362
          lib=$func_resolve_sysroot_result
 
6363
          ;;
1964
6364
        *.$libext)
1965
6365
          if test "$pass" = conv; then
1966
6366
            deplibs="$deplib $deplibs"
1968
6368
          fi
1969
6369
          case $linkmode in
1970
6370
          lib)
1971
 
            if test "$deplibs_check_method" != pass_all; then
1972
 
              $echo
1973
 
              $echo "*** Warning: Trying to link with static lib archive $deplib."
1974
 
              $echo "*** I have the capability to make that library automatically link in when"
1975
 
              $echo "*** you link to this library.  But I can only do this if you have a"
1976
 
              $echo "*** shared version of the library, which you do not appear to have"
1977
 
              $echo "*** because the file extensions .$libext of this argument makes me believe"
1978
 
              $echo "*** that it is just a static archive that I should not used here."
1979
 
            else
1980
 
              $echo
1981
 
              $echo "*** Warning: Linking the shared library $output against the"
1982
 
              $echo "*** static library $deplib is not portable!"
1983
 
              deplibs="$deplib $deplibs"
1984
 
            fi
 
6371
            # Linking convenience modules into shared libraries is allowed,
 
6372
            # but linking other static libraries is non-portable.
 
6373
            case " $dlpreconveniencelibs " in
 
6374
            *" $deplib "*) ;;
 
6375
            *)
 
6376
              valid_a_lib=no
 
6377
              case $deplibs_check_method in
 
6378
                match_pattern*)
 
6379
                  set dummy $deplibs_check_method; shift
 
6380
                  match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
 
6381
                  if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
 
6382
                    | $EGREP "$match_pattern_regex" > /dev/null; then
 
6383
                    valid_a_lib=yes
 
6384
                  fi
 
6385
                ;;
 
6386
                pass_all)
 
6387
                  valid_a_lib=yes
 
6388
                ;;
 
6389
              esac
 
6390
              if test "$valid_a_lib" != yes; then
 
6391
                echo
 
6392
                $ECHO "*** Warning: Trying to link with static lib archive $deplib."
 
6393
                echo "*** I have the capability to make that library automatically link in when"
 
6394
                echo "*** you link to this library.  But I can only do this if you have a"
 
6395
                echo "*** shared version of the library, which you do not appear to have"
 
6396
                echo "*** because the file extensions .$libext of this argument makes me believe"
 
6397
                echo "*** that it is just a static archive that I should not use here."
 
6398
              else
 
6399
                echo
 
6400
                $ECHO "*** Warning: Linking the shared library $output against the"
 
6401
                $ECHO "*** static library $deplib is not portable!"
 
6402
                deplibs="$deplib $deplibs"
 
6403
              fi
 
6404
              ;;
 
6405
            esac
1985
6406
            continue
1986
6407
            ;;
1987
6408
          prog)
2002
6423
            if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
2003
6424
              # If there is no dlopen support or we're linking statically,
2004
6425
              # we need to preload.
2005
 
              newdlprefiles="$newdlprefiles $deplib"
 
6426
              func_append newdlprefiles " $deplib"
2006
6427
              compile_deplibs="$deplib $compile_deplibs"
2007
6428
              finalize_deplibs="$deplib $finalize_deplibs"
2008
6429
            else
2009
 
              newdlfiles="$newdlfiles $deplib"
 
6430
              func_append newdlfiles " $deplib"
2010
6431
            fi
2011
6432
          fi
2012
6433
          continue
2016
6437
          continue
2017
6438
          ;;
2018
6439
        esac # case $deplib
 
6440
 
2019
6441
        if test "$found" = yes || test -f "$lib"; then :
2020
6442
        else
2021
 
          $echo "$modename: cannot find the library \`$lib'" 1>&2
2022
 
          exit 1
 
6443
          func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
2023
6444
        fi
2024
6445
 
2025
6446
        # Check to see that this really is a libtool archive.
2026
 
        if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
2027
 
        else
2028
 
          $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2029
 
          exit 1
2030
 
        fi
 
6447
        func_lalib_unsafe_p "$lib" \
 
6448
          || func_fatal_error "\`$lib' is not a valid libtool archive"
2031
6449
 
2032
 
        ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2033
 
        test "X$ladir" = "X$lib" && ladir="."
 
6450
        func_dirname "$lib" "" "."
 
6451
        ladir="$func_dirname_result"
2034
6452
 
2035
6453
        dlname=
2036
6454
        dlopen=
2038
6456
        libdir=
2039
6457
        library_names=
2040
6458
        old_library=
 
6459
        inherited_linker_flags=
2041
6460
        # If the library was installed with an old release of libtool,
2042
6461
        # it will not redefine variables installed, or shouldnotlink
2043
6462
        installed=yes
2044
6463
        shouldnotlink=no
 
6464
        avoidtemprpath=
 
6465
 
2045
6466
 
2046
6467
        # Read the .la file
2047
 
        case $lib in
2048
 
        */* | *\\*) . $lib ;;
2049
 
        *) . ./$lib ;;
2050
 
        esac
 
6468
        func_source "$lib"
2051
6469
 
 
6470
        # Convert "-framework foo" to "foo.ltframework"
 
6471
        if test -n "$inherited_linker_flags"; then
 
6472
          tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
 
6473
          for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
 
6474
            case " $new_inherited_linker_flags " in
 
6475
              *" $tmp_inherited_linker_flag "*) ;;
 
6476
              *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
 
6477
            esac
 
6478
          done
 
6479
        fi
 
6480
        dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
2052
6481
        if test "$linkmode,$pass" = "lib,link" ||
2053
6482
           test "$linkmode,$pass" = "prog,scan" ||
2054
6483
           { test "$linkmode" != prog && test "$linkmode" != lib; }; then
2055
 
          test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
2056
 
          test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
 
6484
          test -n "$dlopen" && func_append dlfiles " $dlopen"
 
6485
          test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
2057
6486
        fi
2058
6487
 
2059
6488
        if test "$pass" = conv; then
2061
6490
          deplibs="$lib $deplibs"
2062
6491
          if test -z "$libdir"; then
2063
6492
            if test -z "$old_library"; then
2064
 
              $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2065
 
              exit 1
 
6493
              func_fatal_error "cannot find name of link library for \`$lib'"
2066
6494
            fi
2067
6495
            # It is a libtool convenience library, so add in its objects.
2068
 
            convenience="$convenience $ladir/$objdir/$old_library"
2069
 
            old_convenience="$old_convenience $ladir/$objdir/$old_library"
2070
 
            tmp_libs=
2071
 
            for deplib in $dependency_libs; do
2072
 
              deplibs="$deplib $deplibs"
2073
 
              if test "X$duplicate_deps" = "Xyes" ; then
2074
 
                case "$tmp_libs " in
2075
 
                *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2076
 
                esac
2077
 
              fi
2078
 
              tmp_libs="$tmp_libs $deplib"
2079
 
            done
 
6496
            func_append convenience " $ladir/$objdir/$old_library"
 
6497
            func_append old_convenience " $ladir/$objdir/$old_library"
2080
6498
          elif test "$linkmode" != prog && test "$linkmode" != lib; then
2081
 
            $echo "$modename: \`$lib' is not a convenience library" 1>&2
2082
 
            exit 1
 
6499
            func_fatal_error "\`$lib' is not a convenience library"
2083
6500
          fi
 
6501
          tmp_libs=
 
6502
          for deplib in $dependency_libs; do
 
6503
            deplibs="$deplib $deplibs"
 
6504
            if $opt_preserve_dup_deps ; then
 
6505
              case "$tmp_libs " in
 
6506
              *" $deplib "*) func_append specialdeplibs " $deplib" ;;
 
6507
              esac
 
6508
            fi
 
6509
            func_append tmp_libs " $deplib"
 
6510
          done
2084
6511
          continue
2085
6512
        fi # $pass = conv
2086
6513
 
2087
 
    
 
6514
 
2088
6515
        # Get the name of the library we link against.
2089
6516
        linklib=
2090
 
        for l in $old_library $library_names; do
2091
 
          linklib="$l"
2092
 
        done
 
6517
        if test -n "$old_library" &&
 
6518
           { test "$prefer_static_libs" = yes ||
 
6519
             test "$prefer_static_libs,$installed" = "built,no"; }; then
 
6520
          linklib=$old_library
 
6521
        else
 
6522
          for l in $old_library $library_names; do
 
6523
            linklib="$l"
 
6524
          done
 
6525
        fi
2093
6526
        if test -z "$linklib"; then
2094
 
          $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2095
 
          exit 1
 
6527
          func_fatal_error "cannot find name of link library for \`$lib'"
2096
6528
        fi
2097
6529
 
2098
6530
        # This library was specified with -dlopen.
2099
6531
        if test "$pass" = dlopen; then
2100
6532
          if test -z "$libdir"; then
2101
 
            $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
2102
 
            exit 1
 
6533
            func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
2103
6534
          fi
2104
 
          if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
 
6535
          if test -z "$dlname" ||
 
6536
             test "$dlopen_support" != yes ||
 
6537
             test "$build_libtool_libs" = no; then
2105
6538
            # If there is no dlname, no dlopen support or we're linking
2106
6539
            # statically, we need to preload.  We also need to preload any
2107
6540
            # dependent libraries so libltdl's deplib preloader doesn't
2108
6541
            # bomb out in the load deplibs phase.
2109
 
            dlprefiles="$dlprefiles $lib $dependency_libs"
 
6542
            func_append dlprefiles " $lib $dependency_libs"
2110
6543
          else
2111
 
            newdlfiles="$newdlfiles $lib"
 
6544
            func_append newdlfiles " $lib"
2112
6545
          fi
2113
6546
          continue
2114
6547
        fi # $pass = dlopen
2119
6552
        *)
2120
6553
          abs_ladir=`cd "$ladir" && pwd`
2121
6554
          if test -z "$abs_ladir"; then
2122
 
            $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
2123
 
            $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
 
6555
            func_warning "cannot determine absolute directory name of \`$ladir'"
 
6556
            func_warning "passing it literally to the linker, although it might fail"
2124
6557
            abs_ladir="$ladir"
2125
6558
          fi
2126
6559
          ;;
2127
6560
        esac
2128
 
        laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
 
6561
        func_basename "$lib"
 
6562
        laname="$func_basename_result"
2129
6563
 
2130
6564
        # Find the relevant object directory and library name.
2131
6565
        if test "X$installed" = Xyes; then
2132
 
          if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2133
 
            $echo "$modename: warning: library \`$lib' was moved." 1>&2
 
6566
          if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
 
6567
            func_warning "library \`$lib' was moved."
2134
6568
            dir="$ladir"
2135
6569
            absdir="$abs_ladir"
2136
6570
            libdir="$abs_ladir"
2137
6571
          else
2138
 
            dir="$libdir"
2139
 
            absdir="$libdir"
 
6572
            dir="$lt_sysroot$libdir"
 
6573
            absdir="$lt_sysroot$libdir"
2140
6574
          fi
 
6575
          test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
2141
6576
        else
2142
 
          dir="$ladir/$objdir"
2143
 
          absdir="$abs_ladir/$objdir"
2144
 
          # Remove this search path later
2145
 
          notinst_path="$notinst_path $abs_ladir"
 
6577
          if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
 
6578
            dir="$ladir"
 
6579
            absdir="$abs_ladir"
 
6580
            # Remove this search path later
 
6581
            func_append notinst_path " $abs_ladir"
 
6582
          else
 
6583
            dir="$ladir/$objdir"
 
6584
            absdir="$abs_ladir/$objdir"
 
6585
            # Remove this search path later
 
6586
            func_append notinst_path " $abs_ladir"
 
6587
          fi
2146
6588
        fi # $installed = yes
2147
 
        name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
 
6589
        func_stripname 'lib' '.la' "$laname"
 
6590
        name=$func_stripname_result
2148
6591
 
2149
6592
        # This library was specified with -dlpreopen.
2150
6593
        if test "$pass" = dlpreopen; then
2151
 
          if test -z "$libdir"; then
2152
 
            $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
2153
 
            exit 1
2154
 
          fi
2155
 
          # Prefer using a static library (so that no silly _DYNAMIC symbols
2156
 
          # are required to link).
2157
 
          if test -n "$old_library"; then
2158
 
            newdlprefiles="$newdlprefiles $dir/$old_library"
2159
 
          # Otherwise, use the dlname, so that lt_dlopen finds it.
2160
 
          elif test -n "$dlname"; then
2161
 
            newdlprefiles="$newdlprefiles $dir/$dlname"
2162
 
          else
2163
 
            newdlprefiles="$newdlprefiles $dir/$linklib"
2164
 
          fi
 
6594
          if test -z "$libdir" && test "$linkmode" = prog; then
 
6595
            func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
 
6596
          fi
 
6597
          case "$host" in
 
6598
            # special handling for platforms with PE-DLLs.
 
6599
            *cygwin* | *mingw* | *cegcc* )
 
6600
              # Linker will automatically link against shared library if both
 
6601
              # static and shared are present.  Therefore, ensure we extract
 
6602
              # symbols from the import library if a shared library is present
 
6603
              # (otherwise, the dlopen module name will be incorrect).  We do
 
6604
              # this by putting the import library name into $newdlprefiles.
 
6605
              # We recover the dlopen module name by 'saving' the la file
 
6606
              # name in a special purpose variable, and (later) extracting the
 
6607
              # dlname from the la file.
 
6608
              if test -n "$dlname"; then
 
6609
                func_tr_sh "$dir/$linklib"
 
6610
                eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
 
6611
                func_append newdlprefiles " $dir/$linklib"
 
6612
              else
 
6613
                func_append newdlprefiles " $dir/$old_library"
 
6614
                # Keep a list of preopened convenience libraries to check
 
6615
                # that they are being used correctly in the link pass.
 
6616
                test -z "$libdir" && \
 
6617
                  func_append dlpreconveniencelibs " $dir/$old_library"
 
6618
              fi
 
6619
            ;;
 
6620
            * )
 
6621
              # Prefer using a static library (so that no silly _DYNAMIC symbols
 
6622
              # are required to link).
 
6623
              if test -n "$old_library"; then
 
6624
                func_append newdlprefiles " $dir/$old_library"
 
6625
                # Keep a list of preopened convenience libraries to check
 
6626
                # that they are being used correctly in the link pass.
 
6627
                test -z "$libdir" && \
 
6628
                  func_append dlpreconveniencelibs " $dir/$old_library"
 
6629
              # Otherwise, use the dlname, so that lt_dlopen finds it.
 
6630
              elif test -n "$dlname"; then
 
6631
                func_append newdlprefiles " $dir/$dlname"
 
6632
              else
 
6633
                func_append newdlprefiles " $dir/$linklib"
 
6634
              fi
 
6635
            ;;
 
6636
          esac
2165
6637
        fi # $pass = dlpreopen
2166
6638
 
2167
6639
        if test -z "$libdir"; then
2177
6649
          continue
2178
6650
        fi
2179
6651
 
2180
 
    
 
6652
 
2181
6653
        if test "$linkmode" = prog && test "$pass" != link; then
2182
 
          newlib_search_path="$newlib_search_path $ladir"
 
6654
          func_append newlib_search_path " $ladir"
2183
6655
          deplibs="$lib $deplibs"
2184
6656
 
2185
6657
          linkalldeplibs=no
2191
6663
          tmp_libs=
2192
6664
          for deplib in $dependency_libs; do
2193
6665
            case $deplib in
2194
 
            -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
 
6666
            -L*) func_stripname '-L' '' "$deplib"
 
6667
                 func_resolve_sysroot "$func_stripname_result"
 
6668
                 func_append newlib_search_path " $func_resolve_sysroot_result"
 
6669
                 ;;
2195
6670
            esac
2196
6671
            # Need to link against all dependency_libs?
2197
6672
            if test "$linkalldeplibs" = yes; then
2201
6676
              # or/and link against static libraries
2202
6677
              newdependency_libs="$deplib $newdependency_libs"
2203
6678
            fi
2204
 
            if test "X$duplicate_deps" = "Xyes" ; then
 
6679
            if $opt_preserve_dup_deps ; then
2205
6680
              case "$tmp_libs " in
2206
 
              *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
 
6681
              *" $deplib "*) func_append specialdeplibs " $deplib" ;;
2207
6682
              esac
2208
6683
            fi
2209
 
            tmp_libs="$tmp_libs $deplib"
 
6684
            func_append tmp_libs " $deplib"
2210
6685
          done # for deplib
2211
6686
          continue
2212
6687
        fi # $linkmode = prog...
2213
6688
 
2214
6689
        if test "$linkmode,$pass" = "prog,link"; then
2215
6690
          if test -n "$library_names" &&
2216
 
             { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
 
6691
             { { test "$prefer_static_libs" = no ||
 
6692
                 test "$prefer_static_libs,$installed" = "built,yes"; } ||
 
6693
               test -z "$old_library"; }; then
2217
6694
            # We need to hardcode the library path
2218
 
            if test -n "$shlibpath_var"; then
 
6695
            if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
2219
6696
              # Make sure the rpath contains only unique directories.
2220
 
              case "$temp_rpath " in
2221
 
              *" $dir "*) ;;
2222
 
              *" $absdir "*) ;;
2223
 
              *) temp_rpath="$temp_rpath $dir" ;;
 
6697
              case "$temp_rpath:" in
 
6698
              *"$absdir:"*) ;;
 
6699
              *) func_append temp_rpath "$absdir:" ;;
2224
6700
              esac
2225
6701
            fi
2226
6702
 
2232
6708
            *)
2233
6709
              case "$compile_rpath " in
2234
6710
              *" $absdir "*) ;;
2235
 
              *) compile_rpath="$compile_rpath $absdir"
 
6711
              *) func_append compile_rpath " $absdir" ;;
2236
6712
              esac
2237
6713
              ;;
2238
6714
            esac
2241
6717
            *)
2242
6718
              case "$finalize_rpath " in
2243
6719
              *" $libdir "*) ;;
2244
 
              *) finalize_rpath="$finalize_rpath $libdir"
 
6720
              *) func_append finalize_rpath " $libdir" ;;
2245
6721
              esac
2246
6722
              ;;
2247
6723
            esac
2257
6733
        fi
2258
6734
 
2259
6735
        link_static=no # Whether the deplib will be linked statically
 
6736
        use_static_libs=$prefer_static_libs
 
6737
        if test "$use_static_libs" = built && test "$installed" = yes; then
 
6738
          use_static_libs=no
 
6739
        fi
2260
6740
        if test -n "$library_names" &&
2261
 
           { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2262
 
          if test "$installed" = no; then
2263
 
            notinst_deplibs="$notinst_deplibs $lib"
2264
 
            need_relink=yes
2265
 
          fi
 
6741
           { test "$use_static_libs" = no || test -z "$old_library"; }; then
 
6742
          case $host in
 
6743
          *cygwin* | *mingw* | *cegcc*)
 
6744
              # No point in relinking DLLs because paths are not encoded
 
6745
              func_append notinst_deplibs " $lib"
 
6746
              need_relink=no
 
6747
            ;;
 
6748
          *)
 
6749
            if test "$installed" = no; then
 
6750
              func_append notinst_deplibs " $lib"
 
6751
              need_relink=yes
 
6752
            fi
 
6753
            ;;
 
6754
          esac
2266
6755
          # This is a shared library
2267
 
        
2268
 
      # Warn about portability, can't link against -module's on some systems (darwin)
2269
 
      if test "$shouldnotlink" = yes && test "$pass" = link ; then
2270
 
            $echo
 
6756
 
 
6757
          # Warn about portability, can't link against -module's on some
 
6758
          # systems (darwin).  Don't bleat about dlopened modules though!
 
6759
          dlopenmodule=""
 
6760
          for dlpremoduletest in $dlprefiles; do
 
6761
            if test "X$dlpremoduletest" = "X$lib"; then
 
6762
              dlopenmodule="$dlpremoduletest"
 
6763
              break
 
6764
            fi
 
6765
          done
 
6766
          if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
 
6767
            echo
2271
6768
            if test "$linkmode" = prog; then
2272
 
              $echo "*** Warning: Linking the executable $output against the loadable module"
 
6769
              $ECHO "*** Warning: Linking the executable $output against the loadable module"
2273
6770
            else
2274
 
              $echo "*** Warning: Linking the shared library $output against the loadable module"
 
6771
              $ECHO "*** Warning: Linking the shared library $output against the loadable module"
2275
6772
            fi
2276
 
            $echo "*** $linklib is not portable!"    
2277
 
      fi          
 
6773
            $ECHO "*** $linklib is not portable!"
 
6774
          fi
2278
6775
          if test "$linkmode" = lib &&
2279
6776
             test "$hardcode_into_libs" = yes; then
2280
6777
            # Hardcode the library path.
2285
6782
            *)
2286
6783
              case "$compile_rpath " in
2287
6784
              *" $absdir "*) ;;
2288
 
              *) compile_rpath="$compile_rpath $absdir"
 
6785
              *) func_append compile_rpath " $absdir" ;;
2289
6786
              esac
2290
6787
              ;;
2291
6788
            esac
2294
6791
            *)
2295
6792
              case "$finalize_rpath " in
2296
6793
              *" $libdir "*) ;;
2297
 
              *) finalize_rpath="$finalize_rpath $libdir"
 
6794
              *) func_append finalize_rpath " $libdir" ;;
2298
6795
              esac
2299
6796
              ;;
2300
6797
            esac
2303
6800
          if test -n "$old_archive_from_expsyms_cmds"; then
2304
6801
            # figure out the soname
2305
6802
            set dummy $library_names
2306
 
            realname="$2"
2307
 
            shift; shift
2308
 
            libname=`eval \\$echo \"$libname_spec\"`
 
6803
            shift
 
6804
            realname="$1"
 
6805
            shift
 
6806
            libname=`eval "\\$ECHO \"$libname_spec\""`
2309
6807
            # use dlname if we got it. it's perfectly good, no?
2310
6808
            if test -n "$dlname"; then
2311
6809
              soname="$dlname"
2312
6810
            elif test -n "$soname_spec"; then
2313
6811
              # bleh windows
2314
6812
              case $host in
2315
 
              *cygwin* | mingw*)
2316
 
                major=`expr $current - $age`
 
6813
              *cygwin* | mingw* | *cegcc*)
 
6814
                func_arith $current - $age
 
6815
                major=$func_arith_result
2317
6816
                versuffix="-$major"
2318
6817
                ;;
2319
6818
              esac
2324
6823
 
2325
6824
            # Make a new name for the extract_expsyms_cmds to use
2326
6825
            soroot="$soname"
2327
 
            soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
2328
 
            newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
 
6826
            func_basename "$soroot"
 
6827
            soname="$func_basename_result"
 
6828
            func_stripname 'lib' '.dll' "$soname"
 
6829
            newlib=libimp-$func_stripname_result.a
2329
6830
 
2330
6831
            # If the library has no export list, then create one now
2331
6832
            if test -f "$output_objdir/$soname-def"; then :
2332
6833
            else
2333
 
              $show "extracting exported symbol list from \`$soname'"
2334
 
              save_ifs="$IFS"; IFS='~'
2335
 
              cmds=$extract_expsyms_cmds
2336
 
              for cmd in $cmds; do
2337
 
                IFS="$save_ifs"
2338
 
                eval cmd=\"$cmd\"
2339
 
                $show "$cmd"
2340
 
                $run eval "$cmd" || exit $?
2341
 
              done
2342
 
              IFS="$save_ifs"
 
6834
              func_verbose "extracting exported symbol list from \`$soname'"
 
6835
              func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
2343
6836
            fi
2344
6837
 
2345
6838
            # Create $newlib
2346
6839
            if test -f "$output_objdir/$newlib"; then :; else
2347
 
              $show "generating import library for \`$soname'"
2348
 
              save_ifs="$IFS"; IFS='~'
2349
 
              cmds=$old_archive_from_expsyms_cmds
2350
 
              for cmd in $cmds; do
2351
 
                IFS="$save_ifs"
2352
 
                eval cmd=\"$cmd\"
2353
 
                $show "$cmd"
2354
 
                $run eval "$cmd" || exit $?
2355
 
              done
2356
 
              IFS="$save_ifs"
 
6840
              func_verbose "generating import library for \`$soname'"
 
6841
              func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
2357
6842
            fi
2358
6843
            # make sure the library variables are pointing to the new library
2359
6844
            dir=$output_objdir
2360
6845
            linklib=$newlib
2361
6846
          fi # test -n "$old_archive_from_expsyms_cmds"
2362
6847
 
2363
 
          if test "$linkmode" = prog || test "$mode" != relink; then
 
6848
          if test "$linkmode" = prog || test "$opt_mode" != relink; then
2364
6849
            add_shlibpath=
2365
6850
            add_dir=
2366
6851
            add=
2370
6855
              if test "$hardcode_direct" = no; then
2371
6856
                add="$dir/$linklib"
2372
6857
                case $host in
2373
 
                  *-*-sco3.2v5* ) add_dir="-L$dir" ;;
 
6858
                  *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
 
6859
                  *-*-sysv4*uw2*) add_dir="-L$dir" ;;
 
6860
                  *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
 
6861
                    *-*-unixware7*) add_dir="-L$dir" ;;
2374
6862
                  *-*-darwin* )
2375
 
                    # if the lib is a module then we can not link against it, someone
2376
 
                    # is ignoring the new warnings I added
2377
 
                    if /usr/bin/file -L $add 2> /dev/null | grep "bundle" >/dev/null ; then
2378
 
                      $echo "** Warning, lib $linklib is a module, not a shared library"
2379
 
                      if test -z "$old_library" ; then
2380
 
                        $echo
2381
 
                        $echo "** And there doesn't seem to be a static archive available"
2382
 
                        $echo "** The link will probably fail, sorry"
2383
 
                      else
2384
 
                        add="$dir/$old_library"
2385
 
                      fi 
 
6863
                    # if the lib is a (non-dlopened) module then we can not
 
6864
                    # link against it, someone is ignoring the earlier warnings
 
6865
                    if /usr/bin/file -L $add 2> /dev/null |
 
6866
                         $GREP ": [^:]* bundle" >/dev/null ; then
 
6867
                      if test "X$dlopenmodule" != "X$lib"; then
 
6868
                        $ECHO "*** Warning: lib $linklib is a module, not a shared library"
 
6869
                        if test -z "$old_library" ; then
 
6870
                          echo
 
6871
                          echo "*** And there doesn't seem to be a static archive available"
 
6872
                          echo "*** The link will probably fail, sorry"
 
6873
                        else
 
6874
                          add="$dir/$old_library"
 
6875
                        fi
 
6876
                      elif test -n "$old_library"; then
 
6877
                        add="$dir/$old_library"
 
6878
                      fi
2386
6879
                    fi
2387
6880
                esac
2388
6881
              elif test "$hardcode_minus_L" = no; then
2399
6892
              fi
2400
6893
              ;;
2401
6894
            relink)
2402
 
              if test "$hardcode_direct" = yes; then
 
6895
              if test "$hardcode_direct" = yes &&
 
6896
                 test "$hardcode_direct_absolute" = no; then
2403
6897
                add="$dir/$linklib"
2404
6898
              elif test "$hardcode_minus_L" = yes; then
2405
 
                add_dir="-L$dir"
 
6899
                add_dir="-L$absdir"
2406
6900
                # Try looking first in the location we're being installed to.
2407
6901
                if test -n "$inst_prefix_dir"; then
2408
 
                  case "$libdir" in
 
6902
                  case $libdir in
2409
6903
                    [\\/]*)
2410
 
                      add_dir="$add_dir -L$inst_prefix_dir$libdir"
 
6904
                      func_append add_dir " -L$inst_prefix_dir$libdir"
2411
6905
                      ;;
2412
6906
                  esac
2413
6907
                fi
2423
6917
            esac
2424
6918
 
2425
6919
            if test "$lib_linked" != yes; then
2426
 
              $echo "$modename: configuration error: unsupported hardcode properties"
2427
 
              exit 1
 
6920
              func_fatal_configuration "unsupported hardcode properties"
2428
6921
            fi
2429
6922
 
2430
6923
            if test -n "$add_shlibpath"; then
2431
6924
              case :$compile_shlibpath: in
2432
6925
              *":$add_shlibpath:"*) ;;
2433
 
              *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
 
6926
              *) func_append compile_shlibpath "$add_shlibpath:" ;;
2434
6927
              esac
2435
6928
            fi
2436
6929
            if test "$linkmode" = prog; then
2439
6932
            else
2440
6933
              test -n "$add_dir" && deplibs="$add_dir $deplibs"
2441
6934
              test -n "$add" && deplibs="$add $deplibs"
2442
 
              if test "$hardcode_direct" != yes && \
2443
 
                 test "$hardcode_minus_L" != yes && \
 
6935
              if test "$hardcode_direct" != yes &&
 
6936
                 test "$hardcode_minus_L" != yes &&
2444
6937
                 test "$hardcode_shlibpath_var" = yes; then
2445
6938
                case :$finalize_shlibpath: in
2446
6939
                *":$libdir:"*) ;;
2447
 
                *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
 
6940
                *) func_append finalize_shlibpath "$libdir:" ;;
2448
6941
                esac
2449
6942
              fi
2450
6943
            fi
2451
6944
          fi
2452
6945
 
2453
 
          if test "$linkmode" = prog || test "$mode" = relink; then
 
6946
          if test "$linkmode" = prog || test "$opt_mode" = relink; then
2454
6947
            add_shlibpath=
2455
6948
            add_dir=
2456
6949
            add=
2457
6950
            # Finalize command for both is simple: just hardcode it.
2458
 
            if test "$hardcode_direct" = yes; then
 
6951
            if test "$hardcode_direct" = yes &&
 
6952
               test "$hardcode_direct_absolute" = no; then
2459
6953
              add="$libdir/$linklib"
2460
6954
            elif test "$hardcode_minus_L" = yes; then
2461
6955
              add_dir="-L$libdir"
2463
6957
            elif test "$hardcode_shlibpath_var" = yes; then
2464
6958
              case :$finalize_shlibpath: in
2465
6959
              *":$libdir:"*) ;;
2466
 
              *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
 
6960
              *) func_append finalize_shlibpath "$libdir:" ;;
2467
6961
              esac
2468
6962
              add="-l$name"
2469
6963
            elif test "$hardcode_automatic" = yes; then
2470
 
              if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then
2471
 
                add="$inst_prefix_dir$libdir/$linklib"
 
6964
              if test -n "$inst_prefix_dir" &&
 
6965
                 test -f "$inst_prefix_dir$libdir/$linklib" ; then
 
6966
                add="$inst_prefix_dir$libdir/$linklib"
2472
6967
              else
2473
 
                add="$libdir/$linklib"
 
6968
                add="$libdir/$linklib"
2474
6969
              fi
2475
6970
            else
2476
6971
              # We cannot seem to hardcode it, guess we'll fake it.
2477
6972
              add_dir="-L$libdir"
2478
6973
              # Try looking first in the location we're being installed to.
2479
6974
              if test -n "$inst_prefix_dir"; then
2480
 
                case "$libdir" in
 
6975
                case $libdir in
2481
6976
                  [\\/]*)
2482
 
                    add_dir="$add_dir -L$inst_prefix_dir$libdir"
 
6977
                    func_append add_dir " -L$inst_prefix_dir$libdir"
2483
6978
                    ;;
2484
6979
                esac
2485
6980
              fi
2514
7009
 
2515
7010
            # Just print a warning and add the library to dependency_libs so
2516
7011
            # that the program can be linked against the static library.
2517
 
            $echo
2518
 
            $echo "*** Warning: This system can not link to static lib archive $lib."
2519
 
            $echo "*** I have the capability to make that library automatically link in when"
2520
 
            $echo "*** you link to this library.  But I can only do this if you have a"
2521
 
            $echo "*** shared version of the library, which you do not appear to have."
 
7012
            echo
 
7013
            $ECHO "*** Warning: This system can not link to static lib archive $lib."
 
7014
            echo "*** I have the capability to make that library automatically link in when"
 
7015
            echo "*** you link to this library.  But I can only do this if you have a"
 
7016
            echo "*** shared version of the library, which you do not appear to have."
2522
7017
            if test "$module" = yes; then
2523
 
              $echo "*** But as you try to build a module library, libtool will still create "
2524
 
              $echo "*** a static module, that should work as long as the dlopening application"
2525
 
              $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
 
7018
              echo "*** But as you try to build a module library, libtool will still create "
 
7019
              echo "*** a static module, that should work as long as the dlopening application"
 
7020
              echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
2526
7021
              if test -z "$global_symbol_pipe"; then
2527
 
                $echo
2528
 
                $echo "*** However, this would only work if libtool was able to extract symbol"
2529
 
                $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2530
 
                $echo "*** not find such a program.  So, this module is probably useless."
2531
 
                $echo "*** \`nm' from GNU binutils and a full rebuild may help."
 
7022
                echo
 
7023
                echo "*** However, this would only work if libtool was able to extract symbol"
 
7024
                echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
 
7025
                echo "*** not find such a program.  So, this module is probably useless."
 
7026
                echo "*** \`nm' from GNU binutils and a full rebuild may help."
2532
7027
              fi
2533
7028
              if test "$build_old_libs" = no; then
2534
7029
                build_libtool_libs=module
2538
7033
              fi
2539
7034
            fi
2540
7035
          else
2541
 
            convenience="$convenience $dir/$old_library"
2542
 
            old_convenience="$old_convenience $dir/$old_library"
2543
7036
            deplibs="$dir/$old_library $deplibs"
2544
7037
            link_static=yes
2545
7038
          fi
2547
7040
 
2548
7041
        if test "$linkmode" = lib; then
2549
7042
          if test -n "$dependency_libs" &&
2550
 
             { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes ||
 
7043
             { test "$hardcode_into_libs" != yes ||
 
7044
               test "$build_old_libs" = yes ||
2551
7045
               test "$link_static" = yes; }; then
2552
7046
            # Extract -R from dependency_libs
2553
7047
            temp_deplibs=
2554
7048
            for libdir in $dependency_libs; do
2555
7049
              case $libdir in
2556
 
              -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
 
7050
              -R*) func_stripname '-R' '' "$libdir"
 
7051
                   temp_xrpath=$func_stripname_result
2557
7052
                   case " $xrpath " in
2558
7053
                   *" $temp_xrpath "*) ;;
2559
 
                   *) xrpath="$xrpath $temp_xrpath";;
 
7054
                   *) func_append xrpath " $temp_xrpath";;
2560
7055
                   esac;;
2561
 
              *) temp_deplibs="$temp_deplibs $libdir";;
 
7056
              *) func_append temp_deplibs " $libdir";;
2562
7057
              esac
2563
7058
            done
2564
7059
            dependency_libs="$temp_deplibs"
2565
7060
          fi
2566
7061
 
2567
 
          newlib_search_path="$newlib_search_path $absdir"
 
7062
          func_append newlib_search_path " $absdir"
2568
7063
          # Link against this library
2569
7064
          test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2570
7065
          # ... and its dependency_libs
2571
7066
          tmp_libs=
2572
7067
          for deplib in $dependency_libs; do
2573
7068
            newdependency_libs="$deplib $newdependency_libs"
2574
 
            if test "X$duplicate_deps" = "Xyes" ; then
 
7069
            case $deplib in
 
7070
              -L*) func_stripname '-L' '' "$deplib"
 
7071
                   func_resolve_sysroot "$func_stripname_result";;
 
7072
              *) func_resolve_sysroot "$deplib" ;;
 
7073
            esac
 
7074
            if $opt_preserve_dup_deps ; then
2575
7075
              case "$tmp_libs " in
2576
 
              *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
 
7076
              *" $func_resolve_sysroot_result "*)
 
7077
                func_append specialdeplibs " $func_resolve_sysroot_result" ;;
2577
7078
              esac
2578
7079
            fi
2579
 
            tmp_libs="$tmp_libs $deplib"
 
7080
            func_append tmp_libs " $func_resolve_sysroot_result"
2580
7081
          done
2581
7082
 
2582
7083
          if test "$link_all_deplibs" != no; then
2583
7084
            # Add the search paths of all dependency libraries
2584
7085
            for deplib in $dependency_libs; do
 
7086
              path=
2585
7087
              case $deplib in
2586
7088
              -L*) path="$deplib" ;;
2587
7089
              *.la)
2588
 
                dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2589
 
                test "X$dir" = "X$deplib" && dir="."
 
7090
                func_resolve_sysroot "$deplib"
 
7091
                deplib=$func_resolve_sysroot_result
 
7092
                func_dirname "$deplib" "" "."
 
7093
                dir=$func_dirname_result
2590
7094
                # We need an absolute path.
2591
7095
                case $dir in
2592
7096
                [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2593
7097
                *)
2594
7098
                  absdir=`cd "$dir" && pwd`
2595
7099
                  if test -z "$absdir"; then
2596
 
                    $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
 
7100
                    func_warning "cannot determine absolute directory name of \`$dir'"
2597
7101
                    absdir="$dir"
2598
7102
                  fi
2599
7103
                  ;;
2600
7104
                esac
2601
 
                if grep "^installed=no" $deplib > /dev/null; then
2602
 
                  path="$absdir/$objdir"
2603
 
                else
2604
 
                  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2605
 
                  if test -z "$libdir"; then
2606
 
                    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2607
 
                    exit 1
2608
 
                  fi
2609
 
                  if test "$absdir" != "$libdir"; then
2610
 
                    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2611
 
                  fi
2612
 
                  path="$absdir"
2613
 
                fi
2614
 
                depdepl=
 
7105
                if $GREP "^installed=no" $deplib > /dev/null; then
2615
7106
                case $host in
2616
7107
                *-*-darwin*)
2617
 
                  # we do not want to link against static libs, but need to link against shared
 
7108
                  depdepl=
2618
7109
                  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
2619
7110
                  if test -n "$deplibrary_names" ; then
2620
7111
                    for tmp in $deplibrary_names ; do
2621
7112
                      depdepl=$tmp
2622
7113
                    done
2623
 
                    if test -f "$path/$depdepl" ; then
2624
 
                      depdepl="$path/$depdepl"
2625
 
                   fi
2626
 
                    # do not add paths which are already there
2627
 
                    case " $newlib_search_path " in
2628
 
                    *" $path "*) ;;
2629
 
                    *) newlib_search_path="$newlib_search_path $path";;
2630
 
                    esac
 
7114
                    if test -f "$absdir/$objdir/$depdepl" ; then
 
7115
                      depdepl="$absdir/$objdir/$depdepl"
 
7116
                      darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
 
7117
                      if test -z "$darwin_install_name"; then
 
7118
                          darwin_install_name=`${OTOOL64} -L $depdepl  | awk '{if (NR == 2) {print $1;exit}}'`
 
7119
                      fi
 
7120
                      func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
 
7121
                      func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}"
 
7122
                      path=
 
7123
                    fi
2631
7124
                  fi
2632
 
                  path=""
2633
7125
                  ;;
2634
7126
                *)
2635
 
                path="-L$path"
2636
 
                ;;
2637
 
                esac 
2638
 
                
2639
 
                ;;
2640
 
                  -l*)
2641
 
                case $host in
2642
 
                *-*-darwin*)
2643
 
                 # Again, we only want to link against shared libraries
2644
 
                 eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
2645
 
                 for tmp in $newlib_search_path ; do
2646
 
                     if test -f "$tmp/lib$tmp_libs.dylib" ; then
2647
 
                       eval depdepl="$tmp/lib$tmp_libs.dylib"
2648
 
                       break
2649
 
                     fi  
2650
 
         done
2651
 
         path=""
 
7127
                  path="-L$absdir/$objdir"
2652
7128
                  ;;
2653
 
                *) continue ;;
2654
 
                esac              
 
7129
                esac
 
7130
                else
 
7131
                  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
 
7132
                  test -z "$libdir" && \
 
7133
                    func_fatal_error "\`$deplib' is not a valid libtool archive"
 
7134
                  test "$absdir" != "$libdir" && \
 
7135
                    func_warning "\`$deplib' seems to be moved"
 
7136
 
 
7137
                  path="-L$absdir"
 
7138
                fi
2655
7139
                ;;
2656
 
              *) continue ;;
2657
7140
              esac
2658
7141
              case " $deplibs " in
2659
 
              *" $depdepl "*) ;;
2660
 
              *) deplibs="$deplibs $depdepl" ;;
2661
 
              esac            
2662
 
              case " $deplibs " in
2663
7142
              *" $path "*) ;;
2664
 
              *) deplibs="$deplibs $path" ;;
 
7143
              *) deplibs="$path $deplibs" ;;
2665
7144
              esac
2666
7145
            done
2667
7146
          fi # link_all_deplibs != no
2668
7147
        fi # linkmode = lib
2669
7148
      done # for deplib in $libs
 
7149
      if test "$pass" = link; then
 
7150
        if test "$linkmode" = "prog"; then
 
7151
          compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
 
7152
          finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
 
7153
        else
 
7154
          compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
 
7155
        fi
 
7156
      fi
2670
7157
      dependency_libs="$newdependency_libs"
2671
7158
      if test "$pass" = dlpreopen; then
2672
7159
        # Link the dlpreopened libraries before other libraries
2681
7168
          for dir in $newlib_search_path; do
2682
7169
            case "$lib_search_path " in
2683
7170
            *" $dir "*) ;;
2684
 
            *) lib_search_path="$lib_search_path $dir" ;;
 
7171
            *) func_append lib_search_path " $dir" ;;
2685
7172
            esac
2686
7173
          done
2687
7174
          newlib_search_path=
2739
7226
            -L*)
2740
7227
              case " $tmp_libs " in
2741
7228
              *" $deplib "*) ;;
2742
 
              *) tmp_libs="$tmp_libs $deplib" ;;
 
7229
              *) func_append tmp_libs " $deplib" ;;
2743
7230
              esac
2744
7231
              ;;
2745
 
            *) tmp_libs="$tmp_libs $deplib" ;;
 
7232
            *) func_append tmp_libs " $deplib" ;;
2746
7233
            esac
2747
7234
          done
2748
7235
          eval $var=\"$tmp_libs\"
2749
7236
        done # for var
2750
7237
      fi
2751
 
      # Last step: remove runtime libs from dependency_libs (they stay in deplibs)
 
7238
      # Last step: remove runtime libs from dependency_libs
 
7239
      # (they stay in deplibs)
2752
7240
      tmp_libs=
2753
7241
      for i in $dependency_libs ; do
2754
7242
        case " $predeps $postdeps $compiler_lib_search_path " in
2757
7245
          ;;
2758
7246
        esac
2759
7247
        if test -n "$i" ; then
2760
 
          tmp_libs="$tmp_libs $i"
 
7248
          func_append tmp_libs " $i"
2761
7249
        fi
2762
7250
      done
2763
7251
      dependency_libs=$tmp_libs
2764
7252
    done # for pass
2765
7253
    if test "$linkmode" = prog; then
2766
7254
      dlfiles="$newdlfiles"
 
7255
    fi
 
7256
    if test "$linkmode" = prog || test "$linkmode" = lib; then
2767
7257
      dlprefiles="$newdlprefiles"
2768
7258
    fi
2769
7259
 
2770
7260
    case $linkmode in
2771
7261
    oldlib)
2772
 
      if test -n "$deplibs"; then
2773
 
        $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
2774
 
      fi
2775
 
 
2776
7262
      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2777
 
        $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
2778
 
      fi
2779
 
 
2780
 
      if test -n "$rpath"; then
2781
 
        $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
2782
 
      fi
2783
 
 
2784
 
      if test -n "$xrpath"; then
2785
 
        $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
2786
 
      fi
2787
 
 
2788
 
      if test -n "$vinfo"; then
2789
 
        $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
2790
 
      fi
2791
 
 
2792
 
      if test -n "$release"; then
2793
 
        $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
2794
 
      fi
2795
 
 
2796
 
      if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
2797
 
        $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
2798
 
      fi
 
7263
        func_warning "\`-dlopen' is ignored for archives"
 
7264
      fi
 
7265
 
 
7266
      case " $deplibs" in
 
7267
      *\ -l* | *\ -L*)
 
7268
        func_warning "\`-l' and \`-L' are ignored for archives" ;;
 
7269
      esac
 
7270
 
 
7271
      test -n "$rpath" && \
 
7272
        func_warning "\`-rpath' is ignored for archives"
 
7273
 
 
7274
      test -n "$xrpath" && \
 
7275
        func_warning "\`-R' is ignored for archives"
 
7276
 
 
7277
      test -n "$vinfo" && \
 
7278
        func_warning "\`-version-info/-version-number' is ignored for archives"
 
7279
 
 
7280
      test -n "$release" && \
 
7281
        func_warning "\`-release' is ignored for archives"
 
7282
 
 
7283
      test -n "$export_symbols$export_symbols_regex" && \
 
7284
        func_warning "\`-export-symbols' is ignored for archives"
2799
7285
 
2800
7286
      # Now set the variables for building old libraries.
2801
7287
      build_libtool_libs=no
2802
7288
      oldlibs="$output"
2803
 
      objs="$objs$old_deplibs"
 
7289
      func_append objs "$old_deplibs"
2804
7290
      ;;
2805
7291
 
2806
7292
    lib)
2807
7293
      # Make sure we only generate libraries of the form `libNAME.la'.
2808
7294
      case $outputname in
2809
7295
      lib*)
2810
 
        name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2811
 
        eval shared_ext=\"$shrext\"
 
7296
        func_stripname 'lib' '.la' "$outputname"
 
7297
        name=$func_stripname_result
 
7298
        eval shared_ext=\"$shrext_cmds\"
2812
7299
        eval libname=\"$libname_spec\"
2813
7300
        ;;
2814
7301
      *)
2815
 
        if test "$module" = no; then
2816
 
          $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
2817
 
          $echo "$help" 1>&2
2818
 
          exit 1
2819
 
        fi
 
7302
        test "$module" = no && \
 
7303
          func_fatal_help "libtool library \`$output' must begin with \`lib'"
 
7304
 
2820
7305
        if test "$need_lib_prefix" != no; then
2821
7306
          # Add the "lib" prefix for modules if required
2822
 
          name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2823
 
          eval shared_ext=\"$shrext\"
 
7307
          func_stripname '' '.la' "$outputname"
 
7308
          name=$func_stripname_result
 
7309
          eval shared_ext=\"$shrext_cmds\"
2824
7310
          eval libname=\"$libname_spec\"
2825
7311
        else
2826
 
          libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
 
7312
          func_stripname '' '.la' "$outputname"
 
7313
          libname=$func_stripname_result
2827
7314
        fi
2828
7315
        ;;
2829
7316
      esac
2830
7317
 
2831
7318
      if test -n "$objs"; then
2832
7319
        if test "$deplibs_check_method" != pass_all; then
2833
 
          $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
2834
 
          exit 1
 
7320
          func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
2835
7321
        else
2836
 
          $echo
2837
 
          $echo "*** Warning: Linking the shared library $output against the non-libtool"
2838
 
          $echo "*** objects $objs is not portable!"
2839
 
          libobjs="$libobjs $objs"
 
7322
          echo
 
7323
          $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
 
7324
          $ECHO "*** objects $objs is not portable!"
 
7325
          func_append libobjs " $objs"
2840
7326
        fi
2841
7327
      fi
2842
7328
 
2843
 
      if test "$dlself" != no; then
2844
 
        $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
2845
 
      fi
 
7329
      test "$dlself" != no && \
 
7330
        func_warning "\`-dlopen self' is ignored for libtool libraries"
2846
7331
 
2847
7332
      set dummy $rpath
2848
 
      if test "$#" -gt 2; then
2849
 
        $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
2850
 
      fi
2851
 
      install_libdir="$2"
 
7333
      shift
 
7334
      test "$#" -gt 1 && \
 
7335
        func_warning "ignoring multiple \`-rpath's for a libtool library"
 
7336
 
 
7337
      install_libdir="$1"
2852
7338
 
2853
7339
      oldlibs=
2854
7340
      if test -z "$rpath"; then
2862
7348
          build_old_libs=yes
2863
7349
        fi
2864
7350
 
2865
 
        if test -n "$vinfo"; then
2866
 
          $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
2867
 
        fi
 
7351
        test -n "$vinfo" && \
 
7352
          func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
2868
7353
 
2869
 
        if test -n "$release"; then
2870
 
          $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
2871
 
        fi
 
7354
        test -n "$release" && \
 
7355
          func_warning "\`-release' is ignored for convenience libraries"
2872
7356
      else
2873
7357
 
2874
7358
        # Parse the version information argument.
2875
7359
        save_ifs="$IFS"; IFS=':'
2876
7360
        set dummy $vinfo 0 0 0
 
7361
        shift
2877
7362
        IFS="$save_ifs"
2878
7363
 
2879
 
        if test -n "$8"; then
2880
 
          $echo "$modename: too many parameters to \`-version-info'" 1>&2
2881
 
          $echo "$help" 1>&2
2882
 
          exit 1
2883
 
        fi
 
7364
        test -n "$7" && \
 
7365
          func_fatal_help "too many parameters to \`-version-info'"
2884
7366
 
2885
7367
        # convert absolute version numbers to libtool ages
2886
7368
        # this retains compatibility with .la files and attempts
2887
7369
        # to make the code below a bit more comprehensible
2888
 
        
 
7370
 
2889
7371
        case $vinfo_number in
2890
7372
        yes)
2891
 
          number_major="$2"
2892
 
          number_minor="$3"
2893
 
          number_revision="$4"
 
7373
          number_major="$1"
 
7374
          number_minor="$2"
 
7375
          number_revision="$3"
2894
7376
          #
2895
7377
          # There are really only two kinds -- those that
2896
7378
          # use the current revision as the major version
2899
7381
          # which has an extra 1 added just for fun
2900
7382
          #
2901
7383
          case $version_type in
2902
 
          darwin|linux|osf|windows)
2903
 
            current=`expr $number_major + $number_minor`
 
7384
          # correct linux to gnu/linux during the next big refactor
 
7385
          darwin|linux|osf|windows|none)
 
7386
            func_arith $number_major + $number_minor
 
7387
            current=$func_arith_result
2904
7388
            age="$number_minor"
2905
7389
            revision="$number_revision"
2906
7390
            ;;
2907
 
          freebsd-aout|freebsd-elf|sunos)
 
7391
          freebsd-aout|freebsd-elf|qnx|sunos)
2908
7392
            current="$number_major"
2909
7393
            revision="$number_minor"
2910
7394
            age="0"
2911
7395
            ;;
2912
7396
          irix|nonstopux)
2913
 
            current=`expr $number_major + $number_minor - 1`
 
7397
            func_arith $number_major + $number_minor
 
7398
            current=$func_arith_result
2914
7399
            age="$number_minor"
2915
7400
            revision="$number_minor"
 
7401
            lt_irix_increment=no
2916
7402
            ;;
2917
7403
          esac
2918
7404
          ;;
2919
7405
        no)
2920
 
          current="$2"
2921
 
          revision="$3"
2922
 
          age="$4"
 
7406
          current="$1"
 
7407
          revision="$2"
 
7408
          age="$3"
2923
7409
          ;;
2924
7410
        esac
2925
7411
 
2926
7412
        # Check that each of the things are valid numbers.
2927
7413
        case $current in
2928
 
        0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
 
7414
        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]) ;;
2929
7415
        *)
2930
 
          $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
2931
 
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2932
 
          exit 1
 
7416
          func_error "CURRENT \`$current' must be a nonnegative integer"
 
7417
          func_fatal_error "\`$vinfo' is not valid version information"
2933
7418
          ;;
2934
7419
        esac
2935
7420
 
2936
7421
        case $revision in
2937
 
        0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
 
7422
        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]) ;;
2938
7423
        *)
2939
 
          $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
2940
 
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2941
 
          exit 1
 
7424
          func_error "REVISION \`$revision' must be a nonnegative integer"
 
7425
          func_fatal_error "\`$vinfo' is not valid version information"
2942
7426
          ;;
2943
7427
        esac
2944
7428
 
2945
7429
        case $age in
2946
 
        0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
 
7430
        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]) ;;
2947
7431
        *)
2948
 
          $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
2949
 
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2950
 
          exit 1
 
7432
          func_error "AGE \`$age' must be a nonnegative integer"
 
7433
          func_fatal_error "\`$vinfo' is not valid version information"
2951
7434
          ;;
2952
7435
        esac
2953
7436
 
2954
7437
        if test "$age" -gt "$current"; then
2955
 
          $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
2956
 
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2957
 
          exit 1
 
7438
          func_error "AGE \`$age' is greater than the current interface number \`$current'"
 
7439
          func_fatal_error "\`$vinfo' is not valid version information"
2958
7440
        fi
2959
7441
 
2960
7442
        # Calculate the version variables.
2967
7449
        darwin)
2968
7450
          # Like Linux, but with the current version available in
2969
7451
          # verstring for coding it into the library header
2970
 
          major=.`expr $current - $age`
 
7452
          func_arith $current - $age
 
7453
          major=.$func_arith_result
2971
7454
          versuffix="$major.$age.$revision"
2972
7455
          # Darwin ld doesn't like 0 for these options...
2973
 
          minor_current=`expr $current + 1`
 
7456
          func_arith $current + 1
 
7457
          minor_current=$func_arith_result
 
7458
          xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
2974
7459
          verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
2975
7460
          ;;
2976
7461
 
2981
7466
 
2982
7467
        freebsd-elf)
2983
7468
          major=".$current"
2984
 
          versuffix=".$current";
 
7469
          versuffix=".$current"
2985
7470
          ;;
2986
7471
 
2987
7472
        irix | nonstopux)
2988
 
          major=`expr $current - $age + 1`
 
7473
          if test "X$lt_irix_increment" = "Xno"; then
 
7474
            func_arith $current - $age
 
7475
          else
 
7476
            func_arith $current - $age + 1
 
7477
          fi
 
7478
          major=$func_arith_result
2989
7479
 
2990
7480
          case $version_type in
2991
7481
            nonstopux) verstring_prefix=nonstopux ;;
2996
7486
          # Add in all the interfaces that we are compatible with.
2997
7487
          loop=$revision
2998
7488
          while test "$loop" -ne 0; do
2999
 
            iface=`expr $revision - $loop`
3000
 
            loop=`expr $loop - 1`
 
7489
            func_arith $revision - $loop
 
7490
            iface=$func_arith_result
 
7491
            func_arith $loop - 1
 
7492
            loop=$func_arith_result
3001
7493
            verstring="$verstring_prefix$major.$iface:$verstring"
3002
7494
          done
3003
7495
 
3006
7498
          versuffix="$major.$revision"
3007
7499
          ;;
3008
7500
 
3009
 
        linux)
3010
 
          major=.`expr $current - $age`
 
7501
        linux) # correct to gnu/linux during the next big refactor
 
7502
          func_arith $current - $age
 
7503
          major=.$func_arith_result
3011
7504
          versuffix="$major.$age.$revision"
3012
7505
          ;;
3013
7506
 
3014
7507
        osf)
3015
 
          major=.`expr $current - $age`
 
7508
          func_arith $current - $age
 
7509
          major=.$func_arith_result
3016
7510
          versuffix=".$current.$age.$revision"
3017
7511
          verstring="$current.$age.$revision"
3018
7512
 
3019
7513
          # Add in all the interfaces that we are compatible with.
3020
7514
          loop=$age
3021
7515
          while test "$loop" -ne 0; do
3022
 
            iface=`expr $current - $loop`
3023
 
            loop=`expr $loop - 1`
 
7516
            func_arith $current - $loop
 
7517
            iface=$func_arith_result
 
7518
            func_arith $loop - 1
 
7519
            loop=$func_arith_result
3024
7520
            verstring="$verstring:${iface}.0"
3025
7521
          done
3026
7522
 
3027
7523
          # Make executables depend on our current version.
3028
 
          verstring="$verstring:${current}.0"
 
7524
          func_append verstring ":${current}.0"
 
7525
          ;;
 
7526
 
 
7527
        qnx)
 
7528
          major=".$current"
 
7529
          versuffix=".$current"
3029
7530
          ;;
3030
7531
 
3031
7532
        sunos)
3036
7537
        windows)
3037
7538
          # Use '-' rather than '.', since we only want one
3038
7539
          # extension on DOS 8.3 filesystems.
3039
 
          major=`expr $current - $age`
 
7540
          func_arith $current - $age
 
7541
          major=$func_arith_result
3040
7542
          versuffix="-$major"
3041
7543
          ;;
3042
7544
 
3043
7545
        *)
3044
 
          $echo "$modename: unknown library version type \`$version_type'" 1>&2
3045
 
          $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
3046
 
          exit 1
 
7546
          func_fatal_configuration "unknown library version type \`$version_type'"
3047
7547
          ;;
3048
7548
        esac
3049
7549
 
3077
7577
        # Check to see if the archive will have undefined symbols.
3078
7578
        if test "$allow_undefined" = yes; then
3079
7579
          if test "$allow_undefined_flag" = unsupported; then
3080
 
            $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
 
7580
            func_warning "undefined symbols not allowed in $host shared libraries"
3081
7581
            build_libtool_libs=no
3082
7582
            build_old_libs=yes
3083
7583
          fi
3085
7585
          # Don't allow undefined symbols.
3086
7586
          allow_undefined_flag="$no_undefined_flag"
3087
7587
        fi
 
7588
 
3088
7589
      fi
3089
7590
 
3090
 
      if test "$mode" != relink; then
 
7591
      func_generate_dlsyms "$libname" "$libname" "yes"
 
7592
      func_append libobjs " $symfileobj"
 
7593
      test "X$libobjs" = "X " && libobjs=
 
7594
 
 
7595
      if test "$opt_mode" != relink; then
3091
7596
        # Remove our outputs, but don't remove object files since they
3092
7597
        # may have been created when compiling PIC objects.
3093
7598
        removelist=
3094
 
        tempremovelist=`$echo "$output_objdir/*"`
 
7599
        tempremovelist=`$ECHO "$output_objdir/*"`
3095
7600
        for p in $tempremovelist; do
3096
7601
          case $p in
3097
 
            *.$objext)
 
7602
            *.$objext | *.gcno)
3098
7603
               ;;
3099
7604
            $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
3100
 
               if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
3101
 
               then
3102
 
                 continue
 
7605
               if test "X$precious_files_regex" != "X"; then
 
7606
                 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
 
7607
                 then
 
7608
                   continue
 
7609
                 fi
3103
7610
               fi
3104
 
               removelist="$removelist $p"
 
7611
               func_append removelist " $p"
3105
7612
               ;;
3106
7613
            *) ;;
3107
7614
          esac
3108
7615
        done
3109
 
        if test -n "$removelist"; then
3110
 
          $show "${rm}r $removelist"
3111
 
          $run ${rm}r $removelist
3112
 
        fi
 
7616
        test -n "$removelist" && \
 
7617
          func_show_eval "${RM}r \$removelist"
3113
7618
      fi
3114
7619
 
3115
7620
      # Now set the variables for building old libraries.
3116
7621
      if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
3117
 
        oldlibs="$oldlibs $output_objdir/$libname.$libext"
 
7622
        func_append oldlibs " $output_objdir/$libname.$libext"
3118
7623
 
3119
7624
        # Transform .lo files to .o files.
3120
 
        oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
 
7625
        oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP`
3121
7626
      fi
3122
7627
 
3123
7628
      # Eliminate all temporary directories.
3124
 
      for path in $notinst_path; do
3125
 
        lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
3126
 
        deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
3127
 
        dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
3128
 
      done
 
7629
      #for path in $notinst_path; do
 
7630
      # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
 
7631
      # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
 
7632
      # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
 
7633
      #done
3129
7634
 
3130
7635
      if test -n "$xrpath"; then
3131
7636
        # If the user specified any rpath flags, then add them.
3132
7637
        temp_xrpath=
3133
7638
        for libdir in $xrpath; do
3134
 
          temp_xrpath="$temp_xrpath -R$libdir"
 
7639
          func_replace_sysroot "$libdir"
 
7640
          func_append temp_xrpath " -R$func_replace_sysroot_result"
3135
7641
          case "$finalize_rpath " in
3136
7642
          *" $libdir "*) ;;
3137
 
          *) finalize_rpath="$finalize_rpath $libdir" ;;
 
7643
          *) func_append finalize_rpath " $libdir" ;;
3138
7644
          esac
3139
7645
        done
3140
7646
        if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
3148
7654
      for lib in $old_dlfiles; do
3149
7655
        case " $dlprefiles $dlfiles " in
3150
7656
        *" $lib "*) ;;
3151
 
        *) dlfiles="$dlfiles $lib" ;;
 
7657
        *) func_append dlfiles " $lib" ;;
3152
7658
        esac
3153
7659
      done
3154
7660
 
3158
7664
      for lib in $old_dlprefiles; do
3159
7665
        case "$dlprefiles " in
3160
7666
        *" $lib "*) ;;
3161
 
        *) dlprefiles="$dlprefiles $lib" ;;
 
7667
        *) func_append dlprefiles " $lib" ;;
3162
7668
        esac
3163
7669
      done
3164
7670
 
3165
7671
      if test "$build_libtool_libs" = yes; then
3166
7672
        if test -n "$rpath"; then
3167
7673
          case $host in
3168
 
          *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
 
7674
          *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
3169
7675
            # these systems don't actually have a c library (as such)!
3170
7676
            ;;
3171
7677
          *-*-rhapsody* | *-*-darwin1.[012])
3172
7678
            # Rhapsody C library is in the System framework
3173
 
            deplibs="$deplibs -framework System"
 
7679
            func_append deplibs " System.ltframework"
3174
7680
            ;;
3175
7681
          *-*-netbsd*)
3176
7682
            # Don't link with libc until the a.out ld.so is fixed.
3177
7683
            ;;
3178
 
          *-*-openbsd* | *-*-freebsd*)
 
7684
          *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
3179
7685
            # Do not include libc due to us having libc/libc_r.
3180
 
            test "X$arg" = "X-lc" && continue
3181
 
            ;;
3182
 
          *)
 
7686
            ;;
 
7687
          *-*-sco3.2v5* | *-*-sco5v6*)
 
7688
            # Causes problems with __ctype
 
7689
            ;;
 
7690
          *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
 
7691
            # Compiler inserts libc in the correct place for threads to work
 
7692
            ;;
 
7693
          *)
3183
7694
            # Add libc to deplibs on all other systems if necessary.
3184
7695
            if test "$build_libtool_need_lc" = "yes"; then
3185
 
              deplibs="$deplibs -lc"
 
7696
              func_append deplibs " -lc"
3186
7697
            fi
3187
7698
            ;;
3188
7699
          esac
3216
7727
          # limits. Maybe even breaks it.  We compile a program, linking it
3217
7728
          # against the deplibs as a proxy for the library.  Then we can check
3218
7729
          # whether they linked in statically or dynamically with ldd.
3219
 
          $rm conftest.c
 
7730
          $opt_dry_run || $RM conftest.c
3220
7731
          cat > conftest.c <<EOF
3221
7732
          int main() { return 0; }
3222
7733
EOF
3223
 
          $rm conftest
3224
 
          $LTCC -o conftest conftest.c $deplibs
3225
 
          if test "$?" -eq 0 ; then
 
7734
          $opt_dry_run || $RM conftest
 
7735
          if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
3226
7736
            ldd_output=`ldd conftest`
3227
7737
            for i in $deplibs; do
3228
 
              name="`expr $i : '-l\(.*\)'`"
3229
 
              # If $name is empty we are operating on a -L argument.
3230
 
              if test "$name" != "" && test "$name" -ne "0"; then
 
7738
              case $i in
 
7739
              -l*)
 
7740
                func_stripname -l '' "$i"
 
7741
                name=$func_stripname_result
3231
7742
                if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3232
7743
                  case " $predeps $postdeps " in
3233
7744
                  *" $i "*)
3234
 
                    newdeplibs="$newdeplibs $i"
 
7745
                    func_append newdeplibs " $i"
3235
7746
                    i=""
3236
7747
                    ;;
3237
7748
                  esac
3238
 
                fi
 
7749
                fi
3239
7750
                if test -n "$i" ; then
3240
 
                  libname=`eval \\$echo \"$libname_spec\"`
3241
 
                  deplib_matches=`eval \\$echo \"$library_names_spec\"`
3242
 
                  set dummy $deplib_matches
3243
 
                  deplib_match=$2
 
7751
                  libname=`eval "\\$ECHO \"$libname_spec\""`
 
7752
                  deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
 
7753
                  set dummy $deplib_matches; shift
 
7754
                  deplib_match=$1
3244
7755
                  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3245
 
                    newdeplibs="$newdeplibs $i"
 
7756
                    func_append newdeplibs " $i"
3246
7757
                  else
3247
7758
                    droppeddeps=yes
3248
 
                    $echo
3249
 
                    $echo "*** Warning: dynamic linker does not accept needed library $i."
3250
 
                    $echo "*** I have the capability to make that library automatically link in when"
3251
 
                    $echo "*** you link to this library.  But I can only do this if you have a"
3252
 
                    $echo "*** shared version of the library, which I believe you do not have"
3253
 
                    $echo "*** because a test_compile did reveal that the linker did not use it for"
3254
 
                    $echo "*** its dynamic dependency list that programs get resolved with at runtime."
 
7759
                    echo
 
7760
                    $ECHO "*** Warning: dynamic linker does not accept needed library $i."
 
7761
                    echo "*** I have the capability to make that library automatically link in when"
 
7762
                    echo "*** you link to this library.  But I can only do this if you have a"
 
7763
                    echo "*** shared version of the library, which I believe you do not have"
 
7764
                    echo "*** because a test_compile did reveal that the linker did not use it for"
 
7765
                    echo "*** its dynamic dependency list that programs get resolved with at runtime."
3255
7766
                  fi
3256
7767
                fi
3257
 
              else
3258
 
                newdeplibs="$newdeplibs $i"
3259
 
              fi
 
7768
                ;;
 
7769
              *)
 
7770
                func_append newdeplibs " $i"
 
7771
                ;;
 
7772
              esac
3260
7773
            done
3261
7774
          else
3262
7775
            # Error occurred in the first compile.  Let's try to salvage
3263
7776
            # the situation: Compile a separate program for each library.
3264
7777
            for i in $deplibs; do
3265
 
              name="`expr $i : '-l\(.*\)'`"
3266
 
              # If $name is empty we are operating on a -L argument.
3267
 
              if test "$name" != "" && test "$name" != "0"; then
3268
 
                $rm conftest
3269
 
                $LTCC -o conftest conftest.c $i
3270
 
                # Did it work?
3271
 
                if test "$?" -eq 0 ; then
 
7778
              case $i in
 
7779
              -l*)
 
7780
                func_stripname -l '' "$i"
 
7781
                name=$func_stripname_result
 
7782
                $opt_dry_run || $RM conftest
 
7783
                if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
3272
7784
                  ldd_output=`ldd conftest`
3273
7785
                  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3274
7786
                    case " $predeps $postdeps " in
3275
7787
                    *" $i "*)
3276
 
                      newdeplibs="$newdeplibs $i"
 
7788
                      func_append newdeplibs " $i"
3277
7789
                      i=""
3278
7790
                      ;;
3279
7791
                    esac
3280
7792
                  fi
3281
7793
                  if test -n "$i" ; then
3282
 
                    libname=`eval \\$echo \"$libname_spec\"`
3283
 
                    deplib_matches=`eval \\$echo \"$library_names_spec\"`
3284
 
                    set dummy $deplib_matches
3285
 
                    deplib_match=$2
 
7794
                    libname=`eval "\\$ECHO \"$libname_spec\""`
 
7795
                    deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
 
7796
                    set dummy $deplib_matches; shift
 
7797
                    deplib_match=$1
3286
7798
                    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3287
 
                      newdeplibs="$newdeplibs $i"
 
7799
                      func_append newdeplibs " $i"
3288
7800
                    else
3289
7801
                      droppeddeps=yes
3290
 
                      $echo
3291
 
                      $echo "*** Warning: dynamic linker does not accept needed library $i."
3292
 
                      $echo "*** I have the capability to make that library automatically link in when"
3293
 
                      $echo "*** you link to this library.  But I can only do this if you have a"
3294
 
                      $echo "*** shared version of the library, which you do not appear to have"
3295
 
                      $echo "*** because a test_compile did reveal that the linker did not use this one"
3296
 
                      $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
 
7802
                      echo
 
7803
                      $ECHO "*** Warning: dynamic linker does not accept needed library $i."
 
7804
                      echo "*** I have the capability to make that library automatically link in when"
 
7805
                      echo "*** you link to this library.  But I can only do this if you have a"
 
7806
                      echo "*** shared version of the library, which you do not appear to have"
 
7807
                      echo "*** because a test_compile did reveal that the linker did not use this one"
 
7808
                      echo "*** as a dynamic dependency that programs can get resolved with at runtime."
3297
7809
                    fi
3298
7810
                  fi
3299
7811
                else
3300
7812
                  droppeddeps=yes
3301
 
                  $echo
3302
 
                  $echo "*** Warning!  Library $i is needed by this library but I was not able to"
3303
 
                  $echo "***  make it link in!  You will probably need to install it or some"
3304
 
                  $echo "*** library that it depends on before this library will be fully"
3305
 
                  $echo "*** functional.  Installing it before continuing would be even better."
 
7813
                  echo
 
7814
                  $ECHO "*** Warning!  Library $i is needed by this library but I was not able to"
 
7815
                  echo "*** make it link in!  You will probably need to install it or some"
 
7816
                  echo "*** library that it depends on before this library will be fully"
 
7817
                  echo "*** functional.  Installing it before continuing would be even better."
3306
7818
                fi
3307
 
              else
3308
 
                newdeplibs="$newdeplibs $i"
3309
 
              fi
 
7819
                ;;
 
7820
              *)
 
7821
                func_append newdeplibs " $i"
 
7822
                ;;
 
7823
              esac
3310
7824
            done
3311
7825
          fi
3312
7826
          ;;
3313
7827
        file_magic*)
3314
 
          set dummy $deplibs_check_method
3315
 
          file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
 
7828
          set dummy $deplibs_check_method; shift
 
7829
          file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
3316
7830
          for a_deplib in $deplibs; do
3317
 
            name="`expr $a_deplib : '-l\(.*\)'`"
3318
 
            # If $name is empty we are operating on a -L argument.
3319
 
            if test "$name" != "" && test  "$name" != "0"; then
 
7831
            case $a_deplib in
 
7832
            -l*)
 
7833
              func_stripname -l '' "$a_deplib"
 
7834
              name=$func_stripname_result
3320
7835
              if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3321
7836
                case " $predeps $postdeps " in
3322
7837
                *" $a_deplib "*)
3323
 
                  newdeplibs="$newdeplibs $a_deplib"
 
7838
                  func_append newdeplibs " $a_deplib"
3324
7839
                  a_deplib=""
3325
7840
                  ;;
3326
7841
                esac
3327
7842
              fi
3328
7843
              if test -n "$a_deplib" ; then
3329
 
                libname=`eval \\$echo \"$libname_spec\"`
 
7844
                libname=`eval "\\$ECHO \"$libname_spec\""`
 
7845
                if test -n "$file_magic_glob"; then
 
7846
                  libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
 
7847
                else
 
7848
                  libnameglob=$libname
 
7849
                fi
 
7850
                test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob`
3330
7851
                for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3331
 
                  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
 
7852
                  if test "$want_nocaseglob" = yes; then
 
7853
                    shopt -s nocaseglob
 
7854
                    potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
 
7855
                    $nocaseglob
 
7856
                  else
 
7857
                    potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
 
7858
                  fi
3332
7859
                  for potent_lib in $potential_libs; do
3333
7860
                      # Follow soft links.
3334
 
                      if ls -lLd "$potent_lib" 2>/dev/null \
3335
 
                         | grep " -> " >/dev/null; then
 
7861
                      if ls -lLd "$potent_lib" 2>/dev/null |
 
7862
                         $GREP " -> " >/dev/null; then
3336
7863
                        continue
3337
7864
                      fi
3338
7865
                      # The statement above tries to avoid entering an
3345
7872
                        potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
3346
7873
                        case $potliblink in
3347
7874
                        [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
3348
 
                        *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
 
7875
                        *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";;
3349
7876
                        esac
3350
7877
                      done
3351
 
                      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
3352
 
                         | ${SED} 10q \
3353
 
                         | $EGREP "$file_magic_regex" > /dev/null; then
3354
 
                        newdeplibs="$newdeplibs $a_deplib"
 
7878
                      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
 
7879
                         $SED -e 10q |
 
7880
                         $EGREP "$file_magic_regex" > /dev/null; then
 
7881
                        func_append newdeplibs " $a_deplib"
3355
7882
                        a_deplib=""
3356
7883
                        break 2
3357
7884
                      fi
3360
7887
              fi
3361
7888
              if test -n "$a_deplib" ; then
3362
7889
                droppeddeps=yes
3363
 
                $echo
3364
 
                $echo "*** Warning: linker path does not have real file for library $a_deplib."
3365
 
                $echo "*** I have the capability to make that library automatically link in when"
3366
 
                $echo "*** you link to this library.  But I can only do this if you have a"
3367
 
                $echo "*** shared version of the library, which you do not appear to have"
3368
 
                $echo "*** because I did check the linker path looking for a file starting"
 
7890
                echo
 
7891
                $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
 
7892
                echo "*** I have the capability to make that library automatically link in when"
 
7893
                echo "*** you link to this library.  But I can only do this if you have a"
 
7894
                echo "*** shared version of the library, which you do not appear to have"
 
7895
                echo "*** because I did check the linker path looking for a file starting"
3369
7896
                if test -z "$potlib" ; then
3370
 
                  $echo "*** with $libname but no candidates were found. (...for file magic test)"
 
7897
                  $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
3371
7898
                else
3372
 
                  $echo "*** with $libname and none of the candidates passed a file format test"
3373
 
                  $echo "*** using a file magic. Last file checked: $potlib"
 
7899
                  $ECHO "*** with $libname and none of the candidates passed a file format test"
 
7900
                  $ECHO "*** using a file magic. Last file checked: $potlib"
3374
7901
                fi
3375
7902
              fi
3376
 
            else
 
7903
              ;;
 
7904
            *)
3377
7905
              # Add a -L argument.
3378
 
              newdeplibs="$newdeplibs $a_deplib"
3379
 
            fi
 
7906
              func_append newdeplibs " $a_deplib"
 
7907
              ;;
 
7908
            esac
3380
7909
          done # Gone through all deplibs.
3381
7910
          ;;
3382
7911
        match_pattern*)
3383
 
          set dummy $deplibs_check_method
3384
 
          match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
 
7912
          set dummy $deplibs_check_method; shift
 
7913
          match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
3385
7914
          for a_deplib in $deplibs; do
3386
 
            name="`expr $a_deplib : '-l\(.*\)'`"
3387
 
            # If $name is empty we are operating on a -L argument.
3388
 
            if test -n "$name" && test "$name" != "0"; then
 
7915
            case $a_deplib in
 
7916
            -l*)
 
7917
              func_stripname -l '' "$a_deplib"
 
7918
              name=$func_stripname_result
3389
7919
              if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3390
7920
                case " $predeps $postdeps " in
3391
7921
                *" $a_deplib "*)
3392
 
                  newdeplibs="$newdeplibs $a_deplib"
 
7922
                  func_append newdeplibs " $a_deplib"
3393
7923
                  a_deplib=""
3394
7924
                  ;;
3395
7925
                esac
3396
7926
              fi
3397
7927
              if test -n "$a_deplib" ; then
3398
 
                libname=`eval \\$echo \"$libname_spec\"`
 
7928
                libname=`eval "\\$ECHO \"$libname_spec\""`
3399
7929
                for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3400
7930
                  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3401
7931
                  for potent_lib in $potential_libs; do
3402
7932
                    potlib="$potent_lib" # see symlink-check above in file_magic test
3403
 
                    if eval $echo \"$potent_lib\" 2>/dev/null \
3404
 
                        | ${SED} 10q \
3405
 
                        | $EGREP "$match_pattern_regex" > /dev/null; then
3406
 
                      newdeplibs="$newdeplibs $a_deplib"
 
7933
                    if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
 
7934
                       $EGREP "$match_pattern_regex" > /dev/null; then
 
7935
                      func_append newdeplibs " $a_deplib"
3407
7936
                      a_deplib=""
3408
7937
                      break 2
3409
7938
                    fi
3412
7941
              fi
3413
7942
              if test -n "$a_deplib" ; then
3414
7943
                droppeddeps=yes
3415
 
                $echo
3416
 
                $echo "*** Warning: linker path does not have real file for library $a_deplib."
3417
 
                $echo "*** I have the capability to make that library automatically link in when"
3418
 
                $echo "*** you link to this library.  But I can only do this if you have a"
3419
 
                $echo "*** shared version of the library, which you do not appear to have"
3420
 
                $echo "*** because I did check the linker path looking for a file starting"
 
7944
                echo
 
7945
                $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
 
7946
                echo "*** I have the capability to make that library automatically link in when"
 
7947
                echo "*** you link to this library.  But I can only do this if you have a"
 
7948
                echo "*** shared version of the library, which you do not appear to have"
 
7949
                echo "*** because I did check the linker path looking for a file starting"
3421
7950
                if test -z "$potlib" ; then
3422
 
                  $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
 
7951
                  $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
3423
7952
                else
3424
 
                  $echo "*** with $libname and none of the candidates passed a file format test"
3425
 
                  $echo "*** using a regex pattern. Last file checked: $potlib"
 
7953
                  $ECHO "*** with $libname and none of the candidates passed a file format test"
 
7954
                  $ECHO "*** using a regex pattern. Last file checked: $potlib"
3426
7955
                fi
3427
7956
              fi
3428
 
            else
 
7957
              ;;
 
7958
            *)
3429
7959
              # Add a -L argument.
3430
 
              newdeplibs="$newdeplibs $a_deplib"
3431
 
            fi
 
7960
              func_append newdeplibs " $a_deplib"
 
7961
              ;;
 
7962
            esac
3432
7963
          done # Gone through all deplibs.
3433
7964
          ;;
3434
7965
        none | unknown | *)
3435
7966
          newdeplibs=""
3436
 
          tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
3437
 
            -e 's/ -[LR][^ ]*//g'`
 
7967
          tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
3438
7968
          if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3439
7969
            for i in $predeps $postdeps ; do
3440
7970
              # can't use Xsed below, because $i might contain '/'
3441
 
              tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
 
7971
              tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"`
3442
7972
            done
3443
7973
          fi
3444
 
          if $echo "X $tmp_deplibs" | $Xsed -e 's/[     ]//g' \
3445
 
            | grep . >/dev/null; then
3446
 
            $echo
 
7974
          case $tmp_deplibs in
 
7975
          *[!\  \ ]*)
 
7976
            echo
3447
7977
            if test "X$deplibs_check_method" = "Xnone"; then
3448
 
              $echo "*** Warning: inter-library dependencies are not supported in this platform."
 
7978
              echo "*** Warning: inter-library dependencies are not supported in this platform."
3449
7979
            else
3450
 
              $echo "*** Warning: inter-library dependencies are not known to be supported."
 
7980
              echo "*** Warning: inter-library dependencies are not known to be supported."
3451
7981
            fi
3452
 
            $echo "*** All declared inter-library dependencies are being dropped."
 
7982
            echo "*** All declared inter-library dependencies are being dropped."
3453
7983
            droppeddeps=yes
3454
 
          fi
 
7984
            ;;
 
7985
          esac
3455
7986
          ;;
3456
7987
        esac
3457
7988
        versuffix=$versuffix_save
3462
7993
 
3463
7994
        case $host in
3464
7995
        *-*-rhapsody* | *-*-darwin1.[012])
3465
 
          # On Rhapsody replace the C library is the System framework
3466
 
          newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
 
7996
          # On Rhapsody replace the C library with the System framework
 
7997
          newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
3467
7998
          ;;
3468
7999
        esac
3469
8000
 
3470
8001
        if test "$droppeddeps" = yes; then
3471
8002
          if test "$module" = yes; then
3472
 
            $echo
3473
 
            $echo "*** Warning: libtool could not satisfy all declared inter-library"
3474
 
            $echo "*** dependencies of module $libname.  Therefore, libtool will create"
3475
 
            $echo "*** a static module, that should work as long as the dlopening"
3476
 
            $echo "*** application is linked with the -dlopen flag."
 
8003
            echo
 
8004
            echo "*** Warning: libtool could not satisfy all declared inter-library"
 
8005
            $ECHO "*** dependencies of module $libname.  Therefore, libtool will create"
 
8006
            echo "*** a static module, that should work as long as the dlopening"
 
8007
            echo "*** application is linked with the -dlopen flag."
3477
8008
            if test -z "$global_symbol_pipe"; then
3478
 
              $echo
3479
 
              $echo "*** However, this would only work if libtool was able to extract symbol"
3480
 
              $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
3481
 
              $echo "*** not find such a program.  So, this module is probably useless."
3482
 
              $echo "*** \`nm' from GNU binutils and a full rebuild may help."
 
8009
              echo
 
8010
              echo "*** However, this would only work if libtool was able to extract symbol"
 
8011
              echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
 
8012
              echo "*** not find such a program.  So, this module is probably useless."
 
8013
              echo "*** \`nm' from GNU binutils and a full rebuild may help."
3483
8014
            fi
3484
8015
            if test "$build_old_libs" = no; then
3485
8016
              oldlibs="$output_objdir/$libname.$libext"
3489
8020
              build_libtool_libs=no
3490
8021
            fi
3491
8022
          else
3492
 
            $echo "*** The inter-library dependencies that have been dropped here will be"
3493
 
            $echo "*** automatically added whenever a program is linked with this library"
3494
 
            $echo "*** or is declared to -dlopen it."
 
8023
            echo "*** The inter-library dependencies that have been dropped here will be"
 
8024
            echo "*** automatically added whenever a program is linked with this library"
 
8025
            echo "*** or is declared to -dlopen it."
3495
8026
 
3496
8027
            if test "$allow_undefined" = no; then
3497
 
              $echo
3498
 
              $echo "*** Since this library must not contain undefined symbols,"
3499
 
              $echo "*** because either the platform does not support them or"
3500
 
              $echo "*** it was explicitly requested with -no-undefined,"
3501
 
              $echo "*** libtool will only create a static version of it."
 
8028
              echo
 
8029
              echo "*** Since this library must not contain undefined symbols,"
 
8030
              echo "*** because either the platform does not support them or"
 
8031
              echo "*** it was explicitly requested with -no-undefined,"
 
8032
              echo "*** libtool will only create a static version of it."
3502
8033
              if test "$build_old_libs" = no; then
3503
8034
                oldlibs="$output_objdir/$libname.$libext"
3504
8035
                build_libtool_libs=module
3512
8043
        # Done checking deplibs!
3513
8044
        deplibs=$newdeplibs
3514
8045
      fi
 
8046
      # Time to change all our "foo.ltframework" stuff back to "-framework foo"
 
8047
      case $host in
 
8048
        *-*-darwin*)
 
8049
          newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
 
8050
          new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
 
8051
          deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
 
8052
          ;;
 
8053
      esac
 
8054
 
 
8055
      # move library search paths that coincide with paths to not yet
 
8056
      # installed libraries to the beginning of the library search list
 
8057
      new_libs=
 
8058
      for path in $notinst_path; do
 
8059
        case " $new_libs " in
 
8060
        *" -L$path/$objdir "*) ;;
 
8061
        *)
 
8062
          case " $deplibs " in
 
8063
          *" -L$path/$objdir "*)
 
8064
            func_append new_libs " -L$path/$objdir" ;;
 
8065
          esac
 
8066
          ;;
 
8067
        esac
 
8068
      done
 
8069
      for deplib in $deplibs; do
 
8070
        case $deplib in
 
8071
        -L*)
 
8072
          case " $new_libs " in
 
8073
          *" $deplib "*) ;;
 
8074
          *) func_append new_libs " $deplib" ;;
 
8075
          esac
 
8076
          ;;
 
8077
        *) func_append new_libs " $deplib" ;;
 
8078
        esac
 
8079
      done
 
8080
      deplibs="$new_libs"
3515
8081
 
3516
8082
      # All the library-specific variables (install_libdir is set above).
3517
8083
      library_names=
3520
8086
 
3521
8087
      # Test again, we may have decided not to build it any more
3522
8088
      if test "$build_libtool_libs" = yes; then
 
8089
        # Remove ${wl} instances when linking with ld.
 
8090
        # FIXME: should test the right _cmds variable.
 
8091
        case $archive_cmds in
 
8092
          *\$LD\ *) wl= ;;
 
8093
        esac
3523
8094
        if test "$hardcode_into_libs" = yes; then
3524
8095
          # Hardcode the library paths
3525
8096
          hardcode_libdirs=
3526
8097
          dep_rpath=
3527
8098
          rpath="$finalize_rpath"
3528
 
          test "$mode" != relink && rpath="$compile_rpath$rpath"
 
8099
          test "$opt_mode" != relink && rpath="$compile_rpath$rpath"
3529
8100
          for libdir in $rpath; do
3530
8101
            if test -n "$hardcode_libdir_flag_spec"; then
3531
8102
              if test -n "$hardcode_libdir_separator"; then
 
8103
                func_replace_sysroot "$libdir"
 
8104
                libdir=$func_replace_sysroot_result
3532
8105
                if test -z "$hardcode_libdirs"; then
3533
8106
                  hardcode_libdirs="$libdir"
3534
8107
                else
3537
8110
                  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3538
8111
                    ;;
3539
8112
                  *)
3540
 
                    hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
 
8113
                    func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
3541
8114
                    ;;
3542
8115
                  esac
3543
8116
                fi
3544
8117
              else
3545
8118
                eval flag=\"$hardcode_libdir_flag_spec\"
3546
 
                dep_rpath="$dep_rpath $flag"
 
8119
                func_append dep_rpath " $flag"
3547
8120
              fi
3548
8121
            elif test -n "$runpath_var"; then
3549
8122
              case "$perm_rpath " in
3550
8123
              *" $libdir "*) ;;
3551
 
              *) perm_rpath="$perm_rpath $libdir" ;;
 
8124
              *) func_append perm_rpath " $libdir" ;;
3552
8125
              esac
3553
8126
            fi
3554
8127
          done
3556
8129
          if test -n "$hardcode_libdir_separator" &&
3557
8130
             test -n "$hardcode_libdirs"; then
3558
8131
            libdir="$hardcode_libdirs"
3559
 
            if test -n "$hardcode_libdir_flag_spec_ld"; then
3560
 
              eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
3561
 
            else
3562
 
              eval dep_rpath=\"$hardcode_libdir_flag_spec\"
3563
 
            fi
 
8132
            eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
3564
8133
          fi
3565
8134
          if test -n "$runpath_var" && test -n "$perm_rpath"; then
3566
8135
            # We should set the runpath_var.
3567
8136
            rpath=
3568
8137
            for dir in $perm_rpath; do
3569
 
              rpath="$rpath$dir:"
 
8138
              func_append rpath "$dir:"
3570
8139
            done
3571
8140
            eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
3572
8141
          fi
3574
8143
        fi
3575
8144
 
3576
8145
        shlibpath="$finalize_shlibpath"
3577
 
        test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
 
8146
        test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
3578
8147
        if test -n "$shlibpath"; then
3579
8148
          eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
3580
8149
        fi
3581
8150
 
3582
8151
        # Get the real and link names of the library.
3583
 
        eval shared_ext=\"$shrext\"
 
8152
        eval shared_ext=\"$shrext_cmds\"
3584
8153
        eval library_names=\"$library_names_spec\"
3585
8154
        set dummy $library_names
3586
 
        realname="$2"
3587
 
        shift; shift
 
8155
        shift
 
8156
        realname="$1"
 
8157
        shift
3588
8158
 
3589
8159
        if test -n "$soname_spec"; then
3590
8160
          eval soname=\"$soname_spec\"
3596
8166
        fi
3597
8167
 
3598
8168
        lib="$output_objdir/$realname"
 
8169
        linknames=
3599
8170
        for link
3600
8171
        do
3601
 
          linknames="$linknames $link"
 
8172
          func_append linknames " $link"
3602
8173
        done
3603
8174
 
3604
8175
        # Use standard objects if they are pic
3605
 
        test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
 
8176
        test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
 
8177
        test "X$libobjs" = "X " && libobjs=
 
8178
 
 
8179
        delfiles=
 
8180
        if test -n "$export_symbols" && test -n "$include_expsyms"; then
 
8181
          $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
 
8182
          export_symbols="$output_objdir/$libname.uexp"
 
8183
          func_append delfiles " $export_symbols"
 
8184
        fi
 
8185
 
 
8186
        orig_export_symbols=
 
8187
        case $host_os in
 
8188
        cygwin* | mingw* | cegcc*)
 
8189
          if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
 
8190
            # exporting using user supplied symfile
 
8191
            if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
 
8192
              # and it's NOT already a .def file. Must figure out
 
8193
              # which of the given symbols are data symbols and tag
 
8194
              # them as such. So, trigger use of export_symbols_cmds.
 
8195
              # export_symbols gets reassigned inside the "prepare
 
8196
              # the list of exported symbols" if statement, so the
 
8197
              # include_expsyms logic still works.
 
8198
              orig_export_symbols="$export_symbols"
 
8199
              export_symbols=
 
8200
              always_export_symbols=yes
 
8201
            fi
 
8202
          fi
 
8203
          ;;
 
8204
        esac
3606
8205
 
3607
8206
        # Prepare the list of exported symbols
3608
8207
        if test -z "$export_symbols"; then
3609
8208
          if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
3610
 
            $show "generating symbol list for \`$libname.la'"
 
8209
            func_verbose "generating symbol list for \`$libname.la'"
3611
8210
            export_symbols="$output_objdir/$libname.exp"
3612
 
            $run $rm $export_symbols
 
8211
            $opt_dry_run || $RM $export_symbols
3613
8212
            cmds=$export_symbols_cmds
3614
8213
            save_ifs="$IFS"; IFS='~'
3615
 
            for cmd in $cmds; do
 
8214
            for cmd1 in $cmds; do
3616
8215
              IFS="$save_ifs"
3617
 
              eval cmd=\"$cmd\"
3618
 
              if len=`expr "X$cmd" : ".*"` &&
3619
 
               test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
3620
 
                $show "$cmd"
3621
 
                $run eval "$cmd" || exit $?
3622
 
                skipped_export=false
 
8216
              # Take the normal branch if the nm_file_list_spec branch
 
8217
              # doesn't work or if tool conversion is not needed.
 
8218
              case $nm_file_list_spec~$to_tool_file_cmd in
 
8219
                *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
 
8220
                  try_normal_branch=yes
 
8221
                  eval cmd=\"$cmd1\"
 
8222
                  func_len " $cmd"
 
8223
                  len=$func_len_result
 
8224
                  ;;
 
8225
                *)
 
8226
                  try_normal_branch=no
 
8227
                  ;;
 
8228
              esac
 
8229
              if test "$try_normal_branch" = yes \
 
8230
                 && { test "$len" -lt "$max_cmd_len" \
 
8231
                      || test "$max_cmd_len" -le -1; }
 
8232
              then
 
8233
                func_show_eval "$cmd" 'exit $?'
 
8234
                skipped_export=false
 
8235
              elif test -n "$nm_file_list_spec"; then
 
8236
                func_basename "$output"
 
8237
                output_la=$func_basename_result
 
8238
                save_libobjs=$libobjs
 
8239
                save_output=$output
 
8240
                output=${output_objdir}/${output_la}.nm
 
8241
                func_to_tool_file "$output"
 
8242
                libobjs=$nm_file_list_spec$func_to_tool_file_result
 
8243
                func_append delfiles " $output"
 
8244
                func_verbose "creating $NM input file list: $output"
 
8245
                for obj in $save_libobjs; do
 
8246
                  func_to_tool_file "$obj"
 
8247
                  $ECHO "$func_to_tool_file_result"
 
8248
                done > "$output"
 
8249
                eval cmd=\"$cmd1\"
 
8250
                func_show_eval "$cmd" 'exit $?'
 
8251
                output=$save_output
 
8252
                libobjs=$save_libobjs
 
8253
                skipped_export=false
3623
8254
              else
3624
 
                # The command line is too long to execute in one step.
3625
 
                $show "using reloadable object file for export list..."
3626
 
                skipped_export=:
 
8255
                # The command line is too long to execute in one step.
 
8256
                func_verbose "using reloadable object file for export list..."
 
8257
                skipped_export=:
 
8258
                # Break out early, otherwise skipped_export may be
 
8259
                # set to false by a later but shorter cmd.
 
8260
                break
3627
8261
              fi
3628
8262
            done
3629
8263
            IFS="$save_ifs"
3630
 
            if test -n "$export_symbols_regex"; then
3631
 
              $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
3632
 
              $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
3633
 
              $show "$mv \"${export_symbols}T\" \"$export_symbols\""
3634
 
              $run eval '$mv "${export_symbols}T" "$export_symbols"'
 
8264
            if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
 
8265
              func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
 
8266
              func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
3635
8267
            fi
3636
8268
          fi
3637
8269
        fi
3638
8270
 
3639
8271
        if test -n "$export_symbols" && test -n "$include_expsyms"; then
3640
 
          $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
 
8272
          tmp_export_symbols="$export_symbols"
 
8273
          test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
 
8274
          $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
 
8275
        fi
 
8276
 
 
8277
        if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
 
8278
          # The given exports_symbols file has to be filtered, so filter it.
 
8279
          func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
 
8280
          # FIXME: $output_objdir/$libname.filter potentially contains lots of
 
8281
          # 's' commands which not all seds can handle. GNU sed should be fine
 
8282
          # though. Also, the filter scales superlinearly with the number of
 
8283
          # global variables. join(1) would be nice here, but unfortunately
 
8284
          # isn't a blessed tool.
 
8285
          $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
 
8286
          func_append delfiles " $export_symbols $output_objdir/$libname.filter"
 
8287
          export_symbols=$output_objdir/$libname.def
 
8288
          $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
3641
8289
        fi
3642
8290
 
3643
8291
        tmp_deplibs=
3644
8292
        for test_deplib in $deplibs; do
3645
 
                case " $convenience " in
3646
 
                *" $test_deplib "*) ;;
3647
 
                *) 
3648
 
                        tmp_deplibs="$tmp_deplibs $test_deplib"
3649
 
                        ;;
3650
 
                esac
 
8293
          case " $convenience " in
 
8294
          *" $test_deplib "*) ;;
 
8295
          *)
 
8296
            func_append tmp_deplibs " $test_deplib"
 
8297
            ;;
 
8298
          esac
3651
8299
        done
3652
 
        deplibs="$tmp_deplibs" 
 
8300
        deplibs="$tmp_deplibs"
3653
8301
 
3654
8302
        if test -n "$convenience"; then
 
8303
          if test -n "$whole_archive_flag_spec" &&
 
8304
            test "$compiler_needs_object" = yes &&
 
8305
            test -z "$libobjs"; then
 
8306
            # extract the archives, so we have objects to list.
 
8307
            # TODO: could optimize this to just extract one archive.
 
8308
            whole_archive_flag_spec=
 
8309
          fi
3655
8310
          if test -n "$whole_archive_flag_spec"; then
3656
8311
            save_libobjs=$libobjs
3657
8312
            eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
 
8313
            test "X$libobjs" = "X " && libobjs=
3658
8314
          else
3659
8315
            gentop="$output_objdir/${outputname}x"
3660
 
            $show "${rm}r $gentop"
3661
 
            $run ${rm}r "$gentop"
3662
 
            $show "$mkdir $gentop"
3663
 
            $run $mkdir "$gentop"
3664
 
            status=$?
3665
 
            if test "$status" -ne 0 && test ! -d "$gentop"; then
3666
 
              exit $status
3667
 
            fi
3668
 
            generated="$generated $gentop"
3669
 
 
3670
 
            for xlib in $convenience; do
3671
 
              # Extract the objects.
3672
 
              case $xlib in
3673
 
              [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3674
 
              *) xabs=`pwd`"/$xlib" ;;
3675
 
              esac
3676
 
              xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3677
 
              xdir="$gentop/$xlib"
3678
 
 
3679
 
              $show "${rm}r $xdir"
3680
 
              $run ${rm}r "$xdir"
3681
 
              $show "$mkdir $xdir"
3682
 
              $run $mkdir "$xdir"
3683
 
              status=$?
3684
 
              if test "$status" -ne 0 && test ! -d "$xdir"; then
3685
 
                exit $status
3686
 
              fi
3687
 
              # We will extract separately just the conflicting names and we will no
3688
 
              # longer touch any unique names. It is faster to leave these extract
3689
 
              # automatically by $AR in one run.
3690
 
              $show "(cd $xdir && $AR x $xabs)"
3691
 
              $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3692
 
              if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
3693
 
                :
3694
 
              else
3695
 
                $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
3696
 
                $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
3697
 
                $AR t "$xabs" | sort | uniq -cd | while read -r count name
3698
 
                do
3699
 
                  i=1
3700
 
                  while test "$i" -le "$count"
3701
 
                  do
3702
 
                   # Put our $i before any first dot (extension)
3703
 
                   # Never overwrite any file
3704
 
                   name_to="$name"
3705
 
                   while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
3706
 
                   do
3707
 
                     name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
3708
 
                   done
3709
 
                   $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
3710
 
                   $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
3711
 
                   i=`expr $i + 1`
3712
 
                  done
3713
 
                done
3714
 
              fi
3715
 
 
3716
 
              libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
3717
 
            done
 
8316
            func_append generated " $gentop"
 
8317
 
 
8318
            func_extract_archives $gentop $convenience
 
8319
            func_append libobjs " $func_extract_archives_result"
 
8320
            test "X$libobjs" = "X " && libobjs=
3718
8321
          fi
3719
8322
        fi
3720
8323
 
3721
8324
        if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
3722
8325
          eval flag=\"$thread_safe_flag_spec\"
3723
 
          linker_flags="$linker_flags $flag"
 
8326
          func_append linker_flags " $flag"
3724
8327
        fi
3725
8328
 
3726
8329
        # Make a backup of the uninstalled library when relinking
3727
 
        if test "$mode" = relink; then
3728
 
          $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
 
8330
        if test "$opt_mode" = relink; then
 
8331
          $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
3729
8332
        fi
3730
8333
 
3731
8334
        # Do each of the archive commands.
3738
8341
            cmds=$module_cmds
3739
8342
          fi
3740
8343
        else
3741
 
        if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3742
 
          eval test_cmds=\"$archive_expsym_cmds\"
3743
 
          cmds=$archive_expsym_cmds
3744
 
        else
3745
 
          eval test_cmds=\"$archive_cmds\"
3746
 
          cmds=$archive_cmds
 
8344
          if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
 
8345
            eval test_cmds=\"$archive_expsym_cmds\"
 
8346
            cmds=$archive_expsym_cmds
 
8347
          else
 
8348
            eval test_cmds=\"$archive_cmds\"
 
8349
            cmds=$archive_cmds
3747
8350
          fi
3748
8351
        fi
3749
8352
 
3750
 
        if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` &&
3751
 
           test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
 
8353
        if test "X$skipped_export" != "X:" &&
 
8354
           func_len " $test_cmds" &&
 
8355
           len=$func_len_result &&
 
8356
           test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
3752
8357
          :
3753
8358
        else
3754
 
          # The command line is too long to link in one step, link piecewise.
3755
 
          $echo "creating reloadable object files..."
 
8359
          # The command line is too long to link in one step, link piecewise
 
8360
          # or, if using GNU ld and skipped_export is not :, use a linker
 
8361
          # script.
3756
8362
 
3757
8363
          # Save the value of $output and $libobjs because we want to
3758
8364
          # use them later.  If we have whole_archive_flag_spec, we
3766
8372
            save_libobjs=$libobjs
3767
8373
          fi
3768
8374
          save_output=$output
 
8375
          func_basename "$output"
 
8376
          output_la=$func_basename_result
3769
8377
 
3770
8378
          # Clear the reloadable object creation command queue and
3771
8379
          # initialize k to one.
3772
8380
          test_cmds=
3773
8381
          concat_cmds=
3774
8382
          objlist=
3775
 
          delfiles=
3776
8383
          last_robj=
3777
8384
          k=1
3778
 
          output=$output_objdir/$save_output-${k}.$objext
3779
 
          # Loop over the list of objects to be linked.
3780
 
          for obj in $save_libobjs
3781
 
          do
3782
 
            eval test_cmds=\"$reload_cmds $objlist $last_robj\"
3783
 
            if test "X$objlist" = X ||
3784
 
               { len=`expr "X$test_cmds" : ".*"` &&
3785
 
                 test "$len" -le "$max_cmd_len"; }; then
3786
 
              objlist="$objlist $obj"
 
8385
 
 
8386
          if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
 
8387
            output=${output_objdir}/${output_la}.lnkscript
 
8388
            func_verbose "creating GNU ld script: $output"
 
8389
            echo 'INPUT (' > $output
 
8390
            for obj in $save_libobjs
 
8391
            do
 
8392
              func_to_tool_file "$obj"
 
8393
              $ECHO "$func_to_tool_file_result" >> $output
 
8394
            done
 
8395
            echo ')' >> $output
 
8396
            func_append delfiles " $output"
 
8397
            func_to_tool_file "$output"
 
8398
            output=$func_to_tool_file_result
 
8399
          elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
 
8400
            output=${output_objdir}/${output_la}.lnk
 
8401
            func_verbose "creating linker input file list: $output"
 
8402
            : > $output
 
8403
            set x $save_libobjs
 
8404
            shift
 
8405
            firstobj=
 
8406
            if test "$compiler_needs_object" = yes; then
 
8407
              firstobj="$1 "
 
8408
              shift
 
8409
            fi
 
8410
            for obj
 
8411
            do
 
8412
              func_to_tool_file "$obj"
 
8413
              $ECHO "$func_to_tool_file_result" >> $output
 
8414
            done
 
8415
            func_append delfiles " $output"
 
8416
            func_to_tool_file "$output"
 
8417
            output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
 
8418
          else
 
8419
            if test -n "$save_libobjs"; then
 
8420
              func_verbose "creating reloadable object files..."
 
8421
              output=$output_objdir/$output_la-${k}.$objext
 
8422
              eval test_cmds=\"$reload_cmds\"
 
8423
              func_len " $test_cmds"
 
8424
              len0=$func_len_result
 
8425
              len=$len0
 
8426
 
 
8427
              # Loop over the list of objects to be linked.
 
8428
              for obj in $save_libobjs
 
8429
              do
 
8430
                func_len " $obj"
 
8431
                func_arith $len + $func_len_result
 
8432
                len=$func_arith_result
 
8433
                if test "X$objlist" = X ||
 
8434
                   test "$len" -lt "$max_cmd_len"; then
 
8435
                  func_append objlist " $obj"
 
8436
                else
 
8437
                  # The command $test_cmds is almost too long, add a
 
8438
                  # command to the queue.
 
8439
                  if test "$k" -eq 1 ; then
 
8440
                    # The first file doesn't have a previous command to add.
 
8441
                    reload_objs=$objlist
 
8442
                    eval concat_cmds=\"$reload_cmds\"
 
8443
                  else
 
8444
                    # All subsequent reloadable object files will link in
 
8445
                    # the last one created.
 
8446
                    reload_objs="$objlist $last_robj"
 
8447
                    eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
 
8448
                  fi
 
8449
                  last_robj=$output_objdir/$output_la-${k}.$objext
 
8450
                  func_arith $k + 1
 
8451
                  k=$func_arith_result
 
8452
                  output=$output_objdir/$output_la-${k}.$objext
 
8453
                  objlist=" $obj"
 
8454
                  func_len " $last_robj"
 
8455
                  func_arith $len0 + $func_len_result
 
8456
                  len=$func_arith_result
 
8457
                fi
 
8458
              done
 
8459
              # Handle the remaining objects by creating one last
 
8460
              # reloadable object file.  All subsequent reloadable object
 
8461
              # files will link in the last one created.
 
8462
              test -z "$concat_cmds" || concat_cmds=$concat_cmds~
 
8463
              reload_objs="$objlist $last_robj"
 
8464
              eval concat_cmds=\"\${concat_cmds}$reload_cmds\"
 
8465
              if test -n "$last_robj"; then
 
8466
                eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
 
8467
              fi
 
8468
              func_append delfiles " $output"
 
8469
 
3787
8470
            else
3788
 
              # The command $test_cmds is almost too long, add a
3789
 
              # command to the queue.
3790
 
              if test "$k" -eq 1 ; then
3791
 
                # The first file doesn't have a previous command to add.
3792
 
                eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
3793
 
              else
3794
 
                # All subsequent reloadable object files will link in
3795
 
                # the last one created.
3796
 
                eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
 
8471
              output=
 
8472
            fi
 
8473
 
 
8474
            if ${skipped_export-false}; then
 
8475
              func_verbose "generating symbol list for \`$libname.la'"
 
8476
              export_symbols="$output_objdir/$libname.exp"
 
8477
              $opt_dry_run || $RM $export_symbols
 
8478
              libobjs=$output
 
8479
              # Append the command to create the export file.
 
8480
              test -z "$concat_cmds" || concat_cmds=$concat_cmds~
 
8481
              eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
 
8482
              if test -n "$last_robj"; then
 
8483
                eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
3797
8484
              fi
3798
 
              last_robj=$output_objdir/$save_output-${k}.$objext
3799
 
              k=`expr $k + 1`
3800
 
              output=$output_objdir/$save_output-${k}.$objext
3801
 
              objlist=$obj
3802
 
              len=1
3803
8485
            fi
3804
 
          done
3805
 
          # Handle the remaining objects by creating one last
3806
 
          # reloadable object file.  All subsequent reloadable object
3807
 
          # files will link in the last one created.
3808
 
          test -z "$concat_cmds" || concat_cmds=$concat_cmds~
3809
 
          eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
3810
 
 
3811
 
          if ${skipped_export-false}; then
3812
 
            $show "generating symbol list for \`$libname.la'"
3813
 
            export_symbols="$output_objdir/$libname.exp"
3814
 
            $run $rm $export_symbols
3815
 
            libobjs=$output
3816
 
            # Append the command to create the export file.
3817
 
            eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
3818
 
          fi
3819
 
 
3820
 
          # Set up a command to remove the reloadale object files
3821
 
          # after they are used.
3822
 
          i=0
3823
 
          while test "$i" -lt "$k"
3824
 
          do
3825
 
            i=`expr $i + 1`
3826
 
            delfiles="$delfiles $output_objdir/$save_output-${i}.$objext"
3827
 
          done
3828
 
 
3829
 
          $echo "creating a temporary reloadable object file: $output"
3830
 
 
3831
 
          # Loop through the commands generated above and execute them.
3832
 
          save_ifs="$IFS"; IFS='~'
3833
 
          for cmd in $concat_cmds; do
 
8486
 
 
8487
            test -n "$save_libobjs" &&
 
8488
              func_verbose "creating a temporary reloadable object file: $output"
 
8489
 
 
8490
            # Loop through the commands generated above and execute them.
 
8491
            save_ifs="$IFS"; IFS='~'
 
8492
            for cmd in $concat_cmds; do
 
8493
              IFS="$save_ifs"
 
8494
              $opt_silent || {
 
8495
                  func_quote_for_expand "$cmd"
 
8496
                  eval "func_echo $func_quote_for_expand_result"
 
8497
              }
 
8498
              $opt_dry_run || eval "$cmd" || {
 
8499
                lt_exit=$?
 
8500
 
 
8501
                # Restore the uninstalled library and exit
 
8502
                if test "$opt_mode" = relink; then
 
8503
                  ( cd "$output_objdir" && \
 
8504
                    $RM "${realname}T" && \
 
8505
                    $MV "${realname}U" "$realname" )
 
8506
                fi
 
8507
 
 
8508
                exit $lt_exit
 
8509
              }
 
8510
            done
3834
8511
            IFS="$save_ifs"
3835
 
            eval cmd=\"$cmd\"
3836
 
            $show "$cmd"
3837
 
            $run eval "$cmd" || exit $?
3838
 
          done
3839
 
          IFS="$save_ifs"
 
8512
 
 
8513
            if test -n "$export_symbols_regex" && ${skipped_export-false}; then
 
8514
              func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
 
8515
              func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
 
8516
            fi
 
8517
          fi
 
8518
 
 
8519
          if ${skipped_export-false}; then
 
8520
            if test -n "$export_symbols" && test -n "$include_expsyms"; then
 
8521
              tmp_export_symbols="$export_symbols"
 
8522
              test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
 
8523
              $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
 
8524
            fi
 
8525
 
 
8526
            if test -n "$orig_export_symbols"; then
 
8527
              # The given exports_symbols file has to be filtered, so filter it.
 
8528
              func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
 
8529
              # FIXME: $output_objdir/$libname.filter potentially contains lots of
 
8530
              # 's' commands which not all seds can handle. GNU sed should be fine
 
8531
              # though. Also, the filter scales superlinearly with the number of
 
8532
              # global variables. join(1) would be nice here, but unfortunately
 
8533
              # isn't a blessed tool.
 
8534
              $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
 
8535
              func_append delfiles " $export_symbols $output_objdir/$libname.filter"
 
8536
              export_symbols=$output_objdir/$libname.def
 
8537
              $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
 
8538
            fi
 
8539
          fi
3840
8540
 
3841
8541
          libobjs=$output
3842
8542
          # Restore the value of output.
3844
8544
 
3845
8545
          if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
3846
8546
            eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
 
8547
            test "X$libobjs" = "X " && libobjs=
3847
8548
          fi
3848
8549
          # Expand the library linking commands again to reset the
3849
8550
          # value of $libobjs for piecewise linking.
3856
8557
              cmds=$module_cmds
3857
8558
            fi
3858
8559
          else
3859
 
          if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3860
 
            cmds=$archive_expsym_cmds
3861
 
          else
3862
 
            cmds=$archive_cmds
 
8560
            if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
 
8561
              cmds=$archive_expsym_cmds
 
8562
            else
 
8563
              cmds=$archive_cmds
3863
8564
            fi
3864
8565
          fi
3865
 
 
3866
 
          # Append the command to remove the reloadable object files
3867
 
          # to the just-reset $cmds.
3868
 
          eval cmds=\"\$cmds~\$rm $delfiles\"
3869
 
        fi
 
8566
        fi
 
8567
 
 
8568
        if test -n "$delfiles"; then
 
8569
          # Append the command to remove temporary files to $cmds.
 
8570
          eval cmds=\"\$cmds~\$RM $delfiles\"
 
8571
        fi
 
8572
 
 
8573
        # Add any objects from preloaded convenience libraries
 
8574
        if test -n "$dlprefiles"; then
 
8575
          gentop="$output_objdir/${outputname}x"
 
8576
          func_append generated " $gentop"
 
8577
 
 
8578
          func_extract_archives $gentop $dlprefiles
 
8579
          func_append libobjs " $func_extract_archives_result"
 
8580
          test "X$libobjs" = "X " && libobjs=
 
8581
        fi
 
8582
 
3870
8583
        save_ifs="$IFS"; IFS='~'
3871
8584
        for cmd in $cmds; do
3872
8585
          IFS="$save_ifs"
3873
8586
          eval cmd=\"$cmd\"
3874
 
          $show "$cmd"
3875
 
          $run eval "$cmd" || exit $?
 
8587
          $opt_silent || {
 
8588
            func_quote_for_expand "$cmd"
 
8589
            eval "func_echo $func_quote_for_expand_result"
 
8590
          }
 
8591
          $opt_dry_run || eval "$cmd" || {
 
8592
            lt_exit=$?
 
8593
 
 
8594
            # Restore the uninstalled library and exit
 
8595
            if test "$opt_mode" = relink; then
 
8596
              ( cd "$output_objdir" && \
 
8597
                $RM "${realname}T" && \
 
8598
                $MV "${realname}U" "$realname" )
 
8599
            fi
 
8600
 
 
8601
            exit $lt_exit
 
8602
          }
3876
8603
        done
3877
8604
        IFS="$save_ifs"
3878
8605
 
3879
8606
        # Restore the uninstalled library and exit
3880
 
        if test "$mode" = relink; then
3881
 
          $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
3882
 
          exit 0
 
8607
        if test "$opt_mode" = relink; then
 
8608
          $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
 
8609
 
 
8610
          if test -n "$convenience"; then
 
8611
            if test -z "$whole_archive_flag_spec"; then
 
8612
              func_show_eval '${RM}r "$gentop"'
 
8613
            fi
 
8614
          fi
 
8615
 
 
8616
          exit $EXIT_SUCCESS
3883
8617
        fi
3884
8618
 
3885
8619
        # Create links to the real library.
3886
8620
        for linkname in $linknames; do
3887
8621
          if test "$realname" != "$linkname"; then
3888
 
            $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
3889
 
            $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
 
8622
            func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
3890
8623
          fi
3891
8624
        done
3892
8625
 
3899
8632
      ;;
3900
8633
 
3901
8634
    obj)
3902
 
      if test -n "$deplibs"; then
3903
 
        $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
3904
 
      fi
3905
 
 
3906
8635
      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3907
 
        $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
3908
 
      fi
3909
 
 
3910
 
      if test -n "$rpath"; then
3911
 
        $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
3912
 
      fi
3913
 
 
3914
 
      if test -n "$xrpath"; then
3915
 
        $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
3916
 
      fi
3917
 
 
3918
 
      if test -n "$vinfo"; then
3919
 
        $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
3920
 
      fi
3921
 
 
3922
 
      if test -n "$release"; then
3923
 
        $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
3924
 
      fi
 
8636
        func_warning "\`-dlopen' is ignored for objects"
 
8637
      fi
 
8638
 
 
8639
      case " $deplibs" in
 
8640
      *\ -l* | *\ -L*)
 
8641
        func_warning "\`-l' and \`-L' are ignored for objects" ;;
 
8642
      esac
 
8643
 
 
8644
      test -n "$rpath" && \
 
8645
        func_warning "\`-rpath' is ignored for objects"
 
8646
 
 
8647
      test -n "$xrpath" && \
 
8648
        func_warning "\`-R' is ignored for objects"
 
8649
 
 
8650
      test -n "$vinfo" && \
 
8651
        func_warning "\`-version-info' is ignored for objects"
 
8652
 
 
8653
      test -n "$release" && \
 
8654
        func_warning "\`-release' is ignored for objects"
3925
8655
 
3926
8656
      case $output in
3927
8657
      *.lo)
3928
 
        if test -n "$objs$old_deplibs"; then
3929
 
          $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
3930
 
          exit 1
3931
 
        fi
3932
 
        libobj="$output"
3933
 
        obj=`$echo "X$output" | $Xsed -e "$lo2o"`
 
8658
        test -n "$objs$old_deplibs" && \
 
8659
          func_fatal_error "cannot build library object \`$output' from non-libtool objects"
 
8660
 
 
8661
        libobj=$output
 
8662
        func_lo2o "$libobj"
 
8663
        obj=$func_lo2o_result
3934
8664
        ;;
3935
8665
      *)
3936
8666
        libobj=
3939
8669
      esac
3940
8670
 
3941
8671
      # Delete the old objects.
3942
 
      $run $rm $obj $libobj
 
8672
      $opt_dry_run || $RM $obj $libobj
3943
8673
 
3944
8674
      # Objects from convenience libraries.  This assumes
3945
8675
      # single-version convenience libraries.  Whenever we create
3948
8678
      reload_conv_objs=
3949
8679
      gentop=
3950
8680
      # reload_cmds runs $LD directly, so let us get rid of
3951
 
      # -Wl from whole_archive_flag_spec
 
8681
      # -Wl from whole_archive_flag_spec and hope we can get by with
 
8682
      # turning comma into space..
3952
8683
      wl=
3953
8684
 
3954
8685
      if test -n "$convenience"; then
3955
8686
        if test -n "$whole_archive_flag_spec"; then
3956
 
          eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
 
8687
          eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
 
8688
          reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
3957
8689
        else
3958
8690
          gentop="$output_objdir/${obj}x"
3959
 
          $show "${rm}r $gentop"
3960
 
          $run ${rm}r "$gentop"
3961
 
          $show "$mkdir $gentop"
3962
 
          $run $mkdir "$gentop"
3963
 
          status=$?
3964
 
          if test "$status" -ne 0 && test ! -d "$gentop"; then
3965
 
            exit $status
3966
 
          fi
3967
 
          generated="$generated $gentop"
3968
 
 
3969
 
          for xlib in $convenience; do
3970
 
            # Extract the objects.
3971
 
            case $xlib in
3972
 
            [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3973
 
            *) xabs=`pwd`"/$xlib" ;;
3974
 
            esac
3975
 
            xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3976
 
            xdir="$gentop/$xlib"
3977
 
 
3978
 
            $show "${rm}r $xdir"
3979
 
            $run ${rm}r "$xdir"
3980
 
            $show "$mkdir $xdir"
3981
 
            $run $mkdir "$xdir"
3982
 
            status=$?
3983
 
            if test "$status" -ne 0 && test ! -d "$xdir"; then
3984
 
              exit $status
3985
 
            fi
3986
 
            # We will extract separately just the conflicting names and we will no
3987
 
            # longer touch any unique names. It is faster to leave these extract
3988
 
            # automatically by $AR in one run.
3989
 
            $show "(cd $xdir && $AR x $xabs)"
3990
 
            $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3991
 
            if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
3992
 
              :
3993
 
            else
3994
 
              $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
3995
 
              $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
3996
 
              $AR t "$xabs" | sort | uniq -cd | while read -r count name
3997
 
              do
3998
 
                i=1
3999
 
                while test "$i" -le "$count"
4000
 
                do
4001
 
                 # Put our $i before any first dot (extension)
4002
 
                 # Never overwrite any file
4003
 
                 name_to="$name"
4004
 
                 while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
4005
 
                 do
4006
 
                   name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
4007
 
                 done
4008
 
                 $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
4009
 
                 $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
4010
 
                 i=`expr $i + 1`
4011
 
                done
4012
 
              done
4013
 
            fi
4014
 
 
4015
 
            reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
4016
 
          done
 
8691
          func_append generated " $gentop"
 
8692
 
 
8693
          func_extract_archives $gentop $convenience
 
8694
          reload_conv_objs="$reload_objs $func_extract_archives_result"
4017
8695
        fi
4018
8696
      fi
4019
8697
 
 
8698
      # If we're not building shared, we need to use non_pic_objs
 
8699
      test "$build_libtool_libs" != yes && libobjs="$non_pic_objects"
 
8700
 
4020
8701
      # Create the old-style object.
4021
 
      reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
 
8702
      reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
4022
8703
 
4023
8704
      output="$obj"
4024
 
      cmds=$reload_cmds
4025
 
      save_ifs="$IFS"; IFS='~'
4026
 
      for cmd in $cmds; do
4027
 
        IFS="$save_ifs"
4028
 
        eval cmd=\"$cmd\"
4029
 
        $show "$cmd"
4030
 
        $run eval "$cmd" || exit $?
4031
 
      done
4032
 
      IFS="$save_ifs"
 
8705
      func_execute_cmds "$reload_cmds" 'exit $?'
4033
8706
 
4034
8707
      # Exit if we aren't doing a library object file.
4035
8708
      if test -z "$libobj"; then
4036
8709
        if test -n "$gentop"; then
4037
 
          $show "${rm}r $gentop"
4038
 
          $run ${rm}r $gentop
 
8710
          func_show_eval '${RM}r "$gentop"'
4039
8711
        fi
4040
8712
 
4041
 
        exit 0
 
8713
        exit $EXIT_SUCCESS
4042
8714
      fi
4043
8715
 
4044
8716
      if test "$build_libtool_libs" != yes; then
4045
8717
        if test -n "$gentop"; then
4046
 
          $show "${rm}r $gentop"
4047
 
          $run ${rm}r $gentop
 
8718
          func_show_eval '${RM}r "$gentop"'
4048
8719
        fi
4049
8720
 
4050
8721
        # Create an invalid libtool object if no PIC, so that we don't
4051
8722
        # accidentally link it into a program.
4052
8723
        # $show "echo timestamp > $libobj"
4053
 
        # $run eval "echo timestamp > $libobj" || exit $?
4054
 
        exit 0
 
8724
        # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
 
8725
        exit $EXIT_SUCCESS
4055
8726
      fi
4056
8727
 
4057
8728
      if test -n "$pic_flag" || test "$pic_mode" != default; then
4058
8729
        # Only do commands if we really have different PIC objects.
4059
8730
        reload_objs="$libobjs $reload_conv_objs"
4060
8731
        output="$libobj"
4061
 
        cmds=$reload_cmds
4062
 
        save_ifs="$IFS"; IFS='~'
4063
 
        for cmd in $cmds; do
4064
 
          IFS="$save_ifs"
4065
 
          eval cmd=\"$cmd\"
4066
 
          $show "$cmd"
4067
 
          $run eval "$cmd" || exit $?
4068
 
        done
4069
 
        IFS="$save_ifs"
 
8732
        func_execute_cmds "$reload_cmds" 'exit $?'
4070
8733
      fi
4071
8734
 
4072
8735
      if test -n "$gentop"; then
4073
 
        $show "${rm}r $gentop"
4074
 
        $run ${rm}r $gentop
 
8736
        func_show_eval '${RM}r "$gentop"'
4075
8737
      fi
4076
8738
 
4077
 
      exit 0
 
8739
      exit $EXIT_SUCCESS
4078
8740
      ;;
4079
8741
 
4080
8742
    prog)
4081
8743
      case $host in
4082
 
        *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
 
8744
        *cygwin*) func_stripname '' '.exe' "$output"
 
8745
                  output=$func_stripname_result.exe;;
4083
8746
      esac
4084
 
      if test -n "$vinfo"; then
4085
 
        $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
4086
 
      fi
4087
 
 
4088
 
      if test -n "$release"; then
4089
 
        $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
4090
 
      fi
4091
 
 
4092
 
      if test "$preload" = yes; then
4093
 
        if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
4094
 
           test "$dlopen_self_static" = unknown; then
4095
 
          $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
4096
 
        fi
4097
 
      fi
 
8747
      test -n "$vinfo" && \
 
8748
        func_warning "\`-version-info' is ignored for programs"
 
8749
 
 
8750
      test -n "$release" && \
 
8751
        func_warning "\`-release' is ignored for programs"
 
8752
 
 
8753
      test "$preload" = yes \
 
8754
        && test "$dlopen_support" = unknown \
 
8755
        && test "$dlopen_self" = unknown \
 
8756
        && test "$dlopen_self_static" = unknown && \
 
8757
          func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
4098
8758
 
4099
8759
      case $host in
4100
8760
      *-*-rhapsody* | *-*-darwin1.[012])
4101
8761
        # On Rhapsody replace the C library is the System framework
4102
 
        compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4103
 
        finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
 
8762
        compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
 
8763
        finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
4104
8764
        ;;
4105
8765
      esac
4106
8766
 
4107
8767
      case $host in
4108
 
      *darwin*)
4109
 
        # Don't allow lazy linking, it breaks C++ global constructors
4110
 
        if test "$tagname" = CXX ; then
4111
 
        compile_command="$compile_command ${wl}-bind_at_load"
4112
 
        finalize_command="$finalize_command ${wl}-bind_at_load"
4113
 
        fi
4114
 
        ;;
 
8768
      *-*-darwin*)
 
8769
        # Don't allow lazy linking, it breaks C++ global constructors
 
8770
        # But is supposedly fixed on 10.4 or later (yay!).
 
8771
        if test "$tagname" = CXX ; then
 
8772
          case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
 
8773
            10.[0123])
 
8774
              func_append compile_command " ${wl}-bind_at_load"
 
8775
              func_append finalize_command " ${wl}-bind_at_load"
 
8776
            ;;
 
8777
          esac
 
8778
        fi
 
8779
        # Time to change all our "foo.ltframework" stuff back to "-framework foo"
 
8780
        compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
 
8781
        finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
 
8782
        ;;
4115
8783
      esac
4116
8784
 
4117
 
      compile_command="$compile_command $compile_deplibs"
4118
 
      finalize_command="$finalize_command $finalize_deplibs"
 
8785
 
 
8786
      # move library search paths that coincide with paths to not yet
 
8787
      # installed libraries to the beginning of the library search list
 
8788
      new_libs=
 
8789
      for path in $notinst_path; do
 
8790
        case " $new_libs " in
 
8791
        *" -L$path/$objdir "*) ;;
 
8792
        *)
 
8793
          case " $compile_deplibs " in
 
8794
          *" -L$path/$objdir "*)
 
8795
            func_append new_libs " -L$path/$objdir" ;;
 
8796
          esac
 
8797
          ;;
 
8798
        esac
 
8799
      done
 
8800
      for deplib in $compile_deplibs; do
 
8801
        case $deplib in
 
8802
        -L*)
 
8803
          case " $new_libs " in
 
8804
          *" $deplib "*) ;;
 
8805
          *) func_append new_libs " $deplib" ;;
 
8806
          esac
 
8807
          ;;
 
8808
        *) func_append new_libs " $deplib" ;;
 
8809
        esac
 
8810
      done
 
8811
      compile_deplibs="$new_libs"
 
8812
 
 
8813
 
 
8814
      func_append compile_command " $compile_deplibs"
 
8815
      func_append finalize_command " $finalize_deplibs"
4119
8816
 
4120
8817
      if test -n "$rpath$xrpath"; then
4121
8818
        # If the user specified any rpath flags, then add them.
4123
8820
          # This is the magic to use -rpath.
4124
8821
          case "$finalize_rpath " in
4125
8822
          *" $libdir "*) ;;
4126
 
          *) finalize_rpath="$finalize_rpath $libdir" ;;
 
8823
          *) func_append finalize_rpath " $libdir" ;;
4127
8824
          esac
4128
8825
        done
4129
8826
      fi
4142
8839
              *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4143
8840
                ;;
4144
8841
              *)
4145
 
                hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
 
8842
                func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
4146
8843
                ;;
4147
8844
              esac
4148
8845
            fi
4149
8846
          else
4150
8847
            eval flag=\"$hardcode_libdir_flag_spec\"
4151
 
            rpath="$rpath $flag"
 
8848
            func_append rpath " $flag"
4152
8849
          fi
4153
8850
        elif test -n "$runpath_var"; then
4154
8851
          case "$perm_rpath " in
4155
8852
          *" $libdir "*) ;;
4156
 
          *) perm_rpath="$perm_rpath $libdir" ;;
 
8853
          *) func_append perm_rpath " $libdir" ;;
4157
8854
          esac
4158
8855
        fi
4159
8856
        case $host in
4160
 
        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
 
8857
        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
 
8858
          testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
4161
8859
          case :$dllsearchpath: in
4162
8860
          *":$libdir:"*) ;;
4163
 
          *) dllsearchpath="$dllsearchpath:$libdir";;
 
8861
          ::) dllsearchpath=$libdir;;
 
8862
          *) func_append dllsearchpath ":$libdir";;
 
8863
          esac
 
8864
          case :$dllsearchpath: in
 
8865
          *":$testbindir:"*) ;;
 
8866
          ::) dllsearchpath=$testbindir;;
 
8867
          *) func_append dllsearchpath ":$testbindir";;
4164
8868
          esac
4165
8869
          ;;
4166
8870
        esac
4186
8890
              *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4187
8891
                ;;
4188
8892
              *)
4189
 
                hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
 
8893
                func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
4190
8894
                ;;
4191
8895
              esac
4192
8896
            fi
4193
8897
          else
4194
8898
            eval flag=\"$hardcode_libdir_flag_spec\"
4195
 
            rpath="$rpath $flag"
 
8899
            func_append rpath " $flag"
4196
8900
          fi
4197
8901
        elif test -n "$runpath_var"; then
4198
8902
          case "$finalize_perm_rpath " in
4199
8903
          *" $libdir "*) ;;
4200
 
          *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
 
8904
          *) func_append finalize_perm_rpath " $libdir" ;;
4201
8905
          esac
4202
8906
        fi
4203
8907
      done
4211
8915
 
4212
8916
      if test -n "$libobjs" && test "$build_old_libs" = yes; then
4213
8917
        # Transform all the library objects into standard objects.
4214
 
        compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4215
 
        finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4216
 
      fi
4217
 
 
4218
 
      dlsyms=
4219
 
      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4220
 
        if test -n "$NM" && test -n "$global_symbol_pipe"; then
4221
 
          dlsyms="${outputname}S.c"
4222
 
        else
4223
 
          $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
4224
 
        fi
4225
 
      fi
4226
 
 
4227
 
      if test -n "$dlsyms"; then
4228
 
        case $dlsyms in
4229
 
        "") ;;
4230
 
        *.c)
4231
 
          # Discover the nlist of each of the dlfiles.
4232
 
          nlist="$output_objdir/${outputname}.nm"
4233
 
 
4234
 
          $show "$rm $nlist ${nlist}S ${nlist}T"
4235
 
          $run $rm "$nlist" "${nlist}S" "${nlist}T"
4236
 
 
4237
 
          # Parse the name list into a source file.
4238
 
          $show "creating $output_objdir/$dlsyms"
4239
 
 
4240
 
          test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
4241
 
/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
4242
 
/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
4243
 
 
4244
 
#ifdef __cplusplus
4245
 
extern \"C\" {
4246
 
#endif
4247
 
 
4248
 
/* Prevent the only kind of declaration conflicts we can make. */
4249
 
#define lt_preloaded_symbols some_other_symbol
4250
 
 
4251
 
/* External symbol declarations for the compiler. */\
4252
 
"
4253
 
 
4254
 
          if test "$dlself" = yes; then
4255
 
            $show "generating symbol list for \`$output'"
4256
 
 
4257
 
            test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
4258
 
 
4259
 
            # Add our own program objects to the symbol list.
4260
 
            progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4261
 
            for arg in $progfiles; do
4262
 
              $show "extracting global C symbols from \`$arg'"
4263
 
              $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4264
 
            done
4265
 
 
4266
 
            if test -n "$exclude_expsyms"; then
4267
 
              $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
4268
 
              $run eval '$mv "$nlist"T "$nlist"'
4269
 
            fi
4270
 
 
4271
 
            if test -n "$export_symbols_regex"; then
4272
 
              $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
4273
 
              $run eval '$mv "$nlist"T "$nlist"'
4274
 
            fi
4275
 
 
4276
 
            # Prepare the list of exported symbols
4277
 
            if test -z "$export_symbols"; then
4278
 
              export_symbols="$output_objdir/$output.exp"
4279
 
              $run $rm $export_symbols
4280
 
              $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
4281
 
            else
4282
 
              $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
4283
 
              $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
4284
 
              $run eval 'mv "$nlist"T "$nlist"'
4285
 
            fi
4286
 
          fi
4287
 
 
4288
 
          for arg in $dlprefiles; do
4289
 
            $show "extracting global C symbols from \`$arg'"
4290
 
            name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
4291
 
            $run eval '$echo ": $name " >> "$nlist"'
4292
 
            $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4293
 
          done
4294
 
 
4295
 
          if test -z "$run"; then
4296
 
            # Make sure we have at least an empty file.
4297
 
            test -f "$nlist" || : > "$nlist"
4298
 
 
4299
 
            if test -n "$exclude_expsyms"; then
4300
 
              $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
4301
 
              $mv "$nlist"T "$nlist"
4302
 
            fi
4303
 
 
4304
 
            # Try sorting and uniquifying the output.
4305
 
            if grep -v "^: " < "$nlist" |
4306
 
                if sort -k 3 </dev/null >/dev/null 2>&1; then
4307
 
                  sort -k 3
4308
 
                else
4309
 
                  sort +2
4310
 
                fi |
4311
 
                uniq > "$nlist"S; then
4312
 
              :
4313
 
            else
4314
 
              grep -v "^: " < "$nlist" > "$nlist"S
4315
 
            fi
4316
 
 
4317
 
            if test -f "$nlist"S; then
4318
 
              eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
4319
 
            else
4320
 
              $echo '/* NONE */' >> "$output_objdir/$dlsyms"
4321
 
            fi
4322
 
 
4323
 
            $echo >> "$output_objdir/$dlsyms" "\
4324
 
 
4325
 
#undef lt_preloaded_symbols
4326
 
 
4327
 
#if defined (__STDC__) && __STDC__
4328
 
# define lt_ptr void *
4329
 
#else
4330
 
# define lt_ptr char *
4331
 
# define const
4332
 
#endif
4333
 
 
4334
 
/* The mapping between symbol names and symbols. */
4335
 
const struct {
4336
 
  const char *name;
4337
 
  lt_ptr address;
4338
 
}
4339
 
lt_preloaded_symbols[] =
4340
 
{\
4341
 
"
4342
 
 
4343
 
            eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
4344
 
 
4345
 
            $echo >> "$output_objdir/$dlsyms" "\
4346
 
  {0, (lt_ptr) 0}
4347
 
};
4348
 
 
4349
 
/* This works around a problem in FreeBSD linker */
4350
 
#ifdef FREEBSD_WORKAROUND
4351
 
static const void *lt_preloaded_setup() {
4352
 
  return lt_preloaded_symbols;
4353
 
}
4354
 
#endif
4355
 
 
4356
 
#ifdef __cplusplus
4357
 
}
4358
 
#endif\
4359
 
"
4360
 
          fi
4361
 
 
4362
 
          pic_flag_for_symtable=
4363
 
          case $host in
4364
 
          # compiling the symbol table file with pic_flag works around
4365
 
          # a FreeBSD bug that causes programs to crash when -lm is
4366
 
          # linked before any other PIC object.  But we must not use
4367
 
          # pic_flag when linking with -static.  The problem exists in
4368
 
          # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
4369
 
          *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
4370
 
            case "$compile_command " in
4371
 
            *" -static "*) ;;
4372
 
            *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
4373
 
            esac;;
4374
 
          *-*-hpux*)
4375
 
            case "$compile_command " in
4376
 
            *" -static "*) ;;
4377
 
            *) pic_flag_for_symtable=" $pic_flag";;
4378
 
            esac
4379
 
          esac
4380
 
 
4381
 
          # Now compile the dynamic symbol file.
4382
 
          $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
4383
 
          $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
4384
 
 
4385
 
          # Clean up the generated files.
4386
 
          $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
4387
 
          $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
4388
 
 
4389
 
          # Transform the symbol file into the correct name.
4390
 
          compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4391
 
          finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4392
 
          ;;
4393
 
        *)
4394
 
          $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
4395
 
          exit 1
4396
 
          ;;
4397
 
        esac
4398
 
      else
4399
 
        # We keep going just in case the user didn't refer to
4400
 
        # lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
4401
 
        # really was required.
4402
 
 
4403
 
        # Nullify the symbol file.
4404
 
        compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
4405
 
        finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
4406
 
      fi
4407
 
 
4408
 
      if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
 
8918
        compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
 
8919
        finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
 
8920
      fi
 
8921
 
 
8922
      func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
 
8923
 
 
8924
      # template prelinking step
 
8925
      if test -n "$prelink_cmds"; then
 
8926
        func_execute_cmds "$prelink_cmds" 'exit $?'
 
8927
      fi
 
8928
 
 
8929
      wrappers_required=yes
 
8930
      case $host in
 
8931
      *cegcc* | *mingw32ce*)
 
8932
        # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
 
8933
        wrappers_required=no
 
8934
        ;;
 
8935
      *cygwin* | *mingw* )
 
8936
        if test "$build_libtool_libs" != yes; then
 
8937
          wrappers_required=no
 
8938
        fi
 
8939
        ;;
 
8940
      *)
 
8941
        if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
 
8942
          wrappers_required=no
 
8943
        fi
 
8944
        ;;
 
8945
      esac
 
8946
      if test "$wrappers_required" = no; then
4409
8947
        # Replace the output file specification.
4410
 
        compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
 
8948
        compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
4411
8949
        link_command="$compile_command$compile_rpath"
4412
8950
 
4413
8951
        # We have no uninstalled library dependencies, so finalize right now.
4414
 
        $show "$link_command"
4415
 
        $run eval "$link_command"
4416
 
        status=$?
 
8952
        exit_status=0
 
8953
        func_show_eval "$link_command" 'exit_status=$?'
 
8954
 
 
8955
        if test -n "$postlink_cmds"; then
 
8956
          func_to_tool_file "$output"
 
8957
          postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
 
8958
          func_execute_cmds "$postlink_cmds" 'exit $?'
 
8959
        fi
4417
8960
 
4418
8961
        # Delete the generated files.
4419
 
        if test -n "$dlsyms"; then
4420
 
          $show "$rm $output_objdir/${outputname}S.${objext}"
4421
 
          $run $rm "$output_objdir/${outputname}S.${objext}"
 
8962
        if test -f "$output_objdir/${outputname}S.${objext}"; then
 
8963
          func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
4422
8964
        fi
4423
8965
 
4424
 
        exit $status
4425
 
      fi
4426
 
 
4427
 
      if test -n "$shlibpath_var"; then
4428
 
        # We should set the shlibpath_var
4429
 
        rpath=
4430
 
        for dir in $temp_rpath; do
4431
 
          case $dir in
4432
 
          [\\/]* | [A-Za-z]:[\\/]*)
4433
 
            # Absolute path.
4434
 
            rpath="$rpath$dir:"
4435
 
            ;;
4436
 
          *)
4437
 
            # Relative path: add a thisdir entry.
4438
 
            rpath="$rpath\$thisdir/$dir:"
4439
 
            ;;
4440
 
          esac
4441
 
        done
4442
 
        temp_rpath="$rpath"
 
8966
        exit $exit_status
4443
8967
      fi
4444
8968
 
4445
8969
      if test -n "$compile_shlibpath$finalize_shlibpath"; then
4456
8980
          # We should set the runpath_var.
4457
8981
          rpath=
4458
8982
          for dir in $perm_rpath; do
4459
 
            rpath="$rpath$dir:"
 
8983
            func_append rpath "$dir:"
4460
8984
          done
4461
8985
          compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
4462
8986
        fi
4464
8988
          # We should set the runpath_var.
4465
8989
          rpath=
4466
8990
          for dir in $finalize_perm_rpath; do
4467
 
            rpath="$rpath$dir:"
 
8991
            func_append rpath "$dir:"
4468
8992
          done
4469
8993
          finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
4470
8994
        fi
4474
8998
        # We don't need to create a wrapper script.
4475
8999
        link_command="$compile_var$compile_command$compile_rpath"
4476
9000
        # Replace the output file specification.
4477
 
        link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
 
9001
        link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
4478
9002
        # Delete the old output file.
4479
 
        $run $rm $output
 
9003
        $opt_dry_run || $RM $output
4480
9004
        # Link the executable and exit
4481
 
        $show "$link_command"
4482
 
        $run eval "$link_command" || exit $?
4483
 
        exit 0
 
9005
        func_show_eval "$link_command" 'exit $?'
 
9006
 
 
9007
        if test -n "$postlink_cmds"; then
 
9008
          func_to_tool_file "$output"
 
9009
          postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
 
9010
          func_execute_cmds "$postlink_cmds" 'exit $?'
 
9011
        fi
 
9012
 
 
9013
        exit $EXIT_SUCCESS
4484
9014
      fi
4485
9015
 
4486
9016
      if test "$hardcode_action" = relink; then
4488
9018
        link_command="$compile_var$compile_command$compile_rpath"
4489
9019
        relink_command="$finalize_var$finalize_command$finalize_rpath"
4490
9020
 
4491
 
        $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
4492
 
        $echo "$modename: \`$output' will be relinked during installation" 1>&2
 
9021
        func_warning "this platform does not like uninstalled shared libraries"
 
9022
        func_warning "\`$output' will be relinked during installation"
4493
9023
      else
4494
9024
        if test "$fast_install" != no; then
4495
9025
          link_command="$finalize_var$compile_command$finalize_rpath"
4496
9026
          if test "$fast_install" = yes; then
4497
 
            relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
 
9027
            relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
4498
9028
          else
4499
9029
            # fast_install is set to needless
4500
9030
            relink_command=
4506
9036
      fi
4507
9037
 
4508
9038
      # Replace the output file specification.
4509
 
      link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
 
9039
      link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
4510
9040
 
4511
9041
      # Delete the old output files.
4512
 
      $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
4513
 
 
4514
 
      $show "$link_command"
4515
 
      $run eval "$link_command" || exit $?
 
9042
      $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
 
9043
 
 
9044
      func_show_eval "$link_command" 'exit $?'
 
9045
 
 
9046
      if test -n "$postlink_cmds"; then
 
9047
        func_to_tool_file "$output_objdir/$outputname"
 
9048
        postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
 
9049
        func_execute_cmds "$postlink_cmds" 'exit $?'
 
9050
      fi
4516
9051
 
4517
9052
      # Now create the wrapper script.
4518
 
      $show "creating $output"
 
9053
      func_verbose "creating $output"
4519
9054
 
4520
9055
      # Quote the relink command for shipping.
4521
9056
      if test -n "$relink_command"; then
4522
9057
        # Preserve any variables that may affect compiler behavior
4523
9058
        for var in $variables_saved_for_relink; do
4524
9059
          if eval test -z \"\${$var+set}\"; then
4525
 
            relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
 
9060
            relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
4526
9061
          elif eval var_value=\$$var; test -z "$var_value"; then
4527
9062
            relink_command="$var=; export $var; $relink_command"
4528
9063
          else
4529
 
            var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
4530
 
            relink_command="$var=\"$var_value\"; export $var; $relink_command"
 
9064
            func_quote_for_eval "$var_value"
 
9065
            relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
4531
9066
          fi
4532
9067
        done
4533
9068
        relink_command="(cd `pwd`; $relink_command)"
4534
 
        relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
4535
 
      fi
4536
 
 
4537
 
      # Quote $echo for shipping.
4538
 
      if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
4539
 
        case $0 in
4540
 
        [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
4541
 
        *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
4542
 
        esac
4543
 
        qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
4544
 
      else
4545
 
        qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
4546
 
      fi
4547
 
 
4548
 
      # Only actually do things if our run command is non-null.
4549
 
      if test -z "$run"; then
 
9069
        relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
 
9070
      fi
 
9071
 
 
9072
      # Only actually do things if not in dry run mode.
 
9073
      $opt_dry_run || {
4550
9074
        # win32 will think the script is a binary if it has
4551
9075
        # a .exe suffix, so we strip it off here.
4552
9076
        case $output in
4553
 
          *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
 
9077
          *.exe) func_stripname '' '.exe' "$output"
 
9078
                 output=$func_stripname_result ;;
4554
9079
        esac
4555
9080
        # test for cygwin because mv fails w/o .exe extensions
4556
9081
        case $host in
4557
9082
          *cygwin*)
4558
9083
            exeext=.exe
4559
 
            outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
 
9084
            func_stripname '' '.exe' "$outputname"
 
9085
            outputname=$func_stripname_result ;;
4560
9086
          *) exeext= ;;
4561
9087
        esac
4562
9088
        case $host in
4563
9089
          *cygwin* | *mingw* )
4564
 
            cwrappersource=`$echo ${objdir}/lt-${output}.c`
4565
 
            cwrapper=`$echo ${output}.exe`
4566
 
            $rm $cwrappersource $cwrapper
4567
 
            trap "$rm $cwrappersource $cwrapper; exit 1" 1 2 15
4568
 
 
4569
 
            cat > $cwrappersource <<EOF
4570
 
 
4571
 
/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
4572
 
   Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4573
 
 
4574
 
   The $output program cannot be directly executed until all the libtool
4575
 
   libraries that it depends on are installed.
4576
 
   
4577
 
   This wrapper executable should never be moved out of the build directory.
4578
 
   If it is, it will not operate correctly.
4579
 
 
4580
 
   Currently, it simply execs the wrapper *script* "/bin/sh $output",
4581
 
   but could eventually absorb all of the scripts functionality and
4582
 
   exec $objdir/$outputname directly.
4583
 
*/
4584
 
EOF
4585
 
            cat >> $cwrappersource<<"EOF"
4586
 
#include <stdio.h>
4587
 
#include <stdlib.h>
4588
 
#include <unistd.h>
4589
 
#include <malloc.h>
4590
 
#include <stdarg.h>
4591
 
#include <assert.h>
4592
 
 
4593
 
#if defined(PATH_MAX)
4594
 
# define LT_PATHMAX PATH_MAX
4595
 
#elif defined(MAXPATHLEN)
4596
 
# define LT_PATHMAX MAXPATHLEN
4597
 
#else
4598
 
# define LT_PATHMAX 1024
4599
 
#endif
4600
 
 
4601
 
#ifndef DIR_SEPARATOR
4602
 
#define DIR_SEPARATOR '/'
4603
 
#endif
4604
 
 
4605
 
#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4606
 
  defined (__OS2__)
4607
 
#define HAVE_DOS_BASED_FILE_SYSTEM
4608
 
#ifndef DIR_SEPARATOR_2 
4609
 
#define DIR_SEPARATOR_2 '\\'
4610
 
#endif
4611
 
#endif
4612
 
 
4613
 
#ifndef DIR_SEPARATOR_2
4614
 
# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
4615
 
#else /* DIR_SEPARATOR_2 */
4616
 
# define IS_DIR_SEPARATOR(ch) \
4617
 
        (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
4618
 
#endif /* DIR_SEPARATOR_2 */
4619
 
 
4620
 
#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
4621
 
#define XFREE(stale) do { \
4622
 
  if (stale) { free ((void *) stale); stale = 0; } \
4623
 
} while (0)
4624
 
 
4625
 
const char *program_name = NULL;
4626
 
 
4627
 
void * xmalloc (size_t num);
4628
 
char * xstrdup (const char *string);
4629
 
char * basename (const char *name);
4630
 
char * fnqualify(const char *path);
4631
 
char * strendzap(char *str, const char *pat);
4632
 
void lt_fatal (const char *message, ...);
4633
 
 
4634
 
int
4635
 
main (int argc, char *argv[])
4636
 
{
4637
 
  char **newargz;
4638
 
  int i;
4639
 
  
4640
 
  program_name = (char *) xstrdup ((char *) basename (argv[0]));
4641
 
  newargz = XMALLOC(char *, argc+2);
4642
 
EOF
4643
 
 
4644
 
            cat >> $cwrappersource <<EOF
4645
 
  newargz[0] = "$SHELL";
4646
 
EOF
4647
 
 
4648
 
            cat >> $cwrappersource <<"EOF"
4649
 
  newargz[1] = fnqualify(argv[0]);
4650
 
  /* we know the script has the same name, without the .exe */
4651
 
  /* so make sure newargz[1] doesn't end in .exe */
4652
 
  strendzap(newargz[1],".exe"); 
4653
 
  for (i = 1; i < argc; i++)
4654
 
    newargz[i+1] = xstrdup(argv[i]);
4655
 
  newargz[argc+1] = NULL;
4656
 
EOF
4657
 
 
4658
 
            cat >> $cwrappersource <<EOF
4659
 
  execv("$SHELL",newargz);
4660
 
EOF
4661
 
 
4662
 
            cat >> $cwrappersource <<"EOF"
4663
 
}
4664
 
 
4665
 
void *
4666
 
xmalloc (size_t num)
4667
 
{
4668
 
  void * p = (void *) malloc (num);
4669
 
  if (!p)
4670
 
    lt_fatal ("Memory exhausted");
4671
 
 
4672
 
  return p;
4673
 
}
4674
 
 
4675
 
char * 
4676
 
xstrdup (const char *string)
4677
 
{
4678
 
  return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
4679
 
;
4680
 
}
4681
 
 
4682
 
char *
4683
 
basename (const char *name)
4684
 
{
4685
 
  const char *base;
4686
 
 
4687
 
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4688
 
  /* Skip over the disk name in MSDOS pathnames. */
4689
 
  if (isalpha (name[0]) && name[1] == ':') 
4690
 
    name += 2;
4691
 
#endif
4692
 
 
4693
 
  for (base = name; *name; name++)
4694
 
    if (IS_DIR_SEPARATOR (*name))
4695
 
      base = name + 1;
4696
 
  return (char *) base;
4697
 
}
4698
 
 
4699
 
char * 
4700
 
fnqualify(const char *path)
4701
 
{
4702
 
  size_t size;
4703
 
  char *p;
4704
 
  char tmp[LT_PATHMAX + 1];
4705
 
 
4706
 
  assert(path != NULL);
4707
 
 
4708
 
  /* Is it qualified already? */
4709
 
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4710
 
  if (isalpha (path[0]) && path[1] == ':')
4711
 
    return xstrdup (path);
4712
 
#endif
4713
 
  if (IS_DIR_SEPARATOR (path[0]))
4714
 
    return xstrdup (path);
4715
 
 
4716
 
  /* prepend the current directory */
4717
 
  /* doesn't handle '~' */
4718
 
  if (getcwd (tmp, LT_PATHMAX) == NULL)
4719
 
    lt_fatal ("getcwd failed");
4720
 
  size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */
4721
 
  p = XMALLOC(char, size);
4722
 
  sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path);
4723
 
  return p;
4724
 
}
4725
 
 
4726
 
char *
4727
 
strendzap(char *str, const char *pat) 
4728
 
{
4729
 
  size_t len, patlen;
4730
 
 
4731
 
  assert(str != NULL);
4732
 
  assert(pat != NULL);
4733
 
 
4734
 
  len = strlen(str);
4735
 
  patlen = strlen(pat);
4736
 
 
4737
 
  if (patlen <= len)
4738
 
  {
4739
 
    str += len - patlen;
4740
 
    if (strcmp(str, pat) == 0)
4741
 
      *str = '\0';
4742
 
  }
4743
 
  return str;
4744
 
}
4745
 
 
4746
 
static void
4747
 
lt_error_core (int exit_status, const char * mode, 
4748
 
          const char * message, va_list ap)
4749
 
{
4750
 
  fprintf (stderr, "%s: %s: ", program_name, mode);
4751
 
  vfprintf (stderr, message, ap);
4752
 
  fprintf (stderr, ".\n");
4753
 
 
4754
 
  if (exit_status >= 0)
4755
 
    exit (exit_status);
4756
 
}
4757
 
 
4758
 
void
4759
 
lt_fatal (const char *message, ...)
4760
 
{
4761
 
  va_list ap;
4762
 
  va_start (ap, message);
4763
 
  lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
4764
 
  va_end (ap);
4765
 
}
4766
 
EOF
4767
 
          # we should really use a build-platform specific compiler
4768
 
          # here, but OTOH, the wrappers (shell script and this C one)
4769
 
          # are only useful if you want to execute the "real" binary.
4770
 
          # Since the "real" binary is built for $host, then this
4771
 
          # wrapper might as well be built for $host, too.
4772
 
          $run $LTCC -s -o $cwrapper $cwrappersource
4773
 
          ;;
4774
 
        esac
4775
 
        $rm $output
4776
 
        trap "$rm $output; exit 1" 1 2 15
4777
 
 
4778
 
        $echo > $output "\
4779
 
#! $SHELL
4780
 
 
4781
 
# $output - temporary wrapper script for $objdir/$outputname
4782
 
# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4783
 
#
4784
 
# The $output program cannot be directly executed until all the libtool
4785
 
# libraries that it depends on are installed.
4786
 
#
4787
 
# This wrapper script should never be moved out of the build directory.
4788
 
# If it is, it will not operate correctly.
4789
 
 
4790
 
# Sed substitution that helps us do robust quoting.  It backslashifies
4791
 
# metacharacters that are still active within double-quoted strings.
4792
 
Xsed='${SED} -e 1s/^X//'
4793
 
sed_quote_subst='$sed_quote_subst'
4794
 
 
4795
 
# The HP-UX ksh and POSIX shell print the target directory to stdout
4796
 
# if CDPATH is set.
4797
 
if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
4798
 
 
4799
 
relink_command=\"$relink_command\"
4800
 
 
4801
 
# This environment variable determines our operation mode.
4802
 
if test \"\$libtool_install_magic\" = \"$magic\"; then
4803
 
  # install mode needs the following variable:
4804
 
  notinst_deplibs='$notinst_deplibs'
4805
 
else
4806
 
  # When we are sourced in execute mode, \$file and \$echo are already set.
4807
 
  if test \"\$libtool_execute_magic\" != \"$magic\"; then
4808
 
    echo=\"$qecho\"
4809
 
    file=\"\$0\"
4810
 
    # Make sure echo works.
4811
 
    if test \"X\$1\" = X--no-reexec; then
4812
 
      # Discard the --no-reexec flag, and continue.
4813
 
      shift
4814
 
    elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
4815
 
      # Yippee, \$echo works!
4816
 
      :
4817
 
    else
4818
 
      # Restart under the correct shell, and then maybe \$echo will work.
4819
 
      exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
4820
 
    fi
4821
 
  fi\
4822
 
"
4823
 
        $echo >> $output "\
4824
 
 
4825
 
  # Find the directory that this script lives in.
4826
 
  thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
4827
 
  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
4828
 
 
4829
 
  # Follow symbolic links until we get to the real thisdir.
4830
 
  file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
4831
 
  while test -n \"\$file\"; do
4832
 
    destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
4833
 
 
4834
 
    # If there was a directory component, then change thisdir.
4835
 
    if test \"x\$destdir\" != \"x\$file\"; then
4836
 
      case \"\$destdir\" in
4837
 
      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
4838
 
      *) thisdir=\"\$thisdir/\$destdir\" ;;
4839
 
      esac
4840
 
    fi
4841
 
 
4842
 
    file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
4843
 
    file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
4844
 
  done
4845
 
 
4846
 
  # Try to get the absolute directory name.
4847
 
  absdir=\`cd \"\$thisdir\" && pwd\`
4848
 
  test -n \"\$absdir\" && thisdir=\"\$absdir\"
4849
 
"
4850
 
 
4851
 
        if test "$fast_install" = yes; then
4852
 
          $echo >> $output "\
4853
 
  program=lt-'$outputname'$exeext
4854
 
  progdir=\"\$thisdir/$objdir\"
4855
 
 
4856
 
  if test ! -f \"\$progdir/\$program\" || \\
4857
 
     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
4858
 
       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
4859
 
 
4860
 
    file=\"\$\$-\$program\"
4861
 
 
4862
 
    if test ! -d \"\$progdir\"; then
4863
 
      $mkdir \"\$progdir\"
4864
 
    else
4865
 
      $rm \"\$progdir/\$file\"
4866
 
    fi"
4867
 
 
4868
 
          $echo >> $output "\
4869
 
 
4870
 
    # relink executable if necessary
4871
 
    if test -n \"\$relink_command\"; then
4872
 
      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
4873
 
      else
4874
 
        $echo \"\$relink_command_output\" >&2
4875
 
        $rm \"\$progdir/\$file\"
4876
 
        exit 1
4877
 
      fi
4878
 
    fi
4879
 
 
4880
 
    $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
4881
 
    { $rm \"\$progdir/\$program\";
4882
 
      $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
4883
 
    $rm \"\$progdir/\$file\"
4884
 
  fi"
4885
 
        else
4886
 
          $echo >> $output "\
4887
 
  program='$outputname'
4888
 
  progdir=\"\$thisdir/$objdir\"
4889
 
"
4890
 
        fi
4891
 
 
4892
 
        $echo >> $output "\
4893
 
 
4894
 
  if test -f \"\$progdir/\$program\"; then"
4895
 
 
4896
 
        # Export our shlibpath_var if we have one.
4897
 
        if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4898
 
          $echo >> $output "\
4899
 
    # Add our own library path to $shlibpath_var
4900
 
    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
4901
 
 
4902
 
    # Some systems cannot cope with colon-terminated $shlibpath_var
4903
 
    # The second colon is a workaround for a bug in BeOS R4 sed
4904
 
    $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
4905
 
 
4906
 
    export $shlibpath_var
4907
 
"
4908
 
        fi
4909
 
 
4910
 
        # fixup the dll searchpath if we need to.
4911
 
        if test -n "$dllsearchpath"; then
4912
 
          $echo >> $output "\
4913
 
    # Add the dll search path components to the executable PATH
4914
 
    PATH=$dllsearchpath:\$PATH
4915
 
"
4916
 
        fi
4917
 
 
4918
 
        $echo >> $output "\
4919
 
    if test \"\$libtool_execute_magic\" != \"$magic\"; then
4920
 
      # Run the actual program with our arguments.
4921
 
"
4922
 
        case $host in
4923
 
        # Backslashes separate directories on plain windows
4924
 
        *-*-mingw | *-*-os2*)
4925
 
          $echo >> $output "\
4926
 
      exec \$progdir\\\\\$program \${1+\"\$@\"}
4927
 
"
4928
 
          ;;
4929
 
 
4930
 
        *)
4931
 
          $echo >> $output "\
4932
 
      exec \$progdir/\$program \${1+\"\$@\"}
4933
 
"
4934
 
          ;;
4935
 
        esac
4936
 
        $echo >> $output "\
4937
 
      \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
4938
 
      exit 1
4939
 
    fi
4940
 
  else
4941
 
    # The program doesn't exist.
4942
 
    \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
4943
 
    \$echo \"This script is just a wrapper for \$program.\" 1>&2
4944
 
    $echo \"See the $PACKAGE documentation for more information.\" 1>&2
4945
 
    exit 1
4946
 
  fi
4947
 
fi\
4948
 
"
4949
 
        chmod +x $output
4950
 
      fi
4951
 
      exit 0
 
9090
            func_dirname_and_basename "$output" "" "."
 
9091
            output_name=$func_basename_result
 
9092
            output_path=$func_dirname_result
 
9093
            cwrappersource="$output_path/$objdir/lt-$output_name.c"
 
9094
            cwrapper="$output_path/$output_name.exe"
 
9095
            $RM $cwrappersource $cwrapper
 
9096
            trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
 
9097
 
 
9098
            func_emit_cwrapperexe_src > $cwrappersource
 
9099
 
 
9100
            # The wrapper executable is built using the $host compiler,
 
9101
            # because it contains $host paths and files. If cross-
 
9102
            # compiling, it, like the target executable, must be
 
9103
            # executed on the $host or under an emulation environment.
 
9104
            $opt_dry_run || {
 
9105
              $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
 
9106
              $STRIP $cwrapper
 
9107
            }
 
9108
 
 
9109
            # Now, create the wrapper script for func_source use:
 
9110
            func_ltwrapper_scriptname $cwrapper
 
9111
            $RM $func_ltwrapper_scriptname_result
 
9112
            trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
 
9113
            $opt_dry_run || {
 
9114
              # note: this script will not be executed, so do not chmod.
 
9115
              if test "x$build" = "x$host" ; then
 
9116
                $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
 
9117
              else
 
9118
                func_emit_wrapper no > $func_ltwrapper_scriptname_result
 
9119
              fi
 
9120
            }
 
9121
          ;;
 
9122
          * )
 
9123
            $RM $output
 
9124
            trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
 
9125
 
 
9126
            func_emit_wrapper no > $output
 
9127
            chmod +x $output
 
9128
          ;;
 
9129
        esac
 
9130
      }
 
9131
      exit $EXIT_SUCCESS
4952
9132
      ;;
4953
9133
    esac
4954
9134
 
4956
9136
    for oldlib in $oldlibs; do
4957
9137
 
4958
9138
      if test "$build_libtool_libs" = convenience; then
4959
 
        oldobjs="$libobjs_save"
 
9139
        oldobjs="$libobjs_save $symfileobj"
4960
9140
        addlibs="$convenience"
4961
9141
        build_libtool_libs=no
4962
9142
      else
4965
9145
          build_libtool_libs=no
4966
9146
        else
4967
9147
          oldobjs="$old_deplibs $non_pic_objects"
 
9148
          if test "$preload" = yes && test -f "$symfileobj"; then
 
9149
            func_append oldobjs " $symfileobj"
 
9150
          fi
4968
9151
        fi
4969
9152
        addlibs="$old_convenience"
4970
9153
      fi
4971
9154
 
4972
9155
      if test -n "$addlibs"; then
4973
9156
        gentop="$output_objdir/${outputname}x"
4974
 
        $show "${rm}r $gentop"
4975
 
        $run ${rm}r "$gentop"
4976
 
        $show "$mkdir $gentop"
4977
 
        $run $mkdir "$gentop"
4978
 
        status=$?
4979
 
        if test "$status" -ne 0 && test ! -d "$gentop"; then
4980
 
          exit $status
4981
 
        fi
4982
 
        generated="$generated $gentop"
4983
 
 
4984
 
        # Add in members from convenience archives.
4985
 
        for xlib in $addlibs; do
4986
 
          # Extract the objects.
4987
 
          case $xlib in
4988
 
          [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
4989
 
          *) xabs=`pwd`"/$xlib" ;;
4990
 
          esac
4991
 
          xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
4992
 
          xdir="$gentop/$xlib"
4993
 
 
4994
 
          $show "${rm}r $xdir"
4995
 
          $run ${rm}r "$xdir"
4996
 
          $show "$mkdir $xdir"
4997
 
          $run $mkdir "$xdir"
4998
 
          status=$?
4999
 
          if test "$status" -ne 0 && test ! -d "$xdir"; then
5000
 
            exit $status
5001
 
          fi
5002
 
          # We will extract separately just the conflicting names and we will no
5003
 
          # longer touch any unique names. It is faster to leave these extract
5004
 
          # automatically by $AR in one run.
5005
 
          $show "(cd $xdir && $AR x $xabs)"
5006
 
          $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
5007
 
          if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
5008
 
            :
5009
 
          else
5010
 
            $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
5011
 
            $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
5012
 
            $AR t "$xabs" | sort | uniq -cd | while read -r count name
5013
 
            do
5014
 
              i=1
5015
 
              while test "$i" -le "$count"
5016
 
              do
5017
 
               # Put our $i before any first dot (extension)
5018
 
               # Never overwrite any file
5019
 
               name_to="$name"
5020
 
               while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
5021
 
               do
5022
 
                 name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
5023
 
               done
5024
 
               $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
5025
 
               $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
5026
 
               i=`expr $i + 1`
5027
 
              done
5028
 
            done
5029
 
          fi
5030
 
 
5031
 
          oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
5032
 
        done
 
9157
        func_append generated " $gentop"
 
9158
 
 
9159
        func_extract_archives $gentop $addlibs
 
9160
        func_append oldobjs " $func_extract_archives_result"
5033
9161
      fi
5034
9162
 
5035
9163
      # Do each command in the archive commands.
5036
9164
      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
5037
 
       cmds=$old_archive_from_new_cmds
 
9165
        cmds=$old_archive_from_new_cmds
5038
9166
      else
 
9167
 
 
9168
        # Add any objects from preloaded convenience libraries
 
9169
        if test -n "$dlprefiles"; then
 
9170
          gentop="$output_objdir/${outputname}x"
 
9171
          func_append generated " $gentop"
 
9172
 
 
9173
          func_extract_archives $gentop $dlprefiles
 
9174
          func_append oldobjs " $func_extract_archives_result"
 
9175
        fi
 
9176
 
 
9177
        # POSIX demands no paths to be encoded in archives.  We have
 
9178
        # to avoid creating archives with duplicate basenames if we
 
9179
        # might have to extract them afterwards, e.g., when creating a
 
9180
        # static archive out of a convenience library, or when linking
 
9181
        # the entirety of a libtool archive into another (currently
 
9182
        # not supported by libtool).
 
9183
        if (for obj in $oldobjs
 
9184
            do
 
9185
              func_basename "$obj"
 
9186
              $ECHO "$func_basename_result"
 
9187
            done | sort | sort -uc >/dev/null 2>&1); then
 
9188
          :
 
9189
        else
 
9190
          echo "copying selected object files to avoid basename conflicts..."
 
9191
          gentop="$output_objdir/${outputname}x"
 
9192
          func_append generated " $gentop"
 
9193
          func_mkdir_p "$gentop"
 
9194
          save_oldobjs=$oldobjs
 
9195
          oldobjs=
 
9196
          counter=1
 
9197
          for obj in $save_oldobjs
 
9198
          do
 
9199
            func_basename "$obj"
 
9200
            objbase="$func_basename_result"
 
9201
            case " $oldobjs " in
 
9202
            " ") oldobjs=$obj ;;
 
9203
            *[\ /]"$objbase "*)
 
9204
              while :; do
 
9205
                # Make sure we don't pick an alternate name that also
 
9206
                # overlaps.
 
9207
                newobj=lt$counter-$objbase
 
9208
                func_arith $counter + 1
 
9209
                counter=$func_arith_result
 
9210
                case " $oldobjs " in
 
9211
                *[\ /]"$newobj "*) ;;
 
9212
                *) if test ! -f "$gentop/$newobj"; then break; fi ;;
 
9213
                esac
 
9214
              done
 
9215
              func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
 
9216
              func_append oldobjs " $gentop/$newobj"
 
9217
              ;;
 
9218
            *) func_append oldobjs " $obj" ;;
 
9219
            esac
 
9220
          done
 
9221
        fi
 
9222
        func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
 
9223
        tool_oldlib=$func_to_tool_file_result
5039
9224
        eval cmds=\"$old_archive_cmds\"
5040
9225
 
5041
 
        if len=`expr "X$cmds" : ".*"` &&
5042
 
             test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
 
9226
        func_len " $cmds"
 
9227
        len=$func_len_result
 
9228
        if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
 
9229
          cmds=$old_archive_cmds
 
9230
        elif test -n "$archiver_list_spec"; then
 
9231
          func_verbose "using command file archive linking..."
 
9232
          for obj in $oldobjs
 
9233
          do
 
9234
            func_to_tool_file "$obj"
 
9235
            $ECHO "$func_to_tool_file_result"
 
9236
          done > $output_objdir/$libname.libcmd
 
9237
          func_to_tool_file "$output_objdir/$libname.libcmd"
 
9238
          oldobjs=" $archiver_list_spec$func_to_tool_file_result"
5043
9239
          cmds=$old_archive_cmds
5044
9240
        else
5045
9241
          # the command line is too long to link in one step, link in parts
5046
 
          $echo "using piecewise archive linking..."
 
9242
          func_verbose "using piecewise archive linking..."
5047
9243
          save_RANLIB=$RANLIB
5048
9244
          RANLIB=:
5049
9245
          objlist=
5050
9246
          concat_cmds=
5051
9247
          save_oldobjs=$oldobjs
5052
 
          # GNU ar 2.10+ was changed to match POSIX; thus no paths are
5053
 
          # encoded into archives.  This makes 'ar r' malfunction in
5054
 
          # this piecewise linking case whenever conflicting object
5055
 
          # names appear in distinct ar calls; check, warn and compensate.
5056
 
            if (for obj in $save_oldobjs
5057
 
            do
5058
 
              $echo "X$obj" | $Xsed -e 's%^.*/%%'
5059
 
            done | sort | sort -uc >/dev/null 2>&1); then
5060
 
            :
5061
 
          else
5062
 
            $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2
5063
 
            $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2
5064
 
            AR_FLAGS=cq
5065
 
          fi
 
9248
          oldobjs=
5066
9249
          # Is there a better way of finding the last object in the list?
5067
9250
          for obj in $save_oldobjs
5068
9251
          do
5069
9252
            last_oldobj=$obj
5070
 
          done  
 
9253
          done
 
9254
          eval test_cmds=\"$old_archive_cmds\"
 
9255
          func_len " $test_cmds"
 
9256
          len0=$func_len_result
 
9257
          len=$len0
5071
9258
          for obj in $save_oldobjs
5072
9259
          do
5073
 
            oldobjs="$objlist $obj"
5074
 
            objlist="$objlist $obj"
5075
 
            eval test_cmds=\"$old_archive_cmds\"
5076
 
            if len=`expr "X$test_cmds" : ".*"` &&
5077
 
               test "$len" -le "$max_cmd_len"; then
 
9260
            func_len " $obj"
 
9261
            func_arith $len + $func_len_result
 
9262
            len=$func_arith_result
 
9263
            func_append objlist " $obj"
 
9264
            if test "$len" -lt "$max_cmd_len"; then
5078
9265
              :
5079
9266
            else
5080
9267
              # the above command should be used before it gets too long
5081
9268
              oldobjs=$objlist
5082
9269
              if test "$obj" = "$last_oldobj" ; then
5083
 
                RANLIB=$save_RANLIB
5084
 
              fi  
 
9270
                RANLIB=$save_RANLIB
 
9271
              fi
5085
9272
              test -z "$concat_cmds" || concat_cmds=$concat_cmds~
5086
9273
              eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
5087
9274
              objlist=
 
9275
              len=$len0
5088
9276
            fi
5089
9277
          done
5090
9278
          RANLIB=$save_RANLIB
5096
9284
          fi
5097
9285
        fi
5098
9286
      fi
5099
 
      save_ifs="$IFS"; IFS='~'
5100
 
      for cmd in $cmds; do
5101
 
        eval cmd=\"$cmd\"
5102
 
        IFS="$save_ifs"
5103
 
        $show "$cmd"
5104
 
        $run eval "$cmd" || exit $?
5105
 
      done
5106
 
      IFS="$save_ifs"
 
9287
      func_execute_cmds "$cmds" 'exit $?'
5107
9288
    done
5108
9289
 
5109
 
    if test -n "$generated"; then
5110
 
      $show "${rm}r$generated"
5111
 
      $run ${rm}r$generated
5112
 
    fi
 
9290
    test -n "$generated" && \
 
9291
      func_show_eval "${RM}r$generated"
5113
9292
 
5114
9293
    # Now create the libtool archive.
5115
9294
    case $output in
5116
9295
    *.la)
5117
9296
      old_library=
5118
9297
      test "$build_old_libs" = yes && old_library="$libname.$libext"
5119
 
      $show "creating $output"
 
9298
      func_verbose "creating $output"
5120
9299
 
5121
9300
      # Preserve any variables that may affect compiler behavior
5122
9301
      for var in $variables_saved_for_relink; do
5123
9302
        if eval test -z \"\${$var+set}\"; then
5124
 
          relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
 
9303
          relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
5125
9304
        elif eval var_value=\$$var; test -z "$var_value"; then
5126
9305
          relink_command="$var=; export $var; $relink_command"
5127
9306
        else
5128
 
          var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
5129
 
          relink_command="$var=\"$var_value\"; export $var; $relink_command"
 
9307
          func_quote_for_eval "$var_value"
 
9308
          relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
5130
9309
        fi
5131
9310
      done
5132
9311
      # Quote the link command for shipping.
5133
 
      relink_command="(cd `pwd`; $SHELL $0 $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
5134
 
      relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
 
9312
      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
 
9313
      relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
5135
9314
      if test "$hardcode_automatic" = yes ; then
5136
 
        relink_command=
5137
 
      fi  
 
9315
        relink_command=
 
9316
      fi
 
9317
 
5138
9318
      # Only create the output if not a dry run.
5139
 
      if test -z "$run"; then
 
9319
      $opt_dry_run || {
5140
9320
        for installed in no yes; do
5141
9321
          if test "$installed" = yes; then
5142
9322
            if test -z "$install_libdir"; then
5148
9328
            for deplib in $dependency_libs; do
5149
9329
              case $deplib in
5150
9330
              *.la)
5151
 
                name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
5152
 
                eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
5153
 
                if test -z "$libdir"; then
5154
 
                  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
5155
 
                  exit 1
5156
 
                fi
5157
 
                newdependency_libs="$newdependency_libs $libdir/$name"
5158
 
                ;;
5159
 
              *) newdependency_libs="$newdependency_libs $deplib" ;;
 
9331
                func_basename "$deplib"
 
9332
                name="$func_basename_result"
 
9333
                func_resolve_sysroot "$deplib"
 
9334
                eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
 
9335
                test -z "$libdir" && \
 
9336
                  func_fatal_error "\`$deplib' is not a valid libtool archive"
 
9337
                func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
 
9338
                ;;
 
9339
              -L*)
 
9340
                func_stripname -L '' "$deplib"
 
9341
                func_replace_sysroot "$func_stripname_result"
 
9342
                func_append newdependency_libs " -L$func_replace_sysroot_result"
 
9343
                ;;
 
9344
              -R*)
 
9345
                func_stripname -R '' "$deplib"
 
9346
                func_replace_sysroot "$func_stripname_result"
 
9347
                func_append newdependency_libs " -R$func_replace_sysroot_result"
 
9348
                ;;
 
9349
              *) func_append newdependency_libs " $deplib" ;;
5160
9350
              esac
5161
9351
            done
5162
9352
            dependency_libs="$newdependency_libs"
5163
9353
            newdlfiles=
 
9354
 
5164
9355
            for lib in $dlfiles; do
5165
 
              name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5166
 
              eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5167
 
              if test -z "$libdir"; then
5168
 
                $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5169
 
                exit 1
5170
 
              fi
5171
 
              newdlfiles="$newdlfiles $libdir/$name"
 
9356
              case $lib in
 
9357
              *.la)
 
9358
                func_basename "$lib"
 
9359
                name="$func_basename_result"
 
9360
                eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
 
9361
                test -z "$libdir" && \
 
9362
                  func_fatal_error "\`$lib' is not a valid libtool archive"
 
9363
                func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
 
9364
                ;;
 
9365
              *) func_append newdlfiles " $lib" ;;
 
9366
              esac
5172
9367
            done
5173
9368
            dlfiles="$newdlfiles"
5174
9369
            newdlprefiles=
5175
9370
            for lib in $dlprefiles; do
5176
 
              name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5177
 
              eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5178
 
              if test -z "$libdir"; then
5179
 
                $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5180
 
                exit 1
5181
 
              fi
5182
 
              newdlprefiles="$newdlprefiles $libdir/$name"
 
9371
              case $lib in
 
9372
              *.la)
 
9373
                # Only pass preopened files to the pseudo-archive (for
 
9374
                # eventual linking with the app. that links it) if we
 
9375
                # didn't already link the preopened objects directly into
 
9376
                # the library:
 
9377
                func_basename "$lib"
 
9378
                name="$func_basename_result"
 
9379
                eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
 
9380
                test -z "$libdir" && \
 
9381
                  func_fatal_error "\`$lib' is not a valid libtool archive"
 
9382
                func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
 
9383
                ;;
 
9384
              esac
5183
9385
            done
5184
9386
            dlprefiles="$newdlprefiles"
5185
9387
          else
5186
9388
            newdlfiles=
5187
9389
            for lib in $dlfiles; do
5188
 
              case $lib in 
 
9390
              case $lib in
5189
9391
                [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5190
9392
                *) abs=`pwd`"/$lib" ;;
5191
9393
              esac
5192
 
              newdlfiles="$newdlfiles $abs"
 
9394
              func_append newdlfiles " $abs"
5193
9395
            done
5194
9396
            dlfiles="$newdlfiles"
5195
9397
            newdlprefiles=
5196
9398
            for lib in $dlprefiles; do
5197
 
              case $lib in 
 
9399
              case $lib in
5198
9400
                [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5199
9401
                *) abs=`pwd`"/$lib" ;;
5200
9402
              esac
5201
 
              newdlprefiles="$newdlprefiles $abs"
 
9403
              func_append newdlprefiles " $abs"
5202
9404
            done
5203
9405
            dlprefiles="$newdlprefiles"
5204
9406
          fi
5205
 
          $rm $output
 
9407
          $RM $output
5206
9408
          # place dlname in correct position for cygwin
 
9409
          # In fact, it would be nice if we could use this code for all target
 
9410
          # systems that can't hard-code library paths into their executables
 
9411
          # and that have no shared library path variable independent of PATH,
 
9412
          # but it turns out we can't easily determine that from inspecting
 
9413
          # libtool variables, so we have to hard-code the OSs to which it
 
9414
          # applies here; at the moment, that means platforms that use the PE
 
9415
          # object format with DLL files.  See the long comment at the top of
 
9416
          # tests/bindir.at for full details.
5207
9417
          tdlname=$dlname
5208
9418
          case $host,$output,$installed,$module,$dlname in
5209
 
            *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
 
9419
            *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
 
9420
              # If a -bindir argument was supplied, place the dll there.
 
9421
              if test "x$bindir" != x ;
 
9422
              then
 
9423
                func_relative_path "$install_libdir" "$bindir"
 
9424
                tdlname=$func_relative_path_result$dlname
 
9425
              else
 
9426
                # Otherwise fall back on heuristic.
 
9427
                tdlname=../bin/$dlname
 
9428
              fi
 
9429
              ;;
5210
9430
          esac
5211
 
          $echo > $output "\
 
9431
          $ECHO > $output "\
5212
9432
# $outputname - a libtool library file
5213
 
# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
 
9433
# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
5214
9434
#
5215
9435
# Please DO NOT delete this file!
5216
9436
# It is necessary for linking the library.
5224
9444
# The name of the static archive.
5225
9445
old_library='$old_library'
5226
9446
 
 
9447
# Linker flags that can not go in dependency_libs.
 
9448
inherited_linker_flags='$new_inherited_linker_flags'
 
9449
 
5227
9450
# Libraries that this one depends upon.
5228
9451
dependency_libs='$dependency_libs'
5229
9452
 
 
9453
# Names of additional weak libraries provided by this library
 
9454
weak_library_names='$weak_libs'
 
9455
 
5230
9456
# Version information for $libname.
5231
9457
current=$current
5232
9458
age=$age
5245
9471
# Directory that this library needs to be installed in:
5246
9472
libdir='$install_libdir'"
5247
9473
          if test "$installed" = no && test "$need_relink" = yes; then
5248
 
            $echo >> $output "\
 
9474
            $ECHO >> $output "\
5249
9475
relink_command=\"$relink_command\""
5250
9476
          fi
5251
9477
        done
5252
 
      fi
 
9478
      }
5253
9479
 
5254
9480
      # Do a symbolic link so that the libtool archive can be found in
5255
9481
      # LD_LIBRARY_PATH before the program is installed.
5256
 
      $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
5257
 
      $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
5258
 
      ;;
5259
 
    esac
5260
 
    exit 0
5261
 
    ;;
5262
 
 
5263
 
  # libtool install mode
5264
 
  install)
5265
 
    modename="$modename: install"
5266
 
 
5267
 
    # There may be an optional sh(1) argument at the beginning of
5268
 
    # install_prog (especially on Windows NT).
5269
 
    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
5270
 
       # Allow the use of GNU shtool's install command.
5271
 
       $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
5272
 
      # Aesthetically quote it.
5273
 
      arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
5274
 
      case $arg in
5275
 
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*)
5276
 
        arg="\"$arg\""
5277
 
        ;;
5278
 
      esac
5279
 
      install_prog="$arg "
5280
 
      arg="$1"
5281
 
      shift
5282
 
    else
5283
 
      install_prog=
5284
 
      arg="$nonopt"
5285
 
    fi
5286
 
 
5287
 
    # The real first argument should be the name of the installation program.
5288
 
    # Aesthetically quote it.
5289
 
    arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5290
 
    case $arg in
5291
 
    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*)
5292
 
      arg="\"$arg\""
5293
 
      ;;
5294
 
    esac
5295
 
    install_prog="$install_prog$arg"
5296
 
 
5297
 
    # We need to accept at least all the BSD install flags.
5298
 
    dest=
5299
 
    files=
5300
 
    opts=
5301
 
    prev=
5302
 
    install_type=
5303
 
    isdir=no
5304
 
    stripme=
5305
 
    for arg
5306
 
    do
5307
 
      if test -n "$dest"; then
5308
 
        files="$files $dest"
5309
 
        dest="$arg"
5310
 
        continue
5311
 
      fi
5312
 
 
5313
 
      case $arg in
5314
 
      -d) isdir=yes ;;
5315
 
      -f) prev="-f" ;;
5316
 
      -g) prev="-g" ;;
5317
 
      -m) prev="-m" ;;
5318
 
      -o) prev="-o" ;;
5319
 
      -s)
5320
 
        stripme=" -s"
5321
 
        continue
5322
 
        ;;
5323
 
      -*) ;;
5324
 
 
5325
 
      *)
5326
 
        # If the previous option needed an argument, then skip it.
5327
 
        if test -n "$prev"; then
5328
 
          prev=
5329
 
        else
5330
 
          dest="$arg"
5331
 
          continue
5332
 
        fi
5333
 
        ;;
5334
 
      esac
5335
 
 
5336
 
      # Aesthetically quote the argument.
5337
 
      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5338
 
      case $arg in
5339
 
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*)
5340
 
        arg="\"$arg\""
5341
 
        ;;
5342
 
      esac
5343
 
      install_prog="$install_prog $arg"
5344
 
    done
5345
 
 
5346
 
    if test -z "$install_prog"; then
5347
 
      $echo "$modename: you must specify an install program" 1>&2
5348
 
      $echo "$help" 1>&2
5349
 
      exit 1
5350
 
    fi
5351
 
 
5352
 
    if test -n "$prev"; then
5353
 
      $echo "$modename: the \`$prev' option requires an argument" 1>&2
5354
 
      $echo "$help" 1>&2
5355
 
      exit 1
5356
 
    fi
5357
 
 
5358
 
    if test -z "$files"; then
5359
 
      if test -z "$dest"; then
5360
 
        $echo "$modename: no file or destination specified" 1>&2
5361
 
      else
5362
 
        $echo "$modename: you must specify a destination" 1>&2
5363
 
      fi
5364
 
      $echo "$help" 1>&2
5365
 
      exit 1
5366
 
    fi
5367
 
 
5368
 
    # Strip any trailing slash from the destination.
5369
 
    dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
5370
 
 
5371
 
    # Check to see that the destination is a directory.
5372
 
    test -d "$dest" && isdir=yes
5373
 
    if test "$isdir" = yes; then
5374
 
      destdir="$dest"
5375
 
      destname=
5376
 
    else
5377
 
      destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
5378
 
      test "X$destdir" = "X$dest" && destdir=.
5379
 
      destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
5380
 
 
5381
 
      # Not a directory, so check to see that there is only one file specified.
5382
 
      set dummy $files
5383
 
      if test "$#" -gt 2; then
5384
 
        $echo "$modename: \`$dest' is not a directory" 1>&2
5385
 
        $echo "$help" 1>&2
5386
 
        exit 1
5387
 
      fi
5388
 
    fi
5389
 
    case $destdir in
5390
 
    [\\/]* | [A-Za-z]:[\\/]*) ;;
5391
 
    *)
5392
 
      for file in $files; do
5393
 
        case $file in
5394
 
        *.lo) ;;
5395
 
        *)
5396
 
          $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
5397
 
          $echo "$help" 1>&2
5398
 
          exit 1
5399
 
          ;;
5400
 
        esac
5401
 
      done
5402
 
      ;;
5403
 
    esac
5404
 
 
5405
 
    # This variable tells wrapper scripts just to set variables rather
5406
 
    # than running their programs.
5407
 
    libtool_install_magic="$magic"
5408
 
 
5409
 
    staticlibs=
5410
 
    future_libdirs=
5411
 
    current_libdirs=
5412
 
    for file in $files; do
5413
 
 
5414
 
      # Do each installation.
5415
 
      case $file in
5416
 
      *.$libext)
5417
 
        # Do the static libraries later.
5418
 
        staticlibs="$staticlibs $file"
5419
 
        ;;
5420
 
 
5421
 
      *.la)
5422
 
        # Check to see that this really is a libtool archive.
5423
 
        if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
5424
 
        else
5425
 
          $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
5426
 
          $echo "$help" 1>&2
5427
 
          exit 1
5428
 
        fi
5429
 
 
5430
 
        library_names=
5431
 
        old_library=
5432
 
        relink_command=
5433
 
        # If there is no directory component, then add one.
5434
 
        case $file in
5435
 
        */* | *\\*) . $file ;;
5436
 
        *) . ./$file ;;
5437
 
        esac
5438
 
 
5439
 
        # Add the libdir to current_libdirs if it is the destination.
5440
 
        if test "X$destdir" = "X$libdir"; then
5441
 
          case "$current_libdirs " in
5442
 
          *" $libdir "*) ;;
5443
 
          *) current_libdirs="$current_libdirs $libdir" ;;
5444
 
          esac
5445
 
        else
5446
 
          # Note the libdir as a future libdir.
5447
 
          case "$future_libdirs " in
5448
 
          *" $libdir "*) ;;
5449
 
          *) future_libdirs="$future_libdirs $libdir" ;;
5450
 
          esac
5451
 
        fi
5452
 
 
5453
 
        dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
5454
 
        test "X$dir" = "X$file/" && dir=
5455
 
        dir="$dir$objdir"
5456
 
 
5457
 
        if test -n "$relink_command"; then
5458
 
          # Determine the prefix the user has applied to our future dir.
5459
 
          inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
5460
 
 
5461
 
          # Don't allow the user to place us outside of our expected
5462
 
          # location b/c this prevents finding dependent libraries that
5463
 
          # are installed to the same prefix.
5464
 
          # At present, this check doesn't affect windows .dll's that
5465
 
          # are installed into $libdir/../bin (currently, that works fine)
5466
 
          # but it's something to keep an eye on.
5467
 
          if test "$inst_prefix_dir" = "$destdir"; then
5468
 
            $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
5469
 
            exit 1
5470
 
          fi
5471
 
 
5472
 
          if test -n "$inst_prefix_dir"; then
5473
 
            # Stick the inst_prefix_dir data into the link command.
5474
 
            relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
5475
 
          else
5476
 
            relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
5477
 
          fi
5478
 
 
5479
 
          $echo "$modename: warning: relinking \`$file'" 1>&2
5480
 
          $show "$relink_command"
5481
 
          if $run eval "$relink_command"; then :
5482
 
          else
5483
 
            $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
5484
 
            exit 1
5485
 
          fi
5486
 
        fi
5487
 
 
5488
 
        # See the names of the shared library.
5489
 
        set dummy $library_names
5490
 
        if test -n "$2"; then
5491
 
          realname="$2"
5492
 
          shift
5493
 
          shift
5494
 
 
5495
 
          srcname="$realname"
5496
 
          test -n "$relink_command" && srcname="$realname"T
5497
 
 
5498
 
          # Install the shared library and build the symlinks.
5499
 
          $show "$install_prog $dir/$srcname $destdir/$realname"
5500
 
          $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
5501
 
          if test -n "$stripme" && test -n "$striplib"; then
5502
 
            $show "$striplib $destdir/$realname"
5503
 
            $run eval "$striplib $destdir/$realname" || exit $?
5504
 
          fi
5505
 
 
5506
 
          if test "$#" -gt 0; then
5507
 
            # Delete the old symlinks, and create new ones.
5508
 
            for linkname
5509
 
            do
5510
 
              if test "$linkname" != "$realname"; then
5511
 
                $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
5512
 
                $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
5513
 
              fi
5514
 
            done
5515
 
          fi
5516
 
 
5517
 
          # Do each command in the postinstall commands.
5518
 
          lib="$destdir/$realname"
5519
 
          cmds=$postinstall_cmds
5520
 
          save_ifs="$IFS"; IFS='~'
5521
 
          for cmd in $cmds; do
5522
 
            IFS="$save_ifs"
5523
 
            eval cmd=\"$cmd\"
5524
 
            $show "$cmd"
5525
 
            $run eval "$cmd" || exit $?
5526
 
          done
5527
 
          IFS="$save_ifs"
5528
 
        fi
5529
 
 
5530
 
        # Install the pseudo-library for information purposes.
5531
 
        name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5532
 
        instname="$dir/$name"i
5533
 
        $show "$install_prog $instname $destdir/$name"
5534
 
        $run eval "$install_prog $instname $destdir/$name" || exit $?
5535
 
 
5536
 
        # Maybe install the static library, too.
5537
 
        test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
5538
 
        ;;
5539
 
 
5540
 
      *.lo)
5541
 
        # Install (i.e. copy) a libtool object.
5542
 
 
5543
 
        # Figure out destination file name, if it wasn't already specified.
5544
 
        if test -n "$destname"; then
5545
 
          destfile="$destdir/$destname"
5546
 
        else
5547
 
          destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5548
 
          destfile="$destdir/$destfile"
5549
 
        fi
5550
 
 
5551
 
        # Deduce the name of the destination old-style object file.
5552
 
        case $destfile in
5553
 
        *.lo)
5554
 
          staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
5555
 
          ;;
5556
 
        *.$objext)
5557
 
          staticdest="$destfile"
5558
 
          destfile=
5559
 
          ;;
5560
 
        *)
5561
 
          $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
5562
 
          $echo "$help" 1>&2
5563
 
          exit 1
5564
 
          ;;
5565
 
        esac
5566
 
 
5567
 
        # Install the libtool object if requested.
5568
 
        if test -n "$destfile"; then
5569
 
          $show "$install_prog $file $destfile"
5570
 
          $run eval "$install_prog $file $destfile" || exit $?
5571
 
        fi
5572
 
 
5573
 
        # Install the old object if enabled.
5574
 
        if test "$build_old_libs" = yes; then
5575
 
          # Deduce the name of the old-style object file.
5576
 
          staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
5577
 
 
5578
 
          $show "$install_prog $staticobj $staticdest"
5579
 
          $run eval "$install_prog \$staticobj \$staticdest" || exit $?
5580
 
        fi
5581
 
        exit 0
5582
 
        ;;
5583
 
 
5584
 
      *)
5585
 
        # Figure out destination file name, if it wasn't already specified.
5586
 
        if test -n "$destname"; then
5587
 
          destfile="$destdir/$destname"
5588
 
        else
5589
 
          destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5590
 
          destfile="$destdir/$destfile"
5591
 
        fi
5592
 
 
5593
 
        # If the file is missing, and there is a .exe on the end, strip it
5594
 
        # because it is most likely a libtool script we actually want to
5595
 
        # install
5596
 
        stripped_ext=""
5597
 
        case $file in
5598
 
          *.exe)
5599
 
            if test ! -f "$file"; then
5600
 
              file=`$echo $file|${SED} 's,.exe$,,'`
5601
 
              stripped_ext=".exe"
5602
 
            fi
5603
 
            ;;
5604
 
        esac
5605
 
 
5606
 
        # Do a test to see if this is really a libtool program.
5607
 
        case $host in
5608
 
        *cygwin*|*mingw*)
5609
 
            wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
5610
 
            ;;
5611
 
        *)
5612
 
            wrapper=$file
5613
 
            ;;
5614
 
        esac
5615
 
        if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
5616
 
          notinst_deplibs=
5617
 
          relink_command=
5618
 
 
5619
 
          # To insure that "foo" is sourced, and not "foo.exe",
5620
 
          # finese the cygwin/MSYS system by explicitly sourcing "foo."
5621
 
          # which disallows the automatic-append-.exe behavior.
5622
 
          case $build in
5623
 
          *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
5624
 
          *) wrapperdot=${wrapper} ;;
5625
 
          esac
5626
 
          # If there is no directory component, then add one.
5627
 
          case $file in
5628
 
          */* | *\\*) . ${wrapperdot} ;;
5629
 
          *) . ./${wrapperdot} ;;
5630
 
          esac
5631
 
 
5632
 
          # Check the variables that should have been set.
5633
 
          if test -z "$notinst_deplibs"; then
5634
 
            $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
5635
 
            exit 1
5636
 
          fi
5637
 
 
5638
 
          finalize=yes
5639
 
          for lib in $notinst_deplibs; do
5640
 
            # Check to see that each library is installed.
5641
 
            libdir=
5642
 
            if test -f "$lib"; then
5643
 
              # If there is no directory component, then add one.
5644
 
              case $lib in
5645
 
              */* | *\\*) . $lib ;;
5646
 
              *) . ./$lib ;;
5647
 
              esac
5648
 
            fi
5649
 
            libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
5650
 
            if test -n "$libdir" && test ! -f "$libfile"; then
5651
 
              $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
5652
 
              finalize=no
5653
 
            fi
5654
 
          done
5655
 
 
5656
 
          relink_command=
5657
 
          # To insure that "foo" is sourced, and not "foo.exe",
5658
 
          # finese the cygwin/MSYS system by explicitly sourcing "foo."
5659
 
          # which disallows the automatic-append-.exe behavior.
5660
 
          case $build in
5661
 
          *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
5662
 
          *) wrapperdot=${wrapper} ;;
5663
 
          esac
5664
 
          # If there is no directory component, then add one.
5665
 
          case $file in
5666
 
          */* | *\\*) . ${wrapperdot} ;;
5667
 
          *) . ./${wrapperdot} ;;
5668
 
          esac
5669
 
 
5670
 
          outputname=
5671
 
          if test "$fast_install" = no && test -n "$relink_command"; then
5672
 
            if test "$finalize" = yes && test -z "$run"; then
5673
 
              tmpdir="/tmp"
5674
 
              test -n "$TMPDIR" && tmpdir="$TMPDIR"
5675
 
              tmpdir="$tmpdir/libtool-$$"
5676
 
              if $mkdir "$tmpdir" && chmod 700 "$tmpdir"; then :
5677
 
              else
5678
 
                $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
5679
 
                continue
5680
 
              fi
5681
 
              file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
5682
 
              outputname="$tmpdir/$file"
5683
 
              # Replace the output file specification.
5684
 
              relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
5685
 
 
5686
 
              $show "$relink_command"
5687
 
              if $run eval "$relink_command"; then :
5688
 
              else
5689
 
                $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
5690
 
                ${rm}r "$tmpdir"
5691
 
                continue
5692
 
              fi
5693
 
              file="$outputname"
5694
 
            else
5695
 
              $echo "$modename: warning: cannot relink \`$file'" 1>&2
5696
 
            fi
5697
 
          else
5698
 
            # Install the binary that we compiled earlier.
5699
 
            file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
5700
 
          fi
5701
 
        fi
5702
 
 
5703
 
        # remove .exe since cygwin /usr/bin/install will append another
5704
 
        # one anyways
5705
 
        case $install_prog,$host in
5706
 
        */usr/bin/install*,*cygwin*)
5707
 
          case $file:$destfile in
5708
 
          *.exe:*.exe)
5709
 
            # this is ok
5710
 
            ;;
5711
 
          *.exe:*)
5712
 
            destfile=$destfile.exe
5713
 
            ;;
5714
 
          *:*.exe)
5715
 
            destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
5716
 
            ;;
5717
 
          esac
5718
 
          ;;
5719
 
        esac
5720
 
        $show "$install_prog$stripme $file $destfile"
5721
 
        $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
5722
 
        test -n "$outputname" && ${rm}r "$tmpdir"
5723
 
        ;;
5724
 
      esac
5725
 
    done
5726
 
 
5727
 
    for file in $staticlibs; do
5728
 
      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5729
 
 
5730
 
      # Set up the ranlib parameters.
5731
 
      oldlib="$destdir/$name"
5732
 
 
5733
 
      $show "$install_prog $file $oldlib"
5734
 
      $run eval "$install_prog \$file \$oldlib" || exit $?
5735
 
 
5736
 
      if test -n "$stripme" && test -n "$old_striplib"; then
5737
 
        $show "$old_striplib $oldlib"
5738
 
        $run eval "$old_striplib $oldlib" || exit $?
5739
 
      fi
5740
 
 
5741
 
      # Do each command in the postinstall commands.
5742
 
      cmds=$old_postinstall_cmds
5743
 
      save_ifs="$IFS"; IFS='~'
5744
 
      for cmd in $cmds; do
5745
 
        IFS="$save_ifs"
5746
 
        eval cmd=\"$cmd\"
5747
 
        $show "$cmd"
5748
 
        $run eval "$cmd" || exit $?
5749
 
      done
5750
 
      IFS="$save_ifs"
5751
 
    done
5752
 
 
5753
 
    if test -n "$future_libdirs"; then
5754
 
      $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
5755
 
    fi
5756
 
 
5757
 
    if test -n "$current_libdirs"; then
5758
 
      # Maybe just do a dry run.
5759
 
      test -n "$run" && current_libdirs=" -n$current_libdirs"
5760
 
      exec_cmd='$SHELL $0 $preserve_args --finish$current_libdirs'
5761
 
    else
5762
 
      exit 0
5763
 
    fi
5764
 
    ;;
5765
 
 
5766
 
  # libtool finish mode
5767
 
  finish)
5768
 
    modename="$modename: finish"
5769
 
    libdirs="$nonopt"
5770
 
    admincmds=
5771
 
 
5772
 
    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
5773
 
      for dir
5774
 
      do
5775
 
        libdirs="$libdirs $dir"
5776
 
      done
5777
 
 
5778
 
      for libdir in $libdirs; do
5779
 
        if test -n "$finish_cmds"; then
5780
 
          # Do each command in the finish commands.
5781
 
          cmds=$finish_cmds
5782
 
          save_ifs="$IFS"; IFS='~'
5783
 
          for cmd in $cmds; do
5784
 
            IFS="$save_ifs"
5785
 
            eval cmd=\"$cmd\"
5786
 
            $show "$cmd"
5787
 
            $run eval "$cmd" || admincmds="$admincmds
5788
 
       $cmd"
5789
 
          done
5790
 
          IFS="$save_ifs"
5791
 
        fi
5792
 
        if test -n "$finish_eval"; then
5793
 
          # Do the single finish_eval.
5794
 
          eval cmds=\"$finish_eval\"
5795
 
          $run eval "$cmds" || admincmds="$admincmds
5796
 
       $cmds"
5797
 
        fi
5798
 
      done
5799
 
    fi
5800
 
 
5801
 
    # Exit here if they wanted silent mode.
5802
 
    test "$show" = : && exit 0
5803
 
 
5804
 
    $echo "----------------------------------------------------------------------"
5805
 
    $echo "Libraries have been installed in:"
5806
 
    for libdir in $libdirs; do
5807
 
      $echo "   $libdir"
5808
 
    done
5809
 
    $echo
5810
 
    $echo "If you ever happen to want to link against installed libraries"
5811
 
    $echo "in a given directory, LIBDIR, you must either use libtool, and"
5812
 
    $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
5813
 
    $echo "flag during linking and do at least one of the following:"
5814
 
    if test -n "$shlibpath_var"; then
5815
 
      $echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
5816
 
      $echo "     during execution"
5817
 
    fi
5818
 
    if test -n "$runpath_var"; then
5819
 
      $echo "   - add LIBDIR to the \`$runpath_var' environment variable"
5820
 
      $echo "     during linking"
5821
 
    fi
5822
 
    if test -n "$hardcode_libdir_flag_spec"; then
5823
 
      libdir=LIBDIR
5824
 
      eval flag=\"$hardcode_libdir_flag_spec\"
5825
 
 
5826
 
      $echo "   - use the \`$flag' linker flag"
5827
 
    fi
5828
 
    if test -n "$admincmds"; then
5829
 
      $echo "   - have your system administrator run these commands:$admincmds"
5830
 
    fi
5831
 
    if test -f /etc/ld.so.conf; then
5832
 
      $echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
5833
 
    fi
5834
 
    $echo
5835
 
    $echo "See any operating system documentation about shared libraries for"
5836
 
    $echo "more information, such as the ld(1) and ld.so(8) manual pages."
5837
 
    $echo "----------------------------------------------------------------------"
5838
 
    exit 0
5839
 
    ;;
5840
 
 
5841
 
  # libtool execute mode
5842
 
  execute)
5843
 
    modename="$modename: execute"
5844
 
 
5845
 
    # The first argument is the command name.
5846
 
    cmd="$nonopt"
5847
 
    if test -z "$cmd"; then
5848
 
      $echo "$modename: you must specify a COMMAND" 1>&2
5849
 
      $echo "$help"
5850
 
      exit 1
5851
 
    fi
5852
 
 
5853
 
    # Handle -dlopen flags immediately.
5854
 
    for file in $execute_dlfiles; do
5855
 
      if test ! -f "$file"; then
5856
 
        $echo "$modename: \`$file' is not a file" 1>&2
5857
 
        $echo "$help" 1>&2
5858
 
        exit 1
5859
 
      fi
5860
 
 
5861
 
      dir=
5862
 
      case $file in
5863
 
      *.la)
5864
 
        # Check to see that this really is a libtool archive.
5865
 
        if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
5866
 
        else
5867
 
          $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5868
 
          $echo "$help" 1>&2
5869
 
          exit 1
5870
 
        fi
5871
 
 
5872
 
        # Read the libtool library.
5873
 
        dlname=
5874
 
        library_names=
5875
 
 
5876
 
        # If there is no directory component, then add one.
5877
 
        case $file in
5878
 
        */* | *\\*) . $file ;;
5879
 
        *) . ./$file ;;
5880
 
        esac
5881
 
 
5882
 
        # Skip this library if it cannot be dlopened.
5883
 
        if test -z "$dlname"; then
5884
 
          # Warn if it was a shared library.
5885
 
          test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
5886
 
          continue
5887
 
        fi
5888
 
 
5889
 
        dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
5890
 
        test "X$dir" = "X$file" && dir=.
5891
 
 
5892
 
        if test -f "$dir/$objdir/$dlname"; then
5893
 
          dir="$dir/$objdir"
5894
 
        else
5895
 
          $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
5896
 
          exit 1
5897
 
        fi
5898
 
        ;;
5899
 
 
5900
 
      *.lo)
5901
 
        # Just add the directory containing the .lo file.
5902
 
        dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
5903
 
        test "X$dir" = "X$file" && dir=.
5904
 
        ;;
5905
 
 
5906
 
      *)
5907
 
        $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
5908
 
        continue
5909
 
        ;;
5910
 
      esac
5911
 
 
5912
 
      # Get the absolute pathname.
5913
 
      absdir=`cd "$dir" && pwd`
5914
 
      test -n "$absdir" && dir="$absdir"
5915
 
 
5916
 
      # Now add the directory to shlibpath_var.
5917
 
      if eval "test -z \"\$$shlibpath_var\""; then
5918
 
        eval "$shlibpath_var=\"\$dir\""
5919
 
      else
5920
 
        eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
5921
 
      fi
5922
 
    done
5923
 
 
5924
 
    # This variable tells wrapper scripts just to set shlibpath_var
5925
 
    # rather than running their programs.
5926
 
    libtool_execute_magic="$magic"
5927
 
 
5928
 
    # Check if any of the arguments is a wrapper script.
5929
 
    args=
5930
 
    for file
5931
 
    do
5932
 
      case $file in
5933
 
      -*) ;;
5934
 
      *)
5935
 
        # Do a test to see if this is really a libtool program.
5936
 
        if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
5937
 
          # If there is no directory component, then add one.
5938
 
          case $file in
5939
 
          */* | *\\*) . $file ;;
5940
 
          *) . ./$file ;;
5941
 
          esac
5942
 
 
5943
 
          # Transform arg to wrapped name.
5944
 
          file="$progdir/$program"
5945
 
        fi
5946
 
        ;;
5947
 
      esac
5948
 
      # Quote arguments (to preserve shell metacharacters).
5949
 
      file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
5950
 
      args="$args \"$file\""
5951
 
    done
5952
 
 
5953
 
    if test -z "$run"; then
5954
 
      if test -n "$shlibpath_var"; then
5955
 
        # Export the shlibpath_var.
5956
 
        eval "export $shlibpath_var"
5957
 
      fi
5958
 
 
5959
 
      # Restore saved environment variables
5960
 
      if test "${save_LC_ALL+set}" = set; then
5961
 
        LC_ALL="$save_LC_ALL"; export LC_ALL
5962
 
      fi
5963
 
      if test "${save_LANG+set}" = set; then
5964
 
        LANG="$save_LANG"; export LANG
5965
 
      fi
5966
 
 
5967
 
      # Now prepare to actually exec the command.
5968
 
      exec_cmd="\$cmd$args"
5969
 
    else
5970
 
      # Display what would be done.
5971
 
      if test -n "$shlibpath_var"; then
5972
 
        eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
5973
 
        $echo "export $shlibpath_var"
5974
 
      fi
5975
 
      $echo "$cmd$args"
5976
 
      exit 0
5977
 
    fi
5978
 
    ;;
5979
 
 
5980
 
  # libtool clean and uninstall mode
5981
 
  clean | uninstall)
5982
 
    modename="$modename: $mode"
5983
 
    rm="$nonopt"
 
9482
      func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
 
9483
      ;;
 
9484
    esac
 
9485
    exit $EXIT_SUCCESS
 
9486
}
 
9487
 
 
9488
{ test "$opt_mode" = link || test "$opt_mode" = relink; } &&
 
9489
    func_mode_link ${1+"$@"}
 
9490
 
 
9491
 
 
9492
# func_mode_uninstall arg...
 
9493
func_mode_uninstall ()
 
9494
{
 
9495
    $opt_debug
 
9496
    RM="$nonopt"
5984
9497
    files=
5985
9498
    rmforce=
5986
9499
    exit_status=0
5992
9505
    for arg
5993
9506
    do
5994
9507
      case $arg in
5995
 
      -f) rm="$rm $arg"; rmforce=yes ;;
5996
 
      -*) rm="$rm $arg" ;;
5997
 
      *) files="$files $arg" ;;
 
9508
      -f) func_append RM " $arg"; rmforce=yes ;;
 
9509
      -*) func_append RM " $arg" ;;
 
9510
      *) func_append files " $arg" ;;
5998
9511
      esac
5999
9512
    done
6000
9513
 
6001
 
    if test -z "$rm"; then
6002
 
      $echo "$modename: you must specify an RM program" 1>&2
6003
 
      $echo "$help" 1>&2
6004
 
      exit 1
6005
 
    fi
 
9514
    test -z "$RM" && \
 
9515
      func_fatal_help "you must specify an RM program"
6006
9516
 
6007
9517
    rmdirs=
6008
9518
 
6009
 
    origobjdir="$objdir"
6010
9519
    for file in $files; do
6011
 
      dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6012
 
      if test "X$dir" = "X$file"; then
6013
 
        dir=.
6014
 
        objdir="$origobjdir"
 
9520
      func_dirname "$file" "" "."
 
9521
      dir="$func_dirname_result"
 
9522
      if test "X$dir" = X.; then
 
9523
        odir="$objdir"
6015
9524
      else
6016
 
        objdir="$dir/$origobjdir"
 
9525
        odir="$dir/$objdir"
6017
9526
      fi
6018
 
      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6019
 
      test "$mode" = uninstall && objdir="$dir"
 
9527
      func_basename "$file"
 
9528
      name="$func_basename_result"
 
9529
      test "$opt_mode" = uninstall && odir="$dir"
6020
9530
 
6021
 
      # Remember objdir for removal later, being careful to avoid duplicates
6022
 
      if test "$mode" = clean; then
 
9531
      # Remember odir for removal later, being careful to avoid duplicates
 
9532
      if test "$opt_mode" = clean; then
6023
9533
        case " $rmdirs " in
6024
 
          *" $objdir "*) ;;
6025
 
          *) rmdirs="$rmdirs $objdir" ;;
 
9534
          *" $odir "*) ;;
 
9535
          *) func_append rmdirs " $odir" ;;
6026
9536
        esac
6027
9537
      fi
6028
9538
 
6029
9539
      # Don't error if the file doesn't exist and rm -f was used.
6030
 
      if (test -L "$file") >/dev/null 2>&1 \
6031
 
        || (test -h "$file") >/dev/null 2>&1 \
6032
 
        || test -f "$file"; then
 
9540
      if { test -L "$file"; } >/dev/null 2>&1 ||
 
9541
         { test -h "$file"; } >/dev/null 2>&1 ||
 
9542
         test -f "$file"; then
6033
9543
        :
6034
9544
      elif test -d "$file"; then
6035
9545
        exit_status=1
6043
9553
      case $name in
6044
9554
      *.la)
6045
9555
        # Possibly a libtool archive, so verify it.
6046
 
        if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6047
 
          . $dir/$name
 
9556
        if func_lalib_p "$file"; then
 
9557
          func_source $dir/$name
6048
9558
 
6049
9559
          # Delete the libtool libraries and symlinks.
6050
9560
          for n in $library_names; do
6051
 
            rmfiles="$rmfiles $objdir/$n"
 
9561
            func_append rmfiles " $odir/$n"
6052
9562
          done
6053
 
          test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
6054
 
          test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
 
9563
          test -n "$old_library" && func_append rmfiles " $odir/$old_library"
6055
9564
 
6056
 
          if test "$mode" = uninstall; then
 
9565
          case "$opt_mode" in
 
9566
          clean)
 
9567
            case " $library_names " in
 
9568
            *" $dlname "*) ;;
 
9569
            *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
 
9570
            esac
 
9571
            test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
 
9572
            ;;
 
9573
          uninstall)
6057
9574
            if test -n "$library_names"; then
6058
9575
              # Do each command in the postuninstall commands.
6059
 
              cmds=$postuninstall_cmds
6060
 
              save_ifs="$IFS"; IFS='~'
6061
 
              for cmd in $cmds; do
6062
 
                IFS="$save_ifs"
6063
 
                eval cmd=\"$cmd\"
6064
 
                $show "$cmd"
6065
 
                $run eval "$cmd"
6066
 
                if test "$?" -ne 0 && test "$rmforce" != yes; then
6067
 
                  exit_status=1
6068
 
                fi
6069
 
              done
6070
 
              IFS="$save_ifs"
 
9576
              func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
6071
9577
            fi
6072
9578
 
6073
9579
            if test -n "$old_library"; then
6074
9580
              # Do each command in the old_postuninstall commands.
6075
 
              cmds=$old_postuninstall_cmds
6076
 
              save_ifs="$IFS"; IFS='~'
6077
 
              for cmd in $cmds; do
6078
 
                IFS="$save_ifs"
6079
 
                eval cmd=\"$cmd\"
6080
 
                $show "$cmd"
6081
 
                $run eval "$cmd"
6082
 
                if test "$?" -ne 0 && test "$rmforce" != yes; then
6083
 
                  exit_status=1
6084
 
                fi
6085
 
              done
6086
 
              IFS="$save_ifs"
 
9581
              func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
6087
9582
            fi
6088
9583
            # FIXME: should reinstall the best remaining shared library.
6089
 
          fi
 
9584
            ;;
 
9585
          esac
6090
9586
        fi
6091
9587
        ;;
6092
9588
 
6093
9589
      *.lo)
6094
9590
        # Possibly a libtool object, so verify it.
6095
 
        if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
9591
        if func_lalib_p "$file"; then
6096
9592
 
6097
9593
          # Read the .lo file
6098
 
          . $dir/$name
 
9594
          func_source $dir/$name
6099
9595
 
6100
9596
          # Add PIC object to the list of files to remove.
6101
 
          if test -n "$pic_object" \
6102
 
             && test "$pic_object" != none; then
6103
 
            rmfiles="$rmfiles $dir/$pic_object"
 
9597
          if test -n "$pic_object" &&
 
9598
             test "$pic_object" != none; then
 
9599
            func_append rmfiles " $dir/$pic_object"
6104
9600
          fi
6105
9601
 
6106
9602
          # Add non-PIC object to the list of files to remove.
6107
 
          if test -n "$non_pic_object" \
6108
 
             && test "$non_pic_object" != none; then
6109
 
            rmfiles="$rmfiles $dir/$non_pic_object"
 
9603
          if test -n "$non_pic_object" &&
 
9604
             test "$non_pic_object" != none; then
 
9605
            func_append rmfiles " $dir/$non_pic_object"
6110
9606
          fi
6111
9607
        fi
6112
9608
        ;;
6113
9609
 
6114
9610
      *)
6115
 
        if test "$mode" = clean ; then
 
9611
        if test "$opt_mode" = clean ; then
6116
9612
          noexename=$name
6117
9613
          case $file in
6118
 
          *.exe) 
6119
 
            file=`$echo $file|${SED} 's,.exe$,,'`
6120
 
            noexename=`$echo $name|${SED} 's,.exe$,,'`
 
9614
          *.exe)
 
9615
            func_stripname '' '.exe' "$file"
 
9616
            file=$func_stripname_result
 
9617
            func_stripname '' '.exe' "$name"
 
9618
            noexename=$func_stripname_result
6121
9619
            # $file with .exe has already been added to rmfiles,
6122
9620
            # add $file without .exe
6123
 
            rmfiles="$rmfiles $file"
 
9621
            func_append rmfiles " $file"
6124
9622
            ;;
6125
9623
          esac
6126
9624
          # Do a test to see if this is a libtool program.
6127
 
          if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6128
 
            relink_command=
6129
 
            . $dir/$noexename
 
9625
          if func_ltwrapper_p "$file"; then
 
9626
            if func_ltwrapper_executable_p "$file"; then
 
9627
              func_ltwrapper_scriptname "$file"
 
9628
              relink_command=
 
9629
              func_source $func_ltwrapper_scriptname_result
 
9630
              func_append rmfiles " $func_ltwrapper_scriptname_result"
 
9631
            else
 
9632
              relink_command=
 
9633
              func_source $dir/$noexename
 
9634
            fi
6130
9635
 
6131
9636
            # note $name still contains .exe if it was in $file originally
6132
9637
            # as does the version of $file that was added into $rmfiles
6133
 
            rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
 
9638
            func_append rmfiles " $odir/$name $odir/${name}S.${objext}"
6134
9639
            if test "$fast_install" = yes && test -n "$relink_command"; then
6135
 
              rmfiles="$rmfiles $objdir/lt-$name"
 
9640
              func_append rmfiles " $odir/lt-$name"
6136
9641
            fi
6137
9642
            if test "X$noexename" != "X$name" ; then
6138
 
              rmfiles="$rmfiles $objdir/lt-${noexename}.c"
 
9643
              func_append rmfiles " $odir/lt-${noexename}.c"
6139
9644
            fi
6140
9645
          fi
6141
9646
        fi
6142
9647
        ;;
6143
9648
      esac
6144
 
      $show "$rm $rmfiles"
6145
 
      $run $rm $rmfiles || exit_status=1
 
9649
      func_show_eval "$RM $rmfiles" 'exit_status=1'
6146
9650
    done
6147
 
    objdir="$origobjdir"
6148
9651
 
6149
9652
    # Try to remove the ${objdir}s in the directories where we deleted files
6150
9653
    for dir in $rmdirs; do
6151
9654
      if test -d "$dir"; then
6152
 
        $show "rmdir $dir"
6153
 
        $run rmdir $dir >/dev/null 2>&1
 
9655
        func_show_eval "rmdir $dir >/dev/null 2>&1"
6154
9656
      fi
6155
9657
    done
6156
9658
 
6157
9659
    exit $exit_status
6158
 
    ;;
6159
 
 
6160
 
  "")
6161
 
    $echo "$modename: you must specify a MODE" 1>&2
6162
 
    $echo "$generic_help" 1>&2
6163
 
    exit 1
6164
 
    ;;
6165
 
  esac
6166
 
 
6167
 
  if test -z "$exec_cmd"; then
6168
 
    $echo "$modename: invalid operation mode \`$mode'" 1>&2
6169
 
    $echo "$generic_help" 1>&2
6170
 
    exit 1
6171
 
  fi
6172
 
fi # test -z "$show_help"
 
9660
}
 
9661
 
 
9662
{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } &&
 
9663
    func_mode_uninstall ${1+"$@"}
 
9664
 
 
9665
test -z "$opt_mode" && {
 
9666
  help="$generic_help"
 
9667
  func_fatal_help "you must specify a MODE"
 
9668
}
 
9669
 
 
9670
test -z "$exec_cmd" && \
 
9671
  func_fatal_help "invalid operation mode \`$opt_mode'"
6173
9672
 
6174
9673
if test -n "$exec_cmd"; then
6175
 
  eval exec $exec_cmd
6176
 
  exit 1
 
9674
  eval exec "$exec_cmd"
 
9675
  exit $EXIT_FAILURE
6177
9676
fi
6178
9677
 
6179
 
# We need to display help for each of the modes.
6180
 
case $mode in
6181
 
"") $echo \
6182
 
"Usage: $modename [OPTION]... [MODE-ARG]...
6183
 
 
6184
 
Provide generalized library-building support services.
6185
 
 
6186
 
    --config          show all configuration variables
6187
 
    --debug           enable verbose shell tracing
6188
 
-n, --dry-run         display commands without modifying any files
6189
 
    --features        display basic configuration information and exit
6190
 
    --finish          same as \`--mode=finish'
6191
 
    --help            display this help message and exit
6192
 
    --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
6193
 
    --quiet           same as \`--silent'
6194
 
    --silent          don't print informational messages
6195
 
    --tag=TAG         use configuration variables from tag TAG
6196
 
    --version         print version information
6197
 
 
6198
 
MODE must be one of the following:
6199
 
 
6200
 
      clean           remove files from the build directory
6201
 
      compile         compile a source file into a libtool object
6202
 
      execute         automatically set library path, then run a program
6203
 
      finish          complete the installation of libtool libraries
6204
 
      install         install libraries or executables
6205
 
      link            create a library or an executable
6206
 
      uninstall       remove libraries from an installed directory
6207
 
 
6208
 
MODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
6209
 
a more detailed description of MODE.
6210
 
 
6211
 
Report bugs to <bug-libtool@gnu.org>."
6212
 
  exit 0
6213
 
  ;;
6214
 
 
6215
 
clean)
6216
 
  $echo \
6217
 
"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
6218
 
 
6219
 
Remove files from the build directory.
6220
 
 
6221
 
RM is the name of the program to use to delete files associated with each FILE
6222
 
(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
6223
 
to RM.
6224
 
 
6225
 
If FILE is a libtool library, object or program, all the files associated
6226
 
with it are deleted. Otherwise, only FILE itself is deleted using RM."
6227
 
  ;;
6228
 
 
6229
 
compile)
6230
 
  $echo \
6231
 
"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
6232
 
 
6233
 
Compile a source file into a libtool library object.
6234
 
 
6235
 
This mode accepts the following additional options:
6236
 
 
6237
 
  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
6238
 
  -prefer-pic       try to building PIC objects only
6239
 
  -prefer-non-pic   try to building non-PIC objects only
6240
 
  -static           always build a \`.o' file suitable for static linking
6241
 
 
6242
 
COMPILE-COMMAND is a command to be used in creating a \`standard' object file
6243
 
from the given SOURCEFILE.
6244
 
 
6245
 
The output file name is determined by removing the directory component from
6246
 
SOURCEFILE, then substituting the C source code suffix \`.c' with the
6247
 
library object suffix, \`.lo'."
6248
 
  ;;
6249
 
 
6250
 
execute)
6251
 
  $echo \
6252
 
"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
6253
 
 
6254
 
Automatically set library path, then run a program.
6255
 
 
6256
 
This mode accepts the following additional options:
6257
 
 
6258
 
  -dlopen FILE      add the directory containing FILE to the library path
6259
 
 
6260
 
This mode sets the library path environment variable according to \`-dlopen'
6261
 
flags.
6262
 
 
6263
 
If any of the ARGS are libtool executable wrappers, then they are translated
6264
 
into their corresponding uninstalled binary, and any of their required library
6265
 
directories are added to the library path.
6266
 
 
6267
 
Then, COMMAND is executed, with ARGS as arguments."
6268
 
  ;;
6269
 
 
6270
 
finish)
6271
 
  $echo \
6272
 
"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
6273
 
 
6274
 
Complete the installation of libtool libraries.
6275
 
 
6276
 
Each LIBDIR is a directory that contains libtool libraries.
6277
 
 
6278
 
The commands that this mode executes may require superuser privileges.  Use
6279
 
the \`--dry-run' option if you just want to see what would be executed."
6280
 
  ;;
6281
 
 
6282
 
install)
6283
 
  $echo \
6284
 
"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
6285
 
 
6286
 
Install executables or libraries.
6287
 
 
6288
 
INSTALL-COMMAND is the installation command.  The first component should be
6289
 
either the \`install' or \`cp' program.
6290
 
 
6291
 
The rest of the components are interpreted as arguments to that command (only
6292
 
BSD-compatible install options are recognized)."
6293
 
  ;;
6294
 
 
6295
 
link)
6296
 
  $echo \
6297
 
"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
6298
 
 
6299
 
Link object files or libraries together to form another library, or to
6300
 
create an executable program.
6301
 
 
6302
 
LINK-COMMAND is a command using the C compiler that you would use to create
6303
 
a program from several object files.
6304
 
 
6305
 
The following components of LINK-COMMAND are treated specially:
6306
 
 
6307
 
  -all-static       do not do any dynamic linking at all
6308
 
  -avoid-version    do not add a version suffix if possible
6309
 
  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
6310
 
  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
6311
 
  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
6312
 
  -export-symbols SYMFILE
6313
 
                    try to export only the symbols listed in SYMFILE
6314
 
  -export-symbols-regex REGEX
6315
 
                    try to export only the symbols matching REGEX
6316
 
  -LLIBDIR          search LIBDIR for required installed libraries
6317
 
  -lNAME            OUTPUT-FILE requires the installed library libNAME
6318
 
  -module           build a library that can dlopened
6319
 
  -no-fast-install  disable the fast-install mode
6320
 
  -no-install       link a not-installable executable
6321
 
  -no-undefined     declare that a library does not refer to external symbols
6322
 
  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
6323
 
  -objectlist FILE  Use a list of object files found in FILE to specify objects
6324
 
  -precious-files-regex REGEX
6325
 
                    don't remove output files matching REGEX
6326
 
  -release RELEASE  specify package release information
6327
 
  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
6328
 
  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
6329
 
  -static           do not do any dynamic linking of libtool libraries
6330
 
  -version-info CURRENT[:REVISION[:AGE]]
6331
 
                    specify library version info [each variable defaults to 0]
6332
 
 
6333
 
All other options (arguments beginning with \`-') are ignored.
6334
 
 
6335
 
Every other argument is treated as a filename.  Files ending in \`.la' are
6336
 
treated as uninstalled libtool libraries, other files are standard or library
6337
 
object files.
6338
 
 
6339
 
If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
6340
 
only library objects (\`.lo' files) may be specified, and \`-rpath' is
6341
 
required, except when creating a convenience library.
6342
 
 
6343
 
If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
6344
 
using \`ar' and \`ranlib', or on Windows using \`lib'.
6345
 
 
6346
 
If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
6347
 
is created, otherwise an executable program is created."
6348
 
  ;;
6349
 
 
6350
 
uninstall)
6351
 
  $echo \
6352
 
"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
6353
 
 
6354
 
Remove libraries from an installation directory.
6355
 
 
6356
 
RM is the name of the program to use to delete files associated with each FILE
6357
 
(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
6358
 
to RM.
6359
 
 
6360
 
If FILE is a libtool library, all the files associated with it are deleted.
6361
 
Otherwise, only FILE itself is deleted using RM."
6362
 
  ;;
6363
 
 
6364
 
*)
6365
 
  $echo "$modename: invalid operation mode \`$mode'" 1>&2
6366
 
  $echo "$help" 1>&2
6367
 
  exit 1
6368
 
  ;;
6369
 
esac
6370
 
 
6371
 
$echo
6372
 
$echo "Try \`$modename --help' for more information about other modes."
6373
 
 
6374
 
exit 0
 
9678
exit $exit_status
 
9679
 
6375
9680
 
6376
9681
# The TAGs below are defined such that we never get into a situation
6377
9682
# in which we disable both kinds of libraries.  Given conflicting
6390
9695
# ### END LIBTOOL TAG CONFIG: disable-shared
6391
9696
 
6392
9697
# ### BEGIN LIBTOOL TAG CONFIG: disable-static
6393
 
build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac`
 
9698
build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
6394
9699
# ### END LIBTOOL TAG CONFIG: disable-static
6395
9700
 
6396
9701
# Local Variables:
6397
9702
# mode:shell-script
6398
9703
# sh-indentation:2
6399
9704
# End:
 
9705
# vi:sw=2
 
9706