diff options
author | Martin Lucina <mato@kotelna.sk> | 2010-02-18 13:46:00 +0100 |
---|---|---|
committer | Martin Lucina <mato@kotelna.sk> | 2010-02-18 13:46:00 +0100 |
commit | 8be491b7bdb8525eb37cebf355697c566a482e2d (patch) | |
tree | d29d2565f9bd1fdc3facc2f87bca7e4e67932344 | |
parent | d008637bc42da3fca50e423c2df0736be2745ac7 (diff) |
Use feature test macros more conservatively
It turns out that feature test macros are a complete mess, and defining
_GNU_SOURCE and _POSIX_C_SOURCE together breaks some systems. So we try
and define the appropriate "make everything visible" combination specific
to each system instead. This may still break something, so people should
test their platforms and speak up if so.
-rw-r--r-- | configure.in | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/configure.in b/configure.in index a031458..d43f941 100644 --- a/configure.in +++ b/configure.in @@ -92,23 +92,26 @@ if test ! -f "doc/zmq.html"; then fi # Set some default features required by 0MQ code. -CPPFLAGS="-D_REENTRANT -D_THREAD_SAFE -D_GNU_SOURCE -D_POSIX_C_SOURCE=200112L $CPPFLAGS" +CPPFLAGS="-D_REENTRANT -D_THREAD_SAFE $CPPFLAGS" # OS-specific tests case "${host_os}" in *linux*) + # Define on Linux to enable all library features + CPPFLAGS="-D_GNU_SOURCE $CPPFLAGS" AC_DEFINE(ZMQ_HAVE_LINUX, 1, [Have Linux OS]) AC_CHECK_LIB(uuid, main, , [AC_MSG_ERROR([cannot link with -luuid, install uuid-dev.])]) ;; *solaris*) + # Define on Solaris to enable all library features + CPPFLAGS="-D_POSIX_C_SOURCE=200112L -D_PTHREADS $CPPFLAGS" AC_DEFINE(ZMQ_HAVE_SOLARIS, 1, [Have Solaris OS]) AC_CHECK_LIB(socket, main) AC_CHECK_LIB(nsl, main) AC_CHECK_LIB(rt, main) AC_CHECK_LIB(uuid, main, , [AC_MSG_ERROR([cannot link with -luuid, install uuid-dev.])]) - CPPFLAGS="-D_PTHREADS $CPPFLAGS" AC_MSG_CHECKING([wheter atomic operations can be used]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM( [[#include <atomic.h>]], @@ -124,10 +127,14 @@ case "${host_os}" in fi ;; *freebsd*) + # Define on FreeBSD to enable all library features + CPPFLAGS="-D__BSD_VISIBLE $CPPFLAGS" AC_DEFINE(ZMQ_HAVE_FREEBSD, 1, [Have FreeBSD OS]) LIBS="-pthread" ;; *darwin*) + # Define on Darwin to enable all library features + CPPFLAGS="-D_DARWIN_C_SOURCE $CPPFLAGS" pedantic="no" werror="no" AC_DEFINE(ZMQ_HAVE_OSX, 1, [Have DarwinOSX OS]) @@ -135,6 +142,8 @@ case "${host_os}" in LIBZMQ_EXTRA_CXXFLAGS+="-Wno-uninitialized" ;; *openbsd*) + # Define on OpenBSD to enable all library features + CPPFLAGS="-D_BSD_SOURCE $CPPFLAGS" AC_DEFINE(ZMQ_HAVE_OPENBSD, 1, [Have OpenBSD OS]) LIBS="-pthread" ;; @@ -147,6 +156,8 @@ case "${host_os}" in AC_DEFINE(ZMQ_HAVE_AIX, 1, [Have AIX OS]) ;; *hpux*) + # Define on HP-UX to enable all library features + CPPFLAGS="-D_POSIX_C_SOURCE=200112L" AC_DEFINE(ZMQ_HAVE_HPUX, 1, [Have HPUX OS]) AC_CHECK_LIB(rt, main) ;; |