]> 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)
committerAki Tuomi <aki.tuomi@dovecot.fi>
Wed, 3 Jan 2018 15:12:43 +0000 (17:12 +0200)
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 361ea58841a62fdedcef64ea7687cb5d090b1e74..11c4ff145666f5072a02be9452b02a7d7480fdc5 100644 (file)
@@ -328,7 +328,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 \
@@ -898,6 +898,8 @@ AC_DEFUN([AC_CHECKTYPE2], [
   $2]], [[$1 t;]])],[i_cv_type_$1=yes],[i_cv_type_$1=no])])
   AC_MSG_RESULT($i_cv_type_$1)
 ])
+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
index 6579c2feb0e2aff7cb395651ee5d54707d20cdc6..78bf50d6067bc0173c3087397b472fa39751de32 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 b672ad576c24c3bd51150b55eda2a88dcc0acf78..528165829f361b58ba9f40fb5df4ed42e873dab6 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 */