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