3.9.2 unleashed
[claws.git] / configure.ac
index 07cda6f48a8f7ae155cc263234b1b5a8c5a64b5e..e1d166b2b3c0039dec88d893f12e8d8f6db92320 100644 (file)
@@ -18,9 +18,10 @@ if test \( -d .git \); then
        AC_MSG_ERROR([*** git not found. See http://git-scm.com/])
     else
        GIT_VERSION=`git describe --abbrev=6 --dirty --always`
+       echo "echo ${GIT_VERSION}" > ./version
     fi
 else
-    GIT_VERSION=`sh -c '. ./version'`
+    GIT_VERSION=`sh -c ". ./$srcdir/version"`
 fi
 MAJOR_VERSION=${GIT_VERSION%%.*}
 MINOR_VERSION=${GIT_VERSION#*.}
@@ -1237,20 +1238,28 @@ AM_PATH_PYTHON([2.5], [
 
        if test x"$HAVE_PYTHON" = xyes; then
                # libpython.so
-               PYTHON_SO_FILE="libpython${PYTHON_VERSION}.so"
-               found_libpython_so="no"
-               if test -f "$PYTHON_PREFIX/lib/$PYTHON_SO_FILE"; then
-                       found_libpython_so="yes"
-                       PYTHON_SHARED_LIB=`python -c "import os,sys; print os.path.basename(os.path.realpath(\"$PYTHON_PREFIX/lib/$PYTHON_SO_FILE\"))"`
-               fi
-               if test -f "$PYTHON_PREFIX/lib64/$PYTHON_SO_FILE"; then
-                       found_libpython_so="yes"
-                       PYTHON_SHARED_LIB=`python -c "import os,sys; print os.path.basename(os.path.realpath(\"$PYTHON_PREFIX/lib64/$PYTHON_SO_FILE\"))"`
-               fi
+               PYTHON_SHARED_LIB="libpython${PYTHON_VERSION}.so"
+               _save_libs="$LIBS"
+               LIBS="-ldl"
+               AC_MSG_CHECKING([whether to dlopen $PYTHON_SHARED_LIB works])
+               AC_RUN_IFELSE(
+                       [AC_LANG_PROGRAM(
+                               [#include <dlfcn.h>
+                                #define PYTHON_SO_FILE "${PYTHON_SHARED_LIB}"
+                               ],
+                               [if (!dlopen(PYTHON_SO_FILE, RTLD_NOW | RTLD_GLOBAL)) return 1; return 0;])
+                       ],
+                       [found_libpython_so="yes"],
+                       [found_libpython_so="no"],
+                       [AC_MSG_FAILURE([cross-compiling not supported])])
                if test x"$found_libpython_so" != x"yes"; then
-                       AC_MSG_WARN(Could not find Python shared libary: $PYTHON_SO_FILE does not exist. Maybe you need to install development packages for Python.)
+                       AC_MSG_RESULT(no)
+                       AC_MSG_WARN(Could not find Python shared libary: ${PYTHON_SHARED_LIB}. Maybe you need to install development packages for Python.)
                        HAVE_PYTHON=no
+               else
+                       AC_MSG_RESULT(yes)
                fi
+               LIBS="$_save_libs";
        fi
        if test x"$HAVE_PYTHON" = xyes; then
                PKG_CHECK_MODULES(PYGTK, pygtk-2.0 >= 2.10.3, [AC_DEFINE(ENABLE_PYTHON, [1], [Enable Python support])], HAVE_PYTHON=no)
@@ -1964,7 +1973,6 @@ manual/de/dist/ps/Makefile
 manual/de/dist/html/Makefile
 manual/de/dist/txt/Makefile
 claws-mail.pc
-version
 ])
 
 dnl Output the configuration summary