Without this patch, the C++ source files to the Python extension modules are
compiled with $CC. This doesn't result in any compile failures, but the name
mangling seems not to work, such that the resulting libraries have undefined
symbols. It is tricky to trace through how the Python extension-building code
chooses what compilers to use, but as far as I can tell, there is no way to
get it to compile the source files with the C++ compiler. Therefore we hackily
just override the settings to make the C compiler *be* the C++ compiler.

The other problem is that the healpix C++ code can add `-std=gnu++11` to the
C++ compiler flags, which can also cause linking issues due to ABI
incompatibilities between that mode and the default in older clangs. We hack
around to add the necessary flag in to the Python extension module compilation
if needed.

diff --git a/setup.py b/setup.py
index afce7e8..c15390c 100755
--- a/setup.py
+++ b/setup.py
@@ -298,7 +298,7 @@ class build_external_clib(build_clib):
             )
 
             # Run make install.
-            cmd = ["make", "install"]
+            cmd = ["make", "install", "V=1"]
             log.info("%s", " ".join(cmd))
             check_call(cmd, cwd=build_temp, env=env)
 
@@ -409,6 +409,12 @@ class custom_build_ext(build_ext):
         # If we were asked to build any C/C++ libraries, add the directory
         # where we built them to the include path. (It's already on the library
         # path.)
+        import os
+        os.environ['CC'] = os.environ['CXX']
+        if '-std=' not in os.environ['CXXFLAGS']:
+            os.environ['CXXFLAGS'] += ' -std=gnu++11'
+        os.environ['CFLAGS'] = os.environ['CXXFLAGS']
+
         if self.distribution.has_c_libraries():
             self.run_command("build_clib")
             build_clib = self.get_finalized_command("build_clib")
