]> git.saurik.com Git - cycript.git/blame - configure.ac
Parse bison output to prevent LexSetRegExp mistakes.
[cycript.git] / configure.ac
CommitLineData
9c60689e 1AC_PREREQ([2.65])
c7aa54aa 2AC_INIT([Cycript], [0.9], [saurik@saurik.com], [cycript], [http://www.cycript.org/])
35fa52c0 3AC_CONFIG_SRCDIR([Console.cpp])
6b66678a 4AC_CONFIG_AUX_DIR([.])
549f29b5 5LT_INIT([disable-static])
3fd51f51 6PKG_PROG_PKG_CONFIG([0.22])
b98e47e6 7AX_CHECK_GNU_MAKE
790e5246 8AC_SUBST([GMAKE], [$_cv_gnu_make_command])
9d13f949 9AC_SUBST([LTFLAGS])
790e5246 10AS_IF([test "x$GMAKE" = x], [AC_MSG_ERROR([You need GNU make])])
e9c9a47c
DWT
11AC_PATH_PROGS([_BASH], [bash])
12AS_IF([test "x$_BASH" = x], [AC_MSG_ERROR([You need GNU bash])])
13AC_PATH_PROGS([TIME], [time])
14AC_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[
19 ,
20 ac_cv_path_]$1[=$ac_path_]$1[
21 )
22 ,
b5bd4353 23 AC_MSG_RESULT(no)
e9c9a47c
DWT
24 AC_MSG_ERROR(You need ]$2[ ]$5[ or greater)
25 )
26 AC_SUBST(]$1[, $ac_cv_path_]$1[)
27 AC_MSG_RESULT($]$1[)
28])
29AC_ARG_VAR([BISON], [GNU Project parser generator (yacc replacement)])
30CY_CHECK_PROGS_VERSION([BISON], [bison], [bison],
31 [-V | $SED -e '1 s/^bison (GNU Bison) \(.*\)$/\1/p;d'], [2.3])
32AC_ARG_VAR([FLEX], [the fast lexical analyser generator])
33CY_CHECK_PROGS_VERSION([FLEX], [flex], [flex],
8cd1ce21 34 [--version | $SED -e '1 s/^@<:@^0-9.@:>@* \(@<:@0-9.@:>@*\).*$/\1/p;d'], [2.5.33])
e9c9a47c
DWT
35AC_ARG_VAR([GPERF], [perfect hash function generator])
36CY_CHECK_PROGS_VERSION([GPERF], [gperf], [gperf],
37 [--version | $SED -e '1 s/^.* \(@<:@0-9.@:>@*\)$/\1/p;d'], [3.0.3])
38AC_PROG_INSTALL
b5bd4353 39AC_MSG_CHECKING([for GNU tar >=1.19])
e9c9a47c
DWT
40AC_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], [
b5bd4353
DWT
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
44 ], [
45 ac_cv_path_GNUTAR=$ac_path_GNUTAR
46 ])
e9c9a47c
DWT
47 ])
48])
49AS_IF([test "x$ac_cv_path_GNUTAR" != x], [
50 AC_SUBST([GNUTAR], [$ac_cv_path_GNUTAR])
51 AC_MSG_RESULT([$GNUTAR])
52], [
53 AC_SUBST([GNUTAR], [:])
b5bd4353 54 AC_MSG_RESULT([no])
e9c9a47c 55])
fb726fc5 56AC_CHECK_PROGS([GIT], [git])
47aaa820 57AC_PROG_CXX
632b71ea 58AC_PROG_OBJCXX
b816329d 59AC_LANG([C++])
1504c9b8
DWT
60AC_DEFUN([CY_CHECK_UNIVERSAL], [
61 AC_MSG_CHECKING([for universal binary support])
62 AS_CASE([$host_vendor], [apple], [
9d13f949
JF
63 AS_CASE([$host_cpu], [armv6|i386|x86_64], [
64 for cy_arch in armv6 i386 x86_64; do
1504c9b8
DWT
65 cy_save_CXXFLAGS=$CXXFLAGS
66 AC_LIB_APPENDTOVAR([CXXFLAGS], ["-arch $cy_arch"])
67 AC_TRY_LINK([], [], [
68 AC_LIB_APPENDTOVAR([cy_arches], [$cy_arch])
69 AC_LIB_APPENDTOVAR([CFLAGS], ["-arch $cy_arch"])
70 AC_LIB_APPENDTOVAR([LDFLAGS], ["-arch $cy_arch"])
71 AC_LIB_APPENDTOVAR([OBJCXXFLAGS], ["-arch $cy_arch"])
72 ], [
73 CXXFLAGS=$cy_save_CXXFLAGS
74 ])
75 done
76 ])
77 ])
78 AC_MSG_RESULT([${cy_arches-no}])
79])
80AC_ARG_ENABLE([universal-binary], [AS_HELP_STRING(
81 [--disable-universal-binary],
82 [do not build with universal binary support on Darwin]
83)], [
84 AS_CASE([$enableval], [no], [], [CY_CHECK_UNIVERSAL])
85], [CY_CHECK_UNIVERSAL])
632b71ea
DWT
86AC_ARG_WITH([frameworks], [AS_HELP_STRING(
87 [--with-frameworks=DIRS],
88 [add to DIRS (space separated) to the Darwin include path for frameworks with -F]
89)], [
1504c9b8
DWT
90 for cy_framework in $withval; do
91 AC_LIB_APPENDTOVAR([CFLAGS], [-F$cy_framework])
92 AC_LIB_APPENDTOVAR([CXXFLAGS], [-F$cy_framework])
93 AC_LIB_APPENDTOVAR([OBJCCXXFLAGS], [-F$cy_framework])
632b71ea
DWT
94 done
95])
309b0535
DWT
96APR_FIND_APR([], [], [1], [1])
97AS_CASE([$apr_found], [yes], [
98 AC_LIB_APPENDTOVAR([CPPFLAGS], [`$apr_config --includes`])
549f29b5 99 AC_SUBST([LTLIBAPR], [`$apr_config --link-libtool`])
309b0535 100], [AC_MSG_ERROR([You need apr])])
b66977f1
DWT
101AC_DEFUN([CY_CHECK_JAVASCRIPTCORE], [
102 PKG_CHECK_MODULES([WEBKIT], [webkit-1.0], [
a667869d 103 CY_EXECUTE=1
b66977f1
DWT
104 AC_LIB_APPENDTOVAR([CXXFLAGS], [`$PKG_CONFIG --cflags webkit-1.0`])
105 AC_LIB_APPENDTOVAR([LIBS], [`$PKG_CONFIG --libs webkit-1.0`])
b128dfee 106 ], [
b66977f1
DWT
107 PKG_CHECK_MODULES([WEBKIT], [WebKitGtk], [
108 CY_EXECUTE=1
109 AC_LIB_APPENDTOVAR([CXXFLAGS], [`$PKG_CONFIG --cflags WebKitGtk`])
110 AC_LIB_APPENDTOVAR([LIBS], [`$PKG_CONFIG --libs WebKitGtk`])
111 ], [
112 AC_CHECK_FRAMEWORK([JavaScriptCore], [
113 #include <JavaScriptCore/JSBase.h>
114 ], [JSEvaluateScript(0, 0, 0, 0, 0, 0);], [CY_EXECUTE=1])
115 ])
b128dfee 116 ])
35fa52c0 117])
b66977f1
DWT
118AC_DEFUN([CY_CHECK_JAVASCRIPT], [
119 CY_CHECK_JAVASCRIPTCORE
120])
121AC_ARG_ENABLE([javascript], [AS_HELP_STRING(
122 [--enable-javascript@<:@=ENGINE@:>@],
123 [use a JavaScript runtime (currently the only available option for ENGINE is JavaScriptCore) @<:@default=yes@:>@]
124)], [
125 AS_CASE([$enableval], [yes], [CY_CHECK_JAVASCRIPT], [no], [
126 AC_SUBST([CY_EXECUTE], [0])
127 ], [JavaScriptCore], [
128 CY_CHECK_JAVASCRIPTCORE
129 ], [AC_MSG_ERROR([Unknown JavaScript engine: $enableval])])
130], [CY_CHECK_JAVASCRIPT])
e5cca37d 131AC_DEFUN([CY_CHECK_PKG_CONFIG_LIBFFI], [
3fd51f51
DWT
132 PKG_CHECK_MODULES([LIBFFI], [libffi], [
133 AC_LIB_APPENDTOVAR([CXXFLAGS], [`$PKG_CONFIG --cflags libffi`])
134 AC_LIB_APPENDTOVAR([LIBS], [`$PKG_CONFIG --libs libffi`])
135 ], [
e5cca37d
DWT
136 AC_MSG_ERROR([You need libffi])
137 ])
138])
139AS_CASE([$CY_EXECUTE], [1], [
140 AC_SUBST([CY_EXECUTE])
141 AC_CHECK_HEADERS([ffi.h ffi/ffi.h], [break])
142 AS_IF([test "x$ac_cv_header_ffi_h" = xno && test "x$ac_cv_header_ffi_ffi_h" = xno], [
143 CY_CHECK_PKG_CONFIG_LIBFFI
144 ], [
6b66678a 145 AC_SEARCH_LIBS([ffi_call], [ffi])
e5cca37d 146 AS_CASE([$ac_cv_search_ffi_call], [no], [CY_CHECK_PKG_CONFIG_LIBFFI])
6b66678a 147 ])
a667869d
DWT
148 AC_LANG_PUSH([Objective C++])
149 AC_MSG_CHECKING([if we really have Objective C++])
150 AC_COMPILE_IFELSE([
151 // This space intentionally left blank
152 ], [
153 CY_OBJECTIVEC=1
154 AC_MSG_RESULT([yes])
155 ], [AC_MSG_RESULT([no])])
a667869d 156 AS_IF([test "x$CY_OBJECTIVEC" = x1], [
c823f118
DWT
157 AC_CHECK_FRAMEWORK([CoreFoundation], [
158 #include <CoreFoundation/CFBase.h>
159 ], [CFAllocatorGetDefault();], [
a667869d 160 AC_SUBST([CY_OBJECTIVEC])
c823f118
DWT
161 AC_CHECK_FRAMEWORK([Foundation], [
162 #include <Foundation/NSObject.h>
163 ], [[[[NSObject alloc] init];]])
164 AC_CHECK_FRAMEWORK([WebKit], [
165 #include <WebKit/WebScriptObject.h>
166 ], [[[[WebScriptObject alloc] init];]])
167 ], [
790e5246 168 AC_ARG_VAR([GNUSTEP_CONFIG], [prints information about the current gnustep installation])
c823f118
DWT
169 AC_CHECK_PROGS([GNUSTEP_CONFIG], [gnustep-config])
170 AS_IF([test "x$GNUSTEP_CONFIG" != x], [
171 AC_SUBST([CY_OBJECTIVEC])
172 AC_LIB_APPENDTOVAR([OBJCXXFLAGS], [`$GNUSTEP_CONFIG --objc-flags`])
173 AC_LIB_APPENDTOVAR([LIBS], [`$GNUSTEP_CONFIG --base-libs`])
174 ], [AC_SUBST([CY_OBJECTIVEC], [0])])
a667869d
DWT
175 ])
176 ])
c823f118 177 AC_LANG_POP([Objective C++])
3fd51f51 178])
058f1bc8
DWT
179VL_LIB_READLINE
180AS_CASE([$vl_cv_lib_readline], [no], [AC_MSG_ERROR([You need readline])])
5053a6d1
DWT
181AC_LANG_PUSH([C])
182AM_ICONV
058f1bc8
DWT
183AS_CASE([$am_cv_func_iconv], [yes], [], [
184 for cy_iconv_prefix_arg in $CFLAGS $CXXFLAGS $OBJCXXFLAGS $LDFLAGS $LIBS; do
185 AS_CASE([$cy_iconv_prefix_arg], [-I*], [
186 AC_LIB_APPENDTOVAR([cy_iconv_prefixes], [`echo $cy_iconv_prefix_arg | sed -e 's/^-I//;s|/include$||'`])
187 ], [-L*], [
188 AC_LIB_APPENDTOVAR([cy_iconv_prefixes], [`echo $cy_iconv_prefix_arg | sed -e 's/^-L//;s|/lib$||'`])
189 ])
190 done
191 for with_libiconv_prefix in $cy_iconv_prefixes; do
192 AS_UNSET([am_cv_func_iconv])
193 AM_ICONV_LINKFLAGS_BODY
194 AM_ICONV
195 done
196])
5053a6d1 197AS_CASE([$am_cv_func_iconv], [yes], [], [AC_MSG_ERROR([You need iconv])])
058f1bc8 198AC_LANG_POP([C])
9777bd50 199AC_SUBST([SO], [$acl_shlibext])
e1cce270
DWT
200AS_IF([test "x$CY_OBJECTIVEC" = x1], [
201 AC_CHECK_HEADER([mach/mach.h], [
794e88e7
DWT
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])])
794e88e7
DWT
208 AC_SUBST([CY_OBJECTIVEC_MACH], [1])
209 AC_SUBST([CY_ATTACH_GROUP], [procmod])
e1cce270
DWT
210 ])
211])
790e5246
DWT
212AS_IF([test "x$GMAKE" != xmake], [
213 AC_CONFIG_FILES([Makefile])
214])
9c60689e
DWT
215AC_CONFIG_FILES([GNUmakefile])
216AC_OUTPUT