Bug 4109

Summary: package config depends on python unconditionally
Product: unbound Reporter: Petr Menšík <pemensik>
Component: serverAssignee: unbound team <unbound-team>
Status: RESOLVED FIXED    
Severity: minor CC: cathya, pemensik, wouter
Priority: P5    
Version: 1.7.2   
Hardware: x86_64   
OS: Linux   
Attachments: patch using pythonX from pkg-config

Description Petr Menšík 2018-06-26 19:15:20 CEST
Created attachment 507 [details]
patch using pythonX from pkg-config

When --with-pythonmodule --with-pyunbound enabled, libunbound.pc will contain requirement to python.

If ./configure --with-pythonmodule --with-pyunbound PYTHON=python3 
is used, it will require python.pc anyway. On both Fedora and Debian they point to python2. I want python3 module only, but there is no way to not depend on python2. On both Debian and Fedora there are available pkg-config for python2, python3 and versions with minor versions as well. I think they should be used if possible.
Comment 1 Wouter Wijngaards 2018-06-27 07:45:45 CEST
Hi Petr,

I have turned it into the patch below, to move the AC_REQUIRE into the option branch for python.  autoconf errors on the AC_REQUIRE not inside a function.

Thanks for the patch!

Index: configure.ac
===================================================================
--- configure.ac (revision 4756)
+++ configure.ac (working copy)
@@ -586,7 +586,10 @@
         CPPFLAGS="$PYTHON_CPPFLAGS"
       fi
       ub_have_python=yes
-      PC_PY_DEPENDENCY="python"
+      PKG_PROG_PKG_CONFIG
+      PKG_CHECK_EXISTS(["python${PY_MAJOR_VERSION}"],
+                       [PC_PY_DEPENDENCY="python${PY_MAJOR_VERSION}"],
+                       [PC_PY_DEPENDENCY="python"])
       AC_SUBST(PC_PY_DEPENDENCY)
 
       # Check for SWIG

Best regards, Wouter