[PATCH] Fix build without Python
Baruch Siach <[email protected]>
| Newsgroups | gmane.comp.hardware.lirc |
|---|---|
| Message-ID | <b400178c988873c2401db939b79b80bdc1b98f6b.1503859002.git.baruch@tkos.co.il> |
Don't define HAVE_PYTHON35 when PYTHON_LIBS is empty.
Also, don't build Python dependent code when HAVE_PYTHON35 is not
defined.
This fixes build failures like:
Makefile:1616: recipe for target 'python-pkg/dist/lirc-0.10.0.tar.gz' failed
make[3]: *** [python-pkg/dist/lirc-0.10.0.tar.gz] Error 1
python-pkg/lirc/_client.c:1:20: fatal error: Python.h: No such file or directory
#include <Python.h>
^
---
Makefile.am | 2 ++
configure.ac | 3 ++-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/Makefile.am b/Makefile.am
index d1f118776a20..2b44f72f70ec 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -106,6 +106,7 @@ dist_py_pkg_doc_DATA = python-pkg/doc/Doxyfile \
libpython = $(libdir)/python$(PYTHON_VERSION)
pydir = $(libpython)/site-packages/lirc
+if HAVE_PYTHON35
py_LTLIBRARIES = python-pkg/lib/_client.la
python_pkg_lib__client_la_SOURCES = \
python-pkg/lirc/_client.c
@@ -118,6 +119,7 @@ python_pkg_lib__client_la_LDFLAGS = \
$(PYTHON_LIBS)
python_pkg_lib__client_la_LIBADD = \
lib/liblirc_client.la
+endif
pylint: .phony
$(MAKE) -C tools pylint
diff --git a/configure.ac b/configure.ac
index 4882931689ff..dcf9703c3530 100644
--- a/configure.ac
+++ b/configure.ac
@@ -51,7 +51,8 @@ test -z "$PYTHON_LIBS" && \
test -n "$PYTHON_LIBS" || \
AC_MSG_WARN([No python package found (missing devel package?)])
python_version_nodots=$(echo $PYTHON_VERSION | tr -d '.')
-AM_CONDITIONAL(HAVE_PYTHON35, [test $python_version_nodots -ge 35])
+AM_CONDITIONAL(HAVE_PYTHON35, [test -n "$PYTHON_LIBS" && \
+ test $python_version_nodots -ge 35])
CFLAGS="$CFLAGS $PYTHON_CFLAGS"
--
2.14.1
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot