[libxml2] 607273 Fix python detection on MSys/Windows
- From: Daniel Veillard <veillard src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libxml2] 607273 Fix python detection on MSys/Windows
- Date: Thu, 4 Nov 2010 14:47:53 +0000 (UTC)
commit fbd4ddf226c96ba748c828cb1fc7e3593eef1d82
Author: LRN <lrn1986 gmail com>
Date: Thu Nov 4 15:45:46 2010 +0100
607273 Fix python detection on MSys/Windows
Fix the lookup for python executable and headers, add an
extra variable for new dependancies when linking for Python
on Win32
configure.in | 43 +++++++++++++++++++++++++++++++------------
python/Makefile.am | 2 +-
2 files changed, 32 insertions(+), 13 deletions(-)
---
diff --git a/configure.in b/configure.in
index e6b6578..fcc8f65 100644
--- a/configure.in
+++ b/configure.in
@@ -704,17 +704,23 @@ if test "$with_python" != "no" ; then
echo Found python in $with_python/bin/python
PYTHON="$with_python/bin/python"
else
- if test -x "$with_python"
- then
- echo Found python in $with_python
- PYTHON="$with_python"
- else
- if test -x "$PYTHON"
- then
- echo Found python in environment PYTHON=$PYTHON
- with_python=`$PYTHON -c "import sys; print sys.exec_prefix"`
- else
- AC_PATH_PROG(PYTHON, python python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5)
+ if test -x "$with_python/python.exe"
+ then
+ echo Found python in $with_python/python.exe
+ PYTHON="$with_python/python.exe"
+ else
+ if test -x "$with_python"
+ then
+ echo Found python in $with_python
+ PYTHON="$with_python"
+ else
+ if test -x "$PYTHON"
+ then
+ echo Found python in environment PYTHON=$PYTHON
+ with_python=`$PYTHON -c "import sys; print sys.exec_prefix"`
+ else
+ AC_PATH_PROG(PYTHON, python python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5)
+ fi
fi
fi
fi
@@ -741,7 +747,14 @@ if test "$with_python" != "no" ; then
PYTHON_INCLUDES=/usr/include/python$PYTHON_VERSION
PYTHON_SITE_PACKAGES=$libdir/python$PYTHON_VERSION/site-packages
else
- echo could not find python$PYTHON_VERSION/Python.h
+ if test -r $with_python/include/Python.h -a \
+ -d $with_python/lib/site-packages
+ then
+ PYTHON_INCLUDES=$with_python/include
+ PYTHON_SITE_PACKAGES=$with_python/lib/site-packages
+ else
+ echo could not find python$PYTHON_VERSION/Python.h or $with_python/include/Python.h
+ fi
fi
fi
if test ! -d "$PYTHON_SITE_PACKAGES"
@@ -1397,6 +1410,7 @@ WIN32_EXTRA_LIBADD=
WIN32_EXTRA_LDFLAGS=
CYGWIN_EXTRA_LDFLAGS=
CYGWIN_EXTRA_PYTHON_LIBADD=
+WIN32_EXTRA_PYTHON_LIBADD=
case "$host" in
*-*-mingw*)
CPPFLAGS="$CPPFLAGS -DWIN32"
@@ -1405,6 +1419,10 @@ case "$host" in
AC_DEFINE([_WINSOCKAPI_],1,[Using the Win32 Socket implementation])
AC_DEFINE([snprintf],[_snprintf],[Win32 Std C name mangling work-around])
AC_DEFINE([vsnprintf],[_vsnprintf],[Win32 Std C name mangling work-around])
+ if test "${PYTHON}" != ""
+ then
+ WIN32_EXTRA_PYTHON_LIBADD="-L${pythondir}/../../libs -lpython${PYTHON_VERSION//./}"
+ fi
;;
*-*-cygwin*)
CYGWIN_EXTRA_LDFLAGS="-no-undefined"
@@ -1416,6 +1434,7 @@ case "$host" in
esac
AC_SUBST(WIN32_EXTRA_LIBADD)
AC_SUBST(WIN32_EXTRA_LDFLAGS)
+AC_SUBST(WIN32_EXTRA_PYTHON_LIBADD)
AC_SUBST(CYGWIN_EXTRA_LDFLAGS)
AC_SUBST(CYGWIN_EXTRA_PYTHON_LIBADD)
diff --git a/python/Makefile.am b/python/Makefile.am
index 3cf87e7..d2a2253 100644
--- a/python/Makefile.am
+++ b/python/Makefile.am
@@ -31,7 +31,7 @@ python_LTLIBRARIES = libxml2mod.la
libxml2mod_la_SOURCES = $(srcdir)/libxml.c $(srcdir)/types.c
nodist_libxml2mod_la_SOURCES = libxml2-py.c
-libxml2mod_la_LIBADD = $(mylibs) @CYGWIN_EXTRA_PYTHON_LIBADD@ @PYTHON_LIBS@
+libxml2mod_la_LIBADD = $(mylibs) @CYGWIN_EXTRA_PYTHON_LIBADD@ @WIN32_EXTRA_PYTHON_LIBADD@ @PYTHON_LIBS@
$(srcdir)/libxml.c: libxml2-py.h # to generate before to compile
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]