summaryrefslogtreecommitdiffstats
path: root/setup.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2009-12-31 03:17:18 (GMT)
committerBenjamin Peterson <benjamin@python.org>2009-12-31 03:17:18 (GMT)
commit2c19674b51291c361842ec02f2ddbb9b472a2f5c (patch)
tree2556ec3112320aa096f1ae48f772169d41dfcf94 /setup.py
parentdf6f963f15824ad7553324648b5bcd221c221e15 (diff)
downloadcpython-2c19674b51291c361842ec02f2ddbb9b472a2f5c.zip
cpython-2c19674b51291c361842ec02f2ddbb9b472a2f5c.tar.gz
cpython-2c19674b51291c361842ec02f2ddbb9b472a2f5c.tar.bz2
add a --with-system-expat option to build pyexpat against the system's lib #7609
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py30
1 files changed, 19 insertions, 11 deletions
diff --git a/setup.py b/setup.py
index 1af4022..a8c9059 100644
--- a/setup.py
+++ b/setup.py
@@ -1220,19 +1220,26 @@ class PyBuildExt(build_ext):
#
# More information on Expat can be found at www.libexpat.org.
#
- expatinc = os.path.join(os.getcwd(), srcdir, 'Modules', 'expat')
- define_macros = [
- ('HAVE_EXPAT_CONFIG_H', '1'),
- ]
+ if '--with-system-expat' in sysconfig.get_config_var("CONFIG_ARGS"):
+ expat_inc = []
+ define_macros = []
+ expat_lib = ['expat']
+ expat_sources = []
+ else:
+ expat_inc = [os.path.join(os.getcwd(), srcdir, 'Modules', 'expat')]
+ define_macros = [
+ ('HAVE_EXPAT_CONFIG_H', '1'),
+ ]
+ expat_lib = []
+ expat_sources = ['expat/xmlparse.c',
+ 'expat/xmlrole.c',
+ 'expat/xmltok.c']
exts.append(Extension('pyexpat',
define_macros = define_macros,
- include_dirs = [expatinc],
- sources = ['pyexpat.c',
- 'expat/xmlparse.c',
- 'expat/xmlrole.c',
- 'expat/xmltok.c',
- ],
+ include_dirs = expat_inc,
+ libraries = expat_lib,
+ sources = ['pyexpat.c'] + expat_sources
))
# Fredrik Lundh's cElementTree module. Note that this also
@@ -1242,7 +1249,8 @@ class PyBuildExt(build_ext):
define_macros.append(('USE_PYEXPAT_CAPI', None))
exts.append(Extension('_elementtree',
define_macros = define_macros,
- include_dirs = [expatinc],
+ include_dirs = expat_inc,
+ libraries = expat_lib,
sources = ['_elementtree.c'],
))
else: