-#define _XOPEN_SOURCE 600 /**< make limits.h #define IOV_MAX */
-#define __EXTENSIONS__ 1 /**< make Solaris netinet/in.h know IPv6 */
+#ifdef IRCU_SOLARIS
+/* Solaris requires C99 support for SUSv3, but C99 support breaks other
+ * parts of the build. So fall back to SUSv2, but request IPv6 support
+ * by defining __EXTENSIONS__.
+ */
+#define _XOPEN_SOURCE 500
+#define __EXTENSIONS__ 1
+#elif defined(__FreeBSD__) && __FreeBSD__ >= 5
+/* FreeBSD 6.0 requires SUSv3 to support IPv6 -- but if you ask for
+ * that specifically (by defining _XOPEN_SOURCE to anything at all),
+ * they cleverly hide IPPROTO_IPV6. If you don't ask for anything,
+ * they give you everything.
+ */
+#else
+#define _XOPEN_SOURCE 600
+#endif