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

Skip to content

Commit d78735d

Browse files
committed
Merged revisions 77212-77215 via svnmerge from
svn+ssh://[email protected]/python/trunk ........ r77212 | benjamin.peterson | 2010-01-01 09:16:29 -0600 (Fri, 01 Jan 2010) | 1 line use pkg-config to find the libffi headers when --with-system-ffi is used #6943 ........ r77213 | benjamin.peterson | 2010-01-01 09:18:38 -0600 (Fri, 01 Jan 2010) | 1 line add note ........ r77214 | benjamin.peterson | 2010-01-01 09:20:06 -0600 (Fri, 01 Jan 2010) | 1 line fix indentation ........ r77215 | benjamin.peterson | 2010-01-01 09:21:13 -0600 (Fri, 01 Jan 2010) | 1 line allow --with-dbmliborder to specify that no dbm modules will be built #6491 ........
1 parent b7b0019 commit d78735d

5 files changed

Lines changed: 138 additions & 6 deletions

File tree

Makefile.pre.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,8 @@ GRAMMAR_C= $(srcdir)/Python/graminit.c
214214
GRAMMAR_INPUT= $(srcdir)/Grammar/Grammar
215215

216216

217+
LIBFFI_INCLUDEDIR= @LIBFFI_INCLUDEDIR@
218+
217219
##########################################################################
218220
# Parser
219221
PGEN= Parser/pgen$(EXE)

Misc/NEWS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,11 @@ Extension Modules
517517
Build
518518
-----
519519

520+
- Issue #6491: Allow --with-dbmliborder to specify that no dbms will be built.
521+
522+
- Issue #6943: Use pkg-config to find the libffi headers when the
523+
--with-system-ffi flag is used.
524+
520525
- Issue #7609: Add a --with-system-expat option that causes the system's expat
521526
library to be used for the pyexpat module instead of the one included with
522527
Python.

configure

Lines changed: 115 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#! /bin/sh
2-
# From configure.in Revision: 77190 .
2+
# From configure.in Revision: 77196 .
33
# Guess values for system-dependent variables and create Makefiles.
44
# Generated by GNU Autoconf 2.61 for python 3.2.
55
#
@@ -715,6 +715,8 @@ CCSHARED
715715
LINKFORSHARED
716716
CFLAGSFORSHARED
717717
SHLIBS
718+
PKG_CONFIG
719+
LIBFFI_INCLUDEDIR
718720
USE_SIGNAL_MODULE
719721
SIGNAL_OBJS
720722
USE_THREAD_MODULE
@@ -15350,6 +15352,115 @@ if test "${with_system_ffi+set}" = set; then
1535015352
fi
1535115353

1535215354

15355+
if test "$with_system_ffi" = "yes"; then
15356+
if test -n "$ac_tool_prefix"; then
15357+
# Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
15358+
set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
15359+
{ echo "$as_me:$LINENO: checking for $ac_word" >&5
15360+
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
15361+
if test "${ac_cv_path_PKG_CONFIG+set}" = set; then
15362+
echo $ECHO_N "(cached) $ECHO_C" >&6
15363+
else
15364+
case $PKG_CONFIG in
15365+
[\\/]* | ?:[\\/]*)
15366+
ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
15367+
;;
15368+
*)
15369+
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
15370+
for as_dir in $PATH
15371+
do
15372+
IFS=$as_save_IFS
15373+
test -z "$as_dir" && as_dir=.
15374+
for ac_exec_ext in '' $ac_executable_extensions; do
15375+
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
15376+
ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
15377+
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
15378+
break 2
15379+
fi
15380+
done
15381+
done
15382+
IFS=$as_save_IFS
15383+
15384+
;;
15385+
esac
15386+
fi
15387+
PKG_CONFIG=$ac_cv_path_PKG_CONFIG
15388+
if test -n "$PKG_CONFIG"; then
15389+
{ echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5
15390+
echo "${ECHO_T}$PKG_CONFIG" >&6; }
15391+
else
15392+
{ echo "$as_me:$LINENO: result: no" >&5
15393+
echo "${ECHO_T}no" >&6; }
15394+
fi
15395+
15396+
15397+
fi
15398+
if test -z "$ac_cv_path_PKG_CONFIG"; then
15399+
ac_pt_PKG_CONFIG=$PKG_CONFIG
15400+
# Extract the first word of "pkg-config", so it can be a program name with args.
15401+
set dummy pkg-config; ac_word=$2
15402+
{ echo "$as_me:$LINENO: checking for $ac_word" >&5
15403+
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
15404+
if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then
15405+
echo $ECHO_N "(cached) $ECHO_C" >&6
15406+
else
15407+
case $ac_pt_PKG_CONFIG in
15408+
[\\/]* | ?:[\\/]*)
15409+
ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
15410+
;;
15411+
*)
15412+
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
15413+
for as_dir in $PATH
15414+
do
15415+
IFS=$as_save_IFS
15416+
test -z "$as_dir" && as_dir=.
15417+
for ac_exec_ext in '' $ac_executable_extensions; do
15418+
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
15419+
ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
15420+
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
15421+
break 2
15422+
fi
15423+
done
15424+
done
15425+
IFS=$as_save_IFS
15426+
15427+
;;
15428+
esac
15429+
fi
15430+
ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
15431+
if test -n "$ac_pt_PKG_CONFIG"; then
15432+
{ echo "$as_me:$LINENO: result: $ac_pt_PKG_CONFIG" >&5
15433+
echo "${ECHO_T}$ac_pt_PKG_CONFIG" >&6; }
15434+
else
15435+
{ echo "$as_me:$LINENO: result: no" >&5
15436+
echo "${ECHO_T}no" >&6; }
15437+
fi
15438+
15439+
if test "x$ac_pt_PKG_CONFIG" = x; then
15440+
PKG_CONFIG=""
15441+
else
15442+
case $cross_compiling:$ac_tool_warned in
15443+
yes:)
15444+
{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
15445+
whose name does not start with the host triplet. If you think this
15446+
configuration is useful to you, please write to [email protected]." >&5
15447+
echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
15448+
whose name does not start with the host triplet. If you think this
15449+
configuration is useful to you, please write to [email protected]." >&2;}
15450+
ac_tool_warned=yes ;;
15451+
esac
15452+
PKG_CONFIG=$ac_pt_PKG_CONFIG
15453+
fi
15454+
else
15455+
PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
15456+
fi
15457+
15458+
LIBFFI_INCLUDEDIR="`"$PKG_CONFIG" libffi --cflags-only-I 2>/dev/null | sed -e 's/^-I//;s/ *$//'`"
15459+
else
15460+
LIBFFI_INCLUDEDIR=""
15461+
fi
15462+
15463+
1535315464
{ echo "$as_me:$LINENO: result: $with_system_ffi" >&5
1535415465
echo "${ECHO_T}$with_system_ffi" >&6; }
1535515466

@@ -27732,6 +27843,8 @@ for ac_last_try in false false false false false :; do
2773227843
cat >conf$$subs.sed <<_ACEOF
2773327844
CFLAGSFORSHARED!$CFLAGSFORSHARED$ac_delim
2773427845
SHLIBS!$SHLIBS$ac_delim
27846+
PKG_CONFIG!$PKG_CONFIG$ac_delim
27847+
LIBFFI_INCLUDEDIR!$LIBFFI_INCLUDEDIR$ac_delim
2773527848
USE_SIGNAL_MODULE!$USE_SIGNAL_MODULE$ac_delim
2773627849
SIGNAL_OBJS!$SIGNAL_OBJS$ac_delim
2773727850
USE_THREAD_MODULE!$USE_THREAD_MODULE$ac_delim
@@ -27754,7 +27867,7 @@ SRCDIRS!$SRCDIRS$ac_delim
2775427867
LTLIBOBJS!$LTLIBOBJS$ac_delim
2775527868
_ACEOF
2775627869

27757-
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 22; then
27870+
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 24; then
2775827871
break
2775927872
elif $ac_last_try; then
2776027873
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5

configure.in

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1872,6 +1872,14 @@ AC_MSG_CHECKING(for --with-system-ffi)
18721872
AC_ARG_WITH(system_ffi,
18731873
AC_HELP_STRING(--with-system-ffi, build _ctypes module using an installed ffi library))
18741874

1875+
if test "$with_system_ffi" = "yes"; then
1876+
AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1877+
LIBFFI_INCLUDEDIR="`"$PKG_CONFIG" libffi --cflags-only-I 2>/dev/null | sed -e 's/^-I//;s/ *$//'`"
1878+
else
1879+
LIBFFI_INCLUDEDIR=""
1880+
fi
1881+
AC_SUBST(LIBFFI_INCLUDEDIR)
1882+
18751883
AC_MSG_RESULT($with_system_ffi)
18761884

18771885
# Check for --with-dbmliborder

setup.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -887,14 +887,15 @@ class db_found(Exception): pass
887887
else:
888888
missing.append('_sqlite3')
889889

890+
dbm_order = ['gdbm']
890891
# The standard Unix dbm module:
891892
if platform not in ['cygwin']:
892893
config_args = [arg.strip("'")
893894
for arg in sysconfig.get_config_var("CONFIG_ARGS").split()]
894-
dbm_args = [arg.split('=')[-1] for arg in config_args
895+
dbm_args = [arg for arg in config_args
895896
if arg.startswith('--with-dbmliborder=')]
896897
if dbm_args:
897-
dbm_order = dbm_args[-1].split(":")
898+
dbm_order = [arg.split('=')[-1] for arg in dbm_args][-1].split(":")
898899
else:
899900
dbm_order = "ndbm:gdbm:bdb".split(":")
900901
dbmext = None
@@ -958,7 +959,8 @@ class db_found(Exception): pass
958959
missing.append('_dbm')
959960

960961
# Anthony Baxter's gdbm module. GNU dbm(3) will require -lgdbm:
961-
if (self.compiler_obj.find_library_file(lib_dirs, 'gdbm')):
962+
if ('gdbm' in dbm_order and
963+
self.compiler_obj.find_library_file(lib_dirs, 'gdbm')):
962964
exts.append( Extension('_gdbm', ['_gdbmmodule.c'],
963965
libraries = ['gdbm'] ) )
964966
else:
@@ -1558,7 +1560,9 @@ def detect_ctypes(self, inc_dirs, lib_dirs):
15581560
# in /usr/include/ffi
15591561
inc_dirs.append('/usr/include/ffi')
15601562

1561-
ffi_inc = find_file('ffi.h', [], inc_dirs)
1563+
ffi_inc = [sysconfig.get_config_var("LIBFFI_INCLUDEDIR")]
1564+
if not ffi_inc:
1565+
ffi_inc = find_file('ffi.h', [], inc_dirs)
15621566
if ffi_inc is not None:
15631567
ffi_h = ffi_inc[0] + '/ffi.h'
15641568
fp = open(ffi_h)

0 commit comments

Comments
 (0)