Define _REENTRANT as needed on Solaris, elsewhere

It turns out that _REENTRANT isn't only needed to make certain
functions visible; we also need it to make pthreads work properly some
places (like Solaris, where forgetting _REENTRANT basically means that
all threads are sharing the same errno).

Unlike in 2.0, we can't use the PTHREAD_CFLAGS variable to see what
flags to use, since we aren't using pthreads in 1.4.  Instead, we just
check the host type explicitly, like acx_pthreads does.
This commit is contained in:
Nick Mathewson 2010-05-10 19:58:17 -04:00
parent 906d573b4c
commit 6cbea13b03

View File

@ -6,6 +6,8 @@ AM_INIT_AUTOMAKE(libevent,1.4.13-stable-dev)
AM_CONFIG_HEADER(config.h)
dnl AM_MAINTAINER_MODE
AC_CANONICAL_HOST
AC_DEFINE(NUMERIC_VERSION, 0x01040d01, [Numeric representation of the version])
dnl Initialize prefix.
@ -26,6 +28,25 @@ if test "$GCC" = yes ; then
CFLAGS="$CFLAGS -fno-strict-aliasing"
fi
dnl Libevent 1.4 isn't multithreaded, but some of its functions are
dnl documented to be reentrant. If you don't define the right macros
dnl on some platforms, you get non-reentrant versions of the libc
dnl functinos (like an errno that's shared by all threads).
AC_MSG_CHECKING([whether we need extra flags to make libc reentrant])
case $host in
*solaris* | *-osf* | *-hpux* )
AC_MSG_RESULT([-D_REENTRANT])
CFLAGS="$CFLAGS -D_REENTRANT"
;;
*-aix* | *-freebsd* | *-darwin* )
AC_MSG_RESULT([-D_THREAD_SAFE])
CFLAGS="$CFLAGS -D_THREAD_SAFE"
;;
*)
AC_MSG_RESULT(no)
;;
esac
AC_ARG_ENABLE(gcc-warnings,
AS_HELP_STRING(--enable-gcc-warnings, enable verbose warnings with GCC))