~ubuntu-branches/ubuntu/hoary/popt/hoary

« back to all changes in this revision

Viewing changes to ltmain.sh

  • Committer: Bazaar Package Importer
  • Author(s): Paul Martin
  • Date: 2004-08-29 16:36:43 UTC
  • mfrom: (2.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20040829163643-rirf1ycw80g3000b
Tags: 1.7-5
* The "I hate automake" release.
* Make sure configure.in and configure.ac are the same, including
  timestamp. This allows a compile if you have two different versions of
  automake installed. (Closes: #245819)
* Standards-Version: 3.6.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# ltmain.sh - Provide generalized library-building support services.
2
 
# NOTE: Changing this file will not affect anything until you rerun ltconfig.
 
2
# NOTE: Changing this file will not affect anything until you rerun configure.
3
3
#
4
 
# Copyright (C) 1996-1999 Free Software Foundation, Inc.
 
4
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
 
5
# Free Software Foundation, Inc.
5
6
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
6
7
#
7
8
# This program is free software; you can redistribute it and/or modify
48
49
fi
49
50
 
50
51
# The name of this program.
51
 
progname=`$echo "$0" | sed 's%^.*/%%'`
 
52
progname=`$echo "$0" | ${SED} 's%^.*/%%'`
52
53
modename="$progname"
53
54
 
54
55
# Constants.
55
56
PROGRAM=ltmain.sh
56
57
PACKAGE=libtool
57
 
VERSION=1.3.5
58
 
TIMESTAMP=" (1.385.2.206 2000/05/27 11:12:27)"
 
58
VERSION=1.4.3
 
59
TIMESTAMP=" (1.922.2.111 2002/10/23 02:54:36)"
59
60
 
60
61
default_mode=
61
62
help="Try \`$progname --help' for more information."
66
67
 
67
68
# Sed substitution that helps us do robust quoting.  It backslashifies
68
69
# metacharacters that are still active within double-quoted strings.
69
 
Xsed='sed -e 1s/^X//'
 
70
Xsed="${SED}"' -e 1s/^X//'
70
71
sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
71
 
SP2NL='tr \040 \012'
72
 
NL2SP='tr \015\012 \040\040'
 
72
# test EBCDIC or ASCII                                                         
 
73
case `echo A|od -x` in                                                         
 
74
 *[Cc]1*) # EBCDIC based system                                                
 
75
  SP2NL="tr '\100' '\n'"                                                       
 
76
  NL2SP="tr '\r\n' '\100\100'"                                                 
 
77
  ;;                                                                           
 
78
 *) # Assume ASCII based system                                                
 
79
  SP2NL="tr '\040' '\012'"                                                     
 
80
  NL2SP="tr '\015\012' '\040\040'"                                             
 
81
  ;;                                                                           
 
82
esac                                                                           
73
83
 
74
84
# NLS nuisances.
75
85
# Only set LANG and LC_ALL to C if already set.
83
93
  save_LANG="$LANG"; LANG=C; export LANG
84
94
fi
85
95
 
86
 
if test "$LTCONFIG_VERSION" != "$VERSION"; then
87
 
  echo "$modename: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2
88
 
  echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
89
 
  exit 1
90
 
fi
 
96
# Make sure IFS has a sensible default
 
97
: ${IFS="       "}
91
98
 
92
99
if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
93
100
  echo "$modename: not configured to build any kind of library" 1>&2
113
120
  arg="$1"
114
121
  shift
115
122
 
116
 
  case "$arg" in
 
123
  case $arg in
117
124
  -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
118
125
  *) optarg= ;;
119
126
  esac
120
127
 
121
128
  # If the previous option needs an argument, assign it.
122
129
  if test -n "$prev"; then
123
 
    case "$prev" in
 
130
    case $prev in
124
131
    execute_dlfiles)
125
 
      eval "$prev=\"\$$prev \$arg\""
 
132
      execute_dlfiles="$execute_dlfiles $arg"
126
133
      ;;
127
134
    *)
128
135
      eval "$prev=\$arg"
135
142
  fi
136
143
 
137
144
  # Have we seen a non-optional argument yet?
138
 
  case "$arg" in
 
145
  case $arg in
139
146
  --help)
140
147
    show_help=yes
141
148
    ;;
146
153
    ;;
147
154
 
148
155
  --config)
149
 
    sed -e '1,/^### BEGIN LIBTOOL CONFIG/d' -e '/^### END LIBTOOL CONFIG/,$d' $0
 
156
    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
150
157
    exit 0
151
158
    ;;
152
159
 
179
186
  --mode) prevopt="--mode" prev=mode ;;
180
187
  --mode=*) mode="$optarg" ;;
181
188
 
 
189
  --preserve-dup-deps) duplicate_deps="yes" ;;
 
190
 
182
191
  --quiet | --silent)
183
192
    show=:
184
193
    ;;
207
216
  exit 1
208
217
fi
209
218
 
 
219
# If this variable is set in any of the actions, the command in it
 
220
# will be execed at the end.  This prevents here-documents from being
 
221
# left over by shells.
 
222
exec_cmd=
 
223
 
210
224
if test -z "$show_help"; then
211
225
 
212
226
  # Infer the operation mode.
213
227
  if test -z "$mode"; then
214
 
    case "$nonopt" in
215
 
    *cc | *++ | gcc* | *-gcc*)
 
228
    case $nonopt in
 
229
    *cc | *++ | gcc* | *-gcc* | g++* | xlc*)
216
230
      mode=link
217
231
      for arg
218
232
      do
219
 
        case "$arg" in
 
233
        case $arg in
220
234
        -c)
221
235
           mode=compile
222
236
           break
261
275
  help="Try \`$modename --help --mode=$mode' for more information."
262
276
 
263
277
  # These modes are in order of execution frequency so that they run quickly.
264
 
  case "$mode" in
 
278
  case $mode in
265
279
  # libtool compile mode
266
280
  compile)
267
281
    modename="$modename: compile"
268
282
    # Get the compilation command and the source file.
269
283
    base_compile=
 
284
    prev=
270
285
    lastarg=
271
286
    srcfile="$nonopt"
272
287
    suppress_output=
274
289
    user_target=no
275
290
    for arg
276
291
    do
 
292
      case $prev in
 
293
      "") ;;
 
294
      xcompiler)
 
295
        # Aesthetically quote the previous argument.
 
296
        prev=
 
297
        lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
 
298
 
 
299
        case $arg in
 
300
        # Double-quote args containing other shell metacharacters.
 
301
        # Many Bourne shells cannot handle close brackets correctly
 
302
        # in scan sets, so we specify it separately.
 
303
        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
 
304
          arg="\"$arg\""
 
305
          ;;
 
306
        esac
 
307
 
 
308
        # Add the previous argument to base_compile.
 
309
        if test -z "$base_compile"; then
 
310
          base_compile="$lastarg"
 
311
        else
 
312
          base_compile="$base_compile $lastarg"
 
313
        fi
 
314
        continue
 
315
        ;;
 
316
      esac
 
317
 
277
318
      # Accept any command-line options.
278
 
      case "$arg" in
 
319
      case $arg in
279
320
      -o)
280
321
        if test "$user_target" != "no"; then
281
322
          $echo "$modename: you cannot specify \`-o' more than once" 1>&2
288
329
        build_old_libs=yes
289
330
        continue
290
331
        ;;
 
332
 
 
333
      -prefer-pic)
 
334
        pic_mode=yes
 
335
        continue
 
336
        ;;
 
337
 
 
338
      -prefer-non-pic)
 
339
        pic_mode=no
 
340
        continue
 
341
        ;;
 
342
 
 
343
      -Xcompiler)
 
344
        prev=xcompiler
 
345
        continue
 
346
        ;;
 
347
 
 
348
      -Wc,*)
 
349
        args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
 
350
        lastarg=
 
351
        save_ifs="$IFS"; IFS=','
 
352
        for arg in $args; do
 
353
          IFS="$save_ifs"
 
354
 
 
355
          # Double-quote args containing other shell metacharacters.
 
356
          # Many Bourne shells cannot handle close brackets correctly
 
357
          # in scan sets, so we specify it separately.
 
358
          case $arg in
 
359
            *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
 
360
            arg="\"$arg\""
 
361
            ;;
 
362
          esac
 
363
          lastarg="$lastarg $arg"
 
364
        done
 
365
        IFS="$save_ifs"
 
366
        lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
 
367
 
 
368
        # Add the arguments to base_compile.
 
369
        if test -z "$base_compile"; then
 
370
          base_compile="$lastarg"
 
371
        else
 
372
          base_compile="$base_compile $lastarg"
 
373
        fi
 
374
        continue
 
375
        ;;
291
376
      esac
292
377
 
293
 
      case "$user_target" in
 
378
      case $user_target in
294
379
      next)
295
380
        # The next one is the -o target name
296
381
        user_target=yes
316
401
      lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
317
402
 
318
403
      # Double-quote args containing other shell metacharacters.
319
 
      # Many Bourne shells cannot handle close brackets correctly in scan
320
 
      # sets, so we specify it separately.
321
 
      case "$lastarg" in
322
 
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*)
 
404
      # Many Bourne shells cannot handle close brackets correctly
 
405
      # in scan sets, so we specify it separately.
 
406
      case $lastarg in
 
407
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
323
408
        lastarg="\"$lastarg\""
324
409
        ;;
325
410
      esac
332
417
      fi
333
418
    done
334
419
 
335
 
    case "$user_target" in
 
420
    case $user_target in
336
421
    set)
337
422
      ;;
338
423
    no)
348
433
    # Recognize several different file suffixes.
349
434
    # If the user specifies -o file.o, it is replaced with file.lo
350
435
    xform='[cCFSfmso]'
351
 
    case "$libobj" in
 
436
    case $libobj in
352
437
    *.ada) xform=ada ;;
353
438
    *.adb) xform=adb ;;
354
439
    *.ads) xform=ads ;;
363
448
 
364
449
    libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
365
450
 
366
 
    case "$libobj" in
 
451
    case $libobj in
367
452
    *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
368
453
    *)
369
454
      $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
387
472
    $run $rm $removelist
388
473
    trap "$run $rm $removelist; exit 1" 1 2 15
389
474
 
 
475
    # On Cygwin there's no "real" PIC flag so we must build both object types
 
476
    case $host_os in
 
477
    cygwin* | mingw* | pw32* | os2*)
 
478
      pic_mode=default
 
479
      ;;
 
480
    esac
 
481
    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
 
482
      # non-PIC code in shared libraries is not supported
 
483
      pic_mode=default
 
484
    fi
 
485
 
390
486
    # Calculate the filename of the output object if compiler does
391
487
    # not support -o with -c
392
488
    if test "$compiler_c_o" = no; then
393
 
      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\..*$%%'`.${objext}
 
489
      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
394
490
      lockfile="$output_obj.lock"
395
491
      removelist="$removelist $output_obj $lockfile"
396
492
      trap "$run $rm $removelist; exit 1" 1 2 15
402
498
    # Lock this critical section if it is needed
403
499
    # We use this script file to make the link, it avoids creating a new file
404
500
    if test "$need_locks" = yes; then
405
 
      until ln "$0" "$lockfile" 2>/dev/null; do
 
501
      until $run ln "$0" "$lockfile" 2>/dev/null; do
406
502
        $show "Waiting for $lockfile to be removed"
407
503
        sleep 2
408
504
      done
434
530
      # Without this assignment, base_compile gets emptied.
435
531
      fbsd_hideous_sh_bug=$base_compile
436
532
 
437
 
      # All platforms use -DPIC, to notify preprocessed assembler code.
438
 
      command="$base_compile $srcfile $pic_flag -DPIC"
 
533
      if test "$pic_mode" != no; then
 
534
        # All platforms use -DPIC, to notify preprocessed assembler code.
 
535
        command="$base_compile $srcfile $pic_flag -DPIC"
 
536
      else
 
537
        # Don't build PIC code
 
538
        command="$base_compile $srcfile"
 
539
      fi
439
540
      if test "$build_old_libs" = yes; then
440
541
        lo_libobj="$libobj"
441
542
        dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
506
607
      fi
507
608
 
508
609
      # If we have no pic_flag, then copy the object into place and finish.
509
 
      if test -z "$pic_flag" && test "$build_old_libs" = yes; then
 
610
      if (test -z "$pic_flag" || test "$pic_mode" != default) &&
 
611
         test "$build_old_libs" = yes; then
510
612
        # Rename the .lo from within objdir to obj
511
613
        if test -f $obj; then
512
614
          $show $rm $obj
532
634
        # Now arrange that obj and lo_libobj become the same file
533
635
        $show "(cd $xdir && $LN_S $baseobj $libobj)"
534
636
        if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then
 
637
          # Unlock the critical section if it was locked
 
638
          if test "$need_locks" != no; then
 
639
            $run $rm "$lockfile"
 
640
          fi
535
641
          exit 0
536
642
        else
537
643
          error=$?
546
652
 
547
653
    # Only build a position-dependent object if we build old libraries.
548
654
    if test "$build_old_libs" = yes; then
549
 
      command="$base_compile $srcfile"
 
655
      if test "$pic_mode" != yes; then
 
656
        # Don't build PIC code
 
657
        command="$base_compile $srcfile"
 
658
      else
 
659
        # All platforms use -DPIC, to notify preprocessed assembler code.
 
660
        command="$base_compile $srcfile $pic_flag -DPIC"
 
661
      fi
550
662
      if test "$compiler_c_o" = yes; then
551
663
        command="$command -o $obj"
552
664
        output_obj="$obj"
612
724
 
613
725
    # Unlock the critical section if it was locked
614
726
    if test "$need_locks" != no; then
615
 
      $rm "$lockfile"
 
727
      $run $rm "$lockfile"
616
728
    fi
617
729
 
618
730
    exit 0
619
731
    ;;
620
732
 
621
733
  # libtool link mode
622
 
  link)
 
734
  link | relink)
623
735
    modename="$modename: link"
624
 
    case "$host" in
625
 
    *-*-cygwin* | *-*-mingw* | *-*-os2*)
 
736
    case $host in
 
737
    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
626
738
      # It is impossible to link a dll without this setting, and
627
739
      # we shouldn't force the makefile maintainer to figure out
628
740
      # which system we are compiling for in order to pass an extra
635
747
      # -no-undefined on the libtool link line when we can be certain
636
748
      # that all symbols are satisfied, otherwise we get a static library.
637
749
      allow_undefined=yes
638
 
 
639
 
      # This is a source program that is used to create dlls on Windows
640
 
      # Don't remove nor modify the starting and closing comments
641
 
# /* ltdll.c starts here */
642
 
# #define WIN32_LEAN_AND_MEAN
643
 
# #include <windows.h>
644
 
# #undef WIN32_LEAN_AND_MEAN
645
 
# #include <stdio.h>
646
 
#
647
 
# #ifndef __CYGWIN__
648
 
# #  ifdef __CYGWIN32__
649
 
# #    define __CYGWIN__ __CYGWIN32__
650
 
# #  endif
651
 
# #endif
652
 
#
653
 
# #ifdef __cplusplus
654
 
# extern "C" {
655
 
# #endif
656
 
# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
657
 
# #ifdef __cplusplus
658
 
# }
659
 
# #endif
660
 
#
661
 
# #ifdef __CYGWIN__
662
 
# #include <cygwin/cygwin_dll.h>
663
 
# DECLARE_CYGWIN_DLL( DllMain );
664
 
# #endif
665
 
# HINSTANCE __hDllInstance_base;
666
 
#
667
 
# BOOL APIENTRY
668
 
# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
669
 
# {
670
 
#   __hDllInstance_base = hInst;
671
 
#   return TRUE;
672
 
# }
673
 
# /* ltdll.c ends here */
674
 
      # This is a source program that is used to create import libraries
675
 
      # on Windows for dlls which lack them. Don't remove nor modify the
676
 
      # starting and closing comments
677
 
# /* impgen.c starts here */
678
 
# /*   Copyright (C) 1999 Free Software Foundation, Inc.
679
 
680
 
#  This file is part of GNU libtool.
681
 
682
 
#  This program is free software; you can redistribute it and/or modify
683
 
#  it under the terms of the GNU General Public License as published by
684
 
#  the Free Software Foundation; either version 2 of the License, or
685
 
#  (at your option) any later version.
686
 
687
 
#  This program is distributed in the hope that it will be useful,
688
 
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
689
 
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
690
 
#  GNU General Public License for more details.
691
 
692
 
#  You should have received a copy of the GNU General Public License
693
 
#  along with this program; if not, write to the Free Software
694
 
#  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
695
 
#  */
696
 
697
 
#  #include <stdio.h>           /* for printf() */
698
 
#  #include <unistd.h>          /* for open(), lseek(), read() */
699
 
#  #include <fcntl.h>           /* for O_RDONLY, O_BINARY */
700
 
#  #include <string.h>          /* for strdup() */
701
 
702
 
#  static unsigned int
703
 
#  pe_get16 (fd, offset)
704
 
#       int fd;
705
 
#       int offset;
706
 
#  {
707
 
#    unsigned char b[2];
708
 
#    lseek (fd, offset, SEEK_SET);
709
 
#    read (fd, b, 2);
710
 
#    return b[0] + (b[1]<<8);
711
 
#  }
712
 
713
 
#  static unsigned int
714
 
#  pe_get32 (fd, offset)
715
 
#      int fd;
716
 
#      int offset;
717
 
#  {
718
 
#    unsigned char b[4];
719
 
#    lseek (fd, offset, SEEK_SET);
720
 
#    read (fd, b, 4);
721
 
#    return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
722
 
#  }
723
 
724
 
#  static unsigned int
725
 
#  pe_as32 (ptr)
726
 
#       void *ptr;
727
 
#  {
728
 
#    unsigned char *b = ptr;
729
 
#    return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
730
 
#  }
731
 
732
 
#  int
733
 
#  main (argc, argv)
734
 
#      int argc;
735
 
#      char *argv[];
736
 
#  {
737
 
#      int dll;
738
 
#      unsigned long pe_header_offset, opthdr_ofs, num_entries, i;
739
 
#      unsigned long export_rva, export_size, nsections, secptr, expptr;
740
 
#      unsigned long name_rvas, nexp;
741
 
#      unsigned char *expdata, *erva;
742
 
#      char *filename, *dll_name;
743
 
744
 
#      filename = argv[1];
745
 
746
 
#      dll = open(filename, O_RDONLY|O_BINARY);
747
 
#      if (!dll)
748
 
#       return 1;
749
 
750
 
#      dll_name = filename;
751
 
#    
752
 
#      for (i=0; filename[i]; i++)
753
 
#       if (filename[i] == '/' || filename[i] == '\\'  || filename[i] == ':')
754
 
#           dll_name = filename + i +1;
755
 
756
 
#      pe_header_offset = pe_get32 (dll, 0x3c);
757
 
#      opthdr_ofs = pe_header_offset + 4 + 20;
758
 
#      num_entries = pe_get32 (dll, opthdr_ofs + 92);
759
 
760
 
#      if (num_entries < 1) /* no exports */
761
 
#       return 1;
762
 
763
 
#      export_rva = pe_get32 (dll, opthdr_ofs + 96);
764
 
#      export_size = pe_get32 (dll, opthdr_ofs + 100);
765
 
#      nsections = pe_get16 (dll, pe_header_offset + 4 +2);
766
 
#      secptr = (pe_header_offset + 4 + 20 +
767
 
#             pe_get16 (dll, pe_header_offset + 4 + 16));
768
 
769
 
#      expptr = 0;
770
 
#      for (i = 0; i < nsections; i++)
771
 
#      {
772
 
#       char sname[8];
773
 
#       unsigned long secptr1 = secptr + 40 * i;
774
 
#       unsigned long vaddr = pe_get32 (dll, secptr1 + 12);
775
 
#       unsigned long vsize = pe_get32 (dll, secptr1 + 16);
776
 
#       unsigned long fptr = pe_get32 (dll, secptr1 + 20);
777
 
#       lseek(dll, secptr1, SEEK_SET);
778
 
#       read(dll, sname, 8);
779
 
#       if (vaddr <= export_rva && vaddr+vsize > export_rva)
780
 
#       {
781
 
#           expptr = fptr + (export_rva - vaddr);
782
 
#           if (export_rva + export_size > vaddr + vsize)
783
 
#               export_size = vsize - (export_rva - vaddr);
784
 
#           break;
785
 
#       }
786
 
#      }
787
 
788
 
#      expdata = (unsigned char*)malloc(export_size);
789
 
#      lseek (dll, expptr, SEEK_SET);
790
 
#      read (dll, expdata, export_size);
791
 
#      erva = expdata - export_rva;
792
 
793
 
#      nexp = pe_as32 (expdata+24);
794
 
#      name_rvas = pe_as32 (expdata+32);
795
 
796
 
#      printf ("EXPORTS\n");
797
 
#      for (i = 0; i<nexp; i++)
798
 
#      {
799
 
#       unsigned long name_rva = pe_as32 (erva+name_rvas+i*4);
800
 
#       printf ("\t%s @ %ld ;\n", erva+name_rva, 1+ i);
801
 
#      }
802
 
803
 
#      return 0;
804
 
#  }
805
 
# /* impgen.c ends here */
806
750
      ;;
807
751
    *)
808
752
      allow_undefined=yes
809
753
      ;;
810
754
    esac
 
755
    libtool_args="$nonopt"
811
756
    compile_command="$nonopt"
812
757
    finalize_command="$nonopt"
813
758
 
818
763
    convenience=
819
764
    old_convenience=
820
765
    deplibs=
821
 
    linkopts=
 
766
    old_deplibs=
 
767
    compiler_flags=
 
768
    linker_flags=
 
769
    dllsearchpath=
 
770
    lib_search_path=`pwd`
 
771
    inst_prefix_dir=
822
772
 
823
 
    if test -n "$shlibpath_var"; then
824
 
      # get the directories listed in $shlibpath_var
825
 
      eval lib_search_path=\`\$echo \"X \${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
826
 
    else
827
 
      lib_search_path=
828
 
    fi
829
 
    # now prepend the system-specific ones
830
 
    eval lib_search_path=\"$sys_lib_search_path_spec\$lib_search_path\"
831
 
    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
832
 
    
833
773
    avoid_version=no
834
774
    dlfiles=
835
775
    dlprefiles=
839
779
    export_symbols_regex=
840
780
    generated=
841
781
    libobjs=
842
 
    link_against_libtool_libs=
843
782
    ltlibs=
844
783
    module=no
 
784
    no_install=no
845
785
    objs=
846
786
    prefer_static_libs=no
847
787
    preload=no
858
798
    # We need to know -static, to get the right output filenames.
859
799
    for arg
860
800
    do
861
 
      case "$arg" in
 
801
      case $arg in
862
802
      -all-static | -static)
863
803
        if test "X$arg" = "X-all-static"; then
864
804
          if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
887
827
    while test $# -gt 0; do
888
828
      arg="$1"
889
829
      shift
 
830
      case $arg in
 
831
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
 
832
        qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
 
833
        ;;
 
834
      *) qarg=$arg ;;
 
835
      esac
 
836
      libtool_args="$libtool_args $qarg"
890
837
 
891
838
      # If the previous option needs an argument, assign it.
892
839
      if test -n "$prev"; then
893
 
        case "$prev" in
 
840
        case $prev in
894
841
        output)
895
842
          compile_command="$compile_command @OUTPUT@"
896
843
          finalize_command="$finalize_command @OUTPUT@"
897
844
          ;;
898
845
        esac
899
846
 
900
 
        case "$prev" in
 
847
        case $prev in
901
848
        dlfiles|dlprefiles)
902
849
          if test "$preload" = no; then
903
850
            # Add the symbol object into the linking commands.
905
852
            finalize_command="$finalize_command @SYMFILE@"
906
853
            preload=yes
907
854
          fi
908
 
          case "$arg" in
 
855
          case $arg in
909
856
          *.la | *.lo) ;;  # We handle these cases below.
910
857
          force)
911
858
            if test "$dlself" = no; then
934
881
              dlprefiles="$dlprefiles $arg"
935
882
            fi
936
883
            prev=
 
884
            continue
937
885
            ;;
938
886
          esac
939
887
          ;;
951
899
          prev=
952
900
          continue
953
901
          ;;
 
902
        inst_prefix)
 
903
          inst_prefix_dir="$arg"
 
904
          prev=
 
905
          continue
 
906
          ;;
954
907
        release)
955
908
          release="-$arg"
956
909
          prev=
958
911
          ;;
959
912
        rpath | xrpath)
960
913
          # We need an absolute path.
961
 
          case "$arg" in
 
914
          case $arg in
962
915
          [\\/]* | [A-Za-z]:[\\/]*) ;;
963
916
          *)
964
917
            $echo "$modename: only absolute run-paths are allowed" 1>&2
979
932
          prev=
980
933
          continue
981
934
          ;;
 
935
        xcompiler)
 
936
          compiler_flags="$compiler_flags $qarg"
 
937
          prev=
 
938
          compile_command="$compile_command $qarg"
 
939
          finalize_command="$finalize_command $qarg"
 
940
          continue
 
941
          ;;
 
942
        xlinker)
 
943
          linker_flags="$linker_flags $qarg"
 
944
          compiler_flags="$compiler_flags $wl$qarg"
 
945
          prev=
 
946
          compile_command="$compile_command $wl$qarg"
 
947
          finalize_command="$finalize_command $wl$qarg"
 
948
          continue
 
949
          ;;
982
950
        *)
983
951
          eval "$prev=\"\$arg\""
984
952
          prev=
985
953
          continue
986
954
          ;;
987
955
        esac
988
 
      fi
 
956
      fi # test -n $prev
989
957
 
990
958
      prevarg="$arg"
991
959
 
992
 
      case "$arg" in
 
960
      case $arg in
993
961
      -all-static)
994
962
        if test -n "$link_static_flag"; then
995
963
          compile_command="$compile_command $link_static_flag"
1026
994
 
1027
995
      -export-symbols | -export-symbols-regex)
1028
996
        if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1029
 
          $echo "$modename: not more than one -exported-symbols argument allowed"
 
997
          $echo "$modename: more than one -exported-symbols argument is not allowed"
1030
998
          exit 1
1031
999
        fi
1032
1000
        if test "X$arg" = "X-export-symbols"; then
1037
1005
        continue
1038
1006
        ;;
1039
1007
 
 
1008
      -inst-prefix-dir)
 
1009
       prev=inst_prefix
 
1010
       continue
 
1011
       ;;
 
1012
 
 
1013
      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
 
1014
      # so, if we see these flags be careful not to treat them like -L
 
1015
      -L[A-Z][A-Z]*:*)
 
1016
        case $with_gcc/$host in
 
1017
        no/*-*-irix* | no/*-*-nonstopux*)
 
1018
          compile_command="$compile_command $arg"
 
1019
          finalize_command="$finalize_command $arg"
 
1020
          ;;
 
1021
        esac
 
1022
        continue
 
1023
        ;;
 
1024
 
1040
1025
      -L*)
1041
1026
        dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1042
1027
        # We need an absolute path.
1043
 
        case "$dir" in
 
1028
        case $dir in
1044
1029
        [\\/]* | [A-Za-z]:[\\/]*) ;;
1045
1030
        *)
1046
1031
          absdir=`cd "$dir" && pwd`
1047
1032
          if test -z "$absdir"; then
1048
 
            $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
1049
 
            $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
1050
 
            absdir="$dir"
 
1033
            $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
 
1034
            exit 1
1051
1035
          fi
1052
1036
          dir="$absdir"
1053
1037
          ;;
1054
1038
        esac
1055
 
        case " $deplibs " in
1056
 
        *" $arg "*) ;;
1057
 
        *) deplibs="$deplibs $arg";;
1058
 
        esac
1059
 
        case " $lib_search_path " in
1060
 
        *" $dir "*) ;;
1061
 
        *) lib_search_path="$lib_search_path $dir";;
1062
 
        esac
1063
 
        case "$host" in
1064
 
        *-*-cygwin* | *-*-mingw* | *-*-os2*)
1065
 
          dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
1066
 
          case ":$dllsearchpath:" in
1067
 
          ::) dllsearchpath="$dllsearchdir";;
1068
 
          *":$dllsearchdir:"*) ;;
1069
 
          *) dllsearchpath="$dllsearchpath:$dllsearchdir";;
 
1039
        case "$deplibs " in
 
1040
        *" -L$dir "*) ;;
 
1041
        *)
 
1042
          deplibs="$deplibs -L$dir"
 
1043
          lib_search_path="$lib_search_path $dir"
 
1044
          ;;
 
1045
        esac
 
1046
        case $host in
 
1047
        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
 
1048
          case :$dllsearchpath: in
 
1049
          *":$dir:"*) ;;
 
1050
          *) dllsearchpath="$dllsearchpath:$dir";;
1070
1051
          esac
1071
1052
          ;;
1072
1053
        esac
 
1054
        continue
1073
1055
        ;;
1074
1056
 
1075
1057
      -l*)
1076
 
        if test "$arg" = "-lc"; then
1077
 
          case "$host" in
1078
 
          *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
1079
 
            # These systems don't actually have c library (as such)
 
1058
        if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
 
1059
          case $host in
 
1060
          *-*-cygwin* | *-*-pw32* | *-*-beos*)
 
1061
            # These systems don't actually have a C or math library (as such)
1080
1062
            continue
1081
1063
            ;;
 
1064
          *-*-mingw* | *-*-os2*)
 
1065
            # These systems don't actually have a C library (as such)
 
1066
            test "X$arg" = "X-lc" && continue
 
1067
            ;;
 
1068
          *-*-openbsd* | *-*-freebsd*)
 
1069
            # Do not include libc due to us having libc/libc_r.
 
1070
            test "X$arg" = "X-lc" && continue
 
1071
            ;;
1082
1072
          esac
1083
 
        elif test "$arg" = "-lm"; then
1084
 
          case "$host" in
1085
 
          *-*-cygwin* | *-*-beos*)
1086
 
            # These systems don't actually have math library (as such)
 
1073
         elif test "X$arg" = "X-lc_r"; then
 
1074
          case $host in
 
1075
         *-*-openbsd* | *-*-freebsd*)
 
1076
            # Do not include libc_r directly, use -pthread flag.
1087
1077
            continue
1088
1078
            ;;
1089
1079
          esac
1090
1080
        fi
1091
1081
        deplibs="$deplibs $arg"
 
1082
        continue
1092
1083
        ;;
1093
1084
 
1094
1085
      -module)
1096
1087
        continue
1097
1088
        ;;
1098
1089
 
 
1090
      -no-fast-install)
 
1091
        fast_install=no
 
1092
        continue
 
1093
        ;;
 
1094
 
 
1095
      -no-install)
 
1096
        case $host in
 
1097
        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
 
1098
          # The PATH hackery in wrapper scripts is required on Windows
 
1099
          # in order for the loader to find any dlls it needs.
 
1100
          $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
 
1101
          $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
 
1102
          fast_install=no
 
1103
          ;;
 
1104
        *) no_install=yes ;;
 
1105
        esac
 
1106
        continue
 
1107
        ;;
 
1108
 
1099
1109
      -no-undefined)
1100
1110
        allow_undefined=no
1101
1111
        continue
1121
1131
      -R*)
1122
1132
        dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1123
1133
        # We need an absolute path.
1124
 
        case "$dir" in
 
1134
        case $dir in
1125
1135
        [\\/]* | [A-Za-z]:[\\/]*) ;;
1126
1136
        *)
1127
1137
          $echo "$modename: only absolute run-paths are allowed" 1>&2
1136
1146
        ;;
1137
1147
 
1138
1148
      -static)
1139
 
        # If we have no pic_flag, then this is the same as -all-static.
1140
 
        if test -z "$pic_flag" && test -n "$link_static_flag"; then
1141
 
          compile_command="$compile_command $link_static_flag"
1142
 
          finalize_command="$finalize_command $link_static_flag"
1143
 
        fi
 
1149
        # The effects of -static are defined in a previous loop.
 
1150
        # We used to do the same as -all-static on platforms that
 
1151
        # didn't have a PIC flag, but the assumption that the effects
 
1152
        # would be equivalent was wrong.  It would break on at least
 
1153
        # Digital Unix and AIX.
1144
1154
        continue
1145
1155
        ;;
1146
1156
 
1154
1164
        continue
1155
1165
        ;;
1156
1166
 
 
1167
      -Wc,*)
 
1168
        args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
 
1169
        arg=
 
1170
        save_ifs="$IFS"; IFS=','
 
1171
        for flag in $args; do
 
1172
          IFS="$save_ifs"
 
1173
          case $flag in
 
1174
            *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
 
1175
            flag="\"$flag\""
 
1176
            ;;
 
1177
          esac
 
1178
          arg="$arg $wl$flag"
 
1179
          compiler_flags="$compiler_flags $flag"
 
1180
        done
 
1181
        IFS="$save_ifs"
 
1182
        arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
 
1183
        ;;
 
1184
 
 
1185
      -Wl,*)
 
1186
        args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
 
1187
        arg=
 
1188
        save_ifs="$IFS"; IFS=','
 
1189
        for flag in $args; do
 
1190
          IFS="$save_ifs"
 
1191
          case $flag in
 
1192
            *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
 
1193
            flag="\"$flag\""
 
1194
            ;;
 
1195
          esac
 
1196
          arg="$arg $wl$flag"
 
1197
          compiler_flags="$compiler_flags $wl$flag"
 
1198
          linker_flags="$linker_flags $flag"
 
1199
        done
 
1200
        IFS="$save_ifs"
 
1201
        arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
 
1202
        ;;
 
1203
 
 
1204
      -Xcompiler)
 
1205
        prev=xcompiler
 
1206
        continue
 
1207
        ;;
 
1208
 
 
1209
      -Xlinker)
 
1210
        prev=xlinker
 
1211
        continue
 
1212
        ;;
 
1213
 
1157
1214
      # Some other compiler flag.
1158
1215
      -* | +*)
1159
1216
        # Unknown arguments in both finalize_command and compile_command need
1160
1217
        # to be aesthetically quoted because they are evaled later.
1161
1218
        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1162
 
        case "$arg" in
1163
 
        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*)
 
1219
        case $arg in
 
1220
        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
1164
1221
          arg="\"$arg\""
1165
1222
          ;;
1166
1223
        esac
1167
1224
        ;;
1168
1225
 
1169
 
      *.o | *.obj | *.a | *.lib)
1170
 
        # A standard object.
1171
 
        objs="$objs $arg"
1172
 
        ;;
1173
 
 
1174
 
      *.lo)
1175
 
        # A library object.
 
1226
      *.lo | *.$objext)
 
1227
        # A library or standard object.
1176
1228
        if test "$prev" = dlfiles; then
1177
 
          dlfiles="$dlfiles $arg"
1178
 
          if test "$build_libtool_libs" = yes && test "$dlopen" = yes; then
 
1229
          # This file was specified with -dlopen.
 
1230
          if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
 
1231
            dlfiles="$dlfiles $arg"
1179
1232
            prev=
1180
1233
            continue
1181
1234
          else
1188
1241
          # Preload the old-style object.
1189
1242
          dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
1190
1243
          prev=
 
1244
        else
 
1245
          case $arg in
 
1246
          *.lo) libobjs="$libobjs $arg" ;;
 
1247
          *) objs="$objs $arg" ;;
 
1248
          esac
1191
1249
        fi
1192
 
        libobjs="$libobjs $arg"
 
1250
        ;;
 
1251
 
 
1252
      *.$libext)
 
1253
        # An archive.
 
1254
        deplibs="$deplibs $arg"
 
1255
        old_deplibs="$old_deplibs $arg"
 
1256
        continue
1193
1257
        ;;
1194
1258
 
1195
1259
      *.la)
1196
1260
        # A libtool-controlled library.
1197
1261
 
 
1262
        if test "$prev" = dlfiles; then
 
1263
          # This library was specified with -dlopen.
 
1264
          dlfiles="$dlfiles $arg"
 
1265
          prev=
 
1266
        elif test "$prev" = dlprefiles; then
 
1267
          # The library was specified with -dlpreopen.
 
1268
          dlprefiles="$dlprefiles $arg"
 
1269
          prev=
 
1270
        else
 
1271
          deplibs="$deplibs $arg"
 
1272
        fi
 
1273
        continue
 
1274
        ;;
 
1275
 
 
1276
      # Some other compiler argument.
 
1277
      *)
 
1278
        # Unknown arguments in both finalize_command and compile_command need
 
1279
        # to be aesthetically quoted because they are evaled later.
 
1280
        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
 
1281
        case $arg in
 
1282
        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
 
1283
          arg="\"$arg\""
 
1284
          ;;
 
1285
        esac
 
1286
        ;;
 
1287
      esac # arg
 
1288
 
 
1289
      # Now actually substitute the argument into the commands.
 
1290
      if test -n "$arg"; then
 
1291
        compile_command="$compile_command $arg"
 
1292
        finalize_command="$finalize_command $arg"
 
1293
      fi
 
1294
    done # argument parsing loop
 
1295
 
 
1296
    if test -n "$prev"; then
 
1297
      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
 
1298
      $echo "$help" 1>&2
 
1299
      exit 1
 
1300
    fi
 
1301
 
 
1302
    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
 
1303
      eval arg=\"$export_dynamic_flag_spec\"
 
1304
      compile_command="$compile_command $arg"
 
1305
      finalize_command="$finalize_command $arg"
 
1306
    fi
 
1307
 
 
1308
    # calculate the name of the file, without its directory
 
1309
    outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
 
1310
    libobjs_save="$libobjs"
 
1311
 
 
1312
    if test -n "$shlibpath_var"; then
 
1313
      # get the directories listed in $shlibpath_var
 
1314
      eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
 
1315
    else
 
1316
      shlib_search_path=
 
1317
    fi
 
1318
    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
 
1319
    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
 
1320
 
 
1321
    output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
 
1322
    if test "X$output_objdir" = "X$output"; then
 
1323
      output_objdir="$objdir"
 
1324
    else
 
1325
      output_objdir="$output_objdir/$objdir"
 
1326
    fi
 
1327
    # Create the object directory.
 
1328
    if test ! -d $output_objdir; then
 
1329
      $show "$mkdir $output_objdir"
 
1330
      $run $mkdir $output_objdir
 
1331
      status=$?
 
1332
      if test $status -ne 0 && test ! -d $output_objdir; then
 
1333
        exit $status
 
1334
      fi
 
1335
    fi
 
1336
 
 
1337
    # Determine the type of output
 
1338
    case $output in
 
1339
    "")
 
1340
      $echo "$modename: you must specify an output file" 1>&2
 
1341
      $echo "$help" 1>&2
 
1342
      exit 1
 
1343
      ;;
 
1344
    *.$libext) linkmode=oldlib ;;
 
1345
    *.lo | *.$objext) linkmode=obj ;;
 
1346
    *.la) linkmode=lib ;;
 
1347
    *) linkmode=prog ;; # Anything else should be a program.
 
1348
    esac
 
1349
 
 
1350
    specialdeplibs=
 
1351
    libs=
 
1352
    # Find all interdependent deplibs by searching for libraries
 
1353
    # that are linked more than once (e.g. -la -lb -la)
 
1354
    for deplib in $deplibs; do
 
1355
      if test "X$duplicate_deps" = "Xyes" ; then
 
1356
        case "$libs " in
 
1357
        *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
 
1358
        esac
 
1359
      fi
 
1360
      libs="$libs $deplib"
 
1361
    done
 
1362
    deplibs=
 
1363
    newdependency_libs=
 
1364
    newlib_search_path=
 
1365
    need_relink=no # whether we're linking any uninstalled libtool libraries
 
1366
    notinst_deplibs= # not-installed libtool libraries
 
1367
    notinst_path= # paths that contain not-installed libtool libraries
 
1368
    case $linkmode in
 
1369
    lib)
 
1370
        passes="conv link"
 
1371
        for file in $dlfiles $dlprefiles; do
 
1372
          case $file in
 
1373
          *.la) ;;
 
1374
          *)
 
1375
            $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
 
1376
            exit 1
 
1377
            ;;
 
1378
          esac
 
1379
        done
 
1380
        ;;
 
1381
    prog)
 
1382
        compile_deplibs=
 
1383
        finalize_deplibs=
 
1384
        alldeplibs=no
 
1385
        newdlfiles=
 
1386
        newdlprefiles=
 
1387
        passes="conv scan dlopen dlpreopen link"
 
1388
        ;;
 
1389
    *)  passes="conv"
 
1390
        ;;
 
1391
    esac
 
1392
    for pass in $passes; do
 
1393
      if test $linkmode = prog; then
 
1394
        # Determine which files to process
 
1395
        case $pass in
 
1396
        dlopen)
 
1397
          libs="$dlfiles"
 
1398
          save_deplibs="$deplibs" # Collect dlpreopened libraries
 
1399
          deplibs=
 
1400
          ;;
 
1401
        dlpreopen) libs="$dlprefiles" ;;
 
1402
        link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
 
1403
        esac
 
1404
      fi
 
1405
      for deplib in $libs; do
 
1406
        lib=
 
1407
        found=no
 
1408
        case $deplib in
 
1409
        -l*)
 
1410
          if test $linkmode = oldlib && test $linkmode = obj; then
 
1411
            $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2
 
1412
            continue
 
1413
          fi
 
1414
          if test $pass = conv; then
 
1415
            deplibs="$deplib $deplibs"
 
1416
            continue
 
1417
          fi
 
1418
          name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
 
1419
          for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
 
1420
            # Search the libtool library
 
1421
            lib="$searchdir/lib${name}.la"
 
1422
            if test -f "$lib"; then
 
1423
              found=yes
 
1424
              break
 
1425
            fi
 
1426
          done
 
1427
          if test "$found" != yes; then
 
1428
            # deplib doesn't seem to be a libtool library
 
1429
            if test "$linkmode,$pass" = "prog,link"; then
 
1430
              compile_deplibs="$deplib $compile_deplibs"
 
1431
              finalize_deplibs="$deplib $finalize_deplibs"
 
1432
            else
 
1433
              deplibs="$deplib $deplibs"
 
1434
              test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs"
 
1435
            fi
 
1436
            continue
 
1437
          fi
 
1438
          ;; # -l
 
1439
        -L*)
 
1440
          case $linkmode in
 
1441
          lib)
 
1442
            deplibs="$deplib $deplibs"
 
1443
            test $pass = conv && continue
 
1444
            newdependency_libs="$deplib $newdependency_libs"
 
1445
            newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
 
1446
            ;;
 
1447
          prog)
 
1448
            if test $pass = conv; then
 
1449
              deplibs="$deplib $deplibs"
 
1450
              continue
 
1451
            fi
 
1452
            if test $pass = scan; then
 
1453
              deplibs="$deplib $deplibs"
 
1454
              newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
 
1455
            else
 
1456
              compile_deplibs="$deplib $compile_deplibs"
 
1457
              finalize_deplibs="$deplib $finalize_deplibs"
 
1458
            fi
 
1459
            ;;
 
1460
          *)
 
1461
            $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2
 
1462
            ;;
 
1463
          esac # linkmode
 
1464
          continue
 
1465
          ;; # -L
 
1466
        -R*)
 
1467
          if test $pass = link; then
 
1468
            dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
 
1469
            # Make sure the xrpath contains only unique directories.
 
1470
            case "$xrpath " in
 
1471
            *" $dir "*) ;;
 
1472
            *) xrpath="$xrpath $dir" ;;
 
1473
            esac
 
1474
          fi
 
1475
          deplibs="$deplib $deplibs"
 
1476
          continue
 
1477
          ;;
 
1478
        *.la) lib="$deplib" ;;
 
1479
        *.$libext)
 
1480
          if test $pass = conv; then
 
1481
            deplibs="$deplib $deplibs"
 
1482
            continue
 
1483
          fi
 
1484
          case $linkmode in
 
1485
          lib)
 
1486
            if test "$deplibs_check_method" != pass_all; then
 
1487
              echo
 
1488
              echo "*** Warning: Trying to link with static lib archive $deplib."
 
1489
              echo "*** I have the capability to make that library automatically link in when"
 
1490
              echo "*** you link to this library.  But I can only do this if you have a"
 
1491
              echo "*** shared version of the library, which you do not appear to have"
 
1492
              echo "*** because the file extensions .$libext of this argument makes me believe"
 
1493
              echo "*** that it is just a static archive that I should not used here."
 
1494
            else
 
1495
              echo
 
1496
              echo "*** Warning: Linking the shared library $output against the"
 
1497
              echo "*** static library $deplib is not portable!"
 
1498
              deplibs="$deplib $deplibs"
 
1499
            fi
 
1500
            continue
 
1501
            ;;
 
1502
          prog)
 
1503
            if test $pass != link; then
 
1504
              deplibs="$deplib $deplibs"
 
1505
            else
 
1506
              compile_deplibs="$deplib $compile_deplibs"
 
1507
              finalize_deplibs="$deplib $finalize_deplibs"
 
1508
            fi
 
1509
            continue
 
1510
            ;;
 
1511
          esac # linkmode
 
1512
          ;; # *.$libext
 
1513
        *.lo | *.$objext)
 
1514
          if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
 
1515
            # If there is no dlopen support or we're linking statically,
 
1516
            # we need to preload.
 
1517
            newdlprefiles="$newdlprefiles $deplib"
 
1518
            compile_deplibs="$deplib $compile_deplibs"
 
1519
            finalize_deplibs="$deplib $finalize_deplibs"
 
1520
          else
 
1521
            newdlfiles="$newdlfiles $deplib"
 
1522
          fi
 
1523
          continue
 
1524
          ;;
 
1525
        %DEPLIBS%)
 
1526
          alldeplibs=yes
 
1527
          continue
 
1528
          ;;
 
1529
        esac # case $deplib
 
1530
        if test $found = yes || test -f "$lib"; then :
 
1531
        else
 
1532
          $echo "$modename: cannot find the library \`$lib'" 1>&2
 
1533
          exit 1
 
1534
        fi
 
1535
 
 
1536
        # Check to see that this really is a libtool archive.
 
1537
        if (${SED} -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
 
1538
        else
 
1539
          $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
 
1540
          exit 1
 
1541
        fi
 
1542
 
 
1543
        ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
 
1544
        test "X$ladir" = "X$lib" && ladir="."
 
1545
 
1198
1546
        dlname=
 
1547
        dlopen=
 
1548
        dlpreopen=
1199
1549
        libdir=
1200
1550
        library_names=
1201
1551
        old_library=
1202
 
 
1203
 
        # Check to see that this really is a libtool archive.
1204
 
        if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1205
 
        else
1206
 
          $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2
1207
 
          exit 1
1208
 
        fi
1209
 
 
1210
1552
        # If the library was installed with an old release of libtool,
1211
1553
        # it will not redefine variable installed.
1212
1554
        installed=yes
1213
1555
 
1214
1556
        # Read the .la file
1215
 
        # If there is no directory component, then add one.
1216
 
        case "$arg" in
1217
 
        */* | *\\*) . $arg ;;
1218
 
        *) . ./$arg ;;
 
1557
        case $lib in
 
1558
        */* | *\\*) . $lib ;;
 
1559
        *) . ./$lib ;;
1219
1560
        esac
1220
1561
 
 
1562
        if test "$linkmode,$pass" = "lib,link" ||
 
1563
           test "$linkmode,$pass" = "prog,scan" ||
 
1564
           { test $linkmode = oldlib && test $linkmode = obj; }; then
 
1565
           # Add dl[pre]opened files of deplib
 
1566
          test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
 
1567
          test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
 
1568
        fi
 
1569
 
 
1570
        if test $pass = conv; then
 
1571
          # Only check for convenience libraries
 
1572
          deplibs="$lib $deplibs"
 
1573
          if test -z "$libdir"; then
 
1574
            if test -z "$old_library"; then
 
1575
              $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
 
1576
              exit 1
 
1577
            fi
 
1578
            # It is a libtool convenience library, so add in its objects.
 
1579
            convenience="$convenience $ladir/$objdir/$old_library"
 
1580
            old_convenience="$old_convenience $ladir/$objdir/$old_library"
 
1581
            tmp_libs=
 
1582
            for deplib in $dependency_libs; do
 
1583
              deplibs="$deplib $deplibs"
 
1584
              if test "X$duplicate_deps" = "Xyes" ; then
 
1585
                case "$tmp_libs " in
 
1586
                *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
 
1587
                esac
 
1588
              fi
 
1589
              tmp_libs="$tmp_libs $deplib"
 
1590
            done
 
1591
          elif test $linkmode != prog && test $linkmode != lib; then
 
1592
            $echo "$modename: \`$lib' is not a convenience library" 1>&2
 
1593
            exit 1
 
1594
          fi
 
1595
          continue
 
1596
        fi # $pass = conv
 
1597
 
1221
1598
        # Get the name of the library we link against.
1222
1599
        linklib=
1223
1600
        for l in $old_library $library_names; do
1224
1601
          linklib="$l"
1225
1602
        done
1226
 
 
1227
1603
        if test -z "$linklib"; then
1228
 
          $echo "$modename: cannot find name of link library for \`$arg'" 1>&2
 
1604
          $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1229
1605
          exit 1
1230
1606
        fi
1231
1607
 
 
1608
        # This library was specified with -dlopen.
 
1609
        if test $pass = dlopen; then
 
1610
          if test -z "$libdir"; then
 
1611
            $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
 
1612
            exit 1
 
1613
          fi
 
1614
          if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
 
1615
            # If there is no dlname, no dlopen support or we're linking
 
1616
            # statically, we need to preload.
 
1617
            dlprefiles="$dlprefiles $lib"
 
1618
          else
 
1619
            newdlfiles="$newdlfiles $lib"
 
1620
          fi
 
1621
          continue
 
1622
        fi # $pass = dlopen
 
1623
 
 
1624
        # We need an absolute path.
 
1625
        case $ladir in
 
1626
        [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
 
1627
        *)
 
1628
          abs_ladir=`cd "$ladir" && pwd`
 
1629
          if test -z "$abs_ladir"; then
 
1630
            $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
 
1631
            $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
 
1632
            abs_ladir="$ladir"
 
1633
          fi
 
1634
          ;;
 
1635
        esac
 
1636
        laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
 
1637
 
1232
1638
        # Find the relevant object directory and library name.
1233
 
        name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'`
1234
 
 
1235
1639
        if test "X$installed" = Xyes; then
1236
 
          dir="$libdir"
 
1640
          if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
 
1641
            $echo "$modename: warning: library \`$lib' was moved." 1>&2
 
1642
            dir="$ladir"
 
1643
            absdir="$abs_ladir"
 
1644
            libdir="$abs_ladir"
 
1645
          else
 
1646
            dir="$libdir"
 
1647
            absdir="$libdir"
 
1648
          fi
1237
1649
        else
1238
 
          dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1239
 
          if test "X$dir" = "X$arg"; then
1240
 
            dir="$objdir"
1241
 
          else
1242
 
            dir="$dir/$objdir"
1243
 
          fi
1244
 
        fi
1245
 
 
1246
 
        if test -n "$dependency_libs"; then
1247
 
          # Extract -R and -L from dependency_libs
1248
 
          temp_deplibs=
1249
 
          for deplib in $dependency_libs; do
1250
 
            case "$deplib" in
1251
 
            -R*) temp_xrpath=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1252
 
                 case " $rpath $xrpath " in
1253
 
                 *" $temp_xrpath "*) ;;
1254
 
                 *) xrpath="$xrpath $temp_xrpath";;
1255
 
                 esac;;
1256
 
            -L*) case "$compile_command $temp_deplibs " in
1257
 
                 *" $deplib "*) ;;
1258
 
                 *) temp_deplibs="$temp_deplibs $deplib";;
1259
 
                 esac
1260
 
                 temp_dir=`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1261
 
                 case " $lib_search_path " in
1262
 
                 *" $temp_dir "*) ;;
1263
 
                 *) lib_search_path="$lib_search_path $temp_dir";;
1264
 
                 esac
1265
 
                 ;;
1266
 
            *) temp_deplibs="$temp_deplibs $deplib";;
1267
 
            esac
1268
 
          done
1269
 
          dependency_libs="$temp_deplibs"
1270
 
        fi
1271
 
 
1272
 
        if test -z "$libdir"; then
1273
 
          # It is a libtool convenience library, so add in its objects.
1274
 
          convenience="$convenience $dir/$old_library"
1275
 
          old_convenience="$old_convenience $dir/$old_library"
1276
 
          deplibs="$deplibs$dependency_libs"
1277
 
          compile_command="$compile_command $dir/$old_library$dependency_libs"
1278
 
          finalize_command="$finalize_command $dir/$old_library$dependency_libs"
1279
 
          continue
1280
 
        fi
1281
 
 
1282
 
        # This library was specified with -dlopen.
1283
 
        if test "$prev" = dlfiles; then
1284
 
          dlfiles="$dlfiles $arg"
1285
 
          if test -z "$dlname" || test "$dlopen" != yes || test "$build_libtool_libs" = no; then
1286
 
            # If there is no dlname, no dlopen support or we're linking statically,
1287
 
            # we need to preload.
1288
 
            prev=dlprefiles
1289
 
          else
1290
 
            # We should not create a dependency on this library, but we
1291
 
            # may need any libraries it requires.
1292
 
            compile_command="$compile_command$dependency_libs"
1293
 
            finalize_command="$finalize_command$dependency_libs"
1294
 
            prev=
1295
 
            continue
1296
 
          fi
1297
 
        fi
1298
 
 
1299
 
        # The library was specified with -dlpreopen.
1300
 
        if test "$prev" = dlprefiles; then
 
1650
          dir="$ladir/$objdir"
 
1651
          absdir="$abs_ladir/$objdir"
 
1652
          # Remove this search path later
 
1653
          notinst_path="$notinst_path $abs_ladir"
 
1654
        fi # $installed = yes
 
1655
        name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
 
1656
 
 
1657
        # This library was specified with -dlpreopen.
 
1658
        if test $pass = dlpreopen; then
 
1659
          if test -z "$libdir"; then
 
1660
            $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
 
1661
            exit 1
 
1662
          fi
1301
1663
          # Prefer using a static library (so that no silly _DYNAMIC symbols
1302
1664
          # are required to link).
1303
1665
          if test -n "$old_library"; then
1304
 
            dlprefiles="$dlprefiles $dir/$old_library"
1305
 
          else
1306
 
            dlprefiles="$dlprefiles $dir/$linklib"
1307
 
          fi
1308
 
          prev=
 
1666
            newdlprefiles="$newdlprefiles $dir/$old_library"
 
1667
          # Otherwise, use the dlname, so that lt_dlopen finds it.
 
1668
          elif test -n "$dlname"; then
 
1669
            newdlprefiles="$newdlprefiles $dir/$dlname"
 
1670
          else
 
1671
            newdlprefiles="$newdlprefiles $dir/$linklib"
 
1672
          fi
 
1673
        fi # $pass = dlpreopen
 
1674
 
 
1675
        if test -z "$libdir"; then
 
1676
          # Link the convenience library
 
1677
          if test $linkmode = lib; then
 
1678
            deplibs="$dir/$old_library $deplibs"
 
1679
          elif test "$linkmode,$pass" = "prog,link"; then
 
1680
            compile_deplibs="$dir/$old_library $compile_deplibs"
 
1681
            finalize_deplibs="$dir/$old_library $finalize_deplibs"
 
1682
          else
 
1683
            deplibs="$lib $deplibs"
 
1684
          fi
 
1685
          continue
1309
1686
        fi
1310
1687
 
 
1688
        if test $linkmode = prog && test $pass != link; then
 
1689
          newlib_search_path="$newlib_search_path $ladir"
 
1690
          deplibs="$lib $deplibs"
 
1691
 
 
1692
          linkalldeplibs=no
 
1693
          if test "$link_all_deplibs" != no || test -z "$library_names" ||
 
1694
             test "$build_libtool_libs" = no; then
 
1695
            linkalldeplibs=yes
 
1696
          fi
 
1697
 
 
1698
          tmp_libs=
 
1699
          for deplib in $dependency_libs; do
 
1700
            case $deplib in
 
1701
            -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
 
1702
            esac
 
1703
            # Need to link against all dependency_libs?
 
1704
            if test $linkalldeplibs = yes; then
 
1705
              deplibs="$deplib $deplibs"
 
1706
            else
 
1707
              # Need to hardcode shared library paths
 
1708
              # or/and link against static libraries
 
1709
              newdependency_libs="$deplib $newdependency_libs"
 
1710
            fi
 
1711
            if test "X$duplicate_deps" = "Xyes" ; then
 
1712
              case "$tmp_libs " in
 
1713
              *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
 
1714
              esac
 
1715
            fi
 
1716
            tmp_libs="$tmp_libs $deplib"
 
1717
          done # for deplib
 
1718
          continue
 
1719
        fi # $linkmode = prog...
 
1720
 
 
1721
        link_static=no # Whether the deplib will be linked statically
1311
1722
        if test -n "$library_names" &&
1312
1723
           { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
1313
 
          link_against_libtool_libs="$link_against_libtool_libs $arg"
1314
 
          if test -n "$shlibpath_var"; then
1315
 
            # Make sure the rpath contains only unique directories.
1316
 
            case "$temp_rpath " in
1317
 
            *" $dir "*) ;;
1318
 
            *) temp_rpath="$temp_rpath $dir" ;;
1319
 
            esac
1320
 
          fi
 
1724
          # Link against this shared library
1321
1725
 
1322
 
          # We need an absolute path.
1323
 
          case "$dir" in
1324
 
          [\\/] | [A-Za-z]:[\\/]*) absdir="$dir" ;;
1325
 
          *)
1326
 
            absdir=`cd "$dir" && pwd`
1327
 
            if test -z "$absdir"; then
1328
 
              $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
1329
 
              $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
1330
 
              absdir="$dir"
1331
 
            fi
1332
 
            ;;
1333
 
          esac
1334
 
          
1335
 
          # This is the magic to use -rpath.
1336
 
          # Skip directories that are in the system default run-time
1337
 
          # search path, unless they have been requested with -R.
1338
 
          case " $sys_lib_dlsearch_path " in
1339
 
          *" $absdir "*) ;;
1340
 
          *)
1341
 
            case "$compile_rpath " in
 
1726
          if test "$linkmode,$pass" = "prog,link" ||
 
1727
           { test $linkmode = lib && test $hardcode_into_libs = yes; }; then
 
1728
            # Hardcode the library path.
 
1729
            # Skip directories that are in the system default run-time
 
1730
            # search path.
 
1731
            case " $sys_lib_dlsearch_path " in
1342
1732
            *" $absdir "*) ;;
1343
 
            *) compile_rpath="$compile_rpath $absdir" 
 
1733
            *)
 
1734
              case "$compile_rpath " in
 
1735
              *" $absdir "*) ;;
 
1736
              *) compile_rpath="$compile_rpath $absdir"
 
1737
              esac
 
1738
              ;;
1344
1739
            esac
1345
 
            ;;
1346
 
          esac
1347
 
 
1348
 
          case " $sys_lib_dlsearch_path " in
1349
 
          *" $libdir "*) ;;
1350
 
          *)
1351
 
            case "$finalize_rpath " in
 
1740
            case " $sys_lib_dlsearch_path " in
1352
1741
            *" $libdir "*) ;;
1353
 
            *) finalize_rpath="$finalize_rpath $libdir"
 
1742
            *)
 
1743
              case "$finalize_rpath " in
 
1744
              *" $libdir "*) ;;
 
1745
              *) finalize_rpath="$finalize_rpath $libdir"
 
1746
              esac
 
1747
              ;;
1354
1748
            esac
1355
 
            ;;
1356
 
          esac
1357
 
 
1358
 
          lib_linked=yes
1359
 
          case "$hardcode_action" in
1360
 
          immediate | unsupported)
1361
 
            if test "$hardcode_direct" = no; then
1362
 
              compile_command="$compile_command $dir/$linklib"
1363
 
              deplibs="$deplibs $dir/$linklib"
1364
 
              case "$host" in
1365
 
              *-*-cygwin* | *-*-mingw* | *-*-os2*)
1366
 
                dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
1367
 
                if test -n "$dllsearchpath"; then
1368
 
                  dllsearchpath="$dllsearchpath:$dllsearchdir"
1369
 
                else
1370
 
                  dllsearchpath="$dllsearchdir"
 
1749
            if test $linkmode = prog; then
 
1750
              # We need to hardcode the library path
 
1751
              if test -n "$shlibpath_var"; then
 
1752
                # Make sure the rpath contains only unique directories.
 
1753
                case "$temp_rpath " in
 
1754
                *" $dir "*) ;;
 
1755
                *" $absdir "*) ;;
 
1756
                *) temp_rpath="$temp_rpath $dir" ;;
 
1757
                esac
 
1758
              fi
 
1759
            fi
 
1760
          fi # $linkmode,$pass = prog,link...
 
1761
 
 
1762
          if test "$alldeplibs" = yes &&
 
1763
             { test "$deplibs_check_method" = pass_all ||
 
1764
               { test "$build_libtool_libs" = yes &&
 
1765
                 test -n "$library_names"; }; }; then
 
1766
            # We only need to search for static libraries
 
1767
            continue
 
1768
          fi
 
1769
 
 
1770
          if test "$installed" = no; then
 
1771
            notinst_deplibs="$notinst_deplibs $lib"
 
1772
            need_relink=yes
 
1773
          fi
 
1774
 
 
1775
          if test -n "$old_archive_from_expsyms_cmds"; then
 
1776
            # figure out the soname
 
1777
            set dummy $library_names
 
1778
            realname="$2"
 
1779
            shift; shift
 
1780
            libname=`eval \\$echo \"$libname_spec\"`
 
1781
            # use dlname if we got it. it's perfectly good, no?
 
1782
            if test -n "$dlname"; then
 
1783
              soname="$dlname"
 
1784
            elif test -n "$soname_spec"; then
 
1785
              # bleh windows
 
1786
              case $host in
 
1787
              *cygwin*)
 
1788
                major=`expr $current - $age`
 
1789
                versuffix="-$major"
 
1790
                ;;
 
1791
              esac
 
1792
              eval soname=\"$soname_spec\"
 
1793
            else
 
1794
              soname="$realname"
 
1795
            fi
 
1796
 
 
1797
            # Make a new name for the extract_expsyms_cmds to use
 
1798
            soroot="$soname"
 
1799
            soname=`echo $soroot | ${SED} -e 's/^.*\///'`
 
1800
            newlib="libimp-`echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
 
1801
 
 
1802
            # If the library has no export list, then create one now
 
1803
            if test -f "$output_objdir/$soname-def"; then :
 
1804
            else
 
1805
              $show "extracting exported symbol list from \`$soname'"
 
1806
              save_ifs="$IFS"; IFS='~'
 
1807
              eval cmds=\"$extract_expsyms_cmds\"
 
1808
              for cmd in $cmds; do
 
1809
                IFS="$save_ifs"
 
1810
                $show "$cmd"
 
1811
                $run eval "$cmd" || exit $?
 
1812
              done
 
1813
              IFS="$save_ifs"
 
1814
            fi
 
1815
 
 
1816
            # Create $newlib
 
1817
            if test -f "$output_objdir/$newlib"; then :; else
 
1818
              $show "generating import library for \`$soname'"
 
1819
              save_ifs="$IFS"; IFS='~'
 
1820
              eval cmds=\"$old_archive_from_expsyms_cmds\"
 
1821
              for cmd in $cmds; do
 
1822
                IFS="$save_ifs"
 
1823
                $show "$cmd"
 
1824
                $run eval "$cmd" || exit $?
 
1825
              done
 
1826
              IFS="$save_ifs"
 
1827
            fi
 
1828
            # make sure the library variables are pointing to the new library
 
1829
            dir=$output_objdir
 
1830
            linklib=$newlib
 
1831
          fi # test -n $old_archive_from_expsyms_cmds
 
1832
 
 
1833
          if test $linkmode = prog || test "$mode" != relink; then
 
1834
            add_shlibpath=
 
1835
            add_dir=
 
1836
            add=
 
1837
            lib_linked=yes
 
1838
            case $hardcode_action in
 
1839
            immediate | unsupported)
 
1840
              if test "$hardcode_direct" = no; then
 
1841
                add="$dir/$linklib"
 
1842
              elif test "$hardcode_minus_L" = no; then
 
1843
                case $host in
 
1844
                *-*-sunos*) add_shlibpath="$dir" ;;
 
1845
                esac
 
1846
                add_dir="-L$dir"
 
1847
                add="-l$name"
 
1848
              elif test "$hardcode_shlibpath_var" = no; then
 
1849
                add_shlibpath="$dir"
 
1850
                add="-l$name"
 
1851
              else
 
1852
                lib_linked=no
 
1853
              fi
 
1854
              ;;
 
1855
            relink)
 
1856
              if test "$hardcode_direct" = yes; then
 
1857
                add="$dir/$linklib"
 
1858
              elif test "$hardcode_minus_L" = yes; then
 
1859
                add_dir="-L$dir"
 
1860
                # Try looking first in the location we're being installed to.
 
1861
                if test -n "$inst_prefix_dir"; then
 
1862
                  case "$libdir" in
 
1863
                  [\/]*)
 
1864
                    add_dir="-L$inst_prefix_dir$libdir $add_dir"
 
1865
                    ;;
 
1866
                  esac
1371
1867
                fi
1372
 
                ;;
1373
 
              esac
1374
 
            elif test "$hardcode_minus_L" = no; then
1375
 
              case "$host" in
1376
 
              *-*-sunos*)
1377
 
                compile_shlibpath="$compile_shlibpath$dir:"
1378
 
                ;;
1379
 
              esac
1380
 
              case "$compile_command " in
1381
 
              *" -L$dir "*) ;;
1382
 
              *) compile_command="$compile_command -L$dir";;
1383
 
              esac
1384
 
              compile_command="$compile_command -l$name"
1385
 
              deplibs="$deplibs -L$dir -l$name"
1386
 
            elif test "$hardcode_shlibpath_var" = no; then
1387
 
              case ":$compile_shlibpath:" in
1388
 
              *":$dir:"*) ;;
1389
 
              *) compile_shlibpath="$compile_shlibpath$dir:";;
1390
 
              esac
1391
 
              compile_command="$compile_command -l$name"
1392
 
              deplibs="$deplibs -l$name"
 
1868
                add="-l$name"
 
1869
              elif test "$hardcode_shlibpath_var" = yes; then
 
1870
                add_shlibpath="$dir"
 
1871
                add="-l$name"
 
1872
              else
 
1873
                lib_linked=no
 
1874
              fi
 
1875
              ;;
 
1876
            *) lib_linked=no ;;
 
1877
            esac
 
1878
 
 
1879
            if test "$lib_linked" != yes; then
 
1880
              $echo "$modename: configuration error: unsupported hardcode properties"
 
1881
              exit 1
 
1882
            fi
 
1883
 
 
1884
            if test -n "$add_shlibpath"; then
 
1885
              case :$compile_shlibpath: in
 
1886
              *":$add_shlibpath:"*) ;;
 
1887
              *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
 
1888
              esac
 
1889
            fi
 
1890
            if test $linkmode = prog; then
 
1891
              test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
 
1892
              test -n "$add" && compile_deplibs="$add $compile_deplibs"
1393
1893
            else
1394
 
              lib_linked=no
 
1894
              test -n "$add_dir" && deplibs="$add_dir $deplibs"
 
1895
              test -n "$add" && deplibs="$add $deplibs"
 
1896
              if test "$hardcode_direct" != yes && \
 
1897
                 test "$hardcode_minus_L" != yes && \
 
1898
                 test "$hardcode_shlibpath_var" = yes; then
 
1899
                case :$finalize_shlibpath: in
 
1900
                *":$libdir:"*) ;;
 
1901
                *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
 
1902
                esac
 
1903
              fi
1395
1904
            fi
1396
 
            ;;
 
1905
          fi
1397
1906
 
1398
 
          relink)
 
1907
          if test $linkmode = prog || test "$mode" = relink; then
 
1908
            add_shlibpath=
 
1909
            add_dir=
 
1910
            add=
 
1911
            # Finalize command for both is simple: just hardcode it.
1399
1912
            if test "$hardcode_direct" = yes; then
1400
 
              compile_command="$compile_command $absdir/$linklib"
1401
 
              deplibs="$deplibs $absdir/$linklib"
 
1913
              add="$libdir/$linklib"
1402
1914
            elif test "$hardcode_minus_L" = yes; then
1403
 
              case "$compile_command " in
1404
 
              *" -L$absdir "*) ;;
1405
 
              *) compile_command="$compile_command -L$absdir";;
1406
 
              esac
1407
 
              compile_command="$compile_command -l$name"
1408
 
              deplibs="$deplibs -L$absdir -l$name"
 
1915
              add_dir="-L$libdir"
 
1916
              add="-l$name"
1409
1917
            elif test "$hardcode_shlibpath_var" = yes; then
1410
 
              case ":$compile_shlibpath:" in
1411
 
              *":$absdir:"*) ;;
1412
 
              *) compile_shlibpath="$compile_shlibpath$absdir:";;
 
1918
              case :$finalize_shlibpath: in
 
1919
              *":$libdir:"*) ;;
 
1920
              *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
1413
1921
              esac
1414
 
              compile_command="$compile_command -l$name"
1415
 
              deplibs="$deplibs -l$name"
1416
 
            else
1417
 
              lib_linked=no
1418
 
            fi
1419
 
            ;;
1420
 
 
1421
 
          *)
1422
 
            lib_linked=no
1423
 
            ;;
1424
 
          esac
1425
 
 
1426
 
          if test "$lib_linked" != yes; then
1427
 
            $echo "$modename: configuration error: unsupported hardcode properties"
1428
 
            exit 1
1429
 
          fi
1430
 
 
1431
 
          # Finalize command for both is simple: just hardcode it.
1432
 
          if test "$hardcode_direct" = yes; then
1433
 
            finalize_command="$finalize_command $libdir/$linklib"
1434
 
          elif test "$hardcode_minus_L" = yes; then
1435
 
            case "$finalize_command " in
1436
 
            *" -L$libdir "*) ;;
1437
 
            *) finalize_command="$finalize_command -L$libdir";;
1438
 
            esac
1439
 
            finalize_command="$finalize_command -l$name"
1440
 
          elif test "$hardcode_shlibpath_var" = yes; then
1441
 
            case ":$finalize_shlibpath:" in
1442
 
            *":$libdir:"*) ;;
1443
 
            *) finalize_shlibpath="$finalize_shlibpath$libdir:";;
1444
 
            esac
1445
 
            finalize_command="$finalize_command -l$name"
1446
 
          else
1447
 
            # We cannot seem to hardcode it, guess we'll fake it.
1448
 
            case "$finalize_command " in
1449
 
            *" -L$dir "*) ;;
1450
 
            *) finalize_command="$finalize_command -L$libdir";;
1451
 
            esac
1452
 
            finalize_command="$finalize_command -l$name"
1453
 
          fi
1454
 
        else
1455
 
          # Transform directly to old archives if we don't build new libraries.
1456
 
          if test -n "$pic_flag" && test -z "$old_library"; then
1457
 
            $echo "$modename: cannot find static library for \`$arg'" 1>&2
1458
 
            exit 1
1459
 
          fi
1460
 
 
 
1922
              add="-l$name"
 
1923
            else
 
1924
              # We cannot seem to hardcode it, guess we'll fake it.
 
1925
              add_dir="-L$libdir"
 
1926
              # Try looking first in the location we're being installed to.
 
1927
              if test -n "$inst_prefix_dir"; then
 
1928
                case "$libdir" in
 
1929
                [\/]*)
 
1930
                  add_dir="-L$inst_prefix_dir$libdir $add_dir"
 
1931
                  ;;
 
1932
                esac
 
1933
              fi
 
1934
              add="-l$name"
 
1935
            fi
 
1936
 
 
1937
            if test $linkmode = prog; then
 
1938
              test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
 
1939
              test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
 
1940
            else
 
1941
              test -n "$add_dir" && deplibs="$add_dir $deplibs"
 
1942
              test -n "$add" && deplibs="$add $deplibs"
 
1943
            fi
 
1944
          fi
 
1945
        elif test $linkmode = prog; then
 
1946
          if test "$alldeplibs" = yes &&
 
1947
             { test "$deplibs_check_method" = pass_all ||
 
1948
               { test "$build_libtool_libs" = yes &&
 
1949
                 test -n "$library_names"; }; }; then
 
1950
            # We only need to search for static libraries
 
1951
            continue
 
1952
          fi
 
1953
 
 
1954
          # Try to link the static library
1461
1955
          # Here we assume that one of hardcode_direct or hardcode_minus_L
1462
1956
          # is not unsupported.  This is valid on all known static and
1463
1957
          # shared platforms.
1464
1958
          if test "$hardcode_direct" != unsupported; then
1465
1959
            test -n "$old_library" && linklib="$old_library"
1466
 
            compile_command="$compile_command $dir/$linklib"
1467
 
            finalize_command="$finalize_command $dir/$linklib"
1468
 
          else
1469
 
            case "$compile_command " in
1470
 
            *" -L$dir "*) ;;
1471
 
            *) compile_command="$compile_command -L$dir";;
1472
 
            esac
1473
 
            compile_command="$compile_command -l$name"
1474
 
            case "$finalize_command " in
1475
 
            *" -L$dir "*) ;;
1476
 
            *) finalize_command="$finalize_command -L$dir";;
1477
 
            esac
1478
 
            finalize_command="$finalize_command -l$name"
1479
 
          fi
1480
 
        fi
1481
 
 
1482
 
        # Add in any libraries that this one depends upon.
1483
 
        compile_command="$compile_command$dependency_libs"
1484
 
        finalize_command="$finalize_command$dependency_libs"
1485
 
        continue
1486
 
        ;;
1487
 
 
1488
 
      # Some other compiler argument.
1489
 
      *)
1490
 
        # Unknown arguments in both finalize_command and compile_command need
1491
 
        # to be aesthetically quoted because they are evaled later.
1492
 
        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1493
 
        case "$arg" in
1494
 
        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*)
1495
 
          arg="\"$arg\""
1496
 
          ;;
1497
 
        esac
1498
 
        ;;
1499
 
      esac
1500
 
 
1501
 
      # Now actually substitute the argument into the commands.
1502
 
      if test -n "$arg"; then
1503
 
        compile_command="$compile_command $arg"
1504
 
        finalize_command="$finalize_command $arg"
1505
 
      fi
1506
 
    done
1507
 
 
1508
 
    if test -n "$prev"; then
1509
 
      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1510
 
      $echo "$help" 1>&2
1511
 
      exit 1
1512
 
    fi
1513
 
 
1514
 
    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1515
 
      eval arg=\"$export_dynamic_flag_spec\"
1516
 
      compile_command="$compile_command $arg"
1517
 
      finalize_command="$finalize_command $arg"
1518
 
    fi
1519
 
 
1520
 
    oldlibs=
1521
 
    # calculate the name of the file, without its directory
1522
 
    outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1523
 
    libobjs_save="$libobjs"
1524
 
 
1525
 
    case "$output" in
1526
 
    "")
1527
 
      $echo "$modename: you must specify an output file" 1>&2
1528
 
      $echo "$help" 1>&2
1529
 
      exit 1
1530
 
      ;;
1531
 
 
1532
 
    *.a | *.lib)
1533
 
      if test -n "$link_against_libtool_libs"; then
1534
 
        $echo "$modename: error: cannot link libtool libraries into archives" 1>&2
1535
 
        exit 1
1536
 
      fi
1537
 
 
1538
 
      if test -n "$deplibs"; then
1539
 
        $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
1540
 
      fi
1541
 
 
 
1960
            compile_deplibs="$dir/$linklib $compile_deplibs"
 
1961
            finalize_deplibs="$dir/$linklib $finalize_deplibs"
 
1962
          else
 
1963
            compile_deplibs="-l$name -L$dir $compile_deplibs"
 
1964
            finalize_deplibs="-l$name -L$dir $finalize_deplibs"
 
1965
          fi
 
1966
        elif test "$build_libtool_libs" = yes; then
 
1967
          # Not a shared library
 
1968
          if test "$deplibs_check_method" != pass_all; then
 
1969
            # We're trying link a shared library against a static one
 
1970
            # but the system doesn't support it.
 
1971
 
 
1972
            # Just print a warning and add the library to dependency_libs so
 
1973
            # that the program can be linked against the static library.
 
1974
            echo
 
1975
            echo "*** Warning: This system can not link to static lib archive $lib."
 
1976
            echo "*** I have the capability to make that library automatically link in when"
 
1977
            echo "*** you link to this library.  But I can only do this if you have a"
 
1978
            echo "*** shared version of the library, which you do not appear to have."
 
1979
            if test "$module" = yes; then
 
1980
              echo "*** But as you try to build a module library, libtool will still create "
 
1981
              echo "*** a static module, that should work as long as the dlopening application"
 
1982
              echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
 
1983
              if test -z "$global_symbol_pipe"; then
 
1984
                echo
 
1985
                echo "*** However, this would only work if libtool was able to extract symbol"
 
1986
                echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
 
1987
                echo "*** not find such a program.  So, this module is probably useless."
 
1988
                echo "*** \`nm' from GNU binutils and a full rebuild may help."
 
1989
              fi
 
1990
              if test "$build_old_libs" = no; then
 
1991
                build_libtool_libs=module
 
1992
                build_old_libs=yes
 
1993
              else
 
1994
                build_libtool_libs=no
 
1995
              fi
 
1996
            fi
 
1997
          else
 
1998
            convenience="$convenience $dir/$old_library"
 
1999
            old_convenience="$old_convenience $dir/$old_library"
 
2000
            deplibs="$dir/$old_library $deplibs"
 
2001
            link_static=yes
 
2002
          fi
 
2003
        fi # link shared/static library?
 
2004
 
 
2005
        if test $linkmode = lib; then
 
2006
          if test -n "$dependency_libs" &&
 
2007
             { test $hardcode_into_libs != yes || test $build_old_libs = yes ||
 
2008
               test $link_static = yes; }; then
 
2009
            # Extract -R from dependency_libs
 
2010
            temp_deplibs=
 
2011
            for libdir in $dependency_libs; do
 
2012
              case $libdir in
 
2013
              -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
 
2014
                   case " $xrpath " in
 
2015
                   *" $temp_xrpath "*) ;;
 
2016
                   *) xrpath="$xrpath $temp_xrpath";;
 
2017
                   esac;;
 
2018
              *) temp_deplibs="$temp_deplibs $libdir";;
 
2019
              esac
 
2020
            done
 
2021
            dependency_libs="$temp_deplibs"
 
2022
          fi
 
2023
 
 
2024
          newlib_search_path="$newlib_search_path $absdir"
 
2025
          # Link against this library
 
2026
          test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
 
2027
          # ... and its dependency_libs
 
2028
          tmp_libs=
 
2029
          for deplib in $dependency_libs; do
 
2030
            newdependency_libs="$deplib $newdependency_libs"
 
2031
            if test "X$duplicate_deps" = "Xyes" ; then
 
2032
              case "$tmp_libs " in
 
2033
              *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
 
2034
              esac
 
2035
            fi
 
2036
            tmp_libs="$tmp_libs $deplib"
 
2037
          done
 
2038
 
 
2039
          if test $link_all_deplibs != no; then
 
2040
            # Add the search paths of all dependency libraries
 
2041
            for deplib in $dependency_libs; do
 
2042
              case $deplib in
 
2043
              -L*) path="$deplib" ;;
 
2044
              *.la)
 
2045
                dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
 
2046
                test "X$dir" = "X$deplib" && dir="."
 
2047
                # We need an absolute path.
 
2048
                case $dir in
 
2049
                [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
 
2050
                *)
 
2051
                  absdir=`cd "$dir" && pwd`
 
2052
                  if test -z "$absdir"; then
 
2053
                    $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
 
2054
                    absdir="$dir"
 
2055
                  fi
 
2056
                  ;;
 
2057
                esac
 
2058
                if grep "^installed=no" $deplib > /dev/null; then
 
2059
                  path="-L$absdir/$objdir"
 
2060
                else
 
2061
                  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
 
2062
                  if test -z "$libdir"; then
 
2063
                    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
 
2064
                    exit 1
 
2065
                  fi
 
2066
                  if test "$absdir" != "$libdir"; then
 
2067
                    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
 
2068
                  fi
 
2069
                  path="-L$absdir"
 
2070
                fi
 
2071
                ;;
 
2072
              *) continue ;;
 
2073
              esac
 
2074
              case " $deplibs " in
 
2075
              *" $path "*) ;;
 
2076
              *) deplibs="$deplibs $path" ;;
 
2077
              esac
 
2078
            done
 
2079
          fi # link_all_deplibs != no
 
2080
        fi # linkmode = lib
 
2081
      done # for deplib in $libs
 
2082
      if test $pass = dlpreopen; then
 
2083
        # Link the dlpreopened libraries before other libraries
 
2084
        for deplib in $save_deplibs; do
 
2085
          deplibs="$deplib $deplibs"
 
2086
        done
 
2087
      fi
 
2088
      if test $pass != dlopen; then
 
2089
        test $pass != scan && dependency_libs="$newdependency_libs"
 
2090
        if test $pass != conv; then
 
2091
          # Make sure lib_search_path contains only unique directories.
 
2092
          lib_search_path=
 
2093
          for dir in $newlib_search_path; do
 
2094
            case "$lib_search_path " in
 
2095
            *" $dir "*) ;;
 
2096
            *) lib_search_path="$lib_search_path $dir" ;;
 
2097
            esac
 
2098
          done
 
2099
          newlib_search_path=
 
2100
        fi
 
2101
 
 
2102
        if test "$linkmode,$pass" != "prog,link"; then
 
2103
          vars="deplibs"
 
2104
        else
 
2105
          vars="compile_deplibs finalize_deplibs"
 
2106
        fi
 
2107
        for var in $vars dependency_libs; do
 
2108
          # Add libraries to $var in reverse order
 
2109
          eval tmp_libs=\"\$$var\"
 
2110
          new_libs=
 
2111
          for deplib in $tmp_libs; do
 
2112
            case $deplib in
 
2113
            -L*) new_libs="$deplib $new_libs" ;;
 
2114
            *)
 
2115
              case " $specialdeplibs " in
 
2116
              *" $deplib "*) new_libs="$deplib $new_libs" ;;
 
2117
              *)
 
2118
                case " $new_libs " in
 
2119
                *" $deplib "*) ;;
 
2120
                *) new_libs="$deplib $new_libs" ;;
 
2121
                esac
 
2122
                ;;
 
2123
              esac
 
2124
              ;;
 
2125
            esac
 
2126
          done
 
2127
          tmp_libs=
 
2128
          for deplib in $new_libs; do
 
2129
            case $deplib in
 
2130
            -L*)
 
2131
              case " $tmp_libs " in
 
2132
              *" $deplib "*) ;;
 
2133
              *) tmp_libs="$tmp_libs $deplib" ;;
 
2134
              esac
 
2135
              ;;
 
2136
            *) tmp_libs="$tmp_libs $deplib" ;;
 
2137
            esac
 
2138
          done
 
2139
          eval $var=\"$tmp_libs\"
 
2140
        done # for var
 
2141
      fi
 
2142
      if test "$pass" = "conv" &&
 
2143
       { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then
 
2144
        libs="$deplibs" # reset libs
 
2145
        deplibs=
 
2146
      fi
 
2147
    done # for pass
 
2148
    if test $linkmode = prog; then
 
2149
      dlfiles="$newdlfiles"
 
2150
      dlprefiles="$newdlprefiles"
 
2151
    fi
 
2152
 
 
2153
    case $linkmode in
 
2154
    oldlib)
1542
2155
      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
1543
2156
        $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
1544
2157
      fi
1566
2179
      # Now set the variables for building old libraries.
1567
2180
      build_libtool_libs=no
1568
2181
      oldlibs="$output"
 
2182
      objs="$objs$old_deplibs"
1569
2183
      ;;
1570
2184
 
1571
 
    *.la)
 
2185
    lib)
1572
2186
      # Make sure we only generate libraries of the form `libNAME.la'.
1573
 
      case "$outputname" in
 
2187
      case $outputname in
1574
2188
      lib*)
1575
2189
        name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
1576
2190
        eval libname=\"$libname_spec\"
1591
2205
        ;;
1592
2206
      esac
1593
2207
 
1594
 
      output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1595
 
      if test "X$output_objdir" = "X$output"; then
1596
 
        output_objdir="$objdir"
1597
 
      else
1598
 
        output_objdir="$output_objdir/$objdir"
1599
 
      fi
1600
 
 
1601
2208
      if test -n "$objs"; then
1602
 
        $echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1
1603
 
        exit 1
1604
 
      fi
1605
 
 
1606
 
      # How the heck are we supposed to write a wrapper for a shared library?
1607
 
      if test -n "$link_against_libtool_libs"; then
1608
 
         $echo "$modename: error: cannot link shared libraries into libtool libraries" 1>&2
1609
 
         exit 1
1610
 
      fi
1611
 
 
1612
 
      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
1613
 
        $echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2
 
2209
        if test "$deplibs_check_method" != pass_all; then
 
2210
          $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
 
2211
          exit 1
 
2212
        else
 
2213
          echo
 
2214
          echo "*** Warning: Linking the shared library $output against the non-libtool"
 
2215
          echo "*** objects $objs is not portable!"
 
2216
          libobjs="$libobjs $objs"
 
2217
        fi
 
2218
      fi
 
2219
 
 
2220
      if test "$dlself" != no; then
 
2221
        $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
1614
2222
      fi
1615
2223
 
1616
2224
      set dummy $rpath
1628
2236
          build_libtool_libs=convenience
1629
2237
          build_old_libs=yes
1630
2238
        fi
1631
 
        dependency_libs="$deplibs"
1632
2239
 
1633
2240
        if test -n "$vinfo"; then
1634
2241
          $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
1640
2247
      else
1641
2248
 
1642
2249
        # Parse the version information argument.
1643
 
        IFS="${IFS=     }"; save_ifs="$IFS"; IFS=':'
 
2250
        save_ifs="$IFS"; IFS=':'
1644
2251
        set dummy $vinfo 0 0 0
1645
2252
        IFS="$save_ifs"
1646
2253
 
1655
2262
        age="$4"
1656
2263
 
1657
2264
        # Check that each of the things are valid numbers.
1658
 
        case "$current" in
1659
 
        [0-9]*) ;;
 
2265
        case $current in
 
2266
        0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
1660
2267
        *)
1661
2268
          $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
1662
2269
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
1664
2271
          ;;
1665
2272
        esac
1666
2273
 
1667
 
        case "$revision" in
1668
 
        [0-9]*) ;;
 
2274
        case $revision in
 
2275
        0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
1669
2276
        *)
1670
2277
          $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
1671
2278
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
1673
2280
          ;;
1674
2281
        esac
1675
2282
 
1676
 
        case "$age" in
1677
 
        [0-9]*) ;;
 
2283
        case $age in
 
2284
        0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
1678
2285
        *)
1679
2286
          $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
1680
2287
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
1692
2299
        major=
1693
2300
        versuffix=
1694
2301
        verstring=
1695
 
        case "$version_type" in
 
2302
        case $version_type in
1696
2303
        none) ;;
1697
2304
 
1698
 
        irix)
 
2305
        darwin)
 
2306
          # Like Linux, but with the current version available in
 
2307
          # verstring for coding it into the library header
 
2308
          major=.`expr $current - $age`
 
2309
          versuffix="$major.$age.$revision"
 
2310
          # Darwin ld doesn't like 0 for these options...
 
2311
          minor_current=`expr $current + 1`
 
2312
          verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
 
2313
          ;;
 
2314
 
 
2315
        freebsd-aout)
 
2316
          major=".$current"
 
2317
          versuffix=".$current.$revision";
 
2318
          ;;
 
2319
 
 
2320
        freebsd-elf)
 
2321
          major=".$current"
 
2322
          versuffix=".$current";
 
2323
          ;;
 
2324
 
 
2325
        irix | nonstopux)
1699
2326
          major=`expr $current - $age + 1`
1700
 
          versuffix="$major.$revision"
1701
 
          verstring="sgi$major.$revision"
 
2327
 
 
2328
          case $version_type in
 
2329
            nonstopux) verstring_prefix=nonstopux ;;
 
2330
            *)         verstring_prefix=sgi ;;
 
2331
          esac
 
2332
          verstring="$verstring_prefix$major.$revision"
1702
2333
 
1703
2334
          # Add in all the interfaces that we are compatible with.
1704
2335
          loop=$revision
1705
2336
          while test $loop != 0; do
1706
2337
            iface=`expr $revision - $loop`
1707
2338
            loop=`expr $loop - 1`
1708
 
            verstring="sgi$major.$iface:$verstring"
 
2339
            verstring="$verstring_prefix$major.$iface:$verstring"
1709
2340
          done
 
2341
 
 
2342
          # Before this point, $major must not contain `.'.
 
2343
          major=.$major
 
2344
          versuffix="$major.$revision"
1710
2345
          ;;
1711
2346
 
1712
2347
        linux)
1715
2350
          ;;
1716
2351
 
1717
2352
        osf)
1718
 
          major=`expr $current - $age`
 
2353
          major=.`expr $current - $age`
1719
2354
          versuffix=".$current.$age.$revision"
1720
2355
          verstring="$current.$age.$revision"
1721
2356
 
1736
2371
          versuffix=".$current.$revision"
1737
2372
          ;;
1738
2373
 
1739
 
        freebsd-aout)
1740
 
          major=".$current"
1741
 
          versuffix=".$current.$revision";
1742
 
          ;;
1743
 
 
1744
 
        freebsd-elf)
1745
 
          major=".$current"
1746
 
          versuffix=".$current";
1747
 
          ;;
1748
 
 
1749
2374
        windows)
1750
 
          # Like Linux, but with '-' rather than '.', since we only
1751
 
          # want one extension on Windows 95.
 
2375
          # Use '-' rather than '.', since we only want one
 
2376
          # extension on DOS 8.3 filesystems.
1752
2377
          major=`expr $current - $age`
1753
 
          versuffix="-$major-$age-$revision"
 
2378
          versuffix="-$major"
1754
2379
          ;;
1755
2380
 
1756
2381
        *)
1764
2389
        if test -z "$vinfo" && test -n "$release"; then
1765
2390
          major=
1766
2391
          verstring="0.0"
 
2392
          case $version_type in
 
2393
          darwin)
 
2394
            # we can't check for "0.0" in archive_cmds due to quoting
 
2395
            # problems, so we reset it completely
 
2396
            verstring=""
 
2397
            ;;
 
2398
          *)
 
2399
            verstring="0.0"
 
2400
            ;;
 
2401
          esac
1767
2402
          if test "$need_version" = no; then
1768
2403
            versuffix=
1769
2404
          else
1777
2412
          versuffix=
1778
2413
          verstring=""
1779
2414
        fi
1780
 
        
 
2415
 
1781
2416
        # Check to see if the archive will have undefined symbols.
1782
2417
        if test "$allow_undefined" = yes; then
1783
2418
          if test "$allow_undefined_flag" = unsupported; then
1789
2424
          # Don't allow undefined symbols.
1790
2425
          allow_undefined_flag="$no_undefined_flag"
1791
2426
        fi
1792
 
 
1793
 
        dependency_libs="$deplibs"
1794
 
        case "$host" in
1795
 
        *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
1796
 
          # these systems don't actually have a c library (as such)!
1797
 
          ;;
1798
 
        *-*-rhapsody*)
1799
 
          # rhapsody is a little odd...
1800
 
          deplibs="$deplibs -framework System"
1801
 
          ;;
1802
 
        *)
1803
 
          # Add libc to deplibs on all other systems.
1804
 
          deplibs="$deplibs -lc"
1805
 
          ;;
1806
 
        esac
1807
2427
      fi
1808
2428
 
1809
 
      # Create the output directory, or remove our outputs if we need to.
1810
 
      if test -d $output_objdir; then
 
2429
      if test "$mode" != relink; then
 
2430
        # Remove our outputs.
1811
2431
        $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
1812
2432
        $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
1813
 
      else
1814
 
        $show "$mkdir $output_objdir"
1815
 
        $run $mkdir $output_objdir
1816
 
        status=$?
1817
 
        if test $status -ne 0 && test ! -d $output_objdir; then
1818
 
          exit $status
1819
 
        fi
1820
2433
      fi
1821
2434
 
1822
2435
      # Now set the variables for building old libraries.
1827
2440
        oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
1828
2441
      fi
1829
2442
 
 
2443
      # Eliminate all temporary directories.
 
2444
      for path in $notinst_path; do
 
2445
        lib_search_path=`echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
 
2446
        deplibs=`echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
 
2447
        dependency_libs=`echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
 
2448
      done
 
2449
 
 
2450
      if test -n "$xrpath"; then
 
2451
        # If the user specified any rpath flags, then add them.
 
2452
        temp_xrpath=
 
2453
        for libdir in $xrpath; do
 
2454
          temp_xrpath="$temp_xrpath -R$libdir"
 
2455
          case "$finalize_rpath " in
 
2456
          *" $libdir "*) ;;
 
2457
          *) finalize_rpath="$finalize_rpath $libdir" ;;
 
2458
          esac
 
2459
        done
 
2460
        if test $hardcode_into_libs != yes || test $build_old_libs = yes; then
 
2461
          dependency_libs="$temp_xrpath $dependency_libs"
 
2462
        fi
 
2463
      fi
 
2464
 
 
2465
      # Make sure dlfiles contains only unique files that won't be dlpreopened
 
2466
      old_dlfiles="$dlfiles"
 
2467
      dlfiles=
 
2468
      for lib in $old_dlfiles; do
 
2469
        case " $dlprefiles $dlfiles " in
 
2470
        *" $lib "*) ;;
 
2471
        *) dlfiles="$dlfiles $lib" ;;
 
2472
        esac
 
2473
      done
 
2474
 
 
2475
      # Make sure dlprefiles contains only unique files
 
2476
      old_dlprefiles="$dlprefiles"
 
2477
      dlprefiles=
 
2478
      for lib in $old_dlprefiles; do
 
2479
        case "$dlprefiles " in
 
2480
        *" $lib "*) ;;
 
2481
        *) dlprefiles="$dlprefiles $lib" ;;
 
2482
        esac
 
2483
      done
 
2484
 
1830
2485
      if test "$build_libtool_libs" = yes; then
 
2486
        if test -n "$rpath"; then
 
2487
          case $host in
 
2488
          *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
 
2489
            # these systems don't actually have a c library (as such)!
 
2490
            ;;
 
2491
          *-*-rhapsody* | *-*-darwin1.[012])
 
2492
            # Rhapsody C library is in the System framework
 
2493
            deplibs="$deplibs -framework System"
 
2494
            ;;
 
2495
          *-*-netbsd*)
 
2496
            # Don't link with libc until the a.out ld.so is fixed.
 
2497
            ;;
 
2498
          *-*-openbsd* | *-*-freebsd*)
 
2499
            # Do not include libc due to us having libc/libc_r.
 
2500
            ;;
 
2501
          *)
 
2502
            # Add libc to deplibs on all other systems if necessary.
 
2503
            if test $build_libtool_need_lc = "yes"; then
 
2504
              deplibs="$deplibs -lc"
 
2505
            fi
 
2506
            ;;
 
2507
          esac
 
2508
        fi
 
2509
 
1831
2510
        # Transform deplibs into only deplibs that can be linked in shared.
1832
2511
        name_save=$name
1833
2512
        libname_save=$libname
1842
2521
        major=""
1843
2522
        newdeplibs=
1844
2523
        droppeddeps=no
1845
 
        case "$deplibs_check_method" in
 
2524
        case $deplibs_check_method in
1846
2525
        pass_all)
1847
2526
          # Don't check for shared/static.  Everything works.
1848
2527
          # This might be a little naive.  We might want to check
1867
2546
            for i in $deplibs; do
1868
2547
              name="`expr $i : '-l\(.*\)'`"
1869
2548
              # If $name is empty we are operating on a -L argument.
1870
 
              if test "$name" != "" ; then
 
2549
              if test -n "$name" && test "$name" != "0"; then
1871
2550
                libname=`eval \\$echo \"$libname_spec\"`
1872
2551
                deplib_matches=`eval \\$echo \"$library_names_spec\"`
1873
2552
                set dummy $deplib_matches
1877
2556
                else
1878
2557
                  droppeddeps=yes
1879
2558
                  echo
1880
 
                  echo "*** Warning: This library needs some functionality provided by $i."
 
2559
                  echo "*** Warning: dynamic linker does not accept needed library $i."
1881
2560
                  echo "*** I have the capability to make that library automatically link in when"
1882
2561
                  echo "*** you link to this library.  But I can only do this if you have a"
1883
 
                  echo "*** shared version of the library, which you do not appear to have."
 
2562
                  echo "*** shared version of the library, which I believe you do not have"
 
2563
                  echo "*** because a test_compile did reveal that the linker did not use it for"
 
2564
                  echo "*** its dynamic dependency list that programs get resolved with at runtime."
1884
2565
                fi
1885
2566
              else
1886
2567
                newdeplibs="$newdeplibs $i"
1887
2568
              fi
1888
2569
            done
1889
2570
          else
1890
 
            # Error occured in the first compile.  Let's try to salvage the situation:
1891
 
            # Compile a seperate program for each library.
 
2571
            # Error occured in the first compile.  Let's try to salvage
 
2572
            # the situation: Compile a separate program for each library.
1892
2573
            for i in $deplibs; do
1893
2574
              name="`expr $i : '-l\(.*\)'`"
1894
2575
             # If $name is empty we are operating on a -L argument.
1895
 
              if test "$name" != "" ; then
 
2576
              if test -n "$name" && test "$name" != "0"; then
1896
2577
                $rm conftest
1897
2578
                $CC -o conftest conftest.c $i
1898
2579
                # Did it work?
1907
2588
                  else
1908
2589
                    droppeddeps=yes
1909
2590
                    echo
1910
 
                    echo "*** Warning: This library needs some functionality provided by $i."
 
2591
                    echo "*** Warning: dynamic linker does not accept needed library $i."
1911
2592
                    echo "*** I have the capability to make that library automatically link in when"
1912
2593
                    echo "*** you link to this library.  But I can only do this if you have a"
1913
 
                    echo "*** shared version of the library, which you do not appear to have."
 
2594
                    echo "*** shared version of the library, which you do not appear to have"
 
2595
                    echo "*** because a test_compile did reveal that the linker did not use this one"
 
2596
                    echo "*** as a dynamic dependency that programs can get resolved with at runtime."
1914
2597
                  fi
1915
2598
                else
1916
2599
                  droppeddeps=yes
1928
2611
          ;;
1929
2612
        file_magic*)
1930
2613
          set dummy $deplibs_check_method
1931
 
          file_magic_regex="`expr \"$deplibs_check_method\" : \"$2 \(.*\)\"`"
 
2614
          file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
1932
2615
          for a_deplib in $deplibs; do
1933
2616
            name="`expr $a_deplib : '-l\(.*\)'`"
1934
2617
            # If $name is empty we are operating on a -L argument.
1935
 
            if test "$name" != "" ; then
 
2618
            if test -n "$name" && test "$name" != "0"; then
1936
2619
              libname=`eval \\$echo \"$libname_spec\"`
1937
 
              for i in $lib_search_path; do
 
2620
              for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
1938
2621
                    potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
1939
2622
                    for potent_lib in $potential_libs; do
1940
2623
                      # Follow soft links.
1941
2624
                      if ls -lLd "$potent_lib" 2>/dev/null \
1942
2625
                         | grep " -> " >/dev/null; then
1943
 
                        continue 
 
2626
                        continue
1944
2627
                      fi
1945
2628
                      # The statement above tries to avoid entering an
1946
2629
                      # endless loop below, in case of cyclic links.
1949
2632
                      # but so what?
1950
2633
                      potlib="$potent_lib"
1951
2634
                      while test -h "$potlib" 2>/dev/null; do
1952
 
                        potliblink=`ls -ld $potlib | sed 's/.* -> //'`
1953
 
                        case "$potliblink" in
 
2635
                        potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
 
2636
                        case $potliblink in
1954
2637
                        [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
1955
2638
                        *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
1956
2639
                        esac
1957
2640
                      done
1958
2641
                      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
1959
 
                         | sed 10q \
 
2642
                         | ${SED} 10q \
1960
2643
                         | egrep "$file_magic_regex" > /dev/null; then
1961
2644
                        newdeplibs="$newdeplibs $a_deplib"
1962
2645
                        a_deplib=""
1967
2650
              if test -n "$a_deplib" ; then
1968
2651
                droppeddeps=yes
1969
2652
                echo
1970
 
                echo "*** Warning: This library needs some functionality provided by $a_deplib."
1971
 
                echo "*** I have the capability to make that library automatically link in when"
1972
 
                echo "*** you link to this library.  But I can only do this if you have a"
1973
 
                echo "*** shared version of the library, which you do not appear to have."
 
2653
                echo "*** Warning: linker path does not have real file for library $a_deplib."
 
2654
                echo "*** I have the capability to make that library automatically link in when"
 
2655
                echo "*** you link to this library.  But I can only do this if you have a"
 
2656
                echo "*** shared version of the library, which you do not appear to have"
 
2657
                echo "*** because I did check the linker path looking for a file starting"
 
2658
                if test -z "$potlib" ; then
 
2659
                  echo "*** with $libname but no candidates were found. (...for file magic test)"
 
2660
                else
 
2661
                  echo "*** with $libname and none of the candidates passed a file format test"
 
2662
                  echo "*** using a file magic. Last file checked: $potlib"
 
2663
                fi
 
2664
              fi
 
2665
            else
 
2666
              # Add a -L argument.
 
2667
              newdeplibs="$newdeplibs $a_deplib"
 
2668
            fi
 
2669
          done # Gone through all deplibs.
 
2670
          ;;
 
2671
        match_pattern*)
 
2672
          set dummy $deplibs_check_method
 
2673
          match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
 
2674
          for a_deplib in $deplibs; do
 
2675
            name="`expr $a_deplib : '-l\(.*\)'`"
 
2676
            # If $name is empty we are operating on a -L argument.
 
2677
            if test -n "$name" && test "$name" != "0"; then
 
2678
              libname=`eval \\$echo \"$libname_spec\"`
 
2679
              for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
 
2680
                potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
 
2681
                for potent_lib in $potential_libs; do
 
2682
                  potlib="$potent_lib" # see symlink-check below in file_magic test
 
2683
                  if eval echo \"$potent_lib\" 2>/dev/null \
 
2684
                      | ${SED} 10q \
 
2685
                      | egrep "$match_pattern_regex" > /dev/null; then
 
2686
                    newdeplibs="$newdeplibs $a_deplib"
 
2687
                    a_deplib=""
 
2688
                    break 2
 
2689
                  fi
 
2690
                done
 
2691
              done
 
2692
              if test -n "$a_deplib" ; then
 
2693
                droppeddeps=yes
 
2694
                echo
 
2695
                echo "*** Warning: linker path does not have real file for library $a_deplib."
 
2696
                echo "*** I have the capability to make that library automatically link in when"
 
2697
                echo "*** you link to this library.  But I can only do this if you have a"
 
2698
                echo "*** shared version of the library, which you do not appear to have"
 
2699
                echo "*** because I did check the linker path looking for a file starting"
 
2700
                if test -z "$potlib" ; then
 
2701
                  echo "*** with $libname but no candidates were found. (...for regex pattern test)"
 
2702
                else
 
2703
                  echo "*** with $libname and none of the candidates passed a file format test"
 
2704
                  echo "*** using a regex pattern. Last file checked: $potlib"
 
2705
                fi
1974
2706
              fi
1975
2707
            else
1976
2708
              # Add a -L argument.
2000
2732
        libname=$libname_save
2001
2733
        name=$name_save
2002
2734
 
 
2735
        case $host in
 
2736
        *-*-rhapsody* | *-*-darwin1.[012])
 
2737
          # On Rhapsody replace the C library is the System framework
 
2738
          newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
 
2739
          ;;
 
2740
        esac
 
2741
 
2003
2742
        if test "$droppeddeps" = yes; then
2004
2743
          if test "$module" = yes; then
2005
2744
            echo
2025
2764
            echo "*** The inter-library dependencies that have been dropped here will be"
2026
2765
            echo "*** automatically added whenever a program is linked with this library"
2027
2766
            echo "*** or is declared to -dlopen it."
 
2767
 
 
2768
            if test $allow_undefined = no; then
 
2769
              echo
 
2770
              echo "*** Since this library must not contain undefined symbols,"
 
2771
              echo "*** because either the platform does not support them or"
 
2772
              echo "*** it was explicitly requested with -no-undefined,"
 
2773
              echo "*** libtool will only create a static version of it."
 
2774
              if test "$build_old_libs" = no; then
 
2775
                oldlibs="$output_objdir/$libname.$libext"
 
2776
                build_libtool_libs=module
 
2777
                build_old_libs=yes
 
2778
              else
 
2779
                build_libtool_libs=no
 
2780
              fi
 
2781
            fi
2028
2782
          fi
2029
2783
        fi
2030
2784
        # Done checking deplibs!
2035
2789
      library_names=
2036
2790
      old_library=
2037
2791
      dlname=
2038
 
      
 
2792
 
2039
2793
      # Test again, we may have decided not to build it any more
2040
2794
      if test "$build_libtool_libs" = yes; then
 
2795
        if test $hardcode_into_libs = yes; then
 
2796
          # Hardcode the library paths
 
2797
          hardcode_libdirs=
 
2798
          dep_rpath=
 
2799
          rpath="$finalize_rpath"
 
2800
          test "$mode" != relink && rpath="$compile_rpath$rpath"
 
2801
          for libdir in $rpath; do
 
2802
            if test -n "$hardcode_libdir_flag_spec"; then
 
2803
              if test -n "$hardcode_libdir_separator"; then
 
2804
                if test -z "$hardcode_libdirs"; then
 
2805
                  hardcode_libdirs="$libdir"
 
2806
                else
 
2807
                  # Just accumulate the unique libdirs.
 
2808
                  case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
 
2809
                  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
 
2810
                    ;;
 
2811
                  *)
 
2812
                    hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
 
2813
                    ;;
 
2814
                  esac
 
2815
                fi
 
2816
              else
 
2817
                eval flag=\"$hardcode_libdir_flag_spec\"
 
2818
                dep_rpath="$dep_rpath $flag"
 
2819
              fi
 
2820
            elif test -n "$runpath_var"; then
 
2821
              case "$perm_rpath " in
 
2822
              *" $libdir "*) ;;
 
2823
              *) perm_rpath="$perm_rpath $libdir" ;;
 
2824
              esac
 
2825
            fi
 
2826
          done
 
2827
          # Substitute the hardcoded libdirs into the rpath.
 
2828
          if test -n "$hardcode_libdir_separator" &&
 
2829
             test -n "$hardcode_libdirs"; then
 
2830
            libdir="$hardcode_libdirs"
 
2831
            eval dep_rpath=\"$hardcode_libdir_flag_spec\"
 
2832
          fi
 
2833
          if test -n "$runpath_var" && test -n "$perm_rpath"; then
 
2834
            # We should set the runpath_var.
 
2835
            rpath=
 
2836
            for dir in $perm_rpath; do
 
2837
              rpath="$rpath$dir:"
 
2838
            done
 
2839
            eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
 
2840
          fi
 
2841
          test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
 
2842
        fi
 
2843
 
 
2844
        shlibpath="$finalize_shlibpath"
 
2845
        test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
 
2846
        if test -n "$shlibpath"; then
 
2847
          eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
 
2848
        fi
 
2849
 
2041
2850
        # Get the real and link names of the library.
2042
2851
        eval library_names=\"$library_names_spec\"
2043
2852
        set dummy $library_names
2049
2858
        else
2050
2859
          soname="$realname"
2051
2860
        fi
 
2861
        test -z "$dlname" && dlname=$soname
2052
2862
 
2053
2863
        lib="$output_objdir/$realname"
2054
2864
        for link
2083
2893
            export_symbols="$output_objdir/$libname.exp"
2084
2894
            $run $rm $export_symbols
2085
2895
            eval cmds=\"$export_symbols_cmds\"
2086
 
            IFS="${IFS=         }"; save_ifs="$IFS"; IFS='~'
 
2896
            save_ifs="$IFS"; IFS='~'
2087
2897
            for cmd in $cmds; do
2088
2898
              IFS="$save_ifs"
2089
2899
              $show "$cmd"
2120
2930
 
2121
2931
            for xlib in $convenience; do
2122
2932
              # Extract the objects.
2123
 
              case "$xlib" in
 
2933
              case $xlib in
2124
2934
              [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
2125
2935
              *) xabs=`pwd`"/$xlib" ;;
2126
2936
              esac
2145
2955
 
2146
2956
        if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
2147
2957
          eval flag=\"$thread_safe_flag_spec\"
2148
 
          linkopts="$linkopts $flag"
 
2958
          linker_flags="$linker_flags $flag"
 
2959
        fi
 
2960
 
 
2961
        # Make a backup of the uninstalled library when relinking
 
2962
        if test "$mode" = relink; then
 
2963
          $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
2149
2964
        fi
2150
2965
 
2151
2966
        # Do each of the archive commands.
2152
2967
        if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
2153
2968
          eval cmds=\"$archive_expsym_cmds\"
2154
2969
        else
 
2970
          save_deplibs="$deplibs"
 
2971
          for conv in $convenience; do
 
2972
            tmp_deplibs=
 
2973
            for test_deplib in $deplibs; do
 
2974
              if test "$test_deplib" != "$conv"; then
 
2975
                tmp_deplibs="$tmp_deplibs $test_deplib"
 
2976
              fi
 
2977
            done
 
2978
            deplibs="$tmp_deplibs"
 
2979
          done
2155
2980
          eval cmds=\"$archive_cmds\"
 
2981
          deplibs="$save_deplibs"
2156
2982
        fi
2157
 
        IFS="${IFS=     }"; save_ifs="$IFS"; IFS='~'
 
2983
        save_ifs="$IFS"; IFS='~'
2158
2984
        for cmd in $cmds; do
2159
2985
          IFS="$save_ifs"
2160
2986
          $show "$cmd"
2162
2988
        done
2163
2989
        IFS="$save_ifs"
2164
2990
 
 
2991
        # Restore the uninstalled library and exit
 
2992
        if test "$mode" = relink; then
 
2993
          $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
 
2994
          exit 0
 
2995
        fi
 
2996
 
2165
2997
        # Create links to the real library.
2166
2998
        for linkname in $linknames; do
2167
2999
          if test "$realname" != "$linkname"; then
2178
3010
      fi
2179
3011
      ;;
2180
3012
 
2181
 
    *.lo | *.o | *.obj)
2182
 
      if test -n "$link_against_libtool_libs"; then
2183
 
        $echo "$modename: error: cannot link libtool libraries into objects" 1>&2
2184
 
        exit 1
2185
 
      fi
2186
 
 
 
3013
    obj)
2187
3014
      if test -n "$deplibs"; then
2188
3015
        $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
2189
3016
      fi
2208
3035
        $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
2209
3036
      fi
2210
3037
 
2211
 
      case "$output" in
 
3038
      case $output in
2212
3039
      *.lo)
2213
 
        if test -n "$objs"; then
 
3040
        if test -n "$objs$old_deplibs"; then
2214
3041
          $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
2215
3042
          exit 1
2216
3043
        fi
2234
3061
      gentop=
2235
3062
      # reload_cmds runs $LD directly, so let us get rid of
2236
3063
      # -Wl from whole_archive_flag_spec
2237
 
      wl= 
 
3064
      wl=
2238
3065
 
2239
3066
      if test -n "$convenience"; then
2240
3067
        if test -n "$whole_archive_flag_spec"; then
2253
3080
 
2254
3081
          for xlib in $convenience; do
2255
3082
            # Extract the objects.
2256
 
            case "$xlib" in
 
3083
            case $xlib in
2257
3084
            [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
2258
3085
            *) xabs=`pwd`"/$xlib" ;;
2259
3086
            esac
2277
3104
      fi
2278
3105
 
2279
3106
      # Create the old-style object.
2280
 
      reload_objs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs"
 
3107
      reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
2281
3108
 
2282
3109
      output="$obj"
2283
3110
      eval cmds=\"$reload_cmds\"
2284
 
      IFS="${IFS=       }"; save_ifs="$IFS"; IFS='~'
 
3111
      save_ifs="$IFS"; IFS='~'
2285
3112
      for cmd in $cmds; do
2286
3113
        IFS="$save_ifs"
2287
3114
        $show "$cmd"
2312
3139
        exit 0
2313
3140
      fi
2314
3141
 
2315
 
      if test -n "$pic_flag"; then
 
3142
      if test -n "$pic_flag" || test "$pic_mode" != default; then
2316
3143
        # Only do commands if we really have different PIC objects.
2317
3144
        reload_objs="$libobjs $reload_conv_objs"
2318
3145
        output="$libobj"
2319
3146
        eval cmds=\"$reload_cmds\"
2320
 
        IFS="${IFS=     }"; save_ifs="$IFS"; IFS='~'
 
3147
        save_ifs="$IFS"; IFS='~'
2321
3148
        for cmd in $cmds; do
2322
3149
          IFS="$save_ifs"
2323
3150
          $show "$cmd"
2348
3175
      exit 0
2349
3176
      ;;
2350
3177
 
2351
 
    # Anything else should be a program.
2352
 
    *)
 
3178
    prog)
 
3179
      case $host in
 
3180
        *cygwin*) output=`echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
 
3181
      esac
2353
3182
      if test -n "$vinfo"; then
2354
3183
        $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
2355
3184
      fi
2359
3188
      fi
2360
3189
 
2361
3190
      if test "$preload" = yes; then
2362
 
        if test "$dlopen" = unknown && test "$dlopen_self" = unknown &&
 
3191
        if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
2363
3192
           test "$dlopen_self_static" = unknown; then
2364
3193
          $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
2365
 
        fi 
 
3194
        fi
2366
3195
      fi
2367
 
    
 
3196
 
 
3197
      case $host in
 
3198
      *-*-rhapsody* | *-*-darwin1.[012])
 
3199
        # On Rhapsody replace the C library is the System framework
 
3200
        compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
 
3201
        finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
 
3202
        case $host in
 
3203
        *darwin*)
 
3204
          # Don't allow lazy linking, it breaks C++ global constructors
 
3205
          compile_command="$compile_command ${wl}-bind_at_load"
 
3206
          finalize_command="$finalize_command ${wl}-bind_at_load"
 
3207
          ;;
 
3208
        esac
 
3209
        ;;
 
3210
      esac
 
3211
 
 
3212
      compile_command="$compile_command $compile_deplibs"
 
3213
      finalize_command="$finalize_command $finalize_deplibs"
 
3214
 
2368
3215
      if test -n "$rpath$xrpath"; then
2369
3216
        # If the user specified any rpath flags, then add them.
2370
3217
        for libdir in $rpath $xrpath; do
2371
3218
          # This is the magic to use -rpath.
2372
 
          case "$compile_rpath " in
2373
 
          *" $libdir "*) ;;
2374
 
          *) compile_rpath="$compile_rpath $libdir" ;;
2375
 
          esac
2376
3219
          case "$finalize_rpath " in
2377
3220
          *" $libdir "*) ;;
2378
3221
          *) finalize_rpath="$finalize_rpath $libdir" ;;
2390
3233
              hardcode_libdirs="$libdir"
2391
3234
            else
2392
3235
              # Just accumulate the unique libdirs.
2393
 
              case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
 
3236
              case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
2394
3237
              *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
2395
3238
                ;;
2396
3239
              *)
2408
3251
          *) perm_rpath="$perm_rpath $libdir" ;;
2409
3252
          esac
2410
3253
        fi
 
3254
        case $host in
 
3255
        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
 
3256
          case :$dllsearchpath: in
 
3257
          *":$libdir:"*) ;;
 
3258
          *) dllsearchpath="$dllsearchpath:$libdir";;
 
3259
          esac
 
3260
          ;;
 
3261
        esac
2411
3262
      done
2412
3263
      # Substitute the hardcoded libdirs into the rpath.
2413
3264
      if test -n "$hardcode_libdir_separator" &&
2426
3277
              hardcode_libdirs="$libdir"
2427
3278
            else
2428
3279
              # Just accumulate the unique libdirs.
2429
 
              case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
 
3280
              case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
2430
3281
              *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
2431
3282
                ;;
2432
3283
              *)
2453
3304
      fi
2454
3305
      finalize_rpath="$rpath"
2455
3306
 
2456
 
      output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
2457
 
      if test "X$output_objdir" = "X$output"; then
2458
 
        output_objdir="$objdir"
2459
 
      else
2460
 
        output_objdir="$output_objdir/$objdir"
2461
 
      fi
2462
 
 
2463
 
      # Create the binary in the object directory, then wrap it.
2464
 
      if test ! -d $output_objdir; then
2465
 
        $show "$mkdir $output_objdir"
2466
 
        $run $mkdir $output_objdir
2467
 
        status=$?
2468
 
        if test $status -ne 0 && test ! -d $output_objdir; then
2469
 
          exit $status
2470
 
        fi
2471
 
      fi
2472
 
 
2473
3307
      if test -n "$libobjs" && test "$build_old_libs" = yes; then
2474
3308
        # Transform all the library objects into standard objects.
2475
3309
        compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2486
3320
      fi
2487
3321
 
2488
3322
      if test -n "$dlsyms"; then
2489
 
        case "$dlsyms" in
 
3323
        case $dlsyms in
2490
3324
        "") ;;
2491
3325
        *.c)
2492
3326
          # Discover the nlist of each of the dlfiles.
2518
3352
            test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
2519
3353
 
2520
3354
            # Add our own program objects to the symbol list.
2521
 
            progfiles=`$echo "X$objs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
 
3355
            progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2522
3356
            for arg in $progfiles; do
2523
3357
              $show "extracting global C symbols from \`$arg'"
2524
3358
              $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
2528
3362
              $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
2529
3363
              $run eval '$mv "$nlist"T "$nlist"'
2530
3364
            fi
2531
 
            
 
3365
 
2532
3366
            if test -n "$export_symbols_regex"; then
2533
3367
              $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
2534
3368
              $run eval '$mv "$nlist"T "$nlist"'
2538
3372
            if test -z "$export_symbols"; then
2539
3373
              export_symbols="$output_objdir/$output.exp"
2540
3374
              $run $rm $export_symbols
2541
 
              $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
 
3375
              $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
2542
3376
            else
2543
 
              $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
 
3377
              $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
2544
3378
              $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
2545
3379
              $run eval 'mv "$nlist"T "$nlist"'
2546
3380
            fi
2548
3382
 
2549
3383
          for arg in $dlprefiles; do
2550
3384
            $show "extracting global C symbols from \`$arg'"
2551
 
            name=`echo "$arg" | sed -e 's%^.*/%%'`
 
3385
            name=`echo "$arg" | ${SED} -e 's%^.*/%%'`
2552
3386
            $run eval 'echo ": $name " >> "$nlist"'
2553
3387
            $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
2554
3388
          done
2563
3397
            fi
2564
3398
 
2565
3399
            # Try sorting and uniquifying the output.
2566
 
            if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
 
3400
            if grep -v "^: " < "$nlist" |
 
3401
                if sort -k 3 </dev/null >/dev/null 2>&1; then
 
3402
                  sort -k 3
 
3403
                else
 
3404
                  sort +2
 
3405
                fi |
 
3406
                uniq > "$nlist"S; then
2567
3407
              :
2568
3408
            else
2569
3409
              grep -v "^: " < "$nlist" > "$nlist"S
2580
3420
#undef lt_preloaded_symbols
2581
3421
 
2582
3422
#if defined (__STDC__) && __STDC__
2583
 
# define lt_ptr_t void *
 
3423
# define lt_ptr void *
2584
3424
#else
2585
 
# define lt_ptr_t char *
 
3425
# define lt_ptr char *
2586
3426
# define const
2587
3427
#endif
2588
3428
 
2589
3429
/* The mapping between symbol names and symbols. */
2590
3430
const struct {
2591
3431
  const char *name;
2592
 
  lt_ptr_t address;
 
3432
  lt_ptr address;
2593
3433
}
2594
3434
lt_preloaded_symbols[] =
2595
3435
{\
2596
3436
"
2597
3437
 
2598
 
            sed -n -e 's/^: \([^ ]*\) $/  {\"\1\", (lt_ptr_t) 0},/p' \
2599
 
                -e 's/^. \([^ ]*\) \([^ ]*\)$/  {"\2", (lt_ptr_t) \&\2},/p' \
2600
 
                  < "$nlist" >> "$output_objdir/$dlsyms"
 
3438
            eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
2601
3439
 
2602
3440
            $echo >> "$output_objdir/$dlsyms" "\
2603
 
  {0, (lt_ptr_t) 0}
 
3441
  {0, (lt_ptr) 0}
2604
3442
};
2605
3443
 
2606
3444
/* This works around a problem in FreeBSD linker */
2617
3455
          fi
2618
3456
 
2619
3457
          pic_flag_for_symtable=
2620
 
          case "$host" in
 
3458
          case $host in
2621
3459
          # compiling the symbol table file with pic_flag works around
2622
3460
          # a FreeBSD bug that causes programs to crash when -lm is
2623
3461
          # linked before any other PIC object.  But we must not use
2624
3462
          # pic_flag when linking with -static.  The problem exists in
2625
3463
          # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
2626
 
          *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
 
3464
          *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
2627
3465
            case "$compile_command " in
2628
3466
            *" -static "*) ;;
2629
3467
            *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
2662
3500
        finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
2663
3501
      fi
2664
3502
 
2665
 
      if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then
 
3503
      if test $need_relink = no || test "$build_libtool_libs" != yes; then
2666
3504
        # Replace the output file specification.
2667
3505
        compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
2668
3506
        link_command="$compile_command$compile_rpath"
2671
3509
        $show "$link_command"
2672
3510
        $run eval "$link_command"
2673
3511
        status=$?
2674
 
        
 
3512
 
2675
3513
        # Delete the generated files.
2676
3514
        if test -n "$dlsyms"; then
2677
3515
          $show "$rm $output_objdir/${outputname}S.${objext}"
2685
3523
        # We should set the shlibpath_var
2686
3524
        rpath=
2687
3525
        for dir in $temp_rpath; do
2688
 
          case "$dir" in
 
3526
          case $dir in
2689
3527
          [\\/]* | [A-Za-z]:[\\/]*)
2690
3528
            # Absolute path.
2691
3529
            rpath="$rpath$dir:"
2727
3565
        fi
2728
3566
      fi
2729
3567
 
 
3568
      if test "$no_install" = yes; then
 
3569
        # We don't need to create a wrapper script.
 
3570
        link_command="$compile_var$compile_command$compile_rpath"
 
3571
        # Replace the output file specification.
 
3572
        link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
 
3573
        # Delete the old output file.
 
3574
        $run $rm $output
 
3575
        # Link the executable and exit
 
3576
        $show "$link_command"
 
3577
        $run eval "$link_command" || exit $?
 
3578
        exit 0
 
3579
      fi
 
3580
 
2730
3581
      if test "$hardcode_action" = relink; then
2731
3582
        # Fast installation is not supported
2732
3583
        link_command="$compile_var$compile_command$compile_rpath"
2733
3584
        relink_command="$finalize_var$finalize_command$finalize_rpath"
2734
 
        
 
3585
 
2735
3586
        $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
2736
3587
        $echo "$modename: \`$output' will be relinked during installation" 1>&2
2737
3588
      else
2751
3602
 
2752
3603
      # Replace the output file specification.
2753
3604
      link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
2754
 
      
 
3605
 
2755
3606
      # Delete the old output files.
2756
3607
      $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
2757
3608
 
2763
3614
 
2764
3615
      # Quote the relink command for shipping.
2765
3616
      if test -n "$relink_command"; then
 
3617
        # Preserve any variables that may affect compiler behavior
 
3618
        for var in $variables_saved_for_relink; do
 
3619
          if eval test -z \"\${$var+set}\"; then
 
3620
            relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
 
3621
          elif eval var_value=\$$var; test -z "$var_value"; then
 
3622
            relink_command="$var=; export $var; $relink_command"
 
3623
          else
 
3624
            var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
 
3625
            relink_command="$var=\"$var_value\"; export $var; $relink_command"
 
3626
          fi
 
3627
        done
 
3628
        relink_command="(cd `pwd`; $relink_command)"
2766
3629
        relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
2767
3630
      fi
2768
3631
 
2769
3632
      # Quote $echo for shipping.
2770
3633
      if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
2771
 
        case "$0" in
 
3634
        case $0 in
2772
3635
        [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
2773
3636
        *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
2774
3637
        esac
2782
3645
        # win32 will think the script is a binary if it has
2783
3646
        # a .exe suffix, so we strip it off here.
2784
3647
        case $output in
2785
 
          *.exe) output=`echo $output|sed 's,.exe$,,'` ;;
 
3648
          *.exe) output=`echo $output|${SED} 's,.exe$,,'` ;;
 
3649
        esac
 
3650
        # test for cygwin because mv fails w/o .exe extensions
 
3651
        case $host in
 
3652
          *cygwin*) exeext=.exe ;;
 
3653
          *) exeext= ;;
2786
3654
        esac
2787
3655
        $rm $output
2788
3656
        trap "$rm $output; exit 1" 1 2 15
2801
3669
 
2802
3670
# Sed substitution that helps us do robust quoting.  It backslashifies
2803
3671
# metacharacters that are still active within double-quoted strings.
2804
 
Xsed='sed -e 1s/^X//'
 
3672
Xsed="${SED}"' -e 1s/^X//'
2805
3673
sed_quote_subst='$sed_quote_subst'
2806
3674
 
2807
3675
# The HP-UX ksh and POSIX shell print the target directory to stdout
2813
3681
# This environment variable determines our operation mode.
2814
3682
if test \"\$libtool_install_magic\" = \"$magic\"; then
2815
3683
  # install mode needs the following variable:
2816
 
  link_against_libtool_libs='$link_against_libtool_libs'
 
3684
  notinst_deplibs='$notinst_deplibs'
2817
3685
else
2818
3686
  # When we are sourced in execute mode, \$file and \$echo are already set.
2819
3687
  if test \"\$libtool_execute_magic\" != \"$magic\"; then
2839
3707
  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
2840
3708
 
2841
3709
  # Follow symbolic links until we get to the real thisdir.
2842
 
  file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
 
3710
  file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
2843
3711
  while test -n \"\$file\"; do
2844
3712
    destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
2845
3713
 
2846
3714
    # If there was a directory component, then change thisdir.
2847
3715
    if test \"x\$destdir\" != \"x\$file\"; then
2848
3716
      case \"\$destdir\" in
2849
 
      [\\/]* | [A-Za-z]:[\\/]*) thisdir=\"\$destdir\" ;;
 
3717
      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
2850
3718
      *) thisdir=\"\$thisdir/\$destdir\" ;;
2851
3719
      esac
2852
3720
    fi
2853
3721
 
2854
3722
    file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
2855
 
    file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
 
3723
    file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
2856
3724
  done
2857
3725
 
2858
3726
  # Try to get the absolute directory name.
2862
3730
 
2863
3731
        if test "$fast_install" = yes; then
2864
3732
          echo >> $output "\
2865
 
  program=lt-'$outputname'
 
3733
  program=lt-'$outputname'$exeext
2866
3734
  progdir=\"\$thisdir/$objdir\"
2867
 
  
 
3735
 
2868
3736
  if test ! -f \"\$progdir/\$program\" || \\
2869
 
     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
 
3737
     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
2870
3738
       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
2871
3739
 
2872
3740
    file=\"\$\$-\$program\"
2881
3749
 
2882
3750
    # relink executable if necessary
2883
3751
    if test -n \"\$relink_command\"; then
2884
 
      if (cd \"\$thisdir\" && eval \$relink_command); then :
 
3752
      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
2885
3753
      else
 
3754
        $echo \"\$relink_command_output\" >&2
2886
3755
        $rm \"\$progdir/\$file\"
2887
3756
        exit 1
2888
3757
      fi
2911
3780
    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
2912
3781
 
2913
3782
    # Some systems cannot cope with colon-terminated $shlibpath_var
2914
 
    # The second colon is a workaround for a bug in BeOS R4 sed
 
3783
    # The second colon is a workaround for a bug in BeOS R4 ${SED}
2915
3784
    $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
2916
3785
 
2917
3786
    export $shlibpath_var
2931
3800
      # Run the actual program with our arguments.
2932
3801
"
2933
3802
        case $host in
2934
 
          # win32 systems need to use the prog path for dll
2935
 
          # lookup to work
2936
 
        *-*-cygwin*)
 
3803
        # win32 systems need to use the prog path for dll
 
3804
        # lookup to work
 
3805
        *-*-cygwin* | *-*-pw32*)
2937
3806
          $echo >> $output "\
2938
3807
      exec \$progdir/\$program \${1+\"\$@\"}
2939
3808
"
2987
3856
          oldobjs="$libobjs_save"
2988
3857
          build_libtool_libs=no
2989
3858
        else
2990
 
          oldobjs="$objs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
 
3859
          oldobjs="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
2991
3860
        fi
2992
3861
        addlibs="$old_convenience"
2993
3862
      fi
3003
3872
          exit $status
3004
3873
        fi
3005
3874
        generated="$generated $gentop"
3006
 
          
 
3875
 
3007
3876
        # Add in members from convenience archives.
3008
3877
        for xlib in $addlibs; do
3009
3878
          # Extract the objects.
3010
 
          case "$xlib" in
 
3879
          case $xlib in
3011
3880
          [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3012
3881
          *) xabs=`pwd`"/$xlib" ;;
3013
3882
          esac
3053
3922
 
3054
3923
        eval cmds=\"$old_archive_cmds\"
3055
3924
      fi
3056
 
      IFS="${IFS=       }"; save_ifs="$IFS"; IFS='~'
 
3925
      save_ifs="$IFS"; IFS='~'
3057
3926
      for cmd in $cmds; do
3058
3927
        IFS="$save_ifs"
3059
3928
        $show "$cmd"
3068
3937
    fi
3069
3938
 
3070
3939
    # Now create the libtool archive.
3071
 
    case "$output" in
 
3940
    case $output in
3072
3941
    *.la)
3073
3942
      old_library=
3074
3943
      test "$build_old_libs" = yes && old_library="$libname.$libext"
3075
3944
      $show "creating $output"
3076
3945
 
3077
 
      if test -n "$xrpath"; then
3078
 
        temp_xrpath=
3079
 
        for libdir in $xrpath; do
3080
 
          temp_xrpath="$temp_xrpath -R$libdir"
3081
 
        done
3082
 
        dependency_libs="$temp_xrpath $dependency_libs"
3083
 
      fi
 
3946
      # Preserve any variables that may affect compiler behavior
 
3947
      for var in $variables_saved_for_relink; do
 
3948
        if eval test -z \"\${$var+set}\"; then
 
3949
          relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
 
3950
        elif eval var_value=\$$var; test -z "$var_value"; then
 
3951
          relink_command="$var=; export $var; $relink_command"
 
3952
        else
 
3953
          var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
 
3954
          relink_command="$var=\"$var_value\"; export $var; $relink_command"
 
3955
        fi
 
3956
      done
 
3957
      # Quote the link command for shipping.
 
3958
      relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@)"
 
3959
      relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
3084
3960
 
3085
3961
      # Only create the output if not a dry run.
3086
3962
      if test -z "$run"; then
3090
3966
              break
3091
3967
            fi
3092
3968
            output="$output_objdir/$outputname"i
 
3969
            # Replace all uninstalled libtool libraries with the installed ones
 
3970
            newdependency_libs=
 
3971
            for deplib in $dependency_libs; do
 
3972
              case $deplib in
 
3973
              *.la)
 
3974
                name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
 
3975
                eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
 
3976
                if test -z "$libdir"; then
 
3977
                  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
 
3978
                  exit 1
 
3979
                fi
 
3980
                newdependency_libs="$newdependency_libs $libdir/$name"
 
3981
                ;;
 
3982
              *) newdependency_libs="$newdependency_libs $deplib" ;;
 
3983
              esac
 
3984
            done
 
3985
            dependency_libs="$newdependency_libs"
 
3986
            newdlfiles=
 
3987
            for lib in $dlfiles; do
 
3988
              name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
 
3989
              eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
 
3990
              if test -z "$libdir"; then
 
3991
                $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
 
3992
                exit 1
 
3993
              fi
 
3994
              newdlfiles="$newdlfiles $libdir/$name"
 
3995
            done
 
3996
            dlfiles="$newdlfiles"
 
3997
            newdlprefiles=
 
3998
            for lib in $dlprefiles; do
 
3999
              name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
 
4000
              eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
 
4001
              if test -z "$libdir"; then
 
4002
                $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
 
4003
                exit 1
 
4004
              fi
 
4005
              newdlprefiles="$newdlprefiles $libdir/$name"
 
4006
            done
 
4007
            dlprefiles="$newdlprefiles"
3093
4008
          fi
3094
4009
          $rm $output
 
4010
          # place dlname in correct position for cygwin
 
4011
          tdlname=$dlname
 
4012
          case $host,$output,$installed,$module,$dlname in
 
4013
            *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
 
4014
          esac
3095
4015
          $echo > $output "\
3096
4016
# $outputname - a libtool library file
3097
4017
# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
3100
4020
# It is necessary for linking the library.
3101
4021
 
3102
4022
# The name that we can dlopen(3).
3103
 
dlname='$dlname'
 
4023
dlname='$tdlname'
3104
4024
 
3105
4025
# Names of this library.
3106
4026
library_names='$library_names'
3119
4039
# Is this an already installed library?
3120
4040
installed=$installed
3121
4041
 
 
4042
# Files to dlopen/dlpreopen
 
4043
dlopen='$dlfiles'
 
4044
dlpreopen='$dlprefiles'
 
4045
 
3122
4046
# Directory that this library needs to be installed in:
3123
 
libdir='$install_libdir'\
3124
 
"
 
4047
libdir='$install_libdir'"
 
4048
          if test "$installed" = no && test $need_relink = yes; then
 
4049
            $echo >> $output "\
 
4050
relink_command=\"$relink_command\""
 
4051
          fi
3125
4052
        done
3126
4053
      fi
3127
4054
 
3128
4055
      # Do a symbolic link so that the libtool archive can be found in
3129
4056
      # LD_LIBRARY_PATH before the program is installed.
3130
4057
      $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
3131
 
      $run eval "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" || exit $?
 
4058
      $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
3132
4059
      ;;
3133
4060
    esac
3134
4061
    exit 0
3140
4067
 
3141
4068
    # There may be an optional sh(1) argument at the beginning of
3142
4069
    # install_prog (especially on Windows NT).
3143
 
    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh; then
 
4070
    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
 
4071
       # Allow the use of GNU shtool's install command.
 
4072
       $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
3144
4073
      # Aesthetically quote it.
3145
4074
      arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
3146
 
      case "$arg" in
 
4075
      case $arg in
3147
4076
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*)
3148
4077
        arg="\"$arg\""
3149
4078
        ;;
3159
4088
    # The real first argument should be the name of the installation program.
3160
4089
    # Aesthetically quote it.
3161
4090
    arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
3162
 
    case "$arg" in
 
4091
    case $arg in
3163
4092
    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*)
3164
4093
      arg="\"$arg\""
3165
4094
      ;;
3182
4111
        continue
3183
4112
      fi
3184
4113
 
3185
 
      case "$arg" in
 
4114
      case $arg in
3186
4115
      -d) isdir=yes ;;
3187
4116
      -f) prev="-f" ;;
3188
4117
      -g) prev="-g" ;;
3207
4136
 
3208
4137
      # Aesthetically quote the argument.
3209
4138
      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
3210
 
      case "$arg" in
 
4139
      case $arg in
3211
4140
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*)
3212
4141
        arg="\"$arg\""
3213
4142
        ;;
3258
4187
        exit 1
3259
4188
      fi
3260
4189
    fi
3261
 
    case "$destdir" in
 
4190
    case $destdir in
3262
4191
    [\\/]* | [A-Za-z]:[\\/]*) ;;
3263
4192
    *)
3264
4193
      for file in $files; do
3265
 
        case "$file" in
 
4194
        case $file in
3266
4195
        *.lo) ;;
3267
4196
        *)
3268
4197
          $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
3284
4213
    for file in $files; do
3285
4214
 
3286
4215
      # Do each installation.
3287
 
      case "$file" in
3288
 
      *.a | *.lib)
 
4216
      case $file in
 
4217
      *.$libext)
3289
4218
        # Do the static libraries later.
3290
4219
        staticlibs="$staticlibs $file"
3291
4220
        ;;
3292
4221
 
3293
4222
      *.la)
3294
4223
        # Check to see that this really is a libtool archive.
3295
 
        if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
 
4224
        if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
3296
4225
        else
3297
4226
          $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
3298
4227
          $echo "$help" 1>&2
3301
4230
 
3302
4231
        library_names=
3303
4232
        old_library=
 
4233
        relink_command=
3304
4234
        # If there is no directory component, then add one.
3305
 
        case "$file" in
 
4235
        case $file in
3306
4236
        */* | *\\*) . $file ;;
3307
4237
        *) . ./$file ;;
3308
4238
        esac
3321
4251
          esac
3322
4252
        fi
3323
4253
 
3324
 
        dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/"
 
4254
        dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
3325
4255
        test "X$dir" = "X$file/" && dir=
3326
4256
        dir="$dir$objdir"
3327
4257
 
 
4258
        if test -n "$relink_command"; then
 
4259
          # Determine the prefix the user has applied to our future dir.
 
4260
          inst_prefix_dir=`$echo "$destdir" | sed "s%$libdir\$%%"`
 
4261
 
 
4262
          # Don't allow the user to place us outside of our expected
 
4263
          # location b/c this prevents finding dependent libraries that
 
4264
          # are installed to the same prefix.
 
4265
          if test "$inst_prefix_dir" = "$destdir"; then
 
4266
            $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
 
4267
            exit 1
 
4268
          fi
 
4269
 
 
4270
          if test -n "$inst_prefix_dir"; then
 
4271
            # Stick the inst_prefix_dir data into the link command.
 
4272
            relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
 
4273
          else
 
4274
            relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%%"`
 
4275
          fi
 
4276
 
 
4277
          $echo "$modename: warning: relinking \`$file'" 1>&2
 
4278
          $show "$relink_command"
 
4279
          if $run eval "$relink_command"; then :
 
4280
          else
 
4281
            $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
 
4282
            exit 1
 
4283
          fi
 
4284
        fi
 
4285
 
3328
4286
        # See the names of the shared library.
3329
4287
        set dummy $library_names
3330
4288
        if test -n "$2"; then
3332
4290
          shift
3333
4291
          shift
3334
4292
 
 
4293
          srcname="$realname"
 
4294
          test -n "$relink_command" && srcname="$realname"T
 
4295
 
3335
4296
          # Install the shared library and build the symlinks.
3336
 
          $show "$install_prog $dir/$realname $destdir/$realname"
3337
 
          $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $?
 
4297
          $show "$install_prog $dir/$srcname $destdir/$realname"
 
4298
          $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
 
4299
          if test -n "$stripme" && test -n "$striplib"; then
 
4300
            $show "$striplib $destdir/$realname"
 
4301
            $run eval "$striplib $destdir/$realname" || exit $?
 
4302
          fi
3338
4303
 
3339
4304
          if test $# -gt 0; then
3340
4305
            # Delete the old symlinks, and create new ones.
3350
4315
          # Do each command in the postinstall commands.
3351
4316
          lib="$destdir/$realname"
3352
4317
          eval cmds=\"$postinstall_cmds\"
3353
 
          IFS="${IFS=   }"; save_ifs="$IFS"; IFS='~'
 
4318
          save_ifs="$IFS"; IFS='~'
3354
4319
          for cmd in $cmds; do
3355
4320
            IFS="$save_ifs"
3356
4321
            $show "$cmd"
3381
4346
        fi
3382
4347
 
3383
4348
        # Deduce the name of the destination old-style object file.
3384
 
        case "$destfile" in
 
4349
        case $destfile in
3385
4350
        *.lo)
3386
4351
          staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
3387
4352
          ;;
3388
 
        *.o | *.obj)
 
4353
        *.$objext)
3389
4354
          staticdest="$destfile"
3390
4355
          destfile=
3391
4356
          ;;
3423
4388
        fi
3424
4389
 
3425
4390
        # Do a test to see if this is really a libtool program.
3426
 
        if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
3427
 
          link_against_libtool_libs=
 
4391
        case $host in
 
4392
        *cygwin*|*mingw*)
 
4393
            wrapper=`echo $file | ${SED} -e 's,.exe$,,'`
 
4394
            ;;
 
4395
        *)
 
4396
            wrapper=$file
 
4397
            ;;
 
4398
        esac
 
4399
        if (${SED} -e '4q' $wrapper | egrep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
 
4400
          notinst_deplibs=
3428
4401
          relink_command=
3429
4402
 
3430
4403
          # If there is no directory component, then add one.
3431
 
          case "$file" in
3432
 
          */* | *\\*) . $file ;;
3433
 
          *) . ./$file ;;
 
4404
          case $file in
 
4405
          */* | *\\*) . $wrapper ;;
 
4406
          *) . ./$wrapper ;;
3434
4407
          esac
3435
4408
 
3436
4409
          # Check the variables that should have been set.
3437
 
          if test -z "$link_against_libtool_libs"; then
3438
 
            $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
 
4410
          if test -z "$notinst_deplibs"; then
 
4411
            $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
3439
4412
            exit 1
3440
4413
          fi
3441
4414
 
3442
4415
          finalize=yes
3443
 
          for lib in $link_against_libtool_libs; do
 
4416
          for lib in $notinst_deplibs; do
3444
4417
            # Check to see that each library is installed.
3445
4418
            libdir=
3446
4419
            if test -f "$lib"; then
3447
4420
              # If there is no directory component, then add one.
3448
 
              case "$lib" in
 
4421
              case $lib in
3449
4422
              */* | *\\*) . $lib ;;
3450
4423
              *) . ./$lib ;;
3451
4424
              esac
3452
4425
            fi
3453
 
            libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`"
 
4426
            libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
3454
4427
            if test -n "$libdir" && test ! -f "$libfile"; then
3455
4428
              $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
3456
4429
              finalize=no
3457
4430
            fi
3458
4431
          done
3459
4432
 
 
4433
          relink_command=
 
4434
          # If there is no directory component, then add one.
 
4435
          case $file in
 
4436
          */* | *\\*) . $wrapper ;;
 
4437
          *) . ./$wrapper ;;
 
4438
          esac
 
4439
 
3460
4440
          outputname=
3461
4441
          if test "$fast_install" = no && test -n "$relink_command"; then
3462
4442
            if test "$finalize" = yes && test -z "$run"; then
3463
4443
              tmpdir="/tmp"
3464
4444
              test -n "$TMPDIR" && tmpdir="$TMPDIR"
3465
 
              tmpdir=`mktemp -d $tmpdir/libtool-XXXXXX 2> /dev/null`
3466
 
              if test $? = 0 ; then :
3467
 
              else
3468
 
                tmpdir="$tmpdir/libtool-$$"
3469
 
              fi
 
4445
              tmpdir="$tmpdir/libtool-$$"
3470
4446
              if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
3471
4447
              else
3472
4448
                $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
3473
4449
                continue
3474
4450
              fi
 
4451
              file=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
3475
4452
              outputname="$tmpdir/$file"
3476
4453
              # Replace the output file specification.
3477
4454
              relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
3493
4470
          fi
3494
4471
        fi
3495
4472
 
 
4473
        # remove .exe since cygwin /usr/bin/install will append another
 
4474
        # one anyways
 
4475
        case $install_prog,$host in
 
4476
        /usr/bin/install*,*cygwin*)
 
4477
          case $file:$destfile in
 
4478
          *.exe:*.exe)
 
4479
            # this is ok
 
4480
            ;;
 
4481
          *.exe:*)
 
4482
            destfile=$destfile.exe
 
4483
            ;;
 
4484
          *:*.exe)
 
4485
            destfile=`echo $destfile | ${SED} -e 's,.exe$,,'`
 
4486
            ;;
 
4487
          esac
 
4488
          ;;
 
4489
        esac
3496
4490
        $show "$install_prog$stripme $file $destfile"
3497
4491
        $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
3498
4492
        test -n "$outputname" && ${rm}r "$tmpdir"
3509
4503
      $show "$install_prog $file $oldlib"
3510
4504
      $run eval "$install_prog \$file \$oldlib" || exit $?
3511
4505
 
 
4506
      if test -n "$stripme" && test -n "$striplib"; then
 
4507
        $show "$old_striplib $oldlib"
 
4508
        $run eval "$old_striplib $oldlib" || exit $?
 
4509
      fi
 
4510
 
3512
4511
      # Do each command in the postinstall commands.
3513
4512
      eval cmds=\"$old_postinstall_cmds\"
3514
 
      IFS="${IFS=       }"; save_ifs="$IFS"; IFS='~'
 
4513
      save_ifs="$IFS"; IFS='~'
3515
4514
      for cmd in $cmds; do
3516
4515
        IFS="$save_ifs"
3517
4516
        $show "$cmd"
3527
4526
    if test -n "$current_libdirs"; then
3528
4527
      # Maybe just do a dry run.
3529
4528
      test -n "$run" && current_libdirs=" -n$current_libdirs"
3530
 
      exec $SHELL $0 --finish$current_libdirs
3531
 
      exit 1
 
4529
      exec_cmd='$SHELL $0 --finish$current_libdirs'
 
4530
    else
 
4531
      exit 0
3532
4532
    fi
3533
 
 
3534
 
    exit 0
3535
4533
    ;;
3536
4534
 
3537
4535
  # libtool finish mode
3550
4548
        if test -n "$finish_cmds"; then
3551
4549
          # Do each command in the finish commands.
3552
4550
          eval cmds=\"$finish_cmds\"
3553
 
          IFS="${IFS=   }"; save_ifs="$IFS"; IFS='~'
 
4551
          save_ifs="$IFS"; IFS='~'
3554
4552
          for cmd in $cmds; do
3555
4553
            IFS="$save_ifs"
3556
4554
            $show "$cmd"
3569
4567
    fi
3570
4568
 
3571
4569
    # Exit here if they wanted silent mode.
3572
 
    test "$show" = : && exit 0
 
4570
    test "$show" = ":" && exit 0
3573
4571
 
3574
4572
    echo "----------------------------------------------------------------------"
3575
4573
    echo "Libraries have been installed in:"
3579
4577
    echo
3580
4578
    echo "If you ever happen to want to link against installed libraries"
3581
4579
    echo "in a given directory, LIBDIR, you must either use libtool, and"
3582
 
    echo "specify the full pathname of the library, or use \`-LLIBDIR'"
 
4580
    echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
3583
4581
    echo "flag during linking and do at least one of the following:"
3584
4582
    if test -n "$shlibpath_var"; then
3585
4583
      echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
3629
4627
      fi
3630
4628
 
3631
4629
      dir=
3632
 
      case "$file" in
 
4630
      case $file in
3633
4631
      *.la)
3634
4632
        # Check to see that this really is a libtool archive.
3635
 
        if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
 
4633
        if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
3636
4634
        else
3637
4635
          $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3638
4636
          $echo "$help" 1>&2
3644
4642
        library_names=
3645
4643
 
3646
4644
        # If there is no directory component, then add one.
3647
 
        case "$file" in
 
4645
        case $file in
3648
4646
        */* | *\\*) . $file ;;
3649
4647
        *) . ./$file ;;
3650
4648
        esac
3699
4697
    args=
3700
4698
    for file
3701
4699
    do
3702
 
      case "$file" in
 
4700
      case $file in
3703
4701
      -*) ;;
3704
4702
      *)
3705
4703
        # Do a test to see if this is really a libtool program.
3706
 
        if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
4704
        if (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
3707
4705
          # If there is no directory component, then add one.
3708
 
          case "$file" in
 
4706
          case $file in
3709
4707
          */* | *\\*) . $file ;;
3710
4708
          *) . ./$file ;;
3711
4709
          esac
3722
4720
 
3723
4721
    if test -z "$run"; then
3724
4722
      if test -n "$shlibpath_var"; then
3725
 
        # Export the shlibpath_var.
3726
 
        eval "export $shlibpath_var"
 
4723
        # Export the shlibpath_var.
 
4724
        eval "export $shlibpath_var"
3727
4725
      fi
3728
4726
 
3729
4727
      # Restore saved enviroment variables
3734
4732
        LANG="$save_LANG"; export LANG
3735
4733
      fi
3736
4734
 
3737
 
      # Now actually exec the command.
3738
 
      eval "exec \$cmd$args"
3739
 
 
3740
 
      $echo "$modename: cannot exec \$cmd$args"
3741
 
      exit 1
 
4735
      # Now prepare to actually exec the command.
 
4736
      exec_cmd="\$cmd$args"
3742
4737
    else
3743
4738
      # Display what would be done.
3744
4739
      if test -n "$shlibpath_var"; then
3745
 
        eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
3746
 
        $echo "export $shlibpath_var"
 
4740
        eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
 
4741
        $echo "export $shlibpath_var"
3747
4742
      fi
3748
4743
      $echo "$cmd$args"
3749
4744
      exit 0
3750
4745
    fi
3751
4746
    ;;
3752
4747
 
3753
 
  # libtool uninstall mode
3754
 
  uninstall)
3755
 
    modename="$modename: uninstall"
 
4748
  # libtool clean and uninstall mode
 
4749
  clean | uninstall)
 
4750
    modename="$modename: $mode"
3756
4751
    rm="$nonopt"
3757
4752
    files=
 
4753
    rmforce=
 
4754
    exit_status=0
 
4755
 
 
4756
    # This variable tells wrapper scripts just to set variables rather
 
4757
    # than running their programs.
 
4758
    libtool_install_magic="$magic"
3758
4759
 
3759
4760
    for arg
3760
4761
    do
3761
 
      case "$arg" in
 
4762
      case $arg in
 
4763
      -f) rm="$rm $arg"; rmforce=yes ;;
3762
4764
      -*) rm="$rm $arg" ;;
3763
4765
      *) files="$files $arg" ;;
3764
4766
      esac
3770
4772
      exit 1
3771
4773
    fi
3772
4774
 
 
4775
    rmdirs=
 
4776
 
3773
4777
    for file in $files; do
3774
4778
      dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
3775
 
      test "X$dir" = "X$file" && dir=.
 
4779
      if test "X$dir" = "X$file"; then
 
4780
        dir=.
 
4781
        objdir="$objdir"
 
4782
      else
 
4783
        objdir="$dir/$objdir"
 
4784
      fi
3776
4785
      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
 
4786
      test $mode = uninstall && objdir="$dir"
 
4787
 
 
4788
      # Remember objdir for removal later, being careful to avoid duplicates
 
4789
      if test $mode = clean; then
 
4790
        case " $rmdirs " in
 
4791
          *" $objdir "*) ;;
 
4792
          *) rmdirs="$rmdirs $objdir" ;;
 
4793
        esac
 
4794
      fi
 
4795
 
 
4796
      # Don't error if the file doesn't exist and rm -f was used.
 
4797
      if (test -L "$file") >/dev/null 2>&1 \
 
4798
        || (test -h "$file") >/dev/null 2>&1 \
 
4799
        || test -f "$file"; then
 
4800
        :
 
4801
      elif test -d "$file"; then
 
4802
        exit_status=1
 
4803
        continue
 
4804
      elif test "$rmforce" = yes; then
 
4805
        continue
 
4806
      fi
3777
4807
 
3778
4808
      rmfiles="$file"
3779
4809
 
3780
 
      case "$name" in
 
4810
      case $name in
3781
4811
      *.la)
3782
4812
        # Possibly a libtool archive, so verify it.
3783
 
        if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
4813
        if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
3784
4814
          . $dir/$name
3785
4815
 
3786
4816
          # Delete the libtool libraries and symlinks.
3787
4817
          for n in $library_names; do
3788
 
            rmfiles="$rmfiles $dir/$n"
 
4818
            rmfiles="$rmfiles $objdir/$n"
3789
4819
          done
3790
 
          test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library"
3791
 
 
3792
 
          $show "$rm $rmfiles"
3793
 
          $run $rm $rmfiles
3794
 
 
3795
 
          if test -n "$library_names"; then
3796
 
            # Do each command in the postuninstall commands.
3797
 
            eval cmds=\"$postuninstall_cmds\"
3798
 
            IFS="${IFS=         }"; save_ifs="$IFS"; IFS='~'
3799
 
            for cmd in $cmds; do
3800
 
              IFS="$save_ifs"
3801
 
              $show "$cmd"
3802
 
              $run eval "$cmd"
3803
 
            done
3804
 
            IFS="$save_ifs"
3805
 
          fi
3806
 
 
3807
 
          if test -n "$old_library"; then
3808
 
            # Do each command in the old_postuninstall commands.
3809
 
            eval cmds=\"$old_postuninstall_cmds\"
3810
 
            IFS="${IFS=         }"; save_ifs="$IFS"; IFS='~'
3811
 
            for cmd in $cmds; do
3812
 
              IFS="$save_ifs"
3813
 
              $show "$cmd"
3814
 
              $run eval "$cmd"
3815
 
            done
3816
 
            IFS="$save_ifs"
3817
 
          fi
3818
 
 
3819
 
          # FIXME: should reinstall the best remaining shared library.
 
4820
          test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
 
4821
          test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
 
4822
 
 
4823
          if test $mode = uninstall; then
 
4824
            if test -n "$library_names"; then
 
4825
              # Do each command in the postuninstall commands.
 
4826
              eval cmds=\"$postuninstall_cmds\"
 
4827
              save_ifs="$IFS"; IFS='~'
 
4828
              for cmd in $cmds; do
 
4829
                IFS="$save_ifs"
 
4830
                $show "$cmd"
 
4831
                $run eval "$cmd"
 
4832
                if test $? != 0 && test "$rmforce" != yes; then
 
4833
                  exit_status=1
 
4834
                fi
 
4835
              done
 
4836
              IFS="$save_ifs"
 
4837
            fi
 
4838
 
 
4839
            if test -n "$old_library"; then
 
4840
              # Do each command in the old_postuninstall commands.
 
4841
              eval cmds=\"$old_postuninstall_cmds\"
 
4842
              save_ifs="$IFS"; IFS='~'
 
4843
              for cmd in $cmds; do
 
4844
                IFS="$save_ifs"
 
4845
                $show "$cmd"
 
4846
                $run eval "$cmd"
 
4847
                if test $? != 0 && test "$rmforce" != yes; then
 
4848
                  exit_status=1
 
4849
                fi
 
4850
              done
 
4851
              IFS="$save_ifs"
 
4852
            fi
 
4853
            # FIXME: should reinstall the best remaining shared library.
 
4854
          fi
3820
4855
        fi
3821
4856
        ;;
3822
4857
 
3825
4860
          oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
3826
4861
          rmfiles="$rmfiles $dir/$oldobj"
3827
4862
        fi
3828
 
        $show "$rm $rmfiles"
3829
 
        $run $rm $rmfiles
3830
4863
        ;;
3831
4864
 
3832
4865
      *)
3833
 
        $show "$rm $rmfiles"
3834
 
        $run $rm $rmfiles
 
4866
        # Do a test to see if this is a libtool program.
 
4867
        if test $mode = clean &&
 
4868
           (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
4869
          relink_command=
 
4870
          . $dir/$file
 
4871
 
 
4872
          rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
 
4873
          if test "$fast_install" = yes && test -n "$relink_command"; then
 
4874
            rmfiles="$rmfiles $objdir/lt-$name"
 
4875
          fi
 
4876
        fi
3835
4877
        ;;
3836
4878
      esac
3837
 
    done
3838
 
    exit 0
 
4879
      $show "$rm $rmfiles"
 
4880
      $run $rm $rmfiles || exit_status=1
 
4881
    done
 
4882
 
 
4883
    # Try to remove the ${objdir}s in the directories where we deleted files
 
4884
    for dir in $rmdirs; do
 
4885
      if test -d "$dir"; then
 
4886
        $show "rmdir $dir"
 
4887
        $run rmdir $dir >/dev/null 2>&1
 
4888
      fi
 
4889
    done
 
4890
 
 
4891
    exit $exit_status
3839
4892
    ;;
3840
4893
 
3841
4894
  "")
3845
4898
    ;;
3846
4899
  esac
3847
4900
 
3848
 
  $echo "$modename: invalid operation mode \`$mode'" 1>&2
3849
 
  $echo "$generic_help" 1>&2
3850
 
  exit 1
 
4901
  if test -z "$exec_cmd"; then
 
4902
    $echo "$modename: invalid operation mode \`$mode'" 1>&2
 
4903
    $echo "$generic_help" 1>&2
 
4904
    exit 1
 
4905
  fi
3851
4906
fi # test -z "$show_help"
3852
4907
 
 
4908
if test -n "$exec_cmd"; then
 
4909
  eval exec $exec_cmd
 
4910
  exit 1
 
4911
fi
 
4912
 
3853
4913
# We need to display help for each of the modes.
3854
 
case "$mode" in
 
4914
case $mode in
3855
4915
"") $echo \
3856
4916
"Usage: $modename [OPTION]... [MODE-ARG]...
3857
4917
 
3870
4930
 
3871
4931
MODE must be one of the following:
3872
4932
 
 
4933
      clean           remove files from the build directory
3873
4934
      compile         compile a source file into a libtool object
3874
4935
      execute         automatically set library path, then run a program
3875
4936
      finish          complete the installation of libtool libraries
3882
4943
  exit 0
3883
4944
  ;;
3884
4945
 
 
4946
clean)
 
4947
  $echo \
 
4948
"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
 
4949
 
 
4950
Remove files from the build directory.
 
4951
 
 
4952
RM is the name of the program to use to delete files associated with each FILE
 
4953
(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
 
4954
to RM.
 
4955
 
 
4956
If FILE is a libtool library, object or program, all the files associated
 
4957
with it are deleted. Otherwise, only FILE itself is deleted using RM."
 
4958
  ;;
 
4959
 
3885
4960
compile)
3886
4961
  $echo \
3887
4962
"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
3891
4966
This mode accepts the following additional options:
3892
4967
 
3893
4968
  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
 
4969
  -prefer-pic       try to building PIC objects only
 
4970
  -prefer-non-pic   try to building non-PIC objects only
3894
4971
  -static           always build a \`.o' file suitable for static linking
3895
4972
 
3896
4973
COMPILE-COMMAND is a command to be used in creating a \`standard' object file
3970
5047
  -LLIBDIR          search LIBDIR for required installed libraries
3971
5048
  -lNAME            OUTPUT-FILE requires the installed library libNAME
3972
5049
  -module           build a library that can dlopened
 
5050
  -no-fast-install  disable the fast-install mode
 
5051
  -no-install       link a not-installable executable
3973
5052
  -no-undefined     declare that a library does not refer to external symbols
3974
5053
  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
3975
5054
  -release RELEASE  specify package release information