--- /MacPorts/var/macports/sources/rsync.macports.org/release/tarballs/ports/math/R/Portfile	2013-08-28 14:30:18.000000000 -0700
+++ Portfile	2013-08-29 13:56:07.000000000 -0700
@@ -1,6 +1,7 @@
 # $Id: Portfile 110215 2013-08-28 21:26:41Z jeremyhu@macports.org $
 
 PortSystem 1.0
+PortGroup active_variants 1.1
 
 set major 3
 set minor 0
@@ -8,7 +9,7 @@
 
 name                        R
 version                     ${major}.${minor}.${point}
-revision                    2
+revision                    3
 categories                  math science
 maintainers                 me.com:kjell.konis
 license                     {GPL-2 GPL-3}
@@ -53,7 +54,7 @@
 configure.args              --enable-R-framework \
                             --enable-R-shlib \
                             --enable-BLAS-shlib \
-                            --enable-openmp \
+                            --disable-openmp \
                             --with-readline \
                             --with-aqua \
                             --without-tcltk \
@@ -69,17 +70,6 @@
     configure.cflags-append -flax-vector-conversions
 }
 
-variant cairo requires x11 description {Use cairo and pango} {
-    depends_lib-append      path:lib/pkgconfig/cairo.pc:cairo \
-                            path:lib/pkgconfig/pango.pc:pango \
-                            path:lib/pkgconfig/glib-2.0.pc:glib2 \
-                            port:freetype \
-                            port:fontconfig \
-                            port:gettext
-    configure.args-delete   --without-cairo
-    configure.args-append   --with-cairo
-}
-
 variant accelerate conflicts builtin_lapack description {build using the BLAS and Lapack in Apple's Accelerate framework} {
     configure.args-append   --with-blas="-framework vecLib" \
                             --with-lapack="-framework vecLib"
@@ -89,17 +79,30 @@
     configure.args-append   --without-blas --without-lapack
 }
 
+variant cairo requires x11 description {Include cairo support in R's x11 graphics device} {
+    depends_lib-append      path:lib/pkgconfig/cairo.pc:cairo \
+                            path:lib/pkgconfig/pango.pc:pango \
+                            path:lib/pkgconfig/glib-2.0.pc:glib2 \
+                            port:freetype \
+                            port:fontconfig \
+                            port:gettext 
+    require_active_variants path:lib/pkgconfig/cairo.pc:cairo x11
+    require_active_variants path:lib/pkgconfig/pango.pc:pango x11
+    configure.args-delete   --without-cairo
+    configure.args-append   --with-cairo
+}
+
 variant debug description {build with debug symbols} {
     configure.optflags-append -g
 }
 
 set gcc_versions {4.5 4.6 4.7 4.8 4.9}
-set default_fortran_variant +gcc48
+set default_fortran_variant +gfortran48
 
 foreach ver ${gcc_versions} {
     set ver_no_dot [join [split ${ver} "."] ""]
 
-    set variant_line {variant gcc${ver_no_dot} description "build with gfortran from gcc${ver_no_dot}"}
+    set variant_line {variant gfortran${ver_no_dot} description "build with gfortran from gcc${ver_no_dot}"}
 
     foreach over ${gcc_versions} {
         if {${ver} == ${over}} {
@@ -107,14 +110,14 @@
         }
 
         set over_no_dot [join [split ${over} "."] ""]
-        append variant_line " conflicts gcc${over_no_dot}"
+        append variant_line " conflicts gfortran${over_no_dot}"
     }
     append variant_line { {}}
 
     eval $variant_line
 
-    if {[variant_isset gcc${ver_no_dot}]} {
-        if {${default_fortran_variant} != "+gcc${ver_no_dot}"} {
+    if {[variant_isset gfortran${ver_no_dot}]} {
+        if {${default_fortran_variant} != "+gfortran${ver_no_dot}"} {
             set default_fortran_variant ""
         }
     }
@@ -127,7 +130,7 @@
 foreach ver ${gcc_versions} {
     set ver_no_dot [join [split ${ver} "."] ""]
 
-    if {[variant_isset gcc${ver_no_dot}]} {
+    if {[variant_isset gfortran${ver_no_dot}]} {
         depends_lib-append path:lib/libgcc/libgcc_s.1.dylib:libgcc
         depends_build-append port:gcc${ver_no_dot}
 
@@ -147,6 +150,7 @@
                             port:tk \
                             port:xorg-libXScrnSaver \
                             port:xorg-libXext
+    require_active_variants path:lib/pkgconfig/tk.pc:tk x11
     configure.args-delete   --without-tcltk
     configure.args-append   --with-tcltk \
                             --with-tcl-config=${prefix}/lib/tclConfig.sh \
@@ -170,7 +174,11 @@
                             --x-lib=${prefix}/lib
 }
 
-default_variants +cairo +recommended +x11
+default_variants +recommended +x11
+
+if {[variant_isset x11]} {
+    default_variants-append +cairo
+}
 
 if {![variant_isset accelerate] && ![variant_isset builtin_lapack]} {
     default_variants-append +accelerate
@@ -227,3 +235,6 @@
 livecheck.type      regex
 livecheck.url       [lindex ${master_sites} 0]
 livecheck.regex     >${name}-(\[0-9.\]+)${extract.suffix}<
+
+
+
