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