Browse files

gltrace: Detect the availability of tr1/memory header.

Instead of trying to guess it.

Should fix issue #224
  • Loading branch information...
1 parent b9adf67 commit 1c6c2bc52d088962a0b0a0cac9121d11b24eba0b @jrfonseca jrfonseca committed Feb 25, 2014
Showing with 8 additions and 5 deletions.
  1. +5 −0 CMakeLists.txt
  2. +3 −5 wrappers/gltrace_state.cpp
View
5 CMakeLists.txt
@@ -100,6 +100,7 @@ endif ()
# Set global build options
include (CheckCXXCompilerFlag)
+include (CheckIncludeFileCXX)
if (WIN32)
# http://msdn.microsoft.com/en-us/library/aa383745.aspx
@@ -192,6 +193,10 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
add_definitions (-D_GNU_SOURCE)
endif ()
+check_include_file_cxx (tr1/memory HAVE_TR1_MEMORY)
+if (HAVE_TR1_MEMORY)
+ add_definitions (-DHAVE_TR1_MEMORY)
+endif ()
# Put all executables into the same top level build directory, regardless of
# which subdirectory they are declared
View
8 wrappers/gltrace_state.cpp
@@ -28,20 +28,18 @@
#include <assert.h>
#include <map>
-#if defined(_MSC_VER) || (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090)
-#include <memory>
-#else
+#if defined(HAVE_TR1_MEMORY)
#include <tr1/memory>
-#include <memory>
#endif
+#include <memory>
#include <os_thread.hpp>
#include <glproc.hpp>
#include <gltrace.hpp>
namespace gltrace {
-#if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
+#if !defined(HAVE_TR1_MEMORY)
typedef std::shared_ptr<Context> context_ptr_t;
#else
typedef std::tr1::shared_ptr<Context> context_ptr_t;

0 comments on commit 1c6c2bc

Please sign in to comment.