--- Portfile.orig	2008-11-10 18:55:47.000000000 -0500
+++ Portfile	2008-12-10 21:38:06.000000000 -0500
@@ -100,6 +100,7 @@
     --without-ipsepcola \
     --without-rsvg \
     --with-pangocairo \
+    --without-glitz \
     --with-freetype2 \
     --with-fontconfig \
     --without-gdk-pixbuf \
@@ -128,6 +129,13 @@
     --disable-ruby \
     --disable-tcl
 
+platform macosx {
+    if {${os.major} > 8} {
+        configure.args-delete --without-quartz
+        configure.args-append --with-quartz
+    }
+}
+
 variant guile description {Include Guile language bindings} {
     depends_lib-append \
         port:guile
@@ -150,6 +158,9 @@
         --disable-lua
     configure.args-append \
         --enable-lua
+    post-patch {
+        reinplace "s|/usr/lib\$LIBPOSTFIX/lua|${prefix}/lib\$LIBPOSTFIX/lua|g" ${worksrcpath}/configure
+    }
 }
 
 variant ocaml description {Include Objective Caml language bindings} {
@@ -162,11 +173,13 @@
         --disable-ocaml
     configure.args-append \
         --enable-ocaml
+    configure.cppflags-append \
+        -I${prefix}/lib/ocaml
 }
 
 variant perl description {Include PERL 5 language bindings} {
     depends_lib-append \
-        path:bin/perl:perl5.8
+        path:bin/perl:perl5
     depends_build-append \
         port:swig
     configure.args-delete \
@@ -174,11 +187,12 @@
         --disable-perl
     configure.args-append \
         --enable-perl
+    configure.perl  ${prefix}/bin/perl
 }
 
-variant php description {Include PHP 4 language bindings} {
+variant php description {Include PHP language bindings} {
     depends_lib-append \
-        port:php4
+        port:php5
     depends_build-append \
         port:swig
     configure.args-delete \
@@ -186,9 +200,14 @@
         --disable-php
     configure.args-append \
         --enable-php
+    post-patch {
+        reinplace "s|/usr/include/php|${prefix}/include/php|g" ${worksrcpath}/configure
+        reinplace "s|/usr/lib\${LIBPOSTFIX}/php|${prefix}/lib\${LIBPOSTFIX}/php|g" ${worksrcpath}/configure
+        reinplace "s|/usr/share/php|${prefix}/share/php|g" ${worksrcpath}/configure
+    }
 }
 
-variant python description {Include Python 2.4 language bindings} {
+variant python24 description {Include Python 2.4 language bindings} conflicts python25 python26 {
     depends_lib-append \
         port:python24
     depends_build-append \
@@ -198,6 +217,43 @@
         --disable-python
     configure.args-append \
         --enable-python
+    configure.python ${prefix}/bin/python2.4
+    # The configure script asks python where to install
+    # This doesn't work for 2.4 and 2.5 (see #16334)
+    post-patch {
+        reinplace "s|PYTHON_INSTALL_DIR=.*|PYTHON_INSTALL_DIR=${prefix}/lib/python2.4|" ${worksrcpath}/configure
+    }
+}
+
+variant python25 description {Include Python 2.5 language bindings} conflicts python24 python26 {
+    depends_lib-append \
+        port:python25
+    depends_build-append \
+        port:swig
+    configure.args-delete \
+        --disable-swig \
+        --disable-python
+    configure.args-append \
+        --enable-python
+    configure.python ${prefix}/bin/python2.5
+    # The configure script asks python where to install
+    # This doesn't work for 2.4 and 2.5 (see #16334)
+    post-patch {
+        reinplace "s|PYTHON_INSTALL_DIR=.*|PYTHON_INSTALL_DIR=${prefix}/lib/python2.5|" ${worksrcpath}/configure
+    }
+}
+
+variant python26 description {Include Python 2.6 language bindings} conflicts python24 python25 {
+    depends_lib-append \
+        port:python26
+    depends_build-append \
+        port:swig
+    configure.args-delete \
+        --disable-swig \
+        --disable-python
+    configure.args-append \
+        --enable-python
+    configure.python ${prefix}/bin/python2.6
 }
 
 variant ruby description {Include Ruby language bindings} {
@@ -224,6 +280,16 @@
         --enable-tcl
 }
 
+variant java description {Include Java language bindings} {
+    depends_build-append \
+        port:swig
+    configure.args-delete \
+        --disable-swig \
+        --disable-java
+    configure.args-append \
+        --enable-java
+}
+
 variant smyrna description {Include the Smyrna large graph viewer} {
     configure.args-delete \
         --without-smyrna \
@@ -238,7 +304,54 @@
     depends_lib-append \
         port:gtk2 \
         port:gtkglext \
-        port:libglade2
+        port:libglade2 \
+	port:gts
+}
+
+variant r description {Include R language bindings} {
+    depends_build-append \
+        port:swig
+    configure.args-delete \
+        --disable-swig \
+        --disable-r
+    configure.args-append \
+        --enable-r
+}
+
+variant rsvg description {enable the rsvg plugin} {
+    depends_lib-append \
+        port:librsvg
+    configure.args-delete \
+        --without-rsvg
+    configure.args-append \
+        --with-rsvg
+}
+
+variant gdk_pixbuf description {enable the gdk_pixbuf plugin} {
+    depends_lib-append \
+        port:gtk2
+    configure.args-delete \
+        --without-gdk-pixbuf
+    configure.args-append \
+        --with-gdk-pixbuf
+}
+
+variant glitz description {enable the incomplete glitz plugin} {
+    depends_lib-append \
+        port:glitz
+    configure.args-delete \
+        --without-glitz
+    configure.args-append \
+        --with-glitz
+}
+
+variant ming description {enable the incomplete ming plugin} {
+    depends_lib-append \
+        port:ming
+    configure.args-delete \
+        --without-ming
+    configure.args-append \
+        --with-ming
 }
 
 variant no_pangocairo description {Remove pangocairo support (no antialiased bitmapped output; no PDF output)} {
