~ubuntu-branches/ubuntu/gutsy/curl/gutsy

« back to all changes in this revision

Viewing changes to ltmain.sh

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2006-06-29 15:04:24 UTC
  • mto: This revision was merged to the branch mainline in revision 8.
  • Revision ID: james.westby@ubuntu.com-20060629150424-be178abcwks1n519
Tags: upstream-7.15.4
ImportĀ upstreamĀ versionĀ 7.15.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
 
44
44
PROGRAM=ltmain.sh
45
45
PACKAGE=libtool
46
 
VERSION="1.5.20 Debian 1.5.20-2"
47
 
TIMESTAMP=" (1.1220.2.287 2005/08/31 18:54:15)"
 
46
VERSION="1.5.22 Debian 1.5.22-4"
 
47
TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)"
48
48
 
49
49
# See if we are running on zsh, and set the options which allow our
50
50
# commands through without removal of \ escapes.
132
132
show="$echo"
133
133
show_help=
134
134
execute_dlfiles=
 
135
duplicate_deps=no
 
136
preserve_args=
135
137
lo2o="s/\\.lo\$/.${objext}/"
136
138
o2lo="s/\\.${objext}\$/.lo/"
137
139
 
139
141
# Shell function definitions:
140
142
# This seems to be the best place for them
141
143
 
 
144
# func_mktempdir [string]
 
145
# Make a temporary directory that won't clash with other running
 
146
# libtool processes, and avoids race conditions if possible.  If
 
147
# given, STRING is the basename for that directory.
 
148
func_mktempdir ()
 
149
{
 
150
    my_template="${TMPDIR-/tmp}/${1-$progname}"
 
151
 
 
152
    if test "$run" = ":"; then
 
153
      # Return a directory name, but don't create it in dry-run mode
 
154
      my_tmpdir="${my_template}-$$"
 
155
    else
 
156
 
 
157
      # If mktemp works, use that first and foremost
 
158
      my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
 
159
 
 
160
      if test ! -d "$my_tmpdir"; then
 
161
        # Failing that, at least try and use $RANDOM to avoid a race
 
162
        my_tmpdir="${my_template}-${RANDOM-0}$$"
 
163
 
 
164
        save_mktempdir_umask=`umask`
 
165
        umask 0077
 
166
        $mkdir "$my_tmpdir"
 
167
        umask $save_mktempdir_umask
 
168
      fi
 
169
 
 
170
      # If we're not in dry-run mode, bomb out on failure
 
171
      test -d "$my_tmpdir" || {
 
172
        $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
 
173
        exit $EXIT_FAILURE
 
174
      }
 
175
    fi
 
176
 
 
177
    $echo "X$my_tmpdir" | $Xsed
 
178
}
 
179
 
 
180
 
142
181
# func_win32_libid arg
143
182
# return the library type of file 'arg'
144
183
#
157
196
    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
158
197
      $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
159
198
      win32_nmres=`eval $NM -f posix -A $1 | \
160
 
        sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
161
 
      if test "X$win32_nmres" = "Ximport" ; then
162
 
        win32_libid_type="x86 archive import"
163
 
      else
164
 
        win32_libid_type="x86 archive static"
165
 
      fi
 
199
        $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'`
 
200
      case $win32_nmres in
 
201
      import*)  win32_libid_type="x86 archive import";;
 
202
      *)        win32_libid_type="x86 archive static";;
 
203
      esac
166
204
    fi
167
205
    ;;
168
206
  *DLL*)
295
333
      $run ${rm}r "$my_xdir"
296
334
      $show "$mkdir $my_xdir"
297
335
      $run $mkdir "$my_xdir"
298
 
      status=$?
299
 
      if test "$status" -ne 0 && test ! -d "$my_xdir"; then
300
 
        exit $status
 
336
      exit_status=$?
 
337
      if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
 
338
        exit $exit_status
301
339
      fi
302
340
      case $host in
303
341
      *-darwin*)
352
390
# Darwin sucks
353
391
eval std_shrext=\"$shrext_cmds\"
354
392
 
 
393
disable_libs=no
 
394
 
355
395
# Parse our command line options once, thoroughly.
356
396
while test "$#" -gt 0
357
397
do
468
508
    preserve_args="$preserve_args $arg"
469
509
    ;;
470
510
 
471
 
  --tag) prevopt="--tag" prev=tag ;;
 
511
  --tag)
 
512
    prevopt="--tag"
 
513
    prev=tag
 
514
    preserve_args="$preserve_args --tag"
 
515
    ;;
472
516
  --tag=*)
473
517
    set tag "$optarg" ${1+"$@"}
474
518
    shift
500
544
  exit $EXIT_FAILURE
501
545
fi
502
546
 
 
547
case $disable_libs in
 
548
no) 
 
549
  ;;
 
550
shared)
 
551
  build_libtool_libs=no
 
552
  build_old_libs=yes
 
553
  ;;
 
554
static)
 
555
  build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
 
556
  ;;
 
557
esac
 
558
 
503
559
# If this variable is set in any of the actions, the command in it
504
560
# will be execed at the end.  This prevents here-documents from being
505
561
# left over by shells.
856
912
      if test ! -d "${xdir}$objdir"; then
857
913
        $show "$mkdir ${xdir}$objdir"
858
914
        $run $mkdir ${xdir}$objdir
859
 
        status=$?
860
 
        if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then
861
 
          exit $status
 
915
        exit_status=$?
 
916
        if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
 
917
          exit $exit_status
862
918
        fi
863
919
      fi
864
920
 
1061
1117
    no_install=no
1062
1118
    objs=
1063
1119
    non_pic_objects=
 
1120
    notinst_path= # paths that contain not-installed libtool libraries
1064
1121
    precious_files_regex=
1065
1122
    prefer_static_libs=no
1066
1123
    preload=no
1089
1146
          if test -n "$link_static_flag"; then
1090
1147
            dlopen_self=$dlopen_self_static
1091
1148
          fi
 
1149
          prefer_static_libs=yes
1092
1150
        else
1093
1151
          if test -z "$pic_flag" && test -n "$link_static_flag"; then
1094
1152
            dlopen_self=$dlopen_self_static
1095
1153
          fi
 
1154
          prefer_static_libs=built
1096
1155
        fi
1097
1156
        build_libtool_libs=no
1098
1157
        build_old_libs=yes
1099
 
        prefer_static_libs=yes
1100
1158
        break
1101
1159
        ;;
1102
1160
      esac
1271
1329
                  if test -z "$pic_object" || test "$pic_object" = none ; then
1272
1330
                    arg="$non_pic_object"
1273
1331
                  fi
 
1332
                else
 
1333
                  # If the PIC object exists, use it instead.
 
1334
                  # $xdir was prepended to $pic_object above.
 
1335
                  non_pic_object="$pic_object"
 
1336
                  non_pic_objects="$non_pic_objects $non_pic_object"
1274
1337
                fi
1275
1338
              else
1276
1339
                # Only an error if not doing a dry-run.
1354
1417
          prev=
1355
1418
          continue
1356
1419
          ;;
1357
 
        darwin_framework)
1358
 
          compiler_flags="$compiler_flags $arg"
 
1420
        darwin_framework|darwin_framework_skip)
 
1421
          test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
1359
1422
          compile_command="$compile_command $arg"
1360
1423
          finalize_command="$finalize_command $arg"
1361
1424
          prev=
1419
1482
        continue
1420
1483
        ;;
1421
1484
 
1422
 
      -framework|-arch)
1423
 
        prev=darwin_framework
1424
 
        compiler_flags="$compiler_flags $arg"
 
1485
      -framework|-arch|-isysroot)
 
1486
        case " $CC " in
 
1487
          *" ${arg} ${1} "* | *" ${arg} ${1} "*) 
 
1488
                prev=darwin_framework_skip ;;
 
1489
          *) compiler_flags="$compiler_flags $arg"
 
1490
             prev=darwin_framework ;;
 
1491
        esac
1425
1492
        compile_command="$compile_command $arg"
1426
1493
        finalize_command="$finalize_command $arg"
1427
 
        continue
1428
 
        ;;
 
1494
        continue
 
1495
        ;;
1429
1496
 
1430
1497
      -inst-prefix-dir)
1431
1498
        prev=inst_prefix
1453
1520
          absdir=`cd "$dir" && pwd`
1454
1521
          if test -z "$absdir"; then
1455
1522
            $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1456
 
            exit $EXIT_FAILURE
 
1523
            absdir="$dir"
 
1524
            notinst_path="$notinst_path $dir"
1457
1525
          fi
1458
1526
          dir="$absdir"
1459
1527
          ;;
1467
1535
        esac
1468
1536
        case $host in
1469
1537
        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
 
1538
          testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
1470
1539
          case :$dllsearchpath: in
1471
1540
          *":$dir:"*) ;;
1472
1541
          *) dllsearchpath="$dllsearchpath:$dir";;
1473
1542
          esac
 
1543
          case :$dllsearchpath: in
 
1544
          *":$testbindir:"*) ;;
 
1545
          *) dllsearchpath="$dllsearchpath:$testbindir";;
 
1546
          esac
1474
1547
          ;;
1475
1548
        esac
1476
1549
        continue
1479
1552
      -l*)
1480
1553
        if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1481
1554
          case $host in
1482
 
          *-*-cygwin* | *-*-pw32* | *-*-beos*)
 
1555
          *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
1483
1556
            # These systems don't actually have a C or math library (as such)
1484
1557
            continue
1485
1558
            ;;
1486
 
          *-*-mingw* | *-*-os2*)
 
1559
          *-*-os2*)
1487
1560
            # These systems don't actually have a C library (as such)
1488
1561
            test "X$arg" = "X-lc" && continue
1489
1562
            ;;
1495
1568
            # Rhapsody C and math libraries are in the System framework
1496
1569
            deplibs="$deplibs -framework System"
1497
1570
            continue
 
1571
            ;;
 
1572
          *-*-sco3.2v5* | *-*-sco5v6*)
 
1573
            # Causes problems with __ctype
 
1574
            test "X$arg" = "X-lc" && continue
 
1575
            ;;
 
1576
          *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
 
1577
            # Compiler inserts libc in the correct place for threads to work
 
1578
            test "X$arg" = "X-lc" && continue
 
1579
            ;;
1498
1580
          esac
1499
1581
        elif test "X$arg" = "X-lc_r"; then
1500
1582
         case $host in
1536
1618
      # +DA*, +DD* enable 64-bit mode on the HP compiler
1537
1619
      # -q* pass through compiler args for the IBM compiler
1538
1620
      # -m* pass through architecture-specific compiler args for GCC
1539
 
      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*)
 
1621
      # -m*, -t[45]*, -txscale* pass through architecture-specific
 
1622
      # compiler args for GCC
 
1623
      # -pg pass through profiling flag for GCC
 
1624
      # @file GCC response files
 
1625
      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \
 
1626
      -t[45]*|-txscale*|@*)
1540
1627
 
1541
1628
        # Unknown arguments in both finalize_command and compile_command need
1542
1629
        # to be aesthetically quoted because they are evaled later.
1548
1635
        esac
1549
1636
        compile_command="$compile_command $arg"
1550
1637
        finalize_command="$finalize_command $arg"
1551
 
        if test "$with_gcc" = "yes" ; then
1552
 
          compiler_flags="$compiler_flags $arg"
1553
 
        fi
 
1638
        compiler_flags="$compiler_flags $arg"
1554
1639
        continue
1555
1640
        ;;
1556
1641
 
1788
1873
            if test -z "$pic_object" || test "$pic_object" = none ; then
1789
1874
              arg="$non_pic_object"
1790
1875
            fi
 
1876
          else
 
1877
            # If the PIC object exists, use it instead.
 
1878
            # $xdir was prepended to $pic_object above.
 
1879
            non_pic_object="$pic_object"
 
1880
            non_pic_objects="$non_pic_objects $non_pic_object"
1791
1881
          fi
1792
1882
        else
1793
1883
          # Only an error if not doing a dry-run.
1893
1983
    if test ! -d "$output_objdir"; then
1894
1984
      $show "$mkdir $output_objdir"
1895
1985
      $run $mkdir $output_objdir
1896
 
      status=$?
1897
 
      if test "$status" -ne 0 && test ! -d "$output_objdir"; then
1898
 
        exit $status
 
1986
      exit_status=$?
 
1987
      if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
 
1988
        exit $exit_status
1899
1989
      fi
1900
1990
    fi
1901
1991
 
1958
2048
    newlib_search_path=
1959
2049
    need_relink=no # whether we're linking any uninstalled libtool libraries
1960
2050
    notinst_deplibs= # not-installed libtool libraries
1961
 
    notinst_path= # paths that contain not-installed libtool libraries
1962
2051
    case $linkmode in
1963
2052
    lib)
1964
2053
        passes="conv link"
2197
2286
        esac # case $deplib
2198
2287
        if test "$found" = yes || test -f "$lib"; then :
2199
2288
        else
2200
 
          $echo "$modename: cannot find the library \`$lib'" 1>&2
 
2289
          $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
2201
2290
          exit $EXIT_FAILURE
2202
2291
        fi
2203
2292
 
2448
2537
        fi
2449
2538
 
2450
2539
        link_static=no # Whether the deplib will be linked statically
 
2540
        use_static_libs=$prefer_static_libs
 
2541
        if test "$use_static_libs" = built && test "$installed" = yes ; then
 
2542
          use_static_libs=no
 
2543
        fi
2451
2544
        if test -n "$library_names" &&
2452
 
           { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
 
2545
           { test "$use_static_libs" = no || test -z "$old_library"; }; then
2453
2546
          if test "$installed" = no; then
2454
2547
            notinst_deplibs="$notinst_deplibs $lib"
2455
2548
            need_relink=yes
2562
2655
              if test "$hardcode_direct" = no; then
2563
2656
                add="$dir/$linklib"
2564
2657
                case $host in
2565
 
                  *-*-sco3.2v5* ) add_dir="-L$dir" ;;
 
2658
                  *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
 
2659
                  *-*-sysv4*uw2*) add_dir="-L$dir" ;;
 
2660
                  *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
 
2661
                    *-*-unixware7*) add_dir="-L$dir" ;;
2566
2662
                  *-*-darwin* )
2567
2663
                    # if the lib is a module then we can not link against
2568
2664
                    # it, someone is ignoring the new warnings I added
2569
 
                    if /usr/bin/file -L $add 2> /dev/null | $EGREP "bundle" >/dev/null ; then
 
2665
                    if /usr/bin/file -L $add 2> /dev/null |
 
2666
                      $EGREP ": [^:]* bundle" >/dev/null ; then
2570
2667
                      $echo "** Warning, lib $linklib is a module, not a shared library"
2571
2668
                      if test -z "$old_library" ; then
2572
2669
                        $echo
3322
3419
 
3323
3420
      # Eliminate all temporary directories.
3324
3421
      for path in $notinst_path; do
3325
 
        lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
3326
 
        deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
3327
 
        dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
 
3422
        lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
 
3423
        deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
 
3424
        dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
3328
3425
      done
3329
3426
 
3330
3427
      if test -n "$xrpath"; then
3377
3474
            ;;
3378
3475
          *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
3379
3476
            # Do not include libc due to us having libc/libc_r.
3380
 
            test "X$arg" = "X-lc" && continue
 
3477
            ;;
 
3478
          *-*-sco3.2v5* | *-*-sco5v6*)
 
3479
            # Causes problems with __ctype
 
3480
            ;;
 
3481
          *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
 
3482
            # Compiler inserts libc in the correct place for threads to work
3381
3483
            ;;
3382
3484
          *)
3383
3485
            # Add libc to deplibs on all other systems if necessary.
3421
3523
          int main() { return 0; }
3422
3524
EOF
3423
3525
          $rm conftest
3424
 
          $LTCC -o conftest conftest.c $deplibs
 
3526
          $LTCC $LTCFLAGS -o conftest conftest.c $deplibs
3425
3527
          if test "$?" -eq 0 ; then
3426
3528
            ldd_output=`ldd conftest`
3427
3529
            for i in $deplibs; do
3466
3568
              # If $name is empty we are operating on a -L argument.
3467
3569
              if test "$name" != "" && test "$name" != "0"; then
3468
3570
                $rm conftest
3469
 
                $LTCC -o conftest conftest.c $i
 
3571
                $LTCC $LTCFLAGS -o conftest conftest.c $i
3470
3572
                # Did it work?
3471
3573
                if test "$?" -eq 0 ; then
3472
3574
                  ldd_output=`ldd conftest`
3713
3815
        deplibs=$newdeplibs
3714
3816
      fi
3715
3817
 
 
3818
 
 
3819
      # move library search paths that coincide with paths to not yet
 
3820
      # installed libraries to the beginning of the library search list
 
3821
      new_libs=
 
3822
      for path in $notinst_path; do
 
3823
        case " $new_libs " in
 
3824
        *" -L$path/$objdir "*) ;;
 
3825
        *)
 
3826
          case " $deplibs " in
 
3827
          *" -L$path/$objdir "*)
 
3828
            new_libs="$new_libs -L$path/$objdir" ;;
 
3829
          esac
 
3830
          ;;
 
3831
        esac
 
3832
      done
 
3833
      for deplib in $deplibs; do
 
3834
        case $deplib in
 
3835
        -L*)
 
3836
          case " $new_libs " in
 
3837
          *" $deplib "*) ;;
 
3838
          *) new_libs="$new_libs $deplib" ;;
 
3839
          esac
 
3840
          ;;
 
3841
        *) new_libs="$new_libs $deplib" ;;
 
3842
        esac
 
3843
      done
 
3844
      deplibs="$new_libs"
 
3845
 
 
3846
 
3716
3847
      # All the library-specific variables (install_libdir is set above).
3717
3848
      library_names=
3718
3849
      old_library=
3796
3927
        fi
3797
3928
 
3798
3929
        lib="$output_objdir/$realname"
 
3930
        linknames=
3799
3931
        for link
3800
3932
        do
3801
3933
          linknames="$linknames $link"
4227
4359
        ;;
4228
4360
      esac
4229
4361
 
 
4362
 
 
4363
      # move library search paths that coincide with paths to not yet
 
4364
      # installed libraries to the beginning of the library search list
 
4365
      new_libs=
 
4366
      for path in $notinst_path; do
 
4367
        case " $new_libs " in
 
4368
        *" -L$path/$objdir "*) ;;
 
4369
        *)
 
4370
          case " $compile_deplibs " in
 
4371
          *" -L$path/$objdir "*)
 
4372
            new_libs="$new_libs -L$path/$objdir" ;;
 
4373
          esac
 
4374
          ;;
 
4375
        esac
 
4376
      done
 
4377
      for deplib in $compile_deplibs; do
 
4378
        case $deplib in
 
4379
        -L*)
 
4380
          case " $new_libs " in
 
4381
          *" $deplib "*) ;;
 
4382
          *) new_libs="$new_libs $deplib" ;;
 
4383
          esac
 
4384
          ;;
 
4385
        *) new_libs="$new_libs $deplib" ;;
 
4386
        esac
 
4387
      done
 
4388
      compile_deplibs="$new_libs"
 
4389
 
 
4390
 
4230
4391
      compile_command="$compile_command $compile_deplibs"
4231
4392
      finalize_command="$finalize_command $finalize_deplibs"
4232
4393
 
4271
4432
        fi
4272
4433
        case $host in
4273
4434
        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
 
4435
          testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
4274
4436
          case :$dllsearchpath: in
4275
4437
          *":$libdir:"*) ;;
4276
4438
          *) dllsearchpath="$dllsearchpath:$libdir";;
4277
4439
          esac
 
4440
          case :$dllsearchpath: in
 
4441
          *":$testbindir:"*) ;;
 
4442
          *) dllsearchpath="$dllsearchpath:$testbindir";;
 
4443
          esac
4278
4444
          ;;
4279
4445
        esac
4280
4446
      done
4391
4557
              export_symbols="$output_objdir/$outputname.exp"
4392
4558
              $run $rm $export_symbols
4393
4559
              $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
 
4560
              case $host in
 
4561
              *cygwin* | *mingw* )
 
4562
                $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
 
4563
                $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
 
4564
                ;;
 
4565
              esac
4394
4566
            else
4395
 
              $run eval "${SED} -e 's/\([ ][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
 
4567
              $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
4396
4568
              $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
4397
4569
              $run eval 'mv "$nlist"T "$nlist"'
 
4570
              case $host in
 
4571
              *cygwin* | *mingw* )
 
4572
                $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
 
4573
                $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
 
4574
                ;;
 
4575
              esac
4398
4576
            fi
4399
4577
          fi
4400
4578
 
4511
4689
          esac
4512
4690
 
4513
4691
          # Now compile the dynamic symbol file.
4514
 
          $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
4515
 
          $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
 
4692
          $show "(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
 
4693
          $run eval '(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
4516
4694
 
4517
4695
          # Clean up the generated files.
4518
4696
          $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
4519
4697
          $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
4520
4698
 
4521
4699
          # Transform the symbol file into the correct name.
4522
 
          compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4523
 
          finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
 
4700
          case $host in
 
4701
          *cygwin* | *mingw* )
 
4702
            if test -f "$output_objdir/${outputname}.def" ; then
 
4703
              compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
 
4704
              finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
 
4705
            else
 
4706
              compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
 
4707
              finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
 
4708
             fi
 
4709
            ;;
 
4710
          * )
 
4711
            compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
 
4712
            finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
 
4713
            ;;
 
4714
          esac
4524
4715
          ;;
4525
4716
        *)
4526
4717
          $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
4545
4736
        # We have no uninstalled library dependencies, so finalize right now.
4546
4737
        $show "$link_command"
4547
4738
        $run eval "$link_command"
4548
 
        status=$?
 
4739
        exit_status=$?
4549
4740
 
4550
4741
        # Delete the generated files.
4551
4742
        if test -n "$dlsyms"; then
4553
4744
          $run $rm "$output_objdir/${outputname}S.${objext}"
4554
4745
        fi
4555
4746
 
4556
 
        exit $status
 
4747
        exit $exit_status
4557
4748
      fi
4558
4749
 
4559
4750
      if test -n "$shlibpath_var"; then
4693
4884
        esac
4694
4885
        case $host in
4695
4886
          *cygwin* | *mingw* )
4696
 
            cwrappersource=`$echo ${objdir}/lt-${outputname}.c`
4697
 
            cwrapper=`$echo ${output}.exe`
4698
 
            $rm $cwrappersource $cwrapper
4699
 
            trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
 
4887
            output_name=`basename $output`
 
4888
            output_path=`dirname $output`
 
4889
            cwrappersource="$output_path/$objdir/lt-$output_name.c"
 
4890
            cwrapper="$output_path/$output_name.exe"
 
4891
            $rm $cwrappersource $cwrapper
 
4892
            trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
4700
4893
 
4701
4894
            cat > $cwrappersource <<EOF
4702
4895
 
4721
4914
#include <malloc.h>
4722
4915
#include <stdarg.h>
4723
4916
#include <assert.h>
 
4917
#include <string.h>
 
4918
#include <ctype.h>
 
4919
#include <sys/stat.h>
4724
4920
 
4725
4921
#if defined(PATH_MAX)
4726
4922
# define LT_PATHMAX PATH_MAX
4731
4927
#endif
4732
4928
 
4733
4929
#ifndef DIR_SEPARATOR
4734
 
#define DIR_SEPARATOR '/'
 
4930
# define DIR_SEPARATOR '/'
 
4931
# define PATH_SEPARATOR ':'
4735
4932
#endif
4736
4933
 
4737
4934
#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4738
4935
  defined (__OS2__)
4739
 
#define HAVE_DOS_BASED_FILE_SYSTEM
4740
 
#ifndef DIR_SEPARATOR_2
4741
 
#define DIR_SEPARATOR_2 '\\'
4742
 
#endif
 
4936
# define HAVE_DOS_BASED_FILE_SYSTEM
 
4937
# ifndef DIR_SEPARATOR_2
 
4938
#  define DIR_SEPARATOR_2 '\\'
 
4939
# endif
 
4940
# ifndef PATH_SEPARATOR_2
 
4941
#  define PATH_SEPARATOR_2 ';'
 
4942
# endif
4743
4943
#endif
4744
4944
 
4745
4945
#ifndef DIR_SEPARATOR_2
4749
4949
        (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
4750
4950
#endif /* DIR_SEPARATOR_2 */
4751
4951
 
 
4952
#ifndef PATH_SEPARATOR_2
 
4953
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
 
4954
#else /* PATH_SEPARATOR_2 */
 
4955
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
 
4956
#endif /* PATH_SEPARATOR_2 */
 
4957
 
4752
4958
#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
4753
4959
#define XFREE(stale) do { \
4754
4960
  if (stale) { free ((void *) stale); stale = 0; } \
4755
4961
} while (0)
4756
4962
 
 
4963
/* -DDEBUG is fairly common in CFLAGS.  */
 
4964
#undef DEBUG
 
4965
#if defined DEBUGWRAPPER
 
4966
# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
 
4967
#else
 
4968
# define DEBUG(format, ...)
 
4969
#endif
 
4970
 
4757
4971
const char *program_name = NULL;
4758
4972
 
4759
4973
void * xmalloc (size_t num);
4760
4974
char * xstrdup (const char *string);
4761
 
char * basename (const char *name);
4762
 
char * fnqualify(const char *path);
 
4975
const char * base_name (const char *name);
 
4976
char * find_executable(const char *wrapper);
 
4977
int    check_executable(const char *path);
4763
4978
char * strendzap(char *str, const char *pat);
4764
4979
void lt_fatal (const char *message, ...);
4765
4980
 
4769
4984
  char **newargz;
4770
4985
  int i;
4771
4986
 
4772
 
  program_name = (char *) xstrdup ((char *) basename (argv[0]));
 
4987
  program_name = (char *) xstrdup (base_name (argv[0]));
 
4988
  DEBUG("(main) argv[0]      : %s\n",argv[0]);
 
4989
  DEBUG("(main) program_name : %s\n",program_name);
4773
4990
  newargz = XMALLOC(char *, argc+2);
4774
4991
EOF
4775
4992
 
4776
 
            cat >> $cwrappersource <<EOF
4777
 
  newargz[0] = "$SHELL";
 
4993
            cat >> $cwrappersource <<EOF
 
4994
  newargz[0] = (char *) xstrdup("$SHELL");
4778
4995
EOF
4779
4996
 
4780
 
            cat >> $cwrappersource <<"EOF"
4781
 
  newargz[1] = fnqualify(argv[0]);
 
4997
            cat >> $cwrappersource <<"EOF"
 
4998
  newargz[1] = find_executable(argv[0]);
 
4999
  if (newargz[1] == NULL)
 
5000
    lt_fatal("Couldn't find %s", argv[0]);
 
5001
  DEBUG("(main) found exe at : %s\n",newargz[1]);
4782
5002
  /* we know the script has the same name, without the .exe */
4783
5003
  /* so make sure newargz[1] doesn't end in .exe */
4784
5004
  strendzap(newargz[1],".exe");
4785
5005
  for (i = 1; i < argc; i++)
4786
5006
    newargz[i+1] = xstrdup(argv[i]);
4787
5007
  newargz[argc+1] = NULL;
4788
 
EOF
4789
 
 
4790
 
            cat >> $cwrappersource <<EOF
 
5008
 
 
5009
  for (i=0; i<argc+1; i++)
 
5010
  {
 
5011
    DEBUG("(main) newargz[%d]   : %s\n",i,newargz[i]);
 
5012
    ;
 
5013
  }
 
5014
 
 
5015
EOF
 
5016
 
 
5017
            case $host_os in
 
5018
              mingw*)
 
5019
                cat >> $cwrappersource <<EOF
 
5020
  execv("$SHELL",(char const **)newargz);
 
5021
EOF
 
5022
              ;;
 
5023
              *)
 
5024
                cat >> $cwrappersource <<EOF
4791
5025
  execv("$SHELL",newargz);
4792
5026
EOF
 
5027
              ;;
 
5028
            esac
4793
5029
 
4794
 
            cat >> $cwrappersource <<"EOF"
 
5030
            cat >> $cwrappersource <<"EOF"
4795
5031
  return 127;
4796
5032
}
4797
5033
 
4812
5048
;
4813
5049
}
4814
5050
 
4815
 
char *
4816
 
basename (const char *name)
 
5051
const char *
 
5052
base_name (const char *name)
4817
5053
{
4818
5054
  const char *base;
4819
5055
 
4820
5056
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4821
5057
  /* Skip over the disk name in MSDOS pathnames. */
4822
 
  if (isalpha (name[0]) && name[1] == ':')
 
5058
  if (isalpha ((unsigned char)name[0]) && name[1] == ':')
4823
5059
    name += 2;
4824
5060
#endif
4825
5061
 
4826
5062
  for (base = name; *name; name++)
4827
5063
    if (IS_DIR_SEPARATOR (*name))
4828
5064
      base = name + 1;
4829
 
  return (char *) base;
4830
 
}
4831
 
 
 
5065
  return base;
 
5066
}
 
5067
 
 
5068
int
 
5069
check_executable(const char * path)
 
5070
{
 
5071
  struct stat st;
 
5072
 
 
5073
  DEBUG("(check_executable)  : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
 
5074
  if ((!path) || (!*path))
 
5075
    return 0;
 
5076
 
 
5077
  if ((stat (path, &st) >= 0) &&
 
5078
      (
 
5079
        /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
 
5080
#if defined (S_IXOTH)
 
5081
       ((st.st_mode & S_IXOTH) == S_IXOTH) ||
 
5082
#endif
 
5083
#if defined (S_IXGRP)
 
5084
       ((st.st_mode & S_IXGRP) == S_IXGRP) ||
 
5085
#endif
 
5086
       ((st.st_mode & S_IXUSR) == S_IXUSR))
 
5087
      )
 
5088
    return 1;
 
5089
  else
 
5090
    return 0;
 
5091
}
 
5092
 
 
5093
/* Searches for the full path of the wrapper.  Returns
 
5094
   newly allocated full path name if found, NULL otherwise */
4832
5095
char *
4833
 
fnqualify(const char *path)
 
5096
find_executable (const char* wrapper)
4834
5097
{
4835
 
  size_t size;
4836
 
  char *p;
 
5098
  int has_slash = 0;
 
5099
  const char* p;
 
5100
  const char* p_next;
 
5101
  /* static buffer for getcwd */
4837
5102
  char tmp[LT_PATHMAX + 1];
4838
 
 
4839
 
  assert(path != NULL);
4840
 
 
4841
 
  /* Is it qualified already? */
4842
 
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4843
 
  if (isalpha (path[0]) && path[1] == ':')
4844
 
    return xstrdup (path);
4845
 
#endif
4846
 
  if (IS_DIR_SEPARATOR (path[0]))
4847
 
    return xstrdup (path);
4848
 
 
4849
 
  /* prepend the current directory */
4850
 
  /* doesn't handle '~' */
 
5103
  int tmp_len;
 
5104
  char* concat_name;
 
5105
 
 
5106
  DEBUG("(find_executable)  : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
 
5107
 
 
5108
  if ((wrapper == NULL) || (*wrapper == '\0'))
 
5109
    return NULL;
 
5110
 
 
5111
  /* Absolute path? */
 
5112
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
 
5113
  if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
 
5114
  {
 
5115
    concat_name = xstrdup (wrapper);
 
5116
    if (check_executable(concat_name))
 
5117
      return concat_name;
 
5118
    XFREE(concat_name);
 
5119
  }
 
5120
  else
 
5121
  {
 
5122
#endif
 
5123
    if (IS_DIR_SEPARATOR (wrapper[0]))
 
5124
    {
 
5125
      concat_name = xstrdup (wrapper);
 
5126
      if (check_executable(concat_name))
 
5127
        return concat_name;
 
5128
      XFREE(concat_name);
 
5129
    }
 
5130
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
 
5131
  }
 
5132
#endif
 
5133
 
 
5134
  for (p = wrapper; *p; p++)
 
5135
    if (*p == '/')
 
5136
    {
 
5137
      has_slash = 1;
 
5138
      break;
 
5139
    }
 
5140
  if (!has_slash)
 
5141
  {
 
5142
    /* no slashes; search PATH */
 
5143
    const char* path = getenv ("PATH");
 
5144
    if (path != NULL)
 
5145
    {
 
5146
      for (p = path; *p; p = p_next)
 
5147
      {
 
5148
        const char* q;
 
5149
        size_t p_len;
 
5150
        for (q = p; *q; q++)
 
5151
          if (IS_PATH_SEPARATOR(*q))
 
5152
            break;
 
5153
        p_len = q - p;
 
5154
        p_next = (*q == '\0' ? q : q + 1);
 
5155
        if (p_len == 0)
 
5156
        {
 
5157
          /* empty path: current directory */
 
5158
          if (getcwd (tmp, LT_PATHMAX) == NULL)
 
5159
            lt_fatal ("getcwd failed");
 
5160
          tmp_len = strlen(tmp);
 
5161
          concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
 
5162
          memcpy (concat_name, tmp, tmp_len);
 
5163
          concat_name[tmp_len] = '/';
 
5164
          strcpy (concat_name + tmp_len + 1, wrapper);
 
5165
        }
 
5166
        else
 
5167
        {
 
5168
          concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
 
5169
          memcpy (concat_name, p, p_len);
 
5170
          concat_name[p_len] = '/';
 
5171
          strcpy (concat_name + p_len + 1, wrapper);
 
5172
        }
 
5173
        if (check_executable(concat_name))
 
5174
          return concat_name;
 
5175
        XFREE(concat_name);
 
5176
      }
 
5177
    }
 
5178
    /* not found in PATH; assume curdir */
 
5179
  }
 
5180
  /* Relative path | not found in path: prepend cwd */
4851
5181
  if (getcwd (tmp, LT_PATHMAX) == NULL)
4852
5182
    lt_fatal ("getcwd failed");
4853
 
  size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */
4854
 
  p = XMALLOC(char, size);
4855
 
  sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path);
4856
 
  return p;
 
5183
  tmp_len = strlen(tmp);
 
5184
  concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
 
5185
  memcpy (concat_name, tmp, tmp_len);
 
5186
  concat_name[tmp_len] = '/';
 
5187
  strcpy (concat_name + tmp_len + 1, wrapper);
 
5188
 
 
5189
  if (check_executable(concat_name))
 
5190
    return concat_name;
 
5191
  XFREE(concat_name);
 
5192
  return NULL;
4857
5193
}
4858
5194
 
4859
5195
char *
4897
5233
  va_end (ap);
4898
5234
}
4899
5235
EOF
4900
 
          # we should really use a build-platform specific compiler
4901
 
          # here, but OTOH, the wrappers (shell script and this C one)
4902
 
          # are only useful if you want to execute the "real" binary.
4903
 
          # Since the "real" binary is built for $host, then this
4904
 
          # wrapper might as well be built for $host, too.
4905
 
          $run $LTCC -s -o $cwrapper $cwrappersource
4906
 
          ;;
4907
 
        esac
4908
 
        $rm $output
4909
 
        trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
 
5236
          # we should really use a build-platform specific compiler
 
5237
          # here, but OTOH, the wrappers (shell script and this C one)
 
5238
          # are only useful if you want to execute the "real" binary.
 
5239
          # Since the "real" binary is built for $host, then this
 
5240
          # wrapper might as well be built for $host, too.
 
5241
          $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
 
5242
          ;;
 
5243
        esac
 
5244
        $rm $output
 
5245
        trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
4910
5246
 
4911
5247
        $echo > $output "\
4912
5248
#! $SHELL
5136
5472
            $run ${rm}r "$gentop"
5137
5473
            $show "$mkdir $gentop"
5138
5474
            $run $mkdir "$gentop"
5139
 
            status=$?
5140
 
            if test "$status" -ne 0 && test ! -d "$gentop"; then
5141
 
              exit $status
 
5475
            exit_status=$?
 
5476
            if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
 
5477
              exit $exit_status
5142
5478
            fi
5143
5479
          fi
5144
5480
 
5805
6141
          outputname=
5806
6142
          if test "$fast_install" = no && test -n "$relink_command"; then
5807
6143
            if test "$finalize" = yes && test -z "$run"; then
5808
 
              tmpdir="/tmp"
5809
 
              test -n "$TMPDIR" && tmpdir="$TMPDIR"
5810
 
              tmpdir="$tmpdir/libtool-$$"
5811
 
              save_umask=`umask`
5812
 
              umask 0077
5813
 
              if $mkdir "$tmpdir"; then
5814
 
                umask $save_umask
5815
 
              else
5816
 
                umask $save_umask
5817
 
                $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
5818
 
                continue
5819
 
              fi
 
6144
              tmpdir=`func_mktempdir`
5820
6145
              file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
5821
6146
              outputname="$tmpdir/$file"
5822
6147
              # Replace the output file specification.
5940
6265
    # Exit here if they wanted silent mode.
5941
6266
    test "$show" = : && exit $EXIT_SUCCESS
5942
6267
 
5943
 
    $echo "----------------------------------------------------------------------"
 
6268
    $echo "X----------------------------------------------------------------------" | $Xsed
5944
6269
    $echo "Libraries have been installed in:"
5945
6270
    for libdir in $libdirs; do
5946
6271
      $echo "   $libdir"
5973
6298
    $echo
5974
6299
    $echo "See any operating system documentation about shared libraries for"
5975
6300
    $echo "more information, such as the ld(1) and ld.so(8) manual pages."
5976
 
    $echo "----------------------------------------------------------------------"
 
6301
    $echo "X----------------------------------------------------------------------" | $Xsed
5977
6302
    exit $EXIT_SUCCESS
5978
6303
    ;;
5979
6304
 
6190
6515
            rmfiles="$rmfiles $objdir/$n"
6191
6516
          done
6192
6517
          test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
6193
 
          test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
6194
6518
 
6195
 
          if test "$mode" = uninstall; then
 
6519
          case "$mode" in
 
6520
          clean)
 
6521
            case "  $library_names " in
 
6522
            # "  " in the beginning catches empty $dlname
 
6523
            *" $dlname "*) ;;
 
6524
            *) rmfiles="$rmfiles $objdir/$dlname" ;;
 
6525
            esac
 
6526
             test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
 
6527
            ;;
 
6528
          uninstall)
6196
6529
            if test -n "$library_names"; then
6197
6530
              # Do each command in the postuninstall commands.
6198
6531
              cmds=$postuninstall_cmds
6225
6558
              IFS="$save_ifs"
6226
6559
            fi
6227
6560
            # FIXME: should reinstall the best remaining shared library.
6228
 
          fi
 
6561
            ;;
 
6562
          esac
6229
6563
        fi
6230
6564
        ;;
6231
6565
 
6524
6858
# configuration.  But we'll never go from static-only to shared-only.
6525
6859
 
6526
6860
# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
6527
 
build_libtool_libs=no
6528
 
build_old_libs=yes
 
6861
disable_libs=shared
6529
6862
# ### END LIBTOOL TAG CONFIG: disable-shared
6530
6863
 
6531
6864
# ### BEGIN LIBTOOL TAG CONFIG: disable-static
6532
 
build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac`
 
6865
disable_libs=static
6533
6866
# ### END LIBTOOL TAG CONFIG: disable-static
6534
6867
 
6535
6868
# Local Variables: