diff -r d61e8050b7d7 setup.py --- a/setup.py Tue Dec 10 18:22:03 2013 -0800 +++ b/setup.py Thu Dec 12 13:01:55 2013 +0100 @@ -39,6 +39,18 @@ """Add the directory 'dir' to the list 'dirlist' (at the front) if 1) 'dir' is not already in 'dirlist' 2) 'dir' actually exists, and is a directory.""" + if host_platform == 'darwin': + # Honor the MacOSX SDK setting when one was specified. + # An SDK is a directory with the same structure as a real + # system, but with only header files and libraries. + sysroot = macosx_sdk_root() + + if dir is None: + return + + if dir.startswith('/'): + dir = os.path.join(sysroot, dir[1:]) + if dir is not None and os.path.isdir(dir) and dir not in dirlist: dirlist.insert(0, dir)