aboutsummaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac124
1 files changed, 120 insertions, 4 deletions
diff --git a/configure.ac b/configure.ac
index c20629b9c..73aaed8d2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -21,6 +21,7 @@ GNOME_COMMON_INIT
AC_PREREQ([2.59])
+AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_SRCDIR([configure.ac])
@@ -29,9 +30,6 @@ AC_SUBST([EPIPHANY_MAJOR])
AM_INIT_AUTOMAKE([dist-bzip2 no-dist-gzip check-news])
-dnl AC_SUBST([ACLOCAL_AMFLAGS], ["-I $ac_macro_dir \${ACLOCAL_FLAGS}"])
-AC_SUBST([ACLOCAL_AMFLAGS], ["\${ACLOCAL_FLAGS}"])
-
AM_MAINTAINER_MODE
if test "x$enable_maintainer_mode" = "xyes"; then
AC_DEFINE([MAINTAINER_MODE],[1],[Define to enable 'maintainer-only' behaviour])
@@ -439,13 +437,131 @@ DBUS_REQUIRED=0.22
DBUS_GLIB_REQUIRED=0.22
if test "x$enable_dbus" = "xyes" ; then
- AC_DEFINE([ENABLE_DBUS],[1],[Define if DBUS support is enabled (default=disabled)])
+ AC_DEFINE([ENABLE_DBUS],[1],[Define if DBUS support is enabled])
PKG_CHECK_MODULES([DBUS], [dbus-1 >= $DBUS_REQUIRED dbus-glib-1 >= $DBUS_GLIB_REQUIRED])
fi
AM_CONDITIONAL([ENABLE_DBUS], [test "x$enable_dbus" = "xyes"])
+dnl ******
+dnl Python
+dnl ******
+
+AC_MSG_CHECKING([whether python support is requested])
+
+AC_ARG_ENABLE([python],
+ AS_HELP_STRING([--enable-python],[Enable python support]),
+ [enable_python=$enableval have_python=$enableval],
+ [enable_python=autodetect have_python=yes])
+
+AC_MSG_RESULT([$enable_python])
+
+if test "x$have_python" != "xno"; then
+ AM_PATH_PYTHON([2.3],[],[no])
+
+ if test "x$PYTHON" = "x:"; then
+ have_python=no
+ fi
+fi
+
+if test "x$have_python" != "xno"; then
+ AM_CHECK_PYTHON_HEADERS([],[have_python=no])
+fi
+
+if test "x$have_python" != "xno"; then
+ PY_PREFIX=`$PYTHON -c 'import sys ; print sys.prefix'`
+ PY_EXEC_PREFIX=`$PYTHON -c 'import sys ; print sys.exec_prefix'`
+ PYTHON_LIBS="-lpython$PYTHON_VERSION"
+ PYTHON_LIB_LOC="-L$PY_EXEC_PREFIX/lib/python$PYTHON_VERSION/config"
+ PYTHON_CFLAGS="-I$PY_PREFIX/include/python$PYTHON_VERSION"
+ PYTHON_MAKEFILE="$PY_EXEC_PREFIX/lib/python$PYTHON_VERSION/config/Makefile"
+ PYTHON_LOCALMODLIBS=`sed -n -e 's/^LOCALMODLIBS=\(.*\)/\1/p' $PYTHON_MAKEFILE`
+ PYTHON_BASEMODLIBS=`sed -n -e 's/^BASEMODLIBS=\(.*\)/\1/p' $PYTHON_MAKEFILE`
+ PYTHON_OTHER_LIBS=`sed -n -e 's/^LIBS=\(.*\)/\1/p' $PYTHON_MAKEFILE`
+ PYTHON_EXTRA_LIBS="$PYTHON_LOCALMODLIBS $PYTHON_BASEMODLIBS $PYTHON_OTHER_LIBS"
+ AC_SUBST([PYTHON_LIBS])
+ AC_SUBST([PYTHON_LIB_LOC])
+ AC_SUBST([PYTHON_CFLAGS])
+ AC_SUBST([PYTHON_EXTRA_LIBS])
+
+ dnl FIXME: do we really need this test?
+ AC_MSG_CHECKING([whether we can build a shared library depending on libpython])
+ rm -rf testpython
+ mkdir testpython
+ cd testpython
+ cat > testpython.c <<EOF
+#include <Python.h>
+int testpython (void)
+{
+Py_Exit (0);
+}
+EOF
+
+ if /bin/sh ../libtool --mode=compile ${CC} $PYTHON_CFLAGS -c testpython.c >/dev/null 2>&1 && \
+ /bin/sh ../libtool --mode=link ${CC} -o testpython.la -rpath `pwd` -module -avoid-version $PYTHON_LIB_LOC testpython.lo $PYTHON_LIBS $PYTHON_EXTRA_LIBS >/dev/null 2>&1 && \
+ grep 'dlname.*testpython' testpython.la >/dev/null 2>&1; then
+ result=yes
+ else
+ result=no
+ have_python=no
+ fi
+ cd ..
+ rm -rf testpython
+ AC_MSG_RESULT([$result])
+fi
+
+if test "x$have_python" != "xno"; then
+ PYGTK_REQUIRED=2.6.0
+ GNOME_PYTHON_REQUIRED=2.6.0
+
+ PKG_CHECK_MODULES([PYGTK], [pygtk-2.0 >= $PYGTK_REQUIRED gnome-python-2.0 >= $GNOME_PYTHON_REQUIRED],
+ [],[have_python=no])
+
+ AC_SUBST([PYGTK_CFLAGS])
+ AC_SUBST([PYGTK_LIBS])
+fi
+
+if test "x$have_python" != "xno"; then
+ AC_MSG_CHECKING([for pygtk defs])
+ PYGTK_DEFSDIR=`$PKG_CONFIG --variable=defsdir pygtk-2.0`
+ AC_MSG_RESULT([$PYGTK_DEFSDIR])
+
+ AC_MSG_CHECKING([for pygtk codegen])
+ PYGTK_CODEGEN="$PYTHON `$PKG_CONFIG --variable=codegendir pygtk-2.0`/codegen.py"
+ AC_MSG_RESULT([$PYGTK_CODEGEN])
+
+ AC_SUBST([PYGTK_DEFSDIR])
+ AC_SUBST([PYGTK_CODEGEN])
+
+ dnl Check for -fno-strict-aliasing
+ FLAGS="-fno-strict-aliasing"
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $FLAGS"
+ AC_MSG_CHECKING([whether [$]CC understands $FLAGS])
+ AC_TRY_COMPILE([], [], [compiler_has_option=yes], [compiler_has_option=no])
+ CFLAGS="$save_CFLAGS"
+ AC_MSG_RESULT($compiler_has_option)
+ if test $compiler_has_option = yes; then
+ NO_STRICT_ALIASING_CFLAGS="$FLAGS"
+ fi
+ AC_SUBST([NO_STRICT_ALIASING_CFLAGS])
+fi
+
+if test "x$have_python" != "xyes"; then
+ if test "x$enable_python" = "xyes"; then
+ AC_MSG_ERROR([Python not found])
+ elif test "x$enable_python" = "xautodetect"; then
+ enable_python=no
+ AC_MSG_WARN([Python not found, disabling python support])
+ fi
+elif test "x$enable_python" != "xno"; then
+ enable_python=yes
+ AC_DEFINE([ENABLE_PYTHON],[1],[Define to compile with python support])
+fi
+
+AM_CONDITIONAL([ENABLE_PYTHON],[test "x$enable_python" = "xyes"])
+
dnl *******************************
dnl Add warning flags
dnl *******************************