Upstream-Status: Submitted [https://salsa.debian.org/etbe/bonnie/-/merge_requests/3/diffs?commit_id=4ffece51791ba75ddca2e664cdce726cc40c92d3]

diff --git i/configure.in w/configure.in
index 080e40c..f2a2bbe 100644
--- i/configure.in
+++ w/configure.in
@@ -82,8 +82,15 @@ void * thread_func(void * param) { return NULL; }
   , thread_ldflags="-lpthread"
   , thread_ldflags="-pthread")
 
-AC_SUBST(large_file)
-AC_TRY_RUN([#ifndef _LARGEFILE64_SOURCE
+AC_ARG_ENABLE(lfs,
+      [  --disable-lfs  disable large file support],
+      LFS_CHOICE=$enableval, LFS_CHOICE=check)
+
+if test "$LFS_CHOICE" = yes; then
+   bonniepp_cv_large_file=yes
+elif test "$LFS_CHOICE" = check; then
+   AC_CACHE_CHECK([whether to enable -D_LARGEFILE64_SOURCE], bonniepp_cv_large_file,
+      AC_TRY_RUN([#ifndef _LARGEFILE64_SOURCE
 #define _LARGEFILE64_SOURCE
 #endif
 #include <stdio.h>
@@ -118,8 +125,12 @@ int main () {
   }
   close(fd);
   return 0;
-}], large_file="yes")
-if [[ -n "$large_file" ]]; then
+}], bonniepp_cv_large_file="yes"))
+fi
+
+AC_SUBST(large_file)
+
+if [[ -n "$bonniepp_cv_large_file" ]]; then
    large_file="#define _LARGEFILE64_SOURCE"
 fi
 
