From 819a9b0943c2c0c9850586a9489283312cf24d5c Mon Sep 17 00:00:00 2001 From: arvidn Date: Sun, 30 Jul 2017 09:36:27 -0700 Subject: [PATCH] remove configure.ac hack where supposed arguments are spliced out of CXX into CXXFLAGS --- bindings/python/compile_cmd.in | 1 + bindings/python/setup.py | 14 ++++++++++++++ configure.ac | 3 +-- 3 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 bindings/python/compile_cmd.in diff --git a/bindings/python/compile_cmd.in b/bindings/python/compile_cmd.in new file mode 100644 index 000000000..0af6791de --- /dev/null +++ b/bindings/python/compile_cmd.in @@ -0,0 +1 @@ +@CXX@ diff --git a/bindings/python/setup.py b/bindings/python/setup.py index 91e7a16df..73cb25942 100644 --- a/bindings/python/setup.py +++ b/bindings/python/setup.py @@ -64,6 +64,20 @@ try: except: ldflags = None +# this is to pull out compiler arguments from the CXX flags set up by the +# configure script. Specifically, the -std=c++11 flag is added to CXX and here +# we pull out everything starting from the first flag (i.e. something starting +# with a '-'). The actual command to call the compiler may be more than one +# word, for instance "ccache g++". +try: + with open('compile_cmd') as _file: + cmd = _file.read().split(' ') + while len(cmd) > 0 and not cmd[0].startswith('-'): + cmd = cmd[1:] + extra_cmd += ' '.join(cmd) +except: + pass + ext = None packages = None diff --git a/configure.ac b/configure.ac index 78989aad5..385d81ad7 100644 --- a/configure.ac +++ b/configure.ac @@ -123,8 +123,6 @@ 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"], @@ -552,6 +550,7 @@ AC_CONFIG_FILES( [bindings/python/Makefile] [bindings/python/link_flags] [bindings/python/compile_flags] + [bindings/python/compile_cmd] [libtorrent-rasterbar.pc] [libtorrent-rasterbar-cmake.pc] )