Revision
76535
Author
jmr@macports.org
Date
2011-02-27 07:19:04 -0800 (Sun, 27 Feb 2011)

Log Message

gmp: give configure a hand with x86_64 CPUs it doesn't recognise (#28557)

Modified Paths

Diff

Modified: trunk/dports/devel/gmp/Portfile (76534 => 76535)


--- trunk/dports/devel/gmp/Portfile	2011-02-27 14:39:20 UTC (rev 76534)
+++ trunk/dports/devel/gmp/Portfile	2011-02-27 15:19:04 UTC (rev 76535)
@@ -43,6 +43,7 @@
 # On PowerPC machines, CFLAGS must be empty to get -force_cpusubtype_ALL.
 configure.cc_archflags
 configure.cxx_archflags
+configure.ld_archflags
 configure.cflags
 configure.cxxflags
 configure.pipe  no
@@ -62,10 +63,14 @@
 if {![variant_isset universal]} {
     if {${build_arch} == "x86_64"} {
         configure.env   ABI=64
-        #if {${os.platform} == "darwin"} {
-            ## fails to automatically detect that i7 is x86_64 capable
-            #configure.args-append --build=core2-apple-darwin${os.major}
-        #}
+        # fails to correctly detect some x86_64 models (e.g. Sandy Bridge)
+        pre-configure {
+            set build_triplet [split [exec ${worksrcpath}/config.guess] -]
+            set build_cpu [lindex $build_triplet 0]
+            if {$build_cpu != "core2" && $build_cpu != "corei"} {
+                configure.args-append --build=x86_64-[join [lrange $build_triplet 1 end] -]
+            }
+        }
     } elseif {${build_arch} == "ppc64"} {
         configure.env   ABI=mode64
     } else {