+# Reasons for testing:
+# crt_externs.h - Darwin specific
+#
+AC_CHECK_HEADERS([assert.h crt_externs.h])
+
+# Reasons for testing:
+# DINFINITY - OSF specific
+# DQNAN - OSF specific
+# (DINFINITY and DQNAN are actually global variables, not functions)
+# chsize - an MS-DOS-ism, found in mingw
+# cexp, clog - not in various pre-c99 systems, and note that it's possible
+# for gcc to provide the "complex double" type but the system to not
+# have functions like cexp and clog
+# clog10 - not in mingw (though others like clog and csqrt are)
+# fesetround - available in C99, but not older systems
+# ftruncate - posix, but probably not older systems (current mingw
+# has it as an inline for chsize)
+# ioctl - not in mingw.
+# gmtime_r - recent posix, not on old systems
+# pipe - not in mingw
+# _pipe - specific to mingw, taking 3 args
+# readdir_r - recent posix, not on old systems
+# readdir64_r - not available on HP-UX 11.11
+# stat64 - SuS largefile stuff, not on old systems
+# sysconf - not on old systems
+# truncate - not in mingw
+# isblank - available as a GNU extension or in C99
+# _NSGetEnviron - Darwin specific
+# strcoll_l, newlocale - GNU extensions (glibc), also available on Darwin
+# nl_langinfo - X/Open, not available on Windows.
+#
+AC_CHECK_FUNCS([DINFINITY DQNAN cexp chsize clog clog10 ctermid fesetround ftime ftruncate fchown getcwd geteuid gettimeofday gmtime_r ioctl lstat mkdir mknod nice pipe _pipe readdir_r readdir64_r readlink rename rmdir select setegid seteuid setlocale setpgid setsid sigaction siginterrupt stat64 strftime strptime symlink sync sysconf tcgetpgrp tcsetpgrp times uname waitpid strdup system usleep atexit on_exit chown link fcntl ttyname getpwent getgrent kill getppid getpgrp fork setitimer getitimer strchr strcmp index bcopy memcpy rindex truncate unsetenv isblank _NSGetEnviron strcoll strcoll_l newlocale nl_langinfo])
+
+# Reasons for testing:
+# netdb.h - not in mingw
+# sys/param.h - not in mingw
+# pthread.h - only available with pthreads. ACX_PTHREAD doesn't
+# check this specifically, we need it for the timespec test below.
+# sethostname - the function itself check because it's not in mingw,
+# the DECL is checked because Solaris 10 doens't have in any header
+# xlocale.h - needed on Darwin for the `locale_t' API
+#
+AC_CHECK_HEADERS(crypt.h netdb.h pthread.h sys/param.h sys/resource.h sys/file.h xlocale.h)
+AC_CHECK_FUNCS(chroot flock getlogin cuserid getpriority setpriority getpass sethostname gethostname)
+AC_CHECK_DECLS([sethostname])