summaryrefslogtreecommitdiff
blob: 8a8033234713029ad6c525c046e9c30b56ea32f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
diff --git a/cctbx_sources/libtbx/SConscript b/cctbx_sources/libtbx/SConscript
index 16d22b6..f85b664 100644
--- a/cctbx_sources/libtbx/SConscript
+++ b/cctbx_sources/libtbx/SConscript
@@ -5,6 +5,7 @@ from libtbx.str_utils import show_string
 from libtbx.path import norm_join, full_command_path
 import platform
 import sys, os
+import SCons.Util
 
 if (hasattr(Environment, "Clone")):
   Environment.Copy = Environment.Clone # XXX backward compatibility 2008_03_30
@@ -132,9 +133,7 @@ if (env_etc.compiler == "unix_icpc"):
 static_exe = libtbx.env.build_options.static_exe
 
 def gcc_common_warn_options():
-  result = ["-Wall", "-Wno-sign-compare", "-Wno-unknown-pragmas"]
-  if (env_etc.gcc_version >= 40000):
-    result.append("-Winit-self")
+  result = [""]
   return result
 
 def enable_more_warnings(env):
@@ -355,16 +354,22 @@ else:
     cc = env_etc.compiler.replace("unix_", "")
     cxx = cc.replace("gcc", "g++")
     env_etc.gcc_version = libtbx.env_config.get_gcc_version(command_name=cc)
+#    linkerflags = os.environ.get("LDFLAGS")
+#    link_flags=env_etc.ldflags
+    link_flags=os.environ.get("LDFLAGS")
+    linker_options=SCons.Util.CLVar(os.environ['LDFLAGS'])
     env_base.Replace(
       CC=cc,
       SHCC=cc,
       CXX=cxx,
       LINK=cxx,
+      LINKFLAGS=linker_options,
       SHCXX=cxx,
       SHLINK=cxx,
       SHLIBSUFFIX=env_etc.shlibsuffix,
     )
-    env_etc.c_link = cc
+#    linkerflags = env_etc.ldflags
+#    env_etc.c_link = cc + " " + linkerflags
     env_etc.ccflags_base = [
       "-fPIC",
       "-fno-strict-aliasing"]
@@ -380,7 +385,7 @@ else:
       warn_options = gcc_common_warn_options() + ["-Werror"]
     env_etc.ccflags_base.extend(warn_options)
     if (libtbx.env.build_options.optimization):
-      opts = ["-DNDEBUG", "-O3", "-ffast-math"]
+      opts = ["-DNDEBUG"]
       if (env_etc.gcc_version >= 40300):
         opts.append("-fno-associative-math")
       opts.append("-ftrapping-math")
@@ -401,6 +406,7 @@ else:
       env_base.Prepend(LINKFLAGS=["-static"])
       static_exe = None
     env_etc.shlinkflags = ["-shared"]
+    env_etc.shlinkflags.append(linker_options)
     env_etc.shlinkflags_bpl = env_etc.shlinkflags
     if (libtbx.env.build_options.mode == "profile"):
       env_base.Prepend(LINKFLAGS=["-pg"])
diff --git a/cctbx_sources/libtbx/env_config.py b/cctbx_sources/libtbx/env_config.py
index ca510b9..68c58ea 100644
--- a/cctbx_sources/libtbx/env_config.py
+++ b/cctbx_sources/libtbx/env_config.py
@@ -1608,6 +1608,7 @@ class build_options:
       self.env_cxxflags = ""
       self.env_cflags = ""
       self.env_cppflags = ""
+      self.env_ldflags = ""
       flg = os.environ.get("CXXFLAGS")
       if flg is not None:
         self.env_cxxflags = flg
@@ -1617,6 +1618,9 @@ class build_options:
       flg = os.environ.get("CPPFLAGS")
       if flg is not None:
         self.env_cppflags = flg
+      flg = os.environ.get("LDFLAGS")
+      if flg is not None:
+        self.env_ldflags = flg
 
   def report(self, f=None):
     if (f is None): f = sys.stdout
@@ -1640,6 +1644,7 @@ class build_options:
       print >>f, "  CXXFLAGS = ", self.env_cxxflags
       print >>f, "  CFLAGS = ", self.env_cflags
       print >>f, "  CPPFLAGS = ", self.env_cppflags
+      print >>f, "  LDFLAGS = ", self.env_ldflags
 
 class include_registry: