From f745c96a9bcf930d10fe31de5f7b3e772cccfa83 Mon Sep 17 00:00:00 2001 From: Martin Lucina Date: Wed, 17 Feb 2010 15:40:26 +0100 Subject: [PATCH] Add POSIX and GNU Feature Test Macros This should fix more exotic POSIX platforms such as HPUX which insist on having _POSIX_C_SOURCE defined to get proper threading behaviour. We also define _GNU_SOURCE so that we get any extensions on systems with glibc, e.g. eventfd. --- configure.in | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/configure.in b/configure.in index 49266c78..a0314589 100644 --- a/configure.in +++ b/configure.in @@ -91,10 +91,13 @@ if test ! -f "doc/zmq.html"; then fi fi +# Set some default features required by 0MQ code. +CPPFLAGS="-D_REENTRANT -D_THREAD_SAFE -D_GNU_SOURCE -D_POSIX_C_SOURCE=200112L $CPPFLAGS" + +# OS-specific tests case "${host_os}" in *linux*) AC_DEFINE(ZMQ_HAVE_LINUX, 1, [Have Linux OS]) - CPPFLAGS="-D_REENTRANT $CPPFLAGS" AC_CHECK_LIB(uuid, main, , [AC_MSG_ERROR([cannot link with -luuid, install uuid-dev.])]) ;; @@ -105,7 +108,7 @@ case "${host_os}" in AC_CHECK_LIB(rt, main) AC_CHECK_LIB(uuid, main, , [AC_MSG_ERROR([cannot link with -luuid, install uuid-dev.])]) - CPPFLAGS="-D_REENTRANT -D_PTHREADS $CPPFLAGS" + CPPFLAGS="-D_PTHREADS $CPPFLAGS" AC_MSG_CHECKING([wheter atomic operations can be used]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM( [[#include ]], @@ -122,7 +125,6 @@ case "${host_os}" in ;; *freebsd*) AC_DEFINE(ZMQ_HAVE_FREEBSD, 1, [Have FreeBSD OS]) - CPPFLAGS="-D_THREAD_SAFE $CPPFLAGS" LIBS="-pthread" ;; *darwin*) @@ -134,26 +136,18 @@ case "${host_os}" in ;; *openbsd*) AC_DEFINE(ZMQ_HAVE_OPENBSD, 1, [Have OpenBSD OS]) - CPPFLAGS="-pthread $CPPFLAGS" LIBS="-pthread" ;; *nto-qnx*) pedantic="no" AC_DEFINE(ZMQ_HAVE_QNXNTO, 1, [Have QNX Neutrino OS]) - CPPFLAGS="-D_THREAD_SAFE $CPPFLAGS" AC_CHECK_LIB(socket,main) ;; *aix*) AC_DEFINE(ZMQ_HAVE_AIX, 1, [Have AIX OS]) - if test "x$GXX" = "xyes"; then - CPPFLAGS="-D_THREAD_SAFE $CPPFLAGS" - fi ;; *hpux*) AC_DEFINE(ZMQ_HAVE_HPUX, 1, [Have HPUX OS]) - if test "x$GXX" = "xyes"; then - CPPFLAGS="-D_THREAD_SAFE $CPPFLAGS" - fi AC_CHECK_LIB(rt, main) ;; *mingw32*)