]>
Commit | Line | Data |
---|---|---|
1 | AC_PREREQ([2.65]) | |
2 | AC_INIT([Cycript], [0.9], [saurik@saurik.com], [cycript], [http://www.cycript.org/]) | |
3 | AC_CONFIG_SRCDIR([Console.cpp]) | |
4 | AC_CONFIG_AUX_DIR([.]) | |
5 | LT_INIT([disable-static]) | |
6 | PKG_PROG_PKG_CONFIG([0.22]) | |
7 | CHECK_GNU_MAKE | |
8 | AS_IF([test "x$_cv_gnu_make_command" = x], [AC_MSG_ERROR([You need GNU make])]) | |
9 | AC_PROG_CXX | |
10 | AC_PROG_OBJCXX | |
11 | AC_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 | ]) | |
21 | AC_LANG([C++]) | |
22 | AC_PROG_SED | |
23 | AX_PROG_BISON([ | |
24 | BISON=`echo $YACC | $SED -e 's/ -y//'` | |
25 | BISON_VERSION=`$BISON -V | $SED -e 's/^bison (GNU Bison) \(.*\)$/\1/p;d'` | |
26 | ], [AC_MSG_ERROR([You need bison 2.3 or greater])]) | |
27 | AC_PROG_AWK | |
28 | AC_MSG_CHECKING([if bison is >= 2.3]) | |
29 | AS_VERSION_COMPARE([$BISON_VERSION], [2.3], [ | |
30 | AC_MSG_RESULT([no]) | |
31 | AC_MSG_ERROR([You need bison 2.3 or greater]) | |
32 | ], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([yes])]) | |
33 | AC_SUBST([BISON]) | |
34 | AX_PROG_FLEX([ | |
35 | FLEX=$LEX | |
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])]) | |
38 | AC_MSG_CHECKING([if flex is >= 2.5.33]) | |
39 | AS_VERSION_COMPARE([$FLEX_VERSION], [2.5.33], [ | |
40 | AC_MSG_RESULT([no]) | |
41 | AC_MSG_ERROR([You need flex 2.5.33 or greater]) | |
42 | ], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([yes])]) | |
43 | AC_SUBST([FLEX]) | |
44 | AC_CHECK_PROGS([_BASH], [bash]) | |
45 | AC_ARG_VAR([GPERF], [perfect hash function generator]) | |
46 | AC_CHECK_PROGS([GPERF], [gperf]) | |
47 | AC_MSG_CHECKING([if gperf >= 3.0.3]) | |
48 | GPERF_VERSION=[`$GPERF --version | $SED -e 's/^.* \([0-9.]*\)$/\1/p;d'`] | |
49 | AS_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])]) | |
53 | AC_CHECK_PROGS([TIME], [time]) | |
54 | APR_FIND_APR([], [], [1], [1]) | |
55 | AS_CASE([$apr_found], [yes], [ | |
56 | AC_LIB_APPENDTOVAR([CPPFLAGS], [`$apr_config --includes`]) | |
57 | AC_SUBST([LTLIBAPR], [`$apr_config --link-libtool`]) | |
58 | ], [AC_MSG_ERROR([You need apr])]) | |
59 | VL_LIB_READLINE | |
60 | AC_PROG_INSTALL | |
61 | AC_LANG_PUSH([C]) | |
62 | AM_ICONV | |
63 | AC_LANG_POP([C]) | |
64 | AS_CASE([$am_cv_func_iconv], [yes], [], [AC_MSG_ERROR([You need iconv])]) | |
65 | AC_DEFUN([CY_CHECK_JAVASCRIPTCORE], [ | |
66 | PKG_CHECK_MODULES([WEBKIT], [webkit-1.0], [ | |
67 | CY_EXECUTE=1 | |
68 | AC_LIB_APPENDTOVAR([CXXFLAGS], [`$PKG_CONFIG --cflags webkit-1.0`]) | |
69 | AC_LIB_APPENDTOVAR([LIBS], [`$PKG_CONFIG --libs webkit-1.0`]) | |
70 | ], [ | |
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 | ]) | |
80 | ]) | |
81 | ]) | |
82 | AC_DEFUN([CY_CHECK_JAVASCRIPT], [ | |
83 | CY_CHECK_JAVASCRIPTCORE | |
84 | ]) | |
85 | AC_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]) | |
95 | AS_CASE([$CY_EXECUTE], [1], [ | |
96 | AC_SUBST([CY_EXECUTE]) | |
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 | ], [ | |
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 | ]) | |
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])]) | |
118 | AS_IF([test "x$CY_OBJECTIVEC" = x1], [ | |
119 | AC_CHECK_FRAMEWORK([CoreFoundation], [ | |
120 | #include <CoreFoundation/CFBase.h> | |
121 | ], [CFAllocatorGetDefault();], [ | |
122 | AC_SUBST([CY_OBJECTIVEC]) | |
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])]) | |
136 | ]) | |
137 | ]) | |
138 | AC_LANG_POP([Objective C++]) | |
139 | ]) | |
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])]) | |
143 | ]) | |
144 | ]) | |
145 | AC_CONFIG_FILES([GNUmakefile]) | |
146 | AC_OUTPUT |