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