diff --git a/configure b/configure index 908181b752..3d5b60d959 100755 --- a/configure +++ b/configure @@ -19588,6 +19588,9 @@ if test "$USE_LINUX" = 1 -o "$USE_GNU" = 1; then #define _GNU_SOURCE 1 _ACEOF + + GNU_SOURCE_FLAG="-D_GNU_SOURCE" + CFLAGS="$GNU_SOURCE_FLAG $CFLAGS" fi if test "x$USE_AIX" = "x1"; then @@ -25604,7 +25607,7 @@ _ACEOF if test "x$SUNCXX" = xyes; then - CXXFLAGS="-features=tmplife $CXXFLAGS" + CXXFLAGS="-features=tmplife $GNU_SOURCE_FLAG $CXXFLAGS" fi if test "x$SUNCC" = xyes; then diff --git a/configure.in b/configure.in index f768cc5fda..e12e81c30b 100644 --- a/configure.in +++ b/configure.in @@ -1390,6 +1390,11 @@ if test "$USE_LINUX" = 1 -o "$USE_GNU" = 1; then dnl succeed, otherwise things like pthread_mutexattr_settype() (and many dnl others) wouldn't be detected. AC_DEFINE(_GNU_SOURCE) + + dnl For non-g++ compilers (including gcc, as mentioned above) we need to + dnl add this flag explicitly when building our own code later too. + GNU_SOURCE_FLAG="-D_GNU_SOURCE" + CFLAGS="$GNU_SOURCE_FLAG $CFLAGS" fi if test "x$USE_AIX" = "x1"; then @@ -1904,7 +1909,7 @@ WX_CPP_EXPLICIT dnl With Sun CC, temporaries have block scope by default. This flag is needed dnl to get the expression scope behaviour that conforms to the standard. if test "x$SUNCXX" = xyes; then - CXXFLAGS="-features=tmplife $CXXFLAGS" + CXXFLAGS="-features=tmplife $GNU_SOURCE_FLAG $CXXFLAGS" fi dnl Sun X11 headers are (still, in 2005!) non-ANSI and the best they could do