~ubuntu-branches/ubuntu/vivid/globus-gss-assist/vivid

« back to all changes in this revision

Viewing changes to ltmain.sh

  • Committer: Bazaar Package Importer
  • Author(s): Mattias Ellert
  • Date: 2009-04-18 20:17:33 UTC
  • Revision ID: james.westby@ubuntu.com-20090418201733-xl4r26mgda1shx4q
Tags: upstream-4.0
ImportĀ upstreamĀ versionĀ 4.0

Show diffs side-by-side

added added

removed removed

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