[GTK] Add property for IndexedDB database path to WebKitGTK+
[WebKit-https.git] / configure.ac
1 AC_PREREQ(2.60)
2
3 m4_define([webkit_major_version], [1])
4 m4_define([webkit_minor_version], [11])
5 m4_define([webkit_micro_version], [4])
6
7 # This is the version we'll be using as part of our User-Agent string
8 # e.g., AppleWebKit/$(webkit_user_agent_version) ...
9 #
10 # Sourced from Source/WebCore/Configurations/Version.xcconfig
11 m4_define([webkit_user_agent_major_version], [537])
12 m4_define([webkit_user_agent_minor_version], [26])
13
14 AC_INIT([WebKitGTK],[webkit_major_version.webkit_minor_version.webkit_micro_version],[http://bugs.webkit.org/])
15
16 AC_CONFIG_MACRO_DIR([Source/autotools])
17 AC_CONFIG_AUX_DIR([Source/autotools])
18 AC_SUBST(ACLOCAL_AMFLAGS, "-I Source/autotools")
19
20 AC_CONFIG_HEADERS([autotoolsconfig.h])
21 AC_CANONICAL_HOST
22
23 WEBKIT_MAJOR_VERSION=webkit_major_version
24 WEBKIT_MINOR_VERSION=webkit_minor_version
25 WEBKIT_MICRO_VERSION=webkit_micro_version
26 WEBKIT_USER_AGENT_MAJOR_VERSION=webkit_user_agent_major_version
27 WEBKIT_USER_AGENT_MINOR_VERSION=webkit_user_agent_minor_version
28 AC_SUBST(WEBKIT_MAJOR_VERSION)
29 AC_SUBST(WEBKIT_MINOR_VERSION)
30 AC_SUBST(WEBKIT_MICRO_VERSION)
31 AC_SUBST(WEBKIT_USER_AGENT_MAJOR_VERSION)
32 AC_SUBST(WEBKIT_USER_AGENT_MINOR_VERSION)
33
34 AC_CONFIG_SRCDIR([Source/WebCore/config.h])
35
36 dnl # Libtool library version, not to confuse with API version
37 dnl # see http://www.gnu.org/software/libtool/manual/html_node/Libtool-versioning.html
38 LIBWEBKITGTK_VERSION=18:0:18
39 AC_SUBST([LIBWEBKITGTK_VERSION])
40
41 LIBJAVASCRIPTCOREGTK_VERSION=13:8:13
42 AC_SUBST([LIBJAVASCRIPTCOREGTK_VERSION])
43
44 LIBWEBKIT2GTK_VERSION=20:0:20
45 AC_SUBST([LIBWEBKIT2GTK_VERSION])
46
47 AM_INIT_AUTOMAKE([foreign subdir-objects dist-xz no-dist-gzip tar-ustar])
48
49 # Use AM_SILENT_RULES if present
50 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
51
52 # host checking - inspired by the GTK+ configure.in
53 # TODO: move these to webkit.m4?
54 AC_MSG_CHECKING([for native Win32])
55 case "$host" in
56      *-*-mingw*)
57        os_win32=yes
58        ;;
59      *)
60        os_win32=no
61        ;;
62 esac
63 AC_MSG_RESULT([$os_win32])
64
65 case "$host" in
66      *-*-linux*)
67        os_linux=yes
68        ;;
69      *-*-freebsd*)
70        os_freebsd=yes
71        ;;
72      *-*-darwin*)
73        os_darwin=yes
74        ;;
75 esac
76
77 case "$host_os" in
78      gnu* | linux* | k*bsd*-gnu)
79        os_gnu=yes
80        ;;
81      *)
82        os_gnu=no
83        ;;
84 esac
85
86 # If CFLAGS and CXXFLAGS are unset, default to empty.
87 # This is to tell automake not to include '-g' if C{XX,}FLAGS is not set
88 # For more info - http://www.gnu.org/software/automake/manual/autoconf.html#C_002b_002b-Compiler
89 if test -z "$CXXFLAGS"; then
90    CXXFLAGS=""
91 fi
92 if test -z "$CFLAGS"; then
93    CFLAGS=""
94 fi
95
96 PKG_PROG_PKG_CONFIG
97
98 AC_PATH_PROG(PERL, perl)
99 if test -z "$PERL"; then
100    AC_MSG_ERROR([You need 'perl' to compile WebKit])
101 fi
102
103 AC_PATH_PROG(PYTHON, python)
104 if test -z "$PYTHON"; then
105    AC_MSG_ERROR([You need 'python' to compile WebKit])
106 fi
107
108 AC_PATH_PROG(RUBY, ruby)
109 if test -z "$RUBY"; then
110    AC_MSG_ERROR([You need 'ruby' to compile WebKit])
111 fi
112
113 AC_PATH_PROG(BISON, bison)
114 if test -z "$BISON"; then
115    AC_MSG_ERROR([You need the 'bison' parser generator to compile WebKit])
116 fi
117
118 AC_PATH_PROG(MV, mv)
119 if test -z "$MV"; then
120    AC_MSG_ERROR([You need 'mv' to compile WebKit])
121 fi
122
123 AC_PROG_CC
124 AC_PROG_CXX
125 AM_PROG_CC_C_O
126 AC_PROG_INSTALL
127 AC_SYS_LARGEFILE
128
129 # Check whether a C++ was found (AC_PROG_CXX sets $CXX to "g++" even when it
130 # doesn't exist)
131 AC_LANG_PUSH([C++])
132 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],[],[AC_MSG_ERROR([No C++ compiler found])])
133 AC_LANG_POP([C++])
134
135 # C/C++ Language Features
136 AC_C_CONST
137 AC_C_INLINE
138 AC_C_VOLATILE
139
140 # C/C++ Headers
141 AC_HEADER_STDC
142 AC_HEADER_STDBOOL
143
144 # Linker
145 AC_DISABLE_STATIC
146 AC_LIBTOOL_WIN32_DLL
147 AC_PROG_LIBTOOL
148 # use dolt to speedup the build
149 DOLT
150
151 AC_PATH_PROG(FLEX, flex)
152 if test -z "$FLEX"; then
153    AC_MSG_ERROR([You need the 'flex' lexer generator to compile WebKit])
154 else
155    FLEX_VERSION=`$FLEX --version | sed 's,.*\ \([0-9]*\.[0-9]*\.[0-9]*\)$,\1,'`
156    AX_COMPARE_VERSION([2.5.33],[gt],[$FLEX_VERSION],
157       AC_MSG_WARN([You need at least version 2.5.33 of the 'flex' lexer generator to compile WebKit correctly]))
158 fi
159
160 AC_PATH_PROG(GPERF, gperf)
161 if test -z "$GPERF"; then
162    AC_MSG_ERROR([You need the 'gperf' hash function generator to compile WebKit])
163 fi
164
165 # check for -fvisibility=hidden compiler support (GCC >= 4)
166 saved_CFLAGS="$CFLAGS"
167 CFLAGS="$CFLAGS -fvisibility=hidden -fvisibility-inlines-hidden"
168 AC_MSG_CHECKING([if ${CXX} supports -fvisibility=hidden -fvisibility-inlines-hidden])
169 AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])],
170       [ AC_MSG_RESULT([yes])
171         SYMBOL_VISIBILITY="-fvisibility=hidden" SYMBOL_VISIBILITY_INLINES="-fvisibility-inlines-hidden" ],
172         AC_MSG_RESULT([no]))
173 CFLAGS="$saved_CFLAGS"
174 AC_SUBST(SYMBOL_VISIBILITY)
175 AC_SUBST(SYMBOL_VISIBILITY_INLINES)
176
177 # Disable C++0x compat warnings for GCC >= 4.6.0 until we build
178 # cleanly with that.
179 AC_LANG_PUSH(C++)
180 TMPCXXFLAGS=$CXXFLAGS
181 CXXFLAGS="-Wall -Werror"
182 AC_MSG_CHECKING([if we have to disable C++0x compat warnings for GCC >= 4.6.0])
183 AC_TRY_COMPILE([
184 namespace std {
185     class nullptr_t { };
186 }
187 extern std::nullptr_t nullptr;
188 ], [return 0;],
189 disable_cxx0x_compat=no,
190 disable_cxx0x_compat=yes)
191 AC_MSG_RESULT($disable_cxx0x_compat)
192 if test "$disable_cxx0x_compat" = yes; then
193   CXXFLAGS="$TMPCXXFLAGS -Wno-c++0x-compat"
194 else
195   CXXFLAGS="$TMPCXXFLAGS"
196 fi
197 AC_LANG_POP(C++)
198
199 # pthread (not needed on Windows)
200 if test "$os_win32" = "no"; then
201 AC_CHECK_HEADERS([pthread.h],
202                  AC_DEFINE([HAVE_PTHREAD_H],[1],[Define if pthread exists]),
203                  AC_MSG_ERROR([pthread support is required to build WebKit]))
204 AC_CHECK_LIB(pthread, pthread_rwlock_init,
205                  AC_DEFINE([HAVE_PTHREAD_RWLOCK],[1],[Define if pthread rwlock is present]),
206                  AC_MSG_WARN([pthread rwlock support is not available]))
207 fi
208
209 # check for libjpeg the way Gtk does it.
210 AC_CHECK_LIB(jpeg, jpeg_destroy_decompress,
211                    jpeg_ok=yes, jpeg_ok=no
212                    AC_MSG_ERROR([JPEG library (libjpeg) not found]))
213 if test "$jpeg_ok" = yes; then
214    AC_MSG_CHECKING([for jpeglib])
215    AC_TRY_CPP(
216 [#include <stdio.h>
217 #undef PACKAGE
218 #undef VERSION
219 #undef HAVE_STDLIB_H
220 #include <jpeglib.h>],
221          jpeg_ok=yes,
222          jpeg_ok=no)
223    AC_MSG_RESULT($jpeg_ok)
224    if test "$jpeg_ok" = yes; then
225       JPEG_LIBS="-ljpeg"
226       # should we check for progressive JPEG like GTK+ as well?
227    else
228       AC_MSG_ERROR([JPEG library (libjpeg) not found])
229    fi
230 fi
231 AC_SUBST([JPEG_LIBS])
232
233 # Check for libpng the way Gtk+ does it
234 for l in libpng libpng14 libpng12; do
235   AC_MSG_CHECKING(for $l)
236   if $PKG_CONFIG --exists $l ; then
237     AC_MSG_RESULT(yes)
238     PNG_LIBS=`$PKG_CONFIG --libs $l`
239     png_ok=yes
240     break
241   else
242     AC_MSG_RESULT(no)
243     png_ok=no
244   fi
245 done
246 if test "$png_ok" != yes; then
247   AC_CHECK_LIB(png, png_read_info,
248     [AC_CHECK_HEADER(png.h,
249       png_ok=yes,
250       png_ok=no)],
251     AC_MSG_ERROR([PNG library (libpng) not found]), -lz -lm)
252   if test "$png_ok" = yes; then
253     AC_MSG_CHECKING([for png_structp in png.h])
254     AC_TRY_COMPILE([#include <png.h>],
255       [png_structp pp; png_infop info; png_colorp cmap; png_create_read_struct;],
256       png_ok=yes,
257       png_ok=no)
258     AC_MSG_RESULT($png_ok)
259     if test "$png_ok" = yes; then
260       PNG_LIBS='-lpng -lz'
261     else
262       AC_MSG_ERROR([PNG library (libpng) not found])
263     fi
264   else
265     AC_MSG_ERROR([PNG library (libpng) not found])
266   fi
267 fi
268 AC_SUBST([PNG_LIBS])
269
270 # Check for WEBP Image support
271 AC_CHECK_HEADERS([webp/decode.h], [WEBP_LIBS='-lwebp'], [AC_MSG_ERROR([WebP library (libwebp) not found])])
272 AC_SUBST([WEBP_LIBS])
273
274 if test "$os_win32" = "yes"; then
275   WINMM_LIBS=-lwinmm
276   SHLWAPI_LIBS=-lshlwapi
277   OLE32_LIBS=-lole32
278 fi
279 AC_SUBST([WINMM_LIBS])
280 AC_SUBST([SHLWAPI_LIBS])
281 AC_SUBST([OLE32_LIBS])
282
283
284 # check whether dlopen() is in the core libc like on FreeBSD, or in a separate
285 # libdl like on GNU/Linux (in which case we want to link to libdl)
286 AC_CHECK_FUNC([dlopen], [], [AC_CHECK_LIB([dl], [dlopen], [DLOPEN_LIBS="-ldl"])])
287 AC_SUBST([DLOPEN_LIBS])
288
289
290 # determine the GTK+ version to use
291 AC_MSG_CHECKING([the GTK+ version to use])
292 AC_ARG_WITH([gtk],
293         [AS_HELP_STRING([--with-gtk=2.0|3.0], [the GTK+ version to use (default: 3.0)])],
294         [case "$with_gtk" in
295         2.0|3.0) ;;
296         *) AC_MSG_ERROR([invalid GTK+ version specified]) ;;
297         esac],
298         [with_gtk=3.0])
299 AC_MSG_RESULT([$with_gtk])
300
301 GTK2_REQUIRED_VERSION=2.10
302 GAIL2_REQUIRED_VERSION=1.8
303 GTK3_REQUIRED_VERSION=3.4.0
304 GAIL3_REQUIRED_VERSION=3.0
305
306 case "$with_gtk" in
307      2.0) GTK_REQUIRED_VERSION=$GTK2_REQUIRED_VERSION
308           GTK_API_VERSION=2.0
309           WEBKITGTK_API_MAJOR_VERSION=1
310           WEBKITGTK_API_MINOR_VERSION=0
311           WEBKITGTK_API_VERSION=1.0
312           WEBKITGTK_PC_NAME=webkit
313           GAIL_PC_NAME=gail
314           GAIL_REQUIRED_VERSION=$GAIL2_REQUIRED_VERSION
315           ;;
316      3.0) GTK_REQUIRED_VERSION=$GTK3_REQUIRED_VERSION
317           GTK_API_VERSION=3.0
318           WEBKITGTK_API_MAJOR_VERSION=3
319           WEBKITGTK_API_MINOR_VERSION=0
320           WEBKITGTK_API_VERSION=3.0
321           WEBKITGTK_PC_NAME=webkitgtk
322           GAIL_PC_NAME=gail-3.0
323           GAIL_REQUIRED_VERSION=$GAIL3_REQUIRED_VERSION
324           ;;
325 esac
326
327 AC_SUBST([WEBKITGTK_API_MAJOR_VERSION])
328 AC_SUBST([WEBKITGTK_API_MINOR_VERSION])
329 AC_SUBST([WEBKITGTK_API_VERSION])
330 AC_SUBST([WEBKITGTK_PC_NAME])
331 AC_SUBST([GTK_API_VERSION])
332 AM_CONDITIONAL([GTK_API_VERSION_2],[test "$GTK_API_VERSION" = "2.0"])
333
334 # determine the GDK/GTK+ target
335 AC_MSG_CHECKING([the target windowing system])
336 AC_ARG_WITH(target,
337             AC_HELP_STRING([--with-target=@<:@x11/win32/quartz/directfb@:>@],
338                            [Select webkit target [default=x11]]),
339             [],[with_target="x11"])
340
341 case "$with_target" in
342      x11|win32|quartz|directfb) ;;
343      *) AC_MSG_ERROR([Invalid target: must be x11, quartz, win32, or directfb.]) ;;
344 esac
345
346 AC_MSG_RESULT([$with_target])
347
348 # minimum base dependencies
349 CAIRO_REQUIRED_VERSION=1.10
350 FONTCONFIG_REQUIRED_VERSION=2.4
351 FREETYPE2_REQUIRED_VERSION=9.0
352 GLIB_REQUIRED_VERSION=2.32.0
353 LIBSOUP_REQUIRED_VERSION=2.40.0
354 LIBXML_REQUIRED_VERSION=2.6
355 PANGO_REQUIRED_VERSION=1.21.0
356
357 # optional modules
358 LIBXSLT_REQUIRED_VERSION=1.1.7
359 SQLITE_REQUIRED_VERSION=3.0
360 ENCHANT_REQUIRED_VERSION=0.22
361 CLUTTER_REQUIRED_VERSION=1.8.2
362 CLUTTER_GTK_REQUIRED_VERSION=1.0.2
363 ATSPI2_REQUIRED_VERSION=2.2.1
364
365 # Check for glib and required utilities
366 AM_PATH_GLIB_2_0($GLIB_REQUIRED_VERSION, :, :, gmodule gobject gthread gio)
367 if test -z "$GLIB_GENMARSHAL" || test -z "$GLIB_MKENUMS"; then
368    AC_MSG_ERROR([You need the GLib dev tools in your path])
369 fi
370
371 # GResources
372 GLIB_COMPILE_RESOURCES=`$PKG_CONFIG --variable glib_compile_resources gio-2.0`
373 AC_SUBST(GLIB_COMPILE_RESOURCES)
374
375 GLIB_GSETTINGS
376
377 # Check and identify which unicode backend to use
378 AC_MSG_CHECKING([which Unicode backend to use])
379 AC_ARG_WITH(unicode_backend,
380             AC_HELP_STRING([--with-unicode-backend=@<:@icu/glib@:>@],
381                            [Select Unicode backend (WARNING: the glib-based backend is slow, and incomplete) [default=icu]]),
382             [],[with_unicode_backend="icu"])
383
384 case "$with_unicode_backend" in
385      icu|glib) ;;
386      *) AC_MSG_ERROR([Invalid Unicode backend: must be icu or glib.]) ;;
387 esac
388
389 AC_MSG_RESULT([$with_unicode_backend])
390
391 if test "$with_unicode_backend" = "icu"; then
392     # TODO: use pkg-config (after CFLAGS in their .pc files are cleaned up)
393     case "$host" in
394         *-*-darwin*)
395             UNICODE_CFLAGS="-I$srcdir/Source/JavaScriptCore/icu -I$srcdir/Source/WebCore/icu"
396             UNICODE_LIBS="-licucore"
397             ;;
398         *-*-mingw*)
399             UNICODE_CFLAGS=""
400             UNICODE_LIBS="-licui18n -licuuc"
401             ;;
402         *)
403             AC_PATH_PROG(icu_config, icu-config, no)
404             if test "$icu_config" = "no"; then
405                 AC_MSG_ERROR([Cannot find icu-config. The ICU library is needed.])
406             fi
407
408             # We don't use --cflags as this gives us a lot of things that we don't
409             # necessarily want, like debugging and optimization flags
410             # See man (1) icu-config for more info.
411             UNICODE_CFLAGS=`$icu_config --cppflags`
412             UNICODE_LIBS=`$icu_config --ldflags-libsonly`
413             ;;
414     esac
415 fi
416
417 if test "$with_unicode_backend" = "glib"; then
418     PKG_CHECK_MODULES([UNICODE], [glib-2.0 pango >= $PANGO_REQUIRED_VERSION])
419 fi
420
421 AC_SUBST([UNICODE_CFLAGS])
422 AC_SUBST([UNICODE_LIBS])
423
424 PKG_CHECK_MODULES([ZLIB], [zlib])
425 AC_SUBST([ZLIB_CFLAGS])
426 AC_SUBST([ZLIB_LIBS])
427
428 GETTEXT_PACKAGE=$PACKAGE-$GTK_API_VERSION
429 AC_SUBST(GETTEXT_PACKAGE)
430 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",
431                    [The gettext catalog name])
432
433 PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= $LIBXML_REQUIRED_VERSION)
434 AC_SUBST(LIBXML_CFLAGS)
435 AC_SUBST(LIBXML_LIBS)
436
437 PKG_CHECK_MODULES(PANGO, 
438                   [pango >= $PANGO_REQUIRED_VERSION
439                    pangoft2])
440 AC_SUBST(PANGO_CFLAGS)
441 AC_SUBST(PANGO_LIBS)
442
443 AC_MSG_CHECKING([whether to enable spellcheck support])
444 AC_ARG_ENABLE([spellcheck],
445   [AS_HELP_STRING([--enable-spellcheck],[enable support for spellcheck])],
446   [],[enable_spellcheck="yes"])
447 AC_MSG_RESULT([$enable_spellcheck])
448
449 if test "$enable_spellcheck" = "yes"; then
450 PKG_CHECK_MODULES(ENCHANT, enchant >= $ENCHANT_REQUIRED_VERSION, [], [enable_spellcheck="no"])
451 AC_SUBST(ENCHANT_CFLAGS)
452 AC_SUBST(ENCHANT_LIBS)
453 fi
454
455 PKG_CHECK_MODULES(GAIL, $GAIL_PC_NAME >= $GAIL_REQUIRED_VERSION)
456 AC_SUBST(GAIL_CFLAGS)
457 AC_SUBST(GAIL_LIBS)
458
459 # check for target-specific dependencies
460 if test "$with_target" = "directfb"; then
461    PKG_CHECK_MODULES(CAIRO, cairo-directfb >= $CAIRO_REQUIRED_VERSION)
462    PKG_CHECK_MODULES(GTK, gtk+-directfb-2.0 >= $GTK_REQUIRED_VERSION)
463    AC_DEFINE([WTF_PLATFORM_DIRECTFB],[1],[Define if target is DirectFB])
464 else
465    PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_REQUIRED_VERSION)
466    PKG_CHECK_MODULES(GTK, gtk+-$GTK_API_VERSION >= $GTK_REQUIRED_VERSION)
467
468    if test "$with_target" = "x11" && test "$os_win32" = "no"; then
469       # check for XT
470       PKG_CHECK_MODULES([XT],
471                         [xt],
472                         [xt_has_pkg_config=yes],
473                         [xt_has_pkg_config=no])
474       # some old versions of Xt do not provide xt.pc, so try to link against Xt
475       # and if it's installed fall back to just adding -lXt
476       if test "$xt_has_pkg_config" = "no"; then
477          # using AC_CHECK_LIB instead of AC_SEARCH_LIB is fine in this case as
478          # we don't care about the XtOpenDisplay symbol but only about the
479          # existence of libXt
480          AC_CHECK_LIB([Xt], [XtOpenDisplay],
481                       [XT_CFLAGS=""; XT_LIBS="-lXt"],
482                       [AC_MSG_ERROR([X Toolkit Intrinsics library (libXt) not found])])
483       fi
484       AC_SUBST([XT_CFLAGS])
485       AC_SUBST([XT_LIBS])
486       AC_DEFINE([WTF_PLATFORM_X11],[1],[Define if target is X11])
487    fi
488 fi
489 AC_SUBST(GTK_CFLAGS)
490 AC_SUBST(GTK_LIBS)
491 AC_SUBST(CAIRO_CFLAGS)
492 AC_SUBST(CAIRO_LIBS)
493
494 # check whether to build with debugging enabled
495 AC_MSG_CHECKING([whether to do a debug build])
496 AC_ARG_ENABLE(debug,
497               AC_HELP_STRING([--enable-debug],
498                              [turn on debugging [default=no]]),
499               [],[enable_debug="no"])
500 AC_MSG_RESULT([$enable_debug])
501
502 # check whether to enable optimized builds
503 AC_MSG_CHECKING([whether to enable optimized builds])
504 AC_ARG_ENABLE(optimizations,
505               AC_HELP_STRING([--enable-optimizations],
506                              [turn on optimize builds (GCC only)
507                              [default=yes]]),
508               [enable_optimizations=$enableval],
509               [if test "$enable_debug" = "yes"; then enable_optimizations="no"; else enable_optimizations="yes"; fi])
510 AC_MSG_RESULT([$enable_optimizations])
511
512 found_opengl=no
513 AC_ARG_ENABLE(glx,
514               AC_HELP_STRING([--enable-glx], [enable support for GLX [default=auto]]),
515               [], [enable_glx="auto"])
516 AC_ARG_ENABLE(egl,
517               AC_HELP_STRING([--enable-egl], [enable support for EGL [default=auto]]),
518               [], [enable_egl="auto"])
519 AC_ARG_ENABLE(gles2,
520               AC_HELP_STRING([--enable-gles2], [enable support for OpenGL ES 2 [default=auto]]),
521               [], [enable_gles2="auto"])
522
523 have_glx=no
524 AC_CHECK_HEADERS([GL/glx.h], [have_glx="yes"], [have_glx="no"])
525 AC_MSG_CHECKING([whether to enable GLX support])
526 if test "$enable_glx" != "no"; then
527    if test "$have_glx" = "no"; then
528       if test "$enable_glx" = "yes"; then
529          AC_MSG_ERROR([--enable-glx specified, but not available])
530       else
531          enable_glx=no
532       fi
533    elif test "$enable_gles2" != "yes"; then
534       enable_glx=yes
535    fi
536 fi
537 AC_MSG_RESULT([$enable_glx])
538
539 have_egl=no
540 AC_CHECK_HEADERS([EGL/egl.h], [have_egl="yes"], [have_egl="no"])
541 AC_MSG_CHECKING([whether to enable EGL support])
542 if test "$enable_egl" != "no"; then
543    if test "$have_egl" = "no"; then
544       if test "$enable_egl" = "yes"; then
545          AC_MSG_ERROR([--enable-egl specified, but not available])
546       else
547          enable_egl=no
548       fi
549    else
550       enable_egl=yes
551    fi
552 fi
553 AC_MSG_RESULT([$enable_egl])
554
555 have_gles2=no
556 AC_CHECK_HEADERS([GLES2/gl2.h], [have_gles2="yes"], [have_gles2="no"])
557 AC_MSG_CHECKING([whether to use OpenGL ES 2 support])
558 if test "$enable_glx" = "yes"; then
559    if test "$enable_gles2" = "yes"; then
560       AC_MSG_ERROR([Cannot enable OpenGL ES 2 support with GLX])
561    else
562       enable_gles2=no
563    fi
564 fi
565 if test "$enable_egl" = "no"; then
566    if test "$enable_gles2" = "yes"; then
567       AC_MSG_ERROR([Cannot enable OpenGL ES 2 support without EGL])
568    else
569       enable_gles2=no
570    fi
571 fi
572 if test "$enable_gles2" != "no"; then
573    if test "$have_gles2" = "no"; then
574       if test "$enable_gles2" = "yes"; then
575          AC_MSG_ERROR([--enable-gles2 specified, but not available])
576       else
577          enable_gles2=no
578       fi
579    else
580       enable_gles2=yes
581       found_opengl=yes
582    fi
583 fi
584 AC_MSG_RESULT([$enable_gles2])
585
586 if test "$enable_gles2" != "yes"; then
587     AC_CHECK_HEADERS([GL/gl.h], [found_opengl="yes"], [])
588 fi
589
590 AC_MSG_CHECKING([which GPU acceleration backend to use])
591 AC_ARG_WITH(acceleration_backend,
592             AC_HELP_STRING([--with-acceleration-backend=@<:@opengl/clutter/none@:>@],
593                            [Select accelerated backend (Clutter currently unsupported, OpenGL autodetected) [default=autodetect]]), [],
594                            [
595                                 if test "$found_opengl" = "yes"; then
596                                    with_acceleration_backend="opengl";
597                                 else
598                                    with_acceleration_backend="none";
599                                 fi
600                            ])
601 AC_MSG_RESULT([$with_acceleration_backend])
602
603 if test "$with_acceleration_backend" = "opengl"; then
604     PKG_CHECK_MODULES([XCOMPOSITE], [xcomposite]);
605     PKG_CHECK_MODULES([XDAMAGE], [xdamage]);
606     AC_SUBST(XCOMPOSITE_CFLAGS)
607     AC_SUBST(XCOMPOSITE_LIBS)
608     AC_SUBST(XDAMAGE_CFLAGS)
609     AC_SUBST(XDAMAGE_LIBS)
610 fi
611
612 # OpenGL is turned on by default (along with WebGL and accelerated compositing), but if
613 # Clutter is chosen as the accelerated drawing backend, we want to disable it. COGL does 
614 # not play well with OpenGL.
615 AC_MSG_CHECKING([whether to enable WebGL support])
616 AC_ARG_ENABLE(webgl,
617               AC_HELP_STRING([--enable-webgl], [enable support for WebGL [default=check]]), [],
618               [
619                 if test "$with_acceleration_backend" = "opengl"; then
620                     enable_webgl="yes";
621                 else
622                     enable_webgl="no";
623                 fi
624              ])
625 AC_MSG_RESULT([$enable_webgl])
626 if test "$enable_webgl" = "yes" && test "$with_acceleration_backend" != "opengl"; then
627     AC_MSG_ERROR([OpenGL must be active (and Clutter disabled) to use WebGL.])
628 fi;
629
630 AC_MSG_CHECKING([whether to enable accelerated compositing support])
631 AC_ARG_ENABLE(accelerated_compositing,
632             AC_HELP_STRING([--enable-accelerated-compositing], [enable support for accelerated compositing [default=check]]),
633             [
634                 if test "$enableval" = "yes" && test "$with_acceleration_backend" = "none"; then
635                     AC_MSG_ERROR([OpenGL or Clutter must be active to use accelerated compositing.])
636                 fi
637                 enable_accelerated_compositing=$enableval;
638             ],
639             [
640                 if test "$with_acceleration_backend" != "none"; then
641                     enable_accelerated_compositing="yes";
642                 else
643                     enable_accelerated_compositing="no";
644                 fi
645             ])
646 AC_MSG_RESULT([$enable_accelerated_compositing])
647
648 # check whether to enable Gamepad support
649 AC_MSG_CHECKING([whether to enable Gamepad support])
650 AC_ARG_ENABLE(gamepad,
651               AC_HELP_STRING([--enable-gamepad],
652                              [enable Gamepad support [default=no]]),
653               [],[enable_gamepad="no"])
654 AC_MSG_RESULT([$enable_gamepad])
655
656 if test "$enable_gamepad" = "yes" && test "$os_linux" = no; then
657    AC_MSG_WARN([Gamepad support is only available on Linux. Disabling Gamepad support.])
658    enable_gamepad=no;
659 fi
660
661 # check whether to enable HTML5 audio/video support
662 AC_MSG_CHECKING([whether to enable HTML5 video support])
663 AC_ARG_ENABLE(video,
664               AC_HELP_STRING([--enable-video],
665                              [enable HTML5 video support [default=yes]]),
666               [],[enable_video="yes"])
667 AC_MSG_RESULT([$enable_video])
668
669 # check whether to enable media stream support
670 AC_MSG_CHECKING([whether to enable media stream support])
671 AC_ARG_ENABLE(media_stream,
672               AC_HELP_STRING([--enable-media-stream],
673                              [enable media stream support (incomplete) [default=no]]),
674               [],[enable_media_stream="no"])
675 AC_MSG_RESULT([$enable_media_stream])
676
677 # check whether to enable XSLT support
678 AC_MSG_CHECKING([whether to enable XSLT support])
679 AC_ARG_ENABLE(xslt,
680               AC_HELP_STRING([--enable-xslt],
681                              [enable support for XSLT [default=yes]]),
682               [],[enable_xslt="yes"])
683 AC_MSG_RESULT([$enable_xslt])
684
685 # check whether to enable geolocation support
686 AC_MSG_CHECKING([whether to enable geolocation support])
687 AC_ARG_ENABLE(geolocation,
688               AC_HELP_STRING([--enable-geolocation],
689                              [enable support for geolocation [default=yes]]),
690               [],[enable_geolocation="yes"])
691 AC_MSG_RESULT([$enable_geolocation])
692
693 # check whether to enable SVG support
694 AC_MSG_CHECKING([whether to enable SVG support])
695 AC_ARG_ENABLE(svg,
696               AC_HELP_STRING([--enable-svg],
697                              [enable support for SVG [default=yes]]),
698               [],[enable_svg="yes"])
699 AC_MSG_RESULT([$enable_svg])
700
701 # turn off svg features if --disable-svg is requested
702 if test "$enable_svg" = "no"; then
703    enable_svg_fonts=no
704 fi
705
706 # check whether to enable support for SVG fonts
707 AC_MSG_CHECKING([whether to enable support for SVG fonts])
708 AC_ARG_ENABLE(svg_fonts,
709               AC_HELP_STRING([--enable-svg-fonts],
710                              [enable support for SVG fonts (experimental) [default=yes]]),
711               [],[enable_svg_fonts="yes"])
712 AC_MSG_RESULT([$enable_svg_fonts])
713
714 # check for SVG features, enabling SVG if necessary
715 if test "$enable_svg_fonts" = "yes" && test "$enable_svg" = "no"; then
716    AC_MSG_WARN([SVG feature(s) requested but SVG is disabled.. Enabling SVG support])
717    enable_svg=yes
718 fi
719
720 # check whether to enable Web Audio support
721 AC_MSG_CHECKING([whether to enable Web Audio support])
722 AC_ARG_ENABLE(web_audio,
723               AC_HELP_STRING([--enable-web-audio],
724                              [enable support for Web Audio [default=no]]),
725               [],[enable_web_audio="no"])
726 AC_MSG_RESULT([$enable_web_audio])
727
728 # check whether to enable code coverage
729 AC_MSG_CHECKING([whether to enable code coverage support])
730 AC_ARG_ENABLE(coverage,
731               AC_HELP_STRING([--enable-coverage],
732                              [enable code coverage support [default=no]]),
733               [],[enable_coverage="no"])
734 AC_MSG_RESULT([$enable_coverage])
735
736 # check whether to enable FastMalloc
737 AC_MSG_CHECKING([whether to enable optimized memory allocator])
738 AC_ARG_ENABLE(fast_malloc,
739               AC_HELP_STRING([--enable-fast-malloc],
740                              [enable optimized memory allocator default=yes, default=no for debug builds]),
741               [],[if test "$enable_debug" = "yes"; then enable_fast_malloc="no"; else enable_fast_malloc="yes"; fi])
742 AC_MSG_RESULT([$enable_fast_malloc])
743
744 # check whether to enable debug symbols
745 AC_MSG_CHECKING([whether to enable debug symbols])
746 AC_ARG_ENABLE(debug_symbols,
747               AC_HELP_STRING([--enable-debug-symbols=yes|no|min|full],
748                              [enable debug symbols default=no, default=yes for debug builds]),
749               [],[if test "$enable_debug" = "yes"; then enable_debug_symbols="yes"; else enable_debug_symbols="no"; fi])
750
751 case "$enable_debug_symbols" in
752   yes) enable_debug_symbols="full" ;;
753   no|min|full) ;;
754   *) AC_MSG_ERROR([Invalid debug symbols option: must be yes, no, min or full.]) ;;
755 esac
756 AC_MSG_RESULT([$enable_debug_symbols])
757
758 #selecting GStreamer version
759 AC_MSG_CHECKING([the GStreamer version to use])
760 AC_ARG_WITH([gstreamer],
761         [AS_HELP_STRING([--with-gstreamer=1.0|0.10|auto], [the GStreamer version to use (default: auto, tries 1.0 first, 0.10 is fallback)])],
762         [case "$with_gstreamer" in
763         0.10|1.0|auto) ;;
764         *) AC_MSG_ERROR([invalid GStreamer version specified]) ;;
765         esac],
766         [with_gstreamer=auto])
767 AC_MSG_RESULT([$with_gstreamer])
768
769 GSTREAMER_0_10_REQUIRED_VERSION=0.10
770 GSTREAMER_0_10_PLUGINS_BASE_REQUIRED_VERSION=0.10.30
771 GSTREAMER_1_0_REQUIRED_VERSION=1.0.3
772 GSTREAMER_1_0_PLUGINS_BASE_REQUIRED_VERSION=1.0.3
773
774 if test "$enable_video" = "yes" || test "$enable_web_audio" = "yes"; then
775    if test "$with_gstreamer" = "auto"; then
776        gstreamer_modules="gstreamer-1.0 >= $GSTREAMER_1_0_REQUIRED_VERSION
777                           gstreamer-app-1.0
778                           gstreamer-audio-1.0
779                           gstreamer-fft-1.0
780                           gstreamer-base-1.0
781                           gstreamer-pbutils-1.0
782                           gstreamer-plugins-base-1.0 >= $GSTREAMER_1_0_PLUGINS_BASE_REQUIRED_VERSION
783                           gstreamer-video-1.0";
784        PKG_CHECK_MODULES([GSTREAMER_1_0], [$gstreamer_modules], [with_gstreamer=1.0], [with_gstreamer=0.10])
785        AC_MSG_NOTICE([Selected GStreamer $with_gstreamer])
786    fi
787 else
788    if test "$with_gstreamer" != "auto"; then
789        AC_MSG_WARN([You have specified GStreamer $with_gstreamer version but it will not be used because neither HTML5 Video nor Web Audio are enabled])
790    fi
791 fi
792
793 case "$with_gstreamer" in
794      0.10) GSTREAMER_REQUIRED_VERSION=$GSTREAMER_0_10_REQUIRED_VERSION
795            GSTREAMER_PLUGINS_BASE_REQUIRED_VERSION=$GSTREAMER_0_10_PLUGINS_BASE_REQUIRED_VERSION
796            GST_API_VERSION=0.10
797            ;;
798      1.0) GSTREAMER_REQUIRED_VERSION=$GSTREAMER_1_0_REQUIRED_VERSION
799            GSTREAMER_PLUGINS_BASE_REQUIRED_VERSION=$GSTREAMER_1_0_PLUGINS_BASE_REQUIRED_VERSION
800            GST_API_VERSION=1.0
801            ;;
802 esac
803
804 AC_SUBST([GST_API_VERSION])
805 if test "$GST_API_VERSION" = "1.0"; then
806    AC_DEFINE([GST_API_VERSION_1],[1], [Using GStreamer 1.0])
807 fi
808
809 # check whether to enable debug features
810 AC_MSG_CHECKING([whether to enable debug features])
811 AC_ARG_ENABLE(debug_features,
812               AC_HELP_STRING([--enable-debug-features],
813                              [enable debug features default=no, default=yes for debug builds]),
814               [],[if test "$enable_debug" = "yes"; then enable_debug_features="yes"; else enable_debug_features="no"; fi])
815 AC_MSG_RESULT([$enable_debug_features])
816
817 AC_MSG_CHECKING([whether to enable JIT compilation])
818 AC_ARG_ENABLE(jit,
819               AS_HELP_STRING([--enable-jit],
820                              [Enable JIT compilation (default: autodetect)]))
821 case "$enable_jit" in
822   yes) JSC_CPPFLAGS="-DENABLE_JIT=1" ;;
823   no) JSC_CPPFLAGS="-DENABLE_JIT=0" ;;
824   *) enable_jit="autodetect" ;;
825 esac
826 AC_SUBST(JSC_CPPFLAGS)
827 AC_MSG_RESULT([$enable_jit])
828
829 # Opcode stats
830 AC_MSG_CHECKING([whether to enable opcode stats])
831 AC_ARG_ENABLE([opcode-stats],
832   [AS_HELP_STRING([--enable-opcode-stats], [Enable Opcode statistics (default: disabled)])],
833   [], [enable_opcode_stats=no])
834 AC_MSG_RESULT([$enable_opcode_stats])
835
836 if test "$enable_opcode_stats" = "yes"; then
837   if test "$enable_jit" = "yes"; then
838     AC_MSG_ERROR([JIT must be disabled for Opcode stats to work.])
839   fi
840   AC_DEFINE([ENABLE_OPCODE_STATS], [1], [Define to enable Opcode statistics])
841 fi
842
843 # GObject Introspection
844 AC_MSG_CHECKING([whether to enable GObject introspection support])
845 AC_ARG_ENABLE([introspection],
846   [AS_HELP_STRING([--enable-introspection],[Enable GObject introspection (default: disabled)])],
847   [],[enable_introspection=no])
848 AC_MSG_RESULT([$enable_introspection])
849
850 # Enable CSS Filters and Shaders if accelerated_compositing is turned on.
851 enable_css_filters=no;
852 enable_css_shaders=no;
853 AC_MSG_CHECKING([whether to enable CSS Filters and Shaders])
854 if test "$enable_accelerated_compositing" = "yes" && test "$with_acceleration_backend" = "opengl"; then
855     enable_css_filters=yes;
856     enable_css_shaders=yes;
857 fi
858 AC_MSG_RESULT([$enable_css_filters])
859
860 G_IR_SCANNER=
861 G_IR_COMPILER=
862 G_IR_GENERATE=
863 GIRDIR=
864 GIRTYPELIBDIR=
865
866 if test "$enable_introspection" = "yes"; then
867   GOBJECT_INTROSPECTION_REQUIRED=0.9.5
868   PKG_CHECK_MODULES([INTROSPECTION],[gobject-introspection-1.0 >= $GOBJECT_INTROSPECTION_REQUIRED])
869   
870   G_IR_SCANNER="$($PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0)"
871   G_IR_COMPILER="$($PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0)"
872   G_IR_GENERATE="$($PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0)"
873   AC_DEFINE([ENABLE_INTROSPECTION],[1],[Define to enable GObject introspection support])
874 fi
875
876 AC_SUBST([G_IR_SCANNER])
877 AC_SUBST([G_IR_COMPILER])
878 AC_SUBST([G_IR_GENERATE])
879
880 if test "$host_cpu" = "sh4"; then
881    CXXFLAGS="$CXXFLAGS -mieee -w"
882    CFLAGS="$CFLAGS -mieee -w"
883 fi
884
885 # Add '-g' flag to gcc to build with debug symbols
886 if test "$enable_debug_symbols" = "min"; then
887    CXXFLAGS="$CXXFLAGS -g1"
888    CFLAGS="$CFLAGS -g1"
889 elif test "$enable_debug_symbols" != "no"; then
890    CXXFLAGS="$CXXFLAGS -g"
891    CFLAGS="$CFLAGS -g"
892 fi
893
894 if test "$enable_debug_features" = "no"; then
895    AC_DEFINE([NDEBUG], [1], [Define to disable debugging features])
896 fi
897
898 # Add the appropriate 'O' level for optimized builds
899 if test "$enable_optimizations" = "yes"; then
900    CXXFLAGS="$CXXFLAGS -O2"
901    CFLAGS="$CFLAGS -O2"
902 else
903    CXXFLAGS="$CXXFLAGS -O0"
904    CFLAGS="$CFLAGS -O0"
905 fi
906
907 PKG_CHECK_MODULES([LIBSOUP],
908                   [libsoup-2.4 >= $LIBSOUP_REQUIRED_VERSION])
909 AC_SUBST([LIBSOUP_CFLAGS])
910 AC_SUBST([LIBSOUP_LIBS])
911
912 PKG_CHECK_MODULES([LIBSECRET], [libsecret-1])
913 AC_SUBST([LIBSECRET_CFLAGS])
914 AC_SUBST([LIBSECRET_LIBS])
915
916 # check if FreeType/FontConfig are available
917 if test "$with_target" = "directfb"; then
918 PKG_CHECK_MODULES([FREETYPE],
919                   [fontconfig >= $FONTCONFIG_REQUIRED_VERSION
920                   freetype2 >= $FREETYPE2_REQUIRED_VERSION
921                   harfbuzz])
922 else
923 PKG_CHECK_MODULES([FREETYPE],
924                   [cairo-ft
925                   fontconfig >= $FONTCONFIG_REQUIRED_VERSION
926                   freetype2 >= $FREETYPE2_REQUIRED_VERSION
927                   harfbuzz])
928 fi
929 AC_SUBST([FREETYPE_CFLAGS])
930 AC_SUBST([FREETYPE_LIBS])
931
932 # check if SQLite3 is available. Error out only if one of the
933 # features hard-depending on it is enabled while SQLite3 is
934 # unavailable.
935 PKG_CHECK_MODULES([SQLITE3],
936                   [sqlite3 >= $SQLITE_REQUIRED_VERSION],
937                   [sqlite3_has_pkg_config=yes],
938                   [sqlite3_has_pkg_config=no])
939 if test "$sqlite3_has_pkg_config" = "no"; then
940    AC_SEARCH_LIBS([sqlite3_open16], [sqlite3],
941                   [sqlite3_found=yes;SQLITE3_LIBS="$LIBS";SQLITE3_CFLAGS="-I $srcdir/WebKitLibraries/WebCoreSQLite3"],
942                   [sqlite3_found=no])
943 fi
944 AC_SUBST([SQLITE3_CFLAGS])
945 AC_SUBST([SQLITE3_LIBS])
946
947 if (test "$sqlite3_found" = "no"); then
948    AC_MSG_ERROR([SQLite3 is required for the Database related features])
949 fi
950
951 # check if libxslt is available
952 if test "$enable_xslt" = "yes"; then
953    PKG_CHECK_MODULES([LIBXSLT],[libxslt >= $LIBXSLT_REQUIRED_VERSION])
954    AC_SUBST([LIBXSLT_CFLAGS])
955    AC_SUBST([LIBXSLT_LIBS])
956 fi
957
958 # check if geoclue is available
959 if test "$enable_geolocation" = "yes"; then
960     PKG_CHECK_MODULES([GEOCLUE], [geoclue])
961     AC_SUBST([GEOCLUE_CFLAGS])
962     AC_SUBST([GEOCLUE_LIBS])
963 fi
964
965 # check for XRender under Linux/Unix. Some linkers require explicit
966 # linkage (like GNU Gold), so we cannot rely on GTK+ pulling XRender
967 if test "$os_win32" = "no"; then
968    PKG_CHECK_MODULES([XRENDER], [xrender])
969    AC_SUBST([XRENDER_CFLAGS])
970    AC_SUBST([XRENDER_LIBS])
971 fi
972
973 # check if gstreamer is available
974 if test "$enable_video" = "yes" || test "$enable_web_audio" = "yes"; then
975     gstreamer_modules="gstreamer-$GST_API_VERSION >= $GSTREAMER_REQUIRED_VERSION
976                        gstreamer-app-$GST_API_VERSION
977                        gstreamer-audio-$GST_API_VERSION
978                        gstreamer-fft-$GST_API_VERSION
979                        gstreamer-base-$GST_API_VERSION
980                        gstreamer-pbutils-$GST_API_VERSION
981                        gstreamer-plugins-base-$GST_API_VERSION >= $GSTREAMER_PLUGINS_BASE_REQUIRED_VERSION
982                        gstreamer-video-$GST_API_VERSION";
983    if test "$GST_API_VERSION" != "1.0"; then
984        gstreamer_modules="$gstreamer_modules gstreamer-interfaces-$GST_API_VERSION";
985    fi
986    PKG_CHECK_MODULES([GSTREAMER], [$gstreamer_modules], [have_gstreamer=yes])
987    AC_SUBST([GSTREAMER_CFLAGS])
988    AC_SUBST([GSTREAMER_LIBS])
989 fi
990
991 # farstream-0.1 depends on gstreamer 0.10 currently. Disable
992 # media_stream if gstreamer 1.0 build support is enabled.
993 if test "$have_gstreamer" != "yes" || test "$GST_API_VERSION" = "1.0"; then
994    if test "$enable_media_stream" = "yes"; then
995       AC_MSG_WARN([Disabling Media Stream because no GStreamer 0.10 support is enabled])
996    fi
997    enable_media_stream=false
998 fi
999 if test "$enable_media_stream" = "yes"; then
1000    PKG_CHECK_MODULES([FARSTREAM], [farstream-0.1],
1001                      [have_farstream=yes], [enable_media_stream=false])
1002    AC_SUBST([FARSTREAM_CFLAGS])
1003    AC_SUBST([FARSTREAM_LIBS])
1004 fi
1005
1006 acceleration_backend_description=$with_acceleration_backend
1007 if test "$with_acceleration_backend" = "clutter"; then
1008    PKG_CHECK_MODULES(CLUTTER, clutter-1.0 >= $CLUTTER_REQUIRED_VERSION)
1009    PKG_CHECK_MODULES([CLUTTER_GTK],
1010                      [clutter-gtk-1.0 >= $CLUTTER_GTK_REQUIRED_VERSION])
1011
1012    AC_SUBST(CLUTTER_CFLAGS)
1013    AC_SUBST(CLUTTER_LIBS)
1014    AC_SUBST(CLUTTER_GTK_CFLAGS)
1015    AC_SUBST(CLUTTER_GTK_LIBS)
1016
1017    enable_gles2=no
1018    enable_glx=no
1019    enable_egl=no
1020 fi
1021
1022 if test "$with_acceleration_backend" = "opengl"; then
1023    if test "$enable_gles2" = "yes"; then
1024     acceleration_backend_description+= "(gles2"
1025     OPENGL_LIBS="-lGLESv2"
1026    else
1027     acceleration_backend_description+="(gl"
1028     OPENGL_LIBS="-lGL"
1029    fi
1030    if test "$enable_egl" = "yes"; then
1031     acceleration_backend_description+=", egl"
1032     OPENGL_LIBS+=" -lEGL"
1033    fi
1034    if test "$enable_glx" = "yes"; then
1035     acceleration_backend_description+=", glx"
1036    fi
1037    OPENGL_LIBS+=" $DLOPEN_LIBS"
1038    acceleration_backend_description+=")"
1039 fi
1040 AC_SUBST([OPENGL_LIBS])
1041
1042 if test "$enable_gamepad" = "yes"; then
1043    PKG_CHECK_MODULES([GAMEPAD], [gio-unix-2.0 gudev-1.0])
1044
1045    AC_SUBST(GAMEPAD_CFLAGS)
1046    AC_SUBST(GAMEPAD_LIBS)
1047 fi
1048
1049 # check for code coverage support
1050 if test "$enable_coverage" = "yes"; then
1051    COVERAGE_CFLAGS="-MD"
1052    COVERAGE_LDFLAGS="-ftest-coverage -fprofile-arcs"
1053    AC_SUBST([COVERAGE_CFLAGS])
1054    AC_SUBST([COVERAGE_LDFLAGS])
1055 fi
1056
1057 # WebKit1
1058 AC_MSG_CHECKING([whether to build WebKit1])
1059 AC_ARG_ENABLE(webkit1,
1060     AC_HELP_STRING([--enable-webkit1], [build WebKit1 [default=yes]]),
1061     [], [enable_webkit1="yes"])
1062
1063 # WebKit2
1064 # If you change the default here, please also make sure the assumptions made
1065 # in Tools/Scripts/webkitdirs.pm:buildAutotoolsProject still make sense.
1066 AC_MSG_CHECKING([whether to build WebKit2])
1067 AC_ARG_ENABLE(webkit2,
1068     AC_HELP_STRING([--enable-webkit2], [build WebKit2 [default=yes]]),
1069     [], [enable_webkit2="yes"])
1070 AC_MSG_RESULT([$enable_webkit2])
1071 if test "$enable_webkit2" = "yes"; then
1072     if test "$GTK_API_VERSION" = "2.0"; then
1073         AC_MSG_ERROR([WebKit2 requires GTK+ 3.x, use --with-gtk=3.0])
1074     fi
1075
1076     # Make sure we have GTK+ 2.x to build the plugin process.
1077     PKG_CHECK_MODULES(GTK2, gtk+-2.0 >= $GTK2_REQUIRED_VERSION gail >= $GAIL2_REQUIRED_VERSION)
1078     AC_SUBST(GTK2_CFLAGS)
1079     AC_SUBST(GTK2_LIBS)
1080
1081     # Check Unix printing
1082     PKG_CHECK_MODULES(GTK_UNIX_PRINTING, gtk+-unix-print-3.0,
1083                      [have_gtk_unix_printing=yes],
1084                      [have_gtk_unix_printing=no])
1085     AC_SUBST(GTK_UNIX_PRINTING_CFLAGS)
1086     AC_SUBST(GTK_UNIX_PRINTING_LIBS)
1087     if test "$have_gtk_unix_printing" = "yes"; then
1088         AC_DEFINE([HAVE_GTK_UNIX_PRINTING], [1], [Define if GTK+ UNIX Printing is available])
1089     fi
1090
1091     # On some Linux/Unix platforms, shm_* may only be available if linking
1092     # against librt
1093     if test "$os_win32" = "no"; then
1094         AC_SEARCH_LIBS([shm_open], [rt], [SHM_LIBS="-lrt"])
1095         AC_SUBST(SHM_LIBS)
1096     fi
1097 fi
1098
1099 GTK_DOC_CHECK([1.10])
1100
1101 # We need atspi2 for Webkit2 unit tests
1102 if test "$enable_webkit2" = "yes"; then
1103    PKG_CHECK_MODULES([ATSPI2],
1104                      [atspi-2 >= $ATSPI2_REQUIRED_VERSION],
1105                      [have_atspi2=yes], [have_atspi2=no])
1106
1107    AC_SUBST([ATSPI2_CFLAGS])
1108    AC_SUBST([ATSPI2_LIBS])
1109 fi
1110
1111 # For the moment we need to check whether or not indexed database
1112 # is enabled because it determines if we build leveldb or not.
1113 AM_WEBKIT_FEATURE_CONDITIONAL([ENABLE_INDEXED_DATABASE])
1114
1115 # OS conditionals
1116 AM_CONDITIONAL([OS_WIN32],[test "$os_win32" = "yes"])
1117 AM_CONDITIONAL([OS_UNIX],[test "$os_win32" = "no"])
1118 AM_CONDITIONAL([OS_LINUX],[test "$os_linux" = "yes"])
1119 AM_CONDITIONAL([OS_GNU],[test "$os_gnu" = "yes"])
1120 AM_CONDITIONAL([OS_FREEBSD],[test "$os_freebsd" = "yes"])
1121
1122 # target conditionals
1123 AM_CONDITIONAL([TARGET_X11], [test "$with_target" = "x11"])
1124 AM_CONDITIONAL([TARGET_WIN32], [test "$with_target" = "win32"])
1125 AM_CONDITIONAL([TARGET_QUARTZ], [test "$with_target" = "quartz"])
1126 AM_CONDITIONAL([TARGET_DIRECTFB], [test "$with_target" = "directfb"])
1127
1128 # Unicode backend conditionals
1129 AM_CONDITIONAL([USE_ICU_UNICODE], [test "$with_unicode_backend" = "icu"])
1130 AM_CONDITIONAL([USE_GLIB_UNICODE], [test "$with_unicode_backend" = "glib"])
1131
1132 # GStreamer feature conditional
1133 AM_CONDITIONAL([USE_GSTREAMER], [test "$have_gstreamer" = "yes"])
1134 AM_CONDITIONAL([USE_WEBAUDIO_GSTREAMER], [test "$enable_web_audio" = "yes"])
1135
1136 # ATSPI2 conditional
1137 AM_CONDITIONAL([HAVE_ATSPI2], [test "$have_atspi2" = "yes"])
1138
1139 # Accelerated compositing conditional
1140 AM_CONDITIONAL([USE_ACCELERATED_COMPOSITING], [test "$enable_accelerated_compositing" = "yes"])
1141 AM_CONDITIONAL([USE_TEXTURE_MAPPER_CAIRO], [test "$enable_accelerated_compositing" = "yes" && test "$with_acceleration_backend" = "none"])
1142 AM_CONDITIONAL([USE_TEXTURE_MAPPER_GL], [test "$enable_accelerated_compositing" = "yes" && test "$with_acceleration_backend" = "opengl"])
1143 AM_CONDITIONAL([USE_CLUTTER], [test "$with_acceleration_backend" = "clutter"])
1144
1145 # These are the same now, but they will soon be separate.
1146 AM_CONDITIONAL([USE_OPENGL], [test "$with_acceleration_backend" = "opengl"])
1147 AM_CONDITIONAL([USE_EGL], [test "$enable_egl" = "yes"])
1148 AM_CONDITIONAL([USE_GLES2], [test "$enable_gles2" = "yes"])
1149 AM_CONDITIONAL([USE_GLX], [test "$enable_glx" = "yes"])
1150
1151 # Farstream feature conditional
1152 AM_CONDITIONAL([USE_FARSTREAM], [test "$have_farstream" = "yes"])
1153
1154 # WebKit feature conditionals
1155 AM_CONDITIONAL([ENABLE_DEBUG],[test "$enable_debug_features" = "yes"])
1156 AM_CONDITIONAL([ENABLE_WEBGL],[test "$enable_webgl" = "yes"])
1157 AM_CONDITIONAL([ENABLE_GAMEPAD],[test "$enable_gamepad" = "yes"])
1158 AM_CONDITIONAL([ENABLE_XSLT],[test "$enable_xslt" = "yes"])
1159 AM_CONDITIONAL([ENABLE_GEOLOCATION], [test "$enable_geolocation" = "yes"])
1160 AM_CONDITIONAL([ENABLE_VIDEO],[test "$enable_video" = "yes"])
1161 AM_CONDITIONAL([ENABLE_MEDIA_STREAM],[test "$enable_media_stream" = "yes"])
1162 AM_CONDITIONAL([ENABLE_SVG],[test "$enable_svg" = "yes"])
1163 AM_CONDITIONAL([ENABLE_SVG_FONTS],[test "$enable_svg_fonts" = "yes"])
1164 AM_CONDITIONAL([ENABLE_COVERAGE],[test "$enable_coverage" = "yes"])
1165 AM_CONDITIONAL([ENABLE_FAST_MALLOC],[test "$enable_fast_malloc" = "yes"])
1166 AM_CONDITIONAL([ENABLE_WEB_AUDIO],[test "$enable_web_audio" = "yes"])
1167 AM_CONDITIONAL([ENABLE_OPCODE_STATS],[test "$enable_opcode_stats" = "yes"])
1168 AM_CONDITIONAL([ENABLE_WEBKIT1],[test "$enable_webkit1" = "yes"])
1169 AM_CONDITIONAL([ENABLE_WEBKIT2],[test "$enable_webkit2" = "yes"])
1170 AM_CONDITIONAL([ENABLE_SPELLCHECK],[test "$enable_spellcheck" = "yes"])
1171 AM_CONDITIONAL([ENABLE_CSS_FILTERS],[test "$enable_css_filters" = "yes"])
1172 AM_CONDITIONAL([ENABLE_CSS_SHADERS],[test "$enable_css_shaders" = "yes"])
1173
1174 # Gtk conditionals
1175 AM_CONDITIONAL([ENABLE_INTROSPECTION],[test "$enable_introspection" = "yes"])
1176
1177 AC_CONFIG_FILES([
1178 GNUmakefile
1179 ])
1180
1181 AC_CONFIG_FILES([
1182 DerivedSources/WebCore/UserAgentGtk.h:Source/WebCore/platform/gtk/UserAgentGtk.h.in
1183 ])
1184
1185 AC_CONFIG_FILES([
1186 Source/JavaScriptCore/javascriptcoregtk-${WEBKITGTK_API_VERSION}.pc:Source/JavaScriptCore/javascriptcoregtk.pc.in
1187 Source/WebKit/gtk/JSCore-${WEBKITGTK_API_VERSION}.gir:Source/WebKit/gtk/JSCore.gir.in
1188 ]
1189 ,[WEBKITGTK_API_VERSION=$WEBKITGTK_API_VERSION,WEBKITGTK_PC_NAME=$WEBKITGTK_PC_NAME]
1190 )
1191
1192 if test "$enable_webkit1" = "yes"; then
1193     AC_CONFIG_FILES([
1194     Source/WebKit/gtk/webkit/webkitversion.h
1195     Source/WebKit/gtk/po/POTFILES
1196     ])
1197
1198     AC_CONFIG_FILES([
1199     Source/WebKit/gtk/${WEBKITGTK_PC_NAME}-${WEBKITGTK_API_VERSION}.pc:Source/WebKit/gtk/webkit.pc.in
1200     ]
1201     ,[WEBKITGTK_API_VERSION=$WEBKITGTK_API_VERSION,WEBKITGTK_PC_NAME=$WEBKITGTK_PC_NAME]
1202     )
1203 fi
1204
1205 if test "$enable_webkit2" = "yes"; then
1206     AC_CONFIG_FILES([
1207     DerivedSources/WebKit2/webkit2gtk/webkit2/WebKitVersion.h:Source/WebKit2/UIProcess/API/gtk/WebKitVersion.h.in
1208     ])
1209
1210     AC_CONFIG_FILES([
1211     Source/WebKit2/webkit2gtk-${WEBKITGTK_API_VERSION}.pc:Source/WebKit2/webkit2gtk.pc.in
1212     ]
1213     ,[WEBKITGTK_API_VERSION=$WEBKITGTK_API_VERSION,WEBKITGTK_PC_NAME=$WEBKITGTK_PC_NAME]
1214     )
1215 fi
1216
1217 AC_OUTPUT
1218
1219 echo "
1220 WebKit was configured with the following options:
1221
1222 Build configuration:
1223  Enable debugging (slow)                                  : $enable_debug
1224  Compile with debug symbols (slow)                        : $enable_debug_symbols
1225  Enable debug features (slow)                             : $enable_debug_features
1226  Enable GCC build optimization                            : $enable_optimizations
1227  Code coverage support                                    : $enable_coverage
1228  Unicode backend                                          : $with_unicode_backend
1229  Optimized memory allocator                               : $enable_fast_malloc
1230  Accelerated rendering backend                            : $acceleration_backend_description
1231
1232 Features:
1233 =======
1234  WebKit1 support                                          : $enable_webkit1
1235  WebKit2 support                                          : $enable_webkit2
1236  Accelerated Compositing                                  : $enable_accelerated_compositing
1237  Gamepad support                                          : $enable_gamepad
1238  Geolocation support                                      : $enable_geolocation
1239  HTML5 video element support                              : $enable_video
1240  JIT compilation                                          : $enable_jit
1241  Media stream support                                     : $enable_media_stream
1242  Opcode stats                                             : $enable_opcode_stats
1243  SVG fonts support                                        : $enable_svg_fonts
1244  SVG support                                              : $enable_svg
1245  Spellcheck support                                       : $enable_spellcheck
1246  Web Audio support                                        : $enable_web_audio
1247  WebGL                                                    : $enable_webgl
1248  XSLT support                                             : $enable_xslt
1249
1250
1251 GTK+ configuration:
1252  GTK+ version                                             : $with_gtk
1253  GDK target                                               : $with_target
1254  GStreamer version                                        : $with_gstreamer
1255  Introspection support                                    : $enable_introspection
1256  Generate documentation                                   : $enable_gtk_doc
1257 "
1258 if test "$with_unicode_backend" = "glib"; then
1259    echo "     >> WARNING: the glib-based unicode backend is slow and incomplete <<"
1260    echo
1261    echo
1262 fi