_FILE_OFFSET_BITS,_LARGE_FILES for direct largefile support
diff --git a/CHANGES b/CHANGES
index b6fb701..8034a75 100644
--- a/CHANGES
+++ b/CHANGES
@@ -294,6 +294,10 @@
Thanks to Paul Hunt for sending a fix of the configure
--enable-openssl-base processing.
+ Enable direct largefile support on "smaller" systems per
+ _FILE_OFFSET_BITS and _LARGE_FILES.
+ Thanks to Fergus Dall for sending a patch.
+
Testing:
Removed obselete parts from test.sh
diff --git a/config.h.in b/config.h.in
index bf1a72d..fed2f05 100644
--- a/config.h.in
+++ b/config.h.in
@@ -613,6 +613,12 @@
/* is uint64_t already defined? */
#undef HAVE_TYPE_UINT64
+/* Number of bits in a file offset, on hosts where this is settable. */
+#undef _FILE_OFFSET_BITS
+
+/* Define for large files, on AIX-style hosts. */
+#undef _LARGE_FILES
+
/* Define if snprintf() returns required len on truncation (C-99 conform) */
#undef HAVE_C99_SNPRINTF
diff --git a/configure.ac b/configure.ac
index aa3c84d..009fd9c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -30,6 +30,8 @@
export CFLAGS=-O
fi
+AC_SYS_LARGEFILE
+
dnl Checks for programs.
AC_PROG_INSTALL(install)
AC_PROG_CC
diff --git a/procan-cdefs.c b/procan-cdefs.c
index e0cade7..d9587f8 100644
--- a/procan-cdefs.c
+++ b/procan-cdefs.c
@@ -41,6 +41,14 @@
fprintf(outfile, "#define SHUT_RDWR %u\n", SHUT_RDWR);
#endif
+ /* Compile time controls */
+#ifdef _FILE_OFFSET_BITS
+ fprintf(outfile, "#define _FILE_OFFSET_BITS %u\n", _FILE_OFFSET_BITS);
+#endif
+#ifdef _LARGE_FILES
+ fprintf(outfile, "#define _LARGE_FILES %u\n", _LARGE_FILES);
+#endif
+
/* termios constants */
#ifdef CRDLY
fprintf(outfile, "#define CRDLY 0%011o\n", CRDLY);