1188
1241
# Preload the old-style object.
1189
1242
dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
1246
*.lo) libobjs="$libobjs $arg" ;;
1247
*) objs="$objs $arg" ;;
1192
libobjs="$libobjs $arg"
1254
deplibs="$deplibs $arg"
1255
old_deplibs="$old_deplibs $arg"
1196
1260
# A libtool-controlled library.
1262
if test "$prev" = dlfiles; then
1263
# This library was specified with -dlopen.
1264
dlfiles="$dlfiles $arg"
1266
elif test "$prev" = dlprefiles; then
1267
# The library was specified with -dlpreopen.
1268
dlprefiles="$dlprefiles $arg"
1271
deplibs="$deplibs $arg"
1276
# Some other compiler argument.
1278
# Unknown arguments in both finalize_command and compile_command need
1279
# to be aesthetically quoted because they are evaled later.
1280
arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1282
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1289
# Now actually substitute the argument into the commands.
1290
if test -n "$arg"; then
1291
compile_command="$compile_command $arg"
1292
finalize_command="$finalize_command $arg"
1294
done # argument parsing loop
1296
if test -n "$prev"; then
1297
$echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1302
if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1303
eval arg=\"$export_dynamic_flag_spec\"
1304
compile_command="$compile_command $arg"
1305
finalize_command="$finalize_command $arg"
1308
# calculate the name of the file, without its directory
1309
outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1310
libobjs_save="$libobjs"
1312
if test -n "$shlibpath_var"; then
1313
# get the directories listed in $shlibpath_var
1314
eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
1318
eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
1319
eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
1321
output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1322
if test "X$output_objdir" = "X$output"; then
1323
output_objdir="$objdir"
1325
output_objdir="$output_objdir/$objdir"
1327
# Create the object directory.
1328
if test ! -d $output_objdir; then
1329
$show "$mkdir $output_objdir"
1330
$run $mkdir $output_objdir
1332
if test $status -ne 0 && test ! -d $output_objdir; then
1337
# Determine the type of output
1340
$echo "$modename: you must specify an output file" 1>&2
1344
*.$libext) linkmode=oldlib ;;
1345
*.lo | *.$objext) linkmode=obj ;;
1346
*.la) linkmode=lib ;;
1347
*) linkmode=prog ;; # Anything else should be a program.
1352
# Find all interdependent deplibs by searching for libraries
1353
# that are linked more than once (e.g. -la -lb -la)
1354
for deplib in $deplibs; do
1355
if test "X$duplicate_deps" = "Xyes" ; then
1357
*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1360
libs="$libs $deplib"
1365
need_relink=no # whether we're linking any uninstalled libtool libraries
1366
notinst_deplibs= # not-installed libtool libraries
1367
notinst_path= # paths that contain not-installed libtool libraries
1371
for file in $dlfiles $dlprefiles; do
1375
$echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
1387
passes="conv scan dlopen dlpreopen link"
1392
for pass in $passes; do
1393
if test $linkmode = prog; then
1394
# Determine which files to process
1398
save_deplibs="$deplibs" # Collect dlpreopened libraries
1401
dlpreopen) libs="$dlprefiles" ;;
1402
link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
1405
for deplib in $libs; do
1410
if test $linkmode = oldlib && test $linkmode = obj; then
1411
$echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2
1414
if test $pass = conv; then
1415
deplibs="$deplib $deplibs"
1418
name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
1419
for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
1420
# Search the libtool library
1421
lib="$searchdir/lib${name}.la"
1422
if test -f "$lib"; then
1427
if test "$found" != yes; then
1428
# deplib doesn't seem to be a libtool library
1429
if test "$linkmode,$pass" = "prog,link"; then
1430
compile_deplibs="$deplib $compile_deplibs"
1431
finalize_deplibs="$deplib $finalize_deplibs"
1433
deplibs="$deplib $deplibs"
1434
test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs"
1442
deplibs="$deplib $deplibs"
1443
test $pass = conv && continue
1444
newdependency_libs="$deplib $newdependency_libs"
1445
newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1448
if test $pass = conv; then
1449
deplibs="$deplib $deplibs"
1452
if test $pass = scan; then
1453
deplibs="$deplib $deplibs"
1454
newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1456
compile_deplibs="$deplib $compile_deplibs"
1457
finalize_deplibs="$deplib $finalize_deplibs"
1461
$echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2
1467
if test $pass = link; then
1468
dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1469
# Make sure the xrpath contains only unique directories.
1472
*) xrpath="$xrpath $dir" ;;
1475
deplibs="$deplib $deplibs"
1478
*.la) lib="$deplib" ;;
1480
if test $pass = conv; then
1481
deplibs="$deplib $deplibs"
1486
if test "$deplibs_check_method" != pass_all; then
1488
echo "*** Warning: Trying to link with static lib archive $deplib."
1489
echo "*** I have the capability to make that library automatically link in when"
1490
echo "*** you link to this library. But I can only do this if you have a"
1491
echo "*** shared version of the library, which you do not appear to have"
1492
echo "*** because the file extensions .$libext of this argument makes me believe"
1493
echo "*** that it is just a static archive that I should not used here."
1496
echo "*** Warning: Linking the shared library $output against the"
1497
echo "*** static library $deplib is not portable!"
1498
deplibs="$deplib $deplibs"
1503
if test $pass != link; then
1504
deplibs="$deplib $deplibs"
1506
compile_deplibs="$deplib $compile_deplibs"
1507
finalize_deplibs="$deplib $finalize_deplibs"
1514
if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1515
# If there is no dlopen support or we're linking statically,
1516
# we need to preload.
1517
newdlprefiles="$newdlprefiles $deplib"
1518
compile_deplibs="$deplib $compile_deplibs"
1519
finalize_deplibs="$deplib $finalize_deplibs"
1521
newdlfiles="$newdlfiles $deplib"
1530
if test $found = yes || test -f "$lib"; then :
1532
$echo "$modename: cannot find the library \`$lib'" 1>&2
1536
# Check to see that this really is a libtool archive.
1537
if (${SED} -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1539
$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
1543
ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
1544
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
1552
# If the library was installed with an old release of libtool,
1211
1553
# it will not redefine variable installed.
1214
1556
# Read the .la file
1215
# If there is no directory component, then add one.
1217
*/* | *\\*) . $arg ;;
1558
*/* | *\\*) . $lib ;;
1562
if test "$linkmode,$pass" = "lib,link" ||
1563
test "$linkmode,$pass" = "prog,scan" ||
1564
{ test $linkmode = oldlib && test $linkmode = obj; }; then
1565
# Add dl[pre]opened files of deplib
1566
test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
1567
test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
1570
if test $pass = conv; then
1571
# Only check for convenience libraries
1572
deplibs="$lib $deplibs"
1573
if test -z "$libdir"; then
1574
if test -z "$old_library"; then
1575
$echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1578
# It is a libtool convenience library, so add in its objects.
1579
convenience="$convenience $ladir/$objdir/$old_library"
1580
old_convenience="$old_convenience $ladir/$objdir/$old_library"
1582
for deplib in $dependency_libs; do
1583
deplibs="$deplib $deplibs"
1584
if test "X$duplicate_deps" = "Xyes" ; then
1585
case "$tmp_libs " in
1586
*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1589
tmp_libs="$tmp_libs $deplib"
1591
elif test $linkmode != prog && test $linkmode != lib; then
1592
$echo "$modename: \`$lib' is not a convenience library" 1>&2
1221
1598
# Get the name of the library we link against.
1223
1600
for l in $old_library $library_names; do
1227
1603
if test -z "$linklib"; then
1228
$echo "$modename: cannot find name of link library for \`$arg'" 1>&2
1604
$echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1608
# This library was specified with -dlopen.
1609
if test $pass = dlopen; then
1610
if test -z "$libdir"; then
1611
$echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
1614
if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1615
# If there is no dlname, no dlopen support or we're linking
1616
# statically, we need to preload.
1617
dlprefiles="$dlprefiles $lib"
1619
newdlfiles="$newdlfiles $lib"
1624
# We need an absolute path.
1626
[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
1628
abs_ladir=`cd "$ladir" && pwd`
1629
if test -z "$abs_ladir"; then
1630
$echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
1631
$echo "$modename: passing it literally to the linker, although it might fail" 1>&2
1636
laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
1232
1638
# Find the relevant object directory and library name.
1233
name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'`
1235
1639
if test "X$installed" = Xyes; then
1640
if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
1641
$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
1650
dir="$ladir/$objdir"
1651
absdir="$abs_ladir/$objdir"
1652
# Remove this search path later
1653
notinst_path="$notinst_path $abs_ladir"
1654
fi # $installed = yes
1655
name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
1657
# This library was specified with -dlpreopen.
1658
if test $pass = dlpreopen; then
1659
if test -z "$libdir"; then
1660
$echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
1301
1663
# Prefer using a static library (so that no silly _DYNAMIC symbols
1302
1664
# are required to link).
1303
1665
if test -n "$old_library"; then
1304
dlprefiles="$dlprefiles $dir/$old_library"
1306
dlprefiles="$dlprefiles $dir/$linklib"
1666
newdlprefiles="$newdlprefiles $dir/$old_library"
1667
# Otherwise, use the dlname, so that lt_dlopen finds it.
1668
elif test -n "$dlname"; then
1669
newdlprefiles="$newdlprefiles $dir/$dlname"
1671
newdlprefiles="$newdlprefiles $dir/$linklib"
1673
fi # $pass = dlpreopen
1675
if test -z "$libdir"; then
1676
# Link the convenience library
1677
if test $linkmode = lib; then
1678
deplibs="$dir/$old_library $deplibs"
1679
elif test "$linkmode,$pass" = "prog,link"; then
1680
compile_deplibs="$dir/$old_library $compile_deplibs"
1681
finalize_deplibs="$dir/$old_library $finalize_deplibs"
1683
deplibs="$lib $deplibs"
1688
if test $linkmode = prog && test $pass != link; then
1689
newlib_search_path="$newlib_search_path $ladir"
1690
deplibs="$lib $deplibs"
1693
if test "$link_all_deplibs" != no || test -z "$library_names" ||
1694
test "$build_libtool_libs" = no; then
1699
for deplib in $dependency_libs; do
1701
-L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
1703
# Need to link against all dependency_libs?
1704
if test $linkalldeplibs = yes; then
1705
deplibs="$deplib $deplibs"
1707
# Need to hardcode shared library paths
1708
# or/and link against static libraries
1709
newdependency_libs="$deplib $newdependency_libs"
1711
if test "X$duplicate_deps" = "Xyes" ; then
1712
case "$tmp_libs " in
1713
*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1716
tmp_libs="$tmp_libs $deplib"
1719
fi # $linkmode = prog...
1721
link_static=no # Whether the deplib will be linked statically
1311
1722
if test -n "$library_names" &&
1312
1723
{ 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" ;;
1724
# Link against this 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
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
1726
if test "$linkmode,$pass" = "prog,link" ||
1727
{ test $linkmode = lib && test $hardcode_into_libs = yes; }; then
1728
# Hardcode the library path.
1729
# Skip directories that are in the system default run-time
1731
case " $sys_lib_dlsearch_path " in
1342
1732
*" $absdir "*) ;;
1343
*) compile_rpath="$compile_rpath $absdir"
1734
case "$compile_rpath " in
1736
*) compile_rpath="$compile_rpath $absdir"
1348
case " $sys_lib_dlsearch_path " in
1351
case "$finalize_rpath " in
1740
case " $sys_lib_dlsearch_path " in
1352
1741
*" $libdir "*) ;;
1353
*) finalize_rpath="$finalize_rpath $libdir"
1743
case "$finalize_rpath " in
1745
*) 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"
1749
if test $linkmode = prog; then
1750
# We need to hardcode the library path
1751
if test -n "$shlibpath_var"; then
1752
# Make sure the rpath contains only unique directories.
1753
case "$temp_rpath " in
1756
*) temp_rpath="$temp_rpath $dir" ;;
1760
fi # $linkmode,$pass = prog,link...
1762
if test "$alldeplibs" = yes &&
1763
{ test "$deplibs_check_method" = pass_all ||
1764
{ test "$build_libtool_libs" = yes &&
1765
test -n "$library_names"; }; }; then
1766
# We only need to search for static libraries
1770
if test "$installed" = no; then
1771
notinst_deplibs="$notinst_deplibs $lib"
1775
if test -n "$old_archive_from_expsyms_cmds"; then
1776
# figure out the soname
1777
set dummy $library_names
1780
libname=`eval \\$echo \"$libname_spec\"`
1781
# use dlname if we got it. it's perfectly good, no?
1782
if test -n "$dlname"; then
1784
elif test -n "$soname_spec"; then
1788
major=`expr $current - $age`
1792
eval soname=\"$soname_spec\"
1797
# Make a new name for the extract_expsyms_cmds to use
1799
soname=`echo $soroot | ${SED} -e 's/^.*\///'`
1800
newlib="libimp-`echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
1802
# If the library has no export list, then create one now
1803
if test -f "$output_objdir/$soname-def"; then :
1805
$show "extracting exported symbol list from \`$soname'"
1806
save_ifs="$IFS"; IFS='~'
1807
eval cmds=\"$extract_expsyms_cmds\"
1808
for cmd in $cmds; do
1811
$run eval "$cmd" || exit $?
1817
if test -f "$output_objdir/$newlib"; then :; else
1818
$show "generating import library for \`$soname'"
1819
save_ifs="$IFS"; IFS='~'
1820
eval cmds=\"$old_archive_from_expsyms_cmds\"
1821
for cmd in $cmds; do
1824
$run eval "$cmd" || exit $?
1828
# make sure the library variables are pointing to the new library
1831
fi # test -n $old_archive_from_expsyms_cmds
1833
if test $linkmode = prog || test "$mode" != relink; then
1838
case $hardcode_action in
1839
immediate | unsupported)
1840
if test "$hardcode_direct" = no; then
1842
elif test "$hardcode_minus_L" = no; then
1844
*-*-sunos*) add_shlibpath="$dir" ;;
1848
elif test "$hardcode_shlibpath_var" = no; then
1849
add_shlibpath="$dir"
1856
if test "$hardcode_direct" = yes; then
1858
elif test "$hardcode_minus_L" = yes; then
1860
# Try looking first in the location we're being installed to.
1861
if test -n "$inst_prefix_dir"; then
1864
add_dir="-L$inst_prefix_dir$libdir $add_dir"
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"
1869
elif test "$hardcode_shlibpath_var" = yes; then
1870
add_shlibpath="$dir"
1879
if test "$lib_linked" != yes; then
1880
$echo "$modename: configuration error: unsupported hardcode properties"
1884
if test -n "$add_shlibpath"; then
1885
case :$compile_shlibpath: in
1886
*":$add_shlibpath:"*) ;;
1887
*) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
1890
if test $linkmode = prog; then
1891
test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
1892
test -n "$add" && compile_deplibs="$add $compile_deplibs"
1894
test -n "$add_dir" && deplibs="$add_dir $deplibs"
1895
test -n "$add" && deplibs="$add $deplibs"
1896
if test "$hardcode_direct" != yes && \
1897
test "$hardcode_minus_L" != yes && \
1898
test "$hardcode_shlibpath_var" = yes; then
1899
case :$finalize_shlibpath: in
1901
*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
1907
if test $linkmode = prog || test "$mode" = relink; then
1911
# Finalize command for both is simple: just hardcode it.
1399
1912
if test "$hardcode_direct" = yes; then
1400
compile_command="$compile_command $absdir/$linklib"
1401
deplibs="$deplibs $absdir/$linklib"
1913
add="$libdir/$linklib"
1402
1914
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
1917
elif test "$hardcode_shlibpath_var" = yes; then
1410
case ":$compile_shlibpath:" in
1412
*) compile_shlibpath="$compile_shlibpath$absdir:";;
1918
case :$finalize_shlibpath: in
1920
*) 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
1924
# We cannot seem to hardcode it, guess we'll fake it.
1926
# Try looking first in the location we're being installed to.
1927
if test -n "$inst_prefix_dir"; then
1930
add_dir="-L$inst_prefix_dir$libdir $add_dir"
1937
if test $linkmode = prog; then
1938
test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
1939
test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
1941
test -n "$add_dir" && deplibs="$add_dir $deplibs"
1942
test -n "$add" && deplibs="$add $deplibs"
1945
elif test $linkmode = prog; then
1946
if test "$alldeplibs" = yes &&
1947
{ test "$deplibs_check_method" = pass_all ||
1948
{ test "$build_libtool_libs" = yes &&
1949
test -n "$library_names"; }; }; then
1950
# We only need to search for static libraries
1954
# Try to link the static library
1461
1955
# Here we assume that one of hardcode_direct or hardcode_minus_L
1462
1956
# is not unsupported. This is valid on all known static and
1463
1957
# shared platforms.
1464
1958
if test "$hardcode_direct" != unsupported; then
1465
1959
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
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
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
1538
if test -n "$deplibs"; then
1539
$echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
1960
compile_deplibs="$dir/$linklib $compile_deplibs"
1961
finalize_deplibs="$dir/$linklib $finalize_deplibs"
1963
compile_deplibs="-l$name -L$dir $compile_deplibs"
1964
finalize_deplibs="-l$name -L$dir $finalize_deplibs"
1966
elif test "$build_libtool_libs" = yes; then
1967
# Not a shared library
1968
if test "$deplibs_check_method" != pass_all; then
1969
# We're trying link a shared library against a static one
1970
# but the system doesn't support it.
1972
# Just print a warning and add the library to dependency_libs so
1973
# that the program can be linked against the static library.
1975
echo "*** Warning: This system can not link to static lib archive $lib."
1976
echo "*** I have the capability to make that library automatically link in when"
1977
echo "*** you link to this library. But I can only do this if you have a"
1978
echo "*** shared version of the library, which you do not appear to have."
1979
if test "$module" = yes; then
1980
echo "*** But as you try to build a module library, libtool will still create "
1981
echo "*** a static module, that should work as long as the dlopening application"
1982
echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
1983
if test -z "$global_symbol_pipe"; then
1985
echo "*** However, this would only work if libtool was able to extract symbol"
1986
echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
1987
echo "*** not find such a program. So, this module is probably useless."
1988
echo "*** \`nm' from GNU binutils and a full rebuild may help."
1990
if test "$build_old_libs" = no; then
1991
build_libtool_libs=module
1994
build_libtool_libs=no
1998
convenience="$convenience $dir/$old_library"
1999
old_convenience="$old_convenience $dir/$old_library"
2000
deplibs="$dir/$old_library $deplibs"
2003
fi # link shared/static library?
2005
if test $linkmode = lib; then
2006
if test -n "$dependency_libs" &&
2007
{ test $hardcode_into_libs != yes || test $build_old_libs = yes ||
2008
test $link_static = yes; }; then
2009
# Extract -R from dependency_libs
2011
for libdir in $dependency_libs; do
2013
-R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2015
*" $temp_xrpath "*) ;;
2016
*) xrpath="$xrpath $temp_xrpath";;
2018
*) temp_deplibs="$temp_deplibs $libdir";;
2021
dependency_libs="$temp_deplibs"
2024
newlib_search_path="$newlib_search_path $absdir"
2025
# Link against this library
2026
test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2027
# ... and its dependency_libs
2029
for deplib in $dependency_libs; do
2030
newdependency_libs="$deplib $newdependency_libs"
2031
if test "X$duplicate_deps" = "Xyes" ; then
2032
case "$tmp_libs " in
2033
*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2036
tmp_libs="$tmp_libs $deplib"
2039
if test $link_all_deplibs != no; then
2040
# Add the search paths of all dependency libraries
2041
for deplib in $dependency_libs; do
2043
-L*) path="$deplib" ;;
2045
dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2046
test "X$dir" = "X$deplib" && dir="."
2047
# We need an absolute path.
2049
[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2051
absdir=`cd "$dir" && pwd`
2052
if test -z "$absdir"; then
2053
$echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2058
if grep "^installed=no" $deplib > /dev/null; then
2059
path="-L$absdir/$objdir"
2061
eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2062
if test -z "$libdir"; then
2063
$echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2066
if test "$absdir" != "$libdir"; then
2067
$echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2074
case " $deplibs " in
2076
*) deplibs="$deplibs $path" ;;
2079
fi # link_all_deplibs != no
2081
done # for deplib in $libs
2082
if test $pass = dlpreopen; then
2083
# Link the dlpreopened libraries before other libraries
2084
for deplib in $save_deplibs; do
2085
deplibs="$deplib $deplibs"
2088
if test $pass != dlopen; then
2089
test $pass != scan && dependency_libs="$newdependency_libs"
2090
if test $pass != conv; then
2091
# Make sure lib_search_path contains only unique directories.
2093
for dir in $newlib_search_path; do
2094
case "$lib_search_path " in
2096
*) lib_search_path="$lib_search_path $dir" ;;
2102
if test "$linkmode,$pass" != "prog,link"; then
2105
vars="compile_deplibs finalize_deplibs"
2107
for var in $vars dependency_libs; do
2108
# Add libraries to $var in reverse order
2109
eval tmp_libs=\"\$$var\"
2111
for deplib in $tmp_libs; do
2113
-L*) new_libs="$deplib $new_libs" ;;
2115
case " $specialdeplibs " in
2116
*" $deplib "*) new_libs="$deplib $new_libs" ;;
2118
case " $new_libs " in
2120
*) new_libs="$deplib $new_libs" ;;
2128
for deplib in $new_libs; do
2131
case " $tmp_libs " in
2133
*) tmp_libs="$tmp_libs $deplib" ;;
2136
*) tmp_libs="$tmp_libs $deplib" ;;
2139
eval $var=\"$tmp_libs\"
2142
if test "$pass" = "conv" &&
2143
{ test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then
2144
libs="$deplibs" # reset libs
2148
if test $linkmode = prog; then
2149
dlfiles="$newdlfiles"
2150
dlprefiles="$newdlprefiles"
1542
2155
if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
1543
2156
$echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2