From f7548d6d28c313cf80e6f3ef89aed16a19815df1 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 28 Apr 2024 11:51:24 +0200 Subject: Adding upstream version 1:2.3.19.1+dfsg1. Signed-off-by: Daniel Baumann --- m4/gmtime_max.m4 | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 m4/gmtime_max.m4 (limited to 'm4/gmtime_max.m4') diff --git a/m4/gmtime_max.m4 b/m4/gmtime_max.m4 new file mode 100644 index 0000000..1613cb2 --- /dev/null +++ b/m4/gmtime_max.m4 @@ -0,0 +1,42 @@ +dnl * how large time_t values does gmtime() accept? +AC_DEFUN([DOVECOT_GMTIME_MAX], [ + AC_CACHE_CHECK([how large time_t values gmtime() accepts],i_cv_gmtime_max_time_t,[ + AC_RUN_IFELSE([AC_LANG_SOURCE([[ + #include + #include + int main() { + FILE *f; + int bits; + + for (bits = 1; bits < sizeof(time_t)*8; bits++) { + time_t t = ((time_t)1 << bits) - 1; + if (gmtime(&t) == NULL) { + bits--; + break; + } + } + if (bits > 40) { + /* Solaris 9 breaks after 55 bits. Perhaps other systems break earlier. + Let's just do the same as Cyrus folks and limit it to 40 bits. */ + bits = 40; + } + + f = fopen("conftest.temp", "w"); + if (f == NULL) { + perror("fopen()"); + return 1; + } + fprintf(f, "%d", bits); + fclose(f); + return 0; + } + ]])],[ + i_cv_gmtime_max_time_t=`cat conftest.temp` + rm -f conftest.temp + ], [ + printf "check failed, assuming " + i_cv_gmtime_max_time_t=31 + ],[]) + ]) + AC_DEFINE_UNQUOTED(TIME_T_MAX_BITS, $i_cv_gmtime_max_time_t, [max. time_t bits gmtime() can handle]) +]) -- cgit v1.2.3