In Ubuntu's current development release, the Python header files have
been split up for multiarch reasons. /usr/include/python2.7/Python.h
includes pyconfig.h, which is in
/usr/include/x86_64-linux-gnu/python2.7/. This causes a build failure
beacuse the architecture specific include directory is not searched by
the audit build system.
This patch uses the python-config tool, normally provided by the Python
development package, to determine include directories and improves the
readability of the Python section of configure.ac by adding appropriate
indentation.
Signed-off-by: Tyler Hicks <tyhicks(a)canonical.com>
---
bindings/python/Makefile.am | 2 +-
configure.ac | 27 ++++++++++++++++-----------
swig/Makefile.am | 3 +--
3 files changed, 18 insertions(+), 14 deletions(-)
diff --git a/bindings/python/Makefile.am b/bindings/python/Makefile.am
index 4bbe75d..c53c235 100644
--- a/bindings/python/Makefile.am
+++ b/bindings/python/Makefile.am
@@ -26,6 +26,6 @@ CONFIG_CLEAN_FILES = *.loT *.rej *.orig
pyexec_LTLIBRARIES = auparse.la
auparse_la_SOURCES = auparse_python.c
-auparse_la_CPPFLAGS = -I$(top_srcdir)/auparse $(AM_CPPFLAGS)
-I/usr/include/python$(PYTHON_VERSION) -fno-strict-aliasing
+auparse_la_CPPFLAGS = -I$(top_srcdir)/auparse $(AM_CPPFLAGS) $(PYTHON_INCLUDES)
-fno-strict-aliasing
auparse_la_LDFLAGS = -module -avoid-version -Wl,-z,relro
auparse_la_LIBADD = ../../auparse/libauparse.la ../../lib/libaudit.la
diff --git a/configure.ac b/configure.ac
index 40972ce..f6ad07a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -88,20 +88,24 @@ if test x$use_python = xno ; then
python_found="no"
AC_MSG_RESULT(no)
else
-AC_MSG_RESULT(testing)
-AM_PATH_PYTHON
-if test -f /usr/include/python${am_cv_python_version}/Python.h ; then
- python_found="yes"
- AC_MSG_NOTICE(Python bindings will be built)
-else
- python_found="no"
- if test x$use_python = xyes ; then
- AC_MSG_ERROR([Python explicitly required and python headers found])
+ AC_MSG_RESULT(testing)
+ AM_PATH_PYTHON
+ AC_PATH_PROG([PYTHON_CONFIG], [python$PYTHON_VERSION-config python-config], no)
+ if test x$PYTHON_CONFIG = xno ; then
+ python_found="no"
+ if test x$use_python = xyes ; then
+ AC_MSG_ERROR([Python explicitly required and python-config not found])
+ else
+ AC_MSG_WARN("python-config not found - python bindings will not be made")
+ fi
else
- AC_MSG_WARN("Python headers not found - python bindings will not be made")
+ python_found="yes"
+ AC_MSG_NOTICE(Python bindings will be built)
+ AC_MSG_CHECKING(Python header include directories)
+ PYTHON_INCLUDES=`$PYTHON_CONFIG --includes`
+ AC_MSG_RESULT([$PYTHON_INCLUDES])
fi
fi
-fi
AM_CONDITIONAL(HAVE_PYTHON, test ${python_found} = "yes")
#auditd listener
@@ -274,6 +278,7 @@ fi
# See if we want to support lower capabilities for plugins
LIBCAP_NG_PATH
+AC_SUBST(PYTHON_INCLUDES)
AC_SUBST(DEBUG)
AC_SUBST(LIBWRAP_LIBS)
#AC_SUBST(libev_LIBS)
diff --git a/swig/Makefile.am b/swig/Makefile.am
index 5f26ac0..f204356 100644
--- a/swig/Makefile.am
+++ b/swig/Makefile.am
@@ -22,8 +22,7 @@
EXTRA_DIST = auditswig.i
CONFIG_CLEAN_FILES = *.loT *.rej *.orig
AM_CFLAGS = -fPIC -DPIC -fno-strict-aliasing
-PYLIBVER ?= python$(PYTHON_VERSION)
-INCLUDES = -I. -I$(top_builddir) -I${top_srcdir}/lib -I/usr/include/$(PYLIBVER)
+INCLUDES = -I. -I$(top_builddir) -I${top_srcdir}/lib $(PYTHON_INCLUDES)
LIBS = $(top_builddir)/lib/libaudit.la
pyexec_PYTHON = audit.py
pyexec_LTLIBRARIES = _audit.la
--
1.7.10.4