~ubuntu-branches/ubuntu/hardy/lighttpd/hardy

« back to all changes in this revision

Viewing changes to ltmain.sh

  • Committer: Bazaar Package Importer
  • Author(s): Soren Hansen
  • Date: 2007-05-01 13:15:59 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20070501131559-y8jos9wp79uf3pp4
Tags: 1.4.15-1ubuntu1
* Merge from Debian unstable. Remaining Ubuntu changes:
  - Add fam/gamin stat cache engine support
  - Clean environment in init.d script
  - Replace Depends: on perl with Depends: on libterm-readline-perl-perl
  - Make sure that upgrades succeed, even if we can't restart lighttpd
  - DebianMaintainerField update

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.16
47
 
TIMESTAMP=" (1.1220.2.235 2005/04/25 18:13:26)"
 
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.
88
88
Xsed="${SED}"' -e 1s/^X//'
89
89
sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
90
90
# test EBCDIC or ASCII
91
 
case `echo A|tr A '\301'` in
92
 
 A) # EBCDIC based system
93
 
  SP2NL="tr '\100' '\n'"
94
 
  NL2SP="tr '\r\n' '\100\100'"
 
91
case `echo X|tr X '\101'` in
 
92
 A) # ASCII based system
 
93
    # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
 
94
  SP2NL='tr \040 \012'
 
95
  NL2SP='tr \015\012 \040\040'
95
96
  ;;
96
 
 *) # Assume ASCII based system
97
 
  SP2NL="tr '\040' '\012'"
98
 
  NL2SP="tr '\015\012' '\040\040'"
 
97
 *) # EBCDIC based system
 
98
  SP2NL='tr \100 \n'
 
99
  NL2SP='tr \r\n \100\100'
99
100
  ;;
100
101
esac
101
102
 
131
132
show="$echo"
132
133
show_help=
133
134
execute_dlfiles=
 
135
duplicate_deps=no
 
136
preserve_args=
134
137
lo2o="s/\\.lo\$/.${objext}/"
135
138
o2lo="s/\\.${objext}\$/.lo/"
136
 
quote_scanset='[[~#^*{};<>?'"'"'        ]'
137
139
 
138
140
#####################################
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*)
192
230
      CC_quoted=
193
231
      for arg in $CC; do
194
232
        case $arg in
195
 
          *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
 
233
          *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
196
234
          arg="\"$arg\""
197
235
          ;;
198
236
        esac
213
251
            for arg in $CC; do
214
252
            # Double-quote args containing other shell metacharacters.
215
253
            case $arg in
216
 
              *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
 
254
              *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
217
255
              arg="\"$arg\""
218
256
              ;;
219
257
            esac
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*)
337
375
            func_extract_an_archive "$my_xdir" "$my_xabs"
338
376
          fi # $darwin_arches
339
377
        fi # $run
340
 
      ;;
 
378
        ;;
341
379
      *)
342
380
        func_extract_an_archive "$my_xdir" "$my_xabs"
343
381
        ;;
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.
576
632
 
577
633
    for arg
578
634
    do
579
 
      case "$arg_mode" in
 
635
      case $arg_mode in
580
636
      arg  )
581
637
        # do not "continue".  Instead, add this to base_compile
582
638
        lastarg="$arg"
627
683
            # Many Bourne shells cannot handle close brackets correctly
628
684
            # in scan sets, so we specify it separately.
629
685
            case $arg in
630
 
              *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
 
686
              *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
631
687
              arg="\"$arg\""
632
688
              ;;
633
689
            esac
662
718
      # in scan sets (worked around with variable expansion),
663
719
      # and furthermore cannot handle '|' '&' '(' ')' in scan sets 
664
720
      # at all, so we specify them separately.
665
 
      *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
 
721
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
666
722
        lastarg="\"$lastarg\""
667
723
        ;;
668
724
      esac
737
793
 
738
794
    qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
739
795
    case $qlibobj in
740
 
      *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
 
796
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
741
797
        qlibobj="\"$qlibobj\"" ;;
742
798
    esac
743
 
    if test "X$libobj" != "X$qlibobj"; then
744
 
        $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
745
 
        exit $EXIT_FAILURE
746
 
    fi
 
799
    test "X$libobj" != "X$qlibobj" \
 
800
        && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"'  &()|`$[]' \
 
801
        && $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
747
802
    objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
748
803
    xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
749
804
    if test "X$xdir" = "X$obj"; then
824
879
    fi
825
880
    qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
826
881
    case $qsrcfile in
827
 
      *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
 
882
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
828
883
      qsrcfile="\"$qsrcfile\"" ;;
829
884
    esac
830
885
 
857
912
      if test ! -d "${xdir}$objdir"; then
858
913
        $show "$mkdir ${xdir}$objdir"
859
914
        $run $mkdir ${xdir}$objdir
860
 
        status=$?
861
 
        if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then
862
 
          exit $status
 
915
        exit_status=$?
 
916
        if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
 
917
          exit $exit_status
863
918
        fi
864
919
      fi
865
920
 
1062
1117
    no_install=no
1063
1118
    objs=
1064
1119
    non_pic_objects=
 
1120
    notinst_path= # paths that contain not-installed libtool libraries
1065
1121
    precious_files_regex=
1066
1122
    prefer_static_libs=no
1067
1123
    preload=no
1090
1146
          if test -n "$link_static_flag"; then
1091
1147
            dlopen_self=$dlopen_self_static
1092
1148
          fi
 
1149
          prefer_static_libs=yes
1093
1150
        else
1094
1151
          if test -z "$pic_flag" && test -n "$link_static_flag"; then
1095
1152
            dlopen_self=$dlopen_self_static
1096
1153
          fi
 
1154
          prefer_static_libs=built
1097
1155
        fi
1098
1156
        build_libtool_libs=no
1099
1157
        build_old_libs=yes
1100
 
        prefer_static_libs=yes
1101
1158
        break
1102
1159
        ;;
1103
1160
      esac
1111
1168
      arg="$1"
1112
1169
      shift
1113
1170
      case $arg in
1114
 
      *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
 
1171
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
1115
1172
        qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
1116
1173
        ;;
1117
1174
      *) qarg=$arg ;;
1272
1329
                  if test -z "$pic_object" || test "$pic_object" = none ; then
1273
1330
                    arg="$non_pic_object"
1274
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"
1275
1337
                fi
1276
1338
              else
1277
1339
                # Only an error if not doing a dry-run.
1355
1417
          prev=
1356
1418
          continue
1357
1419
          ;;
1358
 
        darwin_framework)
1359
 
          compiler_flags="$compiler_flags $arg"
 
1420
        darwin_framework|darwin_framework_skip)
 
1421
          test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
 
1422
          compile_command="$compile_command $arg"
 
1423
          finalize_command="$finalize_command $arg"
1360
1424
          prev=
1361
1425
          continue
1362
1426
          ;;
1418
1482
        continue
1419
1483
        ;;
1420
1484
 
1421
 
      -framework)
1422
 
        prev=darwin_framework
1423
 
        compiler_flags="$compiler_flags $arg"
1424
 
        continue
1425
 
        ;;
 
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
 
1492
        compile_command="$compile_command $arg"
 
1493
        finalize_command="$finalize_command $arg"
 
1494
        continue
 
1495
        ;;
1426
1496
 
1427
1497
      -inst-prefix-dir)
1428
1498
        prev=inst_prefix
1450
1520
          absdir=`cd "$dir" && pwd`
1451
1521
          if test -z "$absdir"; then
1452
1522
            $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1453
 
            exit $EXIT_FAILURE
 
1523
            absdir="$dir"
 
1524
            notinst_path="$notinst_path $dir"
1454
1525
          fi
1455
1526
          dir="$absdir"
1456
1527
          ;;
1464
1535
        esac
1465
1536
        case $host in
1466
1537
        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
 
1538
          testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
1467
1539
          case :$dllsearchpath: in
1468
1540
          *":$dir:"*) ;;
1469
1541
          *) dllsearchpath="$dllsearchpath:$dir";;
1470
1542
          esac
 
1543
          case :$dllsearchpath: in
 
1544
          *":$testbindir:"*) ;;
 
1545
          *) dllsearchpath="$dllsearchpath:$testbindir";;
 
1546
          esac
1471
1547
          ;;
1472
1548
        esac
1473
1549
        continue
1476
1552
      -l*)
1477
1553
        if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1478
1554
          case $host in
1479
 
          *-*-cygwin* | *-*-pw32* | *-*-beos*)
 
1555
          *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
1480
1556
            # These systems don't actually have a C or math library (as such)
1481
1557
            continue
1482
1558
            ;;
1483
 
          *-*-mingw* | *-*-os2*)
 
1559
          *-*-os2*)
1484
1560
            # These systems don't actually have a C library (as such)
1485
1561
            test "X$arg" = "X-lc" && continue
1486
1562
            ;;
1492
1568
            # Rhapsody C and math libraries are in the System framework
1493
1569
            deplibs="$deplibs -framework System"
1494
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
            ;;
1495
1580
          esac
1496
1581
        elif test "X$arg" = "X-lc_r"; then
1497
1582
         case $host in
1533
1618
      # +DA*, +DD* enable 64-bit mode on the HP compiler
1534
1619
      # -q* pass through compiler args for the IBM compiler
1535
1620
      # -m* pass through architecture-specific compiler args for GCC
1536
 
      -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*|@*)
1537
1627
 
1538
1628
        # Unknown arguments in both finalize_command and compile_command need
1539
1629
        # to be aesthetically quoted because they are evaled later.
1540
1630
        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1541
1631
        case $arg in
1542
 
        *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
 
1632
        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
1543
1633
          arg="\"$arg\""
1544
1634
          ;;
1545
1635
        esac
1546
1636
        compile_command="$compile_command $arg"
1547
1637
        finalize_command="$finalize_command $arg"
1548
 
        if test "$with_gcc" = "yes" ; then
1549
 
          compiler_flags="$compiler_flags $arg"
1550
 
        fi
 
1638
        compiler_flags="$compiler_flags $arg"
1551
1639
        continue
1552
1640
        ;;
1553
1641
 
1655
1743
        for flag in $args; do
1656
1744
          IFS="$save_ifs"
1657
1745
          case $flag in
1658
 
            *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
 
1746
            *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
1659
1747
            flag="\"$flag\""
1660
1748
            ;;
1661
1749
          esac
1673
1761
        for flag in $args; do
1674
1762
          IFS="$save_ifs"
1675
1763
          case $flag in
1676
 
            *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
 
1764
            *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
1677
1765
            flag="\"$flag\""
1678
1766
            ;;
1679
1767
          esac
1706
1794
        # to be aesthetically quoted because they are evaled later.
1707
1795
        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1708
1796
        case $arg in
1709
 
        *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
 
1797
        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
1710
1798
          arg="\"$arg\""
1711
1799
          ;;
1712
1800
        esac
1785
1873
            if test -z "$pic_object" || test "$pic_object" = none ; then
1786
1874
              arg="$non_pic_object"
1787
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"
1788
1881
          fi
1789
1882
        else
1790
1883
          # Only an error if not doing a dry-run.
1840
1933
        # to be aesthetically quoted because they are evaled later.
1841
1934
        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1842
1935
        case $arg in
1843
 
        *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
 
1936
        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
1844
1937
          arg="\"$arg\""
1845
1938
          ;;
1846
1939
        esac
1890
1983
    if test ! -d "$output_objdir"; then
1891
1984
      $show "$mkdir $output_objdir"
1892
1985
      $run $mkdir $output_objdir
1893
 
      status=$?
1894
 
      if test "$status" -ne 0 && test ! -d "$output_objdir"; then
1895
 
        exit $status
 
1986
      exit_status=$?
 
1987
      if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
 
1988
        exit $exit_status
1896
1989
      fi
1897
1990
    fi
1898
1991
 
1955
2048
    newlib_search_path=
1956
2049
    need_relink=no # whether we're linking any uninstalled libtool libraries
1957
2050
    notinst_deplibs= # not-installed libtool libraries
1958
 
    notinst_path= # paths that contain not-installed libtool libraries
1959
2051
    case $linkmode in
1960
2052
    lib)
1961
2053
        passes="conv link"
2191
2283
        esac # case $deplib
2192
2284
        if test "$found" = yes || test -f "$lib"; then :
2193
2285
        else
2194
 
          $echo "$modename: cannot find the library \`$lib'" 1>&2
 
2286
          $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
2195
2287
          exit $EXIT_FAILURE
2196
2288
        fi
2197
2289
 
2405
2497
              case "$temp_rpath " in
2406
2498
              *" $dir "*) ;;
2407
2499
              *" $absdir "*) ;;
2408
 
              *) temp_rpath="$temp_rpath $dir" ;;
 
2500
              *) temp_rpath="$temp_rpath $absdir" ;;
2409
2501
              esac
2410
2502
            fi
2411
2503
 
2442
2534
        fi
2443
2535
 
2444
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
2445
2541
        if test -n "$library_names" &&
2446
 
           { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
 
2542
           { test "$use_static_libs" = no || test -z "$old_library"; }; then
2447
2543
          if test "$installed" = no; then
2448
2544
            notinst_deplibs="$notinst_deplibs $lib"
2449
2545
            need_relink=yes
2556
2652
              if test "$hardcode_direct" = no; then
2557
2653
                add="$dir/$linklib"
2558
2654
                case $host in
2559
 
                  *-*-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" ;;
2560
2659
                  *-*-darwin* )
2561
2660
                    # if the lib is a module then we can not link against
2562
2661
                    # it, someone is ignoring the new warnings I added
2563
 
                    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
2564
2664
                      $echo "** Warning, lib $linklib is a module, not a shared library"
2565
2665
                      if test -z "$old_library" ; then
2566
2666
                        $echo
2591
2691
                add_dir="-L$dir"
2592
2692
                # Try looking first in the location we're being installed to.
2593
2693
                if test -n "$inst_prefix_dir"; then
2594
 
                  case "$libdir" in
 
2694
                  case $libdir in
2595
2695
                    [\\/]*)
2596
2696
                      add_dir="$add_dir -L$inst_prefix_dir$libdir"
2597
2697
                      ;;
2664
2764
              add_dir="-L$libdir"
2665
2765
              # Try looking first in the location we're being installed to.
2666
2766
              if test -n "$inst_prefix_dir"; then
2667
 
                case "$libdir" in
 
2767
                case $libdir in
2668
2768
                  [\\/]*)
2669
2769
                    add_dir="$add_dir -L$inst_prefix_dir$libdir"
2670
2770
                    ;;
2725
2825
              fi
2726
2826
            fi
2727
2827
          else
2728
 
            convenience="$convenience $dir/$old_library"
2729
 
            old_convenience="$old_convenience $dir/$old_library"
2730
2828
            deplibs="$dir/$old_library $deplibs"
2731
2829
            link_static=yes
2732
2830
          fi
3313
3411
 
3314
3412
      # Eliminate all temporary directories.
3315
3413
      for path in $notinst_path; do
3316
 
        lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
3317
 
        deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
3318
 
        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"`
3319
3417
      done
3320
3418
 
3321
3419
      if test -n "$xrpath"; then
3368
3466
            ;;
3369
3467
          *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
3370
3468
            # Do not include libc due to us having libc/libc_r.
3371
 
            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
3372
3475
            ;;
3373
3476
          *)
3374
3477
            # Add libc to deplibs on all other systems if necessary.
3412
3515
          int main() { return 0; }
3413
3516
EOF
3414
3517
          $rm conftest
3415
 
          $LTCC -o conftest conftest.c $deplibs
 
3518
          $LTCC $LTCFLAGS -o conftest conftest.c $deplibs
3416
3519
          if test "$?" -eq 0 ; then
3417
3520
            ldd_output=`ldd conftest`
3418
3521
            for i in $deplibs; do
3419
 
              name="`expr $i : '-l\(.*\)'`"
 
3522
              name=`expr $i : '-l\(.*\)'`
3420
3523
              # If $name is empty we are operating on a -L argument.
3421
3524
              if test "$name" != "" && test "$name" -ne "0"; then
3422
3525
                if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3453
3556
            # Error occurred in the first compile.  Let's try to salvage
3454
3557
            # the situation: Compile a separate program for each library.
3455
3558
            for i in $deplibs; do
3456
 
              name="`expr $i : '-l\(.*\)'`"
 
3559
              name=`expr $i : '-l\(.*\)'`
3457
3560
              # If $name is empty we are operating on a -L argument.
3458
3561
              if test "$name" != "" && test "$name" != "0"; then
3459
3562
                $rm conftest
3460
 
                $LTCC -o conftest conftest.c $i
 
3563
                $LTCC $LTCFLAGS -o conftest conftest.c $i
3461
3564
                # Did it work?
3462
3565
                if test "$?" -eq 0 ; then
3463
3566
                  ldd_output=`ldd conftest`
3505
3608
          set dummy $deplibs_check_method
3506
3609
          file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3507
3610
          for a_deplib in $deplibs; do
3508
 
            name="`expr $a_deplib : '-l\(.*\)'`"
 
3611
            name=`expr $a_deplib : '-l\(.*\)'`
3509
3612
            # If $name is empty we are operating on a -L argument.
3510
3613
            if test "$name" != "" && test  "$name" != "0"; then
3511
3614
              if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3574
3677
          set dummy $deplibs_check_method
3575
3678
          match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3576
3679
          for a_deplib in $deplibs; do
3577
 
            name="`expr $a_deplib : '-l\(.*\)'`"
 
3680
            name=`expr $a_deplib : '-l\(.*\)'`
3578
3681
            # If $name is empty we are operating on a -L argument.
3579
3682
            if test -n "$name" && test "$name" != "0"; then
3580
3683
              if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3704
3807
        deplibs=$newdeplibs
3705
3808
      fi
3706
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
 
3707
3839
      # All the library-specific variables (install_libdir is set above).
3708
3840
      library_names=
3709
3841
      old_library=
3787
3919
        fi
3788
3920
 
3789
3921
        lib="$output_objdir/$realname"
 
3922
        linknames=
3790
3923
        for link
3791
3924
        do
3792
3925
          linknames="$linknames $link"
3815
3948
                # The command line is too long to execute in one step.
3816
3949
                $show "using reloadable object file for export list..."
3817
3950
                skipped_export=:
 
3951
                # Break out early, otherwise skipped_export may be
 
3952
                # set to false by a later but shorter cmd.
 
3953
                break
3818
3954
              fi
3819
3955
            done
3820
3956
            IFS="$save_ifs"
3884
4020
          fi
3885
4021
        fi
3886
4022
 
3887
 
        if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` &&
 
4023
        if test "X$skipped_export" != "X:" &&
 
4024
           len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
3888
4025
           test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
3889
4026
          :
3890
4027
        else
3919
4056
          do
3920
4057
            eval test_cmds=\"$reload_cmds $objlist $last_robj\"
3921
4058
            if test "X$objlist" = X ||
3922
 
               { len=`expr "X$test_cmds" : ".*"` &&
 
4059
               { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
3923
4060
                 test "$len" -le "$max_cmd_len"; }; then
3924
4061
              objlist="$objlist $obj"
3925
4062
            else
4009
4146
          IFS="$save_ifs"
4010
4147
          eval cmd=\"$cmd\"
4011
4148
          $show "$cmd"
4012
 
          $run eval "$cmd" || exit $?
 
4149
          $run eval "$cmd" || {
 
4150
            lt_exit=$?
 
4151
 
 
4152
            # Restore the uninstalled library and exit
 
4153
            if test "$mode" = relink; then
 
4154
              $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
 
4155
            fi
 
4156
 
 
4157
            exit $lt_exit
 
4158
          }
4013
4159
        done
4014
4160
        IFS="$save_ifs"
4015
4161
 
4016
4162
        # Restore the uninstalled library and exit
4017
4163
        if test "$mode" = relink; then
4018
4164
          $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
 
4165
 
 
4166
          if test -n "$convenience"; then
 
4167
            if test -z "$whole_archive_flag_spec"; then
 
4168
              $show "${rm}r $gentop"
 
4169
              $run ${rm}r "$gentop"
 
4170
            fi
 
4171
          fi
 
4172
 
4019
4173
          exit $EXIT_SUCCESS
4020
4174
        fi
4021
4175
 
4197
4351
        ;;
4198
4352
      esac
4199
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
 
4200
4383
      compile_command="$compile_command $compile_deplibs"
4201
4384
      finalize_command="$finalize_command $finalize_deplibs"
4202
4385
 
4241
4424
        fi
4242
4425
        case $host in
4243
4426
        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
 
4427
          testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
4244
4428
          case :$dllsearchpath: in
4245
4429
          *":$libdir:"*) ;;
4246
4430
          *) dllsearchpath="$dllsearchpath:$libdir";;
4247
4431
          esac
 
4432
          case :$dllsearchpath: in
 
4433
          *":$testbindir:"*) ;;
 
4434
          *) dllsearchpath="$dllsearchpath:$testbindir";;
 
4435
          esac
4248
4436
          ;;
4249
4437
        esac
4250
4438
      done
4360
4548
            if test -z "$export_symbols"; then
4361
4549
              export_symbols="$output_objdir/$outputname.exp"
4362
4550
              $run $rm $export_symbols
4363
 
              $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
 
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
4364
4558
            else
4365
 
              $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"'
4366
4560
              $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
4367
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
4368
4568
            fi
4369
4569
          fi
4370
4570
 
4481
4681
          esac
4482
4682
 
4483
4683
          # Now compile the dynamic symbol file.
4484
 
          $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
4485
 
          $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 $?
4486
4686
 
4487
4687
          # Clean up the generated files.
4488
4688
          $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
4489
4689
          $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
4490
4690
 
4491
4691
          # Transform the symbol file into the correct name.
4492
 
          compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4493
 
          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
4494
4707
          ;;
4495
4708
        *)
4496
4709
          $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
4515
4728
        # We have no uninstalled library dependencies, so finalize right now.
4516
4729
        $show "$link_command"
4517
4730
        $run eval "$link_command"
4518
 
        status=$?
 
4731
        exit_status=$?
4519
4732
 
4520
4733
        # Delete the generated files.
4521
4734
        if test -n "$dlsyms"; then
4523
4736
          $run $rm "$output_objdir/${outputname}S.${objext}"
4524
4737
        fi
4525
4738
 
4526
 
        exit $status
 
4739
        exit $exit_status
4527
4740
      fi
4528
4741
 
4529
4742
      if test -n "$shlibpath_var"; then
4663
4876
        esac
4664
4877
        case $host in
4665
4878
          *cygwin* | *mingw* )
4666
 
            cwrappersource=`$echo ${objdir}/lt-${outputname}.c`
4667
 
            cwrapper=`$echo ${output}.exe`
4668
 
            $rm $cwrappersource $cwrapper
4669
 
            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
4670
4885
 
4671
4886
            cat > $cwrappersource <<EOF
4672
4887
 
4691
4906
#include <malloc.h>
4692
4907
#include <stdarg.h>
4693
4908
#include <assert.h>
 
4909
#include <string.h>
 
4910
#include <ctype.h>
 
4911
#include <sys/stat.h>
4694
4912
 
4695
4913
#if defined(PATH_MAX)
4696
4914
# define LT_PATHMAX PATH_MAX
4701
4919
#endif
4702
4920
 
4703
4921
#ifndef DIR_SEPARATOR
4704
 
#define DIR_SEPARATOR '/'
 
4922
# define DIR_SEPARATOR '/'
 
4923
# define PATH_SEPARATOR ':'
4705
4924
#endif
4706
4925
 
4707
4926
#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4708
4927
  defined (__OS2__)
4709
 
#define HAVE_DOS_BASED_FILE_SYSTEM
4710
 
#ifndef DIR_SEPARATOR_2
4711
 
#define DIR_SEPARATOR_2 '\\'
4712
 
#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
4713
4935
#endif
4714
4936
 
4715
4937
#ifndef DIR_SEPARATOR_2
4719
4941
        (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
4720
4942
#endif /* DIR_SEPARATOR_2 */
4721
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
 
4722
4950
#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
4723
4951
#define XFREE(stale) do { \
4724
4952
  if (stale) { free ((void *) stale); stale = 0; } \
4725
4953
} while (0)
4726
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
 
4727
4963
const char *program_name = NULL;
4728
4964
 
4729
4965
void * xmalloc (size_t num);
4730
4966
char * xstrdup (const char *string);
4731
 
char * basename (const char *name);
4732
 
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);
4733
4970
char * strendzap(char *str, const char *pat);
4734
4971
void lt_fatal (const char *message, ...);
4735
4972
 
4739
4976
  char **newargz;
4740
4977
  int i;
4741
4978
 
4742
 
  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);
4743
4982
  newargz = XMALLOC(char *, argc+2);
4744
4983
EOF
4745
4984
 
4746
 
            cat >> $cwrappersource <<EOF
4747
 
  newargz[0] = "$SHELL";
 
4985
            cat >> $cwrappersource <<EOF
 
4986
  newargz[0] = (char *) xstrdup("$SHELL");
4748
4987
EOF
4749
4988
 
4750
 
            cat >> $cwrappersource <<"EOF"
4751
 
  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]);
4752
4994
  /* we know the script has the same name, without the .exe */
4753
4995
  /* so make sure newargz[1] doesn't end in .exe */
4754
4996
  strendzap(newargz[1],".exe");
4755
4997
  for (i = 1; i < argc; i++)
4756
4998
    newargz[i+1] = xstrdup(argv[i]);
4757
4999
  newargz[argc+1] = NULL;
4758
 
EOF
4759
 
 
4760
 
            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
4761
5017
  execv("$SHELL",newargz);
4762
5018
EOF
 
5019
              ;;
 
5020
            esac
4763
5021
 
4764
 
            cat >> $cwrappersource <<"EOF"
 
5022
            cat >> $cwrappersource <<"EOF"
 
5023
  return 127;
4765
5024
}
4766
5025
 
4767
5026
void *
4781
5040
;
4782
5041
}
4783
5042
 
4784
 
char *
4785
 
basename (const char *name)
 
5043
const char *
 
5044
base_name (const char *name)
4786
5045
{
4787
5046
  const char *base;
4788
5047
 
4789
5048
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4790
5049
  /* Skip over the disk name in MSDOS pathnames. */
4791
 
  if (isalpha (name[0]) && name[1] == ':')
 
5050
  if (isalpha ((unsigned char)name[0]) && name[1] == ':')
4792
5051
    name += 2;
4793
5052
#endif
4794
5053
 
4795
5054
  for (base = name; *name; name++)
4796
5055
    if (IS_DIR_SEPARATOR (*name))
4797
5056
      base = name + 1;
4798
 
  return (char *) base;
4799
 
}
4800
 
 
 
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 */
4801
5087
char *
4802
 
fnqualify(const char *path)
 
5088
find_executable (const char* wrapper)
4803
5089
{
4804
 
  size_t size;
4805
 
  char *p;
 
5090
  int has_slash = 0;
 
5091
  const char* p;
 
5092
  const char* p_next;
 
5093
  /* static buffer for getcwd */
4806
5094
  char tmp[LT_PATHMAX + 1];
4807
 
 
4808
 
  assert(path != NULL);
4809
 
 
4810
 
  /* Is it qualified already? */
4811
 
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4812
 
  if (isalpha (path[0]) && path[1] == ':')
4813
 
    return xstrdup (path);
4814
 
#endif
4815
 
  if (IS_DIR_SEPARATOR (path[0]))
4816
 
    return xstrdup (path);
4817
 
 
4818
 
  /* prepend the current directory */
4819
 
  /* 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 */
4820
5173
  if (getcwd (tmp, LT_PATHMAX) == NULL)
4821
5174
    lt_fatal ("getcwd failed");
4822
 
  size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */
4823
 
  p = XMALLOC(char, size);
4824
 
  sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path);
4825
 
  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;
4826
5185
}
4827
5186
 
4828
5187
char *
4866
5225
  va_end (ap);
4867
5226
}
4868
5227
EOF
4869
 
          # we should really use a build-platform specific compiler
4870
 
          # here, but OTOH, the wrappers (shell script and this C one)
4871
 
          # are only useful if you want to execute the "real" binary.
4872
 
          # Since the "real" binary is built for $host, then this
4873
 
          # wrapper might as well be built for $host, too.
4874
 
          $run $LTCC -s -o $cwrapper $cwrappersource
4875
 
          ;;
4876
 
        esac
4877
 
        $rm $output
4878
 
        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
4879
5238
 
4880
5239
        $echo > $output "\
4881
5240
#! $SHELL
5025
5384
        # Backslashes separate directories on plain windows
5026
5385
        *-*-mingw | *-*-os2*)
5027
5386
          $echo >> $output "\
5028
 
      exec \$progdir\\\\\$program \${1+\"\$@\"}
 
5387
      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
5029
5388
"
5030
5389
          ;;
5031
5390
 
5032
5391
        *)
5033
5392
          $echo >> $output "\
5034
 
      exec \$progdir/\$program \${1+\"\$@\"}
 
5393
      exec \"\$progdir/\$program\" \${1+\"\$@\"}
5035
5394
"
5036
5395
          ;;
5037
5396
        esac
5041
5400
    fi
5042
5401
  else
5043
5402
    # The program doesn't exist.
5044
 
    \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
 
5403
    \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
5045
5404
    \$echo \"This script is just a wrapper for \$program.\" 1>&2
5046
5405
    $echo \"See the $PACKAGE documentation for more information.\" 1>&2
5047
5406
    exit $EXIT_FAILURE
5105
5464
            $run ${rm}r "$gentop"
5106
5465
            $show "$mkdir $gentop"
5107
5466
            $run $mkdir "$gentop"
5108
 
            status=$?
5109
 
            if test "$status" -ne 0 && test ! -d "$gentop"; then
5110
 
              exit $status
 
5467
            exit_status=$?
 
5468
            if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
 
5469
              exit $exit_status
5111
5470
            fi
5112
5471
          fi
5113
5472
 
5164
5523
            oldobjs="$objlist $obj"
5165
5524
            objlist="$objlist $obj"
5166
5525
            eval test_cmds=\"$old_archive_cmds\"
5167
 
            if len=`expr "X$test_cmds" : ".*"` &&
 
5526
            if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
5168
5527
               test "$len" -le "$max_cmd_len"; then
5169
5528
              :
5170
5529
            else
5361
5720
    # install_prog (especially on Windows NT).
5362
5721
    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
5363
5722
       # Allow the use of GNU shtool's install command.
5364
 
       $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
 
5723
       $echo "X$nonopt" | grep shtool > /dev/null; then
5365
5724
      # Aesthetically quote it.
5366
5725
      arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
5367
5726
      case $arg in
5368
 
      *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
 
5727
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
5369
5728
        arg="\"$arg\""
5370
5729
        ;;
5371
5730
      esac
5374
5733
      shift
5375
5734
    else
5376
5735
      install_prog=
5377
 
      arg="$nonopt"
 
5736
      arg=$nonopt
5378
5737
    fi
5379
5738
 
5380
5739
    # The real first argument should be the name of the installation program.
5381
5740
    # Aesthetically quote it.
5382
5741
    arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5383
5742
    case $arg in
5384
 
    *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
 
5743
    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
5385
5744
      arg="\"$arg\""
5386
5745
      ;;
5387
5746
    esac
5399
5758
    do
5400
5759
      if test -n "$dest"; then
5401
5760
        files="$files $dest"
5402
 
        dest="$arg"
 
5761
        dest=$arg
5403
5762
        continue
5404
5763
      fi
5405
5764
 
5406
5765
      case $arg in
5407
5766
      -d) isdir=yes ;;
5408
 
      -f) prev="-f" ;;
5409
 
      -g) prev="-g" ;;
5410
 
      -m) prev="-m" ;;
5411
 
      -o) prev="-o" ;;
 
5767
      -f) 
 
5768
        case " $install_prog " in
 
5769
        *[\\\ /]cp\ *) ;;
 
5770
        *) prev=$arg ;;
 
5771
        esac
 
5772
        ;;
 
5773
      -g | -m | -o) prev=$arg ;;
5412
5774
      -s)
5413
5775
        stripme=" -s"
5414
5776
        continue
5415
5777
        ;;
5416
 
      -*) ;;
5417
 
 
 
5778
      -*)
 
5779
        ;;
5418
5780
      *)
5419
5781
        # If the previous option needed an argument, then skip it.
5420
5782
        if test -n "$prev"; then
5421
5783
          prev=
5422
5784
        else
5423
 
          dest="$arg"
 
5785
          dest=$arg
5424
5786
          continue
5425
5787
        fi
5426
5788
        ;;
5429
5791
      # Aesthetically quote the argument.
5430
5792
      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5431
5793
      case $arg in
5432
 
      *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
 
5794
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
5433
5795
        arg="\"$arg\""
5434
5796
        ;;
5435
5797
      esac
5598
5960
 
5599
5961
          if test "$#" -gt 0; then
5600
5962
            # Delete the old symlinks, and create new ones.
 
5963
            # Try `ln -sf' first, because the `ln' binary might depend on
 
5964
            # the symlink we replace!  Solaris /bin/ln does not understand -f,
 
5965
            # so we also need to try rm && ln -s.
5601
5966
            for linkname
5602
5967
            do
5603
5968
              if test "$linkname" != "$realname"; then
5604
 
                $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
5605
 
                $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
 
5969
                $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
 
5970
                $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
5606
5971
              fi
5607
5972
            done
5608
5973
          fi
5615
5980
            IFS="$save_ifs"
5616
5981
            eval cmd=\"$cmd\"
5617
5982
            $show "$cmd"
5618
 
            $run eval "$cmd" || exit $?
 
5983
            $run eval "$cmd" || {
 
5984
              lt_exit=$?
 
5985
 
 
5986
              # Restore the uninstalled library and exit
 
5987
              if test "$mode" = relink; then
 
5988
                $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
 
5989
              fi
 
5990
 
 
5991
              exit $lt_exit
 
5992
            }
5619
5993
          done
5620
5994
          IFS="$save_ifs"
5621
5995
        fi
5709
6083
          notinst_deplibs=
5710
6084
          relink_command=
5711
6085
 
5712
 
          # To insure that "foo" is sourced, and not "foo.exe",
5713
 
          # finese the cygwin/MSYS system by explicitly sourcing "foo."
5714
 
          # which disallows the automatic-append-.exe behavior.
5715
 
          case $build in
5716
 
          *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
5717
 
          *) wrapperdot=${wrapper} ;;
5718
 
          esac
 
6086
          # Note that it is not necessary on cygwin/mingw to append a dot to
 
6087
          # foo even if both foo and FILE.exe exist: automatic-append-.exe
 
6088
          # behavior happens only for exec(3), not for open(2)!  Also, sourcing
 
6089
          # `FILE.' does not work on cygwin managed mounts.
 
6090
          #
5719
6091
          # If there is no directory component, then add one.
5720
 
          case $file in
5721
 
          */* | *\\*) . ${wrapperdot} ;;
5722
 
          *) . ./${wrapperdot} ;;
 
6092
          case $wrapper in
 
6093
          */* | *\\*) . ${wrapper} ;;
 
6094
          *) . ./${wrapper} ;;
5723
6095
          esac
5724
6096
 
5725
6097
          # Check the variables that should have been set.
5747
6119
          done
5748
6120
 
5749
6121
          relink_command=
5750
 
          # To insure that "foo" is sourced, and not "foo.exe",
5751
 
          # finese the cygwin/MSYS system by explicitly sourcing "foo."
5752
 
          # which disallows the automatic-append-.exe behavior.
5753
 
          case $build in
5754
 
          *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
5755
 
          *) wrapperdot=${wrapper} ;;
5756
 
          esac
 
6122
          # Note that it is not necessary on cygwin/mingw to append a dot to
 
6123
          # foo even if both foo and FILE.exe exist: automatic-append-.exe
 
6124
          # behavior happens only for exec(3), not for open(2)!  Also, sourcing
 
6125
          # `FILE.' does not work on cygwin managed mounts.
 
6126
          #
5757
6127
          # If there is no directory component, then add one.
5758
 
          case $file in
5759
 
          */* | *\\*) . ${wrapperdot} ;;
5760
 
          *) . ./${wrapperdot} ;;
 
6128
          case $wrapper in
 
6129
          */* | *\\*) . ${wrapper} ;;
 
6130
          *) . ./${wrapper} ;;
5761
6131
          esac
5762
6132
 
5763
6133
          outputname=
5764
6134
          if test "$fast_install" = no && test -n "$relink_command"; then
5765
6135
            if test "$finalize" = yes && test -z "$run"; then
5766
 
              tmpdir="/tmp"
5767
 
              test -n "$TMPDIR" && tmpdir="$TMPDIR"
5768
 
              tmpdir="$tmpdir/libtool-$$"
5769
 
              save_umask=`umask`
5770
 
              umask 0077
5771
 
              if $mkdir "$tmpdir"; then
5772
 
                umask $save_umask
5773
 
              else
5774
 
                umask $save_umask
5775
 
                $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
5776
 
                continue
5777
 
              fi
 
6136
              tmpdir=`func_mktempdir`
5778
6137
              file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
5779
6138
              outputname="$tmpdir/$file"
5780
6139
              # Replace the output file specification.
5798
6157
        fi
5799
6158
 
5800
6159
        # remove .exe since cygwin /usr/bin/install will append another
5801
 
        # one anyways
 
6160
        # one anyway 
5802
6161
        case $install_prog,$host in
5803
6162
        */usr/bin/install*,*cygwin*)
5804
6163
          case $file:$destfile in
5898
6257
    # Exit here if they wanted silent mode.
5899
6258
    test "$show" = : && exit $EXIT_SUCCESS
5900
6259
 
5901
 
    $echo "----------------------------------------------------------------------"
 
6260
    $echo "X----------------------------------------------------------------------" | $Xsed
5902
6261
    $echo "Libraries have been installed in:"
5903
6262
    for libdir in $libdirs; do
5904
6263
      $echo "   $libdir"
5931
6290
    $echo
5932
6291
    $echo "See any operating system documentation about shared libraries for"
5933
6292
    $echo "more information, such as the ld(1) and ld.so(8) manual pages."
5934
 
    $echo "----------------------------------------------------------------------"
 
6293
    $echo "X----------------------------------------------------------------------" | $Xsed
5935
6294
    exit $EXIT_SUCCESS
5936
6295
    ;;
5937
6296
 
6148
6507
            rmfiles="$rmfiles $objdir/$n"
6149
6508
          done
6150
6509
          test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
6151
 
          test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
6152
6510
 
6153
 
          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)
6154
6521
            if test -n "$library_names"; then
6155
6522
              # Do each command in the postuninstall commands.
6156
6523
              cmds=$postuninstall_cmds
6183
6550
              IFS="$save_ifs"
6184
6551
            fi
6185
6552
            # FIXME: should reinstall the best remaining shared library.
6186
 
          fi
 
6553
            ;;
 
6554
          esac
6187
6555
        fi
6188
6556
        ;;
6189
6557
 
6482
6850
# configuration.  But we'll never go from static-only to shared-only.
6483
6851
 
6484
6852
# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
6485
 
build_libtool_libs=no
6486
 
build_old_libs=yes
 
6853
disable_libs=shared
6487
6854
# ### END LIBTOOL TAG CONFIG: disable-shared
6488
6855
 
6489
6856
# ### BEGIN LIBTOOL TAG CONFIG: disable-static
6490
 
build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac`
 
6857
disable_libs=static
6491
6858
# ### END LIBTOOL TAG CONFIG: disable-static
6492
6859
 
6493
6860
# Local Variables: