You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
240 lines
7.0 KiB
240 lines
7.0 KiB
7 years ago
|
From aa0f7a8d59a9bbd646203d3f14e39e217961f725 Mon Sep 17 00:00:00 2001
|
||
|
From: Gilles Dartiguelongue <eva@gentoo.org>
|
||
|
Date: Wed, 11 Nov 2015 17:49:07 +0100
|
||
|
Subject: [PATCH] Simplify python setup in autoconf
|
||
|
|
||
|
AM_PATH_PYTHON does most of the job without using pkg-config as expected
|
||
|
from the rest of the autoconf script.
|
||
|
diff --git a/Makefile.am b/Makefile.am
|
||
4 years ago
|
index 2c417d0..a65a2b7 100644
|
||
7 years ago
|
--- a/Makefile.am
|
||
|
+++ b/Makefile.am
|
||
4 years ago
|
@@ -2,9 +2,14 @@ SUBDIRS = \
|
||
7 years ago
|
libxslt \
|
||
|
libexslt \
|
||
|
xsltproc \
|
||
|
- doc \
|
||
|
- $(PYTHON_SUBDIR) \
|
||
|
- tests
|
||
|
+ doc
|
||
|
+
|
||
4 years ago
|
+
|
||
7 years ago
|
+if WITH_PYTHON
|
||
4 years ago
|
+ SUBDIRS += python
|
||
7 years ago
|
+endif
|
||
|
+
|
||
|
+SUBDIRS += tests
|
||
|
|
||
|
DIST_SUBDIRS = libxslt libexslt xsltproc python doc tests
|
||
|
|
||
4 years ago
|
@@ -52,7 +57,9 @@ tests: dummy
|
||
7 years ago
|
@echo '## Running the regression test suite'
|
||
|
@(cd tests ; $(MAKE) -s tests)
|
||
|
@(cd xsltproc ; $(MAKE) -s tests)
|
||
|
- @(if [ "$(PYTHON_SUBDIR)" != "" ] ; then cd python ; $(MAKE) -s tests ; fi)
|
||
|
+if WITH_PYTHON
|
||
|
+ @(cd python ; $(MAKE) -s tests)
|
||
|
+endif
|
||
|
|
||
|
valgrind:
|
||
|
@echo '## Running the regression tests under Valgrind'
|
||
|
diff --git a/configure.ac b/configure.ac
|
||
4 years ago
|
index 325a7be..ee1eabd 100644
|
||
7 years ago
|
--- a/configure.ac
|
||
|
+++ b/configure.ac
|
||
4 years ago
|
@@ -227,90 +227,37 @@ dnl
|
||
7 years ago
|
dnl check for python
|
||
|
dnl
|
||
|
|
||
|
-PYTHON_VERSION=
|
||
|
-PYTHON_INCLUDES=
|
||
|
-PYTHON_SITE_PACKAGES=
|
||
|
-pythondir=
|
||
|
-AC_ARG_WITH(python, [ --with-python[=DIR] Build Python bindings if found])
|
||
|
-if test "$with_python" != "no" ; then
|
||
|
- if test -x "$with_python/bin/python"
|
||
|
- 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.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5)
|
||
|
- fi
|
||
|
- fi
|
||
|
- fi
|
||
|
- if test "$PYTHON" != ""
|
||
|
- then
|
||
|
- echo "PYTHON is pointing at $PYTHON"
|
||
|
- PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[[0:3]]"`
|
||
|
- echo Found Python version $PYTHON_VERSION
|
||
|
- LIBXML2_PYTHON=`$PYTHON -c "try : import libxml2 ; print 1
|
||
|
-except: print 0"`
|
||
|
- if test "$LIBXML2_PYTHON" = "1"
|
||
|
- then
|
||
|
- echo Found libxml2-python module
|
||
|
- else
|
||
|
- echo Warning: Missing libxml2-python
|
||
|
- fi
|
||
|
- fi
|
||
|
- if test "$PYTHON_VERSION" != ""
|
||
|
- then
|
||
|
- if test -r $with_python/include/python$PYTHON_VERSION/Python.h -a \
|
||
|
- -d $with_python/lib/python$PYTHON_VERSION/site-packages
|
||
|
- then
|
||
|
- PYTHON_INCLUDES=$with_python/include/python$PYTHON_VERSION
|
||
|
- PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages'
|
||
|
- else
|
||
|
- if test -r $prefix/include/python$PYTHON_VERSION/Python.h
|
||
|
- then
|
||
|
- PYTHON_INCLUDES=$prefix/include/python$PYTHON_VERSION
|
||
|
- PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages'
|
||
|
- else
|
||
|
- if test -r /usr/include/python$PYTHON_VERSION/Python.h
|
||
|
- 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
|
||
|
- fi
|
||
|
- fi
|
||
|
- if test ! -d "$PYTHON_SITE_PACKAGES"
|
||
|
- then
|
||
|
- PYTHON_SITE_PACKAGES=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib()"`
|
||
|
- fi
|
||
|
- fi
|
||
|
- PYTHON_LIBS=`python$PYTHON_VERSION-config --libs`
|
||
|
- fi
|
||
|
- if test "$with_python" != ""
|
||
|
- then
|
||
|
- pythondir='$(PYTHON_SITE_PACKAGES)'
|
||
|
- else
|
||
|
- pythondir='$(libdir)/python$(PYTHON_VERSION)/site-packages'
|
||
|
- fi
|
||
|
-fi
|
||
|
-AM_CONDITIONAL(WITH_PYTHON, test "$PYTHON_INCLUDES" != "")
|
||
|
-if test "$PYTHON_INCLUDES" != ""
|
||
|
-then
|
||
|
- PYTHON_SUBDIR=python
|
||
|
-else
|
||
|
- PYTHON_SUBDIR=
|
||
|
-fi
|
||
|
-AC_SUBST(pythondir)
|
||
|
-AC_SUBST(PYTHON_SUBDIR)
|
||
|
-AC_SUBST(PYTHON_LIBS)
|
||
|
+AC_ARG_WITH([python],
|
||
|
+ AS_HELP_STRING([--with-python], [Build Python bindings if found])
|
||
|
+)
|
||
|
+
|
||
|
+AS_IF([test "$with_python" = "yes"],
|
||
|
+ [AM_PATH_PYTHON
|
||
|
+ AC_PATH_TOOL([PYTHON_CONFIG], [python$PYTHON_VERSION-config], [no])
|
||
|
+ AS_IF([test "$PYTHON_CONFIG" = "no"],
|
||
|
+ [AC_PATH_TOOL([PYTHON_CONFIG], [python-config], [no])])
|
||
|
+ AS_IF([test "$PYTHON_CONFIG" != "no"],
|
||
|
+ [PYTHON_CFLAGS=`$PYTHON_CONFIG --cflags`
|
||
|
+ PYTHON_LDFLAGS=`$PYTHON_CONFIG --ldflags`
|
||
|
+ PYTHON_LIBS=`$PYTHON_CONFIG --libs`],
|
||
|
+ [AC_MSG_ERROR([Missing python development files.])])
|
||
|
+ AC_MSG_CHECKING([libxml2 module in $PYTHON])
|
||
|
+ LIBXML2_PYTHON=`$PYTHON -c "import sys;
|
||
|
+try:
|
||
|
+ import libxml2
|
||
|
+ sys.stdout.write('1')
|
||
|
+except:
|
||
|
+ sys.stdout.write('0')"`
|
||
|
+ AS_IF([test "$LIBXML2_PYTHON" = "1"],
|
||
|
+ [AC_MSG_RESULT([yes])],
|
||
|
+ [AC_MSG_RESULT([no])
|
||
|
+ AC_MSG_WARN([libxml2 python module not found, expect runtime errors])])
|
||
|
+ ])
|
||
|
+
|
||
|
+AM_CONDITIONAL([WITH_PYTHON], [test "$with_python" = "yes"])
|
||
|
+AC_SUBST([PYTHON_CFLAGS])
|
||
|
+AC_SUBST([PYTHON_LDFLAGS])
|
||
|
+AC_SUBST([PYTHON_LIBS])
|
||
|
|
||
|
AC_ARG_WITH(crypto, [ --with-crypto Add crypto support to exslt (on)])
|
||
|
WITH_CRYPTO=0
|
||
4 years ago
|
@@ -634,10 +581,6 @@ AC_SUBST(PYTHONSODV)
|
||
7 years ago
|
AC_SUBST(XML_CONFIG)
|
||
|
AC_SUBST(LIBXML_LIBS)
|
||
|
AC_SUBST(LIBXML_CFLAGS)
|
||
|
-AC_SUBST(PYTHON)
|
||
|
-AC_SUBST(PYTHON_VERSION)
|
||
|
-AC_SUBST(PYTHON_INCLUDES)
|
||
|
-AC_SUBST(PYTHON_SITE_PACKAGES)
|
||
|
|
||
|
XSLT_LIBDIR='-L${libdir}'
|
||
|
XSLT_INCLUDEDIR='-I${includedir}'
|
||
|
diff --git a/python/Makefile.am b/python/Makefile.am
|
||
4 years ago
|
index 17a0d17..1c57a63 100644
|
||
7 years ago
|
--- a/python/Makefile.am
|
||
|
+++ b/python/Makefile.am
|
||
4 years ago
|
@@ -5,7 +5,7 @@ SUBDIRS= . tests
|
||
7 years ago
|
|
||
|
AM_CFLAGS = $(LIBXML_CFLAGS)
|
||
|
|
||
|
-DOCS_DIR = $(datadir)/doc/libxslt-python-$(LIBXSLT_VERSION)
|
||
|
+docsdir = $(datadir)/doc/libxslt-python-$(LIBXSLT_VERSION)
|
||
|
# libxsltclass.txt is generated
|
||
4 years ago
|
DOCS=
|
||
7 years ago
|
|
||
|
@@ -16,10 +16,7 @@ EXTRA_DIST = \
|
||
|
libxml_wrap.h \
|
||
|
libxslt_wrap.h \
|
||
|
libxsl.py \
|
||
|
- libxslt-python-api.xml \
|
||
|
- $(DOCS)
|
||
|
-
|
||
4 years ago
|
-libxsltmod_la_LDFLAGS = -module -avoid-version
|
||
7 years ago
|
+ libxslt-python-api.xml
|
||
|
|
||
|
if WITH_PYTHON
|
||
|
mylibs = \
|
||
|
@@ -28,31 +25,22 @@ mylibs = \
|
||
|
|
||
|
all-local: libxslt.py
|
||
|
|
||
|
-python_LTLIBRARIES = libxsltmod.la
|
||
|
+python_PYTHON = libxslt.py
|
||
|
+pyexec_LTLIBRARIES = libxsltmod.la
|
||
|
|
||
|
libxsltmod_la_CPPFLAGS = \
|
||
|
- -I$(PYTHON_INCLUDES) \
|
||
|
-I$(top_srcdir)/libxslt \
|
||
|
-I$(top_srcdir) \
|
||
|
- -I../libexslt
|
||
|
+ -I$(top_srcdir)/libexslt \
|
||
|
+ $(PYTHON_CFLAGS)
|
||
|
libxsltmod_la_SOURCES = libxslt.c types.c
|
||
|
nodist_libxsltmod_la_SOURCES = libxslt-py.c
|
||
|
libxsltmod_la_LIBADD = $(mylibs) $(PYTHON_LIBS)
|
||
|
+libxsltmod_la_LDFLAGS = $(WIN32_EXTRA_LDFLAGS) $(PYTHON_LDFLAGS) -module -avoid-version
|
||
|
|
||
|
libxslt.py: $(srcdir)/libxsl.py libxsltclass.py
|
||
|
cat $(srcdir)/libxsl.py libxsltclass.py > $@
|
||
|
|
||
|
-install-data-local:
|
||
|
- $(MKDIR_P) $(DESTDIR)$(pythondir)
|
||
|
- $(INSTALL) -m 0644 libxslt.py $(DESTDIR)$(pythondir)
|
||
|
- $(MKDIR_P) $(DESTDIR)$(DOCS_DIR)
|
||
|
- @(for doc in $(DOCS) ; \
|
||
|
- do $(INSTALL) -m 0644 $(srcdir)/$$doc $(DESTDIR)$(DOCS_DIR) ; done)
|
||
|
-
|
||
|
-uninstall-local:
|
||
|
- rm -f $(DESTDIR)$(pythondir)/libxslt.py
|
||
|
- rm -rf $(DESTDIR)$(DOCS_DIR)
|
||
|
-
|
||
|
GENERATE = generator.py
|
||
|
API_DESC = $(top_srcdir)/doc/libxslt-api.xml $(srcdir)/libxslt-python-api.xml
|
||
|
GENERATED= libxsltclass.py \
|