mirror of
https://github.com/Orc/discount.git
synced 2026-09-25 04:10:00 +03:00
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:
+15
-9
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user