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