2008-02-04 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
114 AC_CHECK_HEADERS([pthread.h],
115                  AC_DEFINE([HAVE_PTHREAD_H],[1],[Define if pthread exist]),
116                  AC_MSG_ERROR([pthread support is required to build WebKit]))
117
118 # libjpeg headers
119 AC_CHECK_HEADERS([jpeglib.h])
120
121 # check for pkg-config
122 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
123 if test "$PKG_CONFIG" = "no"; then
124    AC_MSG_ERROR([Cannot find pkg-config, make sure it is installed in your PATH])
125 fi
126
127 # check for icu-config
128 AC_PATH_PROG(icu_config, icu-config, no)
129 if test "$icu_config" = "no"; then
130    AC_MSG_ERROR([Cannot find icu-config. ICU library is needed.])
131 fi
132
133 # We don't use --cflags as this gives us a lot of things that we don't
134 # necessarily want, like debugging and optimization flags
135 # See man (1) icu-config for more info.
136 ICU_CPPFLAGS=`$icu_config --cppflags`
137 ICU_LIBS=`$icu_config --ldflags`
138 AC_SUBST([ICU_CPPFLAGS])
139 AC_SUBST([ICU_LIBS])
140
141 # determine the GDK/GTK+ target
142 AC_MSG_CHECKING([the target for WebKit GTK+])
143 AC_ARG_WITH(webkit_target,
144             AC_HELP_STRING([--with-webkit-target=@<:@x11/win32/quartz/directfb@:>@],
145                            [Select webkit target [default=x11]]),
146             [],[with_webkit_target="x11"])
147
148 case "$with_webkit_target" in
149      x11|win32|quartz|directfb) ;;
150      *) AC_MSG_ERROR([Invalid target: must be x11, quartz, win32, or directfb.]) ;;
151 esac
152
153 AC_MSG_RESULT([$with_webkit_target])
154
155
156 # determine the http backend
157 AC_MSG_CHECKING([the HTTP backend to use])
158 AC_ARG_WITH(http_backend,
159             AC_HELP_STRING([--with-http-backend=@<:@curl@:>@],
160                            [Select HTTP backend [default=curl]]),
161             [],[http_backend="curl"])
162
163 case "$http_backend" in
164      curl) ;;
165      *) AC_MSG_ERROR([Invalid HTTP backend: must be curl.]) ;;
166 esac
167
168 AC_MSG_RESULT([$http_backend])
169
170
171 # minimum base dependencies
172 GLIB_REQUIRED_VERSION=2.0
173 GOBJECT_REQUIRED_VERSION=2.0
174 GTHREAD_REQUIRED_VERSION=2.0
175 PANGO_REQUIRED_VERSION=1.0
176 CAIRO_REQUIRED_VERSION=1.2
177 FONTCONFIG_REQUIRED_VERSION=2.4
178 FREETYPE2_REQUIRED_VERSION=9.0
179 LIBXML_REQUIRED_VERSION=2.6
180
181 # optional modules
182 GTK_REQUIRED_VERSION=2.0
183 LIBCURL_REQUIRED_VERSION=7.15
184 LIBXSLT_REQUIRED_VERSION=1.1.7
185 SQLITE_REQUIRED_VERSION=3.0
186 GSTREAMER_REQUIRED_VERSION=0.10
187 GNOME_VFS_REQUIRED_VERSION=2.0
188
189 PKG_CHECK_MODULES([DEPENDENCIES],
190                   [glib-2.0 >= $GLIB_REQUIRED_VERSION
191                   gobject-2.0 >= $GOBJECT_REQUIRED_VERSION
192                   gthread-2.0 >= $GTHREAD_REQUIRED_VERSION
193                   gtk+-2.0 >= $GTK_REQUIRED_VERSION
194                   pango >= $PANGO_REQUIRED_VERSION
195                   cairo >= $CAIRO_REQUIRED_VERSION
196                   cairo-ft,
197                   fontconfig >= $FONTCONFIG_REQUIRED_VERSION
198                   freetype2 >= $FREETYPE2_REQUIRED_VERSION
199                   libxml-2.0 >= $LIBXML_REQUIRED_VERSION])
200 AC_SUBST([DEPENDENCIES_CFLAGS])
201 AC_SUBST([DEPENDENCIES_LIBS])
202
203 # check whether to build with debugging enabled
204 AC_MSG_CHECKING([whether to do a debug build])
205 AC_ARG_ENABLE(debug,
206               AC_HELP_STRING([--enable-debug],
207                              [turn on debugging [default=no]]),
208               [],[enable_debug="no"])
209 AC_MSG_RESULT([$enable_debug])
210
211 # check whether to build with database support
212 AC_MSG_CHECKING([whether to enable HTML5 client-side storage support])
213 AC_ARG_ENABLE(database,
214               AC_HELP_STRING([--enable-database],
215                              [enable HTML5 client-side storage support [default=yes]]),
216               [],[enable_database="yes"])
217 AC_MSG_RESULT([$enable_database])
218
219 # check whether to build with icon database support
220 AC_MSG_CHECKING([whether to enable icon database support])
221 AC_ARG_ENABLE(icon_database,
222               AC_HELP_STRING([--enable-icon-database],
223                              [enable icon database [default=no]]),
224               [],[enable_icon_database="no"])
225 AC_MSG_RESULT([$enable_icon_database])
226
227 # check whether to enable HTML5 audio/video support
228 AC_MSG_CHECKING([whether to enable HTML5 video support])
229 AC_ARG_ENABLE(video,
230               AC_HELP_STRING([--enable-video],
231                              [enable HTML5 video support [default=no]]),
232               [],[enable_video="no"])
233 AC_MSG_RESULT([$enable_video])
234
235 # check whether to enable XPath support
236 AC_MSG_CHECKING([whether to enable XPath support])
237 AC_ARG_ENABLE(xpath,
238               AC_HELP_STRING([--enable-xpath],
239                              [enable support for XPath [default=yes]]),
240               [],[enable_xpath="yes"])
241 AC_MSG_RESULT([$enable_xpath])
242
243 # check whether to enable XSLT support
244 AC_MSG_CHECKING([whether to enable XSLT support])
245 AC_ARG_ENABLE(xslt,
246               AC_HELP_STRING([--enable-xslt],
247                              [enable support for XSLT [default=yes]]),
248               [],[enable_xslt="yes"])
249 AC_MSG_RESULT([$enable_xslt])
250
251 # check whether to enable SVG experimental features
252 # Enable all SVG if it is
253 AC_MSG_CHECKING([whether to enable SVG experimental features])
254 AC_ARG_ENABLE(svg_experimental,
255               AC_HELP_STRING([--enable-svg-experimental],
256                              [enable support for SVG experimental features [default=no]]),
257               [],[enable_svg_experimental="no"])
258 AC_MSG_RESULT([$enable_svg_experimental])
259
260 if test "$enable_svg_experimental" = "yes"; then
261    enable_svg=yes
262    enable_svg_animation=yes
263    enable_svg_filters=yes
264    enable_svg_fonts=yes
265    enable_svg_foreign_object=yes
266    enable_svg_as_image=yes
267    enable_svg_use_element=yes
268 fi
269
270 # check whether to enable SVG support
271 AC_MSG_CHECKING([whether to enable SVG support])
272 AC_ARG_ENABLE(svg,
273               AC_HELP_STRING([--enable-svg],
274                              [enable support for SVG [default=no]]),
275               [],[enable_svg="no"])
276 AC_MSG_RESULT([$enable_svg])
277
278 # check whether to enable support for SVG animation
279 AC_MSG_CHECKING([whether to enable support for SVG animataion])
280 AC_ARG_ENABLE(svg_animation,
281               AC_HELP_STRING([--enable-svg-animation],
282                              [enable support for SVG animation (experimental) [default=no]]),
283               [],[enable_svg_animation="no"])
284 AC_MSG_RESULT([$enable_svg_animation])
285
286 # check whether to enable support for SVG filters
287 AC_MSG_CHECKING([whether to enable support for SVG filters])
288 AC_ARG_ENABLE(svg_filters,
289               AC_HELP_STRING([--enable-svg-filters],
290                              [enable support for SVG filters (experimental) [default=no]]),
291               [],[enable_svg_filters="no"])
292 AC_MSG_RESULT([$enable_svg_filters])
293
294 # check whether to enable support for SVG fonts
295 AC_MSG_CHECKING([whether to enable support for SVG fonts])
296 AC_ARG_ENABLE(svg_fonts,
297               AC_HELP_STRING([--enable-svg-fonts],
298                              [enable support for SVG fonts (experimental) [default=no]]),
299               [],[enable_svg_fonts="no"])
300 AC_MSG_RESULT([$enable_svg_fonts])
301
302 # check whether to enable foreign objects support for SVG
303 AC_MSG_CHECKING([whether to enable support for SVG foreign objects])
304 AC_ARG_ENABLE(svg_foreign_object,
305               AC_HELP_STRING([--enable-svg-foreign-object],
306                              [enable support for SVG foreign objects (experimental) [default=no]]),
307               [],[enable_svg_foreign_object="no"])
308 AC_MSG_RESULT([$enable_svg_foreign_object])
309
310 # check whether to enable SVG As Image support
311 AC_MSG_CHECKING([whether to enable SVG as Image support])
312 AC_ARG_ENABLE(svg_as_image,
313               AC_HELP_STRING([--enable-svg-as-image],
314                              [enable SVG as Image support (experimental) [default=no]]),
315               [],[enable_svg_as_image="no"])
316 AC_MSG_RESULT([$enable_svg_as_image])
317
318 # check whether to enable SVG USE element support
319 AC_MSG_CHECKING([whether to enable support for SVG use element])
320 AC_ARG_ENABLE(svg_use_element,
321               AC_HELP_STRING([--enable-svg-use-element],
322                              [enable SVG use element support (experimental) [default=no]]),
323               [],[enable_svg_use_element="no"])
324 AC_MSG_RESULT([$enable_svg_use_element])
325
326 # check whether to enable code coverage
327 AC_MSG_CHECKING([whether to enable code coverage support])
328 AC_ARG_ENABLE(coverage,
329               AC_HELP_STRING([--enable-coverage],
330                              [enable code coverage support [default=no]]),
331               [],[enable_coverage="no"])
332 AC_MSG_RESULT([$enable_coverage])
333
334 # check whether to enable FastMalloc
335 AC_MSG_CHECKING([whether to enable optimized memory allocator])
336 AC_ARG_ENABLE(fast_malloc,
337               AC_HELP_STRING([--enable-fast-malloc],
338                              [enable optimized memory allocator default=yes, default=no for debug builds]),
339               [],[if test "$enable_debug" = "yes"; then enable_fast_malloc="no"; else enable_fast_malloc="yes"; fi])
340 AC_MSG_RESULT([$enable_fast_malloc])
341
342 # Add '-g' flag to gcc if it's debug build
343 if test "$enable_debug" = "yes"; then
344    CXXFLAGS="$CXXFLAGS -g"
345    CFLAGS="$CFLAGS -g"
346 fi
347
348 # check if curl is available
349 if test "$http_backend" = "curl"; then
350    PKG_CHECK_MODULES([LIBCURL],
351                      [libcurl >= $LIBCURL_REQUIRED_VERSION])
352    AC_SUBST([LIBCURL_CFLAGS])
353    AC_SUBST([LIBCURL_LIBS])
354 fi
355
356 # check if sqlite 3 is available
357 if test "$enable_icon_database" = "yes" || test "$enable_database" = "yes"; then
358    PKG_CHECK_MODULES([SQLITE3], [sqlite3 >= $SQLITE_REQUIRED_VERSION])
359    AC_SUBST([SQLITE3_CFLAGS])
360    AC_SUBST([SQLITE3_LIBS])
361 fi
362
363 # check if libxslt is available
364 if test "$enable_xslt" = "yes"; then
365    PKG_CHECK_MODULES([LIBXSLT],[libxslt >= $LIBXSLT_REQUIRED_VERSION])
366    AC_SUBST([LIBXSLT_CFLAGS])
367    AC_SUBST([LIBXSLT_LIBS])
368 fi
369
370 # check if gstreamer is available
371 if test "$enable_video" = "yes"; then
372    PKG_CHECK_MODULES([GSTREAMER],
373                      [gstreamer-0.10 >= $GSTREAMER_REQUIRED_VERSION
374                      gstreamer-base-0.10,
375                      gstreamer-plugins-base-0.10,
376                      gnome-vfs-2.0 >= $GNOME_VFS_REQUIRED_VERSION])
377    AC_SUBST([GSTREAMER_CFLAGS])
378    AC_SUBST([GSTREAMER_LIBS])
379 fi
380
381 # check for code coverage support
382 if test "$enable_coverage" = "yes"; then
383    COVERAGE_CFLAGS="-MD"
384    COVERAGE_LDFLAGS="-ftest-coverage -fprofile-arcs"
385    AC_SUBST([COVERAGE_CFLAGS])
386    AC_SUBST([COVERAGE_LDFLAGS])
387 fi
388
389 # check for SVG features, enabling SVG if necessary
390 if test "$enable_svg_animation" = "yes" || \
391    test "$enable_svg_filters" = "yes" || \
392    test "$enable_svg_fonts" = "yes" || \
393    test "$enable_svg_foreign_object" = "yes" || \
394    test "$enable_svg_as_image" = "yes" || \
395    test "$enable_svg_use_element" = "yes"; then
396    svg_flags=yes
397    if test "$enable_svg" = "no"; then
398        AC_MSG_WARN([SVG feature(s) requested but SVG is disabled.. Enabling SVG support])
399        enable_svg=yes
400    fi
401 fi
402
403 # OS conditionals
404 AM_CONDITIONAL([OS_WIN32],[test "$os_win32" = "yes"])
405 AM_CONDITIONAL([OS_UNIX],[test "$os_win32" = "no"])
406 AM_CONDITIONAL([OS_LINUX],[test "$os_linux" = "yes"])
407 AM_CONDITIONAL([OS_FREEBSD],[test "$os_freebsd" = "yes"])
408
409 # target conditionals
410 AM_CONDITIONAL([TARGET_X11], [test "$with_webkit_target" = "x11"])
411 AM_CONDITIONAL([TARGET_WIN32], [test "$with_webkit_target" = "win32"])
412 AM_CONDITIONAL([TARGET_QUARTZ], [test "$with_webkit_target" = "quartz"])
413 AM_CONDITIONAL([TARGET_DIRECTFB], [test "$with_webkit_target" = "directfb"])
414
415 # HTTP backend conditionals
416 AM_CONDITIONAL([USE_CURL], [test "$http_backend" = "curl"])
417
418 # WebKit feature conditionals
419 AM_CONDITIONAL([ENABLE_DEBUG],[test "$enable_debug" = "yes"])
420 AM_CONDITIONAL([ENABLE_DATABASE],[test "$enable_database" = "yes"])
421 AM_CONDITIONAL([ENABLE_ICONDATABASE],[test "$enable_icon_database" = "yes"])
422 AM_CONDITIONAL([ENABLE_XPATH],[test "$enable_xpath" = "yes"])
423 AM_CONDITIONAL([ENABLE_XSLT],[test "$enable_xslt" = "yes"])
424 AM_CONDITIONAL([ENABLE_VIDEO],[test "$enable_video" = "yes"])
425 AM_CONDITIONAL([ENABLE_SVG],[test "$enable_svg" = "yes"])
426 AM_CONDITIONAL([ENABLE_SVG_ANIMATION],[test "$enable_svg_animation" = "yes"])
427 AM_CONDITIONAL([ENABLE_SVG_FILTERS],[test "$enable_svg_filters" = "yes"])
428 AM_CONDITIONAL([ENABLE_SVG_FONTS],[test "$enable_svg_fonts" = "yes"])
429 AM_CONDITIONAL([ENABLE_SVG_FOREIGN_OBJECT],[test "$enable_svg_foreign_object" = "yes"])
430 AM_CONDITIONAL([ENABLE_SVG_AS_IMAGE],[test "$enable_svg_as_image" = "yes"])
431 AM_CONDITIONAL([ENABLE_SVG_USE],[test "$enable_svg_use_element" = "yes"])
432 AM_CONDITIONAL([ENABLE_COVERAGE],[test "$enable_coverage" = "yes"])
433 AM_CONDITIONAL([ENABLE_FAST_MALLOC],[test "$enable_fast_malloc" = "yes"])
434 AM_CONDITIONAL([SVG_FLAGS],[test "$svg_flags" = "yes"])
435
436 AC_CONFIG_FILES([
437 GNUmakefile
438 WebKit/gtk/webkit-1.0.pc:WebKit/gtk/webkit.pc.in
439 ]
440 )
441
442 AC_OUTPUT
443
444 echo "
445 WebKit was configured with the following options:
446
447  Target                            : $with_webkit_target
448  HTTP backend                      : $http_backend
449  Enable debug                      : $enable_debug
450  Code coverage support             : $enable_coverage
451  Optimized memory allocator        : $enable_fast_malloc
452  HTML5 client-side storage support : $enable_database
453  HTML5 video element support       : $enable_video
454  Icon database support             : $enable_icon_database
455  SVG support                       : $enable_svg
456  SVG animation support             : $enable_svg_animation
457  SVG filters support               : $enable_svg_filters
458  SVG fonts support                 : $enable_svg_fonts
459  SVG foreign object support        : $enable_svg_foreign_object
460  SVG as image support              : $enable_svg_as_image
461  SVG use element support           : $enable_svg_use_element
462  XPATH support                     : $enable_xpath
463  XSLT support                      : $enable_xslt
464 "