diff --git a/src/c_wrapper/event.cpp b/src/c_wrapper/event.cpp
index 6faf2b58dd7c076ae929487341626fe27ed647ad..316b08108c69f388d753a777472f37a6c7cd3a45 100644
--- a/src/c_wrapper/event.cpp
+++ b/src/c_wrapper/event.cpp
@@ -85,7 +85,7 @@ event::release_private() noexcept
         delete m_p;
         return;
     }
-#if PYOPENCL_CL_VERSION >= 0x1010
+#if PYOPENCL_CL_VERSION >= 0x1010 && defined(PYOPENCL_HAVE_EVENT_SET_CALLBACK)
     if (release_private_use_cb(this)) {
         try {
             event_private *p = m_p;
@@ -221,7 +221,7 @@ event__wait(clobj_t evt)
         });
 }
 
-#if PYOPENCL_CL_VERSION >= 0x1010
+#if PYOPENCL_CL_VERSION >= 0x1010 && defined(PYOPENCL_HAVE_EVENT_SET_CALLBACK)
 
 error*
 event__set_callback(clobj_t _evt, cl_int type, void *pyobj)
diff --git a/src/c_wrapper/event.h b/src/c_wrapper/event.h
index 5c31af4a2139a21d8dd6c93aaadfb481c24176c1..c6d0dd4b62e43d5b48149760ef4ef099360432b0 100644
--- a/src/c_wrapper/event.h
+++ b/src/c_wrapper/event.h
@@ -31,7 +31,7 @@ public:
     PYOPENCL_USE_RESULT generic_info
     get_profiling_info(cl_profiling_info param) const;
     void wait() const;
-#if PYOPENCL_CL_VERSION >= 0x1010
+#if PYOPENCL_CL_VERSION >= 0x1010 && defined(PYOPENCL_HAVE_EVENT_SET_CALLBACK)
     template<typename Func>
     PYOPENCL_INLINE void
     set_callback(cl_int type, Func &&_func)
diff --git a/src/c_wrapper/wrap_cl.h b/src/c_wrapper/wrap_cl.h
index 576de6c9ff637dd11b73314391c2155e9e6f124c..537c56b02a6ad21bc8ae3ac683dbdbc15a780b49 100644
--- a/src/c_wrapper/wrap_cl.h
+++ b/src/c_wrapper/wrap_cl.h
@@ -34,6 +34,7 @@
 #define strdup _strdup
 #else
 #include <unistd.h>
+#define PYOPENCL_HAVE_EVENT_SET_CALLBACK
 #endif
 
 #ifdef HAVE_GL