117
117
lo2o="s/\\.lo\$/.${objext}/"
118
118
o2lo="s/\\.${objext}\$/.lo/"
120
#####################################
121
# Shell function definitions:
122
# This seems to be the best place for them
124
# Need a lot of goo to handle *both* DLLs and import libs
125
# Has to be a shell function in order to 'eat' the argument
126
# that is supplied when $file_magic_command is called.
128
win32_libid_type="unknown"
129
win32_fileres=`file -L $1 2>/dev/null`
130
case $win32_fileres in
131
*ar\ archive\ import\ library*) # definitely import
132
win32_libid_type="x86 archive import"
134
*ar\ archive*) # could be an import, or static
135
if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
136
grep -E 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
137
win32_nmres=`eval $NM -f posix -A $1 | \
138
sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
139
if test "X$win32_nmres" = "Ximport" ; then
140
win32_libid_type="x86 archive import"
142
win32_libid_type="x86 archive static"
147
win32_libid_type="x86 DLL"
149
*executable*) # but shell scripts are "executable" too...
150
case $win32_fileres in
151
*MS\ Windows\ PE\ Intel*)
152
win32_libid_type="x86 DLL"
157
$echo $win32_libid_type
160
# End of Shell function definitions
161
#####################################
163
120
# Parse our command line options once, thoroughly.
164
while test "$#" -gt 0
371
284
modename="$modename: compile"
372
285
# Get the compilation command and the source file.
374
srcfile="$nonopt" # always keep a non-empty value in "srcfile"
383
# do not "continue". Instead, add this to base_compile
298
# Aesthetically quote the previous argument.
300
lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
303
# Double-quote args containing other shell metacharacters.
304
# Many Bourne shells cannot handle close brackets correctly
305
# in scan sets, so we specify it separately.
306
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
311
# Add the previous argument to base_compile.
312
if test -z "$base_compile"; then
313
base_compile="$lastarg"
315
base_compile="$base_compile $lastarg"
321
# Accept any command-line options.
324
if test "$user_target" != "no"; then
325
$echo "$modename: you cannot specify \`-o' more than once" 1>&2
352
args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
354
save_ifs="$IFS"; IFS=','
358
# Double-quote args containing other shell metacharacters.
359
# Many Bourne shells cannot handle close brackets correctly
360
# in scan sets, so we specify it separately.
362
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
366
lastarg="$lastarg $arg"
369
lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
371
# Add the arguments to base_compile.
372
if test -z "$base_compile"; then
373
base_compile="$lastarg"
375
base_compile="$base_compile $lastarg"
383
# The next one is the -o target name
388
# We got the output file
395
# Accept any command-line options.
398
if test -n "$libobj" ; then
399
$echo "$modename: you cannot specify \`-o' more than once" 1>&2
422
arg_mode=arg # the next one goes into the "base_compile" arg list
423
continue # The current "srcfile" will either be retained or
424
;; # replaced later. I would guess that would be a bug.
427
args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
429
save_ifs="$IFS"; IFS=','
433
# Double-quote args containing other shell metacharacters.
434
# Many Bourne shells cannot handle close brackets correctly
435
# in scan sets, so we specify it separately.
437
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
441
lastarg="$lastarg $arg"
444
lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
446
# Add the arguments to base_compile.
447
base_compile="$base_compile $lastarg"
452
# Accept the current argument as the source file.
453
# The previous "srcfile" becomes the current argument.
460
esac # case $arg_mode
395
# Accept the current argument as the source file.
462
399
# Aesthetically quote the previous argument.
401
# Backslashify any backslashes, double quotes, and dollar signs.
402
# These are the only characters that are still specially
403
# interpreted inside of double-quoted scrings.
463
404
lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
466
406
# Double-quote args containing other shell metacharacters.
467
407
# Many Bourne shells cannot handle close brackets correctly
468
408
# in scan sets, so we specify it separately.
469
410
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
470
411
lastarg="\"$lastarg\""
474
base_compile="$base_compile $lastarg"
415
# Add the previous argument to base_compile.
416
if test -z "$base_compile"; then
417
base_compile="$lastarg"
419
base_compile="$base_compile $lastarg"
479
$echo "$modename: you must specify an argument for -Xcompile"
427
# Get the name of the library object.
428
libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
483
431
$echo "$modename: you must specify a target with \`-o'" 1>&2
487
# Get the name of the library object.
488
[ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
492
436
# Recognize several different file suffixes.
493
437
# If the user specifies -o file.o, it is replaced with file.lo
496
440
*.ada) xform=ada ;;
497
441
*.adb) xform=adb ;;
521
# Infer tagged configuration to use if any are available and
522
# if one wasn't chosen via the "--tag" command line option.
523
# Only attempt this if the compiler in the base compile
524
# command doesn't match the default compiler.
525
if test -n "$available_tags" && test -z "$tagname"; then
526
case $base_compile in
527
# Blanks in the command may have been stripped by the calling shell,
528
# but not from the CC environment variable when configure was run.
529
" $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "*) ;;
530
# Blanks at the start of $base_compile will cause this to fail
531
# if we don't check for them as well.
533
for z in $available_tags; do
534
if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
535
# Evaluate the configuration.
536
eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
537
case "$base_compile " in
538
"$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)
539
# The compiler in the base compile command matches
540
# the one in the tagged configuration.
541
# Assume this is the tagged configuration we want.
548
# If $tagname still isn't set, then no tagged configuration
549
# was found and let the user know that the "--tag" command
550
# line option must be used.
551
if test -z "$tagname"; then
552
$echo "$modename: unable to infer tagged configuration"
553
$echo "$modename: specify a tag with \`--tag'" 1>&2
556
# $echo "$modename: using $tagname tagged configuration"
562
objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
563
xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
564
if test "X$xdir" = "X$obj"; then
569
lobj=${xdir}$objdir/$objname
571
462
if test -z "$base_compile"; then
572
463
$echo "$modename: you must specify a compilation command" 1>&2
573
464
$echo "$help" 1>&2
631
521
$run $rm $removelist
634
$echo $srcfile > "$lockfile"
524
echo $srcfile > "$lockfile"
637
527
if test -n "$fix_srcfile_path"; then
638
528
eval srcfile=\"$fix_srcfile_path\"
641
$run $rm "$libobj" "${libobj}T"
643
# Create a libtool object file (analogous to a ".la" file),
644
# but don't create it if we're doing a dry run.
645
test -z "$run" && cat > ${libobj}T <<EOF
646
# $libobj - a libtool object file
647
# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
649
# Please DO NOT delete this file!
650
# It is necessary for linking the library.
652
# Name of the PIC object.
655
531
# Only build a PIC object if we are building libtool libraries.
656
532
if test "$build_libtool_libs" = yes; then
657
533
# Without this assignment, base_compile gets emptied.
658
534
fbsd_hideous_sh_bug=$base_compile
660
536
if test "$pic_mode" != no; then
661
command="$base_compile $srcfile $pic_flag"
537
# All platforms use -DPIC, to notify preprocessed assembler code.
538
command="$base_compile $srcfile $pic_flag -DPIC"
663
540
# Don't build PIC code
664
541
command="$base_compile $srcfile"
667
if test ! -d "${xdir}$objdir"; then
668
$show "$mkdir ${xdir}$objdir"
669
$run $mkdir ${xdir}$objdir
671
if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then
676
if test -z "$output_obj"; then
677
# Place PIC objects in $objdir
678
command="$command -o $lobj"
681
$run $rm "$lobj" "$output_obj"
543
if test "$build_old_libs" = yes; then
545
dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
546
if test "X$dir" = "X$libobj"; then
551
libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
553
if test -d "$dir"; then
560
if test $status -ne 0 && test ! -d $dir; then
565
if test "$compiler_o_lo" = yes; then
567
command="$command -o $output_obj"
568
elif test "$compiler_c_o" = yes; then
570
command="$command -o $output_obj"
573
$run $rm "$output_obj"
684
575
if $run eval "$command"; then :
710
601
# Just move the object if needed, then go on to compile the next one
711
if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
712
$show "$mv $output_obj $lobj"
713
if $run $mv $output_obj $lobj; then :
721
# Append the name of the PIC object to the libtool object file.
722
test -z "$run" && cat >> ${libobj}T <<EOF
723
pic_object='$objdir/$objname'
602
if test x"$output_obj" != x"$libobj"; then
603
$show "$mv $output_obj $libobj"
604
if $run $mv $output_obj $libobj; then :
612
# If we have no pic_flag, then copy the object into place and finish.
613
if (test -z "$pic_flag" || test "$pic_mode" != default) &&
614
test "$build_old_libs" = yes; then
615
# Rename the .lo from within objdir to obj
616
if test -f $obj; then
621
$show "$mv $libobj $obj"
622
if $run $mv $libobj $obj; then :
629
xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
630
if test "X$xdir" = "X$obj"; then
635
baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"`
636
libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
637
# Now arrange that obj and lo_libobj become the same file
638
$show "(cd $xdir && $LN_S $baseobj $libobj)"
639
if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then
640
# Unlock the critical section if it was locked
641
if test "$need_locks" != no; then
727
652
# Allow error messages only from the first compilation.
728
653
suppress_output=' >/dev/null 2>&1'
730
# No PIC object so indicate it doesn't exist in the libtool
732
test -z "$run" && cat >> ${libobj}T <<EOF
738
656
# Only build a position-dependent object if we build old libraries.
791
# Append the name of the non-PIC object the libtool object file.
792
# Only append if the libtool object file exists.
793
test -z "$run" && cat >> ${libobj}T <<EOF
794
# Name of the non-PIC object.
795
non_pic_object='$objname'
799
# Append the name of the non-PIC object the libtool object file.
800
# Only append if the libtool object file exists.
801
test -z "$run" && cat >> ${libobj}T <<EOF
802
# Name of the non-PIC object.
711
# Create an invalid libtool object if no PIC, so that we do not
712
# accidentally link it into a program.
713
if test "$build_libtool_libs" != yes; then
714
$show "echo timestamp > $libobj"
715
$run eval "echo timestamp > \$libobj" || exit $?
717
# Move the .lo from within objdir
718
$show "$mv $libobj $lo_libobj"
719
if $run $mv $libobj $lo_libobj; then :
808
$run $mv "${libobj}T" "${libobj}"
810
728
# Unlock the critical section if it was locked
811
729
if test "$need_locks" != no; then
812
730
$run $rm "$lockfile"
1002
if test -f "$arg"; then
1005
for fil in `cat $save_arg`
1007
# moreargs="$moreargs $fil"
1009
# A libtool-controlled object.
1011
# Check to see that this really is a libtool object.
1012
if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1017
# If there is no directory component, then add one.
1019
*/* | *\\*) . $arg ;;
1023
if test -z "$pic_object" || \
1024
test -z "$non_pic_object" ||
1025
test "$pic_object" = none && \
1026
test "$non_pic_object" = none; then
1027
$echo "$modename: cannot find name of object for \`$arg'" 1>&2
1031
# Extract subdirectory from the argument.
1032
xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1033
if test "X$xdir" = "X$arg"; then
1039
if test "$pic_object" != none; then
1040
# Prepend the subdirectory the object is found in.
1041
pic_object="$xdir$pic_object"
1043
if test "$prev" = dlfiles; then
1044
if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1045
dlfiles="$dlfiles $pic_object"
1049
# If libtool objects are unsupported, then we need to preload.
1054
# CHECK ME: I think I busted this. -Ossama
1055
if test "$prev" = dlprefiles; then
1056
# Preload the old-style object.
1057
dlprefiles="$dlprefiles $pic_object"
1062
libobjs="$libobjs $pic_object"
1067
if test "$non_pic_object" != none; then
1068
# Prepend the subdirectory the object is found in.
1069
non_pic_object="$xdir$non_pic_object"
1071
# A standard non-PIC object
1072
non_pic_objects="$non_pic_objects $non_pic_object"
1073
if test -z "$pic_object" || test "$pic_object" = none ; then
1074
arg="$non_pic_object"
1078
# Only an error if not doing a dry-run.
1079
if test -z "$run"; then
1080
$echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1085
# Extract subdirectory from the argument.
1086
xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1087
if test "X$xdir" = "X$arg"; then
1093
pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1094
non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1095
libobjs="$libobjs $pic_object"
1096
non_pic_objects="$non_pic_objects $non_pic_object"
1101
$echo "$modename: link input file \`$save_arg' does not exist"
1109
916
# We need an absolute path.
1478
# A standard object.
1483
# A libtool-controlled object.
1485
# Check to see that this really is a libtool object.
1486
if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1491
# If there is no directory component, then add one.
1230
# A library or standard object.
1231
if test "$prev" = dlfiles; then
1232
# This file was specified with -dlopen.
1233
if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1234
dlfiles="$dlfiles $arg"
1238
# If libtool objects are unsupported, then we need to preload.
1243
if test "$prev" = dlprefiles; then
1244
# Preload the old-style object.
1245
dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
1493
*/* | *\\*) . $arg ;;
1249
*.lo) libobjs="$libobjs $arg" ;;
1250
*) objs="$objs $arg" ;;
1497
if test -z "$pic_object" || \
1498
test -z "$non_pic_object" ||
1499
test "$pic_object" = none && \
1500
test "$non_pic_object" = none; then
1501
$echo "$modename: cannot find name of object for \`$arg'" 1>&2
1505
# Extract subdirectory from the argument.
1506
xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1507
if test "X$xdir" = "X$arg"; then
1513
if test "$pic_object" != none; then
1514
# Prepend the subdirectory the object is found in.
1515
pic_object="$xdir$pic_object"
1517
if test "$prev" = dlfiles; then
1518
if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1519
dlfiles="$dlfiles $pic_object"
1523
# If libtool objects are unsupported, then we need to preload.
1528
# CHECK ME: I think I busted this. -Ossama
1529
if test "$prev" = dlprefiles; then
1530
# Preload the old-style object.
1531
dlprefiles="$dlprefiles $pic_object"
1536
libobjs="$libobjs $pic_object"
1541
if test "$non_pic_object" != none; then
1542
# Prepend the subdirectory the object is found in.
1543
non_pic_object="$xdir$non_pic_object"
1545
# A standard non-PIC object
1546
non_pic_objects="$non_pic_objects $non_pic_object"
1547
if test -z "$pic_object" || test "$pic_object" = none ; then
1548
arg="$non_pic_object"
1552
# Only an error if not doing a dry-run.
1553
if test -z "$run"; then
1554
$echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1559
# Extract subdirectory from the argument.
1560
xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1561
if test "X$xdir" = "X$arg"; then
1567
pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1568
non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1569
libobjs="$libobjs $pic_object"
1570
non_pic_objects="$non_pic_objects $non_pic_object"
1625
# Infer tagged configuration to use if any are available and
1626
# if one wasn't chosen via the "--tag" command line option.
1627
# Only attempt this if the compiler in the base link
1628
# command doesn't match the default compiler.
1629
if test -n "$available_tags" && test -z "$tagname"; then
1630
case $base_compile in
1631
# Blanks in the command may have been stripped by the calling shell,
1632
# but not from the CC environment variable when configure was run.
1633
"$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) ;;
1634
# Blanks at the start of $base_compile will cause this to fail
1635
# if we don't check for them as well.
1637
for z in $available_tags; do
1638
if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
1639
# Evaluate the configuration.
1640
eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
1641
case $base_compile in
1642
"$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)
1643
# The compiler in $compile_command matches
1644
# the one in the tagged configuration.
1645
# Assume this is the tagged configuration we want.
1652
# If $tagname still isn't set, then no tagged configuration
1653
# was found and let the user know that the "--tag" command
1654
# line option must be used.
1655
if test -z "$tagname"; then
1656
$echo "$modename: unable to infer tagged configuration"
1657
$echo "$modename: specify a tag with \`--tag'" 1>&2
1660
# $echo "$modename: using $tagname tagged configuration"
1666
1305
if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1667
1306
eval arg=\"$export_dynamic_flag_spec\"
1668
1307
compile_command="$compile_command $arg"
1669
1308
finalize_command="$finalize_command $arg"
1673
1311
# calculate the name of the file, without its directory
1674
1312
outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1675
1313
libobjs_save="$libobjs"
1786
1395
for pass in $passes; do
1787
if test "$linkmode,$pass" = "lib,link" ||
1788
test "$linkmode,$pass" = "prog,scan"; then
1792
if test "$linkmode" = prog; then
1396
if test $linkmode = prog; then
1397
# Determine which files to process
1794
dlopen) libs="$dlfiles" ;;
1401
save_deplibs="$deplibs" # Collect dlpreopened libraries
1795
1404
dlpreopen) libs="$dlprefiles" ;;
1796
1405
link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
1799
if test "$pass" = dlopen; then
1800
# Collect dlpreopened libraries
1801
save_deplibs="$deplibs"
1804
1408
for deplib in $libs; do
1807
1411
case $deplib in
1809
if test "$linkmode" != lib && test "$linkmode" != prog; then
1810
$echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
1413
if test $linkmode = oldlib && test $linkmode = obj; then
1414
$echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2
1813
if test "$pass" = conv; then
1417
if test $pass = conv; then
1814
1418
deplibs="$deplib $deplibs"
1830
1434
finalize_deplibs="$deplib $finalize_deplibs"
1832
1436
deplibs="$deplib $deplibs"
1833
test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
1437
test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs"
1836
else # deplib is a libtool library
1837
# If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
1838
# We need to do some special things here, and not later.
1839
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
1840
case " $predeps $postdeps " in
1842
if (${SED} -e '2q' $lib |
1843
grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1847
*/* | *\\*) . $lib ;;
1850
for l in $old_library $library_names; do
1853
if test "X$ll" = "X$old_library" ; then # only static version available
1855
ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
1856
test "X$ladir" = "X$lib" && ladir="."
1857
lib=$ladir/$old_library
1858
if test "$linkmode,$pass" = "prog,link"; then
1859
compile_deplibs="$deplib $compile_deplibs"
1860
finalize_deplibs="$deplib $finalize_deplibs"
1862
deplibs="$deplib $deplibs"
1863
test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
1875
1443
case $linkmode in
1877
1445
deplibs="$deplib $deplibs"
1878
test "$pass" = conv && continue
1446
test $pass = conv && continue
1879
1447
newdependency_libs="$deplib $newdependency_libs"
1880
1448
newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1883
if test "$pass" = conv; then
1451
if test $pass = conv; then
1884
1452
deplibs="$deplib $deplibs"
1887
if test "$pass" = scan; then
1455
if test $pass = scan; then
1888
1456
deplibs="$deplib $deplibs"
1889
1457
newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1913
1481
*.la) lib="$deplib" ;;
1915
if test "$pass" = conv; then
1483
if test $pass = conv; then
1916
1484
deplibs="$deplib $deplibs"
1919
1487
case $linkmode in
1921
1489
if test "$deplibs_check_method" != pass_all; then
1923
$echo "*** Warning: Trying to link with static lib archive $deplib."
1924
$echo "*** I have the capability to make that library automatically link in when"
1925
$echo "*** you link to this library. But I can only do this if you have a"
1926
$echo "*** shared version of the library, which you do not appear to have"
1927
$echo "*** because the file extensions .$libext of this argument makes me believe"
1928
$echo "*** that it is just a static archive that I should not used here."
1491
echo "*** Warning: Trying to link with static lib archive $deplib."
1492
echo "*** I have the capability to make that library automatically link in when"
1493
echo "*** you link to this library. But I can only do this if you have a"
1494
echo "*** shared version of the library, which you do not appear to have"
1495
echo "*** because the file extensions .$libext of this argument makes me believe"
1496
echo "*** that it is just a static archive that I should not used here."
1931
$echo "*** Warning: Linking the shared library $output against the"
1932
$echo "*** static library $deplib is not portable!"
1499
echo "*** Warning: Linking the shared library $output against the"
1500
echo "*** static library $deplib is not portable!"
1933
1501
deplibs="$deplib $deplibs"
1938
if test "$pass" != link; then
1506
if test $pass != link; then
1939
1507
deplibs="$deplib $deplibs"
1941
1509
compile_deplibs="$deplib $compile_deplibs"
2162
1722
fi # $linkmode = prog...
2164
if test "$linkmode,$pass" = "prog,link"; then
2165
if test -n "$library_names" &&
2166
{ test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2167
# We need to hardcode the library path
2168
if test -n "$shlibpath_var"; then
2169
# Make sure the rpath contains only unique directories.
2170
case "$temp_rpath " in
2173
*) temp_rpath="$temp_rpath $dir" ;;
2177
# Hardcode the library path.
2178
# Skip directories that are in the system default run-time
2180
case " $sys_lib_dlsearch_path " in
2183
case "$compile_rpath " in
2185
*) compile_rpath="$compile_rpath $absdir"
2189
case " $sys_lib_dlsearch_path " in
2192
case "$finalize_rpath " in
2194
*) finalize_rpath="$finalize_rpath $libdir"
2198
fi # $linkmode,$pass = prog,link...
2200
if test "$alldeplibs" = yes &&
2201
{ test "$deplibs_check_method" = pass_all ||
2202
{ test "$build_libtool_libs" = yes &&
2203
test -n "$library_names"; }; }; then
2204
# We only need to search for static libraries
2209
1724
link_static=no # Whether the deplib will be linked statically
2210
1725
if test -n "$library_names" &&
2211
1726
{ test "$prefer_static_libs" = no || test -z "$old_library"; }; then
1727
# Link against this shared library
1729
if test "$linkmode,$pass" = "prog,link" ||
1730
{ test $linkmode = lib && test $hardcode_into_libs = yes; }; then
1731
# Hardcode the library path.
1732
# Skip directories that are in the system default run-time
1734
case " $sys_lib_dlsearch_path " in
1737
case "$compile_rpath " in
1739
*) compile_rpath="$compile_rpath $absdir"
1743
case " $sys_lib_dlsearch_path " in
1746
case "$finalize_rpath " in
1748
*) finalize_rpath="$finalize_rpath $libdir"
1752
if test $linkmode = prog; then
1753
# We need to hardcode the library path
1754
if test -n "$shlibpath_var"; then
1755
# Make sure the rpath contains only unique directories.
1756
case "$temp_rpath " in
1759
*) temp_rpath="$temp_rpath $dir" ;;
1763
fi # $linkmode,$pass = prog,link...
1765
if test "$alldeplibs" = yes &&
1766
{ test "$deplibs_check_method" = pass_all ||
1767
{ test "$build_libtool_libs" = yes &&
1768
test -n "$library_names"; }; }; then
1769
# We only need to search for static libraries
2212
1773
if test "$installed" = no; then
2213
1774
notinst_deplibs="$notinst_deplibs $lib"
2214
1775
need_relink=yes
2216
# This is a shared library
2218
# Warn about portability, can't link against -module's on some systems (darwin)
2219
if test "$shouldnotlink" = yes && test "$pass" = link ; then
2221
if test "$linkmode" = prog; then
2222
$echo "*** Warning: Linking the executable $output against the loadable module"
2224
$echo "*** Warning: Linking the shared library $output against the loadable module"
2226
$echo "*** $linklib is not portable!"
2228
if test "$linkmode" = lib &&
2229
test "$hardcode_into_libs" = yes; then
2230
# Hardcode the library path.
2231
# Skip directories that are in the system default run-time
2233
case " $sys_lib_dlsearch_path " in
2236
case "$compile_rpath " in
2238
*) compile_rpath="$compile_rpath $absdir"
2242
case " $sys_lib_dlsearch_path " in
2245
case "$finalize_rpath " in
2247
*) finalize_rpath="$finalize_rpath $libdir"
2253
1778
if test -n "$old_archive_from_expsyms_cmds"; then
2254
1779
# figure out the soname
2463
1977
# Just print a warning and add the library to dependency_libs so
2464
1978
# that the program can be linked against the static library.
2466
$echo "*** Warning: This system can not link to static lib archive $lib."
2467
$echo "*** I have the capability to make that library automatically link in when"
2468
$echo "*** you link to this library. But I can only do this if you have a"
2469
$echo "*** shared version of the library, which you do not appear to have."
1980
echo "*** Warning: This system can not link to static lib archive $lib."
1981
echo "*** I have the capability to make that library automatically link in when"
1982
echo "*** you link to this library. But I can only do this if you have a"
1983
echo "*** shared version of the library, which you do not appear to have."
2470
1984
if test "$module" = yes; then
2471
$echo "*** But as you try to build a module library, libtool will still create "
2472
$echo "*** a static module, that should work as long as the dlopening application"
2473
$echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
1985
echo "*** But as you try to build a module library, libtool will still create "
1986
echo "*** a static module, that should work as long as the dlopening application"
1987
echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
2474
1988
if test -z "$global_symbol_pipe"; then
2476
$echo "*** However, this would only work if libtool was able to extract symbol"
2477
$echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2478
$echo "*** not find such a program. So, this module is probably useless."
2479
$echo "*** \`nm' from GNU binutils and a full rebuild may help."
1990
echo "*** However, this would only work if libtool was able to extract symbol"
1991
echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
1992
echo "*** not find such a program. So, this module is probably useless."
1993
echo "*** \`nm' from GNU binutils and a full rebuild may help."
2481
1995
if test "$build_old_libs" = no; then
2482
1996
build_libtool_libs=module
2641
2114
eval tmp_libs=\"\$$var\"
2643
2116
for deplib in $tmp_libs; do
2644
# FIXME: Pedantically, this is the right thing to do, so
2645
# that some nasty dependency loop isn't accidentally
2647
#new_libs="$deplib $new_libs"
2648
# Pragmatically, this seems to cause very few problems in
2650
2117
case $deplib in
2651
2118
-L*) new_libs="$deplib $new_libs" ;;
2654
# And here is the reason: when a library appears more
2655
# than once as an explicit dependence of a library, or
2656
# is implicitly linked in more than once by the
2657
# compiler, it is considered special, and multiple
2658
# occurrences thereof are not removed. Compare this
2659
# with having the same library being listed as a
2660
# dependency of multiple other libraries: in this case,
2661
# we know (pedantically, we assume) the library does not
2662
# need to be listed more than once, so we keep only the
2663
# last copy. This is not always right, but it is rare
2664
# enough that we require users that really mean to play
2665
# such unportable linking tricks to link the library
2666
# using -Wl,-lname, so that libtool does not consider it
2667
# for duplicate removal.
2668
2120
case " $specialdeplibs " in
2669
2121
*" $deplib "*) new_libs="$deplib $new_libs" ;;
3161
2545
int main() { return 0; }
3164
$LTCC -o conftest conftest.c $deplibs
3165
if test "$?" -eq 0 ; then
2548
$CC -o conftest conftest.c $deplibs
2549
if test $? -eq 0 ; then
3166
2550
ldd_output=`ldd conftest`
3167
2551
for i in $deplibs; do
3168
2552
name="`expr $i : '-l\(.*\)'`"
3169
2553
# If $name is empty we are operating on a -L argument.
3170
if test "$name" != "" && test "$name" -ne "0"; then
3171
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3172
case " $predeps $postdeps " in
3174
newdeplibs="$newdeplibs $i"
3179
if test -n "$i" ; then
2554
if test -n "$name" && test "$name" != "0"; then
2555
libname=`eval \\$echo \"$libname_spec\"`
2556
deplib_matches=`eval \\$echo \"$library_names_spec\"`
2557
set dummy $deplib_matches
2559
if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2560
newdeplibs="$newdeplibs $i"
2564
echo "*** Warning: dynamic linker does not accept needed library $i."
2565
echo "*** I have the capability to make that library automatically link in when"
2566
echo "*** you link to this library. But I can only do this if you have a"
2567
echo "*** shared version of the library, which I believe you do not have"
2568
echo "*** because a test_compile did reveal that the linker did not use it for"
2569
echo "*** its dynamic dependency list that programs get resolved with at runtime."
2572
newdeplibs="$newdeplibs $i"
2576
# Error occured in the first compile. Let's try to salvage
2577
# the situation: Compile a separate program for each library.
2578
for i in $deplibs; do
2579
name="`expr $i : '-l\(.*\)'`"
2580
# If $name is empty we are operating on a -L argument.
2581
if test -n "$name" && test "$name" != "0"; then
2583
$CC -o conftest conftest.c $i
2585
if test $? -eq 0 ; then
2586
ldd_output=`ldd conftest`
3180
2587
libname=`eval \\$echo \"$libname_spec\"`
3181
2588
deplib_matches=`eval \\$echo \"$library_names_spec\"`
3182
2589
set dummy $deplib_matches
3185
2592
newdeplibs="$newdeplibs $i"
3187
2594
droppeddeps=yes
3189
$echo "*** Warning: dynamic linker does not accept needed library $i."
3190
$echo "*** I have the capability to make that library automatically link in when"
3191
$echo "*** you link to this library. But I can only do this if you have a"
3192
$echo "*** shared version of the library, which I believe you do not have"
3193
$echo "*** because a test_compile did reveal that the linker did not use it for"
3194
$echo "*** its dynamic dependency list that programs get resolved with at runtime."
3198
newdeplibs="$newdeplibs $i"
3202
# Error occurred in the first compile. Let's try to salvage
3203
# the situation: Compile a separate program for each library.
3204
for i in $deplibs; do
3205
name="`expr $i : '-l\(.*\)'`"
3206
# If $name is empty we are operating on a -L argument.
3207
if test "$name" != "" && test "$name" != "0"; then
3209
$LTCC -o conftest conftest.c $i
3211
if test "$?" -eq 0 ; then
3212
ldd_output=`ldd conftest`
3213
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3214
case " $predeps $postdeps " in
3216
newdeplibs="$newdeplibs $i"
3221
if test -n "$i" ; then
3222
libname=`eval \\$echo \"$libname_spec\"`
3223
deplib_matches=`eval \\$echo \"$library_names_spec\"`
3224
set dummy $deplib_matches
3226
if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3227
newdeplibs="$newdeplibs $i"
3231
$echo "*** Warning: dynamic linker does not accept needed library $i."
3232
$echo "*** I have the capability to make that library automatically link in when"
3233
$echo "*** you link to this library. But I can only do this if you have a"
3234
$echo "*** shared version of the library, which you do not appear to have"
3235
$echo "*** because a test_compile did reveal that the linker did not use this one"
3236
$echo "*** as a dynamic dependency that programs can get resolved with at runtime."
2596
echo "*** Warning: dynamic linker does not accept needed library $i."
2597
echo "*** I have the capability to make that library automatically link in when"
2598
echo "*** you link to this library. But I can only do this if you have a"
2599
echo "*** shared version of the library, which you do not appear to have"
2600
echo "*** because a test_compile did reveal that the linker did not use this one"
2601
echo "*** as a dynamic dependency that programs can get resolved with at runtime."
3240
2604
droppeddeps=yes
3242
$echo "*** Warning! Library $i is needed by this library but I was not able to"
3243
$echo "*** make it link in! You will probably need to install it or some"
3244
$echo "*** library that it depends on before this library will be fully"
3245
$echo "*** functional. Installing it before continuing would be even better."
2606
echo "*** Warning! Library $i is needed by this library but I was not able to"
2607
echo "*** make it link in! You will probably need to install it or some"
2608
echo "*** library that it depends on before this library will be fully"
2609
echo "*** functional. Installing it before continuing would be even better."
3248
2612
newdeplibs="$newdeplibs $i"
3256
2620
for a_deplib in $deplibs; do
3257
2621
name="`expr $a_deplib : '-l\(.*\)'`"
3258
2622
# If $name is empty we are operating on a -L argument.
3259
if test "$name" != "" && test "$name" != "0"; then
3260
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3261
case " $predeps $postdeps " in
3263
newdeplibs="$newdeplibs $a_deplib"
3268
if test -n "$a_deplib" ; then
3269
libname=`eval \\$echo \"$libname_spec\"`
3270
for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3271
potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3272
for potent_lib in $potential_libs; do
2623
if test -n "$name" && test "$name" != "0"; then
2624
libname=`eval \\$echo \"$libname_spec\"`
2625
for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2626
potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2627
for potent_lib in $potential_libs; do
3273
2628
# Follow soft links.
3274
2629
if ls -lLd "$potent_lib" 2>/dev/null \
3275
2630
| grep " -> " >/dev/null; then
3291
2646
if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
3293
| $EGREP "$file_magic_regex" > /dev/null; then
2648
| egrep "$file_magic_regex" > /dev/null; then
3294
2649
newdeplibs="$newdeplibs $a_deplib"
3301
2655
if test -n "$a_deplib" ; then
3302
2656
droppeddeps=yes
3304
$echo "*** Warning: linker path does not have real file for library $a_deplib."
3305
$echo "*** I have the capability to make that library automatically link in when"
3306
$echo "*** you link to this library. But I can only do this if you have a"
3307
$echo "*** shared version of the library, which you do not appear to have"
3308
$echo "*** because I did check the linker path looking for a file starting"
2658
echo "*** Warning: linker path does not have real file for library $a_deplib."
2659
echo "*** I have the capability to make that library automatically link in when"
2660
echo "*** you link to this library. But I can only do this if you have a"
2661
echo "*** shared version of the library, which you do not appear to have"
2662
echo "*** because I did check the linker path looking for a file starting"
3309
2663
if test -z "$potlib" ; then
3310
$echo "*** with $libname but no candidates were found. (...for file magic test)"
2664
echo "*** with $libname but no candidates were found. (...for file magic test)"
3312
$echo "*** with $libname and none of the candidates passed a file format test"
3313
$echo "*** using a file magic. Last file checked: $potlib"
2666
echo "*** with $libname and none of the candidates passed a file format test"
2667
echo "*** using a file magic. Last file checked: $potlib"
3326
2680
name="`expr $a_deplib : '-l\(.*\)'`"
3327
2681
# If $name is empty we are operating on a -L argument.
3328
2682
if test -n "$name" && test "$name" != "0"; then
3329
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3330
case " $predeps $postdeps " in
3332
newdeplibs="$newdeplibs $a_deplib"
3337
if test -n "$a_deplib" ; then
3338
libname=`eval \\$echo \"$libname_spec\"`
3339
for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3340
potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3341
for potent_lib in $potential_libs; do
3342
potlib="$potent_lib" # see symlink-check above in file_magic test
3343
if eval $echo \"$potent_lib\" 2>/dev/null \
3345
| $EGREP "$match_pattern_regex" > /dev/null; then
3346
newdeplibs="$newdeplibs $a_deplib"
2683
libname=`eval \\$echo \"$libname_spec\"`
2684
for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2685
potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2686
for potent_lib in $potential_libs; do
2687
potlib="$potent_lib" # see symlink-check below in file_magic test
2688
if eval echo \"$potent_lib\" 2>/dev/null \
2690
| egrep "$match_pattern_regex" > /dev/null; then
2691
newdeplibs="$newdeplibs $a_deplib"
3353
2697
if test -n "$a_deplib" ; then
3354
2698
droppeddeps=yes
3356
$echo "*** Warning: linker path does not have real file for library $a_deplib."
3357
$echo "*** I have the capability to make that library automatically link in when"
3358
$echo "*** you link to this library. But I can only do this if you have a"
3359
$echo "*** shared version of the library, which you do not appear to have"
3360
$echo "*** because I did check the linker path looking for a file starting"
2700
echo "*** Warning: linker path does not have real file for library $a_deplib."
2701
echo "*** I have the capability to make that library automatically link in when"
2702
echo "*** you link to this library. But I can only do this if you have a"
2703
echo "*** shared version of the library, which you do not appear to have"
2704
echo "*** because I did check the linker path looking for a file starting"
3361
2705
if test -z "$potlib" ; then
3362
$echo "*** with $libname but no candidates were found. (...for regex pattern test)"
2706
echo "*** with $libname but no candidates were found. (...for regex pattern test)"
3364
$echo "*** with $libname and none of the candidates passed a file format test"
3365
$echo "*** using a regex pattern. Last file checked: $potlib"
2708
echo "*** with $libname and none of the candidates passed a file format test"
2709
echo "*** using a regex pattern. Last file checked: $potlib"
3374
2718
none | unknown | *)
3376
tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
3377
-e 's/ -[LR][^ ]*//g'`
3378
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3379
for i in $predeps $postdeps ; do
3380
# can't use Xsed below, because $i might contain '/'
3381
tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
3384
if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \
3385
| grep . >/dev/null; then
2720
if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
2721
-e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' |
2722
grep . >/dev/null; then
3387
2724
if test "X$deplibs_check_method" = "Xnone"; then
3388
$echo "*** Warning: inter-library dependencies are not supported in this platform."
2725
echo "*** Warning: inter-library dependencies are not supported in this platform."
3390
$echo "*** Warning: inter-library dependencies are not known to be supported."
2727
echo "*** Warning: inter-library dependencies are not known to be supported."
3392
$echo "*** All declared inter-library dependencies are being dropped."
2729
echo "*** All declared inter-library dependencies are being dropped."
3393
2730
droppeddeps=yes
3410
2747
if test "$droppeddeps" = yes; then
3411
2748
if test "$module" = yes; then
3413
$echo "*** Warning: libtool could not satisfy all declared inter-library"
3414
$echo "*** dependencies of module $libname. Therefore, libtool will create"
3415
$echo "*** a static module, that should work as long as the dlopening"
3416
$echo "*** application is linked with the -dlopen flag."
2750
echo "*** Warning: libtool could not satisfy all declared inter-library"
2751
echo "*** dependencies of module $libname. Therefore, libtool will create"
2752
echo "*** a static module, that should work as long as the dlopening"
2753
echo "*** application is linked with the -dlopen flag."
3417
2754
if test -z "$global_symbol_pipe"; then
3419
$echo "*** However, this would only work if libtool was able to extract symbol"
3420
$echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
3421
$echo "*** not find such a program. So, this module is probably useless."
3422
$echo "*** \`nm' from GNU binutils and a full rebuild may help."
2756
echo "*** However, this would only work if libtool was able to extract symbol"
2757
echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2758
echo "*** not find such a program. So, this module is probably useless."
2759
echo "*** \`nm' from GNU binutils and a full rebuild may help."
3424
2761
if test "$build_old_libs" = no; then
3425
2762
oldlibs="$output_objdir/$libname.$libext"
3429
2766
build_libtool_libs=no
3432
$echo "*** The inter-library dependencies that have been dropped here will be"
3433
$echo "*** automatically added whenever a program is linked with this library"
3434
$echo "*** or is declared to -dlopen it."
2769
echo "*** The inter-library dependencies that have been dropped here will be"
2770
echo "*** automatically added whenever a program is linked with this library"
2771
echo "*** or is declared to -dlopen it."
3436
if test "$allow_undefined" = no; then
3438
$echo "*** Since this library must not contain undefined symbols,"
3439
$echo "*** because either the platform does not support them or"
3440
$echo "*** it was explicitly requested with -no-undefined,"
3441
$echo "*** libtool will only create a static version of it."
2773
if test $allow_undefined = no; then
2775
echo "*** Since this library must not contain undefined symbols,"
2776
echo "*** because either the platform does not support them or"
2777
echo "*** it was explicitly requested with -no-undefined,"
2778
echo "*** libtool will only create a static version of it."
3442
2779
if test "$build_old_libs" = no; then
3443
2780
oldlibs="$output_objdir/$libname.$libext"
3444
2781
build_libtool_libs=module
3618
2945
$show "${rm}r $xdir"
3619
2946
$run ${rm}r "$xdir"
3620
$show "$mkdir $xdir"
3623
if test "$status" -ne 0 && test ! -d "$xdir"; then
2950
if test $status -ne 0 && test ! -d "$xdir"; then
3626
# We will extract separately just the conflicting names and we will no
3627
# longer touch any unique names. It is faster to leave these extract
3628
# automatically by $AR in one run.
3629
2953
$show "(cd $xdir && $AR x $xabs)"
3630
2954
$run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3631
if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
3634
$echo "$modename: warning: object name conflicts; renaming object files" 1>&2
3635
$echo "$modename: warning: to ensure that they will not overwrite" 1>&2
3636
$AR t "$xabs" | sort | uniq -cd | while read -r count name
3639
while test "$i" -le "$count"
3641
# Put our $i before any first dot (extension)
3642
# Never overwrite any file
3644
while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
3646
name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
3648
$show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
3649
$run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
3655
libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
2956
libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
3670
2971
# Do each of the archive commands.
3671
if test "$module" = yes && test -n "$module_cmds" ; then
3672
if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
3673
eval cmds=\"$module_expsym_cmds\"
3675
eval cmds=\"$module_cmds\"
3678
2972
if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3679
2973
eval cmds=\"$archive_expsym_cmds\"
2975
save_deplibs="$deplibs"
2976
for conv in $convenience; do
2978
for test_deplib in $deplibs; do
2979
if test "$test_deplib" != "$conv"; then
2980
tmp_deplibs="$tmp_deplibs $test_deplib"
2983
deplibs="$tmp_deplibs"
3681
2985
eval cmds=\"$archive_cmds\"
3685
if test "X$skipped_export" != "X:" && len=`expr "X$cmds" : ".*"` &&
3686
test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
3689
# The command line is too long to link in one step, link piecewise.
3690
$echo "creating reloadable object files..."
3692
# Save the value of $output and $libobjs because we want to
3693
# use them later. If we have whole_archive_flag_spec, we
3694
# want to use save_libobjs as it was before
3695
# whole_archive_flag_spec was expanded, because we can't
3696
# assume the linker understands whole_archive_flag_spec.
3697
# This may have to be revisited, in case too many
3698
# convenience libraries get linked in and end up exceeding
3700
if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
3701
save_libobjs=$libobjs
3705
# Clear the reloadable object creation command queue and
3706
# initialize k to one.
3713
output=$output_objdir/$save_output-${k}.$objext
3714
# Loop over the list of objects to be linked.
3715
for obj in $save_libobjs
3717
eval test_cmds=\"$reload_cmds $objlist $last_robj\"
3718
if test "X$objlist" = X ||
3719
{ len=`expr "X$test_cmds" : ".*"` &&
3720
test "$len" -le "$max_cmd_len"; }; then
3721
objlist="$objlist $obj"
3723
# The command $test_cmds is almost too long, add a
3724
# command to the queue.
3725
if test "$k" -eq 1 ; then
3726
# The first file doesn't have a previous command to add.
3727
eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
3729
# All subsequent reloadable object files will link in
3730
# the last one created.
3731
eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
3733
last_robj=$output_objdir/$save_output-${k}.$objext
3735
output=$output_objdir/$save_output-${k}.$objext
3740
# Handle the remaining objects by creating one last
3741
# reloadable object file. All subsequent reloadable object
3742
# files will link in the last one created.
3743
test -z "$concat_cmds" || concat_cmds=$concat_cmds~
3744
eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
3746
if ${skipped_export-false}; then
3747
$show "generating symbol list for \`$libname.la'"
3748
export_symbols="$output_objdir/$libname.exp"
3749
$run $rm $export_symbols
3751
# Append the command to create the export file.
3752
eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
3755
# Set up a command to remove the reloadale object files
3756
# after they are used.
3758
while test "$i" -lt "$k"
3761
delfiles="$delfiles $output_objdir/$save_output-${i}.$objext"
3764
$echo "creating a temporary reloadable object file: $output"
3766
# Loop through the commands generated above and execute them.
3767
save_ifs="$IFS"; IFS='~'
3768
for cmd in $concat_cmds; do
3771
$run eval "$cmd" || exit $?
3776
# Restore the value of output.
3779
if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
3780
eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3782
# Expand the library linking commands again to reset the
3783
# value of $libobjs for piecewise linking.
3785
# Do each of the archive commands.
3786
if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3787
eval cmds=\"$archive_expsym_cmds\"
3789
eval cmds=\"$archive_cmds\"
3792
# Append the command to remove the reloadable object files
3793
# to the just-reset $cmds.
3794
eval cmds=\"\$cmds~$rm $delfiles\"
2986
deplibs="$save_deplibs"
3796
2988
save_ifs="$IFS"; IFS='~'
3797
2989
for cmd in $cmds; do
3903
3095
$show "${rm}r $xdir"
3904
3096
$run ${rm}r "$xdir"
3905
$show "$mkdir $xdir"
3908
if test "$status" -ne 0 && test ! -d "$xdir"; then
3100
if test $status -ne 0 && test ! -d "$xdir"; then
3911
# We will extract separately just the conflicting names and we will no
3912
# longer touch any unique names. It is faster to leave these extract
3913
# automatically by $AR in one run.
3914
3103
$show "(cd $xdir && $AR x $xabs)"
3915
3104
$run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3916
if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
3919
$echo "$modename: warning: object name conflicts; renaming object files" 1>&2
3920
$echo "$modename: warning: to ensure that they will not overwrite" 1>&2
3921
$AR t "$xabs" | sort | uniq -cd | while read -r count name
3924
while test "$i" -le "$count"
3926
# Put our $i before any first dot (extension)
3927
# Never overwrite any file
3929
while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
3931
name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
3933
$show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
3934
$run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
3940
reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
3106
reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
4473
3650
# win32 will think the script is a binary if it has
4474
3651
# a .exe suffix, so we strip it off here.
4475
3652
case $output in
4476
*.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
3653
*.exe) output=`echo $output|${SED} 's,.exe$,,'` ;;
4478
3655
# test for cygwin because mv fails w/o .exe extensions
4482
outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
3657
*cygwin*) exeext=.exe ;;
4486
*cygwin* | *mingw* )
4487
cwrappersource=`$echo ${objdir}/lt-${output}.c`
4488
cwrapper=`$echo ${output}.exe`
4489
$rm $cwrappersource $cwrapper
4490
trap "$rm $cwrappersource $cwrapper; exit 1" 1 2 15
4492
cat > $cwrappersource <<EOF
4494
/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
4495
Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4497
The $output program cannot be directly executed until all the libtool
4498
libraries that it depends on are installed.
4500
This wrapper executable should never be moved out of the build directory.
4501
If it is, it will not operate correctly.
4503
Currently, it simply execs the wrapper *script* "/bin/sh $output",
4504
but could eventually absorb all of the scripts functionality and
4505
exec $objdir/$outputname directly.
4508
cat >> $cwrappersource<<"EOF"
4516
#if defined(PATH_MAX)
4517
# define LT_PATHMAX PATH_MAX
4518
#elif defined(MAXPATHLEN)
4519
# define LT_PATHMAX MAXPATHLEN
4521
# define LT_PATHMAX 1024
4524
#ifndef DIR_SEPARATOR
4525
#define DIR_SEPARATOR '/'
4528
#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4530
#define HAVE_DOS_BASED_FILE_SYSTEM
4531
#ifndef DIR_SEPARATOR_2
4532
#define DIR_SEPARATOR_2 '\\'
4536
#ifndef DIR_SEPARATOR_2
4537
# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
4538
#else /* DIR_SEPARATOR_2 */
4539
# define IS_DIR_SEPARATOR(ch) \
4540
(((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
4541
#endif /* DIR_SEPARATOR_2 */
4543
#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
4544
#define XFREE(stale) do { \
4545
if (stale) { free ((void *) stale); stale = 0; } \
4548
const char *program_name = NULL;
4550
void * xmalloc (size_t num);
4551
char * xstrdup (const char *string);
4552
char * basename (const char *name);
4553
char * fnqualify(const char *path);
4554
char * strendzap(char *str, const char *pat);
4555
void lt_fatal (const char *message, ...);
4558
main (int argc, char *argv[])
4563
program_name = (char *) xstrdup ((char *) basename (argv[0]));
4564
newargz = XMALLOC(char *, argc+2);
4567
cat >> $cwrappersource <<EOF
4568
newargz[0] = "$SHELL";
4571
cat >> $cwrappersource <<"EOF"
4572
newargz[1] = fnqualify(argv[0]);
4573
/* we know the script has the same name, without the .exe */
4574
/* so make sure newargz[1] doesn't end in .exe */
4575
strendzap(newargz[1],".exe");
4576
for (i = 1; i < argc; i++)
4577
newargz[i+1] = xstrdup(argv[i]);
4578
newargz[argc+1] = NULL;
4581
cat >> $cwrappersource <<EOF
4582
execv("$SHELL",newargz);
4585
cat >> $cwrappersource <<"EOF"
4589
xmalloc (size_t num)
4591
void * p = (void *) malloc (num);
4593
lt_fatal ("Memory exhausted");
4599
xstrdup (const char *string)
4601
return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
4606
basename (const char *name)
4610
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4611
/* Skip over the disk name in MSDOS pathnames. */
4612
if (isalpha (name[0]) && name[1] == ':')
4616
for (base = name; *name; name++)
4617
if (IS_DIR_SEPARATOR (*name))
4619
return (char *) base;
4623
fnqualify(const char *path)
4627
char tmp[LT_PATHMAX + 1];
4629
assert(path != NULL);
4631
/* Is it qualified already? */
4632
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4633
if (isalpha (path[0]) && path[1] == ':')
4634
return xstrdup (path);
4636
if (IS_DIR_SEPARATOR (path[0]))
4637
return xstrdup (path);
4639
/* prepend the current directory */
4640
/* doesn't handle '~' */
4641
if (getcwd (tmp, LT_PATHMAX) == NULL)
4642
lt_fatal ("getcwd failed");
4643
size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */
4644
p = XMALLOC(char, size);
4645
sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path);
4650
strendzap(char *str, const char *pat)
4654
assert(str != NULL);
4655
assert(pat != NULL);
4658
patlen = strlen(pat);
4662
str += len - patlen;
4663
if (strcmp(str, pat) == 0)
4670
lt_error_core (int exit_status, const char * mode,
4671
const char * message, va_list ap)
4673
fprintf (stderr, "%s: %s: ", program_name, mode);
4674
vfprintf (stderr, message, ap);
4675
fprintf (stderr, ".\n");
4677
if (exit_status >= 0)
4682
lt_fatal (const char *message, ...)
4685
va_start (ap, message);
4686
lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
4690
# we should really use a build-platform specific compiler
4691
# here, but OTOH, the wrappers (shell script and this C one)
4692
# are only useful if you want to execute the "real" binary.
4693
# Since the "real" binary is built for $host, then this
4694
# wrapper might as well be built for $host, too.
4695
$run $LTCC -s -o $cwrapper $cwrappersource
4699
3661
trap "$rm $output; exit 1" 1 2 15
4917
3891
$show "${rm}r $xdir"
4918
3892
$run ${rm}r "$xdir"
4919
$show "$mkdir $xdir"
4922
if test "$status" -ne 0 && test ! -d "$xdir"; then
3896
if test $status -ne 0 && test ! -d "$xdir"; then
4925
# We will extract separately just the conflicting names and we will no
4926
# longer touch any unique names. It is faster to leave these extract
4927
# automatically by $AR in one run.
4928
3899
$show "(cd $xdir && $AR x $xabs)"
4929
3900
$run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
4930
if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
4933
$echo "$modename: warning: object name conflicts; renaming object files" 1>&2
4934
$echo "$modename: warning: to ensure that they will not overwrite" 1>&2
4935
$AR t "$xabs" | sort | uniq -cd | while read -r count name
4938
while test "$i" -le "$count"
4940
# Put our $i before any first dot (extension)
4941
# Never overwrite any file
4943
while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
4945
name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
4947
$show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
4948
$run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
4954
3902
oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
4959
3907
if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
4960
3908
eval cmds=\"$old_archive_from_new_cmds\"
3910
# Ensure that we have .o objects in place in case we decided
3911
# not to build a shared library, and have fallen back to building
3912
# static libs even though --disable-static was passed!
3913
for oldobj in $oldobjs; do
3914
if test ! -f $oldobj; then
3915
xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
3916
if test "X$xdir" = "X$oldobj"; then
3921
baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
3922
obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
3923
$show "(cd $xdir && ${LN_S} $obj $baseobj)"
3924
$run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
4962
3928
eval cmds=\"$old_archive_cmds\"
4964
if len=`expr "X$cmds" : ".*"` &&
4965
test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
4968
# the command line is too long to link in one step, link in parts
4969
$echo "using piecewise archive linking..."
4974
save_oldobjs=$oldobjs
4975
# GNU ar 2.10+ was changed to match POSIX; thus no paths are
4976
# encoded into archives. This makes 'ar r' malfunction in
4977
# this piecewise linking case whenever conflicting object
4978
# names appear in distinct ar calls; check, warn and compensate.
4979
if (for obj in $save_oldobjs
4981
$echo "X$obj" | $Xsed -e 's%^.*/%%'
4982
done | sort | sort -uc >/dev/null 2>&1); then
4985
$echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2
4986
$echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2
4989
# Is there a better way of finding the last object in the list?
4990
for obj in $save_oldobjs
4994
for obj in $save_oldobjs
4996
oldobjs="$objlist $obj"
4997
objlist="$objlist $obj"
4998
eval test_cmds=\"$old_archive_cmds\"
4999
if len=`expr "X$test_cmds" : ".*"` &&
5000
test "$len" -le "$max_cmd_len"; then
5003
# the above command should be used before it gets too long
5005
if test "$obj" = "$last_oldobj" ; then
5008
test -z "$concat_cmds" || concat_cmds=$concat_cmds~
5009
eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
5015
if test "X$oldobjs" = "X" ; then
5016
eval cmds=\"\$concat_cmds\"
5018
eval cmds=\"\$concat_cmds~$old_archive_cmds\"
5022
3930
save_ifs="$IFS"; IFS='~'
5023
3931
for cmd in $cmds; do
5490
4392
destfile="$destdir/$destfile"
5493
# If the file is missing, and there is a .exe on the end, strip it
5494
# because it is most likely a libtool script we actually want to
5499
if test ! -f "$file"; then
5500
file=`$echo $file|${SED} 's,.exe$,,'`
5506
4395
# Do a test to see if this is really a libtool program.
5508
4397
*cygwin*|*mingw*)
5509
wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
4398
wrapper=`echo $file | ${SED} -e 's,.exe$,,'`
5515
if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
4404
if (${SED} -e '4q' $wrapper | egrep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
5516
4405
notinst_deplibs=
5517
4406
relink_command=
5519
# To insure that "foo" is sourced, and not "foo.exe",
5520
# finese the cygwin/MSYS system by explicitly sourcing "foo."
5521
# which disallows the automatic-append-.exe behavior.
5523
*cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
5524
*) wrapperdot=${wrapper} ;;
5526
4408
# If there is no directory component, then add one.
5528
*/* | *\\*) . ${wrapperdot} ;;
5529
*) . ./${wrapperdot} ;;
4410
*/* | *\\*) . $wrapper ;;
5532
4414
# Check the variables that should have been set.
5705
4580
# Exit here if they wanted silent mode.
5706
test "$show" = : && exit 0
4581
test "$show" = ":" && exit 0
5708
$echo "----------------------------------------------------------------------"
5709
$echo "Libraries have been installed in:"
4583
echo "----------------------------------------------------------------------"
4584
echo "Libraries have been installed in:"
5710
4585
for libdir in $libdirs; do
5714
$echo "If you ever happen to want to link against installed libraries"
5715
$echo "in a given directory, LIBDIR, you must either use libtool, and"
5716
$echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
5717
$echo "flag during linking and do at least one of the following:"
4589
echo "If you ever happen to want to link against installed libraries"
4590
echo "in a given directory, LIBDIR, you must either use libtool, and"
4591
echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
4592
echo "flag during linking and do at least one of the following:"
5718
4593
if test -n "$shlibpath_var"; then
5719
$echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
5720
$echo " during execution"
4594
echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
4595
echo " during execution"
5722
4597
if test -n "$runpath_var"; then
5723
$echo " - add LIBDIR to the \`$runpath_var' environment variable"
5724
$echo " during linking"
4598
echo " - add LIBDIR to the \`$runpath_var' environment variable"
4599
echo " during linking"
5726
4601
if test -n "$hardcode_libdir_flag_spec"; then
5728
4603
eval flag=\"$hardcode_libdir_flag_spec\"
5730
$echo " - use the \`$flag' linker flag"
4605
echo " - use the \`$flag' linker flag"
5732
4607
if test -n "$admincmds"; then
5733
$echo " - have your system administrator run these commands:$admincmds"
4608
echo " - have your system administrator run these commands:$admincmds"
5735
4610
if test -f /etc/ld.so.conf; then
5736
$echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
4611
echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
5739
$echo "See any operating system documentation about shared libraries for"
5740
$echo "more information, such as the ld(1) and ld.so(8) manual pages."
5741
$echo "----------------------------------------------------------------------"
4614
echo "See any operating system documentation about shared libraries for"
4615
echo "more information, such as the ld(1) and ld.so(8) manual pages."
4616
echo "----------------------------------------------------------------------"
5996
# Possibly a libtool object, so verify it.
5997
if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6002
# Add PIC object to the list of files to remove.
6003
if test -n "$pic_object" \
6004
&& test "$pic_object" != none; then
6005
rmfiles="$rmfiles $dir/$pic_object"
6008
# Add non-PIC object to the list of files to remove.
6009
if test -n "$non_pic_object" \
6010
&& test "$non_pic_object" != none; then
6011
rmfiles="$rmfiles $dir/$non_pic_object"
4870
if test "$build_old_libs" = yes; then
4871
oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
4872
rmfiles="$rmfiles $dir/$oldobj"
6017
if test "$mode" = clean ; then
6021
file=`$echo $file|${SED} 's,.exe$,,'`
6022
noexename=`$echo $name|${SED} 's,.exe$,,'`
6023
# $file with .exe has already been added to rmfiles,
6024
# add $file without .exe
6025
rmfiles="$rmfiles $file"
6028
# Do a test to see if this is a libtool program.
6029
if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4877
# Do a test to see if this is a libtool program.
4878
if test $mode = clean &&
4879
(${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6033
# note $name still contains .exe if it was in $file originally
6034
# as does the version of $file that was added into $rmfiles
6035
rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
6036
if test "$fast_install" = yes && test -n "$relink_command"; then
6037
rmfiles="$rmfiles $objdir/lt-$name"
6039
if test "X$noexename" != "X$name" ; then
6040
rmfiles="$rmfiles $objdir/lt-${noexename}.c"
4883
rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
4884
if test "$fast_install" = yes && test -n "$relink_command"; then
4885
rmfiles="$rmfiles $objdir/lt-$name"
6272
5111
$echo "Try \`$modename --help' for more information about other modes."
6276
# The TAGs below are defined such that we never get into a situation
6277
# in which we disable both kinds of libraries. Given conflicting
6278
# choices, we go for a static library, that is the most portable,
6279
# since we can't tell whether shared libraries were disabled because
6280
# the user asked for that or because the platform doesn't support
6281
# them. This is particularly important on AIX, because we don't
6282
# support having both static and shared libraries enabled at the same
6283
# time on that platform, so we default to a shared-only configuration.
6284
# If a disable-shared tag is given, we'll fallback to a static-only
6285
# configuration. But we'll never go from static-only to shared-only.
6287
# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
6288
build_libtool_libs=no
6290
# ### END LIBTOOL TAG CONFIG: disable-shared
6292
# ### BEGIN LIBTOOL TAG CONFIG: disable-static
6293
build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac`
6294
# ### END LIBTOOL TAG CONFIG: disable-static
6296
5115
# Local Variables:
6297
5116
# mode:shell-script
6298
5117
# sh-indentation:2