Index: Portfile
===================================================================
--- Portfile	(revision 41385)
+++ Portfile	(working copy)
@@ -120,6 +120,43 @@
     configure.args-delete   --without-webkit
 }
 
+if {[variant_isset no_x11]} {
+    default_variants    +quartz
+}
+
+if {![variant_isset quartz]} {
+    default_variants    +x11
+}
+
+pre-fetch {
+    if {![variant_isset quartz] && ![variant_isset x11]} {
+        error "Either +x11 or +quartz is required"
+    }
+}
+
+pre-configure {
+    if {[file exists ${prefix}/lib/gtk-2.0/include/gdkconfig.h]} {
+        set gtk_quartz [exec grep -c GDK_WINDOWING_QUARTZ ${prefix}/lib/gtk-2.0/include/gdkconfig.h]
+        if {[variant_isset quartz] && ${gtk_quartz} == 0} {
+            error "+quartz variant selected, but gtk2+x11 is installed"
+        } elseif {[variant_isset x11] && ${gtk_quartz} == 1} {
+            error "+x11 variant selected, but gtk2+quartz is installed"
+        }
+    } else {
+        error "Cannot find gdkconfig.h"
+    }
+}
+
+variant quartz requires no_x11 conflicts x11 description {Enable Quartz rendering} {
+    configure.env-append   LDFLAGS="-framework Carbon"
+}
+
+variant x11 conflicts quartz description {Enable rendering in X11 (default)} {
+}
+
+variant no_x11 description {Same as +quartz} {
+}
+
 livecheck.check regex
 livecheck.url   http://www.gimp.org/downloads/
 livecheck.regex "gimp-(${branch}(?:\\.\\d+)*)${extract.suffix}"

