makefiles: add two flavours for flat makefiles. Fixes #501107
[gtk-doc.git] / configure.ac
blob3d7c8e12579e3d479036f74503325ecf0dc5ead9
1 dnl Process this file with autoconf to produce a configure script.
2 AC_PREREQ(2.58)
4 dnl Use a simple 2-digit version number for a while, since our old example
5 dnl Makefile can only cope with that, i.e. use 1.1, 1.2, 1.3 ... 9.9.
6 dnl FIXME: I can't see anything failing (1.14.1), lets try to use a three digit
7 dnl number for the development version
8 m4_define(gtk_doc_version, 1.15.1)
10 AC_INIT([gtk-doc], [gtk_doc_version], [http://bugzilla.gnome.org/enter_bug.cgi?product=gtk-doc])
12 AC_CONFIG_MACRO_DIR([m4])
13 AC_CONFIG_SRCDIR([gtkdoc-common.pl.in])
15 AM_INIT_AUTOMAKE([check-news std-options])
16 AM_MAINTAINER_MODE
18 # Support silent build rules, requires at least automake-1.11. Disable
19 # by either passing --disable-silent-rules to configure or passing V=1
20 # to make
21 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
23 dnl Forcing a non-null ACTION-IF-NOT-FOUND disables scrollkeeper if
24 dnl gnome-doc-utils is not found but does not invalidate the build.
25 GNOME_DOC_INIT([],[],enable_scrollkeeper=no)
27 dnl make sure $ACLOCAL_FLAGS are used during a rebuild.
28 AC_SUBST([ACLOCAL_AMFLAGS], ["\${ACLOCAL_FLAGS}"])
30 AC_ISC_POSIX
31 AC_PROG_CC
32 AC_PROG_LIBTOOL
34 dnl Make sure we have pkg-config >= 0.19, so installing in $(datadir) is OK.
35 PKG_PROG_PKG_CONFIG([0.19])
37 dnl
38 dnl Check for Perl.
39 dnl
40 AC_PATH_PROG([PERL], [perl])
41 if test -z "$PERL"; then
42         AC_MSG_ERROR([perl not found])
45 AC_MSG_CHECKING([if Perl version >= 5.6.0])
46 if "$PERL" -e "require v5.6.0"; then
47         AC_MSG_RESULT([yes])
48 else
49         AC_MSG_RESULT([no])
50         AC_MSG_ERROR([perl >= 5.6.0 is required for gtk-doc])
53 dnl
54 dnl Check for Python.
55 dnl
56 AM_PATH_PYTHON([2.3],,[:])
57 AM_CONDITIONAL([HAVE_PYTHON], [test "$PYTHON" != :])
59 dnl
60 dnl Check for jade or openjade.
61 dnl
62 dnl We prefer to use openjade with the '-t sgml-raw' option, since '-t sgml'
63 dnl adds a newline before the closing '>' of HTML tags. lynx can't parse
64 dnl that, which is bad for accessibility.
65 dnl
66 SGML_FORMAT_TYPE=sgml-raw
67 AC_PATH_PROG([JADE], [openjade])
68 if test -z "$JADE"; then
69         SGML_FORMAT_TYPE=sgml
70         AC_PATH_PROG([JADE], [jade])
71         if test -z "$JADE"; then
72                 AC_MSG_WARN([Could not find openjade or jade, so SGML is not supported])
73         fi
75 AC_SUBST([SGML_FORMAT_TYPE])
77 dnl
78 dnl Check for xsltproc
79 dnl
80 AC_PATH_PROG([XSLTPROC], [xsltproc])
81 if test -z "$XSLTPROC"; then
82         AC_MSG_ERROR([xsltproc not found])
85 dnl
86 dnl Check for dblatex/fop (for pdf output)
87 dnl
88 AC_PATH_PROG([DBLATEX], [dblatex])
89 if test -z "$DBLATEX"; then
90         AC_PATH_PROG([FOP], [fop])
91         if test -z "$FOP"; then
92                 AC_MSG_WARN([neither dblatex nor fop found, so no pdf output from xml])
93         fi
96 dnl check for DocBook DTD and stylesheets in the local catalog.
97 JH_CHECK_XML_CATALOG([-//OASIS//DTD DocBook XML V4.3//EN], [DocBook XML DTD V4.3])
98 JH_CHECK_XML_CATALOG([http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl], [DocBook XSL Stylesheets])
101 dnl Check for syntax highlighters
103 HIGHLIGHT_OPTIONS=""
104 AC_PATH_PROG([HIGHLIGHT], [source-highlight])
105 if test -n "$HIGHLIGHT"; then
106         HIGHLIGHT_OPTIONS="-t4 -sc -cstyle.css --no-doc -i"
107 else
108         AC_PATH_PROG([HIGHLIGHT], [highlight])
109         if test -n "$HIGHLIGHT"; then
110                 HIGHLIGHT_OPTIONS="-X -f --class-name=gtkdoc "
111         else
112                 AC_PATH_PROG([HIGHLIGHT], [vim])
113                 if test -n "$HIGHLIGHT"; then
114                         dnl vim is useless if it does not support syntax highlighting
115                         AC_MSG_CHECKING([whether vim has +syntax feature])
116                         if $HIGHLIGHT --version | grep '+syntax' >/dev/null; then
117                                 AC_MSG_RESULT([yes])
118                         else
119                                 AC_MSG_RESULT([no])
120                                 HIGHLIGHT=
121                         fi
122                 fi
123         fi
125 AC_SUBST([HIGHLIGHT_OPTIONS])
128 dnl Set PACKAGE_DATA_DIR so we can find the script containing common routines.
130 dnl From Autoconf Macro Archive:
131 m4_define([AC_DEFINE_DIR], [
132         prefix_NONE=
133         exec_prefix_NONE=
134         test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix
135         test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix
136         eval ac_define_dir="\"[$]$2\""
137         eval ac_define_dir="\"$ac_define_dir\""
138         AC_SUBST($1, "$ac_define_dir")
139         test "$prefix_NONE" && prefix=NONE
140         test "$exec_prefix_NONE" && exec_prefix=NONE
142 PACKAGE_DATA_DIR="${datadir}/${PACKAGE}/data"
143 AC_DEFINE_DIR([PACKAGE_DATA_DIR], [PACKAGE_DATA_DIR])
145 dnl Only use -Wall if we have gcc
146 if test "x$GCC" = "xyes"; then
147         if test -z "`echo "$CFLAGS" | grep "\-Wall" 2> /dev/null`" ; then
148                 CFLAGS="$CFLAGS -Wall"
149         fi
152 dnl if glib is available we can enable the tests
153 PKG_CHECK_MODULES(TEST_DEPS, [glib-2.0 >= 2.6.0 gobject-2.0 >= 2.6.0],
154         [       glib_prefix="`$PKG_CONFIG --variable=prefix glib-2.0`"
155                 gtk_doc_use_libtool="yes"
156                 build_tests="yes"
157         ],
158         [       gtk_doc_use_libtool="no"
159                 build_tests="no"
160         ]
162 AM_CONDITIONAL(GTK_DOC_USE_LIBTOOL, test -n "$LIBTOOL" -a x$gtk_doc_use_libtool = xyes )
163 dnl this enable the rule in test/Makefile.am
164 AM_CONDITIONAL(BUILD_TESTS, test x$build_tests = xyes)
165 AC_SUBST(glib_prefix)
167 dnl enable runtime debugging code
168 AC_MSG_CHECKING(whether to enable runtime debugging code)
169 AC_ARG_ENABLE([debug],
170         AS_HELP_STRING([--enable-debug],
171         [enable runtime debugging code (default=no)]),,
172         [enable_debug="no"])
173 AC_MSG_RESULT($enable_debug)
175 if test "$enable_debug" = "yes"; then
176         TRACE="print __FILE__ . \":\" . __LINE__ . \":\" ."
177 else
178         TRACE="#"
180 AC_SUBST(TRACE)
182 AC_CONFIG_FILES([Makefile
183 gtk-doc.pc
184 gtk-doc.dsl
185 gtk-doc.spec
186 gtk-doc.cat
187 gtkdoc-common.pl
188 help/Makefile
189 help/manual/Makefile
190 tests/Makefile
191 tests/gobject/Makefile
192 tests/gobject/src/Makefile
193 tests/gobject/docs/Makefile
194 tests/gobject/docs-tmpl/Makefile
195 tests/bugs/Makefile
196 tests/bugs/src/Makefile
197 tests/bugs/docs/Makefile
198 tests/annotations/Makefile
199 tests/annotations/src/Makefile
200 tests/annotations/docs/Makefile
201 tests/fail/Makefile
202 tests/fail/src/Makefile
203 tests/fail/docs/Makefile
204 tests/empty/Makefile
205 tests/empty/src/Makefile
206 tests/empty/docs/Makefile
209 dnl run chmod on these after parsing them.
210 AC_CONFIG_FILES([gtkdoc-check],    [chmod +x gtkdoc-check])
211 AC_CONFIG_FILES([gtkdoc-depscan],  [chmod +x gtkdoc-depscan])
212 AC_CONFIG_FILES([gtkdoc-fixxref],  [chmod +x gtkdoc-fixxref])
213 dnl that would be nice, but would fail if perl is in a non-std path
214 dnl AC_CONFIG_FILES([gtkdoc-mkdb],     [chmod +x gtkdoc-mkdb && perl -cwT gtkdoc-mkdb])
215 AC_CONFIG_FILES([gtkdoc-mkdb],     [chmod +x gtkdoc-mkdb])
216 AC_CONFIG_FILES([gtkdoc-mkhtml],   [chmod +x gtkdoc-mkhtml])
217 AC_CONFIG_FILES([gtkdoc-mkman],    [chmod +x gtkdoc-mkman])
218 AC_CONFIG_FILES([gtkdoc-mkpdf],    [chmod +x gtkdoc-mkpdf])
219 AC_CONFIG_FILES([gtkdoc-mktmpl],   [chmod +x gtkdoc-mktmpl])
220 AC_CONFIG_FILES([gtkdoc-rebase],   [chmod +x gtkdoc-rebase])
221 AC_CONFIG_FILES([gtkdoc-scan],     [chmod +x gtkdoc-scan])
222 AC_CONFIG_FILES([gtkdoc-scangobj], [chmod +x gtkdoc-scangobj])
223 AC_CONFIG_FILES([gtkdoc-scanobj],  [chmod +x gtkdoc-scanobj])
224 AC_CONFIG_FILES([gtkdocize],       [chmod +x gtkdocize])
225 AC_CONFIG_FILES([tests/tools.sh],  [chmod +x tests/tools.sh])
226 AC_OUTPUT
228 AC_MSG_NOTICE([
229 gtk-doc was configured with the following options:
230 ==================================================])
232 test "$PYTHON" != : \
233     && AC_MSG_NOTICE([** Python based tools enabled, using $PYTHON]) \
234     || AC_MSG_NOTICE([   Python based tools disabled])
235 test -n "$JADE" \
236     && AC_MSG_NOTICE([** SGML support enabled, using $JADE]) \
237     || AC_MSG_NOTICE([   SGML support disabled, no jade processor available])
238 test -n "$DBLATEX$FOP" \
239     && AC_MSG_NOTICE([** XML PDF support enabled, using $DBLATEX$FOP]) \
240     || AC_MSG_NOTICE([   XML PDF support disabled, no fop available])
241 test "x$gdu_cv_have_gdu" = "xyes" \
242     && AC_MSG_NOTICE([** Gnome-doc-utils support enabled]) \
243     || AC_MSG_NOTICE([   Gnome-doc-utils support disabled])
244 test "x$enable_scrollkeeper" = "xyes" \
245     && AC_MSG_NOTICE([** Scrollkeeper support enabled]) \
246     || AC_MSG_NOTICE([   Scrollkeeper support disabled])
247 test -n "$HIGHLIGHT" \
248     && AC_MSG_NOTICE([** Syntax highlighting of examples enabled, using $HIGHLIGHT]) \
249     || AC_MSG_NOTICE([   Syntax highlighting of examples disabled])
250 test "x$build_tests" != "xno" \
251     && AC_MSG_NOTICE([** Building regression tests]) \
252     || AC_MSG_NOTICE([   Skipping regression tests])