* [PATCH] Use python-config to find python include directories
@ 2012-12-20 21:17 Tyler Hicks
2012-12-20 21:28 ` Tyler Hicks
0 siblings, 1 reply; 2+ messages in thread
From: Tyler Hicks @ 2012-12-20 21:17 UTC (permalink / raw)
To: Steve Grubb; +Cc: linux-audit
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@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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Use python-config to find python include directories
2012-12-20 21:17 [PATCH] Use python-config to find python include directories Tyler Hicks
@ 2012-12-20 21:28 ` Tyler Hicks
0 siblings, 0 replies; 2+ messages in thread
From: Tyler Hicks @ 2012-12-20 21:28 UTC (permalink / raw)
To: Steve Grubb; +Cc: linux-audit
[-- Attachment #1.1: Type: text/plain, Size: 459 bytes --]
On 2012-12-20 13:17:17, Tyler Hicks wrote:
> 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/.
I'm not sure if this sort of a layout is going to become common or not
(I would assume not). But either way, using python-config in the
configure step seems to be the right thing to do.
Tyler
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-12-20 21:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-20 21:17 [PATCH] Use python-config to find python include directories Tyler Hicks
2012-12-20 21:28 ` Tyler Hicks
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox