1
2m4_define([abi_version_major], [3])
3m4_define([abi_version_minor], [0])
4m4_define([abi_version_micro], [5])
5m4_define([abi_series], [abi_version_major.abi_version_minor])
6m4_define([abi_version], [abi_version_major.abi_version_minor.abi_version_micro])
7
8AC_INIT([abiword],[abi_version],[http://www.abisource.com/])
9AC_CANONICAL_HOST
10AC_CONFIG_HEADERS(config.h)
11
12AM_INIT_AUTOMAKE([1.9 tar-ustar])
13m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
14
15dnl we use AM_MAINTAINER_MODE and enable it to allow to disable it.
16dnl very usefull to build in scratchbox where the maintainer mode is used for the PC
17dnl build but the embedded build just use pregenerated one (with a different version)
18AM_MAINTAINER_MODE([enable])
19
20#
21# Dependency requirements
22#
23
24#
25# versions requested.
26#
27GTK_VERSION_REQ=3.0.8
28GTK_ENCODED_VERSION="GDK_VERSION_3_0"
29GTK2_VERSION_REQ=2.12.0
30
31AC_ARG_WITH([gtk2],
32	[AS_HELP_STRING([--with-gtk2], [use Gtk library version 2.x])],
33[
34	abi_cv_gtk2="$withval"
35])
36
37
38# This check MUST be done early.
39#
40# We define EMBEDDED_TARGET to a numerical value so that we can do like
41# #if EMBEDDED_TARGET = EMBEDDED_TARGET_HILDON
42#
43# The following have to be defined unconditionally, because we want
44# EMBEDDED_TARGET to be undefined if not building for embedded so that we
45# can use #ifdef and #ifndef on it (two undefined symbols will return
46# true if tested for equality in #if construct)
47AC_DEFINE([EMBEDDED_TARGET_GENERIC], [1], [Generic embedded platform])
48AC_DEFINE([EMBEDDED_TARGET_HILDON],  [2], [Hildon embedded platform])
49AC_DEFINE([EMBEDDED_TARGET_POKY],    [3], [Poky embedded platform])
50
51AC_ARG_ENABLE([embedded],
52	[AS_HELP_STRING([--enable-embedded], [=generic|hildon|poky, (Gtk+ only), build for embedded platform])],
53[
54	abi_cv_embedded_platform="$enableval"
55	case "$enableval" in
56	hildon)
57		abi_cv_embedded_target=EMBEDDED_TARGET_HILDON
58		GTK2_VERSION_REQ=2.12.0
59		;;
60	poky)
61		abi_cv_embedded_target=EMBEDDED_TARGET_POKY ;;
62	generic)
63		abi_cv_embedded_target=EMBEDDED_TARGET_GENERIC ;;
64	yes)
65		abi_cv_embedded_target=EMBEDDED_TARGET_GENERIC
66		abi_cv_embedded_platform="generic" ;;
67	no)
68		;;
69	*)
70		AC_MSG_ERROR(bad value $enableval for --enable-embedded) ;;
71	esac
72],[
73	abi_cv_embedded_platform="no"
74	abi_cv_embedded_target="no"
75])
76
77#
78# setting the deps requirement is done further down
79#
80
81# cross platform deps
82fribidi_req='fribidi >= 0.10.4'
83glib_req='glib-2.0 >= 2.6.0 gthread-2.0 >= 2.6.0 gobject-2.0 >= 2.6.0'
84gsf_req='libgsf-1 >= 1.14.18'
85gsf_gio_req='libgsf-1 >= 1.14.9'
86wv_req='wv-1.0 >= 1.2.0'
87xslt_req='libxslt'
88xp_pkgs="
89  ${fribidi_req}
90  ${glib_req}
91  ${gsf_req}
92  ${wv_req}
93  ${xslt_req}
94"
95
96# optional deps
97enchant_req='enchant >= 1.2.0'
98gio_req='gio-2.0'
99goffice_req='libgoffice-0.10 >= 0.10.0'
100
101hildon_pkgs='hildon-1 hildon-fm-2 dbus-1 libosso'
102dnl libosso-gsf-1'
103# placeholder for accumulated optional deps
104opt_pkgs=''
105
106# gtk deps
107cairo_req='cairo-pdf cairo-ps pangocairo'
108#
109if test "x$abi_cv_gtk2" = "xyes"; then
110gtk_req="gtk+-2.0 >= $GTK2_VERSION_REQ gtk+-unix-print-2.0 librsvg-2.0 >= 2.16.0"
111else
112gtk_req="gtk+-3.0 >= $GTK_VERSION_REQ gtk+-unix-print-3.0 librsvg-2.0 >= 2.16.0"
113fi
114dnl cairo-fc is needed but only available on cairo > 1.10
115dnl http://bugzilla.abisource.com/show_bug.cgi?id=13265
116PKG_CHECK_EXISTS(cairo >= 1.10, [gtk_req="$gtk_req cairo-fc"],[])
117gtk_pkgs="
118  ${cairo_req}
119  ${gtk_req}
120"
121# cocoa deps
122cocoa_pkgs="$enchant_req $cairo_req"
123
124
125# win32 deps
126win_pkgs="$enchant_req"
127
128#
129# System tests
130#
131
132AC_PROG_CC
133AC_PROG_CXX
134AX_CXX_COMPILE_STDCXX_11(noext,mandatory)
135#AC_PROG_OBJC
136AC_PROG_INSTALL
137# For libtool 1.5.x compatability (AC_PROG_LIBTOOL is deprecated version of LT_INIT)
138m4_ifdef([LT_INIT], [LT_INIT([disable-static win32-dll])], [AC_LIBTOOL_WIN32_DLL])
139m4_ifdef([LT_INIT], [], [AC_PROG_LIBTOOL])
140AC_PROG_LN_S
141
142AC_CHECK_PROG(HAVE_PERL, perl, yes, no)
143if test "x$HAVE_PERL" = "xno"; then
144	AC_MSG_ERROR([*** perl program not found])
145fi
146
147
148TOOLKIT_IS_GTK2="no"
149AC_MSG_CHECKING([for platform and toolkit])
150case ${host_os} in
151  *darwin*)
152    PLATFORM="unix"
153    TOOLKIT="cocoa"
154    ;;
155  *mingw*)
156    PLATFORM="win"
157    TOOLKIT="win"
158    ;;
159  *)
160    PLATFORM="unix"
161    if test "x$abi_cv_gtk2" = "xyes"; then
162      TOOLKIT_IS_GTK2="yes"
163    fi
164    TOOLKIT="gtk"
165    ;;
166esac
167AC_MSG_RESULT([$PLATFORM / $TOOLKIT])
168AC_SUBST([PLATFORM])
169AC_DEFINE_UNQUOTED(PLATFORM, "$PLATFORM", The platform that is compiled for)
170AC_SUBST([TOOLKIT])
171AC_DEFINE_UNQUOTED(TOOLKIT, "$TOOLKIT", The toolkit that is used)
172
173# Platform-specific tests
174
175function_err='Your operating system or setup seems to be missing one or more required functions'
176header_err='Your operating system or setup seems to be missing one or more required header files'
177
178cocoa_funcs='floor mkdir'
179unix_funcs='alarm gettimeofday'
180win_funcs=
181xp_funcs='localeconv strcspn strncasecmp strtoul' # "sqrt" test fails, hmm
182funcs=
183
184if test "$PLATFORM" = "cocoa"; then
185	funcs="$cocoa_funcs $xp_funcs"
186elif test "$PLATFORM" = "unix"; then
187	AC_CHECK_HEADERS([sys/time.h], [], [$header_err])
188	AC_FUNC_STRTOD
189	AC_TYPE_UINT32_T
190	funcs="$unix_funcs $xp_funcs"
191elif test "$PLATFORM" = "win"; then
192	funcs="$win_funcs $xp_funcs"
193fi
194
195AC_CHECK_FUNCS([ $funcs ],
196[], [
197	AC_MSG_ERROR([$function_err])
198])
199
200#
201# Features
202#
203
204AC_ARG_ENABLE([default-plugins],
205	[AS_HELP_STRING([--disable-default-plugins], [do not build any plugins by default])],
206[
207	if test "$enableval" = "no"; then
208		abi_cv_disable_default_plugins="yes"
209	fi
210])
211
212m4_define([plugin_list], m4_include([plugin-list.m4]))
213
214AC_ARG_ENABLE([plugins],
215	[AS_HELP_STRING([--enable-plugins], [="foo bar baz", list of plugins to build. Use --disable-plugins to disable plugin loading support, resulting in a smaller binary size. The list of plugins : ]m4_n([plugin_list]))],
216[
217	if test "$enableval" = "no"; then
218		abi_cv_disable_exports="yes"
219		abi_cv_disable_default_plugins="yes"
220		abi_cv_plugins=""
221	elif test "$enableval" = "yes"; then
222		# auto-detect which plugins can be built
223		abi_cv_plugins="auto"
224	else
225		# custom plugins list
226		abi_cv_plugins="$enableval"
227	fi
228])
229
230AC_ARG_ENABLE([builtin-plugins],
231	[AS_HELP_STRING([--enable-builtin-plugins], [="foo bar baz", list of plugins to link statically])],
232[
233	if test "$enableval" = "no"; then
234		abi_cv_builtin_plugins=""
235	elif test "$enableval" = "yes"; then
236		# just build default plugins
237		abi_cv_builtin_plugins=""
238	else
239		# custom plugins list
240		abi_cv_builtin_plugins="$enableval"
241	fi
242])
243
244AC_ARG_ENABLE([menubutton],
245	[AS_HELP_STRING([--enable-menubutton], [(Gtk+ only) menu-button instead of menu-bar])],
246[
247	abi_cv_menubutton="$enableval"
248],[
249	abi_cv_menubutton="no"
250])
251
252AC_ARG_ENABLE([print],
253	[AS_HELP_STRING([--disable-print], [(Gtk+ only) do not include printing support])],
254[
255	abi_cv_print="$enableval"
256],[
257	abi_cv_print="yes"
258])
259
260if test "$abi_cv_print" = "yes" &&
261   test "$TOOLKIT" = "gtk"; then
262	opt_pkgs="$opt_pkgs"
263fi
264
265AC_ARG_ENABLE([spell],
266	[AS_HELP_STRING([--disable-spell], [(Gtk+ only) do not include spell checking support])],
267[
268	abi_cv_spell="$enableval"
269],[
270	# autodetect
271	if test "$PLATFORM" = "unix"; then
272		PKG_CHECK_EXISTS([ $enchant_req ],
273		[
274			abi_cv_spell="yes"
275		], [
276			abi_cv_spell="no"
277		])
278	else
279		abi_cv_spell="yes"
280	fi
281])
282
283if test "$abi_cv_spell" = "yes"; then
284	opt_pkgs="$opt_pkgs $enchant_req"
285fi
286
287AC_ARG_ENABLE([statusbar],
288	[AS_HELP_STRING([--disable-statusbar], [(Gtk+ only) do not include status bar])],
289[
290	abi_cv_statusbar="$enableval"
291],[
292	# on by default
293	abi_cv_statusbar="yes"
294])
295
296AC_ARG_ENABLE([emacs-keybinding],
297	[AS_HELP_STRING([--enable-emacs-keybinding], [Enable the use of emacs-compatible keyboard commands])],
298[
299	abi_cv_emacs_keybinding="$enableval"
300], [
301	abi_cv_emacs_keybinding="yes"
302])
303
304AC_ARG_ENABLE([vi-keybinding],
305	[AS_HELP_STRING([--enable-vi-keybinding], [Enable the use of vi-compatible keyboard commands])],
306[
307	abi_cv_vi_keybinding="$enableval"
308], [
309	abi_cv_vi_keybinding="yes"
310])
311
312AC_ARG_ENABLE([clipart],
313	[AS_HELP_STRING([--enable-clipart], [Install clipart])],
314[
315	abi_cv_clipart="$enableval"
316], [
317	abi_cv_clipart="no"
318])
319
320AC_ARG_ENABLE([templates],
321	[AS_HELP_STRING([--enable-templates], [Install additional templates])],
322[
323	abi_cv_templates="$enableval"
324], [
325	abi_cv_templates="no"
326])
327
328#
329# deferred from the "enable-embedded"
330#
331if test "$abi_cv_embedded_platform" = "hildon"; then
332	opt_pkgs="$opt_pkgs $hildon_pkgs"
333fi
334
335
336AC_ARG_ENABLE([debug],
337	[AS_HELP_STRING([--enable-debug], [Enable debugging functionality, verbose terminal output])],
338[
339	if test "$enableval" = "yes"; then
340		abi_cv_debug="yes"
341	fi
342], [
343	abi_cv_debug="no"
344])
345
346#
347# Optional packages
348#
349if test "x$abi_cv_gtk2" = "xyes"; then
350AC_ARG_WITH([gnomevfs],
351         [AS_HELP_STRING([--with-gnomevfs], [(Gtk+-2 only) use gnome-vfs library])],
352	[
353	        abi_cv_gnomevfs="$withval"
354	],[
355	        # use gnomevfs if detected
356	        if test "$TOOLKIT_IS_GTK2" = "yes"; then
357	                PKG_CHECK_EXISTS([ $gnomevfs_req ],
358	                [
359	                        abi_cv_gnomevfs="yes"
360	                ], [
361	                        abi_cv_gnomevfs="no"
362	                ])
363	        else
364	                abi_cv_gnomevfs="no"
365	        fi
366	])
367
368	if test "$abi_cv_gnomevfs" = "yes"; then
369	        opt_pkgs="$opt_pkgs $gnomevfs_req"
370	fi
371fi
372
373AC_ARG_WITH([gio],
374	[AS_HELP_STRING([--with-gio], [use GIO library])],
375[
376	abi_cv_gio="$withval"
377],[
378	# use gio if detected
379	PKG_CHECK_EXISTS([ $gio_req ],
380	[
381		abi_cv_gio="yes"
382	], [
383		abi_cv_gio="no"
384	])
385])
386
387if test "$abi_cv_gio" = "yes"; then
388	opt_pkgs="$opt_pkgs $gio_req"
389fi
390
391AC_ARG_WITH([goffice],
392	[AS_HELP_STRING([--with-goffice], [(Gtk+ only) use goffice library])],
393[
394	abi_cv_goffice="$withval"
395],[
396	# use goffice if detected
397	if test "$TOOLKIT" = "gtk"; then
398	PKG_CHECK_EXISTS([ $goffice_req ],
399	[
400		abi_cv_goffice="yes"
401	], [
402		abi_cv_goffice="no"
403	])
404	fi
405])
406
407GOFFICE_BUILTIN_CPPFLAGS=
408GOFFICE_BUILTIN_LIBS=
409if test "$TOOLKIT_IS_GTK2" = "yes"; then
410	GOFFICE_BUILTIN_CPPFLAGS='-I${top_srcdir}/goffice-bits2'
411	GOFFICE_BUILTIN_LIBS='${top_builddir}/goffice-bits2/libgoffice.la'
412	AC_SUBST(GOFFICE_BUILTIN_CPPFLAGS)
413	AC_SUBST(GOFFICE_BUILTIN_LIBS)
414elif test "$PLATFORM" = "unix" && \
415   test "$abi_cv_goffice" = "yes"; then
416	opt_pkgs="$opt_pkgs $goffice_req"
417else
418	GOFFICE_BUILTIN_CPPFLAGS='-I${top_srcdir}/goffice-bits'
419	GOFFICE_BUILTIN_LIBS='${top_builddir}/goffice-bits/libgoffice.la'
420	AC_SUBST(GOFFICE_BUILTIN_CPPFLAGS)
421	AC_SUBST(GOFFICE_BUILTIN_LIBS)
422fi
423
424AC_ARG_WITH([darwinports],
425	[AS_HELP_STRING([--with-darwinports], [(Mac OSX only) add `/opt/local' prefix to CPP/LDFLAGS])],
426[
427        if test "x$withval" != "xno"; then
428            CPPFLAGS="$CPPFLAGS -I/opt/local/include"
429            LDFLAGS="$LDFLAGS -headerpad_max_install_names -L/opt/local/lib"
430        fi
431])
432
433AC_ARG_WITH([fink],
434	[AS_HELP_STRING([--with-fink], [(Mac OSX only) add `/sw' prefix to CPP/LDFLAGS])],
435[
436        if test "x$withval" != "xno"; then
437                CPPFLAGS="$CPPFLAGS -I/sw/include"
438                LDFLAGS="$LDFLAGS -L/sw/lib"
439        fi
440])
441
442AC_ARG_WITH([abisdk],
443	[AS_HELP_STRING([--with-abisdk], [(Mac OSX only) use the AbiSDK])],
444[
445	if test "x$withval" = "x"; then
446		AC_MSG_ERROR([The AbiSDK path must be specified.])
447	fi
448	if test "x$withval" != "xno"; then
449		PKG_CONFIG=/opt/abi/bin/pkg-config
450		PKG_CONFIG_PATH=/usr/lib/pkgconfig ; export PKG_CONFIG_PATH
451		CPPFLAGS="$CPPFLAGS -mmacosx-version-min=10.4 -isysroot $withval -I/opt/abi/include"
452		LDFLAGS="$LDFLAGS -mmacosx-version-min=10.4 -isysroot $withval -L/opt/abi/lib"
453	fi
454])
455
456
457redland_req='redland >= 1.0.10 rasqal >= 0.9.17'
458AC_ARG_WITH([redland],
459	[AS_HELP_STRING([--with-redland], [use redland and raptor libraries])],
460[
461	abi_cv_redland="$withval"
462],[
463	# use redland if detected
464	PKG_CHECK_EXISTS([ $redland_req ],
465	[
466		abi_cv_redland="yes"
467	], [
468		abi_cv_redland="no"
469	])
470])
471
472if test "$abi_cv_redland" = "yes"; then
473	opt_pkgs="$opt_pkgs $redland_req"
474	AC_DEFINE([WITH_REDLAND], [1], [Using redland])
475fi
476
477AM_CONDITIONAL([WITH_REDLAND], test "$abi_cv_redland" = "yes")
478AM_CONDITIONAL([HAVE_REDLAND], test "$abi_cv_redland" = "yes")
479
480
481evolution_data_server_req='libebook-1.2 >= 3.6'
482AC_ARG_WITH([evolution_data_server],
483	[AS_HELP_STRING([--with-evolution-data-server], [Use Evolution Data Server to get at contact information])],
484[
485	abi_cv_evolution_data_server="$withval"
486],[
487	# use evolution_data_server if detected
488	PKG_CHECK_EXISTS([ $evolution_data_server_req ],
489	[
490		abi_cv_evolution_data_server="yes"
491	], [
492		abi_cv_evolution_data_server="no"
493	])
494])
495
496if test "$abi_cv_evolution_data_server" = "yes"; then
497	opt_pkgs="$opt_pkgs $evolution_data_server_req"
498	AC_DEFINE([WITH_EVOLUTION_DATA_SERVER], [1], [Using evolution_data_server])
499fi
500
501AM_CONDITIONAL([WITH_EVOLUTION_DATA_SERVER], test "$abi_cv_evolution_data_server" = "yes")
502AM_CONDITIONAL([HAVE_EVOLUTION_DATA_SERVER], test "$abi_cv_evolution_data_server" = "yes")
503
504
505libical_req=' libical >= 0.46 '
506AC_ARG_WITH([libical],
507	[AS_HELP_STRING([--with-libical], [use libical and raptor libraries])],
508[
509	abi_cv_libical="$withval"
510],[
511	# use libical if detected
512	PKG_CHECK_EXISTS([ $libical_req ],
513	[
514		abi_cv_libical="yes"
515	], [
516		abi_cv_libical="no"
517	])
518])
519
520if test "$abi_cv_libical" = "yes"; then
521	opt_pkgs="$opt_pkgs $libical_req"
522	AC_DEFINE([WITH_LIBICAL], [1], [Using libical])
523fi
524
525AM_CONDITIONAL([WITH_LIBICAL], test "$abi_cv_libical" = "yes")
526AM_CONDITIONAL([HAVE_LIBICAL], test "$abi_cv_libical" = "yes")
527
528
529champlain_req=' champlain-gtk-0.12 '
530AC_ARG_WITH([champlain],
531	[AS_HELP_STRING([--with-champlain], [use champlain to display maps])],
532	,[with_champlain="check"])
533
534if test "x$with_champlain" != "xno"; then
535    PKG_CHECK_MODULES(CHAMPLAIN, [ $champlain_req ],,
536    [if test "x$with_champlain" = "xyes"; then
537    	AC_MSG_FAILURE([--with-champlain was given, but test for champlain failed])
538    fi])
539    abi_cv_champlain=yes
540
541	if test "$pkg_failed" = "no"; then
542	#
543	# try to make sure that champlain-gtk through pkg-config and
544 	# the GTK+ version that the user wants abiword to directly
545 	# link with match on major number.
546	#
547	# The test is simple, make sure that a little client using the
548	# GTK+ that champlain natively uses is using the GTK+ version
549	# that we want to link with.
550 	#
551	AC_LANG_PUSH(C++)
552	CXXFLAGS_cache=$CXXFLAGS
553	CXXFLAGS=" $CHAMPLAIN_CFLAGS "
554	LDFLAGS_cache=$LDFLAGS
555	LDFLAGS=" $CHAMPLAIN_LIBS "
556
557	if test "x$abi_cv_gtk2" = "xyes"; then
558 	  echo -n "checking whether CHAMPLAIN uses GTK+2... "
559
560		AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <champlain-gtk/champlain-gtk.h>],[
561 #if GTK_MAJOR_VERSION > 2
562 #error bad
563 #endif
564                               ])], gtk_matches=yes, gtk_matches=no)
565	else
566 	  echo -n "checking whether CHAMPLAIN uses GTK+3... "
567		AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <champlain-gtk/champlain-gtk.h>],[
568 #if GTK_MAJOR_VERSION < 3
569 #error bad
570 #endif
571                               ])], gtk_matches=yes, gtk_matches=no)
572	fi
573        echo "$gtk_matches"
574
575	LDFLAGS=$LDFLAGS_cache
576	CXXFLAGS=$CXXFLAGS_cache
577        AC_LANG_POP
578
579 	# Don't do mapping if their libchamplain is not using the right GTK+
580	if test "$gtk_matches" = "no"; then
581		if test "x$with_champlain" = "xyes"; then
582			AC_MSG_FAILURE([--with-champlain was given, but champlain does not use the correct gtk version])
583		fi
584	   abi_cv_champlain=no
585           CHAMPLAIN_CFLAGS=
586           CHAMPLAIN_LIBS=
587	fi
588	else
589		abi_cv_champlain=no
590	fi
591else
592	abi_cv_champlain=no
593fi
594
595if test "$abi_cv_champlain" = "yes"; then
596dnl	opt_pkgs="$opt_pkgs $champlain_req"
597	AC_DEFINE([WITH_CHAMPLAIN], [1], [Using champlain])
598fi
599
600AC_SUBST([CHAMPLAIN_CFLAGS])
601AC_SUBST([CHAMPLAIN_LIBS])
602AM_CONDITIONAL([WITH_CHAMPLAIN], test "$abi_cv_champlain" = "yes")
603AM_CONDITIONAL([HAVE_CHAMPLAIN], test "$abi_cv_champlain" = "yes")
604
605
606AC_ARG_WITH([icondir],
607	[AS_HELP_STRING([--with-icondir=DIR], [install icon in DIR instead of PREFIX/share/icons/THEME/SIZE/apps])],
608[
609	abi_cv_icondir="$withval"
610])
611if test "$abi_cv_icondir" = "" -o \
612        "$abi_cv_icondir" = "yes" -o \
613        "$abi_cv_icondir" = "no"; then
614	abi_cv_prefix="$prefix"
615	test "$abi_cv_prefix" = "NONE" && abi_cv_prefix="$ac_default_prefix"
616	abi_cv_icondir="${abi_cv_prefix}/share/icons"
617fi
618AC_SUBST(ABIWORD_ICONDIR, "$abi_cv_icondir")
619
620dnl ***********************************************************************
621dnl GCC/Clang sanitizer support
622dnl ***********************************************************************
623AC_ARG_WITH([sanitizer],
624            [AS_HELP_STRING([--with-sanitizer=@<:@address/undefined/no@:>@],
625                            [Use specific GCC/Clang analyzer])],
626            [with_sanitizer=$withval],
627            [with_sanitizer=no])
628AS_IF([test "x$with_sanitizer" != "xno"],[
629	AX_CHECK_COMPILE_FLAG([-fsanitize=$withval],
630	                      [CFLAGS="$CFLAGS -fsanitize=$withval"
631			       CXXFLAGS="$CXXFLAGS -fsanitize=$withval"],
632	                      [AC_MSG_ERROR([-fsanitize=$withval is not supported])])
633        AX_APPEND_COMPILE_FLAGS([-fno-omit-frame-pointer])
634        AC_LANG_PUSH(C++)
635        AX_APPEND_COMPILE_FLAGS([-fno-omit-frame-pointer])
636        AC_LANG_POP
637])
638
639#
640# Compiler settings (from gnumeric's configure.in)
641#
642# TODO enable -Wshadow
643AC_LANG_PUSH(C++)
644if test "$GCC" = "yes"; then
645	for option in -Wall -Wextra -Wsign-compare -Wpointer-arith \
646		      -Wchar-subscripts -Wwrite-strings -Wmissing-noreturn \
647                      -Wformat-overflow=2 \
648		      -Wunused -Wpointer-arith -Wshadow; do
649		SAVE_CPPFLAGS="$CPPFLAGS"
650		CPPFLAGS="$CPPFLAGS $option"
651		AC_MSG_CHECKING([whether gcc understands $option])
652		AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])],
653			has_option=yes,
654			has_option=no)
655		if test $has_option = no; then
656		  CPPFLAGS="$SAVE_CPPFLAGS"
657		fi
658		AC_MSG_RESULT($has_option)
659		unset has_option
660		unset SAVE_CPPFLAGS
661	done
662	unset option
663
664	for option in -Wno-overloaded-virtual; do
665		SAVE_CXXFLAGS="$CXXFLAGS"
666		CXXFLAGS="$CXXFLAGS $option"
667		AC_MSG_CHECKING([whether gcc understands $option])
668		AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])],
669			has_option=yes,
670			has_option=no)
671		if test $has_option = no; then
672		  CXXFLAGS="$SAVE_CXXFLAGS"
673		fi
674		AC_MSG_RESULT($has_option)
675		unset has_option
676		unset SAVE_CXXFLAGS
677	done
678	unset option
679fi
680AC_LANG_POP
681
682#
683# Dependency tests
684#
685
686# We need libpng
687for l in libpng libpng16 libpng14 libpng12; do
688  AC_MSG_CHECKING(for $l)
689  if $PKG_CONFIG --exists $l ; then
690    AC_MSG_RESULT(yes)
691    PKG_CHECK_MODULES(PNG, $l, [abi_cv_png=yes],[abi_cv_png=no])
692    break
693  else
694    AC_MSG_RESULT(no)
695  fi
696done
697if test x$abi_cv_png != xyes; then
698  AC_CHECK_HEADER([png.h], [],
699  [
700    AC_MSG_ERROR([`png.h' not found, install libpng or specify CPPFLAGS to include custom locations])
701  ])
702  PNG_CFLAGS=
703  PNG_LIBS=-lpng
704fi
705
706# We need ljpeg
707AC_CHECK_HEADER(jpeglib.h,[
708	AC_CHECK_LIB(jpeg,jpeg_read_header,
709	[],
710	[
711	  AC_MSG_ERROR([libjpeg not found])
712	])
713],[
714	  AC_MSG_ERROR([jpeg.h not found])
715])
716
717# TODO need to check for libz too, at least on win32
718AC_CHECK_HEADER([zlib.h], [],
719[
720	AC_MSG_ERROR([`zlib.h' not found, install zlib or specify CPPFLAGS to include custom locations])
721])
722
723AX_BOOST_BASE([1.40.0],,[AC_MSG_ERROR([`boost' not found.])])
724
725deps_pkgs="$xp_pkgs $opt_pkgs"
726SYSTEM_LIBS=
727SYSTEM_CFLAGS=
728if test "$TOOLKIT" = "win"; then
729	deps_pkgs="$deps_pkgs $win_pkgs"
730	# nonstandard dlls go below the blank line
731	SYSTEM_LIBS="-ladvapi32 -lcomctl32 -lcomdlg32 -lgdi32 -lkernel32 -lole32 -loleaut32 -lshell32 -luser32 -luuid -lversion -lwinspool \
732		      $PNG_LIBS -lz -ljpeg"
733	SYSTEM_CFLAGS="-mthreads"
734elif test "$TOOLKIT" = "cocoa"; then
735	deps_pkgs="$deps_pkgs $cocoa_pkgs"
736	SYSTEM_LIBS="-framework Cocoa"
737	AC_CHECK_PROG([CONVERT], [convert], convert, AC_MSG_ERROR(Cannot find ImageMagick convert))
738else
739	SYSTEM_CFLAGS=$PNG_CFLAGS
740	SYSTEM_LIBS="$PNG_LIBS -ljpeg"
741	deps_pkgs="$deps_pkgs $gtk_pkgs x11"
742fi
743
744PKG_CHECK_MODULES(DEPS,[$deps_pkgs])
745
746if test "$TOOLKIT" = "gtk"; then
747       DEPS_CFLAGS="$DEPS_CFLAGS -DGDK_VERSION_MIN_REQUIRED=$GTK_ENCODED_VERSION"
748fi
749dnl -DGDK_VERSION_MAX_ALLOWED=$GTK_ENCODED_VERSION"
750
751dnl make that for all.
752if test "$TOOLKIT" = "gtk" -o "$TOOLKIT" = "cocoa"; then
753	dnl move away
754	AC_DEFINE([WITH_CAIRO], [1], [Using Cairo])
755	WITH_CAIRO=1
756fi
757AM_CONDITIONAL([WITH_CAIRO], test "$WITH_CAIRO" = "1")
758
759
760AC_SUBST([DEPS_CFLAGS])
761if test "$abi_cv_gio" = "yes"; then
762	PKG_CHECK_MODULES(GSFGI, [$gsf_gio_req], [abi_cv_gsf_gio=yes],
763                 [abi_cv_gsf_gio=no])
764	if test "$abi_cv_gsf_gio" = "yes" ; then
765		AC_DEFINE([HAVE_GSF_GIO], [1], [GSF has GIO support])
766	fi
767else
768	abi_cv_gsf_gio=no
769fi
770
771DEPS_LIBS="$SYSTEM_LIBS $DEPS_LIBS"
772AC_SUBST([DEPS_LIBS])
773
774BASE_CPPFLAGS_='
775  ${DEPS_CFLAGS}
776  ${BOOST_CPPFLAGS}
777  -I${top_srcdir}
778  ${GOFFICE_BUILTIN_CPPFLAGS}'
779BASE_CPPFLAGS="$SYSTEM_CFLAGS"
780for f in $(echo $BASE_CPPFLAGS_); do BASE_CPPFLAGS="$BASE_CPPFLAGS $f"; done
781AC_SUBST([BASE_CPPFLAGS])
782
783AF_CPPFLAGS_='
784  ${BASE_CPPFLAGS}
785  -I${top_srcdir}/src/af/ev/${TOOLKIT}
786  -I${top_srcdir}/src/af/ev/xp
787  -I${top_srcdir}/src/af/gr/${TOOLKIT}
788  -I${top_srcdir}/src/af/gr/xp
789  -I${top_srcdir}/src/af/util/${PLATFORM}
790  -I${top_srcdir}/src/af/util/xp
791  -I${top_srcdir}/src/af/xap/${TOOLKIT}
792  -I${top_srcdir}/src/af/xap/xp'
793AF_CPPFLAGS=
794for f in $(echo $AF_CPPFLAGS_); do AF_CPPFLAGS="$AF_CPPFLAGS $f"; done
795AC_SUBST([AF_CPPFLAGS])
796
797AF_TEST_CPPFLAGS_='
798  ${AF_CPPFLAGS}
799  -I${top_srcdir}/src/af/tf/xp'
800AF_TEST_CPPFLAGS=
801for f in $(echo $AF_TEST_CPPFLAGS_); do AF_TEST_CPPFLAGS="$AF_TEST_CPPFLAGS $f"; done
802AC_SUBST([AF_TEST_CPPFLAGS])
803
804TEXT_CPPFLAGS_='
805  ${AF_CPPFLAGS}
806  -I${top_srcdir}/src/text/fmt/${TOOLKIT}
807  -I${top_srcdir}/src/text/fmt/xp
808  -I${top_srcdir}/src/text/ptbl/xp'
809TEXT_CPPFLAGS=
810for f in $(echo $TEXT_CPPFLAGS_); do TEXT_CPPFLAGS="$TEXT_CPPFLAGS $f"; done
811AC_SUBST([TEXT_CPPFLAGS])
812
813TEXT_TEST_CPPFLAGS_='
814  ${TEXT_CPPFLAGS}
815  -I${top_srcdir}/src/af/tf/xp'
816TEXT_TEST_CPPFLAGS=
817for f in $(echo $TEXT_TEST_CPPFLAGS_); do TEXT_TEST_CPPFLAGS="$TEXT_TEST_CPPFLAGS $f"; done
818AC_SUBST([TEXT_TEST_CPPFLAGS])
819
820IMPEXP_CPPFLAGS_='
821  ${TEXT_CPPFLAGS}
822  -I${top_srcdir}/src/wp/impexp/${TOOLKIT}
823  -I${top_srcdir}/src/wp/impexp/xp'
824IMPEXP_CPPFLAGS=
825for f in $(echo $IMPEXP_CPPFLAGS_); do IMPEXP_CPPFLAGS="$IMPEXP_CPPFLAGS $f"; done
826AC_SUBST([IMPEXP_CPPFLAGS])
827
828IMPEXP_TEST_CPPFLAGS_='
829  ${IMPEXP_CPPFLAGS}
830  -I${top_srcdir}/src/af/tf/xp'
831IMPEXP_TEST_CPPFLAGS=
832for f in $(echo $IMPEXP_TEST_CPPFLAGS_); do IMPEXP_TEST_CPPFLAGS="$IMPEXP_TEST_CPPFLAGS $f"; done
833AC_SUBST([IMPEXP_TEST_CPPFLAGS])
834
835WP_CPPFLAGS_='
836  ${IMPEXP_CPPFLAGS}
837  -I${top_srcdir}/src/wp/ap/${TOOLKIT}
838  -I${top_srcdir}/src/wp/ap/xp
839  -I${top_srcdir}/src/plugins'
840WP_CPPFLAGS=
841for f in $(echo $WP_CPPFLAGS_); do WP_CPPFLAGS="$WP_CPPFLAGS $f"; done
842AC_SUBST([WP_CPPFLAGS])
843
844#
845# Settings
846#
847
848ABIWORD_SERIES="abi_series"
849AC_DEFINE_UNQUOTED([ABIWORD_SERIES], [ "$ABIWORD_SERIES" ], [major.minor])
850AC_SUBST(ABIWORD_SERIES)
851AC_SUBST(ABIWORD_HEADERSDIR, "${includedir}/${PACKAGE_NAME}-${ABIWORD_SERIES}")
852if test "$TOOLKIT" = "cocoa"; then
853AC_SUBST(ABIWORD_CONTENTSDIR, "/AbiWord.app/Contents")
854AC_SUBST(ABIWORD_DATADIR,    "${ABIWORD_CONTENTSDIR}/Resources")
855AC_SUBST(ABIWORD_UIDIR,      "${ABIWORD_CONTENTSDIR}/Resources")
856AC_SUBST(ABIWORD_MACOSDIR,   "${ABIWORD_CONTENTSDIR}/MacOS")
857AC_SUBST(ABIWORD_PLUGINSDIR, "${ABIWORD_CONTENTSDIR}/PlugIns")
858AC_SUBST(ABIWORD_LIBDIR,     "${ABIWORD_CONTENTSDIR}/Frameworks")
859else
860AC_SUBST(ABIWORD_DATADIR,    "${datadir}/${PACKAGE_NAME}-${ABIWORD_SERIES}")
861AC_SUBST(ABIWORD_UIDIR,   "${ABIWORD_DATADIR}/ui")
862AC_SUBST(ABIWORD_LIBDIR,     "${libdir}/${PACKAGE_NAME}-${ABIWORD_SERIES}")
863AC_SUBST(ABIWORD_PLUGINSDIR, "${ABIWORD_LIBDIR}/plugins")
864fi
865
866# maybe just switch on TOOLKIT instead of the fancy TARGET defines
867# also for embedded, e.g. hildon would set TOOLKIT_GTK and TOOLKIT_HILDON
868AM_CONDITIONAL([TOOLKIT_COCOA], test "$TOOLKIT" = "cocoa")
869AM_CONDITIONAL([TOOLKIT_GTK_ALL], test "$TOOLKIT" = "gtk")
870AM_CONDITIONAL([TOOLKIT_GTK], test "$TOOLKIT" = "gtk" -a "$TOOLKIT_IS_GTK2" = "no")
871AM_CONDITIONAL([TOOLKIT_GTK2], test "$TOOLKIT_IS_GTK2" = "yes")
872AM_CONDITIONAL([TOOLKIT_WIN], test "$TOOLKIT" = "win")
873
874if test "$enable_shared" = ""; then
875	enable_shared="no"
876fi
877
878if test "$enable_static" = ""; then
879	enable_static="no"
880fi
881
882if test "$TOOLKIT" = "win"; then
883	AC_DEFINE([TOOLKIT_WIN], [1], [Build win32 user interface])
884	AC_DEFINE([_WIN32_IE], [0x0501], [minimal comctl.dll v4.70 for toolbars])
885	AC_DEFINE([_WIN32_WINNT], [0x0500], [support collaboration plugin in Windows 2000 or higher])
886	case ${host} in
887	  *-w64-mingw*)
888		AC_DEFINE([UNICODE], [1], [Build a full unicode AbiWord])
889		;;
890	  *)
891	  	;;
892	esac
893elif test "$TOOLKIT" = "cocoa"; then
894	AC_DEFINE([TOOLKIT_COCOA], [1], [Build cocoa user interface])
895	# override static/shared, on cocoa. shared only
896	enable_shared="yes"
897	enable_static="no"
898elif test "$TOOLKIT" = "gtk"; then
899     if test "$TOOLKIT_IS_GTK2" = "yes"; then
900	AC_DEFINE([TOOLKIT_GTK2], [1], [Build gtk+ user interface])
901	AC_DEFINE([TOOLKIT_GTK_ALL], [1], [Build gtk+ user interface])
902     else
903	AC_DEFINE([TOOLKIT_GTK], [1], [Build gtk+ user interface])
904	AC_DEFINE([TOOLKIT_GTK_ALL], [1], [Build gtk+ user interface])
905dnl We have no reason to mess with that.
906dnl	# build static binary by default
907dnl	if test "$enable_shared" = "no" && \
908dnl	   test "$enable_static" = "no"; then
909dnl		enable_shared="no"
910dnl		enable_static="yes"
911dnl	fi
912     fi
913fi
914AM_CONDITIONAL([ENABLE_DYNAMIC], test "$enable_shared" = "yes")
915AM_CONDITIONAL([ENABLE_STATIC], test "$enable_static" = "yes")
916
917PKG_CHECK_MODULES(PLUGIN,[$glib_req])
918PLUGIN_CFLAGS="$PLUGIN_CFLAGS "'${WP_CPPFLAGS} -DABI_DLL'
919if test "$TOOLKIT" = "gtk"  &&
920   test "$enable_shared" = "yes"; then
921	# link plugins to work around gcc visibility issue with
922	# derived classes in dlopened modules
923	PLUGIN_LIBS='${top_builddir}/src/libabiword-'"$ABIWORD_SERIES"'.la'" $PLUGIN_LIBS"
924elif test "$TOOLKIT" = "win"; then
925	PLUGIN_CFLAGS="$PLUGIN_CFLAGS "'-D_WIN32_IE=0x0501 -D_WIN32_WINNT=0x0500'
926	PLUGIN_LIBS='${top_builddir}/src/libabiword-'"$ABIWORD_SERIES"'.la'" $PLUGIN_LIBS"
927elif test "$TOOLKIT" = "cocoa" ; then
928	PLUGIN_LIBS='${top_builddir}/src/libabiword-'"$ABIWORD_SERIES"'.la'" $PLUGIN_LIBS"
929fi
930AC_SUBST([PLUGIN_CFLAGS])
931AC_SUBST([PLUGIN_LIBS])
932
933if test "$abi_cv_disable_exports" = "yes"; then
934	AC_DEFINE([DISABLE_EXPORTS], [1], [Define to prevent symbols from being exported dynamically])
935fi
936
937if test "$abi_cv_menubutton" = "yes"; then
938	AC_DEFINE([ENABLE_MENUBUTTON], [1], [Define if building menu button support])
939fi
940AM_CONDITIONAL([ENABLE_MENUBUTTON], test "$abi_cv_menubutton" = "yes")
941
942if test "$abi_cv_print" = "yes"; then
943	AC_DEFINE([ENABLE_PRINT], [1], [Define if building printing support])
944fi
945AM_CONDITIONAL([ENABLE_PRINT], test "$abi_cv_print" = "yes")
946
947if test "$abi_cv_spell" = "yes"; then
948	AC_DEFINE([ENABLE_SPELL], [1], [Define if building spell checking support])
949	# TODO get rid of this after all platforms are using enchant exclusively
950	AC_DEFINE([WITH_ENCHANT], [1], [use Dom's enchanting spell checker abstraction library])
951fi
952AM_CONDITIONAL([ENABLE_SPELL], test "$abi_cv_spell" = "yes")
953
954if test "$abi_cv_statusbar" = "yes"; then
955	AC_DEFINE([ENABLE_STATUSBAR], [1], [Define if building status bar])
956fi
957AM_CONDITIONAL([ENABLE_STATUSBAR], test "$abi_cv_statusbar" = "yes")
958
959if test "$abi_cv_embedded_target" != "no"; then
960	AC_DEFINE_UNQUOTED(EMBEDDED_TARGET, $abi_cv_embedded_target, [Whether we are building for embedded device])
961fi
962AM_CONDITIONAL(EMBEDDED_HILDON, test "$abi_cv_embedded_target" = "EMBEDDED_TARGET_HILDON")
963
964if test "$abi_cv_emacs_keybinding" = "yes"; then
965	AC_DEFINE([ENABLE_EMACS_KEYBINDING], [1], [Define to enable include emacs-compatible keyboard commands])
966fi
967AM_CONDITIONAL(ENABLE_EMACS_KEYBINDING, test "$abi_cv_emacs_keybinding" = "yes")
968
969if test "$abi_cv_vi_keybinding" = "yes"; then
970	AC_DEFINE([ENABLE_VI_KEYBINDING], [1], [Define to enable include vi-compatible keyboard commands])
971fi
972AM_CONDITIONAL(ENABLE_VI_KEYBINDING, test "$abi_cv_vi_keybinding" = "yes")
973
974AM_CONDITIONAL(ENABLE_CLIPART, test "$abi_cv_clipart" = "yes")
975AM_CONDITIONAL(ENABLE_TEMPLATES, test "$abi_cv_templates" = "yes")
976
977if test "$abi_cv_debug" = "yes"; then
978	AC_DEFINE([DEBUG], [1], [Define to enable debugging functionality])
979else
980	AC_DEFINE([NDEBUG], [1], [Define to disable debugging functionality])
981fi
982AM_CONDITIONAL(DEBUG, test "$abi_cv_debug" = "yes")
983
984#
985# Optional dependencies handling
986#
987AM_PATH_LIBGCRYPT( 1.4.5,
988		   [
989		   abi_cv_gcrypt=no
990 		   AC_DEFINE([HAVE_GCRYPT], [1], [Use gcrypt for the cryptos])
991		   ],
992		   [
993		   abi_cv_gcrypt=yes
994		   ] )
995AM_CONDITIONAL(HAVE_GCRYPT, test "$abi_cv_gcrypt" = "yes")
996
997if test "$abi_cv_gnomevfs" = "yes"; then
998    AC_DEFINE([WITH_GNOMEVFS], [1], [Define if using gnome-vfs])
999fi
1000
1001if test "$abi_cv_gio" = "yes"; then
1002	AC_DEFINE([WITH_GIO], [1], [Define if using GIO])
1003fi
1004
1005if test "$abi_cv_goffice" = "yes"; then
1006	AC_DEFINE([WITH_GOFFICE], [1], [Define if using goffice])
1007fi
1008AM_CONDITIONAL([TOOLKIT_GTK_ALL], test "$TOOLKIT" = "gtk")
1009AM_CONDITIONAL([WITH_GOFFICE_BUILTIN], test "$TOOLKIT" = "gtk" && test "$abi_cv_goffice" != "yes")
1010AC_SUBST([GOFFICE_BUILTIN_LIBS])
1011
1012ALL_PLUGINS_="\
1013  m4_n([plugin_list])"
1014# strip trailing newline from the included file, it messes up sed on windows
1015ALL_PLUGINS=
1016for p in $(echo $ALL_PLUGINS_); do ALL_PLUGINS="$ALL_PLUGINS $p"; done
1017AC_SUBST([ALL_PLUGINS])
1018
1019PLUGINS=
1020if test "$abi_cv_plugins" = "auto"; then
1021
1022	# which plugins to auto-enable
1023	# this creates variables like "enable_wordperfect=auto"
1024	for plugin in `echo $ALL_PLUGINS`; do
1025		eval $(echo "enable_$plugin")="auto"
1026	done
1027else
1028	default_plugins="opendocument openxml"
1029
1030	if test "$abi_cv_disable_default_plugins" != "yes"; then
1031		PLUGINS="$default_plugins"
1032	fi
1033	for i in $abi_cv_plugins; do
1034		if test -d "plugins/$i"; then
1035			PLUGINS="$PLUGINS $i"
1036		else
1037			AC_MSG_WARN([Plugin $i does not exist.])
1038		fi
1039	done
1040
1041	# which plugins to enable
1042	# this creates variables like "enable_wordperfect=yes"
1043	for plugin in `echo $PLUGINS`; do
1044		eval $(echo "enable_$plugin")="yes"
1045	done
1046fi
1047
1048# enable the plugins we want to link statically
1049# this creates variables like "enable_wordperfect=yes"
1050BUILTIN_PLUGINS="$abi_cv_builtin_plugins"
1051for plugin in `echo $BUILTIN_PLUGINS`; do
1052	eval $(echo "enable_$plugin")="yes"
1053done
1054
1055# which plugins to build in
1056# this creates variables like "enable_wordperfect_builtin=yes"
1057for plugin in `echo $BUILTIN_PLUGINS`; do
1058	variable="enable_"$plugin"_builtin"
1059	eval $(echo $variable)="yes"
1060done
1061
1062# this creates the list of .la files to link statically
1063# used in src/plugins/Makefile.am
1064BUILTIN_PLUGINS_LA=
1065for plugin in `echo $BUILTIN_PLUGINS`; do
1066	BUILTIN_PLUGINS_LA="$BUILTIN_PLUGINS_LA ../../plugins/$plugin/$plugin.la"
1067done
1068
1069m4_include([plugin-builtin.m4])
1070
1071m4_include([plugin-configure.m4])
1072
1073AC_SUBST([PLUGINS])
1074AC_SUBST([BUILTIN_PLUGINS])
1075AC_SUBST([BUILTIN_PLUGINS_LA])
1076
1077# put all deps on a single line for the .pc file
1078ABIWORD_REQUIRED_PKGS=
1079for dep in `echo $deps_pkgs`; do
1080	ABIWORD_REQUIRED_PKGS="$ABIWORD_REQUIRED_PKGS $dep"
1081done
1082AC_SUBST(ABIWORD_REQUIRED_PKGS)
1083
1084dnl Check for valgrind for the UniTest
1085AC_CHECK_PROG(VALGRIND, valgrind, valgrind)
1086AC_CHECK_HEADERS(valgrind/memcheck.h)
1087if test "$VALGRIND" = ""; then
1088        AC_MSG_WARN([Valgrind is missing. UnitTesting will run without])
1089fi
1090if test "$VALGRIND" != ""; then
1091dnl due to stupid m4 I had to double the [ and ] in the regexp
1092        vg_ver=`valgrind --version | sed -e  's/.*-\([[0-9]]\)\.[[0-9]].*/\1/'`
1093        VALGRIND="$VALGRIND --tool=memcheck --leak-check=yes --num-callers=10"
1094        if test "$vg_ver" != "3" ; then
1095           VALGRIND="$VALGRIND --logfile-fd=-1"
1096        fi
1097fi
1098AC_SUBST(VALGRIND)
1099
1100dnl Introspection support
1101if test "$TOOLKIT" = "gtk"; then
1102GIR_REQ=1.0.0
1103AC_ARG_ENABLE(introspection,
1104          AS_HELP_STRING([--enable-introspection[=@<:@no/auto/yes@:>@]],
1105                         [Enable introspection for this build]),,
1106                         [enable_introspection=no])
1107
1108AC_MSG_CHECKING([for gobject-introspection])
1109
1110dnl presence/version checking
1111AS_CASE([$enable_introspection],
1112[no], [
1113    found_introspection="no (disabled, use --enable-introspection to enable)"
1114],
1115[yes],[
1116    PKG_CHECK_EXISTS([gobject-introspection-1.0],,
1117                     AC_MSG_ERROR([gobject-introspection-1.0 is not installed]))
1118    PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $GIR_REQ],
1119                     found_introspection=yes,
1120                     AC_MSG_ERROR([You need to have gobject-introspection >= $1 installed to build AC_PACKAGE_NAME]))
1121],
1122[auto],[
1123    PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $GIR_REQ], found_introspection=yes, found_introspection=no)
1124dnl Canonicalize enable_introspection
1125enable_introspection=$found_introspection
1126],
1127[
1128    AC_MSG_ERROR([invalid argument passed to --enable-introspection, should be one of @<:@no/auto/yes@:>@])
1129])
1130
1131AC_MSG_RESULT([$found_introspection])
1132
1133INTROSPECTION_SCANNER=
1134INTROSPECTION_COMPILER=
1135INTROSPECTION_GENERATE=
1136INTROSPECTION_GIRDIR=
1137INTROSPECTION_TYPELIBDIR=
1138if test "x$found_introspection" = "xyes"; then
1139   AM_PATH_PYTHON
1140   INTROSPECTION_SCANNER=`$PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0`
1141   INTROSPECTION_COMPILER=`$PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0`
1142   INTROSPECTION_GENERATE=`$PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0`
1143   INTROSPECTION_GIRDIR=`$PKG_CONFIG --variable=girdir gobject-introspection-1.0`
1144   INTROSPECTION_TYPELIBDIR="$($PKG_CONFIG --variable=typelibdir gobject-introspection-1.0)"
1145   INTROSPECTION_CFLAGS=`$PKG_CONFIG --cflags gobject-introspection-1.0`
1146   INTROSPECTION_LIBS=`$PKG_CONFIG --libs gobject-introspection-1.0`
1147   INTROSPECTION_MAKEFILE=`$PKG_CONFIG --variable=datadir gobject-introspection-1.0`/gobject-introspection-1.0/Makefile.introspection
1148fi
1149AC_SUBST(INTROSPECTION_SCANNER)
1150AC_SUBST(INTROSPECTION_COMPILER)
1151AC_SUBST(INTROSPECTION_GENERATE)
1152AC_SUBST(INTROSPECTION_GIRDIR)
1153AC_SUBST(INTROSPECTION_TYPELIBDIR)
1154AC_SUBST(INTROSPECTION_CFLAGS)
1155AC_SUBST(INTROSPECTION_LIBS)
1156AC_SUBST(INTROSPECTION_MAKEFILE)
1157
1158ABI_SUB_SERIES="abi_version_major"_"abi_version_minor"
1159AC_SUBST(ABI_SUB_SERIES)
1160
1161dnl we need to change the install directories for distcheck
1162AC_ARG_WITH([gir-dir],
1163	AS_HELP_STRING(
1164		[--with-gir-dir],
1165		[
1166		 path to gir repository
1167		 (automatically detected via pkg-config)
1168		]
1169	),
1170	[GIRDIR=$withval],
1171	[GIRDIR=$INTROSPECTION_GIRDIR]
1172)
1173AC_SUBST(GIRDIR)
1174AC_ARG_WITH([typelib-dir],
1175	AS_HELP_STRING(
1176		[--with-typelib-dir],
1177		[
1178		 path to typelibs repository
1179		 (automatically detected via pkg-config)
1180		]
1181	),
1182	[TYPELIBDIR=$withval],
1183	[TYPELIBDIR=$INTROSPECTION_TYPELIBDIR]
1184)
1185AC_SUBST(TYPELIBDIR)
1186fi
1187
1188AM_CONDITIONAL(HAVE_INTROSPECTION, test "x$found_introspection" = "xyes")
1189
1190AC_OUTPUT(
1191  libabiword.pc
1192  Makefile
1193  goffice-bits/Makefile
1194  goffice-bits2/Makefile
1195  icons/Makefile
1196  po/Makefile
1197  src/Makefile
1198  src/af/Makefile
1199  src/af/ev/Makefile
1200  src/af/ev/cocoa/Makefile
1201  src/af/ev/gtk/Makefile
1202  src/af/ev/win/bmp/Makefile
1203  src/af/ev/win/Makefile
1204  src/af/ev/xp/Makefile
1205  src/af/gr/Makefile
1206  src/af/gr/cocoa/Makefile
1207  src/af/gr/gtk/Makefile
1208  src/af/gr/win/Makefile
1209  src/af/gr/xp/Makefile
1210  src/af/tf/Makefile
1211  src/af/tf/xp/Makefile
1212  src/af/util/Makefile
1213  src/af/util/unix/Makefile
1214  src/af/util/win/Makefile
1215  src/af/util/xp/Makefile
1216  src/af/util/xp/t/Makefile
1217  src/af/xap/Makefile
1218  src/af/xap/cocoa/Makefile
1219  src/af/xap/gtk/Makefile
1220  src/af/xap/gtk/t/Makefile
1221  src/af/xap/win/Makefile
1222  src/af/xap/xp/Makefile
1223  src/gi-overrides/Makefile
1224  src/plugins/Makefile
1225  src/text/Makefile
1226  src/text/fmt/Makefile
1227  src/text/fmt/gtk/Makefile
1228  src/text/fmt/xp/Makefile
1229  src/text/fmt/xp/t/Makefile
1230  src/text/ptbl/Makefile
1231  src/text/ptbl/xp/Makefile
1232  src/text/ptbl/xp/t/Makefile
1233  src/wp/Makefile
1234  src/wp/ap/Makefile
1235  src/wp/ap/cocoa/Makefile
1236  src/wp/ap/gtk/Makefile
1237  src/wp/ap/gtk/hildon/abiword.desktop
1238  src/wp/ap/gtk/hildon/com.abisource.abiword.service
1239  src/wp/ap/win/Makefile
1240  src/wp/ap/xp/Makefile
1241  src/wp/ap/xp/ToolbarIcons/Makefile
1242  src/wp/impexp/Makefile
1243  src/wp/impexp/cocoa/Makefile
1244  src/wp/impexp/gtk/Makefile
1245  src/wp/impexp/win/Makefile
1246  src/wp/impexp/xp/Makefile
1247  src/wp/test/Makefile
1248  src/wp/test/cocoa/Makefile
1249  src/wp/test/unix/Makefile
1250  src/wp/test/unix/testwrap.sh
1251  src/wp/test/win/Makefile
1252  src/wp/test/win/testwrap.sh
1253  src/wp/test/xp/Makefile
1254  src/wp/main/Makefile
1255  src/wp/main/cocoa/Makefile
1256  src/wp/main/cocoa/bundle/Info.plist
1257  src/wp/main/win/Makefile
1258  user/Makefile
1259  user/wp/Makefile
1260  user/wp/clipart/Makefile
1261  user/wp/dictionary/Makefile
1262  user/wp/templates/Makefile
1263  tools/Makefile
1264  tools/cdump/Makefile
1265  tools/cdump/xp/Makefile
1266)
1267
1268AC_OUTPUT(
1269  m4_include([plugin-makefiles.m4])
1270)
1271
1272echo "
1273Configuration:
1274  host                  ${host}
1275  dynamic binary        ${enable_shared}
1276  static binary         ${enable_static}
1277  platform              ${PLATFORM} (embedded: $abi_cv_embedded_platform)
1278  toolkit               ${TOOLKIT}
1279  debug                 ${abi_cv_debug}
1280
1281Optional features:
1282  menubutton            ${abi_cv_menubutton}
1283  printing              ${abi_cv_print}
1284  spell checking        ${abi_cv_spell}
1285  status bar            ${abi_cv_statusbar}
1286  emacs keybinding      ${abi_cv_emacs_keybinding}
1287  vi keybinding         ${abi_cv_vi_keybinding}
1288  clipart               ${abi_cv_clipart}
1289  templates             ${abi_cv_templates}
1290
1291Optional dependencies:
1292  gio			${abi_cv_gio}
1293  gsf-gio               ${abi_cv_gsf_gio}
1294  goffice               ${abi_cv_goffice}
1295  redland               ${abi_cv_redland}
1296  evolution_data_server ${abi_cv_evolution_data_server}
1297  libical               ${abi_cv_libical}
1298  champlain             ${abi_cv_champlain}
1299
1300Builtin plugins         ${BUILTIN_PLUGINS}
1301Plugins                 ${PLUGINS}
1302"
1303
1304