2 AC_INIT([Cycript], [0.9], [saurik@saurik.com], [cycript], [http://www.cycript.org/])
3 AC_CONFIG_SRCDIR([Console.cpp])
5 LT_INIT([disable-static])
6 PKG_PROG_PKG_CONFIG([0.22])
8 AS_IF([test "x$_cv_gnu_make_command" = x], [AC_MSG_ERROR([You need GNU make])])
11 AC_ARG_WITH([frameworks], [AS_HELP_STRING(
12 [--with-frameworks=DIRS],
13 [add to DIRS (space separated) to the Darwin include path for frameworks with -F]
15 for framework in $withval; do
16 AC_LIB_APPENDTOVAR([CFLAGS], [-F$framework])
17 AC_LIB_APPENDTOVAR([CXXFLAGS], [-F$framework])
18 AC_LIB_APPENDTOVAR([OBJCCXXFLAGS], [-F$framework])
24 BISON=`echo $YACC | $SED -e 's/ -y//'`
25 BISON_VERSION=`$BISON -V | $SED -e 's/^bison (GNU Bison) \(.*\)$/\1/p;d'`
26 ], [AC_MSG_ERROR([You need bison 2.3 or greater])])
28 AC_MSG_CHECKING([if bison is >= 2.3])
29 AS_VERSION_COMPARE([$BISON_VERSION], [2.3], [
31 AC_MSG_ERROR([You need bison 2.3 or greater])
32 ], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([yes])])
36 FLEX_VERSION=[`$FLEX --version | $SED -e 's/^.* \([0-9.]*\)$/\1/p;d'`]
37 ], [AC_MSG_ERROR([You need flex 2.5.33 or greater])])
38 AC_MSG_CHECKING([if flex is >= 2.5.33])
39 AS_VERSION_COMPARE([$FLEX_VERSION], [2.5.33], [
41 AC_MSG_ERROR([You need flex 2.5.33 or greater])
42 ], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([yes])])
44 AC_CHECK_PROGS([_BASH], [bash])
45 AC_ARG_VAR([GPERF], [perfect hash function generator])
46 AC_CHECK_PROGS([GPERF], [gperf])
47 AC_MSG_CHECKING([if gperf >= 3.0.3])
48 GPERF_VERSION=[`$GPERF --version | $SED -e 's/^.* \([0-9.]*\)$/\1/p;d'`]
49 AS_VERSION_COMPARE([$GPERF_VERSION], [3.0.3], [
51 AC_MSG_ERROR([You need gperf 3.0.3 or greater])
52 ], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([yes])])
53 AC_CHECK_PROGS([TIME], [time])
54 APR_FIND_APR([], [], [1], [1])
55 AS_CASE([$apr_found], [yes], [
56 AC_LIB_APPENDTOVAR([CPPFLAGS], [`$apr_config --includes`])
57 AC_SUBST([LTLIBAPR], [`$apr_config --link-libtool`])
58 ], [AC_MSG_ERROR([You need apr])])
64 AS_CASE([$am_cv_func_iconv], [yes], [], [AC_MSG_ERROR([You need iconv])])
65 AC_DEFUN([CY_CHECK_JAVASCRIPTCORE], [
66 PKG_CHECK_MODULES([WEBKIT], [webkit-1.0], [
68 AC_LIB_APPENDTOVAR([CXXFLAGS], [`$PKG_CONFIG --cflags webkit-1.0`])
69 AC_LIB_APPENDTOVAR([LIBS], [`$PKG_CONFIG --libs webkit-1.0`])
71 PKG_CHECK_MODULES([WEBKIT], [WebKitGtk], [
73 AC_LIB_APPENDTOVAR([CXXFLAGS], [`$PKG_CONFIG --cflags WebKitGtk`])
74 AC_LIB_APPENDTOVAR([LIBS], [`$PKG_CONFIG --libs WebKitGtk`])
76 AC_CHECK_FRAMEWORK([JavaScriptCore], [
77 #include <JavaScriptCore/JSBase.h>
78 ], [JSEvaluateScript(0, 0, 0, 0, 0, 0);], [CY_EXECUTE=1])
82 AC_DEFUN([CY_CHECK_JAVASCRIPT], [
83 CY_CHECK_JAVASCRIPTCORE
85 AC_ARG_ENABLE([javascript], [AS_HELP_STRING(
86 [--enable-javascript@<:@=ENGINE@:>@],
87 [use a JavaScript runtime (currently the only available option for ENGINE is JavaScriptCore) @<:@default=yes@:>@]
89 AS_CASE([$enableval], [yes], [CY_CHECK_JAVASCRIPT], [no], [
90 AC_SUBST([CY_EXECUTE], [0])
91 ], [JavaScriptCore], [
92 CY_CHECK_JAVASCRIPTCORE
93 ], [AC_MSG_ERROR([Unknown JavaScript engine: $enableval])])
94 ], [CY_CHECK_JAVASCRIPT])
95 AS_CASE([$CY_EXECUTE], [1], [
96 AC_SUBST([CY_EXECUTE])
97 PKG_CHECK_MODULES([LIBFFI], [libffi], [
98 AC_LIB_APPENDTOVAR([CXXFLAGS], [`$PKG_CONFIG --cflags libffi`])
99 AC_LIB_APPENDTOVAR([LIBS], [`$PKG_CONFIG --libs libffi`])
101 AC_CHECK_HEADERS([ffi.h ffi/ffi.h], [break])
102 AS_IF([test "x$ac_cv_header_ffi_h" = xno && test "x$ac_cv_header_ffi_ffi_h" = xno], [
103 AC_MSG_ERROR([You need libffi])
105 AC_SEARCH_LIBS([ffi_call], [ffi])
106 AS_CASE([$ac_cv_search_ffi_call], [no], [
107 AC_MSG_ERROR([You need libffi])
110 AC_LANG_PUSH([Objective C++])
111 AC_MSG_CHECKING([if we really have Objective C++])
113 // This space intentionally left blank
117 ], [AC_MSG_RESULT([no])])
118 AS_IF([test "x$CY_OBJECTIVEC" = x1], [
119 AC_CHECK_FRAMEWORK([CoreFoundation], [
120 #include <CoreFoundation/CFBase.h>
121 ], [CFAllocatorGetDefault();], [
122 AC_SUBST([CY_OBJECTIVEC])
123 AC_CHECK_FRAMEWORK([Foundation], [
124 #include <Foundation/NSObject.h>
125 ], [[[[NSObject alloc] init];]])
126 AC_CHECK_FRAMEWORK([WebKit], [
127 #include <WebKit/WebScriptObject.h>
128 ], [[[[WebScriptObject alloc] init];]])
130 AC_CHECK_PROGS([GNUSTEP_CONFIG], [gnustep-config])
131 AS_IF([test "x$GNUSTEP_CONFIG" != x], [
132 AC_SUBST([CY_OBJECTIVEC])
133 AC_LIB_APPENDTOVAR([OBJCXXFLAGS], [`$GNUSTEP_CONFIG --objc-flags`])
134 AC_LIB_APPENDTOVAR([LIBS], [`$GNUSTEP_CONFIG --base-libs`])
135 ], [AC_SUBST([CY_OBJECTIVEC], [0])])
138 AC_LANG_POP([Objective C++])
140 AS_IF([test "x$CY_OBJECTIVEC" = x1], [
141 AC_CHECK_HEADER([mach/mach.h], [
142 AS_CASE([$OTOOL], [:], [AC_MSG_WARN([Missing otool?])], [AC_SUBST([CY_OBJECTIVEC_MACH], [1])])
145 AC_CONFIG_FILES([GNUmakefile])