diff --git a/configure b/configure index bc6c346686..908181b752 100755 --- a/configure +++ b/configure @@ -19583,6 +19583,13 @@ case "${host}" in esac +if test "$USE_LINUX" = 1 -o "$USE_GNU" = 1; then + cat >>confdefs.h <<\_ACEOF +#define _GNU_SOURCE 1 +_ACEOF + +fi + if test "x$USE_AIX" = "x1"; then if test "x$XLCXX" = "xyes"; then CXXFLAGS="-qunique $CXXFLAGS" @@ -27379,84 +27386,6 @@ echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi rm -f confcache -if test "$USE_LINUX" = 1 -o "$USE_GNU" = 1; then - { echo "$as_me:$LINENO: checking for glibc 2.1 or later" >&5 -echo $ECHO_N "checking for glibc 2.1 or later... $ECHO_C" >&6; } -if test "${wx_cv_lib_glibc21+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -int -main () -{ - - #if (__GLIBC__ < 2) || (__GLIBC_MINOR__ < 1) - not glibc 2.1 - #endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - - wx_cv_lib_glibc21=yes - -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - - wx_cv_lib_glibc21=no - - -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ echo "$as_me:$LINENO: result: $wx_cv_lib_glibc21" >&5 -echo "${ECHO_T}$wx_cv_lib_glibc21" >&6; } - if test "$wx_cv_lib_glibc21" = "yes"; then - cat >>confdefs.h <<\_ACEOF -#define wxHAVE_GLIBC2 1 -_ACEOF - - fi -fi - -if test "x$wx_cv_lib_glibc21" = "xyes"; then - if test "$wxUSE_UNICODE" = "yes" -o "$wxUSE_THREADS" = "yes"; then - cat >>confdefs.h <<\_ACEOF -#define _GNU_SOURCE 1 -_ACEOF - - fi -fi - have_cos=0 have_floor=0 diff --git a/configure.in b/configure.in index 4fd1e479c8..f768cc5fda 100644 --- a/configure.in +++ b/configure.in @@ -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 ], - [ - #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 diff --git a/setup.h.in b/setup.h.in index 0147d6d774..97fcb89a6a 100644 --- a/setup.h.in +++ b/setup.h.in @@ -818,10 +818,6 @@ * Use the Hildon 2.0 framework */ #define wxUSE_LIBHILDON2 0 -/* - * Have glibc2 - */ -#define wxHAVE_GLIBC2 0 /* * Use libXpm */ diff --git a/setup.h_vms b/setup.h_vms index 19737e8fa0..cfa7fa2c41 100644 --- a/setup.h_vms +++ b/setup.h_vms @@ -862,10 +862,6 @@ typedef pid_t GPid; #define wxUSE_DC_TRANSFORM_MATRIX 1 -/* - * Have glibc2 - */ -#define wxHAVE_GLIBC2 0 /* * Use libXpm */