2008-02-28 Alp Toker <alp@atoker.com>
[WebKit-https.git] / configure.ac
1 AC_INIT([WebKit],[0.1],[http://bugs.webkit.org/])
2
3 AC_PREREQ(2.59)
4
5 AC_CONFIG_HEADERS([aconfig.h])
6 AC_CONFIG_SRCDIR([WebCore/config.h])
7
8 # see http://www.gnu.org/software/libtool/manual.html#Versioning
9 LIBWEBKITGTK_VERSION=1:0:0
10 AC_SUBST([LIBWEBKITGTK_VERSION])
11
12 AM_INIT_AUTOMAKE([foreign subdir-objects])
13
14 AC_CANONICAL_HOST
15
16 # host checking - inspired by the GTK+ configure.in
17 # TODO: os_mac, os_bsd
18 AC_MSG_CHECKING([for native Win32])
19 case "$host" in
20      *-*-mingw*)
21        os_win32=yes
22        ;;
23      *)
24        os_win32=no
25        ;;
26 esac
27 AC_MSG_RESULT([$os_win32])
28
29 case "$host" in
30      *-*-linux*)
31        os_linux=yes
32        ;;
33      *-*-freebsd*)
34        os_freebsd=yes
35        ;;
36 esac
37
38 # If CXXFLAGS and CFLAGS are unset, default to -O2
39 # This is to tell automake not to include '-g' if CXXFLAGS is not set
40 # For more info - http://www.gnu.org/software/automake/manual/autoconf.html#C_002b_002b-Compiler
41 if test -z "$CXXFLAGS"; then
42    CXXFLAGS="-O2"
43 fi
44 if test -z "$CFLAGS"; then
45    CFLAGS="-O2"
46 fi
47
48 # programs
49 AC_DISABLE_STATIC
50 AM_PROG_LIBTOOL
51 AC_PROG_INSTALL
52 AM_PROG_CC_STDC
53 AC_PROG_CXX
54 AM_PROG_CC_C_O
55
56 # check for -fvisibility=hidden compiler support (GCC >= 4)
57 saved_CFLAGS="$CFLAGS"
58 CFLAGS="$CFLAGS -fvisibility=hidden -fvisibility-inlines-hidden"
59 AC_MSG_CHECKING([if ${CXX} supports -fvisibility=hidden -fvisibility-inlines-hidden])
60 AC_COMPILE_IFELSE([char foo;],
61       [ AC_MSG_RESULT([yes])
62         SYMBOL_VISIBILITY="-fvisibility=hidden" SYMBOL_VISIBILITY_INLINES="-fvisibility-inlines-hidden" ],
63         AC_MSG_RESULT([no]))
64 CFLAGS="$saved_CFLAGS"
65 AC_SUBST(SYMBOL_VISIBILITY)
66 AC_SUBST(SYMBOL_VISIBILITY_INLINES)
67
68 AC_PATH_PROG(PERL, perl)
69 if test -z "$PERL"; then
70    AC_MSG_ERROR([You need 'perl' to compile WebKit])
71 fi
72
73 AC_PATH_PROG(BISON, bison)
74 if test -z "$BISON"; then
75    AC_MSG_ERROR([You need the 'bison' parser generator to compile WebKit])
76 fi
77
78 AC_PATH_PROG(FLEX, flex)
79 if test -z "$FLEX"; then
80    AC_MSG_ERROR([You need the 'flex' lexer generator to compile WebKit])
81 fi
82
83 AC_PATH_PROG(GPERF, gperf)
84 if test -z "$GPERF"; then
85    AC_MSG_ERROR([You need the 'gperf' hash function generator to compile WebKit])
86 fi
87
88 AC_PATH_PROG(MV, mv)
89 if test -z "$MV"; then
90    AC_MSG_ERROR([You need 'mv' to compile WebKit])
91 fi
92
93 # GTK+ port only
94 # Check for glib-genmarshal and glib-mkenums
95 AC_PATH_PROG([GLIB_GENMARSHAL], [glib-genmarshal])
96 AC_PATH_PROG([GLIB_MKENUMS],[glib-mkenums])
97
98 # Check whether a C++ was found (AC_PROG_CXX sets $CXX to "g++" even when it
99 # doesn't exist)
100 AC_LANG_PUSH([C++])
101 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],[],[AC_MSG_ERROR([No C++ compiler found])])
102 AC_LANG_POP([C++])
103
104 # C/C++ Language Features
105 AC_C_CONST
106 AC_C_INLINE
107 AC_C_VOLATILE
108
109 # C/C++ Headers
110 AC_HEADER_STDC
111 AC_HEADER_STDBOOL
112
113 # pthread (not needed on Windows)
114 if test "$os_win32" = "no"; then
115 AC_CHECK_HEADERS([pthread.h],
116                  AC_DEFINE([HAVE_PTHREAD_H],[1],[Define if pthread exist]),
117                  AC_MSG_ERROR([pthread support is required to build WebKit]))
118 fi
119
120 # libjpeg headers
121 AC_CHECK_HEADERS([jpeglib.h])
122
123 # check for pkg-config
124 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
125 if test "$PKG_CONFIG" = "no"; then
126    AC_MSG_ERROR([Cannot find pkg-config, make sure it is installed in your PATH])
127 fi
128
129 # check for icu-config
130 AC_PATH_PROG(icu_config, icu-config, no)
131 if test "$icu_config" = "no"; then
132    AC_MSG_ERROR([Cannot find icu-config. ICU library is needed.])
133 fi
134
135 # We don't use --cflags as this gives us a lot of things that we don't
136 # necessarily want, like debugging and optimization flags
137 # See man (1) icu-config for more info.
138 ICU_CPPFLAGS=`$icu_config --cppflags`
139 ICU_LIBS=`$icu_config --ldflags`
140 AC_SUBST([ICU_CPPFLAGS])
141 AC_SUBST([ICU_LIBS])
142
143 # determine the GDK/GTK+ target
144 AC_MSG_CHECKING([the target windowing system])
145 AC_ARG_WITH(target,
146             AC_HELP_STRING([--with-target=@<:@x11/win32/quartz/directfb@:>@],
147                            [Select webkit target [default=x11]]),
148             [],[with_target="x11"])
149
150 case "$with_target" in
151      x11|win32|quartz|directfb) ;;
152      *) AC_MSG_ERROR([Invalid target: must be x11, quartz, win32, or directfb.]) ;;
153 esac
154
155 AC_MSG_RESULT([$with_target])
156
157 AC_MSG_CHECKING([for Hildon UI extensions])
158 AC_ARG_WITH(hildon,
159             AC_HELP_STRING([--with-hildon],
160                            [Use Hildon UI extensions [default=no]]),
161             [],[with_hildon="no"])
162 AC_MSG_RESULT([$with_hildon])
163
164 if test "$with_hildon" = "yes"; then
165     HILDON_CPPFLAGS="-DMAEMO_CHANGES"
166     PKG_CHECK_MODULES([HILDON], [hildon-1])
167     AC_SUBST([HILDON_CPPFLAGS])
168     AC_SUBST([HILDON_CFLAGS])
169     AC_SUBST([HILDON_LIBS])
170 fi
171
172 # determine the http backend
173 AC_MSG_CHECKING([the HTTP backend to use])
174 AC_ARG_WITH(http_backend,
175             AC_HELP_STRING([--with-http-backend=@<:@curl@:>@],
176                            [Select HTTP backend [default=curl]]),
177             [],[http_backend="curl"])
178
179 case "$http_backend" in
180      curl) ;;
181      *) AC_MSG_ERROR([Invalid HTTP backend: must be curl.]) ;;
182 esac
183
184 AC_MSG_RESULT([$http_backend])
185
186 # minimum base dependencies
187 CAIRO_REQUIRED_VERSION=1.4
188 FONTCONFIG_REQUIRED_VERSION=2.4
189 FREETYPE2_REQUIRED_VERSION=9.0
190 LIBXML_REQUIRED_VERSION=2.6
191
192 # minimum GTK+ base dependencies
193 GLIB_REQUIRED_VERSION=2.0
194 GOBJECT_REQUIRED_VERSION=2.0
195 GTHREAD_REQUIRED_VERSION=2.0
196 PANGO_REQUIRED_VERSION=1.0
197 GTK_REQUIRED_VERSION=2.8
198
199 # optional modules
200 LIBCURL_REQUIRED_VERSION=7.15
201 LIBXSLT_REQUIRED_VERSION=1.1.7
202 SQLITE_REQUIRED_VERSION=3.0
203 GSTREAMER_REQUIRED_VERSION=0.10
204 GNOME_VFS_REQUIRED_VERSION=2.0
205
206 PKG_CHECK_MODULES([GLOBALDEPS],
207                   [glib-2.0 >= $GLIB_REQUIRED_VERSION
208                   gobject-2.0 >= $GOBJECT_REQUIRED_VERSION
209                   gthread-2.0 >= $GTHREAD_REQUIRED_VERSION])
210 AC_SUBST([GLOBALDEPS_CFLAGS])
211 AC_SUBST([GLOBALDEPS_LIBS])
212
213 PKG_CHECK_MODULES([WEBKITDEPS],
214                   [gtk+-2.0 >= $GTK_REQUIRED_VERSION
215                   pango >= $PANGO_REQUIRED_VERSION
216                   cairo >= $CAIRO_REQUIRED_VERSION
217                   cairo-ft,
218                   fontconfig >= $FONTCONFIG_REQUIRED_VERSION
219                   freetype2 >= $FREETYPE2_REQUIRED_VERSION
220                   libxml-2.0 >= $LIBXML_REQUIRED_VERSION])
221 AC_SUBST([WEBKITDEPS_CFLAGS])
222 AC_SUBST([WEBKITDEPS_LIBS])
223
224 # check whether to build with debugging enabled
225 AC_MSG_CHECKING([whether to do a debug build])
226 AC_ARG_ENABLE(debug,
227               AC_HELP_STRING([--enable-debug],
228                              [turn on debugging [default=no]]),
229               [],[enable_debug="no"])
230 AC_MSG_RESULT([$enable_debug])
231
232 # check whether to build with cross-document messaging support
233 AC_MSG_CHECKING([whether to enable HTML5 cross-document messaging support])
234 AC_ARG_ENABLE(cross_document_messaging,
235               AC_HELP_STRING([--enable-cross-document-messaging],
236                              [enable HTML5 cross-document messaging support [default=yes]]),
237               [],[enable_cross_document_messaging="yes"])
238 AC_MSG_RESULT([$enable_cross_document_messaging])
239
240 # check whether to build with database support
241 AC_MSG_CHECKING([whether to enable HTML5 client-side storage support])
242 AC_ARG_ENABLE(database,
243               AC_HELP_STRING([--enable-database],
244                              [enable HTML5 client-side storage support [default=yes]]),
245               [],[enable_database="yes"])
246 AC_MSG_RESULT([$enable_database])
247
248 # check whether to build with icon database support
249 AC_MSG_CHECKING([whether to enable icon database support])
250 AC_ARG_ENABLE(icon_database,
251               AC_HELP_STRING([--enable-icon-database],
252                              [enable icon database [default=no]]),
253               [],[enable_icon_database="no"])
254 AC_MSG_RESULT([$enable_icon_database])
255
256 # check whether to enable HTML5 audio/video support
257 AC_MSG_CHECKING([whether to enable HTML5 video support])
258 AC_ARG_ENABLE(video,
259               AC_HELP_STRING([--enable-video],
260                              [enable HTML5 video support [default=no]]),
261               [],[enable_video="no"])
262 AC_MSG_RESULT([$enable_video])
263
264 # check whether to enable XPath support
265 AC_MSG_CHECKING([whether to enable XPath support])
266 AC_ARG_ENABLE(xpath,
267               AC_HELP_STRING([--enable-xpath],
268                              [enable support for XPath [default=yes]]),
269               [],[enable_xpath="yes"])
270 AC_MSG_RESULT([$enable_xpath])
271
272 # check whether to enable XSLT support
273 AC_MSG_CHECKING([whether to enable XSLT support])
274 AC_ARG_ENABLE(xslt,
275               AC_HELP_STRING([--enable-xslt],
276                              [enable support for XSLT [default=yes]]),
277               [],[enable_xslt="yes"])
278 AC_MSG_RESULT([$enable_xslt])
279
280 # check whether to enable SVG experimental features
281 # Enable all SVG if it is
282 AC_MSG_CHECKING([whether to enable SVG experimental features])
283 AC_ARG_ENABLE(svg_experimental,
284               AC_HELP_STRING([--enable-svg-experimental],
285                              [enable support for SVG experimental features [default=no]]),
286               [],[enable_svg_experimental="no"])
287 AC_MSG_RESULT([$enable_svg_experimental])
288
289 if test "$enable_svg_experimental" = "yes"; then
290    enable_svg=yes
291    enable_svg_animation=yes
292 #   enable_svg_filters=yes
293    enable_svg_fonts=yes
294    enable_svg_foreign_object=yes
295    enable_svg_as_image=yes
296    enable_svg_use_element=yes
297 fi
298
299 # check whether to enable SVG support
300 AC_MSG_CHECKING([whether to enable SVG support])
301 AC_ARG_ENABLE(svg,
302               AC_HELP_STRING([--enable-svg],
303                              [enable support for SVG [default=no]]),
304               [],[enable_svg="no"])
305 AC_MSG_RESULT([$enable_svg])
306
307 # check whether to enable support for SVG animation
308 AC_MSG_CHECKING([whether to enable support for SVG animation])
309 AC_ARG_ENABLE(svg_animation,
310               AC_HELP_STRING([--enable-svg-animation],
311                              [enable support for SVG animation (experimental) [default=no]]),
312               [],[enable_svg_animation="no"])
313 AC_MSG_RESULT([$enable_svg_animation])
314
315 # check whether to enable support for SVG filters
316 AC_MSG_CHECKING([whether to enable support for SVG filters])
317 AC_ARG_ENABLE(svg_filters,
318               AC_HELP_STRING([--enable-svg-filters],
319                              [enable support for SVG filters (experimental) [default=no]]),
320               [],[enable_svg_filters="no"])
321 AC_MSG_RESULT([$enable_svg_filters])
322
323 # check whether to enable support for SVG fonts
324 AC_MSG_CHECKING([whether to enable support for SVG fonts])
325 AC_ARG_ENABLE(svg_fonts,
326               AC_HELP_STRING([--enable-svg-fonts],
327                              [enable support for SVG fonts (experimental) [default=no]]),
328               [],[enable_svg_fonts="no"])
329 AC_MSG_RESULT([$enable_svg_fonts])
330
331 # check whether to enable foreign objects support for SVG
332 AC_MSG_CHECKING([whether to enable support for SVG foreign objects])
333 AC_ARG_ENABLE(svg_foreign_object,
334               AC_HELP_STRING([--enable-svg-foreign-object],
335                              [enable support for SVG foreign objects (experimental) [default=no]]),
336               [],[enable_svg_foreign_object="no"])
337 AC_MSG_RESULT([$enable_svg_foreign_object])
338
339 # check whether to enable SVG As Image support
340 AC_MSG_CHECKING([whether to enable SVG as Image support])
341 AC_ARG_ENABLE(svg_as_image,
342               AC_HELP_STRING([--enable-svg-as-image],
343                              [enable SVG as Image support (experimental) [default=no]]),
344               [],[enable_svg_as_image="no"])
345 AC_MSG_RESULT([$enable_svg_as_image])
346
347 # check whether to enable SVG USE element support
348 AC_MSG_CHECKING([whether to enable support for SVG use element])
349 AC_ARG_ENABLE(svg_use_element,
350               AC_HELP_STRING([--enable-svg-use-element],
351                              [enable SVG use element support (experimental) [default=no]]),
352               [],[enable_svg_use_element="no"])
353 AC_MSG_RESULT([$enable_svg_use_element])
354
355 # check whether to enable code coverage
356 AC_MSG_CHECKING([whether to enable code coverage support])
357 AC_ARG_ENABLE(coverage,
358               AC_HELP_STRING([--enable-coverage],
359                              [enable code coverage support [default=no]]),
360               [],[enable_coverage="no"])
361 AC_MSG_RESULT([$enable_coverage])
362
363 # check whether to enable FastMalloc
364 AC_MSG_CHECKING([whether to enable optimized memory allocator])
365 AC_ARG_ENABLE(fast_malloc,
366               AC_HELP_STRING([--enable-fast-malloc],
367                              [enable optimized memory allocator default=yes, default=no for debug builds]),
368               [],[if test "$enable_debug" = "yes"; then enable_fast_malloc="no"; else enable_fast_malloc="yes"; fi])
369 AC_MSG_RESULT([$enable_fast_malloc])
370
371 # Add '-g' flag to gcc if it's debug build
372 if test "$enable_debug" = "yes"; then
373    CXXFLAGS="$CXXFLAGS -g"
374    CFLAGS="$CFLAGS -g"
375 fi
376
377 # check if curl is available
378 if test "$http_backend" = "curl"; then
379    PKG_CHECK_MODULES([LIBCURL],
380                      [libcurl >= $LIBCURL_REQUIRED_VERSION])
381    AC_SUBST([LIBCURL_CFLAGS])
382    AC_SUBST([LIBCURL_LIBS])
383 fi
384
385 # check if sqlite 3 is available
386 if test "$enable_icon_database" = "yes" || test "$enable_database" = "yes"; then
387    PKG_CHECK_MODULES([SQLITE3], [sqlite3 >= $SQLITE_REQUIRED_VERSION])
388    AC_SUBST([SQLITE3_CFLAGS])
389    AC_SUBST([SQLITE3_LIBS])
390 fi
391
392 # check if libxslt is available
393 if test "$enable_xslt" = "yes"; then
394    PKG_CHECK_MODULES([LIBXSLT],[libxslt >= $LIBXSLT_REQUIRED_VERSION])
395    AC_SUBST([LIBXSLT_CFLAGS])
396    AC_SUBST([LIBXSLT_LIBS])
397 fi
398
399 # check if gstreamer is available
400 if test "$enable_video" = "yes"; then
401    PKG_CHECK_MODULES([GSTREAMER],
402                      [gstreamer-0.10 >= $GSTREAMER_REQUIRED_VERSION
403                      gstreamer-base-0.10,
404                      gstreamer-plugins-base-0.10,
405                      gnome-vfs-2.0 >= $GNOME_VFS_REQUIRED_VERSION])
406    AC_SUBST([GSTREAMER_CFLAGS])
407    AC_SUBST([GSTREAMER_LIBS])
408 fi
409
410 # check for code coverage support
411 if test "$enable_coverage" = "yes"; then
412    COVERAGE_CFLAGS="-MD"
413    COVERAGE_LDFLAGS="-ftest-coverage -fprofile-arcs"
414    AC_SUBST([COVERAGE_CFLAGS])
415    AC_SUBST([COVERAGE_LDFLAGS])
416 fi
417
418 # check for SVG features, enabling SVG if necessary
419 if test "$enable_svg_animation" = "yes" || \
420    test "$enable_svg_filters" = "yes" || \
421    test "$enable_svg_fonts" = "yes" || \
422    test "$enable_svg_foreign_object" = "yes" || \
423    test "$enable_svg_as_image" = "yes" || \
424    test "$enable_svg_use_element" = "yes"; then
425    svg_flags=yes
426    if test "$enable_svg" = "no"; then
427        AC_MSG_WARN([SVG feature(s) requested but SVG is disabled.. Enabling SVG support])
428        enable_svg=yes
429    fi
430 fi
431
432 # OS conditionals
433 AM_CONDITIONAL([OS_WIN32],[test "$os_win32" = "yes"])
434 AM_CONDITIONAL([OS_UNIX],[test "$os_win32" = "no"])
435 AM_CONDITIONAL([OS_LINUX],[test "$os_linux" = "yes"])
436 AM_CONDITIONAL([OS_FREEBSD],[test "$os_freebsd" = "yes"])
437
438 # target conditionals
439 AM_CONDITIONAL([TARGET_X11], [test "$with_target" = "x11"])
440 AM_CONDITIONAL([TARGET_WIN32], [test "$with_target" = "win32"])
441 AM_CONDITIONAL([TARGET_QUARTZ], [test "$with_target" = "quartz"])
442 AM_CONDITIONAL([TARGET_DIRECTFB], [test "$with_target" = "directfb"])
443
444 # HTTP backend conditionals
445 AM_CONDITIONAL([USE_CURL], [test "$http_backend" = "curl"])
446
447 # WebKit feature conditionals
448 AM_CONDITIONAL([ENABLE_DEBUG],[test "$enable_debug" = "yes"])
449 AM_CONDITIONAL([ENABLE_CROSS_DOCUMENT_MESSAGING],[test "$enable_cross_document_messaging" = "yes"])
450 AM_CONDITIONAL([ENABLE_DATABASE],[test "$enable_database" = "yes"])
451 AM_CONDITIONAL([ENABLE_ICONDATABASE],[test "$enable_icon_database" = "yes"])
452 AM_CONDITIONAL([ENABLE_XPATH],[test "$enable_xpath" = "yes"])
453 AM_CONDITIONAL([ENABLE_XSLT],[test "$enable_xslt" = "yes"])
454 AM_CONDITIONAL([ENABLE_VIDEO],[test "$enable_video" = "yes"])
455 AM_CONDITIONAL([ENABLE_SVG],[test "$enable_svg" = "yes"])
456 AM_CONDITIONAL([ENABLE_SVG_ANIMATION],[test "$enable_svg_animation" = "yes"])
457 AM_CONDITIONAL([ENABLE_SVG_FILTERS],[test "$enable_svg_filters" = "yes"])
458 AM_CONDITIONAL([ENABLE_SVG_FONTS],[test "$enable_svg_fonts" = "yes"])
459 AM_CONDITIONAL([ENABLE_SVG_FOREIGN_OBJECT],[test "$enable_svg_foreign_object" = "yes"])
460 AM_CONDITIONAL([ENABLE_SVG_AS_IMAGE],[test "$enable_svg_as_image" = "yes"])
461 AM_CONDITIONAL([ENABLE_SVG_USE],[test "$enable_svg_use_element" = "yes"])
462 AM_CONDITIONAL([ENABLE_COVERAGE],[test "$enable_coverage" = "yes"])
463 AM_CONDITIONAL([ENABLE_FAST_MALLOC],[test "$enable_fast_malloc" = "yes"])
464 AM_CONDITIONAL([SVG_FLAGS],[test "$svg_flags" = "yes"])
465
466 AC_CONFIG_FILES([
467 GNUmakefile
468 WebKit/gtk/webkit-1.0.pc:WebKit/gtk/webkit.pc.in
469 ]
470 )
471
472 AC_OUTPUT
473
474 echo "
475 WebKit was configured with the following options:
476
477 Build configuration:
478  Enable debugging (slow)           : $enable_debug
479  Code coverage support             : $enable_coverage
480  HTTP backend                      : $http_backend
481  Optimized memory allocator        : $enable_fast_malloc
482 Features:
483  HTML5 cross-document messaging    : $enable_cross_document_messaging
484  HTML5 client-side storage support : $enable_database
485  HTML5 video element support       : $enable_video
486  Icon database support             : $enable_icon_database
487  SVG support                       : $enable_svg
488  SVG animation support             : $enable_svg_animation
489  SVG filters support               : $enable_svg_filters
490  SVG fonts support                 : $enable_svg_fonts
491  SVG foreign object support        : $enable_svg_foreign_object
492  SVG as image support              : $enable_svg_as_image
493  SVG use element support           : $enable_svg_use_element
494  XPATH support                     : $enable_xpath
495  XSLT support                      : $enable_xslt
496 GTK+ configuration:
497  GDK target                        : $with_target
498  Hildon UI extensions              : $with_hildon
499 "