Blame python-2.6.2-with-system-expat.patch

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