... and yet another one.

ATM, building rpm fails if python-devel isn't installed.

The patch below adds a check for presence of Python.h to configure.ac
and applies automake-conditionals to switch off building rpm's python
bindings if Python.h can't be found.

Ralf

diff -r 425cce5ee453 configure.ac
--- a/configure.ac	Sun Aug 05 11:30:55 2007 +0300
+++ b/configure.ac	Mon Aug 06 10:30:23 2007 +0200
@@ -863,12 +863,19 @@ else
   WITH_PYTHON_LIB=`${__PYTHON} -c 'from distutils.sysconfig import *; print get_python_lib(1)'` 
   WITH_PYTHON_SUBDIR=python
   WITH_PYTHON_SUBPACKAGE=1
+  save_CPPFLAGS="$CPPFLAGS"
+  CPPFLAGS="$CPPFLAGS -I$WITH_PYTHON_INCLUDE"
+  AC_CHECK_HEADER([Python.h],
+    [WITH_PYTHON_SUBPACKAGE=1],
+    [WITH_PYTHON_SUBPACKAGE=0])
+  CPPFLAGS="$save_CPPFLAGS"
 fi
 
 AC_SUBST(WITH_PYTHON_SUBDIR)
-AC_SUBST(WITH_PYTHON_SUBPACKAGE)
 AC_SUBST(WITH_PYTHON_INCLUDE)
 AC_SUBST(WITH_PYTHON_LIB)
+
+AM_CONDITIONAL(PYTHON,[test "$WITH_PYTHON_SUBPACKAGE" = "1"])
 
 AC_PATH_PROG(__DOXYGEN, doxygen, no, $PATH)
 dnl
diff -r 425cce5ee453 python/Makefile.am
--- a/python/Makefile.am	Sun Aug 05 11:30:55 2007 +0300
+++ b/python/Makefile.am	Mon Aug 06 10:42:12 2007 +0200
@@ -2,10 +2,9 @@
 
 LINT = splint
 
+if PYTHON
 pylibdir = @WITH_PYTHON_LIB@
 pyincdir = @WITH_PYTHON_INCLUDE@
-
-SUBDIRS = 
 
 EXTRA_DIST = system.h rpmdebug-py.c rpm/__init__.py
 
@@ -61,3 +60,5 @@ splint_srcs = \
 .PHONY:	lint
 lint:
 	$(LINT) $(DEFS) $(AM_CPPFLAGS) $(splint_srcs)
+
+endif
_______________________________________________
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
https://lists.rpm.org/mailman/listinfo/rpm-maint

Reply via email to