diff -Naurp gegl/opencl/cl.h gegl/opencl/cl.h
--- gegl/opencl/cl.h	2012-09-03 13:51:13.000000000 -0700
+++ gegl/opencl/cl.h	2012-09-03 13:46:10.000000000 -0700
@@ -26,7 +26,7 @@
 #ifndef __OPENCL_CL_H
 #define __OPENCL_CL_H
 
-#ifdef __APPLE__
+#if defined(__APPLE__) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
 #include <OpenCL/cl_platform.h>
 #else
 #include "cl_platform.h"
diff -Naurp gegl/opencl/cl_gl.h gegl/opencl/cl_gl.h
--- gegl/opencl/cl_gl.h	2012-09-03 13:51:13.000000000 -0700
+++ gegl/opencl/cl_gl.h	2012-09-03 13:46:10.000000000 -0700
@@ -32,7 +32,7 @@
 #ifndef __OPENCL_CL_GL_H
 #define __OPENCL_CL_GL_H
 
-#ifdef __APPLE__
+#if defined(__APPLE__) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
 #include <OpenCL/cl.h>
 #include <OpenGL/CGLDevice.h>
 #else
diff -Naurp gegl/opencl/cl_platform.h gegl/opencl/cl_platform.h
--- gegl/opencl/cl_platform.h	2012-09-03 13:51:13.000000000 -0700
+++ gegl/opencl/cl_platform.h	2012-09-03 13:53:20.000000000 -0700
@@ -26,11 +26,6 @@
 #ifndef __CL_PLATFORM_H
 #define __CL_PLATFORM_H
 
-#ifdef __APPLE__
-    /* Contains #defines for AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER below */
-    #include <AvailabilityMacros.h>
-#endif
-
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -45,7 +40,9 @@ extern "C" {
     #define CL_CALLBACK
 #endif
 
-#ifdef __APPLE__
+#if defined(__APPLE__) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
+    #include <AvailabilityMacros.h>
+
     #define CL_EXTENSION_WEAK_LINK                  __attribute__((weak_import))
     #define CL_API_SUFFIX__VERSION_1_0              AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER
     #define CL_EXT_SUFFIX__VERSION_1_0              CL_EXTENSION_WEAK_LINK AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER
