1dnl macros to check for JavaScriptCore and WebKit/Gtk+ dependencies 2dnl 3dnl The rationale is so that we can share these macros between 4dnl WebKit and JavaScriptCore builds. 5 6# global states 7m4_define([initialized], [no]) 8 9AC_DEFUN([INIT_C_CXX_FLAGS], 10[dnl 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 14if test -z "$CXXFLAGS"; then 15 CXXFLAGS="" 16fi 17if test -z "$CFLAGS"; then 18 CFLAGS="" 19fi 20]) 21 22AC_DEFUN_ONCE([WEBKIT_INIT], 23[dnl 24dnl check if we have the required packages to have successful checks 25dnl 26# Make sure CXXFLAGS and CFLAGS are set before expanding AC_PROG_CXX to avoid 27# building with '-g -O2' on Release builds. 28AC_REQUIRE([INIT_C_CXX_FLAGS]) 29 30# check for -fvisibility=hidden compiler support (GCC >= 4) 31saved_CFLAGS="$CFLAGS" 32CFLAGS="$CFLAGS -fvisibility=hidden -fvisibility-inlines-hidden" 33AC_MSG_CHECKING([if ${CXX} supports -fvisibility=hidden -fvisibility-inlines-hidden]) 34AC_COMPILE_IFELSE([char foo;], 35 [ AC_MSG_RESULT([yes]) 36 SYMBOL_VISIBILITY="-fvisibility=hidden" SYMBOL_VISIBILITY_INLINES="-fvisibility-inlines-hidden" ], 37 AC_MSG_RESULT([no])) 38CFLAGS="$saved_CFLAGS" 39AC_SUBST(SYMBOL_VISIBILITY) 40AC_SUBST(SYMBOL_VISIBILITY_INLINES) 41 42# check for pkg-config 43AC_PATH_PROG(PKG_CONFIG, pkg-config, no) 44if test "$PKG_CONFIG" = "no"; then 45 AC_MSG_ERROR([Cannot find pkg-config, make sure it is installed in your PATH]) 46fi 47 48AC_PATH_PROG(PERL, perl) 49if test -z "$PERL"; then 50 AC_MSG_ERROR([You need 'perl' to compile WebKit]) 51fi 52 53AC_PATH_PROG(PYTHON, python) 54if test -z "$PYTHON"; then 55 AC_MSG_ERROR([You need 'python' to compile WebKit]) 56fi 57 58AC_PATH_PROG(BISON, bison) 59if test -z "$BISON"; then 60 AC_MSG_ERROR([You need the 'bison' parser generator to compile WebKit]) 61fi 62 63AC_PATH_PROG(MV, mv) 64if test -z "$MV"; then 65 AC_MSG_ERROR([You need 'mv' to compile WebKit]) 66fi 67 68AC_REQUIRE([AC_PROG_CC]) 69AC_REQUIRE([AC_PROG_CXX]) 70AM_PROG_CC_STDC 71AM_PROG_CC_C_O 72AC_PROG_INSTALL 73AC_SYS_LARGEFILE 74 75# Check whether a C++ was found (AC_PROG_CXX sets $CXX to "g++" even when it 76# doesn't exist) 77AC_LANG_PUSH([C++]) 78AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],[],[AC_MSG_ERROR([No C++ compiler found])]) 79AC_LANG_POP([C++]) 80 81# C/C++ Language Features 82AC_C_CONST 83AC_C_INLINE 84AC_C_VOLATILE 85 86# C/C++ Headers 87AC_REQUIRE([AC_HEADER_STDC]) 88AC_HEADER_STDBOOL 89 90m4_define([initialized], [yes]) 91]) 92 93AC_DEFUN_ONCE([WEBKIT_CHECK_DEPENDENCIES], 94[dnl 95dnl check for module dependencies 96for module in $1 97do 98 case $module in 99 glib) _WEBKIT_CHECK_GLIB ;; 100 unicode) _WEBKIT_CHECK_UNICODE ;; 101 *) AC_MSG_ERROR([I don't support that module. Sorry..]) ;; 102 103 esac 104done 105]) 106 107AC_DEFUN_ONCE([_WEBKIT_CHECK_GLIB], 108[dnl 109dnl check for glib 110# Version requirements 111GLIB_REQUIRED_VERSION=2.27.90 112AM_PATH_GLIB_2_0($GLIB_REQUIRED_VERSION) 113if test -z "$GLIB_GENMARSHAL" || test -z "$GLIB_MKENUMS"; then 114 AC_MSG_ERROR([You need the GLib dev tools in your path]) 115fi 116GLIB_GSETTINGS 117]) 118 119AC_DEFUN_ONCE([_WEBKIT_CHECK_UNICODE], 120[dnl 121dnl determine the Unicode backend 122AC_MSG_CHECKING([which Unicode backend to use]) 123AC_ARG_WITH(unicode_backend, 124 AC_HELP_STRING([--with-unicode-backend=@<:@icu/glib@:>@], 125 [Select Unicode backend (WARNING: the glib-based backend is slow, and incomplete) [default=icu]]), 126 [],[with_unicode_backend="icu"]) 127 128case "$with_unicode_backend" in 129 icu|glib) ;; 130 *) AC_MSG_ERROR([Invalid Unicode backend: must be icu or glib.]) ;; 131esac 132 133AC_MSG_RESULT([$with_unicode_backend]) 134 135if test "$with_unicode_backend" = "icu"; then 136 case "$host" in 137 *-*-darwin*) 138 UNICODE_CFLAGS="-I$srcdir/Source/JavaScriptCore/icu -I$srcdir/Source/WebCore/icu" 139 UNICODE_LIBS="-licucore" 140 ;; 141 *-*-mingw*) 142 UNICODE_CFLAGS="" 143 UNICODE_LIBS="-licuin -licuuc" 144 ;; 145 *) 146 AC_PATH_PROG(icu_config, icu-config, no) 147 if test "$icu_config" = "no"; then 148 AC_MSG_ERROR([Cannot find icu-config. The ICU library is needed.]) 149 fi 150 151 # We don't use --cflags as this gives us a lot of things that we don't 152 # necessarily want, like debugging and optimization flags 153 # See man (1) icu-config for more info. 154 UNICODE_CFLAGS=`$icu_config --cppflags` 155 UNICODE_LIBS=`$icu_config --ldflags-libsonly` 156 ;; 157 esac 158fi 159 160if test "$with_unicode_backend" = "glib"; then 161 PKG_CHECK_MODULES([UNICODE], [glib-2.0 pango >= 1.21.0]) 162fi 163 164AC_SUBST([UNICODE_CFLAGS]) 165AC_SUBST([UNICODE_LIBS]) 166]) 167