1dnl Initialization
2AC_PREREQ(2.58)
3AC_INIT([gtkhtml], [4.10.0], [http://bugzilla.gnome.org/enter_bug.cgi?product=GtkHtml])
4AM_INIT_AUTOMAKE([gnu 1.9 dist-xz no-dist-gzip -Wno-portability])
5AC_CONFIG_MACRO_DIR([m4])
6AC_CONFIG_HEADERS(config.h)
7AC_CONFIG_SRCDIR(README)
8
9PACKAGE=gtkhtml
10
11dnl Required Package Versions
12m4_define([gtk_minimum_version], [3.2.0])
13m4_define([enchant_minimum_version], [1.1.7])
14m4_define([cairo_minimum_version], [1.10.0])
15
16GTKHTML_API_VERSION=4.0
17EDITOR_API_VERSION=4.0
18
19AC_DEFINE_UNQUOTED(GTKHTML_API_VERSION, "${GTKHTML_API_VERSION}", [GtkHTML API Version])
20AC_SUBST(GTKHTML_API_VERSION)
21
22AC_DEFINE_UNQUOTED(EDITOR_API_VERSION, "${EDITOR_API_VERSION}", [Editor API Version])
23AC_SUBST(EDITOR_API_VERSION)
24
25GTKHTML_RELEASE_STRING=${PACKAGE}-${GTKHTML_API_VERSION}
26AC_DEFINE_UNQUOTED(GTKHTML_RELEASE_STRING, "${GTKHTML_RELEASE_STRING}", [GtkHTML Release String])
27AC_SUBST(GTKHTML_RELEASE_STRING)
28
29GETTEXT_PACKAGE=${GTKHTML_RELEASE_STRING}
30AC_SUBST(GETTEXT_PACKAGE)
31AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Package name for gettext])
32
33I18N_LIB_CFLAGS="-DGNOME_EXPLICIT_TRANSLATION_DOMAIN=\\\"${GTKHTML_RELEASE_STRING}\\\""
34AC_SUBST(I18N_LIB_CFLAGS)
35
36dnl Automake 1.11 - Silent Build Rules
37m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
38
39AM_MAINTAINER_MODE([enable])
40
41dnl ************
42dnl I18N stuff
43dnl ************
44IT_PROG_INTLTOOL([0.36.3])
45AM_GLIB_GNU_GETTEXT
46
47dnl **********************************
48dnl Compiler Warning Flags
49dnl **********************************
50AS_COMPILER_FLAGS(WARNING_FLAGS,
51	"-Wall -Wextra
52	-Wno-missing-field-initializers
53	-Wno-sign-compare
54	-Wno-unused-parameter
55	-Wno-deprecated-declarations
56	-Wdeclaration-after-statement
57	-Werror-implicit-function-declaration
58	-Wformat-nonliteral -Wformat-security -Winit-self
59	-Wmissing-declarations -Wmissing-include-dirs
60	-Wmissing-noreturn -Wnested-externs -Wpointer-arith
61	-Wredundant-decls -Wundef -Wwrite-strings")
62AC_SUBST(WARNING_FLAGS)
63
64dnl Other useful compiler warnings for test builds only.
65dnl These may produce warnings we have no control over,
66dnl or false positives we don't always want to see.
67dnl
68dnl	-Wmissing-format-attribute
69dnl	-Wshadow
70dnl	-Wstrict-aliasing=2
71
72dnl XXX This really belongs in AM_CPPFLAGS.
73CFLAGS="$CFLAGS $WARNING_FLAGS"
74
75dnl *********************
76dnl Necessary programs
77dnl *********************
78AC_PROG_CC
79AC_PROG_CXX
80AC_C_INLINE
81AC_FUNC_ALLOCA
82AC_FUNC_MALLOC
83AC_TYPE_SIZE_T
84
85AC_CHECK_FUNCS([memchr memmove memset regcomp setlocale strchr strcspn strrchr strstr strtol strtoull])
86AC_CHECK_HEADERS([fcntl.h libintl.h])
87
88dnl GCC 4.4 got more aggressive in its aliasing optimizations, changing
89dnl behavior that -- according to the C99 standard -- is supposed to be
90dnl undefined.  We may still have aliasing abuses lying around that rely
91dnl on GCC's previous "undefined" behavior, so disable strict-aliasing
92dnl optimization until we can find and fix all the abuses.
93dnl (AC_PROG_CC must run first to set the GCC variable.)
94dnl XXX This really belongs in AM_CFLAGS.
95if test "x${GCC}" = "xyes"; then
96	CFLAGS="$CFLAGS -fno-strict-aliasing"
97fi
98
99dnl *****************
100dnl libtool
101dnl *****************
102LT_PREREQ(2.2)
103LT_INIT(disable-static win32-dll)
104
105AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
106
107dnl ********
108dnl Win32
109dnl ********
110AC_MSG_CHECKING([for Win32])
111case "$host" in
112*-mingw*)
113    os_win32=yes
114    SOEXT='.dll'
115    ;;
116*)  os_win32=no
117    SOEXT='.so'
118    ;;
119esac
120AC_MSG_RESULT([$os_win32])
121AM_CONDITIONAL(OS_WIN32, [test $os_win32 = yes])
122AC_SUBST(SOEXT)
123
124AC_SUBST(CFLAGS)
125AC_SUBST(CPPFLAGS)
126AC_SUBST(LDFLAGS)
127
128AC_CHECK_LIBM
129AC_SUBST(LIBM)
130
131dnl **********************************
132dnl GAIL modules
133dnl **********************************
134GAIL_MODULES="gail-3.0 >= gtk_minimum_version"
135PKG_CHECK_MODULES(GAIL, $GAIL_MODULES)
136AC_SUBST(GAIL_CFLAGS)
137AC_SUBST(GAIL_LIBS)
138AC_SUBST(GAIL_MODULES)
139
140dnl **********************************
141dnl GTKHTML modules
142dnl **********************************
143GTKHTML_MODULES="gtk+-3.0 >= gtk_minimum_version enchant >= enchant_minimum_version gsettings-desktop-schemas iso-codes cairo >= cairo_minimum_version"
144PKG_CHECK_MODULES(GTKHTML, $GTKHTML_MODULES)
145AC_SUBST(GTKHTML_CFLAGS)
146AC_SUBST(GTKHTML_LIBS)
147AC_SUBST(GTKHTML_MODULES)
148
149dnl **********************************
150dnl Glade catalog files
151dnl **********************************
152AC_ARG_WITH(glade-catalog,
153	AC_HELP_STRING([--with-glade-catalog],
154	[install the catalog files for Glade 3]
155	[(for maintainers only) @<:@default=no@:>@]),
156	[glade_catalog="$withval"], [glade_catalog="no"])
157if test "x$glade_catalog" = "xyes"; then
158	PKG_CHECK_MODULES(GLADEUI, gladeui-2.0)
159fi
160AM_CONDITIONAL(GLADE_CATALOG, test x$glade_catalog = xyes)
161
162dnl These are still needed for 'dist' targets.
163ORBIT_IDL="`$PKG_CONFIG --variable=orbit_idl ORBit-2.0`"
164AC_SUBST(ORBIT_IDL)
165
166dnl **********************************
167dnl soup for testgtkhtml
168dnl **********************************
169HAVE_NEWSOUP="no"
170have_newsoup="no"
171PKG_CHECK_MODULES(SOUP, libsoup-2.4  >= 2.26.0,
172	[	HAVE_NEWSOUP="yes"
173		have_soup="yes"
174	],
175	[	PKG_CHECK_MODULES(SOUP, libsoup-2.4,
176		have_soup="yes",
177		have_soup="no")
178	])
179AC_SUBST(HAVE_NEWSOUP)
180AM_CONDITIONAL(HAVE_SOUP, test x$have_soup != xno)
181AM_CONDITIONAL(HAVE_NEWSOUP, test x$HAVE_NEWSOUP != xno)
182
183dnl **************************************************
184dnl iso-codes
185dnl **************************************************
186AC_MSG_CHECKING([for iso-codes package])
187have_iso_codes=no
188if $PKG_CONFIG --exists iso-codes; then
189	if $PKG_CONFIG iso-codes --atleast-version=0.49; then
190		have_iso_codes=yes
191		AC_MSG_RESULT([$have_iso_codes])
192	else
193		AC_MSG_WARN([iso-codes detected, but version 0.49 or later is required due to licensing])
194	fi
195else
196	AC_MSG_RESULT([$have_iso_codes])
197fi
198
199if test "x$have_iso_codes" = "xyes"; then
200	AC_MSG_CHECKING([whether iso-codes has iso-639 and iso-3166 domains])
201	if $PKG_CONFIG --variable=domains iso-codes | grep 639 >/dev/null 2>&1 && \
202		$PKG_CONFIG --variable=domains iso-codes | grep 3166 >/dev/null 2>&1 ; then
203			result=yes
204	else
205		result=no
206		have_iso_codes=no
207	fi
208	AC_MSG_RESULT([$result])
209fi
210
211if test "x$have_iso_codes" = "xyes"; then
212	AC_DEFINE_UNQUOTED([ISO_CODES_PREFIX],
213		["`$PKG_CONFIG --variable=prefix iso-codes`"],
214		[ISO codes prefix])
215	AC_DEFINE([HAVE_ISO_CODES], [1],
216		[Define if you have the iso-codes package])
217fi
218
219dnl **************************************************
220dnl XF86 multimedia keys support
221dnl **************************************************
222AC_CHECK_HEADER([X11/XF86keysym.h],
223	[AC_DEFINE([HAVE_XFREE], 1, [Have <X11/XF86keysym.h>])],,
224	[[	#if HAVE_XFREE
225		#include <X11/XF86keysym.h>
226		#endif
227	]])
228
229dnl **************************************************
230dnl regex library
231dnl **************************************************
232AC_CHECK_FUNCS(regexec,,[AC_CHECK_LIB(regex,regexec,[REGEX_LIBS=-lregex],[AC_MSG_ERROR([No regex library found])])])
233AC_SUBST(REGEX_LIBS)
234
235dnl ******************************
236dnl shlib factory
237dnl ******************************
238AC_ARG_ENABLE([shlib-factory],
239		AS_HELP_STRING([--enable-shlib-factory],
240		[build editor factory as shared library @<:@default=yes@:>@]),
241		[enable_shlib_factory="$enableval"],
242		[enable_shlib_factory="yes"])
243
244if test "x$enable_shlib_factory" = "xyes"; then
245	GNOME_GTKHTML_EDITOR_SHLIB=1
246	GNOME_GTKHTML_EDITOR_TYPE="shlib"
247	AC_DEFINE(GNOME_GTKHTML_EDITOR_SHLIB,, [Editor shlib])
248else
249	GNOME_GTKHTML_EDITOR_TYPE="exe"
250fi
251
252AC_SUBST(GNOME_GTKHTML_EDITOR_TYPE)
253AM_CONDITIONAL(EDITOR_SHLIB, test x$enable_shlib_factory = xyes)
254
255dnl **********************************
256dnl Library version information.
257dnl **********************************
258
259dnl Increment the following if the interface has additions, changes,
260dnl removals.
261GTKHTML_CURRENT=0
262
263dnl Increment any time the source changes; set to 0 if you
264dnl increment CURRENT.
265GTKHTML_REVISION=0
266
267dnl Increment if any interfaces have been added; set to 0
268dnl if any interfaces have been removed. removal has
269dnl precedence over adding, so set to 0 if both happened.
270GTKHTML_AGE=0
271
272AC_SUBST(GTKHTML_CURRENT)
273AC_SUBST(GTKHTML_REVISION)
274AC_SUBST(GTKHTML_AGE)
275
276dnl **************
277dnl Done.
278dnl **************
279
280AC_CONFIG_FILES([
281Makefile
282a11y/Makefile
283art/Makefile
284components/Makefile
285components/editor/Makefile
286components/editor/gtkhtml-editor.pc
287gtkhtml/Makefile
288gtkhtml/libgtkhtml.pc
289po/Makefile.in
290])
291AC_OUTPUT
292
293echo "
294Configuration:
295
296	Cookies support in soup :		${HAVE_NEWSOUP}
297	Editor component type   :		${GNOME_GTKHTML_EDITOR_TYPE}
298"
299