~ubuntu-branches/ubuntu/intrepid/apache2/intrepid

« back to all changes in this revision

Viewing changes to srclib/apr/build/ltmain.sh

  • Committer: Bazaar Package Importer
  • Author(s): Stefan Fritsch
  • Date: 2007-10-18 19:35:40 UTC
  • mfrom: (0.13.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20071018193540-u9bl0154m45xppyj
Tags: 2.2.6-2
* Avoid calling apr_pollset_poll() and accept_func() when the listening
  sockets have already been closed on graceful stop or reload. This
  hopefully fixes processes not being killed (closes: #445263, #447164)
  and the "Bad file descriptor: apr_socket_accept: (client socket)"
  error message (closes: #400918, #443310)
* Allow logresolve to process long lines (Closes: #331631)
* Remove duplicate config examples (Closes: #294662)
* Include README.backtrace describing how to create a backtrace
* Add CVE reference to 2.2.6-1 changelog entry

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
47
 
TIMESTAMP=" (1.1220.2.287 2005/08/31 18:54:15)"
 
46
VERSION=1.5.22
 
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"
2194
2283
        esac # case $deplib
2195
2284
        if test "$found" = yes || test -f "$lib"; then :
2196
2285
        else
2197
 
          $echo "$modename: cannot find the library \`$lib'" 1>&2
 
2286
          $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
2198
2287
          exit $EXIT_FAILURE
2199
2288
        fi
2200
2289
 
2445
2534
        fi
2446
2535
 
2447
2536
        link_static=no # Whether the deplib will be linked statically
 
2537
        use_static_libs=$prefer_static_libs
 
2538
        if test "$use_static_libs" = built && test "$installed" = yes ; then
 
2539
          use_static_libs=no
 
2540
        fi
2448
2541
        if test -n "$library_names" &&
2449
 
           { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
 
2542
           { test "$use_static_libs" = no || test -z "$old_library"; }; then
2450
2543
          if test "$installed" = no; then
2451
2544
            notinst_deplibs="$notinst_deplibs $lib"
2452
2545
            need_relink=yes
2559
2652
              if test "$hardcode_direct" = no; then
2560
2653
                add="$dir/$linklib"
2561
2654
                case $host in
2562
 
                  *-*-sco3.2v5* ) add_dir="-L$dir" ;;
 
2655
                  *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
 
2656
                  *-*-sysv4*uw2*) add_dir="-L$dir" ;;
 
2657
                  *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
 
2658
                    *-*-unixware7*) add_dir="-L$dir" ;;
2563
2659
                  *-*-darwin* )
2564
2660
                    # if the lib is a module then we can not link against
2565
2661
                    # it, someone is ignoring the new warnings I added
2566
 
                    if /usr/bin/file -L $add 2> /dev/null | $EGREP "bundle" >/dev/null ; then
 
2662
                    if /usr/bin/file -L $add 2> /dev/null |
 
2663
                      $EGREP ": [^:]* bundle" >/dev/null ; then
2567
2664
                      $echo "** Warning, lib $linklib is a module, not a shared library"
2568
2665
                      if test -z "$old_library" ; then
2569
2666
                        $echo
3314
3411
 
3315
3412
      # Eliminate all temporary directories.
3316
3413
      for path in $notinst_path; do
3317
 
        lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
3318
 
        deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
3319
 
        dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
 
3414
        lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
 
3415
        deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
 
3416
        dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
3320
3417
      done
3321
3418
 
3322
3419
      if test -n "$xrpath"; then
3369
3466
            ;;
3370
3467
          *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
3371
3468
            # Do not include libc due to us having libc/libc_r.
3372
 
            test "X$arg" = "X-lc" && continue
 
3469
            ;;
 
3470
          *-*-sco3.2v5* | *-*-sco5v6*)
 
3471
            # Causes problems with __ctype
 
3472
            ;;
 
3473
          *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
 
3474
            # Compiler inserts libc in the correct place for threads to work
3373
3475
            ;;
3374
3476
          *)
3375
3477
            # Add libc to deplibs on all other systems if necessary.
3413
3515
          int main() { return 0; }
3414
3516
EOF
3415
3517
          $rm conftest
3416
 
          $LTCC -o conftest conftest.c $deplibs
 
3518
          $LTCC $LTCFLAGS -o conftest conftest.c $deplibs
3417
3519
          if test "$?" -eq 0 ; then
3418
3520
            ldd_output=`ldd conftest`
3419
3521
            for i in $deplibs; do
3458
3560
              # If $name is empty we are operating on a -L argument.
3459
3561
              if test "$name" != "" && test "$name" != "0"; then
3460
3562
                $rm conftest
3461
 
                $LTCC -o conftest conftest.c $i
 
3563
                $LTCC $LTCFLAGS -o conftest conftest.c $i
3462
3564
                # Did it work?
3463
3565
                if test "$?" -eq 0 ; then
3464
3566
                  ldd_output=`ldd conftest`
3705
3807
        deplibs=$newdeplibs
3706
3808
      fi
3707
3809
 
 
3810
 
 
3811
      # move library search paths that coincide with paths to not yet
 
3812
      # installed libraries to the beginning of the library search list
 
3813
      new_libs=
 
3814
      for path in $notinst_path; do
 
3815
        case " $new_libs " in
 
3816
        *" -L$path/$objdir "*) ;;
 
3817
        *)
 
3818
          case " $deplibs " in
 
3819
          *" -L$path/$objdir "*)
 
3820
            new_libs="$new_libs -L$path/$objdir" ;;
 
3821
          esac
 
3822
          ;;
 
3823
        esac
 
3824
      done
 
3825
      for deplib in $deplibs; do
 
3826
        case $deplib in
 
3827
        -L*)
 
3828
          case " $new_libs " in
 
3829
          *" $deplib "*) ;;
 
3830
          *) new_libs="$new_libs $deplib" ;;
 
3831
          esac
 
3832
          ;;
 
3833
        *) new_libs="$new_libs $deplib" ;;
 
3834
        esac
 
3835
      done
 
3836
      deplibs="$new_libs"
 
3837
 
 
3838
 
3708
3839
      # All the library-specific variables (install_libdir is set above).
3709
3840
      library_names=
3710
3841
      old_library=
3788
3919
        fi
3789
3920
 
3790
3921
        lib="$output_objdir/$realname"
 
3922
        linknames=
3791
3923
        for link
3792
3924
        do
3793
3925
          linknames="$linknames $link"
4219
4351
        ;;
4220
4352
      esac
4221
4353
 
 
4354
 
 
4355
      # move library search paths that coincide with paths to not yet
 
4356
      # installed libraries to the beginning of the library search list
 
4357
      new_libs=
 
4358
      for path in $notinst_path; do
 
4359
        case " $new_libs " in
 
4360
        *" -L$path/$objdir "*) ;;
 
4361
        *)
 
4362
          case " $compile_deplibs " in
 
4363
          *" -L$path/$objdir "*)
 
4364
            new_libs="$new_libs -L$path/$objdir" ;;
 
4365
          esac
 
4366
          ;;
 
4367
        esac
 
4368
      done
 
4369
      for deplib in $compile_deplibs; do
 
4370
        case $deplib in
 
4371
        -L*)
 
4372
          case " $new_libs " in
 
4373
          *" $deplib "*) ;;
 
4374
          *) new_libs="$new_libs $deplib" ;;
 
4375
          esac
 
4376
          ;;
 
4377
        *) new_libs="$new_libs $deplib" ;;
 
4378
        esac
 
4379
      done
 
4380
      compile_deplibs="$new_libs"
 
4381
 
 
4382
 
4222
4383
      compile_command="$compile_command $compile_deplibs"
4223
4384
      finalize_command="$finalize_command $finalize_deplibs"
4224
4385
 
4263
4424
        fi
4264
4425
        case $host in
4265
4426
        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
 
4427
          testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
4266
4428
          case :$dllsearchpath: in
4267
4429
          *":$libdir:"*) ;;
4268
4430
          *) dllsearchpath="$dllsearchpath:$libdir";;
4269
4431
          esac
 
4432
          case :$dllsearchpath: in
 
4433
          *":$testbindir:"*) ;;
 
4434
          *) dllsearchpath="$dllsearchpath:$testbindir";;
 
4435
          esac
4270
4436
          ;;
4271
4437
        esac
4272
4438
      done
4383
4549
              export_symbols="$output_objdir/$outputname.exp"
4384
4550
              $run $rm $export_symbols
4385
4551
              $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
 
4552
              case $host in
 
4553
              *cygwin* | *mingw* )
 
4554
                $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
 
4555
                $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
 
4556
                ;;
 
4557
              esac
4386
4558
            else
4387
 
              $run eval "${SED} -e 's/\([ ][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
 
4559
              $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
4388
4560
              $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
4389
4561
              $run eval 'mv "$nlist"T "$nlist"'
 
4562
              case $host in
 
4563
              *cygwin* | *mingw* )
 
4564
                $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
 
4565
                $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
 
4566
                ;;
 
4567
              esac
4390
4568
            fi
4391
4569
          fi
4392
4570
 
4503
4681
          esac
4504
4682
 
4505
4683
          # Now compile the dynamic symbol file.
4506
 
          $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
4507
 
          $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
 
4684
          $show "(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
 
4685
          $run eval '(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
4508
4686
 
4509
4687
          # Clean up the generated files.
4510
4688
          $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
4511
4689
          $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
4512
4690
 
4513
4691
          # Transform the symbol file into the correct name.
4514
 
          compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4515
 
          finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
 
4692
          case $host in
 
4693
          *cygwin* | *mingw* )
 
4694
            if test -f "$output_objdir/${outputname}.def" ; then
 
4695
              compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
 
4696
              finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
 
4697
            else
 
4698
              compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
 
4699
              finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
 
4700
             fi
 
4701
            ;;
 
4702
          * )
 
4703
            compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
 
4704
            finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
 
4705
            ;;
 
4706
          esac
4516
4707
          ;;
4517
4708
        *)
4518
4709
          $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
4537
4728
        # We have no uninstalled library dependencies, so finalize right now.
4538
4729
        $show "$link_command"
4539
4730
        $run eval "$link_command"
4540
 
        status=$?
 
4731
        exit_status=$?
4541
4732
 
4542
4733
        # Delete the generated files.
4543
4734
        if test -n "$dlsyms"; then
4545
4736
          $run $rm "$output_objdir/${outputname}S.${objext}"
4546
4737
        fi
4547
4738
 
4548
 
        exit $status
 
4739
        exit $exit_status
4549
4740
      fi
4550
4741
 
4551
4742
      if test -n "$shlibpath_var"; then
4685
4876
        esac
4686
4877
        case $host in
4687
4878
          *cygwin* | *mingw* )
4688
 
            cwrappersource=`$echo ${objdir}/lt-${outputname}.c`
4689
 
            cwrapper=`$echo ${output}.exe`
4690
 
            $rm $cwrappersource $cwrapper
4691
 
            trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
 
4879
            output_name=`basename $output`
 
4880
            output_path=`dirname $output`
 
4881
            cwrappersource="$output_path/$objdir/lt-$output_name.c"
 
4882
            cwrapper="$output_path/$output_name.exe"
 
4883
            $rm $cwrappersource $cwrapper
 
4884
            trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
4692
4885
 
4693
4886
            cat > $cwrappersource <<EOF
4694
4887
 
4713
4906
#include <malloc.h>
4714
4907
#include <stdarg.h>
4715
4908
#include <assert.h>
 
4909
#include <string.h>
 
4910
#include <ctype.h>
 
4911
#include <sys/stat.h>
4716
4912
 
4717
4913
#if defined(PATH_MAX)
4718
4914
# define LT_PATHMAX PATH_MAX
4723
4919
#endif
4724
4920
 
4725
4921
#ifndef DIR_SEPARATOR
4726
 
#define DIR_SEPARATOR '/'
 
4922
# define DIR_SEPARATOR '/'
 
4923
# define PATH_SEPARATOR ':'
4727
4924
#endif
4728
4925
 
4729
4926
#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4730
4927
  defined (__OS2__)
4731
 
#define HAVE_DOS_BASED_FILE_SYSTEM
4732
 
#ifndef DIR_SEPARATOR_2
4733
 
#define DIR_SEPARATOR_2 '\\'
4734
 
#endif
 
4928
# define HAVE_DOS_BASED_FILE_SYSTEM
 
4929
# ifndef DIR_SEPARATOR_2
 
4930
#  define DIR_SEPARATOR_2 '\\'
 
4931
# endif
 
4932
# ifndef PATH_SEPARATOR_2
 
4933
#  define PATH_SEPARATOR_2 ';'
 
4934
# endif
4735
4935
#endif
4736
4936
 
4737
4937
#ifndef DIR_SEPARATOR_2
4741
4941
        (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
4742
4942
#endif /* DIR_SEPARATOR_2 */
4743
4943
 
 
4944
#ifndef PATH_SEPARATOR_2
 
4945
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
 
4946
#else /* PATH_SEPARATOR_2 */
 
4947
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
 
4948
#endif /* PATH_SEPARATOR_2 */
 
4949
 
4744
4950
#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
4745
4951
#define XFREE(stale) do { \
4746
4952
  if (stale) { free ((void *) stale); stale = 0; } \
4747
4953
} while (0)
4748
4954
 
 
4955
/* -DDEBUG is fairly common in CFLAGS.  */
 
4956
#undef DEBUG
 
4957
#if defined DEBUGWRAPPER
 
4958
# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
 
4959
#else
 
4960
# define DEBUG(format, ...)
 
4961
#endif
 
4962
 
4749
4963
const char *program_name = NULL;
4750
4964
 
4751
4965
void * xmalloc (size_t num);
4752
4966
char * xstrdup (const char *string);
4753
 
char * basename (const char *name);
4754
 
char * fnqualify(const char *path);
 
4967
const char * base_name (const char *name);
 
4968
char * find_executable(const char *wrapper);
 
4969
int    check_executable(const char *path);
4755
4970
char * strendzap(char *str, const char *pat);
4756
4971
void lt_fatal (const char *message, ...);
4757
4972
 
4761
4976
  char **newargz;
4762
4977
  int i;
4763
4978
 
4764
 
  program_name = (char *) xstrdup ((char *) basename (argv[0]));
 
4979
  program_name = (char *) xstrdup (base_name (argv[0]));
 
4980
  DEBUG("(main) argv[0]      : %s\n",argv[0]);
 
4981
  DEBUG("(main) program_name : %s\n",program_name);
4765
4982
  newargz = XMALLOC(char *, argc+2);
4766
4983
EOF
4767
4984
 
4768
 
            cat >> $cwrappersource <<EOF
4769
 
  newargz[0] = "$SHELL";
 
4985
            cat >> $cwrappersource <<EOF
 
4986
  newargz[0] = (char *) xstrdup("$SHELL");
4770
4987
EOF
4771
4988
 
4772
 
            cat >> $cwrappersource <<"EOF"
4773
 
  newargz[1] = fnqualify(argv[0]);
 
4989
            cat >> $cwrappersource <<"EOF"
 
4990
  newargz[1] = find_executable(argv[0]);
 
4991
  if (newargz[1] == NULL)
 
4992
    lt_fatal("Couldn't find %s", argv[0]);
 
4993
  DEBUG("(main) found exe at : %s\n",newargz[1]);
4774
4994
  /* we know the script has the same name, without the .exe */
4775
4995
  /* so make sure newargz[1] doesn't end in .exe */
4776
4996
  strendzap(newargz[1],".exe");
4777
4997
  for (i = 1; i < argc; i++)
4778
4998
    newargz[i+1] = xstrdup(argv[i]);
4779
4999
  newargz[argc+1] = NULL;
4780
 
EOF
4781
 
 
4782
 
            cat >> $cwrappersource <<EOF
 
5000
 
 
5001
  for (i=0; i<argc+1; i++)
 
5002
  {
 
5003
    DEBUG("(main) newargz[%d]   : %s\n",i,newargz[i]);
 
5004
    ;
 
5005
  }
 
5006
 
 
5007
EOF
 
5008
 
 
5009
            case $host_os in
 
5010
              mingw*)
 
5011
                cat >> $cwrappersource <<EOF
 
5012
  execv("$SHELL",(char const **)newargz);
 
5013
EOF
 
5014
              ;;
 
5015
              *)
 
5016
                cat >> $cwrappersource <<EOF
4783
5017
  execv("$SHELL",newargz);
4784
5018
EOF
 
5019
              ;;
 
5020
            esac
4785
5021
 
4786
 
            cat >> $cwrappersource <<"EOF"
 
5022
            cat >> $cwrappersource <<"EOF"
4787
5023
  return 127;
4788
5024
}
4789
5025
 
4804
5040
;
4805
5041
}
4806
5042
 
4807
 
char *
4808
 
basename (const char *name)
 
5043
const char *
 
5044
base_name (const char *name)
4809
5045
{
4810
5046
  const char *base;
4811
5047
 
4812
5048
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4813
5049
  /* Skip over the disk name in MSDOS pathnames. */
4814
 
  if (isalpha (name[0]) && name[1] == ':')
 
5050
  if (isalpha ((unsigned char)name[0]) && name[1] == ':')
4815
5051
    name += 2;
4816
5052
#endif
4817
5053
 
4818
5054
  for (base = name; *name; name++)
4819
5055
    if (IS_DIR_SEPARATOR (*name))
4820
5056
      base = name + 1;
4821
 
  return (char *) base;
4822
 
}
4823
 
 
 
5057
  return base;
 
5058
}
 
5059
 
 
5060
int
 
5061
check_executable(const char * path)
 
5062
{
 
5063
  struct stat st;
 
5064
 
 
5065
  DEBUG("(check_executable)  : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
 
5066
  if ((!path) || (!*path))
 
5067
    return 0;
 
5068
 
 
5069
  if ((stat (path, &st) >= 0) &&
 
5070
      (
 
5071
        /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
 
5072
#if defined (S_IXOTH)
 
5073
       ((st.st_mode & S_IXOTH) == S_IXOTH) ||
 
5074
#endif
 
5075
#if defined (S_IXGRP)
 
5076
       ((st.st_mode & S_IXGRP) == S_IXGRP) ||
 
5077
#endif
 
5078
       ((st.st_mode & S_IXUSR) == S_IXUSR))
 
5079
      )
 
5080
    return 1;
 
5081
  else
 
5082
    return 0;
 
5083
}
 
5084
 
 
5085
/* Searches for the full path of the wrapper.  Returns
 
5086
   newly allocated full path name if found, NULL otherwise */
4824
5087
char *
4825
 
fnqualify(const char *path)
 
5088
find_executable (const char* wrapper)
4826
5089
{
4827
 
  size_t size;
4828
 
  char *p;
 
5090
  int has_slash = 0;
 
5091
  const char* p;
 
5092
  const char* p_next;
 
5093
  /* static buffer for getcwd */
4829
5094
  char tmp[LT_PATHMAX + 1];
4830
 
 
4831
 
  assert(path != NULL);
4832
 
 
4833
 
  /* Is it qualified already? */
4834
 
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4835
 
  if (isalpha (path[0]) && path[1] == ':')
4836
 
    return xstrdup (path);
4837
 
#endif
4838
 
  if (IS_DIR_SEPARATOR (path[0]))
4839
 
    return xstrdup (path);
4840
 
 
4841
 
  /* prepend the current directory */
4842
 
  /* doesn't handle '~' */
 
5095
  int tmp_len;
 
5096
  char* concat_name;
 
5097
 
 
5098
  DEBUG("(find_executable)  : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
 
5099
 
 
5100
  if ((wrapper == NULL) || (*wrapper == '\0'))
 
5101
    return NULL;
 
5102
 
 
5103
  /* Absolute path? */
 
5104
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
 
5105
  if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
 
5106
  {
 
5107
    concat_name = xstrdup (wrapper);
 
5108
    if (check_executable(concat_name))
 
5109
      return concat_name;
 
5110
    XFREE(concat_name);
 
5111
  }
 
5112
  else
 
5113
  {
 
5114
#endif
 
5115
    if (IS_DIR_SEPARATOR (wrapper[0]))
 
5116
    {
 
5117
      concat_name = xstrdup (wrapper);
 
5118
      if (check_executable(concat_name))
 
5119
        return concat_name;
 
5120
      XFREE(concat_name);
 
5121
    }
 
5122
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
 
5123
  }
 
5124
#endif
 
5125
 
 
5126
  for (p = wrapper; *p; p++)
 
5127
    if (*p == '/')
 
5128
    {
 
5129
      has_slash = 1;
 
5130
      break;
 
5131
    }
 
5132
  if (!has_slash)
 
5133
  {
 
5134
    /* no slashes; search PATH */
 
5135
    const char* path = getenv ("PATH");
 
5136
    if (path != NULL)
 
5137
    {
 
5138
      for (p = path; *p; p = p_next)
 
5139
      {
 
5140
        const char* q;
 
5141
        size_t p_len;
 
5142
        for (q = p; *q; q++)
 
5143
          if (IS_PATH_SEPARATOR(*q))
 
5144
            break;
 
5145
        p_len = q - p;
 
5146
        p_next = (*q == '\0' ? q : q + 1);
 
5147
        if (p_len == 0)
 
5148
        {
 
5149
          /* empty path: current directory */
 
5150
          if (getcwd (tmp, LT_PATHMAX) == NULL)
 
5151
            lt_fatal ("getcwd failed");
 
5152
          tmp_len = strlen(tmp);
 
5153
          concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
 
5154
          memcpy (concat_name, tmp, tmp_len);
 
5155
          concat_name[tmp_len] = '/';
 
5156
          strcpy (concat_name + tmp_len + 1, wrapper);
 
5157
        }
 
5158
        else
 
5159
        {
 
5160
          concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
 
5161
          memcpy (concat_name, p, p_len);
 
5162
          concat_name[p_len] = '/';
 
5163
          strcpy (concat_name + p_len + 1, wrapper);
 
5164
        }
 
5165
        if (check_executable(concat_name))
 
5166
          return concat_name;
 
5167
        XFREE(concat_name);
 
5168
      }
 
5169
    }
 
5170
    /* not found in PATH; assume curdir */
 
5171
  }
 
5172
  /* Relative path | not found in path: prepend cwd */
4843
5173
  if (getcwd (tmp, LT_PATHMAX) == NULL)
4844
5174
    lt_fatal ("getcwd failed");
4845
 
  size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */
4846
 
  p = XMALLOC(char, size);
4847
 
  sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path);
4848
 
  return p;
 
5175
  tmp_len = strlen(tmp);
 
5176
  concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
 
5177
  memcpy (concat_name, tmp, tmp_len);
 
5178
  concat_name[tmp_len] = '/';
 
5179
  strcpy (concat_name + tmp_len + 1, wrapper);
 
5180
 
 
5181
  if (check_executable(concat_name))
 
5182
    return concat_name;
 
5183
  XFREE(concat_name);
 
5184
  return NULL;
4849
5185
}
4850
5186
 
4851
5187
char *
4889
5225
  va_end (ap);
4890
5226
}
4891
5227
EOF
4892
 
          # we should really use a build-platform specific compiler
4893
 
          # here, but OTOH, the wrappers (shell script and this C one)
4894
 
          # are only useful if you want to execute the "real" binary.
4895
 
          # Since the "real" binary is built for $host, then this
4896
 
          # wrapper might as well be built for $host, too.
4897
 
          $run $LTCC -s -o $cwrapper $cwrappersource
4898
 
          ;;
4899
 
        esac
4900
 
        $rm $output
4901
 
        trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
 
5228
          # we should really use a build-platform specific compiler
 
5229
          # here, but OTOH, the wrappers (shell script and this C one)
 
5230
          # are only useful if you want to execute the "real" binary.
 
5231
          # Since the "real" binary is built for $host, then this
 
5232
          # wrapper might as well be built for $host, too.
 
5233
          $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
 
5234
          ;;
 
5235
        esac
 
5236
        $rm $output
 
5237
        trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
4902
5238
 
4903
5239
        $echo > $output "\
4904
5240
#! $SHELL
5128
5464
            $run ${rm}r "$gentop"
5129
5465
            $show "$mkdir $gentop"
5130
5466
            $run $mkdir "$gentop"
5131
 
            status=$?
5132
 
            if test "$status" -ne 0 && test ! -d "$gentop"; then
5133
 
              exit $status
 
5467
            exit_status=$?
 
5468
            if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
 
5469
              exit $exit_status
5134
5470
            fi
5135
5471
          fi
5136
5472
 
5797
6133
          outputname=
5798
6134
          if test "$fast_install" = no && test -n "$relink_command"; then
5799
6135
            if test "$finalize" = yes && test -z "$run"; then
5800
 
              tmpdir="/tmp"
5801
 
              test -n "$TMPDIR" && tmpdir="$TMPDIR"
5802
 
              tmpdir="$tmpdir/libtool-$$"
5803
 
              save_umask=`umask`
5804
 
              umask 0077
5805
 
              if $mkdir "$tmpdir"; then
5806
 
                umask $save_umask
5807
 
              else
5808
 
                umask $save_umask
5809
 
                $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
5810
 
                continue
5811
 
              fi
 
6136
              tmpdir=`func_mktempdir`
5812
6137
              file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
5813
6138
              outputname="$tmpdir/$file"
5814
6139
              # Replace the output file specification.
5932
6257
    # Exit here if they wanted silent mode.
5933
6258
    test "$show" = : && exit $EXIT_SUCCESS
5934
6259
 
5935
 
    $echo "----------------------------------------------------------------------"
 
6260
    $echo "X----------------------------------------------------------------------" | $Xsed
5936
6261
    $echo "Libraries have been installed in:"
5937
6262
    for libdir in $libdirs; do
5938
6263
      $echo "   $libdir"
5965
6290
    $echo
5966
6291
    $echo "See any operating system documentation about shared libraries for"
5967
6292
    $echo "more information, such as the ld(1) and ld.so(8) manual pages."
5968
 
    $echo "----------------------------------------------------------------------"
 
6293
    $echo "X----------------------------------------------------------------------" | $Xsed
5969
6294
    exit $EXIT_SUCCESS
5970
6295
    ;;
5971
6296
 
6182
6507
            rmfiles="$rmfiles $objdir/$n"
6183
6508
          done
6184
6509
          test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
6185
 
          test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
6186
6510
 
6187
 
          if test "$mode" = uninstall; then
 
6511
          case "$mode" in
 
6512
          clean)
 
6513
            case "  $library_names " in
 
6514
            # "  " in the beginning catches empty $dlname
 
6515
            *" $dlname "*) ;;
 
6516
            *) rmfiles="$rmfiles $objdir/$dlname" ;;
 
6517
            esac
 
6518
             test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
 
6519
            ;;
 
6520
          uninstall)
6188
6521
            if test -n "$library_names"; then
6189
6522
              # Do each command in the postuninstall commands.
6190
6523
              cmds=$postuninstall_cmds
6217
6550
              IFS="$save_ifs"
6218
6551
            fi
6219
6552
            # FIXME: should reinstall the best remaining shared library.
6220
 
          fi
 
6553
            ;;
 
6554
          esac
6221
6555
        fi
6222
6556
        ;;
6223
6557
 
6516
6850
# configuration.  But we'll never go from static-only to shared-only.
6517
6851
 
6518
6852
# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
6519
 
build_libtool_libs=no
6520
 
build_old_libs=yes
 
6853
disable_libs=shared
6521
6854
# ### END LIBTOOL TAG CONFIG: disable-shared
6522
6855
 
6523
6856
# ### BEGIN LIBTOOL TAG CONFIG: disable-static
6524
 
build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac`
 
6857
disable_libs=static
6525
6858
# ### END LIBTOOL TAG CONFIG: disable-static
6526
6859
 
6527
6860
# Local Variables: