1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-03-19 14:50:07 +03:00

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
This commit is contained in:
LRN 2010-11-04 15:45:46 +01:00 committed by Daniel Veillard
parent 60587d6ebd
commit fbd4ddf226
2 changed files with 32 additions and 13 deletions

View File

@ -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)

View File

@ -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