--- Portfile.orig	2008-04-01 15:19:41.000000000 -0600
+++ Portfile	2008-04-03 08:26:45.000000000 -0600
@@ -17,25 +17,46 @@
                     rmd160 2dbbcccd32986dcd66ce804c5e90ac6c949b71f6
 
 depends_lib         port:zlib
-patchfiles	        patch-commence.in patch-c-commence.in
+patchfiles	        patch-commence.in patch-c-commence.in \
+                    patch-fortran-commence.in patch-H5f90i.h
 
 use_parallel_build  yes
 configure.args      --enable-cxx --with-zlib=yes --with-szlib=no
-configure.ldflags   "-L${worksrcpath}/src/.libs -L${prefix}/lib"
+configure.ldflags   -L${worksrcpath}/src/.libs -L${prefix}/lib
 destroot.destdir    prefix=${destroot}${prefix}
 test.run            yes
 test.target         check
 
-variant szip description "Enable szip compression support" {
+variant szip description {Enable szip compression support} {
     configure.args-delete	--with-szlib=no
 	configure.args-append	--with-szlib=yes
 	depends_lib-append	    port:szip
 }
 
-variant gcc43 description "Use GCC 4.3 for compilation of HDF-5 - optimized for host machine (+ Fotran support)" {
+variant optimized description {Use GCC 4.3 for compilation of HDF-5 - optimized for host machine} {
     depends_build-append        port:gcc43
-    configure.args-append       --enable-fortran
     configure.compiler          macports-gcc-4.3
-    configure.cflags-append     "-ftree-vectorize -march=native -O3"
-    configure.cxxflags-append   "-ftree-vectorize -march=native -O3"
+    configure.cflags-delete     -O2
+    configure.cxxflags-delete   -O2
+    configure.cflags-append     -ftree-vectorize -march=native -O3
+    configure.cxxflags-append   -ftree-vectorize -march=native -O3
+    if { [variant_isset gcc43] } {
+        configure.fflags-delete     -O2
+        configure.fflags-append     -ftree-vectorize -march=native -O3
+    } else {
+        configure.fflags-delete     -O2
+        configure.fflags-append     -ftree-vectorize -O3
+    }
+}
+
+variant gcc43 description {compile the Fortran interface using GCC 4.3} conflicts g95 {
+    depends_build-append        port:gcc43
+    configure.args-append       --enable-fortran
+    configure.fc                ${prefix}/bin/gfortran-mp-4.3
+}
+
+variant g95 description {compile the Fortran interface using G95} conflicts gcc43 {
+    depends_build-append        port:g95
+    configure.args-append       --enable-fortran
+    configure.fc                ${prefix}/bin/g95
 }

