~ubuntu-branches/ubuntu/feisty/irssi/feisty-backports

« back to all changes in this revision

Viewing changes to ltmain.sh

  • Committer: Bazaar Package Importer
  • Author(s): David Pashley
  • Date: 2005-12-10 21:25:51 UTC
  • Revision ID: james.westby@ubuntu.com-20051210212551-5qwm108g7inyu2f2
Tags: upstream-0.8.10
ImportĀ upstreamĀ versionĀ 0.8.10

Show diffs side-by-side

added added

removed removed

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