~ubuntu-branches/ubuntu/precise/netatalk/precise

« back to all changes in this revision

Viewing changes to ltmain.sh

  • Committer: Bazaar Package Importer
  • Author(s): Jonas Smedegaard
  • Date: 2009-09-09 23:43:27 UTC
  • mfrom: (8.2.5 sid)
  • Revision ID: james.westby@ubuntu.com-20090909234327-dhgxhuanxheto4x8
Tags: 2.0.4-2
* Update copyright hints.
* Lower policy compliance to 3.8.0 (uncertain about sysv script
  requirements in 3.8.1).
* Fix order of db upgrade commands in README.Debian. Closes:
  bug#533344, thanks (again) to Itai Seggev.
* Update package-relations.mk: Cleanup unversioned+versioned
  dependency mix. Improve whitespace cleanup. Rewrite and silence
  applying dependencies.
* Fix and improve README.Debian section on recompiling with OpenSSL,
  thanks to Gijs Hillenius and others.

Show diffs side-by-side

added added

removed removed

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