medit/m4/moo-pygtk.m4

117 lines
3.4 KiB
Plaintext
Raw Normal View History

2005-10-30 13:16:22 -08:00
##############################################################################
# _MOO_AC_CHECK_PYGTK_REAL(python-version,action-if-found,action-if-not-found)
2005-10-30 13:16:22 -08:00
# checks pygtk stuff
#
AC_DEFUN([_MOO_AC_CHECK_PYGTK_REAL],[
2007-06-16 04:26:44 -07:00
PKG_CHECK_MODULES(PYGTK$1,pygtk-2.0 >= 2.6.0 pycairo,[
AC_MSG_CHECKING([whether pygtk can be used])
save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $PYGTK[]$1[]_CFLAGS $PYTHON[]$1[]_INCLUDES"
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $PYGTK[]$1[]_CFLAGS $PYTHON[]$1[]_INCLUDES"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <pygobject.h>
2007-06-16 04:26:44 -07:00
#include <pycairo.h>
int main ()
{
PyObject *object = pygobject_new (NULL);
return 0;
}]])],[
AC_MSG_RESULT(yes)
PYGTK_DEFS_DIR=`$PKG_CONFIG --variable=defsdir pygtk-2.0`
AC_SUBST(PYGTK_DEFS_DIR)
PYGTK_CODEGEN_DIR=`$PKG_CONFIG --variable=codegendir pygtk-2.0`
AC_SUBST(PYGTK_CODEGEN_DIR)
m4_if([$1],,,[
AC_SUBST(PYGTK[]$1[]_DEFS_DIR,[$PYGTK_DEFS_DIR])
AC_SUBST(PYGTK[]$1[]_CODEGEN_DIR,[$PYGTK_CODEGEN_DIR])
])
AC_MSG_NOTICE([pygtk defs dir: $PYGTK_DEFS_DIR])
m4_if([$2],[],[:],[$2])
2005-10-30 13:16:22 -08:00
],[
AC_MSG_RESULT([no])
m4_if([$3],[],[:],[$3])
2005-10-30 13:16:22 -08:00
])
CFLAGS="$save_CFLAGS"
CPPFLAGS="$save_CPPFLAGS"
],[
m4_if([$3],[],[:],[$3])
])
2005-10-30 13:16:22 -08:00
])
##############################################################################
# _MOO_AC_CHECK_PYGTK(action-if-found,action-if-not-found)
2005-10-30 13:16:22 -08:00
# checks pygtk stuff
#
AC_DEFUN([_MOO_AC_CHECK_PYGTK],[
2005-10-30 13:16:22 -08:00
AC_REQUIRE([MOO_AC_CHECK_OS])
if test "x$MOO_OS_CYGWIN" != "xyes"; then
if test "x$MOO_OS_MINGW" = "xyes"; then
_MOO_AC_CHECK_PYGTK_REAL([24],[$1],[$2])
_MOO_AC_CHECK_PYGTK_REAL([25],[$1],[$2])
2005-10-30 13:16:22 -08:00
else
_MOO_AC_CHECK_PYGTK_REAL(,[$1],[$2])
2005-10-30 13:16:22 -08:00
fi
fi
])
##############################################################################
# MOO_AC_PYTHON()
2005-10-30 13:16:22 -08:00
#
AC_DEFUN_ONCE([MOO_AC_PYTHON],[
AC_REQUIRE([MOO_AC_CHECK_OS])
MOO_USE_PYTHON=true
_moo_want_python="auto"
_moo_python_version=2.2
AC_ARG_WITH([python],AC_HELP_STRING([--with-python], [whether to compile python support (default = YES)]),[
if test "x$with_python" = "xno"; then
MOO_USE_PYTHON=false
elif test "x$with_python" = "xyes"; then
_moo_want_python="yes"
_moo_python_version="2.2"
else
_moo_want_python="yes"
_moo_python_version="$with_python"
2005-10-30 13:16:22 -08:00
fi
])
if test "x$MOO_OS_CYGWIN" = "xyes"; then
MOO_USE_PYTHON=false
fi
if $MOO_USE_PYTHON; then
MOO_USE_PYTHON=false
MOO_AC_CHECK_PYTHON($_moo_python_version,[
_MOO_AC_CHECK_PYGTK([
MOO_USE_PYTHON=true
_MOO_SPLIT_VERSION_PKG(PYGTK, pygtk-2.0)
AC_SUBST(PYGTK_VERSION)
AC_SUBST(PYGTK_MAJOR_VERSION)
AC_SUBST(PYGTK_MINOR_VERSION)
AC_SUBST(PYGTK_MICRO_VERSION)
])
])
if $MOO_USE_PYTHON; then
AC_MSG_NOTICE([compiling python support])
elif test "x$_moo_want_python" = "xyes"; then
AC_MSG_ERROR([python support requested but python cannot be used])
elif test "x$_moo_want_python" = "xauto"; then
AC_MSG_WARN([disabled python support])
else
AC_MSG_NOTICE([disabled python support])
2005-10-30 13:16:22 -08:00
fi
fi
2006-04-29 23:02:19 -07:00
AM_CONDITIONAL(MOO_USE_PYTHON, $MOO_USE_PYTHON)
if $MOO_USE_PYTHON; then
AC_DEFINE(MOO_USE_PYTHON, 1, [build python bindings and plugin])
fi
2005-10-30 13:16:22 -08:00
])