--- /dev/null
+?RCS: $Id: Hasproto.U $
+?RCS:
+?RCS: Copyright (c) 1998 Andy Dougherty
+?RCS:
+?RCS: You may distribute under the terms of either the GNU General Public
+?RCS: License or the Artistic License, as specified in the README file.
+?RCS:
+?X: This unit generates a $hasproto string that is used internally
+?X: by Configure to check if this system has a prototype for a
+?X: particular function
+?X:
+?X: To use it, say something like:
+?X: set d_getnetent_proto getnetent $i_netdb netdb.h
+?X: eval $hasproto
+?X: Or, for more complicated sets of headers, do something like
+?X: hdrs="$define sys/types.h
+?X: $i_systime sys/time.h
+?X: $i_sysselct sys/select.h
+?X: $i_netdb netdb.h"
+?X: set d_getnetent_proto getnetent $hdrs
+?X: eval $hasproto
+?X:
+?MAKE:Hasproto: Setvar cppstdin cppflags cppminus contains rm_try test
+?MAKE: -pick add $@ %<
+?T:func varname
+?F:!try.c
+?V:hasproto
+: Define hasproto macro for Configure internal use
+hasproto='varname=$1; func=$2; shift; shift;
+while $test $# -ge 2; do
+ case "$1" in
+ $define) echo "#include <$2>";;
+ literal) echo "$2" ;;
+ esac ;
+ shift 2;
+done > try.c;
+$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
+if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
+ echo "$func() prototype found.";
+ val="$define";
+else
+ echo "$func() prototype NOT found.";
+ val="$undef";
+fi;
+set $varname;
+eval $setvar;
+$rm_try tryout.c'
+