1 dnl macros to check for JavaScriptCore and WebKit/Gtk+ dependencies
3 dnl The rationale is so that we can share these macros between
4 dnl WebKit and JavaScriptCore builds.
7 m4_define([initialized], [no])
9 AC_DEFUN([INIT_C_CXX_FLAGS],
11 # If CXXFLAGS and CFLAGS are unset, default to empty.
12 # This is to tell automake not to include '-g' if CXXFLAGS is not set
13 # For more info - http://www.gnu.org/software/automake/manual/autoconf.html#C_002b_002b-Compiler
14 if test -z "$CXXFLAGS"; then
17 if test -z "$CFLAGS"; then
22 AC_DEFUN_ONCE([WEBKIT_INIT],
24 dnl check if we have the required packages to have successful checks
26 # Make sure CXXFLAGS and CFLAGS are set before expanding AC_PROG_CXX to avoid
27 # building with '-g -O2' on Release builds.
28 AC_REQUIRE([INIT_C_CXX_FLAGS])
30 # check for -fvisibility=hidden compiler support (GCC >= 4)
31 saved_CFLAGS="$CFLAGS"
32 CFLAGS="$CFLAGS -fvisibility=hidden -fvisibility-inlines-hidden"
33 AC_MSG_CHECKING([if ${CXX} supports -fvisibility=hidden -fvisibility-inlines-hidden])
34 AC_COMPILE_IFELSE([char foo;],
35 [ AC_MSG_RESULT([yes])
36 SYMBOL_VISIBILITY="-fvisibility=hidden" SYMBOL_VISIBILITY_INLINES="-fvisibility-inlines-hidden" ],
38 CFLAGS="$saved_CFLAGS"
39 AC_SUBST(SYMBOL_VISIBILITY)
40 AC_SUBST(SYMBOL_VISIBILITY_INLINES)
42 # check for pkg-config
43 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
44 if test "$PKG_CONFIG" = "no"; then
45 AC_MSG_ERROR([Cannot find pkg-config, make sure it is installed in your PATH])
48 AC_PATH_PROG(PERL, perl)
49 if test -z "$PERL"; then
50 AC_MSG_ERROR([You need 'perl' to compile WebKit])
53 AC_PATH_PROG(BISON, bison)
54 if test -z "$BISON"; then
55 AC_MSG_ERROR([You need the 'bison' parser generator to compile WebKit])
59 if test -z "$MV"; then
60 AC_MSG_ERROR([You need 'mv' to compile WebKit])
63 AC_REQUIRE([AC_PROG_CC])
64 AC_REQUIRE([AC_PROG_CXX])
70 # Check whether a C++ was found (AC_PROG_CXX sets $CXX to "g++" even when it
73 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],[],[AC_MSG_ERROR([No C++ compiler found])])
76 # C/C++ Language Features
82 AC_REQUIRE([AC_HEADER_STDC])
85 m4_define([initialized], [yes])
88 AC_DEFUN_ONCE([WEBKIT_CHECK_DEPENDENCIES],
90 dnl check for module dependencies
94 glib) _WEBKIT_CHECK_GLIB ;;
95 unicode) _WEBKIT_CHECK_UNICODE ;;
96 *) AC_MSG_ERROR([I don't support that module. Sorry..]) ;;
102 AC_DEFUN_ONCE([_WEBKIT_CHECK_GLIB],
105 # Version requirements
106 GLIB_REQUIRED_VERSION=2.21.3
107 GOBJECT_REQUIRED_VERSION=2.0
108 GTHREAD_REQUIRED_VERSION=2.0
110 PKG_CHECK_MODULES([GLIB],
111 [glib-2.0 >= $GLIB_REQUIRED_VERSION
112 gobject-2.0 >= $GOBJECT_REQUIRED_VERSION
113 gthread-2.0 >= $GTHREAD_REQUIRED_VERSION])
114 AC_SUBST([GLIB_CFLAGS])
115 AC_SUBST([GLIB_LIBS])
118 # Check for glib-genmarshal and glib-mkenums
119 AC_PATH_PROG([GLIB_GENMARSHAL], [glib-genmarshal])
120 AC_PATH_PROG([GLIB_MKENUMS],[glib-mkenums])
121 if test -z "$GLIB_GENMARSHAL" || test -z "$GLIB_MKENUMS"; then
122 AC_MSG_ERROR([You need the GLib dev tools in your path])
126 AC_DEFUN_ONCE([_WEBKIT_CHECK_UNICODE],
128 dnl determine the Unicode backend
129 AC_MSG_CHECKING([which Unicode backend to use])
130 AC_ARG_WITH(unicode_backend,
131 AC_HELP_STRING([--with-unicode-backend=@<:@icu/glib@:>@],
132 [Select Unicode backend (WARNING: the glib-based backend is slow, and incomplete) [default=icu]]),
133 [],[with_unicode_backend="icu"])
135 case "$with_unicode_backend" in
137 *) AC_MSG_ERROR([Invalid Unicode backend: must be icu or glib.]) ;;
140 AC_MSG_RESULT([$with_unicode_backend])
142 # https://bugs.webkit.org/show_bug.cgi?id=15914
143 # Splitting ICU removal patch into smaller portions. We compile a hybrid version
144 # with the WTF Unicode backend being based on GLib while text codecs and TextBreakIterator
145 # keep the ICU dependency. That's why we temporarily add icu headers and libs for glib config case as well.
146 if test "$with_unicode_backend" = "icu" -o "$with_unicode_backend" = "glib"; then
149 UNICODE_CFLAGS="-I$srcdir/JavaScriptCore/icu -I$srcdir/WebCore/icu"
150 UNICODE_LIBS="-licucore"
154 UNICODE_LIBS="-licuin -licuuc"
157 AC_PATH_PROG(icu_config, icu-config, no)
158 if test "$icu_config" = "no"; then
159 AC_MSG_ERROR([Cannot find icu-config. The ICU library is needed.])
162 # We don't use --cflags as this gives us a lot of things that we don't
163 # necessarily want, like debugging and optimization flags
164 # See man (1) icu-config for more info.
165 UNICODE_CFLAGS=`$icu_config --cppflags`
166 UNICODE_LIBS=`$icu_config --ldflags-libsonly`
171 if test "$with_unicode_backend" = "glib"; then
172 # https://bugs.webkit.org/show_bug.cgi?id=15914
173 # Splitting ICU removal patch into smaller portions, that's why we
174 # temporarily retrieve flags & libs info for glib into UNICODEGLIB
175 # instead of UNICODE variable, then concatenate.
176 # Patch 3/4 of the above issue will rename the variable back to UNICODE.
177 PKG_CHECK_MODULES([UNICODEGLIB], [glib-2.0 pango >= 1.21.0])
178 UNICODE_CFLAGS="$UNICODE_CFLAGS $UNICODEGLIB_CFLAGS"
179 UNICODE_LIBS="$UNICODE_LIBS $UNICODEGLIB_LIBS"
182 AC_SUBST([UNICODE_CFLAGS])
183 AC_SUBST([UNICODE_LIBS])