Andreas Krennmair:
[apps/madmutt.git] / m4 / types.m4
1 dnl types.m4
2 dnl macros for type checks not covered by autoconf
3
4 dnl MUTT_C99_INTTYPES
5 dnl Brendan Cully
6 dnl
7 # MUTT_C99_INTTYPES
8 # Check for C99 integer type definitions, or define if missing
9 AC_DEFUN([MUTT_C99_INTTYPES],
10 [dnl
11 AC_CHECK_HEADERS([inttypes.h])
12 AC_CHECK_TYPE([uint32_t],
13   [AC_DEFINE(HAVE_C99_INTTYPES, 1, [Define if you have the C99 integer types])],
14   [AC_CHECK_SIZEOF(short)
15    AC_CHECK_SIZEOF(int)
16    AC_CHECK_SIZEOF(long)
17    AC_CHECK_SIZEOF(long long)])
18 AH_VERBATIM([X_HAVE_C99_INTTYPES],
19   [#ifndef HAVE_C99_INTTYPES
20 #  if SIZEOF_SHORT == 4
21 typedef unsigned short uint32_t;
22 #  elif SIZEOF_INT == 4
23 typedef unsigned int uint32_t;
24 #  elif SIZEOF_LONG == 4
25 typedef unsigned long uint32_t;
26 #  endif
27 #  if SIZEOF_INT == 8
28 typedef unsigned int uint64_t;
29 #  elif SIZEOF_LONG == 8
30 typedef unsigned long uint64_t;
31 #  elif SIZEOF_LONG_LONG == 8
32 typedef unsigned long long uint64_t;
33 #  endif
34 #endif
35   ])
36 ])