From 6c383116d20ab1f9bc5d8aa965f4a216ebd354cc Mon Sep 17 00:00:00 2001
From: =?utf8?q?Jos=C3=A9=20Fonseca?= <jose.r.fonseca@gmail.com>
Date: Sat, 4 May 2013 09:33:41 +0100
Subject: [PATCH] Define _GNU_SOURCE for the whole tree.

As not all dlfnc.h includes define it consistently.
---
 CMakeLists.txt          | 5 +++++
 dispatch/glproc_egl.cpp | 3 ---
 wrappers/glxtrace.py    | 3 ---
 3 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 91643c2..2bfa07e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -174,6 +174,11 @@ if (MINGW)
     endif ()
 endif ()
 
+if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
+    # For RTLD_DEFAULT and RTLD_NEXT
+    add_definitions (-D_GNU_SOURCE)
+endif ()
+
 
 # Put all executables into the same top level build directory, regardless of
 # which subdirectory they are declared
diff --git a/dispatch/glproc_egl.cpp b/dispatch/glproc_egl.cpp
index 5f93b14..c77c444 100644
--- a/dispatch/glproc_egl.cpp
+++ b/dispatch/glproc_egl.cpp
@@ -28,9 +28,6 @@
 
 
 #if !defined(_WIN32)
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE // for dladdr
-#endif
 #include <dlfcn.h>
 #endif
 
diff --git a/wrappers/glxtrace.py b/wrappers/glxtrace.py
index 9c0f87d..8f83f31 100644
--- a/wrappers/glxtrace.py
+++ b/wrappers/glxtrace.py
@@ -86,9 +86,6 @@ if __name__ == '__main__':
     print '#include <stdlib.h>'
     print '#include <string.h>'
     print
-    print '#ifndef _GNU_SOURCE'
-    print '#define _GNU_SOURCE // for dladdr'
-    print '#endif'
     print '#include <dlfcn.h>'
     print
     print '#include "trace_writer_local.hpp"'
-- 
2.45.2