Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b2d9046

Browse files
committed
Merged revisions 77169 via svnmerge from
svn+ssh://[email protected]/python/trunk ........ r77169 | benjamin.peterson | 2009-12-30 21:17:18 -0600 (Wed, 30 Dec 2009) | 2 lines add a --with-system-expat option to build pyexpat against the system's lib #7609 ........
1 parent 587a310 commit b2d9046

4 files changed

Lines changed: 61 additions & 27 deletions

File tree

Misc/NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,10 @@ Extension Modules
514514
Build
515515
-----
516516

517+
- Issue #7609: Add a --with-system-expat option that causes the system's expat
518+
library to be used for the pyexpat module instead of the one included with
519+
Python.
520+
517521
- Issue #7589: Only build the nis module when the correct header files are
518522
found.
519523

configure

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#! /bin/sh
2-
# From configure.in Revision: 76815 .
2+
# From configure.in Revision: 77032 .
33
# Guess values for system-dependent variables and create Makefiles.
44
# Generated by GNU Autoconf 2.61 for python 3.2.
55
#
@@ -1342,6 +1342,8 @@ Optional Packages:
13421342
--with-suffix=.exe set executable suffix
13431343
--with-pydebug build with Py_DEBUG defined
13441344
--with-libs='lib1 ...' link against additional libs
1345+
--with-system-expat build pyexpat module using an installed expat
1346+
library
13451347
--with-system-ffi build _ctypes module using an installed ffi library
13461348
--with-dbmliborder=db1:db2:...
13471349
order to check db backends for dbm. Valid value is a
@@ -3792,7 +3794,7 @@ else
37923794
{ echo "$as_me:$LINENO: result: no" >&5
37933795
echo "${ECHO_T}no" >&6; }
37943796
fi
3795-
rm -f -r conftest*
3797+
rm -f conftest*
37963798

37973799

37983800

@@ -5335,7 +5337,7 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
53355337
else
53365338
ac_cv_header_stdc=no
53375339
fi
5338-
rm -f -r conftest*
5340+
rm -f conftest*
53395341

53405342
fi
53415343

@@ -5356,7 +5358,7 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
53565358
else
53575359
ac_cv_header_stdc=no
53585360
fi
5359-
rm -f -r conftest*
5361+
rm -f conftest*
53605362

53615363
fi
53625364

@@ -6454,7 +6456,7 @@ _ACEOF
64546456

64556457

64566458
fi
6457-
rm -f -r conftest*
6459+
rm -f conftest*
64586460

64596461
{ echo "$as_me:$LINENO: result: $was_it_defined" >&5
64606462
echo "${ECHO_T}$was_it_defined" >&6; }
@@ -6984,7 +6986,7 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
69846986
else
69856987
ac_cv_type_uid_t=no
69866988
fi
6987-
rm -f -r conftest*
6989+
rm -f conftest*
69886990

69896991
fi
69906992
{ echo "$as_me:$LINENO: result: $ac_cv_type_uid_t" >&5
@@ -15320,6 +15322,19 @@ echo "${ECHO_T}no" >&6; }
1532015322
fi
1532115323

1532215324

15325+
# Check for use of the system expat library
15326+
{ echo "$as_me:$LINENO: checking for --with-system-expat" >&5
15327+
echo $ECHO_N "checking for --with-system-expat... $ECHO_C" >&6; }
15328+
15329+
# Check whether --with-system_expat was given.
15330+
if test "${with_system_expat+set}" = set; then
15331+
withval=$with_system_expat;
15332+
fi
15333+
15334+
15335+
{ echo "$as_me:$LINENO: result: $with_system_expat" >&5
15336+
echo "${ECHO_T}$with_system_expat" >&6; }
15337+
1532315338
# Check for use of the system libffi library
1532415339
{ echo "$as_me:$LINENO: checking for --with-system-ffi" >&5
1532515340
echo $ECHO_N "checking for --with-system-ffi... $ECHO_C" >&6; }
@@ -15526,7 +15541,7 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
1552615541
else
1552715542
unistd_defines_pthreads=no
1552815543
fi
15529-
rm -f -r conftest*
15544+
rm -f conftest*
1553015545

1553115546
{ echo "$as_me:$LINENO: result: $unistd_defines_pthreads" >&5
1553215547
echo "${ECHO_T}$unistd_defines_pthreads" >&6; }
@@ -16824,7 +16839,7 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
1682416839
$EGREP "yes" >/dev/null 2>&1; then
1682516840
ipv6type=$i
1682616841
fi
16827-
rm -f -r conftest*
16842+
rm -f conftest*
1682816843

1682916844
;;
1683016845
kame)
@@ -16847,7 +16862,7 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
1684716862
ipv6libdir=/usr/local/v6/lib
1684816863
ipv6trylibc=yes
1684916864
fi
16850-
rm -f -r conftest*
16865+
rm -f conftest*
1685116866

1685216867
;;
1685316868
linux-glibc)
@@ -16868,7 +16883,7 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
1686816883
ipv6type=$i;
1686916884
ipv6trylibc=yes
1687016885
fi
16871-
rm -f -r conftest*
16886+
rm -f conftest*
1687216887

1687316888
;;
1687416889
linux-inet6)
@@ -16906,7 +16921,7 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
1690616921
ipv6lib=inet6;
1690716922
ipv6libdir=/usr/local/v6/lib
1690816923
fi
16909-
rm -f -r conftest*
16924+
rm -f conftest*
1691016925

1691116926
;;
1691216927
v6d)
@@ -16929,7 +16944,7 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
1692916944
ipv6libdir=/usr/local/v6/lib;
1693016945
BASECFLAGS="-I/usr/local/v6/include $BASECFLAGS"
1693116946
fi
16932-
rm -f -r conftest*
16947+
rm -f conftest*
1693316948

1693416949
;;
1693516950
zeta)
@@ -16951,7 +16966,7 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
1695116966
ipv6lib=inet6;
1695216967
ipv6libdir=/usr/local/v6/lib
1695316968
fi
16954-
rm -f -r conftest*
16969+
rm -f conftest*
1695516970

1695616971
;;
1695716972
esac
@@ -25292,7 +25307,7 @@ cat >>confdefs.h <<\_ACEOF
2529225307
_ACEOF
2529325308

2529425309
fi
25295-
rm -f -r conftest*
25310+
rm -f conftest*
2529625311

2529725312
cat >conftest.$ac_ext <<_ACEOF
2529825313
/* confdefs.h. */
@@ -25311,7 +25326,7 @@ cat >>confdefs.h <<\_ACEOF
2531125326
_ACEOF
2531225327

2531325328
fi
25314-
rm -f -r conftest*
25329+
rm -f conftest*
2531525330

2531625331
fi
2531725332

@@ -25581,7 +25596,7 @@ cat >>confdefs.h <<\_ACEOF
2558125596
_ACEOF
2558225597

2558325598
fi
25584-
rm -f -r conftest*
25599+
rm -f conftest*
2558525600

2558625601
fi
2558725602

configure.in

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1856,6 +1856,13 @@ LIBS="$withval $LIBS"
18561856
],
18571857
[AC_MSG_RESULT(no)])
18581858

1859+
# Check for use of the system expat library
1860+
AC_MSG_CHECKING(for --with-system-expat)
1861+
AC_ARG_WITH(system_expat,
1862+
AC_HELP_STRING(--with-system-expat, build pyexpat module using an installed expat library))
1863+
1864+
AC_MSG_RESULT($with_system_expat)
1865+
18591866
# Check for use of the system libffi library
18601867
AC_MSG_CHECKING(for --with-system-ffi)
18611868
AC_ARG_WITH(system_ffi,

setup.py

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,19 +1104,26 @@ class db_found(Exception): pass
11041104
#
11051105
# More information on Expat can be found at www.libexpat.org.
11061106
#
1107-
expatinc = os.path.join(os.getcwd(), srcdir, 'Modules', 'expat')
1108-
define_macros = [
1109-
('HAVE_EXPAT_CONFIG_H', '1'),
1110-
]
1107+
if '--with-system-expat' in sysconfig.get_config_var("CONFIG_ARGS"):
1108+
expat_inc = []
1109+
define_macros = []
1110+
expat_lib = ['expat']
1111+
expat_sources = []
1112+
else:
1113+
expat_inc = [os.path.join(os.getcwd(), srcdir, 'Modules', 'expat')]
1114+
define_macros = [
1115+
('HAVE_EXPAT_CONFIG_H', '1'),
1116+
]
1117+
expat_lib = []
1118+
expat_sources = ['expat/xmlparse.c',
1119+
'expat/xmlrole.c',
1120+
'expat/xmltok.c']
11111121

11121122
exts.append(Extension('pyexpat',
11131123
define_macros = define_macros,
1114-
include_dirs = [expatinc],
1115-
sources = ['pyexpat.c',
1116-
'expat/xmlparse.c',
1117-
'expat/xmlrole.c',
1118-
'expat/xmltok.c',
1119-
],
1124+
include_dirs = expat_inc,
1125+
libraries = expat_lib,
1126+
sources = ['pyexpat.c'] + expat_sources
11201127
))
11211128

11221129
# Fredrik Lundh's cElementTree module. Note that this also
@@ -1126,7 +1133,8 @@ class db_found(Exception): pass
11261133
define_macros.append(('USE_PYEXPAT_CAPI', None))
11271134
exts.append(Extension('_elementtree',
11281135
define_macros = define_macros,
1129-
include_dirs = [expatinc],
1136+
include_dirs = expat_inc,
1137+
libraries = expat_lib,
11301138
sources = ['_elementtree.c'],
11311139
))
11321140
else:

0 commit comments

Comments
 (0)