[cig-commits] commit: Make configure automatically use c++
Mercurial
hg at geodynamics.org
Thu May 12 11:21:00 PDT 2011
changeset: 153:fc021c6f9bbb
tag: tip
user: Walter Landry <wlandry at caltech.edu>
date: Thu May 12 11:19:33 2011 -0700
files: Package.py cc.py checks.py config.py cxx.py packages/MPI.py packages/PETSc.py packages/PETScExt.py
description:
Make configure automatically use c++
diff -r e845d00fe2cf -r fc021c6f9bbb Package.py
--- a/Package.py Fri Nov 12 16:02:09 2010 -0800
+++ b/Package.py Thu May 12 11:19:33 2011 -0700
@@ -102,7 +102,7 @@ class Package:
'self.headers' as a list of headers to try to include in the
compile.
"""
- return conf.CheckLibWithHeader(None, self.headers, 'c',
+ return conf.CheckLibWithHeader(None, self.headers, 'c++',
autoadd=0)
def __call__(self, **kw):
diff -r e845d00fe2cf -r fc021c6f9bbb cc.py
--- a/cc.py Fri Nov 12 16:02:09 2010 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-import checks
-
-def apply_cc(env, cc):
- if cc in ['gcc']:
- pass
- #env.Tool(cc)
- elif cc == 'xlc':
- pass
-
- conf = env.Configure(
- custom_tests={
- 'CheckCCFixed': checks.CheckCCFixed
- }
- )
- if not conf.CheckCCFixed():
- env.Exit()
- return conf.Finish()
diff -r e845d00fe2cf -r fc021c6f9bbb checks.py
--- a/checks.py Fri Nov 12 16:02:09 2010 -0800
+++ b/checks.py Thu May 12 11:19:33 2011 -0700
@@ -42,8 +42,8 @@ def CheckLibsWithHeader(context, libs, h
context.did_show_result = 1
return not res
-def CheckCCFixed(context):
- res = SCons.Conftest.CheckCC(context)
+def CheckCXXFixed(context):
+ res = SCons.Conftest.CheckCXX(context)
context.did_show_result = 1
return not res
@@ -66,7 +66,7 @@ def Conftest_CheckSharedLib(context, lib
"language" should be "C" or "C++" and is used to select the compiler.
Default is "C".
Note that this uses the current value of compiler and linker flags, make
- sure $CFLAGS, $CPPFLAGS and $LIBS are set correctly.
+ sure $CXXFLAGS, $CPPFLAGS and $LIBS are set correctly.
Returns an empty string for success, an error message for failure.
"""
# Include "confdefs.h" first, so that the header can use HAVE_HEADER_H.
diff -r e845d00fe2cf -r fc021c6f9bbb config.py
--- a/config.py Fri Nov 12 16:02:09 2010 -0800
+++ b/config.py Thu May 12 11:19:33 2011 -0700
@@ -40,7 +40,7 @@ def SaveConfig(env, filename='config.cfg
out = open(filename, 'w')
opts = [o[1] for o in env['cfg_options']] + [
'CPPPATH', 'LIBPATH', 'RPATH', 'LIBS', 'CPPDEFINES',
- 'CFLAGS', 'CCFLAGS', 'FRAMEWORKS',
+ 'CXXFLAGS', 'FRAMEWORKS',
] + env.get('save_vars', [])
for o in opts:
v = env.get(o, None)
@@ -51,9 +51,9 @@ def PrintSummary(env):
def PrintSummary(env):
if not (GetOption('help') or GetOption('clean')):
print ''
- print 'C compiler: %s'%repr(env['CC'])
- print 'C flags: %s'%env.subst('$CFLAGS $CCFLAGS')
- print 'C preprocessor: %s'%repr(env.get('CPPDEFINES'))
+ print 'C++ compiler: %s'%repr(env['CXX'])
+ print 'C++ flags: %s'%env.subst('$CXXFLAGS')
+ print 'C++ preprocessor: %s'%repr(env.get('CPPDEFINES'))
print ''
def generate(env, options=[]):
diff -r e845d00fe2cf -r fc021c6f9bbb cxx.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/cxx.py Thu May 12 11:19:33 2011 -0700
@@ -0,0 +1,16 @@
+import checks
+
+def apply_cxx(env, cxx):
+ if cxx in ['mpicxx', 'g++']:
+ pass
+ elif cxx == 'xlc':
+ pass
+
+ conf = env.Configure(
+ custom_tests={
+ 'CheckCXXFixed': checks.CheckCXXFixed
+ }
+ )
+ if not conf.CheckCXXFixed():
+ env.Exit()
+ return conf.Finish()
diff -r e845d00fe2cf -r fc021c6f9bbb packages/MPI.py
--- a/packages/MPI.py Fri Nov 12 16:02:09 2010 -0800
+++ b/packages/MPI.py Thu May 12 11:19:33 2011 -0700
@@ -14,7 +14,7 @@ class MPI(Package):
def gen_envs(self, loc):
# If we've been given an MPI compiler just try that.
- if os.path.basename(self.env['CC']) in ['mpicc', 'mpicxx']:
+ if os.path.basename(self.env['CXX']) in ['mpicxx', 'mpic++', 'mpiCC']:
yield self.env.Clone()
return
@@ -26,7 +26,7 @@ class MPI(Package):
self.get_option('mpi_lib_dir') is None and \
self.get_option('mpi_libs') is None:
env = self.env.Clone()
- env['CC'] = 'mpicc'
+ env['CXX'] = 'mpicxx'
yield env
for env in Package.gen_envs(self, loc):
@@ -69,4 +69,4 @@ class MPI(Package):
def check(self, conf, env):
- return conf.CheckLibWithHeader(None, 'mpi.h', 'c', call='MPI_Finalize();', autoadd=0)
+ return conf.CheckLibWithHeader(None, 'mpi.h', 'c++', call='MPI_Finalize();', autoadd=0)
diff -r e845d00fe2cf -r fc021c6f9bbb packages/PETSc.py
--- a/packages/PETSc.py Fri Nov 12 16:02:09 2010 -0800
+++ b/packages/PETSc.py Thu May 12 11:19:33 2011 -0700
@@ -130,7 +130,7 @@ class PETSc(Package):
if not conf.CheckLibWithHeader(None,
['mpi.h', 'petsc.h', 'petscvec.h', 'petscmat.h',
- 'petscksp.h', 'petscsnes.h'], 'c',
+ 'petscksp.h', 'petscsnes.h'], 'c++',
call=call,
autoadd=0):
return False
@@ -139,7 +139,7 @@ class PETSc(Package):
if env['shared_libs'] and \
not conf.CheckSharedLibWithHeader(None,
['mpi.h', 'petsc.h', 'petscvec.h', 'petscmat.h',
- 'petscksp.h', 'petscsnes.h'], 'c',
+ 'petscksp.h', 'petscsnes.h'], 'c++',
call=call,
autoadd=0):
print '\n\nThe PETSc located in:'
diff -r e845d00fe2cf -r fc021c6f9bbb packages/PETScExt.py
--- a/packages/PETScExt.py Fri Nov 12 16:02:09 2010 -0800
+++ b/packages/PETScExt.py Thu May 12 11:19:33 2011 -0700
@@ -47,5 +47,5 @@ class PETScExt(Package):
['mpi.h', 'petsc.h', 'petscvec.h', 'petscmat.h',
'petscksp.h', 'petscsnes.h',
'petscext.h', 'petscext_vec.h', 'petscext_mat.h',
- 'petscext_ksp.h', 'petscext_snes.h'], 'c',
+ 'petscext_ksp.h', 'petscext_snes.h'], 'c++',
autoadd=0)
More information about the CIG-COMMITS
mailing list