Add an option to control GtkDoc header generation

This allows explicit activation or deactivation of the GtkDoc header
generation.

This might allow to e.g. force enable it on distcheck.
This commit is contained in:
Colomban Wendling 2016-02-18 22:51:30 +01:00
parent 607c95ed98
commit e9e2ddf581
4 changed files with 44 additions and 28 deletions

View File

@ -123,7 +123,7 @@ AC_SUBST([pkgdatadir])
# Documentation tools # Documentation tools
GEANY_CHECK_DOCUTILS GEANY_CHECK_DOCUTILS
GEANY_CHECK_DOXYGEN GEANY_CHECK_DOXYGEN
GEANY_CHECK_PYTHON GEANY_CHECK_GTKDOC_HEADER
# libgeany # libgeany
GEANY_LIB_INIT GEANY_LIB_INIT

View File

@ -119,7 +119,7 @@ Doxyfile.stamp: Doxyfile Doxyfile-gi $(doxygen_sources)
ALL_TARGETS = Doxyfile.stamp ALL_TARGETS = Doxyfile.stamp
if WITH_PYTHON if ENABLE_GTKDOC_HEADER
geany-gtkdoc.h: Doxyfile.stamp $(top_srcdir)/scripts/gen-api-gtkdoc.py geany-gtkdoc.h: Doxyfile.stamp $(top_srcdir)/scripts/gen-api-gtkdoc.py
$(AM_V_GEN)$(top_srcdir)/scripts/gen-api-gtkdoc.py xml -d $(builddir) \ $(AM_V_GEN)$(top_srcdir)/scripts/gen-api-gtkdoc.py xml -d $(builddir) \

View File

@ -70,29 +70,3 @@ AC_DEFUN([GEANY_CHECK_DOCUTILS_PDF],
AM_CONDITIONAL([WITH_RST2PDF], [test "x$geany_enable_pdf_docs" != "xno"]) AM_CONDITIONAL([WITH_RST2PDF], [test "x$geany_enable_pdf_docs" != "xno"])
GEANY_STATUS_ADD([Build PDF documentation], [$geany_enable_pdf_docs]) GEANY_STATUS_ADD([Build PDF documentation], [$geany_enable_pdf_docs])
]) ])
dnl
dnl GEANY_CHECK_PYTHON
dnl For gtkdoc header generation
dnl
AC_DEFUN([GEANY_CHECK_PYTHON],
[
AM_PATH_PYTHON([2.7], [], [])
have_python=no
AS_IF([test -n "$PYTHON"], [
AC_MSG_CHECKING([for python lxml package])
$PYTHON -c 'import lxml' 1>&2 2>/dev/null
AS_IF([test $? -eq 0], [
AC_MSG_RESULT([found])
have_python=yes
], [
AC_MSG_RESULT([not found])
have_python=no
])
])
AM_CONDITIONAL([WITH_PYTHON], [test "x$have_python" = "xyes"])
AM_COND_IF([WITH_PYTHON],
[GEANY_STATUS_ADD([Using Python version], [$PYTHON_VERSION])])
])

42
m4/geany-gtkdoc-header.m4 Normal file
View File

@ -0,0 +1,42 @@
AC_DEFUN([_GEANY_CHECK_GTKDOC_HEADER_ERROR],
[
AC_MSG_ERROR([GtkDoc header generation enabled but $1])
])
dnl GEANY_CHECK_GTKDOC_HEADER
dnl checks for GtkDoc header generation requirements and define
dnl ENABLE_GTKDOC_HEADER Automake conditional as appropriate
AC_DEFUN([GEANY_CHECK_GTKDOC_HEADER],
[
AC_REQUIRE([GEANY_CHECK_DOXYGEN])
AC_ARG_ENABLE([gtkdoc-header],
[AS_HELP_STRING([--enable-gtkdoc-header],
[generate the GtkDoc header suitable for GObject introspection [default=auto]])],
[geany_enable_gtkdoc_header="$enableval"],
[geany_enable_gtkdoc_header="auto"])
AS_IF([test "x$geany_enable_gtkdoc_header$geany_with_doxygen" = "xyesno"],
[_GEANY_CHECK_GTKDOC_HEADER_ERROR([Doxygen support not available])],
[test "x$geany_enable_gtkdoc_header" != "xno"],
[
dnl python
AM_PATH_PYTHON([2.7], [have_python=yes], [have_python=no])
dnl lxml module
AS_IF([test "x$have_python" = xyes],
[have_python_and_lxml=yes
AC_MSG_CHECKING([for python lxml package])
AS_IF([$PYTHON -c 'import lxml' 2>&1 >/dev/null],
[have_python_and_lxml=yes],
[have_python_and_lxml=no])
AC_MSG_RESULT([$have_python_and_lxml])],
[have_python_and_lxml=no])
dnl final result
AS_IF([test "x$geany_enable_gtkdoc_header$have_python_and_lxml" = "xyesno"],
[_GEANY_CHECK_GTKDOC_HEADER_ERROR([python or its lxml module not found])],
[geany_enable_gtkdoc_header=yes])
])
AM_CONDITIONAL([ENABLE_GTKDOC_HEADER], [test "x$geany_enable_gtkdoc_header" = "xyes"])
GEANY_STATUS_ADD([Generate GtkDoc header], [$geany_enable_gtkdoc_header])
])