From ec5164ced227fc3e634dea614e7b999bb8266138 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Tue, 19 Apr 2022 13:28:39 -0600 Subject: [PATCH] Define _TIME_BITS=64 on systems that define __TIMESIZE, like GNU libc. This should be replaced by a specialized autoconf macro when one becomes available. --- config.h.in | 3 +++ configure | 20 +++++++++++++++++++- configure.ac | 13 ++++++++++++- 3 files changed, 34 insertions(+), 2 deletions(-) diff --git a/config.h.in b/config.h.in index da1cf40ba..ac94b4983 100644 --- a/config.h.in +++ b/config.h.in @@ -1386,6 +1386,9 @@ /* Define for large files, on AIX-style hosts. */ #undef _LARGE_FILES +/* Number of bits in a time_t, on hosts where this is settable. */ +#undef _TIME_BITS + /* Define to __FUNCTION__ if your compiler supports __FUNCTION__ but not __func__ */ #undef __func__ diff --git a/configure b/configure index 8fa97d167..c3e5deea6 100755 --- a/configure +++ b/configure @@ -19341,7 +19341,9 @@ fi done # -# Check for large file support. +# Check for large file and 64-bit time support. +# GNU libc only allows setting _TIME_BITS when FILE_OFFSET_BITS is also set. +# GNU libc defines __TIMESIZE on systems where _TIME_BITS can be set. # # Check whether --enable-largefile was given. if test ${enable_largefile+y} @@ -19547,6 +19549,22 @@ rm -rf conftest* fi fi +if test X"$ac_cv_sys_file_offset_bits" = X"yes"; then + ac_fn_check_decl "$LINENO" "__TIMESIZE" "ac_cv_have_decl___TIMESIZE" " +$ac_includes_default +#include + +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl___TIMESIZE" = xyes +then : + + +printf "%s\n" "#define _TIME_BITS 64" >>confdefs.h + + +fi +fi + # # HP-UX may need to define _XOPEN_SOURCE_EXTENDED to expose MSG_WAITALL. # Also, HP-UX 11.23 has a broken sys/types.h when large files support diff --git a/configure.ac b/configure.ac index 268cdb033..fabcd0853 100644 --- a/configure.ac +++ b/configure.ac @@ -2447,9 +2447,20 @@ AC_CHECK_HEADERS([procfs.h] [sys/procfs.h], [AC_CHECK_MEMBERS(struct psinfo.pr_t ])] break) # -# Check for large file support. +# Check for large file and 64-bit time support. +# GNU libc only allows setting _TIME_BITS when FILE_OFFSET_BITS is also set. +# GNU libc defines __TIMESIZE on systems where _TIME_BITS can be set. # AC_SYS_LARGEFILE +if test X"$ac_cv_sys_file_offset_bits" = X"yes"; then + AC_CHECK_DECL(__TIMESIZE, [ + AC_DEFINE([_TIME_BITS], [64], [Number of bits in a time_t, on hosts where this is settable.]) + ], [], [ +AC_INCLUDES_DEFAULT +#include + ]) +fi + # # HP-UX may need to define _XOPEN_SOURCE_EXTENDED to expose MSG_WAITALL. # Also, HP-UX 11.23 has a broken sys/types.h when large files support