1#  This the autoconf script for the gimp-help-2 project.
2#  The GPL version 2 applies to it, which you may get from
3#  http://www.gnu.org/.
4
5AC_PREREQ(2.54)
6
7m4_define([help_major_version], [2])
8m4_define([help_minor_version], [10])
9m4_define([help_micro_version], [0])
10
11m4_define([help_version], [help_major_version.help_minor_version.help_micro_version])
12
13AC_INIT([GIMP-Help], [help_version])
14
15# Apparently this macro must be called before "AM_INIT_AUTOMAKE"
16AC_CANONICAL_BUILD
17case $build_os in
18  *cygwin*) IS_CYGWIN=yes;;
19         *) IS_CYGWIN=no;;
20esac
21# for use in Makefile.am
22AM_CONDITIONAL(CYGWIN, test $IS_CYGWIN = yes)
23# for use in Makefile
24#AC_SUBST(IS_CYGWIN)
25
26AC_CONFIG_SRCDIR([src/gimp.xml])
27AC_CONFIG_COMMANDS(
28    [stylesheets],
29    [test "${srcdir:-.}" != "${builddir:-.}" &&
30     { test -d stylesheets || mkdir stylesheets; } &&
31     cp -f $srcdir/stylesheets/*.xsl $srcdir/stylesheets/*.dtd stylesheets/]
32)
33# XXX: use this if 'configure' (instead of 'config.status') should do it:
34#AC_CONFIG_COMMANDS_POST([
35#    test "${srcdir:-.}" != "${builddir:-.}" &&
36#    { test -d stylesheets || mkdir stylesheets; } &&
37#    cp -f $srcdir/stylesheets/*.xsl $srcdir/stylesheets/*.dtd stylesheets/
38#])
39
40AM_INIT_AUTOMAKE([1.10 tar-pax dist-bzip2 -Wall -Wno-portability])
41
42AM_MAINTAINER_MODE
43
44AC_PROG_INSTALL
45AC_PROG_LN_S
46AC_PROG_MKDIR_P
47AC_PROG_MAKE_SET
48AC_PROG_SED
49
50
51#  You can set the LINGUAS or LANGUAGES environment variable to
52#  control what languages are build:
53#      LINGUAS   will be re restricted to languages in ALL_LINGUAS
54#      LANGUAGES will override ALL_LINGUAS
55#
56#  Quickreference files are built for languages in
57#  QUICKREFERENCE_ALL_LINGUAS *and* (intersection) ALL_LINGUAS
58
59if test "x$ALL_LINGUAS" = "x"; then
60	ALL_LINGUAS="ca da de el en en_GB es fi fr it ja ko nl nn pt_BR ro ru zh_CN"
61else
62  ALL_LINGUAS=`echo "$ALL_LINGUAS" | $SED -e 's/[,] */ /g'`
63fi
64if test "x$QUICKREFERENCE_ALL_LINGUAS" = "x"; then
65  QUICKREFERENCE_ALL_LINGUAS="ca de el en fi fr it ja ko pl ro ru sv zh_CN"
66fi
67
68AC_SUBST(ALL_LINGUAS)
69AC_SUBST(QUICKREFERENCE_ALL_LINGUAS)
70
71
72#  It doesn't make sense to disable HTML build.
73
74AC_ARG_ENABLE(build, AS_HELP_STRING([--disable-build], [obsolete]), , )
75#AM_CONDITIONAL(GIMP_HELP_BUILD, true)
76
77#AC_ARG_ENABLE(i18n,
78#              AS_HELP_STRING([--disable-i18n],
79#                             [don't build translated HTML files (with xml2po & gettext)]),
80#              , enable_i18n=yes)
81#AM_CONDITIONAL(GIMP_HELP_I18N, test "$enable_i18n" = "yes")
82
83test "$ALL_LINGUAS" != "en" && enable_i18n=yes || enable_i18n=no
84
85
86#  Check for GNU make.
87
88AC_MSG_CHECKING([whether ${MAKE-make} is GNU make])
89if (${MAKE-make} --version) < /dev/null > /dev/null 2>&1; then
90  if (${MAKE-make} --version) 2> /dev/null | grep 'GNU Make' > /dev/null 2>&1; then
91    AC_MSG_RESULT(yes)
92  else
93    AC_MSG_RESULT(no)
94    AC_MSG_WARN([
95** It seems that the make utility is not GNU Make. Since this project
96** makes use of GNU Make extensions, you may run into build problems.
97** Please use GNU Make if possible.
98])
99  fi
100else
101  AC_MSG_ERROR([${MAKE-make} not found])
102fi
103
104
105#  Search for the XSLT processor
106
107AC_PATH_PROG(XSLTPROC, xsltproc)
108if test -z "$XSLTPROC"; then
109  AC_MSG_ERROR([
110** Couldn't find xsltproc(1). You will need it to build the help files.
111** See the file 'INSTALL' for more help.])
112fi
113
114
115#  Search for xmllint
116
117AC_PATH_PROG(XMLLINT, xmllint)
118if test -z "$XMLLINT" && test "x$enable_build" = "xyes"; then
119  AC_MSG_WARN([cannot find xmllint(1), XML will not be validated])
120fi
121
122AM_CONDITIONAL(HAVE_XMLLINT, test -n "$XMLLINT")
123XMLLINTFLAGS="--nonet"
124AC_SUBST(XMLLINTFLAGS)
125
126
127#  Search for dblatex
128
129AC_PATH_PROG(DBLATEX, dblatex)
130if test -z "$DBLATEX"; then
131  AC_MSG_WARN([cannot find dblatex(1), PDF generation disabled])
132fi
133
134AM_CONDITIONAL(HAVE_DBLATEX, test -n "$DBLATEX")
135DBLATEXFLAGS="--backend=xetex --style=db2latex --verbose"
136AC_SUBST(DBLATEXFLAGS)
137
138
139#  Search for docbook2odf
140
141AC_PATH_PROG(DOCBOOK2ODF, docbook2odf)
142if test -z "$DOCBOOK2ODF"; then
143  AC_MSG_NOTICE([cannot find docbook2odf(1), ODF generation disabled])
144fi
145
146AM_CONDITIONAL(HAVE_DOCBOOK2ODF, test -n "$DOCBOOK2ODF")
147DOCBOOK2ODFFLAGS=
148AC_SUBST(DOCBOOK2ODFFLAGS)
149
150
151#  Use our customized xml2po
152
153XML2PO='$(top_srcdir)/tools/xml2po.py'
154XML2POFLAGS="--mode=gimphelp"
155AC_SUBST(XML2PO)
156AC_SUBST(XML2POFLAGS)
157
158
159#  Search for gettext tools
160
161AC_PATH_PROG(MSGFMT, msgfmt)
162if test -z "$MSGFMT" && test "x$enable_i18n" = "xyes"; then
163  # print warning only for the main i18n tools xml2po & msgfmt
164  AC_MSG_WARN([cannot find msgfmt])
165  missing_i18n_tools=${missing_i18n_tools:+"${missing_i18n_tools} "}msgfmt
166fi
167MSGFMTFLAGS="--check --use-fuzzy --statistics"
168AC_SUBST(MSGFMTFLAGS)
169
170
171AC_PATH_PROG(MSGINIT, msginit)
172if test -z "$MSGINIT" && test "x$enable_i18n" = "xyes"; then
173  missing_i18n_tools=${missing_i18n_tools:+"${missing_i18n_tools} "}msginit
174fi
175MSGINITFLAGS='--no-translator --width=$(MSGWIDTH)'
176AC_SUBST(MSGINITFLAGS)
177
178
179AC_PATH_PROG(MSGMERGE, msgmerge)
180if test -z "$MSGMERGE" && test "x$enable_i18n" = "xyes"; then
181  missing_i18n_tools=${missing_i18n_tools:+"${missing_i18n_tools} "}msgmerge
182fi
183MSGMERGEFLAGS='--quiet --width=$(MSGWIDTH)'
184AC_SUBST(MSGMERGEFLAGS)
185
186
187AC_PATH_PROG(MSGUNIQ, msguniq)
188if test -z "$MSGUNIQ" && test "x$enable_i18n" = "xyes"; then
189  missing_i18n_tools=${missing_i18n_tools:+"${missing_i18n_tools} "}msguniq
190fi
191MSGUNIQFLAGS=
192AC_SUBST(MSGUNIQFLAGS)
193
194
195AC_PATH_PROG(MSGCAT, msgcat)
196if test -z "$MSGCAT" && test "x$enable_i18n" = "xyes"; then
197  missing_i18n_tools=${missing_i18n_tools:+"${missing_i18n_tools} "}msgcat
198fi
199MSGCATFLAGS='--width=$(MSGWIDTH)'
200AC_SUBST(MSGCATFLAGS)
201
202MSGWIDTH=79
203AC_SUBST(MSGWIDTH)
204
205#  Optional: dot to create build system map
206
207AC_PATH_PROG(DOT, dot)
208#if test -z "$DOT"; then
209#  AC_MSG_NOTICE([cannot find dot(1), creating build system PNG disabled])
210#fi
211
212AM_CONDITIONAL(HAVE_DOT, test -n "$DOT")
213
214
215#test -z "$missing_i18n_tools" && HAVE_I18N_TOOLS=yes || HAVE_I18N_TOOLS=no
216#AC_SUBST(HAVE_I18N_TOOLS)
217AM_CONDITIONAL(HAVE_I18N_TOOLS, test -z "$missing_i18n_tools")
218
219test -z "$missing_i18n_tools" || test "$missing_i18n_tools" = "xml2po" &&
220HAVE_GETTEXT_TOOLS=yes || HAVE_GETTEXT_TOOLS=no
221AM_CONDITIONAL(HAVE_GETTEXT_TOOLS, test "$HAVE_GETTEXT_TOOLS" = "yes")
222#AC_SUBST(HAVE_GETTEXT_TOOLS)
223
224
225#  Optionally allow xsltproc to access DTDs over the network
226
227AC_ARG_ENABLE(network,
228              AS_HELP_STRING([--enable-network],
229                             [allow xsltproc to fetch DTDs/entities over the network]))
230
231if test "x$enable_network" != "xyes"; then
232  XSLTFLAGS="$XSLTFLAGS --nonet"
233fi
234
235AC_SUBST(XSLTFLAGS)
236
237
238#  Optionally allow to build a language selector. A HTML menu is
239#  rendered based on ALL_LINGUAS below the header navigation in the HTML
240#  output.
241
242AC_ARG_ENABLE(languageMenu,
243              AS_HELP_STRING([--enable-languageMenu],
244                             [Compile the HTML output with a language selector.]))
245
246if test "x$enable_languageMenu" = "xyes"; then
247    XSLTFLAGS="$XSLTFLAGS --stringparam gimp.help.languageselector 1"
248fi
249
250AC_SUBST(XSLTFLAGS)
251
252
253#  Optionally search for pngnq and pngcrush, which are helpful for
254#  creating distributions
255
256AC_PATH_PROG(PNGNQ, pngnq)
257if test -z "$PNGNQ"; then
258  AC_MSG_WARN([cannot find pngnq,
259images will not be optimized during distribution creation])
260fi
261
262
263
264AC_PATH_PROG(PNGCRUSH, pngcrush)
265if test -z "$PNGCRUSH"; then
266  AC_MSG_WARN([cannot find pngcrush,
267images will not be optimized during distribution creation])
268fi
269
270AM_CONDITIONAL(HAVE_PNGOPTIMIZERS, test -n "$PNGNQ" && test -n "$PNGCRUSH")
271
272
273#  Default to the correct way of identifying stylesheets.
274#  People need an XML catalog to resolve this to a local file.
275
276STYLEBASE='http://docbook.sourceforge.net/release/xsl/current'
277
278
279#  Allow to explicitly specify the stylesheet location
280#  in case the XML catalog doesn't exist or is broken.
281
282AC_ARG_WITH(xsl,
283            AS_HELP_STRING([--with-xsl=<basedir>],
284                           [path to the base of the DocBook Modular Stylesheets
285                            (deprecated - fix your DocBook Stylesheets package!)
286                           ]))
287
288if test "x$with_xsl" != "x"; then
289  STYLEBASE="$with_xsl"
290  AC_CHECK_FILE($STYLEBASE/xhtml/docbook.xsl, ,
291                AC_MSG_ERROR([** Couldn't find docbook.xsl in $STYLEBASE/xhtml]))
292fi
293
294AC_SUBST(STYLEBASE)
295
296
297#  We need the GIMP data directory to install the help files.
298
299AC_ARG_WITH(gimp,
300            AS_HELP_STRING([--without-gimp],
301                           [skip check for gimp2, install into PREFIX]))
302
303if test "x$with_gimp" != "xno"; then
304  #  Note: AC_MSG_ERROR() must be bracket-quoted, or else errors result
305  PKG_CHECK_MODULES(GIMP, gimp-2.0, , [AC_MSG_ERROR([
306** Couldn't find a GIMP-2.0 installation. If you want to skip this check and
307** install the help files to the configured prefix, use the --without-gimp
308** configure option. Note that GIMP will then only find the help files if it
309** is installed in the same prefix. See the file 'INSTALL' for more help.])])
310
311  gimpdatadir=`$PKG_CONFIG --variable=gimpdatadir gimp-2.0`
312else
313  gimpdatadir=`pkg-config --variable=gimpdatadir gimp-2.0` ||
314  gimpdatadir='$(datadir)/gimp/2.0'
315fi
316
317AC_SUBST(gimpdatadir)
318
319
320if test -n "$missing_i18n_tools" && test "$enable_i18n" = "yes"; then
321  AC_MSG_WARN([
322** Couldn't find some tools needed to build translated help files.
323** You will be able to build the English manual, but no translations.])
324  ALL_LINGUAS=en
325fi
326
327
328AC_CONFIG_FILES([
329Makefile
330quickreference/Makefile
331stylesheets/plainhtml.xsl
332stylesheets/htmlalternate.xsl
333])
334
335AC_OUTPUT
336
337AC_MSG_RESULT([
338 Languages:                 $ALL_LINGUAS
339 Installation prefix:       $gimpdatadir ])
340if test -n "$missing_i18n_tools" && test "$enable_i18n" = "yes"; then
341 AC_MSG_RESULT([ Missing translation tools: $missing_i18n_tools ])
342fi
343