+AC_CHECK_FUNCS(sbrk utimes setmode getc_unlocked)
+
+# Check whether fopen64 is available and whether _LARGEFILE64_SOURCE
+# needs to be defined for it
+AC_MSG_CHECKING([for fopen64])
+AC_CACHE_VAL(bu_cv_have_fopen64,
+[AC_TRY_LINK([#include <stdio.h>], [FILE *f = fopen64 ("/tmp/foo","r");],
+bu_cv_have_fopen64=yes,
+[saved_CPPFLAGS=$CPPFLAGS
+ CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE"
+ AC_TRY_LINK([#include <stdio.h>], [FILE *f = fopen64 ("/tmp/foo","r");],
+bu_cv_have_fopen64="need -D_LARGEFILE64_SOURCE",
+bu_cv_have_fopen64=no)
+ CPPFLAGS=$saved_CPPFLAGS])])
+AC_MSG_RESULT($bu_cv_have_fopen64)
+if test $bu_cv_have_fopen64 != no; then
+ AC_DEFINE([HAVE_FOPEN64], 1,
+ [Is fopen64 available?])
+ if test $bu_cv_have_fopen64 = "need -D_LARGEFILE64_SOURCE"; then
+ AC_DEFINE([_LARGEFILE64_SOURCE], 1,
+ [Enable LFS])
+ fi
+fi