Check also for log and pow functions in configure

This commit is contained in:
Miroslav Lichvar 2009-12-12 20:15:51 +01:00
parent 7817bef866
commit feb86e336a

62
configure vendored
View file

@ -32,43 +32,6 @@ fi
# ====================================================================== # ======================================================================
# FUNCTIONS # FUNCTIONS
#{{{ test_for_sqrt
test_for_sqrt () {
# 0 : doesn't need -lm
# 1 : needs -lm
# 2 : doesn't even link with -lm
cat >docheck.c <<EOF;
#include <math.h>
int main(int argc, char **argv) {
return (int) sqrt((double)argc);
}
EOF
${MYCC} ${MYCFLAGS} ${MYCPPFLAGS} -c -o docheck.o docheck.c >/dev/null 2>&1
if [ $? -eq 0 ]
then
${MYCC} ${MYCFLAGS} ${MYCPPFLAGS} -o docheck docheck.o >/dev/null 2>&1
if [ $? -eq 0 ]
then
result=0
else
${MYCC} ${MYCFLAGS} ${MYCPPFLAGS} -o docheck docheck.o -lm >/dev/null 2>&1
if [ $? -eq 0 ]
then
result=1
else
result=2
fi
fi
else
result=2
fi
rm -f docheck.c docheck.o docheck
echo $result
}
#}}}
#{{{ test_code #{{{ test_code
test_code () { test_code () {
name=$1 name=$1
@ -354,22 +317,17 @@ case $SYSTEM in
;; ;;
esac esac
printf "Checking if sqrt() needs -lm : " MATHCODE='return (int) pow(2.0, log(sqrt((double)argc)));'
case `test_for_sqrt` if test_code 'math' 'math.h' '' '' "$MATHCODE"; then
in
0)
printf "No\n"
LIBS="" LIBS=""
;; else
1) if test_code 'math in -lm' 'math.h' '' '-lm' "$MATHCODE"; then
printf "Yes\n" LIBS="-lm"
LIBS="-lm" else
;; printf "Can't compile/link a program which uses sqrt(), log(), pow(), bailing out\n"
*) exit 1
printf "\nCan't compile/link a program which uses sqrt(), bailing out\n" fi
exit 1 fi
;;
esac
if test_code '<stdint.h>' 'stdint.h' '' '' ''; then if test_code '<stdint.h>' 'stdint.h' '' '' ''; then
SYSDEFS="${SYSDEFS} -DHAS_STDINT_H" SYSDEFS="${SYSDEFS} -DHAS_STDINT_H"