Browse Source

build: Map the BSD u_intN_t types to C99 uintN_t if not defined

The md5 module imported from OpenBSD is using these BSD types, but
those are not present on at least Solaris. Define them to their
corresponding C99 types, so that the imported code has to be modified
as less as possible.

Reported-by: Andrew Stormont <andrew.stormont@nexenta.com>
Guillem Jover 14 years ago
parent
commit
1f4d0354fc
2 changed files with 23 additions and 1 deletions
  1. 1 0
      configure.ac
  2. 22 1
      m4/dpkg-types.m4

+ 1 - 0
configure.ac

@@ -73,6 +73,7 @@ DPKG_C_C99
 AC_TYPE_MODE_T
 AC_TYPE_PID_T
 AC_TYPE_SIZE_T
+DPKG_TYPES_U_INT_T
 DPKG_TYPE_PTRDIFF_T
 AC_CHECK_SIZEOF([unsigned int])
 AC_CHECK_SIZEOF([unsigned long])

+ 22 - 1
m4/dpkg-types.m4

@@ -1,5 +1,5 @@
 # Copyright © 2005 Scott James Remnant <scott@netsplit.com>
-# Copyright © 2009 Guillem Jover <guillem@debian.org>
+# Copyright © 2009-2011 Guillem Jover <guillem@debian.org>
 
 # DPKG_TYPE_PTRDIFF_T
 # -------------------
@@ -10,6 +10,27 @@ AC_DEFUN([DPKG_TYPE_PTRDIFF_T],
 			   [Define to 'int' if <malloc.h> does not define.]))dnl
 ])# DPKG_TYPE_PTRDIFF_T
 
+# DPKG_TYPE_U_INT_T(N)
+# --------------------
+# Check for u_intN_t BSD type, defining to C99 type if not.
+AC_DEFUN([DPKG_TYPE_U_INT_T],
+[
+  AC_CHECK_TYPE([u_int$1_t], [],
+                AC_DEFINE_UNQUOTED([u_int$1_t], [uint$1_t],
+                                   [Define to 'uint$1_t' if not defined.]))
+])
+
+# DPKG_TYPES_U_INT_T
+# ------------------
+# Check for u_int(8|16|32|64)_t BSD types, defining to C99 types if not.
+AC_DEFUN([DPKG_TYPES_U_INT_T],
+[
+  DPKG_TYPE_U_INT_T([8])
+  DPKG_TYPE_U_INT_T([16])
+  DPKG_TYPE_U_INT_T([32])
+  DPKG_TYPE_U_INT_T([64])
+])
+
 # DPKG_DECL_SYS_SIGLIST
 # ---------------------
 # Check for the sys_siglist variable in either signal.h or unistd.h