summaryrefslogtreecommitdiff
path: root/numpy/distutils/unixccompiler.py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2015-01-06 13:28:01 -0500
committerCharles Harris <charlesr.harris@gmail.com>2015-01-06 13:28:01 -0500
commitd3e8d697abe3f50fce0a2b81526483ee533d36af (patch)
treed81a675681dc0a2fb59dd45784753b3853b81521 /numpy/distutils/unixccompiler.py
parentc6b8109a18e7b8e472b50713b4fc9a36fbb4de91 (diff)
parented83ae77ebd92e6008c4e133d1dead56d8f575fb (diff)
downloadnumpy-d3e8d697abe3f50fce0a2b81526483ee533d36af.tar.gz
Merge pull request #5425 from mbyt/ensure_OPT_environment_variable_is_read
BLD: ensure OPT build environment variable is read
Diffstat (limited to 'numpy/distutils/unixccompiler.py')
-rw-r--r--numpy/distutils/unixccompiler.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/numpy/distutils/unixccompiler.py b/numpy/distutils/unixccompiler.py
index 955407aa0..a92ccd3e7 100644
--- a/numpy/distutils/unixccompiler.py
+++ b/numpy/distutils/unixccompiler.py
@@ -30,6 +30,18 @@ def UnixCCompiler__compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts
# add flags for (almost) sane C++ handling
ccomp += ['-AA']
self.compiler_so = ccomp
+ # ensure OPT environment variable is read
+ if 'OPT' in os.environ:
+ from distutils.sysconfig import get_config_vars
+ opt = " ".join(os.environ['OPT'].split())
+ gcv_opt = " ".join(get_config_vars('OPT')[0].split())
+ ccomp_s = " ".join(self.compiler_so)
+ if opt not in ccomp_s:
+ ccomp_s = ccomp_s.replace(gcv_opt, opt)
+ self.compiler_so = ccomp_s.split()
+ llink_s = " ".join(self.linker_so)
+ if opt not in llink_s:
+ self.linker_so = llink_s.split() + opt.split()
display = '%s: %s' % (os.path.basename(self.compiler_so[0]), src)
try: