build: Check for [s]size_t before redefining them on MinGW
authorPhilip Withnall <philip.withnall@collabora.co.uk>
Thu, 3 Apr 2014 11:29:04 +0000 (12:29 +0100)
committerPhilip Withnall <philip.withnall@collabora.co.uk>
Thu, 3 Apr 2014 14:02:01 +0000 (15:02 +0100)
MinGW defines size_t and ssize_t for us, so we should not
unconditionally redefine them in stun/win32_common.h. Add an
AC_CHECK_TYPES configure check to avoid this.

configure.ac
stun/win32_common.h

index 745b40c..9b83742 100644 (file)
@@ -92,6 +92,7 @@ AC_CHECK_HEADERS([arpa/inet.h net/in.h])
 AC_CHECK_HEADERS([ifaddrs.h], \
                      [AC_DEFINE(HAVE_GETIFADDRS, [1], \
                       [Whether getifaddrs() is available on the system])])
+AC_CHECK_TYPES([size_t, ssize_t])
 
 # Also put matching version in LIBNICE_CFLAGS
 GLIB_REQ=2.30
index 5f8e593..61fa981 100644 (file)
@@ -57,6 +57,7 @@
 #ifndef _WIN32_COMMON_H
 #define _WIN32_COMMON_H
 
+#include "config.h"
 #include <sys/types.h>
 
 /* 7.18.1.1  Exact-width integer types */
@@ -69,8 +70,10 @@ typedef unsigned   uint32_t;
 typedef long long  int64_t;
 typedef unsigned long long   uint64_t;
 
-#ifndef _SSIZE_T_
+#ifndef HAVE_SIZE_T
 typedef unsigned int size_t;
+#endif
+#ifndef HAVE_SSIZE_T
 typedef unsigned long ssize_t;
 #endif