From 6dd7a0a5e52979f226b414d61d9a82e341710525 Mon Sep 17 00:00:00 2001 From: Josef 'Jeff' Sipek Date: Wed, 17 May 2017 10:35:03 +0300 Subject: [PATCH] lib: include inttypes.h to get PRIu64 & friends Including it in lib.h allows all of the Dovecot code (as well as any external plugins) to just use these macros without worrying about what system headers to include. --- configure.ac | 5 ++++- src/lib/compat.h | 4 ---- src/lib/lib.h | 1 + 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index 2a46d74f07..16875427f2 100644 --- a/configure.ac +++ b/configure.ac @@ -309,7 +309,7 @@ AC_DEFINE_UNQUOTED(DOVECOT_VERSION, "$PACKAGE_VERSION", [Dovecot version]) AC_DEFINE([DOVECOT_VERSION_MAJOR], regexp(AC_PACKAGE_VERSION, [^\([0-9]+\)\.\([0-9]+\)], [\1]), [Dovecot major version]) AC_DEFINE([DOVECOT_VERSION_MINOR], regexp(AC_PACKAGE_VERSION, [^\([0-9]+\)\.\([0-9]+\)], [\2]), [Dovecot minor version]) -AC_CHECK_HEADERS(strings.h stdint.h unistd.h dirent.h malloc.h inttypes.h \ +AC_CHECK_HEADERS(strings.h stdint.h unistd.h dirent.h malloc.h \ sys/uio.h sys/sysmacros.h sys/resource.h sys/select.h libgen.h \ sys/quota.h sys/fs/ufs_quota.h ufs/ufs/quota.h jfs/quota.h \ quota.h sys/fs/quota_common.h \ @@ -425,6 +425,9 @@ DOVECOT_SIZE_T_SIGNED AC_DEFINE_UNQUOTED(SSIZE_T_MAX, $ssizet_max, [Maximum value of ssize_t]) AC_DEFINE_UNQUOTED(PRIuSIZE_T, "$sizet_fmt", [printf() format for size_t]) +dnl we require inttypes.h for PRIu{8,16,32,64} macros +AC_CHECK_HEADER(inttypes.h,,AC_MSG_ERROR([inttypes.h missing but required])) + dnl some systems don't have stdint.h, but still have some of the types dnl defined elsewhere AC_CHECK_HEADER(stdint.h, [ diff --git a/src/lib/compat.h b/src/lib/compat.h index 449664ca2c..9bb59d7b99 100644 --- a/src/lib/compat.h +++ b/src/lib/compat.h @@ -1,10 +1,6 @@ #ifndef COMPAT_H #define COMPAT_H -#if defined (HAVE_INTTYPES_H) && (defined(__osf__) || defined(_HPUX_SOURCE)) -# include -#endif - /* well, this is obviously wrong since it assumes it's 64bit, but older GCCs don't define it and we really want it. */ #ifndef LLONG_MAX diff --git a/src/lib/lib.h b/src/lib/lib.h index 672ce446ce..16ec4cc945 100644 --- a/src/lib/lib.h +++ b/src/lib/lib.h @@ -17,6 +17,7 @@ #include /* INT_MAX, etc. */ #include /* error checking is good */ #include /* many other includes want this */ +#include /* PRI* macros */ #ifdef HAVE_STDINT_H # include /* C99 int types, we mostly need uintmax_t */