~ubuntu-branches/ubuntu/feisty/libwpd/feisty

« back to all changes in this revision

Viewing changes to ltmain.sh

  • Committer: Bazaar Package Importer
  • Author(s): Masayuki Hatta (mhatta)
  • Date: 2004-08-10 00:37:47 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040810003747-5i7g92h2v88z70zo
Tags: 0.7.2-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# ltmain.sh - Provide generalized library-building support services.
2
2
# NOTE: Changing this file will not affect anything until you rerun configure.
3
3
#
4
 
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003
 
4
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
5
5
# Free Software Foundation, Inc.
6
6
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
7
7
#
58
58
# Constants.
59
59
PROGRAM=ltmain.sh
60
60
PACKAGE=libtool
61
 
VERSION=1.5
62
 
TIMESTAMP=" (1.1220.2.1 2003/04/14 22:48:00)"
 
61
VERSION=1.4.3
 
62
TIMESTAMP=" (1.922.2.111 2002/10/23 02:54:36)"
63
63
 
64
64
default_mode=
65
65
help="Try \`$progname --help' for more information."
72
72
# metacharacters that are still active within double-quoted strings.
73
73
Xsed="${SED}"' -e 1s/^X//'
74
74
sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
75
 
# test EBCDIC or ASCII
76
 
case `echo A|od -x` in
77
 
 *[Cc]1*) # EBCDIC based system
78
 
  SP2NL="tr '\100' '\n'"
79
 
  NL2SP="tr '\r\n' '\100\100'"
80
 
  ;;
81
 
 *) # Assume ASCII based system
82
 
  SP2NL="tr '\040' '\012'"
83
 
  NL2SP="tr '\015\012' '\040\040'"
84
 
  ;;
85
 
esac
 
75
# test EBCDIC or ASCII                                                         
 
76
case `echo A|od -x` in                                                         
 
77
 *[Cc]1*) # EBCDIC based system                                                
 
78
  SP2NL="tr '\100' '\n'"                                                       
 
79
  NL2SP="tr '\r\n' '\100\100'"                                                 
 
80
  ;;                                                                           
 
81
 *) # Assume ASCII based system                                                
 
82
  SP2NL="tr '\040' '\012'"                                                     
 
83
  NL2SP="tr '\015\012' '\040\040'"                                             
 
84
  ;;                                                                           
 
85
esac                                                                           
86
86
 
87
87
# NLS nuisances.
88
88
# Only set LANG and LC_ALL to C if already set.
100
100
: ${IFS="       "}
101
101
 
102
102
if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
103
 
  $echo "$modename: not configured to build any kind of library" 1>&2
104
 
  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
 
103
  echo "$modename: not configured to build any kind of library" 1>&2
 
104
  echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
105
105
  exit 1
106
106
fi
107
107
 
117
117
lo2o="s/\\.lo\$/.${objext}/"
118
118
o2lo="s/\\.${objext}\$/.lo/"
119
119
 
120
 
#####################################
121
 
# Shell function definitions:
122
 
# This seems to be the best place for them
123
 
 
124
 
# Need a lot of goo to handle *both* DLLs and import libs
125
 
# Has to be a shell function in order to 'eat' the argument
126
 
# that is supplied when $file_magic_command is called.
127
 
win32_libid () {
128
 
  win32_libid_type="unknown"
129
 
  win32_fileres=`file -L $1 2>/dev/null`
130
 
  case $win32_fileres in
131
 
  *ar\ archive\ import\ library*) # definitely import
132
 
    win32_libid_type="x86 archive import"
133
 
    ;;
134
 
  *ar\ archive*) # could be an import, or static
135
 
    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
136
 
      grep -E 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
137
 
      win32_nmres=`eval $NM -f posix -A $1 | \
138
 
        sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
139
 
      if test "X$win32_nmres" = "Ximport" ; then
140
 
        win32_libid_type="x86 archive import"
141
 
      else
142
 
        win32_libid_type="x86 archive static"
143
 
      fi
144
 
    fi
145
 
    ;;
146
 
  *DLL*) 
147
 
    win32_libid_type="x86 DLL"
148
 
    ;;
149
 
  *executable*) # but shell scripts are "executable" too...
150
 
    case $win32_fileres in
151
 
    *MS\ Windows\ PE\ Intel*)
152
 
      win32_libid_type="x86 DLL"
153
 
      ;;
154
 
    esac
155
 
    ;;
156
 
  esac
157
 
  $echo $win32_libid_type
158
 
}
159
 
 
160
 
# End of Shell function definitions
161
 
#####################################
162
 
 
163
120
# Parse our command line options once, thoroughly.
164
 
while test "$#" -gt 0
 
121
while test $# -gt 0
165
122
do
166
123
  arg="$1"
167
124
  shift
177
134
    execute_dlfiles)
178
135
      execute_dlfiles="$execute_dlfiles $arg"
179
136
      ;;
180
 
    tag)
181
 
      tagname="$arg"
182
 
 
183
 
      # Check whether tagname contains only valid characters
184
 
      case $tagname in
185
 
      *[!-_A-Za-z0-9,/]*)
186
 
        $echo "$progname: invalid tag name: $tagname" 1>&2
187
 
        exit 1
188
 
        ;;
189
 
      esac
190
 
 
191
 
      case $tagname in
192
 
      CC)
193
 
        # Don't test for the "default" C tag, as we know, it's there, but
194
 
        # not specially marked.
195
 
        ;;
196
 
      *)
197
 
        if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$0" > /dev/null; then
198
 
          taglist="$taglist $tagname"
199
 
          # Evaluate the configuration.
200
 
          eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $0`"
201
 
        else
202
 
          $echo "$progname: ignoring unknown tag $tagname" 1>&2
203
 
        fi
204
 
        ;;
205
 
      esac
206
 
      ;;
207
137
    *)
208
138
      eval "$prev=\$arg"
209
139
      ;;
221
151
    ;;
222
152
 
223
153
  --version)
224
 
    $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
225
 
    $echo
226
 
    $echo "Copyright (C) 2003  Free Software Foundation, Inc."
227
 
    $echo "This is free software; see the source for copying conditions.  There is NO"
228
 
    $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
 
154
    echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
229
155
    exit 0
230
156
    ;;
231
157
 
232
158
  --config)
233
159
    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
234
 
    # Now print the configurations for the tags.
235
 
    for tagname in $taglist; do
236
 
      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$0"
237
 
    done
238
160
    exit 0
239
161
    ;;
240
162
 
241
163
  --debug)
242
 
    $echo "$progname: enabling shell trace mode"
 
164
    echo "$progname: enabling shell trace mode"
243
165
    set -x
244
166
    ;;
245
167
 
248
170
    ;;
249
171
 
250
172
  --features)
251
 
    $echo "host: $host"
 
173
    echo "host: $host"
252
174
    if test "$build_libtool_libs" = yes; then
253
 
      $echo "enable shared libraries"
 
175
      echo "enable shared libraries"
254
176
    else
255
 
      $echo "disable shared libraries"
 
177
      echo "disable shared libraries"
256
178
    fi
257
179
    if test "$build_old_libs" = yes; then
258
 
      $echo "enable static libraries"
 
180
      echo "enable static libraries"
259
181
    else
260
 
      $echo "disable static libraries"
 
182
      echo "disable static libraries"
261
183
    fi
262
184
    exit 0
263
185
    ;;
273
195
    show=:
274
196
    ;;
275
197
 
276
 
  --tag) prevopt="--tag" prev=tag ;;
277
 
  --tag=*)
278
 
    set tag "$optarg" ${1+"$@"}
279
 
    shift
280
 
    prev=tag
281
 
    ;;
282
 
 
283
198
  -dlopen)
284
199
    prevopt="-dlopen"
285
200
    prev=execute_dlfiles
313
228
 
314
229
  # Infer the operation mode.
315
230
  if test -z "$mode"; then
316
 
    $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
317
 
    $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2
318
231
    case $nonopt in
319
 
    *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
 
232
    *cc | *++ | gcc* | *-gcc* | xlc*)
320
233
      mode=link
321
234
      for arg
322
235
      do
371
284
    modename="$modename: compile"
372
285
    # Get the compilation command and the source file.
373
286
    base_compile=
374
 
    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
 
287
    prev=
 
288
    lastarg=
 
289
    srcfile="$nonopt"
375
290
    suppress_output=
376
 
    arg_mode=normal
377
 
    libobj=
378
291
 
 
292
    user_target=no
379
293
    for arg
380
294
    do
381
 
      case "$arg_mode" in
382
 
      arg  )
383
 
        # do not "continue".  Instead, add this to base_compile
384
 
        lastarg="$arg"
385
 
        arg_mode=normal
386
 
        ;;
387
 
 
388
 
      target )
 
295
      case $prev in
 
296
      "") ;;
 
297
      xcompiler)
 
298
        # Aesthetically quote the previous argument.
 
299
        prev=
 
300
        lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
 
301
 
 
302
        case $arg in
 
303
        # Double-quote args containing other shell metacharacters.
 
304
        # Many Bourne shells cannot handle close brackets correctly
 
305
        # in scan sets, so we specify it separately.
 
306
        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
 
307
          arg="\"$arg\""
 
308
          ;;
 
309
        esac
 
310
 
 
311
        # Add the previous argument to base_compile.
 
312
        if test -z "$base_compile"; then
 
313
          base_compile="$lastarg"
 
314
        else
 
315
          base_compile="$base_compile $lastarg"
 
316
        fi
 
317
        continue
 
318
        ;;
 
319
      esac
 
320
 
 
321
      # Accept any command-line options.
 
322
      case $arg in
 
323
      -o)
 
324
        if test "$user_target" != "no"; then
 
325
          $echo "$modename: you cannot specify \`-o' more than once" 1>&2
 
326
          exit 1
 
327
        fi
 
328
        user_target=next
 
329
        ;;
 
330
 
 
331
      -static)
 
332
        build_old_libs=yes
 
333
        continue
 
334
        ;;
 
335
 
 
336
      -prefer-pic)
 
337
        pic_mode=yes
 
338
        continue
 
339
        ;;
 
340
 
 
341
      -prefer-non-pic)
 
342
        pic_mode=no
 
343
        continue
 
344
        ;;
 
345
 
 
346
      -Xcompiler)
 
347
        prev=xcompiler
 
348
        continue
 
349
        ;;
 
350
 
 
351
      -Wc,*)
 
352
        args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
 
353
        lastarg=
 
354
        save_ifs="$IFS"; IFS=','
 
355
        for arg in $args; do
 
356
          IFS="$save_ifs"
 
357
 
 
358
          # Double-quote args containing other shell metacharacters.
 
359
          # Many Bourne shells cannot handle close brackets correctly
 
360
          # in scan sets, so we specify it separately.
 
361
          case $arg in
 
362
            *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
 
363
            arg="\"$arg\""
 
364
            ;;
 
365
          esac
 
366
          lastarg="$lastarg $arg"
 
367
        done
 
368
        IFS="$save_ifs"
 
369
        lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
 
370
 
 
371
        # Add the arguments to base_compile.
 
372
        if test -z "$base_compile"; then
 
373
          base_compile="$lastarg"
 
374
        else
 
375
          base_compile="$base_compile $lastarg"
 
376
        fi
 
377
        continue
 
378
        ;;
 
379
      esac
 
380
 
 
381
      case $user_target in
 
382
      next)
 
383
        # The next one is the -o target name
 
384
        user_target=yes
 
385
        continue
 
386
        ;;
 
387
      yes)
 
388
        # We got the output file
 
389
        user_target=set
389
390
        libobj="$arg"
390
 
        arg_mode=normal
391
391
        continue
392
392
        ;;
393
 
 
394
 
      normal )
395
 
        # Accept any command-line options.
396
 
        case $arg in
397
 
        -o)
398
 
          if test -n "$libobj" ; then
399
 
            $echo "$modename: you cannot specify \`-o' more than once" 1>&2
400
 
            exit 1
401
 
          fi
402
 
          arg_mode=target
403
 
          continue
404
 
          ;;
405
 
 
406
 
        -static)
407
 
          build_old_libs=yes
408
 
          continue
409
 
          ;;
410
 
 
411
 
        -prefer-pic)
412
 
          pic_mode=yes
413
 
          continue
414
 
          ;;
415
 
 
416
 
        -prefer-non-pic)
417
 
          pic_mode=no
418
 
          continue
419
 
          ;;
420
 
 
421
 
        -Xcompiler)
422
 
          arg_mode=arg  #  the next one goes into the "base_compile" arg list
423
 
          continue      #  The current "srcfile" will either be retained or
424
 
          ;;            #  replaced later.  I would guess that would be a bug.
425
 
 
426
 
        -Wc,*)
427
 
          args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
428
 
          lastarg=
429
 
          save_ifs="$IFS"; IFS=','
430
 
          for arg in $args; do
431
 
            IFS="$save_ifs"
432
 
 
433
 
            # Double-quote args containing other shell metacharacters.
434
 
            # Many Bourne shells cannot handle close brackets correctly
435
 
            # in scan sets, so we specify it separately.
436
 
            case $arg in
437
 
              *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
438
 
              arg="\"$arg\""
439
 
              ;;
440
 
            esac
441
 
            lastarg="$lastarg $arg"
442
 
          done
443
 
          IFS="$save_ifs"
444
 
          lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
445
 
 
446
 
          # Add the arguments to base_compile.
447
 
          base_compile="$base_compile $lastarg"
448
 
          continue
449
 
          ;;
450
 
 
451
 
        * )
452
 
          # Accept the current argument as the source file.
453
 
          # The previous "srcfile" becomes the current argument.
454
 
          #
455
 
          lastarg="$srcfile"
456
 
          srcfile="$arg"
457
 
          ;;
458
 
        esac  #  case $arg
459
 
        ;;
460
 
      esac    #  case $arg_mode
 
393
      esac
 
394
 
 
395
      # Accept the current argument as the source file.
 
396
      lastarg="$srcfile"
 
397
      srcfile="$arg"
461
398
 
462
399
      # Aesthetically quote the previous argument.
 
400
 
 
401
      # Backslashify any backslashes, double quotes, and dollar signs.
 
402
      # These are the only characters that are still specially
 
403
      # interpreted inside of double-quoted scrings.
463
404
      lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
464
405
 
465
 
      case $lastarg in
466
406
      # Double-quote args containing other shell metacharacters.
467
407
      # Many Bourne shells cannot handle close brackets correctly
468
408
      # in scan sets, so we specify it separately.
 
409
      case $lastarg in
469
410
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
470
411
        lastarg="\"$lastarg\""
471
412
        ;;
472
413
      esac
473
414
 
474
 
      base_compile="$base_compile $lastarg"
475
 
    done # for arg
 
415
      # Add the previous argument to base_compile.
 
416
      if test -z "$base_compile"; then
 
417
        base_compile="$lastarg"
 
418
      else
 
419
        base_compile="$base_compile $lastarg"
 
420
      fi
 
421
    done
476
422
 
477
 
    case $arg_mode in
478
 
    arg)
479
 
      $echo "$modename: you must specify an argument for -Xcompile"
480
 
      exit 1
481
 
      ;;
482
 
    target)
 
423
    case $user_target in
 
424
    set)
 
425
      ;;
 
426
    no)
 
427
      # Get the name of the library object.
 
428
      libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
 
429
      ;;
 
430
    *)
483
431
      $echo "$modename: you must specify a target with \`-o'" 1>&2
484
432
      exit 1
485
433
      ;;
486
 
    *)
487
 
      # Get the name of the library object.
488
 
      [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
489
 
      ;;
490
434
    esac
491
435
 
492
436
    # Recognize several different file suffixes.
493
437
    # If the user specifies -o file.o, it is replaced with file.lo
494
 
    xform='[cCFSifmso]'
 
438
    xform='[cCFSfmso]'
495
439
    case $libobj in
496
440
    *.ada) xform=ada ;;
497
441
    *.adb) xform=adb ;;
499
443
    *.asm) xform=asm ;;
500
444
    *.c++) xform=c++ ;;
501
445
    *.cc) xform=cc ;;
502
 
    *.ii) xform=ii ;;
503
 
    *.class) xform=class ;;
504
446
    *.cpp) xform=cpp ;;
505
447
    *.cxx) xform=cxx ;;
506
448
    *.f90) xform=f90 ;;
507
449
    *.for) xform=for ;;
508
 
    *.java) xform=java ;;
509
450
    esac
510
451
 
511
452
    libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
518
459
      ;;
519
460
    esac
520
461
 
521
 
    # Infer tagged configuration to use if any are available and
522
 
    # if one wasn't chosen via the "--tag" command line option.
523
 
    # Only attempt this if the compiler in the base compile
524
 
    # command doesn't match the default compiler.
525
 
    if test -n "$available_tags" && test -z "$tagname"; then
526
 
      case $base_compile in
527
 
      # Blanks in the command may have been stripped by the calling shell,
528
 
      # but not from the CC environment variable when configure was run.
529
 
      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "*) ;;
530
 
      # Blanks at the start of $base_compile will cause this to fail
531
 
      # if we don't check for them as well.
532
 
      *)
533
 
        for z in $available_tags; do
534
 
          if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
535
 
            # Evaluate the configuration.
536
 
            eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
537
 
            case "$base_compile " in
538
 
            "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)
539
 
              # The compiler in the base compile command matches
540
 
              # the one in the tagged configuration.
541
 
              # Assume this is the tagged configuration we want.
542
 
              tagname=$z
543
 
              break
544
 
              ;;
545
 
            esac
546
 
          fi
547
 
        done
548
 
        # If $tagname still isn't set, then no tagged configuration
549
 
        # was found and let the user know that the "--tag" command
550
 
        # line option must be used.
551
 
        if test -z "$tagname"; then
552
 
          $echo "$modename: unable to infer tagged configuration"
553
 
          $echo "$modename: specify a tag with \`--tag'" 1>&2
554
 
          exit 1
555
 
#        else
556
 
#          $echo "$modename: using $tagname tagged configuration"
557
 
        fi
558
 
        ;;
559
 
      esac
560
 
    fi
561
 
 
562
 
    objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
563
 
    xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
564
 
    if test "X$xdir" = "X$obj"; then
565
 
      xdir=
566
 
    else
567
 
      xdir=$xdir/
568
 
    fi
569
 
    lobj=${xdir}$objdir/$objname
570
 
 
571
462
    if test -z "$base_compile"; then
572
463
      $echo "$modename: you must specify a compilation command" 1>&2
573
464
      $echo "$help" 1>&2
576
467
 
577
468
    # Delete any leftover library objects.
578
469
    if test "$build_old_libs" = yes; then
579
 
      removelist="$obj $lobj $libobj ${libobj}T"
 
470
      removelist="$obj $libobj"
580
471
    else
581
 
      removelist="$lobj $libobj ${libobj}T"
 
472
      removelist="$libobj"
582
473
    fi
583
474
 
584
475
    $run $rm $removelist
603
494
      removelist="$removelist $output_obj $lockfile"
604
495
      trap "$run $rm $removelist; exit 1" 1 2 15
605
496
    else
606
 
      output_obj=
607
497
      need_locks=no
608
498
      lockfile=
609
499
    fi
617
507
      done
618
508
    elif test "$need_locks" = warn; then
619
509
      if test -f "$lockfile"; then
620
 
        $echo "\
 
510
        echo "\
621
511
*** ERROR, $lockfile exists and contains:
622
512
`cat $lockfile 2>/dev/null`
623
513
 
631
521
        $run $rm $removelist
632
522
        exit 1
633
523
      fi
634
 
      $echo $srcfile > "$lockfile"
 
524
      echo $srcfile > "$lockfile"
635
525
    fi
636
526
 
637
527
    if test -n "$fix_srcfile_path"; then
638
528
      eval srcfile=\"$fix_srcfile_path\"
639
529
    fi
640
530
 
641
 
    $run $rm "$libobj" "${libobj}T"
642
 
 
643
 
    # Create a libtool object file (analogous to a ".la" file),
644
 
    # but don't create it if we're doing a dry run.
645
 
    test -z "$run" && cat > ${libobj}T <<EOF
646
 
# $libobj - a libtool object file
647
 
# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
648
 
#
649
 
# Please DO NOT delete this file!
650
 
# It is necessary for linking the library.
651
 
 
652
 
# Name of the PIC object.
653
 
EOF
654
 
 
655
531
    # Only build a PIC object if we are building libtool libraries.
656
532
    if test "$build_libtool_libs" = yes; then
657
533
      # Without this assignment, base_compile gets emptied.
658
534
      fbsd_hideous_sh_bug=$base_compile
659
535
 
660
536
      if test "$pic_mode" != no; then
661
 
        command="$base_compile $srcfile $pic_flag"
 
537
        # All platforms use -DPIC, to notify preprocessed assembler code.
 
538
        command="$base_compile $srcfile $pic_flag -DPIC"
662
539
      else
663
540
        # Don't build PIC code
664
541
        command="$base_compile $srcfile"
665
542
      fi
666
 
 
667
 
      if test ! -d "${xdir}$objdir"; then
668
 
        $show "$mkdir ${xdir}$objdir"
669
 
        $run $mkdir ${xdir}$objdir
670
 
        status=$?
671
 
        if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then
672
 
          exit $status
673
 
        fi
674
 
      fi
675
 
 
676
 
      if test -z "$output_obj"; then
677
 
        # Place PIC objects in $objdir
678
 
        command="$command -o $lobj"
679
 
      fi
680
 
 
681
 
      $run $rm "$lobj" "$output_obj"
682
 
 
 
543
      if test "$build_old_libs" = yes; then
 
544
        lo_libobj="$libobj"
 
545
        dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
 
546
        if test "X$dir" = "X$libobj"; then
 
547
          dir="$objdir"
 
548
        else
 
549
          dir="$dir/$objdir"
 
550
        fi
 
551
        libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
 
552
 
 
553
        if test -d "$dir"; then
 
554
          $show "$rm $libobj"
 
555
          $run $rm $libobj
 
556
        else
 
557
          $show "$mkdir $dir"
 
558
          $run $mkdir $dir
 
559
          status=$?
 
560
          if test $status -ne 0 && test ! -d $dir; then
 
561
            exit $status
 
562
          fi
 
563
        fi
 
564
      fi
 
565
      if test "$compiler_o_lo" = yes; then
 
566
        output_obj="$libobj"
 
567
        command="$command -o $output_obj"
 
568
      elif test "$compiler_c_o" = yes; then
 
569
        output_obj="$obj"
 
570
        command="$command -o $output_obj"
 
571
      fi
 
572
 
 
573
      $run $rm "$output_obj"
683
574
      $show "$command"
684
575
      if $run eval "$command"; then :
685
576
      else
688
579
      fi
689
580
 
690
581
      if test "$need_locks" = warn &&
691
 
         test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
692
 
        $echo "\
 
582
         test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
 
583
        echo "\
693
584
*** ERROR, $lockfile contains:
694
585
`cat $lockfile 2>/dev/null`
695
586
 
708
599
      fi
709
600
 
710
601
      # Just move the object if needed, then go on to compile the next one
711
 
      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
712
 
        $show "$mv $output_obj $lobj"
713
 
        if $run $mv $output_obj $lobj; then :
714
 
        else
715
 
          error=$?
716
 
          $run $rm $removelist
717
 
          exit $error
718
 
        fi
719
 
      fi
720
 
 
721
 
      # Append the name of the PIC object to the libtool object file.
722
 
      test -z "$run" && cat >> ${libobj}T <<EOF
723
 
pic_object='$objdir/$objname'
724
 
 
725
 
EOF
 
602
      if test x"$output_obj" != x"$libobj"; then
 
603
        $show "$mv $output_obj $libobj"
 
604
        if $run $mv $output_obj $libobj; then :
 
605
        else
 
606
          error=$?
 
607
          $run $rm $removelist
 
608
          exit $error
 
609
        fi
 
610
      fi
 
611
 
 
612
      # If we have no pic_flag, then copy the object into place and finish.
 
613
      if (test -z "$pic_flag" || test "$pic_mode" != default) &&
 
614
         test "$build_old_libs" = yes; then
 
615
        # Rename the .lo from within objdir to obj
 
616
        if test -f $obj; then
 
617
          $show $rm $obj
 
618
          $run $rm $obj
 
619
        fi
 
620
 
 
621
        $show "$mv $libobj $obj"
 
622
        if $run $mv $libobj $obj; then :
 
623
        else
 
624
          error=$?
 
625
          $run $rm $removelist
 
626
          exit $error
 
627
        fi
 
628
 
 
629
        xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
 
630
        if test "X$xdir" = "X$obj"; then
 
631
          xdir="."
 
632
        else
 
633
          xdir="$xdir"
 
634
        fi
 
635
        baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"`
 
636
        libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
 
637
        # Now arrange that obj and lo_libobj become the same file
 
638
        $show "(cd $xdir && $LN_S $baseobj $libobj)"
 
639
        if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then
 
640
          # Unlock the critical section if it was locked
 
641
          if test "$need_locks" != no; then
 
642
            $run $rm "$lockfile"
 
643
          fi
 
644
          exit 0
 
645
        else
 
646
          error=$?
 
647
          $run $rm $removelist
 
648
          exit $error
 
649
        fi
 
650
      fi
726
651
 
727
652
      # Allow error messages only from the first compilation.
728
653
      suppress_output=' >/dev/null 2>&1'
729
 
    else
730
 
      # No PIC object so indicate it doesn't exist in the libtool
731
 
      # object file.
732
 
      test -z "$run" && cat >> ${libobj}T <<EOF
733
 
pic_object=none
734
 
 
735
 
EOF
736
654
    fi
737
655
 
738
656
    # Only build a position-dependent object if we build old libraries.
741
659
        # Don't build PIC code
742
660
        command="$base_compile $srcfile"
743
661
      else
744
 
        command="$base_compile $srcfile $pic_flag"
 
662
        # All platforms use -DPIC, to notify preprocessed assembler code.
 
663
        command="$base_compile $srcfile $pic_flag -DPIC"
745
664
      fi
746
665
      if test "$compiler_c_o" = yes; then
747
666
        command="$command -o $obj"
 
667
        output_obj="$obj"
748
668
      fi
749
669
 
750
670
      # Suppress compiler output if we already did a PIC compilation.
751
671
      command="$command$suppress_output"
752
 
      $run $rm "$obj" "$output_obj"
 
672
      $run $rm "$output_obj"
753
673
      $show "$command"
754
674
      if $run eval "$command"; then :
755
675
      else
758
678
      fi
759
679
 
760
680
      if test "$need_locks" = warn &&
761
 
         test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
762
 
        $echo "\
 
681
         test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
 
682
        echo "\
763
683
*** ERROR, $lockfile contains:
764
684
`cat $lockfile 2>/dev/null`
765
685
 
778
698
      fi
779
699
 
780
700
      # Just move the object if needed
781
 
      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
 
701
      if test x"$output_obj" != x"$obj"; then
782
702
        $show "$mv $output_obj $obj"
783
703
        if $run $mv $output_obj $obj; then :
784
704
        else
788
708
        fi
789
709
      fi
790
710
 
791
 
      # Append the name of the non-PIC object the libtool object file.
792
 
      # Only append if the libtool object file exists.
793
 
      test -z "$run" && cat >> ${libobj}T <<EOF
794
 
# Name of the non-PIC object.
795
 
non_pic_object='$objname'
796
 
 
797
 
EOF
798
 
    else
799
 
      # Append the name of the non-PIC object the libtool object file.
800
 
      # Only append if the libtool object file exists.
801
 
      test -z "$run" && cat >> ${libobj}T <<EOF
802
 
# Name of the non-PIC object.
803
 
non_pic_object=none
804
 
 
805
 
EOF
 
711
      # Create an invalid libtool object if no PIC, so that we do not
 
712
      # accidentally link it into a program.
 
713
      if test "$build_libtool_libs" != yes; then
 
714
        $show "echo timestamp > $libobj"
 
715
        $run eval "echo timestamp > \$libobj" || exit $?
 
716
      else
 
717
        # Move the .lo from within objdir
 
718
        $show "$mv $libobj $lo_libobj"
 
719
        if $run $mv $libobj $lo_libobj; then :
 
720
        else
 
721
          error=$?
 
722
          $run $rm $removelist
 
723
          exit $error
 
724
        fi
 
725
      fi
806
726
    fi
807
727
 
808
 
    $run $mv "${libobj}T" "${libobj}"
809
 
 
810
728
    # Unlock the critical section if it was locked
811
729
    if test "$need_locks" != no; then
812
730
      $run $rm "$lockfile"
823
741
      # It is impossible to link a dll without this setting, and
824
742
      # we shouldn't force the makefile maintainer to figure out
825
743
      # which system we are compiling for in order to pass an extra
826
 
      # flag for every libtool invocation.
 
744
      # flag for every libtool invokation.
827
745
      # allow_undefined=no
828
746
 
829
747
      # FIXME: Unfortunately, there are problems with the above when trying
838
756
      ;;
839
757
    esac
840
758
    libtool_args="$nonopt"
841
 
    base_compile="$nonopt"
842
759
    compile_command="$nonopt"
843
760
    finalize_command="$nonopt"
844
761
 
869
786
    module=no
870
787
    no_install=no
871
788
    objs=
872
 
    non_pic_objects=
873
789
    prefer_static_libs=no
874
790
    preload=no
875
791
    prev=
881
797
    temp_rpath=
882
798
    thread_safe=no
883
799
    vinfo=
884
 
    vinfo_number=no
885
800
 
886
801
    # We need to know -static, to get the right output filenames.
887
802
    for arg
912
827
    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
913
828
 
914
829
    # Go through the arguments, transforming them on the way.
915
 
    while test "$#" -gt 0; do
 
830
    while test $# -gt 0; do
916
831
      arg="$1"
917
 
      base_compile="$base_compile $arg"
918
832
      shift
919
833
      case $arg in
920
834
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
988
902
          prev=
989
903
          continue
990
904
          ;;
991
 
        inst_prefix)
 
905
        inst_prefix)
992
906
          inst_prefix_dir="$arg"
993
907
          prev=
994
908
          continue
998
912
          prev=
999
913
          continue
1000
914
          ;;
1001
 
        objectlist)
1002
 
          if test -f "$arg"; then
1003
 
            save_arg=$arg
1004
 
            moreargs=
1005
 
            for fil in `cat $save_arg`
1006
 
            do
1007
 
#             moreargs="$moreargs $fil"
1008
 
              arg=$fil
1009
 
              # A libtool-controlled object.
1010
 
 
1011
 
              # Check to see that this really is a libtool object.
1012
 
              if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1013
 
                pic_object=
1014
 
                non_pic_object=
1015
 
 
1016
 
                # Read the .lo file
1017
 
                # If there is no directory component, then add one.
1018
 
                case $arg in
1019
 
                */* | *\\*) . $arg ;;
1020
 
                *) . ./$arg ;;
1021
 
                esac
1022
 
 
1023
 
                if test -z "$pic_object" || \
1024
 
                   test -z "$non_pic_object" ||
1025
 
                   test "$pic_object" = none && \
1026
 
                   test "$non_pic_object" = none; then
1027
 
                  $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1028
 
                  exit 1
1029
 
                fi
1030
 
 
1031
 
                # Extract subdirectory from the argument.
1032
 
                xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1033
 
                if test "X$xdir" = "X$arg"; then
1034
 
                  xdir=
1035
 
                else
1036
 
                  xdir="$xdir/"
1037
 
                fi
1038
 
 
1039
 
                if test "$pic_object" != none; then
1040
 
                  # Prepend the subdirectory the object is found in.
1041
 
                  pic_object="$xdir$pic_object"
1042
 
 
1043
 
                  if test "$prev" = dlfiles; then
1044
 
                    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1045
 
                      dlfiles="$dlfiles $pic_object"
1046
 
                      prev=
1047
 
                      continue
1048
 
                    else
1049
 
                      # If libtool objects are unsupported, then we need to preload.
1050
 
                      prev=dlprefiles
1051
 
                    fi
1052
 
                  fi
1053
 
 
1054
 
                  # CHECK ME:  I think I busted this.  -Ossama
1055
 
                  if test "$prev" = dlprefiles; then
1056
 
                    # Preload the old-style object.
1057
 
                    dlprefiles="$dlprefiles $pic_object"
1058
 
                    prev=
1059
 
                  fi
1060
 
 
1061
 
                  # A PIC object.
1062
 
                  libobjs="$libobjs $pic_object"
1063
 
                  arg="$pic_object"
1064
 
                fi
1065
 
 
1066
 
                # Non-PIC object.
1067
 
                if test "$non_pic_object" != none; then
1068
 
                  # Prepend the subdirectory the object is found in.
1069
 
                  non_pic_object="$xdir$non_pic_object"
1070
 
 
1071
 
                  # A standard non-PIC object
1072
 
                  non_pic_objects="$non_pic_objects $non_pic_object"
1073
 
                  if test -z "$pic_object" || test "$pic_object" = none ; then
1074
 
                    arg="$non_pic_object"
1075
 
                  fi
1076
 
                fi
1077
 
              else
1078
 
                # Only an error if not doing a dry-run.
1079
 
                if test -z "$run"; then
1080
 
                  $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1081
 
                  exit 1
1082
 
                else
1083
 
                  # Dry-run case.
1084
 
 
1085
 
                  # Extract subdirectory from the argument.
1086
 
                  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1087
 
                  if test "X$xdir" = "X$arg"; then
1088
 
                    xdir=
1089
 
                  else
1090
 
                    xdir="$xdir/"
1091
 
                  fi
1092
 
 
1093
 
                  pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1094
 
                  non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1095
 
                  libobjs="$libobjs $pic_object"
1096
 
                  non_pic_objects="$non_pic_objects $non_pic_object"
1097
 
                fi
1098
 
              fi
1099
 
            done
1100
 
          else
1101
 
            $echo "$modename: link input file \`$save_arg' does not exist"
1102
 
            exit 1
1103
 
          fi
1104
 
          arg=$save_arg
1105
 
          prev=
1106
 
          continue
1107
 
          ;;
1108
915
        rpath | xrpath)
1109
916
          # We need an absolute path.
1110
917
          case $arg in
1143
950
          finalize_command="$finalize_command $wl$qarg"
1144
951
          continue
1145
952
          ;;
1146
 
        xcclinker)
1147
 
          linker_flags="$linker_flags $qarg"
1148
 
          compiler_flags="$compiler_flags $qarg"
1149
 
          prev=
1150
 
          compile_command="$compile_command $qarg"
1151
 
          finalize_command="$finalize_command $qarg"
1152
 
          continue
1153
 
          ;;
1154
953
        *)
1155
954
          eval "$prev=\"\$arg\""
1156
955
          prev=
1157
956
          continue
1158
957
          ;;
1159
958
        esac
1160
 
      fi # test -n "$prev"
 
959
      fi # test -n $prev
1161
960
 
1162
961
      prevarg="$arg"
1163
962
 
1218
1017
      # so, if we see these flags be careful not to treat them like -L
1219
1018
      -L[A-Z][A-Z]*:*)
1220
1019
        case $with_gcc/$host in
1221
 
        no/*-*-irix* | /*-*-irix*)
 
1020
        no/*-*-irix* | no/*-*-nonstopux*)
1222
1021
          compile_command="$compile_command $arg"
1223
1022
          finalize_command="$finalize_command $arg"
1224
1023
          ;;
1273
1072
            # Do not include libc due to us having libc/libc_r.
1274
1073
            test "X$arg" = "X-lc" && continue
1275
1074
            ;;
1276
 
          *-*-rhapsody* | *-*-darwin1.[012])
1277
 
            # Rhapsody C and math libraries are in the System framework
1278
 
            deplibs="$deplibs -framework System"
1279
 
            continue
1280
1075
          esac
1281
 
        elif test "X$arg" = "X-lc_r"; then
1282
 
         case $host in
 
1076
         elif test "X$arg" = "X-lc_r"; then
 
1077
          case $host in
1283
1078
         *-*-openbsd* | *-*-freebsd*)
1284
 
           # Do not include libc_r directly, use -pthread flag.
1285
 
           continue
1286
 
           ;;
1287
 
         esac
 
1079
            # Do not include libc_r directly, use -pthread flag.
 
1080
            continue
 
1081
            ;;
 
1082
          esac
1288
1083
        fi
1289
1084
        deplibs="$deplibs $arg"
1290
1085
        continue
1295
1090
        continue
1296
1091
        ;;
1297
1092
 
1298
 
      # gcc -m* arguments should be passed to the linker via $compiler_flags
1299
 
      # in order to pass architecture information to the linker
1300
 
      # (e.g. 32 vs 64-bit).  This may also be accomplished via -Wl,-mfoo
1301
 
      # but this is not reliable with gcc because gcc may use -mfoo to
1302
 
      # select a different linker, different libraries, etc, while
1303
 
      # -Wl,-mfoo simply passes -mfoo to the linker.
1304
 
      -m*)
1305
 
        # Unknown arguments in both finalize_command and compile_command need
1306
 
        # to be aesthetically quoted because they are evaled later.
1307
 
        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1308
 
        case $arg in
1309
 
        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
1310
 
          arg="\"$arg\""
1311
 
          ;;
1312
 
        esac
1313
 
        compile_command="$compile_command $arg"
1314
 
        finalize_command="$finalize_command $arg"
1315
 
        if test "$with_gcc" = "yes" ; then
1316
 
          compiler_flags="$compiler_flags $arg"
1317
 
        fi
1318
 
        continue
1319
 
        ;;
1320
 
 
1321
 
      -shrext)
1322
 
        prev=shrext
1323
 
        continue
1324
 
        ;;
1325
 
 
1326
1093
      -no-fast-install)
1327
1094
        fast_install=no
1328
1095
        continue
1347
1114
        continue
1348
1115
        ;;
1349
1116
 
1350
 
      -objectlist)
1351
 
        prev=objectlist
1352
 
        continue
1353
 
        ;;
1354
 
 
1355
1117
      -o) prev=output ;;
1356
1118
 
1357
1119
      -release)
1404
1166
        prev=vinfo
1405
1167
        continue
1406
1168
        ;;
1407
 
      -version-number)
1408
 
        prev=vinfo
1409
 
        vinfo_number=yes
1410
 
        continue
1411
 
        ;;
1412
1169
 
1413
1170
      -Wc,*)
1414
1171
        args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1457
1214
        continue
1458
1215
        ;;
1459
1216
 
1460
 
      -XCClinker)
1461
 
        prev=xcclinker
1462
 
        continue
1463
 
        ;;
1464
 
 
1465
1217
      # Some other compiler flag.
1466
1218
      -* | +*)
1467
1219
        # Unknown arguments in both finalize_command and compile_command need
1474
1226
        esac
1475
1227
        ;;
1476
1228
 
1477
 
      *.$objext)
1478
 
        # A standard object.
1479
 
        objs="$objs $arg"
1480
 
        ;;
1481
 
 
1482
 
      *.lo)
1483
 
        # A libtool-controlled object.
1484
 
 
1485
 
        # Check to see that this really is a libtool object.
1486
 
        if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1487
 
          pic_object=
1488
 
          non_pic_object=
1489
 
 
1490
 
          # Read the .lo file
1491
 
          # If there is no directory component, then add one.
 
1229
      *.lo | *.$objext)
 
1230
        # A library or standard object.
 
1231
        if test "$prev" = dlfiles; then
 
1232
          # This file was specified with -dlopen.
 
1233
          if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
 
1234
            dlfiles="$dlfiles $arg"
 
1235
            prev=
 
1236
            continue
 
1237
          else
 
1238
            # If libtool objects are unsupported, then we need to preload.
 
1239
            prev=dlprefiles
 
1240
          fi
 
1241
        fi
 
1242
 
 
1243
        if test "$prev" = dlprefiles; then
 
1244
          # Preload the old-style object.
 
1245
          dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
 
1246
          prev=
 
1247
        else
1492
1248
          case $arg in
1493
 
          */* | *\\*) . $arg ;;
1494
 
          *) . ./$arg ;;
 
1249
          *.lo) libobjs="$libobjs $arg" ;;
 
1250
          *) objs="$objs $arg" ;;
1495
1251
          esac
1496
 
 
1497
 
          if test -z "$pic_object" || \
1498
 
             test -z "$non_pic_object" ||
1499
 
             test "$pic_object" = none && \
1500
 
             test "$non_pic_object" = none; then
1501
 
            $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1502
 
            exit 1
1503
 
          fi
1504
 
 
1505
 
          # Extract subdirectory from the argument.
1506
 
          xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1507
 
          if test "X$xdir" = "X$arg"; then
1508
 
            xdir=
1509
 
          else
1510
 
            xdir="$xdir/"
1511
 
          fi
1512
 
 
1513
 
          if test "$pic_object" != none; then
1514
 
            # Prepend the subdirectory the object is found in.
1515
 
            pic_object="$xdir$pic_object"
1516
 
 
1517
 
            if test "$prev" = dlfiles; then
1518
 
              if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1519
 
                dlfiles="$dlfiles $pic_object"
1520
 
                prev=
1521
 
                continue
1522
 
              else
1523
 
                # If libtool objects are unsupported, then we need to preload.
1524
 
                prev=dlprefiles
1525
 
              fi
1526
 
            fi
1527
 
 
1528
 
            # CHECK ME:  I think I busted this.  -Ossama
1529
 
            if test "$prev" = dlprefiles; then
1530
 
              # Preload the old-style object.
1531
 
              dlprefiles="$dlprefiles $pic_object"
1532
 
              prev=
1533
 
            fi
1534
 
 
1535
 
            # A PIC object.
1536
 
            libobjs="$libobjs $pic_object"
1537
 
            arg="$pic_object"
1538
 
          fi
1539
 
 
1540
 
          # Non-PIC object.
1541
 
          if test "$non_pic_object" != none; then
1542
 
            # Prepend the subdirectory the object is found in.
1543
 
            non_pic_object="$xdir$non_pic_object"
1544
 
 
1545
 
            # A standard non-PIC object
1546
 
            non_pic_objects="$non_pic_objects $non_pic_object"
1547
 
            if test -z "$pic_object" || test "$pic_object" = none ; then
1548
 
              arg="$non_pic_object"
1549
 
            fi
1550
 
          fi
1551
 
        else
1552
 
          # Only an error if not doing a dry-run.
1553
 
          if test -z "$run"; then
1554
 
            $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1555
 
            exit 1
1556
 
          else
1557
 
            # Dry-run case.
1558
 
 
1559
 
            # Extract subdirectory from the argument.
1560
 
            xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1561
 
            if test "X$xdir" = "X$arg"; then
1562
 
              xdir=
1563
 
            else
1564
 
              xdir="$xdir/"
1565
 
            fi
1566
 
 
1567
 
            pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1568
 
            non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1569
 
            libobjs="$libobjs $pic_object"
1570
 
            non_pic_objects="$non_pic_objects $non_pic_object"
1571
 
          fi
1572
1252
        fi
1573
1253
        ;;
1574
1254
 
1622
1302
      exit 1
1623
1303
    fi
1624
1304
 
1625
 
    # Infer tagged configuration to use if any are available and
1626
 
    # if one wasn't chosen via the "--tag" command line option.
1627
 
    # Only attempt this if the compiler in the base link
1628
 
    # command doesn't match the default compiler.
1629
 
    if test -n "$available_tags" && test -z "$tagname"; then
1630
 
      case $base_compile in
1631
 
      # Blanks in the command may have been stripped by the calling shell,
1632
 
      # but not from the CC environment variable when configure was run.
1633
 
      "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) ;;
1634
 
      # Blanks at the start of $base_compile will cause this to fail
1635
 
      # if we don't check for them as well.
1636
 
      *)
1637
 
        for z in $available_tags; do
1638
 
          if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
1639
 
            # Evaluate the configuration.
1640
 
            eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
1641
 
            case $base_compile in
1642
 
            "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)
1643
 
              # The compiler in $compile_command matches
1644
 
              # the one in the tagged configuration.
1645
 
              # Assume this is the tagged configuration we want.
1646
 
              tagname=$z
1647
 
              break
1648
 
              ;;
1649
 
            esac
1650
 
          fi
1651
 
        done
1652
 
        # If $tagname still isn't set, then no tagged configuration
1653
 
        # was found and let the user know that the "--tag" command
1654
 
        # line option must be used.
1655
 
        if test -z "$tagname"; then
1656
 
          $echo "$modename: unable to infer tagged configuration"
1657
 
          $echo "$modename: specify a tag with \`--tag'" 1>&2
1658
 
          exit 1
1659
 
#       else
1660
 
#         $echo "$modename: using $tagname tagged configuration"
1661
 
        fi
1662
 
        ;;
1663
 
      esac
1664
 
    fi
1665
 
 
1666
1305
    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1667
1306
      eval arg=\"$export_dynamic_flag_spec\"
1668
1307
      compile_command="$compile_command $arg"
1669
1308
      finalize_command="$finalize_command $arg"
1670
1309
    fi
1671
1310
 
1672
 
    oldlibs=
1673
1311
    # calculate the name of the file, without its directory
1674
1312
    outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1675
1313
    libobjs_save="$libobjs"
1690
1328
      output_objdir="$output_objdir/$objdir"
1691
1329
    fi
1692
1330
    # Create the object directory.
1693
 
    if test ! -d "$output_objdir"; then
 
1331
    if test ! -d $output_objdir; then
1694
1332
      $show "$mkdir $output_objdir"
1695
1333
      $run $mkdir $output_objdir
1696
1334
      status=$?
1697
 
      if test "$status" -ne 0 && test ! -d "$output_objdir"; then
 
1335
      if test $status -ne 0 && test ! -d $output_objdir; then
1698
1336
        exit $status
1699
1337
      fi
1700
1338
    fi
1712
1350
    *) linkmode=prog ;; # Anything else should be a program.
1713
1351
    esac
1714
1352
 
1715
 
    case $host in
1716
 
    *cygwin* | *mingw* | *pw32*)
1717
 
      # don't eliminate duplcations in $postdeps and $predeps
1718
 
      duplicate_compiler_generated_deps=yes
1719
 
      ;;
1720
 
    *)
1721
 
      duplicate_compiler_generated_deps=$duplicate_deps
1722
 
      ;;
1723
 
    esac
1724
1353
    specialdeplibs=
1725
 
 
1726
1354
    libs=
1727
1355
    # Find all interdependent deplibs by searching for libraries
1728
1356
    # that are linked more than once (e.g. -la -lb -la)
1734
1362
      fi
1735
1363
      libs="$libs $deplib"
1736
1364
    done
1737
 
 
1738
 
    if test "$linkmode" = lib; then
1739
 
      libs="$predeps $libs $compiler_lib_search_path $postdeps"
1740
 
 
1741
 
      # Compute libraries that are listed more than once in $predeps
1742
 
      # $postdeps and mark them as special (i.e., whose duplicates are
1743
 
      # not to be eliminated).
1744
 
      pre_post_deps=
1745
 
      if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
1746
 
        for pre_post_dep in $predeps $postdeps; do
1747
 
          case "$pre_post_deps " in
1748
 
          *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
1749
 
          esac
1750
 
          pre_post_deps="$pre_post_deps $pre_post_dep"
1751
 
        done
1752
 
      fi
1753
 
      pre_post_deps=
1754
 
    fi
1755
 
 
1756
1365
    deplibs=
1757
1366
    newdependency_libs=
1758
1367
    newlib_search_path=
1784
1393
        ;;
1785
1394
    esac
1786
1395
    for pass in $passes; do
1787
 
      if test "$linkmode,$pass" = "lib,link" ||
1788
 
         test "$linkmode,$pass" = "prog,scan"; then
1789
 
        libs="$deplibs"
1790
 
        deplibs=
1791
 
      fi
1792
 
      if test "$linkmode" = prog; then
 
1396
      if test $linkmode = prog; then
 
1397
        # Determine which files to process
1793
1398
        case $pass in
1794
 
        dlopen) libs="$dlfiles" ;;
 
1399
        dlopen)
 
1400
          libs="$dlfiles"
 
1401
          save_deplibs="$deplibs" # Collect dlpreopened libraries
 
1402
          deplibs=
 
1403
          ;;
1795
1404
        dlpreopen) libs="$dlprefiles" ;;
1796
1405
        link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
1797
1406
        esac
1798
1407
      fi
1799
 
      if test "$pass" = dlopen; then
1800
 
        # Collect dlpreopened libraries
1801
 
        save_deplibs="$deplibs"
1802
 
        deplibs=
1803
 
      fi
1804
1408
      for deplib in $libs; do
1805
1409
        lib=
1806
1410
        found=no
1807
1411
        case $deplib in
1808
1412
        -l*)
1809
 
          if test "$linkmode" != lib && test "$linkmode" != prog; then
1810
 
            $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
 
1413
          if test $linkmode = oldlib && test $linkmode = obj; then
 
1414
            $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2
1811
1415
            continue
1812
1416
          fi
1813
 
          if test "$pass" = conv; then
 
1417
          if test $pass = conv; then
1814
1418
            deplibs="$deplib $deplibs"
1815
1419
            continue
1816
1420
          fi
1830
1434
              finalize_deplibs="$deplib $finalize_deplibs"
1831
1435
            else
1832
1436
              deplibs="$deplib $deplibs"
1833
 
              test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
 
1437
              test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs"
1834
1438
            fi
1835
1439
            continue
1836
 
          else # deplib is a libtool library
1837
 
            # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
1838
 
            # We need to do some special things here, and not later.
1839
 
            if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
1840
 
              case " $predeps $postdeps " in
1841
 
              *" $deplib "*)
1842
 
                if (${SED} -e '2q' $lib |
1843
 
                    grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1844
 
                  library_names=
1845
 
                  old_library=
1846
 
                  case $lib in
1847
 
                  */* | *\\*) . $lib ;;
1848
 
                  *) . ./$lib ;;
1849
 
                  esac
1850
 
                  for l in $old_library $library_names; do
1851
 
                    ll="$l"
1852
 
                  done
1853
 
                  if test "X$ll" = "X$old_library" ; then # only static version available
1854
 
                    found=no
1855
 
                    ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
1856
 
                    test "X$ladir" = "X$lib" && ladir="."
1857
 
                    lib=$ladir/$old_library
1858
 
                    if test "$linkmode,$pass" = "prog,link"; then
1859
 
                      compile_deplibs="$deplib $compile_deplibs"
1860
 
                      finalize_deplibs="$deplib $finalize_deplibs"
1861
 
                    else
1862
 
                      deplibs="$deplib $deplibs"
1863
 
                      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
1864
 
                    fi
1865
 
                    continue
1866
 
                  fi
1867
 
                fi
1868
 
                ;;
1869
 
              *) ;;
1870
 
              esac
1871
 
            fi
1872
1440
          fi
1873
1441
          ;; # -l
1874
1442
        -L*)
1875
1443
          case $linkmode in
1876
1444
          lib)
1877
1445
            deplibs="$deplib $deplibs"
1878
 
            test "$pass" = conv && continue
 
1446
            test $pass = conv && continue
1879
1447
            newdependency_libs="$deplib $newdependency_libs"
1880
1448
            newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1881
1449
            ;;
1882
1450
          prog)
1883
 
            if test "$pass" = conv; then
 
1451
            if test $pass = conv; then
1884
1452
              deplibs="$deplib $deplibs"
1885
1453
              continue
1886
1454
            fi
1887
 
            if test "$pass" = scan; then
 
1455
            if test $pass = scan; then
1888
1456
              deplibs="$deplib $deplibs"
1889
1457
              newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1890
1458
            else
1893
1461
            fi
1894
1462
            ;;
1895
1463
          *)
1896
 
            $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
 
1464
            $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2
1897
1465
            ;;
1898
1466
          esac # linkmode
1899
1467
          continue
1900
1468
          ;; # -L
1901
1469
        -R*)
1902
 
          if test "$pass" = link; then
 
1470
          if test $pass = link; then
1903
1471
            dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1904
1472
            # Make sure the xrpath contains only unique directories.
1905
1473
            case "$xrpath " in
1912
1480
          ;;
1913
1481
        *.la) lib="$deplib" ;;
1914
1482
        *.$libext)
1915
 
          if test "$pass" = conv; then
 
1483
          if test $pass = conv; then
1916
1484
            deplibs="$deplib $deplibs"
1917
1485
            continue
1918
1486
          fi
1919
1487
          case $linkmode in
1920
1488
          lib)
1921
1489
            if test "$deplibs_check_method" != pass_all; then
1922
 
              $echo
1923
 
              $echo "*** Warning: Trying to link with static lib archive $deplib."
1924
 
              $echo "*** I have the capability to make that library automatically link in when"
1925
 
              $echo "*** you link to this library.  But I can only do this if you have a"
1926
 
              $echo "*** shared version of the library, which you do not appear to have"
1927
 
              $echo "*** because the file extensions .$libext of this argument makes me believe"
1928
 
              $echo "*** that it is just a static archive that I should not used here."
 
1490
              echo
 
1491
              echo "*** Warning: Trying to link with static lib archive $deplib."
 
1492
              echo "*** I have the capability to make that library automatically link in when"
 
1493
              echo "*** you link to this library.  But I can only do this if you have a"
 
1494
              echo "*** shared version of the library, which you do not appear to have"
 
1495
              echo "*** because the file extensions .$libext of this argument makes me believe"
 
1496
              echo "*** that it is just a static archive that I should not used here."
1929
1497
            else
1930
 
              $echo
1931
 
              $echo "*** Warning: Linking the shared library $output against the"
1932
 
              $echo "*** static library $deplib is not portable!"
 
1498
              echo
 
1499
              echo "*** Warning: Linking the shared library $output against the"
 
1500
              echo "*** static library $deplib is not portable!"
1933
1501
              deplibs="$deplib $deplibs"
1934
1502
            fi
1935
1503
            continue
1936
1504
            ;;
1937
1505
          prog)
1938
 
            if test "$pass" != link; then
 
1506
            if test $pass != link; then
1939
1507
              deplibs="$deplib $deplibs"
1940
1508
            else
1941
1509
              compile_deplibs="$deplib $compile_deplibs"
1946
1514
          esac # linkmode
1947
1515
          ;; # *.$libext
1948
1516
        *.lo | *.$objext)
1949
 
          if test "$pass" = conv; then
1950
 
            deplibs="$deplib $deplibs"
1951
 
          elif test "$linkmode" = prog; then
1952
 
            if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1953
 
              # If there is no dlopen support or we're linking statically,
1954
 
              # we need to preload.
1955
 
              newdlprefiles="$newdlprefiles $deplib"
1956
 
              compile_deplibs="$deplib $compile_deplibs"
1957
 
              finalize_deplibs="$deplib $finalize_deplibs"
1958
 
            else
1959
 
              newdlfiles="$newdlfiles $deplib"
1960
 
            fi
 
1517
          if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
 
1518
            # If there is no dlopen support or we're linking statically,
 
1519
            # we need to preload.
 
1520
            newdlprefiles="$newdlprefiles $deplib"
 
1521
            compile_deplibs="$deplib $compile_deplibs"
 
1522
            finalize_deplibs="$deplib $finalize_deplibs"
 
1523
          else
 
1524
            newdlfiles="$newdlfiles $deplib"
1961
1525
          fi
1962
1526
          continue
1963
1527
          ;;
1966
1530
          continue
1967
1531
          ;;
1968
1532
        esac # case $deplib
1969
 
        if test "$found" = yes || test -f "$lib"; then :
 
1533
        if test $found = yes || test -f "$lib"; then :
1970
1534
        else
1971
1535
          $echo "$modename: cannot find the library \`$lib'" 1>&2
1972
1536
          exit 1
1973
1537
        fi
1974
1538
 
1975
1539
        # Check to see that this really is a libtool archive.
1976
 
        if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
 
1540
        if (${SED} -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1977
1541
        else
1978
1542
          $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
1979
1543
          exit 1
1989
1553
        library_names=
1990
1554
        old_library=
1991
1555
        # If the library was installed with an old release of libtool,
1992
 
        # it will not redefine variables installed, or shouldnotlink
 
1556
        # it will not redefine variable installed.
1993
1557
        installed=yes
1994
 
        shouldnotlink=no
1995
1558
 
1996
1559
        # Read the .la file
1997
1560
        case $lib in
2001
1564
 
2002
1565
        if test "$linkmode,$pass" = "lib,link" ||
2003
1566
           test "$linkmode,$pass" = "prog,scan" ||
2004
 
           { test "$linkmode" != prog && test "$linkmode" != lib; }; then
 
1567
           { test $linkmode = oldlib && test $linkmode = obj; }; then
 
1568
           # Add dl[pre]opened files of deplib
2005
1569
          test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
2006
1570
          test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
2007
1571
        fi
2008
1572
 
2009
 
        if test "$pass" = conv; then
 
1573
        if test $pass = conv; then
2010
1574
          # Only check for convenience libraries
2011
1575
          deplibs="$lib $deplibs"
2012
1576
          if test -z "$libdir"; then
2027
1591
              fi
2028
1592
              tmp_libs="$tmp_libs $deplib"
2029
1593
            done
2030
 
          elif test "$linkmode" != prog && test "$linkmode" != lib; then
 
1594
          elif test $linkmode != prog && test $linkmode != lib; then
2031
1595
            $echo "$modename: \`$lib' is not a convenience library" 1>&2
2032
1596
            exit 1
2033
1597
          fi
2034
1598
          continue
2035
1599
        fi # $pass = conv
2036
1600
 
2037
 
    
2038
1601
        # Get the name of the library we link against.
2039
1602
        linklib=
2040
1603
        for l in $old_library $library_names; do
2046
1609
        fi
2047
1610
 
2048
1611
        # This library was specified with -dlopen.
2049
 
        if test "$pass" = dlopen; then
 
1612
        if test $pass = dlopen; then
2050
1613
          if test -z "$libdir"; then
2051
1614
            $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
2052
1615
            exit 1
2053
1616
          fi
2054
1617
          if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
2055
1618
            # If there is no dlname, no dlopen support or we're linking
2056
 
            # statically, we need to preload.  We also need to preload any
2057
 
            # dependent libraries so libltdl's deplib preloader doesn't
2058
 
            # bomb out in the load deplibs phase.
2059
 
            dlprefiles="$dlprefiles $lib $dependency_libs"
 
1619
            # statically, we need to preload.
 
1620
            dlprefiles="$dlprefiles $lib"
2060
1621
          else
2061
1622
            newdlfiles="$newdlfiles $lib"
2062
1623
          fi
2097
1658
        name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2098
1659
 
2099
1660
        # This library was specified with -dlpreopen.
2100
 
        if test "$pass" = dlpreopen; then
 
1661
        if test $pass = dlpreopen; then
2101
1662
          if test -z "$libdir"; then
2102
1663
            $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
2103
1664
            exit 1
2116
1677
 
2117
1678
        if test -z "$libdir"; then
2118
1679
          # Link the convenience library
2119
 
          if test "$linkmode" = lib; then
 
1680
          if test $linkmode = lib; then
2120
1681
            deplibs="$dir/$old_library $deplibs"
2121
1682
          elif test "$linkmode,$pass" = "prog,link"; then
2122
1683
            compile_deplibs="$dir/$old_library $compile_deplibs"
2123
1684
            finalize_deplibs="$dir/$old_library $finalize_deplibs"
2124
1685
          else
2125
 
            deplibs="$lib $deplibs" # used for prog,scan pass
 
1686
            deplibs="$lib $deplibs"
2126
1687
          fi
2127
1688
          continue
2128
1689
        fi
2129
1690
 
2130
 
    
2131
 
        if test "$linkmode" = prog && test "$pass" != link; then
 
1691
        if test $linkmode = prog && test $pass != link; then
2132
1692
          newlib_search_path="$newlib_search_path $ladir"
2133
1693
          deplibs="$lib $deplibs"
2134
1694
 
2144
1704
            -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
2145
1705
            esac
2146
1706
            # Need to link against all dependency_libs?
2147
 
            if test "$linkalldeplibs" = yes; then
 
1707
            if test $linkalldeplibs = yes; then
2148
1708
              deplibs="$deplib $deplibs"
2149
1709
            else
2150
1710
              # Need to hardcode shared library paths
2161
1721
          continue
2162
1722
        fi # $linkmode = prog...
2163
1723
 
2164
 
        if test "$linkmode,$pass" = "prog,link"; then
2165
 
          if test -n "$library_names" &&
2166
 
             { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2167
 
            # We need to hardcode the library path
2168
 
            if test -n "$shlibpath_var"; then
2169
 
              # Make sure the rpath contains only unique directories.
2170
 
              case "$temp_rpath " in
2171
 
              *" $dir "*) ;;
2172
 
              *" $absdir "*) ;;
2173
 
              *) temp_rpath="$temp_rpath $dir" ;;
2174
 
              esac
2175
 
            fi
2176
 
 
2177
 
            # Hardcode the library path.
2178
 
            # Skip directories that are in the system default run-time
2179
 
            # search path.
2180
 
            case " $sys_lib_dlsearch_path " in
2181
 
            *" $absdir "*) ;;
2182
 
            *)
2183
 
              case "$compile_rpath " in
2184
 
              *" $absdir "*) ;;
2185
 
              *) compile_rpath="$compile_rpath $absdir"
2186
 
              esac
2187
 
              ;;
2188
 
            esac
2189
 
            case " $sys_lib_dlsearch_path " in
2190
 
            *" $libdir "*) ;;
2191
 
            *)
2192
 
              case "$finalize_rpath " in
2193
 
              *" $libdir "*) ;;
2194
 
              *) finalize_rpath="$finalize_rpath $libdir"
2195
 
              esac
2196
 
              ;;
2197
 
            esac
2198
 
          fi # $linkmode,$pass = prog,link...
2199
 
 
2200
 
          if test "$alldeplibs" = yes &&
2201
 
             { test "$deplibs_check_method" = pass_all ||
2202
 
               { test "$build_libtool_libs" = yes &&
2203
 
                 test -n "$library_names"; }; }; then
2204
 
            # We only need to search for static libraries
2205
 
            continue
2206
 
          fi
2207
 
        fi
2208
 
 
2209
1724
        link_static=no # Whether the deplib will be linked statically
2210
1725
        if test -n "$library_names" &&
2211
1726
           { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
 
1727
          # Link against this shared library
 
1728
 
 
1729
          if test "$linkmode,$pass" = "prog,link" ||
 
1730
           { test $linkmode = lib && test $hardcode_into_libs = yes; }; then
 
1731
            # Hardcode the library path.
 
1732
            # Skip directories that are in the system default run-time
 
1733
            # search path.
 
1734
            case " $sys_lib_dlsearch_path " in
 
1735
            *" $absdir "*) ;;
 
1736
            *)
 
1737
              case "$compile_rpath " in
 
1738
              *" $absdir "*) ;;
 
1739
              *) compile_rpath="$compile_rpath $absdir"
 
1740
              esac
 
1741
              ;;
 
1742
            esac
 
1743
            case " $sys_lib_dlsearch_path " in
 
1744
            *" $libdir "*) ;;
 
1745
            *)
 
1746
              case "$finalize_rpath " in
 
1747
              *" $libdir "*) ;;
 
1748
              *) finalize_rpath="$finalize_rpath $libdir"
 
1749
              esac
 
1750
              ;;
 
1751
            esac
 
1752
            if test $linkmode = prog; then
 
1753
              # We need to hardcode the library path
 
1754
              if test -n "$shlibpath_var"; then
 
1755
                # Make sure the rpath contains only unique directories.
 
1756
                case "$temp_rpath " in
 
1757
                *" $dir "*) ;;
 
1758
                *" $absdir "*) ;;
 
1759
                *) temp_rpath="$temp_rpath $dir" ;;
 
1760
                esac
 
1761
              fi
 
1762
            fi
 
1763
          fi # $linkmode,$pass = prog,link...
 
1764
 
 
1765
          if test "$alldeplibs" = yes &&
 
1766
             { test "$deplibs_check_method" = pass_all ||
 
1767
               { test "$build_libtool_libs" = yes &&
 
1768
                 test -n "$library_names"; }; }; then
 
1769
            # We only need to search for static libraries
 
1770
            continue
 
1771
          fi
 
1772
 
2212
1773
          if test "$installed" = no; then
2213
1774
            notinst_deplibs="$notinst_deplibs $lib"
2214
1775
            need_relink=yes
2215
1776
          fi
2216
 
          # This is a shared library
2217
 
        
2218
 
      # Warn about portability, can't link against -module's on some systems (darwin)
2219
 
      if test "$shouldnotlink" = yes && test "$pass" = link ; then
2220
 
            $echo
2221
 
            if test "$linkmode" = prog; then
2222
 
              $echo "*** Warning: Linking the executable $output against the loadable module"
2223
 
            else
2224
 
              $echo "*** Warning: Linking the shared library $output against the loadable module"
2225
 
            fi
2226
 
            $echo "*** $linklib is not portable!"    
2227
 
      fi          
2228
 
          if test "$linkmode" = lib &&
2229
 
             test "$hardcode_into_libs" = yes; then
2230
 
            # Hardcode the library path.
2231
 
            # Skip directories that are in the system default run-time
2232
 
            # search path.
2233
 
            case " $sys_lib_dlsearch_path " in
2234
 
            *" $absdir "*) ;;
2235
 
            *)
2236
 
              case "$compile_rpath " in
2237
 
              *" $absdir "*) ;;
2238
 
              *) compile_rpath="$compile_rpath $absdir"
2239
 
              esac
2240
 
              ;;
2241
 
            esac
2242
 
            case " $sys_lib_dlsearch_path " in
2243
 
            *" $libdir "*) ;;
2244
 
            *)
2245
 
              case "$finalize_rpath " in
2246
 
              *" $libdir "*) ;;
2247
 
              *) finalize_rpath="$finalize_rpath $libdir"
2248
 
              esac
2249
 
              ;;
2250
 
            esac
2251
 
          fi
2252
1777
 
2253
1778
          if test -n "$old_archive_from_expsyms_cmds"; then
2254
1779
            # figure out the soname
2262
1787
            elif test -n "$soname_spec"; then
2263
1788
              # bleh windows
2264
1789
              case $host in
2265
 
              *cygwin* | mingw*)
 
1790
              *cygwin*)
2266
1791
                major=`expr $current - $age`
2267
1792
                versuffix="-$major"
2268
1793
                ;;
2274
1799
 
2275
1800
            # Make a new name for the extract_expsyms_cmds to use
2276
1801
            soroot="$soname"
2277
 
            soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
2278
 
            newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
 
1802
            soname=`echo $soroot | ${SED} -e 's/^.*\///'`
 
1803
            newlib="libimp-`echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
2279
1804
 
2280
1805
            # If the library has no export list, then create one now
2281
1806
            if test -f "$output_objdir/$soname-def"; then :
2306
1831
            # make sure the library variables are pointing to the new library
2307
1832
            dir=$output_objdir
2308
1833
            linklib=$newlib
2309
 
          fi # test -n "$old_archive_from_expsyms_cmds"
 
1834
          fi # test -n $old_archive_from_expsyms_cmds
2310
1835
 
2311
 
          if test "$linkmode" = prog || test "$mode" != relink; then
 
1836
          if test $linkmode = prog || test "$mode" != relink; then
2312
1837
            add_shlibpath=
2313
1838
            add_dir=
2314
1839
            add=
2317
1842
            immediate | unsupported)
2318
1843
              if test "$hardcode_direct" = no; then
2319
1844
                add="$dir/$linklib"
2320
 
                case $host in
2321
 
                  *-*-sco3.2v5* ) add_dir="-L$dir" ;;
2322
 
                  *-*-darwin* )
2323
 
                    # if the lib is a module then we can not link against it, someone
2324
 
                    # is ignoring the new warnings I added
2325
 
                    if /usr/bin/file -L $add 2> /dev/null | grep "bundle" >/dev/null ; then
2326
 
                      $echo "** Warning, lib $linklib is a module, not a shared library"
2327
 
                      if test -z "$old_library" ; then
2328
 
                        $echo
2329
 
                        $echo "** And there doesn't seem to be a static archive available"
2330
 
                        $echo "** The link will probably fail, sorry"
2331
 
                      else
2332
 
                        add="$dir/$old_library"
2333
 
                      fi 
2334
 
                    fi
2335
 
                esac
2336
1845
              elif test "$hardcode_minus_L" = no; then
2337
1846
                case $host in
2338
1847
                *-*-sunos*) add_shlibpath="$dir" ;;
2351
1860
                add="$dir/$linklib"
2352
1861
              elif test "$hardcode_minus_L" = yes; then
2353
1862
                add_dir="-L$dir"
2354
 
                # Try looking first in the location we're being installed to.
2355
 
                if test -n "$inst_prefix_dir"; then
2356
 
                  case "$libdir" in
2357
 
                    [\\/]*)
2358
 
                      add_dir="$add_dir -L$inst_prefix_dir$libdir"
2359
 
                      ;;
2360
 
                  esac
2361
 
                fi
2362
1863
                add="-l$name"
2363
1864
              elif test "$hardcode_shlibpath_var" = yes; then
2364
1865
                add_shlibpath="$dir"
2381
1882
              *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
2382
1883
              esac
2383
1884
            fi
2384
 
            if test "$linkmode" = prog; then
 
1885
            if test $linkmode = prog; then
2385
1886
              test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
2386
1887
              test -n "$add" && compile_deplibs="$add $compile_deplibs"
2387
1888
            else
2398
1899
            fi
2399
1900
          fi
2400
1901
 
2401
 
          if test "$linkmode" = prog || test "$mode" = relink; then
 
1902
          if test $linkmode = prog || test "$mode" = relink; then
2402
1903
            add_shlibpath=
2403
1904
            add_dir=
2404
1905
            add=
2406
1907
            if test "$hardcode_direct" = yes; then
2407
1908
              add="$libdir/$linklib"
2408
1909
            elif test "$hardcode_minus_L" = yes; then
2409
 
              add_dir="-L$libdir"
 
1910
              # Try looking first in the location we're being installed to.
 
1911
              add_dir=
 
1912
              if test -n "$inst_prefix_dir"; then
 
1913
                case "$libdir" in
 
1914
                [\\/]*)
 
1915
                  add_dir="-L$inst_prefix_dir$libdir"
 
1916
                  ;;
 
1917
                esac
 
1918
              fi
 
1919
              add_dir="$add_dir -L$libdir"
2410
1920
              add="-l$name"
2411
1921
            elif test "$hardcode_shlibpath_var" = yes; then
2412
1922
              case :$finalize_shlibpath: in
2414
1924
              *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2415
1925
              esac
2416
1926
              add="-l$name"
2417
 
            elif test "$hardcode_automatic" = yes; then
2418
 
              if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then
2419
 
                add="$inst_prefix_dir$libdir/$linklib"
2420
 
              else
2421
 
                add="$libdir/$linklib"
2422
 
              fi
2423
1927
            else
2424
1928
              # We cannot seem to hardcode it, guess we'll fake it.
2425
 
              add_dir="-L$libdir"
2426
1929
              # Try looking first in the location we're being installed to.
 
1930
              add_dir=
2427
1931
              if test -n "$inst_prefix_dir"; then
2428
1932
                case "$libdir" in
2429
 
                  [\\/]*)
2430
 
                    add_dir="$add_dir -L$inst_prefix_dir$libdir"
2431
 
                    ;;
 
1933
                [\\/]*)
 
1934
                  add_dir="-L$inst_prefix_dir$libdir"
 
1935
                  ;;
2432
1936
                esac
2433
1937
              fi
 
1938
              add_dir="$add_dir -L$libdir"
2434
1939
              add="-l$name"
2435
1940
            fi
2436
1941
 
2437
 
            if test "$linkmode" = prog; then
 
1942
            if test $linkmode = prog; then
2438
1943
              test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
2439
1944
              test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
2440
1945
            else
2442
1947
              test -n "$add" && deplibs="$add $deplibs"
2443
1948
            fi
2444
1949
          fi
2445
 
        elif test "$linkmode" = prog; then
 
1950
        elif test $linkmode = prog; then
 
1951
          if test "$alldeplibs" = yes &&
 
1952
             { test "$deplibs_check_method" = pass_all ||
 
1953
               { test "$build_libtool_libs" = yes &&
 
1954
                 test -n "$library_names"; }; }; then
 
1955
            # We only need to search for static libraries
 
1956
            continue
 
1957
          fi
 
1958
 
 
1959
          # Try to link the static library
2446
1960
          # Here we assume that one of hardcode_direct or hardcode_minus_L
2447
1961
          # is not unsupported.  This is valid on all known static and
2448
1962
          # shared platforms.
2462
1976
 
2463
1977
            # Just print a warning and add the library to dependency_libs so
2464
1978
            # that the program can be linked against the static library.
2465
 
            $echo
2466
 
            $echo "*** Warning: This system can not link to static lib archive $lib."
2467
 
            $echo "*** I have the capability to make that library automatically link in when"
2468
 
            $echo "*** you link to this library.  But I can only do this if you have a"
2469
 
            $echo "*** shared version of the library, which you do not appear to have."
 
1979
            echo
 
1980
            echo "*** Warning: This system can not link to static lib archive $lib."
 
1981
            echo "*** I have the capability to make that library automatically link in when"
 
1982
            echo "*** you link to this library.  But I can only do this if you have a"
 
1983
            echo "*** shared version of the library, which you do not appear to have."
2470
1984
            if test "$module" = yes; then
2471
 
              $echo "*** But as you try to build a module library, libtool will still create "
2472
 
              $echo "*** a static module, that should work as long as the dlopening application"
2473
 
              $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
 
1985
              echo "*** But as you try to build a module library, libtool will still create "
 
1986
              echo "*** a static module, that should work as long as the dlopening application"
 
1987
              echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
2474
1988
              if test -z "$global_symbol_pipe"; then
2475
 
                $echo
2476
 
                $echo "*** However, this would only work if libtool was able to extract symbol"
2477
 
                $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2478
 
                $echo "*** not find such a program.  So, this module is probably useless."
2479
 
                $echo "*** \`nm' from GNU binutils and a full rebuild may help."
 
1989
                echo
 
1990
                echo "*** However, this would only work if libtool was able to extract symbol"
 
1991
                echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
 
1992
                echo "*** not find such a program.  So, this module is probably useless."
 
1993
                echo "*** \`nm' from GNU binutils and a full rebuild may help."
2480
1994
              fi
2481
1995
              if test "$build_old_libs" = no; then
2482
1996
                build_libtool_libs=module
2493
2007
          fi
2494
2008
        fi # link shared/static library?
2495
2009
 
2496
 
        if test "$linkmode" = lib; then
 
2010
        if test $linkmode = lib; then
2497
2011
          if test -n "$dependency_libs" &&
2498
 
             { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes ||
2499
 
               test "$link_static" = yes; }; then
 
2012
             { test $hardcode_into_libs != yes || test $build_old_libs = yes ||
 
2013
               test $link_static = yes; }; then
2500
2014
            # Extract -R from dependency_libs
2501
2015
            temp_deplibs=
2502
2016
            for libdir in $dependency_libs; do
2527
2041
            tmp_libs="$tmp_libs $deplib"
2528
2042
          done
2529
2043
 
2530
 
          if test "$link_all_deplibs" != no; then
 
2044
          if test $link_all_deplibs != no; then
2531
2045
            # Add the search paths of all dependency libraries
2532
2046
            for deplib in $dependency_libs; do
2533
2047
              case $deplib in
2547
2061
                  ;;
2548
2062
                esac
2549
2063
                if grep "^installed=no" $deplib > /dev/null; then
2550
 
                  path="$absdir/$objdir"
 
2064
                  path="-L$absdir/$objdir"
2551
2065
                else
2552
2066
                  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2553
2067
                  if test -z "$libdir"; then
2557
2071
                  if test "$absdir" != "$libdir"; then
2558
2072
                    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2559
2073
                  fi
2560
 
                  path="$absdir"
 
2074
                  path="-L$absdir"
2561
2075
                fi
2562
 
                depdepl=
2563
 
                case $host in
2564
 
                *-*-darwin*)
2565
 
                  # we do not want to link against static libs, but need to link against shared
2566
 
                  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
2567
 
                  if test -n "$deplibrary_names" ; then
2568
 
                    for tmp in $deplibrary_names ; do
2569
 
                      depdepl=$tmp
2570
 
                    done
2571
 
                    if test -f "$path/$depdepl" ; then
2572
 
                      depdepl="$path/$depdepl"
2573
 
                   fi
2574
 
                    newlib_search_path="$newlib_search_path $path"
2575
 
                    path=""
2576
 
                  fi
2577
 
                  ;;
2578
 
                *)
2579
 
                path="-L$path"
2580
 
                ;;
2581
 
                esac 
2582
 
                
2583
 
                ;;
2584
 
                  -l*)
2585
 
                case $host in
2586
 
                *-*-darwin*)
2587
 
                 # Again, we only want to link against shared libraries
2588
 
                 eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
2589
 
                 for tmp in $newlib_search_path ; do
2590
 
                     if test -f "$tmp/lib$tmp_libs.dylib" ; then
2591
 
                       eval depdepl="$tmp/lib$tmp_libs.dylib"
2592
 
                       break
2593
 
                     fi  
2594
 
         done
2595
 
         path=""
2596
 
                  ;;
2597
 
                *) continue ;;
2598
 
                esac              
2599
2076
                ;;
2600
2077
              *) continue ;;
2601
2078
              esac
2602
2079
              case " $deplibs " in
2603
 
              *" $depdepl "*) ;;
2604
 
              *) deplibs="$deplibs $depdepl" ;;
2605
 
              esac            
2606
 
              case " $deplibs " in
2607
2080
              *" $path "*) ;;
2608
2081
              *) deplibs="$deplibs $path" ;;
2609
2082
              esac
2611
2084
          fi # link_all_deplibs != no
2612
2085
        fi # linkmode = lib
2613
2086
      done # for deplib in $libs
2614
 
      dependency_libs="$newdependency_libs"
2615
 
      if test "$pass" = dlpreopen; then
 
2087
      if test $pass = dlpreopen; then
2616
2088
        # Link the dlpreopened libraries before other libraries
2617
2089
        for deplib in $save_deplibs; do
2618
2090
          deplibs="$deplib $deplibs"
2619
2091
        done
2620
2092
      fi
2621
 
      if test "$pass" != dlopen; then
2622
 
        if test "$pass" != conv; then
 
2093
      if test $pass != dlopen; then
 
2094
        test $pass != scan && dependency_libs="$newdependency_libs"
 
2095
        if test $pass != conv; then
2623
2096
          # Make sure lib_search_path contains only unique directories.
2624
2097
          lib_search_path=
2625
2098
          for dir in $newlib_search_path; do
2641
2114
          eval tmp_libs=\"\$$var\"
2642
2115
          new_libs=
2643
2116
          for deplib in $tmp_libs; do
2644
 
            # FIXME: Pedantically, this is the right thing to do, so
2645
 
            #        that some nasty dependency loop isn't accidentally
2646
 
            #        broken:
2647
 
            #new_libs="$deplib $new_libs"
2648
 
            # Pragmatically, this seems to cause very few problems in
2649
 
            # practice:
2650
2117
            case $deplib in
2651
2118
            -L*) new_libs="$deplib $new_libs" ;;
2652
 
            -R*) ;;
2653
2119
            *)
2654
 
              # And here is the reason: when a library appears more
2655
 
              # than once as an explicit dependence of a library, or
2656
 
              # is implicitly linked in more than once by the
2657
 
              # compiler, it is considered special, and multiple
2658
 
              # occurrences thereof are not removed.  Compare this
2659
 
              # with having the same library being listed as a
2660
 
              # dependency of multiple other libraries: in this case,
2661
 
              # we know (pedantically, we assume) the library does not
2662
 
              # need to be listed more than once, so we keep only the
2663
 
              # last copy.  This is not always right, but it is rare
2664
 
              # enough that we require users that really mean to play
2665
 
              # such unportable linking tricks to link the library
2666
 
              # using -Wl,-lname, so that libtool does not consider it
2667
 
              # for duplicate removal.
2668
2120
              case " $specialdeplibs " in
2669
2121
              *" $deplib "*) new_libs="$deplib $new_libs" ;;
2670
2122
              *)
2692
2144
          eval $var=\"$tmp_libs\"
2693
2145
        done # for var
2694
2146
      fi
2695
 
      # Last step: remove runtime libs from dependency_libs (they stay in deplibs)
2696
 
      tmp_libs=
2697
 
      for i in $dependency_libs ; do
2698
 
        case " $predeps $postdeps $compiler_lib_search_path " in
2699
 
        *" $i "*)
2700
 
          i=""
2701
 
          ;;
2702
 
        esac
2703
 
        if test -n "$i" ; then
2704
 
          tmp_libs="$tmp_libs $i"
2705
 
        fi
2706
 
      done
2707
 
      dependency_libs=$tmp_libs
 
2147
      if test "$pass" = "conv" &&
 
2148
       { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then
 
2149
        libs="$deplibs" # reset libs
 
2150
        deplibs=
 
2151
      fi
2708
2152
    done # for pass
2709
 
    if test "$linkmode" = prog; then
 
2153
    if test $linkmode = prog; then
2710
2154
      dlfiles="$newdlfiles"
2711
2155
      dlprefiles="$newdlprefiles"
2712
2156
    fi
2713
2157
 
2714
2158
    case $linkmode in
2715
2159
    oldlib)
2716
 
      if test -n "$deplibs"; then
2717
 
        $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
2718
 
      fi
2719
 
 
2720
2160
      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2721
2161
        $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
2722
2162
      fi
2730
2170
      fi
2731
2171
 
2732
2172
      if test -n "$vinfo"; then
2733
 
        $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
 
2173
        $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
2734
2174
      fi
2735
2175
 
2736
2176
      if test -n "$release"; then
2752
2192
      case $outputname in
2753
2193
      lib*)
2754
2194
        name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2755
 
        eval shared_ext=\"$shrext\"
2756
2195
        eval libname=\"$libname_spec\"
2757
2196
        ;;
2758
2197
      *)
2764
2203
        if test "$need_lib_prefix" != no; then
2765
2204
          # Add the "lib" prefix for modules if required
2766
2205
          name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2767
 
          eval shared_ext=\"$shrext\"
2768
2206
          eval libname=\"$libname_spec\"
2769
2207
        else
2770
2208
          libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2777
2215
          $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
2778
2216
          exit 1
2779
2217
        else
2780
 
          $echo
2781
 
          $echo "*** Warning: Linking the shared library $output against the non-libtool"
2782
 
          $echo "*** objects $objs is not portable!"
 
2218
          echo
 
2219
          echo "*** Warning: Linking the shared library $output against the non-libtool"
 
2220
          echo "*** objects $objs is not portable!"
2783
2221
          libobjs="$libobjs $objs"
2784
2222
        fi
2785
2223
      fi
2789
2227
      fi
2790
2228
 
2791
2229
      set dummy $rpath
2792
 
      if test "$#" -gt 2; then
 
2230
      if test $# -gt 2; then
2793
2231
        $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
2794
2232
      fi
2795
2233
      install_libdir="$2"
2798
2236
      if test -z "$rpath"; then
2799
2237
        if test "$build_libtool_libs" = yes; then
2800
2238
          # Building a libtool convenience library.
2801
 
          # Some compilers have problems with a `.al' extension so
2802
 
          # convenience libraries should have the same extension an
2803
 
          # archive normally would.
 
2239
          libext=al
2804
2240
          oldlibs="$output_objdir/$libname.$libext $oldlibs"
2805
2241
          build_libtool_libs=convenience
2806
2242
          build_old_libs=yes
2807
2243
        fi
2808
2244
 
2809
2245
        if test -n "$vinfo"; then
2810
 
          $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
 
2246
          $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
2811
2247
        fi
2812
2248
 
2813
2249
        if test -n "$release"; then
2826
2262
          exit 1
2827
2263
        fi
2828
2264
 
2829
 
        # convert absolute version numbers to libtool ages
2830
 
        # this retains compatibility with .la files and attempts
2831
 
        # to make the code below a bit more comprehensible
2832
 
        
2833
 
        case $vinfo_number in
2834
 
        yes)
2835
 
          number_major="$2"
2836
 
          number_minor="$3"
2837
 
          number_revision="$4"
2838
 
          #
2839
 
          # There are really only two kinds -- those that
2840
 
          # use the current revision as the major version
2841
 
          # and those that subtract age and use age as
2842
 
          # a minor version.  But, then there is irix
2843
 
          # which has an extra 1 added just for fun
2844
 
          #
2845
 
          case $version_type in
2846
 
          darwin|linux|osf|windows)
2847
 
            current=`expr $number_major + $number_minor`
2848
 
            age="$number_minor"
2849
 
            revision="$number_revision"
2850
 
            ;;
2851
 
          freebsd-aout|freebsd-elf|sunos)
2852
 
            current="$number_major"
2853
 
            revision="$number_minor"
2854
 
            age="0"
2855
 
            ;;
2856
 
          irix|nonstopux)
2857
 
            current=`expr $number_major + $number_minor - 1`
2858
 
            age="$number_minor"
2859
 
            revision="$number_minor"
2860
 
            ;;
2861
 
          esac
2862
 
          ;;
2863
 
        no)
2864
 
          current="$2"
2865
 
          revision="$3"
2866
 
          age="$4"
2867
 
          ;;
2868
 
        esac
 
2265
        current="$2"
 
2266
        revision="$3"
 
2267
        age="$4"
2869
2268
 
2870
2269
        # Check that each of the things are valid numbers.
2871
2270
        case $current in
2895
2294
          ;;
2896
2295
        esac
2897
2296
 
2898
 
        if test "$age" -gt "$current"; then
 
2297
        if test $age -gt $current; then
2899
2298
          $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
2900
2299
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2901
2300
          exit 1
2939
2338
 
2940
2339
          # Add in all the interfaces that we are compatible with.
2941
2340
          loop=$revision
2942
 
          while test "$loop" -ne 0; do
 
2341
          while test $loop != 0; do
2943
2342
            iface=`expr $revision - $loop`
2944
2343
            loop=`expr $loop - 1`
2945
2344
            verstring="$verstring_prefix$major.$iface:$verstring"
2962
2361
 
2963
2362
          # Add in all the interfaces that we are compatible with.
2964
2363
          loop=$age
2965
 
          while test "$loop" -ne 0; do
 
2364
          while test $loop != 0; do
2966
2365
            iface=`expr $current - $loop`
2967
2366
            loop=`expr $loop - 1`
2968
2367
            verstring="$verstring:${iface}.0"
2986
2385
 
2987
2386
        *)
2988
2387
          $echo "$modename: unknown library version type \`$version_type'" 1>&2
2989
 
          $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
 
2388
          echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
2990
2389
          exit 1
2991
2390
          ;;
2992
2391
        esac
2994
2393
        # Clear the version info if we defaulted, and they specified a release.
2995
2394
        if test -z "$vinfo" && test -n "$release"; then
2996
2395
          major=
 
2396
          verstring="0.0"
2997
2397
          case $version_type in
2998
2398
          darwin)
2999
2399
            # we can't check for "0.0" in archive_cmds due to quoting
3000
2400
            # problems, so we reset it completely
3001
 
            verstring=
 
2401
            verstring=""
3002
2402
            ;;
3003
2403
          *)
3004
2404
            verstring="0.0"
3032
2432
      fi
3033
2433
 
3034
2434
      if test "$mode" != relink; then
3035
 
        # Remove our outputs, but don't remove object files since they
3036
 
        # may have been created when compiling PIC objects.
3037
 
        removelist=
3038
 
        tempremovelist=`$echo "$output_objdir/*"`
3039
 
        for p in $tempremovelist; do
3040
 
          case $p in
3041
 
            *.$objext)
3042
 
               ;;
3043
 
            $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
3044
 
               removelist="$removelist $p"
3045
 
               ;;
3046
 
            *) ;;
3047
 
          esac
3048
 
        done
3049
 
        if test -n "$removelist"; then
3050
 
          $show "${rm}r $removelist"
3051
 
          $run ${rm}r $removelist
3052
 
        fi
 
2435
        # Remove our outputs.
 
2436
        $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
 
2437
        $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
3053
2438
      fi
3054
2439
 
3055
2440
      # Now set the variables for building old libraries.
3062
2447
 
3063
2448
      # Eliminate all temporary directories.
3064
2449
      for path in $notinst_path; do
3065
 
        lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
3066
 
        deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
3067
 
        dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
 
2450
        lib_search_path=`echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
 
2451
        deplibs=`echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
 
2452
        dependency_libs=`echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
3068
2453
      done
3069
2454
 
3070
2455
      if test -n "$xrpath"; then
3077
2462
          *) finalize_rpath="$finalize_rpath $libdir" ;;
3078
2463
          esac
3079
2464
        done
3080
 
        if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
 
2465
        if test $hardcode_into_libs != yes || test $build_old_libs = yes; then
3081
2466
          dependency_libs="$temp_xrpath $dependency_libs"
3082
2467
        fi
3083
2468
      fi
3117
2502
            ;;
3118
2503
          *-*-openbsd* | *-*-freebsd*)
3119
2504
            # Do not include libc due to us having libc/libc_r.
3120
 
            test "X$arg" = "X-lc" && continue
3121
2505
            ;;
3122
 
          *)
 
2506
          *)
3123
2507
            # Add libc to deplibs on all other systems if necessary.
3124
 
            if test "$build_libtool_need_lc" = "yes"; then
 
2508
            if test $build_libtool_need_lc = "yes"; then
3125
2509
              deplibs="$deplibs -lc"
3126
2510
            fi
3127
2511
            ;;
3148
2532
          # This might be a little naive.  We might want to check
3149
2533
          # whether the library exists or not.  But this is on
3150
2534
          # osf3 & osf4 and I'm not really sure... Just
3151
 
          # implementing what was already the behavior.
 
2535
          # implementing what was already the behaviour.
3152
2536
          newdeplibs=$deplibs
3153
2537
          ;;
3154
2538
        test_compile)
3161
2545
          int main() { return 0; }
3162
2546
EOF
3163
2547
          $rm conftest
3164
 
          $LTCC -o conftest conftest.c $deplibs
3165
 
          if test "$?" -eq 0 ; then
 
2548
          $CC -o conftest conftest.c $deplibs
 
2549
          if test $? -eq 0 ; then
3166
2550
            ldd_output=`ldd conftest`
3167
2551
            for i in $deplibs; do
3168
2552
              name="`expr $i : '-l\(.*\)'`"
3169
2553
              # If $name is empty we are operating on a -L argument.
3170
 
              if test "$name" != "" && test "$name" -ne "0"; then
3171
 
                if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3172
 
                  case " $predeps $postdeps " in
3173
 
                  *" $i "*)
3174
 
                    newdeplibs="$newdeplibs $i"
3175
 
                    i=""
3176
 
                    ;;
3177
 
                  esac
3178
 
                fi
3179
 
                if test -n "$i" ; then
 
2554
              if test -n "$name" && test "$name" != "0"; then
 
2555
                libname=`eval \\$echo \"$libname_spec\"`
 
2556
                deplib_matches=`eval \\$echo \"$library_names_spec\"`
 
2557
                set dummy $deplib_matches
 
2558
                deplib_match=$2
 
2559
                if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
 
2560
                  newdeplibs="$newdeplibs $i"
 
2561
                else
 
2562
                  droppeddeps=yes
 
2563
                  echo
 
2564
                  echo "*** Warning: dynamic linker does not accept needed library $i."
 
2565
                  echo "*** I have the capability to make that library automatically link in when"
 
2566
                  echo "*** you link to this library.  But I can only do this if you have a"
 
2567
                  echo "*** shared version of the library, which I believe you do not have"
 
2568
                  echo "*** because a test_compile did reveal that the linker did not use it for"
 
2569
                  echo "*** its dynamic dependency list that programs get resolved with at runtime."
 
2570
                fi
 
2571
              else
 
2572
                newdeplibs="$newdeplibs $i"
 
2573
              fi
 
2574
            done
 
2575
          else
 
2576
            # Error occured in the first compile.  Let's try to salvage
 
2577
            # the situation: Compile a separate program for each library.
 
2578
            for i in $deplibs; do
 
2579
              name="`expr $i : '-l\(.*\)'`"
 
2580
             # If $name is empty we are operating on a -L argument.
 
2581
              if test -n "$name" && test "$name" != "0"; then
 
2582
                $rm conftest
 
2583
                $CC -o conftest conftest.c $i
 
2584
                # Did it work?
 
2585
                if test $? -eq 0 ; then
 
2586
                  ldd_output=`ldd conftest`
3180
2587
                  libname=`eval \\$echo \"$libname_spec\"`
3181
2588
                  deplib_matches=`eval \\$echo \"$library_names_spec\"`
3182
2589
                  set dummy $deplib_matches
3185
2592
                    newdeplibs="$newdeplibs $i"
3186
2593
                  else
3187
2594
                    droppeddeps=yes
3188
 
                    $echo
3189
 
                    $echo "*** Warning: dynamic linker does not accept needed library $i."
3190
 
                    $echo "*** I have the capability to make that library automatically link in when"
3191
 
                    $echo "*** you link to this library.  But I can only do this if you have a"
3192
 
                    $echo "*** shared version of the library, which I believe you do not have"
3193
 
                    $echo "*** because a test_compile did reveal that the linker did not use it for"
3194
 
                    $echo "*** its dynamic dependency list that programs get resolved with at runtime."
3195
 
                  fi
3196
 
                fi
3197
 
              else
3198
 
                newdeplibs="$newdeplibs $i"
3199
 
              fi
3200
 
            done
3201
 
          else
3202
 
            # Error occurred in the first compile.  Let's try to salvage
3203
 
            # the situation: Compile a separate program for each library.
3204
 
            for i in $deplibs; do
3205
 
              name="`expr $i : '-l\(.*\)'`"
3206
 
              # If $name is empty we are operating on a -L argument.
3207
 
              if test "$name" != "" && test "$name" != "0"; then
3208
 
                $rm conftest
3209
 
                $LTCC -o conftest conftest.c $i
3210
 
                # Did it work?
3211
 
                if test "$?" -eq 0 ; then
3212
 
                  ldd_output=`ldd conftest`
3213
 
                  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3214
 
                    case " $predeps $postdeps " in
3215
 
                    *" $i "*)
3216
 
                      newdeplibs="$newdeplibs $i"
3217
 
                      i=""
3218
 
                      ;;
3219
 
                    esac
3220
 
                  fi
3221
 
                  if test -n "$i" ; then
3222
 
                    libname=`eval \\$echo \"$libname_spec\"`
3223
 
                    deplib_matches=`eval \\$echo \"$library_names_spec\"`
3224
 
                    set dummy $deplib_matches
3225
 
                    deplib_match=$2
3226
 
                    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3227
 
                      newdeplibs="$newdeplibs $i"
3228
 
                    else
3229
 
                      droppeddeps=yes
3230
 
                      $echo
3231
 
                      $echo "*** Warning: dynamic linker does not accept needed library $i."
3232
 
                      $echo "*** I have the capability to make that library automatically link in when"
3233
 
                      $echo "*** you link to this library.  But I can only do this if you have a"
3234
 
                      $echo "*** shared version of the library, which you do not appear to have"
3235
 
                      $echo "*** because a test_compile did reveal that the linker did not use this one"
3236
 
                      $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
3237
 
                    fi
 
2595
                    echo
 
2596
                    echo "*** Warning: dynamic linker does not accept needed library $i."
 
2597
                    echo "*** I have the capability to make that library automatically link in when"
 
2598
                    echo "*** you link to this library.  But I can only do this if you have a"
 
2599
                    echo "*** shared version of the library, which you do not appear to have"
 
2600
                    echo "*** because a test_compile did reveal that the linker did not use this one"
 
2601
                    echo "*** as a dynamic dependency that programs can get resolved with at runtime."
3238
2602
                  fi
3239
2603
                else
3240
2604
                  droppeddeps=yes
3241
 
                  $echo
3242
 
                  $echo "*** Warning!  Library $i is needed by this library but I was not able to"
3243
 
                  $echo "***  make it link in!  You will probably need to install it or some"
3244
 
                  $echo "*** library that it depends on before this library will be fully"
3245
 
                  $echo "*** functional.  Installing it before continuing would be even better."
 
2605
                  echo
 
2606
                  echo "*** Warning!  Library $i is needed by this library but I was not able to"
 
2607
                  echo "***  make it link in!  You will probably need to install it or some"
 
2608
                  echo "*** library that it depends on before this library will be fully"
 
2609
                  echo "*** functional.  Installing it before continuing would be even better."
3246
2610
                fi
3247
2611
              else
3248
2612
                newdeplibs="$newdeplibs $i"
3256
2620
          for a_deplib in $deplibs; do
3257
2621
            name="`expr $a_deplib : '-l\(.*\)'`"
3258
2622
            # If $name is empty we are operating on a -L argument.
3259
 
            if test "$name" != "" && test  "$name" != "0"; then
3260
 
              if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3261
 
                case " $predeps $postdeps " in
3262
 
                *" $a_deplib "*)
3263
 
                  newdeplibs="$newdeplibs $a_deplib"
3264
 
                  a_deplib=""
3265
 
                  ;;
3266
 
                esac
3267
 
              fi
3268
 
              if test -n "$a_deplib" ; then
3269
 
                libname=`eval \\$echo \"$libname_spec\"`
3270
 
                for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3271
 
                  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3272
 
                  for potent_lib in $potential_libs; do
 
2623
            if test -n "$name" && test "$name" != "0"; then
 
2624
              libname=`eval \\$echo \"$libname_spec\"`
 
2625
              for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
 
2626
                    potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
 
2627
                    for potent_lib in $potential_libs; do
3273
2628
                      # Follow soft links.
3274
2629
                      if ls -lLd "$potent_lib" 2>/dev/null \
3275
2630
                         | grep " -> " >/dev/null; then
3290
2645
                      done
3291
2646
                      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
3292
2647
                         | ${SED} 10q \
3293
 
                         | $EGREP "$file_magic_regex" > /dev/null; then
 
2648
                         | egrep "$file_magic_regex" > /dev/null; then
3294
2649
                        newdeplibs="$newdeplibs $a_deplib"
3295
2650
                        a_deplib=""
3296
2651
                        break 2
3297
2652
                      fi
3298
 
                  done
3299
 
                done
3300
 
              fi
 
2653
                    done
 
2654
              done
3301
2655
              if test -n "$a_deplib" ; then
3302
2656
                droppeddeps=yes
3303
 
                $echo
3304
 
                $echo "*** Warning: linker path does not have real file for library $a_deplib."
3305
 
                $echo "*** I have the capability to make that library automatically link in when"
3306
 
                $echo "*** you link to this library.  But I can only do this if you have a"
3307
 
                $echo "*** shared version of the library, which you do not appear to have"
3308
 
                $echo "*** because I did check the linker path looking for a file starting"
 
2657
                echo
 
2658
                echo "*** Warning: linker path does not have real file for library $a_deplib."
 
2659
                echo "*** I have the capability to make that library automatically link in when"
 
2660
                echo "*** you link to this library.  But I can only do this if you have a"
 
2661
                echo "*** shared version of the library, which you do not appear to have"
 
2662
                echo "*** because I did check the linker path looking for a file starting"
3309
2663
                if test -z "$potlib" ; then
3310
 
                  $echo "*** with $libname but no candidates were found. (...for file magic test)"
 
2664
                  echo "*** with $libname but no candidates were found. (...for file magic test)"
3311
2665
                else
3312
 
                  $echo "*** with $libname and none of the candidates passed a file format test"
3313
 
                  $echo "*** using a file magic. Last file checked: $potlib"
 
2666
                  echo "*** with $libname and none of the candidates passed a file format test"
 
2667
                  echo "*** using a file magic. Last file checked: $potlib"
3314
2668
                fi
3315
2669
              fi
3316
2670
            else
3326
2680
            name="`expr $a_deplib : '-l\(.*\)'`"
3327
2681
            # If $name is empty we are operating on a -L argument.
3328
2682
            if test -n "$name" && test "$name" != "0"; then
3329
 
              if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3330
 
                case " $predeps $postdeps " in
3331
 
                *" $a_deplib "*)
3332
 
                  newdeplibs="$newdeplibs $a_deplib"
3333
 
                  a_deplib=""
3334
 
                  ;;
3335
 
                esac
3336
 
              fi
3337
 
              if test -n "$a_deplib" ; then
3338
 
                libname=`eval \\$echo \"$libname_spec\"`
3339
 
                for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3340
 
                  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3341
 
                  for potent_lib in $potential_libs; do
3342
 
                    potlib="$potent_lib" # see symlink-check above in file_magic test
3343
 
                    if eval $echo \"$potent_lib\" 2>/dev/null \
3344
 
                        | ${SED} 10q \
3345
 
                        | $EGREP "$match_pattern_regex" > /dev/null; then
3346
 
                      newdeplibs="$newdeplibs $a_deplib"
3347
 
                      a_deplib=""
3348
 
                      break 2
3349
 
                    fi
3350
 
                  done
 
2683
              libname=`eval \\$echo \"$libname_spec\"`
 
2684
              for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
 
2685
                potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
 
2686
                for potent_lib in $potential_libs; do
 
2687
                  potlib="$potent_lib" # see symlink-check below in file_magic test
 
2688
                  if eval echo \"$potent_lib\" 2>/dev/null \
 
2689
                      | ${SED} 10q \
 
2690
                      | egrep "$match_pattern_regex" > /dev/null; then
 
2691
                    newdeplibs="$newdeplibs $a_deplib"
 
2692
                    a_deplib=""
 
2693
                    break 2
 
2694
                  fi
3351
2695
                done
3352
 
              fi
 
2696
              done
3353
2697
              if test -n "$a_deplib" ; then
3354
2698
                droppeddeps=yes
3355
 
                $echo
3356
 
                $echo "*** Warning: linker path does not have real file for library $a_deplib."
3357
 
                $echo "*** I have the capability to make that library automatically link in when"
3358
 
                $echo "*** you link to this library.  But I can only do this if you have a"
3359
 
                $echo "*** shared version of the library, which you do not appear to have"
3360
 
                $echo "*** because I did check the linker path looking for a file starting"
 
2699
                echo
 
2700
                echo "*** Warning: linker path does not have real file for library $a_deplib."
 
2701
                echo "*** I have the capability to make that library automatically link in when"
 
2702
                echo "*** you link to this library.  But I can only do this if you have a"
 
2703
                echo "*** shared version of the library, which you do not appear to have"
 
2704
                echo "*** because I did check the linker path looking for a file starting"
3361
2705
                if test -z "$potlib" ; then
3362
 
                  $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
 
2706
                  echo "*** with $libname but no candidates were found. (...for regex pattern test)"
3363
2707
                else
3364
 
                  $echo "*** with $libname and none of the candidates passed a file format test"
3365
 
                  $echo "*** using a regex pattern. Last file checked: $potlib"
 
2708
                  echo "*** with $libname and none of the candidates passed a file format test"
 
2709
                  echo "*** using a regex pattern. Last file checked: $potlib"
3366
2710
                fi
3367
2711
              fi
3368
2712
            else
3373
2717
          ;;
3374
2718
        none | unknown | *)
3375
2719
          newdeplibs=""
3376
 
          tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
3377
 
            -e 's/ -[LR][^ ]*//g'`
3378
 
          if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3379
 
            for i in $predeps $postdeps ; do
3380
 
              # can't use Xsed below, because $i might contain '/'
3381
 
              tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
3382
 
            done
3383
 
          fi
3384
 
          if $echo "X $tmp_deplibs" | $Xsed -e 's/[     ]//g' \
3385
 
            | grep . >/dev/null; then
3386
 
            $echo
 
2720
          if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
 
2721
               -e 's/ -[LR][^ ]*//g' -e 's/[    ]//g' |
 
2722
             grep . >/dev/null; then
 
2723
            echo
3387
2724
            if test "X$deplibs_check_method" = "Xnone"; then
3388
 
              $echo "*** Warning: inter-library dependencies are not supported in this platform."
 
2725
              echo "*** Warning: inter-library dependencies are not supported in this platform."
3389
2726
            else
3390
 
              $echo "*** Warning: inter-library dependencies are not known to be supported."
 
2727
              echo "*** Warning: inter-library dependencies are not known to be supported."
3391
2728
            fi
3392
 
            $echo "*** All declared inter-library dependencies are being dropped."
 
2729
            echo "*** All declared inter-library dependencies are being dropped."
3393
2730
            droppeddeps=yes
3394
2731
          fi
3395
2732
          ;;
3409
2746
 
3410
2747
        if test "$droppeddeps" = yes; then
3411
2748
          if test "$module" = yes; then
3412
 
            $echo
3413
 
            $echo "*** Warning: libtool could not satisfy all declared inter-library"
3414
 
            $echo "*** dependencies of module $libname.  Therefore, libtool will create"
3415
 
            $echo "*** a static module, that should work as long as the dlopening"
3416
 
            $echo "*** application is linked with the -dlopen flag."
 
2749
            echo
 
2750
            echo "*** Warning: libtool could not satisfy all declared inter-library"
 
2751
            echo "*** dependencies of module $libname.  Therefore, libtool will create"
 
2752
            echo "*** a static module, that should work as long as the dlopening"
 
2753
            echo "*** application is linked with the -dlopen flag."
3417
2754
            if test -z "$global_symbol_pipe"; then
3418
 
              $echo
3419
 
              $echo "*** However, this would only work if libtool was able to extract symbol"
3420
 
              $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
3421
 
              $echo "*** not find such a program.  So, this module is probably useless."
3422
 
              $echo "*** \`nm' from GNU binutils and a full rebuild may help."
 
2755
              echo
 
2756
              echo "*** However, this would only work if libtool was able to extract symbol"
 
2757
              echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
 
2758
              echo "*** not find such a program.  So, this module is probably useless."
 
2759
              echo "*** \`nm' from GNU binutils and a full rebuild may help."
3423
2760
            fi
3424
2761
            if test "$build_old_libs" = no; then
3425
2762
              oldlibs="$output_objdir/$libname.$libext"
3429
2766
              build_libtool_libs=no
3430
2767
            fi
3431
2768
          else
3432
 
            $echo "*** The inter-library dependencies that have been dropped here will be"
3433
 
            $echo "*** automatically added whenever a program is linked with this library"
3434
 
            $echo "*** or is declared to -dlopen it."
 
2769
            echo "*** The inter-library dependencies that have been dropped here will be"
 
2770
            echo "*** automatically added whenever a program is linked with this library"
 
2771
            echo "*** or is declared to -dlopen it."
3435
2772
 
3436
 
            if test "$allow_undefined" = no; then
3437
 
              $echo
3438
 
              $echo "*** Since this library must not contain undefined symbols,"
3439
 
              $echo "*** because either the platform does not support them or"
3440
 
              $echo "*** it was explicitly requested with -no-undefined,"
3441
 
              $echo "*** libtool will only create a static version of it."
 
2773
            if test $allow_undefined = no; then
 
2774
              echo
 
2775
              echo "*** Since this library must not contain undefined symbols,"
 
2776
              echo "*** because either the platform does not support them or"
 
2777
              echo "*** it was explicitly requested with -no-undefined,"
 
2778
              echo "*** libtool will only create a static version of it."
3442
2779
              if test "$build_old_libs" = no; then
3443
2780
                oldlibs="$output_objdir/$libname.$libext"
3444
2781
                build_libtool_libs=module
3460
2797
 
3461
2798
      # Test again, we may have decided not to build it any more
3462
2799
      if test "$build_libtool_libs" = yes; then
3463
 
        if test "$hardcode_into_libs" = yes; then
 
2800
        if test $hardcode_into_libs = yes; then
3464
2801
          # Hardcode the library paths
3465
2802
          hardcode_libdirs=
3466
2803
          dep_rpath=
3496
2833
          if test -n "$hardcode_libdir_separator" &&
3497
2834
             test -n "$hardcode_libdirs"; then
3498
2835
            libdir="$hardcode_libdirs"
3499
 
            if test -n "$hardcode_libdir_flag_spec_ld"; then
3500
 
              eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
3501
 
            else
3502
 
              eval dep_rpath=\"$hardcode_libdir_flag_spec\"
3503
 
            fi
 
2836
            eval dep_rpath=\"$hardcode_libdir_flag_spec\"
3504
2837
          fi
3505
2838
          if test -n "$runpath_var" && test -n "$perm_rpath"; then
3506
2839
            # We should set the runpath_var.
3520
2853
        fi
3521
2854
 
3522
2855
        # Get the real and link names of the library.
3523
 
        eval shared_ext=\"$shrext\"
3524
2856
        eval library_names=\"$library_names_spec\"
3525
2857
        set dummy $library_names
3526
2858
        realname="$2"
3531
2863
        else
3532
2864
          soname="$realname"
3533
2865
        fi
3534
 
        if test -z "$dlname"; then
3535
 
          dlname=$soname
3536
 
        fi
 
2866
        test -z "$dlname" && dlname=$soname
3537
2867
 
3538
2868
        lib="$output_objdir/$realname"
3539
2869
        for link
3541
2871
          linknames="$linknames $link"
3542
2872
        done
3543
2873
 
 
2874
        # Ensure that we have .o objects for linkers which dislike .lo
 
2875
        # (e.g. aix) in case we are running --disable-static
 
2876
        for obj in $libobjs; do
 
2877
          xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
 
2878
          if test "X$xdir" = "X$obj"; then
 
2879
            xdir="."
 
2880
          else
 
2881
            xdir="$xdir"
 
2882
          fi
 
2883
          baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
 
2884
          oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
 
2885
          if test ! -f $xdir/$oldobj; then
 
2886
            $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
 
2887
            $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
 
2888
          fi
 
2889
        done
 
2890
 
3544
2891
        # Use standard objects if they are pic
3545
2892
        test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3546
2893
 
3554
2901
            save_ifs="$IFS"; IFS='~'
3555
2902
            for cmd in $cmds; do
3556
2903
              IFS="$save_ifs"
3557
 
              if len=`expr "X$cmd" : ".*"` &&
3558
 
               test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
3559
 
                $show "$cmd"
3560
 
                $run eval "$cmd" || exit $?
3561
 
                skipped_export=false
3562
 
              else
3563
 
                # The command line is too long to execute in one step.
3564
 
                $show "using reloadable object file for export list..."
3565
 
                skipped_export=:
3566
 
              fi
 
2904
              $show "$cmd"
 
2905
              $run eval "$cmd" || exit $?
3567
2906
            done
3568
2907
            IFS="$save_ifs"
3569
2908
            if test -n "$export_symbols_regex"; then
3570
 
              $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
3571
 
              $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
 
2909
              $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
 
2910
              $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
3572
2911
              $show "$mv \"${export_symbols}T\" \"$export_symbols\""
3573
2912
              $run eval '$mv "${export_symbols}T" "$export_symbols"'
3574
2913
            fi
3579
2918
          $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
3580
2919
        fi
3581
2920
 
3582
 
        tmp_deplibs=
3583
 
        for test_deplib in $deplibs; do
3584
 
                case " $convenience " in
3585
 
                *" $test_deplib "*) ;;
3586
 
                *) 
3587
 
                        tmp_deplibs="$tmp_deplibs $test_deplib"
3588
 
                        ;;
3589
 
                esac
3590
 
        done
3591
 
        deplibs="$tmp_deplibs" 
3592
 
 
3593
2921
        if test -n "$convenience"; then
3594
2922
          if test -n "$whole_archive_flag_spec"; then
3595
 
            save_libobjs=$libobjs
3596
2923
            eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3597
2924
          else
3598
2925
            gentop="$output_objdir/${outputname}x"
3599
2926
            $show "${rm}r $gentop"
3600
2927
            $run ${rm}r "$gentop"
3601
 
            $show "$mkdir $gentop"
3602
 
            $run $mkdir "$gentop"
 
2928
            $show "mkdir $gentop"
 
2929
            $run mkdir "$gentop"
3603
2930
            status=$?
3604
 
            if test "$status" -ne 0 && test ! -d "$gentop"; then
 
2931
            if test $status -ne 0 && test ! -d "$gentop"; then
3605
2932
              exit $status
3606
2933
            fi
3607
2934
            generated="$generated $gentop"
3617
2944
 
3618
2945
              $show "${rm}r $xdir"
3619
2946
              $run ${rm}r "$xdir"
3620
 
              $show "$mkdir $xdir"
3621
 
              $run $mkdir "$xdir"
 
2947
              $show "mkdir $xdir"
 
2948
              $run mkdir "$xdir"
3622
2949
              status=$?
3623
 
              if test "$status" -ne 0 && test ! -d "$xdir"; then
 
2950
              if test $status -ne 0 && test ! -d "$xdir"; then
3624
2951
                exit $status
3625
2952
              fi
3626
 
              # We will extract separately just the conflicting names and we will no
3627
 
              # longer touch any unique names. It is faster to leave these extract
3628
 
              # automatically by $AR in one run.
3629
2953
              $show "(cd $xdir && $AR x $xabs)"
3630
2954
              $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3631
 
              if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
3632
 
                :
3633
 
              else
3634
 
                $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
3635
 
                $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
3636
 
                $AR t "$xabs" | sort | uniq -cd | while read -r count name
3637
 
                do
3638
 
                  i=1
3639
 
                  while test "$i" -le "$count"
3640
 
                  do
3641
 
                   # Put our $i before any first dot (extension)
3642
 
                   # Never overwrite any file
3643
 
                   name_to="$name"
3644
 
                   while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
3645
 
                   do
3646
 
                     name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
3647
 
                   done
3648
 
                   $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
3649
 
                   $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
3650
 
                   i=`expr $i + 1`
3651
 
                  done
3652
 
                done
3653
 
              fi
3654
2955
 
3655
 
              libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
 
2956
              libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
3656
2957
            done
3657
2958
          fi
3658
2959
        fi
3668
2969
        fi
3669
2970
 
3670
2971
        # Do each of the archive commands.
3671
 
        if test "$module" = yes && test -n "$module_cmds" ; then
3672
 
          if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
3673
 
            eval cmds=\"$module_expsym_cmds\"
3674
 
          else
3675
 
            eval cmds=\"$module_cmds\"
3676
 
          fi
3677
 
        else
3678
2972
        if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3679
2973
          eval cmds=\"$archive_expsym_cmds\"
3680
2974
        else
 
2975
          save_deplibs="$deplibs"
 
2976
          for conv in $convenience; do
 
2977
            tmp_deplibs=
 
2978
            for test_deplib in $deplibs; do
 
2979
              if test "$test_deplib" != "$conv"; then
 
2980
                tmp_deplibs="$tmp_deplibs $test_deplib"
 
2981
              fi
 
2982
            done
 
2983
            deplibs="$tmp_deplibs"
 
2984
          done
3681
2985
          eval cmds=\"$archive_cmds\"
3682
 
          fi
3683
 
        fi
3684
 
 
3685
 
        if test "X$skipped_export" != "X:" && len=`expr "X$cmds" : ".*"` &&
3686
 
           test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
3687
 
          :
3688
 
        else
3689
 
          # The command line is too long to link in one step, link piecewise.
3690
 
          $echo "creating reloadable object files..."
3691
 
 
3692
 
          # Save the value of $output and $libobjs because we want to
3693
 
          # use them later.  If we have whole_archive_flag_spec, we
3694
 
          # want to use save_libobjs as it was before
3695
 
          # whole_archive_flag_spec was expanded, because we can't
3696
 
          # assume the linker understands whole_archive_flag_spec.
3697
 
          # This may have to be revisited, in case too many
3698
 
          # convenience libraries get linked in and end up exceeding
3699
 
          # the spec.
3700
 
          if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
3701
 
            save_libobjs=$libobjs
3702
 
          fi
3703
 
          save_output=$output
3704
 
 
3705
 
          # Clear the reloadable object creation command queue and
3706
 
          # initialize k to one.
3707
 
          test_cmds=
3708
 
          concat_cmds=
3709
 
          objlist=
3710
 
          delfiles=
3711
 
          last_robj=
3712
 
          k=1
3713
 
          output=$output_objdir/$save_output-${k}.$objext
3714
 
          # Loop over the list of objects to be linked.
3715
 
          for obj in $save_libobjs
3716
 
          do
3717
 
            eval test_cmds=\"$reload_cmds $objlist $last_robj\"
3718
 
            if test "X$objlist" = X ||
3719
 
               { len=`expr "X$test_cmds" : ".*"` &&
3720
 
                 test "$len" -le "$max_cmd_len"; }; then
3721
 
              objlist="$objlist $obj"
3722
 
            else
3723
 
              # The command $test_cmds is almost too long, add a
3724
 
              # command to the queue.
3725
 
              if test "$k" -eq 1 ; then
3726
 
                # The first file doesn't have a previous command to add.
3727
 
                eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
3728
 
              else
3729
 
                # All subsequent reloadable object files will link in
3730
 
                # the last one created.
3731
 
                eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
3732
 
              fi
3733
 
              last_robj=$output_objdir/$save_output-${k}.$objext
3734
 
              k=`expr $k + 1`
3735
 
              output=$output_objdir/$save_output-${k}.$objext
3736
 
              objlist=$obj
3737
 
              len=1
3738
 
            fi
3739
 
          done
3740
 
          # Handle the remaining objects by creating one last
3741
 
          # reloadable object file.  All subsequent reloadable object
3742
 
          # files will link in the last one created.
3743
 
          test -z "$concat_cmds" || concat_cmds=$concat_cmds~
3744
 
          eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
3745
 
 
3746
 
          if ${skipped_export-false}; then
3747
 
            $show "generating symbol list for \`$libname.la'"
3748
 
            export_symbols="$output_objdir/$libname.exp"
3749
 
            $run $rm $export_symbols
3750
 
            libobjs=$output
3751
 
            # Append the command to create the export file.
3752
 
            eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
3753
 
          fi
3754
 
 
3755
 
          # Set up a command to remove the reloadale object files
3756
 
          # after they are used.
3757
 
          i=0
3758
 
          while test "$i" -lt "$k"
3759
 
          do
3760
 
            i=`expr $i + 1`
3761
 
            delfiles="$delfiles $output_objdir/$save_output-${i}.$objext"
3762
 
          done
3763
 
 
3764
 
          $echo "creating a temporary reloadable object file: $output"
3765
 
 
3766
 
          # Loop through the commands generated above and execute them.
3767
 
          save_ifs="$IFS"; IFS='~'
3768
 
          for cmd in $concat_cmds; do
3769
 
            IFS="$save_ifs"
3770
 
            $show "$cmd"
3771
 
            $run eval "$cmd" || exit $?
3772
 
          done
3773
 
          IFS="$save_ifs"
3774
 
 
3775
 
          libobjs=$output
3776
 
          # Restore the value of output.
3777
 
          output=$save_output
3778
 
 
3779
 
          if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
3780
 
            eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3781
 
          fi
3782
 
          # Expand the library linking commands again to reset the
3783
 
          # value of $libobjs for piecewise linking.
3784
 
 
3785
 
          # Do each of the archive commands.
3786
 
          if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3787
 
            eval cmds=\"$archive_expsym_cmds\"
3788
 
          else
3789
 
            eval cmds=\"$archive_cmds\"
3790
 
          fi
3791
 
 
3792
 
          # Append the command to remove the reloadable object files
3793
 
          # to the just-reset $cmds.
3794
 
          eval cmds=\"\$cmds~$rm $delfiles\"
 
2986
          deplibs="$save_deplibs"
3795
2987
        fi
3796
2988
        save_ifs="$IFS"; IFS='~'
3797
2989
        for cmd in $cmds; do
3883
3075
          gentop="$output_objdir/${obj}x"
3884
3076
          $show "${rm}r $gentop"
3885
3077
          $run ${rm}r "$gentop"
3886
 
          $show "$mkdir $gentop"
3887
 
          $run $mkdir "$gentop"
 
3078
          $show "mkdir $gentop"
 
3079
          $run mkdir "$gentop"
3888
3080
          status=$?
3889
 
          if test "$status" -ne 0 && test ! -d "$gentop"; then
 
3081
          if test $status -ne 0 && test ! -d "$gentop"; then
3890
3082
            exit $status
3891
3083
          fi
3892
3084
          generated="$generated $gentop"
3902
3094
 
3903
3095
            $show "${rm}r $xdir"
3904
3096
            $run ${rm}r "$xdir"
3905
 
            $show "$mkdir $xdir"
3906
 
            $run $mkdir "$xdir"
 
3097
            $show "mkdir $xdir"
 
3098
            $run mkdir "$xdir"
3907
3099
            status=$?
3908
 
            if test "$status" -ne 0 && test ! -d "$xdir"; then
 
3100
            if test $status -ne 0 && test ! -d "$xdir"; then
3909
3101
              exit $status
3910
3102
            fi
3911
 
            # We will extract separately just the conflicting names and we will no
3912
 
            # longer touch any unique names. It is faster to leave these extract
3913
 
            # automatically by $AR in one run.
3914
3103
            $show "(cd $xdir && $AR x $xabs)"
3915
3104
            $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3916
 
            if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
3917
 
              :
3918
 
            else
3919
 
              $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
3920
 
              $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
3921
 
              $AR t "$xabs" | sort | uniq -cd | while read -r count name
3922
 
              do
3923
 
                i=1
3924
 
                while test "$i" -le "$count"
3925
 
                do
3926
 
                 # Put our $i before any first dot (extension)
3927
 
                 # Never overwrite any file
3928
 
                 name_to="$name"
3929
 
                 while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
3930
 
                 do
3931
 
                   name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
3932
 
                 done
3933
 
                 $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
3934
 
                 $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
3935
 
                 i=`expr $i + 1`
3936
 
                done
3937
 
              done
3938
 
            fi
3939
3105
 
3940
 
            reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
 
3106
            reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
3941
3107
          done
3942
3108
        fi
3943
3109
      fi
3973
3139
 
3974
3140
        # Create an invalid libtool object if no PIC, so that we don't
3975
3141
        # accidentally link it into a program.
3976
 
        # $show "echo timestamp > $libobj"
3977
 
        # $run eval "echo timestamp > $libobj" || exit $?
 
3142
        $show "echo timestamp > $libobj"
 
3143
        $run eval "echo timestamp > $libobj" || exit $?
3978
3144
        exit 0
3979
3145
      fi
3980
3146
 
3990
3156
          $run eval "$cmd" || exit $?
3991
3157
        done
3992
3158
        IFS="$save_ifs"
 
3159
      else
 
3160
        # Just create a symlink.
 
3161
        $show $rm $libobj
 
3162
        $run $rm $libobj
 
3163
        xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
 
3164
        if test "X$xdir" = "X$libobj"; then
 
3165
          xdir="."
 
3166
        else
 
3167
          xdir="$xdir"
 
3168
        fi
 
3169
        baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
 
3170
        oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
 
3171
        $show "(cd $xdir && $LN_S $oldobj $baseobj)"
 
3172
        $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
3993
3173
      fi
3994
3174
 
3995
3175
      if test -n "$gentop"; then
4002
3182
 
4003
3183
    prog)
4004
3184
      case $host in
4005
 
        *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
 
3185
        *cygwin*) output=`echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
4006
3186
      esac
4007
3187
      if test -n "$vinfo"; then
4008
3188
        $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
4024
3204
        # On Rhapsody replace the C library is the System framework
4025
3205
        compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4026
3206
        finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
 
3207
        case $host in
 
3208
        *darwin*)
 
3209
          # Don't allow lazy linking, it breaks C++ global constructors
 
3210
          compile_command="$compile_command ${wl}-bind_at_load"
 
3211
          finalize_command="$finalize_command ${wl}-bind_at_load"
 
3212
          ;;
 
3213
        esac
4027
3214
        ;;
4028
3215
      esac
4029
3216
 
4030
 
      case $host in
4031
 
      *darwin*)
4032
 
        # Don't allow lazy linking, it breaks C++ global constructors
4033
 
        if test "$tagname" = CXX ; then
4034
 
        compile_command="$compile_command ${wl}-bind_at_load"
4035
 
        finalize_command="$finalize_command ${wl}-bind_at_load"
4036
 
        fi
4037
 
        ;;
4038
 
      esac
4039
 
 
4040
3217
      compile_command="$compile_command $compile_deplibs"
4041
3218
      finalize_command="$finalize_command $finalize_deplibs"
4042
3219
 
4187
3364
            done
4188
3365
 
4189
3366
            if test -n "$exclude_expsyms"; then
4190
 
              $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
 
3367
              $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
4191
3368
              $run eval '$mv "$nlist"T "$nlist"'
4192
3369
            fi
4193
3370
 
4194
3371
            if test -n "$export_symbols_regex"; then
4195
 
              $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
 
3372
              $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
4196
3373
              $run eval '$mv "$nlist"T "$nlist"'
4197
3374
            fi
4198
3375
 
4210
3387
 
4211
3388
          for arg in $dlprefiles; do
4212
3389
            $show "extracting global C symbols from \`$arg'"
4213
 
            name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
4214
 
            $run eval '$echo ": $name " >> "$nlist"'
 
3390
            name=`echo "$arg" | ${SED} -e 's%^.*/%%'`
 
3391
            $run eval 'echo ": $name " >> "$nlist"'
4215
3392
            $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4216
3393
          done
4217
3394
 
4220
3397
            test -f "$nlist" || : > "$nlist"
4221
3398
 
4222
3399
            if test -n "$exclude_expsyms"; then
4223
 
              $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
 
3400
              egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
4224
3401
              $mv "$nlist"T "$nlist"
4225
3402
            fi
4226
3403
 
4240
3417
            if test -f "$nlist"S; then
4241
3418
              eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
4242
3419
            else
4243
 
              $echo '/* NONE */' >> "$output_objdir/$dlsyms"
 
3420
              echo '/* NONE */' >> "$output_objdir/$dlsyms"
4244
3421
            fi
4245
3422
 
4246
3423
            $echo >> "$output_objdir/$dlsyms" "\
4292
3469
          *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
4293
3470
            case "$compile_command " in
4294
3471
            *" -static "*) ;;
4295
 
            *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
 
3472
            *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
4296
3473
            esac;;
4297
3474
          *-*-hpux*)
4298
3475
            case "$compile_command " in
4299
3476
            *" -static "*) ;;
4300
 
            *) pic_flag_for_symtable=" $pic_flag";;
 
3477
            *) pic_flag_for_symtable=" $pic_flag -DPIC";;
4301
3478
            esac
4302
3479
          esac
4303
3480
 
4304
3481
          # Now compile the dynamic symbol file.
4305
 
          $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
4306
 
          $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
 
3482
          $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
 
3483
          $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
4307
3484
 
4308
3485
          # Clean up the generated files.
4309
3486
          $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
4328
3505
        finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
4329
3506
      fi
4330
3507
 
4331
 
      if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
 
3508
      if test $need_relink = no || test "$build_libtool_libs" != yes; then
4332
3509
        # Replace the output file specification.
4333
3510
        compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
4334
3511
        link_command="$compile_command$compile_rpath"
4473
3650
        # win32 will think the script is a binary if it has
4474
3651
        # a .exe suffix, so we strip it off here.
4475
3652
        case $output in
4476
 
          *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
 
3653
          *.exe) output=`echo $output|${SED} 's,.exe$,,'` ;;
4477
3654
        esac
4478
3655
        # test for cygwin because mv fails w/o .exe extensions
4479
3656
        case $host in
4480
 
          *cygwin*)
4481
 
            exeext=.exe
4482
 
            outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
 
3657
          *cygwin*) exeext=.exe ;;
4483
3658
          *) exeext= ;;
4484
3659
        esac
4485
 
        case $host in
4486
 
          *cygwin* | *mingw* )
4487
 
            cwrappersource=`$echo ${objdir}/lt-${output}.c`
4488
 
            cwrapper=`$echo ${output}.exe`
4489
 
            $rm $cwrappersource $cwrapper
4490
 
            trap "$rm $cwrappersource $cwrapper; exit 1" 1 2 15
4491
 
 
4492
 
            cat > $cwrappersource <<EOF
4493
 
 
4494
 
/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
4495
 
   Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4496
 
 
4497
 
   The $output program cannot be directly executed until all the libtool
4498
 
   libraries that it depends on are installed.
4499
 
   
4500
 
   This wrapper executable should never be moved out of the build directory.
4501
 
   If it is, it will not operate correctly.
4502
 
 
4503
 
   Currently, it simply execs the wrapper *script* "/bin/sh $output",
4504
 
   but could eventually absorb all of the scripts functionality and
4505
 
   exec $objdir/$outputname directly.
4506
 
*/
4507
 
EOF
4508
 
            cat >> $cwrappersource<<"EOF"
4509
 
#include <stdio.h>
4510
 
#include <stdlib.h>
4511
 
#include <unistd.h>
4512
 
#include <malloc.h>
4513
 
#include <stdarg.h>
4514
 
#include <assert.h>
4515
 
 
4516
 
#if defined(PATH_MAX)
4517
 
# define LT_PATHMAX PATH_MAX
4518
 
#elif defined(MAXPATHLEN)
4519
 
# define LT_PATHMAX MAXPATHLEN
4520
 
#else
4521
 
# define LT_PATHMAX 1024
4522
 
#endif
4523
 
 
4524
 
#ifndef DIR_SEPARATOR
4525
 
#define DIR_SEPARATOR '/'
4526
 
#endif
4527
 
 
4528
 
#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4529
 
  defined (__OS2__)
4530
 
#define HAVE_DOS_BASED_FILE_SYSTEM
4531
 
#ifndef DIR_SEPARATOR_2 
4532
 
#define DIR_SEPARATOR_2 '\\'
4533
 
#endif
4534
 
#endif
4535
 
 
4536
 
#ifndef DIR_SEPARATOR_2
4537
 
# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
4538
 
#else /* DIR_SEPARATOR_2 */
4539
 
# define IS_DIR_SEPARATOR(ch) \
4540
 
        (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
4541
 
#endif /* DIR_SEPARATOR_2 */
4542
 
 
4543
 
#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
4544
 
#define XFREE(stale) do { \
4545
 
  if (stale) { free ((void *) stale); stale = 0; } \
4546
 
} while (0)
4547
 
 
4548
 
const char *program_name = NULL;
4549
 
 
4550
 
void * xmalloc (size_t num);
4551
 
char * xstrdup (const char *string);
4552
 
char * basename (const char *name);
4553
 
char * fnqualify(const char *path);
4554
 
char * strendzap(char *str, const char *pat);
4555
 
void lt_fatal (const char *message, ...);
4556
 
 
4557
 
int
4558
 
main (int argc, char *argv[])
4559
 
{
4560
 
  char **newargz;
4561
 
  int i;
4562
 
  
4563
 
  program_name = (char *) xstrdup ((char *) basename (argv[0]));
4564
 
  newargz = XMALLOC(char *, argc+2);
4565
 
EOF
4566
 
 
4567
 
            cat >> $cwrappersource <<EOF
4568
 
  newargz[0] = "$SHELL";
4569
 
EOF
4570
 
 
4571
 
            cat >> $cwrappersource <<"EOF"
4572
 
  newargz[1] = fnqualify(argv[0]);
4573
 
  /* we know the script has the same name, without the .exe */
4574
 
  /* so make sure newargz[1] doesn't end in .exe */
4575
 
  strendzap(newargz[1],".exe"); 
4576
 
  for (i = 1; i < argc; i++)
4577
 
    newargz[i+1] = xstrdup(argv[i]);
4578
 
  newargz[argc+1] = NULL;
4579
 
EOF
4580
 
 
4581
 
            cat >> $cwrappersource <<EOF
4582
 
  execv("$SHELL",newargz);
4583
 
EOF
4584
 
 
4585
 
            cat >> $cwrappersource <<"EOF"
4586
 
}
4587
 
 
4588
 
void *
4589
 
xmalloc (size_t num)
4590
 
{
4591
 
  void * p = (void *) malloc (num);
4592
 
  if (!p)
4593
 
    lt_fatal ("Memory exhausted");
4594
 
 
4595
 
  return p;
4596
 
}
4597
 
 
4598
 
char * 
4599
 
xstrdup (const char *string)
4600
 
{
4601
 
  return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
4602
 
;
4603
 
}
4604
 
 
4605
 
char *
4606
 
basename (const char *name)
4607
 
{
4608
 
  const char *base;
4609
 
 
4610
 
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4611
 
  /* Skip over the disk name in MSDOS pathnames. */
4612
 
  if (isalpha (name[0]) && name[1] == ':') 
4613
 
    name += 2;
4614
 
#endif
4615
 
 
4616
 
  for (base = name; *name; name++)
4617
 
    if (IS_DIR_SEPARATOR (*name))
4618
 
      base = name + 1;
4619
 
  return (char *) base;
4620
 
}
4621
 
 
4622
 
char * 
4623
 
fnqualify(const char *path)
4624
 
{
4625
 
  size_t size;
4626
 
  char *p;
4627
 
  char tmp[LT_PATHMAX + 1];
4628
 
 
4629
 
  assert(path != NULL);
4630
 
 
4631
 
  /* Is it qualified already? */
4632
 
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4633
 
  if (isalpha (path[0]) && path[1] == ':')
4634
 
    return xstrdup (path);
4635
 
#endif
4636
 
  if (IS_DIR_SEPARATOR (path[0]))
4637
 
    return xstrdup (path);
4638
 
 
4639
 
  /* prepend the current directory */
4640
 
  /* doesn't handle '~' */
4641
 
  if (getcwd (tmp, LT_PATHMAX) == NULL)
4642
 
    lt_fatal ("getcwd failed");
4643
 
  size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */
4644
 
  p = XMALLOC(char, size);
4645
 
  sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path);
4646
 
  return p;
4647
 
}
4648
 
 
4649
 
char *
4650
 
strendzap(char *str, const char *pat) 
4651
 
{
4652
 
  size_t len, patlen;
4653
 
 
4654
 
  assert(str != NULL);
4655
 
  assert(pat != NULL);
4656
 
 
4657
 
  len = strlen(str);
4658
 
  patlen = strlen(pat);
4659
 
 
4660
 
  if (patlen <= len)
4661
 
  {
4662
 
    str += len - patlen;
4663
 
    if (strcmp(str, pat) == 0)
4664
 
      *str = '\0';
4665
 
  }
4666
 
  return str;
4667
 
}
4668
 
 
4669
 
static void
4670
 
lt_error_core (int exit_status, const char * mode, 
4671
 
          const char * message, va_list ap)
4672
 
{
4673
 
  fprintf (stderr, "%s: %s: ", program_name, mode);
4674
 
  vfprintf (stderr, message, ap);
4675
 
  fprintf (stderr, ".\n");
4676
 
 
4677
 
  if (exit_status >= 0)
4678
 
    exit (exit_status);
4679
 
}
4680
 
 
4681
 
void
4682
 
lt_fatal (const char *message, ...)
4683
 
{
4684
 
  va_list ap;
4685
 
  va_start (ap, message);
4686
 
  lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
4687
 
  va_end (ap);
4688
 
}
4689
 
EOF
4690
 
          # we should really use a build-platform specific compiler
4691
 
          # here, but OTOH, the wrappers (shell script and this C one)
4692
 
          # are only useful if you want to execute the "real" binary.
4693
 
          # Since the "real" binary is built for $host, then this
4694
 
          # wrapper might as well be built for $host, too.
4695
 
          $run $LTCC -s -o $cwrapper $cwrappersource
4696
 
          ;;
4697
 
        esac
4698
3660
        $rm $output
4699
3661
        trap "$rm $output; exit 1" 1 2 15
4700
3662
 
4712
3674
 
4713
3675
# Sed substitution that helps us do robust quoting.  It backslashifies
4714
3676
# metacharacters that are still active within double-quoted strings.
4715
 
Xsed='${SED} -e 1s/^X//'
 
3677
Xsed="${SED}"' -e 1s/^X//'
4716
3678
sed_quote_subst='$sed_quote_subst'
4717
3679
 
4718
3680
# The HP-UX ksh and POSIX shell print the target directory to stdout
4772
3734
"
4773
3735
 
4774
3736
        if test "$fast_install" = yes; then
4775
 
          $echo >> $output "\
 
3737
          echo >> $output "\
4776
3738
  program=lt-'$outputname'$exeext
4777
3739
  progdir=\"\$thisdir/$objdir\"
4778
3740
 
4788
3750
      $rm \"\$progdir/\$file\"
4789
3751
    fi"
4790
3752
 
4791
 
          $echo >> $output "\
 
3753
          echo >> $output "\
4792
3754
 
4793
3755
    # relink executable if necessary
4794
3756
    if test -n \"\$relink_command\"; then
4806
3768
    $rm \"\$progdir/\$file\"
4807
3769
  fi"
4808
3770
        else
4809
 
          $echo >> $output "\
 
3771
          echo >> $output "\
4810
3772
  program='$outputname'
4811
3773
  progdir=\"\$thisdir/$objdir\"
4812
3774
"
4813
3775
        fi
4814
3776
 
4815
 
        $echo >> $output "\
 
3777
        echo >> $output "\
4816
3778
 
4817
3779
  if test -f \"\$progdir/\$program\"; then"
4818
3780
 
4823
3785
    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
4824
3786
 
4825
3787
    # Some systems cannot cope with colon-terminated $shlibpath_var
4826
 
    # The second colon is a workaround for a bug in BeOS R4 sed
 
3788
    # The second colon is a workaround for a bug in BeOS R4 ${SED}
4827
3789
    $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
4828
3790
 
4829
3791
    export $shlibpath_var
4843
3805
      # Run the actual program with our arguments.
4844
3806
"
4845
3807
        case $host in
 
3808
        # win32 systems need to use the prog path for dll
 
3809
        # lookup to work
 
3810
        *-*-cygwin* | *-*-pw32*)
 
3811
          $echo >> $output "\
 
3812
      exec \$progdir/\$program \${1+\"\$@\"}
 
3813
"
 
3814
          ;;
 
3815
 
4846
3816
        # Backslashes separate directories on plain windows
4847
3817
        *-*-mingw | *-*-os2*)
4848
3818
          $echo >> $output "\
4852
3822
 
4853
3823
        *)
4854
3824
          $echo >> $output "\
4855
 
      exec \$progdir/\$program \${1+\"\$@\"}
 
3825
      # Export the path to the program.
 
3826
      PATH=\"\$progdir:\$PATH\"
 
3827
      export PATH
 
3828
 
 
3829
      exec \$program \${1+\"\$@\"}
4856
3830
"
4857
3831
          ;;
4858
3832
        esac
4864
3838
    # The program doesn't exist.
4865
3839
    \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
4866
3840
    \$echo \"This script is just a wrapper for \$program.\" 1>&2
4867
 
    $echo \"See the $PACKAGE documentation for more information.\" 1>&2
 
3841
    echo \"See the $PACKAGE documentation for more information.\" 1>&2
4868
3842
    exit 1
4869
3843
  fi
4870
3844
fi\
4887
3861
          oldobjs="$libobjs_save"
4888
3862
          build_libtool_libs=no
4889
3863
        else
4890
 
          oldobjs="$old_deplibs $non_pic_objects"
 
3864
          oldobjs="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
4891
3865
        fi
4892
3866
        addlibs="$old_convenience"
4893
3867
      fi
4896
3870
        gentop="$output_objdir/${outputname}x"
4897
3871
        $show "${rm}r $gentop"
4898
3872
        $run ${rm}r "$gentop"
4899
 
        $show "$mkdir $gentop"
4900
 
        $run $mkdir "$gentop"
 
3873
        $show "mkdir $gentop"
 
3874
        $run mkdir "$gentop"
4901
3875
        status=$?
4902
 
        if test "$status" -ne 0 && test ! -d "$gentop"; then
 
3876
        if test $status -ne 0 && test ! -d "$gentop"; then
4903
3877
          exit $status
4904
3878
        fi
4905
3879
        generated="$generated $gentop"
4916
3890
 
4917
3891
          $show "${rm}r $xdir"
4918
3892
          $run ${rm}r "$xdir"
4919
 
          $show "$mkdir $xdir"
4920
 
          $run $mkdir "$xdir"
 
3893
          $show "mkdir $xdir"
 
3894
          $run mkdir "$xdir"
4921
3895
          status=$?
4922
 
          if test "$status" -ne 0 && test ! -d "$xdir"; then
 
3896
          if test $status -ne 0 && test ! -d "$xdir"; then
4923
3897
            exit $status
4924
3898
          fi
4925
 
          # We will extract separately just the conflicting names and we will no
4926
 
          # longer touch any unique names. It is faster to leave these extract
4927
 
          # automatically by $AR in one run.
4928
3899
          $show "(cd $xdir && $AR x $xabs)"
4929
3900
          $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
4930
 
          if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
4931
 
            :
4932
 
          else
4933
 
            $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
4934
 
            $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
4935
 
            $AR t "$xabs" | sort | uniq -cd | while read -r count name
4936
 
            do
4937
 
              i=1
4938
 
              while test "$i" -le "$count"
4939
 
              do
4940
 
               # Put our $i before any first dot (extension)
4941
 
               # Never overwrite any file
4942
 
               name_to="$name"
4943
 
               while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
4944
 
               do
4945
 
                 name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
4946
 
               done
4947
 
               $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
4948
 
               $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
4949
 
               i=`expr $i + 1`
4950
 
              done
4951
 
            done
4952
 
          fi
4953
3901
 
4954
3902
          oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
4955
3903
        done
4959
3907
      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
4960
3908
        eval cmds=\"$old_archive_from_new_cmds\"
4961
3909
      else
 
3910
        # Ensure that we have .o objects in place in case we decided
 
3911
        # not to build a shared library, and have fallen back to building
 
3912
        # static libs even though --disable-static was passed!
 
3913
        for oldobj in $oldobjs; do
 
3914
          if test ! -f $oldobj; then
 
3915
            xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
 
3916
            if test "X$xdir" = "X$oldobj"; then
 
3917
              xdir="."
 
3918
            else
 
3919
              xdir="$xdir"
 
3920
            fi
 
3921
            baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
 
3922
            obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
 
3923
            $show "(cd $xdir && ${LN_S} $obj $baseobj)"
 
3924
            $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
 
3925
          fi
 
3926
        done
 
3927
 
4962
3928
        eval cmds=\"$old_archive_cmds\"
4963
 
 
4964
 
        if len=`expr "X$cmds" : ".*"` &&
4965
 
             test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
4966
 
          :
4967
 
        else
4968
 
          # the command line is too long to link in one step, link in parts
4969
 
          $echo "using piecewise archive linking..."
4970
 
          save_RANLIB=$RANLIB
4971
 
          RANLIB=:
4972
 
          objlist=
4973
 
          concat_cmds=
4974
 
          save_oldobjs=$oldobjs
4975
 
          # GNU ar 2.10+ was changed to match POSIX; thus no paths are
4976
 
          # encoded into archives.  This makes 'ar r' malfunction in
4977
 
          # this piecewise linking case whenever conflicting object
4978
 
          # names appear in distinct ar calls; check, warn and compensate.
4979
 
            if (for obj in $save_oldobjs
4980
 
            do
4981
 
              $echo "X$obj" | $Xsed -e 's%^.*/%%'
4982
 
            done | sort | sort -uc >/dev/null 2>&1); then
4983
 
            :
4984
 
          else
4985
 
            $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2
4986
 
            $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2
4987
 
            AR_FLAGS=cq
4988
 
          fi
4989
 
          # Is there a better way of finding the last object in the list?
4990
 
          for obj in $save_oldobjs
4991
 
          do
4992
 
            last_oldobj=$obj
4993
 
          done  
4994
 
          for obj in $save_oldobjs
4995
 
          do
4996
 
            oldobjs="$objlist $obj"
4997
 
            objlist="$objlist $obj"
4998
 
            eval test_cmds=\"$old_archive_cmds\"
4999
 
            if len=`expr "X$test_cmds" : ".*"` &&
5000
 
               test "$len" -le "$max_cmd_len"; then
5001
 
              :
5002
 
            else
5003
 
              # the above command should be used before it gets too long
5004
 
              oldobjs=$objlist
5005
 
              if test "$obj" = "$last_oldobj" ; then
5006
 
                RANLIB=$save_RANLIB
5007
 
              fi  
5008
 
              test -z "$concat_cmds" || concat_cmds=$concat_cmds~
5009
 
              eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
5010
 
              objlist=
5011
 
            fi
5012
 
          done
5013
 
          RANLIB=$save_RANLIB
5014
 
          oldobjs=$objlist
5015
 
          if test "X$oldobjs" = "X" ; then
5016
 
            eval cmds=\"\$concat_cmds\"
5017
 
          else
5018
 
            eval cmds=\"\$concat_cmds~$old_archive_cmds\"
5019
 
          fi
5020
 
        fi
5021
3929
      fi
5022
3930
      save_ifs="$IFS"; IFS='~'
5023
3931
      for cmd in $cmds; do
5107
4015
          # place dlname in correct position for cygwin
5108
4016
          tdlname=$dlname
5109
4017
          case $host,$output,$installed,$module,$dlname in
5110
 
            *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
 
4018
            *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
5111
4019
          esac
5112
4020
          $echo > $output "\
5113
4021
# $outputname - a libtool library file
5136
4044
# Is this an already installed library?
5137
4045
installed=$installed
5138
4046
 
5139
 
# Should we warn about portability when linking against -modules?
5140
 
shouldnotlink=$module
5141
 
 
5142
4047
# Files to dlopen/dlpreopen
5143
4048
dlopen='$dlfiles'
5144
4049
dlpreopen='$dlprefiles'
5145
4050
 
5146
4051
# Directory that this library needs to be installed in:
5147
4052
libdir='$install_libdir'"
5148
 
          if test "$installed" = no && test "$need_relink" = yes; then
 
4053
          if test "$installed" = no && test $need_relink = yes; then
5149
4054
            $echo >> $output "\
5150
4055
relink_command=\"$relink_command\""
5151
4056
          fi
5281
4186
 
5282
4187
      # Not a directory, so check to see that there is only one file specified.
5283
4188
      set dummy $files
5284
 
      if test "$#" -gt 2; then
 
4189
      if test $# -gt 2; then
5285
4190
        $echo "$modename: \`$dest' is not a directory" 1>&2
5286
4191
        $echo "$help" 1>&2
5287
4192
        exit 1
5321
4226
 
5322
4227
      *.la)
5323
4228
        # Check to see that this really is a libtool archive.
5324
 
        if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
 
4229
        if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
5325
4230
        else
5326
4231
          $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
5327
4232
          $echo "$help" 1>&2
5357
4262
 
5358
4263
        if test -n "$relink_command"; then
5359
4264
          # Determine the prefix the user has applied to our future dir.
5360
 
          inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
 
4265
          inst_prefix_dir=`$echo "$destdir" | sed "s%$libdir\$%%"`
5361
4266
 
5362
4267
          # Don't allow the user to place us outside of our expected
5363
4268
          # location b/c this prevents finding dependent libraries that
5364
4269
          # are installed to the same prefix.
5365
 
          # At present, this check doesn't affect windows .dll's that
5366
 
          # are installed into $libdir/../bin (currently, that works fine)
5367
 
          # but it's something to keep an eye on.
5368
4270
          if test "$inst_prefix_dir" = "$destdir"; then
5369
4271
            $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
5370
4272
            exit 1
5372
4274
 
5373
4275
          if test -n "$inst_prefix_dir"; then
5374
4276
            # Stick the inst_prefix_dir data into the link command.
5375
 
            relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
 
4277
            relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
5376
4278
          else
5377
 
            relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
 
4279
            relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%%"`
5378
4280
          fi
5379
4281
 
5380
4282
          $echo "$modename: warning: relinking \`$file'" 1>&2
5404
4306
            $run eval "$striplib $destdir/$realname" || exit $?
5405
4307
          fi
5406
4308
 
5407
 
          if test "$#" -gt 0; then
 
4309
          if test $# -gt 0; then
5408
4310
            # Delete the old symlinks, and create new ones.
5409
4311
            for linkname
5410
4312
            do
5490
4392
          destfile="$destdir/$destfile"
5491
4393
        fi
5492
4394
 
5493
 
        # If the file is missing, and there is a .exe on the end, strip it
5494
 
        # because it is most likely a libtool script we actually want to
5495
 
        # install
5496
 
        stripped_ext=""
5497
 
        case $file in
5498
 
          *.exe)
5499
 
            if test ! -f "$file"; then
5500
 
              file=`$echo $file|${SED} 's,.exe$,,'`
5501
 
              stripped_ext=".exe"
5502
 
            fi
5503
 
            ;;
5504
 
        esac
5505
 
 
5506
4395
        # Do a test to see if this is really a libtool program.
5507
4396
        case $host in
5508
4397
        *cygwin*|*mingw*)
5509
 
            wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
 
4398
            wrapper=`echo $file | ${SED} -e 's,.exe$,,'`
5510
4399
            ;;
5511
4400
        *)
5512
4401
            wrapper=$file
5513
4402
            ;;
5514
4403
        esac
5515
 
        if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
 
4404
        if (${SED} -e '4q' $wrapper | egrep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
5516
4405
          notinst_deplibs=
5517
4406
          relink_command=
5518
4407
 
5519
 
          # To insure that "foo" is sourced, and not "foo.exe",
5520
 
          # finese the cygwin/MSYS system by explicitly sourcing "foo."
5521
 
          # which disallows the automatic-append-.exe behavior.
5522
 
          case $build in
5523
 
          *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
5524
 
          *) wrapperdot=${wrapper} ;;
5525
 
          esac
5526
4408
          # If there is no directory component, then add one.
5527
4409
          case $file in
5528
 
          */* | *\\*) . ${wrapperdot} ;;
5529
 
          *) . ./${wrapperdot} ;;
 
4410
          */* | *\\*) . $wrapper ;;
 
4411
          *) . ./$wrapper ;;
5530
4412
          esac
5531
4413
 
5532
4414
          # Check the variables that should have been set.
5554
4436
          done
5555
4437
 
5556
4438
          relink_command=
5557
 
          # To insure that "foo" is sourced, and not "foo.exe",
5558
 
          # finese the cygwin/MSYS system by explicitly sourcing "foo."
5559
 
          # which disallows the automatic-append-.exe behavior.
5560
 
          case $build in
5561
 
          *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
5562
 
          *) wrapperdot=${wrapper} ;;
5563
 
          esac
5564
4439
          # If there is no directory component, then add one.
5565
4440
          case $file in
5566
 
          */* | *\\*) . ${wrapperdot} ;;
5567
 
          *) . ./${wrapperdot} ;;
 
4441
          */* | *\\*) . $wrapper ;;
 
4442
          *) . ./$wrapper ;;
5568
4443
          esac
5569
4444
 
5570
4445
          outputname=
5573
4448
              tmpdir="/tmp"
5574
4449
              test -n "$TMPDIR" && tmpdir="$TMPDIR"
5575
4450
              tmpdir_mktemp=`mktemp -d $tmpdir/libtool-XXXXXX 2> /dev/null`
5576
 
              if test "$?" = 0 ; then
 
4451
              if test $? = 0 ; then
5577
4452
                tmpdir="$tmpdir_mktemp"
5578
4453
                unset tmpdir_mktemp
5579
4454
               else
5584
4459
                $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
5585
4460
                continue
5586
4461
              fi
5587
 
              file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
 
4462
              file=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5588
4463
              outputname="$tmpdir/$file"
5589
4464
              # Replace the output file specification.
5590
4465
              relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
5602
4477
            fi
5603
4478
          else
5604
4479
            # Install the binary that we compiled earlier.
5605
 
            file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
 
4480
            file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
5606
4481
          fi
5607
4482
        fi
5608
4483
 
5609
4484
        # remove .exe since cygwin /usr/bin/install will append another
5610
4485
        # one anyways
5611
4486
        case $install_prog,$host in
5612
 
        */usr/bin/install*,*cygwin*)
 
4487
        /usr/bin/install*,*cygwin*)
5613
4488
          case $file:$destfile in
5614
4489
          *.exe:*.exe)
5615
4490
            # this is ok
5618
4493
            destfile=$destfile.exe
5619
4494
            ;;
5620
4495
          *:*.exe)
5621
 
            destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
 
4496
            destfile=`echo $destfile | ${SED} -e 's,.exe$,,'`
5622
4497
            ;;
5623
4498
          esac
5624
4499
          ;;
5703
4578
    fi
5704
4579
 
5705
4580
    # Exit here if they wanted silent mode.
5706
 
    test "$show" = : && exit 0
 
4581
    test "$show" = ":" && exit 0
5707
4582
 
5708
 
    $echo "----------------------------------------------------------------------"
5709
 
    $echo "Libraries have been installed in:"
 
4583
    echo "----------------------------------------------------------------------"
 
4584
    echo "Libraries have been installed in:"
5710
4585
    for libdir in $libdirs; do
5711
 
      $echo "   $libdir"
 
4586
      echo "   $libdir"
5712
4587
    done
5713
 
    $echo
5714
 
    $echo "If you ever happen to want to link against installed libraries"
5715
 
    $echo "in a given directory, LIBDIR, you must either use libtool, and"
5716
 
    $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
5717
 
    $echo "flag during linking and do at least one of the following:"
 
4588
    echo
 
4589
    echo "If you ever happen to want to link against installed libraries"
 
4590
    echo "in a given directory, LIBDIR, you must either use libtool, and"
 
4591
    echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
 
4592
    echo "flag during linking and do at least one of the following:"
5718
4593
    if test -n "$shlibpath_var"; then
5719
 
      $echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
5720
 
      $echo "     during execution"
 
4594
      echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
 
4595
      echo "     during execution"
5721
4596
    fi
5722
4597
    if test -n "$runpath_var"; then
5723
 
      $echo "   - add LIBDIR to the \`$runpath_var' environment variable"
5724
 
      $echo "     during linking"
 
4598
      echo "   - add LIBDIR to the \`$runpath_var' environment variable"
 
4599
      echo "     during linking"
5725
4600
    fi
5726
4601
    if test -n "$hardcode_libdir_flag_spec"; then
5727
4602
      libdir=LIBDIR
5728
4603
      eval flag=\"$hardcode_libdir_flag_spec\"
5729
4604
 
5730
 
      $echo "   - use the \`$flag' linker flag"
 
4605
      echo "   - use the \`$flag' linker flag"
5731
4606
    fi
5732
4607
    if test -n "$admincmds"; then
5733
 
      $echo "   - have your system administrator run these commands:$admincmds"
 
4608
      echo "   - have your system administrator run these commands:$admincmds"
5734
4609
    fi
5735
4610
    if test -f /etc/ld.so.conf; then
5736
 
      $echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
 
4611
      echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
5737
4612
    fi
5738
 
    $echo
5739
 
    $echo "See any operating system documentation about shared libraries for"
5740
 
    $echo "more information, such as the ld(1) and ld.so(8) manual pages."
5741
 
    $echo "----------------------------------------------------------------------"
 
4613
    echo
 
4614
    echo "See any operating system documentation about shared libraries for"
 
4615
    echo "more information, such as the ld(1) and ld.so(8) manual pages."
 
4616
    echo "----------------------------------------------------------------------"
5742
4617
    exit 0
5743
4618
    ;;
5744
4619
 
5766
4641
      case $file in
5767
4642
      *.la)
5768
4643
        # Check to see that this really is a libtool archive.
5769
 
        if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
 
4644
        if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
5770
4645
        else
5771
4646
          $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5772
4647
          $echo "$help" 1>&2
5837
4712
      -*) ;;
5838
4713
      *)
5839
4714
        # Do a test to see if this is really a libtool program.
5840
 
        if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
4715
        if (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
5841
4716
          # If there is no directory component, then add one.
5842
4717
          case $file in
5843
4718
          */* | *\\*) . $file ;;
5860
4735
        eval "export $shlibpath_var"
5861
4736
      fi
5862
4737
 
5863
 
      # Restore saved environment variables
 
4738
      # Restore saved enviroment variables
5864
4739
      if test "${save_LC_ALL+set}" = set; then
5865
4740
        LC_ALL="$save_LC_ALL"; export LC_ALL
5866
4741
      fi
5910
4785
 
5911
4786
    rmdirs=
5912
4787
 
5913
 
    origobjdir="$objdir"
5914
4788
    for file in $files; do
5915
4789
      dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
5916
4790
      if test "X$dir" = "X$file"; then
5917
4791
        dir=.
5918
 
        objdir="$origobjdir"
 
4792
        objdir="$objdir"
5919
4793
      else
5920
 
        objdir="$dir/$origobjdir"
 
4794
        objdir="$dir/$objdir"
5921
4795
      fi
5922
4796
      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5923
 
      test "$mode" = uninstall && objdir="$dir"
 
4797
      test $mode = uninstall && objdir="$dir"
5924
4798
 
5925
4799
      # Remember objdir for removal later, being careful to avoid duplicates
5926
 
      if test "$mode" = clean; then
 
4800
      if test $mode = clean; then
5927
4801
        case " $rmdirs " in
5928
4802
          *" $objdir "*) ;;
5929
4803
          *) rmdirs="$rmdirs $objdir" ;;
5947
4821
      case $name in
5948
4822
      *.la)
5949
4823
        # Possibly a libtool archive, so verify it.
5950
 
        if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
4824
        if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
5951
4825
          . $dir/$name
5952
4826
 
5953
4827
          # Delete the libtool libraries and symlinks.
5955
4829
            rmfiles="$rmfiles $objdir/$n"
5956
4830
          done
5957
4831
          test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
5958
 
          test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
 
4832
          test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
5959
4833
 
5960
 
          if test "$mode" = uninstall; then
 
4834
          if test $mode = uninstall; then
5961
4835
            if test -n "$library_names"; then
5962
4836
              # Do each command in the postuninstall commands.
5963
4837
              eval cmds=\"$postuninstall_cmds\"
5966
4840
                IFS="$save_ifs"
5967
4841
                $show "$cmd"
5968
4842
                $run eval "$cmd"
5969
 
                if test "$?" -ne 0 && test "$rmforce" != yes; then
 
4843
                if test $? != 0 && test "$rmforce" != yes; then
5970
4844
                  exit_status=1
5971
4845
                fi
5972
4846
              done
5981
4855
                IFS="$save_ifs"
5982
4856
                $show "$cmd"
5983
4857
                $run eval "$cmd"
5984
 
                if test "$?" -ne 0 && test "$rmforce" != yes; then
 
4858
                if test $? != 0 && test "$rmforce" != yes; then
5985
4859
                  exit_status=1
5986
4860
                fi
5987
4861
              done
5993
4867
        ;;
5994
4868
 
5995
4869
      *.lo)
5996
 
        # Possibly a libtool object, so verify it.
5997
 
        if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
5998
 
 
5999
 
          # Read the .lo file
6000
 
          . $dir/$name
6001
 
 
6002
 
          # Add PIC object to the list of files to remove.
6003
 
          if test -n "$pic_object" \
6004
 
             && test "$pic_object" != none; then
6005
 
            rmfiles="$rmfiles $dir/$pic_object"
6006
 
          fi
6007
 
 
6008
 
          # Add non-PIC object to the list of files to remove.
6009
 
          if test -n "$non_pic_object" \
6010
 
             && test "$non_pic_object" != none; then
6011
 
            rmfiles="$rmfiles $dir/$non_pic_object"
6012
 
          fi
 
4870
        if test "$build_old_libs" = yes; then
 
4871
          oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
 
4872
          rmfiles="$rmfiles $dir/$oldobj"
6013
4873
        fi
6014
4874
        ;;
6015
4875
 
6016
4876
      *)
6017
 
        if test "$mode" = clean ; then
6018
 
          noexename=$name
6019
 
          case $file in
6020
 
          *.exe) 
6021
 
            file=`$echo $file|${SED} 's,.exe$,,'`
6022
 
            noexename=`$echo $name|${SED} 's,.exe$,,'`
6023
 
            # $file with .exe has already been added to rmfiles,
6024
 
            # add $file without .exe
6025
 
            rmfiles="$rmfiles $file"
6026
 
            ;;
6027
 
          esac
6028
 
          # Do a test to see if this is a libtool program.
6029
 
          if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6030
 
            relink_command=
6031
 
            . $dir/$noexename
 
4877
        # Do a test to see if this is a libtool program.
 
4878
        if test $mode = clean &&
 
4879
           (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
4880
          relink_command=
 
4881
          . $dir/$file
6032
4882
 
6033
 
            # note $name still contains .exe if it was in $file originally
6034
 
            # as does the version of $file that was added into $rmfiles
6035
 
            rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
6036
 
            if test "$fast_install" = yes && test -n "$relink_command"; then
6037
 
              rmfiles="$rmfiles $objdir/lt-$name"
6038
 
            fi
6039
 
            if test "X$noexename" != "X$name" ; then
6040
 
              rmfiles="$rmfiles $objdir/lt-${noexename}.c"
6041
 
            fi
 
4883
          rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
 
4884
          if test "$fast_install" = yes && test -n "$relink_command"; then
 
4885
            rmfiles="$rmfiles $objdir/lt-$name"
6042
4886
          fi
6043
4887
        fi
6044
4888
        ;;
6046
4890
      $show "$rm $rmfiles"
6047
4891
      $run $rm $rmfiles || exit_status=1
6048
4892
    done
6049
 
    objdir="$origobjdir"
6050
4893
 
6051
4894
    # Try to remove the ${objdir}s in the directories where we deleted files
6052
4895
    for dir in $rmdirs; do
6094
4937
    --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
6095
4938
    --quiet           same as \`--silent'
6096
4939
    --silent          don't print informational messages
6097
 
    --tag=TAG         use configuration variables from tag TAG
6098
4940
    --version         print version information
6099
4941
 
6100
4942
MODE must be one of the following:
6108
4950
      uninstall       remove libraries from an installed directory
6109
4951
 
6110
4952
MODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
6111
 
a more detailed description of MODE.
6112
 
 
6113
 
Report bugs to <bug-libtool@gnu.org>."
 
4953
a more detailed description of MODE."
6114
4954
  exit 0
6115
4955
  ;;
6116
4956
 
6222
5062
  -no-install       link a not-installable executable
6223
5063
  -no-undefined     declare that a library does not refer to external symbols
6224
5064
  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
6225
 
  -objectlist FILE  Use a list of object files found in FILE to specify objects
6226
5065
  -release RELEASE  specify package release information
6227
5066
  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
6228
5067
  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
6268
5107
  ;;
6269
5108
esac
6270
5109
 
6271
 
$echo
 
5110
echo
6272
5111
$echo "Try \`$modename --help' for more information about other modes."
6273
5112
 
6274
5113
exit 0
6275
5114
 
6276
 
# The TAGs below are defined such that we never get into a situation
6277
 
# in which we disable both kinds of libraries.  Given conflicting
6278
 
# choices, we go for a static library, that is the most portable,
6279
 
# since we can't tell whether shared libraries were disabled because
6280
 
# the user asked for that or because the platform doesn't support
6281
 
# them.  This is particularly important on AIX, because we don't
6282
 
# support having both static and shared libraries enabled at the same
6283
 
# time on that platform, so we default to a shared-only configuration.
6284
 
# If a disable-shared tag is given, we'll fallback to a static-only
6285
 
# configuration.  But we'll never go from static-only to shared-only.
6286
 
 
6287
 
# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
6288
 
build_libtool_libs=no
6289
 
build_old_libs=yes
6290
 
# ### END LIBTOOL TAG CONFIG: disable-shared
6291
 
 
6292
 
# ### BEGIN LIBTOOL TAG CONFIG: disable-static
6293
 
build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac`
6294
 
# ### END LIBTOOL TAG CONFIG: disable-static
6295
 
 
6296
5115
# Local Variables:
6297
5116
# mode:shell-script
6298
5117
# sh-indentation:2