]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: include inttypes.h to get PRIu64 & friends
authorJosef 'Jeff' Sipek <jeff.sipek@dovecot.fi>
Wed, 17 May 2017 07:35:03 +0000 (10:35 +0300)
committerGitLab <gitlab@git.dovecot.net>
Wed, 17 May 2017 11:13:04 +0000 (14:13 +0300)
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
src/lib/compat.h
src/lib/lib.h

index 2a46d74f07c142148c4103795da6b25445bc8cd5..16875427f2ab93a265c64823651532488b8a9127 100644 (file)
@@ -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, [
index 449664ca2c8a8de43db34d41579e183d20e1999c..9bb59d7b99bfe2beb95c8b16f95d89f037a74a80 100644 (file)
@@ -1,10 +1,6 @@
 #ifndef COMPAT_H
 #define COMPAT_H
 
-#if defined (HAVE_INTTYPES_H) && (defined(__osf__) || defined(_HPUX_SOURCE))
-#  include <inttypes.h>
-#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
index 672ce446ce49d62d321d63a4fc7f4937744d82d2..16ec4cc9459ad6072f777f5114f643a7511021c9 100644 (file)
@@ -17,6 +17,7 @@
 #include <limits.h> /* INT_MAX, etc. */
 #include <errno.h> /* error checking is good */
 #include <sys/types.h> /* many other includes want this */
+#include <inttypes.h> /* PRI* macros */
 
 #ifdef HAVE_STDINT_H
 #  include <stdint.h> /* C99 int types, we mostly need uintmax_t */