~ubuntu-branches/ubuntu/trusty/eb/trusty

« back to all changes in this revision

Viewing changes to zlib/ltmain.sh

  • Committer: Bazaar Package Importer
  • Author(s): Susumu OSAWA
  • Date: 2003-09-08 10:46:13 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20030908104613-xmsmhu2m2oulcmnm
Tags: 3.3.2-4
Add conflicts & replaces with libeb6 

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
fi
50
50
 
51
51
# The name of this program.
52
 
progname=`$echo "$0" | sed 's%^.*/%%'`
 
52
progname=`$echo "$0" | ${SED} 's%^.*/%%'`
53
53
modename="$progname"
54
54
 
55
55
# Constants.
56
56
PROGRAM=ltmain.sh
57
57
PACKAGE=libtool
58
 
VERSION=1.4
59
 
TIMESTAMP=" (1.920 2001/04/24 23:26:18)"
 
58
VERSION=1.4.3
 
59
TIMESTAMP=" (1.922.2.110 2002/10/23 01:39:54)"
60
60
 
61
61
default_mode=
62
62
help="Try \`$progname --help' for more information."
67
67
 
68
68
# Sed substitution that helps us do robust quoting.  It backslashifies
69
69
# metacharacters that are still active within double-quoted strings.
70
 
Xsed='sed -e 1s/^X//'
 
70
Xsed="${SED}"' -e 1s/^X//'
71
71
sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
72
 
SP2NL='tr \040 \012'
73
 
NL2SP='tr \015\012 \040\040'
 
72
# test EBCDIC or ASCII                                                         
 
73
case `echo A|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                                                                           
74
83
 
75
84
# NLS nuisances.
76
85
# Only set LANG and LC_ALL to C if already set.
84
93
  save_LANG="$LANG"; LANG=C; export LANG
85
94
fi
86
95
 
 
96
# Make sure IFS has a sensible default
 
97
: ${IFS="       "}
 
98
 
87
99
if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
88
100
  echo "$modename: not configured to build any kind of library" 1>&2
89
101
  echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
141
153
    ;;
142
154
 
143
155
  --config)
144
 
    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
145
157
    exit 0
146
158
    ;;
147
159
 
174
186
  --mode) prevopt="--mode" prev=mode ;;
175
187
  --mode=*) mode="$optarg" ;;
176
188
 
 
189
  --preserve-dup-deps) duplicate_deps="yes" ;;
 
190
 
177
191
  --quiet | --silent)
178
192
    show=:
179
193
    ;;
202
216
  exit 1
203
217
fi
204
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
 
205
224
if test -z "$show_help"; then
206
225
 
207
226
  # Infer the operation mode.
208
227
  if test -z "$mode"; then
209
228
    case $nonopt in
210
 
    *cc | *++ | gcc* | *-gcc*)
 
229
    *cc | *++ | gcc* | *-gcc* | xlc*)
211
230
      mode=link
212
231
      for arg
213
232
      do
329
348
      -Wc,*)
330
349
        args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
331
350
        lastarg=
332
 
        IFS="${IFS=     }"; save_ifs="$IFS"; IFS=','
 
351
        save_ifs="$IFS"; IFS=','
333
352
        for arg in $args; do
334
353
          IFS="$save_ifs"
335
354
 
459
478
      pic_mode=default
460
479
      ;;
461
480
    esac
462
 
    if test $pic_mode = no && test "$deplibs_check_method" != pass_all; then
 
481
    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
463
482
      # non-PIC code in shared libraries is not supported
464
483
      pic_mode=default
465
484
    fi
615
634
        # Now arrange that obj and lo_libobj become the same file
616
635
        $show "(cd $xdir && $LN_S $baseobj $libobj)"
617
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
618
641
          exit 0
619
642
        else
620
643
          error=$?
980
1003
      # so, if we see these flags be careful not to treat them like -L
981
1004
      -L[A-Z][A-Z]*:*)
982
1005
        case $with_gcc/$host in
983
 
        no/*-*-irix*)
 
1006
        no/*-*-irix* | no/*-*-nonstopux*)
984
1007
          compile_command="$compile_command $arg"
985
1008
          finalize_command="$finalize_command $arg"
986
1009
          ;;
1031
1054
            # These systems don't actually have a C library (as such)
1032
1055
            test "X$arg" = "X-lc" && continue
1033
1056
            ;;
 
1057
          *-*-openbsd* | *-*-freebsd*)
 
1058
            # Do not include libc due to us having libc/libc_r.
 
1059
            test "X$arg" = "X-lc" && continue
 
1060
            ;;
 
1061
          esac
 
1062
         elif test "X$arg" = "X-lc_r"; then
 
1063
          case $host in
 
1064
         *-*-openbsd* | *-*-freebsd*)
 
1065
            # Do not include libc_r directly, use -pthread flag.
 
1066
            continue
 
1067
            ;;
1034
1068
          esac
1035
1069
        fi
1036
1070
        deplibs="$deplibs $arg"
1122
1156
      -Wc,*)
1123
1157
        args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1124
1158
        arg=
1125
 
        IFS="${IFS=     }"; save_ifs="$IFS"; IFS=','
 
1159
        save_ifs="$IFS"; IFS=','
1126
1160
        for flag in $args; do
1127
1161
          IFS="$save_ifs"
1128
1162
          case $flag in
1140
1174
      -Wl,*)
1141
1175
        args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1142
1176
        arg=
1143
 
        IFS="${IFS=     }"; save_ifs="$IFS"; IFS=','
 
1177
        save_ifs="$IFS"; IFS=','
1144
1178
        for flag in $args; do
1145
1179
          IFS="$save_ifs"
1146
1180
          case $flag in
1307
1341
    # Find all interdependent deplibs by searching for libraries
1308
1342
    # that are linked more than once (e.g. -la -lb -la)
1309
1343
    for deplib in $deplibs; do
1310
 
      case "$libs " in
1311
 
      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1312
 
      esac
 
1344
      if test "X$duplicate_deps" = "Xyes" ; then
 
1345
        case "$libs " in
 
1346
        *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
 
1347
        esac
 
1348
      fi
1313
1349
      libs="$libs $deplib"
1314
1350
    done
1315
1351
    deplibs=
1438
1474
          lib)
1439
1475
            if test "$deplibs_check_method" != pass_all; then
1440
1476
              echo
1441
 
              echo "*** Warning: This library needs some functionality provided by $deplib."
 
1477
              echo "*** Warning: Trying to link with static lib archive $deplib."
1442
1478
              echo "*** I have the capability to make that library automatically link in when"
1443
1479
              echo "*** you link to this library.  But I can only do this if you have a"
1444
 
              echo "*** shared version of the library, which you do not appear to have."
 
1480
              echo "*** shared version of the library, which you do not appear to have"
 
1481
              echo "*** because the file extensions .$libext of this argument makes me believe"
 
1482
              echo "*** that it is just a static archive that I should not used here."
1445
1483
            else
1446
1484
              echo
1447
1485
              echo "*** Warning: Linking the shared library $output against the"
1485
1523
        fi
1486
1524
 
1487
1525
        # Check to see that this really is a libtool archive.
1488
 
        if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
 
1526
        if (${SED} -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1489
1527
        else
1490
1528
          $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
1491
1529
          exit 1
1532
1570
            tmp_libs=
1533
1571
            for deplib in $dependency_libs; do
1534
1572
              deplibs="$deplib $deplibs"
1535
 
              case "$tmp_libs " in
1536
 
              *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1537
 
              esac
 
1573
              if test "X$duplicate_deps" = "Xyes" ; then
 
1574
                case "$tmp_libs " in
 
1575
                *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
 
1576
                esac
 
1577
              fi
1538
1578
              tmp_libs="$tmp_libs $deplib"
1539
1579
            done
1540
1580
          elif test $linkmode != prog && test $linkmode != lib; then
1657
1697
              # or/and link against static libraries
1658
1698
              newdependency_libs="$deplib $newdependency_libs"
1659
1699
            fi
1660
 
            case "$tmp_libs " in
1661
 
            *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1662
 
            esac
 
1700
            if test "X$duplicate_deps" = "Xyes" ; then
 
1701
              case "$tmp_libs " in
 
1702
              *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
 
1703
              esac
 
1704
            fi
1663
1705
            tmp_libs="$tmp_libs $deplib"
1664
1706
          done # for deplib
1665
1707
          continue
1743
1785
 
1744
1786
            # Make a new name for the extract_expsyms_cmds to use
1745
1787
            soroot="$soname"
1746
 
            soname=`echo $soroot | sed -e 's/^.*\///'`
1747
 
            newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a"
 
1788
            soname=`echo $soroot | ${SED} -e 's/^.*\///'`
 
1789
            newlib="libimp-`echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
1748
1790
 
1749
1791
            # If the library has no export list, then create one now
1750
1792
            if test -f "$output_objdir/$soname-def"; then :
1751
1793
            else
1752
1794
              $show "extracting exported symbol list from \`$soname'"
1753
 
              IFS="${IFS=       }"; save_ifs="$IFS"; IFS='~'
 
1795
              save_ifs="$IFS"; IFS='~'
1754
1796
              eval cmds=\"$extract_expsyms_cmds\"
1755
1797
              for cmd in $cmds; do
1756
1798
                IFS="$save_ifs"
1763
1805
            # Create $newlib
1764
1806
            if test -f "$output_objdir/$newlib"; then :; else
1765
1807
              $show "generating import library for \`$soname'"
1766
 
              IFS="${IFS=       }"; save_ifs="$IFS"; IFS='~'
 
1808
              save_ifs="$IFS"; IFS='~'
1767
1809
              eval cmds=\"$old_archive_from_expsyms_cmds\"
1768
1810
              for cmd in $cmds; do
1769
1811
                IFS="$save_ifs"
1903
1945
            # Just print a warning and add the library to dependency_libs so
1904
1946
            # that the program can be linked against the static library.
1905
1947
            echo
1906
 
            echo "*** Warning: This library needs some functionality provided by $lib."
 
1948
            echo "*** Warning: This system can not link to static lib archive $lib."
1907
1949
            echo "*** I have the capability to make that library automatically link in when"
1908
1950
            echo "*** you link to this library.  But I can only do this if you have a"
1909
1951
            echo "*** shared version of the library, which you do not appear to have."
1910
1952
            if test "$module" = yes; then
1911
 
              echo "*** Therefore, libtool will create a static module, that should work "
1912
 
              echo "*** as long as the dlopening application is linked with the -dlopen flag."
 
1953
              echo "*** But as you try to build a module library, libtool will still create "
 
1954
              echo "*** a static module, that should work as long as the dlopening application"
 
1955
              echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
1913
1956
              if test -z "$global_symbol_pipe"; then
1914
 
                echo
1915
 
                echo "*** However, this would only work if libtool was able to extract symbol"
1916
 
                echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
1917
 
                echo "*** not find such a program.  So, this module is probably useless."
1918
 
                echo "*** \`nm' from GNU binutils and a full rebuild may help."
 
1957
                echo
 
1958
                echo "*** However, this would only work if libtool was able to extract symbol"
 
1959
                echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
 
1960
                echo "*** not find such a program.  So, this module is probably useless."
 
1961
                echo "*** \`nm' from GNU binutils and a full rebuild may help."
1919
1962
              fi
1920
1963
              if test "$build_old_libs" = no; then
1921
 
                build_libtool_libs=module
1922
 
                build_old_libs=yes
 
1964
                build_libtool_libs=module
 
1965
                build_old_libs=yes
1923
1966
              else
1924
 
                build_libtool_libs=no
 
1967
                build_libtool_libs=no
1925
1968
              fi
1926
1969
            fi
1927
1970
          else
1958
2001
          tmp_libs=
1959
2002
          for deplib in $dependency_libs; do
1960
2003
            newdependency_libs="$deplib $newdependency_libs"
1961
 
            case "$tmp_libs " in
1962
 
            *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1963
 
            esac
 
2004
            if test "X$duplicate_deps" = "Xyes" ; then
 
2005
              case "$tmp_libs " in
 
2006
              *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
 
2007
              esac
 
2008
            fi
1964
2009
            tmp_libs="$tmp_libs $deplib"
1965
2010
          done
1966
2011
 
1986
2031
                if grep "^installed=no" $deplib > /dev/null; then
1987
2032
                  path="-L$absdir/$objdir"
1988
2033
                else
1989
 
                  eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
 
2034
                  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
1990
2035
                  if test -z "$libdir"; then
1991
2036
                    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
1992
2037
                    exit 1
2175
2220
      else
2176
2221
 
2177
2222
        # Parse the version information argument.
2178
 
        IFS="${IFS=     }"; save_ifs="$IFS"; IFS=':'
 
2223
        save_ifs="$IFS"; IFS=':'
2179
2224
        set dummy $vinfo 0 0 0
2180
2225
        IFS="$save_ifs"
2181
2226
 
2250
2295
          versuffix=".$current";
2251
2296
          ;;
2252
2297
 
2253
 
        irix)
 
2298
        irix | nonstopux)
2254
2299
          major=`expr $current - $age + 1`
2255
 
          verstring="sgi$major.$revision"
 
2300
 
 
2301
          case $version_type in
 
2302
            nonstopux) verstring_prefix=nonstopux ;;
 
2303
            *)         verstring_prefix=sgi ;;
 
2304
          esac
 
2305
          verstring="$verstring_prefix$major.$revision"
2256
2306
 
2257
2307
          # Add in all the interfaces that we are compatible with.
2258
2308
          loop=$revision
2259
2309
          while test $loop != 0; do
2260
2310
            iface=`expr $revision - $loop`
2261
2311
            loop=`expr $loop - 1`
2262
 
            verstring="sgi$major.$iface:$verstring"
 
2312
            verstring="$verstring_prefix$major.$iface:$verstring"
2263
2313
          done
2264
2314
 
2265
2315
          # Before this point, $major must not contain `.'.
2273
2323
          ;;
2274
2324
 
2275
2325
        osf)
2276
 
          major=`expr $current - $age`
 
2326
          major=.`expr $current - $age`
2277
2327
          versuffix=".$current.$age.$revision"
2278
2328
          verstring="$current.$age.$revision"
2279
2329
 
2312
2362
        if test -z "$vinfo" && test -n "$release"; then
2313
2363
          major=
2314
2364
          verstring="0.0"
 
2365
          case $version_type in
 
2366
          darwin)
 
2367
            # we can't check for "0.0" in archive_cmds due to quoting
 
2368
            # problems, so we reset it completely
 
2369
            verstring=""
 
2370
            ;;
 
2371
          *)
 
2372
            verstring="0.0"
 
2373
            ;;
 
2374
          esac
2315
2375
          if test "$need_version" = no; then
2316
2376
            versuffix=
2317
2377
          else
2355
2415
 
2356
2416
      # Eliminate all temporary directories.
2357
2417
      for path in $notinst_path; do
2358
 
        lib_search_path=`echo "$lib_search_path " | sed -e 's% $path % %g'`
2359
 
        deplibs=`echo "$deplibs " | sed -e 's% -L$path % %g'`
2360
 
        dependency_libs=`echo "$dependency_libs " | sed -e 's% -L$path % %g'`
 
2418
        lib_search_path=`echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
 
2419
        deplibs=`echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
 
2420
        dependency_libs=`echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
2361
2421
      done
2362
2422
 
2363
2423
      if test -n "$xrpath"; then
2408
2468
          *-*-netbsd*)
2409
2469
            # Don't link with libc until the a.out ld.so is fixed.
2410
2470
            ;;
 
2471
          *-*-openbsd* | *-*-freebsd*)
 
2472
            # Do not include libc due to us having libc/libc_r.
 
2473
            ;;
2411
2474
          *)
2412
2475
            # Add libc to deplibs on all other systems if necessary.
2413
2476
            if test $build_libtool_need_lc = "yes"; then
2466
2529
                else
2467
2530
                  droppeddeps=yes
2468
2531
                  echo
2469
 
                  echo "*** Warning: This library needs some functionality provided by $i."
 
2532
                  echo "*** Warning: dynamic linker does not accept needed library $i."
2470
2533
                  echo "*** I have the capability to make that library automatically link in when"
2471
2534
                  echo "*** you link to this library.  But I can only do this if you have a"
2472
 
                  echo "*** shared version of the library, which you do not appear to have."
 
2535
                  echo "*** shared version of the library, which I believe you do not have"
 
2536
                  echo "*** because a test_compile did reveal that the linker did not use it for"
 
2537
                  echo "*** its dynamic dependency list that programs get resolved with at runtime."
2473
2538
                fi
2474
2539
              else
2475
2540
                newdeplibs="$newdeplibs $i"
2476
2541
              fi
2477
2542
            done
2478
2543
          else
2479
 
            # Error occured in the first compile.  Let's try to salvage the situation:
2480
 
            # Compile a seperate program for each library.
 
2544
            # Error occured in the first compile.  Let's try to salvage
 
2545
            # the situation: Compile a separate program for each library.
2481
2546
            for i in $deplibs; do
2482
2547
              name="`expr $i : '-l\(.*\)'`"
2483
2548
             # If $name is empty we are operating on a -L argument.
2496
2561
                  else
2497
2562
                    droppeddeps=yes
2498
2563
                    echo
2499
 
                    echo "*** Warning: This library needs some functionality provided by $i."
 
2564
                    echo "*** Warning: dynamic linker does not accept needed library $i."
2500
2565
                    echo "*** I have the capability to make that library automatically link in when"
2501
2566
                    echo "*** you link to this library.  But I can only do this if you have a"
2502
 
                    echo "*** shared version of the library, which you do not appear to have."
 
2567
                    echo "*** shared version of the library, which you do not appear to have"
 
2568
                    echo "*** because a test_compile did reveal that the linker did not use this one"
 
2569
                    echo "*** as a dynamic dependency that programs can get resolved with at runtime."
2503
2570
                  fi
2504
2571
                else
2505
2572
                  droppeddeps=yes
2538
2605
                      # but so what?
2539
2606
                      potlib="$potent_lib"
2540
2607
                      while test -h "$potlib" 2>/dev/null; do
2541
 
                        potliblink=`ls -ld $potlib | sed 's/.* -> //'`
 
2608
                        potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
2542
2609
                        case $potliblink in
2543
2610
                        [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
2544
2611
                        *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
2545
2612
                        esac
2546
2613
                      done
2547
2614
                      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
2548
 
                         | sed 10q \
 
2615
                         | ${SED} 10q \
2549
2616
                         | egrep "$file_magic_regex" > /dev/null; then
2550
2617
                        newdeplibs="$newdeplibs $a_deplib"
2551
2618
                        a_deplib=""
2556
2623
              if test -n "$a_deplib" ; then
2557
2624
                droppeddeps=yes
2558
2625
                echo
2559
 
                echo "*** Warning: This library needs some functionality provided by $a_deplib."
 
2626
                echo "*** Warning: linker path does not have real file for library $a_deplib."
2560
2627
                echo "*** I have the capability to make that library automatically link in when"
2561
2628
                echo "*** you link to this library.  But I can only do this if you have a"
2562
 
                echo "*** shared version of the library, which you do not appear to have."
 
2629
                echo "*** shared version of the library, which you do not appear to have"
 
2630
                echo "*** because I did check the linker path looking for a file starting"
 
2631
                if test -z "$potlib" ; then
 
2632
                  echo "*** with $libname but no candidates were found. (...for file magic test)"
 
2633
                else
 
2634
                  echo "*** with $libname and none of the candidates passed a file format test"
 
2635
                  echo "*** using a file magic. Last file checked: $potlib"
 
2636
                fi
2563
2637
              fi
2564
2638
            else
2565
2639
              # Add a -L argument.
2578
2652
              for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2579
2653
                potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2580
2654
                for potent_lib in $potential_libs; do
 
2655
                  potlib="$potent_lib" # see symlink-check below in file_magic test
2581
2656
                  if eval echo \"$potent_lib\" 2>/dev/null \
2582
 
                      | sed 10q \
 
2657
                      | ${SED} 10q \
2583
2658
                      | egrep "$match_pattern_regex" > /dev/null; then
2584
2659
                    newdeplibs="$newdeplibs $a_deplib"
2585
2660
                    a_deplib=""
2590
2665
              if test -n "$a_deplib" ; then
2591
2666
                droppeddeps=yes
2592
2667
                echo
2593
 
                echo "*** Warning: This library needs some functionality provided by $a_deplib."
 
2668
                echo "*** Warning: linker path does not have real file for library $a_deplib."
2594
2669
                echo "*** I have the capability to make that library automatically link in when"
2595
2670
                echo "*** you link to this library.  But I can only do this if you have a"
2596
 
                echo "*** shared version of the library, which you do not appear to have."
 
2671
                echo "*** shared version of the library, which you do not appear to have"
 
2672
                echo "*** because I did check the linker path looking for a file starting"
 
2673
                if test -z "$potlib" ; then
 
2674
                  echo "*** with $libname but no candidates were found. (...for regex pattern test)"
 
2675
                else
 
2676
                  echo "*** with $libname and none of the candidates passed a file format test"
 
2677
                  echo "*** using a regex pattern. Last file checked: $potlib"
 
2678
                fi
2597
2679
              fi
2598
2680
            else
2599
2681
              # Add a -L argument.
2784
2866
            export_symbols="$output_objdir/$libname.exp"
2785
2867
            $run $rm $export_symbols
2786
2868
            eval cmds=\"$export_symbols_cmds\"
2787
 
            IFS="${IFS=         }"; save_ifs="$IFS"; IFS='~'
 
2869
            save_ifs="$IFS"; IFS='~'
2788
2870
            for cmd in $cmds; do
2789
2871
              IFS="$save_ifs"
2790
2872
              $show "$cmd"
2858
2940
        if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
2859
2941
          eval cmds=\"$archive_expsym_cmds\"
2860
2942
        else
 
2943
          save_deplibs="$deplibs"
 
2944
          for conv in $convenience; do
 
2945
            tmp_deplibs=
 
2946
            for test_deplib in $deplibs; do
 
2947
              if test "$test_deplib" != "$conv"; then
 
2948
                tmp_deplibs="$tmp_deplibs $test_deplib"
 
2949
              fi
 
2950
            done
 
2951
            deplibs="$tmp_deplibs"
 
2952
          done
2861
2953
          eval cmds=\"$archive_cmds\"
 
2954
          deplibs="$save_deplibs"
2862
2955
        fi
2863
 
        IFS="${IFS=     }"; save_ifs="$IFS"; IFS='~'
 
2956
        save_ifs="$IFS"; IFS='~'
2864
2957
        for cmd in $cmds; do
2865
2958
          IFS="$save_ifs"
2866
2959
          $show "$cmd"
2988
3081
 
2989
3082
      output="$obj"
2990
3083
      eval cmds=\"$reload_cmds\"
2991
 
      IFS="${IFS=       }"; save_ifs="$IFS"; IFS='~'
 
3084
      save_ifs="$IFS"; IFS='~'
2992
3085
      for cmd in $cmds; do
2993
3086
        IFS="$save_ifs"
2994
3087
        $show "$cmd"
3024
3117
        reload_objs="$libobjs $reload_conv_objs"
3025
3118
        output="$libobj"
3026
3119
        eval cmds=\"$reload_cmds\"
3027
 
        IFS="${IFS=     }"; save_ifs="$IFS"; IFS='~'
 
3120
        save_ifs="$IFS"; IFS='~'
3028
3121
        for cmd in $cmds; do
3029
3122
          IFS="$save_ifs"
3030
3123
          $show "$cmd"
3057
3150
 
3058
3151
    prog)
3059
3152
      case $host in
3060
 
        *cygwin*) output=`echo $output | sed -e 's,.exe$,,;s,$,.exe,'` ;;
 
3153
        *cygwin*) output=`echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
3061
3154
      esac
3062
3155
      if test -n "$vinfo"; then
3063
3156
        $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
3079
3172
        # On Rhapsody replace the C library is the System framework
3080
3173
        compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3081
3174
        finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
 
3175
        case $host in
 
3176
        *darwin*)
 
3177
          # Don't allow lazy linking, it breaks C++ global constructors
 
3178
          compile_command="$compile_command ${wl}-bind_at_load"
 
3179
          finalize_command="$finalize_command ${wl}-bind_at_load"
 
3180
          ;;
 
3181
        esac
3082
3182
        ;;
3083
3183
      esac
3084
3184
 
3245
3345
            if test -z "$export_symbols"; then
3246
3346
              export_symbols="$output_objdir/$output.exp"
3247
3347
              $run $rm $export_symbols
3248
 
              $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
 
3348
              $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3249
3349
            else
3250
 
              $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
 
3350
              $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
3251
3351
              $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
3252
3352
              $run eval 'mv "$nlist"T "$nlist"'
3253
3353
            fi
3255
3355
 
3256
3356
          for arg in $dlprefiles; do
3257
3357
            $show "extracting global C symbols from \`$arg'"
3258
 
            name=`echo "$arg" | sed -e 's%^.*/%%'`
 
3358
            name=`echo "$arg" | ${SED} -e 's%^.*/%%'`
3259
3359
            $run eval 'echo ": $name " >> "$nlist"'
3260
3360
            $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3261
3361
          done
3270
3370
            fi
3271
3371
 
3272
3372
            # Try sorting and uniquifying the output.
3273
 
            if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
 
3373
            if grep -v "^: " < "$nlist" |
 
3374
                if sort -k 3 </dev/null >/dev/null 2>&1; then
 
3375
                  sort -k 3
 
3376
                else
 
3377
                  sort +2
 
3378
                fi |
 
3379
                uniq > "$nlist"S; then
3274
3380
              :
3275
3381
            else
3276
3382
              grep -v "^: " < "$nlist" > "$nlist"S
3287
3393
#undef lt_preloaded_symbols
3288
3394
 
3289
3395
#if defined (__STDC__) && __STDC__
3290
 
# define lt_ptr_t void *
 
3396
# define lt_ptr void *
3291
3397
#else
3292
 
# define lt_ptr_t char *
 
3398
# define lt_ptr char *
3293
3399
# define const
3294
3400
#endif
3295
3401
 
3296
3402
/* The mapping between symbol names and symbols. */
3297
3403
const struct {
3298
3404
  const char *name;
3299
 
  lt_ptr_t address;
 
3405
  lt_ptr address;
3300
3406
}
3301
3407
lt_preloaded_symbols[] =
3302
3408
{\
3303
3409
"
3304
3410
 
3305
 
            sed -n -e 's/^: \([^ ]*\) $/  {\"\1\", (lt_ptr_t) 0},/p' \
3306
 
                -e 's/^. \([^ ]*\) \([^ ]*\)$/  {"\2", (lt_ptr_t) \&\2},/p' \
3307
 
                  < "$nlist" >> "$output_objdir/$dlsyms"
 
3411
            eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
3308
3412
 
3309
3413
            $echo >> "$output_objdir/$dlsyms" "\
3310
 
  {0, (lt_ptr_t) 0}
 
3414
  {0, (lt_ptr) 0}
3311
3415
};
3312
3416
 
3313
3417
/* This works around a problem in FreeBSD linker */
3494
3598
            relink_command="$var=\"$var_value\"; export $var; $relink_command"
3495
3599
          fi
3496
3600
        done
3497
 
        relink_command="cd `pwd`; $relink_command"
 
3601
        relink_command="(cd `pwd`; $relink_command)"
3498
3602
        relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
3499
3603
      fi
3500
3604
 
3514
3618
        # win32 will think the script is a binary if it has
3515
3619
        # a .exe suffix, so we strip it off here.
3516
3620
        case $output in
3517
 
          *.exe) output=`echo $output|sed 's,.exe$,,'` ;;
 
3621
          *.exe) output=`echo $output|${SED} 's,.exe$,,'` ;;
3518
3622
        esac
3519
3623
        # test for cygwin because mv fails w/o .exe extensions
3520
3624
        case $host in
3538
3642
 
3539
3643
# Sed substitution that helps us do robust quoting.  It backslashifies
3540
3644
# metacharacters that are still active within double-quoted strings.
3541
 
Xsed='sed -e 1s/^X//'
 
3645
Xsed="${SED}"' -e 1s/^X//'
3542
3646
sed_quote_subst='$sed_quote_subst'
3543
3647
 
3544
3648
# The HP-UX ksh and POSIX shell print the target directory to stdout
3576
3680
  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
3577
3681
 
3578
3682
  # Follow symbolic links until we get to the real thisdir.
3579
 
  file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
 
3683
  file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
3580
3684
  while test -n \"\$file\"; do
3581
3685
    destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
3582
3686
 
3589
3693
    fi
3590
3694
 
3591
3695
    file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
3592
 
    file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
 
3696
    file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
3593
3697
  done
3594
3698
 
3595
3699
  # Try to get the absolute directory name.
3603
3707
  progdir=\"\$thisdir/$objdir\"
3604
3708
 
3605
3709
  if test ! -f \"\$progdir/\$program\" || \\
3606
 
     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
 
3710
     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
3607
3711
       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
3608
3712
 
3609
3713
    file=\"\$\$-\$program\"
3618
3722
 
3619
3723
    # relink executable if necessary
3620
3724
    if test -n \"\$relink_command\"; then
3621
 
      if (eval \$relink_command); then :
 
3725
      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
3622
3726
      else
 
3727
        $echo \"\$relink_command_output\" >&2
3623
3728
        $rm \"\$progdir/\$file\"
3624
3729
        exit 1
3625
3730
      fi
3648
3753
    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
3649
3754
 
3650
3755
    # Some systems cannot cope with colon-terminated $shlibpath_var
3651
 
    # The second colon is a workaround for a bug in BeOS R4 sed
 
3756
    # The second colon is a workaround for a bug in BeOS R4 ${SED}
3652
3757
    $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
3653
3758
 
3654
3759
    export $shlibpath_var
3790
3895
 
3791
3896
        eval cmds=\"$old_archive_cmds\"
3792
3897
      fi
3793
 
      IFS="${IFS=       }"; save_ifs="$IFS"; IFS='~'
 
3898
      save_ifs="$IFS"; IFS='~'
3794
3899
      for cmd in $cmds; do
3795
3900
        IFS="$save_ifs"
3796
3901
        $show "$cmd"
3823
3928
        fi
3824
3929
      done
3825
3930
      # Quote the link command for shipping.
3826
 
      relink_command="cd `pwd`; $SHELL $0 --mode=relink $libtool_args"
 
3931
      relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args)"
3827
3932
      relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
3828
3933
 
3829
3934
      # Only create the output if not a dry run.
3840
3945
              case $deplib in
3841
3946
              *.la)
3842
3947
                name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
3843
 
                eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
 
3948
                eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
3844
3949
                if test -z "$libdir"; then
3845
3950
                  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
3846
3951
                  exit 1
3854
3959
            newdlfiles=
3855
3960
            for lib in $dlfiles; do
3856
3961
              name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
3857
 
              eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
 
3962
              eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
3858
3963
              if test -z "$libdir"; then
3859
3964
                $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3860
3965
                exit 1
3865
3970
            newdlprefiles=
3866
3971
            for lib in $dlprefiles; do
3867
3972
              name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
3868
 
              eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
 
3973
              eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
3869
3974
              if test -z "$libdir"; then
3870
3975
                $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3871
3976
                exit 1
4089
4194
 
4090
4195
      *.la)
4091
4196
        # Check to see that this really is a libtool archive.
4092
 
        if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
 
4197
        if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4093
4198
        else
4094
4199
          $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
4095
4200
          $echo "$help" 1>&2
4165
4270
          # Do each command in the postinstall commands.
4166
4271
          lib="$destdir/$realname"
4167
4272
          eval cmds=\"$postinstall_cmds\"
4168
 
          IFS="${IFS=   }"; save_ifs="$IFS"; IFS='~'
 
4273
          save_ifs="$IFS"; IFS='~'
4169
4274
          for cmd in $cmds; do
4170
4275
            IFS="$save_ifs"
4171
4276
            $show "$cmd"
4238
4343
        fi
4239
4344
 
4240
4345
        # Do a test to see if this is really a libtool program.
4241
 
        if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
4346
        case $host in
 
4347
        *cygwin*|*mingw*)
 
4348
            wrapper=`echo $file | ${SED} -e 's,.exe$,,'`
 
4349
            ;;
 
4350
        *)
 
4351
            wrapper=$file
 
4352
            ;;
 
4353
        esac
 
4354
        if (${SED} -e '4q' $wrapper | egrep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
4242
4355
          notinst_deplibs=
4243
4356
          relink_command=
4244
4357
 
4245
4358
          # If there is no directory component, then add one.
4246
4359
          case $file in
4247
 
          */* | *\\*) . $file ;;
4248
 
          *) . ./$file ;;
 
4360
          */* | *\\*) . $wrapper ;;
 
4361
          *) . ./$wrapper ;;
4249
4362
          esac
4250
4363
 
4251
4364
          # Check the variables that should have been set.
4252
4365
          if test -z "$notinst_deplibs"; then
4253
 
            $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
 
4366
            $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
4254
4367
            exit 1
4255
4368
          fi
4256
4369
 
4275
4388
          relink_command=
4276
4389
          # If there is no directory component, then add one.
4277
4390
          case $file in
4278
 
          */* | *\\*) . $file ;;
4279
 
          *) . ./$file ;;
 
4391
          */* | *\\*) . $wrapper ;;
 
4392
          *) . ./$wrapper ;;
4280
4393
          esac
4281
4394
 
4282
4395
          outputname=
4324
4437
            destfile=$destfile.exe
4325
4438
            ;;
4326
4439
          *:*.exe)
4327
 
            destfile=`echo $destfile | sed -e 's,.exe$,,'`
 
4440
            destfile=`echo $destfile | ${SED} -e 's,.exe$,,'`
4328
4441
            ;;
4329
4442
          esac
4330
4443
          ;;
4352
4465
 
4353
4466
      # Do each command in the postinstall commands.
4354
4467
      eval cmds=\"$old_postinstall_cmds\"
4355
 
      IFS="${IFS=       }"; save_ifs="$IFS"; IFS='~'
 
4468
      save_ifs="$IFS"; IFS='~'
4356
4469
      for cmd in $cmds; do
4357
4470
        IFS="$save_ifs"
4358
4471
        $show "$cmd"
4368
4481
    if test -n "$current_libdirs"; then
4369
4482
      # Maybe just do a dry run.
4370
4483
      test -n "$run" && current_libdirs=" -n$current_libdirs"
4371
 
      exec $SHELL $0 --finish$current_libdirs
4372
 
      exit 1
 
4484
      exec_cmd='$SHELL $0 --finish$current_libdirs'
 
4485
    else
 
4486
      exit 0
4373
4487
    fi
4374
 
 
4375
 
    exit 0
4376
4488
    ;;
4377
4489
 
4378
4490
  # libtool finish mode
4391
4503
        if test -n "$finish_cmds"; then
4392
4504
          # Do each command in the finish commands.
4393
4505
          eval cmds=\"$finish_cmds\"
4394
 
          IFS="${IFS=   }"; save_ifs="$IFS"; IFS='~'
 
4506
          save_ifs="$IFS"; IFS='~'
4395
4507
          for cmd in $cmds; do
4396
4508
            IFS="$save_ifs"
4397
4509
            $show "$cmd"
4473
4585
      case $file in
4474
4586
      *.la)
4475
4587
        # Check to see that this really is a libtool archive.
4476
 
        if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
 
4588
        if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4477
4589
        else
4478
4590
          $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
4479
4591
          $echo "$help" 1>&2
4544
4656
      -*) ;;
4545
4657
      *)
4546
4658
        # Do a test to see if this is really a libtool program.
4547
 
        if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
4659
        if (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4548
4660
          # If there is no directory component, then add one.
4549
4661
          case $file in
4550
4662
          */* | *\\*) . $file ;;
4575
4687
        LANG="$save_LANG"; export LANG
4576
4688
      fi
4577
4689
 
4578
 
      # Now actually exec the command.
4579
 
      eval "exec \$cmd$args"
4580
 
 
4581
 
      $echo "$modename: cannot exec \$cmd$args"
4582
 
      exit 1
 
4690
      # Now prepare to actually exec the command.
 
4691
      exec_cmd="\$cmd$args"
4583
4692
    else
4584
4693
      # Display what would be done.
4585
4694
      if test -n "$shlibpath_var"; then
4641
4750
 
4642
4751
      # Don't error if the file doesn't exist and rm -f was used.
4643
4752
      if (test -L "$file") >/dev/null 2>&1 \
4644
 
        || (test -h "$file") >/dev/null 2>&1 \
 
4753
        || (test -h "$file") >/dev/null 2>&1 \
4645
4754
        || test -f "$file"; then
4646
 
        :
 
4755
        :
4647
4756
      elif test -d "$file"; then
4648
 
        exit_status=1
 
4757
        exit_status=1
4649
4758
        continue
4650
4759
      elif test "$rmforce" = yes; then
4651
 
        continue
 
4760
        continue
4652
4761
      fi
4653
4762
 
4654
4763
      rmfiles="$file"
4656
4765
      case $name in
4657
4766
      *.la)
4658
4767
        # Possibly a libtool archive, so verify it.
4659
 
        if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
4768
        if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4660
4769
          . $dir/$name
4661
4770
 
4662
4771
          # Delete the libtool libraries and symlinks.
4670
4779
            if test -n "$library_names"; then
4671
4780
              # Do each command in the postuninstall commands.
4672
4781
              eval cmds=\"$postuninstall_cmds\"
4673
 
              IFS="${IFS=       }"; save_ifs="$IFS"; IFS='~'
 
4782
              save_ifs="$IFS"; IFS='~'
4674
4783
              for cmd in $cmds; do
4675
4784
                IFS="$save_ifs"
4676
4785
                $show "$cmd"
4685
4794
            if test -n "$old_library"; then
4686
4795
              # Do each command in the old_postuninstall commands.
4687
4796
              eval cmds=\"$old_postuninstall_cmds\"
4688
 
              IFS="${IFS=       }"; save_ifs="$IFS"; IFS='~'
 
4797
              save_ifs="$IFS"; IFS='~'
4689
4798
              for cmd in $cmds; do
4690
4799
                IFS="$save_ifs"
4691
4800
                $show "$cmd"
4711
4820
      *)
4712
4821
        # Do a test to see if this is a libtool program.
4713
4822
        if test $mode = clean &&
4714
 
           (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
4823
           (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4715
4824
          relink_command=
4716
4825
          . $dir/$file
4717
4826
 
4744
4853
    ;;
4745
4854
  esac
4746
4855
 
4747
 
  $echo "$modename: invalid operation mode \`$mode'" 1>&2
4748
 
  $echo "$generic_help" 1>&2
4749
 
  exit 1
 
4856
  if test -z "$exec_cmd"; then
 
4857
    $echo "$modename: invalid operation mode \`$mode'" 1>&2
 
4858
    $echo "$generic_help" 1>&2
 
4859
    exit 1
 
4860
  fi
4750
4861
fi # test -z "$show_help"
4751
4862
 
 
4863
if test -n "$exec_cmd"; then
 
4864
  eval exec $exec_cmd
 
4865
  exit 1
 
4866
fi
 
4867
 
4752
4868
# We need to display help for each of the modes.
4753
4869
case $mode in
4754
4870
"") $echo \