94e658a
diff -up Python-2.6.2/configure.in.expat Python-2.6.2/configure.in
94e658a
--- Python-2.6.2/configure.in.expat	2010-01-25 21:46:42.700858981 -0500
94e658a
+++ Python-2.6.2/configure.in	2010-01-25 21:46:54.710857387 -0500
94e658a
@@ -1898,6 +1898,13 @@ LIBS="$withval $LIBS"
94e658a
 ],
94e658a
 [AC_MSG_RESULT(no)])
94e658a
 
94e658a
+# Check for use of the system expat library
94e658a
+AC_MSG_CHECKING(for --with-system-expat)
94e658a
+AC_ARG_WITH(system_expat,
94e658a
+            AC_HELP_STRING(--with-system-expat, build pyexpat module using an installed expat library))
94e658a
+
94e658a
+AC_MSG_RESULT($with_system_expat)
94e658a
+
94e658a
 # Check for use of the system libffi library
94e658a
 AC_MSG_CHECKING(for --with-system-ffi)
94e658a
 AC_ARG_WITH(system_ffi,
94e658a
diff -up Python-2.6.2/setup.py.expat Python-2.6.2/setup.py
94e658a
--- Python-2.6.2/setup.py.expat	2010-01-25 21:46:48.490911125 -0500
94e658a
+++ Python-2.6.2/setup.py	2010-01-25 21:46:54.711857933 -0500
94e658a
@@ -1196,19 +1196,26 @@ class PyBuildExt(build_ext):
94e658a
         #
94e658a
         # More information on Expat can be found at www.libexpat.org.
94e658a
         #
94e658a
-        expatinc = os.path.join(os.getcwd(), srcdir, 'Modules', 'expat')
94e658a
-        define_macros = [
94e658a
-            ('HAVE_EXPAT_CONFIG_H', '1'),
94e658a
-        ]
94e658a
+        if '--with-system-expat' in sysconfig.get_config_var("CONFIG_ARGS"):
94e658a
+            expat_inc = []
94e658a
+            define_macros = []
94e658a
+            expat_lib = ['expat']
94e658a
+            expat_sources = []
94e658a
+        else:
94e658a
+            expat_inc = [os.path.join(os.getcwd(), srcdir, 'Modules', 'expat')]
94e658a
+            define_macros = [
94e658a
+                ('HAVE_EXPAT_CONFIG_H', '1'),
94e658a
+            ]
94e658a
+            expat_lib = []
94e658a
+            expat_sources = ['expat/xmlparse.c',
94e658a
+                             'expat/xmlrole.c',
94e658a
+                             'expat/xmltok.c']
94e658a
 
94e658a
         exts.append(Extension('pyexpat',
94e658a
                               define_macros = define_macros,
94e658a
-                              include_dirs = [expatinc],
94e658a
-                              sources = ['pyexpat.c',
94e658a
-                                         'expat/xmlparse.c',
94e658a
-                                         'expat/xmlrole.c',
94e658a
-                                         'expat/xmltok.c',
94e658a
-                                         ],
94e658a
+                              include_dirs = expat_inc,
94e658a
+                              libraries = expat_lib,
94e658a
+                              sources = ['pyexpat.c'] + expat_sources
94e658a
                               ))
94e658a
 
94e658a
         # Fredrik Lundh's cElementTree module.  Note that this also
94e658a
@@ -1218,7 +1225,8 @@ class PyBuildExt(build_ext):
94e658a
             define_macros.append(('USE_PYEXPAT_CAPI', None))
94e658a
             exts.append(Extension('_elementtree',
94e658a
                                   define_macros = define_macros,
94e658a
-                                  include_dirs = [expatinc],
94e658a
+                                  include_dirs = expat_inc,
94e658a
+                                  libraries = expat_lib,
94e658a
                                   sources = ['_elementtree.c'],
94e658a
                                   ))
94e658a
         else: