WebKit2 View Gestures: Swipe gesture can track vertical movement instead of horizonta...
[WebKit-https.git] / Source / autotools / FindDependencies.m4
1 PKG_PROG_PKG_CONFIG
2
3 # Check for libjpeg the way Gtk does it.
4 AC_CHECK_LIB(jpeg, jpeg_destroy_decompress, jpeg_ok=yes, jpeg_ok=no AC_MSG_ERROR([JPEG library (libjpeg) not found]))
5 if test "$jpeg_ok" = yes; then
6     AC_MSG_CHECKING([for jpeglib])
7     AC_TRY_CPP([
8 #include <stdio.h>
9 #undef PACKAGE
10 #undef VERSION
11 #undef HAVE_STDLIB_H
12 #include <jpeglib.h>
13 ], jpeg_ok=yes, jpeg_ok=no)
14     AC_MSG_RESULT($jpeg_ok)
15     if test "$jpeg_ok" = yes; then
16         JPEG_LIBS="-ljpeg"
17         # Should we check for progressive JPEG like GTK+ as well?
18     else
19         AC_MSG_ERROR([JPEG library (libjpeg) not found])
20     fi
21 fi
22 AC_SUBST([JPEG_LIBS])
23
24 # Check for libpng the way Gtk+ does it.
25 for l in libpng libpng14 libpng12; do
26     AC_MSG_CHECKING(for $l)
27     if $PKG_CONFIG --exists $l ; then
28         AC_MSG_RESULT(yes)
29         PNG_LIBS=`$PKG_CONFIG --libs $l`
30         png_ok=yes
31         break
32     else
33         AC_MSG_RESULT(no)
34         png_ok=no
35     fi
36 done
37 if test "$png_ok" != yes; then
38     AC_CHECK_LIB(png, png_read_info, [AC_CHECK_HEADER(png.h, png_ok=yes, png_ok=no)],
39         AC_MSG_ERROR([PNG library (libpng) not found]), -lz -lm)
40    if test "$png_ok" = yes; then
41         AC_MSG_CHECKING([for png_structp in png.h])
42         AC_TRY_COMPILE([
43 #include <png.h>
44 ], [png_structp pp; png_infop info; png_colorp cmap; png_create_read_struct;], png_ok=yes, png_ok=no)
45         AC_MSG_RESULT($png_ok)
46         if test "$png_ok" = yes; then
47             PNG_LIBS='-lpng -lz'
48         else
49             AC_MSG_ERROR([PNG library (libpng) not found])
50         fi
51     else
52         AC_MSG_ERROR([PNG library (libpng) not found])
53     fi
54 fi
55 AC_SUBST([PNG_LIBS])
56
57 # Check for WebP Image support.
58 AC_CHECK_HEADERS([webp/decode.h], [WEBP_LIBS='-lwebp'], [AC_MSG_ERROR([WebP library (libwebp) not found])])
59 AC_SUBST([WEBP_LIBS])
60
61 if test "$os_win32" = "yes"; then
62     WINMM_LIBS=-lwinmm
63     SHLWAPI_LIBS=-lshlwapi
64     OLE32_LIBS=-lole32
65 fi
66 AC_SUBST([WINMM_LIBS])
67 AC_SUBST([SHLWAPI_LIBS])
68 AC_SUBST([OLE32_LIBS])
69
70 case "$with_gtk" in
71     2.0) GTK_REQUIRED_VERSION=gtk2_required_version
72         GTK_API_VERSION=2.0
73         WEBKITGTK_API_MAJOR_VERSION=1
74         WEBKITGTK_API_MINOR_VERSION=0
75         WEBKITGTK_API_VERSION=1.0
76         WEBKITGTK_PC_NAME=webkit
77         ;;
78     3.0) GTK_REQUIRED_VERSION=gtk3_required_version
79         GTK_API_VERSION=3.0
80         WEBKITGTK_API_MAJOR_VERSION=3
81         WEBKITGTK_API_MINOR_VERSION=0
82         WEBKITGTK_API_VERSION=3.0
83         WEBKITGTK_PC_NAME=webkitgtk
84         ;;
85 esac
86 AC_SUBST([WEBKITGTK_API_MAJOR_VERSION])
87 AC_SUBST([WEBKITGTK_API_MINOR_VERSION])
88 AC_SUBST([WEBKITGTK_API_VERSION])
89 AC_SUBST([WEBKITGTK_PC_NAME])
90 AC_SUBST([GTK_API_VERSION])
91
92
93 # Check for glib and required utilities. This macro is named as if it interacts
94 # with automake, but it doesn't. Thus it doesn't need to be in the automake section.
95 AM_PATH_GLIB_2_0(glib_required_version, :, :, gmodule gobject gthread gio)
96 if test -z "$GLIB_GENMARSHAL" || test -z "$GLIB_MKENUMS"; then
97     AC_MSG_ERROR([You need the GLib dev tools in your path])
98 fi
99
100 # GResources
101 GLIB_COMPILE_RESOURCES=`$PKG_CONFIG --variable glib_compile_resources gio-2.0`
102 AC_SUBST(GLIB_COMPILE_RESOURCES)
103 GLIB_GSETTINGS
104
105 # TODO: use pkg-config (after CFLAGS in their .pc files are cleaned up).
106 case "$host" in
107     *-*-darwin*)
108         UNICODE_CFLAGS="-I$srcdir/Source/JavaScriptCore/icu -I$srcdir/Source/WebCore/icu"
109         UNICODE_LIBS="-licucore"
110         ;;
111     *-*-mingw*)
112         UNICODE_CFLAGS=""
113         UNICODE_LIBS="-licui18n -licuuc"
114         AC_CHECK_HEADERS([unicode/uchar.h], [], [AC_MSG_ERROR([Could not find ICU headers.])])
115         ;;
116     *)
117         AC_PATH_PROG(icu_config, icu-config, no)
118         if test "$icu_config" = "no"; then
119             AC_MSG_ERROR([Cannot find icu-config. The ICU library is needed.])
120         fi
121
122         # We don't use --cflags as this gives us a lot of things that we don't necessarily want,
123         # like debugging and optimization flags. See man (1) icu-config for more info.
124         UNICODE_CFLAGS=`$icu_config --cppflags-searchpath`
125         UNICODE_LIBS=`$icu_config --ldflags-libsonly`
126         ;;
127 esac
128
129 AC_SUBST([UNICODE_CFLAGS])
130 AC_SUBST([UNICODE_LIBS])
131
132 PKG_CHECK_MODULES([ZLIB], [zlib], [], [
133         AC_CHECK_LIB([z], [gzread], ,
134           [AC_MSG_ERROR([unable to find the libz library])]
135         )])
136 AC_SUBST([ZLIB_CFLAGS])
137 AC_SUBST([ZLIB_LIBS])
138
139 GETTEXT_PACKAGE=WebKitGTK-$GTK_API_VERSION
140 AC_SUBST(GETTEXT_PACKAGE)
141
142 PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= libxml_required_version)
143 AC_SUBST(LIBXML_CFLAGS)
144 AC_SUBST(LIBXML_LIBS)
145
146 PKG_CHECK_MODULES(PANGO, [pango >= pango_required_version pangoft2])
147 AC_SUBST(PANGO_CFLAGS)
148 AC_SUBST(PANGO_LIBS)
149
150 if test "$enable_spellcheck" = "yes"; then
151     PKG_CHECK_MODULES(ENCHANT, enchant >= enchant_required_version, [], [enable_spellcheck="no"])
152     AC_SUBST(ENCHANT_CFLAGS)
153     AC_SUBST(ENCHANT_LIBS)
154 fi
155
156 PKG_CHECK_MODULES(CAIRO, cairo >= cairo_required_version)
157 PKG_CHECK_MODULES(GTK, gtk+-$GTK_API_VERSION >= $GTK_REQUIRED_VERSION)
158 GTK_ACTUAL_VERSION=`pkg-config --modversion gtk+-$GTK_API_VERSION`
159
160 if test "$enable_directfb_target" = "yes"; then
161     PKG_CHECK_MODULES(CAIRO_DIRECTFB, cairo-directfb >= cairo_required_version)
162     CAIRO_CFLAGS="$CAIRO_CFLAGS $CAIRO_DIRECTFB_CFLAGS"
163     CAIRO_LIBS="$CAIRO_LIBS $CAIRO_DIRECTFB_LIBS"
164
165     PKG_CHECK_MODULES(GTK_DIRECTFB, gtk+-directfb-2.0 >= $GTK_REQUIRED_VERSION)
166     GTK_CFLAGS="$GTK_CFLAGS $GTK_DIRECTFB_CFLAGS"
167     GTK_LIBS="$GTK_LIBS $GTK_DIRECTFB_LIBS"
168 fi
169
170 AC_SUBST(GTK_CFLAGS)
171 AC_SUBST(GTK_LIBS)
172 AC_SUBST(CAIRO_CFLAGS)
173 AC_SUBST(CAIRO_LIBS)
174
175 if test "$enable_x11_target" = "yes"; then
176     # The GTK+ X11 target dependency should match the version of the master GTK+ dependency.
177     PKG_CHECK_MODULES(GTK_X11, gtk+-x11-$GTK_API_VERSION = $GTK_ACTUAL_VERSION)
178
179     if test "$os_win32" = "no"; then
180         PKG_CHECK_MODULES([XT], [xt], [xt_has_pkg_config=yes], [xt_has_pkg_config=no])
181
182         # Some old versions of Xt do not provide xt.pc, so try to link against Xt
183         # and if it's installed fall back to just adding -lXt.
184         if test "$xt_has_pkg_config" = "no"; then
185             # Using AC_CHECK_LIB instead of AC_SEARCH_LIB is fine in this case as we don't care
186             # about the XtOpenDisplay symbol but only about the existence of libXt.
187             AC_CHECK_LIB([Xt], [XtOpenDisplay], [XT_CFLAGS=""; XT_LIBS="-lXt"],
188                 [AC_MSG_ERROR([X Toolkit Intrinsics library (libXt) not found])])
189         fi
190
191         AC_SUBST([XT_CFLAGS])
192         AC_SUBST([XT_LIBS])
193     fi
194
195     # Check for XRender under Linux/Unix. Some linkers require explicit linkage (like GNU Gold),
196     # so we cannot rely on GTK+ pulling XRender.
197     if test "$enable_x11_target" = "yes"; then
198         PKG_CHECK_MODULES([XRENDER], [xrender])
199         AC_SUBST([XRENDER_CFLAGS])
200         AC_SUBST([XRENDER_LIBS])
201     fi
202 elif test "enable_glx" != "no"; then
203     AC_MSG_WARN([X11 target support not enabled, disabling GLX support.])
204     enable_glx=no
205 fi
206
207 if test "$enable_wayland_target" != "no"; then
208      # The GTK+ Wayland target dependency should match the version of the master GTK+ dependency.
209     PKG_CHECK_MODULES([GTK_WAYLAND], [
210         gtk+-wayland-$GTK_API_VERSION = $GTK_ACTUAL_VERSION
211         gtk+-wayland-$GTK_API_VERSION >= gtk3_wayland_required_version
212     ], [enable_wayland_target=yes], [
213         if test "$enable_wayland_target" = "yes"; then
214             AC_MSG_ERROR([GTK+ Wayland dependency (gtk+-wayland-$GTK_API_VERSION >= gtk3_wayland_required_version) not found.])
215         else
216             AC_MSG_WARN([GTK+ Wayland dependency (gtk+-wayland-$GTK_API_VERSION >= gtk3_wayland_required_version) not found, disabling the Wayland target.])
217             enable_wayland_target=no
218         fi
219     ])
220 fi
221
222 AC_CHECK_HEADERS([GL/glx.h], [have_glx="yes"], [have_glx="no"])
223 AC_MSG_CHECKING([whether to enable GLX support])
224 if test "$enable_glx" != "no"; then
225     if test "$have_glx" = "no"; then
226         if test "$enable_glx" = "yes"; then
227             AC_MSG_ERROR([--enable-glx specified, but not available])
228         else
229             enable_glx=no
230         fi
231     elif test "$enable_gles2" != "yes"; then
232         enable_glx=yes
233     fi
234 fi
235 AC_MSG_RESULT([$enable_glx])
236
237 AC_CHECK_HEADERS([EGL/egl.h], [have_egl="yes"], [have_egl="no"])
238 AC_MSG_CHECKING([whether to enable EGL support])
239 if test "$enable_egl" != "no"; then
240     if test "$have_egl" = "no"; then
241         if test "$enable_egl" = "yes"; then
242             AC_MSG_ERROR([--enable-egl specified, but not available])
243         else
244             enable_egl=no
245         fi
246     else
247         enable_egl=yes
248     fi
249 fi
250 AC_MSG_RESULT([$enable_egl])
251
252 AC_CHECK_HEADERS([GLES2/gl2.h], [have_gles2="yes"], [have_gles2="no"])
253 AC_MSG_CHECKING([whether to use OpenGL ES 2 support])
254 if test "$enable_glx" = "yes"; then
255     if test "$enable_gles2" = "yes"; then
256         AC_MSG_ERROR([Cannot enable OpenGL ES 2 support with GLX enabled.])
257     else
258         enable_gles2=no
259     fi
260 fi
261 if test "$enable_egl" = "no"; then
262     if test "$enable_gles2" = "yes"; then
263         AC_MSG_ERROR([Cannot enable OpenGL ES 2 support without EGL enabled.])
264     else
265         enable_gles2=no
266     fi
267 fi
268 if test "$enable_gles2" != "no"; then
269     if test "$have_gles2" = "no"; then
270         if test "$enable_gles2" = "yes"; then
271             AC_MSG_ERROR([--enable-gles2 specified, but not available.])
272         else
273             enable_gles2=no
274         fi
275     else
276         enable_gles2=yes
277     fi
278 fi
279 AC_MSG_RESULT([$enable_gles2])
280
281 found_opengl=no
282 if test "$enable_gles2" = "yes"; then
283     found_opengl=yes
284 else
285     AC_CHECK_HEADERS([GL/gl.h], [found_opengl="yes"], [])
286 fi
287
288 if test "$enable_x11_target" = "yes" && test "$found_opengl" = "yes"; then
289     PKG_CHECK_MODULES([XCOMPOSITE], [xcomposite])
290     PKG_CHECK_MODULES([XDAMAGE], [xdamage])
291     AC_SUBST(XCOMPOSITE_CFLAGS)
292     AC_SUBST(XCOMPOSITE_LIBS)
293     AC_SUBST(XDAMAGE_CFLAGS)
294     AC_SUBST(XDAMAGE_LIBS)
295 fi
296
297 if test "$enable_webgl" != "no"; then
298     if test "$found_opengl" = "yes"; then
299         enable_webgl=yes
300     else
301         if test "$enable_webgl" = "yes"; then
302             AC_MSG_ERROR([OpenGL support must be present to enable WebGL.])
303         fi
304         enable_webgl=no
305     fi
306 fi
307
308 if test "$enable_x11_target" != "yes" && test "$enable_wayland_target" = "yes" && test "enable_accelerated_compositing" != "no"; then
309     AC_MSG_WARN([Accelerated compositing for Wayland is not yet implemented, disabling due to the Wayland-only target.])
310     enable_accelerated_compositing=no
311 fi
312
313 if test "$enable_accelerated_compositing" != "no"; then
314     if test "$found_opengl" = "yes"; then
315         enable_accelerated_compositing=yes
316     else
317         if test "$enable_accelerated_compositing" = "yes"; then
318             AC_MSG_ERROR([OpenGL support must be present to enable accelerated compositing.])
319         fi
320         enable_accelerated_compositing=no
321     fi
322 fi
323
324 if test "$enable_gamepad" = "yes" && test "$os_linux" = no; then
325     AC_MSG_WARN([Gamepad support is only available on Linux. Disabling Gamepad support.])
326     enable_gamepad=no;
327 fi
328
329 if test "$enable_opcode_stats" = "yes"; then
330     if test "$enable_jit" = "yes"; then
331         AC_MSG_ERROR([JIT must be disabled for Opcode stats to work.])
332     fi
333 fi
334
335 # Enable CSS Filters if accelerated_compositing is turned on.
336 enable_css_filters=no;
337 AC_MSG_CHECKING([whether to enable CSS Filters])
338 if test "$enable_accelerated_compositing" = "yes" && test "$found_opengl" = "yes"; then
339     enable_css_filters=yes;
340 fi
341 AC_MSG_RESULT([$enable_css_filters])
342
343 G_IR_SCANNER=
344 G_IR_COMPILER=
345 G_IR_GENERATE=
346 GIRDIR=
347 GIRTYPELIBDIR=
348
349 if test "$enable_introspection" = "yes"; then
350     PKG_CHECK_MODULES([INTROSPECTION],[gobject-introspection-1.0 >= gobject_introspection_required_version])
351
352     G_IR_SCANNER="$($PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0)"
353     G_IR_COMPILER="$($PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0)"
354     G_IR_GENERATE="$($PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0)"
355 fi
356
357 AC_SUBST([G_IR_SCANNER])
358 AC_SUBST([G_IR_COMPILER])
359 AC_SUBST([G_IR_GENERATE])
360
361 PKG_CHECK_MODULES([LIBSOUP], [libsoup-2.4 >= libsoup_required_version])
362 AC_SUBST([LIBSOUP_CFLAGS])
363 AC_SUBST([LIBSOUP_LIBS])
364
365 if test "$enable_credential_storage" = "yes"; then
366     PKG_CHECK_MODULES([LIBSECRET], [libsecret-1])
367     AC_SUBST([LIBSECRET_CFLAGS])
368     AC_SUBST([LIBSECRET_LIBS])
369 fi
370
371 # Check if FreeType/FontConfig are available.
372 if test "$enable_directfb_target" = "yes"; then
373     PKG_CHECK_MODULES([FREETYPE],
374         [fontconfig >= fontconfig_required_version freetype2 >= freetype2_required_version harfbuzz >= harfbuzz_required_version])
375 else
376     PKG_CHECK_MODULES([FREETYPE],
377         [cairo-ft fontconfig >= fontconfig_required_version freetype2 >= freetype2_required_version harfbuzz >= harfbuzz_required_version])
378 fi
379 # HarfBuzz 0.9.18 splits harbuzz-icu into a separate library.
380 # Since we support earlier HarfBuzz versions we keep this conditional for now.
381 if $PKG_CONFIG --atleast-version 0.9.18 harfbuzz; then
382     PKG_CHECK_MODULES([HARFBUZZ_ICU], [harfbuzz-icu >= harfbuzz_required_version])
383     FREETYPE_CFLAGS="$FREETYPE_CFLAGS $HARFBUZZ_ICU_CFLAGS"
384     FREETYPE_LIBS="$FREETYPE_LIBS $HARFBUZZ_ICU_LIBS"
385 fi
386 AC_SUBST([FREETYPE_CFLAGS])
387 AC_SUBST([FREETYPE_LIBS])
388
389 # Check if SQLite3 is available. Error out only if one of the features hard-depending
390 # on it is enabled while SQLite3 is unavailable.
391 PKG_CHECK_MODULES([SQLITE3], [sqlite3 >= sqlite_required_version], [sqlite3_has_pkg_config=yes], [sqlite3_has_pkg_config=no])
392 if test "$sqlite3_has_pkg_config" = "no"; then
393     AC_SEARCH_LIBS([sqlite3_open16], [sqlite3],
394         [sqlite3_found=yes; SQLITE3_LIBS="$LIBS"; SQLITE3_CFLAGS="-I $srcdir/WebKitLibraries/WebCoreSQLite3"], [sqlite3_found=no])
395 fi
396 AC_SUBST([SQLITE3_CFLAGS])
397 AC_SUBST([SQLITE3_LIBS])
398
399 if (test "$sqlite3_found" = "no"); then
400     AC_MSG_ERROR([SQLite3 is required for the Database related features])
401 fi
402
403 PKG_CHECK_MODULES([LIBXSLT],[libxslt >= libxslt_required_version])
404 AC_SUBST([LIBXSLT_CFLAGS])
405 AC_SUBST([LIBXSLT_LIBS])
406
407 # Check if geoclue is available, with a preference over Geoclue2 if present.
408 geolocation_description="none"
409 if test "$enable_geolocation" = "yes"; then
410     PKG_CHECK_MODULES([GEOCLUE2], [gio-unix-2.0 geoclue-2.0 >= geoclue2_required_version], [found_geoclue2=yes], [found_geoclue2=no])
411     if test "$found_geoclue2" = "yes"; then
412         GEOCLUE_CFLAGS="$GEOCLUE2_CFLAGS"
413         GEOCLUE_LIBS="$GEOCLUE2_LIBS"
414         GEOCLUE_DBUS_INTERFACE=`$PKG_CONFIG --variable dbus_interface geoclue-2.0`
415         AC_SUBST(GEOCLUE_DBUS_INTERFACE)
416         geolocation_description="Geoclue 2"
417     else
418         PKG_CHECK_MODULES([GEOCLUE], [geoclue])
419         geolocation_description="Geoclue"
420     fi
421     AC_SUBST([GEOCLUE_CFLAGS])
422     AC_SUBST([GEOCLUE_LIBS])
423 fi
424
425 if test "$enable_video" = "yes" || test "$enable_web_audio" = "yes"; then
426     PKG_CHECK_MODULES([GSTREAMER], [
427         gstreamer-1.0 >= gstreamer_required_version
428         gstreamer-plugins-base-1.0 >= gstreamer_plugins_base_required_version
429         gstreamer-app-1.0
430         gstreamer-audio-1.0,
431         gstreamer-fft-1.0,
432         gstreamer-base-1.0,
433         gstreamer-pbutils-1.0,
434         gstreamer-tag-1.0,
435         gstreamer-video-1.0])
436     AC_SUBST([GSTREAMER_CFLAGS])
437     AC_SUBST([GSTREAMER_LIBS])
438 fi
439
440 acceleration_description=
441 if test "$found_opengl" = "yes"; then
442     acceleration_description="OpenGL"
443     if test "$enable_gles2" = "yes"; then
444         acceleration_description="$acceleration_description (gles2"
445         OPENGL_LIBS="-lGLESv2"
446     else
447         acceleration_description="$acceleration_description (gl"
448         OPENGL_LIBS="-lGL"
449     fi
450     if test "$enable_egl" = "yes"; then
451         acceleration_description="$acceleration_description, egl"
452         OPENGL_LIBS="$OPENGL_LIBS -lEGL"
453     fi
454     if test "$enable_glx" = "yes"; then
455         acceleration_description="$acceleration_description, glx"
456     fi
457
458     # Check whether dlopen() is in the core libc like on FreeBSD, or in a separate
459     # libdl like on GNU/Linux (in which case we want to link to libdl).
460     AC_CHECK_FUNC([dlopen], [], [AC_CHECK_LIB([dl], [dlopen], [OPENGL_LIBS="$OPENGL_LIBS -ldl"])])
461
462     acceleration_description="$acceleration_description)"
463 fi
464 AC_SUBST([OPENGL_LIBS])
465
466 enable_accelerated_canvas=no
467 if test "$enable_accelerated_compositing" = "yes" && test "$found_opengl" = "yes"; then
468     CAIRO_GL_LIBS="cairo-gl"
469     if test "$enable_glx" = "yes"; then
470         CAIRO_GL_LIBS="$CAIRO_GL_LIBS cairo-glx"
471     fi
472     if test "$enable_egl" = "yes"; then
473         CAIRO_GL_LIBS="$CAIRO_GL_LIBS cairo-egl"
474     fi
475
476     # At the moment CairoGL does not add any extra cflags and libraries, so we can
477     # safely ignore CAIRO_GL_LIBS and CAIRO_GL_CFLAGS for the moment.
478     PKG_CHECK_MODULES(CAIRO_GL, $CAIRO_GL_LIBS, [enable_accelerated_canvas=yes], [enable_accelerated_canvas=no])
479 fi
480
481 if test "$enable_gamepad" = "yes"; then
482     PKG_CHECK_MODULES([GAMEPAD], [gio-unix-2.0 gudev-1.0])
483
484     AC_SUBST(GAMEPAD_CFLAGS)
485     AC_SUBST(GAMEPAD_LIBS)
486 fi
487
488 if test "$enable_battery_status" = "yes"; then
489     PKG_CHECK_MODULES([UPOWER_GLIB], [upower-glib])
490
491     AC_SUBST(UPOWER_GLIB_CFLAGS)
492     AC_SUBST(UPOWER_GLIB_LIBS)
493 fi
494
495 # Check whether to enable code coverage support.
496 if test "$enable_coverage" = "yes"; then
497     COVERAGE_CFLAGS="-MD"
498     COVERAGE_LDFLAGS="-ftest-coverage -fprofile-arcs"
499     AC_SUBST([COVERAGE_CFLAGS])
500     AC_SUBST([COVERAGE_LDFLAGS])
501 fi
502
503 if test "$enable_webkit2" = "yes"; then
504     if test "$GTK_API_VERSION" = "2.0"; then
505         AC_MSG_ERROR([WebKit2 requires GTK+ 3.x, use --with-gtk=3.0])
506     fi
507
508     # Make sure we have GTK+ 2.x to build the plugin process.
509     PKG_CHECK_MODULES(GTK2, gtk+-2.0 >= gtk2_required_version)
510     AC_SUBST(GTK2_CFLAGS)
511     AC_SUBST(GTK2_LIBS)
512
513     # Check Unix printing
514     PKG_CHECK_MODULES(GTK_UNIX_PRINTING, gtk+-unix-print-3.0, [have_gtk_unix_printing=yes], [have_gtk_unix_printing=no])
515     AC_SUBST(GTK_UNIX_PRINTING_CFLAGS)
516     AC_SUBST(GTK_UNIX_PRINTING_LIBS)
517
518     # On some Linux/Unix platforms, shm_* may only be available if linking against librt
519     if test "$os_win32" = "no" && test "$os_openbsd" = "no"; then
520         AC_SEARCH_LIBS([shm_open], [rt], [SHM_LIBS="-lrt"])
521         AC_SUBST(SHM_LIBS)
522     fi
523 fi
524
525 # We need atspi2 for Webkit2 unit tests.
526 if test "$enable_webkit2" = "yes"; then
527    PKG_CHECK_MODULES([ATSPI2], [atspi-2 >= atspi2_required_version], [have_atspi2=yes], [have_atspi2=no])
528    AC_SUBST([ATSPI2_CFLAGS])
529    AC_SUBST([ATSPI2_LIBS])
530 fi
531
532 if test "$enable_jit" = "no"; then
533     AC_MSG_NOTICE([JIT compilation is disabled, also disabling FTL JIT support.])
534     enable_ftl_jit=no
535 fi
536
537 if test "$enable_ftl_jit" != no && test "$cxx_compiler" != "clang++"; then
538     if test "$enable_ftl_jit" = "yes"; then
539         AC_MSG_ERROR([Clang C++ compiler is required for FTL JIT support.])
540     else
541         AC_MSG_WARN([Clang C++ compiler is not used, disabling FTL JIT support.])
542         enable_ftl_jit=no
543     fi
544 fi
545
546 if test "$enable_ftl_jit" != "no"; then
547     AC_PATH_PROG(llvm_config, llvm-config, no)
548     if test "$llvm_config" = "no"; then
549         if test "$enable_ftl_jit" = "yes"; then
550             AC_MSG_ERROR([Cannot find llvm-config. LLVM >= 3.4 is needed for FTL JIT support.])
551         else
552             AC_MSG_WARN([Cannot find llvm-config. LLVM >= 3.4 is not present, disabling FTL JIT support.])
553             enable_ftl_jit=no
554         fi
555     else
556         LLVM_VERSION=`$llvm_config --version`
557         AX_COMPARE_VERSION([$LLVM_VERSION], [ge], [3.4], [have_llvm=yes], [have_llvm=no])
558         if test "$have_llvm" = "no"; then
559             if test "$enable_ftl_jit" = "yes"; then
560                 AC_MSG_ERROR([LLVM >= 3.4 is needed for FTL JIT support.])
561             else
562                 AC_MSG_WARN([LLVM >= 3.4 is not present, disabling FTL JIT support.])
563                 enable_ftl_jit=no
564             fi
565         else
566             LLVM_CFLAGS=`$llvm_config --cppflags`
567             LLVM_LIBS="`$llvm_config --ldflags` `$llvm_config --libs`"
568             AC_SUBST([LLVM_CFLAGS])
569             AC_SUBST([LLVM_LIBS])
570         fi
571     fi
572 fi
573
574 m4_ifdef([GTK_DOC_CHECK], [
575 GTK_DOC_CHECK([1.10])
576 ],[
577 AM_CONDITIONAL([ENABLE_GTK_DOC], false)
578 ])