1# RNA_ENABLE_DOXYGEN_REFMAN(PROJECT_NAME, [config-file], [documentation-output-directory])
2#
3#
4
5
6
7
8AC_DEFUN([RNA_ENABLE_DOXYGEN_REFMAN],[
9
10    AC_REQUIRE([RNA_LATEX_ENVIRONMENT])
11
12RNA_ADD_PACKAGE([doc_pdf],
13                [PDF RNAlib reference manual],
14                [yes])
15RNA_ADD_PACKAGE([doc_html],
16                [HTML RNAlib reference manual],
17                [yes])
18RNA_ADD_PACKAGE([doc],
19                [RNAlib reference manual],
20                [yes],
21                [ with_doc=no
22                  with_doc_pdf=no
23                  with_doc_html=no],
24                [])
25
26
27AC_PATH_PROG(doxygen, [doxygen],no)
28AC_PATH_PROG(dot,[dot],no)
29AC_PATH_PROG(egrep,[egrep],no)
30AC_PATH_PROG(perl,[perl],no)
31
32# check whether we are able to generate the doxygen documentation
33RNA_PACKAGE_IF_ENABLED([doc],[
34  if test "x$doxygen" != xno;
35  then
36
37    # test for programs necessary in order to use doxygen
38    if test "x$LATEX_CMD" = xno;
39    then
40      AC_MSG_WARN([Could not find pdflatex!])
41      AC_MSG_WARN([deactivating automatic (re)generation of reference manual!])
42      doxygen_failed="pdflatex command is missing!"
43      doxygen=no
44    else
45      RNA_LATEX_TEST_PACKAGES(
46        [fixltx2e calc graphicx makeidx multicol multirow textcomp xcolor fontenc helvet courier amssymb sectsty geometry fancyhdr natbib tocloft amsmath amsfonts newunicodechar hyperref caption etoc ], [], [
47          doxygen_failed="Required LaTeX packages are missing!"
48          doxygen=no
49      ])
50    fi
51
52    if test "x$makeindex" = xno;
53    then
54      AC_MSG_WARN([makeindex command not found on your system!])
55      AC_MSG_WARN([deactivating automatic (re)generation of reference manual!])
56      doxygen_failed="makeindex command is missing!"
57      doxygen=no
58    fi
59
60    if test "x$bibtex" = xno;
61    then
62      AC_MSG_WARN([bibtex command not found on your system!])
63      AC_MSG_WARN([deactivating automatic (re)generation of reference manual!])
64      doxygen_failed="bibtex command is missing!"
65      doxygen=no
66    fi
67
68    if test "x$egrep" = xno;
69    then
70      AC_MSG_WARN([egrep command not found on your system!])
71      AC_MSG_WARN([deactivating automatic (re)generation of reference manual!])
72      doxygen_failed="egrep command is missing!"
73      doxygen=no
74    fi
75
76    if test "x$dot" = xno;
77    then
78      AC_MSG_WARN([dot command not found on your system!])
79      AC_MSG_WARN([deactivating graph output in reference manual!])
80    fi
81
82    if test "x$perl" = xno;
83    then
84      AC_MSG_WARN([perl command not found on your system!])
85      AC_MSG_WARN([deactivating automatic (re)generation of reference manual!])
86      doxygen_failed="perl command is missing!"
87      doxygen=no
88    fi
89  else
90    doxygen_failed="doxygen command is missing!"
91  fi
92])
93
94
95# setup everything in order to generate the doxygen configfile
96
97RNA_PACKAGE_IF_ENABLED([doc],[
98
99  AC_SUBST([DOXYGEN_PROJECT_NAME], [$1-$PACKAGE_VERSION])
100  AC_SUBST([DOXYGEN_SRCDIR], [$srcdir])
101  AC_SUBST([DOXYGEN_DOCDIR], [ifelse([$3], [], [doc], [$3])])
102  AC_SUBST([DOXYGEN_CONF], [ifelse([$2], [], [doxygen.conf], [$2])])
103
104
105# prepare the config file for doxygen if we are able to generate a reference manual
106  if test "x$doxygen" != xno;
107  then
108
109    AC_SUBST([DOXYGEN_CMD_LATEX], ["$LATEX_CMD -interaction=nonstopmode -halt-on-error"])
110    AC_SUBST([DOXYGEN_CMD_BIBTEX], [$BIBTEX_CMD])
111    AC_SUBST([DOXYGEN_CMD_MAKEINDEX], [$MAKEINDEX_CMD])
112    AC_SUBST([DOXYGEN_HAVE_DOT],[ifelse([$dot], [no], [NO], [YES])])
113    AC_SUBST([DOXYGEN_WITH_PDFLATEX], [YES])
114    AC_SUBST([DOXYGEN_GENERATE_HTML], [ifelse([$with_doc_html], [no], [NO], [YES])])
115    AC_SUBST([DOXYGEN_GENERATE_LATEX], [ifelse([$with_doc_pdf], [no], [NO], [YES])])
116
117    AC_CONFIG_FILES([${DOXYGEN_DOCDIR}/${DOXYGEN_CONF}])
118    AC_CONFIG_FILES([${DOXYGEN_DOCDIR}/refman.include/install.dox])
119
120  else
121
122# otherwise check if a generated reference manual already exists
123
124    RNA_PACKAGE_IF_ENABLED([doc_pdf],[
125      AC_RNA_TEST_FILE( [$DOXYGEN_DOCDIR/$DOXYGEN_PROJECT_NAME.pdf],
126                        [with_doc_pdf=yes],
127                        [with_doc_pdf=no
128                         doc_pdf_failed="($doxygen_failed)"])])
129
130    RNA_PACKAGE_IF_ENABLED([doc_html],[
131      AC_RNA_TEST_FILE( [$DOXYGEN_DOCDIR/html/index.html],
132                        [with_doc_html=yes],
133                        [with_doc_html=no
134                         doc_html_failed="($doxygen_failed)"])])
135
136    if test "x$with_doc_pdf" = "x$with_doc_html";
137    then
138      if test "x$with_doc_pdf" = xno;
139      then
140        with_doc=no
141      fi
142    fi
143  fi
144])
145
146AC_SUBST([REFERENCE_MANUAL_PDF_NAME], [ifelse([$with_doc_pdf],
147                                              [no],
148                                              [],
149                                              [$DOXYGEN_PROJECT_NAME.pdf])])
150AC_SUBST([REFERENCE_MANUAL_TAGFILE],  [ifelse([$doxygen],
151                                              [no],
152                                              [],
153                                              [$DOXYGEN_PROJECT_NAME.tag])])
154
155
156# setup variables used in Makefile.am
157
158# Define ${htmldir} if the configure script was created with a version of
159# autoconf older than 2.60
160# Alternatively, if ${htmldir} is exactly '${docdir}', append a /html to
161# separate html files from rest of doc.
162# Otherwise, just append the PACKAGE_NAME to the htmldir
163if test "x${htmldir}" = "x";
164then
165  AC_MSG_WARN([resetting htmldir])
166  htmldir="${docdir}/html"
167fi
168
169if test "x${htmldir}" = 'x${docdir}';
170then
171  htmldir="${docdir}/html"
172else
173  htmldir=${htmldir}/${PACKAGE_NAME}
174fi
175
176AC_SUBST(htmldir, [${htmldir}])
177
178#
179
180AM_CONDITIONAL(WITH_REFERENCE_MANUAL, test "x$with_doc" != xno)
181AM_CONDITIONAL(WITH_REFERENCE_MANUAL_BUILD, test "x$doxygen" != xno)
182AM_CONDITIONAL(WITH_REFERENCE_MANUAL_PDF, test "x$with_doc_pdf" != xno)
183AM_CONDITIONAL(WITH_REFERENCE_MANUAL_HTML, test "x$with_doc_html" != xno)
184])
185
186