prettier config msg output
[platform/upstream/libexif.git] / m4m / gp-documentation.m4
1 dnl
2 dnl check where to install documentation
3 dnl
4 dnl determines documentation "root directory", i.e. the directory
5 dnl where all documentation will be placed in
6 dnl
7
8 AC_DEFUN([GP_CHECK_DOC_DIR],
9 [
10 AC_BEFORE([$0], [GP_BUILD_GTK_DOCS])dnl
11 AC_BEFORE([$0], [GP_CHECK_DOXYGEN])dnl
12
13 AC_ARG_WITH([doc-dir],
14 [AS_HELP_STRING([--with-doc-dir=PATH],
15 [Where to install docs  [default=autodetect]])])
16
17 # check for the main ("root") documentation directory
18 AC_MSG_CHECKING([main docdir])
19
20 if test "x${with_doc_dir}" != "x"
21 then # docdir is given as parameter
22     docdir="${with_doc_dir}"
23     AC_MSG_RESULT([${docdir} (from parameter)])
24 else # otherwise invent a docdir hopefully compatible with system policy
25     if test -d "/usr/share/doc"
26     then
27         maindocdir='${prefix}/share/doc'
28         AC_MSG_RESULT([${maindocdir} (FHS style)])
29     elif test -d "/usr/doc"
30     then
31         maindocdir='${prefix}/doc'
32         AC_MSG_RESULT([${maindocdir} (old style)])
33     else
34         maindocdir='${datadir}/doc'
35         AC_MSG_RESULT([${maindocdir} (default value)])
36     fi
37     AC_MSG_CHECKING([package docdir])
38     # check whether to include package version into documentation path
39     # FIXME: doesn't work properly.
40     if ls -d /usr/{share/,}doc/make-[0-9]* > /dev/null 2>&1
41     then
42         docdir="${maindocdir}/${PACKAGE}-${VERSION}"
43         AC_MSG_RESULT([${docdir} (redhat style)])
44     else
45         docdir="${maindocdir}/${PACKAGE}"
46         AC_MSG_RESULT([${docdir} (default style)])
47     fi
48 fi
49
50 AC_SUBST([docdir])
51 ])dnl
52
53 dnl
54 dnl check whether to build docs and where to:
55 dnl
56 dnl * determine presence of prerequisites (only gtk-doc for now)
57 dnl * determine destination directory for HTML files
58 dnl
59
60 AC_DEFUN([GP_BUILD_GTK_DOCS],
61 [
62 # docdir has to be determined in advance
63 AC_REQUIRE([GP_CHECK_DOC_DIR])
64
65 # ---------------------------------------------------------------------------
66 # gtk-doc: We use gtk-doc for building our documentation. However, we
67 #          require the user to explicitely request the build.
68 # ---------------------------------------------------------------------------
69 try_gtkdoc=false
70 gtkdoc_msg="no (not requested)"
71 have_gtkdoc=false
72 AC_ARG_ENABLE([docs],
73 [AS_HELP_STRING([--enable-docs],
74 [Use gtk-doc to build documentation [default=no]])],[
75         if test x$enableval = xyes; then
76                 try_gtkdoc=true
77         fi
78 ])
79 if $try_gtkdoc; then
80         AC_PATH_PROG([GTKDOC],[gtkdoc-mkdb])
81         if test -n "${GTKDOC}"; then
82                 have_gtkdoc=true
83                 gtkdoc_msg="yes"
84         else
85                 gtkdoc_msg="no (http://www.gtk.org/rdp/download.html)"
86         fi
87 fi
88 AM_CONDITIONAL([ENABLE_GTK_DOC], [$have_gtkdoc])
89 GP_CONFIG_MSG([build API docs with gtk-doc],[$gtkdoc_msg])
90
91
92 # ---------------------------------------------------------------------------
93 # Give the user the possibility to install html documentation in a 
94 # user-defined location.
95 # ---------------------------------------------------------------------------
96 AC_ARG_WITH([html-dir],
97 [AS_HELP_STRING([--with-html-dir=PATH],
98 [Where to install html docs [default=autodetect]])])
99
100 AC_MSG_CHECKING([for html dir])
101 if test "x${with_html_dir}" = "x" ; then
102     htmldir="${docdir}/html"
103     AC_MSG_RESULT([${htmldir} (default)])
104 else
105     htmldir="${with_html_dir}"
106     AC_MSG_RESULT([${htmldir} (from parameter)])
107 fi
108 AC_SUBST([htmldir])
109 apidocdir="${htmldir}/api"
110 AC_SUBST([apidocdir}])
111
112 ])dnl
113
114
115 dnl doxygen related stuff
116 dnl look for tools
117 dnl define substitutions for Doxyfile.in
118 AC_DEFUN([GP_CHECK_DOXYGEN],[dnl
119 AC_REQUIRE([GP_CHECK_DOC_DIR])dnl
120 AC_PATH_PROG([DOT], [dot], [false])
121 AC_PATH_PROG([DOXYGEN], [doxygen], [false])
122 AM_CONDITIONAL([HAVE_DOXYGEN], [test "x$DOXYGEN" != "false"])
123 AM_CONDITIONAL([HAVE_DOT], [test "x$DOT" != "false"])
124 if test "x$DOT" != "false"; then
125         AC_SUBST([HAVE_DOT],[YES])
126 else
127         AC_SUBST([HAVE_DOT],[NO])
128 fi
129 AC_SUBST([HTML_APIDOC_DIR], ["${PACKAGE_TARNAME}-api.html"])
130 AC_SUBST([DOXYGEN_OUTPUT_DIR], [doxygen-output])
131 ])dnl
132