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