summaryrefslogtreecommitdiffstats
path: root/m4/time_t.m4
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 17:36:47 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 17:36:47 +0000
commit0441d265f2bb9da249c7abf333f0f771fadb4ab5 (patch)
tree3f3789daa2f6db22da6e55e92bee0062a7d613fe /m4/time_t.m4
parentInitial commit. (diff)
downloaddovecot-0441d265f2bb9da249c7abf333f0f771fadb4ab5.tar.xz
dovecot-0441d265f2bb9da249c7abf333f0f771fadb4ab5.zip
Adding upstream version 1:2.3.21+dfsg1.upstream/1%2.3.21+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'm4/time_t.m4')
-rw-r--r--m4/time_t.m442
1 files changed, 42 insertions, 0 deletions
diff --git a/m4/time_t.m4 b/m4/time_t.m4
new file mode 100644
index 0000000..24a0242
--- /dev/null
+++ b/m4/time_t.m4
@@ -0,0 +1,42 @@
+AC_DEFUN([DOVECOT_TIME_T], [
+ AC_TYPEOF(time_t, long int long-long unsigned-int unsigned-long unsigned-long-long)
+ case "$typeof_time_t" in
+ long)
+ timet_len="l"
+ i_cv_signed_time_t=yes
+ ;;
+ int)
+ timet_len=""
+ i_cv_signed_time_t=yes
+ ;;
+ "long long")
+ timet_len="ll"
+ i_cv_signed_time_t=yes
+ ;;
+ "unsigned int")
+ timet_len=""
+ i_cv_signed_time_t=no
+ ;;
+ "unsigned long")
+ timet_len="l"
+ i_cv_signed_time_t=no
+ ;;
+ "unsigned long long")
+ timet_len="ll"
+ i_cv_signed_time_t=no
+ ;;
+ *)
+ AC_MSG_ERROR([Unsupported time_t type])
+ ;;
+ esac
+ if test $i_cv_signed_time_t = yes; then
+ AC_DEFINE(TIME_T_SIGNED,, [Define if your time_t is signed])
+ timet_d_fmt="$timet_len"d
+ else
+ timet_d_fmt="$timet_len"u
+ fi
+ timet_x_fmt="$timet_len"x
+
+ AC_DEFINE_UNQUOTED(PRIdTIME_T, "$timet_d_fmt", [printf() fmt for dec time_t])
+ AC_DEFINE_UNQUOTED(PRIxTIME_T, "$timet_x_fmt", [printf() fmt for hex time_t])
+])