More C++11 fixes.
authorCarl Hetherington <cth@carlh.net>
Mon, 11 Dec 2017 23:53:23 +0000 (23:53 +0000)
committerCarl Hetherington <cth@carlh.net>
Mon, 11 Dec 2017 23:53:23 +0000 (23:53 +0000)
cscript
wscript

diff --git a/cscript b/cscript
index 69aa855aaef8a5f98c09aed1007aae9f13823a69..1a32daac62fbf22bd974f80fb41ee1dda14fab59 100644 (file)
--- a/cscript
+++ b/cscript
@@ -308,6 +308,11 @@ def configure_options(target):
                 opt += ' --static-boost --static-xmlpp'
             elif target.version == '7':
                 opt += ' --workaround-gssapi'
+                # Centos 7 ships with glibmm 2.50.0 which requires C++11
+                # but its compiler (gcc 4.8.5) defaults to C++97.  Go figure.
+                # I worry that this will cause ABI problems but I don't have
+                # a better solution.
+                opt += ' --force-cpp11'
 
     # Build Windows debug versions with static linking as I think gdb works better then
     if target.debug and target.platform == 'windows':
diff --git a/wscript b/wscript
index 86452bc8833bc0128e13347e6aac0af2f9780a56..2321f1eedf9da7cf7e91d7b89bc98b86cbfe191f 100644 (file)
--- a/wscript
+++ b/wscript
@@ -50,6 +50,7 @@ def options(opt):
     opt.add_option('--static-sub',        action='store_true', default=False, help='link statically to libsub')
     opt.add_option('--static-curl',       action='store_true', default=False, help='link statically to libcurl')
     opt.add_option('--workaround-gssapi', action='store_true', default=False, help='link to gssapi_krb5')
+    opt.add_option('--force-cpp11',       action='store_true', default=False, help='force use of C++11')
 
 def configure(conf):
     conf.load('compiler_cxx')
@@ -83,6 +84,9 @@ def configure(conf):
                                        '-Wno-deprecated-declarations',
                                        '-D_FILE_OFFSET_BITS=64'])
 
+    if conf.options.force_cpp11:
+        conf.env.append_value('CXXFLAGS', ['-std=c++11', '-DBOOST_NO_CXX11_SCOPED_ENUMS'])
+
     gcc = conf.env['CC_VERSION']
     if int(gcc[0]) >= 4 and int(gcc[1]) > 1:
         conf.env.append_value('CXXFLAGS', ['-Wno-unused-result'])