~ubuntu-branches/ubuntu/karmic/cryptsetup/karmic-updates

« back to all changes in this revision

Viewing changes to ltmain.sh

  • Committer: Bazaar Package Importer
  • Author(s): Scott James Remnant, Steve Langasek, Scott James Remnant
  • Date: 2009-10-14 04:52:16 UTC
  • Revision ID: james.westby@ubuntu.com-20091014045216-yej34imeg7sh3ljd
Tags: 2:1.0.6+20090405.svn49-1ubuntu6
[ Steve Langasek ]
* Move the Debian Vcs- fields aside.

[ Scott James Remnant ]
* debian/cryptdisks-enable.upstart: Don't overcompensate for my idiocy,
  cryptsetup should not need a controlling terminal, just a terminal
  is fine.  May fix LP: #439138.

Show diffs side-by-side

added added

removed removed

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