Description: C compiler flags:
 1. Don't duplicate /usr/local in gcc search paths.
    FIXME: Not sure why.
 2. Respect CPPFLAGS

Forwarded: no

--- a/setup.py
+++ b/setup.py
@@ -461,8 +461,10 @@ class PyBuildExt(build_ext):
         # unfortunately, distutils doesn't let us provide separate C and C++
         # compilers
         if compiler is not None:
-            (ccshared,cflags) = sysconfig.get_config_vars('CCSHARED','CFLAGS')
-            args['compiler_so'] = compiler + ' ' + ccshared + ' ' + cflags
+            (ccshared, cppflags, cflags) = \
+                sysconfig.get_config_vars('CCSHARED', 'CPPFLAGS', 'CFLAGS')
+            cppflags = ' '.join([f for f in cppflags.split() if not f.startswith('-I')])
+            args['compiler_so'] = compiler + ' ' + ccshared + ' ' + cppflags + ' ' + cflags
         self.compiler.set_executables(**args)
 
     def build_extensions(self):
@@ -807,12 +809,7 @@ class PyBuildExt(build_ext):
                         add_dir_to_list(dir_list, directory)
 
     def configure_compiler(self):
-        # Ensure that /usr/local is always used, but the local build
-        # directories (i.e. '.' and 'Include') must be first.  See issue
-        # 10520.
-        if not CROSS_COMPILING:
-            add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
-            add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
+        # On Debian /usr/local is always used, so we don't include it twice
         # only change this for cross builds for 3.3, issues on Mageia
         if CROSS_COMPILING:
             self.add_cross_compiling_paths()
