2007-12-26 Jan Michael Alonzo <jmalonzo@unpluggable.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([1.9 subdir-objects foreign tar-ustar])
13
14 AM_MAINTAINER_MODE
15
16 AC_CANONICAL_HOST
17
18 # host checking - inspired by the GTK+ configure.in
19 # TODO: os_mac, os_bsd
20 AC_MSG_CHECKING([for native Win32])
21 case "$host" in
22      *-*-mingw*)
23        os_win32=yes
24        ;;
25      *)
26        os_win32=no
27        ;;
28 esac
29 AC_MSG_RESULT([$os_win32])
30
31 case "$host" in
32      *-*-linux*)
33        os_linux=yes
34        ;;
35      *-*-freebsd*)
36        os_freebsd=yes
37        ;;
38 esac
39
40 # programs
41 AM_PROG_LIBTOOL
42 AC_PROG_INSTALL
43 AM_PROG_CC_STDC
44 AC_PROG_CXX
45 AM_PROG_CC_C_O
46
47 AC_PATH_PROG(PERL, perl)
48 if test -z "$PERL"; then
49    AC_MSG_ERROR([You need 'perl' to compile WebKit])
50 fi
51
52 AC_PATH_PROG(BISON, bison)
53 if test -z "$BISON"; then
54    AC_MSG_ERROR([You need the 'bison' parser generator to compile WebKit])
55 fi
56
57 AC_PATH_PROG(FLEX, flex)
58 if test -z "$FLEX"; then
59    AC_MSG_ERROR([You need the 'flex' lexer generator to compile WebKit])
60 fi
61
62 AC_PATH_PROG(GPERF, gperf)
63 if test -z "$GPERF"; then
64    AC_MSG_ERROR([You need the 'gperf' hash function generator to compile WebKit])
65 fi
66
67 AC_PATH_PROG(MV, mv)
68 if test -z "$MV"; then
69    AC_MSG_ERROR([You need 'mv' to compile WebKit])
70 fi
71
72 # GTK+ port only
73 # Check for glib-genmarshal and glib-mkenums
74 AC_PATH_PROG([GLIB_GENMARSHAL], [glib-genmarshal])
75 AC_PATH_PROG([GLIB_MKENUMS],[glib-mkenums])
76
77 # Check whether a C++ was found (AC_PROG_CXX sets $CXX to "g++" even when it
78 # doesn't exist)
79 AC_LANG_PUSH([C++])
80 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],[],[AC_MSG_ERROR([No C++ compiler found])])
81 AC_LANG_POP([C++])
82
83 # C/C++ Language Features
84 AC_C_CONST
85 AC_C_INLINE
86 AC_C_VOLATILE
87
88 # C/C++ Headers
89 AC_HEADER_STDC
90 AC_HEADER_STDBOOL
91
92 # pthread
93 AC_CHECK_HEADERS([pthread.h],
94                  AC_DEFINE([HAVE_PTHREAD_H],[1],[Define if pthread exist]),
95                  AC_MSG_ERROR([pthread support is required to build WebKit]))
96
97 # libjpeg headers
98 AC_CHECK_HEADERS([jpeglib.h])
99
100 # check for pkg-config
101 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
102 if test "$PKG_CONFIG" = "no"; then
103    AC_MSG_ERROR([Cannot find pkg-config, make sure it is installed in your PATH])
104 fi
105
106 # check for icu-config
107 AC_PATH_PROG(icu_config, icu-config, no)
108 if test "$icu_config" = "no"; then
109    AC_MSG_ERROR([Cannot find icu-config. ICU library is needed.])
110 fi
111 ICU_CFLAGS=`$icu_config --cflags`
112 ICU_LIBS=`$icu_config --ldflags`
113 AC_SUBST([ICU_CFLAGS])
114 AC_SUBST([ICU_LIBS])
115
116 # determine the GDK/GTK+ target
117 AC_MSG_CHECKING([the target for WebKit GTK+])
118 AC_ARG_WITH(webkittarget,
119             AC_HELP_STRING([--with-webkit-target=@<:@x11/win32/quartz/directfb@:>@],
120                            [Select webkit target [default=x11]]),
121             [],[with_webkittarget="x11"])
122
123 case "$with_webkittarget" in
124      x11|win32|quartz|directfb) ;;
125      *) AC_MSG_ERROR([Invalid target: must be x11, quartz, win32, or directfb.]) ;;
126 esac
127
128 AC_MSG_RESULT([$with_webkittarget])
129
130 # minimum base dependencies
131 GLIB_REQUIRED_VERSION=2.0
132 GOBJECT_REQUIRED_VERSION=2.0
133 GTHREAD_REQUIRED_VERSION=2.0
134 PANGO_REQUIRED_VERSION=1.0
135 CAIRO_REQUIRED_VERSION=1.2
136 FONTCONFIG_REQUIRED_VERSION=2.4
137 FREETYPE2_REQUIRED_VERSION=9.0
138 LIBCURL_REQUIRED_VERSION=7.15
139 LIBXML_REQUIRED_VERSION=2.6
140
141 # optional modules
142 GTK_REQUIRED_VERSION=2.0
143 LIBXSLT_REQUIRED_VERSION=1.1.7
144 SQLITE_REQUIRED_VERSION=3.0
145 GSTREAMER_REQUIRED_VERSION=0.10
146 GNOME_VFS_REQUIRED_VERSION=2.0
147
148 PKG_CHECK_MODULES([DEPENDENCIES],
149                   [glib-2.0 >= $GLIB_REQUIRED_VERSION
150                   gobject-2.0 >= $GOBJECT_REQUIRED_VERSION
151                   gthread-2.0 >= $GTHREAD_REQUIRED_VERSION
152                   gtk+-2.0 >= $GTK_REQUIRED_VERSION
153                   pango >= $PANGO_REQUIRED_VERSION
154                   libcurl >= $LIBCURL_REQUIRED_VERSION
155                   cairo >= $CAIRO_REQUIRED_VERSION
156                   cairo-ft,
157                   fontconfig >= $FONTCONFIG_REQUIRED_VERSION
158                   freetype2 >= $FREETYPE2_REQUIRED_VERSION
159                   libxml-2.0 >= $LIBXML_REQUIRED_VERSION])
160 AC_SUBST([DEPENDENCIES_CFLAGS])
161 AC_SUBST([DEPENDENCIES_LIBS])
162
163 # check whether to build with debugging enabled
164 AC_MSG_CHECKING([whether to do a debug build])
165 AC_ARG_ENABLE(debug,
166               AC_HELP_STRING([--enable-debug],
167                              [turn on debugging [default=no]]),
168               [enable_debug="yes"],[enable_debug="no"])
169 AC_MSG_RESULT([$enable_debug])
170
171 # check whether to build with database support
172 AC_MSG_CHECKING([whether to enable HTML5 client-side storage support])
173 AC_ARG_ENABLE(database,
174               AC_HELP_STRING([--enable-database],
175                              [enable HTML5 client-side storage support [default=no]]),
176               [],[enable_database="yes"])
177 AC_MSG_RESULT([$enable_database])
178
179 # check whether to build with icon database support
180 AC_MSG_CHECKING([whether to enable icon database support])
181 AC_ARG_ENABLE(icondatabase,
182               AC_HELP_STRING([--enable-icon-database],
183                              [enable icon database [default=no]]),
184               [],[enable_icon_database="yes"])
185 AC_MSG_RESULT([$enable_icon_database])
186
187 # check whether to enable HTML5 audio/video support
188 AC_MSG_CHECKING([whether to enable HTML5 video support])
189 AC_ARG_ENABLE(video,
190               AC_HELP_STRING([--enable-video],
191                              [enable HTML5 video support [default=no]]),
192               [enable_video="yes"],[enable_video="no"])
193 AC_MSG_RESULT([$enable_video])
194
195 # check whether to enable XPath support
196 AC_MSG_CHECKING([whether to enable XPath support])
197 AC_ARG_ENABLE(xpath,
198               AC_HELP_STRING([--enable-xpath],
199                              [enable support for XPath [default=no]]),
200               [],[enable_xpath="no"])
201 AC_MSG_RESULT([$enable_xpath])
202
203 # check whether to enable XBL support
204 AC_MSG_CHECKING([whether to enable XBL support])
205 AC_ARG_ENABLE(xbl,
206               AC_HELP_STRING([--enable-xbl],
207                              [enable support for XBL [default=no]]),
208               [],[enable_xbl="no"])
209 AC_MSG_RESULT([$enable_xbl])
210
211 # check whether to enable XSLT support
212 AC_MSG_CHECKING([whether to enable XSLT support])
213 AC_ARG_ENABLE(xslt,
214               AC_HELP_STRING([--enable-xslt],
215                              [enable support for XSLT [default=no]]),
216               [],[enable_xslt="no"])
217 AC_MSG_RESULT([$enable_xslt])
218
219 # check whether to enable SVG support
220 AC_MSG_CHECKING([whether to enable SVG support])
221 AC_ARG_ENABLE(svg,
222               AC_HELP_STRING([--enable-svg],
223                              [enable support for SVG [default=no]]),
224               [],[enable_svg="no"])
225 AC_MSG_RESULT([$enable_svg])
226
227 # check whether to enable support for SVG animation
228 AC_MSG_CHECKING([whether to enable support for SVG animataion])
229 AC_ARG_ENABLE(svg_animation,
230               AC_HELP_STRING([--enable-svg-animation],
231                              [enable support for SVG animation feature (experimental) [default=no]]),
232               [],[enable_svg_animation="no"])
233 AC_MSG_RESULT([$enable_svg_animation])
234
235 # check whether to enable support for SVG filters
236 AC_MSG_CHECKING([whether to enable support for SVG filters])
237 AC_ARG_ENABLE(svg_filters,
238               AC_HELP_STRING([--enable-svg-filters],
239                              [enable support for SVG filters (experimental) [default=no]]),
240               [],[enable_svg_filters="no"])
241 AC_MSG_RESULT([$enable_svg_filters])
242
243 # check whether to enable support for SVG fonts
244 AC_MSG_CHECKING([whether to enable support for SVG fonts])
245 AC_ARG_ENABLE(svg_fonts,
246               AC_HELP_STRING([--enable-svg-fonts],
247                              [enable support for SVG fonts (experimental) [default=no]]),
248               [],[enable_svg_fonts="no"])
249 AC_MSG_RESULT([$enable_svg_fonts])
250
251 # check whether to enable SVG As Image support
252 AC_MSG_CHECKING([whether to enable SVG as Image support])
253 AC_ARG_ENABLE(svg_as_image,
254               AC_HELP_STRING([--enable-svg-as-image],
255                              [enable SVG as Image support (experimental) [default=no]]),
256               [],[enable_svg_as_image="no"])
257 AC_MSG_RESULT([$enable_svg_as_image])
258
259 # check whether to enable SVG USE element support
260 AC_MSG_CHECKING([whether to enable support for SVG use element])
261 AC_ARG_ENABLE(svg_use_element,
262               AC_HELP_STRING([--enable-svg-use-element],
263                              [enable SVG use element support (experimental) [default=no]]),
264               [],[enable_svg_use_element="no"])
265 AC_MSG_RESULT([$enable_svg_use_element])
266
267 # check whether to enable code coverage
268 AC_MSG_CHECKING([whether to enable code coverage support])
269 AC_ARG_ENABLE(coverage,
270               AC_HELP_STRING([--enable-coverage],
271                              [enable code coverage support [default=no]]),
272               [],[enable_coverage="no"])
273 AC_MSG_RESULT([$enable_coverage])
274
275 # check if sqlite 3 is available
276 if test "$enable_icon_database" = "yes" || test "$enable_database" = "yes"; then
277    PKG_CHECK_MODULES([SQLITE3], [sqlite3 >= $SQLITE_REQUIRED_VERSION])
278    AC_SUBST([SQLITE3_CFLAGS])
279    AC_SUBST([SQLITE3_LIBS])
280 fi
281   
282 # check if libxslt is available
283 if test "$enable_xslt" = "yes"; then
284    PKG_CHECK_MODULES([LIBXSLT],[libxslt >= $LIBXSLT_REQUIRED_VERSION])
285    AC_SUBST([LIBXSLT_CFLAGS])
286    AC_SUBST([LIBXSLT_LIBS])
287 fi
288
289 # check if gstreamer is available
290 if test "$enable_video" = "yes"; then
291    PKG_CHECK_MODULES([GSTREAMER],
292                      [gstreamer-0.10 >= $GSTREAMER_REQUIRED_VERSION
293                      gstreamer-base-0.10,
294                      gstreamer-plugins-base-0.10,
295                      gnome-vfs-2.0 >= $GNOME_VFS_REQUIRED_VERSION])
296    AC_SUBST([GSTREAMER_CFLAGS])
297    AC_SUBST([GSTREAMER_LIBS])
298 fi
299
300 # check for code coverage support
301 if test "$enable_coverage" = "yes"; then
302    COVERAGE_CFLAGS="-MD"
303    COVERAGE_LDFLAGS="-ftest-coverage -fprofile-arcs"
304    AC_SUBST([COVERAGE_CFLAGS])
305    AC_SUBST([COVERAGE_LDFLAGS])
306 fi
307
308 # check for SVG features, enabling SVG if necessary
309 if test "$enable_svg" = "no" && (\
310    test "$enable_svg_animation" = "yes" || \
311    test "$enable_svg_filters" = "yes" || \
312    test "$enable_svg_fonts" = "yes" || \
313    test "$enable_svg_as_image" = "yes" || \
314    test "$enable_svg_use_element" = "yes"); then
315
316    AC_MSG_WARN([SVG feature(s) requested but SVG is disabled.. Enabling SVG support])
317    enable_svg = yes
318    svg_flags = yes
319 fi
320
321 # OS conditionals
322 AM_CONDITIONAL([OS_WIN32],[test "$os_win32" = "yes"])
323 AM_CONDITIONAL([OS_UNIX],[test "$os_win32" = "no"])
324 AM_CONDITIONAL([OS_LINUX],[test "$os_linux" = "yes"])
325 AM_CONDITIONAL([OS_FREEBSD],[test "$os_freebsd" = "yes"])
326
327 # target conditionals
328 AM_CONDITIONAL([TARGET_X11], [test "$with_webkittarget" = "x11"])
329 AM_CONDITIONAL([TARGET_WIN32], [test "$with_webkittarget" = "win32"])
330 AM_CONDITIONAL([TARGET_QUARTZ], [test "$with_webkittarget" = "quartz"])
331 AM_CONDITIONAL([TARGET_DIRECTFB], [test "$with_webkittarget" = "directfb"])
332
333 # WebKit feature conditionals
334 AM_CONDITIONAL([ENABLE_DEBUG],[test "$enable_debug" = "yes"])
335 AM_CONDITIONAL([ENABLE_DATABASE],[test "$enable_database" = "yes"])
336 AM_CONDITIONAL([ENABLE_ICONDATABASE],[test "$enable_icon_database" = "yes"])
337 AM_CONDITIONAL([ENABLE_XPATH],[test "$enable_xpath" = "yes"])
338 AM_CONDITIONAL([ENABLE_XBL],[test "$enable_xbl" = "yes"])
339 AM_CONDITIONAL([ENABLE_XSLT],[test "$enable_xslt" = "yes"])
340 AM_CONDITIONAL([ENABLE_VIDEO],[test "$enable_video" = "yes"])
341 AM_CONDITIONAL([ENABLE_SVG],[test "$enable_svg" = "yes"])
342 AM_CONDITIONAL([ENABLE_SVG_ANIMATION],[test "$enable_svg_animation" = "yes"])
343 AM_CONDITIONAL([ENABLE_SVG_FILTERS],[test "$enable_svg_filters" = "yes"])
344 AM_CONDITIONAL([ENABLE_SVG_FONTS],[test "$enable_svg_fonts" = "yes"])
345 AM_CONDITIONAL([ENABLE_SVG_AS_IMAGE],[test "$enable_svg_as_image" = "yes"])
346 AM_CONDITIONAL([ENABLE_SVG_USE],[test "$enable_svg_use_element" = "yes"])
347 AM_CONDITIONAL([ENABLE_COVERAGE],[test "$enable_coverage" = "yes"])
348 AM_CONDITIONAL([SVG_FLAGS],[test "$svg_flags" = "yes"])
349
350
351 AC_CONFIG_FILES([
352 GNUmakefile
353 WebKit/gtk/WebKitGtk.pc:WebKit/gtk/WebKitGtk.pc.in
354 ]
355 )
356
357 AC_OUTPUT
358
359 echo "
360 WebKit was configured with the following options:
361
362  Target                            : $with_webkittarget
363  Enable debug                      : $enable_debug
364  Icon database support             : $enable_icon_database
365  HTML5 client-side storage support : $enable_database
366  HTML5 video element support       : $enable_video
367  SVG support                       : $enable_svg
368  SVG animation support             : $enable_svg_animation
369  SVG filters support               : $enable_svg_filters
370  SVG fonts support                 : $enable_svg_fonts
371  SVG as image support              : $enable_svg_as_image
372  SVG use element support           : $enable_svg_use_element
373  XPATH support                     : $enable_xpath
374  XSLT support                      : $enable_xslt
375  XBL support                       : $enable_xbl
376  Code coverage support             : $enable_coverage
377 "