2008-01-15 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 ICU_CFLAGS=`$icu_config --cflags`
133 ICU_LIBS=`$icu_config --ldflags`
134 AC_SUBST([ICU_CFLAGS])
135 AC_SUBST([ICU_LIBS])
136
137 # determine the GDK/GTK+ target
138 AC_MSG_CHECKING([the target for WebKit GTK+])
139 AC_ARG_WITH(webkit_target,
140             AC_HELP_STRING([--with-webkit-target=@<:@x11/win32/quartz/directfb@:>@],
141                            [Select webkit target [default=x11]]),
142             [],[with_webkit_target="x11"])
143
144 case "$with_webkit_target" in
145      x11|win32|quartz|directfb) ;;
146      *) AC_MSG_ERROR([Invalid target: must be x11, quartz, win32, or directfb.]) ;;
147 esac
148
149 AC_MSG_RESULT([$with_webkit_target])
150
151 # minimum base dependencies
152 GLIB_REQUIRED_VERSION=2.0
153 GOBJECT_REQUIRED_VERSION=2.0
154 GTHREAD_REQUIRED_VERSION=2.0
155 PANGO_REQUIRED_VERSION=1.0
156 CAIRO_REQUIRED_VERSION=1.2
157 FONTCONFIG_REQUIRED_VERSION=2.4
158 FREETYPE2_REQUIRED_VERSION=9.0
159 LIBCURL_REQUIRED_VERSION=7.15
160 LIBXML_REQUIRED_VERSION=2.6
161
162 # optional modules
163 GTK_REQUIRED_VERSION=2.0
164 LIBXSLT_REQUIRED_VERSION=1.1.7
165 SQLITE_REQUIRED_VERSION=3.0
166 GSTREAMER_REQUIRED_VERSION=0.10
167 GNOME_VFS_REQUIRED_VERSION=2.0
168
169 PKG_CHECK_MODULES([DEPENDENCIES],
170                   [glib-2.0 >= $GLIB_REQUIRED_VERSION
171                   gobject-2.0 >= $GOBJECT_REQUIRED_VERSION
172                   gthread-2.0 >= $GTHREAD_REQUIRED_VERSION
173                   gtk+-2.0 >= $GTK_REQUIRED_VERSION
174                   pango >= $PANGO_REQUIRED_VERSION
175                   libcurl >= $LIBCURL_REQUIRED_VERSION
176                   cairo >= $CAIRO_REQUIRED_VERSION
177                   cairo-ft,
178                   fontconfig >= $FONTCONFIG_REQUIRED_VERSION
179                   freetype2 >= $FREETYPE2_REQUIRED_VERSION
180                   libxml-2.0 >= $LIBXML_REQUIRED_VERSION])
181 AC_SUBST([DEPENDENCIES_CFLAGS])
182 AC_SUBST([DEPENDENCIES_LIBS])
183
184 # check whether to build with debugging enabled
185 AC_MSG_CHECKING([whether to do a debug build])
186 AC_ARG_ENABLE(debug,
187               AC_HELP_STRING([--enable-debug],
188                              [turn on debugging [default=no]]),
189               [],[enable_debug="no"])
190 AC_MSG_RESULT([$enable_debug])
191
192 # check whether to build with database support
193 AC_MSG_CHECKING([whether to enable HTML5 client-side storage support])
194 AC_ARG_ENABLE(database,
195               AC_HELP_STRING([--enable-database],
196                              [enable HTML5 client-side storage support [default=yes]]),
197               [],[enable_database="yes"])
198 AC_MSG_RESULT([$enable_database])
199
200 # check whether to build with icon database support
201 AC_MSG_CHECKING([whether to enable icon database support])
202 AC_ARG_ENABLE(icon_database,
203               AC_HELP_STRING([--enable-icon-database],
204                              [enable icon database [default=no]]),
205               [],[enable_icon_database="no"])
206 AC_MSG_RESULT([$enable_icon_database])
207
208 # check whether to enable HTML5 audio/video support
209 AC_MSG_CHECKING([whether to enable HTML5 video support])
210 AC_ARG_ENABLE(video,
211               AC_HELP_STRING([--enable-video],
212                              [enable HTML5 video support [default=no]]),
213               [],[enable_video="no"])
214 AC_MSG_RESULT([$enable_video])
215
216 # check whether to enable XPath support
217 AC_MSG_CHECKING([whether to enable XPath support])
218 AC_ARG_ENABLE(xpath,
219               AC_HELP_STRING([--enable-xpath],
220                              [enable support for XPath [default=yes]]),
221               [],[enable_xpath="yes"])
222 AC_MSG_RESULT([$enable_xpath])
223
224 # check whether to enable XSLT support
225 AC_MSG_CHECKING([whether to enable XSLT support])
226 AC_ARG_ENABLE(xslt,
227               AC_HELP_STRING([--enable-xslt],
228                              [enable support for XSLT [default=yes]]),
229               [],[enable_xslt="yes"])
230 AC_MSG_RESULT([$enable_xslt])
231
232 # check whether to enable SVG support
233 AC_MSG_CHECKING([whether to enable SVG support])
234 AC_ARG_ENABLE(svg,
235               AC_HELP_STRING([--enable-svg],
236                              [enable support for SVG [default=no]]),
237               [],[enable_svg="no"])
238 AC_MSG_RESULT([$enable_svg])
239
240 # check whether to enable support for SVG animation
241 AC_MSG_CHECKING([whether to enable support for SVG animataion])
242 AC_ARG_ENABLE(svg_animation,
243               AC_HELP_STRING([--enable-svg-animation],
244                              [enable support for SVG animation (experimental) [default=no]]),
245               [],[enable_svg_animation="no"])
246 AC_MSG_RESULT([$enable_svg_animation])
247
248 # check whether to enable support for SVG filters
249 AC_MSG_CHECKING([whether to enable support for SVG filters])
250 AC_ARG_ENABLE(svg_filters,
251               AC_HELP_STRING([--enable-svg-filters],
252                              [enable support for SVG filters (experimental) [default=no]]),
253               [],[enable_svg_filters="no"])
254 AC_MSG_RESULT([$enable_svg_filters])
255
256 # check whether to enable support for SVG fonts
257 AC_MSG_CHECKING([whether to enable support for SVG fonts])
258 AC_ARG_ENABLE(svg_fonts,
259               AC_HELP_STRING([--enable-svg-fonts],
260                              [enable support for SVG fonts (experimental) [default=no]]),
261               [],[enable_svg_fonts="no"])
262 AC_MSG_RESULT([$enable_svg_fonts])
263
264 # check whether to enable SVG As Image support
265 AC_MSG_CHECKING([whether to enable SVG as Image support])
266 AC_ARG_ENABLE(svg_as_image,
267               AC_HELP_STRING([--enable-svg-as-image],
268                              [enable SVG as Image support (experimental) [default=no]]),
269               [],[enable_svg_as_image="no"])
270 AC_MSG_RESULT([$enable_svg_as_image])
271
272 # check whether to enable SVG USE element support
273 AC_MSG_CHECKING([whether to enable support for SVG use element])
274 AC_ARG_ENABLE(svg_use_element,
275               AC_HELP_STRING([--enable-svg-use-element],
276                              [enable SVG use element support (experimental) [default=no]]),
277               [],[enable_svg_use_element="no"])
278 AC_MSG_RESULT([$enable_svg_use_element])
279
280 # check whether to enable code coverage
281 AC_MSG_CHECKING([whether to enable code coverage support])
282 AC_ARG_ENABLE(coverage,
283               AC_HELP_STRING([--enable-coverage],
284                              [enable code coverage support [default=no]]),
285               [],[enable_coverage="no"])
286 AC_MSG_RESULT([$enable_coverage])
287
288 # check whether to enable FastMalloc
289 AC_MSG_CHECKING([whether to enable optimized memory allocator])
290 AC_ARG_ENABLE(fast_malloc,
291               AC_HELP_STRING([--enable-fast-malloc],
292                              [enable optimized memory allocator default=yes, default=no for debug builds]),
293               [],[if test "$enable_debug" = "yes"; then enable_fast_malloc="no"; else enable_fast_malloc="yes"; fi])
294 AC_MSG_RESULT([$enable_fast_malloc])
295
296 # Add '-g' flag to gcc if it's debug build
297 if test "$enable_debug" = "yes"; then
298    CXXFLAGS="$CXXFLAGS -g"
299    CFLAGS="$CFLAGS -g"
300 fi
301
302 # check if sqlite 3 is available
303 if test "$enable_icon_database" = "yes" || test "$enable_database" = "yes"; then
304    PKG_CHECK_MODULES([SQLITE3], [sqlite3 >= $SQLITE_REQUIRED_VERSION])
305    AC_SUBST([SQLITE3_CFLAGS])
306    AC_SUBST([SQLITE3_LIBS])
307 fi
308   
309 # check if libxslt is available
310 if test "$enable_xslt" = "yes"; then
311    PKG_CHECK_MODULES([LIBXSLT],[libxslt >= $LIBXSLT_REQUIRED_VERSION])
312    AC_SUBST([LIBXSLT_CFLAGS])
313    AC_SUBST([LIBXSLT_LIBS])
314 fi
315
316 # check if gstreamer is available
317 if test "$enable_video" = "yes"; then
318    PKG_CHECK_MODULES([GSTREAMER],
319                      [gstreamer-0.10 >= $GSTREAMER_REQUIRED_VERSION
320                      gstreamer-base-0.10,
321                      gstreamer-plugins-base-0.10,
322                      gnome-vfs-2.0 >= $GNOME_VFS_REQUIRED_VERSION])
323    AC_SUBST([GSTREAMER_CFLAGS])
324    AC_SUBST([GSTREAMER_LIBS])
325 fi
326
327 # check for code coverage support
328 if test "$enable_coverage" = "yes"; then
329    COVERAGE_CFLAGS="-MD"
330    COVERAGE_LDFLAGS="-ftest-coverage -fprofile-arcs"
331    AC_SUBST([COVERAGE_CFLAGS])
332    AC_SUBST([COVERAGE_LDFLAGS])
333 fi
334
335 # check for SVG features, enabling SVG if necessary
336 if test "$enable_svg_animation" = "yes" || \
337    test "$enable_svg_filters" = "yes" || \
338    test "$enable_svg_fonts" = "yes" || \
339    test "$enable_svg_as_image" = "yes" || \
340    test "$enable_svg_use_element" = "yes"; then
341    svg_flags=yes
342    if test "$enable_svg" = "no"; then
343        AC_MSG_WARN([SVG feature(s) requested but SVG is disabled.. Enabling SVG support])
344        enable_svg=yes
345    fi
346 fi
347
348 # OS conditionals
349 AM_CONDITIONAL([OS_WIN32],[test "$os_win32" = "yes"])
350 AM_CONDITIONAL([OS_UNIX],[test "$os_win32" = "no"])
351 AM_CONDITIONAL([OS_LINUX],[test "$os_linux" = "yes"])
352 AM_CONDITIONAL([OS_FREEBSD],[test "$os_freebsd" = "yes"])
353
354 # target conditionals
355 AM_CONDITIONAL([TARGET_X11], [test "$with_webkit_target" = "x11"])
356 AM_CONDITIONAL([TARGET_WIN32], [test "$with_webkit_target" = "win32"])
357 AM_CONDITIONAL([TARGET_QUARTZ], [test "$with_webkit_target" = "quartz"])
358 AM_CONDITIONAL([TARGET_DIRECTFB], [test "$with_webkit_target" = "directfb"])
359
360 # WebKit feature conditionals
361 AM_CONDITIONAL([ENABLE_DEBUG],[test "$enable_debug" = "yes"])
362 AM_CONDITIONAL([ENABLE_DATABASE],[test "$enable_database" = "yes"])
363 AM_CONDITIONAL([ENABLE_ICONDATABASE],[test "$enable_icon_database" = "yes"])
364 AM_CONDITIONAL([ENABLE_XPATH],[test "$enable_xpath" = "yes"])
365 AM_CONDITIONAL([ENABLE_XSLT],[test "$enable_xslt" = "yes"])
366 AM_CONDITIONAL([ENABLE_VIDEO],[test "$enable_video" = "yes"])
367 AM_CONDITIONAL([ENABLE_SVG],[test "$enable_svg" = "yes"])
368 AM_CONDITIONAL([ENABLE_SVG_ANIMATION],[test "$enable_svg_animation" = "yes"])
369 AM_CONDITIONAL([ENABLE_SVG_FILTERS],[test "$enable_svg_filters" = "yes"])
370 AM_CONDITIONAL([ENABLE_SVG_FONTS],[test "$enable_svg_fonts" = "yes"])
371 AM_CONDITIONAL([ENABLE_SVG_AS_IMAGE],[test "$enable_svg_as_image" = "yes"])
372 AM_CONDITIONAL([ENABLE_SVG_USE],[test "$enable_svg_use_element" = "yes"])
373 AM_CONDITIONAL([ENABLE_COVERAGE],[test "$enable_coverage" = "yes"])
374 AM_CONDITIONAL([ENABLE_FAST_MALLOC],[test "$enable_fast_malloc" = "yes"])
375 AM_CONDITIONAL([SVG_FLAGS],[test "$svg_flags" = "yes"])
376
377 AC_CONFIG_FILES([
378 GNUmakefile
379 WebKit/gtk/WebKitGtk.pc:WebKit/gtk/WebKitGtk.pc.in
380 ]
381 )
382
383 AC_OUTPUT
384
385 echo "
386 WebKit was configured with the following options:
387
388  Target                            : $with_webkit_target
389  Enable debug                      : $enable_debug
390  Code coverage support             : $enable_coverage
391  Optimized memory allocator        : $enable_fast_malloc
392  HTML5 client-side storage support : $enable_database
393  HTML5 video element support       : $enable_video
394  Icon database support             : $enable_icon_database
395  SVG support                       : $enable_svg
396  SVG animation support             : $enable_svg_animation
397  SVG filters support               : $enable_svg_filters
398  SVG fonts support                 : $enable_svg_fonts
399  SVG as image support              : $enable_svg_as_image
400  SVG use element support           : $enable_svg_use_element
401  XPATH support                     : $enable_xpath
402  XSLT support                      : $enable_xslt
403 "