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])
13 ], jpeg_ok=yes, jpeg_ok=no)
14 AC_MSG_RESULT($jpeg_ok)
15 if test "$jpeg_ok" = yes; then
17 # Should we check for progressive JPEG like GTK+ as well?
19 AC_MSG_ERROR([JPEG library (libjpeg) not found])
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
29 PNG_LIBS=`$PKG_CONFIG --libs $l`
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])
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
49 AC_MSG_ERROR([PNG library (libpng) not found])
52 AC_MSG_ERROR([PNG library (libpng) not found])
57 # Check for WebP Image support.
58 AC_CHECK_HEADERS([webp/decode.h], [WEBP_LIBS='-lwebp'], [AC_MSG_ERROR([WebP library (libwebp) not found])])
61 if test "$os_win32" = "yes"; then
63 SHLWAPI_LIBS=-lshlwapi
66 AC_SUBST([WINMM_LIBS])
67 AC_SUBST([SHLWAPI_LIBS])
68 AC_SUBST([OLE32_LIBS])
71 2.0) GTK_REQUIRED_VERSION=gtk2_required_version
73 WEBKITGTK_API_MAJOR_VERSION=1
74 WEBKITGTK_API_MINOR_VERSION=0
75 WEBKITGTK_API_VERSION=1.0
76 WEBKITGTK_PC_NAME=webkit
78 GAIL_REQUIRED_VERSION=gail2_required_version
80 3.0) GTK_REQUIRED_VERSION=gtk3_required_version
82 WEBKITGTK_API_MAJOR_VERSION=3
83 WEBKITGTK_API_MINOR_VERSION=0
84 WEBKITGTK_API_VERSION=3.0
85 WEBKITGTK_PC_NAME=webkitgtk
87 GAIL_REQUIRED_VERSION=gail3_required_version
90 AC_SUBST([WEBKITGTK_API_MAJOR_VERSION])
91 AC_SUBST([WEBKITGTK_API_MINOR_VERSION])
92 AC_SUBST([WEBKITGTK_API_VERSION])
93 AC_SUBST([WEBKITGTK_PC_NAME])
94 AC_SUBST([GTK_API_VERSION])
97 # Check for glib and required utilities. This macro is named as if it interacts
98 # with automake, but it doesn't. Thus it doesn't need to be in the automake section.
99 AM_PATH_GLIB_2_0(glib_required_version, :, :, gmodule gobject gthread gio)
100 if test -z "$GLIB_GENMARSHAL" || test -z "$GLIB_MKENUMS"; then
101 AC_MSG_ERROR([You need the GLib dev tools in your path])
105 GLIB_COMPILE_RESOURCES=`$PKG_CONFIG --variable glib_compile_resources gio-2.0`
106 AC_SUBST(GLIB_COMPILE_RESOURCES)
109 # TODO: use pkg-config (after CFLAGS in their .pc files are cleaned up).
112 UNICODE_CFLAGS="-I$srcdir/Source/JavaScriptCore/icu -I$srcdir/Source/WebCore/icu"
113 UNICODE_LIBS="-licucore"
117 UNICODE_LIBS="-licui18n -licuuc"
118 AC_CHECK_HEADERS([unicode/uchar.h], [], [AC_MSG_ERROR([Could not find ICU headers.])])
121 AC_PATH_PROG(icu_config, icu-config, no)
122 if test "$icu_config" = "no"; then
123 AC_MSG_ERROR([Cannot find icu-config. The ICU library is needed.])
126 # We don't use --cflags as this gives us a lot of things that we don't necessarily want,
127 # like debugging and optimization flags. See man (1) icu-config for more info.
128 UNICODE_CFLAGS=`$icu_config --cppflags`
129 UNICODE_LIBS=`$icu_config --ldflags-libsonly`
133 AC_SUBST([UNICODE_CFLAGS])
134 AC_SUBST([UNICODE_LIBS])
136 PKG_CHECK_MODULES([ZLIB], [zlib])
137 AC_SUBST([ZLIB_CFLAGS])
138 AC_SUBST([ZLIB_LIBS])
140 GETTEXT_PACKAGE=WebKitGTK-$GTK_API_VERSION
141 AC_SUBST(GETTEXT_PACKAGE)
143 PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= libxml_required_version)
144 AC_SUBST(LIBXML_CFLAGS)
145 AC_SUBST(LIBXML_LIBS)
147 PKG_CHECK_MODULES(PANGO, [pango >= pango_required_version pangoft2])
148 AC_SUBST(PANGO_CFLAGS)
151 if test "$enable_spellcheck" = "yes"; then
152 PKG_CHECK_MODULES(ENCHANT, enchant >= enchant_required_version, [], [enable_spellcheck="no"])
153 AC_SUBST(ENCHANT_CFLAGS)
154 AC_SUBST(ENCHANT_LIBS)
157 PKG_CHECK_MODULES(GAIL, $GAIL_PC_NAME >= $GAIL_REQUIRED_VERSION)
158 AC_SUBST(GAIL_CFLAGS)
161 # Check for target-specific dependencies.
162 if test "$with_target" = "directfb"; then
163 PKG_CHECK_MODULES(CAIRO, cairo-directfb >= cairo_required_version)
164 PKG_CHECK_MODULES(GTK, gtk+-directfb-2.0 >= $GTK_REQUIRED_VERSION)
166 PKG_CHECK_MODULES(CAIRO, cairo >= cairo_required_version)
167 PKG_CHECK_MODULES(GTK, gtk+-$GTK_API_VERSION >= $GTK_REQUIRED_VERSION)
169 if test "$with_target" = "x11" && test "$os_win32" = "no"; then
170 PKG_CHECK_MODULES([XT], [xt], [xt_has_pkg_config=yes], [xt_has_pkg_config=no])
172 # Some old versions of Xt do not provide xt.pc, so try to link against Xt
173 # and if it's installed fall back to just adding -lXt.
174 if test "$xt_has_pkg_config" = "no"; then
175 # Using AC_CHECK_LIB instead of AC_SEARCH_LIB is fine in this case as we don't care
176 # about the XtOpenDisplay symbol but only about the existence of libXt.
177 AC_CHECK_LIB([Xt], [XtOpenDisplay], [XT_CFLAGS=""; XT_LIBS="-lXt"],
178 [AC_MSG_ERROR([X Toolkit Intrinsics library (libXt) not found])])
181 AC_SUBST([XT_CFLAGS])
187 AC_SUBST(CAIRO_CFLAGS)
193 AC_CHECK_HEADERS([GL/glx.h], [have_glx="yes"], [have_glx="no"])
194 AC_MSG_CHECKING([whether to enable GLX support])
195 if test "$enable_glx" != "no"; then
196 if test "$have_glx" = "no"; then
197 if test "$enable_glx" = "yes"; then
198 AC_MSG_ERROR([--enable-glx specified, but not available])
202 elif test "$enable_gles2" != "yes"; then
206 AC_MSG_RESULT([$enable_glx])
209 AC_CHECK_HEADERS([EGL/egl.h], [have_egl="yes"], [have_egl="no"])
210 AC_MSG_CHECKING([whether to enable EGL support])
211 if test "$enable_egl" != "no"; then
212 if test "$have_egl" = "no"; then
213 if test "$enable_egl" = "yes"; then
214 AC_MSG_ERROR([--enable-egl specified, but not available])
222 AC_MSG_RESULT([$enable_egl])
225 AC_CHECK_HEADERS([GLES2/gl2.h], [have_gles2="yes"], [have_gles2="no"])
226 AC_MSG_CHECKING([whether to use OpenGL ES 2 support])
227 if test "$enable_glx" = "yes"; then
228 if test "$enable_gles2" = "yes"; then
229 AC_MSG_ERROR([Cannot enable OpenGL ES 2 support with GLX])
234 if test "$enable_egl" = "no"; then
235 if test "$enable_gles2" = "yes"; then
236 AC_MSG_ERROR([Cannot enable OpenGL ES 2 support without EGL])
241 if test "$enable_gles2" != "no"; then
242 if test "$have_gles2" = "no"; then
243 if test "$enable_gles2" = "yes"; then
244 AC_MSG_ERROR([--enable-gles2 specified, but not available])
253 AC_MSG_RESULT([$enable_gles2])
255 if test "$enable_gles2" != "yes"; then
256 AC_CHECK_HEADERS([GL/gl.h], [found_opengl="yes"], [])
259 if test "$with_acceleration_backend" = "auto"; then
260 if test "$found_opengl" = "yes"; then
261 with_acceleration_backend="opengl";
263 with_acceleration_backend="none";
267 if test "$with_acceleration_backend" = "opengl"; then
268 PKG_CHECK_MODULES([XCOMPOSITE], [xcomposite]);
269 PKG_CHECK_MODULES([XDAMAGE], [xdamage]);
270 AC_SUBST(XCOMPOSITE_CFLAGS)
271 AC_SUBST(XCOMPOSITE_LIBS)
272 AC_SUBST(XDAMAGE_CFLAGS)
273 AC_SUBST(XDAMAGE_LIBS)
276 # OpenGL is turned on by default (along with WebGL and accelerated compositing), but if Clutter is chosen
277 # as the accelerated drawing backend, we want to disable it. COGL does not play well with OpenGL.
278 if test "$enable_webgl" = "auto"; then
279 if test "$with_acceleration_backend" = "opengl"; then
286 if test "$enable_webgl" = "yes" && test "$with_acceleration_backend" != "opengl"; then
287 AC_MSG_ERROR([OpenGL must be active (and Clutter disabled) to use WebGL.])
290 if test "$enable_accelerated_compositing" = "yes" && test "$with_acceleration_backend" = "none"; then
291 AC_MSG_ERROR([OpenGL or Clutter must be active to use accelerated compositing.])
294 if test "$enable_accelerated_compositing" = "auto"; then
295 if test "$with_acceleration_backend" != "none"; then
296 enable_accelerated_compositing="yes";
298 enable_accelerated_compositing="no";
302 if test "$enable_gamepad" = "yes" && test "$os_linux" = no; then
303 AC_MSG_WARN([Gamepad support is only available on Linux. Disabling Gamepad support.])
307 # Turn off svg features if --disable-svg is requested.
308 if test "$enable_svg" = "no"; then
312 # Check for SVG features, enabling SVG if necessary.
313 if test "$enable_svg_fonts" = "yes" && test "$enable_svg" = "no"; then
314 AC_MSG_WARN([SVG feature(s) requested but SVG is disabled.. Enabling SVG support])
318 if test "$enable_opcode_stats" = "yes"; then
319 if test "$enable_jit" = "yes"; then
320 AC_MSG_ERROR([JIT must be disabled for Opcode stats to work.])
324 case "$enable_jit" in
325 yes) JSC_CPPFLAGS="-DENABLE_JIT=1" ;;
326 no) JSC_CPPFLAGS="-DENABLE_JIT=0" ;;
327 *) enable_jit="autodetect" ;;
329 AC_SUBST(JSC_CPPFLAGS)
332 # Enable CSS Filters and Shaders if accelerated_compositing is turned on.
333 enable_css_filters=no;
334 enable_css_shaders=no;
335 AC_MSG_CHECKING([whether to enable CSS Filters and Shaders])
336 if test "$enable_accelerated_compositing" = "yes" && test "$with_acceleration_backend" = "opengl"; then
337 enable_css_filters=yes;
338 enable_css_shaders=yes;
340 AC_MSG_RESULT([$enable_css_filters])
348 if test "$enable_introspection" = "yes"; then
349 PKG_CHECK_MODULES([INTROSPECTION],[gobject-introspection-1.0 >= gobject_introspection_required_version])
351 G_IR_SCANNER="$($PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0)"
352 G_IR_COMPILER="$($PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0)"
353 G_IR_GENERATE="$($PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0)"
356 AC_SUBST([G_IR_SCANNER])
357 AC_SUBST([G_IR_COMPILER])
358 AC_SUBST([G_IR_GENERATE])
360 PKG_CHECK_MODULES([LIBSOUP], [libsoup-2.4 >= libsoup_required_version])
361 AC_SUBST([LIBSOUP_CFLAGS])
362 AC_SUBST([LIBSOUP_LIBS])
364 if test "$enable_credential_storage" = "yes"; then
365 PKG_CHECK_MODULES([LIBSECRET], [libsecret-1])
366 AC_SUBST([LIBSECRET_CFLAGS])
367 AC_SUBST([LIBSECRET_LIBS])
370 # Check if FreeType/FontConfig are available.
371 if test "$with_target" = "directfb"; then
372 PKG_CHECK_MODULES([FREETYPE],
373 [fontconfig >= fontconfig_required_version freetype2 >= freetype2_required_version harfbuzz >= harfbuzz_required_version])
375 PKG_CHECK_MODULES([FREETYPE],
376 [cairo-ft fontconfig >= fontconfig_required_version freetype2 >= freetype2_required_version harfbuzz >= harfbuzz_required_version])
378 # HarfBuzz 0.9.18 splits harbuzz-icu into a separate library.
379 # Since we support earlier HarfBuzz versions we keep this conditional for now.
380 if $PKG_CONFIG --atleast-version 0.9.18 harfbuzz; then
381 PKG_CHECK_MODULES(HARFBUZZ_ICU, harfbuzz-icu >= $harfbuzz_required_version)
382 FREETYPE_CFLAGS+=" $HARFBUZZ_ICU_CFLAGS"
383 FREETYPE_LIBS+=" $HARFBUZZ_ICU_LIBS"
385 AC_SUBST([FREETYPE_CFLAGS])
386 AC_SUBST([FREETYPE_LIBS])
388 # Check if SQLite3 is available. Error out only if one of the features hard-depending
389 # on it is enabled while SQLite3 is unavailable.
390 PKG_CHECK_MODULES([SQLITE3], [sqlite3 >= sqlite_required_version], [sqlite3_has_pkg_config=yes], [sqlite3_has_pkg_config=no])
391 if test "$sqlite3_has_pkg_config" = "no"; then
392 AC_SEARCH_LIBS([sqlite3_open16], [sqlite3],
393 [sqlite3_found=yes; SQLITE3_LIBS="$LIBS"; SQLITE3_CFLAGS="-I $srcdir/WebKitLibraries/WebCoreSQLite3"], [sqlite3_found=no])
395 AC_SUBST([SQLITE3_CFLAGS])
396 AC_SUBST([SQLITE3_LIBS])
398 if (test "$sqlite3_found" = "no"); then
399 AC_MSG_ERROR([SQLite3 is required for the Database related features])
402 PKG_CHECK_MODULES([LIBXSLT],[libxslt >= libxslt_required_version])
403 AC_SUBST([LIBXSLT_CFLAGS])
404 AC_SUBST([LIBXSLT_LIBS])
406 # Check if geoclue is available.
407 if test "$enable_geolocation" = "yes"; then
408 PKG_CHECK_MODULES([GEOCLUE], [geoclue])
409 AC_SUBST([GEOCLUE_CFLAGS])
410 AC_SUBST([GEOCLUE_LIBS])
413 # Check for XRender under Linux/Unix. Some linkers require explicit linkage (like GNU Gold),
414 # so we cannot rely on GTK+ pulling XRender.
415 if test "$with_target" = "x11"; then
416 PKG_CHECK_MODULES([XRENDER], [xrender])
417 AC_SUBST([XRENDER_CFLAGS])
418 AC_SUBST([XRENDER_LIBS])
421 if test "$enable_video" = "yes" || test "$enable_web_audio" = "yes"; then
422 PKG_CHECK_MODULES([GSTREAMER], [
423 gstreamer-1.0 >= gstreamer_required_version
424 gstreamer-plugins-base-1.0 >= gstreamer_plugins_base_required_version
429 gstreamer-pbutils-1.0,
430 gstreamer-video-1.0])
431 AC_SUBST([GSTREAMER_CFLAGS])
432 AC_SUBST([GSTREAMER_LIBS])
435 acceleration_backend_description=$with_acceleration_backend
436 if test "$with_acceleration_backend" = "clutter"; then
437 PKG_CHECK_MODULES(CLUTTER, clutter-1.0 >= clutter_required_version)
438 PKG_CHECK_MODULES([CLUTTER_GTK], [clutter-gtk-1.0 >= clutter_gtk_required_version])
440 AC_SUBST(CLUTTER_CFLAGS)
441 AC_SUBST(CLUTTER_LIBS)
442 AC_SUBST(CLUTTER_GTK_CFLAGS)
443 AC_SUBST(CLUTTER_GTK_LIBS)
450 if test "$with_acceleration_backend" = "opengl"; then
451 if test "$enable_gles2" = "yes"; then
452 acceleration_backend_description+="(gles2"
453 OPENGL_LIBS="-lGLESv2"
455 acceleration_backend_description+="(gl"
458 if test "$enable_egl" = "yes"; then
459 acceleration_backend_description+=", egl"
460 OPENGL_LIBS+=" -lEGL"
462 if test "$enable_glx" = "yes"; then
463 acceleration_backend_description+=", glx"
466 # Check whether dlopen() is in the core libc like on FreeBSD, or in a separate
467 # libdl like on GNU/Linux (in which case we want to link to libdl).
468 AC_CHECK_FUNC([dlopen], [], [AC_CHECK_LIB([dl], [dlopen], [DLOPEN_LIBS="-ldl"])])
469 AC_SUBST([DLOPEN_LIBS])
471 OPENGL_LIBS+=" $DLOPEN_LIBS"
472 acceleration_backend_description+=")"
474 AC_SUBST([OPENGL_LIBS])
476 enable_accelerated_canvas=no
477 if test "$enable_accelerated_compositing" = "yes" && test "$with_acceleration_backend" = "opengl"; then
478 CAIRO_GL_LIBS="cairo-gl"
479 if test "$enable_glx" = "yes"; then
480 CAIRO_GL_LIBS+=" cairo-glx"
482 if test "$enable_egl" = "yes"; then
483 CAIRO_GL_LIBS+=" cairo-egl"
486 # At the moment CairoGL does not add any extra cflags and libraries, so we can
487 # safely ignore CAIRO_GL_LIBS and CAIRO_GL_CFLAGS for the moment.
488 PKG_CHECK_MODULES(CAIRO_GL, $CAIRO_GL_LIBS, [enable_accelerated_canvas=yes], [enable_accelerated_canvas=no])
491 if test "$enable_gamepad" = "yes"; then
492 PKG_CHECK_MODULES([GAMEPAD], [gio-unix-2.0 gudev-1.0])
494 AC_SUBST(GAMEPAD_CFLAGS)
495 AC_SUBST(GAMEPAD_LIBS)
498 if test "$enable_battery_status" = "yes"; then
499 PKG_CHECK_MODULES([UPOWER_GLIB], [upower-glib])
501 AC_SUBST(UPOWER_GLIB_CFLAGS)
502 AC_SUBST(UPOWER_GLIB_LIBS)
505 # Check whether to enable code coverage support.
506 if test "$enable_coverage" = "yes"; then
507 COVERAGE_CFLAGS="-MD"
508 COVERAGE_LDFLAGS="-ftest-coverage -fprofile-arcs"
509 AC_SUBST([COVERAGE_CFLAGS])
510 AC_SUBST([COVERAGE_LDFLAGS])
513 if test "$enable_webkit2" = "yes"; then
514 if test "$GTK_API_VERSION" = "2.0"; then
515 AC_MSG_ERROR([WebKit2 requires GTK+ 3.x, use --with-gtk=3.0])
518 # Make sure we have GTK+ 2.x to build the plugin process.
519 PKG_CHECK_MODULES(GTK2, gtk+-2.0 >= gtk2_required_version gail >= gail2_required_version)
520 AC_SUBST(GTK2_CFLAGS)
523 # Check Unix printing
524 PKG_CHECK_MODULES(GTK_UNIX_PRINTING, gtk+-unix-print-3.0, [have_gtk_unix_printing=yes], [have_gtk_unix_printing=no])
525 AC_SUBST(GTK_UNIX_PRINTING_CFLAGS)
526 AC_SUBST(GTK_UNIX_PRINTING_LIBS)
528 # On some Linux/Unix platforms, shm_* may only be available if linking against librt
529 if test "$os_win32" = "no"; then
530 AC_SEARCH_LIBS([shm_open], [rt], [SHM_LIBS="-lrt"])
535 # We need atspi2 for Webkit2 unit tests.
536 if test "$enable_webkit2" = "yes"; then
537 PKG_CHECK_MODULES([ATSPI2], [atspi-2 >= atspi2_required_version], [have_atspi2=yes], [have_atspi2=no])
538 AC_SUBST([ATSPI2_CFLAGS])
539 AC_SUBST([ATSPI2_LIBS])
542 m4_ifdef([GTK_DOC_CHECK], [
543 GTK_DOC_CHECK([1.10])
545 AM_CONDITIONAL([ENABLE_GTK_DOC], false)