~ubuntu-branches/debian/jessie/liblouis/jessie

« back to all changes in this revision

Viewing changes to build-aux/ltmain.sh

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