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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [binutils-2.20.1/] [ltmain.sh] - Blame information for rev 304

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

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

powered by: WebSVN 2.1.0

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