#! /bin/sh
have_getpeereid=0
have_getpeerucred=0
stdlib=`ocamlc -where`
######################################################################
printf "Checking for getpeereid... "
getpeereid_compile=0
rm -f configtests/getpeereid.err
if (cd configtests; ocamlc -o getpeereid getpeereid.c main.ml -custom ) \
>>configtests/getpeereid.err 2>&1
then
getpeereid_compile=1
fi
if [ $getpeereid_compile -gt 0 ]; then
if configtests/getpeereid >>configtests/getpeereid.err 2>&1; then
have_getpeereid=1
fi
fi
if [ $have_getpeereid -gt 0 ]; then
echo "found"
def_have_getpeereid="#define HAVE_GETPEEREID"
else
echo "not found"
def_have_getpeereid="#undef HAVE_GETPEEREID"
fi
######################################################################
printf "Checking for getpeerucred... "
getpeerucred_compile=0
rm -f configtests/getpeerucred.err
if (cd configtests; ocamlc -o getpeerucred getpeerucred.c main.ml -custom ) \
>>configtests/getpeerucred.err 2>&1
then
getpeerucred_compile=1
fi
if [ $getpeerucred_compile -gt 0 ]; then
if configtests/getpeerucred >>configtests/getpeerucred.err 2>&1; then
have_getpeerucred=1
fi
fi
if [ $have_getpeerucred -gt 0 ]; then
echo "found"
def_have_getpeerucred="#define HAVE_GETPEERUCRED"
else
echo "not found"
def_have_getpeerucred="#undef HAVE_GETPEERUCRED"
fi
######################################################################
cat <<EOF >config.h
$def_have_getpeereid
$def_have_getpeerucred
EOF
exit 0