]> git.saurik.com Git - cycript.git/blame - configure.ac
Enable/disable argument for JavaScript (engine).
[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])
632b71ea
DWT
7CHECK_GNU_MAKE
8AS_IF([test "x$_cv_gnu_make_command" = x], [AC_MSG_ERROR([You need GNU make])])
47aaa820 9AC_PROG_CXX
632b71ea
DWT
10AC_PROG_OBJCXX
11AC_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]
14)], [
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])
19 done
20])
47aaa820 21AC_LANG([C++])
e1cce270 22AC_PROG_SED
35fa52c0
DWT
23AX_PROG_BISON([
24 BISON=`echo $YACC | $SED -e 's/ -y//'`
25 BISON_VERSION=`$BISON -V | $SED -e 's/^bison (GNU Bison) \(.*\)$/\1/p;d'`
27557508 26], [AC_MSG_ERROR([You need bison 2.3 or greater])])
35fa52c0 27AC_PROG_AWK
27557508
DWT
28AC_MSG_CHECKING([if bison is >= 2.3])
29AS_VERSION_COMPARE([$BISON_VERSION], [2.3], [
35fa52c0 30 AC_MSG_RESULT([no])
27557508 31 AC_MSG_ERROR([You need bison 2.3 or greater])
6b66678a 32], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([yes])])
35fa52c0 33AC_SUBST([BISON])
6b66678a
DWT
34AX_PROG_FLEX([
35 FLEX=$LEX
3fd51f51
DWT
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])])
50ac250c
DWT
38AC_MSG_CHECKING([if flex is >= 2.5.33])
39AS_VERSION_COMPARE([$FLEX_VERSION], [2.5.33], [
6b66678a 40 AC_MSG_RESULT([no])
50ac250c 41 AC_MSG_ERROR([You need flex 2.5.33 or greater])
6b66678a
DWT
42], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([yes])])
43AC_SUBST([FLEX])
9c60689e 44AC_CHECK_PROGS([_BASH], [bash])
27557508 45AC_ARG_VAR([GPERF], [perfect hash function generator])
9c60689e 46AC_CHECK_PROGS([GPERF], [gperf])
3fd51f51
DWT
47AC_MSG_CHECKING([if gperf >= 3.0.3])
48GPERF_VERSION=[`$GPERF --version | $SED -e 's/^.* \([0-9.]*\)$/\1/p;d'`]
49AS_VERSION_COMPARE([$GPERF_VERSION], [3.0.3], [
50 AC_MSG_RESULT([no])
51 AC_MSG_ERROR([You need gperf 3.0.3 or greater])
52], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([yes])])
3530897b 53AC_CHECK_PROGS([TIME], [time])
309b0535
DWT
54APR_FIND_APR([], [], [1], [1])
55AS_CASE([$apr_found], [yes], [
56 AC_LIB_APPENDTOVAR([CPPFLAGS], [`$apr_config --includes`])
549f29b5 57 AC_SUBST([LTLIBAPR], [`$apr_config --link-libtool`])
309b0535 58], [AC_MSG_ERROR([You need apr])])
9c60689e 59VL_LIB_READLINE
35fa52c0 60AC_PROG_INSTALL
94690cff 61AC_LANG_PUSH([C])
35fa52c0 62AM_ICONV
94690cff 63AC_LANG_POP([C])
35fa52c0 64AS_CASE([$am_cv_func_iconv], [yes], [], [AC_MSG_ERROR([You need iconv])])
b66977f1
DWT
65AC_DEFUN([CY_CHECK_JAVASCRIPTCORE], [
66 PKG_CHECK_MODULES([WEBKIT], [webkit-1.0], [
a667869d 67 CY_EXECUTE=1
b66977f1
DWT
68 AC_LIB_APPENDTOVAR([CXXFLAGS], [`$PKG_CONFIG --cflags webkit-1.0`])
69 AC_LIB_APPENDTOVAR([LIBS], [`$PKG_CONFIG --libs webkit-1.0`])
b128dfee 70 ], [
b66977f1
DWT
71 PKG_CHECK_MODULES([WEBKIT], [WebKitGtk], [
72 CY_EXECUTE=1
73 AC_LIB_APPENDTOVAR([CXXFLAGS], [`$PKG_CONFIG --cflags WebKitGtk`])
74 AC_LIB_APPENDTOVAR([LIBS], [`$PKG_CONFIG --libs WebKitGtk`])
75 ], [
76 AC_CHECK_FRAMEWORK([JavaScriptCore], [
77 #include <JavaScriptCore/JSBase.h>
78 ], [JSEvaluateScript(0, 0, 0, 0, 0, 0);], [CY_EXECUTE=1])
79 ])
b128dfee 80 ])
35fa52c0 81])
b66977f1
DWT
82AC_DEFUN([CY_CHECK_JAVASCRIPT], [
83 CY_CHECK_JAVASCRIPTCORE
84])
85AC_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@:>@]
88)], [
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])
a667869d
DWT
95AS_CASE([$CY_EXECUTE], [1], [
96 AC_SUBST([CY_EXECUTE])
3fd51f51
DWT
97 PKG_CHECK_MODULES([LIBFFI], [libffi], [
98 AC_LIB_APPENDTOVAR([CXXFLAGS], [`$PKG_CONFIG --cflags libffi`])
99 AC_LIB_APPENDTOVAR([LIBS], [`$PKG_CONFIG --libs libffi`])
100 ], [
6b66678a
DWT
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])
104 ])
105 AC_SEARCH_LIBS([ffi_call], [ffi])
106 AS_CASE([$ac_cv_search_ffi_call], [no], [
107 AC_MSG_ERROR([You need libffi])
108 ])
109 ])
a667869d
DWT
110 AC_LANG_PUSH([Objective C++])
111 AC_MSG_CHECKING([if we really have Objective C++])
112 AC_COMPILE_IFELSE([
113 // This space intentionally left blank
114 ], [
115 CY_OBJECTIVEC=1
116 AC_MSG_RESULT([yes])
117 ], [AC_MSG_RESULT([no])])
a667869d 118 AS_IF([test "x$CY_OBJECTIVEC" = x1], [
c823f118
DWT
119 AC_CHECK_FRAMEWORK([CoreFoundation], [
120 #include <CoreFoundation/CFBase.h>
121 ], [CFAllocatorGetDefault();], [
a667869d 122 AC_SUBST([CY_OBJECTIVEC])
c823f118
DWT
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];]])
129 ], [
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])])
a667869d
DWT
136 ])
137 ])
c823f118 138 AC_LANG_POP([Objective C++])
3fd51f51 139])
e1cce270
DWT
140AS_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])])
143 ])
144])
9c60689e
DWT
145AC_CONFIG_FILES([GNUmakefile])
146AC_OUTPUT