summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2017-12-09 22:44:28 +0000
committerCarl Hetherington <cth@carlh.net>2017-12-09 22:44:28 +0000
commit4602bc14a9b229cf2a2e14ad2cd5d3a48bea2747 (patch)
tree0e8aeb9ffcc82891fb9d7a9ac3519b0c39c5853f
parenteeb0a8a6d9a14876d5d8c14cd75196cb3639b86c (diff)
Tidy up c++11 stuff.
-rw-r--r--cscript11
-rw-r--r--wscript10
2 files changed, 12 insertions, 9 deletions
diff --git a/cscript b/cscript
index 94a26d1..612ded1 100644
--- a/cscript
+++ b/cscript
@@ -9,8 +9,15 @@ def build(target, options):
cmd += ' --static'
if target.distro == 'centos':
cmd += ' --disable-tests'
- if (target.distro == 'debian' and target.version == 'unstable' or target.distro == 'fedora' and target.version == '23'):
- target.append_with_space('CXXFLAGS', '-std=c++11')
+ if target.version == '7':
+ # 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.
+ cmd += ' --force-cpp11'
+ if target.distro == 'mageia' and target.version == '6':
+ # Mageia 6 pulls the same stunt except it's libxml++ that requires C++11
+ cmd += ' --force-cpp11'
if target.debug:
cmd += ' --enable-debug'
if target.platform == 'windows':
diff --git a/wscript b/wscript
index b763c86..ea0f8d5 100644
--- a/wscript
+++ b/wscript
@@ -51,10 +51,13 @@ def options(opt):
opt.add_option('--static', action='store_true', default=False, help='build libsub statically and link statically to cxml and dcp')
opt.add_option('--target-windows', action='store_true', default=False, help='set up to do a cross-compile to make a Windows package')
opt.add_option('--disable-tests', action='store_true', default=False, help='disable building of tests')
+ opt.add_option('--force-cpp11', action='store_true', default=False, help='force use of C++11')
def configure(conf):
conf.load('compiler_cxx')
conf.env.append_value('CXXFLAGS', ['-Wall', '-Wextra', '-D_FILE_OFFSET_BITS=64', '-D__STDC_FORMAT_MACROS'])
+ if conf.options.force_cpp11:
+ conf.env.append_value('CXXFLAGS', ['-std=c++11', '-DBOOST_NO_CXX11_SCOPED_ENUMS'])
conf.env.append_value('CXXFLAGS', ['-DLIBSUB_VERSION="%s"' % VERSION])
conf.env.ENABLE_DEBUG = conf.options.enable_debug
@@ -143,13 +146,6 @@ def configure(conf):
if not conf.env.DISABLE_TESTS:
conf.recurse('test')
- # libxml++ 2.39.1 and later must be built with -std=c++11
- libxmlpp_version = conf.cmd_and_log(['pkg-config', '--modversion', 'libxml++-2.6'], output=Context.STDOUT, quiet=Context.BOTH)
- s = libxmlpp_version.split('.')
- v = (int(s[0]) << 16) | (int(s[1]) << 8) | int(s[2])
- if v >= 0x022701:
- conf.env.append_value('CXXFLAGS', '-std=c++11')
-
def build(bld):
create_version_cc(bld, VERSION)