+AC_CHECK_PROGS([GIT], [git])
+AC_PROG_CXX
+AC_PROG_OBJCXX
+AC_LANG([C++])
+AC_DEFUN([CY_CHECK_UNIVERSAL], [
+ AC_MSG_CHECKING([for universal binary support])
+ AS_CASE([$host_vendor], [apple], [
+ AS_CASE([$host_cpu], [armv6|i386|x86_64], [
+ for cy_arch in armv6 i386 x86_64; do
+ cy_save_CXXFLAGS=$CXXFLAGS
+ AC_LIB_APPENDTOVAR([CXXFLAGS], ["-arch $cy_arch"])
+ AC_TRY_LINK([], [], [
+ AC_LIB_APPENDTOVAR([cy_arches], [$cy_arch])
+ AC_LIB_APPENDTOVAR([CFLAGS], ["-arch $cy_arch"])
+ AC_LIB_APPENDTOVAR([LDFLAGS], ["-arch $cy_arch"])
+ AC_LIB_APPENDTOVAR([OBJCXXFLAGS], ["-arch $cy_arch"])
+ ], [
+ CXXFLAGS=$cy_save_CXXFLAGS
+ ])
+ done
+ ])
+ ])
+ AC_MSG_RESULT([${cy_arches-no}])
+])
+AC_ARG_ENABLE([universal-binary], [AS_HELP_STRING(
+ [--disable-universal-binary],
+ [do not build with universal binary support on Darwin]
+)], [
+ AS_CASE([$enableval], [no], [], [CY_CHECK_UNIVERSAL])
+], [CY_CHECK_UNIVERSAL])
+AC_ARG_WITH([frameworks], [AS_HELP_STRING(
+ [--with-frameworks=DIRS],
+ [add to DIRS (space separated) to the Darwin include path for frameworks with -F]
+)], [
+ for cy_framework in $withval; do
+ AC_LIB_APPENDTOVAR([CFLAGS], [-F$cy_framework])
+ AC_LIB_APPENDTOVAR([CXXFLAGS], [-F$cy_framework])
+ AC_LIB_APPENDTOVAR([OBJCCXXFLAGS], [-F$cy_framework])
+ done
+])
+APR_FIND_APR([], [], [1], [1])
+AS_CASE([$apr_found], [yes], [
+ AC_LIB_APPENDTOVAR([CPPFLAGS], [`$apr_config --includes`])
+ AC_SUBST([LTLIBAPR], [`$apr_config --link-libtool`])
+], [AC_MSG_ERROR([You need apr])])
+AC_DEFUN([CY_CHECK_JAVASCRIPTCORE], [
+ PKG_CHECK_MODULES([WEBKIT], [webkit-1.0], [
+ CY_EXECUTE=1
+ AC_LIB_APPENDTOVAR([CXXFLAGS], [`$PKG_CONFIG --cflags webkit-1.0`])
+ AC_LIB_APPENDTOVAR([LIBS], [`$PKG_CONFIG --libs webkit-1.0`])
+ ], [
+ PKG_CHECK_MODULES([WEBKIT], [WebKitGtk], [
+ CY_EXECUTE=1
+ AC_LIB_APPENDTOVAR([CXXFLAGS], [`$PKG_CONFIG --cflags WebKitGtk`])
+ AC_LIB_APPENDTOVAR([LIBS], [`$PKG_CONFIG --libs WebKitGtk`])
+ ], [
+ AC_CHECK_FRAMEWORK([JavaScriptCore], [
+ #include <JavaScriptCore/JSBase.h>
+ ], [JSEvaluateScript(0, 0, 0, 0, 0, 0);], [CY_EXECUTE=1])
+ ])
+ ])
+])
+AC_DEFUN([CY_CHECK_JAVASCRIPT], [
+ CY_CHECK_JAVASCRIPTCORE
+])
+AC_ARG_ENABLE([javascript], [AS_HELP_STRING(
+ [--enable-javascript@<:@=ENGINE@:>@],
+ [use a JavaScript runtime (currently the only available option for ENGINE is JavaScriptCore) @<:@default=yes@:>@]
+)], [
+ AS_CASE([$enableval], [yes], [CY_CHECK_JAVASCRIPT], [no], [
+ AC_SUBST([CY_EXECUTE], [0])
+ ], [JavaScriptCore], [
+ CY_CHECK_JAVASCRIPTCORE
+ ], [AC_MSG_ERROR([Unknown JavaScript engine: $enableval])])
+], [CY_CHECK_JAVASCRIPT])
+AC_DEFUN([CY_CHECK_PKG_CONFIG_LIBFFI], [
+ PKG_CHECK_MODULES([LIBFFI], [libffi], [
+ AC_LIB_APPENDTOVAR([CXXFLAGS], [`$PKG_CONFIG --cflags libffi`])
+ AC_LIB_APPENDTOVAR([LIBS], [`$PKG_CONFIG --libs libffi`])
+ ], [
+ AC_MSG_ERROR([You need libffi])
+ ])
+])
+AS_CASE([$CY_EXECUTE], [1], [
+ AC_SUBST([CY_EXECUTE])
+ AC_CHECK_HEADERS([ffi.h ffi/ffi.h], [break])
+ AS_IF([test "x$ac_cv_header_ffi_h" = xno && test "x$ac_cv_header_ffi_ffi_h" = xno], [
+ CY_CHECK_PKG_CONFIG_LIBFFI
+ ], [
+ AC_SEARCH_LIBS([ffi_call], [ffi])
+ AS_CASE([$ac_cv_search_ffi_call], [no], [CY_CHECK_PKG_CONFIG_LIBFFI])
+ ])
+ AC_LANG_PUSH([Objective C++])
+ AC_MSG_CHECKING([if we really have Objective C++])
+ AC_COMPILE_IFELSE([
+ // This space intentionally left blank
+ ], [
+ CY_OBJECTIVEC=1
+ AC_MSG_RESULT([yes])
+ ], [AC_MSG_RESULT([no])])
+ AS_IF([test "x$CY_OBJECTIVEC" = x1], [
+ AC_CHECK_FRAMEWORK([CoreFoundation], [
+ #include <CoreFoundation/CFBase.h>
+ ], [CFAllocatorGetDefault();], [
+ AC_SUBST([CY_OBJECTIVEC])
+ AC_CHECK_FRAMEWORK([Foundation], [
+ #include <Foundation/NSObject.h>
+ ], [[[[NSObject alloc] init];]])
+ AC_CHECK_FRAMEWORK([WebKit], [
+ #include <WebKit/WebScriptObject.h>
+ ], [[[[WebScriptObject alloc] init];]])
+ ], [
+ AC_ARG_VAR([GNUSTEP_CONFIG], [prints information about the current gnustep installation])
+ AC_CHECK_PROGS([GNUSTEP_CONFIG], [gnustep-config])
+ AS_IF([test "x$GNUSTEP_CONFIG" != x], [
+ AC_SUBST([CY_OBJECTIVEC])
+ AC_LIB_APPENDTOVAR([OBJCXXFLAGS], [`$GNUSTEP_CONFIG --objc-flags`])
+ AC_LIB_APPENDTOVAR([LIBS], [`$GNUSTEP_CONFIG --base-libs`])
+ ], [AC_SUBST([CY_OBJECTIVEC], [0])])
+ ])
+ ])
+ AC_LANG_POP([Objective C++])
+])
+VL_LIB_READLINE
+AS_CASE([$vl_cv_lib_readline], [no], [AC_MSG_ERROR([You need readline])])
+AC_LANG_PUSH([C])