/rusxmms/librcc

To get this branch, use:
bzr branch http://suren.me/webbzr/rusxmms/librcc

« back to all changes in this revision

Viewing changes to ltmain.sh

  • Committer: Suren A. Chilingaryan
  • Date: 2005-06-16 23:14:30 UTC
  • Revision ID: Arch-1:ds@dside.dyndns.org--darksoft-2004%librcc--main--0.1--base-0
Initial Import

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