:
#
# Copyright 1993 Brent Townshend (bst@tc.com)
# Townshend Computer Tools
# Montreal, Quebec
#
# Check if a variable is defined in any system library
# Usage: checkvar variable [extra libraries]
# Returns non-zero exit status if not defined
# CC, CCFLAGS, and EXTRALIBS must be defined before calling.
# Appends to 'SysConfig.errs' and 'syscap.new'
echo $0 $*  >>SysConfig.errs
tmp=checkvar$$
variable=$1
shift
echo "extern int $variable;"  > ${tmp}.c
echo 'main() { printf("a=%d",'$variable'); }' >>${tmp}.c
if $CC $CCFLAGS ${tmp}.c $* $EXTRALIBS >>SysConfig.errs 2>&1
then
    # It does exist
    rm -f ${tmp}.* a.out
    echo "#define HAS_$variable" >>syscap.new
    echo $n "$variable+...$c"
    exit 0
else
    rm -f ${tmp}.* a.out
    echo "#define MISSING_$variable" >>syscap.new
    echo $n "$variable-...$c"
    exit 1 
fi
