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])
10 AS_IF([test "x$GMAKE" = x], [AC_MSG_ERROR([You need GNU make])])
11 AC_PATH_PROGS([_BASH], [bash])
12 AS_IF([test "x$_BASH" = x], [AC_MSG_ERROR([You need GNU bash])])
13 AC_PATH_PROGS([TIME], [time])
14 AC_DEFUN([CY_CHECK_PROGS_VERSION], [
15 AC_MSG_CHECKING(for ]$2[ >= ]$5[)
16 AC_PATH_PROGS_FEATURE_CHECK(]$1[, ]$3[,
17 AS_VERSION_COMPARE(`$ac_path_]$1[ ]$4[`, ]$5[, ,
18 ac_cv_path_]$1[=$ac_path_]$1[
20 ac_cv_path_]$1[=$ac_path_]$1[
24 AC_MSG_ERROR(You need ]$2[ ]$5[ or greater)
26 AC_SUBST(]$1[, $ac_cv_path_]$1[)
29 AC_ARG_VAR([BISON], [GNU Project parser generator (yacc replacement)])
30 CY_CHECK_PROGS_VERSION([BISON], [bison], [bison],
31 [-V | $SED -e '1 s/^bison (GNU Bison) \(.*\)$/\1/p;d'], [2.3])
32 AC_ARG_VAR([FLEX], [the fast lexical analyser generator])
33 CY_CHECK_PROGS_VERSION([FLEX], [flex], [flex],
34 [--version | $SED -e '1 s/^.* \(@<:@0-9.@:>@*\)$/\1/p;d'], [2.5.33])
35 AC_ARG_VAR([GPERF], [perfect hash function generator])
36 CY_CHECK_PROGS_VERSION([GPERF], [gperf], [gperf],
37 [--version | $SED -e '1 s/^.* \(@<:@0-9.@:>@*\)$/\1/p;d'], [3.0.3])
39 AC_MSG_CHECKING([for GNU tar >=1.19])
40 AC_PATH_PROGS_FEATURE_CHECK([GNUTAR], [tar gtar gnutar], [
41 AS_IF([test "x`$ac_path_GNUTAR --version | $SED -e '1 s/^tar (GNU tar)/&/p;d'`" != x], [
42 AS_VERSION_COMPARE([`$ac_path_GNUTAR --version | $SED -e '1 s/^tar (GNU tar) \(.*\)$/\1/p;d'`], [1.19], , [
43 ac_cv_path_GNUTAR=$ac_path_GNUTAR
45 ac_cv_path_GNUTAR=$ac_path_GNUTAR
49 AS_IF([test "x$ac_cv_path_GNUTAR" != x], [
50 AC_SUBST([GNUTAR], [$ac_cv_path_GNUTAR])
51 AC_MSG_RESULT([$GNUTAR])
53 AC_SUBST([GNUTAR], [:])
56 AC_CHECK_PROGS([SVN], [svn])
57 AC_CHECK_PROGS([SVNVERSION], [svnversion])
61 AC_DEFUN([CY_CHECK_UNIVERSAL], [
62 AC_MSG_CHECKING([for universal binary support])
63 AS_CASE([$host_vendor], [apple], [
64 AS_CASE([$host_cpu], [armv6|i386|x86_64], [
65 for cy_arch in armv6 i386 x86_64; do
66 cy_save_CXXFLAGS=$CXXFLAGS
67 AC_LIB_APPENDTOVAR([CXXFLAGS], ["-arch $cy_arch"])
69 AC_LIB_APPENDTOVAR([cy_arches], [$cy_arch])
70 AC_LIB_APPENDTOVAR([CFLAGS], ["-arch $cy_arch"])
71 AC_LIB_APPENDTOVAR([LDFLAGS], ["-arch $cy_arch"])
72 AC_LIB_APPENDTOVAR([OBJCXXFLAGS], ["-arch $cy_arch"])
74 CXXFLAGS=$cy_save_CXXFLAGS
79 AC_MSG_RESULT([${cy_arches-no}])
81 AC_ARG_ENABLE([universal-binary], [AS_HELP_STRING(
82 [--disable-universal-binary],
83 [do not build with universal binary support on Darwin]
85 AS_CASE([$enableval], [no], [], [CY_CHECK_UNIVERSAL])
86 ], [CY_CHECK_UNIVERSAL])
87 AC_ARG_WITH([frameworks], [AS_HELP_STRING(
88 [--with-frameworks=DIRS],
89 [add to DIRS (space separated) to the Darwin include path for frameworks with -F]
91 for cy_framework in $withval; do
92 AC_LIB_APPENDTOVAR([CFLAGS], [-F$cy_framework])
93 AC_LIB_APPENDTOVAR([CXXFLAGS], [-F$cy_framework])
94 AC_LIB_APPENDTOVAR([OBJCCXXFLAGS], [-F$cy_framework])
97 APR_FIND_APR([], [], [1], [1])
98 AS_CASE([$apr_found], [yes], [
99 AC_LIB_APPENDTOVAR([CPPFLAGS], [`$apr_config --includes`])
100 AC_SUBST([LTLIBAPR], [`$apr_config --link-libtool`])
101 ], [AC_MSG_ERROR([You need apr])])
102 AC_DEFUN([CY_CHECK_JAVASCRIPTCORE], [
103 PKG_CHECK_MODULES([WEBKIT], [webkit-1.0], [
105 AC_LIB_APPENDTOVAR([CXXFLAGS], [`$PKG_CONFIG --cflags webkit-1.0`])
106 AC_LIB_APPENDTOVAR([LIBS], [`$PKG_CONFIG --libs webkit-1.0`])
108 PKG_CHECK_MODULES([WEBKIT], [WebKitGtk], [
110 AC_LIB_APPENDTOVAR([CXXFLAGS], [`$PKG_CONFIG --cflags WebKitGtk`])
111 AC_LIB_APPENDTOVAR([LIBS], [`$PKG_CONFIG --libs WebKitGtk`])
113 AC_CHECK_FRAMEWORK([JavaScriptCore], [
114 #include <JavaScriptCore/JSBase.h>
115 ], [JSEvaluateScript(0, 0, 0, 0, 0, 0);], [CY_EXECUTE=1])
119 AC_DEFUN([CY_CHECK_JAVASCRIPT], [
120 CY_CHECK_JAVASCRIPTCORE
122 AC_ARG_ENABLE([javascript], [AS_HELP_STRING(
123 [--enable-javascript@<:@=ENGINE@:>@],
124 [use a JavaScript runtime (currently the only available option for ENGINE is JavaScriptCore) @<:@default=yes@:>@]
126 AS_CASE([$enableval], [yes], [CY_CHECK_JAVASCRIPT], [no], [
127 AC_SUBST([CY_EXECUTE], [0])
128 ], [JavaScriptCore], [
129 CY_CHECK_JAVASCRIPTCORE
130 ], [AC_MSG_ERROR([Unknown JavaScript engine: $enableval])])
131 ], [CY_CHECK_JAVASCRIPT])
132 AC_DEFUN([CY_CHECK_PKG_CONFIG_LIBFFI], [
133 PKG_CHECK_MODULES([LIBFFI], [libffi], [
134 AC_LIB_APPENDTOVAR([CXXFLAGS], [`$PKG_CONFIG --cflags libffi`])
135 AC_LIB_APPENDTOVAR([LIBS], [`$PKG_CONFIG --libs libffi`])
137 AC_MSG_ERROR([You need libffi])
140 AS_CASE([$CY_EXECUTE], [1], [
141 AC_SUBST([CY_EXECUTE])
142 AC_CHECK_HEADERS([ffi.h ffi/ffi.h], [break])
143 AS_IF([test "x$ac_cv_header_ffi_h" = xno && test "x$ac_cv_header_ffi_ffi_h" = xno], [
144 CY_CHECK_PKG_CONFIG_LIBFFI
146 AC_SEARCH_LIBS([ffi_call], [ffi])
147 AS_CASE([$ac_cv_search_ffi_call], [no], [CY_CHECK_PKG_CONFIG_LIBFFI])
149 AC_LANG_PUSH([Objective C++])
150 AC_MSG_CHECKING([if we really have Objective C++])
152 // This space intentionally left blank
156 ], [AC_MSG_RESULT([no])])
157 AS_IF([test "x$CY_OBJECTIVEC" = x1], [
158 AC_CHECK_FRAMEWORK([CoreFoundation], [
159 #include <CoreFoundation/CFBase.h>
160 ], [CFAllocatorGetDefault();], [
161 AC_SUBST([CY_OBJECTIVEC])
162 AC_CHECK_FRAMEWORK([Foundation], [
163 #include <Foundation/NSObject.h>
164 ], [[[[NSObject alloc] init];]])
165 AC_CHECK_FRAMEWORK([WebKit], [
166 #include <WebKit/WebScriptObject.h>
167 ], [[[[WebScriptObject alloc] init];]])
169 AC_ARG_VAR([GNUSTEP_CONFIG], [prints information about the current gnustep installation])
170 AC_CHECK_PROGS([GNUSTEP_CONFIG], [gnustep-config])
171 AS_IF([test "x$GNUSTEP_CONFIG" != x], [
172 AC_SUBST([CY_OBJECTIVEC])
173 AC_LIB_APPENDTOVAR([OBJCXXFLAGS], [`$GNUSTEP_CONFIG --objc-flags`])
174 AC_LIB_APPENDTOVAR([LIBS], [`$GNUSTEP_CONFIG --base-libs`])
175 ], [AC_SUBST([CY_OBJECTIVEC], [0])])
178 AC_LANG_POP([Objective C++])
181 AS_CASE([$vl_cv_lib_readline], [no], [AC_MSG_ERROR([You need readline])])
184 AS_CASE([$am_cv_func_iconv], [yes], [], [
185 for cy_iconv_prefix_arg in $CFLAGS $CXXFLAGS $OBJCXXFLAGS $LDFLAGS $LIBS; do
186 AS_CASE([$cy_iconv_prefix_arg], [-I*], [
187 AC_LIB_APPENDTOVAR([cy_iconv_prefixes], [`echo $cy_iconv_prefix_arg | sed -e 's/^-I//;s|/include$||'`])
189 AC_LIB_APPENDTOVAR([cy_iconv_prefixes], [`echo $cy_iconv_prefix_arg | sed -e 's/^-L//;s|/lib$||'`])
192 for with_libiconv_prefix in $cy_iconv_prefixes; do
193 AS_UNSET([am_cv_func_iconv])
194 AM_ICONV_LINKFLAGS_BODY
198 AS_CASE([$am_cv_func_iconv], [yes], [], [AC_MSG_ERROR([You need iconv])])
200 AS_IF([test "x$CY_OBJECTIVEC" = x1], [
201 AC_CHECK_HEADER([mach/mach.h], [
202 AC_CHECK_TOOLS([_OTOOL], [otool])
203 AS_IF([test "x$_OTOOL" = x], [AC_MSG_ERROR([You need otool])])
204 AC_CHECK_TOOLS([_LIPO], [lipo])
205 AS_IF([test "x$_LIPO" = x], [AC_MSG_ERROR([You need lipo])])
206 AC_CHECK_TOOLS([_NM], [nm])
207 AS_IF([test "x$_NM" = x], [AC_MSG_ERROR([You need nm])])
208 AC_SUBST([SO], [$acl_shlibext])
209 AC_SUBST([CY_OBJECTIVEC_MACH], [1])
210 AC_SUBST([CY_ATTACH_GROUP], [procmod])
213 AS_IF([test "x$GMAKE" != xmake], [
214 AC_CONFIG_FILES([Makefile])
216 AC_CONFIG_FILES([GNUmakefile])