[cig-commits] commit: Compile optimized by default

Mercurial hg at geodynamics.org
Mon May 14 15:26:22 PDT 2012


changeset:   113:1aeff3bcfc5d
tag:         tip
user:        Walter Landry <wlandry at caltech.edu>
date:        Mon May 14 15:26:10 2012 -0700
files:       wscript
description:
Compile optimized by default


diff -r 6d107ca62541 -r 1aeff3bcfc5d wscript
--- a/wscript	Mon May 14 15:25:42 2012 -0700
+++ b/wscript	Mon May 14 15:26:10 2012 -0700
@@ -53,6 +53,31 @@ def configure(cnf):
 def configure(cnf):
     cnf.load('compiler_c compiler_fc')
     
+    # Check for -zero or -finit-local-zero.  We check it first, before
+    # setting CFLAGS, because optimization can ruin this test.
+    frag="program main\n  INTEGER :: foo\n  call exit(foo)\n" + "end program main\n"
+    zero_flags=['-zero','-finit-local-zero']
+    if cnf.options.zero_flag:
+        zero_flags=[cnf.options.zero_flag]
+    found_zero=False
+    for flag in zero_flags:
+        try:
+            cnf.check_fc(fragment=frag,msg="Checking zero option " + flag,
+                         fcflags=flag,uselib_store='zero',execute=True)
+        except:
+            continue
+        else:
+            found_zero=True
+            break
+    if not found_zero:
+        cnf.fatal("Could not find an option for zero'ing initial values")
+
+    # We set the flags here 
+    if not cnf.env.CFLAGS:
+        cnf.env.CFLAGS=['-O3']
+    if not cnf.env.FCFLAGS:
+        cnf.env.FCFLAGS=['-O3']
+
     cnf.check_fortran()
 
     # Find Proj
@@ -149,25 +174,8 @@ def configure(cnf):
                      rpath=[cnf.options.mkl_libdir],
                      use='openmp', define_name='IMKL_FFT')
 
-    # Check for -zero or -finit-local-zero
-    frag="program main\n  INTEGER :: foo\n  call exit(foo)\n" + "end program main\n"
-    zero_flags=['-zero','-finit-local-zero']
-    if cnf.options.zero_flag:
-        zero_flags=[cnf.options.zero_flag]
-    found_zero=False
-    for flag in zero_flags:
-        try:
-            cnf.check_fc(fragment=frag,msg="Checking zero option " + flag,
-                         fcflags=flag,uselib_store='zero',execute=True)
-        except:
-            continue
-        else:
-            found_zero=True
-            break
-    if not found_zero:
-        cnf.fatal("Could not find an option for zero'ing initial values")
-
     # Check for C preprocessor option
+    frag="program main\n  INTEGER :: foo\n" + "end program main\n"
     cpp_flags=['-cpp','-Mpreprocess']
     if cnf.options.cpp_flag:
         cpp_flags=[cnf.options.cpp_flag]



More information about the CIG-COMMITS mailing list