1490
args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1492
save_ifs="$IFS"; IFS=','
1493
for flag in $args; do
1496
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1501
compiler_flags="$compiler_flags $flag"
1504
arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1508
args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1510
save_ifs="$IFS"; IFS=','
1511
for flag in $args; do
1514
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1519
compiler_flags="$compiler_flags $wl$flag"
1520
linker_flags="$linker_flags $flag"
1523
arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1157
1541
# Some other compiler flag.
1159
1543
# Unknown arguments in both finalize_command and compile_command need
1160
1544
# to be aesthetically quoted because they are evaled later.
1161
1545
arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1163
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
1547
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1169
*.o | *.obj | *.a | *.lib)
1170
1554
# A standard object.
1171
1555
objs="$objs $arg"
1176
if test "$prev" = dlfiles; then
1177
dlfiles="$dlfiles $arg"
1178
if test "$build_libtool_libs" = yes && test "$dlopen" = yes; then
1559
# A libtool-controlled object.
1561
# Check to see that this really is a libtool object.
1562
if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1567
# If there is no directory component, then add one.
1569
*/* | *\\*) . $arg ;;
1573
if test -z "$pic_object" || \
1574
test -z "$non_pic_object" ||
1575
test "$pic_object" = none && \
1576
test "$non_pic_object" = none; then
1577
$echo "$modename: cannot find name of object for \`$arg'" 1>&2
1581
# Extract subdirectory from the argument.
1582
xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1583
if test "X$xdir" = "X$arg"; then
1589
if test "$pic_object" != none; then
1590
# Prepend the subdirectory the object is found in.
1591
pic_object="$xdir$pic_object"
1593
if test "$prev" = dlfiles; then
1594
if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1595
dlfiles="$dlfiles $pic_object"
1599
# If libtool objects are unsupported, then we need to preload.
1604
# CHECK ME: I think I busted this. -Ossama
1605
if test "$prev" = dlprefiles; then
1606
# Preload the old-style object.
1607
dlprefiles="$dlprefiles $pic_object"
1612
libobjs="$libobjs $pic_object"
1617
if test "$non_pic_object" != none; then
1618
# Prepend the subdirectory the object is found in.
1619
non_pic_object="$xdir$non_pic_object"
1621
# A standard non-PIC object
1622
non_pic_objects="$non_pic_objects $non_pic_object"
1623
if test -z "$pic_object" || test "$pic_object" = none ; then
1624
arg="$non_pic_object"
1628
# Only an error if not doing a dry-run.
1629
if test -z "$run"; then
1630
$echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1182
# If libtool objects are unsupported, then we need to preload.
1635
# Extract subdirectory from the argument.
1636
xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1637
if test "X$xdir" = "X$arg"; then
1643
pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1644
non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1645
libobjs="$libobjs $pic_object"
1646
non_pic_objects="$non_pic_objects $non_pic_object"
1187
if test "$prev" = dlprefiles; then
1188
# Preload the old-style object.
1189
dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
1192
libobjs="$libobjs $arg"
1653
deplibs="$deplibs $arg"
1654
old_deplibs="$old_deplibs $arg"
1196
1659
# A libtool-controlled library.
1661
if test "$prev" = dlfiles; then
1662
# This library was specified with -dlopen.
1663
dlfiles="$dlfiles $arg"
1665
elif test "$prev" = dlprefiles; then
1666
# The library was specified with -dlpreopen.
1667
dlprefiles="$dlprefiles $arg"
1670
deplibs="$deplibs $arg"
1675
# Some other compiler argument.
1677
# Unknown arguments in both finalize_command and compile_command need
1678
# to be aesthetically quoted because they are evaled later.
1679
arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1681
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1688
# Now actually substitute the argument into the commands.
1689
if test -n "$arg"; then
1690
compile_command="$compile_command $arg"
1691
finalize_command="$finalize_command $arg"
1693
done # argument parsing loop
1695
if test -n "$prev"; then
1696
$echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1701
if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1702
eval arg=\"$export_dynamic_flag_spec\"
1703
compile_command="$compile_command $arg"
1704
finalize_command="$finalize_command $arg"
1708
# calculate the name of the file, without its directory
1709
outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1710
libobjs_save="$libobjs"
1712
if test -n "$shlibpath_var"; then
1713
# get the directories listed in $shlibpath_var
1714
eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
1718
eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
1719
eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
1721
output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1722
if test "X$output_objdir" = "X$output"; then
1723
output_objdir="$objdir"
1725
output_objdir="$output_objdir/$objdir"
1727
# Create the object directory.
1728
if test ! -d "$output_objdir"; then
1729
$show "$mkdir $output_objdir"
1730
$run $mkdir $output_objdir
1732
if test "$status" -ne 0 && test ! -d "$output_objdir"; then
1737
# Determine the type of output
1740
$echo "$modename: you must specify an output file" 1>&2
1744
*.$libext) linkmode=oldlib ;;
1745
*.lo | *.$objext) linkmode=obj ;;
1746
*.la) linkmode=lib ;;
1747
*) linkmode=prog ;; # Anything else should be a program.
1751
*cygwin* | *mingw* | *pw32*)
1752
# don't eliminate duplcations in $postdeps and $predeps
1753
duplicate_compiler_generated_deps=yes
1756
duplicate_compiler_generated_deps=$duplicate_deps
1762
# Find all interdependent deplibs by searching for libraries
1763
# that are linked more than once (e.g. -la -lb -la)
1764
for deplib in $deplibs; do
1765
if test "X$duplicate_deps" = "Xyes" ; then
1767
*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1770
libs="$libs $deplib"
1773
if test "$linkmode" = lib; then
1774
libs="$predeps $libs $compiler_lib_search_path $postdeps"
1776
# Compute libraries that are listed more than once in $predeps
1777
# $postdeps and mark them as special (i.e., whose duplicates are
1778
# not to be eliminated).
1780
if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
1781
for pre_post_dep in $predeps $postdeps; do
1782
case "$pre_post_deps " in
1783
*" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
1785
pre_post_deps="$pre_post_deps $pre_post_dep"
1794
need_relink=no # whether we're linking any uninstalled libtool libraries
1795
notinst_deplibs= # not-installed libtool libraries
1796
notinst_path= # paths that contain not-installed libtool libraries
1800
for file in $dlfiles $dlprefiles; do
1804
$echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
1816
passes="conv scan dlopen dlpreopen link"
1821
for pass in $passes; do
1822
if test "$linkmode,$pass" = "lib,link" ||
1823
test "$linkmode,$pass" = "prog,scan"; then
1827
if test "$linkmode" = prog; then
1829
dlopen) libs="$dlfiles" ;;
1830
dlpreopen) libs="$dlprefiles" ;;
1831
link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
1834
if test "$pass" = dlopen; then
1835
# Collect dlpreopened libraries
1836
save_deplibs="$deplibs"
1839
for deplib in $libs; do
1843
-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
1844
if test "$linkmode,$pass" = "prog,link"; then
1845
compile_deplibs="$deplib $compile_deplibs"
1846
finalize_deplibs="$deplib $finalize_deplibs"
1848
deplibs="$deplib $deplibs"
1853
if test "$linkmode" != lib && test "$linkmode" != prog; then
1854
$echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
1857
if test "$pass" = conv; then
1858
deplibs="$deplib $deplibs"
1861
name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
1862
for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
1863
for search_ext in .la $shrext .so .a; do
1864
# Search the libtool library
1865
lib="$searchdir/lib${name}${search_ext}"
1866
if test -f "$lib"; then
1867
if test "$search_ext" = ".la"; then
1876
if test "$found" != yes; then
1877
# deplib doesn't seem to be a libtool library
1878
if test "$linkmode,$pass" = "prog,link"; then
1879
compile_deplibs="$deplib $compile_deplibs"
1880
finalize_deplibs="$deplib $finalize_deplibs"
1882
deplibs="$deplib $deplibs"
1883
test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
1886
else # deplib is a libtool library
1887
# If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
1888
# We need to do some special things here, and not later.
1889
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
1890
case " $predeps $postdeps " in
1892
if (${SED} -e '2q' $lib |
1893
grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1897
*/* | *\\*) . $lib ;;
1900
for l in $old_library $library_names; do
1903
if test "X$ll" = "X$old_library" ; then # only static version available
1905
ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
1906
test "X$ladir" = "X$lib" && ladir="."
1907
lib=$ladir/$old_library
1908
if test "$linkmode,$pass" = "prog,link"; then
1909
compile_deplibs="$deplib $compile_deplibs"
1910
finalize_deplibs="$deplib $finalize_deplibs"
1912
deplibs="$deplib $deplibs"
1913
test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
1927
deplibs="$deplib $deplibs"
1928
test "$pass" = conv && continue
1929
newdependency_libs="$deplib $newdependency_libs"
1930
newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1933
if test "$pass" = conv; then
1934
deplibs="$deplib $deplibs"
1937
if test "$pass" = scan; then
1938
deplibs="$deplib $deplibs"
1939
newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1941
compile_deplibs="$deplib $compile_deplibs"
1942
finalize_deplibs="$deplib $finalize_deplibs"
1946
$echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
1952
if test "$pass" = link; then
1953
dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1954
# Make sure the xrpath contains only unique directories.
1957
*) xrpath="$xrpath $dir" ;;
1960
deplibs="$deplib $deplibs"
1963
*.la) lib="$deplib" ;;
1965
if test "$pass" = conv; then
1966
deplibs="$deplib $deplibs"
1971
if test "$deplibs_check_method" != pass_all; then
1973
$echo "*** Warning: Trying to link with static lib archive $deplib."
1974
$echo "*** I have the capability to make that library automatically link in when"
1975
$echo "*** you link to this library. But I can only do this if you have a"
1976
$echo "*** shared version of the library, which you do not appear to have"
1977
$echo "*** because the file extensions .$libext of this argument makes me believe"
1978
$echo "*** that it is just a static archive that I should not used here."
1981
$echo "*** Warning: Linking the shared library $output against the"
1982
$echo "*** static library $deplib is not portable!"
1983
deplibs="$deplib $deplibs"
1988
if test "$pass" != link; then
1989
deplibs="$deplib $deplibs"
1991
compile_deplibs="$deplib $compile_deplibs"
1992
finalize_deplibs="$deplib $finalize_deplibs"
1999
if test "$pass" = conv; then
2000
deplibs="$deplib $deplibs"
2001
elif test "$linkmode" = prog; then
2002
if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
2003
# If there is no dlopen support or we're linking statically,
2004
# we need to preload.
2005
newdlprefiles="$newdlprefiles $deplib"
2006
compile_deplibs="$deplib $compile_deplibs"
2007
finalize_deplibs="$deplib $finalize_deplibs"
2009
newdlfiles="$newdlfiles $deplib"
2019
if test "$found" = yes || test -f "$lib"; then :
2021
$echo "$modename: cannot find the library \`$lib'" 1>&2
2025
# Check to see that this really is a libtool archive.
2026
if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
2028
$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2032
ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2033
test "X$ladir" = "X$lib" && ladir="."
1203
# Check to see that this really is a libtool archive.
1204
if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1206
$echo "$modename: \`$arg' is not a valid libtool archive" 1>&2
1210
2041
# If the library was installed with an old release of libtool,
1211
# it will not redefine variable installed.
2042
# it will not redefine variables installed, or shouldnotlink
1214
2046
# Read the .la file
1215
# If there is no directory component, then add one.
1217
*/* | *\\*) . $arg ;;
2048
*/* | *\\*) . $lib ;;
2052
if test "$linkmode,$pass" = "lib,link" ||
2053
test "$linkmode,$pass" = "prog,scan" ||
2054
{ test "$linkmode" != prog && test "$linkmode" != lib; }; then
2055
test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
2056
test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
2059
if test "$pass" = conv; then
2060
# Only check for convenience libraries
2061
deplibs="$lib $deplibs"
2062
if test -z "$libdir"; then
2063
if test -z "$old_library"; then
2064
$echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2067
# It is a libtool convenience library, so add in its objects.
2068
convenience="$convenience $ladir/$objdir/$old_library"
2069
old_convenience="$old_convenience $ladir/$objdir/$old_library"
2071
for deplib in $dependency_libs; do
2072
deplibs="$deplib $deplibs"
2073
if test "X$duplicate_deps" = "Xyes" ; then
2074
case "$tmp_libs " in
2075
*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2078
tmp_libs="$tmp_libs $deplib"
2080
elif test "$linkmode" != prog && test "$linkmode" != lib; then
2081
$echo "$modename: \`$lib' is not a convenience library" 1>&2
1221
2088
# Get the name of the library we link against.
1223
2090
for l in $old_library $library_names; do
1227
2093
if test -z "$linklib"; then
1228
$echo "$modename: cannot find name of link library for \`$arg'" 1>&2
2094
$echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2098
# This library was specified with -dlopen.
2099
if test "$pass" = dlopen; then
2100
if test -z "$libdir"; then
2101
$echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
2104
if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
2105
# If there is no dlname, no dlopen support or we're linking
2106
# statically, we need to preload. We also need to preload any
2107
# dependent libraries so libltdl's deplib preloader doesn't
2108
# bomb out in the load deplibs phase.
2109
dlprefiles="$dlprefiles $lib $dependency_libs"
2111
newdlfiles="$newdlfiles $lib"
2116
# We need an absolute path.
2118
[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
2120
abs_ladir=`cd "$ladir" && pwd`
2121
if test -z "$abs_ladir"; then
2122
$echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
2123
$echo "$modename: passing it literally to the linker, although it might fail" 1>&2
2128
laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
1232
2130
# Find the relevant object directory and library name.
1233
name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'`
1235
2131
if test "X$installed" = Xyes; then
2132
if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2133
$echo "$modename: warning: library \`$lib' was moved." 1>&2
1238
dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1239
if test "X$dir" = "X$arg"; then
1246
if test -n "$dependency_libs"; then
1247
# Extract -R and -L from dependency_libs
1249
for deplib in $dependency_libs; do
1251
-R*) temp_xrpath=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1252
case " $rpath $xrpath " in
1253
*" $temp_xrpath "*) ;;
1254
*) xrpath="$xrpath $temp_xrpath";;
1256
-L*) case "$compile_command $temp_deplibs " in
1258
*) temp_deplibs="$temp_deplibs $deplib";;
1260
temp_dir=`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1261
case " $lib_search_path " in
1263
*) lib_search_path="$lib_search_path $temp_dir";;
1266
*) temp_deplibs="$temp_deplibs $deplib";;
1269
dependency_libs="$temp_deplibs"
1272
if test -z "$libdir"; then
1273
# It is a libtool convenience library, so add in its objects.
1274
convenience="$convenience $dir/$old_library"
1275
old_convenience="$old_convenience $dir/$old_library"
1276
deplibs="$deplibs$dependency_libs"
1277
compile_command="$compile_command $dir/$old_library$dependency_libs"
1278
finalize_command="$finalize_command $dir/$old_library$dependency_libs"
1282
# This library was specified with -dlopen.
1283
if test "$prev" = dlfiles; then
1284
dlfiles="$dlfiles $arg"
1285
if test -z "$dlname" || test "$dlopen" != yes || test "$build_libtool_libs" = no; then
1286
# If there is no dlname, no dlopen support or we're linking statically,
1287
# we need to preload.
1290
# We should not create a dependency on this library, but we
1291
# may need any libraries it requires.
1292
compile_command="$compile_command$dependency_libs"
1293
finalize_command="$finalize_command$dependency_libs"
1299
# The library was specified with -dlpreopen.
1300
if test "$prev" = dlprefiles; then
2142
dir="$ladir/$objdir"
2143
absdir="$abs_ladir/$objdir"
2144
# Remove this search path later
2145
notinst_path="$notinst_path $abs_ladir"
2146
fi # $installed = yes
2147
name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2149
# This library was specified with -dlpreopen.
2150
if test "$pass" = dlpreopen; then
2151
if test -z "$libdir"; then
2152
$echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
1301
2155
# Prefer using a static library (so that no silly _DYNAMIC symbols
1302
2156
# are required to link).
1303
2157
if test -n "$old_library"; then
1304
dlprefiles="$dlprefiles $dir/$old_library"
1306
dlprefiles="$dlprefiles $dir/$linklib"
2158
newdlprefiles="$newdlprefiles $dir/$old_library"
2159
# Otherwise, use the dlname, so that lt_dlopen finds it.
2160
elif test -n "$dlname"; then
2161
newdlprefiles="$newdlprefiles $dir/$dlname"
2163
newdlprefiles="$newdlprefiles $dir/$linklib"
2165
fi # $pass = dlpreopen
2167
if test -z "$libdir"; then
2168
# Link the convenience library
2169
if test "$linkmode" = lib; then
2170
deplibs="$dir/$old_library $deplibs"
2171
elif test "$linkmode,$pass" = "prog,link"; then
2172
compile_deplibs="$dir/$old_library $compile_deplibs"
2173
finalize_deplibs="$dir/$old_library $finalize_deplibs"
2175
deplibs="$lib $deplibs" # used for prog,scan pass
2181
if test "$linkmode" = prog && test "$pass" != link; then
2182
newlib_search_path="$newlib_search_path $ladir"
2183
deplibs="$lib $deplibs"
2186
if test "$link_all_deplibs" != no || test -z "$library_names" ||
2187
test "$build_libtool_libs" = no; then
2192
for deplib in $dependency_libs; do
2194
-L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
2196
# Need to link against all dependency_libs?
2197
if test "$linkalldeplibs" = yes; then
2198
deplibs="$deplib $deplibs"
2200
# Need to hardcode shared library paths
2201
# or/and link against static libraries
2202
newdependency_libs="$deplib $newdependency_libs"
2204
if test "X$duplicate_deps" = "Xyes" ; then
2205
case "$tmp_libs " in
2206
*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2209
tmp_libs="$tmp_libs $deplib"
2212
fi # $linkmode = prog...
2214
if test "$linkmode,$pass" = "prog,link"; then
2215
if test -n "$library_names" &&
2216
{ test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2217
# We need to hardcode the library path
2218
if test -n "$shlibpath_var"; then
2219
# Make sure the rpath contains only unique directories.
2220
case "$temp_rpath " in
2223
*) temp_rpath="$temp_rpath $dir" ;;
2227
# Hardcode the library path.
2228
# Skip directories that are in the system default run-time
2230
case " $sys_lib_dlsearch_path " in
2233
case "$compile_rpath " in
2235
*) compile_rpath="$compile_rpath $absdir"
2239
case " $sys_lib_dlsearch_path " in
2242
case "$finalize_rpath " in
2244
*) finalize_rpath="$finalize_rpath $libdir"
2248
fi # $linkmode,$pass = prog,link...
2250
if test "$alldeplibs" = yes &&
2251
{ test "$deplibs_check_method" = pass_all ||
2252
{ test "$build_libtool_libs" = yes &&
2253
test -n "$library_names"; }; }; then
2254
# We only need to search for static libraries
2259
link_static=no # Whether the deplib will be linked statically
1311
2260
if test -n "$library_names" &&
1312
2261
{ test "$prefer_static_libs" = no || test -z "$old_library"; }; then
1313
link_against_libtool_libs="$link_against_libtool_libs $arg"
1314
if test -n "$shlibpath_var"; then
1315
# Make sure the rpath contains only unique directories.
1316
case "$temp_rpath " in
1318
*) temp_rpath="$temp_rpath $dir" ;;
2262
if test "$installed" = no; then
2263
notinst_deplibs="$notinst_deplibs $lib"
1322
# We need an absolute path.
1324
[\\/] | [A-Za-z]:[\\/]*) absdir="$dir" ;;
1326
absdir=`cd "$dir" && pwd`
1327
if test -z "$absdir"; then
1328
$echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
1329
$echo "$modename: passing it literally to the linker, although it might fail" 1>&2
2266
# This is a shared library
2268
# Warn about portability, can't link against -module's on some systems (darwin)
2269
if test "$shouldnotlink" = yes && test "$pass" = link ; then
2271
if test "$linkmode" = prog; then
2272
$echo "*** Warning: Linking the executable $output against the loadable module"
2274
$echo "*** Warning: Linking the shared library $output against the loadable module"
1335
# This is the magic to use -rpath.
1336
# Skip directories that are in the system default run-time
1337
# search path, unless they have been requested with -R.
1338
case " $sys_lib_dlsearch_path " in
1341
case "$compile_rpath " in
2276
$echo "*** $linklib is not portable!"
2278
if test "$linkmode" = lib &&
2279
test "$hardcode_into_libs" = yes; then
2280
# Hardcode the library path.
2281
# Skip directories that are in the system default run-time
2283
case " $sys_lib_dlsearch_path " in
1342
2284
*" $absdir "*) ;;
1343
*) compile_rpath="$compile_rpath $absdir"
2286
case "$compile_rpath " in
2288
*) compile_rpath="$compile_rpath $absdir"
1348
case " $sys_lib_dlsearch_path " in
1351
case "$finalize_rpath " in
2292
case " $sys_lib_dlsearch_path " in
1352
2293
*" $libdir "*) ;;
1353
*) finalize_rpath="$finalize_rpath $libdir"
2295
case "$finalize_rpath " in
2297
*) finalize_rpath="$finalize_rpath $libdir"
1359
case "$hardcode_action" in
1360
immediate | unsupported)
1361
if test "$hardcode_direct" = no; then
1362
compile_command="$compile_command $dir/$linklib"
1363
deplibs="$deplibs $dir/$linklib"
1365
*-*-cygwin* | *-*-mingw* | *-*-os2*)
1366
dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
1367
if test -n "$dllsearchpath"; then
1368
dllsearchpath="$dllsearchpath:$dllsearchdir"
1370
dllsearchpath="$dllsearchdir"
2303
if test -n "$old_archive_from_expsyms_cmds"; then
2304
# figure out the soname
2305
set dummy $library_names
2308
libname=`eval \\$echo \"$libname_spec\"`
2309
# use dlname if we got it. it's perfectly good, no?
2310
if test -n "$dlname"; then
2312
elif test -n "$soname_spec"; then
2316
major=`expr $current - $age`
2320
eval soname=\"$soname_spec\"
2325
# Make a new name for the extract_expsyms_cmds to use
2327
soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
2328
newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
2330
# If the library has no export list, then create one now
2331
if test -f "$output_objdir/$soname-def"; then :
2333
$show "extracting exported symbol list from \`$soname'"
2334
save_ifs="$IFS"; IFS='~'
2335
cmds=$extract_expsyms_cmds
2336
for cmd in $cmds; do
2340
$run eval "$cmd" || exit $?
2346
if test -f "$output_objdir/$newlib"; then :; else
2347
$show "generating import library for \`$soname'"
2348
save_ifs="$IFS"; IFS='~'
2349
cmds=$old_archive_from_expsyms_cmds
2350
for cmd in $cmds; do
2354
$run eval "$cmd" || exit $?
2358
# make sure the library variables are pointing to the new library
2361
fi # test -n "$old_archive_from_expsyms_cmds"
2363
if test "$linkmode" = prog || test "$mode" != relink; then
2368
case $hardcode_action in
2369
immediate | unsupported)
2370
if test "$hardcode_direct" = no; then
2373
*-*-sco3.2v5* ) add_dir="-L$dir" ;;
2375
# if the lib is a module then we can not link against it, someone
2376
# is ignoring the new warnings I added
2377
if /usr/bin/file -L $add 2> /dev/null | grep "bundle" >/dev/null ; then
2378
$echo "** Warning, lib $linklib is a module, not a shared library"
2379
if test -z "$old_library" ; then
2381
$echo "** And there doesn't seem to be a static archive available"
2382
$echo "** The link will probably fail, sorry"
2384
add="$dir/$old_library"
2388
elif test "$hardcode_minus_L" = no; then
2390
*-*-sunos*) add_shlibpath="$dir" ;;
2394
elif test "$hardcode_shlibpath_var" = no; then
2395
add_shlibpath="$dir"
2402
if test "$hardcode_direct" = yes; then
2404
elif test "$hardcode_minus_L" = yes; then
2406
# Try looking first in the location we're being installed to.
2407
if test -n "$inst_prefix_dir"; then
2410
add_dir="$add_dir -L$inst_prefix_dir$libdir"
1374
elif test "$hardcode_minus_L" = no; then
1377
compile_shlibpath="$compile_shlibpath$dir:"
1380
case "$compile_command " in
1382
*) compile_command="$compile_command -L$dir";;
1384
compile_command="$compile_command -l$name"
1385
deplibs="$deplibs -L$dir -l$name"
1386
elif test "$hardcode_shlibpath_var" = no; then
1387
case ":$compile_shlibpath:" in
1389
*) compile_shlibpath="$compile_shlibpath$dir:";;
1391
compile_command="$compile_command -l$name"
1392
deplibs="$deplibs -l$name"
2415
elif test "$hardcode_shlibpath_var" = yes; then
2416
add_shlibpath="$dir"
2425
if test "$lib_linked" != yes; then
2426
$echo "$modename: configuration error: unsupported hardcode properties"
2430
if test -n "$add_shlibpath"; then
2431
case :$compile_shlibpath: in
2432
*":$add_shlibpath:"*) ;;
2433
*) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
2436
if test "$linkmode" = prog; then
2437
test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
2438
test -n "$add" && compile_deplibs="$add $compile_deplibs"
2440
test -n "$add_dir" && deplibs="$add_dir $deplibs"
2441
test -n "$add" && deplibs="$add $deplibs"
2442
if test "$hardcode_direct" != yes && \
2443
test "$hardcode_minus_L" != yes && \
2444
test "$hardcode_shlibpath_var" = yes; then
2445
case :$finalize_shlibpath: in
2447
*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2453
if test "$linkmode" = prog || test "$mode" = relink; then
2457
# Finalize command for both is simple: just hardcode it.
1399
2458
if test "$hardcode_direct" = yes; then
1400
compile_command="$compile_command $absdir/$linklib"
1401
deplibs="$deplibs $absdir/$linklib"
2459
add="$libdir/$linklib"
1402
2460
elif test "$hardcode_minus_L" = yes; then
1403
case "$compile_command " in
1405
*) compile_command="$compile_command -L$absdir";;
1407
compile_command="$compile_command -l$name"
1408
deplibs="$deplibs -L$absdir -l$name"
1409
2463
elif test "$hardcode_shlibpath_var" = yes; then
1410
case ":$compile_shlibpath:" in
1412
*) compile_shlibpath="$compile_shlibpath$absdir:";;
2464
case :$finalize_shlibpath: in
2466
*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
1414
compile_command="$compile_command -l$name"
1415
deplibs="$deplibs -l$name"
1426
if test "$lib_linked" != yes; then
1427
$echo "$modename: configuration error: unsupported hardcode properties"
1431
# Finalize command for both is simple: just hardcode it.
1432
if test "$hardcode_direct" = yes; then
1433
finalize_command="$finalize_command $libdir/$linklib"
1434
elif test "$hardcode_minus_L" = yes; then
1435
case "$finalize_command " in
1437
*) finalize_command="$finalize_command -L$libdir";;
1439
finalize_command="$finalize_command -l$name"
1440
elif test "$hardcode_shlibpath_var" = yes; then
1441
case ":$finalize_shlibpath:" in
1443
*) finalize_shlibpath="$finalize_shlibpath$libdir:";;
1445
finalize_command="$finalize_command -l$name"
1447
# We cannot seem to hardcode it, guess we'll fake it.
1448
case "$finalize_command " in
1450
*) finalize_command="$finalize_command -L$libdir";;
1452
finalize_command="$finalize_command -l$name"
1455
# Transform directly to old archives if we don't build new libraries.
1456
if test -n "$pic_flag" && test -z "$old_library"; then
1457
$echo "$modename: cannot find static library for \`$arg'" 1>&2
2469
elif test "$hardcode_automatic" = yes; then
2470
if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then
2471
add="$inst_prefix_dir$libdir/$linklib"
2473
add="$libdir/$linklib"
2476
# We cannot seem to hardcode it, guess we'll fake it.
2478
# Try looking first in the location we're being installed to.
2479
if test -n "$inst_prefix_dir"; then
2482
add_dir="$add_dir -L$inst_prefix_dir$libdir"
2489
if test "$linkmode" = prog; then
2490
test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
2491
test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
2493
test -n "$add_dir" && deplibs="$add_dir $deplibs"
2494
test -n "$add" && deplibs="$add $deplibs"
2497
elif test "$linkmode" = prog; then
1461
2498
# Here we assume that one of hardcode_direct or hardcode_minus_L
1462
2499
# is not unsupported. This is valid on all known static and
1463
2500
# shared platforms.
1464
2501
if test "$hardcode_direct" != unsupported; then
1465
2502
test -n "$old_library" && linklib="$old_library"
1466
compile_command="$compile_command $dir/$linklib"
1467
finalize_command="$finalize_command $dir/$linklib"
1469
case "$compile_command " in
1471
*) compile_command="$compile_command -L$dir";;
1473
compile_command="$compile_command -l$name"
1474
case "$finalize_command " in
1476
*) finalize_command="$finalize_command -L$dir";;
1478
finalize_command="$finalize_command -l$name"
1482
# Add in any libraries that this one depends upon.
1483
compile_command="$compile_command$dependency_libs"
1484
finalize_command="$finalize_command$dependency_libs"
1488
# Some other compiler argument.
1490
# Unknown arguments in both finalize_command and compile_command need
1491
# to be aesthetically quoted because they are evaled later.
1492
arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1494
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
2503
compile_deplibs="$dir/$linklib $compile_deplibs"
2504
finalize_deplibs="$dir/$linklib $finalize_deplibs"
2506
compile_deplibs="-l$name -L$dir $compile_deplibs"
2507
finalize_deplibs="-l$name -L$dir $finalize_deplibs"
2509
elif test "$build_libtool_libs" = yes; then
2510
# Not a shared library
2511
if test "$deplibs_check_method" != pass_all; then
2512
# We're trying link a shared library against a static one
2513
# but the system doesn't support it.
2515
# Just print a warning and add the library to dependency_libs so
2516
# that the program can be linked against the static library.
2518
$echo "*** Warning: This system can not link to static lib archive $lib."
2519
$echo "*** I have the capability to make that library automatically link in when"
2520
$echo "*** you link to this library. But I can only do this if you have a"
2521
$echo "*** shared version of the library, which you do not appear to have."
2522
if test "$module" = yes; then
2523
$echo "*** But as you try to build a module library, libtool will still create "
2524
$echo "*** a static module, that should work as long as the dlopening application"
2525
$echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
2526
if test -z "$global_symbol_pipe"; then
2528
$echo "*** However, this would only work if libtool was able to extract symbol"
2529
$echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2530
$echo "*** not find such a program. So, this module is probably useless."
2531
$echo "*** \`nm' from GNU binutils and a full rebuild may help."
2533
if test "$build_old_libs" = no; then
2534
build_libtool_libs=module
2537
build_libtool_libs=no
2541
convenience="$convenience $dir/$old_library"
2542
old_convenience="$old_convenience $dir/$old_library"
2543
deplibs="$dir/$old_library $deplibs"
2546
fi # link shared/static library?
2548
if test "$linkmode" = lib; then
2549
if test -n "$dependency_libs" &&
2550
{ test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes ||
2551
test "$link_static" = yes; }; then
2552
# Extract -R from dependency_libs
2554
for libdir in $dependency_libs; do
2556
-R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2558
*" $temp_xrpath "*) ;;
2559
*) xrpath="$xrpath $temp_xrpath";;
2561
*) temp_deplibs="$temp_deplibs $libdir";;
2564
dependency_libs="$temp_deplibs"
2567
newlib_search_path="$newlib_search_path $absdir"
2568
# Link against this library
2569
test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2570
# ... and its dependency_libs
2572
for deplib in $dependency_libs; do
2573
newdependency_libs="$deplib $newdependency_libs"
2574
if test "X$duplicate_deps" = "Xyes" ; then
2575
case "$tmp_libs " in
2576
*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2579
tmp_libs="$tmp_libs $deplib"
2582
if test "$link_all_deplibs" != no; then
2583
# Add the search paths of all dependency libraries
2584
for deplib in $dependency_libs; do
2586
-L*) path="$deplib" ;;
2588
dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2589
test "X$dir" = "X$deplib" && dir="."
2590
# We need an absolute path.
2592
[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2594
absdir=`cd "$dir" && pwd`
2595
if test -z "$absdir"; then
2596
$echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2601
if grep "^installed=no" $deplib > /dev/null; then
2602
path="$absdir/$objdir"
2604
eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2605
if test -z "$libdir"; then
2606
$echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2609
if test "$absdir" != "$libdir"; then
2610
$echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2617
# we do not want to link against static libs, but need to link against shared
2618
eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
2619
if test -n "$deplibrary_names" ; then
2620
for tmp in $deplibrary_names ; do
2623
if test -f "$path/$depdepl" ; then
2624
depdepl="$path/$depdepl"
2626
# do not add paths which are already there
2627
case " $newlib_search_path " in
2629
*) newlib_search_path="$newlib_search_path $path";;
2643
# Again, we only want to link against shared libraries
2644
eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
2645
for tmp in $newlib_search_path ; do
2646
if test -f "$tmp/lib$tmp_libs.dylib" ; then
2647
eval depdepl="$tmp/lib$tmp_libs.dylib"
2658
case " $deplibs " in
2660
*) deplibs="$deplibs $depdepl" ;;
2662
case " $deplibs " in
2664
*) deplibs="$deplibs $path" ;;
2667
fi # link_all_deplibs != no
2669
done # for deplib in $libs
2670
dependency_libs="$newdependency_libs"
2671
if test "$pass" = dlpreopen; then
2672
# Link the dlpreopened libraries before other libraries
2673
for deplib in $save_deplibs; do
2674
deplibs="$deplib $deplibs"
2677
if test "$pass" != dlopen; then
2678
if test "$pass" != conv; then
2679
# Make sure lib_search_path contains only unique directories.
2681
for dir in $newlib_search_path; do
2682
case "$lib_search_path " in
2684
*) lib_search_path="$lib_search_path $dir" ;;
2690
if test "$linkmode,$pass" != "prog,link"; then
2693
vars="compile_deplibs finalize_deplibs"
2695
for var in $vars dependency_libs; do
2696
# Add libraries to $var in reverse order
2697
eval tmp_libs=\"\$$var\"
2699
for deplib in $tmp_libs; do
2700
# FIXME: Pedantically, this is the right thing to do, so
2701
# that some nasty dependency loop isn't accidentally
2703
#new_libs="$deplib $new_libs"
2704
# Pragmatically, this seems to cause very few problems in
2707
-L*) new_libs="$deplib $new_libs" ;;
2710
# And here is the reason: when a library appears more
2711
# than once as an explicit dependence of a library, or
2712
# is implicitly linked in more than once by the
2713
# compiler, it is considered special, and multiple
2714
# occurrences thereof are not removed. Compare this
2715
# with having the same library being listed as a
2716
# dependency of multiple other libraries: in this case,
2717
# we know (pedantically, we assume) the library does not
2718
# need to be listed more than once, so we keep only the
2719
# last copy. This is not always right, but it is rare
2720
# enough that we require users that really mean to play
2721
# such unportable linking tricks to link the library
2722
# using -Wl,-lname, so that libtool does not consider it
2723
# for duplicate removal.
2724
case " $specialdeplibs " in
2725
*" $deplib "*) new_libs="$deplib $new_libs" ;;
2727
case " $new_libs " in
2729
*) new_libs="$deplib $new_libs" ;;
2737
for deplib in $new_libs; do
2740
case " $tmp_libs " in
2742
*) tmp_libs="$tmp_libs $deplib" ;;
2745
*) tmp_libs="$tmp_libs $deplib" ;;
2748
eval $var=\"$tmp_libs\"
2751
# Last step: remove runtime libs from dependency_libs (they stay in deplibs)
2753
for i in $dependency_libs ; do
2754
case " $predeps $postdeps $compiler_lib_search_path " in
1501
# Now actually substitute the argument into the commands.
1502
if test -n "$arg"; then
1503
compile_command="$compile_command $arg"
1504
finalize_command="$finalize_command $arg"
1508
if test -n "$prev"; then
1509
$echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1514
if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1515
eval arg=\"$export_dynamic_flag_spec\"
1516
compile_command="$compile_command $arg"
1517
finalize_command="$finalize_command $arg"
1521
# calculate the name of the file, without its directory
1522
outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1523
libobjs_save="$libobjs"
1527
$echo "$modename: you must specify an output file" 1>&2
1533
if test -n "$link_against_libtool_libs"; then
1534
$echo "$modename: error: cannot link libtool libraries into archives" 1>&2
2759
if test -n "$i" ; then
2760
tmp_libs="$tmp_libs $i"
2763
dependency_libs=$tmp_libs
2765
if test "$linkmode" = prog; then
2766
dlfiles="$newdlfiles"
2767
dlprefiles="$newdlprefiles"
1538
2772
if test -n "$deplibs"; then
1539
2773
$echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2