--- Portfile.orig	2011-02-04 10:17:53.000000000 +0100
+++ Portfile	2011-02-05 09:57:46.000000000 +0100
@@ -5,11 +5,11 @@
 
 categories          math
 name                atlas
-version             3.8.3
-revision            4
+version             3.9.33
+#revision            4
 
 # additional versions
-set lapackversion   3.2.2
+set lapackversion   3.3.0
 set lapackname      lapack
 set atlasdist       ${name}${version}.tar.bz2
 set lapackdist      ${lapackname}-${lapackversion}.tgz
@@ -30,18 +30,16 @@
 distfiles           ${atlasdist}:atlas \
                     ${lapackdist}:lapack
 
-patchfiles          patch-ATL_AVgcc-fix.diff \
-                    patch-archinfo_freebsd.c.diff \
-                    patch-SpewMakeInc.c.diff
-
-checksums           $atlasdist \
-                    md5     6c13be94a87178e7582111c08e9503bc \
-                    sha1    c7546210df4796457d9e96a00444adc4c0f2e77f \
-                    rmd160  0425e630d9d0c5b7aae81427a41b7eaa18447e90 \
-                    $lapackdist \
-                    md5     10832891c9e8100f81108c1ec7da0da4 \
-                    sha1    a434c45932f6affb654b3abde21dd669f5751633 \
-                    rmd160  62426f2f360b2c438853ee6230da08f1f23dfd5b
+patchfiles          patch-SpewMakeInc.c.diff
+
+checksums			atlas3.9.33.tar.bz2 \
+        			md5     8f518f386b69bdfd1f5061704aa196f9 \
+                    sha1    8dbc6015318458ff7abd178964d90350a18ce9fa \
+                    rmd160  810033a9f81c11994a5221dc268e3da84e2367d7 \
+                	lapack-3.3.0.tgz \
+                    md5     84213fca70936cc5f1b59a7b1bf71697 \
+                    sha1    4f0b103da52110e7f60d1d7676727103aca9785e \
+                	rmd160  cc72e7c93ab13464fd892d684b00b910cbbd3b3e
 
 
 use_parallel_build  no
@@ -99,16 +97,33 @@
                     -C dk ${configure.cc} \
                     -C sk ${configure.cc} \
                     --cc=${configure.cc} \
+                    --with-netlib-lapack-tarfile=${distpath}/${lapackdist} \
+                    -O 12 \
                     -b ${my_arch} \
                     -Fa alg -fPIC
 
 if { [variant_isset universal] } {
     configure.universal_args-delete --disable-dependency-tracking
-    configure.args-delete -b ${my_arch}
-    lappend merger_configure_args(ppc)     -b 32
-    lappend merger_configure_args(ppc64)   -b 64
-    lappend merger_configure_args(i386)    -b 32
-    lappend merger_configure_args(x86_64)  -b 64
+    configure.args-delete	--cc=${configure.cc} \
+    						-b ${my_arch} \
+    						-Fa alg -fPIC
+                    
+    lappend merger_configure_args(ppc)		--cc='${configure.cc} -m32' \
+    										-b 32 \
+    										-s gas_ppc \
+    										-Fa alg '-fPIC -m32'
+    lappend merger_configure_args(ppc64)	--cc='${configure.cc} -m64' \
+    										-b 64 \
+    										-s gas_ppc \
+    										-Fa alg '-fPIC -m64'
+    lappend merger_configure_args(i386) 	--cc='${configure.cc} -m32' \
+    										-b 32 \
+    										-s gas_x86_32 \
+    										-Fa alg '-fPIC -m32'
+    lappend merger_configure_args(x86_64) 	--cc='${configure.cc} -m64' \
+    										-b 64 \
+    										-s gas_x86_64 \
+    										-Fa alg '-fPIC -m64'
 } else {
     lappend merger_configure_args(ppc)
     lappend merger_configure_args(ppc64)
@@ -118,7 +133,6 @@
 
 build.env-append    "CC=${configure.cc} CXX=${configure.cxx}"
 
-
 # we are configuring from the build directory
 configure.dir       ${workpath}/${name}-${version}/build
 configure.cmd       ../configure
@@ -130,21 +144,17 @@
     system "cd ${workpath} && bunzip2 -dc ${distpath}/${atlasdist} | \
          gnutar --no-same-owner -xf -"
     system "mv ${workpath}/ATLAS ${workpath}/${name}-${version}"
-
-    # extract lapack
-    system "cd ${workpath} && gunzip -dc ${distpath}/${lapackdist} | \
-         gnutar --no-same-owner -xf -"
 }
 
 post-patch {
-    reinplace "s|__MACPORTS_GCC__|${configure.cc}|g" ${workpath}/${name}-${version}/CONFIG/src/SpewMakeInc.c
+    	reinplace "s|__MACPORTS_GCC__|${configure.cc}|g" \
+    		${workpath}/${name}-${version}/CONFIG/src/SpewMakeInc.c
 }
 
 pre-configure {
     if { [variant_isset universal] } {
         foreach arch ${universal_archs_to_use} {
             copy ${workpath}/${name}-${version} ${workpath}/${name}-${version}-${arch}
-            copy ${workpath}/${lapackname}-${lapackversion} ${workpath}/${lapackname}-${lapackversion}-${arch}
         }
     }
 
@@ -169,71 +179,14 @@
 
     foreach arch ${archs} {
 
-    # first do a 'fake configure' of atlas so we get optimized lapack libraries
-    ui_debug "performing fake configure of atlas for optimized lapack"
-    # atlas docs: 3.1.2
-    if { ! [variant_isset universal] } {
+    	if { ! [variant_isset universal] } {
         set atlas_path  ${workpath}/${name}-${version}
-        set lapack_path ${workpath}/${lapackname}-${lapackversion}
-    } else {
+    	} else {
         set atlas_path ${workpath}/${name}-${version}-${arch}
-        set lapack_path ${workpath}/${lapackname}-${lapackversion}-${arch}
-    }
-    ui_debug "Clean out old temp directory if exists"
-    file delete -force ${atlas_path}/temp
-    file mkdir ${atlas_path}/temp
-    ui_debug "Assembled Command: '${configure.cmd} ${configure.args} $merger_configure_args(${arch})"
-    system "cd ${atlas_path}/temp && \
-            ${configure.cmd} ${configure.args} $merger_configure_args(${arch})"
-
-    # Get the F77FLAGS
-    set atlas_f77    [join [lrange [split [exec grep "F77 = " $atlas_path/temp/Make.inc     ] =] 1 end] =]
-    ui_debug "Found atlas F77: ${atlas_f77}"
-
-    set atlas_fflags [join [lrange [split [exec grep "F77FLAGS = " $atlas_path/temp/Make.inc] =] 1 end] =]
-    ui_debug "Found atlas F77FLAGS: ${atlas_fflags}"
-
-    ui_debug "Remove the old test configure directory"
-    file delete -force ${atlas_path}/temp
-
-    # compile lapack
-    system "cd ${lapack_path} && \
-            cp INSTALL/make.inc.gfortran make.inc"
-    reinplace "s|gfortran|${atlas_f77}|" \
-           ${lapack_path}/make.inc
-    reinplace "s|OPTS     = -O2|OPTS = ${atlas_fflags}|" \
-           ${lapack_path}/make.inc
-
-    if { ! [variant_isset universal] } {
-        reinplace "s|NOOPT    = -O0|NOOPT = -O2 -m${my_arch}|" \
-               ${lapack_path}/make.inc
-    } else {
-        if { ${arch}=="i386" || ${arch}=="ppc" } {
-            reinplace "s|NOOPT    = -O0|NOOPT = -O2 -m32|" \
-                   ${lapack_path}/make.inc
-        } else {
-            reinplace "s|NOOPT    = -O0|NOOPT = -O2 -m64|" \
-                   ${lapack_path}/make.inc
-        }
-    }
-
-    reinplace "s|PLAT = _LINUX|PLAT = _darwin|" \
-           ${lapack_path}/make.inc
-
-    reinplace "s|LOADOPTS =|LOADOPTS = ${atlas_fflags}|" \
-           ${lapack_path}/make.inc
-
-    system "cd ${lapack_path} && make lib"
-
-    # create a build directory for atlas
-    file mkdir ${atlas_path}/build
-
-    if { ! [variant_isset universal] } {
-        configure.args-append --with-netlib-lapack=${lapack_path}/lapack_darwin.a
-    } else {
-        lappend merger_configure_args(${arch}) --with-netlib-lapack=${lapack_path}/lapack_darwin.a
-    }
-}
+    	}
+    	
+    	file mkdir ${atlas_path}/build
+	}
 }
 
 post-configure {
