+#### Add the libraries to LIBS and check for some functions.
+
+]
+DEFS="$c_switch_system $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)
+
+AC_HAVE_LIBRARY(-lXbsd, LD_SWITCH_X_SITE="$LD_SWITCH_X_SITE -lXbsd"
+ 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)
+
+if test "${HAVE_X11}" = "yes"; then
+ DEFS="$C_SWITCH_X_SITE $DEFS"
+ LIBS="$LD_SWITCH_X_SITE $LIBX $LIBS"
+ AC_HAVE_FUNCS(XrmSetDatabase XScreenResourceString random bcopy)
+fi
+
+AC_ALLOCA
+AC_HAVE_FUNCS(gettimeofday gethostname dup2 rename closedir)
+
+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)
+fi
+[