From 1a735e300a0ecd35d41f68f3c776350bb18f763a Mon Sep 17 00:00:00 2001 From: Emmanuel Dreyfus Date: Wed, 29 Oct 2014 20:35:10 +0100 Subject: glupy: portability fixes Fixes portability problems so that NetBSD passes tests/features/glupy.t - Use python-config to detect python build environment on all systems, not just Linux and Darwin. - Get the site-package directory from python and make sure we install glupy.py there, Previously we installed within glusterfs prefix, which caused a problem if it was different that python's prefix. - Set PYTHONPATH for tests so that the detected site-packages is used in python's search path. This should be useless, but let us have it just in case. - Pass glupy.so path from glusterfsd to glupy.py through an environment variable and use it in CDLL instead of "", as the later seems not portable (at least it fails on NetBSD). - Use gil_init_key pthread_getspecific to avoid deadlocks (that code was #ifdef out, perhaps because it was not needed on Linux, but it seems to be required for NetBSD. - Recover the error message from Python and send it to the logs to help debugging problems. BUG: 1129939 Change-Id: Icc71e77d6940f0759cc14c5c5cf7ca6fa431e0d2 Signed-off-by: Emmanuel Dreyfus Reviewed-on: http://review.gluster.org/8978 Tested-by: Gluster Build System Reviewed-by: Jeff Darcy --- configure.ac | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 3757c33df72..4de524f8bda 100644 --- a/configure.ac +++ b/configure.ac @@ -219,6 +219,7 @@ AC_CANONICAL_HOST AC_PROG_CC AC_DISABLE_STATIC AC_PROG_LIBTOOL +AC_SUBST([shrext_cmds]) AC_CHECK_PROG([RPCGEN], [rpcgen], [yes], [no]) @@ -1003,18 +1004,9 @@ saved_CFLAGS=$CFLAGS saved_CPPFLAGS=$CPPFLAGS saved_LDFLAGS=$LDFLAGS -case $host_os in - linux*) - CFLAGS="`${PYTHON}-config --cflags`" - CPPFLAGS=$CFLAGS - LDFLAGS="-L`${PYTHON}-config --prefix`/lib `${PYTHON}-config --ldflags`" - ;; - darwin*) - CFLAGS="`${PYTHON}-config --cflags`" - CPPFLAGS=$CFLAGS - LDFLAGS="-L`${PYTHON}-config --prefix`/lib `${PYTHON}-config --ldflags`" - ;; -esac +CFLAGS="`${PYTHON}-config --cflags`" +CPPFLAGS=$CFLAGS +LDFLAGS="-L`${PYTHON}-config --prefix`/lib `${PYTHON}-config --ldflags`" AC_CHECK_HEADERS([python$PYTHON_VERSION/Python.h],[have_Python_h=yes],[]) AC_ARG_ENABLE([glupy], @@ -1065,12 +1057,14 @@ case $host_os in esac if test "x$BUILD_GLUPY" = "xyes"; then + BUILD_PYTHON_SITE_PACKAGES=`$PYTHON -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())'` BUILD_PYTHON_INC=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_inc()"` BUILD_PYTHON_LIB=python$PYTHON_VERSION GLUPY_SUBDIR=glupy GLUPY_SUBDIR_MAKEFILE=xlators/features/glupy/Makefile GLUPY_SUBDIR_SRC_MAKEFILE=xlators/features/glupy/src/Makefile echo "building glupy with -isystem $BUILD_PYTHON_INC -l $BUILD_PYTHON_LIB" + AC_SUBST(BUILD_PYTHON_SITE_PACKAGES) AC_SUBST(BUILD_PYTHON_INC) AC_SUBST(BUILD_PYTHON_LIB) AC_SUBST(GLUPY_SUBDIR) -- cgit