@@ -68,6 +68,7 @@ def detect_modules(self):
6868 # a fixed list
6969 lib_dirs = self .compiler .library_dirs [:]
7070 lib_dirs += ['/lib' , '/usr/lib' , '/usr/local/lib' ]
71+ inc_dirs = ['/usr/include' , '/usr/local/include' ] + self .include_dirs
7172 exts = []
7273
7374 # XXX Omitted modules: gl, pure, dl, SGI-specific modules
@@ -232,8 +233,7 @@ def detect_modules(self):
232233 # Setup.config before enabling it here.
233234
234235 if (self .compiler .find_library_file (lib_dirs , 'db' ) and
235- find_file (['/usr/include' , '/usr/local/include' ] + self .include_dirs ,
236- 'db_185.h' ) ):
236+ find_file (inc_dirs , 'db_185.h' ) ):
237237 exts .append ( Extension ('bsddb' , ['bsddbmodule.c' ],
238238 libraries = ['db' ] ) )
239239
@@ -340,8 +340,15 @@ def detect_modules(self):
340340 # ar cr libexpat.a xmltok/*.o xmlparse/*.o
341341 #
342342 if (self .compiler .find_library_file (lib_dirs , 'expat' )):
343- exts .append ( Extension ('pyexpat' , ['pyexpat.c' ],
344- libraries = ['expat' ]) )
343+ defs = None
344+ if find_file (inc_dirs , 'expat.h' ):
345+ defs = [('HAVE_EXPAT_H' , 1 )]
346+ elif find_file (inc_dirs , 'xmlparse.h' ):
347+ defs = []
348+ if defs is not None :
349+ exts .append ( Extension ('pyexpat' , ['pyexpat.c' ],
350+ define_macros = defs ,
351+ libraries = ['expat' ]) )
345352
346353 # Platform-specific libraries
347354 plat = sys .platform
0 commit comments