2006-04-29 09:10:57 -07:00
|
|
|
##############################################################################
|
|
|
|
# _MOO_AC_PYGTK_CODEGEN
|
|
|
|
#
|
|
|
|
AC_DEFUN([_MOO_AC_PYGTK_CODEGEN],[
|
2006-06-14 21:43:34 -07:00
|
|
|
AC_ARG_WITH([custom-codegen], AC_HELP_STRING([--with-custom-codegen], [whether to use custom copy of pygtk codegen (default = yes)]),[
|
2006-04-29 09:10:57 -07:00
|
|
|
if test x$with_custom_codegen = "xno"; then
|
|
|
|
MOO_USE_CUSTOM_CODEGEN="no"
|
|
|
|
AC_MSG_NOTICE([using installed codegen])
|
|
|
|
else
|
|
|
|
MOO_USE_CUSTOM_CODEGEN="yes"
|
|
|
|
AC_MSG_NOTICE([using patched codegen])
|
|
|
|
fi
|
|
|
|
],[
|
2006-06-14 21:43:34 -07:00
|
|
|
MOO_USE_CUSTOM_CODEGEN="yes"
|
|
|
|
AC_MSG_NOTICE([using patched codegen])
|
2006-04-29 09:10:57 -07:00
|
|
|
])
|
|
|
|
|
|
|
|
if test x$MOO_USE_CUSTOM_CODEGEN != xyes; then
|
|
|
|
AC_MSG_NOTICE([pygtk codegen dir: $PYGTK_CODEGEN_DIR])
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
|
|
|
|
2005-10-30 13:16:22 -08:00
|
|
|
##############################################################################
|
|
|
|
# _MOO_AC_CHECK_PYGTK_MINGW(version,action-if-found,action-if-not-found)
|
|
|
|
# checks pygtk stuff for mingw, it's broken
|
|
|
|
#
|
|
|
|
AC_DEFUN([_MOO_AC_CHECK_PYGTK_MINGW],[
|
|
|
|
# _AC_CHECK_PYGTK_MINGW
|
|
|
|
|
2006-08-04 04:57:15 -07:00
|
|
|
if test -z "$PYTHON[]$1[]_PARENT_DIR"; then
|
|
|
|
PYTHON[]$1[]_PARENT_DIR=/usr/local/win
|
2005-10-30 13:16:22 -08:00
|
|
|
fi
|
2006-08-04 04:57:15 -07:00
|
|
|
if test -z "$PYTHON[]$1[]_PREFIX"; then
|
|
|
|
PYTHON[]$1[]_PREFIX=$PYTHON[]$1[]_PARENT_DIR/Python$1
|
2005-10-30 13:16:22 -08:00
|
|
|
fi
|
2006-08-04 04:57:15 -07:00
|
|
|
if test -z "$PYGTK[]$1[]_CFLAGS"; then
|
|
|
|
PYGTK[]$1[]_CFLAGS="-I$PYTHON[]$1[]_PREFIX/include/pygtk-2.0 $PYTHON[]$1[]_CFLAGS $GTK_CFLAGS"
|
2005-10-30 13:16:22 -08:00
|
|
|
fi
|
|
|
|
|
|
|
|
dnl check whether pygtk.h exists
|
|
|
|
save_CPPFLAGS="$CPPFLAGS"
|
2006-08-04 04:57:15 -07:00
|
|
|
CPPFLAGS="$CPPFLAGS $PYGTK[]$1[]_CFLAGS"
|
2005-10-30 13:16:22 -08:00
|
|
|
save_CFLAGS="$CFLAGS"
|
2006-08-04 04:57:15 -07:00
|
|
|
CFLAGS="$CFLAGS $PYGTK[]$1[]_CFLAGS"
|
2005-10-30 13:16:22 -08:00
|
|
|
|
2006-08-04 04:57:15 -07:00
|
|
|
AC_MSG_CHECKING([for pygtk$1 headers])
|
2005-10-30 13:16:22 -08:00
|
|
|
# start AC_COMPILE_IFELSE in _AC_CHECK_PYGTK_MINGW
|
|
|
|
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
|
|
|
|
#include <pygtk/pygtk.h>
|
|
|
|
int main ()
|
|
|
|
{
|
|
|
|
init_pygtk();
|
|
|
|
return 0;
|
|
|
|
}]])],[
|
2006-08-04 04:57:15 -07:00
|
|
|
AC_MSG_RESULT([$PYGTK[]$1[]_CFLAGS])
|
|
|
|
AC_SUBST(PYGTK[]$1[]_CFLAGS)
|
|
|
|
PYGTK[]$1[]_DEFS_DIR=$PYTHON[]$1[]_PREFIX/share/pygtk/2.0/defs
|
|
|
|
AC_SUBST(PYGTK[]$1[]_DEFS_DIR)
|
|
|
|
PYGTK_DEFS_DIR=$PYTHON[]$1[]_PREFIX/share/pygtk/2.0/defs
|
2005-10-30 13:16:22 -08:00
|
|
|
AC_SUBST(PYGTK_DEFS_DIR)
|
2006-08-04 04:57:15 -07:00
|
|
|
PYGTK[]$1[]_CODEGEN_DIR=$PYTHON[]$1[]_PREFIX/share/pygtk/2.0/codegen
|
|
|
|
AC_SUBST(PYGTK[]$1[]_CODEGEN_DIR)
|
|
|
|
PYGTK_CODEGEN_DIR=$PYTHON[]$1[]_PREFIX/share/pygtk/2.0/codegen
|
2006-04-29 09:10:57 -07:00
|
|
|
AC_SUBST(PYGTK_CODEGEN_DIR)
|
2006-08-04 04:57:15 -07:00
|
|
|
AC_MSG_NOTICE([pygtk defs dir: $PYGTK[]$1[]_DEFS_DIR])
|
2005-10-30 13:16:22 -08:00
|
|
|
$2
|
2006-04-29 09:10:57 -07:00
|
|
|
_MOO_AC_PYGTK_CODEGEN
|
2005-10-30 13:16:22 -08:00
|
|
|
],[
|
|
|
|
AC_MSG_RESULT([not found])
|
|
|
|
$3
|
|
|
|
])
|
|
|
|
# end AC_COMPILE_IFELSE in _AC_CHECK_PYGTK_MINGW
|
|
|
|
|
|
|
|
CFLAGS="$save_CFLAGS"
|
|
|
|
CPPFLAGS="$save_CPPFLAGS"
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
# _MOO_AC_CHECK_PYGTK_UNIX(action-if-found,action-if-not-found)
|
|
|
|
# checks pygtk stuff
|
|
|
|
#
|
|
|
|
AC_DEFUN([_MOO_AC_CHECK_PYGTK_UNIX],[
|
|
|
|
# _AC_CHECK_PYGTK_UNIX
|
|
|
|
AC_MSG_CHECKING([for pygtk headers])
|
2006-11-14 09:20:39 -08:00
|
|
|
PKG_CHECK_MODULES(PYGTK,pygtk-2.0 >= 2.6.0,[
|
2005-10-30 13:16:22 -08:00
|
|
|
AC_MSG_RESULT([found])
|
|
|
|
AC_MSG_CHECKING([whether pygtk can be used])
|
|
|
|
save_CPPFLAGS="$CPPFLAGS"
|
2006-08-04 02:17:32 -07:00
|
|
|
CPPFLAGS="$CPPFLAGS $PYGTK_CFLAGS $PYTHON_CFLAGS"
|
2005-10-30 13:16:22 -08:00
|
|
|
save_CFLAGS="$CFLAGS"
|
2006-08-04 02:17:32 -07:00
|
|
|
CFLAGS="$CFLAGS $PYGTK_CFLAGS $PYTHON_CFLAGS"
|
2005-10-30 13:16:22 -08:00
|
|
|
|
|
|
|
# start AC_COMPILE_IFELSE in _AC_CHECK_PYGTK_UNIX
|
|
|
|
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
|
|
|
|
#include <pygobject.h>
|
|
|
|
int main ()
|
|
|
|
{
|
|
|
|
PyObject *object = pygobject_new (NULL);
|
|
|
|
return 0;
|
|
|
|
}]])],[
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
$2
|
|
|
|
PYGTK_DEFS_DIR=`$PKG_CONFIG --variable=defsdir pygtk-2.0`
|
|
|
|
AC_SUBST(PYGTK_DEFS_DIR)
|
2006-04-30 11:43:07 -07:00
|
|
|
PYGTK_CODEGEN_DIR=`$PKG_CONFIG --variable=codegendir pygtk-2.0`
|
|
|
|
AC_SUBST(PYGTK_CODEGEN_DIR)
|
2005-10-30 13:16:22 -08:00
|
|
|
AC_MSG_NOTICE([pygtk defs dir: $PYGTK_DEFS_DIR])
|
2006-04-29 09:10:57 -07:00
|
|
|
_MOO_AC_PYGTK_CODEGEN
|
2005-10-30 13:16:22 -08:00
|
|
|
],[
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
$3
|
|
|
|
])
|
|
|
|
# end AC_COMPILE_IFELSE in _AC_CHECK_PYGTK_UNIX
|
|
|
|
|
|
|
|
CFLAGS="$save_CFLAGS"
|
|
|
|
CPPFLAGS="$save_CPPFLAGS"
|
|
|
|
],[
|
|
|
|
AC_MSG_RESULT([not found])
|
|
|
|
$3
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
# MOO_AC_CHECK_PYGTK(version,action-if-found,action-if-not-found)
|
|
|
|
# checks pygtk stuff
|
|
|
|
# version argument is passed to _AC_CHECK_PYGTK_MINGW only
|
|
|
|
#
|
|
|
|
AC_DEFUN([MOO_AC_CHECK_PYGTK],[
|
|
|
|
AC_REQUIRE([MOO_AC_CHECK_OS])
|
2006-04-29 23:02:19 -07:00
|
|
|
|
2005-10-30 13:16:22 -08:00
|
|
|
if test x$MOO_OS_CYGWIN != xyes; then
|
|
|
|
if test x$MOO_OS_MINGW = xyes; then
|
2006-08-04 04:57:15 -07:00
|
|
|
_MOO_AC_CHECK_PYGTK_MINGW([24],[$2],[$3])
|
2006-11-11 01:01:50 -08:00
|
|
|
_MOO_AC_CHECK_PYGTK_MINGW([25],[$2],[$3])
|
2005-10-30 13:16:22 -08:00
|
|
|
else
|
|
|
|
_MOO_AC_CHECK_PYGTK_UNIX([$1],[$2],[$3])
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
# MOO_AC_PYGTK()
|
|
|
|
#
|
|
|
|
AC_DEFUN([MOO_AC_PYGTK],[
|
|
|
|
AC_REQUIRE([MOO_AC_CHECK_OS])
|
|
|
|
|
2006-05-02 20:36:05 -07:00
|
|
|
AC_ARG_WITH([pygtk], AC_HELP_STRING([--with-pygtk], [whether to compile pygtk support (default = YES)]),[
|
2005-10-30 13:16:22 -08:00
|
|
|
if test x$with_pygtk = "xno"; then
|
|
|
|
MOO_USE_PYGTK="no"
|
|
|
|
else
|
|
|
|
MOO_USE_PYGTK="yes"
|
|
|
|
fi
|
|
|
|
],[
|
|
|
|
MOO_USE_PYGTK="yes"
|
|
|
|
])
|
|
|
|
|
2006-05-02 20:36:05 -07:00
|
|
|
AC_ARG_WITH([python],AC_HELP_STRING([--with-python], [whether to compile python support (default = YES)]),[
|
2005-10-30 13:16:22 -08:00
|
|
|
if test x$with_python = "xno"; then
|
|
|
|
MOO_USE_PYTHON="no"
|
2005-11-04 20:28:33 -08:00
|
|
|
MOO_USE_PYGTK="no"
|
2005-10-30 13:16:22 -08:00
|
|
|
else
|
|
|
|
if test x$with_python = "xyes"; then
|
|
|
|
moo_python_version=2.2
|
|
|
|
else
|
|
|
|
moo_python_version=$with_python
|
|
|
|
fi
|
|
|
|
MOO_USE_PYTHON="yes"
|
|
|
|
fi
|
|
|
|
],[
|
|
|
|
if test x$MOO_USE_PYTGK = xyes; then
|
|
|
|
MOO_USE_PYTHON="yes"
|
|
|
|
else
|
|
|
|
MOO_USE_PYTHON="auto"
|
|
|
|
MOO_USE_PYTGK="no"
|
|
|
|
fi
|
|
|
|
moo_python_version=2.2
|
|
|
|
])
|
|
|
|
|
|
|
|
if test x$MOO_OS_CYGWIN = xyes; then
|
|
|
|
MOO_USE_PYTHON=no
|
|
|
|
MOO_USE_PYGTK=no
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test x$MOO_USE_PYTHON != "xno"; then
|
|
|
|
MOO_AC_CHECK_PYTHON($moo_python_version,[
|
|
|
|
MOO_USE_PYTHON="yes"
|
|
|
|
AC_MSG_NOTICE([compiling python support])
|
|
|
|
],[
|
|
|
|
if test x$MOO_USE_PYTHON = "xyes"; then
|
|
|
|
AC_MSG_ERROR([Python not found])
|
|
|
|
else
|
|
|
|
AC_MSG_WARN([Python support will be disabled])
|
|
|
|
fi
|
2005-11-03 20:30:47 -08:00
|
|
|
MOO_USE_PYTHON="no"
|
|
|
|
MOO_USE_PYGTK="no"
|
2005-10-30 13:16:22 -08:00
|
|
|
])
|
|
|
|
fi
|
|
|
|
|
|
|
|
AM_CONDITIONAL(MOO_USE_PYTHON, test x$MOO_USE_PYTHON = "xyes")
|
|
|
|
if test x$MOO_USE_PYTHON = "xyes"; then
|
|
|
|
AC_DEFINE(MOO_USE_PYTHON, 1, [MOO_USE_PYTHON])
|
|
|
|
fi
|
|
|
|
|
|
|
|
### Pygtk
|
|
|
|
|
|
|
|
if test x$MOO_USE_PYGTK = xyes; then
|
|
|
|
MOO_AC_CHECK_PYGTK([$moo_python_version],[
|
|
|
|
MOO_USE_PYGTK="yes"
|
|
|
|
AC_MSG_NOTICE([compiling pygtk support])
|
|
|
|
],[
|
|
|
|
MOO_USE_PYGTK="no"
|
|
|
|
AC_MSG_NOTICE([usable pygtk not found])
|
|
|
|
])
|
|
|
|
fi
|
|
|
|
|
|
|
|
AM_CONDITIONAL(MOO_USE_PYGTK, test x$MOO_USE_PYGTK = "xyes")
|
|
|
|
if test x$MOO_USE_PYGTK = "xyes"; then
|
|
|
|
AC_DEFINE(MOO_USE_PYGTK, 1, [MOO_USE_PYGTK])
|
2006-06-14 21:43:34 -07:00
|
|
|
|
|
|
|
PYGTK_VERSION=`$PKG_CONFIG --modversion pygtk-2.0`
|
|
|
|
i=0
|
|
|
|
for part in `echo $PYGTK_VERSION | sed 's/\./ /g'`; do
|
|
|
|
i=`expr $i + 1`
|
|
|
|
eval part$i=$part
|
|
|
|
done
|
|
|
|
|
|
|
|
PYGTK_MAJOR_VERSION=$part1
|
|
|
|
PYGTK_MINOR_VERSION=$part2
|
|
|
|
PYGTK_MICRO_VERSION=$part3
|
|
|
|
|
|
|
|
AC_SUBST(PYGTK_VERSION)
|
|
|
|
AC_SUBST(PYGTK_MAJOR_VERSION)
|
|
|
|
AC_SUBST(PYGTK_MINOR_VERSION)
|
|
|
|
AC_SUBST(PYGTK_MICRO_VERSION)
|
2005-10-30 13:16:22 -08:00
|
|
|
fi
|
2006-04-29 23:02:19 -07:00
|
|
|
|
|
|
|
AM_CONDITIONAL(MOO_USE_CUSTOM_CODEGEN, test x$MOO_USE_CUSTOM_CODEGEN = "xyes")
|
2005-10-30 13:16:22 -08:00
|
|
|
])
|