[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bacula-devel] configure and python


Hi,

I have been busy with updating some OpenSUSE packages in the last days, 
as OpenSUSE 11.1 has been released last week. Unfortunately, building 
Bacula was not hassle-free.

Bacula's "configure" has a manually coded section for python handling. 
This section is not able to detect or link against the python 
installation in OpenSUSE 11.1 for two reasons:

configure looks for python versions 2.2 thru 2.5. OpenSUSE 11.1 brings 
python 2.6 as well as a beta of python 3.0.

a) The include path is not detected correctly (as python 2.6 is not
   checked)
b) The library that bacula tries to link is "python"; OpenSUSE ships the
   lib as "python2.6".

Disclaimer: I am neither a autoconf nor a python expert, so my fixes for 
these problems may well be wrong.

a) is easily fixable by adding "python2.6" for the $ver variable that
   configure checks.
b) python brings a "python-config" program that provides a "--includes"
   as well as a "--libs" argument. If configure can find python-config,
   it should use its results.

Patch (for trunk's configure.in only; my autoconf is a different version 
than yours, so please rebuild configure yourself :) attached. I have 
NOT tested whether python support still works, but at least bacula 
compiles well with the patch applied. As said, I am neither a Python 
nor a autoconf expert, so you may want to regard the patch as a proof 
of concept :)

Best regards and season's greetings
   Bastian

-- 
Collax GmbH . Burkheimer Straße 3 . 79111 Freiburg . Germany
p: +49 (0) 761-45684-24
f: +49 (0) 761-45684-10        www.collax.com

Geschäftsführer: William K. Hite / Boris Nalbach
AG München HRB 158898 . Ust.-IdNr: DE 814464942
\ Computers make very fast, very accurate mistakes.
Index: autoconf/configure.in
===================================================================
--- autoconf/configure.in	(revision 8229)
+++ autoconf/configure.in	(working copy)
@@ -886,35 +886,43 @@
        PYTHON_LIBS=
        if test "$withval" != "no"; then
 	  if test "$withval" = "yes"; then
-	     for python_root in /usr /usr/local /usr/sfw; do
-		for ver in python2.2 python2.3 python2.4 python2.5; do
-		   if test -f $python_root/include/${ver}/Python.h; then
-		      PYTHON_INCDIR=-I$python_root/include/${ver}
-		      if test -d $python_root/lib64/${ver}/config; then
-			 PYTHON_LIBS="-L$python_root/lib64/${ver}/config -l${ver}"
+	     if test -e /usr/bin/python-config ; then
+		PYTHON_INCDIR=`/usr/bin/python-config --includes`
+		PYTHON_LIBS=`/usr/bin/python-config --libs`
+	     else
+	        for python_root in /usr /usr/local /usr/sfw; do
+		   for ver in python2.2 python2.3 python2.4 python2.5 python2.6; do
+		      if test -f $python_root/include/${ver}/Python.h; then
+		         PYTHON_INCDIR=-I$python_root/include/${ver}
+		         if test -d $python_root/lib64/${ver}/config; then
+			    PYTHON_LIBS="-L$python_root/lib64/${ver}/config -l${ver}"
+		         else
+			    PYTHON_LIBS="-L$python_root/lib/${ver}/config -l${ver}"
+		         fi
+		         break 
+		      fi
+		   done
+	        done
+
+	        if test x$PYTHON_INCDIR = x; then
+		   if test -f $prefix/include/Python.h; then
+		      PYTHON_INCDIR=-I$prefix/include
+		      if test -d $prefix/lib64/config; then
+		         PYTHON_LIBS="-L$prefix/lib64/config -lpython"
 		      else
-			 PYTHON_LIBS="-L$python_root/lib/${ver}/config -l${ver}"
+		         PYTHON_LIBS="-L$prefix/lib/config -lpython"
 		      fi
-		      break 
-		   fi
-		done
-	     done
-
-	     if test x$PYTHON_INCDIR = x; then
-		if test -f $prefix/include/Python.h; then
-		   PYTHON_INCDIR=-I$prefix/include
-		   if test -d $prefix/lib64/config; then
-		      PYTHON_LIBS="-L$prefix/lib64/config -lpython"
 		   else
-		      PYTHON_LIBS="-L$prefix/lib/config -lpython"
+		      AC_MSG_RESULT(no)
+		      AC_MSG_ERROR(Unable to find Python.h in standard locations)
 		   fi
-		else
-		   AC_MSG_RESULT(no)
-		   AC_MSG_ERROR(Unable to find Python.h in standard locations)
-		fi
+	        fi
 	     fi
 	  else
-	     if test -f $withval/Python.h; then
+	     if test -e $withval/bin/python-config ; then
+		PYTHON_INCDIR=`$withval/bin/python-config --includes`
+		PYTHON_LIBS=`$withval/bin/python-config --libs`
+	     elif test -f $withval/Python.h; then
 		PYTHON_INCDIR=-I$withval
 		PYTHON_LIBS="-L$withval/config -lpython"
 	     elif test -f $withval/include/Python.h; then
------------------------------------------------------------------------------
_______________________________________________
Bacula-devel mailing list
Bacula-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/bacula-devel


This mailing list archive is a service of Copilotco.