move bundled CXX folder, allow to optionally use system installed files

Hi,
many GNU/Linux distributions discourage to bundle other software like matplotlib
does with PyCXX.
It is understandable you may not want additionally support each new version
of the bundled software.
But you should give the distribution package maintainers an easy way to use
the version available in the system should they wish to do so.

With the current build system this is not possible without rather large modifications.
To allow maintainers to use the system files the bundled CXX must be moved from the
matplotlib root to a subfolder, e.g. CXX -> external/CXX, so gcc will not unintentionally use the bundled headers.

Attached patch makes use of this move and modifies setupext.py to search for the PyCXX
sources in a list of possible folder pairs. The first folder where files are found is chosen.
The found sources and include path have been added to all CXX uses I found.

To prefer the system installed version put the paths to the front of the lists and
it will fall back to the bundled version if they are unavailable.
E.g. for debian:
_pycxx_src_paths = ["/usr/share/python{0}.{1}/".format(*sys.version_info[:2]), "external/"]
_pycxx_h_paths = ["/usr/include/python{0}.{1}/".format(*sys.version_info[:2]), "external/"]

Btw, I also saw you patched CXX for sparc
http://sourceforge.net/tracker/?func=detail&aid=3022815&group_id=80706&atid=560720
has this bug and patch been forwarded to pycxx?
It is not been applied to trunk yet, was it rejected?

PS: please CC me I'm not subscribed to the list.

Best Regards,
Julian Taylor

matplot_cxx.patch (6.36 KB)