--- ./net/xrootd/src/xrootd/configure.classic.orig 2008-06-25 07:24:15.000000000 +0100 +++ ./net/xrootd/src/xrootd/configure.classic 2008-07-04 20:06:20.537658375 +0100 @@ -342,7 +342,8 @@ # Assert that we got enough arguments if test $# -ne 3 ; then - echo "check_symbol: Not 3 arguments" + echo "check_symbol: not 3 arguments" + found_symbol=0 return 1 fi @@ -351,34 +352,105 @@ symbollib=$1 ; shift symboldir=$1 + if test "x$symbollib" = "x" ; then + found_symbol=0 + return 1 + fi + + symbollib=`echo $symbollib | sed -e 's/^-l/lib/'` + + if test ! "x$symboldir" = "x" ; then + symboldir=`echo $symboldir | sed -e 's/^-L//'` + fi + # Check if we got a specific argument as to where the library # is to be found symbolfile=$symbollib - if test ! "x$symboldir" = "x" ; then - symbolfile=$symboldir/$symbollib - if test ! -r $symbolfile ; then - for i in .a .so .lib ; do - if test -r $symbolfile$i ; then - symbolfile=$symbolfile$i - break + exts=".so .lib" + if test ! "x$shared" = "xno" ; then + exts="$exts .a" + else + exts=".a $exts" + fi + + usrlib="/usr/lib" + # look first in the lib32 directories + if test "x$checklib32" = "xyes" ; then + usrlib="/usr/lib32 $usrlib" + fi + # look first in the lib64 directories + if test "x$checklib64" = "xyes" ; then + usrlib="/usr/lib64 $usrlib" + fi + # look only in the lib64 directories + if test "x$checkonlylib64" = "xyes" ; then + usrlib="/usr/lib64" + fi + # look only in the hpux64 directories + if test "x$checkhpux64" = "xyes" ; then + usrlib="/usr/lib/hpux64" + fi + + for d in "$symboldir" $usrlib ; do + echo " Checking in $d" + if test ! -r $d/$symbollib ; then + echo " $d/$symbollib not readable" + for i in $exts ; do + echo " Checking extension $i with $d/$symbollib" + if test -r $d/$symbollib$i ; then + echo " $d/$symbollib$i readable" + symbolfile=$d/$symbollib$i + break 2 fi done + else + echo "$d/$symbollib readable" + symbolfile=$d/$symbollib + break fi - fi + done if test "x$symbolfile" = "x" || test ! -r $symbolfile ; then found_symbol=0 + echo " Symbol not found" return 1 fi - symbol_in_lib=`nm $symbolfile | grep $symbol > /dev/null 2>&1` + checking_msg "$symbol in $symbolfile" + nm $symbolfile 2>&1 | grep $symbol > /dev/null 2>&1 if test $? -eq 0 ; then found_symbol=1 + echo " Symbol found" else - found_symbol=0 + nm $symbolfile 2>&1 | grep "no symbols" > /dev/null 2>&1 + if test $? -eq 0 ; then + echo " $symbolfile is stripped, trying a link" + # stripped library - only safe test is to link against the + # library! However, we do not know what compiler to use + # so we can not do the test. Assume the symbol is in + cat < conftest.mk +conftest:conftest.c $symbolfile + \$(CC) \$(CFLAGS) \$(LDFLAGS) $symbolfile \$< -o \$@ + +conftest.c: + echo "extern int $symbol (); " > \$@ + echo "int main() { $symbol (); return 0; }" >> \$@ +EOF + make -f conftest.mk >> config.log 2>&1 + if test $? -eq 0 ; then + found_symbol=1 + echo " Link OK" + else + found_symbol=0 + echo " Failed code was" + cat conftest.mk >> config.log + fi + rm -rf conftest.c conftest.mk conftest + else + found_symbol=0 + fi fi } - #_____________________________________________________________________ guess_architecture () { # Try to guess the architecture of the host system