Fix build with Sun CC under Linux.

We need to explicitly define _GNU_SOURCE when building our code as we use it
configure when running the tests and it's not predefined by Sun CC, unlike g++
so we need to add it to CXXFLAGS ourselves.

An alternative solution would be to run the tests without _GNU_SOURCE but this
would lose too much functionality so it doesn't seem like a good idea.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69936 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2011-12-07 00:59:43 +00:00
parent be1c88bf3e
commit eef2e91ffb
2 changed files with 10 additions and 2 deletions

5
configure vendored
View File

@@ -19588,6 +19588,9 @@ if test "$USE_LINUX" = 1 -o "$USE_GNU" = 1; then
#define _GNU_SOURCE 1 #define _GNU_SOURCE 1
_ACEOF _ACEOF
GNU_SOURCE_FLAG="-D_GNU_SOURCE"
CFLAGS="$GNU_SOURCE_FLAG $CFLAGS"
fi fi
if test "x$USE_AIX" = "x1"; then if test "x$USE_AIX" = "x1"; then
@@ -25604,7 +25607,7 @@ _ACEOF
if test "x$SUNCXX" = xyes; then if test "x$SUNCXX" = xyes; then
CXXFLAGS="-features=tmplife $CXXFLAGS" CXXFLAGS="-features=tmplife $GNU_SOURCE_FLAG $CXXFLAGS"
fi fi
if test "x$SUNCC" = xyes; then if test "x$SUNCC" = xyes; then

View File

@@ -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 succeed, otherwise things like pthread_mutexattr_settype() (and many
dnl others) wouldn't be detected. dnl others) wouldn't be detected.
AC_DEFINE(_GNU_SOURCE) 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 fi
if test "x$USE_AIX" = "x1"; then 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 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. dnl to get the expression scope behaviour that conforms to the standard.
if test "x$SUNCXX" = xyes; then if test "x$SUNCXX" = xyes; then
CXXFLAGS="-features=tmplife $CXXFLAGS" CXXFLAGS="-features=tmplife $GNU_SOURCE_FLAG $CXXFLAGS"
fi fi
dnl Sun X11 headers are (still, in 2005!) non-ANSI and the best they could do dnl Sun X11 headers are (still, in 2005!) non-ANSI and the best they could do