与autoconf集成

非常容易!只需在您的 configure.ac 脚本中添加一行。

Example 2-2与autoconf集成
# 检查 gtk-doc
GTK_DOC_CHECK([1.14],[--flavour no-tmpl])

          

This will require all developers to have gtk-doc installed. If it is okay for your project to have optional api-doc build setup, you can solve this as below. Keep it as is, as gtkdocize is looking for GTK_DOC_CHECK at the start of a line.

Example 2-3Keep gtk-doc optional
# check for gtk-doc
m4_ifdef([GTK_DOC_CHECK], [
GTK_DOC_CHECK([1.14],[--flavour no-tmpl])
],[
AM_CONDITIONAL([ENABLE_GTK_DOC], false)
])

          

The first argument is used to check for the gtkdocversion at configure time. The 2nd, optional argument is used by gtkdocize. The GTK_DOC_CHECK macro also adds several configure switches:

  1. --with-html-dir=PATH : 安装文档的路径
  2. --enable-gtk-doc : 用gtk-doc构建文档[默认值:no]
  3. --enable-gtk-doc-html :用html格式构建文档[默认值:yes]
  4. --enable-gtk-doc-pdf : 以PDF格式构建文档[默认值:no]

GTK-Doc在默认情况下是关闭的!请记得给文本configure运作时传递'--enable-gtk-doc'选项。否则,将会安装预先生成的文档(对用户有意义但对开发人员没用处)。

而且建议你在configure.ac脚本里拥有这样一行。它允许gtkdocizeGTK_DOC_CHECK的宏定义复制到您的项目中去。

Example 2-4准备gtkdocize
AC_CONFIG_MACRO_DIR(m4)