OpenCores
URL https://opencores.org/ocsvn/open8_urisc/open8_urisc/trunk

Subversion Repositories open8_urisc

[/] [open8_urisc/] [trunk/] [gnu/] [binutils/] [ltmain.sh] - Blame information for rev 178

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.