tizen 2.3 release
[framework/multimedia/gst-plugins-base0.10.git] / common / m4 / gst-doc.m4
1 AC_DEFUN([AG_GST_DOCBOOK_CHECK],
2 [
3   dnl choose a location to install docbook docs in
4   if test "x$PACKAGE_TARNAME" = "x"
5   then
6     AC_MSG_ERROR([Internal error - PACKAGE_TARNAME not set])
7   fi
8   docdir="\$(datadir)/doc/$PACKAGE_TARNAME-$GST_MAJORMINOR"
9
10   dnl enable/disable docbook documentation building
11   AC_ARG_ENABLE(docbook,
12   AC_HELP_STRING([--enable-docbook],
13                  [use docbook to build documentation [default=no]]),,
14                  enable_docbook=no)
15
16   have_docbook=no
17
18   if test x$enable_docbook = xyes; then
19     dnl check if we actually have everything we need
20
21     dnl check for docbook tools
22     AC_CHECK_PROG(HAVE_DOCBOOK2PS, docbook2ps, yes, no)
23     AC_CHECK_PROG(HAVE_DOCBOOK2HTML, docbook2html, yes, no)
24     AC_CHECK_PROG(HAVE_JADETEX, jadetex, yes, no)
25     AC_CHECK_PROG(HAVE_PS2PDF, ps2pdf, yes, no)
26
27     # -V option appeared in 0.6.10
28     docbook2html_min_version=0.6.10
29     if test "x$HAVE_DOCBOOK2HTML" != "xno"; then
30       docbook2html_version=`docbook2html --version`
31       AC_MSG_CHECKING([docbook2html version ($docbook2html_version) >= $docbook2html_min_version])
32       if perl -w <<EOF
33         (\$min_version_major, \$min_version_minor, \$min_version_micro ) = "$docbook2html_min_version" =~ /(\d+)\.(\d+)\.(\d+)/;
34         (\$docbook2html_version_major, \$docbook2html_version_minor, \$docbook2html_version_micro ) = "$docbook2html_version" =~ /(\d+)\.(\d+)\.(\d+)/;
35         exit (((\$docbook2html_version_major > \$min_version_major) ||
36              ((\$docbook2html_version_major == \$min_version_major) &&
37               (\$docbook2html_version_minor >= \$min_version_minor)) ||
38              ((\$docbook2html_version_major == \$min_version_major) &&
39               (\$docbook2html_version_minor >= \$min_version_minor) &&
40               (\$docbook2html_version_micro >= \$min_version_micro)))
41              ? 0 : 1);
42 EOF
43       then
44         AC_MSG_RESULT(yes)
45       else
46         AC_MSG_RESULT(no)
47         HAVE_DOCBOOK2HTML=no
48       fi
49     fi
50
51     dnl check if we can process docbook stuff
52     AS_DOCBOOK(have_docbook=yes, have_docbook=no)
53
54     dnl check for extra tools
55     AC_CHECK_PROG(HAVE_DVIPS, dvips, yes, no)
56     AC_CHECK_PROG(HAVE_XMLLINT, xmllint, yes, no)
57
58     dnl check for image conversion tools
59     AC_CHECK_PROG(HAVE_FIG2DEV, fig2dev, yes, no)
60     if test "x$HAVE_FIG2DEV" = "xno" ; then
61       AC_MSG_WARN([Did not find fig2dev (from xfig), images will not be generated.])
62     fi
63
64     dnl The following is a hack: if fig2dev doesn't display an error message
65     dnl for the desired type, we assume it supports it.
66     HAVE_FIG2DEV_EPS=no
67     if test "x$HAVE_FIG2DEV" = "xyes" ; then
68       fig2dev_quiet=`fig2dev -L eps </dev/null 2>&1 >/dev/null`
69       if test "x$fig2dev_quiet" = "x" ; then
70         HAVE_FIG2DEV_EPS=yes
71       fi
72     fi
73     HAVE_FIG2DEV_PNG=no
74     if test "x$HAVE_FIG2DEV" = "xyes" ; then
75       fig2dev_quiet=`fig2dev -L png </dev/null 2>&1 >/dev/null`
76       if test "x$fig2dev_quiet" = "x" ; then
77         HAVE_FIG2DEV_PNG=yes
78       fi
79     fi
80     HAVE_FIG2DEV_PDF=no
81     if test "x$HAVE_FIG2DEV" = "xyes" ; then
82       fig2dev_quiet=`fig2dev -L pdf </dev/null 2>&1 >/dev/null`
83       if test "x$fig2dev_quiet" = "x" ; then
84         HAVE_FIG2DEV_PDF=yes
85       fi
86     fi
87
88     AC_CHECK_PROG(HAVE_PNGTOPNM, pngtopnm, yes, no)
89     AC_CHECK_PROG(HAVE_PNMTOPS,  pnmtops,  yes, no)
90     AC_CHECK_PROG(HAVE_EPSTOPDF, epstopdf, yes, no)
91
92     dnl check if we can generate HTML
93     if test "x$HAVE_DOCBOOK2HTML" = "xyes" && \
94        test "x$enable_docbook" = "xyes" && \
95        test "x$HAVE_XMLLINT" = "xyes" && \
96        test "x$HAVE_FIG2DEV_PNG" = "xyes"; then
97       DOC_HTML=yes
98       AC_MSG_NOTICE(Will output HTML documentation)
99      else
100       DOC_HTML=no
101       AC_MSG_NOTICE(Will not output HTML documentation)
102     fi
103
104     dnl check if we can generate PS
105     if test "x$HAVE_DOCBOOK2PS" = "xyes" && \
106        test "x$enable_docbook" = "xyes" && \
107        test "x$HAVE_XMLLINT" = "xyes" && \
108        test "x$HAVE_JADETEX" = "xyes" && \
109        test "x$HAVE_FIG2DEV_EPS" = "xyes" && \
110        test "x$HAVE_DVIPS" = "xyes" && \
111        test "x$HAVE_PNGTOPNM" = "xyes" && \
112        test "x$HAVE_PNMTOPS" = "xyes"; then
113       DOC_PS=yes
114       AC_MSG_NOTICE(Will output PS documentation)
115     else
116       DOC_PS=no
117       AC_MSG_NOTICE(Will not output PS documentation)
118     fi
119
120     dnl check if we can generate PDF - using only ps2pdf
121     if test "x$DOC_PS" = "xyes" && \
122        test "x$enable_docbook" = "xyes" && \
123        test "x$HAVE_XMLLINT" = "xyes" && \
124        test "x$HAVE_PS2PDF" = "xyes"; then
125       DOC_PDF=yes
126       AC_MSG_NOTICE(Will output PDF documentation)
127     else
128       DOC_PDF=no
129       AC_MSG_NOTICE(Will not output PDF documentation)
130     fi
131
132     dnl if we don't have everything, we should disable
133     if test "x$have_docbook" != "xyes"; then
134       enable_docbook=no
135     fi
136   fi
137
138   dnl if we're going to install documentation, tell us where
139   if test "x$have_docbook" = "xyes"; then
140     AC_MSG_NOTICE(Installing documentation in $docdir)
141     AC_SUBST(docdir)
142   fi
143
144   AM_CONDITIONAL(ENABLE_DOCBOOK,      test x$enable_docbook = xyes)
145   AM_CONDITIONAL(DOC_HTML,            test x$DOC_HTML = xyes)
146   AM_CONDITIONAL(DOC_PDF,             test x$DOC_PDF = xyes)
147   AM_CONDITIONAL(DOC_PS,              test x$DOC_PS = xyes)
148 ])