~ubuntu-branches/ubuntu/intrepid/gwenview/intrepid

« back to all changes in this revision

Viewing changes to admin/ltmain.sh

  • Committer: Bazaar Package Importer
  • Author(s): Christopher Martin
  • Date: 2005-04-06 11:33:06 UTC
  • mfrom: (1.2.1 upstream) (2.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20050406113306-7zovl7z0io5bacpd
Tags: 1.2.0-1
* New upstream release.
  + Fixes crashes when using "Back" to navigate. (Closes: #301811)
* Enable KIPI support.
* Add a doc-base file for the handbook.

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, 1997, 1998, 1999, 2000, 2001
 
4
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003
5
5
# Free Software Foundation, Inc.
6
6
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
7
7
#
49
49
fi
50
50
 
51
51
# The name of this program.
52
 
progname=`$echo "$0" | sed 's%^.*/%%'`
 
52
progname=`$echo "$0" | ${SED} 's%^.*/%%'`
53
53
modename="$progname"
54
54
 
55
55
# Constants.
56
56
PROGRAM=ltmain.sh
57
57
PACKAGE=libtool
58
 
VERSION=1.4a
59
 
TIMESTAMP=" (1.641.2.206mm 2001/04/03 21:47:47)"
 
58
VERSION=1.5a
 
59
TIMESTAMP=" (1.1240 2003/06/26 06:55:19)"
60
60
 
61
61
default_mode=
62
62
help="Try \`$progname --help' for more information."
67
67
 
68
68
# Sed substitution that helps us do robust quoting.  It backslashifies
69
69
# metacharacters that are still active within double-quoted strings.
70
 
Xsed='sed -e 1s/^X//'
 
70
Xsed="${SED}"' -e 1s/^X//'
71
71
sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
72
 
SP2NL='tr \040 \012'
73
 
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
74
83
 
75
84
# NLS nuisances.
76
85
# Only set LANG and LC_ALL to C if already set.
84
93
  save_LANG="$LANG"; LANG=C; export LANG
85
94
fi
86
95
 
87
 
if test "$LTCONFIG_VERSION" != "$VERSION"; then
88
 
  echo "$modename: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2
89
 
  echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
90
 
  exit 1
91
 
fi
 
96
# Make sure IFS has a sensible default
 
97
: ${IFS="       "}
92
98
 
93
99
if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
94
 
  echo "$modename: not configured to build any kind of library" 1>&2
95
 
  echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
 
100
  $echo "$modename: not configured to build any kind of library" 1>&2
 
101
  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
96
102
  exit 1
97
103
fi
98
104
 
108
114
lo2o="s/\\.lo\$/.${objext}/"
109
115
o2lo="s/\\.${objext}\$/.lo/"
110
116
 
 
117
#####################################
 
118
# Shell function definitions:
 
119
# This seems to be the best place for them
 
120
 
 
121
# Need a lot of goo to handle *both* DLLs and import libs
 
122
# Has to be a shell function in order to 'eat' the argument
 
123
# that is supplied when $file_magic_command is called.
 
124
win32_libid () {
 
125
  win32_libid_type="unknown"
 
126
  win32_fileres=`file -L $1 2>/dev/null`
 
127
  case $win32_fileres in
 
128
  *ar\ archive\ import\ library*) # definitely import
 
129
    win32_libid_type="x86 archive import"
 
130
    ;;
 
131
  *ar\ archive*) # could be an import, or static
 
132
    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
 
133
      grep -E 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
 
134
      win32_nmres=`eval $NM -f posix -A $1 | \
 
135
        sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
 
136
      if test "X$win32_nmres" = "Ximport" ; then
 
137
        win32_libid_type="x86 archive import"
 
138
      else
 
139
        win32_libid_type="x86 archive static"
 
140
      fi
 
141
    fi
 
142
    ;;
 
143
  *DLL*) 
 
144
    win32_libid_type="x86 DLL"
 
145
    ;;
 
146
  *executable*) # but shell scripts are "executable" too...
 
147
    case $win32_fileres in
 
148
    *MS\ Windows\ PE\ Intel*)
 
149
      win32_libid_type="x86 DLL"
 
150
      ;;
 
151
    esac
 
152
    ;;
 
153
  esac
 
154
  $echo $win32_libid_type
 
155
}
 
156
 
 
157
# End of Shell function definitions
 
158
#####################################
 
159
 
111
160
# Parse our command line options once, thoroughly.
112
 
while test $# -gt 0
 
161
while test "$#" -gt 0
113
162
do
114
163
  arg="$1"
115
164
  shift
131
180
      # Check whether tagname contains only valid characters
132
181
      case $tagname in
133
182
      *[!-_A-Za-z0-9,/]*)
134
 
        echo "$progname: invalid tag name: $tagname" 1>&2
 
183
        $echo "$progname: invalid tag name: $tagname" 1>&2
135
184
        exit 1
136
 
        ;;
 
185
        ;;
137
186
      esac
138
187
 
139
 
      if grep "^### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$0" > /dev/null; then
140
 
        taglist="$taglist $tagname"
141
 
        # Evaluate the configuration.
142
 
        eval "`sed -n -e '/^### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $0`"
143
 
      else
144
 
        echo "$progname: ignoring unknown tag $tagname" 1>&2
145
 
      fi
 
188
      case $tagname in
 
189
      CC)
 
190
        # Don't test for the "default" C tag, as we know, it's there, but
 
191
        # not specially marked.
 
192
        ;;
 
193
      *)
 
194
        if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$0" > /dev/null; then
 
195
          taglist="$taglist $tagname"
 
196
          # Evaluate the configuration.
 
197
          eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $0`"
 
198
        else
 
199
          $echo "$progname: ignoring unknown tag $tagname" 1>&2
 
200
        fi
 
201
        ;;
 
202
      esac
146
203
      ;;
147
204
    *)
148
205
      eval "$prev=\$arg"
161
218
    ;;
162
219
 
163
220
  --version)
164
 
    echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
 
221
    $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
 
222
    $echo
 
223
    $echo "Copyright (C) 2003  Free Software Foundation, Inc."
 
224
    $echo "This is free software; see the source for copying conditions.  There is NO"
 
225
    $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
165
226
    exit 0
166
227
    ;;
167
228
 
168
229
  --config)
169
 
    sed -n -e '/^### BEGIN LIBTOOL CONFIG/,/^### END LIBTOOL CONFIG/p' < "$0"
 
230
    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
170
231
    # Now print the configurations for the tags.
171
232
    for tagname in $taglist; do
172
 
      sed -n -e "/^### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^### END LIBTOOL TAG CONFIG: $tagname$/p" < "$0"
 
233
      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$0"
173
234
    done
174
235
    exit 0
175
236
    ;;
176
237
 
177
238
  --debug)
178
 
    echo "$progname: enabling shell trace mode"
 
239
    $echo "$progname: enabling shell trace mode"
179
240
    set -x
180
241
    ;;
181
242
 
184
245
    ;;
185
246
 
186
247
  --features)
187
 
    echo "host: $host"
 
248
    $echo "host: $host"
188
249
    if test "$build_libtool_libs" = yes; then
189
 
      echo "enable shared libraries"
 
250
      $echo "enable shared libraries"
190
251
    else
191
 
      echo "disable shared libraries"
 
252
      $echo "disable shared libraries"
192
253
    fi
193
254
    if test "$build_old_libs" = yes; then
194
 
      echo "enable static libraries"
 
255
      $echo "enable static libraries"
195
256
    else
196
 
      echo "disable static libraries"
 
257
      $echo "disable static libraries"
197
258
    fi
198
259
    exit 0
199
260
    ;;
203
264
  --mode) prevopt="--mode" prev=mode ;;
204
265
  --mode=*) mode="$optarg" ;;
205
266
 
 
267
  --preserve-dup-deps) duplicate_deps="yes" ;;
 
268
 
206
269
  --quiet | --silent)
207
270
    show=:
208
271
    ;;
238
301
  exit 1
239
302
fi
240
303
 
 
304
# If this variable is set in any of the actions, the command in it
 
305
# will be execed at the end.  This prevents here-documents from being
 
306
# left over by shells.
 
307
exec_cmd=
 
308
 
241
309
if test -z "$show_help"; then
242
310
 
243
311
  # Infer the operation mode.
244
312
  if test -z "$mode"; then
 
313
    $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
 
314
    $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2
245
315
    case $nonopt in
246
 
    *cc | *++ | gcc* | *-gcc*)
 
316
    *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
247
317
      mode=link
248
318
      for arg
249
319
      do
298
368
    modename="$modename: compile"
299
369
    # Get the compilation command and the source file.
300
370
    base_compile=
301
 
    prev=
302
 
    lastarg=
303
 
    srcfile="$nonopt"
 
371
    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
304
372
    suppress_output=
 
373
    arg_mode=normal
 
374
    libobj=
305
375
 
306
 
    user_target=no
307
376
    for arg
308
377
    do
309
 
      case $prev in
310
 
      "") ;;
311
 
      xcompiler)
312
 
        # Aesthetically quote the previous argument.
313
 
        prev=
314
 
        lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
315
 
 
316
 
        case $arg in
317
 
        # Double-quote args containing other shell metacharacters.
318
 
        # Many Bourne shells cannot handle close brackets correctly
319
 
        # in scan sets, so we specify it separately.
320
 
        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
321
 
          arg="\"$arg\""
322
 
          ;;
323
 
        esac
324
 
 
325
 
        # Add the previous argument to base_compile.
326
 
        if test -z "$base_compile"; then
327
 
          base_compile="$lastarg"
328
 
        else
329
 
          base_compile="$base_compile $lastarg"
330
 
        fi
331
 
        continue
332
 
        ;;
333
 
      esac
334
 
 
335
 
      # Accept any command-line options.
336
 
      case $arg in
337
 
      -o)
338
 
        if test "$user_target" != "no"; then
339
 
          $echo "$modename: you cannot specify \`-o' more than once" 1>&2
340
 
          exit 1
341
 
        fi
342
 
        user_target=next
343
 
        ;;
344
 
 
345
 
      -static)
346
 
        build_old_libs=yes
347
 
        continue
348
 
        ;;
349
 
 
350
 
      -prefer-pic)
351
 
        pic_mode=yes
352
 
        continue
353
 
        ;;
354
 
 
355
 
      -prefer-non-pic)
356
 
        pic_mode=no
357
 
        continue
358
 
        ;;
359
 
 
360
 
      -Xcompiler)
361
 
        prev=xcompiler
362
 
        continue
363
 
        ;;
364
 
 
365
 
      -Wc,*)
366
 
        args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
367
 
        lastarg=
368
 
        IFS="${IFS=     }"; save_ifs="$IFS"; IFS=','
369
 
        for arg in $args; do
370
 
          IFS="$save_ifs"
371
 
 
372
 
          # Double-quote args containing other shell metacharacters.
373
 
          # Many Bourne shells cannot handle close brackets correctly
374
 
          # in scan sets, so we specify it separately.
375
 
          case $arg in
376
 
            *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
377
 
            arg="\"$arg\""
378
 
            ;;
379
 
          esac
380
 
          lastarg="$lastarg $arg"
381
 
        done
382
 
        IFS="$save_ifs"
383
 
        lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
384
 
 
385
 
        # Add the arguments to base_compile.
386
 
        if test -z "$base_compile"; then
387
 
          base_compile="$lastarg"
388
 
        else
389
 
          base_compile="$base_compile $lastarg"
390
 
        fi
391
 
        continue
392
 
        ;;
393
 
      esac
394
 
 
395
 
      case $user_target in
396
 
      next)
397
 
        # The next one is the -o target name
398
 
        user_target=yes
399
 
        continue
400
 
        ;;
401
 
      yes)
402
 
        # We got the output file
403
 
        user_target=set
 
378
      case "$arg_mode" in
 
379
      arg  )
 
380
        # do not "continue".  Instead, add this to base_compile
 
381
        lastarg="$arg"
 
382
        arg_mode=normal
 
383
        ;;
 
384
 
 
385
      target )
404
386
        libobj="$arg"
 
387
        arg_mode=normal
405
388
        continue
406
389
        ;;
407
 
      esac
408
 
 
409
 
      # Accept the current argument as the source file.
410
 
      lastarg="$srcfile"
411
 
      srcfile="$arg"
 
390
 
 
391
      normal )
 
392
        # Accept any command-line options.
 
393
        case $arg in
 
394
        -o)
 
395
          if test -n "$libobj" ; then
 
396
            $echo "$modename: you cannot specify \`-o' more than once" 1>&2
 
397
            exit 1
 
398
          fi
 
399
          arg_mode=target
 
400
          continue
 
401
          ;;
 
402
 
 
403
        -static)
 
404
          build_old_libs=yes
 
405
          continue
 
406
          ;;
 
407
 
 
408
        -prefer-pic)
 
409
          pic_mode=yes
 
410
          continue
 
411
          ;;
 
412
 
 
413
        -prefer-non-pic)
 
414
          pic_mode=no
 
415
          continue
 
416
          ;;
 
417
 
 
418
        -Xcompiler)
 
419
          arg_mode=arg  #  the next one goes into the "base_compile" arg list
 
420
          continue      #  The current "srcfile" will either be retained or
 
421
          ;;            #  replaced later.  I would guess that would be a bug.
 
422
 
 
423
        -Wc,*)
 
424
          args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
 
425
          lastarg=
 
426
          save_ifs="$IFS"; IFS=','
 
427
          for arg in $args; do
 
428
            IFS="$save_ifs"
 
429
 
 
430
            # Double-quote args containing other shell metacharacters.
 
431
            # Many Bourne shells cannot handle close brackets correctly
 
432
            # in scan sets, so we specify it separately.
 
433
            case $arg in
 
434
              *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
 
435
              arg="\"$arg\""
 
436
              ;;
 
437
            esac
 
438
            lastarg="$lastarg $arg"
 
439
          done
 
440
          IFS="$save_ifs"
 
441
          lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
 
442
 
 
443
          # Add the arguments to base_compile.
 
444
          base_compile="$base_compile $lastarg"
 
445
          continue
 
446
          ;;
 
447
 
 
448
        * )
 
449
          # Accept the current argument as the source file.
 
450
          # The previous "srcfile" becomes the current argument.
 
451
          #
 
452
          lastarg="$srcfile"
 
453
          srcfile="$arg"
 
454
          ;;
 
455
        esac  #  case $arg
 
456
        ;;
 
457
      esac    #  case $arg_mode
412
458
 
413
459
      # Aesthetically quote the previous argument.
414
 
 
415
 
      # Backslashify any backslashes, double quotes, and dollar signs.
416
 
      # These are the only characters that are still specially
417
 
      # interpreted inside of double-quoted scrings.
418
460
      lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
419
461
 
 
462
      case $lastarg in
420
463
      # Double-quote args containing other shell metacharacters.
421
464
      # Many Bourne shells cannot handle close brackets correctly
422
465
      # in scan sets, so we specify it separately.
423
 
      case $lastarg in
424
466
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
425
467
        lastarg="\"$lastarg\""
426
468
        ;;
427
469
      esac
428
470
 
429
 
      # Add the previous argument to base_compile.
430
 
      if test -z "$base_compile"; then
431
 
        base_compile="$lastarg"
432
 
      else
433
 
        base_compile="$base_compile $lastarg"
434
 
      fi
435
 
    done
 
471
      base_compile="$base_compile $lastarg"
 
472
    done # for arg
436
473
 
437
 
    case $user_target in
438
 
    set)
439
 
      ;;
440
 
    no)
 
474
    case $arg_mode in
 
475
    arg)
 
476
      $echo "$modename: you must specify an argument for -Xcompile"
 
477
      exit 1
 
478
      ;;
 
479
    target)
 
480
      $echo "$modename: you must specify a target with \`-o'" 1>&2
 
481
      exit 1
 
482
      ;;
 
483
    *)
441
484
      # Get the name of the library object.
442
 
      libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
443
 
      ;;
444
 
    *)
445
 
      $echo "$modename: you must specify a target with \`-o'" 1>&2
446
 
      exit 1
 
485
      [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
447
486
      ;;
448
487
    esac
449
488
 
450
489
    # Recognize several different file suffixes.
451
490
    # If the user specifies -o file.o, it is replaced with file.lo
452
 
    xform='[cCFSfmso]'
 
491
    xform='[cCFSifmso]'
453
492
    case $libobj in
454
493
    *.ada) xform=ada ;;
455
494
    *.adb) xform=adb ;;
457
496
    *.asm) xform=asm ;;
458
497
    *.c++) xform=c++ ;;
459
498
    *.cc) xform=cc ;;
 
499
    *.ii) xform=ii ;;
460
500
    *.class) xform=class ;;
461
501
    *.cpp) xform=cpp ;;
462
502
    *.cxx) xform=cxx ;;
481
521
    # command doesn't match the default compiler.
482
522
    if test -n "$available_tags" && test -z "$tagname"; then
483
523
      case $base_compile in
484
 
      "$CC "*) ;;
485
524
      # Blanks in the command may have been stripped by the calling shell,
486
 
      # but not from the CC environment variable when ltconfig was run.
487
 
      "`$echo $CC` "*) ;;
 
525
      # but not from the CC environment variable when configure was run.
 
526
      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "*) ;;
 
527
      # Blanks at the start of $base_compile will cause this to fail
 
528
      # if we don't check for them as well.
488
529
      *)
489
 
        for z in $available_tags; do
490
 
          if grep "^### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
 
530
        for z in $available_tags; do
 
531
          if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
491
532
            # Evaluate the configuration.
492
 
            eval "`sed -n -e '/^### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
493
 
            case $base_compile in
494
 
            "$CC "*)
495
 
              # The compiler in the base compile command matches
496
 
              # the one in the tagged configuration.
497
 
              # Assume this is the tagged configuration we want.
498
 
              tagname=$z
499
 
              break
500
 
              ;;
501
 
            "`$echo $CC` "*)
 
533
            eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
 
534
            case "$base_compile " in
 
535
            "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)
 
536
              # The compiler in the base compile command matches
 
537
              # the one in the tagged configuration.
 
538
              # Assume this is the tagged configuration we want.
502
539
              tagname=$z
503
540
              break
504
541
              ;;
505
542
            esac
506
 
          fi
507
 
        done
508
 
        # If $tagname still isn't set, then no tagged configuration
509
 
        # was found and let the user know that the "--tag" command
510
 
        # line option must be used.
511
 
        if test -z "$tagname"; then
512
 
          echo "$modename: unable to infer tagged configuration"
513
 
          echo "$modename: specify a tag with \`--tag'" 1>&2
 
543
          fi
 
544
        done
 
545
        # If $tagname still isn't set, then no tagged configuration
 
546
        # was found and let the user know that the "--tag" command
 
547
        # line option must be used.
 
548
        if test -z "$tagname"; then
 
549
          $echo "$modename: unable to infer tagged configuration"
 
550
          $echo "$modename: specify a tag with \`--tag'" 1>&2
514
551
          exit 1
515
552
#        else
516
 
#          echo "$modename: using $tagname tagged configuration"
517
 
        fi
 
553
#          $echo "$modename: using $tagname tagged configuration"
 
554
        fi
518
555
        ;;
519
556
      esac
520
557
    fi
550
587
      pic_mode=default
551
588
      ;;
552
589
    esac
553
 
    if test $pic_mode = no && test "$deplibs_check_method" != pass_all; then
 
590
    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
554
591
      # non-PIC code in shared libraries is not supported
555
592
      pic_mode=default
556
593
    fi
577
614
      done
578
615
    elif test "$need_locks" = warn; then
579
616
      if test -f "$lockfile"; then
580
 
        echo "\
 
617
        $echo "\
581
618
*** ERROR, $lockfile exists and contains:
582
619
`cat $lockfile 2>/dev/null`
583
620
 
591
628
        $run $rm $removelist
592
629
        exit 1
593
630
      fi
594
 
      echo $srcfile > "$lockfile"
 
631
      $echo $srcfile > "$lockfile"
595
632
    fi
596
633
 
597
634
    if test -n "$fix_srcfile_path"; then
624
661
        command="$base_compile $srcfile"
625
662
      fi
626
663
 
627
 
      if test ! -d ${xdir}$objdir; then
 
664
      if test ! -d "${xdir}$objdir"; then
628
665
        $show "$mkdir ${xdir}$objdir"
629
666
        $run $mkdir ${xdir}$objdir
630
667
        status=$?
631
 
        if test $status -ne 0 && test ! -d ${xdir}$objdir; then
 
668
        if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then
632
669
          exit $status
633
 
        fi
634
 
      fi 
 
670
        fi
 
671
      fi
635
672
 
636
673
      if test -z "$output_obj"; then
637
 
        # Place PIC objects in $objdir
638
 
        command="$command -o $lobj"
 
674
        # Place PIC objects in $objdir
 
675
        command="$command -o $lobj"
639
676
      fi
640
677
 
641
678
      $run $rm "$lobj" "$output_obj"
648
685
      fi
649
686
 
650
687
      if test "$need_locks" = warn &&
651
 
         test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
652
 
        echo "\
 
688
         test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
 
689
        $echo "\
653
690
*** ERROR, $lockfile contains:
654
691
`cat $lockfile 2>/dev/null`
655
692
 
668
705
      fi
669
706
 
670
707
      # Just move the object if needed, then go on to compile the next one
671
 
      if test -n "$output_obj" && test "x$output_obj" != "x$lobj"; then
 
708
      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
672
709
        $show "$mv $output_obj $lobj"
673
710
        if $run $mv $output_obj $lobj; then :
674
711
        else
718
755
      fi
719
756
 
720
757
      if test "$need_locks" = warn &&
721
 
         test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
722
 
        echo "\
 
758
         test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
 
759
        $echo "\
723
760
*** ERROR, $lockfile contains:
724
761
`cat $lockfile 2>/dev/null`
725
762
 
738
775
      fi
739
776
 
740
777
      # Just move the object if needed
741
 
      if test -n "$output_obj" && test "x$output_obj" != "x$obj"; then
 
778
      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
742
779
        $show "$mv $output_obj $obj"
743
780
        if $run $mv $output_obj $obj; then :
744
781
        else
783
820
      # It is impossible to link a dll without this setting, and
784
821
      # we shouldn't force the makefile maintainer to figure out
785
822
      # which system we are compiling for in order to pass an extra
786
 
      # flag for every libtool invokation.
 
823
      # flag for every libtool invocation.
787
824
      # allow_undefined=no
788
825
 
789
826
      # FIXME: Unfortunately, there are problems with the above when trying
810
847
    old_convenience=
811
848
    deplibs=
812
849
    old_deplibs=
 
850
    add_flags=
813
851
    compiler_flags=
814
852
    linker_flags=
815
853
    dllsearchpath=
816
854
    lib_search_path=`pwd`
 
855
    inst_prefix_dir=
817
856
 
818
857
    avoid_version=no
819
858
    dlfiles=
840
879
    temp_rpath=
841
880
    thread_safe=no
842
881
    vinfo=
 
882
    vinfo_number=no
843
883
 
844
884
    # We need to know -static, to get the right output filenames.
845
885
    for arg
870
910
    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
871
911
 
872
912
    # Go through the arguments, transforming them on the way.
873
 
    while test $# -gt 0; do
 
913
    while test "$#" -gt 0; do
874
914
      arg="$1"
875
915
      base_compile="$base_compile $arg"
876
916
      shift
946
986
          prev=
947
987
          continue
948
988
          ;;
 
989
        inst_prefix)
 
990
          inst_prefix_dir="$arg"
 
991
          prev=
 
992
          continue
 
993
          ;;
949
994
        release)
950
995
          release="-$arg"
951
996
          prev=
953
998
          ;;
954
999
        objectlist)
955
1000
          if test -f "$arg"; then
956
 
            save_arg=$arg
 
1001
            save_arg=$arg
957
1002
            moreargs=
958
1003
            for fil in `cat $save_arg`
959
1004
            do
960
1005
#             moreargs="$moreargs $fil"
961
 
              arg=$fil
962
 
              # A libtool-controlled object.
 
1006
              arg=$fil
 
1007
              # A libtool-controlled object.
963
1008
 
964
1009
              # Check to see that this really is a libtool object.
965
 
              if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
966
 
                pic_object=
967
 
                non_pic_object=
968
 
 
969
 
                # Read the .lo file
970
 
                # If there is no directory component, then add one.
971
 
                case $arg in
972
 
                */* | *\\*) . $arg ;;
973
 
                *) . ./$arg ;;
974
 
                esac
975
 
 
976
 
                if test -z "$pic_object" || \
977
 
                   test -z "$non_pic_object" ||
978
 
                   test "$pic_object" = none && \
979
 
                   test "$non_pic_object" = none; then
980
 
                  $echo "$modename: cannot find name of object for \`$arg'" 1>&2
981
 
                  exit 1
982
 
                fi
983
 
 
984
 
                # Extract subdirectory from the argument.
985
 
                xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
986
 
                if test "X$xdir" = "X$arg"; then
987
 
                  xdir=
988
 
                else
989
 
                  xdir="$xdir/"
990
 
                fi
991
 
 
992
 
                if test "$pic_object" != none; then
993
 
                  # Prepend the subdirectory the object is found in.
994
 
                  pic_object="$xdir$pic_object"
995
 
 
996
 
                  if test "$prev" = dlfiles; then
997
 
                    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
998
 
                      dlfiles="$dlfiles $pic_object"
999
 
                      prev=
1000
 
                      continue
1001
 
                    else
1002
 
                      # If libtool objects are unsupported, then we need to preload.
1003
 
                      prev=dlprefiles
1004
 
                    fi
1005
 
                  fi
1006
 
 
1007
 
                  # CHECK ME:  I think I busted this.  -Ossama
1008
 
                  if test "$prev" = dlprefiles; then
1009
 
                    # Preload the old-style object.
1010
 
                    dlprefiles="$dlprefiles $pic_object"
1011
 
                    prev=
1012
 
                  fi
1013
 
 
1014
 
                  # A PIC object.
1015
 
                  libobjs="$libobjs $pic_object"
1016
 
                  arg="$pic_object"
1017
 
                fi
1018
 
 
1019
 
                # Non-PIC object.
1020
 
                if test "$non_pic_object" != none; then
1021
 
                  # Prepend the subdirectory the object is found in.
1022
 
                  non_pic_object="$xdir$non_pic_object"
1023
 
 
1024
 
                  # A standard non-PIC object
1025
 
                  non_pic_objects="$non_pic_objects $non_pic_object"
1026
 
                  if test -z "$pic_object" || test "$pic_object" = none ; then
1027
 
                    arg="$non_pic_object"
1028
 
                  fi
1029
 
                fi
1030
 
              else
1031
 
                # Only an error if not doing a dry-run.
1032
 
                if test -z "$run"; then
1033
 
                  $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1034
 
                  exit 1
1035
 
                else
1036
 
                  # Dry-run case.
1037
 
 
1038
 
                  # Extract subdirectory from the argument.
1039
 
                  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1040
 
                  if test "X$xdir" = "X$arg"; then
1041
 
                    xdir=
1042
 
                  else
1043
 
                    xdir="$xdir/"
1044
 
                  fi
1045
 
 
1046
 
                  pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1047
 
                  non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1048
 
                  libobjs="$libobjs $pic_object"
1049
 
                  non_pic_objects="$non_pic_objects $non_pic_object"
1050
 
                fi
 
1010
              if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
1011
                pic_object=
 
1012
                non_pic_object=
 
1013
 
 
1014
                # Read the .lo file
 
1015
                # If there is no directory component, then add one.
 
1016
                case $arg in
 
1017
                */* | *\\*) . $arg ;;
 
1018
                *) . ./$arg ;;
 
1019
                esac
 
1020
 
 
1021
                if test -z "$pic_object" || \
 
1022
                   test -z "$non_pic_object" ||
 
1023
                   test "$pic_object" = none && \
 
1024
                   test "$non_pic_object" = none; then
 
1025
                  $echo "$modename: cannot find name of object for \`$arg'" 1>&2
 
1026
                  exit 1
 
1027
                fi
 
1028
 
 
1029
                # Extract subdirectory from the argument.
 
1030
                xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
 
1031
                if test "X$xdir" = "X$arg"; then
 
1032
                  xdir=
 
1033
                else
 
1034
                  xdir="$xdir/"
 
1035
                fi
 
1036
 
 
1037
                if test "$pic_object" != none; then
 
1038
                  # Prepend the subdirectory the object is found in.
 
1039
                  pic_object="$xdir$pic_object"
 
1040
 
 
1041
                  if test "$prev" = dlfiles; then
 
1042
                    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
 
1043
                      dlfiles="$dlfiles $pic_object"
 
1044
                      prev=
 
1045
                      continue
 
1046
                    else
 
1047
                      # If libtool objects are unsupported, then we need to preload.
 
1048
                      prev=dlprefiles
 
1049
                    fi
 
1050
                  fi
 
1051
 
 
1052
                  # CHECK ME:  I think I busted this.  -Ossama
 
1053
                  if test "$prev" = dlprefiles; then
 
1054
                    # Preload the old-style object.
 
1055
                    dlprefiles="$dlprefiles $pic_object"
 
1056
                    prev=
 
1057
                  fi
 
1058
 
 
1059
                  # A PIC object.
 
1060
                  libobjs="$libobjs $pic_object"
 
1061
                  arg="$pic_object"
 
1062
                fi
 
1063
 
 
1064
                # Non-PIC object.
 
1065
                if test "$non_pic_object" != none; then
 
1066
                  # Prepend the subdirectory the object is found in.
 
1067
                  non_pic_object="$xdir$non_pic_object"
 
1068
 
 
1069
                  # A standard non-PIC object
 
1070
                  non_pic_objects="$non_pic_objects $non_pic_object"
 
1071
                  if test -z "$pic_object" || test "$pic_object" = none ; then
 
1072
                    arg="$non_pic_object"
 
1073
                  fi
 
1074
                fi
 
1075
              else
 
1076
                # Only an error if not doing a dry-run.
 
1077
                if test -z "$run"; then
 
1078
                  $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
 
1079
                  exit 1
 
1080
                else
 
1081
                  # Dry-run case.
 
1082
 
 
1083
                  # Extract subdirectory from the argument.
 
1084
                  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
 
1085
                  if test "X$xdir" = "X$arg"; then
 
1086
                    xdir=
 
1087
                  else
 
1088
                    xdir="$xdir/"
 
1089
                  fi
 
1090
 
 
1091
                  pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
 
1092
                  non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
 
1093
                  libobjs="$libobjs $pic_object"
 
1094
                  non_pic_objects="$non_pic_objects $non_pic_object"
 
1095
                fi
1051
1096
              fi
1052
1097
            done
1053
1098
          else
1054
1099
            $echo "$modename: link input file \`$save_arg' does not exist"
1055
1100
            exit 1
1056
1101
          fi
1057
 
          arg=$save_arg
 
1102
          arg=$save_arg
1058
1103
          prev=
1059
1104
          continue
1060
1105
          ;;
1096
1141
          finalize_command="$finalize_command $wl$qarg"
1097
1142
          continue
1098
1143
          ;;
 
1144
        xcclinker)
 
1145
          linker_flags="$linker_flags $qarg"
 
1146
          compiler_flags="$compiler_flags $qarg"
 
1147
          prev=
 
1148
          compile_command="$compile_command $qarg"
 
1149
          finalize_command="$finalize_command $qarg"
 
1150
          continue
 
1151
          ;;
 
1152
        framework)
 
1153
          case $host in
 
1154
            *-*-darwin*)
 
1155
              case "$deplibs " in
 
1156
                *" $qarg.ltframework "*) ;;
 
1157
                *) deplibs="$deplibs $qarg.ltframework" # this is fixed later
 
1158
                   ;;
 
1159
              esac
 
1160
              ;;
 
1161
          esac
 
1162
          prev=
 
1163
          continue
 
1164
          ;;
1099
1165
        *)
1100
1166
          eval "$prev=\"\$arg\""
1101
1167
          prev=
1102
1168
          continue
1103
1169
          ;;
1104
1170
        esac
1105
 
      fi
 
1171
      fi # test -n "$prev"
1106
1172
 
1107
1173
      prevarg="$arg"
1108
1174
 
1143
1209
 
1144
1210
      -export-symbols | -export-symbols-regex)
1145
1211
        if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1146
 
          $echo "$modename: not more than one -exported-symbols argument allowed"
 
1212
          $echo "$modename: more than one -exported-symbols argument is not allowed"
1147
1213
          exit 1
1148
1214
        fi
1149
1215
        if test "X$arg" = "X-export-symbols"; then
1154
1220
        continue
1155
1221
        ;;
1156
1222
 
 
1223
      -inst-prefix-dir)
 
1224
        prev=inst_prefix
 
1225
        continue
 
1226
        ;;
 
1227
 
1157
1228
      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1158
1229
      # so, if we see these flags be careful not to treat them like -L
1159
1230
      -L[A-Z][A-Z]*:*)
1160
1231
        case $with_gcc/$host in
1161
 
        no/*-*-irix*)
 
1232
        no/*-*-irix* | /*-*-irix*)
1162
1233
          compile_command="$compile_command $arg"
1163
1234
          finalize_command="$finalize_command $arg"
1164
1235
          ;;
1165
1236
        esac
1166
1237
        continue
1167
1238
        ;;
1168
 
       
 
1239
 
1169
1240
      -L*)
1170
1241
        dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1171
1242
        # We need an absolute path.
1199
1270
        ;;
1200
1271
 
1201
1272
      -l*)
1202
 
        if test "$arg" = "-lc"; then
1203
 
          case $host in
1204
 
          *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
1205
 
            # These systems don't actually have c library (as such)
1206
 
            continue
1207
 
            ;;
1208
 
          *-*-rhapsody* | *-*-darwin1.[012])
1209
 
            # Rhapsody C library is in the System framework
1210
 
            deplibs="$deplibs -framework System"
1211
 
            continue
1212
 
            ;;
1213
 
          esac
1214
 
        elif test "$arg" = "-lm"; then
 
1273
        if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1215
1274
          case $host in
1216
1275
          *-*-cygwin* | *-*-pw32* | *-*-beos*)
1217
 
            # These systems don't actually have math library (as such)
 
1276
            # These systems don't actually have a C or math library (as such)
1218
1277
            continue
1219
1278
            ;;
 
1279
          *-*-freebsd*-gnu*)
 
1280
            # prevent being parsed by the freebsd regexp below
 
1281
            ;;
 
1282
          *-*-mingw* | *-*-os2*)
 
1283
            # These systems don't actually have a C library (as such)
 
1284
            test "X$arg" = "X-lc" && continue
 
1285
            ;;
 
1286
          *-*-openbsd* | *-*-freebsd*)
 
1287
            # Do not include libc due to us having libc/libc_r.
 
1288
            test "X$arg" = "X-lc" && continue
 
1289
            ;;
1220
1290
          *-*-rhapsody* | *-*-darwin1.[012])
1221
 
            # Rhapsody math library is in the System framework
1222
 
            deplibs="$deplibs -framework System"
 
1291
            # Rhapsody C and math libraries are in the System framework
 
1292
            deplibs="$deplibs System.ltframework"
1223
1293
            continue
1224
 
            ;;
1225
1294
          esac
 
1295
        elif test "X$arg" = "X-lc_r"; then
 
1296
         case $host in
 
1297
         *-*-freebsd*-gnu*)
 
1298
           # prevent being parsed by the freebsd regexp below
 
1299
           ;;
 
1300
         *-*-openbsd*)
 
1301
           # Do not include libc_r directly, use -pthread flag.
 
1302
           continue
 
1303
           ;;
 
1304
         esac
1226
1305
        fi
1227
1306
        deplibs="$deplibs $arg"
1228
1307
        continue
1233
1312
        continue
1234
1313
        ;;
1235
1314
 
 
1315
      # gcc -m* arguments should be passed to the linker via $compiler_flags
 
1316
      # in order to pass architecture information to the linker
 
1317
      # (e.g. 32 vs 64-bit).  This may also be accomplished via -Wl,-mfoo
 
1318
      # but this is not reliable with gcc because gcc may use -mfoo to
 
1319
      # select a different linker, different libraries, etc, while
 
1320
      # -Wl,-mfoo simply passes -mfoo to the linker.
 
1321
      -m*)
 
1322
        # Unknown arguments in both finalize_command and compile_command need
 
1323
        # to be aesthetically quoted because they are evaled later.
 
1324
        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
 
1325
        case $arg in
 
1326
        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
 
1327
          arg="\"$arg\""
 
1328
          ;;
 
1329
        esac
 
1330
        compile_command="$compile_command $arg"
 
1331
        finalize_command="$finalize_command $arg"
 
1332
        if test "$with_gcc" = "yes" ; then
 
1333
          compiler_flags="$compiler_flags $arg"
 
1334
        fi
 
1335
        continue
 
1336
        ;;
 
1337
 
 
1338
      -shrext)
 
1339
        prev=shrext
 
1340
        continue
 
1341
        ;;
 
1342
 
1236
1343
      -no-fast-install)
1237
1344
        fast_install=no
1238
1345
        continue
1247
1354
          $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1248
1355
          fast_install=no
1249
1356
          ;;
1250
 
        *)
1251
 
          no_install=yes
1252
 
          ;;
 
1357
        *) no_install=yes ;;
1253
1358
        esac
1254
1359
        continue
1255
1360
        ;;
1299
1404
        ;;
1300
1405
 
1301
1406
      -static)
1302
 
        # The effects of -static are defined in a previous loop.
 
1407
        # The effects of -static are defined in a previous loop.
1303
1408
        # We used to do the same as -all-static on platforms that
1304
1409
        # didn't have a PIC flag, but the assumption that the effects
1305
1410
        # would be equivalent was wrong.  It would break on at least
1316
1421
        prev=vinfo
1317
1422
        continue
1318
1423
        ;;
 
1424
      -version-number)
 
1425
        prev=vinfo
 
1426
        vinfo_number=yes
 
1427
        continue
 
1428
        ;;
1319
1429
 
1320
1430
      -Wc,*)
1321
1431
        args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1322
1432
        arg=
1323
 
        IFS="${IFS=     }"; save_ifs="$IFS"; IFS=','
 
1433
        save_ifs="$IFS"; IFS=','
1324
1434
        for flag in $args; do
1325
1435
          IFS="$save_ifs"
1326
1436
          case $flag in
1338
1448
      -Wl,*)
1339
1449
        args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1340
1450
        arg=
1341
 
        IFS="${IFS=     }"; save_ifs="$IFS"; IFS=','
 
1451
        save_ifs="$IFS"; IFS=','
1342
1452
        for flag in $args; do
1343
1453
          IFS="$save_ifs"
1344
1454
          case $flag in
1364
1474
        continue
1365
1475
        ;;
1366
1476
 
 
1477
      -XCClinker)
 
1478
        prev=xcclinker
 
1479
        continue
 
1480
        ;;
 
1481
 
 
1482
      -framework)
 
1483
        prev=framework
 
1484
        continue
 
1485
        ;;
 
1486
 
1367
1487
      # Some other compiler flag.
1368
1488
      -* | +*)
1369
1489
        # Unknown arguments in both finalize_command and compile_command need
1374
1494
          arg="\"$arg\""
1375
1495
          ;;
1376
1496
        esac
 
1497
        add_flags="$add_flags $arg"
1377
1498
        ;;
1378
1499
 
1379
1500
      *.$objext)
1385
1506
        # A libtool-controlled object.
1386
1507
 
1387
1508
        # Check to see that this really is a libtool object.
1388
 
        if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1389
 
          pic_object=
1390
 
          non_pic_object=
1391
 
 
1392
 
          # Read the .lo file
1393
 
          # If there is no directory component, then add one.
1394
 
          case $arg in
1395
 
          */* | *\\*) . $arg ;;
1396
 
          *) . ./$arg ;;
1397
 
          esac
1398
 
 
1399
 
          if test -z "$pic_object" || \
1400
 
             test -z "$non_pic_object" ||
1401
 
             test "$pic_object" = none && \
1402
 
             test "$non_pic_object" = none; then
1403
 
            $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1404
 
            exit 1
1405
 
          fi
 
1509
        if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
1510
          pic_object=
 
1511
          non_pic_object=
 
1512
 
 
1513
          # Read the .lo file
 
1514
          # If there is no directory component, then add one.
 
1515
          case $arg in
 
1516
          */* | *\\*) . $arg ;;
 
1517
          *) . ./$arg ;;
 
1518
          esac
 
1519
 
 
1520
          if test -z "$pic_object" || \
 
1521
             test -z "$non_pic_object" ||
 
1522
             test "$pic_object" = none && \
 
1523
             test "$non_pic_object" = none; then
 
1524
            $echo "$modename: cannot find name of object for \`$arg'" 1>&2
 
1525
            exit 1
 
1526
          fi
1406
1527
 
1407
1528
          # Extract subdirectory from the argument.
1408
1529
          xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1409
1530
          if test "X$xdir" = "X$arg"; then
1410
1531
            xdir=
1411
 
          else
 
1532
          else
1412
1533
            xdir="$xdir/"
1413
1534
          fi
1414
1535
 
1415
 
          if test "$pic_object" != none; then
1416
 
            # Prepend the subdirectory the object is found in.
 
1536
          if test "$pic_object" != none; then
 
1537
            # Prepend the subdirectory the object is found in.
1417
1538
            pic_object="$xdir$pic_object"
1418
1539
 
1419
1540
            if test "$prev" = dlfiles; then
1420
1541
              if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1421
 
                dlfiles="$dlfiles $pic_object"
1422
 
                prev=
1423
 
                continue
 
1542
                dlfiles="$dlfiles $pic_object"
 
1543
                prev=
 
1544
                continue
1424
1545
              else
1425
 
                # If libtool objects are unsupported, then we need to preload.
1426
 
                prev=dlprefiles
 
1546
                # If libtool objects are unsupported, then we need to preload.
 
1547
                prev=dlprefiles
1427
1548
              fi
1428
1549
            fi
1429
1550
 
1430
1551
            # CHECK ME:  I think I busted this.  -Ossama
1431
 
            if test "$prev" = dlprefiles; then
 
1552
            if test "$prev" = dlprefiles; then
1432
1553
              # Preload the old-style object.
1433
1554
              dlprefiles="$dlprefiles $pic_object"
1434
1555
              prev=
1435
 
            fi
 
1556
            fi
1436
1557
 
1437
 
            # A PIC object.
 
1558
            # A PIC object.
1438
1559
            libobjs="$libobjs $pic_object"
1439
1560
            arg="$pic_object"
1440
 
          fi
 
1561
          fi
1441
1562
 
1442
 
          # Non-PIC object.
1443
 
          if test "$non_pic_object" != none; then
1444
 
            # Prepend the subdirectory the object is found in.
 
1563
          # Non-PIC object.
 
1564
          if test "$non_pic_object" != none; then
 
1565
            # Prepend the subdirectory the object is found in.
1445
1566
            non_pic_object="$xdir$non_pic_object"
1446
1567
 
1447
 
            # A standard non-PIC object
1448
 
            non_pic_objects="$non_pic_objects $non_pic_object"
1449
 
            if test -z "$pic_object" || test "$pic_object" = none ; then
1450
 
              arg="$non_pic_object"
1451
 
            fi
1452
 
          fi
1453
 
        else
1454
 
          # Only an error if not doing a dry-run.
1455
 
          if test -z "$run"; then
1456
 
            $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1457
 
            exit 1
1458
 
          else
1459
 
            # Dry-run case.
 
1568
            # A standard non-PIC object
 
1569
            non_pic_objects="$non_pic_objects $non_pic_object"
 
1570
            if test -z "$pic_object" || test "$pic_object" = none ; then
 
1571
              arg="$non_pic_object"
 
1572
            fi
 
1573
          fi
 
1574
        else
 
1575
          # Only an error if not doing a dry-run.
 
1576
          if test -z "$run"; then
 
1577
            $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
 
1578
            exit 1
 
1579
          else
 
1580
            # Dry-run case.
1460
1581
 
1461
1582
            # Extract subdirectory from the argument.
1462
1583
            xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1466
1587
              xdir="$xdir/"
1467
1588
            fi
1468
1589
 
1469
 
            pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1470
 
            non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
 
1590
            pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
 
1591
            non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1471
1592
            libobjs="$libobjs $pic_object"
1472
 
            non_pic_objects="$non_pic_objects $non_pic_object"
1473
 
          fi
 
1593
            non_pic_objects="$non_pic_objects $non_pic_object"
 
1594
          fi
1474
1595
        fi
1475
1596
        ;;
1476
1597
 
1508
1629
          arg="\"$arg\""
1509
1630
          ;;
1510
1631
        esac
 
1632
        add_flags="$add_flags $arg"
1511
1633
        ;;
1512
 
      esac
 
1634
      esac # arg
1513
1635
 
1514
1636
      # Now actually substitute the argument into the commands.
1515
1637
      if test -n "$arg"; then
1516
1638
        compile_command="$compile_command $arg"
1517
1639
        finalize_command="$finalize_command $arg"
1518
1640
      fi
1519
 
    done
 
1641
    done # argument parsing loop
1520
1642
 
1521
1643
    if test -n "$prev"; then
1522
1644
      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1530
1652
    # command doesn't match the default compiler.
1531
1653
    if test -n "$available_tags" && test -z "$tagname"; then
1532
1654
      case $base_compile in
1533
 
      "$CC "*) ;;
1534
1655
      # Blanks in the command may have been stripped by the calling shell,
1535
 
      # but not from the CC environment variable when ltconfig was run.
1536
 
      "`$echo $CC` "*) ;;
 
1656
      # but not from the CC environment variable when configure was run.
 
1657
      "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) ;;
 
1658
      # Blanks at the start of $base_compile will cause this to fail
 
1659
      # if we don't check for them as well.
1537
1660
      *)
1538
 
        for z in $available_tags; do
1539
 
          if grep "^### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
 
1661
        for z in $available_tags; do
 
1662
          if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
1540
1663
            # Evaluate the configuration.
1541
 
            eval "`sed -n -e '/^### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
1542
 
            case $base_compile in
1543
 
            "$CC "*)
1544
 
              # The compiler in $compile_command matches
1545
 
              # the one in the tagged configuration.
1546
 
              # Assume this is the tagged configuration we want.
1547
 
              tagname=$z
1548
 
              break
1549
 
              ;;
1550
 
            "`$echo $CC` "*)
 
1664
            eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
 
1665
            case $base_compile in
 
1666
            "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)
 
1667
              # The compiler in $compile_command matches
 
1668
              # the one in the tagged configuration.
 
1669
              # Assume this is the tagged configuration we want.
1551
1670
              tagname=$z
1552
1671
              break
1553
1672
              ;;
1554
1673
            esac
1555
 
          fi
1556
 
        done
1557
 
        # If $tagname still isn't set, then no tagged configuration
1558
 
        # was found and let the user know that the "--tag" command
1559
 
        # line option must be used.
1560
 
        if test -z "$tagname"; then
1561
 
          echo "$modename: unable to infer tagged configuration"
1562
 
          echo "$modename: specify a tag with \`--tag'" 1>&2
 
1674
          fi
 
1675
        done
 
1676
        # If $tagname still isn't set, then no tagged configuration
 
1677
        # was found and let the user know that the "--tag" command
 
1678
        # line option must be used.
 
1679
        if test -z "$tagname"; then
 
1680
          $echo "$modename: unable to infer tagged configuration"
 
1681
          $echo "$modename: specify a tag with \`--tag'" 1>&2
1563
1682
          exit 1
1564
1683
#       else
1565
 
#         echo "$modename: using $tagname tagged configuration"
1566
 
        fi
 
1684
#         $echo "$modename: using $tagname tagged configuration"
 
1685
        fi
1567
1686
        ;;
1568
1687
      esac
1569
1688
    fi
1595
1714
      output_objdir="$output_objdir/$objdir"
1596
1715
    fi
1597
1716
    # Create the object directory.
1598
 
    if test ! -d $output_objdir; then
 
1717
    if test ! -d "$output_objdir"; then
1599
1718
      $show "$mkdir $output_objdir"
1600
1719
      $run $mkdir $output_objdir
1601
1720
      status=$?
1602
 
      if test $status -ne 0 && test ! -d $output_objdir; then
 
1721
      if test "$status" -ne 0 && test ! -d "$output_objdir"; then
1603
1722
        exit $status
1604
1723
      fi
1605
1724
    fi
1617
1736
    *) linkmode=prog ;; # Anything else should be a program.
1618
1737
    esac
1619
1738
 
 
1739
    case $host in
 
1740
    *cygwin* | *mingw* | *pw32*)
 
1741
      # don't eliminate duplcations in $postdeps and $predeps
 
1742
      duplicate_compiler_generated_deps=yes
 
1743
      ;;
 
1744
    *)
 
1745
      duplicate_compiler_generated_deps=$duplicate_deps
 
1746
      ;;
 
1747
    esac
1620
1748
    specialdeplibs=
 
1749
 
1621
1750
    libs=
1622
1751
    # Find all interdependent deplibs by searching for libraries
1623
1752
    # that are linked more than once (e.g. -la -lb -la)
1624
1753
    for deplib in $deplibs; do
1625
 
      case "$libs " in
1626
 
      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1627
 
      esac
 
1754
      if test "X$duplicate_deps" = "Xyes" ; then
 
1755
        case "$libs " in
 
1756
        *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
 
1757
        esac
 
1758
      fi
1628
1759
      libs="$libs $deplib"
1629
1760
    done
1630
1761
 
1631
 
    if test $linkmode = lib; then
 
1762
    if test "$linkmode" = lib; then
1632
1763
      libs="$predeps $libs $compiler_lib_search_path $postdeps"
 
1764
 
 
1765
      # Compute libraries that are listed more than once in $predeps
 
1766
      # $postdeps and mark them as special (i.e., whose duplicates are
 
1767
      # not to be eliminated).
 
1768
      pre_post_deps=
 
1769
      if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
 
1770
        for pre_post_dep in $predeps $postdeps; do
 
1771
          case "$pre_post_deps " in
 
1772
          *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
 
1773
          esac
 
1774
          pre_post_deps="$pre_post_deps $pre_post_dep"
 
1775
        done
 
1776
      fi
 
1777
      pre_post_deps=
1633
1778
    fi
1634
1779
 
1635
1780
    deplibs=
1636
1781
    newdependency_libs=
1637
1782
    newlib_search_path=
1638
1783
    need_relink=no # whether we're linking any uninstalled libtool libraries
1639
 
    uninst_deplibs= # uninstalled libtool libraries
1640
 
    uninst_path= # paths that contain uninstalled libtool libraries
 
1784
    notinst_deplibs= # not-installed libtool libraries
 
1785
    notinst_path= # paths that contain not-installed libtool libraries
1641
1786
    case $linkmode in
1642
1787
    lib)
1643
1788
        passes="conv link"
1659
1804
        newdlprefiles=
1660
1805
        passes="conv scan dlopen dlpreopen link"
1661
1806
        ;;
1662
 
    *)  passes="conv"
 
1807
    *)  passes="conv"
1663
1808
        ;;
1664
1809
    esac
1665
1810
    for pass in $passes; do
1668
1813
        libs="$deplibs"
1669
1814
        deplibs=
1670
1815
      fi
1671
 
      if test $linkmode = prog; then
 
1816
      if test "$linkmode" = prog; then
1672
1817
        case $pass in
1673
1818
        dlopen) libs="$dlfiles" ;;
1674
1819
        dlpreopen) libs="$dlprefiles" ;;
1675
1820
        link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
1676
1821
        esac
1677
1822
      fi
1678
 
      if test $pass = dlopen; then
 
1823
      if test "$pass" = dlopen; then
1679
1824
        # Collect dlpreopened libraries
1680
1825
        save_deplibs="$deplibs"
1681
1826
        deplibs=
1685
1830
        found=no
1686
1831
        case $deplib in
1687
1832
        -l*)
1688
 
          if test $linkmode != lib && test $linkmode != prog; then
 
1833
          if test "$linkmode" != lib && test "$linkmode" != prog; then
1689
1834
            $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
1690
1835
            continue
1691
1836
          fi
1692
 
          if test $pass = conv; then
 
1837
          if test "$pass" = conv && test "$allow_undefined" = yes; then
1693
1838
            deplibs="$deplib $deplibs"
1694
1839
            continue
1695
1840
          fi
1696
1841
          name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
1697
1842
          for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
1698
 
            # Search the libtool library
1699
 
            lib="$searchdir/lib${name}.la"
1700
 
            if test -f "$lib"; then
1701
 
              found=yes
1702
 
              break
1703
 
            fi
 
1843
            for search_ext in .la $shrext .so .a; do
 
1844
              # Search the libtool library
 
1845
              lib="$searchdir/lib${name}${search_ext}"
 
1846
              if test -f "$lib"; then
 
1847
                if test "$search_ext" = ".la"; then
 
1848
                  found=yes
 
1849
                else
 
1850
                  found=no
 
1851
                fi
 
1852
                break 2
 
1853
              fi
 
1854
            done
1704
1855
          done
1705
1856
          if test "$found" != yes; then
 
1857
            # deplib doesn't seem to be a libtool library
1706
1858
            if test "$linkmode,$pass" = "prog,link"; then
1707
1859
              compile_deplibs="$deplib $compile_deplibs"
1708
1860
              finalize_deplibs="$deplib $finalize_deplibs"
1709
1861
            else
1710
1862
              deplibs="$deplib $deplibs"
1711
 
              test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs"
 
1863
              test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
1712
1864
            fi
1713
1865
            continue
1714
 
          fi
 
1866
          else # deplib is a libtool library
 
1867
            # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
 
1868
            # We need to do some special things here, and not later.
 
1869
            if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
1870
              case " $predeps $postdeps " in
 
1871
              *" $deplib "*)
 
1872
                if (${SED} -e '2q' $lib |
 
1873
                    grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
1874
                  library_names=
 
1875
                  old_library=
 
1876
                  case $lib in
 
1877
                  */* | *\\*) . $lib ;;
 
1878
                  *) . ./$lib ;;
 
1879
                  esac
 
1880
                  for l in $old_library $library_names; do
 
1881
                    ll="$l"
 
1882
                  done
 
1883
                  if test "X$ll" = "X$old_library" ; then # only static version available
 
1884
                    found=no
 
1885
                    ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
 
1886
                    test "X$ladir" = "X$lib" && ladir="."
 
1887
                    lib=$ladir/$old_library
 
1888
                    if test "$linkmode,$pass" = "prog,link"; then
 
1889
                      compile_deplibs="$deplib $compile_deplibs"
 
1890
                      finalize_deplibs="$deplib $finalize_deplibs"
 
1891
                    else
 
1892
                      deplibs="$deplib $deplibs"
 
1893
                      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
 
1894
                    fi
 
1895
                    continue
 
1896
                  fi
 
1897
                fi
 
1898
                ;;
 
1899
              *) ;;
 
1900
              esac
 
1901
            fi
 
1902
          fi
 
1903
          ;; # -l
 
1904
        *.ltframework)
 
1905
          if test "$linkmode,$pass" = "prog,link"; then
 
1906
            compile_deplibs="$deplib $compile_deplibs"
 
1907
            finalize_deplibs="$deplib $finalize_deplibs"
 
1908
          else
 
1909
            deplibs="$deplib $deplibs"
 
1910
            if test "$linkmode" = lib ; then
 
1911
              newdependency_libs="$deplib $newdependency_libs"
 
1912
            fi
 
1913
          fi
 
1914
          continue
1715
1915
          ;;
1716
1916
        -L*)
1717
1917
          case $linkmode in
1718
1918
          lib)
1719
1919
            deplibs="$deplib $deplibs"
1720
 
            test $pass = conv && continue
 
1920
            test "$pass" = conv && continue
1721
1921
            newdependency_libs="$deplib $newdependency_libs"
1722
1922
            newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1723
1923
            ;;
1724
1924
          prog)
1725
 
            if test $pass = conv; then
 
1925
            if test "$pass" = conv; then
1726
1926
              deplibs="$deplib $deplibs"
1727
1927
              continue
1728
1928
            fi
1729
 
            if test $pass = scan; then
 
1929
            if test "$pass" = scan; then
1730
1930
              deplibs="$deplib $deplibs"
1731
1931
              newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1732
1932
            else
1737
1937
          *)
1738
1938
            $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
1739
1939
            ;;
1740
 
          esac
 
1940
          esac # linkmode
1741
1941
          continue
1742
 
          ;;
 
1942
          ;; # -L
1743
1943
        -R*)
1744
 
          if test $pass = link; then
 
1944
          if test "$pass" = link; then
1745
1945
            dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1746
1946
            # Make sure the xrpath contains only unique directories.
1747
1947
            case "$xrpath " in
1754
1954
          ;;
1755
1955
        *.la) lib="$deplib" ;;
1756
1956
        *.$libext)
1757
 
          if test $pass = conv; then
 
1957
          if test "$pass" = conv; then
1758
1958
            deplibs="$deplib $deplibs"
1759
1959
            continue
1760
1960
          fi
1761
1961
          case $linkmode in
1762
1962
          lib)
1763
1963
            if test "$deplibs_check_method" != pass_all; then
1764
 
              echo
1765
 
              echo "*** Warning: This library needs some functionality provided by $deplib."
1766
 
              echo "*** I have the capability to make that library automatically link in when"
1767
 
              echo "*** you link to this library.  But I can only do this if you have a"
1768
 
              echo "*** shared version of the library, which you do not appear to have."
 
1964
              $echo
 
1965
              $echo "*** Warning: Trying to link with static lib archive $deplib."
 
1966
              $echo "*** I have the capability to make that library automatically link in when"
 
1967
              $echo "*** you link to this library.  But I can only do this if you have a"
 
1968
              $echo "*** shared version of the library, which you do not appear to have"
 
1969
              $echo "*** because the file extensions .$libext of this argument makes me believe"
 
1970
              $echo "*** that it is just a static archive that I should not used here."
1769
1971
            else
1770
 
              echo
1771
 
              echo "*** Warning: Linking the shared library $output against the"
1772
 
              echo "*** static library $deplib is not portable!"
 
1972
              $echo
 
1973
              $echo "*** Warning: Linking the shared library $output against the"
 
1974
              $echo "*** static library $deplib is not portable!"
1773
1975
              deplibs="$deplib $deplibs"
1774
1976
            fi
1775
1977
            continue
1776
1978
            ;;
1777
1979
          prog)
1778
 
            if test $pass != link; then
 
1980
            if test "$pass" != link; then
1779
1981
              deplibs="$deplib $deplibs"
1780
1982
            else
1781
1983
              compile_deplibs="$deplib $compile_deplibs"
1783
1985
            fi
1784
1986
            continue
1785
1987
            ;;
1786
 
          esac
1787
 
          ;;
 
1988
          esac # linkmode
 
1989
          ;; # *.$libext
1788
1990
        *.lo | *.$objext)
1789
 
          if test $pass = conv; then
 
1991
          if test "$pass" = conv; then
1790
1992
            deplibs="$deplib $deplibs"
1791
 
          elif test $linkmode = prog; then
1792
 
            if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
 
1993
          elif test "$linkmode" = prog; then
 
1994
            if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1793
1995
              # If there is no dlopen support or we're linking statically,
1794
1996
              # we need to preload.
1795
1997
              newdlprefiles="$newdlprefiles $deplib"
1805
2007
          alldeplibs=yes
1806
2008
          continue
1807
2009
          ;;
1808
 
        esac
1809
 
        if test $found = yes || test -f "$lib"; then :
 
2010
        esac # case $deplib
 
2011
        if test "$found" = yes || test -f "$lib"; then :
1810
2012
        else
1811
2013
          $echo "$modename: cannot find the library \`$lib'" 1>&2
1812
2014
          exit 1
1813
2015
        fi
1814
2016
 
1815
2017
        # Check to see that this really is a libtool archive.
1816
 
        if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
 
2018
        if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1817
2019
        else
1818
2020
          $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
1819
2021
          exit 1
1829
2031
        library_names=
1830
2032
        old_library=
1831
2033
        # If the library was installed with an old release of libtool,
1832
 
        # it will not redefine variable installed.
 
2034
        # it will not redefine variables installed, or shouldnotlink
1833
2035
        installed=yes
 
2036
        shouldnotlink=no
1834
2037
 
1835
2038
        # Read the .la file
1836
2039
        case $lib in
1838
2041
        *) . ./$lib ;;
1839
2042
        esac
1840
2043
 
 
2044
        case $host in
 
2045
        *-*-darwin*)
 
2046
          # Convert "-framework foo" to "foo.ltframework" in dependency_libs
 
2047
          test -n "$dependency_libs" && dependency_libs=`$echo "X$dependency_libs" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'`
 
2048
          ;;
 
2049
        esac
 
2050
 
1841
2051
        if test "$linkmode,$pass" = "lib,link" ||
1842
2052
           test "$linkmode,$pass" = "prog,scan" ||
1843
 
           { test $linkmode != prog && test $linkmode != lib; }; then
 
2053
           { test "$linkmode" != prog && test "$linkmode" != lib; }; then
1844
2054
          test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
1845
2055
          test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
1846
2056
        fi
1847
2057
 
1848
 
        if test $pass = conv; then
1849
 
          # only check for convenience libraries
 
2058
        if test "$pass" = conv; then
 
2059
          # Only check for convenience libraries
1850
2060
          deplibs="$lib $deplibs"
 
2061
          tmp_libs=
 
2062
          for deplib in $dependency_libs; do
 
2063
            #echo "Adding $deplib to \$deplibs"
 
2064
            deplibs="$deplib $deplibs"
 
2065
            if test "X$duplicate_deps" = "Xyes" ; then
 
2066
              case "$tmp_libs " in
 
2067
              *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
 
2068
              esac
 
2069
            fi
 
2070
            tmp_libs="$tmp_libs $deplib"
 
2071
          done
1851
2072
          if test -z "$libdir"; then
1852
2073
            if test -z "$old_library"; then
1853
2074
              $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1856
2077
            # It is a libtool convenience library, so add in its objects.
1857
2078
            convenience="$convenience $ladir/$objdir/$old_library"
1858
2079
            old_convenience="$old_convenience $ladir/$objdir/$old_library"
1859
 
            tmp_libs=
1860
 
            for deplib in $dependency_libs; do
1861
 
              deplibs="$deplib $deplibs"
1862
 
              case "$tmp_libs " in
1863
 
              *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1864
 
              esac
1865
 
              tmp_libs="$tmp_libs $deplib"
1866
 
            done
1867
 
          elif test $linkmode != prog && test $linkmode != lib; then
 
2080
          elif test "$linkmode" != prog && test "$linkmode" != lib; then
1868
2081
            $echo "$modename: \`$lib' is not a convenience library" 1>&2
1869
2082
            exit 1
1870
2083
          fi
1871
2084
          continue
1872
 
        fi
 
2085
        fi # $pass = conv
1873
2086
 
 
2087
    
1874
2088
        # Get the name of the library we link against.
1875
2089
        linklib=
1876
2090
        for l in $old_library $library_names; do
1882
2096
        fi
1883
2097
 
1884
2098
        # This library was specified with -dlopen.
1885
 
        if test $pass = dlopen; then
 
2099
        if test "$pass" = dlopen; then
1886
2100
          if test -z "$libdir"; then
1887
2101
            $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
1888
2102
            exit 1
1897
2111
            newdlfiles="$newdlfiles $lib"
1898
2112
          fi
1899
2113
          continue
1900
 
        fi
 
2114
        fi # $pass = dlopen
1901
2115
 
1902
2116
        # We need an absolute path.
1903
2117
        case $ladir in
1928
2142
          dir="$ladir/$objdir"
1929
2143
          absdir="$abs_ladir/$objdir"
1930
2144
          # Remove this search path later
1931
 
          uninst_path="$uninst_path $abs_ladir"
1932
 
        fi
 
2145
          notinst_path="$notinst_path $abs_ladir"
 
2146
        fi # $installed = yes
1933
2147
        name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
1934
2148
 
1935
2149
        # This library was specified with -dlpreopen.
1936
 
        if test $pass = dlpreopen; then
 
2150
        if test "$pass" = dlpreopen; then
1937
2151
          if test -z "$libdir"; then
1938
2152
            $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
1939
2153
            exit 1
1948
2162
          else
1949
2163
            newdlprefiles="$newdlprefiles $dir/$linklib"
1950
2164
          fi
1951
 
        fi
 
2165
        fi # $pass = dlpreopen
1952
2166
 
1953
2167
        if test -z "$libdir"; then
1954
 
          # link the convenience library
1955
 
          if test $linkmode = lib; then
 
2168
          # Link the convenience library
 
2169
          if test "$linkmode" = lib; then
1956
2170
            deplibs="$dir/$old_library $deplibs"
1957
2171
          elif test "$linkmode,$pass" = "prog,link"; then
1958
2172
            compile_deplibs="$dir/$old_library $compile_deplibs"
1963
2177
          continue
1964
2178
        fi
1965
2179
 
1966
 
        if test $linkmode = prog && test $pass != link; then
 
2180
    
 
2181
        if test "$linkmode" = prog && test "$pass" != link; then
1967
2182
          newlib_search_path="$newlib_search_path $ladir"
1968
2183
          deplibs="$lib $deplibs"
1969
2184
 
1979
2194
            -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
1980
2195
            esac
1981
2196
            # Need to link against all dependency_libs?
1982
 
            if test $linkalldeplibs = yes; then
 
2197
            if test "$linkalldeplibs" = yes; then
1983
2198
              deplibs="$deplib $deplibs"
1984
2199
            else
1985
2200
              # Need to hardcode shared library paths
1986
2201
              # or/and link against static libraries
1987
2202
              newdependency_libs="$deplib $newdependency_libs"
1988
2203
            fi
1989
 
            case "$tmp_libs " in
1990
 
            *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1991
 
            esac
 
2204
            if test "X$duplicate_deps" = "Xyes" ; then
 
2205
              case "$tmp_libs " in
 
2206
              *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
 
2207
              esac
 
2208
            fi
1992
2209
            tmp_libs="$tmp_libs $deplib"
1993
 
          done
 
2210
          done # for deplib
1994
2211
          continue
1995
 
        fi
 
2212
        fi # $linkmode = prog...
1996
2213
 
1997
2214
        if test "$linkmode,$pass" = "prog,link"; then
1998
2215
          if test -n "$library_names" &&
2019
2236
              esac
2020
2237
              ;;
2021
2238
            esac
2022
 
 
2023
2239
            case " $sys_lib_dlsearch_path " in
2024
2240
            *" $libdir "*) ;;
2025
2241
            *)
2029
2245
              esac
2030
2246
              ;;
2031
2247
            esac
2032
 
          fi
 
2248
          fi # $linkmode,$pass = prog,link...
2033
2249
 
2034
2250
          if test "$alldeplibs" = yes &&
2035
2251
             { test "$deplibs_check_method" = pass_all ||
2044
2260
        if test -n "$library_names" &&
2045
2261
           { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2046
2262
          if test "$installed" = no; then
2047
 
            uninst_deplibs="$uninst_deplibs $lib"
 
2263
            notinst_deplibs="$notinst_deplibs $lib"
2048
2264
            need_relink=yes
2049
2265
          fi
2050
2266
          # This is a shared library
2051
 
          if test $linkmode = lib && test "$hardcode_into_libs" = all; then
 
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"
 
2275
            fi
 
2276
            $echo "*** $linklib is not portable!"    
 
2277
      fi          
 
2278
          if test "$linkmode" = lib &&
 
2279
             test "$hardcode_into_libs" = yes; then
2052
2280
            # Hardcode the library path.
2053
2281
            # Skip directories that are in the system default run-time
2054
2282
            # search path.
2084
2312
            elif test -n "$soname_spec"; then
2085
2313
              # bleh windows
2086
2314
              case $host in
2087
 
              *cygwin*)
 
2315
              *cygwin* | mingw*)
2088
2316
                major=`expr $current - $age`
2089
2317
                versuffix="-$major"
2090
2318
                ;;
2096
2324
 
2097
2325
            # Make a new name for the extract_expsyms_cmds to use
2098
2326
            soroot="$soname"
2099
 
            soname=`echo $soroot | sed -e 's/^.*\///'`
2100
 
            newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a"
 
2327
            soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
 
2328
            newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
2101
2329
 
2102
2330
            # If the library has no export list, then create one now
2103
2331
            if test -f "$output_objdir/$soname-def"; then :
2104
2332
            else
2105
2333
              $show "extracting exported symbol list from \`$soname'"
2106
 
              IFS="${IFS=       }"; save_ifs="$IFS"; IFS='~'
 
2334
              save_ifs="$IFS"; IFS='~'
2107
2335
              eval cmds=\"$extract_expsyms_cmds\"
2108
2336
              for cmd in $cmds; do
2109
2337
                IFS="$save_ifs"
2116
2344
            # Create $newlib
2117
2345
            if test -f "$output_objdir/$newlib"; then :; else
2118
2346
              $show "generating import library for \`$soname'"
2119
 
              IFS="${IFS=       }"; save_ifs="$IFS"; IFS='~'
 
2347
              save_ifs="$IFS"; IFS='~'
2120
2348
              eval cmds=\"$old_archive_from_expsyms_cmds\"
2121
2349
              for cmd in $cmds; do
2122
2350
                IFS="$save_ifs"
2128
2356
            # make sure the library variables are pointing to the new library
2129
2357
            dir=$output_objdir
2130
2358
            linklib=$newlib
2131
 
          fi
 
2359
          fi # test -n "$old_archive_from_expsyms_cmds"
2132
2360
 
2133
 
          if test $linkmode = prog || test "$mode" != relink; then
 
2361
          if test "$linkmode" = prog || test "$mode" != relink; then
2134
2362
            add_shlibpath=
2135
2363
            add_dir=
2136
2364
            add=
2139
2367
            immediate | unsupported)
2140
2368
              if test "$hardcode_direct" = no; then
2141
2369
                add="$dir/$linklib"
 
2370
                case $host in
 
2371
                  *-*-sco3.2v5* ) add_dir="-L$dir" ;;
 
2372
                  *-*-darwin* )
 
2373
                    # if the lib is a module then we can not link against it, someone
 
2374
                    # is ignoring the new warnings I added
 
2375
                    if /usr/bin/file -L $add 2> /dev/null | grep "bundle" >/dev/null ; then
 
2376
                      $echo "** Warning, lib $linklib is a module, not a shared library"
 
2377
                      if test -z "$old_library" ; then
 
2378
                        $echo
 
2379
                        $echo "** And there doesn't seem to be a static archive available"
 
2380
                        $echo "** The link will probably fail, sorry"
 
2381
                      else
 
2382
                        add="$dir/$old_library"
 
2383
                      fi 
 
2384
                    fi
 
2385
                esac
2142
2386
              elif test "$hardcode_minus_L" = no; then
2143
2387
                case $host in
2144
2388
                *-*-sunos*) add_shlibpath="$dir" ;;
2157
2401
                add="$dir/$linklib"
2158
2402
              elif test "$hardcode_minus_L" = yes; then
2159
2403
                add_dir="-L$dir"
 
2404
                # Try looking first in the location we're being installed to.
 
2405
                if test -n "$inst_prefix_dir"; then
 
2406
                  case "$libdir" in
 
2407
                    [\\/]*)
 
2408
                      add_dir="-L$inst_prefix_dir$libdir $add_dir"
 
2409
                      ;;
 
2410
                  esac
 
2411
                fi
2160
2412
                add="-l$name"
2161
2413
              elif test "$hardcode_shlibpath_var" = yes; then
2162
2414
                add_shlibpath="$dir"
2179
2431
              *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
2180
2432
              esac
2181
2433
            fi
2182
 
            if test $linkmode = prog; then
 
2434
            if test "$linkmode" = prog; then
2183
2435
              test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
2184
2436
              test -n "$add" && compile_deplibs="$add $compile_deplibs"
2185
2437
            else
2196
2448
            fi
2197
2449
          fi
2198
2450
 
2199
 
          if test $linkmode = prog || test "$mode" = relink; then
 
2451
          if test "$linkmode" = prog || test "$mode" = relink; then
2200
2452
            add_shlibpath=
2201
2453
            add_dir=
2202
2454
            add=
2212
2464
              *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2213
2465
              esac
2214
2466
              add="-l$name"
 
2467
            elif test "$hardcode_automatic" = yes; then
 
2468
              if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then
 
2469
                add="$inst_prefix_dir$libdir/$linklib"
 
2470
              else
 
2471
                add="$libdir/$linklib"
 
2472
              fi
2215
2473
            else
2216
2474
              # We cannot seem to hardcode it, guess we'll fake it.
2217
2475
              add_dir="-L$libdir"
 
2476
              # Try looking first in the location we're being installed to.
 
2477
              if test -n "$inst_prefix_dir"; then
 
2478
                case "$libdir" in
 
2479
                  [\\/]*)
 
2480
                    add_dir="-L$inst_prefix_dir$libdir $add_dir"
 
2481
                    ;;
 
2482
                esac
 
2483
              fi
2218
2484
              add="-l$name"
2219
2485
            fi
2220
2486
 
2221
 
            if test $linkmode = prog; then
 
2487
            if test "$linkmode" = prog; then
2222
2488
              test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
2223
2489
              test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
2224
2490
            else
2226
2492
              test -n "$add" && deplibs="$add $deplibs"
2227
2493
            fi
2228
2494
          fi
2229
 
        elif test $linkmode = prog; then
 
2495
        elif test "$linkmode" = prog; then
2230
2496
          # Here we assume that one of hardcode_direct or hardcode_minus_L
2231
2497
          # is not unsupported.  This is valid on all known static and
2232
2498
          # shared platforms.
2243
2509
          if test "$deplibs_check_method" != pass_all; then
2244
2510
            # We're trying link a shared library against a static one
2245
2511
            # but the system doesn't support it.
 
2512
 
2246
2513
            # Just print a warning and add the library to dependency_libs so
2247
2514
            # that the program can be linked against the static library.
2248
 
            echo
2249
 
            echo "*** Warning: This library needs some functionality provided by $lib."
2250
 
            echo "*** I have the capability to make that library automatically link in when"
2251
 
            echo "*** you link to this library.  But I can only do this if you have a"
2252
 
            echo "*** shared version of the library, which you do not appear to have."
 
2515
            $echo
 
2516
            $echo "*** Warning: This system can not link to static lib archive $lib."
 
2517
            $echo "*** I have the capability to make that library automatically link in when"
 
2518
            $echo "*** you link to this library.  But I can only do this if you have a"
 
2519
            $echo "*** shared version of the library, which you do not appear to have."
 
2520
            if test "$module" = yes; then
 
2521
              $echo "*** But as you try to build a module library, libtool will still create "
 
2522
              $echo "*** a static module, that should work as long as the dlopening application"
 
2523
              $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
 
2524
              if test -z "$global_symbol_pipe"; then
 
2525
                $echo
 
2526
                $echo "*** However, this would only work if libtool was able to extract symbol"
 
2527
                $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
 
2528
                $echo "*** not find such a program.  So, this module is probably useless."
 
2529
                $echo "*** \`nm' from GNU binutils and a full rebuild may help."
 
2530
              fi
 
2531
              if test "$build_old_libs" = no; then
 
2532
                build_libtool_libs=module
 
2533
                build_old_libs=yes
 
2534
              else
 
2535
                build_libtool_libs=no
 
2536
              fi
 
2537
            fi
2253
2538
          else
2254
2539
            convenience="$convenience $dir/$old_library"
2255
2540
            old_convenience="$old_convenience $dir/$old_library"
2256
2541
            deplibs="$dir/$old_library $deplibs"
2257
2542
            link_static=yes
2258
2543
          fi
2259
 
        fi
 
2544
        fi # link shared/static library?
2260
2545
 
2261
 
        if test $linkmode = lib; then
2262
 
          if test -n "$dependency_libs" &&
2263
 
             { test $hardcode_into_libs != yes || test $build_old_libs = yes ||
2264
 
               test $link_static = yes; }; then
 
2546
        if test "$linkmode" = lib; then
 
2547
          #if test -n "$dependency_libs" &&
 
2548
          #   { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes ||
 
2549
          #     test "$link_static" = yes; }; then
2265
2550
            # Extract -R from dependency_libs
2266
2551
            temp_deplibs=
2267
2552
            for libdir in $dependency_libs; do
2275
2560
              esac
2276
2561
            done
2277
2562
            dependency_libs="$temp_deplibs"
2278
 
          fi
 
2563
          #fi
2279
2564
 
2280
2565
          newlib_search_path="$newlib_search_path $absdir"
2281
2566
          # Link against this library
2284
2569
          tmp_libs=
2285
2570
          for deplib in $dependency_libs; do
2286
2571
            newdependency_libs="$deplib $newdependency_libs"
2287
 
            case "$tmp_libs " in
2288
 
            *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2289
 
            esac
 
2572
            if test "X$duplicate_deps" = "Xyes" ; then
 
2573
              case "$tmp_libs " in
 
2574
              *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
 
2575
              esac
 
2576
            fi
2290
2577
            tmp_libs="$tmp_libs $deplib"
2291
2578
          done
2292
2579
 
2293
 
          if test $link_all_deplibs != no; then
 
2580
          if test "$link_all_deplibs" != no; then
2294
2581
            # Add the search paths of all dependency libraries
2295
2582
            for deplib in $dependency_libs; do
2296
2583
              case $deplib in
2310
2597
                  ;;
2311
2598
                esac
2312
2599
                if grep "^installed=no" $deplib > /dev/null; then
2313
 
                  path="-L$absdir/$objdir"
 
2600
                  path="$absdir/$objdir"
2314
2601
                else
2315
 
                  eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
 
2602
                  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2316
2603
                  if test -z "$libdir"; then
2317
2604
                    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2318
2605
                    exit 1
2319
2606
                  fi
2320
2607
                  if test "$absdir" != "$libdir"; then
2321
 
                    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
 
2608
                    # Sure, some shells/systems don't implement the -ef.
 
2609
                    # Those will have to live with the warning.
 
2610
                    test "$absdir" -ef "$libdir" > /dev/null 2>&1 ||
 
2611
                      $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2322
2612
                  fi
2323
 
                  path="-L$absdir"
 
2613
                  path="$absdir"
2324
2614
                fi
2325
 
                ;;
 
2615
                depdepl=
 
2616
                case $host in
 
2617
                *-*-darwin*)
 
2618
                  # we do not want to link against static libs, but need to link against shared
 
2619
                  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
 
2620
                  if test -n "$deplibrary_names" ; then
 
2621
                    for tmp in $deplibrary_names ; do
 
2622
                      depdepl=$tmp
 
2623
                    done
 
2624
                    if test -f "$path/$depdepl" ; then
 
2625
                      depdepl="$path/$depdepl"
 
2626
                   fi
 
2627
                    # do not add paths which are already there
 
2628
                    case " $newlib_search_path " in
 
2629
                    *" $path "*) ;;
 
2630
                    *) newlib_search_path="$newlib_search_path $path";;
 
2631
                    esac
 
2632
                    path=""
 
2633
                  fi
 
2634
                  ;;
 
2635
                *)
 
2636
                path="-L$path"
 
2637
                ;;
 
2638
                esac 
 
2639
                
 
2640
                ;;
 
2641
                  -l*)
 
2642
                case $host in
 
2643
                *-*-darwin*)
 
2644
                 # Again, we only want to link against shared libraries
 
2645
                 eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
 
2646
                 for tmp in $newlib_search_path ; do
 
2647
                     if test -f "$tmp/lib$tmp_libs.dylib" ; then
 
2648
                       eval depdepl="$tmp/lib$tmp_libs.dylib"
 
2649
                       break
 
2650
                     fi  
 
2651
         done
 
2652
         path=""
 
2653
                  ;;
 
2654
                *) continue ;;
 
2655
                esac              
 
2656
                ;;
 
2657
 
 
2658
              *.ltframework)
 
2659
                case $host in
 
2660
                  *-*-darwin*)
 
2661
                    depdepl="$deplib"
 
2662
                    ;;
 
2663
                esac
 
2664
                ;;
 
2665
 
2326
2666
              *) continue ;;
2327
2667
              esac
2328
2668
              case " $deplibs " in
 
2669
              *" $depdepl "*) ;;
 
2670
              *) deplibs="$deplibs $depdepl" ;;
 
2671
              esac            
 
2672
              case " $deplibs " in
2329
2673
              *" $path "*) ;;
2330
 
              *) deplibs="$path $deplibs" ;;
 
2674
              *) deplibs="$deplibs $path" ;;
2331
2675
              esac
2332
2676
            done
2333
 
          fi
2334
 
        fi
2335
 
      done
 
2677
          fi # link_all_deplibs != no
 
2678
        fi # linkmode = lib
 
2679
      done # for deplib in $libs
2336
2680
      dependency_libs="$newdependency_libs"
2337
 
      if test $pass = dlpreopen; then
 
2681
      if test "$pass" = dlpreopen; then
2338
2682
        # Link the dlpreopened libraries before other libraries
2339
2683
        for deplib in $save_deplibs; do
2340
2684
          deplibs="$deplib $deplibs"
2341
2685
        done
2342
2686
      fi
2343
 
      if test $pass != dlopen; then
2344
 
        if test $pass != conv; then
 
2687
      if test "$pass" != dlopen; then
 
2688
        if test "$pass" != conv; then
2345
2689
          # Make sure lib_search_path contains only unique directories.
2346
2690
          lib_search_path=
2347
2691
          for dir in $newlib_search_path; do
2359
2703
          vars="compile_deplibs finalize_deplibs"
2360
2704
        fi
2361
2705
        for var in $vars dependency_libs; do
2362
 
          # Make sure that $var contains only unique libraries
2363
 
          # and add them in reverse order
 
2706
          # Add libraries to $var in reverse order
2364
2707
          eval tmp_libs=\"\$$var\"
2365
2708
          new_libs=
2366
2709
          for deplib in $tmp_libs; do
2367
 
            case "$deplib" in
 
2710
            # FIXME: Pedantically, this is the right thing to do, so
 
2711
            #        that some nasty dependency loop isn't accidentally
 
2712
            #        broken:
 
2713
            #new_libs="$deplib $new_libs"
 
2714
            # Pragmatically, this seems to cause very few problems in
 
2715
            # practice:
 
2716
            case $deplib in
2368
2717
            -L*) new_libs="$deplib $new_libs" ;;
 
2718
            -R*) ;;
2369
2719
            *)
 
2720
              # And here is the reason: when a library appears more
 
2721
              # than once as an explicit dependence of a library, or
 
2722
              # is implicitly linked in more than once by the
 
2723
              # compiler, it is considered special, and multiple
 
2724
              # occurrences thereof are not removed.  Compare this
 
2725
              # with having the same library being listed as a
 
2726
              # dependency of multiple other libraries: in this case,
 
2727
              # we know (pedantically, we assume) the library does not
 
2728
              # need to be listed more than once, so we keep only the
 
2729
              # last copy.  This is not always right, but it is rare
 
2730
              # enough that we require users that really mean to play
 
2731
              # such unportable linking tricks to link the library
 
2732
              # using -Wl,-lname, so that libtool does not consider it
 
2733
              # for duplicate removal.
2370
2734
              case " $specialdeplibs " in
2371
2735
              *" $deplib "*) new_libs="$deplib $new_libs" ;;
2372
2736
              *)
2392
2756
            esac
2393
2757
          done
2394
2758
          eval $var=\"$tmp_libs\"
2395
 
        done
 
2759
        done # for var
2396
2760
      fi
2397
 
    done
2398
 
    if test $linkmode = prog; then
 
2761
      # Last step: remove runtime libs from dependency_libs (they stay in deplibs)
 
2762
      tmp_libs=
 
2763
      for i in $dependency_libs ; do
 
2764
        case " $predeps $postdeps $compiler_lib_search_path " in
 
2765
        *" $i "*)
 
2766
          i=""
 
2767
          ;;
 
2768
        esac
 
2769
        if test -n "$i" ; then
 
2770
          tmp_libs="$tmp_libs $i"
 
2771
        fi
 
2772
      done
 
2773
      dependency_libs=$tmp_libs
 
2774
    done # for pass
 
2775
    if test "$linkmode" = prog; then
2399
2776
      dlfiles="$newdlfiles"
2400
2777
      dlprefiles="$newdlprefiles"
2401
2778
    fi
2419
2796
      fi
2420
2797
 
2421
2798
      if test -n "$vinfo"; then
2422
 
        $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
 
2799
        $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
2423
2800
      fi
2424
2801
 
2425
2802
      if test -n "$release"; then
2441
2818
      case $outputname in
2442
2819
      lib*)
2443
2820
        name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
 
2821
        eval shared_ext=\"$shrext\"
2444
2822
        eval libname=\"$libname_spec\"
2445
2823
        ;;
2446
2824
      *)
2452
2830
        if test "$need_lib_prefix" != no; then
2453
2831
          # Add the "lib" prefix for modules if required
2454
2832
          name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
 
2833
          eval shared_ext=\"$shrext\"
2455
2834
          eval libname=\"$libname_spec\"
2456
2835
        else
2457
2836
          libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2464
2843
          $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
2465
2844
          exit 1
2466
2845
        else
2467
 
          echo
2468
 
          echo "*** Warning: Linking the shared library $output against the non-libtool"
2469
 
          echo "*** objects $objs is not portable!"
 
2846
          $echo
 
2847
          $echo "*** Warning: Linking the shared library $output against the non-libtool"
 
2848
          $echo "*** objects $objs is not portable!"
2470
2849
          libobjs="$libobjs $objs"
2471
2850
        fi
2472
2851
      fi
2476
2855
      fi
2477
2856
 
2478
2857
      set dummy $rpath
2479
 
      if test $# -gt 2; then
 
2858
      if test "$#" -gt 2; then
2480
2859
        $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
2481
2860
      fi
2482
2861
      install_libdir="$2"
2486
2865
        if test "$build_libtool_libs" = yes; then
2487
2866
          # Building a libtool convenience library.
2488
2867
          # Some compilers have problems with a `.al' extension so
2489
 
          # convenience libraries should have the same extension an
2490
 
          # archive normally would.
 
2868
          # convenience libraries should have the same extension an
 
2869
          # archive normally would.
2491
2870
          oldlibs="$output_objdir/$libname.$libext $oldlibs"
2492
2871
          build_libtool_libs=convenience
2493
2872
          build_old_libs=yes
2494
2873
        fi
2495
2874
 
2496
2875
        if test -n "$vinfo"; then
2497
 
          $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
 
2876
          $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
2498
2877
        fi
2499
2878
 
2500
2879
        if test -n "$release"; then
2503
2882
      else
2504
2883
 
2505
2884
        # Parse the version information argument.
2506
 
        IFS="${IFS=     }"; save_ifs="$IFS"; IFS=':'
 
2885
        save_ifs="$IFS"; IFS=':'
2507
2886
        set dummy $vinfo 0 0 0
2508
2887
        IFS="$save_ifs"
2509
2888
 
2513
2892
          exit 1
2514
2893
        fi
2515
2894
 
2516
 
        current="$2"
2517
 
        revision="$3"
2518
 
        age="$4"
 
2895
        # convert absolute version numbers to libtool ages
 
2896
        # this retains compatibility with .la files and attempts
 
2897
        # to make the code below a bit more comprehensible
 
2898
        
 
2899
        case $vinfo_number in
 
2900
        yes)
 
2901
          number_major="$2"
 
2902
          number_minor="$3"
 
2903
          number_revision="$4"
 
2904
          #
 
2905
          # There are really only two kinds -- those that
 
2906
          # use the current revision as the major version
 
2907
          # and those that subtract age and use age as
 
2908
          # a minor version.  But, then there is irix
 
2909
          # which has an extra 1 added just for fun
 
2910
          #
 
2911
          case $version_type in
 
2912
          darwin|linux|osf|windows)
 
2913
            current=`expr $number_major + $number_minor`
 
2914
            age="$number_minor"
 
2915
            revision="$number_revision"
 
2916
            ;;
 
2917
          freebsd-aout|freebsd-elf|sunos)
 
2918
            current="$number_major"
 
2919
            revision="$number_minor"
 
2920
            age="0"
 
2921
            ;;
 
2922
          irix|nonstopux)
 
2923
            current=`expr $number_major + $number_minor - 1`
 
2924
            age="$number_minor"
 
2925
            revision="$number_minor"
 
2926
            ;;
 
2927
          esac
 
2928
          ;;
 
2929
        no)
 
2930
          current="$2"
 
2931
          revision="$3"
 
2932
          age="$4"
 
2933
          ;;
 
2934
        esac
2519
2935
 
2520
2936
        # Check that each of the things are valid numbers.
2521
2937
        case $current in
2522
 
        0 | [1-9] | [1-9][0-9]*) ;;
 
2938
        0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2523
2939
        *)
2524
2940
          $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
2525
2941
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2528
2944
        esac
2529
2945
 
2530
2946
        case $revision in
2531
 
        0 | [1-9] | [1-9][0-9]*) ;;
 
2947
        0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2532
2948
        *)
2533
2949
          $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
2534
2950
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2537
2953
        esac
2538
2954
 
2539
2955
        case $age in
2540
 
        0 | [1-9] | [1-9][0-9]*) ;;
 
2956
        0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2541
2957
        *)
2542
2958
          $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
2543
2959
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2545
2961
          ;;
2546
2962
        esac
2547
2963
 
2548
 
        if test $age -gt $current; then
 
2964
        if test "$age" -gt "$current"; then
2549
2965
          $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
2550
2966
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2551
2967
          exit 1
2578
2994
          versuffix=".$current";
2579
2995
          ;;
2580
2996
 
2581
 
        irix)
 
2997
        irix | nonstopux)
2582
2998
          major=`expr $current - $age + 1`
2583
 
          verstring="sgi$major.$revision"
 
2999
 
 
3000
          case $version_type in
 
3001
            nonstopux) verstring_prefix=nonstopux ;;
 
3002
            *)         verstring_prefix=sgi ;;
 
3003
          esac
 
3004
          verstring="$verstring_prefix$major.$revision"
2584
3005
 
2585
3006
          # Add in all the interfaces that we are compatible with.
2586
3007
          loop=$revision
2587
 
          while test $loop != 0; do
 
3008
          while test "$loop" -ne 0; do
2588
3009
            iface=`expr $revision - $loop`
2589
3010
            loop=`expr $loop - 1`
2590
 
            verstring="sgi$major.$iface:$verstring"
 
3011
            verstring="$verstring_prefix$major.$iface:$verstring"
2591
3012
          done
2592
3013
 
2593
3014
          # Before this point, $major must not contain `.'.
2601
3022
          ;;
2602
3023
 
2603
3024
        osf)
2604
 
          major=`expr $current - $age`
 
3025
          major=.`expr $current - $age`
2605
3026
          versuffix=".$current.$age.$revision"
2606
3027
          verstring="$current.$age.$revision"
2607
3028
 
2608
3029
          # Add in all the interfaces that we are compatible with.
2609
3030
          loop=$age
2610
 
          while test $loop != 0; do
 
3031
          while test "$loop" -ne 0; do
2611
3032
            iface=`expr $current - $loop`
2612
3033
            loop=`expr $loop - 1`
2613
3034
            verstring="$verstring:${iface}.0"
2631
3052
 
2632
3053
        *)
2633
3054
          $echo "$modename: unknown library version type \`$version_type'" 1>&2
2634
 
          echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
 
3055
          $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
2635
3056
          exit 1
2636
3057
          ;;
2637
3058
        esac
2639
3060
        # Clear the version info if we defaulted, and they specified a release.
2640
3061
        if test -z "$vinfo" && test -n "$release"; then
2641
3062
          major=
2642
 
          verstring="0.0"
 
3063
          case $version_type in
 
3064
          darwin)
 
3065
            # we can't check for "0.0" in archive_cmds due to quoting
 
3066
            # problems, so we reset it completely
 
3067
            verstring=
 
3068
            ;;
 
3069
          *)
 
3070
            verstring="0.0"
 
3071
            ;;
 
3072
          esac
2643
3073
          if test "$need_version" = no; then
2644
3074
            versuffix=
2645
3075
          else
2669
3099
 
2670
3100
      if test "$mode" != relink; then
2671
3101
        # Remove our outputs, but don't remove object files since they
2672
 
        # may have been created when compiling PIC objects.
2673
 
        removelist=
2674
 
        tempremovelist=`echo "$output_objdir/*"`
 
3102
        # may have been created when compiling PIC objects.
 
3103
        removelist=
 
3104
        tempremovelist=`$echo "$output_objdir/*"`
2675
3105
        for p in $tempremovelist; do
2676
 
          case $p in
2677
 
            *.$objext)
2678
 
               ;;
2679
 
            $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
2680
 
               removelist="$removelist $p"
2681
 
               ;;
2682
 
            *) ;;
2683
 
          esac
2684
 
        done
2685
 
        if test -n "$removelist"; then
 
3106
          case $p in
 
3107
            *.$objext)
 
3108
               ;;
 
3109
            $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
 
3110
               removelist="$removelist $p"
 
3111
               ;;
 
3112
            *) ;;
 
3113
          esac
 
3114
        done
 
3115
        if test -n "$removelist"; then
2686
3116
          $show "${rm}r $removelist"
2687
3117
          $run ${rm}r $removelist
2688
 
        fi
 
3118
        fi
2689
3119
      fi
2690
3120
 
2691
3121
      # Now set the variables for building old libraries.
2697
3127
      fi
2698
3128
 
2699
3129
      # Eliminate all temporary directories.
2700
 
      for path in $uninst_path; do
2701
 
        lib_search_path=`echo "$lib_search_path " | sed -e 's% $path % %g'`
2702
 
        deplibs=`echo "$deplibs " | sed -e 's% -L$path % %g'`
2703
 
        dependency_libs=`echo "$dependency_libs " | sed -e 's% -L$path % %g'`
 
3130
      for path in $notinst_path; do
 
3131
        lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
 
3132
        deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
 
3133
        dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
2704
3134
      done
2705
3135
 
2706
3136
      if test -n "$xrpath"; then
2713
3143
          *) finalize_rpath="$finalize_rpath $libdir" ;;
2714
3144
          esac
2715
3145
        done
2716
 
        if test $hardcode_into_libs != yes || test $build_old_libs = yes; then
 
3146
        if true || test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
2717
3147
          dependency_libs="$temp_xrpath $dependency_libs"
2718
3148
        fi
2719
3149
      fi
2746
3176
            ;;
2747
3177
          *-*-rhapsody* | *-*-darwin1.[012])
2748
3178
            # Rhapsody C library is in the System framework
2749
 
            deplibs="$deplibs -framework System"
2750
 
            ;;
2751
 
          *)
2752
 
            # Add libc to deplibs on all other systems if necessary.
2753
 
            if test $build_libtool_need_lc = "yes"; then
2754
 
              deplibs="$deplibs -lc"
2755
 
            fi
 
3179
            deplibs="$deplibs System.ltframework"
 
3180
            ;;
 
3181
          *-*-netbsd*)
 
3182
            # Don't link with libc until the a.out ld.so is fixed.
 
3183
            ;;
 
3184
          *-*-freebsd*-gnu*)
 
3185
            # Prevent $arg from being parsed by the freebsd regexp below.
 
3186
            if test "$build_libtool_need_lc" = "yes"; then
 
3187
              deplibs="$deplibs -lc"
 
3188
            fi
 
3189
            ;;
 
3190
          *-*-openbsd* | *-*-freebsd*)
 
3191
            # Do not include libc due to us having libc/libc_r.
 
3192
            test "X$arg" = "X-lc" && continue
 
3193
            ;;
 
3194
          *)
 
3195
            # Add libc to deplibs on all other systems if necessary.
 
3196
            if test "$build_libtool_need_lc" = "yes"; then
 
3197
              deplibs="$deplibs -lc"
 
3198
            fi
2756
3199
            ;;
2757
3200
          esac
2758
3201
        fi
2777
3220
          # This might be a little naive.  We might want to check
2778
3221
          # whether the library exists or not.  But this is on
2779
3222
          # osf3 & osf4 and I'm not really sure... Just
2780
 
          # implementing what was already the behaviour.
 
3223
          # implementing what was already the behavior.
2781
3224
          newdeplibs=$deplibs
2782
3225
          ;;
2783
3226
        test_compile)
2791
3234
EOF
2792
3235
          $rm conftest
2793
3236
          $LTCC -o conftest conftest.c $deplibs
2794
 
          if test $? -eq 0 ; then
 
3237
          if test "$?" -eq 0 ; then
2795
3238
            ldd_output=`ldd conftest`
2796
3239
            for i in $deplibs; do
2797
3240
              name="`expr $i : '-l\(.*\)'`"
2798
3241
              # If $name is empty we are operating on a -L argument.
2799
 
              if test "$name" != "" -a "$name" != "0"; then
2800
 
                libname=`eval \\$echo \"$libname_spec\"`
2801
 
                deplib_matches=`eval \\$echo \"$library_names_spec\"`
2802
 
                set dummy $deplib_matches
2803
 
                deplib_match=$2
2804
 
                if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2805
 
                  newdeplibs="$newdeplibs $i"
2806
 
                else
2807
 
                  droppeddeps=yes
2808
 
                  echo
2809
 
                  echo "*** Warning: This library needs some functionality provided by $i."
2810
 
                  echo "*** I have the capability to make that library automatically link in when"
2811
 
                  echo "*** you link to this library.  But I can only do this if you have a"
2812
 
                  echo "*** shared version of the library, which you do not appear to have."
2813
 
                fi
2814
 
              else
2815
 
                newdeplibs="$newdeplibs $i"
2816
 
              fi
2817
 
            done
2818
 
          else
2819
 
            # Error occured in the first compile.  Let's try to salvage the situation:
2820
 
            # Compile a seperate program for each library.
2821
 
            for i in $deplibs; do
2822
 
              name="`expr $i : '-l\(.*\)'`"
2823
 
             # If $name is empty we are operating on a -L argument.
2824
 
              if test "$name" != "" -a "$name" != "0"; then
2825
 
                $rm conftest
2826
 
                $LTCC -o conftest conftest.c $i
2827
 
                # Did it work?
2828
 
                if test $? -eq 0 ; then
2829
 
                  ldd_output=`ldd conftest`
 
3242
              if test "$name" != "" && test "$name" -ne "0"; then
 
3243
                if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
3244
                  case " $predeps $postdeps " in
 
3245
                  *" $i "*)
 
3246
                    newdeplibs="$newdeplibs $i"
 
3247
                    i=""
 
3248
                    ;;
 
3249
                  esac
 
3250
                fi
 
3251
                if test -n "$i" ; then
2830
3252
                  libname=`eval \\$echo \"$libname_spec\"`
2831
3253
                  deplib_matches=`eval \\$echo \"$library_names_spec\"`
2832
3254
                  set dummy $deplib_matches
2835
3257
                    newdeplibs="$newdeplibs $i"
2836
3258
                  else
2837
3259
                    droppeddeps=yes
2838
 
                    echo
2839
 
                    echo "*** Warning: This library needs some functionality provided by $i."
2840
 
                    echo "*** I have the capability to make that library automatically link in when"
2841
 
                    echo "*** you link to this library.  But I can only do this if you have a"
2842
 
                    echo "*** shared version of the library, which you do not appear to have."
 
3260
                    $echo
 
3261
                    $echo "*** Warning: dynamic linker does not accept needed library $i."
 
3262
                    $echo "*** I have the capability to make that library automatically link in when"
 
3263
                    $echo "*** you link to this library.  But I can only do this if you have a"
 
3264
                    $echo "*** shared version of the library, which I believe you do not have"
 
3265
                    $echo "*** because a test_compile did reveal that the linker did not use it for"
 
3266
                    $echo "*** its dynamic dependency list that programs get resolved with at runtime."
 
3267
                  fi
 
3268
                fi
 
3269
              else
 
3270
                newdeplibs="$newdeplibs $i"
 
3271
              fi
 
3272
            done
 
3273
          else
 
3274
            # Error occurred in the first compile.  Let's try to salvage
 
3275
            # the situation: Compile a separate program for each library.
 
3276
            for i in $deplibs; do
 
3277
              name="`expr $i : '-l\(.*\)'`"
 
3278
              # If $name is empty we are operating on a -L argument.
 
3279
              if test "$name" != "" && test "$name" != "0"; then
 
3280
                $rm conftest
 
3281
                $LTCC -o conftest conftest.c $i
 
3282
                # Did it work?
 
3283
                if test "$?" -eq 0 ; then
 
3284
                  ldd_output=`ldd conftest`
 
3285
                  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
3286
                    case " $predeps $postdeps " in
 
3287
                    *" $i "*)
 
3288
                      newdeplibs="$newdeplibs $i"
 
3289
                      i=""
 
3290
                      ;;
 
3291
                    esac
 
3292
                  fi
 
3293
                  if test -n "$i" ; then
 
3294
                    libname=`eval \\$echo \"$libname_spec\"`
 
3295
                    deplib_matches=`eval \\$echo \"$library_names_spec\"`
 
3296
                    set dummy $deplib_matches
 
3297
                    deplib_match=$2
 
3298
                    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
 
3299
                      newdeplibs="$newdeplibs $i"
 
3300
                    else
 
3301
                      droppeddeps=yes
 
3302
                      $echo
 
3303
                      $echo "*** Warning: dynamic linker does not accept needed library $i."
 
3304
                      $echo "*** I have the capability to make that library automatically link in when"
 
3305
                      $echo "*** you link to this library.  But I can only do this if you have a"
 
3306
                      $echo "*** shared version of the library, which you do not appear to have"
 
3307
                      $echo "*** because a test_compile did reveal that the linker did not use this one"
 
3308
                      $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
 
3309
                    fi
2843
3310
                  fi
2844
3311
                else
2845
3312
                  droppeddeps=yes
2846
 
                  echo
2847
 
                  echo "*** Warning!  Library $i is needed by this library but I was not able to"
2848
 
                  echo "***  make it link in!  You will probably need to install it or some"
2849
 
                  echo "*** library that it depends on before this library will be fully"
2850
 
                  echo "*** functional.  Installing it before continuing would be even better."
 
3313
                  $echo
 
3314
                  $echo "*** Warning!  Library $i is needed by this library but I was not able to"
 
3315
                  $echo "***  make it link in!  You will probably need to install it or some"
 
3316
                  $echo "*** library that it depends on before this library will be fully"
 
3317
                  $echo "*** functional.  Installing it before continuing would be even better."
2851
3318
                fi
2852
3319
              else
2853
3320
                newdeplibs="$newdeplibs $i"
2861
3328
          for a_deplib in $deplibs; do
2862
3329
            name="`expr $a_deplib : '-l\(.*\)'`"
2863
3330
            # If $name is empty we are operating on a -L argument.
2864
 
            if test "$name" != "" -a "$name" != "0"; then
2865
 
              libname=`eval \\$echo \"$libname_spec\"`
2866
 
              for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2867
 
                    potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2868
 
                    for potent_lib in $potential_libs; do
 
3331
            if test "$name" != "" && test  "$name" != "0"; then
 
3332
              if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
3333
                case " $predeps $postdeps " in
 
3334
                *" $a_deplib "*)
 
3335
                  newdeplibs="$newdeplibs $a_deplib"
 
3336
                  a_deplib=""
 
3337
                  ;;
 
3338
                esac
 
3339
              fi
 
3340
              if test -n "$a_deplib" ; then
 
3341
                libname=`eval \\$echo \"$libname_spec\"`
 
3342
                for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
 
3343
                  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
 
3344
                  for potent_lib in $potential_libs; do
2869
3345
                      # Follow soft links.
2870
3346
                      if ls -lLd "$potent_lib" 2>/dev/null \
2871
3347
                         | grep " -> " >/dev/null; then
2878
3354
                      # but so what?
2879
3355
                      potlib="$potent_lib"
2880
3356
                      while test -h "$potlib" 2>/dev/null; do
2881
 
                        potliblink=`ls -ld $potlib | sed 's/.* -> //'`
 
3357
                        potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
2882
3358
                        case $potliblink in
2883
3359
                        [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
2884
3360
                        *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
2885
3361
                        esac
2886
3362
                      done
2887
3363
                      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
2888
 
                         | sed 10q \
2889
 
                         | egrep "$file_magic_regex" > /dev/null; then
 
3364
                         | ${SED} 10q \
 
3365
                         | $EGREP "$file_magic_regex" > /dev/null; then
2890
3366
                        newdeplibs="$newdeplibs $a_deplib"
2891
3367
                        a_deplib=""
2892
3368
                        break 2
2893
3369
                      fi
2894
 
                    done
2895
 
              done
2896
 
              if test -n "$a_deplib" ; then
2897
 
                droppeddeps=yes
2898
 
                echo
2899
 
                echo "*** Warning: This library needs some functionality provided by $a_deplib."
2900
 
                echo "*** I have the capability to make that library automatically link in when"
2901
 
                echo "*** you link to this library.  But I can only do this if you have a"
2902
 
                echo "*** shared version of the library, which you do not appear to have."
 
3370
                  done
 
3371
                done
 
3372
              fi
 
3373
              if test -n "$a_deplib" ; then
 
3374
                droppeddeps=yes
 
3375
                $echo
 
3376
                $echo "*** Warning: linker path does not have real file for library $a_deplib."
 
3377
                $echo "*** I have the capability to make that library automatically link in when"
 
3378
                $echo "*** you link to this library.  But I can only do this if you have a"
 
3379
                $echo "*** shared version of the library, which you do not appear to have"
 
3380
                $echo "*** because I did check the linker path looking for a file starting"
 
3381
                if test -z "$potlib" ; then
 
3382
                  $echo "*** with $libname but no candidates were found. (...for file magic test)"
 
3383
                else
 
3384
                  $echo "*** with $libname and none of the candidates passed a file format test"
 
3385
                  $echo "*** using a file magic. Last file checked: $potlib"
 
3386
                fi
 
3387
              fi
 
3388
            else
 
3389
              # Add a -L argument.
 
3390
              newdeplibs="$newdeplibs $a_deplib"
 
3391
            fi
 
3392
          done # Gone through all deplibs.
 
3393
          ;;
 
3394
        match_pattern*)
 
3395
          set dummy $deplibs_check_method
 
3396
          match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
 
3397
          for a_deplib in $deplibs; do
 
3398
            name="`expr $a_deplib : '-l\(.*\)'`"
 
3399
            # If $name is empty we are operating on a -L argument.
 
3400
            if test -n "$name" && test "$name" != "0"; then
 
3401
              if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
3402
                case " $predeps $postdeps " in
 
3403
                *" $a_deplib "*)
 
3404
                  newdeplibs="$newdeplibs $a_deplib"
 
3405
                  a_deplib=""
 
3406
                  ;;
 
3407
                esac
 
3408
              fi
 
3409
              if test -n "$a_deplib" ; then
 
3410
                libname=`eval \\$echo \"$libname_spec\"`
 
3411
                for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
 
3412
                  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
 
3413
                  for potent_lib in $potential_libs; do
 
3414
                    potlib="$potent_lib" # see symlink-check above in file_magic test
 
3415
                    if eval $echo \"$potent_lib\" 2>/dev/null \
 
3416
                        | ${SED} 10q \
 
3417
                        | $EGREP "$match_pattern_regex" > /dev/null; then
 
3418
                      newdeplibs="$newdeplibs $a_deplib"
 
3419
                      a_deplib=""
 
3420
                      break 2
 
3421
                    fi
 
3422
                  done
 
3423
                done
 
3424
              fi
 
3425
              if test -n "$a_deplib" ; then
 
3426
                droppeddeps=yes
 
3427
                $echo
 
3428
                $echo "*** Warning: linker path does not have real file for library $a_deplib."
 
3429
                $echo "*** I have the capability to make that library automatically link in when"
 
3430
                $echo "*** you link to this library.  But I can only do this if you have a"
 
3431
                $echo "*** shared version of the library, which you do not appear to have"
 
3432
                $echo "*** because I did check the linker path looking for a file starting"
 
3433
                if test -z "$potlib" ; then
 
3434
                  $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
 
3435
                else
 
3436
                  $echo "*** with $libname and none of the candidates passed a file format test"
 
3437
                  $echo "*** using a regex pattern. Last file checked: $potlib"
 
3438
                fi
2903
3439
              fi
2904
3440
            else
2905
3441
              # Add a -L argument.
2909
3445
          ;;
2910
3446
        none | unknown | *)
2911
3447
          newdeplibs=""
2912
 
          if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
2913
 
               -e 's/ -[LR][^ ]*//g' -e 's/[    ]//g' |
2914
 
             grep . >/dev/null; then
2915
 
            echo
 
3448
          tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
 
3449
            -e 's/ -[LR][^ ]*//g'`
 
3450
          if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
3451
            for i in $predeps $postdeps ; do
 
3452
              # can't use Xsed below, because $i might contain '/'
 
3453
              tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
 
3454
            done
 
3455
          fi
 
3456
          if $echo "X $tmp_deplibs" | $Xsed -e 's/[     ]//g' \
 
3457
            | grep . >/dev/null; then
 
3458
            $echo
2916
3459
            if test "X$deplibs_check_method" = "Xnone"; then
2917
 
              echo "*** Warning: inter-library dependencies are not supported in this platform."
 
3460
              $echo "*** Warning: inter-library dependencies are not supported in this platform."
2918
3461
            else
2919
 
              echo "*** Warning: inter-library dependencies are not known to be supported."
 
3462
              $echo "*** Warning: inter-library dependencies are not known to be supported."
2920
3463
            fi
2921
 
            echo "*** All declared inter-library dependencies are being dropped."
 
3464
            $echo "*** All declared inter-library dependencies are being dropped."
2922
3465
            droppeddeps=yes
2923
3466
          fi
2924
3467
          ;;
2929
3472
        libname=$libname_save
2930
3473
        name=$name_save
2931
3474
 
 
3475
        case $host in
 
3476
        *-*-rhapsody* | *-*-darwin1.[012])
 
3477
          # On Rhapsody replace the C library is the System framework
 
3478
          newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
 
3479
          ;;
 
3480
        esac
 
3481
 
2932
3482
        if test "$droppeddeps" = yes; then
2933
3483
          if test "$module" = yes; then
2934
 
            echo
2935
 
            echo "*** Warning: libtool could not satisfy all declared inter-library"
2936
 
            echo "*** dependencies of module $libname.  Therefore, libtool will create"
2937
 
            echo "*** a static module, that should work as long as the dlopening"
2938
 
            echo "*** application is linked with the -dlopen flag."
 
3484
            $echo
 
3485
            $echo "*** Warning: libtool could not satisfy all declared inter-library"
 
3486
            $echo "*** dependencies of module $libname.  Therefore, libtool will create"
 
3487
            $echo "*** a static module, that should work as long as the dlopening"
 
3488
            $echo "*** application is linked with the -dlopen flag."
2939
3489
            if test -z "$global_symbol_pipe"; then
2940
 
              echo
2941
 
              echo "*** However, this would only work if libtool was able to extract symbol"
2942
 
              echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2943
 
              echo "*** not find such a program.  So, this module is probably useless."
2944
 
              echo "*** \`nm' from GNU binutils and a full rebuild may help."
 
3490
              $echo
 
3491
              $echo "*** However, this would only work if libtool was able to extract symbol"
 
3492
              $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
 
3493
              $echo "*** not find such a program.  So, this module is probably useless."
 
3494
              $echo "*** \`nm' from GNU binutils and a full rebuild may help."
2945
3495
            fi
2946
3496
            if test "$build_old_libs" = no; then
2947
3497
              oldlibs="$output_objdir/$libname.$libext"
2951
3501
              build_libtool_libs=no
2952
3502
            fi
2953
3503
          else
2954
 
            echo "*** The inter-library dependencies that have been dropped here will be"
2955
 
            echo "*** automatically added whenever a program is linked with this library"
2956
 
            echo "*** or is declared to -dlopen it."
 
3504
            $echo "*** The inter-library dependencies that have been dropped here will be"
 
3505
            $echo "*** automatically added whenever a program is linked with this library"
 
3506
            $echo "*** or is declared to -dlopen it."
2957
3507
 
2958
 
            if test $allow_undefined = no; then
2959
 
              echo
2960
 
              echo "*** Since this library must not contain undefined symbols,"
2961
 
              echo "*** because either the platform does not support them or"
2962
 
              echo "*** it was explicitly requested with -no-undefined,"
2963
 
              echo "*** libtool will only create a static version of it."
 
3508
            if test "$allow_undefined" = no; then
 
3509
              $echo
 
3510
              $echo "*** Since this library must not contain undefined symbols,"
 
3511
              $echo "*** because either the platform does not support them or"
 
3512
              $echo "*** it was explicitly requested with -no-undefined,"
 
3513
              $echo "*** libtool will only create a static version of it."
2964
3514
              if test "$build_old_libs" = no; then
2965
3515
                oldlibs="$output_objdir/$libname.$libext"
2966
3516
                build_libtool_libs=module
2971
3521
            fi
2972
3522
          fi
2973
3523
        fi
 
3524
        # Time to change all our "foo.ltframework" stuff back to "-framework foo"
 
3525
        case $host in
 
3526
          *-*-darwin*)
 
3527
            newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
 
3528
            dependency_libs=`$echo "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
 
3529
            ;;
 
3530
        esac
2974
3531
        # Done checking deplibs!
2975
3532
        deplibs=$newdeplibs
2976
3533
      fi
2982
3539
 
2983
3540
      # Test again, we may have decided not to build it any more
2984
3541
      if test "$build_libtool_libs" = yes; then
2985
 
        if test $hardcode_into_libs = yes; then
 
3542
        if test "$hardcode_into_libs" = yes; then
2986
3543
          # Hardcode the library paths
2987
3544
          hardcode_libdirs=
2988
3545
          dep_rpath=
2989
3546
          rpath="$finalize_rpath"
2990
 
          test "$mode" != relink && rpath="$compile_rpath$rpath"
 
3547
          test "$mode" != relink && test "$fast_install" = no && rpath="$compile_rpath$rpath"
2991
3548
          for libdir in $rpath; do
2992
3549
            if test -n "$hardcode_libdir_flag_spec"; then
2993
3550
              if test -n "$hardcode_libdir_separator"; then
3018
3575
          if test -n "$hardcode_libdir_separator" &&
3019
3576
             test -n "$hardcode_libdirs"; then
3020
3577
            libdir="$hardcode_libdirs"
3021
 
            eval dep_rpath=\"$hardcode_libdir_flag_spec\"
 
3578
            if test -n "$hardcode_libdir_flag_spec_ld"; then
 
3579
              eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
 
3580
            else
 
3581
              eval dep_rpath=\"$hardcode_libdir_flag_spec\"
 
3582
            fi
3022
3583
          fi
3023
3584
          if test -n "$runpath_var" && test -n "$perm_rpath"; then
3024
3585
            # We should set the runpath_var.
3038
3599
        fi
3039
3600
 
3040
3601
        # Get the real and link names of the library.
 
3602
        eval shared_ext=\"$shrext\"
3041
3603
        eval library_names=\"$library_names_spec\"
3042
3604
        set dummy $library_names
3043
3605
        realname="$2"
3048
3610
        else
3049
3611
          soname="$realname"
3050
3612
        fi
3051
 
        if test x$dlname = x; then
 
3613
        if test -z "$dlname"; then
3052
3614
          dlname=$soname
3053
3615
        fi
3054
3616
 
3058
3620
          linknames="$linknames $link"
3059
3621
        done
3060
3622
 
3061
 
#       # Ensure that we have .o objects for linkers which dislike .lo
3062
 
#       # (e.g. aix) in case we are running --disable-static
3063
 
#       for obj in $libobjs; do
3064
 
#         xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
3065
 
#         if test "X$xdir" = "X$obj"; then
3066
 
#           xdir="."
3067
 
#         else
3068
 
#           xdir="$xdir"
3069
 
#         fi
3070
 
#         baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
3071
 
#         oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
3072
 
#         if test ! -f $xdir/$oldobj && test "$baseobj" != "$oldobj"; then
3073
 
#           $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
3074
 
#           $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
3075
 
#         fi
3076
 
#       done
3077
 
 
3078
3623
        # Use standard objects if they are pic
3079
3624
        test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3080
3625
 
3085
3630
            export_symbols="$output_objdir/$libname.exp"
3086
3631
            $run $rm $export_symbols
3087
3632
            eval cmds=\"$export_symbols_cmds\"
3088
 
            IFS="${IFS=         }"; save_ifs="$IFS"; IFS='~'
 
3633
            save_ifs="$IFS"; IFS='~'
3089
3634
            for cmd in $cmds; do
3090
3635
              IFS="$save_ifs"
3091
 
              $show "$cmd"
3092
 
              $run eval "$cmd" || exit $?
 
3636
              if len=`expr "X$cmd" : ".*"` &&
 
3637
               test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
 
3638
                $show "$cmd"
 
3639
                $run eval "$cmd" || exit $?
 
3640
                skipped_export=false
 
3641
              else
 
3642
                # The command line is too long to execute in one step.
 
3643
                $show "using reloadable object file for export list..."
 
3644
                skipped_export=:
 
3645
              fi
3093
3646
            done
3094
3647
            IFS="$save_ifs"
3095
3648
            if test -n "$export_symbols_regex"; then
3096
 
              $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
3097
 
              $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
 
3649
              $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
 
3650
              $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
3098
3651
              $show "$mv \"${export_symbols}T\" \"$export_symbols\""
3099
3652
              $run eval '$mv "${export_symbols}T" "$export_symbols"'
3100
3653
            fi
3105
3658
          $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
3106
3659
        fi
3107
3660
 
 
3661
        tmp_deplibs=
 
3662
        for test_deplib in $deplibs; do
 
3663
                case " $convenience " in
 
3664
                *" $test_deplib "*) ;;
 
3665
                *) 
 
3666
                        tmp_deplibs="$tmp_deplibs $test_deplib"
 
3667
                        ;;
 
3668
                esac
 
3669
        done
 
3670
        deplibs="$tmp_deplibs" 
 
3671
 
3108
3672
        if test -n "$convenience"; then
3109
3673
          if test -n "$whole_archive_flag_spec"; then
3110
3674
            save_libobjs=$libobjs
3116
3680
            $show "$mkdir $gentop"
3117
3681
            $run $mkdir "$gentop"
3118
3682
            status=$?
3119
 
            if test $status -ne 0 && test ! -d "$gentop"; then
 
3683
            if test "$status" -ne 0 && test ! -d "$gentop"; then
3120
3684
              exit $status
3121
3685
            fi
3122
3686
            generated="$generated $gentop"
3135
3699
              $show "$mkdir $xdir"
3136
3700
              $run $mkdir "$xdir"
3137
3701
              status=$?
3138
 
              if test $status -ne 0 && test ! -d "$xdir"; then
 
3702
              if test "$status" -ne 0 && test ! -d "$xdir"; then
3139
3703
                exit $status
3140
3704
              fi
 
3705
              # We will extract separately just the conflicting names and we will no
 
3706
              # longer touch any unique names. It is faster to leave these extract
 
3707
              # automatically by $AR in one run.
3141
3708
              $show "(cd $xdir && $AR x $xabs)"
3142
3709
              $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
 
3710
              if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
 
3711
                :
 
3712
              else
 
3713
                $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
 
3714
                $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
 
3715
                $AR t "$xabs" | sort | uniq -cd | while read -r count name
 
3716
                do
 
3717
                  i=1
 
3718
                  while test "$i" -le "$count"
 
3719
                  do
 
3720
                   # Put our $i before any first dot (extension)
 
3721
                   # Never overwrite any file
 
3722
                   name_to="$name"
 
3723
                   while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
 
3724
                   do
 
3725
                     name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
 
3726
                   done
 
3727
                   $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
 
3728
                   $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
 
3729
                   i=`expr $i + 1`
 
3730
                  done
 
3731
                done
 
3732
              fi
3143
3733
 
3144
3734
              libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
3145
3735
            done
3152
3742
        fi
3153
3743
 
3154
3744
        # Make a backup of the uninstalled library when relinking
3155
 
        if test "$mode" = relink && test "$hardcode_into_libs" = all; then
 
3745
        if test "$mode" = relink; then
3156
3746
          $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
3157
3747
        fi
3158
3748
 
 
3749
        # Add all flags from the command line.  We here create a library,
 
3750
        # but those flags were only added to compile_command and
 
3751
        # finalize_command, which are only used when creating executables.
 
3752
        # So do it by hand here.
 
3753
        compiler_flags="$compiler_flags $add_flags"
 
3754
        # Only add it to commands which use CC, instead of LD, i.e.
 
3755
        # only to $compiler_flags
 
3756
        #linker_flags="$linker_flags $add_flags"
 
3757
 
3159
3758
        # Do each of the archive commands.
 
3759
        if test "$module" = yes && test -n "$module_cmds" ; then
 
3760
          if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
 
3761
            eval cmds=\"$module_expsym_cmds\"
 
3762
          else
 
3763
            eval cmds=\"$module_cmds\"
 
3764
          fi
 
3765
        else
3160
3766
        if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3161
3767
          eval cmds=\"$archive_expsym_cmds\"
3162
3768
        else
3163
3769
          eval cmds=\"$archive_cmds\"
 
3770
          fi
3164
3771
        fi
3165
 
        if len=`expr "X$cmds" : ".*"` &&
3166
 
           test $len -le $max_cmd_len; then
3167
 
          :
3168
 
        else
 
3772
 
 
3773
        if test "X$skipped_export" != "X:" && len=`expr "X$cmds" : ".*"` &&
 
3774
           test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
 
3775
          :
 
3776
        else
3169
3777
          # The command line is too long to link in one step, link piecewise.
3170
 
          $echo "creating reloadable object files..."
 
3778
          $echo "creating reloadable object files..."
3171
3779
 
3172
3780
          # Save the value of $output and $libobjs because we want to
3173
3781
          # use them later.  If we have whole_archive_flag_spec, we
3180
3788
          if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
3181
3789
            save_libobjs=$libobjs
3182
3790
          fi
3183
 
          save_output=$output
 
3791
          save_output=$output
3184
3792
 
3185
3793
          # Clear the reloadable object creation command queue and
3186
3794
          # initialize k to one.
3187
 
          test_cmds=
3188
 
          concat_cmds=
3189
 
          objlist=
3190
 
          delfiles=
3191
 
          last_robj=
3192
 
          k=1
3193
 
          output=$output_objdir/$save_output-${k}.$objext
 
3795
          test_cmds=
 
3796
          concat_cmds=
 
3797
          objlist=
 
3798
          delfiles=
 
3799
          last_robj=
 
3800
          k=1
 
3801
          output=$output_objdir/$save_output-${k}.$objext
3194
3802
          # Loop over the list of objects to be linked.
3195
 
          for obj in $save_libobjs
3196
 
          do
3197
 
            eval test_cmds=\"$reload_cmds $objlist $last_robj\"
3198
 
            if test "X$objlist" = X ||
 
3803
          for obj in $save_libobjs
 
3804
          do
 
3805
            eval test_cmds=\"$reload_cmds $objlist $last_robj\"
 
3806
            if test "X$objlist" = X ||
3199
3807
               { len=`expr "X$test_cmds" : ".*"` &&
3200
 
                 test $len -le $max_cmd_len; }; then
3201
 
              objlist="$objlist $obj"
3202
 
            else
 
3808
                 test "$len" -le "$max_cmd_len"; }; then
 
3809
              objlist="$objlist $obj"
 
3810
            else
3203
3811
              # The command $test_cmds is almost too long, add a
3204
3812
              # command to the queue.
3205
 
              if test $k -eq 1 ; then
3206
 
                # The first file doesn't have a previous command to add.
3207
 
                eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
3208
 
              else
3209
 
                # All subsequent reloadable object files will link in
3210
 
                # the last one created.
3211
 
                eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
3212
 
              fi
3213
 
              last_robj=$output_objdir/$save_output-${k}.$objext
3214
 
              k=`expr $k + 1`
3215
 
              output=$output_objdir/$save_output-${k}.$objext
3216
 
              objlist=$obj
3217
 
              len=1
3218
 
            fi
3219
 
          done
 
3813
              if test "$k" -eq 1 ; then
 
3814
                # The first file doesn't have a previous command to add.
 
3815
                eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
 
3816
              else
 
3817
                # All subsequent reloadable object files will link in
 
3818
                # the last one created.
 
3819
                eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
 
3820
              fi
 
3821
              last_robj=$output_objdir/$save_output-${k}.$objext
 
3822
              k=`expr $k + 1`
 
3823
              output=$output_objdir/$save_output-${k}.$objext
 
3824
              objlist=$obj
 
3825
              len=1
 
3826
            fi
 
3827
          done
3220
3828
          # Handle the remaining objects by creating one last
3221
3829
          # reloadable object file.  All subsequent reloadable object
3222
3830
          # files will link in the last one created.
3223
3831
          test -z "$concat_cmds" || concat_cmds=$concat_cmds~
3224
 
          eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
 
3832
          eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
 
3833
 
 
3834
          if ${skipped_export-false}; then
 
3835
            $show "generating symbol list for \`$libname.la'"
 
3836
            export_symbols="$output_objdir/$libname.exp"
 
3837
            $run $rm $export_symbols
 
3838
            libobjs=$output
 
3839
            # Append the command to create the export file.
 
3840
            eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
 
3841
          fi
3225
3842
 
3226
3843
          # Set up a command to remove the reloadale object files
3227
3844
          # after they are used.
3228
 
          i=0
3229
 
          while test $i -lt $k
3230
 
          do
3231
 
            i=`expr $i + 1`
3232
 
            delfiles="$delfiles $output_objdir/$save_output-${i}.$objext"
3233
 
          done
 
3845
          i=0
 
3846
          while test "$i" -lt "$k"
 
3847
          do
 
3848
            i=`expr $i + 1`
 
3849
            delfiles="$delfiles $output_objdir/$save_output-${i}.$objext"
 
3850
          done
3234
3851
 
3235
 
          $echo "creating a temporary reloadable object file: $output"
 
3852
          $echo "creating a temporary reloadable object file: $output"
3236
3853
 
3237
3854
          # Loop through the commands generated above and execute them.
3238
 
          IFS="${IFS=   }"; save_ifs="$IFS"; IFS='~'
3239
 
          for cmd in $concat_cmds; do
3240
 
            IFS="$save_ifs"
3241
 
            $show "$cmd"
3242
 
            $run eval "$cmd" || exit $?
3243
 
          done
3244
 
          IFS="$save_ifs"
 
3855
          save_ifs="$IFS"; IFS='~'
 
3856
          for cmd in $concat_cmds; do
 
3857
            IFS="$save_ifs"
 
3858
            $show "$cmd"
 
3859
            $run eval "$cmd" || exit $?
 
3860
          done
 
3861
          IFS="$save_ifs"
3245
3862
 
3246
 
          libobjs=$output
 
3863
          libobjs=$output
3247
3864
          # Restore the value of output.
3248
 
          output=$save_output
 
3865
          output=$save_output
3249
3866
 
3250
3867
          if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
3251
3868
            eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3254
3871
          # value of $libobjs for piecewise linking.
3255
3872
 
3256
3873
          # Do each of the archive commands.
3257
 
          if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3258
 
            eval cmds=\"$archive_expsym_cmds\"
3259
 
          else
3260
 
            eval cmds=\"$archive_cmds\"
3261
 
          fi
 
3874
          if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
 
3875
            eval cmds=\"$archive_expsym_cmds\"
 
3876
          else
 
3877
            eval cmds=\"$archive_cmds\"
 
3878
          fi
3262
3879
 
3263
3880
          # Append the command to remove the reloadable object files
3264
3881
          # to the just-reset $cmds.
3265
 
          eval cmds=\"\$cmds~$rm $delfiles\"
3266
 
        fi
3267
 
        IFS="${IFS=     }"; save_ifs="$IFS"; IFS='~'
3268
 
        for cmd in $cmds; do
3269
 
          IFS="$save_ifs"
3270
 
          $show "$cmd"
3271
 
          $run eval "$cmd" || exit $?
3272
 
        done
3273
 
        IFS="$save_ifs"
 
3882
          eval cmds=\"\$cmds~$rm $delfiles\"
 
3883
        fi
 
3884
        save_ifs="$IFS"; IFS='~'
 
3885
        for cmd in $cmds; do
 
3886
          IFS="$save_ifs"
 
3887
          $show "$cmd"
 
3888
          $run eval "$cmd" || exit $?
 
3889
        done
 
3890
        IFS="$save_ifs"
3274
3891
 
3275
3892
        # Restore the uninstalled library and exit
3276
 
        if test "$mode" = relink && test "$hardcode_into_libs" = all; then
 
3893
        if test "$mode" = relink; then
3277
3894
          $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
3278
3895
          exit 0
3279
3896
        fi
3357
3974
          $show "$mkdir $gentop"
3358
3975
          $run $mkdir "$gentop"
3359
3976
          status=$?
3360
 
          if test $status -ne 0 && test ! -d "$gentop"; then
 
3977
          if test "$status" -ne 0 && test ! -d "$gentop"; then
3361
3978
            exit $status
3362
3979
          fi
3363
3980
          generated="$generated $gentop"
3376
3993
            $show "$mkdir $xdir"
3377
3994
            $run $mkdir "$xdir"
3378
3995
            status=$?
3379
 
            if test $status -ne 0 && test ! -d "$xdir"; then
 
3996
            if test "$status" -ne 0 && test ! -d "$xdir"; then
3380
3997
              exit $status
3381
3998
            fi
 
3999
            # We will extract separately just the conflicting names and we will no
 
4000
            # longer touch any unique names. It is faster to leave these extract
 
4001
            # automatically by $AR in one run.
3382
4002
            $show "(cd $xdir && $AR x $xabs)"
3383
4003
            $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
 
4004
            if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
 
4005
              :
 
4006
            else
 
4007
              $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
 
4008
              $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
 
4009
              $AR t "$xabs" | sort | uniq -cd | while read -r count name
 
4010
              do
 
4011
                i=1
 
4012
                while test "$i" -le "$count"
 
4013
                do
 
4014
                 # Put our $i before any first dot (extension)
 
4015
                 # Never overwrite any file
 
4016
                 name_to="$name"
 
4017
                 while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
 
4018
                 do
 
4019
                   name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
 
4020
                 done
 
4021
                 $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
 
4022
                 $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
 
4023
                 i=`expr $i + 1`
 
4024
                done
 
4025
              done
 
4026
            fi
3384
4027
 
3385
4028
            reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
3386
4029
          done
3392
4035
 
3393
4036
      output="$obj"
3394
4037
      eval cmds=\"$reload_cmds\"
3395
 
      IFS="${IFS=       }"; save_ifs="$IFS"; IFS='~'
 
4038
      save_ifs="$IFS"; IFS='~'
3396
4039
      for cmd in $cmds; do
3397
4040
        IFS="$save_ifs"
3398
4041
        $show "$cmd"
3428
4071
        reload_objs="$libobjs $reload_conv_objs"
3429
4072
        output="$libobj"
3430
4073
        eval cmds=\"$reload_cmds\"
3431
 
        IFS="${IFS=     }"; save_ifs="$IFS"; IFS='~'
 
4074
        save_ifs="$IFS"; IFS='~'
3432
4075
        for cmd in $cmds; do
3433
4076
          IFS="$save_ifs"
3434
4077
          $show "$cmd"
3435
4078
          $run eval "$cmd" || exit $?
3436
4079
        done
3437
4080
        IFS="$save_ifs"
3438
 
#     else
3439
 
#       # Just create a symlink.
3440
 
#       $show $rm $libobj
3441
 
#       $run $rm $libobj
3442
 
#       xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
3443
 
#       if test "X$xdir" = "X$libobj"; then
3444
 
#         xdir="."
3445
 
#       else
3446
 
#         xdir="$xdir"
3447
 
#       fi
3448
 
#       baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
3449
 
#       oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
3450
 
#       $show "(cd $xdir && $LN_S $oldobj $baseobj)"
3451
 
#       $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
3452
4081
      fi
3453
4082
 
3454
4083
      if test -n "$gentop"; then
3461
4090
 
3462
4091
    prog)
3463
4092
      case $host in
3464
 
        *cygwin*) output=`echo $output | sed -e 's,.exe$,,;s,$,.exe,'` ;;
 
4093
        *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
3465
4094
      esac
3466
4095
      if test -n "$vinfo"; then
3467
4096
        $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
3478
4107
        fi
3479
4108
      fi
3480
4109
 
 
4110
      case $host in
 
4111
      *-*-rhapsody* | *-*-darwin1.[012])
 
4112
        # On Rhapsody replace the C library is the System framework
 
4113
        compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
 
4114
        finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
 
4115
        ;;
 
4116
      esac
 
4117
 
 
4118
      case $host in
 
4119
      *-*-darwin*)
 
4120
        # Don't allow lazy linking, it breaks C++ global constructors
 
4121
        if test "$tagname" = CXX ; then
 
4122
        compile_command="$compile_command ${wl}-bind_at_load"
 
4123
        finalize_command="$finalize_command ${wl}-bind_at_load"
 
4124
        fi
 
4125
        # Time to change all our "foo.ltframework" stuff back to "-framework foo"
 
4126
        compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
 
4127
        finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
 
4128
        ;;
 
4129
      esac
 
4130
 
3481
4131
      compile_command="$compile_command $compile_deplibs"
3482
4132
      finalize_command="$finalize_command $finalize_deplibs"
3483
4133
 
3573
4223
      fi
3574
4224
      finalize_rpath="$rpath"
3575
4225
 
 
4226
      if test -n "$libobjs" && test "$build_old_libs" = yes; then
 
4227
        # Transform all the library objects into standard objects.
 
4228
        compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
 
4229
        finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
 
4230
      fi
 
4231
 
3576
4232
      dlsyms=
3577
4233
      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3578
4234
        if test -n "$NM" && test -n "$global_symbol_pipe"; then
3615
4271
            test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
3616
4272
 
3617
4273
            # Add our own program objects to the symbol list.
3618
 
            progfiles="$objs$old_deplibs"
 
4274
            progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3619
4275
            for arg in $progfiles; do
3620
4276
              $show "extracting global C symbols from \`$arg'"
3621
4277
              $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3622
4278
            done
3623
4279
 
3624
4280
            if test -n "$exclude_expsyms"; then
3625
 
              $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
 
4281
              $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3626
4282
              $run eval '$mv "$nlist"T "$nlist"'
3627
4283
            fi
3628
4284
 
3629
4285
            if test -n "$export_symbols_regex"; then
3630
 
              $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
 
4286
              $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3631
4287
              $run eval '$mv "$nlist"T "$nlist"'
3632
4288
            fi
3633
4289
 
3635
4291
            if test -z "$export_symbols"; then
3636
4292
              export_symbols="$output_objdir/$output.exp"
3637
4293
              $run $rm $export_symbols
3638
 
              $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
 
4294
              $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3639
4295
            else
3640
 
              $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
 
4296
              $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
3641
4297
              $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
3642
4298
              $run eval 'mv "$nlist"T "$nlist"'
3643
4299
            fi
3645
4301
 
3646
4302
          for arg in $dlprefiles; do
3647
4303
            $show "extracting global C symbols from \`$arg'"
3648
 
            name=`echo "$arg" | sed -e 's%^.*/%%'`
3649
 
            $run eval 'echo ": $name " >> "$nlist"'
 
4304
            name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
 
4305
            $run eval '$echo ": $name " >> "$nlist"'
3650
4306
            $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3651
4307
          done
3652
4308
 
3655
4311
            test -f "$nlist" || : > "$nlist"
3656
4312
 
3657
4313
            if test -n "$exclude_expsyms"; then
3658
 
              egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
 
4314
              $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3659
4315
              $mv "$nlist"T "$nlist"
3660
4316
            fi
3661
4317
 
3662
4318
            # Try sorting and uniquifying the output.
3663
 
            if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
 
4319
            if grep -v "^: " < "$nlist" |
 
4320
                if sort -k 3 </dev/null >/dev/null 2>&1; then
 
4321
                  sort -k 3
 
4322
                else
 
4323
                  sort +2
 
4324
                fi |
 
4325
                uniq > "$nlist"S; then
3664
4326
              :
3665
4327
            else
3666
4328
              grep -v "^: " < "$nlist" > "$nlist"S
3669
4331
            if test -f "$nlist"S; then
3670
4332
              eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
3671
4333
            else
3672
 
              echo '/* NONE */' >> "$output_objdir/$dlsyms"
 
4334
              $echo '/* NONE */' >> "$output_objdir/$dlsyms"
3673
4335
            fi
3674
4336
 
3675
4337
            $echo >> "$output_objdir/$dlsyms" "\
3677
4339
#undef lt_preloaded_symbols
3678
4340
 
3679
4341
#if defined (__STDC__) && __STDC__
3680
 
# define lt_ptr_t void *
 
4342
# define lt_ptr void *
3681
4343
#else
3682
 
# define lt_ptr_t char *
 
4344
# define lt_ptr char *
3683
4345
# define const
3684
4346
#endif
3685
4347
 
3686
4348
/* The mapping between symbol names and symbols. */
3687
4349
const struct {
3688
4350
  const char *name;
3689
 
  lt_ptr_t address;
 
4351
  lt_ptr address;
3690
4352
}
3691
4353
lt_preloaded_symbols[] =
3692
4354
{\
3693
4355
"
3694
4356
 
3695
 
            sed -n -e 's/^: \([^ ]*\) $/  {\"\1\", (lt_ptr_t) 0},/p' \
3696
 
                -e 's/^. \([^ ]*\) \([^ ]*\)$/  {"\2", (lt_ptr_t) \&\2},/p' \
3697
 
                  < "$nlist" >> "$output_objdir/$dlsyms"
 
4357
            eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
3698
4358
 
3699
4359
            $echo >> "$output_objdir/$dlsyms" "\
3700
 
  {0, (lt_ptr_t) 0}
 
4360
  {0, (lt_ptr) 0}
3701
4361
};
3702
4362
 
3703
4363
/* This works around a problem in FreeBSD linker */
3770
4430
                   finalize_command=`$echo "X$finalize_command $wl-brtl" | $Xsed -e "s/\$CC/\$CC $wl-bnolibpath/1"` ;;
3771
4431
      esac
3772
4432
 
3773
 
      if test $need_relink = no || test "$build_libtool_libs" != yes; then
 
4433
      if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
3774
4434
        # Replace the output file specification.
3775
4435
        compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3776
4436
        link_command="$compile_command$compile_rpath"
3895
4555
            relink_command="$var=\"$var_value\"; export $var; $relink_command"
3896
4556
          fi
3897
4557
        done
3898
 
        relink_command="cd `pwd`; $relink_command"
 
4558
        relink_command="(cd `pwd`; $relink_command)"
3899
4559
        relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
3900
4560
      fi
3901
4561
 
3915
4575
        # win32 will think the script is a binary if it has
3916
4576
        # a .exe suffix, so we strip it off here.
3917
4577
        case $output in
3918
 
          *.exe) output=`echo $output|sed 's,.exe$,,'` ;;
 
4578
          *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
3919
4579
        esac
3920
4580
        # test for cygwin because mv fails w/o .exe extensions
3921
4581
        case $host in
3922
 
          *cygwin*) exeext=.exe ;;
 
4582
          *cygwin*)
 
4583
            exeext=.exe
 
4584
            outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
3923
4585
          *) exeext= ;;
3924
4586
        esac
 
4587
        case $host in
 
4588
          *cygwin* | *mingw* )
 
4589
            cwrappersource=`$echo ${objdir}/lt-${output}.c`
 
4590
            cwrapper=`$echo ${output}.exe`
 
4591
            $rm $cwrappersource $cwrapper
 
4592
            trap "$rm $cwrappersource $cwrapper; exit 1" 1 2 15
 
4593
 
 
4594
            cat > $cwrappersource <<EOF
 
4595
 
 
4596
/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
 
4597
   Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
 
4598
 
 
4599
   The $output program cannot be directly executed until all the libtool
 
4600
   libraries that it depends on are installed.
 
4601
   
 
4602
   This wrapper executable should never be moved out of the build directory.
 
4603
   If it is, it will not operate correctly.
 
4604
 
 
4605
   Currently, it simply execs the wrapper *script* "/bin/sh $output",
 
4606
   but could eventually absorb all of the scripts functionality and
 
4607
   exec $objdir/$outputname directly.
 
4608
*/
 
4609
EOF
 
4610
            cat >> $cwrappersource<<"EOF"
 
4611
#include <stdio.h>
 
4612
#include <stdlib.h>
 
4613
#include <unistd.h>
 
4614
#include <malloc.h>
 
4615
#include <stdarg.h>
 
4616
#include <assert.h>
 
4617
 
 
4618
#if defined(PATH_MAX)
 
4619
# define LT_PATHMAX PATH_MAX
 
4620
#elif defined(MAXPATHLEN)
 
4621
# define LT_PATHMAX MAXPATHLEN
 
4622
#else
 
4623
# define LT_PATHMAX 1024
 
4624
#endif
 
4625
 
 
4626
#ifndef DIR_SEPARATOR
 
4627
#define DIR_SEPARATOR '/'
 
4628
#endif
 
4629
 
 
4630
#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
 
4631
  defined (__OS2__)
 
4632
#define HAVE_DOS_BASED_FILE_SYSTEM
 
4633
#ifndef DIR_SEPARATOR_2 
 
4634
#define DIR_SEPARATOR_2 '\\'
 
4635
#endif
 
4636
#endif
 
4637
 
 
4638
#ifndef DIR_SEPARATOR_2
 
4639
# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
 
4640
#else /* DIR_SEPARATOR_2 */
 
4641
# define IS_DIR_SEPARATOR(ch) \
 
4642
        (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
 
4643
#endif /* DIR_SEPARATOR_2 */
 
4644
 
 
4645
#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
 
4646
#define XFREE(stale) do { \
 
4647
  if (stale) { free ((void *) stale); stale = 0; } \
 
4648
} while (0)
 
4649
 
 
4650
const char *program_name = NULL;
 
4651
 
 
4652
void * xmalloc (size_t num);
 
4653
char * xstrdup (const char *string);
 
4654
char * basename (const char *name);
 
4655
char * fnqualify(const char *path);
 
4656
char * strendzap(char *str, const char *pat);
 
4657
void lt_fatal (const char *message, ...);
 
4658
 
 
4659
int
 
4660
main (int argc, char *argv[])
 
4661
{
 
4662
  char **newargz;
 
4663
  int i;
 
4664
  
 
4665
  program_name = (char *) xstrdup ((char *) basename (argv[0]));
 
4666
  newargz = XMALLOC(char *, argc+2);
 
4667
EOF
 
4668
 
 
4669
            cat >> $cwrappersource <<EOF
 
4670
  newargz[0] = "$SHELL";
 
4671
EOF
 
4672
 
 
4673
            cat >> $cwrappersource <<"EOF"
 
4674
  newargz[1] = fnqualify(argv[0]);
 
4675
  /* we know the script has the same name, without the .exe */
 
4676
  /* so make sure newargz[1] doesn't end in .exe */
 
4677
  strendzap(newargz[1],".exe"); 
 
4678
  for (i = 1; i < argc; i++)
 
4679
    newargz[i+1] = xstrdup(argv[i]);
 
4680
  newargz[argc+1] = NULL;
 
4681
EOF
 
4682
 
 
4683
            cat >> $cwrappersource <<EOF
 
4684
  execv("$SHELL",newargz);
 
4685
EOF
 
4686
 
 
4687
            cat >> $cwrappersource <<"EOF"
 
4688
}
 
4689
 
 
4690
void *
 
4691
xmalloc (size_t num)
 
4692
{
 
4693
  void * p = (void *) malloc (num);
 
4694
  if (!p)
 
4695
    lt_fatal ("Memory exhausted");
 
4696
 
 
4697
  return p;
 
4698
}
 
4699
 
 
4700
char * 
 
4701
xstrdup (const char *string)
 
4702
{
 
4703
  return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
 
4704
;
 
4705
}
 
4706
 
 
4707
char *
 
4708
basename (const char *name)
 
4709
{
 
4710
  const char *base;
 
4711
 
 
4712
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
 
4713
  /* Skip over the disk name in MSDOS pathnames. */
 
4714
  if (isalpha (name[0]) && name[1] == ':') 
 
4715
    name += 2;
 
4716
#endif
 
4717
 
 
4718
  for (base = name; *name; name++)
 
4719
    if (IS_DIR_SEPARATOR (*name))
 
4720
      base = name + 1;
 
4721
  return (char *) base;
 
4722
}
 
4723
 
 
4724
char * 
 
4725
fnqualify(const char *path)
 
4726
{
 
4727
  size_t size;
 
4728
  char *p;
 
4729
  char tmp[LT_PATHMAX + 1];
 
4730
 
 
4731
  assert(path != NULL);
 
4732
 
 
4733
  /* Is it qualified already? */
 
4734
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
 
4735
  if (isalpha (path[0]) && path[1] == ':')
 
4736
    return xstrdup (path);
 
4737
#endif
 
4738
  if (IS_DIR_SEPARATOR (path[0]))
 
4739
    return xstrdup (path);
 
4740
 
 
4741
  /* prepend the current directory */
 
4742
  /* doesn't handle '~' */
 
4743
  if (getcwd (tmp, LT_PATHMAX) == NULL)
 
4744
    lt_fatal ("getcwd failed");
 
4745
  size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */
 
4746
  p = XMALLOC(char, size);
 
4747
  sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path);
 
4748
  return p;
 
4749
}
 
4750
 
 
4751
char *
 
4752
strendzap(char *str, const char *pat) 
 
4753
{
 
4754
  size_t len, patlen;
 
4755
 
 
4756
  assert(str != NULL);
 
4757
  assert(pat != NULL);
 
4758
 
 
4759
  len = strlen(str);
 
4760
  patlen = strlen(pat);
 
4761
 
 
4762
  if (patlen <= len)
 
4763
  {
 
4764
    str += len - patlen;
 
4765
    if (strcmp(str, pat) == 0)
 
4766
      *str = '\0';
 
4767
  }
 
4768
  return str;
 
4769
}
 
4770
 
 
4771
static void
 
4772
lt_error_core (int exit_status, const char * mode, 
 
4773
          const char * message, va_list ap)
 
4774
{
 
4775
  fprintf (stderr, "%s: %s: ", program_name, mode);
 
4776
  vfprintf (stderr, message, ap);
 
4777
  fprintf (stderr, ".\n");
 
4778
 
 
4779
  if (exit_status >= 0)
 
4780
    exit (exit_status);
 
4781
}
 
4782
 
 
4783
void
 
4784
lt_fatal (const char *message, ...)
 
4785
{
 
4786
  va_list ap;
 
4787
  va_start (ap, message);
 
4788
  lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
 
4789
  va_end (ap);
 
4790
}
 
4791
EOF
 
4792
          # we should really use a build-platform specific compiler
 
4793
          # here, but OTOH, the wrappers (shell script and this C one)
 
4794
          # are only useful if you want to execute the "real" binary.
 
4795
          # Since the "real" binary is built for $host, then this
 
4796
          # wrapper might as well be built for $host, too.
 
4797
          $run $LTCC -s -o $cwrapper $cwrappersource
 
4798
          ;;
 
4799
        esac
3925
4800
        $rm $output
3926
4801
        trap "$rm $output; exit 1" 1 2 15
3927
4802
 
3939
4814
 
3940
4815
# Sed substitution that helps us do robust quoting.  It backslashifies
3941
4816
# metacharacters that are still active within double-quoted strings.
3942
 
Xsed='sed -e 1s/^X//'
 
4817
Xsed='${SED} -e 1s/^X//'
3943
4818
sed_quote_subst='$sed_quote_subst'
3944
4819
 
3945
4820
# The HP-UX ksh and POSIX shell print the target directory to stdout
3951
4826
# This environment variable determines our operation mode.
3952
4827
if test \"\$libtool_install_magic\" = \"$magic\"; then
3953
4828
  # install mode needs the following variable:
3954
 
  uninst_deplibs='$uninst_deplibs'
 
4829
  notinst_deplibs='$notinst_deplibs'
3955
4830
else
3956
4831
  # When we are sourced in execute mode, \$file and \$echo are already set.
3957
4832
  if test \"\$libtool_execute_magic\" != \"$magic\"; then
3977
4852
  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
3978
4853
 
3979
4854
  # Follow symbolic links until we get to the real thisdir.
3980
 
  file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
 
4855
  file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
3981
4856
  while test -n \"\$file\"; do
3982
4857
    destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
3983
4858
 
3990
4865
    fi
3991
4866
 
3992
4867
    file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
3993
 
    file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
 
4868
    file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
3994
4869
  done
3995
4870
 
3996
4871
  # Try to get the absolute directory name.
3999
4874
"
4000
4875
 
4001
4876
        if test "$fast_install" = yes; then
4002
 
          echo >> $output "\
 
4877
          $echo >> $output "\
4003
4878
  program=lt-'$outputname'$exeext
4004
4879
  progdir=\"\$thisdir/$objdir\"
4005
4880
 
4006
4881
  if test ! -f \"\$progdir/\$program\" || \\
4007
 
     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
 
4882
     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
4008
4883
       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
4009
4884
 
4010
4885
    file=\"\$\$-\$program\"
4015
4890
      $rm \"\$progdir/\$file\"
4016
4891
    fi"
4017
4892
 
4018
 
          echo >> $output "\
 
4893
          $echo >> $output "\
4019
4894
 
4020
4895
    # relink executable if necessary
4021
4896
    if test -n \"\$relink_command\"; then
4022
 
      if (eval \$relink_command); then :
 
4897
      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
4023
4898
      else
 
4899
        $echo \"\$relink_command_output\" >&2
4024
4900
        $rm \"\$progdir/\$file\"
4025
4901
        exit 1
4026
4902
      fi
4032
4908
    $rm \"\$progdir/\$file\"
4033
4909
  fi"
4034
4910
        else
4035
 
          echo >> $output "\
 
4911
          $echo >> $output "\
4036
4912
  program='$outputname'
4037
4913
  progdir=\"\$thisdir/$objdir\"
4038
4914
"
4039
4915
        fi
4040
4916
 
4041
 
        echo >> $output "\
 
4917
        $echo >> $output "\
4042
4918
 
4043
4919
  if test -f \"\$progdir/\$program\"; then"
4044
4920
 
4069
4945
      # Run the actual program with our arguments.
4070
4946
"
4071
4947
        case $host in
4072
 
        # win32 systems need to use the prog path for dll
4073
 
        # lookup to work
4074
 
        *-*-cygwin* | *-*-pw32*)
4075
 
          $echo >> $output "\
4076
 
      exec \$progdir/\$program \${1+\"\$@\"}
4077
 
"
4078
 
          ;;
4079
 
 
4080
4948
        # Backslashes separate directories on plain windows
4081
4949
        *-*-mingw | *-*-os2*)
4082
4950
          $echo >> $output "\
4085
4953
          ;;
4086
4954
 
4087
4955
        *)
 
4956
          # Need to set LD_LIBRARY_PATH, to the value already
 
4957
          # computed within libtool.
4088
4958
          $echo >> $output "\
4089
 
      # Export the path to the program.
4090
 
      PATH=\"\$progdir:\$PATH\"
4091
 
      export PATH
4092
 
 
4093
 
      exec \$program \${1+\"\$@\"}
 
4959
      LD_LIBRARY_PATH=\"$rpath\" exec \$progdir/\$program \${1+\"\$@\"}
4094
4960
"
4095
4961
          ;;
4096
4962
        esac
4102
4968
    # The program doesn't exist.
4103
4969
    \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
4104
4970
    \$echo \"This script is just a wrapper for \$program.\" 1>&2
4105
 
    echo \"See the $PACKAGE documentation for more information.\" 1>&2
 
4971
    $echo \"See the $PACKAGE documentation for more information.\" 1>&2
4106
4972
    exit 1
4107
4973
  fi
4108
4974
fi\
4125
4991
          oldobjs="$libobjs_save"
4126
4992
          build_libtool_libs=no
4127
4993
        else
4128
 
          oldobjs="$objs$old_deplibs $non_pic_objects"
 
4994
          oldobjs="$old_deplibs $non_pic_objects"
4129
4995
        fi
4130
4996
        addlibs="$old_convenience"
4131
4997
      fi
4137
5003
        $show "$mkdir $gentop"
4138
5004
        $run $mkdir "$gentop"
4139
5005
        status=$?
4140
 
        if test $status -ne 0 && test ! -d "$gentop"; then
 
5006
        if test "$status" -ne 0 && test ! -d "$gentop"; then
4141
5007
          exit $status
4142
5008
        fi
4143
5009
        generated="$generated $gentop"
4157
5023
          $show "$mkdir $xdir"
4158
5024
          $run $mkdir "$xdir"
4159
5025
          status=$?
4160
 
          if test $status -ne 0 && test ! -d "$xdir"; then
 
5026
          if test "$status" -ne 0 && test ! -d "$xdir"; then
4161
5027
            exit $status
4162
5028
          fi
 
5029
          # We will extract separately just the conflicting names and we will no
 
5030
          # longer touch any unique names. It is faster to leave these extract
 
5031
          # automatically by $AR in one run.
4163
5032
          $show "(cd $xdir && $AR x $xabs)"
4164
5033
          $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
 
5034
          if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
 
5035
            :
 
5036
          else
 
5037
            $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
 
5038
            $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
 
5039
            $AR t "$xabs" | sort | uniq -cd | while read -r count name
 
5040
            do
 
5041
              i=1
 
5042
              while test "$i" -le "$count"
 
5043
              do
 
5044
               # Put our $i before any first dot (extension)
 
5045
               # Never overwrite any file
 
5046
               name_to="$name"
 
5047
               while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
 
5048
               do
 
5049
                 name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
 
5050
               done
 
5051
               $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
 
5052
               $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
 
5053
               i=`expr $i + 1`
 
5054
              done
 
5055
            done
 
5056
          fi
4165
5057
 
4166
 
          oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print | $NL2SP`
 
5058
          oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
4167
5059
        done
4168
5060
      fi
4169
5061
 
 
5062
      compiler_flags="$compiler_flags $add_flags"
 
5063
 
4170
5064
      # Do each command in the archive commands.
4171
5065
      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
4172
5066
        eval cmds=\"$old_archive_from_new_cmds\"
4173
5067
      else
4174
 
#       # Ensure that we have .o objects in place in case we decided
4175
 
#       # not to build a shared library, and have fallen back to building
4176
 
#       # static libs even though --disable-static was passed!
4177
 
#       for oldobj in $oldobjs; do
4178
 
#         if test ! -f $oldobj; then
4179
 
#           xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
4180
 
#           if test "X$xdir" = "X$oldobj"; then
4181
 
#             xdir="."
4182
 
#           else
4183
 
#             xdir="$xdir"
4184
 
#           fi
4185
 
#           baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
4186
 
#           obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
4187
 
#           $show "(cd $xdir && ${LN_S} $obj $baseobj)"
4188
 
#           $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
4189
 
#         fi
4190
 
#       done
4191
 
 
4192
 
        eval cmds=\"$old_archive_cmds\"
4193
 
 
4194
 
        if len=`expr "X$cmds" : ".*"` &&
4195
 
             test $len -le $max_cmd_len; then
4196
 
          :
4197
 
        else
4198
 
          # the command line is too long to link in one step, link in parts
4199
 
          $echo "using piecewise archive linking..."
 
5068
        eval cmds=\"$old_archive_cmds\"
 
5069
 
 
5070
        if len=`expr "X$cmds" : ".*"` &&
 
5071
             test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
 
5072
          :
 
5073
        else
 
5074
          # the command line is too long to link in one step, link in parts
 
5075
          $echo "using piecewise archive linking..."
4200
5076
          save_RANLIB=$RANLIB
4201
5077
          RANLIB=:
4202
 
          objlist=
4203
 
          concat_cmds=
4204
 
          save_oldobjs=$oldobjs
4205
 
          for obj in $save_oldobjs
4206
 
          do
4207
 
            oldobjs="$objlist $obj"
4208
 
            objlist="$objlist $obj"
4209
 
            eval test_cmds=\"$old_archive_cmds\"
4210
 
            if len=`expr "X$test_cmds" : ".*"` &&
4211
 
               test $len -le $max_cmd_len; then
4212
 
              :
4213
 
            else
4214
 
              # the above command should be used before it gets too long
4215
 
              oldobjs=$objlist
 
5078
          objlist=
 
5079
          concat_cmds=
 
5080
          save_oldobjs=$oldobjs
 
5081
          # GNU ar 2.10+ was changed to match POSIX; thus no paths are
 
5082
          # encoded into archives.  This makes 'ar r' malfunction in
 
5083
          # this piecewise linking case whenever conflicting object
 
5084
          # names appear in distinct ar calls; check, warn and compensate.
 
5085
            if (for obj in $save_oldobjs
 
5086
            do
 
5087
              $echo "X$obj" | $Xsed -e 's%^.*/%%'
 
5088
            done | sort | sort -uc >/dev/null 2>&1); then
 
5089
            :
 
5090
          else
 
5091
            $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2
 
5092
            $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2
 
5093
            AR_FLAGS=cq
 
5094
          fi
 
5095
          # Is there a better way of finding the last object in the list?
 
5096
          for obj in $save_oldobjs
 
5097
          do
 
5098
            last_oldobj=$obj
 
5099
          done  
 
5100
          for obj in $save_oldobjs
 
5101
          do
 
5102
            oldobjs="$objlist $obj"
 
5103
            objlist="$objlist $obj"
 
5104
            eval test_cmds=\"$old_archive_cmds\"
 
5105
            if len=`expr "X$test_cmds" : ".*"` &&
 
5106
               test "$len" -le "$max_cmd_len"; then
 
5107
              :
 
5108
            else
 
5109
              # the above command should be used before it gets too long
 
5110
              oldobjs=$objlist
 
5111
              if test "$obj" = "$last_oldobj" ; then
 
5112
                RANLIB=$save_RANLIB
 
5113
              fi  
4216
5114
              test -z "$concat_cmds" || concat_cmds=$concat_cmds~
4217
 
              eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
4218
 
              objlist=
4219
 
            fi
4220
 
          done
 
5115
              eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
 
5116
              objlist=
 
5117
            fi
 
5118
          done
4221
5119
          RANLIB=$save_RANLIB
4222
 
          oldobjs=$objlist
4223
 
          eval cmds=\"\$concat_cmds~$old_archive_cmds\"
4224
 
        fi
 
5120
          oldobjs=$objlist
 
5121
          if test "X$oldobjs" = "X" ; then
 
5122
            eval cmds=\"\$concat_cmds\"
 
5123
          else
 
5124
            eval cmds=\"\$concat_cmds~$old_archive_cmds\"
 
5125
          fi
 
5126
        fi
4225
5127
      fi
4226
 
      IFS="${IFS=       }"; save_ifs="$IFS"; IFS='~'
 
5128
      save_ifs="$IFS"; IFS='~'
4227
5129
      for cmd in $cmds; do
4228
5130
        IFS="$save_ifs"
4229
5131
        $show "$cmd"
4256
5158
        fi
4257
5159
      done
4258
5160
      # Quote the link command for shipping.
4259
 
      relink_command="cd `pwd`; $SHELL $0 --mode=relink $libtool_args"
 
5161
      relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@)"
4260
5162
      relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
4261
 
 
 
5163
      if test "$hardcode_automatic" = yes ; then
 
5164
        relink_command=
 
5165
      fi  
4262
5166
      # Only create the output if not a dry run.
4263
5167
      if test -z "$run"; then
4264
5168
        for installed in no yes; do
4273
5177
              case $deplib in
4274
5178
              *.la)
4275
5179
                name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
4276
 
                eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
 
5180
                eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
4277
5181
                if test -z "$libdir"; then
4278
5182
                  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
4279
5183
                  exit 1
4287
5191
            newdlfiles=
4288
5192
            for lib in $dlfiles; do
4289
5193
              name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
4290
 
              eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
 
5194
              eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
4291
5195
              if test -z "$libdir"; then
4292
5196
                $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
4293
5197
                exit 1
4298
5202
            newdlprefiles=
4299
5203
            for lib in $dlprefiles; do
4300
5204
              name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
4301
 
              eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
 
5205
              eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
4302
5206
              if test -z "$libdir"; then
4303
5207
                $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
4304
5208
                exit 1
4311
5215
          # place dlname in correct position for cygwin
4312
5216
          tdlname=$dlname
4313
5217
          case $host,$output,$installed,$module,$dlname in
4314
 
            *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
 
5218
            *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
4315
5219
          esac
4316
5220
          $echo > $output "\
4317
5221
# $outputname - a libtool library file
4340
5244
# Is this an already installed library?
4341
5245
installed=$installed
4342
5246
 
 
5247
# Should we warn about portability when linking against -modules?
 
5248
shouldnotlink=$module
 
5249
 
4343
5250
# Files to dlopen/dlpreopen
4344
5251
dlopen='$dlfiles'
4345
5252
dlpreopen='$dlprefiles'
4346
5253
 
4347
5254
# Directory that this library needs to be installed in:
4348
5255
libdir='$install_libdir'"
4349
 
          if test $hardcode_into_libs = all &&
4350
 
             test "$installed" = no && test $need_relink = yes; then
 
5256
          if test "$installed" = no && test "$need_relink" = yes && test "$fast_install" = no; then
4351
5257
            $echo >> $output "\
4352
5258
relink_command=\"$relink_command\""
4353
5259
          fi
4483
5389
 
4484
5390
      # Not a directory, so check to see that there is only one file specified.
4485
5391
      set dummy $files
4486
 
      if test $# -gt 2; then
 
5392
      if test "$#" -gt 2; then
4487
5393
        $echo "$modename: \`$dest' is not a directory" 1>&2
4488
5394
        $echo "$help" 1>&2
4489
5395
        exit 1
4523
5429
 
4524
5430
      *.la)
4525
5431
        # Check to see that this really is a libtool archive.
4526
 
        if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
 
5432
        if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4527
5433
        else
4528
5434
          $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
4529
5435
          $echo "$help" 1>&2
4557
5463
        test "X$dir" = "X$file/" && dir=
4558
5464
        dir="$dir$objdir"
4559
5465
 
4560
 
        if test "$hardcode_into_libs" = all && test -n "$relink_command"; then
 
5466
        if test -n "$relink_command"; then
 
5467
          # Determine the prefix the user has applied to our future dir.
 
5468
          inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
 
5469
 
 
5470
          # Don't allow the user to place us outside of our expected
 
5471
          # location b/c this prevents finding dependent libraries that
 
5472
          # are installed to the same prefix.
 
5473
          # At present, this check doesn't affect windows .dll's that
 
5474
          # are installed into $libdir/../bin (currently, that works fine)
 
5475
          # but it's something to keep an eye on.
 
5476
          if test "$inst_prefix_dir" = "$destdir"; then
 
5477
            $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
 
5478
            exit 1
 
5479
          fi
 
5480
 
 
5481
          if test -n "$inst_prefix_dir"; then
 
5482
            # Stick the inst_prefix_dir data into the link command.
 
5483
            relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
 
5484
          else
 
5485
            relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
 
5486
          fi
 
5487
 
4561
5488
          $echo "$modename: warning: relinking \`$file'" 1>&2
4562
5489
          $show "$relink_command"
4563
5490
          if $run eval "$relink_command"; then :
4564
5491
          else
4565
5492
            $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4566
 
            continue
 
5493
            exit 1
4567
5494
          fi
4568
5495
        fi
4569
5496
 
4575
5502
          shift
4576
5503
 
4577
5504
          srcname="$realname"
4578
 
          test "$hardcode_into_libs" = all && test -n "$relink_command" && srcname="$realname"T
 
5505
          test -n "$relink_command" && srcname="$realname"T
4579
5506
 
4580
5507
          # Install the shared library and build the symlinks.
4581
5508
          $show "$install_prog $dir/$srcname $destdir/$realname"
4585
5512
            $run eval "$striplib $destdir/$realname" || exit $?
4586
5513
          fi
4587
5514
 
4588
 
          if test $# -gt 0; then
 
5515
          if test "$#" -gt 0; then
4589
5516
            # Delete the old symlinks, and create new ones.
4590
5517
            for linkname
4591
5518
            do
4599
5526
          # Do each command in the postinstall commands.
4600
5527
          lib="$destdir/$realname"
4601
5528
          eval cmds=\"$postinstall_cmds\"
4602
 
          IFS="${IFS=   }"; save_ifs="$IFS"; IFS='~'
 
5529
          save_ifs="$IFS"; IFS='~'
4603
5530
          for cmd in $cmds; do
4604
5531
            IFS="$save_ifs"
4605
5532
            $show "$cmd"
4671
5598
          destfile="$destdir/$destfile"
4672
5599
        fi
4673
5600
 
 
5601
        # If the file is missing, and there is a .exe on the end, strip it
 
5602
        # because it is most likely a libtool script we actually want to
 
5603
        # install
 
5604
        stripped_ext=""
 
5605
        case $file in
 
5606
          *.exe)
 
5607
            if test ! -f "$file"; then
 
5608
              file=`$echo $file|${SED} 's,.exe$,,'`
 
5609
              stripped_ext=".exe"
 
5610
            fi
 
5611
            ;;
 
5612
        esac
 
5613
 
4674
5614
        # Do a test to see if this is really a libtool program.
4675
 
        if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4676
 
          uninst_deplibs=
 
5615
        case $host in
 
5616
        *cygwin*|*mingw*)
 
5617
            wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
 
5618
            ;;
 
5619
        *)
 
5620
            wrapper=$file
 
5621
            ;;
 
5622
        esac
 
5623
        if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
 
5624
          notinst_deplibs=
4677
5625
          relink_command=
4678
5626
 
 
5627
          # To insure that "foo" is sourced, and not "foo.exe",
 
5628
          # finese the cygwin/MSYS system by explicitly sourcing "foo."
 
5629
          # which disallows the automatic-append-.exe behavior.
 
5630
          case $build in
 
5631
          *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
 
5632
          *) wrapperdot=${wrapper} ;;
 
5633
          esac
4679
5634
          # If there is no directory component, then add one.
4680
5635
          case $file in
4681
 
          */* | *\\*) . $file ;;
4682
 
          *) . ./$file ;;
 
5636
          */* | *\\*) . ${wrapperdot} ;;
 
5637
          *) . ./${wrapperdot} ;;
4683
5638
          esac
4684
5639
 
4685
5640
          # Check the variables that should have been set.
4686
 
          if test -z "$uninst_deplibs"; then
4687
 
            $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
 
5641
          if test -z "$notinst_deplibs"; then
 
5642
            $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
4688
5643
            exit 1
4689
5644
          fi
4690
5645
 
4691
5646
          finalize=yes
4692
 
          for lib in $uninst_deplibs; do
 
5647
          for lib in $notinst_deplibs; do
4693
5648
            # Check to see that each library is installed.
4694
5649
            libdir=
4695
5650
            if test -f "$lib"; then
4707
5662
          done
4708
5663
 
4709
5664
          relink_command=
 
5665
          # To insure that "foo" is sourced, and not "foo.exe",
 
5666
          # finese the cygwin/MSYS system by explicitly sourcing "foo."
 
5667
          # which disallows the automatic-append-.exe behavior.
 
5668
          case $build in
 
5669
          *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
 
5670
          *) wrapperdot=${wrapper} ;;
 
5671
          esac
4710
5672
          # If there is no directory component, then add one.
4711
5673
          case $file in
4712
 
          */* | *\\*) . $file ;;
4713
 
          *) . ./$file ;;
 
5674
          */* | *\\*) . ${wrapperdot} ;;
 
5675
          *) . ./${wrapperdot} ;;
4714
5676
          esac
4715
5677
 
4716
5678
          outputname=
4719
5681
              tmpdir="/tmp"
4720
5682
              test -n "$TMPDIR" && tmpdir="$TMPDIR"
4721
5683
              tmpdir="$tmpdir/libtool-$$"
4722
 
              if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
 
5684
              if $mkdir "$tmpdir" && chmod 700 "$tmpdir"; then :
4723
5685
              else
4724
5686
                $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
4725
5687
                continue
4726
5688
              fi
4727
 
              file=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
 
5689
              file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
4728
5690
              outputname="$tmpdir/$file"
4729
5691
              # Replace the output file specification.
4730
5692
              relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
4742
5704
            fi
4743
5705
          else
4744
5706
            # Install the binary that we compiled earlier.
4745
 
            file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
 
5707
            file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
4746
5708
          fi
4747
5709
        fi
4748
5710
 
4749
 
 
4750
5711
        # remove .exe since cygwin /usr/bin/install will append another
4751
5712
        # one anyways
4752
5713
        case $install_prog,$host in
4759
5720
            destfile=$destfile.exe
4760
5721
            ;;
4761
5722
          *:*.exe)
4762
 
            destfile=`echo $destfile | sed -e 's,.exe$,,'`
 
5723
            destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
4763
5724
            ;;
4764
5725
          esac
4765
5726
          ;;
4766
5727
        esac
4767
 
 
4768
5728
        $show "$install_prog$stripme $file $destfile"
4769
5729
        $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
4770
5730
        test -n "$outputname" && ${rm}r "$tmpdir"
4788
5748
 
4789
5749
      # Do each command in the postinstall commands.
4790
5750
      eval cmds=\"$old_postinstall_cmds\"
4791
 
      IFS="${IFS=       }"; save_ifs="$IFS"; IFS='~'
 
5751
      save_ifs="$IFS"; IFS='~'
4792
5752
      for cmd in $cmds; do
4793
5753
        IFS="$save_ifs"
4794
5754
        $show "$cmd"
4804
5764
    if test -n "$current_libdirs"; then
4805
5765
      # Maybe just do a dry run.
4806
5766
      test -n "$run" && current_libdirs=" -n$current_libdirs"
4807
 
      exec $SHELL $0 --finish$current_libdirs
4808
 
      exit 1
 
5767
      exec_cmd='$SHELL $0 --finish$current_libdirs'
 
5768
    else
 
5769
      exit 0
4809
5770
    fi
4810
 
 
4811
 
    exit 0
4812
5771
    ;;
4813
5772
 
4814
5773
  # libtool finish mode
4827
5786
        if test -n "$finish_cmds"; then
4828
5787
          # Do each command in the finish commands.
4829
5788
          eval cmds=\"$finish_cmds\"
4830
 
          IFS="${IFS=   }"; save_ifs="$IFS"; IFS='~'
 
5789
          save_ifs="$IFS"; IFS='~'
4831
5790
          for cmd in $cmds; do
4832
5791
            IFS="$save_ifs"
4833
5792
            $show "$cmd"
4848
5807
    # Exit here if they wanted silent mode.
4849
5808
    exit 0
4850
5809
 
4851
 
    echo "----------------------------------------------------------------------"
4852
 
    echo "Libraries have been installed in:"
 
5810
    $echo "----------------------------------------------------------------------"
 
5811
    $echo "Libraries have been installed in:"
4853
5812
    for libdir in $libdirs; do
4854
 
      echo "   $libdir"
 
5813
      $echo "   $libdir"
4855
5814
    done
4856
 
    echo
4857
 
    echo "If you ever happen to want to link against installed libraries"
4858
 
    echo "in a given directory, LIBDIR, you must either use libtool, and"
4859
 
    echo "specify the full pathname of the library, or use \`-LLIBDIR'"
4860
 
    echo "flag during linking and do at least one of the following:"
 
5815
    $echo
 
5816
    $echo "If you ever happen to want to link against installed libraries"
 
5817
    $echo "in a given directory, LIBDIR, you must either use libtool, and"
 
5818
    $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
 
5819
    $echo "flag during linking and do at least one of the following:"
4861
5820
    if test -n "$shlibpath_var"; then
4862
 
      echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
4863
 
      echo "     during execution"
 
5821
      $echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
 
5822
      $echo "     during execution"
4864
5823
    fi
4865
5824
    if test -n "$runpath_var"; then
4866
 
      echo "   - add LIBDIR to the \`$runpath_var' environment variable"
4867
 
      echo "     during linking"
 
5825
      $echo "   - add LIBDIR to the \`$runpath_var' environment variable"
 
5826
      $echo "     during linking"
4868
5827
    fi
4869
5828
    if test -n "$hardcode_libdir_flag_spec"; then
4870
5829
      libdir=LIBDIR
4871
5830
      eval flag=\"$hardcode_libdir_flag_spec\"
4872
5831
 
4873
 
      echo "   - use the \`$flag' linker flag"
 
5832
      $echo "   - use the \`$flag' linker flag"
4874
5833
    fi
4875
5834
    if test -n "$admincmds"; then
4876
 
      echo "   - have your system administrator run these commands:$admincmds"
 
5835
      $echo "   - have your system administrator run these commands:$admincmds"
4877
5836
    fi
4878
5837
    if test -f /etc/ld.so.conf; then
4879
 
      echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
 
5838
      $echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
4880
5839
    fi
4881
 
    echo
4882
 
    echo "See any operating system documentation about shared libraries for"
4883
 
    echo "more information, such as the ld(1) and ld.so(8) manual pages."
4884
 
    echo "----------------------------------------------------------------------"
 
5840
    $echo
 
5841
    $echo "See any operating system documentation about shared libraries for"
 
5842
    $echo "more information, such as the ld(1) and ld.so(8) manual pages."
 
5843
    $echo "----------------------------------------------------------------------"
4885
5844
    exit 0
4886
5845
    ;;
4887
5846
 
4909
5868
      case $file in
4910
5869
      *.la)
4911
5870
        # Check to see that this really is a libtool archive.
4912
 
        if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
 
5871
        if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4913
5872
        else
4914
5873
          $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
4915
5874
          $echo "$help" 1>&2
4980
5939
      -*) ;;
4981
5940
      *)
4982
5941
        # Do a test to see if this is really a libtool program.
4983
 
        if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
5942
        if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4984
5943
          # If there is no directory component, then add one.
4985
5944
          case $file in
4986
5945
          */* | *\\*) . $file ;;
5003
5962
        eval "export $shlibpath_var"
5004
5963
      fi
5005
5964
 
5006
 
      # Restore saved enviroment variables
 
5965
      # Restore saved environment variables
5007
5966
      if test "${save_LC_ALL+set}" = set; then
5008
5967
        LC_ALL="$save_LC_ALL"; export LC_ALL
5009
5968
      fi
5011
5970
        LANG="$save_LANG"; export LANG
5012
5971
      fi
5013
5972
 
5014
 
      # Now actually exec the command.
5015
 
      eval "exec \$cmd$args"
5016
 
 
5017
 
      $echo "$modename: cannot exec \$cmd$args"
5018
 
      exit 1
 
5973
      # Now prepare to actually exec the command.
 
5974
      exec_cmd="\$cmd$args"
5019
5975
    else
5020
5976
      # Display what would be done.
5021
5977
      if test -n "$shlibpath_var"; then
5032
5988
    modename="$modename: $mode"
5033
5989
    rm="$nonopt"
5034
5990
    files=
 
5991
    rmforce=
 
5992
    exit_status=0
5035
5993
 
5036
5994
    # This variable tells wrapper scripts just to set variables rather
5037
5995
    # than running their programs.
5040
5998
    for arg
5041
5999
    do
5042
6000
      case $arg in
 
6001
      -f) rm="$rm $arg"; rmforce=yes ;;
5043
6002
      -*) rm="$rm $arg" ;;
5044
6003
      *) files="$files $arg" ;;
5045
6004
      esac
5053
6012
 
5054
6013
    rmdirs=
5055
6014
 
 
6015
    origobjdir="$objdir"
5056
6016
    for file in $files; do
5057
6017
      dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
5058
6018
      if test "X$dir" = "X$file"; then
5059
6019
        dir=.
5060
 
        objdir="$objdir"
 
6020
        objdir="$origobjdir"
5061
6021
      else
5062
 
        objdir="$dir/$objdir"
 
6022
        objdir="$dir/$origobjdir"
5063
6023
      fi
5064
6024
      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5065
 
      test $mode = uninstall && objdir="$dir"
 
6025
      test "$mode" = uninstall && objdir="$dir"
5066
6026
 
5067
6027
      # Remember objdir for removal later, being careful to avoid duplicates
5068
 
      if test $mode = clean; then
5069
 
        case " $rmdirs " in
 
6028
      if test "$mode" = clean; then
 
6029
        case " $rmdirs " in
5070
6030
          *" $objdir "*) ;;
5071
6031
          *) rmdirs="$rmdirs $objdir" ;;
5072
6032
        esac
5073
6033
      fi
5074
6034
 
 
6035
      # Don't error if the file doesn't exist and rm -f was used.
 
6036
      if (test -L "$file") >/dev/null 2>&1 \
 
6037
        || (test -h "$file") >/dev/null 2>&1 \
 
6038
        || test -f "$file"; then
 
6039
        :
 
6040
      elif test -d "$file"; then
 
6041
        exit_status=1
 
6042
        continue
 
6043
      elif test "$rmforce" = yes; then
 
6044
        continue
 
6045
      fi
 
6046
 
5075
6047
      rmfiles="$file"
5076
6048
 
5077
6049
      case $name in
5078
6050
      *.la)
5079
6051
        # Possibly a libtool archive, so verify it.
5080
 
        if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
6052
        if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
5081
6053
          . $dir/$name
5082
6054
 
5083
6055
          # Delete the libtool libraries and symlinks.
5085
6057
            rmfiles="$rmfiles $objdir/$n"
5086
6058
          done
5087
6059
          test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
5088
 
          test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
 
6060
          test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
5089
6061
 
5090
 
          if test $mode = uninstall; then
 
6062
          if test "$mode" = uninstall; then
5091
6063
            if test -n "$library_names"; then
5092
6064
              # Do each command in the postuninstall commands.
5093
6065
              eval cmds=\"$postuninstall_cmds\"
5094
 
              IFS="${IFS=       }"; save_ifs="$IFS"; IFS='~'
 
6066
              save_ifs="$IFS"; IFS='~'
5095
6067
              for cmd in $cmds; do
5096
6068
                IFS="$save_ifs"
5097
6069
                $show "$cmd"
5098
6070
                $run eval "$cmd"
 
6071
                if test "$?" -ne 0 && test "$rmforce" != yes; then
 
6072
                  exit_status=1
 
6073
                fi
5099
6074
              done
5100
6075
              IFS="$save_ifs"
5101
6076
            fi
5103
6078
            if test -n "$old_library"; then
5104
6079
              # Do each command in the old_postuninstall commands.
5105
6080
              eval cmds=\"$old_postuninstall_cmds\"
5106
 
              IFS="${IFS=       }"; save_ifs="$IFS"; IFS='~'
 
6081
              save_ifs="$IFS"; IFS='~'
5107
6082
              for cmd in $cmds; do
5108
6083
                IFS="$save_ifs"
5109
6084
                $show "$cmd"
5110
6085
                $run eval "$cmd"
 
6086
                if test "$?" -ne 0 && test "$rmforce" != yes; then
 
6087
                  exit_status=1
 
6088
                fi
5111
6089
              done
5112
6090
              IFS="$save_ifs"
5113
6091
            fi
5118
6096
 
5119
6097
      *.lo)
5120
6098
        # Possibly a libtool object, so verify it.
5121
 
        if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
6099
        if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
5122
6100
 
5123
 
          # Read the .lo file
5124
 
          . $dir/$name
 
6101
          # Read the .lo file
 
6102
          . $dir/$name
5125
6103
 
5126
6104
          # Add PIC object to the list of files to remove.
5127
 
          if test -n "$pic_object" \
5128
 
             && test "$pic_object" != none; then
 
6105
          if test -n "$pic_object" \
 
6106
             && test "$pic_object" != none; then
5129
6107
            rmfiles="$rmfiles $dir/$pic_object"
5130
 
          fi
 
6108
          fi
5131
6109
 
5132
6110
          # Add non-PIC object to the list of files to remove.
5133
 
          if test -n "$non_pic_object" \
5134
 
             && test "$non_pic_object" != none; then
 
6111
          if test -n "$non_pic_object" \
 
6112
             && test "$non_pic_object" != none; then
5135
6113
            rmfiles="$rmfiles $dir/$non_pic_object"
5136
 
          fi
 
6114
          fi
5137
6115
        fi
5138
6116
        ;;
5139
6117
 
5140
6118
      *)
5141
 
        # Do a test to see if this is a libtool program.
5142
 
        if test $mode = clean &&
5143
 
           (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
5144
 
          relink_command=
5145
 
          . $dir/$file
 
6119
        if test "$mode" = clean ; then
 
6120
          noexename=$name
 
6121
          case $file in
 
6122
          *.exe) 
 
6123
            file=`$echo $file|${SED} 's,.exe$,,'`
 
6124
            noexename=`$echo $name|${SED} 's,.exe$,,'`
 
6125
            # $file with .exe has already been added to rmfiles,
 
6126
            # add $file without .exe
 
6127
            rmfiles="$rmfiles $file"
 
6128
            ;;
 
6129
          esac
 
6130
          # Do a test to see if this is a libtool program.
 
6131
          if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
6132
            relink_command=
 
6133
            . $dir/$noexename
5146
6134
 
5147
 
          rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
5148
 
          if test "$fast_install" = yes && test -n "$relink_command"; then
5149
 
            rmfiles="$rmfiles $objdir/lt-$name"
 
6135
            # note $name still contains .exe if it was in $file originally
 
6136
            # as does the version of $file that was added into $rmfiles
 
6137
            rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
 
6138
            if test "$fast_install" = yes && test -n "$relink_command"; then
 
6139
              rmfiles="$rmfiles $objdir/lt-$name"
 
6140
            fi
 
6141
            if test "X$noexename" != "X$name" ; then
 
6142
              rmfiles="$rmfiles $objdir/lt-${noexename}.c"
 
6143
            fi
5150
6144
          fi
5151
6145
        fi
5152
6146
        ;;
5153
6147
      esac
5154
6148
      $show "$rm $rmfiles"
5155
 
      $run $rm $rmfiles
 
6149
      $run $rm $rmfiles || exit_status=1
5156
6150
    done
 
6151
    objdir="$origobjdir"
5157
6152
 
5158
6153
    # Try to remove the ${objdir}s in the directories where we deleted files
5159
6154
    for dir in $rmdirs; do
5160
6155
      if test -d "$dir"; then
5161
 
        $show "rmdir $dir"
5162
 
        $run rmdir $dir >/dev/null 2>&1
 
6156
        $show "rmdir $dir"
 
6157
        $run rmdir $dir >/dev/null 2>&1
5163
6158
      fi
5164
6159
    done
5165
6160
 
5166
 
    exit 0
 
6161
    exit $exit_status
5167
6162
    ;;
5168
6163
 
5169
6164
  "")
5173
6168
    ;;
5174
6169
  esac
5175
6170
 
5176
 
  $echo "$modename: invalid operation mode \`$mode'" 1>&2
5177
 
  $echo "$generic_help" 1>&2
5178
 
  exit 1
 
6171
  if test -z "$exec_cmd"; then
 
6172
    $echo "$modename: invalid operation mode \`$mode'" 1>&2
 
6173
    $echo "$generic_help" 1>&2
 
6174
    exit 1
 
6175
  fi
5179
6176
fi # test -z "$show_help"
5180
6177
 
 
6178
if test -n "$exec_cmd"; then
 
6179
  eval exec $exec_cmd
 
6180
  exit 1
 
6181
fi
 
6182
 
5181
6183
# We need to display help for each of the modes.
5182
6184
case $mode in
5183
6185
"") $echo \
5208
6210
      uninstall       remove libraries from an installed directory
5209
6211
 
5210
6212
MODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
5211
 
a more detailed description of MODE."
 
6213
a more detailed description of MODE.
 
6214
 
 
6215
Report bugs to <bug-libtool@gnu.org>."
5212
6216
  exit 0
5213
6217
  ;;
5214
6218
 
5235
6239
This mode accepts the following additional options:
5236
6240
 
5237
6241
  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
 
6242
  -prefer-pic       try to building PIC objects only
 
6243
  -prefer-non-pic   try to building non-PIC objects only
5238
6244
  -static           always build a \`.o' file suitable for static linking
5239
6245
 
5240
6246
COMPILE-COMMAND is a command to be used in creating a \`standard' object file
5364
6370
  ;;
5365
6371
esac
5366
6372
 
5367
 
echo
 
6373
$echo
5368
6374
$echo "Try \`$modename --help' for more information about other modes."
5369
6375
 
5370
6376
exit 0
5380
6386
# If a disable-shared tag is given, we'll fallback to a static-only
5381
6387
# configuration.  But we'll never go from static-only to shared-only.
5382
6388
 
5383
 
### BEGIN LIBTOOL TAG CONFIG: disable-shared
 
6389
# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
5384
6390
build_libtool_libs=no
5385
6391
build_old_libs=yes
5386
 
### END LIBTOOL TAG CONFIG: disable-shared
 
6392
# ### END LIBTOOL TAG CONFIG: disable-shared
5387
6393
 
5388
 
### BEGIN LIBTOOL TAG CONFIG: disable-static
5389
 
build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
5390
 
### END LIBTOOL TAG CONFIG: disable-static
 
6394
# ### BEGIN LIBTOOL TAG CONFIG: disable-static
 
6395
build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac`
 
6396
# ### END LIBTOOL TAG CONFIG: disable-static
5391
6397
 
5392
6398
# Local Variables:
5393
6399
# mode:shell-script