Remove wxHAVE_GLIBC2 from configure, always predefine _GNU_SOURCE.

We used to test for glibc version first and predefined _GNU_SOURCE only if it
was greater than 2.1 but there doesn't seem to be any harm to just always
predefine _GNU_SOURCE under Linux (not that there are any systems with glibc <
2.1 left anyhow). Also do it much earlier to ensure that all tests are
affected by it.

And as we don't use wxHAVE_GLIBC2 anywhere else just remove it.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69935 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2011-12-07 00:59:40 +00:00
parent f825123271
commit be1c88bf3e
4 changed files with 15 additions and 125 deletions

View File

@@ -1384,6 +1384,14 @@ dnl ------------------------------------------------------------------------
dnl Platform specific tests
dnl ------------------------------------------------------------------------
if test "$USE_LINUX" = 1 -o "$USE_GNU" = 1; then
dnl While g++ predefines _GNU_SOURCE by default, gcc does not, so do it
dnl explicitly to ensure that the tests done below using C compiler
dnl succeed, otherwise things like pthread_mutexattr_settype() (and many
dnl others) wouldn't be detected.
AC_DEFINE(_GNU_SOURCE)
fi
if test "x$USE_AIX" = "x1"; then
dnl xlC needs -qunique under AIX so that one source file can be
dnl compiled to multiple object files and safely linked together.
@@ -2390,45 +2398,6 @@ dnl ------------------------------------------------------------------------
dnl flush the cache because checking for libraries below might abort
AC_CACHE_SAVE
dnl check for glibc version
dnl
dnl VZ: I have no idea why had this check been there originally, but now
dnl we could probably do without it by just always adding _GNU_SOURCE
if test "$USE_LINUX" = 1 -o "$USE_GNU" = 1; then
AC_CACHE_CHECK([for glibc 2.1 or later], wx_cv_lib_glibc21,[
AC_TRY_COMPILE([#include <features.h>],
[
#if (__GLIBC__ < 2) || (__GLIBC_MINOR__ < 1)
not glibc 2.1
#endif
],
[
wx_cv_lib_glibc21=yes
],
[
wx_cv_lib_glibc21=no
]
)
])
if test "$wx_cv_lib_glibc21" = "yes"; then
AC_DEFINE(wxHAVE_GLIBC2)
fi
fi
dnl we may need _GNU_SOURCE for 2 things:
dnl
dnl 1. to get PTHREAD_MUTEX_RECURSIVE with glibc 2.1+ (strictly speaking we
dnl only need _XOPEN_SOURCE=500 but just defining this disables _BSD_SOURCE
dnl which breaks libtiff compilation, so it is simpler to just define
dnl _GNU_SOURCE to get everything)
dnl
dnl 2. for Unicode functions
if test "x$wx_cv_lib_glibc21" = "xyes"; then
if test "$wxUSE_UNICODE" = "yes" -o "$wxUSE_THREADS" = "yes"; then
AC_DEFINE(_GNU_SOURCE)
fi
fi
dnl Only add the -lm library if floating point functions cannot be used
dnl without it. This check is important on cygwin because of the bizarre
dnl way that they have organized functions into libraries. On cygwin, both