Add a check for bzero() or memset(). This requires some stupid thrashing

to deal with the stupid FSF compiler, which has ArCaNe KnOwLeDgE about bzero
and memset and will fall over and die if you don't provide arguments for
the functions even if you don't #include <string.h> (or whatever include
file has the prototype)
This commit is contained in:
David Parsons
2009-11-28 21:58:23 -08:00
parent 8c5936dde6
commit 3fb96fd388
2 changed files with 23 additions and 9 deletions
+15 -9
View File
@@ -183,27 +183,33 @@ AC_CHECK_HEADERS () {
AC_CHECK_FUNCS () {
AC_PROG_CC
F=$1
shift
rm -f /tmp/ngc$$.c
B=`echo "$1" | sed -e 's/(.*)//'`
case "$B" in
"$1") F="$1()" ;;
*) F="$1" ;;
esac
while [ "$1" ]; do
echo "#include <$1>" >> /tmp/ngc$$.c
shift
done
rm -f /tmp/ngc$$.c
while [ "$1" ]; do
echo "#include <$1>" >> /tmp/ngc$$.c
shift
done
cat >> /tmp/ngc$$.c << EOF
main()
{
$F();
$F;
}
EOF
LOGN "looking for the $F function"
LOGN "looking for the $B function"
if $AC_CC -o /tmp/ngc$$ /tmp/ngc$$.c $LIBS; then
AC_DEFINE `echo ${2:-HAVE_$F} | $AC_UPPERCASE` 1
AC_DEFINE `echo ${2:-HAVE_$B} | $AC_UPPERCASE` 1
TLOG " (found)"
rc=0
else
+8
View File
@@ -76,6 +76,14 @@ else
AC_DEFINE 'INITRNG(x)' '(void)1'
fi
if AC_CHECK_FUNCS 'bzero((char*)0,0)'; then
: # Yay
elif AC_CHECK_FUNCS 'memset((char*)0,0,0)'; then
AC_DEFINE 'bzero(p,s)' 'memset(p,s,0)'
else
AC_FAIL "$TARGET requires bzero or memset"
fi
if AC_CHECK_FUNCS random; then
AC_DEFINE 'COINTOSS()' '(random()&1)'
elif AC_CHECK_FUNCS rand; then