+DEFS="$c_switch_system $c_switch_machine $DEFS"
+LIBS="$libsrc_libs"
+
+dnl If found, this defines HAVE_LIBDNET, which m/pmax.h checks,
+dnl and also adds -ldnet to LIBS, which Autoconf uses for checks.
+AC_HAVE_LIBRARY(-ldnet)
+dnl This causes -lresolv to get used in subsequent tests,
+dnl which causes failures on some systems such as HPUX 9.
+dnl AC_HAVE_LIBRARY(-lresolv)
+
+AC_HAVE_LIBRARY(-lXbsd, LD_SWITCH_X_SITE="$LD_SWITCH_X_SITE -lXbsd")
+
+echo checking for XFree86
+if test -d /usr/X386/include; then
+ HAVE_XFREE386=yes
+ test -z "${C_SWITCH_X_SITE}" && C_SWITCH_X_SITE="-I/usr/X386/include"
+fi
+
+# We change CFLAGS temporarily so that C_SWITCH_X_SITE gets used
+# for the tests that follow.
+
+if test "${HAVE_X11}" = "yes"; then
+ DEFS="$C_SWITCH_X_SITE $DEFS"
+ LIBS="$LD_SWITCH_X_SITE $LIBX $LIBS"
+ CFLAGS="$C_SWITCH_X_SITE $CFLAGS"
+ AC_HAVE_FUNCS(XrmSetDatabase XScreenResourceString \
+XScreenNumberOfScreen XSetWMProtocols)
+fi
+
+if test "${USE_X_TOOLKIT}" != "none"; then
+ AC_COMPILE_CHECK(X11 toolkit version,
+ [#include <X11/Intrinsic.h>],
+ [
+#if XtSpecificationRelease < 6
+fail;
+#endif
+],
+ AC_DEFINE(HAVE_X11XTR6))
+fi
+
+# If netdb.h doesn't declare h_errno, we must declare it by hand.
+AC_COMPILE_CHECK(declaration of h_errno in netdb.h,
+ [#include <netdb.h>],
+ [
+int
+foo ()
+{
+ return h_errno;
+}
+],
+ AC_DEFINE(HAVE_H_ERRNO))
+
+AC_ALLOCA
+
+# logb and frexp are found in -lm on most systems.
+AC_HAVE_LIBRARY(-lm)
+AC_HAVE_FUNCS(gettimeofday gethostname dup2 rename closedir mkdir rmdir \
+random lrand48 bcopy bcmp logb frexp fmod drem ftime res_init setsid \
+strerror fpathconf select mktime eaccess getpagesize)
+
+ok_so_far=true
+AC_FUNC_CHECK(socket, , ok_so_far=)
+if test -n "$ok_so_far"; then
+ AC_HEADER_CHECK(netinet/in.h, , ok_so_far=)
+fi
+if test -n "$ok_so_far"; then
+ AC_HEADER_CHECK(arpa/inet.h, , ok_so_far=)
+fi
+if test -n "$ok_so_far"; then
+ AC_DEFINE(HAVE_INET_SOCKETS)