sun
diff --git a/include/u.h b/include/u.h
index c5f5dcd..59446be 100644
--- a/include/u.h
+++ b/include/u.h
@@ -5,8 +5,14 @@
 #endif
 
 #define __BSD_VISIBLE 1 /* FreeBSD 5.x */
-#define __EXTENSIONS__ 1 /* SunOS */
-/* NOT USING #define __MAKECONTEXT_V2_SOURCE 1 / * SunOS */
+#if defined(__sun__)
+#	define __EXTENSIONS__ 1 /* SunOS */
+#	if defined(__SunOS5_6__) || defined(__SunOS5_7__) || defined(__SunOS5_8__)
+		/* NOT USING #define __MAKECONTEXT_V2_SOURCE 1 / * SunOS */
+#	else
+#		define __MAKECONTEXT_V2_SOURCE 1
+#	endif
+#endif
 #define _BSD_SOURCE 1
 #define _NETBSD_SOURCE 1	/* NetBSD */
 #define _SVID_SOURCE 1
diff --git a/src/libthread/thread.c b/src/libthread/thread.c
index 387b640..4d55b06 100644
--- a/src/libthread/thread.c
+++ b/src/libthread/thread.c
@@ -126,7 +126,7 @@
 	/* leave a few words open on both ends */
 	t->context.uc.uc_stack.ss_sp = t->stk+8;
 	t->context.uc.uc_stack.ss_size = t->stksize-64;
-#ifdef __sun__		/* sigh */
+#if defined(__sun__) && !defined(__MAKECONTEXT_V2_SOURCE)		/* sigh */
 	/* can avoid this with __MAKECONTEXT_V2_SOURCE but only on SunOS 5.9 */
 	t->context.uc.uc_stack.ss_sp = 
 		(char*)t->context.uc.uc_stack.ss_sp