]> git.saurik.com Git - wxWidgets.git/commitdiff
Fix build with Sun CC under Linux.
authorVadim Zeitlin <vadim@wxwidgets.org>
Wed, 7 Dec 2011 00:59:43 +0000 (00:59 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Wed, 7 Dec 2011 00:59:43 +0000 (00:59 +0000)
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

configure
configure.in

index 908181b752e21bac37f2e47ab5cc94565bdd8aea..3d5b60d9590f7fe8d3fc7e07f610d99d77ccc4ee 100755 (executable)
--- 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
index f768cc5fdaacf849c32b815354ac9faf79baa055..e12e81c30b78e93205e1c07473074840898c928e 100644 (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 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