~ubuntu-branches/ubuntu/hoary/pcre3/hoary-security

« back to all changes in this revision

Viewing changes to ltmain.sh

  • Committer: Bazaar Package Importer
  • Author(s): Andreas Metzler
  • Date: 2004-03-12 13:23:02 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040312132302-id6ksx1l8dwssbw9
Tags: 4.5-1.1
* NMU to fix rc-bugs.
* Update libtool related files to fix build-error on mips, keep original
  config.in, as it is no generated file. (Closes: #237265)
* pcregrep replaces pgrep. (Closes: #237564)
* Bump shlibs, pcre 4.5 includes two new functions.
* Let pgrep's /usr/share/doc symlink point to the package it depends on,
  pcregrep.

Show diffs side-by-side

added added

removed removed

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