1dnl Process this file with autoconf to produce a configure script.
2
3AC_INIT
4AC_CONFIG_SRCDIR([src/common/Clock.hh])
5
6MATHVIEW_MAJOR_VERSION=0
7MATHVIEW_MINOR_VERSION=8
8MATHVIEW_MICRO_VERSION=0
9MATHVIEW_VERSION=$MATHVIEW_MAJOR_VERSION.$MATHVIEW_MINOR_VERSION.$MATHVIEW_MICRO_VERSION
10MATHVIEW_VERSION_INFO=`expr $MATHVIEW_MAJOR_VERSION + $MATHVIEW_MINOR_VERSION`:$MATHVIEW_MICRO_VERSION:$MATHVIEW_MINOR_VERSION
11
12MAJOR_VERSION=$MATHVIEW_MAJOR_VERSION
13MINOR_VERSION=$MATHVIEW_MINOR_VERSION
14VERSION=$MATHVIEW_VERSION
15
16AC_SUBST(MAJOR_VERSION)
17AC_SUBST(MINOR_VERSION)
18AC_SUBST(MATHVIEW_VERSION)
19AC_SUBST(MATHVIEW_VERSION_INFO)
20
21AREAMODEL_VERSION_INFO=$MATHVIEW_VERSION_INFO
22AC_SUBST(AREAMODEL_VERSION_INFO)
23
24AC_ARG_ENABLE(
25	builder-cache,
26	[  --enable-builder-cache[=ARG] enable the cache for MathML text nodes [default=no]],
27	enable_builder_cache=$enableval,
28	enable_builder_cache=no
29)
30
31AC_ARG_ENABLE(
32	pipe,
33	[  --enable-pipe[=ARG]     enable the -pipe option in the GCC compiler [default=no]],
34	enable_pipe=$enableval,
35	enable_pipe=no
36)
37
38AC_ARG_ENABLE(
39	profile,
40	[  --enable-profile[=ARG]  include profiling information [default=no]],
41	enable_profile=$enableval,
42	enable_profile=no
43)
44
45AC_ARG_ENABLE(
46	debug,
47	[  --enable-debug[=ARG]    include debugging debug [default=yes]],
48	enable_debug=$enableval,
49	enable_debug=no
50)
51
52AC_ARG_ENABLE(
53	breaks,
54	[  --enable-breaks[=ARG]   enable linebreaking with mspace elements [default=no]],
55	enable_breaks=$enableval,
56	enable_breaks=no
57)
58
59if test "x$enable_breaks" = "xyes"; then
60	AC_DEFINE(ENABLE_BREAKS,1,[Define to 1 if you want to enable linebreaking using mspace elements])
61fi
62
63AC_ARG_ENABLE(
64	boxml,
65	[  --enable-boxml[=ARG]    enable support for BoxML markup [default=yes]],
66	enable_boxml=$enableval,
67	enable_boxml=yes
68)
69AM_CONDITIONAL([COND_BOXML], [test "$enable_boxml" = "yes"])
70if test "x$enable_boxml" = "xyes"; then
71	AC_DEFINE(GMV_ENABLE_BOXML,1,[Define to 1 if you want support for BoxML markup])
72	GMV_ENABLE_BOXML_CFLAGS=-DGMV_ENABLE_BOXML=1
73else
74	GMV_ENABLE_BOXML_CFLAGS=
75fi
76AC_SUBST(GMV_ENABLE_BOXML_CFLAGS)
77
78AC_ARG_ENABLE(
79	gmetadom,
80	[  --enable-gmetadom[=ARG]  enable the GMetaDOM frontend [default=auto]],
81	enable_gmetadom=$enableval,
82	enable_gmetadom="auto"
83)
84
85AC_ARG_ENABLE(
86	libxml2,
87	[  --enable-libxml2[=ARG]   enable the libxml2 frontend [default=auto]],
88	enable_libxml2=$enableval,
89	enable_libxml2="auto"
90)
91
92AC_ARG_ENABLE(
93	libxml2-reader,
94	[  --enable-libxml2-reader[=ARG] enable the libxml2 reader frontend [default=auto]],
95	enable_libxml2_reader=$enableval,
96	enable_libxml2_reader="auto"
97)
98
99AC_ARG_ENABLE(
100	custom-reader,
101	[  --enable-custom-reader[=ARG] enable the custom reader frontend [default=yes]],
102	enable_custom_reader=$enableval,
103	enable_custom_reader="yes"
104)
105
106AC_ARG_ENABLE(
107	tfm,
108	[  --enable-tfm[=ARG]  enable support level for TeX Font Metrics (0,1,2,3) [disabled=0,default=2]],
109	enable_tfm=$enableval,
110	enable_tfm="2"
111)
112if test $enable_tfm = "yes"; then
113  enable_tfm="2"
114elif test $enable_tfm = "no"; then
115  enable_tfm="0"
116fi
117
118AC_ARG_ENABLE(
119	gtk,
120	[  --enable-gtk[=ARG]  enable GTK backend [default=auto]],
121	enable_gtk=$enableval,
122	enable_gtk="auto"
123)
124
125AC_ARG_ENABLE(
126	svg,
127	[  --enable-svg[=ARG]  enable SVG backend [default=yes]],
128	enable_svg=$enableval,
129	enable_svg="yes"
130)
131
132AC_ARG_ENABLE(
133	ps,
134	[  --enable-ps[=ARG]  enable PostScript backend [default=yes]],
135	enable_ps=$enableval,
136	enable_ps="yes"
137)
138
139AC_ARG_ENABLE(
140	gcc-pch,
141	[  --enable-gcc-pch=[yes/no/auto]       use gcc4 pch support (default=auto)],
142	enable_gcc_pch=$enableval,
143	enable_gcc_pch="auto"
144)
145
146AC_ARG_WITH(
147	t1lib,
148	[  --with-t1lib[=ARG]      compile with t1lib 1.x library [default=auto]],
149	with_t1lib=$withval,
150	with_t1lib=auto
151)
152
153AC_ARG_WITH(
154        t1lib-prefix,
155        [  --with-t1lib-prefix=PFX prefix dir where t1lib is installed],
156        [
157                with_t1lib_prefix=yes
158                T1LIB_PREFIX=$withval
159        ],
160        [
161                with_t1lib_prefix=no
162        ]
163)
164
165AC_ARG_WITH(
166        popt-prefix,
167        [  --with-popt-prefix=PFX prefix dir where popt is installed],
168        [
169                with_popt_prefix="yes"
170                POPT_PREFIX=$withval
171        ],
172        [
173                with_popt_prefix="no"
174        ]
175)
176
177AC_ARG_WITH(
178	popt,
179	[  --with-popt[=ARG] use popt - required for mathmlsvg and viewer (default=auto)],
180	with_popt=$withval,
181	with_popt="auto"
182)
183
184dnl Automake configuration
185AM_CONFIG_HEADER(config.h)
186AM_INIT_AUTOMAKE(gtkmathview, $MATHVIEW_VERSION)
187AC_LIBTOOL_WIN32_DLL
188AM_PROG_LIBTOOL
189
190dnl config.h top and bottom
191AH_TOP([
192/* Copyright (C) 2000-2007, Luca Padovani <padovani@sti.uniurb.it>.
193 *
194 * This file is part of GtkMathView, a flexible, high-quality rendering
195 * engine for MathML documents.
196 *
197 * GtkMathView is free software; you can redistribute it and/or modify it
198 * under the terms of the GNU Lesser General Public License as published
199 * by the Free Software Foundation; either version 3 of the License, or
200 * (at your option) any later version.
201 *
202 * GtkMathView is distributed in the hope that it will be useful, but
203 * WITHOUT ANY WARRANTY; without even the implied warranty of
204 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
205 * Lesser General Public License for more details.
206 *
207 * You should have received a copy of the GNU Lesser General Public License
208 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
209 */
210
211#ifndef config_h
212#define config_h
213])
214
215AH_BOTTOM([
216#define GMV_ENABLE_TFM (GMV_TFM_LEVEL != 0)
217
218#endif /* config_h */
219])
220
221dnl Checks for programs.
222AC_PROG_CC
223AC_PROG_CXX
224AC_PROG_LN_S
225AC_ISC_POSIX
226
227dnl Checks for header files.
228AC_HEADER_STDC
229AC_CHECK_HEADERS(unistd.h)
230
231dnl Checks for typedefs, structures, and compiler characteristics.
232AC_C_CONST
233AC_C_BIGENDIAN
234AC_C_CHAR_UNSIGNED
235AC_CHECK_SIZEOF(unsigned char, 1)
236AC_CHECK_SIZEOF(unsigned short, 2)
237AC_CHECK_SIZEOF(unsigned int, 4)
238AC_CHECK_SIZEOF(unsigned long, 4)
239AC_CHECK_SIZEOF(unsigned long long, 8)
240AC_CHECK_SIZEOF(wchar_t, 8)
241if test "x$ac_cv_c_char_unsigned" = "xyes"; then
242   AC_SUBST(CHAR_UNSIGNED, "1")
243else
244   AC_SUBST(CHAR_UNSIGNED, "0")
245fi
246AC_SUBST(GTKMATHVIEW_SIZEOF_CHAR, "$ac_cv_sizeof_unsigned_char")
247AC_SUBST(GTKMATHVIEW_SIZEOF_SHORT, "$ac_cv_sizeof_unsigned_short")
248AC_SUBST(GTKMATHVIEW_SIZEOF_INT, "$ac_cv_sizeof_unsigned_int")
249AC_SUBST(GTKMATHVIEW_SIZEOF_LONG, "$ac_cv_sizeof_unsigned_long")
250AC_SUBST(GTKMATHVIEW_SIZEOF_LONG_LONG, "$ac_cv_sizeof_unsigned_long_long")
251AC_SUBST(GTKMATHVIEW_SIZEOF_WCHAR_T, "$ac_cv_sizeof_wchar_t")
252
253AC_LANG_PUSH(C++)
254
255AC_CHECK_HEADERS(hash_map,
256	[
257		AC_DEFINE(GMV_HAVE_HASH_MAP,1,[Define if <hash_map> is provided])
258		GMV_HAVE_HASH_MAP_CFLAGS=-DGMV_HAVE_HASH_MAP=1
259	],
260	[
261		GMV_HAVE_HASH_MAP_CFLAGS=
262	]
263)
264AC_SUBST(GMV_HAVE_HASH_MAP_CFLAGS)
265AC_CHECK_HEADERS(ext/hash_map,
266	[
267		AC_DEFINE(GMV_HAVE_EXT_HASH_MAP,1,[Define if <ext/hash_map> is provided])
268		GMV_HAVE_EXT_HASH_MAP_CFLAGS=-DGMV_HAVE_EXT_HASH_MAP=1
269	],
270	[
271		GMV_HAVE_EXT_HASH_MAP_CFLAGS=
272	]
273)
274AC_SUBST(GMV_HAVE_EXT_HASH_MAP_CFLAGS)
275
276AC_MSG_CHECKING([whether the C++ compiler supports the standard character traits])
277AC_TRY_LINK(
278	[#include <string>],
279	[
280		std::basic_string<char> s1;
281		std::basic_string<wchar_t> s2;
282		std::basic_string<wchar_t> s3;
283		s2 = s3;
284	],
285	[
286		AC_DEFINE(STD_TRAITS,1,[Define to 1 if standard traits for char and wchar_t are provided])
287		AC_MSG_RESULT(yes)
288	],
289	[
290		AC_MSG_RESULT(no)
291	]
292)
293
294AC_LANG_POP(C++)
295
296AC_CHECK_PROG(HAVE_XSLTPROC, xsltproc, yes, no)
297if test $HAVE_XSLTPROC = "no"; then
298	AC_MSG_WARN(xsltproc not found, the compilation may fail)
299fi
300AM_CONDITIONAL([COND_XSLTPROC], [test "$HAVE_XSLTPROC" = "yes"])
301
302have_popt="no"
303if test $with_popt = "auto"; then
304	AC_CHECK_HEADERS(popt.h,[
305		AC_CHECK_LIB(popt, poptGetContext, [have_popt="yes"])
306	])
307else
308	have_popt=$with_popt
309fi
310
311if test $have_popt = "yes"; then
312	AC_DEFINE(HAVE_POPT_H,1,[Define to 1 if popt.h is available])
313
314        if test $with_popt_prefix = "yes"; then
315                POPT_CFLAGS="-I$POPT_PREFIX/include"
316		POPT_LIBS="-L$POPT_PREFIX/lib -lpopt"
317	else
318		POPT_CFLAGS=""
319		POPT_LIBS="-lpopt"
320        fi
321else
322	POPT_CFLAGS=""
323	POPT_LIBS=""
324fi
325AM_CONDITIONAL([COND_HAVE_POPT], [test "$have_popt" = "yes"])
326AC_SUBST(POPT_CFLAGS)
327AC_SUBST(POPT_LIBS)
328
329AC_LANG([C])
330
331PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.2.1],,[AC_MSG_ERROR(could not find GLIB)])
332AC_SUBST(GLIB_CFLAGS)
333AC_SUBST(GLIB_LIBS)
334
335have_gtk="no"
336have_pango="no"
337if test "$enable_gtk" = "auto" -o "$enable_gtk" = "yes"; then
338  PKG_CHECK_MODULES(GTK, [gtk+-2.0 >= 2.2.1],
339    [AC_DEFINE(HAVE_GTK,1,[Define to 1 if GTK+ is installed])
340     have_gtk="yes"],
341    [AC_MSG_WARN([could not find GTK+])])
342  AC_SUBST(GTK_CFLAGS)
343  AC_SUBST(GTK_LIBS)
344  PKG_CHECK_MODULES(PANGOX, pangox,
345    [AC_DEFINE(HAVE_PANGO,1,[Define to 1 if Pango is installed])
346     have_pango="yes"],
347    [AC_MSG_WARN([could not find Pango])])
348  AC_SUBST(PANGOX_CFLAGS)
349  AC_SUBST(PANGOX_LIBS)
350fi
351
352AM_CONDITIONAL([COND_GTK], [test "$enable_gtk" = "yes" -o \( "$enable_gtk" = "auto" -a \( "$have_gtk" = "yes" -a "$have_pango" = "yes" \) \) ])
353
354AM_CONDITIONAL([COND_CUSTOM_READER], [test "$enable_custom_reader" = "yes" -o "$enable_custom_reader" = "auto"])
355
356have_libxml2="no"
357PKG_CHECK_MODULES(XML, [libxml-2.0 >= 2.6.7],
358  [AC_DEFINE(HAVE_LIBXML,1,[Define to 1 if libxml2 is installed])
359   have_libxml2="yes"],
360  [AC_MSG_WARN([could not find libxml2])])
361AC_SUBST(XML_CFLAGS)
362AC_SUBST(XML_LIBS)
363AM_CONDITIONAL([COND_LIBXML2], [test "$enable_libxml2" = "yes" -o \( "$enable_libxml2" = "auto" -a "$have_libxml2" = "yes" \)])
364AM_CONDITIONAL([COND_LIBXML2_READER], [test "$enable_libxml2_reader" = "yes" -o \( "$enable_libxml2_reader" = "auto" -a "$have_libxml2" = "yes" \)])
365
366have_gmetadom="no"
367if test "$enable_gmetadom" = "yes" -o "$enable_gmetadom" = "auto"; then
368  PKG_CHECK_MODULES(DOM, [gdome2-cpp-smart >= 0.1.8],
369    [AC_DEFINE(HAVE_GMETADOM,1,[Define to 1 if gmetadom is installed])
370     have_gmetadom="yes"],
371    [AC_MSG_WARN([could not find GMetaDOM])]
372    [enable_gmetadom="no"])
373  AC_SUBST(DOM_CFLAGS)
374  AC_SUBST(DOM_LIBS)
375fi
376AM_CONDITIONAL([COND_GMETADOM], [test "$enable_gmetadom" = "yes" -o \( "$enable_gmetadom" = "auto" -a "$have_gmetadom" = "yes" \)])
377
378have_t1lib="no"
379if test $with_t1lib = "auto"; then
380	AC_CHECK_HEADERS(t1lib.h,[
381		AC_CHECK_LIB(t1, T1_InitLib, [have_t1lib="yes"],,[-lm])
382	])
383else
384	have_t1lib=$with_t1lib
385fi
386
387if test $have_t1lib = "yes"; then
388	AC_DEFINE(HAVE_LIBT1,1,[Define to 1 to compile with t1lib for Type 1 fonts])
389
390        if test $with_t1lib_prefix = "yes"; then
391                T1_CFLAGS="-I$T1LIB_PREFIX/include"
392		T1_LIBS="-L$T1LIB_PREFIX/lib -lt1"
393		T1_LIBS_X="-L$T1LIB_PREFIX/lib -lt1x"
394	else
395		T1_CFLAGS=""
396		T1_LIBS="-lt1"
397		T1_LIBS_X="-lt1x"
398        fi
399else
400	T1_CFLAGS=""
401	T1_LIBS=""
402	T1_LIBS_X=""
403fi
404AM_CONDITIONAL([COND_T1LIB], [test $have_t1lib = "yes"])
405AC_SUBST(T1_CFLAGS)
406AC_SUBST(T1_LIBS)
407AC_SUBST(T1_LIBS_X)
408
409CFLAGS="$CFLAGS -W -Wall"
410CXXFLAGS="$CXXFLAGS -W -Wall"
411
412if test $enable_debug = yes; then
413	CFLAGS="$CFLAGS -O0"
414	CXXFLAGS="$CXXFLAGS -O0"
415	AC_DEFINE(ENABLE_DEBUG,1,[Define to 1 if you want to enable validity checks while running])
416fi
417
418if test $enable_profile = yes; then
419	CFLAGS="$CFLAGS -pg"
420	CXXFLAGS="$CXXFLAGS -pg"
421	AC_DEFINE(ENABLE_PROFILE,1,[Define to 1 to let the widget collect some information for profiling purposes])
422fi
423AM_CONDITIONAL([COND_PROFILE], [test "$enable_profile" = "yes"])
424
425if test $enable_pipe = yes; then
426	CFLAGS="$CFLAGS -pipe"
427	CXXFLAGS="$CXXFLAGS -pipe"
428fi
429
430if test $enable_builder_cache = yes; then
431    AC_DEFINE(ENABLE_BUILDER_CACHE,1,[Define to 1 to enable caching of MathML Text nodes (slower but saves memory)])
432fi
433
434AC_DEFINE_UNQUOTED(GMV_TFM_LEVEL, $enable_tfm, [Define to 0, 1, 2, or 3 depending on the TFM support level you want])
435AM_CONDITIONAL([COND_TFM], [test "$enable_tfm" != "0"])
436AM_CONDITIONAL([COND_TFM_LEVEL_1], [test "$enable_tfm" = "1"])
437AM_CONDITIONAL([COND_TFM_LEVEL_2], [test "$enable_tfm" = "2"])
438AM_CONDITIONAL([COND_TFM_LEVEL_3], [test "$enable_tfm" = "3"])
439
440if test "$enable_tfm" = "0" -a "$enable_svg" = "yes"; then
441	AC_MSG_WARN([SVG support requires TFM support])
442	enable_svg="no"
443fi
444
445if test "$enable_svg" = "yes"; then
446	AC_DEFINE(ENABLE_SVG,1,[Define to 1 if you want to enable the SVG backend])
447fi
448AM_CONDITIONAL([COND_SVG], [test "$enable_svg" = "yes"])
449
450if test "$enable_ps" = "yes"; then
451	AC_DEFINE(ENABLE_PS,1,[Define to 1 if you want to enable the PostScript backend])
452fi
453AM_CONDITIONAL([COND_PS], [test "$enable_ps" = "yes"])
454
455AM_BINRELOC
456AM_CONDITIONAL(WITH_BINRELOC, test "x$br_cv_binreloc" = "xyes")
457
458AC_MSG_CHECKING([whether to use GCC precompiled headers with $CXX])
459if test "x$GCC" = "xyes" ; then
460	_gmv_gcc_version=`$CXX --version | grep GCC | head -1 | cut -f 3 -d " "`
461        _gmv_gcc_major=`echo $_gmv_gcc_version | cut -f 1 -d "."`
462
463	if [[ "$_gmv_gcc_major" -ge "4" ]] ; then
464		if test "x$enable_gcc_pch" = "xyes" ; then
465			AC_MSG_RESULT(yes)
466			gmv_gcc_pch="yes"
467		elif test "x$enable_gcc_pch" = "xauto" ; then
468			AC_MSG_RESULT(yes)
469			gmv_gcc_pch="yes"
470		else
471			AC_MSG_RESULT(no)
472			gmv_gcc_pch="no"
473		fi
474	else
475		AC_MSG_RESULT(no)
476		gmv_gcc_pch="no"
477	fi
478else
479	gmv_gcc_pch="no"
480fi
481AM_CONDITIONAL(USE_GCC_PCH, test "x$gmv_gcc_pch" = "xyes")
482
483AC_CONFIG_FILES([
484 Makefile
485 gtkmathview.spec
486 config/Makefile
487 config/gtkmathview.conf.xml
488 scripts/Makefile
489 auto/Makefile
490 auto/Char.hh.in
491 autopackage/Makefile
492 src/Makefile
493 src/common/Makefile
494 src/common/mathvariants/Makefile
495 src/common/mathvariants/xml/Makefile
496 src/frontend/Makefile
497 src/frontend/common/Makefile
498 src/frontend/custom_reader/Makefile
499 src/frontend/libxml2_reader/Makefile
500 src/frontend/libxml2/Makefile
501 src/frontend/gmetadom/Makefile
502 src/engine/Makefile
503 src/engine/common/Makefile
504 src/engine/boxml/Makefile
505 src/engine/mathml/Makefile
506 src/engine/adapters/Makefile
507 src/backend/Makefile
508 src/backend/common/Makefile
509 src/backend/common/tfm/Makefile
510 src/backend/gtk/Makefile
511 src/backend/svg/Makefile
512 src/backend/ps/Makefile
513 src/view/Makefile
514 src/widget/Makefile
515 viewer/Makefile
516 mathmlsvg/Makefile
517 mathmlps/Makefile
518 doc/Makefile
519 mathview-core.pc
520 mathview-frontend-custom-reader.pc
521 mathview-frontend-libxml2-reader.pc
522 mathview-frontend-libxml2.pc
523 mathview-frontend-gmetadom.pc
524 mathview-backend-ps.pc
525 mathview-backend-svg.pc
526 mathview-backend-gtk.pc
527 gtkmathview-custom-reader.pc
528 gtkmathview-libxml2-reader.pc
529 gtkmathview-libxml2.pc
530 gtkmathview-gmetadom.pc
531 autopackage/abimath.apspec
532])
533AC_OUTPUT
534
535cat <<EOF
536
537GtkMathView ${MATHVIEW_VERSION}
538
539Compilation
540
541  GCC pipe            ${enable_pipe}
542  Profiling           ${enable_profile}
543  Debugging           ${enable_debug}
544  xsltproc            ${HAVE_XSLTPROC}
545  popt                ${have_popt}
546
547Engine
548
549  MathML              yes
550  BoxML               ${enable_boxml}
551
552Frontend
553
554  GMetaDOM            ${enable_gmetadom}
555  libxml2             ${enable_libxml2}
556  libxml2 reader      ${enable_libxml2_reader}
557  custom reader       ${enable_custom_reader}
558
559Backend
560
561  GTK+                ${have_gtk}
562  Type1 fonts (t1lib) ${have_t1lib}
563  TFM support level   ${enable_tfm}
564  SVG                 ${enable_svg}
565  PostScript          ${enable_ps}
566
567Performance
568
569  Builder cache       ${enable_builder_cache}
570
571EOF
572