1AC_DEFUN([GP_CHECK_GEANYPY],
2[
3    GP_ARG_DISABLE([Geanypy], [auto])
4    GP_CHECK_PLUGIN_GTK2_ONLY([Geanypy])
5    GP_CHECK_PLUGIN_DEPS([Geanypy], [PYGTK], [pygtk-2.0])
6    GP_CHECK_PLUGIN_DEPS([Geanypy], [GMODULE], [gmodule-2.0])
7    dnl FIXME: Checks for Python below should gracefully disable the plugin
8    dnl        if they don't succeed and enable_geanypy is set to `auto`.
9    dnl        However, since these macros don't seem to gracefully handle
10    dnl        failure, and since if PyGTK is found they are likely to succeed
11    dnl        anyway, we assume that if the plugin is not disabled at this
12    dnl        point it is OK for these checks to be fatal.  The user can pass
13    dnl        always pass --disable-geanypy anyway.
14    AS_IF([! test x$enable_geanypy = xno], [
15        AX_PYTHON_DEVEL([>= '2.6'])
16        AX_PYTHON_LIBRARY(,[AC_MSG_ERROR([Cannot find Python library])])
17        AC_SUBST([PYTHON])
18        AC_DEFINE_UNQUOTED([GEANYPY_PYTHON_LIBRARY],
19                           ["$PYTHON_LIBRARY"],
20                           [Location of Python library to dlopen()])
21
22        dnl check for C flags we wish to use
23        GEANYPY_CFLAGS=
24        for flag in -fno-strict-aliasing \
25                    -Wno-write-strings \
26                    -Wno-long-long
27        do
28            GP_CHECK_CFLAG([$flag], [GEANYPY_CFLAGS="${GEANYPY_CFLAGS} $flag"])
29        done
30        AC_SUBST([GEANYPY_CFLAGS])
31    ])
32    GP_COMMIT_PLUGIN_STATUS([Geanypy])
33    AC_CONFIG_FILES([
34        geanypy/Makefile
35        geanypy/src/Makefile
36        geanypy/geany/Makefile
37        geanypy/plugins/Makefile
38    ])
39])
40