From aeeb8e975dc740cb79954de7fec4fcfe902d3a42 Mon Sep 17 00:00:00 2001 From: NIIBE Yutaka Date: Wed, 18 Nov 2020 13:33:41 +0900 Subject: [PATCH] build: Use modern Autoconf check for types. * common/types.h: Use HAVE_TYPE_BYTE, HAVE_USHORT_TYPEDEF, HAVE_ULONG_TYPEDEF, HAVE_U16_TYPEDEF, and HAVE_TYPE_U32. * configure.ac (byte, ushort, ulong, u16, u32): Use AC_CHECK_TYPES. Signed-off-by: NIIBE Yutaka --- common/types.h | 22 +++++++++++----------- configure.ac | 7 +------ 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/common/types.h b/common/types.h index 8e551df46..28f37797b 100644 --- a/common/types.h +++ b/common/types.h @@ -67,29 +67,29 @@ Windows typedefs byte in the RPC headers but we need to avoid a warning about a double definition. */ -#ifndef HAVE_BYTE_TYPEDEF +#ifndef HAVE_TYPE_BYTE # undef byte /* There might be a macro with this name. */ # ifdef __riscos__ typedef char byte; # elif !(defined(_WIN32) && defined(cbNDRContext)) typedef unsigned char byte; # endif -# define HAVE_BYTE_TYPEDEF -#endif /*!HAVE_BYTE_TYPEDEF*/ +# define HAVE_TYPE_BYTE +#endif /*!HAVE_TYPE_BYTE*/ -#ifndef HAVE_USHORT_TYPEDEF +#ifndef HAVE_TYPE_USHORT # undef ushort /* There might be a macro with this name. */ typedef unsigned short ushort; -# define HAVE_USHORT_TYPEDEF +# define HAVE_TYPE_USHORT #endif -#ifndef HAVE_ULONG_TYPEDEF +#ifndef HAVE_TYPE_ULONG # undef ulong /* There might be a macro with this name. */ typedef unsigned long ulong; -# define HAVE_ULONG_TYPEDEF +# define HAVE_TYPE_ULONG #endif -#ifndef HAVE_U16_TYPEDEF +#ifndef HAVE_TYPE_U16 # undef u16 /* There might be a macro with this name. */ # if SIZEOF_UNSIGNED_INT == 2 typedef unsigned int u16; @@ -98,10 +98,10 @@ # else # error no typedef for u16 # endif -# define HAVE_U16_TYPEDEF +# define HAVE_TYPE_U16 #endif -#ifndef HAVE_U32_TYPEDEF +#ifndef HAVE_TYPE_U32 # undef u32 /* There might be a macro with this name. */ # if SIZEOF_UNSIGNED_INT == 4 typedef unsigned int u32; @@ -110,7 +110,7 @@ # else # error no typedef for u32 # endif -# define HAVE_U32_TYPEDEF +# define HAVE_TYPE_U32 #endif #endif /*GNUPG_COMMON_TYPES_H*/ diff --git a/configure.ac b/configure.ac index 83829f895..059c2fe6e 100644 --- a/configure.ac +++ b/configure.ac @@ -1384,12 +1384,7 @@ if test x"$endiancheck" = xyes ; then fi # fixme: we should get rid of the byte type -GNUPG_CHECK_TYPEDEF(byte, HAVE_BYTE_TYPEDEF) -GNUPG_CHECK_TYPEDEF(ushort, HAVE_USHORT_TYPEDEF) -GNUPG_CHECK_TYPEDEF(ulong, HAVE_ULONG_TYPEDEF) -GNUPG_CHECK_TYPEDEF(u16, HAVE_U16_TYPEDEF) -GNUPG_CHECK_TYPEDEF(u32, HAVE_U32_TYPEDEF) - +AC_CHECK_TYPES([byte, ushort, ulong, u16, u32]) AC_CHECK_SIZEOF(unsigned short) AC_CHECK_SIZEOF(unsigned int) AC_CHECK_SIZEOF(unsigned long)