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])])
10 AC_PATH_PROGS([_BASH], [bash])
11 AS_IF([test "x$_BASH" = x], [AC_MSG_ERROR([You need GNU bash])])
12 AC_PATH_PROGS([TIME], [time])
13 AC_DEFUN([CY_CHECK_PROGS_VERSION], [
14 AC_MSG_CHECKING(for ]$2[ >= ]$5[)
15 AC_PATH_PROGS_FEATURE_CHECK(]$1[, ]$3[,
16 AS_VERSION_COMPARE(`$ac_path_]$1[ ]$4[`, ]$5[, ,
17 ac_cv_path_]$1[=$ac_path_]$1[
19 ac_cv_path_]$1[=$ac_path_]$1[
23 AC_MSG_ERROR(You need ]$2[ ]$5[ or greater)
25 AC_SUBST(]$1[, $ac_cv_path_]$1[)
28 AC_ARG_VAR([BISON], [GNU Project parser generator (yacc replacement)])
29 CY_CHECK_PROGS_VERSION([BISON], [bison], [bison],
30 [-V | $SED -e '1 s/^bison (GNU Bison) \(.*\)$/\1/p;d'], [2.3])
31 AC_ARG_VAR([FLEX], [the fast lexical analyser generator])
32 CY_CHECK_PROGS_VERSION([FLEX], [flex], [flex],
33 [--version | $SED -e '1 s/^.* \(@<:@0-9.@:>@*\)$/\1/p;d'], [2.5.33])
34 AC_ARG_VAR([GPERF], [perfect hash function generator])
35 CY_CHECK_PROGS_VERSION([GPERF], [gperf], [gperf],
36 [--version | $SED -e '1 s/^.* \(@<:@0-9.@:>@*\)$/\1/p;d'], [3.0.3])
38 AC_MSG_CHECKING([for GNU tar >=1.19])
39 AC_PATH_PROGS_FEATURE_CHECK([GNUTAR], [tar gtar gnutar], [
40 AS_IF([test "x`$ac_path_GNUTAR --version | $SED -e '1 s/^tar (GNU tar)/&/p;d'`" != x], [
41 AS_VERSION_COMPARE([`$ac_path_GNUTAR --version | $SED -e '1 s/^tar (GNU tar) \(.*\)$/\1/p;d'`], [1.19], , [
42 ac_cv_path_GNUTAR=$ac_path_GNUTAR
44 ac_cv_path_GNUTAR=$ac_path_GNUTAR
48 AS_IF([test "x$ac_cv_path_GNUTAR" != x], [
49 AC_SUBST([GNUTAR], [$ac_cv_path_GNUTAR])
50 AC_MSG_RESULT([$GNUTAR])
52 AC_SUBST([GNUTAR], [:])
55 AC_CHECK_PROGS([SVN], [svn])
56 AC_CHECK_PROGS([SVNVERSION], [svnversion])
59 AC_ARG_WITH([frameworks], [AS_HELP_STRING(
60 [--with-frameworks=DIRS],
61 [add to DIRS (space separated) to the Darwin include path for frameworks with -F]
63 for framework in $withval; do
64 AC_LIB_APPENDTOVAR([CFLAGS], [-F$framework])
65 AC_LIB_APPENDTOVAR([CXXFLAGS], [-F$framework])
66 AC_LIB_APPENDTOVAR([OBJCCXXFLAGS], [-F$framework])
70 APR_FIND_APR([], [], [1], [1])
71 AS_CASE([$apr_found], [yes], [
72 AC_LIB_APPENDTOVAR([CPPFLAGS], [`$apr_config --includes`])
73 AC_SUBST([LTLIBAPR], [`$apr_config --link-libtool`])
74 ], [AC_MSG_ERROR([You need apr])])
75 AC_DEFUN([CY_CHECK_JAVASCRIPTCORE], [
76 PKG_CHECK_MODULES([WEBKIT], [webkit-1.0], [
78 AC_LIB_APPENDTOVAR([CXXFLAGS], [`$PKG_CONFIG --cflags webkit-1.0`])
79 AC_LIB_APPENDTOVAR([LIBS], [`$PKG_CONFIG --libs webkit-1.0`])
81 PKG_CHECK_MODULES([WEBKIT], [WebKitGtk], [
83 AC_LIB_APPENDTOVAR([CXXFLAGS], [`$PKG_CONFIG --cflags WebKitGtk`])
84 AC_LIB_APPENDTOVAR([LIBS], [`$PKG_CONFIG --libs WebKitGtk`])
86 AC_CHECK_FRAMEWORK([JavaScriptCore], [
87 #include <JavaScriptCore/JSBase.h>
88 ], [JSEvaluateScript(0, 0, 0, 0, 0, 0);], [CY_EXECUTE=1])
92 AC_DEFUN([CY_CHECK_JAVASCRIPT], [
93 CY_CHECK_JAVASCRIPTCORE
95 AC_ARG_ENABLE([javascript], [AS_HELP_STRING(
96 [--enable-javascript@<:@=ENGINE@:>@],
97 [use a JavaScript runtime (currently the only available option for ENGINE is JavaScriptCore) @<:@default=yes@:>@]
99 AS_CASE([$enableval], [yes], [CY_CHECK_JAVASCRIPT], [no], [
100 AC_SUBST([CY_EXECUTE], [0])
101 ], [JavaScriptCore], [
102 CY_CHECK_JAVASCRIPTCORE
103 ], [AC_MSG_ERROR([Unknown JavaScript engine: $enableval])])
104 ], [CY_CHECK_JAVASCRIPT])
105 AS_CASE([$CY_EXECUTE], [1], [
106 AC_SUBST([CY_EXECUTE])
107 PKG_CHECK_MODULES([LIBFFI], [libffi], [
108 AC_LIB_APPENDTOVAR([CXXFLAGS], [`$PKG_CONFIG --cflags libffi`])
109 AC_LIB_APPENDTOVAR([LIBS], [`$PKG_CONFIG --libs libffi`])
111 AC_CHECK_HEADERS([ffi.h ffi/ffi.h], [break])
112 AS_IF([test "x$ac_cv_header_ffi_h" = xno && test "x$ac_cv_header_ffi_ffi_h" = xno], [
113 AC_MSG_ERROR([You need libffi])
115 AC_SEARCH_LIBS([ffi_call], [ffi])
116 AS_CASE([$ac_cv_search_ffi_call], [no], [
117 AC_MSG_ERROR([You need libffi])
120 AC_LANG_PUSH([Objective C++])
121 AC_MSG_CHECKING([if we really have Objective C++])
123 // This space intentionally left blank
127 ], [AC_MSG_RESULT([no])])
128 AS_IF([test "x$CY_OBJECTIVEC" = x1], [
129 AC_CHECK_FRAMEWORK([CoreFoundation], [
130 #include <CoreFoundation/CFBase.h>
131 ], [CFAllocatorGetDefault();], [
132 AC_SUBST([CY_OBJECTIVEC])
133 AC_CHECK_FRAMEWORK([Foundation], [
134 #include <Foundation/NSObject.h>
135 ], [[[[NSObject alloc] init];]])
136 AC_CHECK_FRAMEWORK([WebKit], [
137 #include <WebKit/WebScriptObject.h>
138 ], [[[[WebScriptObject alloc] init];]])
140 AC_ARG_VAR([GNUSTEP_CONFIG], [prints information about the current gnustep installation])
141 AC_CHECK_PROGS([GNUSTEP_CONFIG], [gnustep-config])
142 AS_IF([test "x$GNUSTEP_CONFIG" != x], [
143 AC_SUBST([CY_OBJECTIVEC])
144 AC_LIB_APPENDTOVAR([OBJCXXFLAGS], [`$GNUSTEP_CONFIG --objc-flags`])
145 AC_LIB_APPENDTOVAR([LIBS], [`$GNUSTEP_CONFIG --base-libs`])
146 ], [AC_SUBST([CY_OBJECTIVEC], [0])])
149 AC_LANG_POP([Objective C++])
152 AS_CASE([$vl_cv_lib_readline], [no], [AC_MSG_ERROR([You need readline])])
155 AS_CASE([$am_cv_func_iconv], [yes], [], [
156 for cy_iconv_prefix_arg in $CFLAGS $CXXFLAGS $OBJCXXFLAGS $LDFLAGS $LIBS; do
157 AS_CASE([$cy_iconv_prefix_arg], [-I*], [
158 AC_LIB_APPENDTOVAR([cy_iconv_prefixes], [`echo $cy_iconv_prefix_arg | sed -e 's/^-I//;s|/include$||'`])
160 AC_LIB_APPENDTOVAR([cy_iconv_prefixes], [`echo $cy_iconv_prefix_arg | sed -e 's/^-L//;s|/lib$||'`])
163 for with_libiconv_prefix in $cy_iconv_prefixes; do
164 AS_UNSET([am_cv_func_iconv])
165 AM_ICONV_LINKFLAGS_BODY
169 AS_CASE([$am_cv_func_iconv], [yes], [], [AC_MSG_ERROR([You need iconv])])
171 AS_IF([test "x$CY_OBJECTIVEC" = x1], [
172 AC_CHECK_HEADER([mach/mach.h], [
173 AS_CASE([$OTOOL], [:], [AC_MSG_WARN([Missing otool?])], [AC_SUBST([CY_OBJECTIVEC_MACH], [1])])
176 AS_IF([test "x$GMAKE" != xmake], [
177 AC_CONFIG_FILES([Makefile])
179 AC_CONFIG_FILES([GNUmakefile])