--- node.h.orig	2008-07-07 15:17:24.000000000 +0900
+++ node.h	2008-11-06 00:53:06.000000000 +0900
@@ -375,9 +375,17 @@
 void rb_add_event_hook _((rb_event_hook_func_t,rb_event_t));
 int rb_remove_event_hook _((rb_event_hook_func_t));
 
-#if defined(HAVE_GETCONTEXT) && defined(HAVE_SETCONTEXT)
-#include <ucontext.h>
-#define USE_CONTEXT
+#if defined(HAVE_GETCONTEXT) && defined(HAVE_SETCONTEXT) 
+# if defined(__APPLE__)
+#   include <AvailabilityMacros.h>
+#   if MAC_OS_X_VERSION_MAX_ALLOWED <= 1040
+#     include <ucontext.h>
+#     define USE_CONTEXT
+#   endif
+# else
+#   include <ucontext.h>
+#   define USE_CONTEXT
+# endif
 #endif
 #include <setjmp.h>
 #include "st.h"
