1503
args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1505
save_ifs="$IFS"; IFS=','
1506
for flag in $args; do
1509
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1514
compiler_flags="$compiler_flags $flag"
1517
arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1521
args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1523
save_ifs="$IFS"; IFS=','
1524
for flag in $args; do
1527
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1532
compiler_flags="$compiler_flags $wl$flag"
1533
linker_flags="$linker_flags $flag"
1536
arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1157
1554
# Some other compiler flag.
1159
1556
# Unknown arguments in both finalize_command and compile_command need
1160
1557
# to be aesthetically quoted because they are evaled later.
1161
1558
arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1163
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
1560
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1169
*.o | *.obj | *.a | *.lib)
1170
1567
# A standard object.
1171
1568
objs="$objs $arg"
1176
if test "$prev" = dlfiles; then
1177
dlfiles="$dlfiles $arg"
1178
if test "$build_libtool_libs" = yes && test "$dlopen" = yes; then
1572
# A libtool-controlled object.
1574
# Check to see that this really is a libtool object.
1575
if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1580
# If there is no directory component, then add one.
1582
*/* | *\\*) . $arg ;;
1586
if test -z "$pic_object" || \
1587
test -z "$non_pic_object" ||
1588
test "$pic_object" = none && \
1589
test "$non_pic_object" = none; then
1590
$echo "$modename: cannot find name of object for \`$arg'" 1>&2
1594
# Extract subdirectory from the argument.
1595
xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1596
if test "X$xdir" = "X$arg"; then
1602
if test "$pic_object" != none; then
1603
# Prepend the subdirectory the object is found in.
1604
pic_object="$xdir$pic_object"
1606
if test "$prev" = dlfiles; then
1607
if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1608
dlfiles="$dlfiles $pic_object"
1612
# If libtool objects are unsupported, then we need to preload.
1617
# CHECK ME: I think I busted this. -Ossama
1618
if test "$prev" = dlprefiles; then
1619
# Preload the old-style object.
1620
dlprefiles="$dlprefiles $pic_object"
1625
libobjs="$libobjs $pic_object"
1630
if test "$non_pic_object" != none; then
1631
# Prepend the subdirectory the object is found in.
1632
non_pic_object="$xdir$non_pic_object"
1634
# A standard non-PIC object
1635
non_pic_objects="$non_pic_objects $non_pic_object"
1636
if test -z "$pic_object" || test "$pic_object" = none ; then
1637
arg="$non_pic_object"
1641
# Only an error if not doing a dry-run.
1642
if test -z "$run"; then
1643
$echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1182
# If libtool objects are unsupported, then we need to preload.
1648
# Extract subdirectory from the argument.
1649
xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1650
if test "X$xdir" = "X$arg"; then
1656
pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1657
non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1658
libobjs="$libobjs $pic_object"
1659
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"
1666
deplibs="$deplibs $arg"
1667
old_deplibs="$old_deplibs $arg"
1196
1672
# A libtool-controlled library.
1674
if test "$prev" = dlfiles; then
1675
# This library was specified with -dlopen.
1676
dlfiles="$dlfiles $arg"
1678
elif test "$prev" = dlprefiles; then
1679
# The library was specified with -dlpreopen.
1680
dlprefiles="$dlprefiles $arg"
1683
deplibs="$deplibs $arg"
1688
# Some other compiler argument.
1690
# Unknown arguments in both finalize_command and compile_command need
1691
# to be aesthetically quoted because they are evaled later.
1692
arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1694
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1701
# Now actually substitute the argument into the commands.
1702
if test -n "$arg"; then
1703
compile_command="$compile_command $arg"
1704
finalize_command="$finalize_command $arg"
1706
done # argument parsing loop
1708
if test -n "$prev"; then
1709
$echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1714
if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1715
eval arg=\"$export_dynamic_flag_spec\"
1716
compile_command="$compile_command $arg"
1717
finalize_command="$finalize_command $arg"
1721
# calculate the name of the file, without its directory
1722
outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1723
libobjs_save="$libobjs"
1725
if test -n "$shlibpath_var"; then
1726
# get the directories listed in $shlibpath_var
1727
eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
1731
eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
1732
eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
1734
output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1735
if test "X$output_objdir" = "X$output"; then
1736
output_objdir="$objdir"
1738
output_objdir="$output_objdir/$objdir"
1740
# Create the object directory.
1741
if test ! -d "$output_objdir"; then
1742
$show "$mkdir $output_objdir"
1743
$run $mkdir $output_objdir
1745
if test "$status" -ne 0 && test ! -d "$output_objdir"; then
1750
# Determine the type of output
1753
$echo "$modename: you must specify an output file" 1>&2
1757
*.$libext) linkmode=oldlib ;;
1758
*.lo | *.$objext) linkmode=obj ;;
1759
*.la) linkmode=lib ;;
1760
*) linkmode=prog ;; # Anything else should be a program.
1764
*cygwin* | *mingw* | *pw32*)
1765
# don't eliminate duplications in $postdeps and $predeps
1766
duplicate_compiler_generated_deps=yes
1769
duplicate_compiler_generated_deps=$duplicate_deps
1775
# Find all interdependent deplibs by searching for libraries
1776
# that are linked more than once (e.g. -la -lb -la)
1777
for deplib in $deplibs; do
1778
if test "X$duplicate_deps" = "Xyes" ; then
1780
*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1783
libs="$libs $deplib"
1786
if test "$linkmode" = lib; then
1787
libs="$predeps $libs $compiler_lib_search_path $postdeps"
1789
# Compute libraries that are listed more than once in $predeps
1790
# $postdeps and mark them as special (i.e., whose duplicates are
1791
# not to be eliminated).
1793
if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
1794
for pre_post_dep in $predeps $postdeps; do
1795
case "$pre_post_deps " in
1796
*" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
1798
pre_post_deps="$pre_post_deps $pre_post_dep"
1807
need_relink=no # whether we're linking any uninstalled libtool libraries
1808
notinst_deplibs= # not-installed libtool libraries
1809
notinst_path= # paths that contain not-installed libtool libraries
1813
for file in $dlfiles $dlprefiles; do
1817
$echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
1829
passes="conv scan dlopen dlpreopen link"
1834
for pass in $passes; do
1835
if test "$linkmode,$pass" = "lib,link" ||
1836
test "$linkmode,$pass" = "prog,scan"; then
1840
if test "$linkmode" = prog; then
1842
dlopen) libs="$dlfiles" ;;
1843
dlpreopen) libs="$dlprefiles" ;;
1844
link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
1847
if test "$pass" = dlopen; then
1848
# Collect dlpreopened libraries
1849
save_deplibs="$deplibs"
1852
for deplib in $libs; do
1856
-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
1857
if test "$linkmode,$pass" = "prog,link"; then
1858
compile_deplibs="$deplib $compile_deplibs"
1859
finalize_deplibs="$deplib $finalize_deplibs"
1861
deplibs="$deplib $deplibs"
1866
if test "$linkmode" != lib && test "$linkmode" != prog; then
1867
$echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
1870
if test "$pass" = conv; then
1871
deplibs="$deplib $deplibs"
1874
name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
1875
for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
1876
for search_ext in .la $std_shrext .so .a; do
1877
# Search the libtool library
1878
lib="$searchdir/lib${name}${search_ext}"
1879
if test -f "$lib"; then
1880
if test "$search_ext" = ".la"; then
1889
if test "$found" != yes; then
1890
# deplib doesn't seem to be a libtool library
1891
if test "$linkmode,$pass" = "prog,link"; then
1892
compile_deplibs="$deplib $compile_deplibs"
1893
finalize_deplibs="$deplib $finalize_deplibs"
1895
deplibs="$deplib $deplibs"
1896
test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
1899
else # deplib is a libtool library
1900
# If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
1901
# We need to do some special things here, and not later.
1902
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
1903
case " $predeps $postdeps " in
1905
if (${SED} -e '2q' $lib |
1906
grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1910
*/* | *\\*) . $lib ;;
1913
for l in $old_library $library_names; do
1916
if test "X$ll" = "X$old_library" ; then # only static version available
1918
ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
1919
test "X$ladir" = "X$lib" && ladir="."
1920
lib=$ladir/$old_library
1921
if test "$linkmode,$pass" = "prog,link"; then
1922
compile_deplibs="$deplib $compile_deplibs"
1923
finalize_deplibs="$deplib $finalize_deplibs"
1925
deplibs="$deplib $deplibs"
1926
test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
1940
deplibs="$deplib $deplibs"
1941
test "$pass" = conv && continue
1942
newdependency_libs="$deplib $newdependency_libs"
1943
newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1946
if test "$pass" = conv; then
1947
deplibs="$deplib $deplibs"
1950
if test "$pass" = scan; then
1951
deplibs="$deplib $deplibs"
1953
compile_deplibs="$deplib $compile_deplibs"
1954
finalize_deplibs="$deplib $finalize_deplibs"
1956
newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1959
$echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
1965
if test "$pass" = link; then
1966
dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1967
# Make sure the xrpath contains only unique directories.
1970
*) xrpath="$xrpath $dir" ;;
1973
deplibs="$deplib $deplibs"
1976
*.la) lib="$deplib" ;;
1978
if test "$pass" = conv; then
1979
deplibs="$deplib $deplibs"
1984
if test "$deplibs_check_method" != pass_all; then
1986
$echo "*** Warning: Trying to link with static lib archive $deplib."
1987
$echo "*** I have the capability to make that library automatically link in when"
1988
$echo "*** you link to this library. But I can only do this if you have a"
1989
$echo "*** shared version of the library, which you do not appear to have"
1990
$echo "*** because the file extensions .$libext of this argument makes me believe"
1991
$echo "*** that it is just a static archive that I should not used here."
1994
$echo "*** Warning: Linking the shared library $output against the"
1995
$echo "*** static library $deplib is not portable!"
1996
deplibs="$deplib $deplibs"
2001
if test "$pass" != link; then
2002
deplibs="$deplib $deplibs"
2004
compile_deplibs="$deplib $compile_deplibs"
2005
finalize_deplibs="$deplib $finalize_deplibs"
2012
if test "$pass" = conv; then
2013
deplibs="$deplib $deplibs"
2014
elif test "$linkmode" = prog; then
2015
if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
2016
# If there is no dlopen support or we're linking statically,
2017
# we need to preload.
2018
newdlprefiles="$newdlprefiles $deplib"
2019
compile_deplibs="$deplib $compile_deplibs"
2020
finalize_deplibs="$deplib $finalize_deplibs"
2022
newdlfiles="$newdlfiles $deplib"
2032
if test "$found" = yes || test -f "$lib"; then :
2034
$echo "$modename: cannot find the library \`$lib'" 1>&2
2038
# Check to see that this really is a libtool archive.
2039
if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
2041
$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2045
ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2046
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
2054
# If the library was installed with an old release of libtool,
1211
# it will not redefine variable installed.
2055
# it will not redefine variables installed, or shouldnotlink
1214
2059
# Read the .la file
1215
# If there is no directory component, then add one.
1217
*/* | *\\*) . $arg ;;
2061
*/* | *\\*) . $lib ;;
2065
if test "$linkmode,$pass" = "lib,link" ||
2066
test "$linkmode,$pass" = "prog,scan" ||
2067
{ test "$linkmode" != prog && test "$linkmode" != lib; }; then
2068
test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
2069
test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
2072
if test "$pass" = conv; then
2073
# Only check for convenience libraries
2074
deplibs="$lib $deplibs"
2075
if test -z "$libdir"; then
2076
if test -z "$old_library"; then
2077
$echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2080
# It is a libtool convenience library, so add in its objects.
2081
convenience="$convenience $ladir/$objdir/$old_library"
2082
old_convenience="$old_convenience $ladir/$objdir/$old_library"
2084
for deplib in $dependency_libs; do
2085
deplibs="$deplib $deplibs"
2086
if test "X$duplicate_deps" = "Xyes" ; then
2087
case "$tmp_libs " in
2088
*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2091
tmp_libs="$tmp_libs $deplib"
2093
elif test "$linkmode" != prog && test "$linkmode" != lib; then
2094
$echo "$modename: \`$lib' is not a convenience library" 1>&2
1221
2101
# Get the name of the library we link against.
1223
2103
for l in $old_library $library_names; do
1227
2106
if test -z "$linklib"; then
1228
$echo "$modename: cannot find name of link library for \`$arg'" 1>&2
2107
$echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2111
# This library was specified with -dlopen.
2112
if test "$pass" = dlopen; then
2113
if test -z "$libdir"; then
2114
$echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
2117
if test -z "$dlname" ||
2118
test "$dlopen_support" != yes ||
2119
test "$build_libtool_libs" = no; then
2120
# If there is no dlname, no dlopen support or we're linking
2121
# statically, we need to preload. We also need to preload any
2122
# dependent libraries so libltdl's deplib preloader doesn't
2123
# bomb out in the load deplibs phase.
2124
dlprefiles="$dlprefiles $lib $dependency_libs"
2126
newdlfiles="$newdlfiles $lib"
2131
# We need an absolute path.
2133
[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
2135
abs_ladir=`cd "$ladir" && pwd`
2136
if test -z "$abs_ladir"; then
2137
$echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
2138
$echo "$modename: passing it literally to the linker, although it might fail" 1>&2
2143
laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
1232
2145
# Find the relevant object directory and library name.
1233
name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'`
1235
2146
if test "X$installed" = Xyes; then
2147
if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2148
$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
2157
dir="$ladir/$objdir"
2158
absdir="$abs_ladir/$objdir"
2159
# Remove this search path later
2160
notinst_path="$notinst_path $abs_ladir"
2161
fi # $installed = yes
2162
name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2164
# This library was specified with -dlpreopen.
2165
if test "$pass" = dlpreopen; then
2166
if test -z "$libdir"; then
2167
$echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
1301
2170
# Prefer using a static library (so that no silly _DYNAMIC symbols
1302
2171
# are required to link).
1303
2172
if test -n "$old_library"; then
1304
dlprefiles="$dlprefiles $dir/$old_library"
1306
dlprefiles="$dlprefiles $dir/$linklib"
2173
newdlprefiles="$newdlprefiles $dir/$old_library"
2174
# Otherwise, use the dlname, so that lt_dlopen finds it.
2175
elif test -n "$dlname"; then
2176
newdlprefiles="$newdlprefiles $dir/$dlname"
2178
newdlprefiles="$newdlprefiles $dir/$linklib"
2180
fi # $pass = dlpreopen
2182
if test -z "$libdir"; then
2183
# Link the convenience library
2184
if test "$linkmode" = lib; then
2185
deplibs="$dir/$old_library $deplibs"
2186
elif test "$linkmode,$pass" = "prog,link"; then
2187
compile_deplibs="$dir/$old_library $compile_deplibs"
2188
finalize_deplibs="$dir/$old_library $finalize_deplibs"
2190
deplibs="$lib $deplibs" # used for prog,scan pass
2196
if test "$linkmode" = prog && test "$pass" != link; then
2197
newlib_search_path="$newlib_search_path $ladir"
2198
deplibs="$lib $deplibs"
2201
if test "$link_all_deplibs" != no || test -z "$library_names" ||
2202
test "$build_libtool_libs" = no; then
2207
for deplib in $dependency_libs; do
2209
-L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
2211
# Need to link against all dependency_libs?
2212
if test "$linkalldeplibs" = yes; then
2213
deplibs="$deplib $deplibs"
2215
# Need to hardcode shared library paths
2216
# or/and link against static libraries
2217
newdependency_libs="$deplib $newdependency_libs"
2219
if test "X$duplicate_deps" = "Xyes" ; then
2220
case "$tmp_libs " in
2221
*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2224
tmp_libs="$tmp_libs $deplib"
2227
fi # $linkmode = prog...
2229
if test "$linkmode,$pass" = "prog,link"; then
2230
if test -n "$library_names" &&
2231
{ test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2232
# We need to hardcode the library path
2233
if test -n "$shlibpath_var"; then
2234
# Make sure the rpath contains only unique directories.
2235
case "$temp_rpath " in
2238
*) temp_rpath="$temp_rpath $dir" ;;
2242
# Hardcode the library path.
2243
# Skip directories that are in the system default run-time
2245
case " $sys_lib_dlsearch_path " in
2248
case "$compile_rpath " in
2250
*) compile_rpath="$compile_rpath $absdir"
2254
case " $sys_lib_dlsearch_path " in
2257
case "$finalize_rpath " in
2259
*) finalize_rpath="$finalize_rpath $libdir"
2263
fi # $linkmode,$pass = prog,link...
2265
if test "$alldeplibs" = yes &&
2266
{ test "$deplibs_check_method" = pass_all ||
2267
{ test "$build_libtool_libs" = yes &&
2268
test -n "$library_names"; }; }; then
2269
# We only need to search for static libraries
2274
link_static=no # Whether the deplib will be linked statically
1311
2275
if test -n "$library_names" &&
1312
2276
{ 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" ;;
2277
if test "$installed" = no; then
2278
notinst_deplibs="$notinst_deplibs $lib"
2281
# This is a shared library
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
2283
# Warn about portability, can't link against -module's on
2284
# some systems (darwin)
2285
if test "$shouldnotlink" = yes && test "$pass" = link ; then
2287
if test "$linkmode" = prog; then
2288
$echo "*** Warning: Linking the executable $output against the loadable module"
2290
$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
2292
$echo "*** $linklib is not portable!"
2294
if test "$linkmode" = lib &&
2295
test "$hardcode_into_libs" = yes; then
2296
# Hardcode the library path.
2297
# Skip directories that are in the system default run-time
2299
case " $sys_lib_dlsearch_path " in
1342
2300
*" $absdir "*) ;;
1343
*) compile_rpath="$compile_rpath $absdir"
2302
case "$compile_rpath " in
2304
*) compile_rpath="$compile_rpath $absdir"
1348
case " $sys_lib_dlsearch_path " in
1351
case "$finalize_rpath " in
2308
case " $sys_lib_dlsearch_path " in
1352
2309
*" $libdir "*) ;;
1353
*) finalize_rpath="$finalize_rpath $libdir"
2311
case "$finalize_rpath " in
2313
*) 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"
2319
if test -n "$old_archive_from_expsyms_cmds"; then
2320
# figure out the soname
2321
set dummy $library_names
2324
libname=`eval \\$echo \"$libname_spec\"`
2325
# use dlname if we got it. it's perfectly good, no?
2326
if test -n "$dlname"; then
2328
elif test -n "$soname_spec"; then
2332
major=`expr $current - $age`
2336
eval soname=\"$soname_spec\"
2341
# Make a new name for the extract_expsyms_cmds to use
2343
soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
2344
newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
2346
# If the library has no export list, then create one now
2347
if test -f "$output_objdir/$soname-def"; then :
2349
$show "extracting exported symbol list from \`$soname'"
2350
save_ifs="$IFS"; IFS='~'
2351
cmds=$extract_expsyms_cmds
2352
for cmd in $cmds; do
2356
$run eval "$cmd" || exit $?
2362
if test -f "$output_objdir/$newlib"; then :; else
2363
$show "generating import library for \`$soname'"
2364
save_ifs="$IFS"; IFS='~'
2365
cmds=$old_archive_from_expsyms_cmds
2366
for cmd in $cmds; do
2370
$run eval "$cmd" || exit $?
2374
# make sure the library variables are pointing to the new library
2377
fi # test -n "$old_archive_from_expsyms_cmds"
2379
if test "$linkmode" = prog || test "$mode" != relink; then
2384
case $hardcode_action in
2385
immediate | unsupported)
2386
if test "$hardcode_direct" = no; then
2389
*-*-sco3.2v5* ) add_dir="-L$dir" ;;
2391
# if the lib is a module then we can not link against
2392
# it, someone is ignoring the new warnings I added
2393
if /usr/bin/file -L $add 2> /dev/null | $EGREP "bundle" >/dev/null ; then
2394
$echo "** Warning, lib $linklib is a module, not a shared library"
2395
if test -z "$old_library" ; then
2397
$echo "** And there doesn't seem to be a static archive available"
2398
$echo "** The link will probably fail, sorry"
2400
add="$dir/$old_library"
2404
elif test "$hardcode_minus_L" = no; then
2406
*-*-sunos*) add_shlibpath="$dir" ;;
2410
elif test "$hardcode_shlibpath_var" = no; then
2411
add_shlibpath="$dir"
2418
if test "$hardcode_direct" = yes; then
2420
elif test "$hardcode_minus_L" = yes; then
2422
# Try looking first in the location we're being installed to.
2423
if test -n "$inst_prefix_dir"; then
2426
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"
2431
elif test "$hardcode_shlibpath_var" = yes; then
2432
add_shlibpath="$dir"
2441
if test "$lib_linked" != yes; then
2442
$echo "$modename: configuration error: unsupported hardcode properties"
2446
if test -n "$add_shlibpath"; then
2447
case :$compile_shlibpath: in
2448
*":$add_shlibpath:"*) ;;
2449
*) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
2452
if test "$linkmode" = prog; then
2453
test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
2454
test -n "$add" && compile_deplibs="$add $compile_deplibs"
2456
test -n "$add_dir" && deplibs="$add_dir $deplibs"
2457
test -n "$add" && deplibs="$add $deplibs"
2458
if test "$hardcode_direct" != yes && \
2459
test "$hardcode_minus_L" != yes && \
2460
test "$hardcode_shlibpath_var" = yes; then
2461
case :$finalize_shlibpath: in
2463
*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2469
if test "$linkmode" = prog || test "$mode" = relink; then
2473
# Finalize command for both is simple: just hardcode it.
1399
2474
if test "$hardcode_direct" = yes; then
1400
compile_command="$compile_command $absdir/$linklib"
1401
deplibs="$deplibs $absdir/$linklib"
2475
add="$libdir/$linklib"
1402
2476
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
2479
elif test "$hardcode_shlibpath_var" = yes; then
1410
case ":$compile_shlibpath:" in
1412
*) compile_shlibpath="$compile_shlibpath$absdir:";;
2480
case :$finalize_shlibpath: in
2482
*) 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
2485
elif test "$hardcode_automatic" = yes; then
2486
if test -n "$inst_prefix_dir" &&
2487
test -f "$inst_prefix_dir$libdir/$linklib" ; then
2488
add="$inst_prefix_dir$libdir/$linklib"
2490
add="$libdir/$linklib"
2493
# We cannot seem to hardcode it, guess we'll fake it.
2495
# Try looking first in the location we're being installed to.
2496
if test -n "$inst_prefix_dir"; then
2499
add_dir="$add_dir -L$inst_prefix_dir$libdir"
2506
if test "$linkmode" = prog; then
2507
test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
2508
test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
2510
test -n "$add_dir" && deplibs="$add_dir $deplibs"
2511
test -n "$add" && deplibs="$add $deplibs"
2514
elif test "$linkmode" = prog; then
1461
2515
# Here we assume that one of hardcode_direct or hardcode_minus_L
1462
2516
# is not unsupported. This is valid on all known static and
1463
2517
# shared platforms.
1464
2518
if test "$hardcode_direct" != unsupported; then
1465
2519
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
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
2520
compile_deplibs="$dir/$linklib $compile_deplibs"
2521
finalize_deplibs="$dir/$linklib $finalize_deplibs"
2523
compile_deplibs="-l$name -L$dir $compile_deplibs"
2524
finalize_deplibs="-l$name -L$dir $finalize_deplibs"
2526
elif test "$build_libtool_libs" = yes; then
2527
# Not a shared library
2528
if test "$deplibs_check_method" != pass_all; then
2529
# We're trying link a shared library against a static one
2530
# but the system doesn't support it.
2532
# Just print a warning and add the library to dependency_libs so
2533
# that the program can be linked against the static library.
2535
$echo "*** Warning: This system can not link to static lib archive $lib."
2536
$echo "*** I have the capability to make that library automatically link in when"
2537
$echo "*** you link to this library. But I can only do this if you have a"
2538
$echo "*** shared version of the library, which you do not appear to have."
2539
if test "$module" = yes; then
2540
$echo "*** But as you try to build a module library, libtool will still create "
2541
$echo "*** a static module, that should work as long as the dlopening application"
2542
$echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
2543
if test -z "$global_symbol_pipe"; then
2545
$echo "*** However, this would only work if libtool was able to extract symbol"
2546
$echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2547
$echo "*** not find such a program. So, this module is probably useless."
2548
$echo "*** \`nm' from GNU binutils and a full rebuild may help."
2550
if test "$build_old_libs" = no; then
2551
build_libtool_libs=module
2554
build_libtool_libs=no
2558
convenience="$convenience $dir/$old_library"
2559
old_convenience="$old_convenience $dir/$old_library"
2560
deplibs="$dir/$old_library $deplibs"
2563
fi # link shared/static library?
2565
if test "$linkmode" = lib; then
2566
if test -n "$dependency_libs" &&
2567
{ test "$hardcode_into_libs" != yes ||
2568
test "$build_old_libs" = yes ||
2569
test "$link_static" = yes; }; then
2570
# Extract -R from dependency_libs
2572
for libdir in $dependency_libs; do
2574
-R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2576
*" $temp_xrpath "*) ;;
2577
*) xrpath="$xrpath $temp_xrpath";;
2579
*) temp_deplibs="$temp_deplibs $libdir";;
2582
dependency_libs="$temp_deplibs"
2585
newlib_search_path="$newlib_search_path $absdir"
2586
# Link against this library
2587
test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2588
# ... and its dependency_libs
2590
for deplib in $dependency_libs; do
2591
newdependency_libs="$deplib $newdependency_libs"
2592
if test "X$duplicate_deps" = "Xyes" ; then
2593
case "$tmp_libs " in
2594
*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2597
tmp_libs="$tmp_libs $deplib"
2600
if test "$link_all_deplibs" != no; then
2601
# Add the search paths of all dependency libraries
2602
for deplib in $dependency_libs; do
2604
-L*) path="$deplib" ;;
2606
dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2607
test "X$dir" = "X$deplib" && dir="."
2608
# We need an absolute path.
2610
[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2612
absdir=`cd "$dir" && pwd`
2613
if test -z "$absdir"; then
2614
$echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2619
if grep "^installed=no" $deplib > /dev/null; then
2620
path="$absdir/$objdir"
2622
eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2623
if test -z "$libdir"; then
2624
$echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2627
if test "$absdir" != "$libdir"; then
2628
$echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2635
# we do not want to link against static libs,
2636
# but need to link against shared
2637
eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
2638
if test -n "$deplibrary_names" ; then
2639
for tmp in $deplibrary_names ; do
2642
if test -f "$path/$depdepl" ; then
2643
depdepl="$path/$depdepl"
2645
# do not add paths which are already there
2646
case " $newlib_search_path " in
2648
*) newlib_search_path="$newlib_search_path $path";;
2661
# Again, we only want to link against shared libraries
2662
eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
2663
for tmp in $newlib_search_path ; do
2664
if test -f "$tmp/lib$tmp_libs.dylib" ; then
2665
eval depdepl="$tmp/lib$tmp_libs.dylib"
2676
case " $deplibs " in
2678
*) deplibs="$depdepl $deplibs" ;;
2680
case " $deplibs " in
2682
*) deplibs="$deplibs $path" ;;
2685
fi # link_all_deplibs != no
2687
done # for deplib in $libs
2688
dependency_libs="$newdependency_libs"
2689
if test "$pass" = dlpreopen; then
2690
# Link the dlpreopened libraries before other libraries
2691
for deplib in $save_deplibs; do
2692
deplibs="$deplib $deplibs"
2695
if test "$pass" != dlopen; then
2696
if test "$pass" != conv; then
2697
# Make sure lib_search_path contains only unique directories.
2699
for dir in $newlib_search_path; do
2700
case "$lib_search_path " in
2702
*) lib_search_path="$lib_search_path $dir" ;;
2708
if test "$linkmode,$pass" != "prog,link"; then
2711
vars="compile_deplibs finalize_deplibs"
2713
for var in $vars dependency_libs; do
2714
# Add libraries to $var in reverse order
2715
eval tmp_libs=\"\$$var\"
2717
for deplib in $tmp_libs; do
2718
# FIXME: Pedantically, this is the right thing to do, so
2719
# that some nasty dependency loop isn't accidentally
2721
#new_libs="$deplib $new_libs"
2722
# Pragmatically, this seems to cause very few problems in
2725
-L*) new_libs="$deplib $new_libs" ;;
2728
# And here is the reason: when a library appears more
2729
# than once as an explicit dependence of a library, or
2730
# is implicitly linked in more than once by the
2731
# compiler, it is considered special, and multiple
2732
# occurrences thereof are not removed. Compare this
2733
# with having the same library being listed as a
2734
# dependency of multiple other libraries: in this case,
2735
# we know (pedantically, we assume) the library does not
2736
# need to be listed more than once, so we keep only the
2737
# last copy. This is not always right, but it is rare
2738
# enough that we require users that really mean to play
2739
# such unportable linking tricks to link the library
2740
# using -Wl,-lname, so that libtool does not consider it
2741
# for duplicate removal.
2742
case " $specialdeplibs " in
2743
*" $deplib "*) new_libs="$deplib $new_libs" ;;
2745
case " $new_libs " in
2747
*) new_libs="$deplib $new_libs" ;;
2755
for deplib in $new_libs; do
2758
case " $tmp_libs " in
2760
*) tmp_libs="$tmp_libs $deplib" ;;
2763
*) tmp_libs="$tmp_libs $deplib" ;;
2766
eval $var=\"$tmp_libs\"
2769
# Last step: remove runtime libs from dependency_libs
2770
# (they stay in deplibs)
2772
for i in $dependency_libs ; do
2773
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
2778
if test -n "$i" ; then
2779
tmp_libs="$tmp_libs $i"
2782
dependency_libs=$tmp_libs
2784
if test "$linkmode" = prog; then
2785
dlfiles="$newdlfiles"
2786
dlprefiles="$newdlprefiles"
1538
2791
if test -n "$deplibs"; then
1539
2792
$echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2