AC_INIT(src)
AM_CONFIG_HEADER(config.h)
-AM_INIT_AUTOMAKE(dovecot, 0.99.10)
+AM_INIT_AUTOMAKE(dovecot, 0.99.11-test4)
AM_MAINTAINER_MODE
fi
AC_MSG_RESULT($i_cv_field_tm_gmtoff)
+dnl * how large time_t values does gmtime() accept?
+AC_MSG_CHECKING([how large time_t values gmtime() accepts])
+AC_TRY_RUN([
+ #include <stdio.h>
+ #include <time.h>
+ int main() {
+ FILE *f;
+ int bits;
+ time_t t;
+
+ for (bits = 1, t = 1; t > 0; ++bits, t <<= 1) {
+ if (gmtime(&t) == NULL) {
+ bits--;
+ break;
+ }
+ }
+ f = fopen("conftest.temp", "w");
+ if (f == NULL) {
+ perror("fopen()");
+ return 1;
+ }
+ fprintf(f, "%d", bits);
+ fclose(f);
+ return 0;
+ }
+], [
+ max_bits=`cat conftest.temp`
+ rm -f conftest.temp
+ AC_MSG_RESULT($max_bits)
+], [
+ AC_MSG_RESULT([check failed, assuming 31])
+ max_bits=31
+])
+AC_DEFINE_UNQUOTED(TIME_T_MAX_BITS, $max_bits, max. time_t bits gmtime() can handle)
+
dnl * do we have struct iovec
AC_MSG_CHECKING([for struct iovec])
AC_CACHE_VAL(i_cv_struct_iovec,
** would still be very reasonable).
*/
+#include "lib.h"
#include "utc-mktime.h"
static int tmcomp(register const struct tm * const atmp,
** (this works regardless of whether time_t is
** signed or unsigned, though lint complains if unsigned).
*/
- for (bits = 0, t = 1; t > 0; ++bits, t <<= 1)
- ;
+ for (bits = 0, t = 1; t > 0 && bits < TIME_T_MAX_BITS-1; bits++)
+ t <<= 1;
+
/*
** If time_t is signed, then 0 is the median value,
** if time_t is unsigned, then 1 << bits is median.