]> git.saurik.com Git - cycript.git/blame - configure.ac
Fail on a lack of readline.
[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 7CHECK_GNU_MAKE
790e5246
DWT
8AC_SUBST([GMAKE], [$_cv_gnu_make_command])
9AS_IF([test "x$GMAKE" = x], [AC_MSG_ERROR([You need GNU make])])
e9c9a47c
DWT
10AC_PATH_PROGS([_BASH], [bash])
11AS_IF([test "x$_BASH" = x], [AC_MSG_ERROR([You need GNU bash])])
12AC_PATH_PROGS([TIME], [time])
13AC_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[
18 ,
19 ac_cv_path_]$1[=$ac_path_]$1[
20 )
21 ,
22 AC_MSG_RESULT(not found)
23 AC_MSG_ERROR(You need ]$2[ ]$5[ or greater)
24 )
25 AC_SUBST(]$1[, $ac_cv_path_]$1[)
26 AC_MSG_RESULT($]$1[)
27])
28AC_ARG_VAR([BISON], [GNU Project parser generator (yacc replacement)])
29CY_CHECK_PROGS_VERSION([BISON], [bison], [bison],
30 [-V | $SED -e '1 s/^bison (GNU Bison) \(.*\)$/\1/p;d'], [2.3])
31AC_ARG_VAR([FLEX], [the fast lexical analyser generator])
32CY_CHECK_PROGS_VERSION([FLEX], [flex], [flex],
33 [--version | $SED -e '1 s/^.* \(@<:@0-9.@:>@*\)$/\1/p;d'], [2.5.33])
34AC_ARG_VAR([GPERF], [perfect hash function generator])
35CY_CHECK_PROGS_VERSION([GPERF], [gperf], [gperf],
36 [--version | $SED -e '1 s/^.* \(@<:@0-9.@:>@*\)$/\1/p;d'], [3.0.3])
37AC_PROG_INSTALL
38AC_MSG_CHECKING([for GNU tar])
39AC_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 ac_cv_path_GNUTAR=$ac_path_GNUTAR
42 ])
43])
44AS_IF([test "x$ac_cv_path_GNUTAR" != x], [
45 AC_SUBST([GNUTAR], [$ac_cv_path_GNUTAR])
46 AC_MSG_RESULT([$GNUTAR])
47], [
48 AC_SUBST([GNUTAR], [:])
49 AC_MSG_RESULT([not found])
50])
b65019fe
DWT
51AC_CHECK_PROGS([SVN], [svn])
52AC_CHECK_PROGS([SVNVERSION], [svnversion])
47aaa820 53AC_PROG_CXX
632b71ea
DWT
54AC_PROG_OBJCXX
55AC_ARG_WITH([frameworks], [AS_HELP_STRING(
56 [--with-frameworks=DIRS],
57 [add to DIRS (space separated) to the Darwin include path for frameworks with -F]
58)], [
59 for framework in $withval; do
60 AC_LIB_APPENDTOVAR([CFLAGS], [-F$framework])
61 AC_LIB_APPENDTOVAR([CXXFLAGS], [-F$framework])
62 AC_LIB_APPENDTOVAR([OBJCCXXFLAGS], [-F$framework])
63 done
64])
47aaa820 65AC_LANG([C++])
309b0535
DWT
66APR_FIND_APR([], [], [1], [1])
67AS_CASE([$apr_found], [yes], [
68 AC_LIB_APPENDTOVAR([CPPFLAGS], [`$apr_config --includes`])
549f29b5 69 AC_SUBST([LTLIBAPR], [`$apr_config --link-libtool`])
309b0535 70], [AC_MSG_ERROR([You need apr])])
9c60689e 71VL_LIB_READLINE
19c905b4 72AS_CASE([$vl_cv_lib_readline], [no], [AC_MSG_ERROR([You need readline])])
94690cff 73AC_LANG_PUSH([C])
35fa52c0 74AM_ICONV
94690cff 75AC_LANG_POP([C])
35fa52c0 76AS_CASE([$am_cv_func_iconv], [yes], [], [AC_MSG_ERROR([You need iconv])])
b66977f1
DWT
77AC_DEFUN([CY_CHECK_JAVASCRIPTCORE], [
78 PKG_CHECK_MODULES([WEBKIT], [webkit-1.0], [
a667869d 79 CY_EXECUTE=1
b66977f1
DWT
80 AC_LIB_APPENDTOVAR([CXXFLAGS], [`$PKG_CONFIG --cflags webkit-1.0`])
81 AC_LIB_APPENDTOVAR([LIBS], [`$PKG_CONFIG --libs webkit-1.0`])
b128dfee 82 ], [
b66977f1
DWT
83 PKG_CHECK_MODULES([WEBKIT], [WebKitGtk], [
84 CY_EXECUTE=1
85 AC_LIB_APPENDTOVAR([CXXFLAGS], [`$PKG_CONFIG --cflags WebKitGtk`])
86 AC_LIB_APPENDTOVAR([LIBS], [`$PKG_CONFIG --libs WebKitGtk`])
87 ], [
88 AC_CHECK_FRAMEWORK([JavaScriptCore], [
89 #include <JavaScriptCore/JSBase.h>
90 ], [JSEvaluateScript(0, 0, 0, 0, 0, 0);], [CY_EXECUTE=1])
91 ])
b128dfee 92 ])
35fa52c0 93])
b66977f1
DWT
94AC_DEFUN([CY_CHECK_JAVASCRIPT], [
95 CY_CHECK_JAVASCRIPTCORE
96])
97AC_ARG_ENABLE([javascript], [AS_HELP_STRING(
98 [--enable-javascript@<:@=ENGINE@:>@],
99 [use a JavaScript runtime (currently the only available option for ENGINE is JavaScriptCore) @<:@default=yes@:>@]
100)], [
101 AS_CASE([$enableval], [yes], [CY_CHECK_JAVASCRIPT], [no], [
102 AC_SUBST([CY_EXECUTE], [0])
103 ], [JavaScriptCore], [
104 CY_CHECK_JAVASCRIPTCORE
105 ], [AC_MSG_ERROR([Unknown JavaScript engine: $enableval])])
106], [CY_CHECK_JAVASCRIPT])
a667869d
DWT
107AS_CASE([$CY_EXECUTE], [1], [
108 AC_SUBST([CY_EXECUTE])
3fd51f51
DWT
109 PKG_CHECK_MODULES([LIBFFI], [libffi], [
110 AC_LIB_APPENDTOVAR([CXXFLAGS], [`$PKG_CONFIG --cflags libffi`])
111 AC_LIB_APPENDTOVAR([LIBS], [`$PKG_CONFIG --libs libffi`])
112 ], [
6b66678a
DWT
113 AC_CHECK_HEADERS([ffi.h ffi/ffi.h], [break])
114 AS_IF([test "x$ac_cv_header_ffi_h" = xno && test "x$ac_cv_header_ffi_ffi_h" = xno], [
115 AC_MSG_ERROR([You need libffi])
116 ])
117 AC_SEARCH_LIBS([ffi_call], [ffi])
118 AS_CASE([$ac_cv_search_ffi_call], [no], [
119 AC_MSG_ERROR([You need libffi])
120 ])
121 ])
a667869d
DWT
122 AC_LANG_PUSH([Objective C++])
123 AC_MSG_CHECKING([if we really have Objective C++])
124 AC_COMPILE_IFELSE([
125 // This space intentionally left blank
126 ], [
127 CY_OBJECTIVEC=1
128 AC_MSG_RESULT([yes])
129 ], [AC_MSG_RESULT([no])])
a667869d 130 AS_IF([test "x$CY_OBJECTIVEC" = x1], [
c823f118
DWT
131 AC_CHECK_FRAMEWORK([CoreFoundation], [
132 #include <CoreFoundation/CFBase.h>
133 ], [CFAllocatorGetDefault();], [
a667869d 134 AC_SUBST([CY_OBJECTIVEC])
c823f118
DWT
135 AC_CHECK_FRAMEWORK([Foundation], [
136 #include <Foundation/NSObject.h>
137 ], [[[[NSObject alloc] init];]])
138 AC_CHECK_FRAMEWORK([WebKit], [
139 #include <WebKit/WebScriptObject.h>
140 ], [[[[WebScriptObject alloc] init];]])
141 ], [
790e5246 142 AC_ARG_VAR([GNUSTEP_CONFIG], [prints information about the current gnustep installation])
c823f118
DWT
143 AC_CHECK_PROGS([GNUSTEP_CONFIG], [gnustep-config])
144 AS_IF([test "x$GNUSTEP_CONFIG" != x], [
145 AC_SUBST([CY_OBJECTIVEC])
146 AC_LIB_APPENDTOVAR([OBJCXXFLAGS], [`$GNUSTEP_CONFIG --objc-flags`])
147 AC_LIB_APPENDTOVAR([LIBS], [`$GNUSTEP_CONFIG --base-libs`])
148 ], [AC_SUBST([CY_OBJECTIVEC], [0])])
a667869d
DWT
149 ])
150 ])
c823f118 151 AC_LANG_POP([Objective C++])
3fd51f51 152])
e1cce270
DWT
153AS_IF([test "x$CY_OBJECTIVEC" = x1], [
154 AC_CHECK_HEADER([mach/mach.h], [
155 AS_CASE([$OTOOL], [:], [AC_MSG_WARN([Missing otool?])], [AC_SUBST([CY_OBJECTIVEC_MACH], [1])])
156 ])
157])
790e5246
DWT
158AS_IF([test "x$GMAKE" != xmake], [
159 AC_CONFIG_FILES([Makefile])
160])
9c60689e
DWT
161AC_CONFIG_FILES([GNUmakefile])
162AC_OUTPUT