~svn/ubuntu/raring/subversion/ppa

« back to all changes in this revision

Viewing changes to ac-helpers/ltmain.sh

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-12-05 01:26:14 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051205012614-qom4xfypgtsqc2xq
Tags: 1.2.3dfsg1-3ubuntu1
Merge with the final Debian release of 1.2.3dfsg1-3, bringing in
fixes to the clean target, better documentation of the libdb4.3
upgrade and build fixes to work with swig1.3_1.3.27.

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