+AC_CHECK_HEADERS([ctype.h dirent.h errno.h fcntl.h limits.h signal.h sys/resource.h sys/select.h sys/syscall.h sys/time.h sys/timeb.h sys/timers.h sys/times.h sys/utsname.h sys/wait.h termios.h time.h utime.h windows.h winsock.h])
+
+# Enable large file support. Do this before testing the types ino_t, off_t, and
+# rlim_t, because it will affect the result of that test.
+AC_SYS_LARGEFILE
+
+dnl ** check for wide-char classifications
+dnl FreeBSD has an emtpy wctype.h, so test one of the affected
+dnl functions if it's really there.
+AC_CHECK_HEADERS([wctype.h], [AC_CHECK_FUNCS(iswspace)])
+
+AC_CHECK_FUNCS([ftime gmtime_r localtime_r lstat readdir_r])
+AC_CHECK_FUNCS([getclock getrusage gettimeofday setitimer times])
+AC_CHECK_FUNCS([_chsize ftruncate])
+
+dnl ** check if it is safe to include both <time.h> and <sys/time.h>
+AC_HEADER_TIME