From 9b30d0909995e4e44c84692a606f95bf464fdc79 Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Sat, 14 Jan 2017 18:40:58 +0000 Subject: [PATCH] [#1543] Fix missing C++11 flag for building python bindings * Extract the flags from CXX and put into CXXFLAGS which is passed into setup.py extra_compile_args. * Remove now redundant os.environ test in setup.py --- bindings/python/compile_flags.in | 2 +- bindings/python/setup.py | 7 ------- configure.ac | 2 ++ 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/bindings/python/compile_flags.in b/bindings/python/compile_flags.in index 701d89862..1de90eb8e 100644 --- a/bindings/python/compile_flags.in +++ b/bindings/python/compile_flags.in @@ -1 +1 @@ --I@top_srcdir@/include @COMPILETIME_OPTIONS@ @CPPFLAGS@ @BOOST_CPPFLAGS@ @OPENSSL_INCLUDES@ +-I@top_srcdir@/include @COMPILETIME_OPTIONS@ @CXXFLAGS@ @CPPFLAGS@ @BOOST_CPPFLAGS@ @OPENSSL_INCLUDES@ diff --git a/bindings/python/setup.py b/bindings/python/setup.py index ee00478dd..e7dc06c9c 100644 --- a/bindings/python/setup.py +++ b/bindings/python/setup.py @@ -112,13 +112,6 @@ else: extra_link = flags.parse(ldflags) extra_compile = flags.parse(extra_cmd) - # for some reason distutils uses the CC environment variable to determine - # the compiler to use for C++ - if 'CXX' in os.environ: - os.environ['CC'] = os.environ['CXX'] - if 'CXXFLAGS' in os.environ: - os.environ['CFLAGS'] = os.environ['CXXFLAGS'] - ext = [Extension('libtorrent', sources = source_list, language='c++', diff --git a/configure.ac b/configure.ac index 29080d8a3..f5275dcf3 100644 --- a/configure.ac +++ b/configure.ac @@ -123,6 +123,8 @@ AS_ECHO "Checking for boost libraries:" AX_BOOST_BASE([1.54]) AX_CXX_COMPILE_STDCXX_11([noext], [mandatory]) +# Also put any flags added to CXX into CXXFLAGS +CXXFLAGS="$CXXFLAGS $(echo "$CXX" | cut -d ' ' -f 2-)" AX_BOOST_SYSTEM() AS_IF([test -z "$BOOST_SYSTEM_LIB"],