From 60ab24a26a334a542eeb2070af3850ec24502b33 Mon Sep 17 00:00:00 2001 From: Kevin Wang Date: Fri, 22 Mar 2019 10:04:17 +0800 Subject: [PATCH] Do not pass "-std=c99" to cpp compiler This fixes https://github.com/scrapinghub/python-crfsuite/issues/69 --- setup.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 4fba1aa..3bd1fce 100755 --- a/setup.py +++ b/setup.py @@ -26,9 +26,15 @@ class build_ext_check_gcc(build_ext): def build_extensions(self): c = self.compiler + + _compile = c._compile + + def c_compile(obj, src, ext, cc_args, extra_postargs, pp_opts): + cc_args = cc_args + ['-std=c99'] if src.endswith('.c') else cc_args + return _compile(obj, src, ext, cc_args, extra_postargs, pp_opts) + if c.compiler_type == 'unix' and 'gcc' in c.compiler: - for e in self.extensions: - e.extra_compile_args=['-std=c99'] + c._compile = c_compile elif self.compiler.compiler_type == "msvc": if sys.version_info[:2] < (3, 5): c.include_dirs.extend(['crfsuite/win32'])