Adjusted from
https://github.com/autotools-mirror/autoconf/commit/b71143738516017f0e0d347a4025301c06c40254.patch

--- a/lib/autoconf/specific.m4
+++ b/lib/autoconf/specific.m4
@@ -279,25 +279,25 @@
 # If you change this macro you may also need to change
 # _AC_SYS_LARGEFILE_OPTIONS.
 AC_DEFUN([_AC_SYS_LARGEFILE_PROBE],
-[AC_CACHE_CHECK([for $CC option to enable large file support],
+[AC_CACHE_CHECK([for $CPPFLAGS option to enable large file support],
   [ac_cv_sys_largefile_opts],
-  [ac_save_CC="$CC"
+  [ac_save_CPPFLAGS=$CPPFLAGS
   ac_opt_found=no
   for ac_opt in _AC_SYS_LARGEFILE_OPTIONS; do
     AS_IF([test x"$ac_opt" != x"none needed"],
-      [CC="$ac_save_CC $ac_opt"])
+      [CPPFLAGS="$ac_save_CPPFLAGS $ac_opt"])
     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([_AC_SYS_LARGEFILE_TEST_CODE])],
      [AS_IF([test x"$ac_opt" = x"none needed"],
 	[# GNU/Linux s390x and alpha need _FILE_OFFSET_BITS=64 for wide ino_t.
-	 CC="$CC -DFTYPE=ino_t"
+	 CPPFLAGS="$CPPFLAGS -DFTYPE=ino_t"
 	 AC_COMPILE_IFELSE([], [],
-	   [CC="$CC -D_FILE_OFFSET_BITS=64"
+	   [CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=64"
 	    AC_COMPILE_IFELSE([], [ac_opt='-D_FILE_OFFSET_BITS=64'])])])
       ac_cv_sys_largefile_opts=$ac_opt
       ac_opt_found=yes])
     test $ac_opt_found = no || break
   done
-  CC="$ac_save_CC"
+  CPPFLAGS=$ac_save_CPPFLAGS
   dnl Gnulib implements large file support for native Windows, based on the
   dnl variables WINDOWS_64_BIT_OFF_T, WINDOWS_64_BIT_ST_SIZE.
   m4_ifdef([gl_LARGEFILE], [
