Dear all:

As mentioned in another thread, I am working on getting the current
trunk to build on CentOS 4.4 (as well as other distroes).

With the following patch, it can correctly setup the python and apr
include directories.

Brad, it would be great if you can test this under SuSE to see if
everything works as it should.

Comments welcome.

Thanks,

Bernard
Index: configure.in
===================================================================
--- configure.in	(revision 805)
+++ configure.in	(working copy)
@@ -240,17 +240,32 @@
 if test "$enable_python" = yes ; then
   echo
   echo Checking for python
-dnl   AC_CHECK_LIB(python2.4, set_python_path, [echo "The ganglia python support module uses Python 2.4"], [echo "Python library not found"], [-lm])
-   AC_CHECK_HEADERS(python/Python.h, [ found_python_header=yes ])
-      echo
-      echo "The Ganglia python support module expects to use the Python 2.4 libraries."
-      echo "Make sure that you either have the devel package for Python 2.4 installed "
-      echo "or you make the appropriate changes to the Makefile.am to support your "
-      echo "version of the Python libraries."
+
+  # check for Python executable
+  if test -z "$PYTHON_BIN"; then
+    AC_PATH_PROG(PYTHON_BIN, python)
+    if test -z "$PYTHON_BIN"; then
+      AC_MSG_ERROR(python binary not found in path)
+    fi
+  fi
+
+  # find out python version
+  AC_MSG_CHECKING(Python version)
+  PyVERSION=`$PYTHON_BIN -c ['import sys; print sys.version[:3]'`]
+  PyMAJVERSION=`$PYTHON_BIN -c ['import sys; print sys.version[:1]'`]
+  AC_MSG_RESULT($PyVERSION)
+  PYTHON_VERSION=$PyVERSION
+  AC_SUBST(PYTHON_VERSION)
+
+dnl   AC_CHECK_LIB(python{PyVERSION}, set_python_path, [echo "The ganglia python support module requires Python to compile"], [echo "Python library not found"], [-lm])
+   AC_CHECK_HEADERS(python$PyVERSION/Python.h python/Python.h, [ found_python_header=yes ])
    if test "$found_python_header" != yes; then
       echo
       echo "No Python devel package detected. "
       exit;
+   else
+      PYTHON_INCLUDES="-I/usr/include/python$PyVERSION -I/usr/include/python"
+      AC_SUBST(PYTHON_INCLUDES)
    fi
 fi
 
@@ -264,7 +279,15 @@
   if test x"$libaprpath" != x && test x"$libaprpath" != xyes ; then
     CFLAGS="$CFLAGS -I$libaprpath/include"
     LDFLAGS="$LDFLAGS -L$libaprpath/lib"
+  else
+    AC_PATH_PROG(APR_CONFIG, apr-1-config)
+    if test -z "$APR_CONFIG"; then
+      AC_MSG_ERROR(apr-1-config binary not found in path)
+    fi
+    APR_INCLUDES=`$APR_CONFIG --includes`
+    AC_SUBST(APR_INCLUDES)
   fi
+
   AC_CHECK_LIB(apr-1, apr_socket_send)
   if test $ac_cv_lib_apr_1_apr_socket_send = yes; then
     echo "The ganglia utilities use the Apache Portable Runtime functions (http://www.apache.org/)"
Index: gmond/modules/python/mod_python.c
===================================================================
--- gmond/modules/python/mod_python.c	(revision 805)
+++ gmond/modules/python/mod_python.c	(working copy)
@@ -46,7 +46,7 @@
 #include <apr_tables.h>
 #include <apr_strings.h>
 
-#include <python/Python.h>
+#include <Python.h>
 #include <dirent.h>
 #include <sys/stat.h>
 
Index: gmond/modules/python/Makefile.am
===================================================================
--- gmond/modules/python/Makefile.am	(revision 805)
+++ gmond/modules/python/Makefile.am	(working copy)
@@ -2,6 +2,7 @@
 
 pkglib_LTLIBRARIES    = modpython.la
 modpython_la_SOURCES = mod_python.c 
-modpython_la_LDFLAGS = -module -lpython2.4
+modpython_la_LDFLAGS = -module [EMAIL PROTECTED]@
 
 EXTRA_DIST = ../conf.d/modpython.conf
+INCLUDES = @APR_INCLUDES@ @PYTHON_INCLUDES@
Index: gmond/modules/cpu/Makefile.am
===================================================================
--- gmond/modules/cpu/Makefile.am	(revision 805)
+++ gmond/modules/cpu/Makefile.am	(working copy)
@@ -5,3 +5,4 @@
 modmulticpu_la_LDFLAGS = -module
 
 EXTRA_DIST = ../conf.d/multicpu.conf
+INCLUDES = @APR_INCLUDES@
Index: gmond/modules/example/Makefile.am
===================================================================
--- gmond/modules/example/Makefile.am	(revision 805)
+++ gmond/modules/example/Makefile.am	(working copy)
@@ -5,3 +5,4 @@
 modexample_la_LDFLAGS = -module
 
 EXTRA_DIST = ../conf.d/example.conf
+INCLUDES = @APR_INCLUDES@
Index: gmond/Makefile.am
===================================================================
--- gmond/Makefile.am	(revision 805)
+++ gmond/Makefile.am	(working copy)
@@ -8,8 +8,9 @@
 GLDFLAGS = -static
 else
 GCFLAGS = -D_LARGEFILE64_SOURCE
-GLDADD = 
-GLDFLAGS = 
+GLDADD =
+GLDFLAGS =
+INCLUDES = @APR_INCLUDES@
 endif
 
 AM_CFLAGS = -I$(top_builddir)/lib -I$(top_builddir)/libmetrics/ $(GCFLAGS) 
Index: lib/Makefile.am
===================================================================
--- lib/Makefile.am	(revision 805)
+++ lib/Makefile.am	(working copy)
@@ -8,7 +8,8 @@
 else
 GCFLAGS = -D_LARGEFILE64_SOURCE
 GLDADD = 
-GLDFLAGS = 
+GLDFLAGS =
+INCLUDES = @APR_INCLUDES@
 endif
 
 AM_CFLAGS = -I.. -I. -I$(top_builddir)/libmetrics/ $(GCFLAGS)  
Index: Makefile.am
===================================================================
--- Makefile.am	(revision 805)
+++ Makefile.am	(working copy)
@@ -14,6 +14,7 @@
 SRCLIB_SUBDIR = 
 EXTRA_SUBDIRS = "./web"
 EXTRA_DIST_FILES = srclib/Makefile.am srclib/Makefile.in
+INCLUDES = @APR_INCLUDES@
 endif
 
 AUTOMAKE_OPTIONS = dist-bzip2 dist-tarZ dist-shar dist-zip
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Ganglia-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ganglia-developers

Reply via email to