Fix a typo in my previous commit that is causing test failures.
[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], [2])
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], [20])
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=17:1:17
39 AC_SUBST([LIBWEBKITGTK_VERSION])
40
41 LIBJAVASCRIPTCOREGTK_VERSION=13:7:13
42 AC_SUBST([LIBJAVASCRIPTCOREGTK_VERSION])
43
44 LIBWEBKIT2GTK_VERSION=19:0:19
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
271 if test "$os_win32" = "yes"; then
272   WINMM_LIBS=-lwinmm
273   SHLWAPI_LIBS=-lshlwapi
274   OLE32_LIBS=-lole32
275 fi
276 AC_SUBST([WINMM_LIBS])
277 AC_SUBST([SHLWAPI_LIBS])
278 AC_SUBST([OLE32_LIBS])
279
280
281 # determine the GTK+ version to use
282 AC_MSG_CHECKING([the GTK+ version to use])
283 AC_ARG_WITH([gtk],
284         [AS_HELP_STRING([--with-gtk=2.0|3.0], [the GTK+ version to use (default: 3.0)])],
285         [case "$with_gtk" in
286         2.0|3.0) ;;
287         *) AC_MSG_ERROR([invalid GTK+ version specified]) ;;
288         esac],
289         [with_gtk=3.0])
290 AC_MSG_RESULT([$with_gtk])
291
292 GTK2_REQUIRED_VERSION=2.10
293 GAIL2_REQUIRED_VERSION=1.8
294 GTK3_REQUIRED_VERSION=3.4.0
295 GAIL3_REQUIRED_VERSION=3.0
296
297 case "$with_gtk" in
298      2.0) GTK_REQUIRED_VERSION=$GTK2_REQUIRED_VERSION
299           GTK_API_VERSION=2.0
300           WEBKITGTK_API_MAJOR_VERSION=1
301           WEBKITGTK_API_MINOR_VERSION=0
302           WEBKITGTK_API_VERSION=1.0
303           WEBKITGTK_PC_NAME=webkit
304           GAIL_PC_NAME=gail
305           GAIL_REQUIRED_VERSION=$GAIL2_REQUIRED_VERSION
306           ;;
307      3.0) GTK_REQUIRED_VERSION=$GTK3_REQUIRED_VERSION
308           GTK_API_VERSION=3.0
309           WEBKITGTK_API_MAJOR_VERSION=3
310           WEBKITGTK_API_MINOR_VERSION=0
311           WEBKITGTK_API_VERSION=3.0
312           WEBKITGTK_PC_NAME=webkitgtk
313           GAIL_PC_NAME=gail-3.0
314           GAIL_REQUIRED_VERSION=$GAIL3_REQUIRED_VERSION
315           ;;
316 esac
317
318 AC_SUBST([WEBKITGTK_API_MAJOR_VERSION])
319 AC_SUBST([WEBKITGTK_API_MINOR_VERSION])
320 AC_SUBST([WEBKITGTK_API_VERSION])
321 AC_SUBST([WEBKITGTK_PC_NAME])
322 AC_SUBST([GTK_API_VERSION])
323 AM_CONDITIONAL([GTK_API_VERSION_2],[test "$GTK_API_VERSION" = "2.0"])
324
325 # determine the GDK/GTK+ target
326 AC_MSG_CHECKING([the target windowing system])
327 AC_ARG_WITH(target,
328             AC_HELP_STRING([--with-target=@<:@x11/win32/quartz/directfb@:>@],
329                            [Select webkit target [default=x11]]),
330             [],[with_target="x11"])
331
332 case "$with_target" in
333      x11|win32|quartz|directfb) ;;
334      *) AC_MSG_ERROR([Invalid target: must be x11, quartz, win32, or directfb.]) ;;
335 esac
336
337 AC_MSG_RESULT([$with_target])
338
339 # minimum base dependencies
340 CAIRO_REQUIRED_VERSION=1.10
341 FONTCONFIG_REQUIRED_VERSION=2.4
342 FREETYPE2_REQUIRED_VERSION=9.0
343 GLIB_REQUIRED_VERSION=2.32.0
344 LIBSOUP_REQUIRED_VERSION=2.40.0
345 LIBXML_REQUIRED_VERSION=2.6
346 PANGO_REQUIRED_VERSION=1.21.0
347
348 # optional modules
349 LIBXSLT_REQUIRED_VERSION=1.1.7
350 SQLITE_REQUIRED_VERSION=3.0
351 ENCHANT_REQUIRED_VERSION=0.22
352 CLUTTER_REQUIRED_VERSION=1.8.2
353 CLUTTER_GTK_REQUIRED_VERSION=1.0.2
354 ATSPI2_REQUIRED_VERSION=2.2.1
355
356 # Check for glib and required utilities
357 AM_PATH_GLIB_2_0($GLIB_REQUIRED_VERSION, :, :, gmodule gobject gthread gio)
358 if test -z "$GLIB_GENMARSHAL" || test -z "$GLIB_MKENUMS"; then
359    AC_MSG_ERROR([You need the GLib dev tools in your path])
360 fi
361
362 # GResources
363 GLIB_COMPILE_RESOURCES=`$PKG_CONFIG --variable glib_compile_resources gio-2.0`
364 AC_SUBST(GLIB_COMPILE_RESOURCES)
365
366 GLIB_GSETTINGS
367
368 # Check and identify which unicode backend to use
369 AC_MSG_CHECKING([which Unicode backend to use])
370 AC_ARG_WITH(unicode_backend,
371             AC_HELP_STRING([--with-unicode-backend=@<:@icu/glib@:>@],
372                            [Select Unicode backend (WARNING: the glib-based backend is slow, and incomplete) [default=icu]]),
373             [],[with_unicode_backend="icu"])
374
375 case "$with_unicode_backend" in
376      icu|glib) ;;
377      *) AC_MSG_ERROR([Invalid Unicode backend: must be icu or glib.]) ;;
378 esac
379
380 AC_MSG_RESULT([$with_unicode_backend])
381
382 if test "$with_unicode_backend" = "icu"; then
383     # TODO: use pkg-config (after CFLAGS in their .pc files are cleaned up)
384     case "$host" in
385         *-*-darwin*)
386             UNICODE_CFLAGS="-I$srcdir/Source/JavaScriptCore/icu -I$srcdir/Source/WebCore/icu"
387             UNICODE_LIBS="-licucore"
388             ;;
389         *-*-mingw*)
390             UNICODE_CFLAGS=""
391             UNICODE_LIBS="-licui18n -licuuc"
392             ;;
393         *)
394             AC_PATH_PROG(icu_config, icu-config, no)
395             if test "$icu_config" = "no"; then
396                 AC_MSG_ERROR([Cannot find icu-config. The ICU library is needed.])
397             fi
398
399             # We don't use --cflags as this gives us a lot of things that we don't
400             # necessarily want, like debugging and optimization flags
401             # See man (1) icu-config for more info.
402             UNICODE_CFLAGS=`$icu_config --cppflags`
403             UNICODE_LIBS=`$icu_config --ldflags-libsonly`
404             ;;
405     esac
406 fi
407
408 if test "$with_unicode_backend" = "glib"; then
409     PKG_CHECK_MODULES([UNICODE], [glib-2.0 pango >= $PANGO_REQUIRED_VERSION])
410 fi
411
412 AC_SUBST([UNICODE_CFLAGS])
413 AC_SUBST([UNICODE_LIBS])
414
415 PKG_CHECK_MODULES([ZLIB], [zlib])
416 AC_SUBST([ZLIB_CFLAGS])
417 AC_SUBST([ZLIB_LIBS])
418
419 GETTEXT_PACKAGE=$PACKAGE-$GTK_API_VERSION
420 AC_SUBST(GETTEXT_PACKAGE)
421 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",
422                    [The gettext catalog name])
423
424 PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= $LIBXML_REQUIRED_VERSION)
425 AC_SUBST(LIBXML_CFLAGS)
426 AC_SUBST(LIBXML_LIBS)
427
428 PKG_CHECK_MODULES(PANGO, 
429                   [pango >= $PANGO_REQUIRED_VERSION
430                    pangoft2])
431 AC_SUBST(PANGO_CFLAGS)
432 AC_SUBST(PANGO_LIBS)
433
434 AC_MSG_CHECKING([whether to enable spellcheck support])
435 AC_ARG_ENABLE([spellcheck],
436   [AS_HELP_STRING([--enable-spellcheck],[enable support for spellcheck])],
437   [],[enable_spellcheck="yes"])
438 AC_MSG_RESULT([$enable_spellcheck])
439
440 if test "$enable_spellcheck" = "yes"; then
441 PKG_CHECK_MODULES(ENCHANT, enchant >= $ENCHANT_REQUIRED_VERSION, [], [enable_spellcheck="no"])
442 AC_SUBST(ENCHANT_CFLAGS)
443 AC_SUBST(ENCHANT_LIBS)
444 fi
445
446 PKG_CHECK_MODULES(GAIL, $GAIL_PC_NAME >= $GAIL_REQUIRED_VERSION)
447 AC_SUBST(GAIL_CFLAGS)
448 AC_SUBST(GAIL_LIBS)
449
450 # check for target-specific dependencies
451 if test "$with_target" = "directfb"; then
452    PKG_CHECK_MODULES(CAIRO, cairo-directfb >= $CAIRO_REQUIRED_VERSION)
453    PKG_CHECK_MODULES(GTK, gtk+-directfb-2.0 >= $GTK_REQUIRED_VERSION)
454    AC_DEFINE([WTF_PLATFORM_DIRECTFB],[1],[Define if target is DirectFB])
455 else
456    PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_REQUIRED_VERSION)
457    PKG_CHECK_MODULES(GTK, gtk+-$GTK_API_VERSION >= $GTK_REQUIRED_VERSION)
458
459    if test "$with_target" = "x11" && test "$os_win32" = "no"; then
460       # check for XT
461       PKG_CHECK_MODULES([XT],
462                         [xt],
463                         [xt_has_pkg_config=yes],
464                         [xt_has_pkg_config=no])
465       # some old versions of Xt do not provide xt.pc, so try to link against Xt
466       # and if it's installed fall back to just adding -lXt
467       if test "$xt_has_pkg_config" = "no"; then
468          # using AC_CHECK_LIB instead of AC_SEARCH_LIB is fine in this case as
469          # we don't care about the XtOpenDisplay symbol but only about the
470          # existence of libXt
471          AC_CHECK_LIB([Xt], [XtOpenDisplay],
472                       [XT_CFLAGS=""; XT_LIBS="-lXt"],
473                       [AC_MSG_ERROR([X Toolkit Intrinsics library (libXt) not found])])
474       fi
475       AC_SUBST([XT_CFLAGS])
476       AC_SUBST([XT_LIBS])
477       AC_DEFINE([WTF_PLATFORM_X11],[1],[Define if target is X11])
478    fi
479 fi
480 AC_SUBST(GTK_CFLAGS)
481 AC_SUBST(GTK_LIBS)
482 AC_SUBST(CAIRO_CFLAGS)
483 AC_SUBST(CAIRO_LIBS)
484
485 # check whether to build with debugging enabled
486 AC_MSG_CHECKING([whether to do a debug build])
487 AC_ARG_ENABLE(debug,
488               AC_HELP_STRING([--enable-debug],
489                              [turn on debugging [default=no]]),
490               [],[enable_debug="no"])
491 AC_MSG_RESULT([$enable_debug])
492
493 # check whether to enable optimized builds
494 AC_MSG_CHECKING([whether to enable optimized builds])
495 AC_ARG_ENABLE(optimizations,
496               AC_HELP_STRING([--enable-optimizations],
497                              [turn on optimize builds (GCC only)
498                              [default=yes]]),
499               [enable_optimizations=$enableval],
500               [if test "$enable_debug" = "yes"; then enable_optimizations="no"; else enable_optimizations="yes"; fi])
501 AC_MSG_RESULT([$enable_optimizations])
502
503 # check whether to enable unstable features
504 AC_MSG_CHECKING([whether to enable unstable features])
505 AC_ARG_ENABLE(unstable_features,
506               AC_HELP_STRING([--enable-unstable-features],
507                              [enable unstable features [default=no]]),
508               [],[enable_unstable_features="no"])
509 AC_MSG_RESULT([$enable_unstable_features])
510
511 found_opengl=no
512 AC_ARG_ENABLE(glx,
513               AC_HELP_STRING([--enable-glx], [enable support for GLX [default=auto]]),
514               [], [enable_glx="auto"])
515 AC_ARG_ENABLE(egl,
516               AC_HELP_STRING([--enable-egl], [enable support for EGL [default=auto]]),
517               [], [enable_egl="auto"])
518 AC_ARG_ENABLE(gles2,
519               AC_HELP_STRING([--enable-gles2], [enable support for OpenGL ES 2 [default=auto]]),
520               [], [enable_gles2="auto"])
521
522 have_glx=no
523 AC_CHECK_HEADERS([GL/glx.h], [have_glx="yes"], [have_glx="no"])
524 AC_MSG_CHECKING([whether to enable GLX support])
525 if test "$enable_glx" != "no"; then
526    if test "$have_glx" = "no"; then
527       if test "$enable_glx" = "yes"; then
528          AC_MSG_ERROR([--enable-glx specified, but not available])
529       else
530          enable_glx=no
531       fi
532    elif test "$enable_gles2" != "yes"; then
533       enable_glx=yes
534    fi
535 fi
536 AC_MSG_RESULT([$enable_glx])
537
538 have_egl=no
539 AC_CHECK_HEADERS([EGL/egl.h], [have_egl="yes"], [have_egl="no"])
540 AC_MSG_CHECKING([whether to enable EGL support])
541 if test "$enable_egl" != "no"; then
542    if test "$have_egl" = "no"; then
543       if test "$enable_egl" = "yes"; then
544          AC_MSG_ERROR([--enable-egl specified, but not available])
545       else
546          enable_egl=no
547       fi
548    else
549       enable_egl=yes
550    fi
551 fi
552 AC_MSG_RESULT([$enable_egl])
553
554 have_gles2=no
555 AC_CHECK_HEADERS([GLES2/gl2.h], [have_gles2="yes"], [have_gles2="no"])
556 AC_MSG_CHECKING([whether to use OpenGL ES 2 support])
557 if test "$enable_glx" = "yes"; then
558    if test "$enable_gles2" = "yes"; then
559       AC_MSG_ERROR([Cannot enable OpenGL ES 2 support with GLX])
560    else
561       enable_gles2=no
562    fi
563 fi
564 if test "$enable_egl" = "no"; then
565    if test "$enable_gles2" = "yes"; then
566       AC_MSG_ERROR([Cannot enable OpenGL ES 2 support without EGL])
567    else
568       enable_gles2=no
569    fi
570 fi
571 if test "$enable_gles2" != "no"; then
572    if test "$have_gles2" = "no"; then
573       if test "$enable_gles2" = "yes"; then
574          AC_MSG_ERROR([--enable-gles2 specified, but not available])
575       else
576          enable_gles2=no
577       fi
578    else
579       enable_gles2=yes
580       found_opengl=yes
581    fi
582 fi
583 AC_MSG_RESULT([$enable_gles2])
584
585 if test "$enable_gles2" != "yes"; then
586     AC_CHECK_HEADERS([GL/gl.h], [found_opengl="yes"], [])
587 fi
588
589 AC_MSG_CHECKING([which GPU acceleration backend to use])
590 AC_ARG_WITH(acceleration_backend,
591             AC_HELP_STRING([--with-acceleration-backend=@<:@opengl/clutter/none@:>@],
592                            [Select accelerated backend (Clutter currently unsupported, OpenGL autodetected) [default=autodetect]]), [],
593                            [
594                                 if test "$found_opengl" = "yes"; then
595                                    with_acceleration_backend="opengl";
596                                 else
597                                    with_acceleration_backend="none";
598                                 fi
599                            ])
600 AC_MSG_RESULT([$with_acceleration_backend])
601
602 if test "$with_acceleration_backend" = "opengl"; then
603     PKG_CHECK_MODULES([XCOMPOSITE], [xcomposite]);
604     PKG_CHECK_MODULES([XDAMAGE], [xdamage]);
605     AC_SUBST(XCOMPOSITE_CFLAGS)
606     AC_SUBST(XCOMPOSITE_LIBS)
607     AC_SUBST(XDAMAGE_CFLAGS)
608     AC_SUBST(XDAMAGE_LIBS)
609 fi
610
611 # OpenGL is turned on by default (along with WebGL and accelerated compositing), but if
612 # Clutter is chosen as the accelerated drawing backend, we want to disable it. COGL does 
613 # not play well with OpenGL.
614 AC_MSG_CHECKING([whether to enable WebGL support])
615 AC_ARG_ENABLE(webgl,
616               AC_HELP_STRING([--enable-webgl], [enable support for WebGL [default=check]]), [],
617               [
618                 if test "$with_acceleration_backend" = "opengl"; then
619                     enable_webgl="yes";
620                 else
621                     enable_webgl="no";
622                 fi
623              ])
624 AC_MSG_RESULT([$enable_webgl])
625 if test "$enable_webgl" = "yes" && test "$with_acceleration_backend" != "opengl"; then
626     AC_MSG_ERROR([OpenGL must be active (and Clutter disabled) to use WebGL.])
627 fi;
628
629 AC_MSG_CHECKING([whether to enable accelerated compositing support])
630 AC_ARG_ENABLE(accelerated_compositing,
631             AC_HELP_STRING([--enable-accelerated-compositing], [enable support for accelerated compositing [default=check]]),
632             [
633                 if test "$enableval" = "yes" && test "$with_acceleration_backend" = "none"; then
634                     AC_MSG_ERROR([OpenGL or Clutter must be active to use accelerated compositing.])
635                 fi
636                 enable_accelerated_compositing=$enableval;
637             ],
638             [
639                 if test "$with_acceleration_backend" != "none"; then
640                     enable_accelerated_compositing="yes";
641                 else
642                     enable_accelerated_compositing="no";
643                 fi
644             ])
645 AC_MSG_RESULT([$enable_accelerated_compositing])
646
647 # check whether to enable Gamepad support
648 AC_MSG_CHECKING([whether to enable Gamepad support])
649 AC_ARG_ENABLE(gamepad,
650               AC_HELP_STRING([--enable-gamepad],
651                              [enable Gamepad support [default=no]]),
652               [],[enable_gamepad=$enable_unstable_features])
653 AC_MSG_RESULT([$enable_gamepad])
654
655 if test "$enable_gamepad" = "yes" && test "$os_linux" = no; then
656    AC_MSG_WARN([Gamepad support is only available on Linux. Disabling Gamepad support.])
657    enable_gamepad=no;
658 fi
659
660 # check whether to enable the indexed database API
661 AC_MSG_CHECKING([whether to enable the indexed database API])
662 AC_ARG_ENABLE(indexed_database,
663               AC_HELP_STRING([--enable-indexed-database],
664                              [enable the indexed database API (incomplete) [default=no]]),
665               [],[enable_indexed_database="no"])
666 AC_MSG_RESULT([$enable_indexed_database])
667
668 # check whether to enable HTML5 audio/video support
669 AC_MSG_CHECKING([whether to enable HTML5 video support])
670 AC_ARG_ENABLE(video,
671               AC_HELP_STRING([--enable-video],
672                              [enable HTML5 video support [default=yes]]),
673               [],[enable_video="yes"])
674 AC_MSG_RESULT([$enable_video])
675
676 # check whether to enable media stream support
677 AC_MSG_CHECKING([whether to enable media stream support])
678 AC_ARG_ENABLE(media_stream,
679               AC_HELP_STRING([--enable-media-stream],
680                              [enable media stream support (incomplete) [default=no]]),
681               [],[enable_media_stream=$enable_unstable_features])
682 AC_MSG_RESULT([$enable_media_stream])
683
684 # check whether to enable XHR timeout support
685 AC_MSG_CHECKING([whether to enable XHR timeout support])
686 AC_ARG_ENABLE(xhr_timeout,
687               AC_HELP_STRING([--enable-xhr-timeout],
688                              [enable support for XHR timeout [default=yes]]),
689               [],[enable_xhr_timeout="yes"])
690 AC_MSG_RESULT([$enable_xhr_timeout])
691
692 # check whether to enable XSLT support
693 AC_MSG_CHECKING([whether to enable XSLT support])
694 AC_ARG_ENABLE(xslt,
695               AC_HELP_STRING([--enable-xslt],
696                              [enable support for XSLT [default=yes]]),
697               [],[enable_xslt="yes"])
698 AC_MSG_RESULT([$enable_xslt])
699
700 # check whether to enable geolocation support
701 AC_MSG_CHECKING([whether to enable geolocation support])
702 AC_ARG_ENABLE(geolocation,
703               AC_HELP_STRING([--enable-geolocation],
704                              [enable support for geolocation [default=yes]]),
705               [],[enable_geolocation="yes"])
706 AC_MSG_RESULT([$enable_geolocation])
707
708 # check whether to enable SVG support
709 AC_MSG_CHECKING([whether to enable SVG support])
710 AC_ARG_ENABLE(svg,
711               AC_HELP_STRING([--enable-svg],
712                              [enable support for SVG [default=yes]]),
713               [],[enable_svg="yes"])
714 AC_MSG_RESULT([$enable_svg])
715
716 # turn off svg features if --disable-svg is requested
717 if test "$enable_svg" = "no"; then
718    enable_svg_fonts=no
719 fi
720
721 # check whether to enable support for filters
722 AC_MSG_CHECKING([whether to enable support for filters])
723 AC_ARG_ENABLE(filters,
724               AC_HELP_STRING([--enable-filters],
725                              [enable support for filters (experimental) [default=yes]]),
726               [],[enable_filters="yes"])
727 AC_MSG_RESULT([$enable_filters])
728
729 # check whether to enable support for SVG fonts
730 AC_MSG_CHECKING([whether to enable support for SVG fonts])
731 AC_ARG_ENABLE(svg_fonts,
732               AC_HELP_STRING([--enable-svg-fonts],
733                              [enable support for SVG fonts (experimental) [default=yes]]),
734               [],[enable_svg_fonts="yes"])
735 AC_MSG_RESULT([$enable_svg_fonts])
736
737 # check for SVG features, enabling SVG if necessary
738 if test "$enable_svg_fonts" = "yes" && test "$enable_svg" = "no"; then
739    AC_MSG_WARN([SVG feature(s) requested but SVG is disabled.. Enabling SVG support])
740    enable_svg=yes
741 fi
742
743 # check whether to enable Web Socket support
744 AC_MSG_CHECKING([whether to enable Web Sockets support])
745 AC_ARG_ENABLE(web_sockets,
746               AC_HELP_STRING([--enable-web-sockets],
747                              [enable support for Web Sockets [default=yes]]),
748               [],[enable_web_sockets="yes"])
749 AC_MSG_RESULT([$enable_web_sockets])
750
751 # check whether to enable Web Audio support
752 AC_MSG_CHECKING([whether to enable Web Audio support])
753 AC_ARG_ENABLE(web_audio,
754               AC_HELP_STRING([--enable-web-audio],
755                              [enable support for Web Audio [default=no]]),
756               [],[enable_web_audio="no"])
757 AC_MSG_RESULT([$enable_web_audio])
758
759 # check whether to enable code coverage
760 AC_MSG_CHECKING([whether to enable code coverage support])
761 AC_ARG_ENABLE(coverage,
762               AC_HELP_STRING([--enable-coverage],
763                              [enable code coverage support [default=no]]),
764               [],[enable_coverage="no"])
765 AC_MSG_RESULT([$enable_coverage])
766
767 # check whether to enable CSS conditional rules support
768 AC_MSG_CHECKING([whether to enable CSS3 conditional rules support])
769 AC_ARG_ENABLE(css3_conditional_rules,
770               AC_HELP_STRING([--enable-css3-conditional-rules],
771                              [enable CSS3 conditional rules support [default=no]]),
772               [],[enable_css3_conditional_rules="no"])
773 AC_MSG_RESULT([$enable_css3_conditional_rules])
774
775 # check whether to enable FastMalloc
776 AC_MSG_CHECKING([whether to enable optimized memory allocator])
777 AC_ARG_ENABLE(fast_malloc,
778               AC_HELP_STRING([--enable-fast-malloc],
779                              [enable optimized memory allocator default=yes, default=no for debug builds]),
780               [],[if test "$enable_debug" = "yes"; then enable_fast_malloc="no"; else enable_fast_malloc="yes"; fi])
781 AC_MSG_RESULT([$enable_fast_malloc])
782
783 # check whether to enable debug symbols
784 AC_MSG_CHECKING([whether to enable debug symbols])
785 AC_ARG_ENABLE(debug_symbols,
786               AC_HELP_STRING([--enable-debug-symbols=yes|no|min|full],
787                              [enable debug symbols default=no, default=yes for debug builds]),
788               [],[if test "$enable_debug" = "yes"; then enable_debug_symbols="yes"; else enable_debug_symbols="no"; fi])
789
790 case "$enable_debug_symbols" in
791   yes) enable_debug_symbols="full" ;;
792   no|min|full) ;;
793   *) AC_MSG_ERROR([Invalid debug symbols option: must be yes, no, min or full.]) ;;
794 esac
795 AC_MSG_RESULT([$enable_debug_symbols])
796
797 #selecting GStreamer version
798 AC_MSG_CHECKING([the GStreamer version to use])
799 AC_ARG_WITH([gstreamer],
800         [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)])],
801         [case "$with_gstreamer" in
802         0.10|1.0|auto) ;;
803         *) AC_MSG_ERROR([invalid GStreamer version specified]) ;;
804         esac],
805         [with_gstreamer=auto])
806 AC_MSG_RESULT([$with_gstreamer])
807
808 GSTREAMER_0_10_REQUIRED_VERSION=0.10
809 GSTREAMER_0_10_PLUGINS_BASE_REQUIRED_VERSION=0.10.30
810 GSTREAMER_1_0_REQUIRED_VERSION=1.0.3
811 GSTREAMER_1_0_PLUGINS_BASE_REQUIRED_VERSION=1.0.3
812
813 if test "$enable_video" = "yes" || test "$enable_web_audio" = "yes"; then
814    if test "$with_gstreamer" = "auto"; then
815        gstreamer_modules="gstreamer-1.0 >= $GSTREAMER_1_0_REQUIRED_VERSION
816                           gstreamer-app-1.0
817                           gstreamer-audio-1.0
818                           gstreamer-fft-1.0
819                           gstreamer-base-1.0
820                           gstreamer-pbutils-1.0
821                           gstreamer-plugins-base-1.0 >= $GSTREAMER_1_0_PLUGINS_BASE_REQUIRED_VERSION
822                           gstreamer-video-1.0";
823        PKG_CHECK_MODULES([GSTREAMER_1_0], [$gstreamer_modules], [with_gstreamer=1.0], [with_gstreamer=0.10])
824        AC_MSG_NOTICE([Selected GStreamer $with_gstreamer])
825    fi
826 else
827    if test "$with_gstreamer" != "auto"; then
828        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])
829    fi
830 fi
831
832 case "$with_gstreamer" in
833      0.10) GSTREAMER_REQUIRED_VERSION=$GSTREAMER_0_10_REQUIRED_VERSION
834            GSTREAMER_PLUGINS_BASE_REQUIRED_VERSION=$GSTREAMER_0_10_PLUGINS_BASE_REQUIRED_VERSION
835            GST_API_VERSION=0.10
836            ;;
837      1.0) GSTREAMER_REQUIRED_VERSION=$GSTREAMER_1_0_REQUIRED_VERSION
838            GSTREAMER_PLUGINS_BASE_REQUIRED_VERSION=$GSTREAMER_1_0_PLUGINS_BASE_REQUIRED_VERSION
839            GST_API_VERSION=1.0
840            ;;
841 esac
842
843 AC_SUBST([GST_API_VERSION])
844 if test "$GST_API_VERSION" = "1.0"; then
845    AC_DEFINE([GST_API_VERSION_1],[1], [Using GStreamer 1.0])
846 fi
847
848 # check whether to enable debug features
849 AC_MSG_CHECKING([whether to enable debug features])
850 AC_ARG_ENABLE(debug_features,
851               AC_HELP_STRING([--enable-debug-features],
852                              [enable debug features default=no, default=yes for debug builds]),
853               [],[if test "$enable_debug" = "yes"; then enable_debug_features="yes"; else enable_debug_features="no"; fi])
854 AC_MSG_RESULT([$enable_debug_features])
855
856 AC_MSG_CHECKING([whether to enable JIT compilation])
857 AC_ARG_ENABLE(jit,
858               AS_HELP_STRING([--enable-jit],
859                              [Enable JIT compilation (default: autodetect)]))
860 case "$enable_jit" in
861   yes) JSC_CPPFLAGS="-DENABLE_JIT=1" ;;
862   no) JSC_CPPFLAGS="-DENABLE_JIT=0" ;;
863   *) enable_jit="autodetect" ;;
864 esac
865 AC_SUBST(JSC_CPPFLAGS)
866 AC_MSG_RESULT([$enable_jit])
867
868 # Opcode stats
869 AC_MSG_CHECKING([whether to enable opcode stats])
870 AC_ARG_ENABLE([opcode-stats],
871   [AS_HELP_STRING([--enable-opcode-stats], [Enable Opcode statistics (default: disabled)])],
872   [], [enable_opcode_stats=no])
873 AC_MSG_RESULT([$enable_opcode_stats])
874
875 if test "$enable_opcode_stats" = "yes"; then
876   if test "$enable_jit" = "yes"; then
877     AC_MSG_ERROR([JIT must be disabled for Opcode stats to work.])
878   fi
879   AC_DEFINE([ENABLE_OPCODE_STATS], [1], [Define to enable Opcode statistics])
880 fi
881
882 # GObject Introspection
883 AC_MSG_CHECKING([whether to enable GObject introspection support])
884 AC_ARG_ENABLE([introspection],
885   [AS_HELP_STRING([--enable-introspection],[Enable GObject introspection (default: disabled)])],
886   [],[enable_introspection=no])
887 AC_MSG_RESULT([$enable_introspection])
888
889 # Enable CSS Filters and Shaders if unstable_features and accelerated_compositing are turned on.
890 enable_css_filters=no;
891 enable_css_shaders=no;
892 AC_MSG_CHECKING([whether to enable CSS Filters and Shaders])
893 if test "$enable_unstable_features" = "yes" && test "$enable_accelerated_compositing" = "yes" && test "$with_acceleration_backend" = "opengl"; then
894     enable_css_filters=yes;
895     enable_css_shaders=yes;
896 fi
897 AC_MSG_RESULT([$enable_css_filters])
898
899 # CSS Device Adaptation
900 AC_MSG_CHECKING([whether to enable CSS Device Adaptation])
901 AC_ARG_ENABLE(css_device_adaptation,
902               AC_HELP_STRING([--enable-css-device-adaptation],
903                              [enable support for CSS Device Adaptation [default=no]]),
904               [],[enable_css_device_adaptation="no"])
905 AC_MSG_RESULT([$enable_css_device_adaptation])
906
907 G_IR_SCANNER=
908 G_IR_COMPILER=
909 G_IR_GENERATE=
910 GIRDIR=
911 GIRTYPELIBDIR=
912
913 if test "$enable_introspection" = "yes"; then
914   GOBJECT_INTROSPECTION_REQUIRED=0.9.5
915   PKG_CHECK_MODULES([INTROSPECTION],[gobject-introspection-1.0 >= $GOBJECT_INTROSPECTION_REQUIRED])
916   
917   G_IR_SCANNER="$($PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0)"
918   G_IR_COMPILER="$($PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0)"
919   G_IR_GENERATE="$($PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0)"
920   AC_DEFINE([ENABLE_INTROSPECTION],[1],[Define to enable GObject introspection support])
921 fi
922
923 AC_SUBST([G_IR_SCANNER])
924 AC_SUBST([G_IR_COMPILER])
925 AC_SUBST([G_IR_GENERATE])
926
927 if test "$host_cpu" = "sh4"; then
928    CXXFLAGS="$CXXFLAGS -mieee -w"
929    CFLAGS="$CFLAGS -mieee -w"
930 fi
931
932 # Add '-g' flag to gcc to build with debug symbols
933 if test "$enable_debug_symbols" = "min"; then
934    CXXFLAGS="$CXXFLAGS -g1"
935    CFLAGS="$CFLAGS -g1"
936 elif test "$enable_debug_symbols" != "no"; then
937    CXXFLAGS="$CXXFLAGS -g"
938    CFLAGS="$CFLAGS -g"
939 fi
940
941 if test "$enable_debug_features" = "no"; then
942    AC_DEFINE([NDEBUG], [1], [Define to disable debugging features])
943 fi
944
945 # Add the appropriate 'O' level for optimized builds
946 if test "$enable_optimizations" = "yes"; then
947    CXXFLAGS="$CXXFLAGS -O2"
948    CFLAGS="$CFLAGS -O2"
949 else
950    CXXFLAGS="$CXXFLAGS -O0"
951    CFLAGS="$CFLAGS -O0"
952 fi
953
954 PKG_CHECK_MODULES([LIBSOUP],
955                   [libsoup-2.4 >= $LIBSOUP_REQUIRED_VERSION])
956 AC_SUBST([LIBSOUP_CFLAGS])
957 AC_SUBST([LIBSOUP_LIBS])
958
959 PKG_CHECK_MODULES([LIBSECRET], [libsecret-1])
960 AC_SUBST([LIBSECRET_CFLAGS])
961 AC_SUBST([LIBSECRET_LIBS])
962
963 # check if FreeType/FontConfig are available
964 if test "$with_target" = "directfb"; then
965 PKG_CHECK_MODULES([FREETYPE],
966                   [fontconfig >= $FONTCONFIG_REQUIRED_VERSION
967                   freetype2 >= $FREETYPE2_REQUIRED_VERSION
968                   harfbuzz])
969 else
970 PKG_CHECK_MODULES([FREETYPE],
971                   [cairo-ft
972                   fontconfig >= $FONTCONFIG_REQUIRED_VERSION
973                   freetype2 >= $FREETYPE2_REQUIRED_VERSION
974                   harfbuzz])
975 fi
976 AC_SUBST([FREETYPE_CFLAGS])
977 AC_SUBST([FREETYPE_LIBS])
978
979 # check if SQLite3 is available. Error out only if one of the
980 # features hard-depending on it is enabled while SQLite3 is
981 # unavailable.
982 PKG_CHECK_MODULES([SQLITE3],
983                   [sqlite3 >= $SQLITE_REQUIRED_VERSION],
984                   [sqlite3_has_pkg_config=yes],
985                   [sqlite3_has_pkg_config=no])
986 if test "$sqlite3_has_pkg_config" = "no"; then
987    AC_SEARCH_LIBS([sqlite3_open16], [sqlite3],
988                   [sqlite3_found=yes;SQLITE3_LIBS="$LIBS";SQLITE3_CFLAGS="-I $srcdir/WebKitLibraries/WebCoreSQLite3"],
989                   [sqlite3_found=no])
990 fi
991 AC_SUBST([SQLITE3_CFLAGS])
992 AC_SUBST([SQLITE3_LIBS])
993
994 if (test "$sqlite3_found" = "no"); then
995    AC_MSG_ERROR([SQLite3 is required for the Database related features])
996 fi
997
998 # check if libxslt is available
999 if test "$enable_xslt" = "yes"; then
1000    PKG_CHECK_MODULES([LIBXSLT],[libxslt >= $LIBXSLT_REQUIRED_VERSION])
1001    AC_SUBST([LIBXSLT_CFLAGS])
1002    AC_SUBST([LIBXSLT_LIBS])
1003 fi
1004
1005 # check if geoclue is available
1006 if test "$enable_geolocation" = "yes"; then
1007     PKG_CHECK_MODULES([GEOCLUE], [geoclue])
1008     AC_SUBST([GEOCLUE_CFLAGS])
1009     AC_SUBST([GEOCLUE_LIBS])
1010 fi
1011
1012 # check for XRender under Linux/Unix. Some linkers require explicit
1013 # linkage (like GNU Gold), so we cannot rely on GTK+ pulling XRender
1014 if test "$os_win32" = "no"; then
1015    PKG_CHECK_MODULES([XRENDER], [xrender])
1016    AC_SUBST([XRENDER_CFLAGS])
1017    AC_SUBST([XRENDER_LIBS])
1018 fi
1019
1020 # check if gstreamer is available
1021 if test "$enable_video" = "yes" || test "$enable_web_audio" = "yes"; then
1022     gstreamer_modules="gstreamer-$GST_API_VERSION >= $GSTREAMER_REQUIRED_VERSION
1023                        gstreamer-app-$GST_API_VERSION
1024                        gstreamer-audio-$GST_API_VERSION
1025                        gstreamer-fft-$GST_API_VERSION
1026                        gstreamer-base-$GST_API_VERSION
1027                        gstreamer-pbutils-$GST_API_VERSION
1028                        gstreamer-plugins-base-$GST_API_VERSION >= $GSTREAMER_PLUGINS_BASE_REQUIRED_VERSION
1029                        gstreamer-video-$GST_API_VERSION";
1030    if test "$GST_API_VERSION" != "1.0"; then
1031        gstreamer_modules="$gstreamer_modules gstreamer-interfaces-$GST_API_VERSION";
1032    fi
1033    PKG_CHECK_MODULES([GSTREAMER], [$gstreamer_modules], [have_gstreamer=yes])
1034    AC_SUBST([GSTREAMER_CFLAGS])
1035    AC_SUBST([GSTREAMER_LIBS])
1036 fi
1037
1038 # farstream-0.1 depends on gstreamer 0.10 currently. Disable
1039 # media_stream if gstreamer 1.0 build support is enabled.
1040 if test "$have_gstreamer" != "yes" || test "$GST_API_VERSION" = "1.0"; then
1041    if test "$enable_media_stream" = "yes"; then
1042       AC_MSG_WARN([Disabling Media Stream because no GStreamer 0.10 support is enabled])
1043    fi
1044    enable_media_stream=false
1045 fi
1046 if test "$enable_media_stream" = "yes"; then
1047    PKG_CHECK_MODULES([FARSTREAM], [farstream-0.1],
1048                      [have_farstream=yes], [enable_media_stream=false])
1049    AC_SUBST([FARSTREAM_CFLAGS])
1050    AC_SUBST([FARSTREAM_LIBS])
1051 fi
1052
1053 acceleration_backend_description=$with_acceleration_backend
1054 if test "$with_acceleration_backend" = "clutter"; then
1055    PKG_CHECK_MODULES(CLUTTER, clutter-1.0 >= $CLUTTER_REQUIRED_VERSION)
1056    PKG_CHECK_MODULES([CLUTTER_GTK],
1057                      [clutter-gtk-1.0 >= $CLUTTER_GTK_REQUIRED_VERSION])
1058
1059    AC_SUBST(CLUTTER_CFLAGS)
1060    AC_SUBST(CLUTTER_LIBS)
1061    AC_SUBST(CLUTTER_GTK_CFLAGS)
1062    AC_SUBST(CLUTTER_GTK_LIBS)
1063 fi
1064
1065 if test "$with_acceleration_backend" = "opengl"; then
1066    if test "$enable_gles2" = "yes"; then
1067     acceleration_backend_description+= "(gles2"
1068     OPENGL_LIBS="-lGLESv2"
1069    else
1070     acceleration_backend_description+="(gl"
1071     OPENGL_LIBS="-lGL"
1072    fi
1073    if test "$enable_egl" = "yes"; then
1074     acceleration_backend_description+=", egl"
1075     OPENGL_LIBS+=" -lEGL"
1076    fi
1077    if test "$enable_glx" = "yes"; then
1078     acceleration_backend_description+=", glx"
1079    fi
1080    OPENGL_LIBS+=" -ldl"
1081    acceleration_backend_description+=")"
1082 fi
1083 AC_SUBST([OPENGL_LIBS])
1084
1085 if test "$enable_gamepad" = "yes"; then
1086    PKG_CHECK_MODULES([GAMEPAD], [gio-unix-2.0 gudev-1.0])
1087
1088    AC_SUBST(GAMEPAD_CFLAGS)
1089    AC_SUBST(GAMEPAD_LIBS)
1090 fi
1091
1092 # check for code coverage support
1093 if test "$enable_coverage" = "yes"; then
1094    COVERAGE_CFLAGS="-MD"
1095    COVERAGE_LDFLAGS="-ftest-coverage -fprofile-arcs"
1096    AC_SUBST([COVERAGE_CFLAGS])
1097    AC_SUBST([COVERAGE_LDFLAGS])
1098 fi
1099
1100 # WebKit2
1101 # If you change the default here, please also make sure the assumptions made
1102 # in Tools/Scripts/webkitdirs.pm:buildAutotoolsProject still make sense.
1103 AC_MSG_CHECKING([whether to build Webkit2])
1104 AC_ARG_ENABLE(webkit2,
1105     AC_HELP_STRING([--enable-webkit2], [build webkit2 [default=yes]]),
1106     [], [enable_webkit2="yes"])
1107 AC_MSG_RESULT([$enable_webkit2])
1108 if test "$enable_webkit2" = "yes"; then
1109    if test "$GTK_API_VERSION" = "2.0"; then
1110       AC_MSG_ERROR([WebKit2 requires GTK+ 3.x, use --with-gtk=3.0])
1111    fi
1112
1113    # Check Unix printing
1114    PKG_CHECK_MODULES(GTK_UNIX_PRINTING, gtk+-unix-print-3.0,
1115                      [have_gtk_unix_printing=yes],
1116                      [have_gtk_unix_printing=no])
1117    AC_SUBST(GTK_UNIX_PRINTING_CFLAGS)
1118    AC_SUBST(GTK_UNIX_PRINTING_LIBS)
1119    if test "$have_gtk_unix_printing" = "yes"; then
1120        AC_DEFINE([HAVE_GTK_UNIX_PRINTING], [1], [Define if GTK+ UNIX Printing is available])
1121    fi
1122
1123    # On some Linux/Unix platforms, shm_* may only be available if linking
1124    # against librt
1125    if test "$os_win32" = "no"; then
1126        AC_SEARCH_LIBS([shm_open], [rt], [SHM_LIBS="-lrt"])
1127        AC_SUBST(SHM_LIBS)
1128    fi
1129 fi
1130
1131 # Plugin Process
1132 AC_MSG_CHECKING([whether to build plugin process for WebKit2])
1133 AC_ARG_ENABLE(plugin_process,
1134             AC_HELP_STRING([--enable-plugin-process], [build plugin process for WebKit2 [default=yes]]),
1135                            [], [enable_plugin_process="yes"])
1136 AC_MSG_RESULT([$enable_plugin_process])
1137
1138 # Build the plugin process only when building Webkit2.
1139 if test "$enable_webkit2" = "no"; then
1140     enable_plugin_process=no
1141 fi
1142
1143 # Make sure we have GTK+ 2.x to build the plugin process.
1144 if test "$enable_plugin_process" = "yes"; then
1145    PKG_CHECK_MODULES(GTK2, gtk+-2.0 >= $GTK2_REQUIRED_VERSION gail >= $GAIL2_REQUIRED_VERSION)
1146 fi
1147 AC_SUBST(GTK2_CFLAGS)
1148 AC_SUBST(GTK2_LIBS)
1149
1150 GTK_DOC_CHECK([1.10])
1151
1152 # We need atspi2 for Webkit2 unit tests
1153 if test "$enable_webkit2" = "yes"; then
1154    PKG_CHECK_MODULES([ATSPI2],
1155                      [atspi-2 >= $ATSPI2_REQUIRED_VERSION],
1156                      [have_atspi2=yes], [have_atspi2=no])
1157
1158    AC_SUBST([ATSPI2_CFLAGS])
1159    AC_SUBST([ATSPI2_LIBS])
1160 fi
1161
1162 # OS conditionals
1163 AM_CONDITIONAL([OS_WIN32],[test "$os_win32" = "yes"])
1164 AM_CONDITIONAL([OS_UNIX],[test "$os_win32" = "no"])
1165 AM_CONDITIONAL([OS_LINUX],[test "$os_linux" = "yes"])
1166 AM_CONDITIONAL([OS_GNU],[test "$os_gnu" = "yes"])
1167 AM_CONDITIONAL([OS_FREEBSD],[test "$os_freebsd" = "yes"])
1168
1169 # target conditionals
1170 AM_CONDITIONAL([TARGET_X11], [test "$with_target" = "x11"])
1171 AM_CONDITIONAL([TARGET_WIN32], [test "$with_target" = "win32"])
1172 AM_CONDITIONAL([TARGET_QUARTZ], [test "$with_target" = "quartz"])
1173 AM_CONDITIONAL([TARGET_DIRECTFB], [test "$with_target" = "directfb"])
1174
1175 # Unicode backend conditionals
1176 AM_CONDITIONAL([USE_ICU_UNICODE], [test "$with_unicode_backend" = "icu"])
1177 AM_CONDITIONAL([USE_GLIB_UNICODE], [test "$with_unicode_backend" = "glib"])
1178
1179 # GStreamer feature conditional
1180 AM_CONDITIONAL([USE_GSTREAMER], [test "$have_gstreamer" = "yes"])
1181 AM_CONDITIONAL([USE_WEBAUDIO_GSTREAMER], [test "$enable_web_audio" = "yes"])
1182
1183 # ATSPI2 conditional
1184 AM_CONDITIONAL([HAVE_ATSPI2], [test "$have_atspi2" = "yes"])
1185
1186 # Accelerated compositing conditional
1187 AM_CONDITIONAL([USE_ACCELERATED_COMPOSITING], [test "$enable_accelerated_compositing" = "yes"])
1188 AM_CONDITIONAL([USE_TEXTURE_MAPPER_CAIRO], [test "$enable_accelerated_compositing" = "yes" && test "$with_acceleration_backend" = "none"])
1189 AM_CONDITIONAL([USE_TEXTURE_MAPPER_GL], [test "$enable_accelerated_compositing" = "yes" && test "$with_acceleration_backend" = "opengl"])
1190 AM_CONDITIONAL([USE_CLUTTER], [test "$with_acceleration_backend" = "clutter"])
1191
1192 # These are the same now, but they will soon be separate.
1193 AM_CONDITIONAL([USE_OPENGL], [test "$with_acceleration_backend" = "opengl"])
1194 AM_CONDITIONAL([USE_EGL], [test "$enable_egl" = "yes"])
1195 AM_CONDITIONAL([USE_GLES2], [test "$enable_gles2" = "yes"])
1196 AM_CONDITIONAL([USE_GLX], [test "$enable_glx" = "yes"])
1197
1198 # IndexedDB implies LevelDB, but other features may one day require LevelDB.
1199 AM_CONDITIONAL([ENABLE_INDEXED_DATABASE],[test "$enable_indexed_database" = "yes"])
1200 AM_CONDITIONAL([USE_LEVELDB],[test "$enable_indexed_database" = "yes"])
1201
1202 # Farstream feature conditional
1203 AM_CONDITIONAL([USE_FARSTREAM], [test "$have_farstream" = "yes"])
1204
1205 # WebKit feature conditionals
1206 AM_CONDITIONAL([ENABLE_DEBUG],[test "$enable_debug_features" = "yes"])
1207 AM_CONDITIONAL([ENABLE_UNSTABLE_FEATURES],[test "$enable_unstable_features" = "yes"])
1208 AM_CONDITIONAL([ENABLE_WEBGL],[test "$enable_webgl" = "yes"])
1209 AM_CONDITIONAL([ENABLE_GAMEPAD],[test "$enable_gamepad" = "yes"])
1210 AM_CONDITIONAL([ENABLE_XHR_TIMEOUT],[test "$enable_xhr_timeout" = "yes"])
1211 AM_CONDITIONAL([ENABLE_XSLT],[test "$enable_xslt" = "yes"])
1212 AM_CONDITIONAL([ENABLE_FILTERS],[test "$enable_filters" = "yes"])
1213 AM_CONDITIONAL([ENABLE_GEOLOCATION], [test "$enable_geolocation" = "yes"])
1214 AM_CONDITIONAL([ENABLE_VIDEO],[test "$enable_video" = "yes"])
1215 AM_CONDITIONAL([ENABLE_MEDIA_STREAM],[test "$enable_media_stream" = "yes"])
1216 AM_CONDITIONAL([ENABLE_SVG],[test "$enable_svg" = "yes"])
1217 AM_CONDITIONAL([ENABLE_SVG_FONTS],[test "$enable_svg_fonts" = "yes"])
1218 AM_CONDITIONAL([ENABLE_COVERAGE],[test "$enable_coverage" = "yes"])
1219 AM_CONDITIONAL([ENABLE_CSS3_CONDITIONAL_RULES],[test "$enable_css3_conditional_rules" = "yes"])
1220 AM_CONDITIONAL([ENABLE_FAST_MALLOC],[test "$enable_fast_malloc" = "yes"])
1221 AM_CONDITIONAL([ENABLE_WEB_AUDIO],[test "$enable_web_audio" = "yes"])
1222 AM_CONDITIONAL([ENABLE_OPCODE_STATS],[test "$enable_opcode_stats" = "yes"])
1223 AM_CONDITIONAL([ENABLE_WEBKIT2],[test "$enable_webkit2" = "yes"])
1224 AM_CONDITIONAL([ENABLE_PLUGIN_PROCESS],[test "$enable_plugin_process" = "yes"])
1225 AM_CONDITIONAL([ENABLE_SPELLCHECK],[test "$enable_spellcheck" = "yes"])
1226 AM_CONDITIONAL([ENABLE_CSS_DEVICE_ADAPTATION],[test "$enable_css_device_adaptation" = "yes"])
1227 AM_CONDITIONAL([ENABLE_CSS_FILTERS],[test "$enable_css_filters" = "yes"])
1228 AM_CONDITIONAL([ENABLE_CSS_SHADERS],[test "$enable_css_shaders" = "yes"])
1229
1230 # Gtk conditionals
1231 AM_CONDITIONAL([ENABLE_INTROSPECTION],[test "$enable_introspection" = "yes"])
1232
1233 AC_CONFIG_FILES([
1234 GNUmakefile
1235 ])
1236  
1237
1238 AC_CONFIG_FILES([
1239 Source/WebKit/gtk/webkit/webkitversion.h
1240 Source/WebKit/gtk/po/POTFILES
1241 DerivedSources/WebCore/UserAgentGtk.h:Source/WebCore/platform/gtk/UserAgentGtk.h.in
1242 ])
1243
1244 AC_CONFIG_FILES([
1245 Source/WebKit/gtk/${WEBKITGTK_PC_NAME}-${WEBKITGTK_API_VERSION}.pc:Source/WebKit/gtk/webkit.pc.in
1246 Source/WebKit/gtk/JSCore-${WEBKITGTK_API_VERSION}.gir:Source/WebKit/gtk/JSCore.gir.in
1247 Source/JavaScriptCore/javascriptcoregtk-${WEBKITGTK_API_VERSION}.pc:Source/JavaScriptCore/javascriptcoregtk.pc.in
1248 ]
1249 ,[WEBKITGTK_API_VERSION=$WEBKITGTK_API_VERSION,WEBKITGTK_PC_NAME=$WEBKITGTK_PC_NAME]
1250 )
1251
1252
1253 if test "$enable_webkit2" = "yes"; then
1254     AC_CONFIG_FILES([
1255     DerivedSources/WebKit2/webkit2gtk/webkit2/WebKitVersion.h:Source/WebKit2/UIProcess/API/gtk/WebKitVersion.h.in
1256     ])
1257
1258     AC_CONFIG_FILES([
1259     Source/WebKit2/webkit2gtk-${WEBKITGTK_API_VERSION}.pc:Source/WebKit2/webkit2gtk.pc.in
1260     ]
1261     ,[WEBKITGTK_API_VERSION=$WEBKITGTK_API_VERSION,WEBKITGTK_PC_NAME=$WEBKITGTK_PC_NAME]
1262     )
1263 fi
1264
1265 AC_OUTPUT
1266
1267 echo "
1268 WebKit was configured with the following options:
1269
1270 Build configuration:
1271  Enable debugging (slow)                                  : $enable_debug
1272  Compile with debug symbols (slow)                        : $enable_debug_symbols
1273  Enable debug features (slow)                             : $enable_debug_features
1274  Enable GCC build optimization                            : $enable_optimizations
1275  Code coverage support                                    : $enable_coverage
1276  Unicode backend                                          : $with_unicode_backend
1277  Optimized memory allocator                               : $enable_fast_malloc
1278  Accelerated rendering backend                            : $acceleration_backend_description
1279
1280 Features:
1281 =======
1282  Accelerated Compositing                                  : $enable_accelerated_compositing
1283  CSS3 Conditional Rules support                           : $enable_css3_conditional_rules
1284  Filters support                                          : $enable_filters
1285  Gamepad support                                          : $enable_gamepad
1286  Geolocation support                                      : $enable_geolocation
1287  HTML5 video element support                              : $enable_video
1288  JIT compilation                                          : $enable_jit
1289  Media stream support                                     : $enable_media_stream
1290  Opcode stats                                             : $enable_opcode_stats
1291  SVG fonts support                                        : $enable_svg_fonts
1292  SVG support                                              : $enable_svg
1293  Spellcheck support                                       : $enable_spellcheck
1294  Web Audio support                                        : $enable_web_audio
1295  WebGL                                                    : $enable_webgl
1296  XHR timeout support                                      : $enable_xhr_timeout
1297  XSLT support                                             : $enable_xslt
1298
1299 WebKit2 support:
1300  WebKit2 support                                          : $enable_webkit2
1301  WebKit2 plugin process                                   : $enable_plugin_process
1302
1303 GTK+ configuration:
1304  GTK+ version                                             : $with_gtk
1305  GDK target                                               : $with_target
1306  GStreamer version                                        : $with_gstreamer
1307  Introspection support                                    : $enable_introspection
1308  Generate documentation                                   : $enable_gtk_doc
1309 "
1310 if test "$with_unicode_backend" = "glib"; then
1311    echo "     >> WARNING: the glib-based unicode backend is slow and incomplete <<"
1312    echo
1313    echo
1314 fi