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 AC_SUBST([GMAKE], [$_cv_gnu_make_command])
9 AS_IF([test "x$GMAKE" = x], [AC_MSG_ERROR([You need GNU make])])
12 AC_ARG_WITH([frameworks], [AS_HELP_STRING(
13 [--with-frameworks=DIRS],
14 [add to DIRS (space separated) to the Darwin include path for frameworks with -F]
16 for framework in $withval; do
17 AC_LIB_APPENDTOVAR([CFLAGS], [-F$framework])
18 AC_LIB_APPENDTOVAR([CXXFLAGS], [-F$framework])
19 AC_LIB_APPENDTOVAR([OBJCCXXFLAGS], [-F$framework])
23 AC_ARG_VAR([BISON], [GNU Project parser generator (yacc replacement)])
24 AS_IF([test "x$BISON" = x], [AX_PROG_BISON([
25 AC_SUBST([BISON], [`echo $YACC | $SED -e 's/ -y//'`])
26 ], [AC_MSG_ERROR([You need bison 2.3 or greater])])])
27 AC_MSG_CHECKING([if bison is >= 2.3])
28 BISON_VERSION=[`$BISON -V | $SED -e 's/^bison (GNU Bison) \(.*\)$/\1/p;d'`]
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])])
33 AC_ARG_VAR([FLEX], [the fast lexical analyser generator])
34 AS_IF([test "x$FLEX" = x], [AX_PROG_FLEX([
35 AC_SUBST([FLEX], [$LEX])
36 ], [AC_MSG_ERROR([You need flex 2.5.33 or greater])])])
37 FLEX_VERSION=[`$FLEX --version | $SED -e 's/^.* \([0-9.]*\)$/\1/p;d'`]
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])])
43 AC_CHECK_PROGS([BASH], [bash])
44 AC_ARG_VAR([GPERF], [perfect hash function generator])
45 AC_CHECK_PROGS([GPERF], [gperf])
46 AC_MSG_CHECKING([if gperf >= 3.0.3])
47 GPERF_VERSION=[`$GPERF --version | $SED -e 's/^.* \([0-9.]*\)$/\1/p;d'`]
48 AS_VERSION_COMPARE([$GPERF_VERSION], [3.0.3], [
50 AC_MSG_ERROR([You need gperf 3.0.3 or greater])
51 ], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([yes])])
52 AC_CHECK_PROGS([TIME], [time])
53 APR_FIND_APR([], [], [1], [1])
54 AS_CASE([$apr_found], [yes], [
55 AC_LIB_APPENDTOVAR([CPPFLAGS], [`$apr_config --includes`])
56 AC_SUBST([LTLIBAPR], [`$apr_config --link-libtool`])
57 ], [AC_MSG_ERROR([You need apr])])
63 AS_CASE([$am_cv_func_iconv], [yes], [], [AC_MSG_ERROR([You need iconv])])
64 AC_DEFUN([CY_CHECK_JAVASCRIPTCORE], [
65 PKG_CHECK_MODULES([WEBKIT], [webkit-1.0], [
67 AC_LIB_APPENDTOVAR([CXXFLAGS], [`$PKG_CONFIG --cflags webkit-1.0`])
68 AC_LIB_APPENDTOVAR([LIBS], [`$PKG_CONFIG --libs webkit-1.0`])
70 PKG_CHECK_MODULES([WEBKIT], [WebKitGtk], [
72 AC_LIB_APPENDTOVAR([CXXFLAGS], [`$PKG_CONFIG --cflags WebKitGtk`])
73 AC_LIB_APPENDTOVAR([LIBS], [`$PKG_CONFIG --libs WebKitGtk`])
75 AC_CHECK_FRAMEWORK([JavaScriptCore], [
76 #include <JavaScriptCore/JSBase.h>
77 ], [JSEvaluateScript(0, 0, 0, 0, 0, 0);], [CY_EXECUTE=1])
81 AC_DEFUN([CY_CHECK_JAVASCRIPT], [
82 CY_CHECK_JAVASCRIPTCORE
84 AC_ARG_ENABLE([javascript], [AS_HELP_STRING(
85 [--enable-javascript@<:@=ENGINE@:>@],
86 [use a JavaScript runtime (currently the only available option for ENGINE is JavaScriptCore) @<:@default=yes@:>@]
88 AS_CASE([$enableval], [yes], [CY_CHECK_JAVASCRIPT], [no], [
89 AC_SUBST([CY_EXECUTE], [0])
90 ], [JavaScriptCore], [
91 CY_CHECK_JAVASCRIPTCORE
92 ], [AC_MSG_ERROR([Unknown JavaScript engine: $enableval])])
93 ], [CY_CHECK_JAVASCRIPT])
94 AS_CASE([$CY_EXECUTE], [1], [
95 AC_SUBST([CY_EXECUTE])
96 PKG_CHECK_MODULES([LIBFFI], [libffi], [
97 AC_LIB_APPENDTOVAR([CXXFLAGS], [`$PKG_CONFIG --cflags libffi`])
98 AC_LIB_APPENDTOVAR([LIBS], [`$PKG_CONFIG --libs libffi`])
100 AC_CHECK_HEADERS([ffi.h ffi/ffi.h], [break])
101 AS_IF([test "x$ac_cv_header_ffi_h" = xno && test "x$ac_cv_header_ffi_ffi_h" = xno], [
102 AC_MSG_ERROR([You need libffi])
104 AC_SEARCH_LIBS([ffi_call], [ffi])
105 AS_CASE([$ac_cv_search_ffi_call], [no], [
106 AC_MSG_ERROR([You need libffi])
109 AC_LANG_PUSH([Objective C++])
110 AC_MSG_CHECKING([if we really have Objective C++])
112 // This space intentionally left blank
116 ], [AC_MSG_RESULT([no])])
117 AS_IF([test "x$CY_OBJECTIVEC" = x1], [
118 AC_CHECK_FRAMEWORK([CoreFoundation], [
119 #include <CoreFoundation/CFBase.h>
120 ], [CFAllocatorGetDefault();], [
121 AC_SUBST([CY_OBJECTIVEC])
122 AC_CHECK_FRAMEWORK([Foundation], [
123 #include <Foundation/NSObject.h>
124 ], [[[[NSObject alloc] init];]])
125 AC_CHECK_FRAMEWORK([WebKit], [
126 #include <WebKit/WebScriptObject.h>
127 ], [[[[WebScriptObject alloc] init];]])
129 AC_ARG_VAR([GNUSTEP_CONFIG], [prints information about the current gnustep installation])
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 AS_IF([test "x$GMAKE" != xmake], [
146 AC_CONFIG_FILES([Makefile])
148 AC_CONFIG_FILES([GNUmakefile])