-
-
Notifications
You must be signed in to change notification settings - Fork 43
Expand file tree
/
Copy pathconfigure.ac
More file actions
174 lines (141 loc) · 5.89 KB
/
configure.ac
File metadata and controls
174 lines (141 loc) · 5.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
AC_PREREQ([2.69])
AC_INIT([ra1nsn0w], m4_esyscmd([git rev-list --count HEAD | tr -d '\n']), [tihmstar@gmail.com])
AC_CANONICAL_SYSTEM
AC_CANONICAL_HOST
AM_PROG_LIBTOOL
AM_INIT_AUTOMAKE
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIRS([m4])
AC_DEFINE([VERSION_COMMIT_COUNT], "m4_esyscmd([git rev-list --count HEAD | tr -d '\n'])", [Git commit count])
AC_DEFINE([VERSION_COMMIT_SHA], "m4_esyscmd([git rev-parse HEAD | tr -d '\n'])", [Git commit sha])
AC_SUBST([VERSION_COMMIT_COUNT], ["m4_esyscmd([git rev-list --count HEAD | tr -d '\n'])"])
AC_SUBST([VERSION_COMMIT_SHA], ["m4_esyscmd([git rev-parse HEAD | tr -d '\n'])"])
# Checks for programs.
AC_PROG_CXX([clang++])
AC_PROG_CC([clang])
# Check for operating system
AC_MSG_CHECKING([whether we need platform-specific build settings])
case $host_os in
darwin* )
CXXFLAGS+=" -stdlib=libc++"
;;
*mingw32*|*cygwin*|*msys*)
AC_MSG_RESULT([${host_os}])
win32=true
LDFLAGS+=" -no-undefined"
;;
esac
CXXFLAGS+=" -std=c++11"
CFLAGS+=" -std=c11"
LDFLAGS+=" -lpthread"
LIBGENERAL_REQUIRES_STR="libgeneral >= 75"
LIBFRAGMENTZIP_REQUIRES_STR="libfragmentzip >= 67"
LIBFWKEYFETCH_REQUIRES_STR="libfwkeyfetch >= 1"
LIBIMG4TOOL_REQUIRES_STR="libimg4tool >= 202"
LIBIMG3TOOL_REQUIRES_STR="libimg3tool >= 8"
LIBIMG1TOOL_REQUIRES_STR="libimg1tool >= 12"
LIBIRECOVERY_REQUIRES_STR="libirecovery-1.0 >= 1.0.0"
LIBPATCHFINDER_REQUIRES_STR="libpatchfinder >= 153"
LIBPLIST_REQUIRES_STR="libplist-2.0 >= 2.3.0"
LIBTSSCHECKER_REQUIRES_STR="libtsschecker >= 336"
OPENSSL_REQUIRES_STR="openssl"
PKG_CHECK_MODULES(libgeneral, $LIBGENERAL_REQUIRES_STR)
PKG_CHECK_MODULES(libfragmentzip, $LIBFRAGMENTZIP_REQUIRES_STR)
PKG_CHECK_MODULES(libfwkeyfetch, $LIBFWKEYFETCH_REQUIRES_STR)
PKG_CHECK_MODULES(libimg4tool, $LIBIMG4TOOL_REQUIRES_STR)
PKG_CHECK_MODULES(libimg3tool, $LIBIMG3TOOL_REQUIRES_STR)
PKG_CHECK_MODULES(libirecovery, $LIBIRECOVERY_REQUIRES_STR)
PKG_CHECK_MODULES(libpatchfinder, $LIBPATCHFINDER_REQUIRES_STR)
PKG_CHECK_MODULES(libplist, $LIBPLIST_REQUIRES_STR)
PKG_CHECK_MODULES(libtsschecker, $LIBTSSCHECKER_REQUIRES_STR)
PKG_CHECK_MODULES(openssl, $OPENSSL_REQUIRES_STR, have_openssl=yes, have_openssl=no)
PKG_CHECK_MODULES(libimg1tool, $LIBIMG1TOOL_REQUIRES_STR, have_img1tool=yes, have_img1tool=no)
AC_SUBST([libgeneral_requires], [$LIBGENERAL_REQUIRES_STR])
AC_SUBST([libfragmentzip_requires], [$LIBFRAGMENTZIP_REQUIRES_STR])
AC_SUBST([libfwkeyfetch_requires], [$LIBFWKEYFETCH_REQUIRES_STR])
AC_SUBST([libimg3tool_requires], [$LIBIMG3TOOL_REQUIRES_STR])
AC_SUBST([libimg4tool_requires], [$LIBIMG4TOOL_REQUIRES_STR])
AC_SUBST([libirecovery_requires], [$LIBIRECOVERY_REQUIRES_STR])
AC_SUBST([libpatchfinder_requires], [$LIBPATCHFINDER_REQUIRES_STR])
AC_SUBST([libplist_requires], [$LIBPLIST_REQUIRES_STR])
AC_SUBST([libtsschecker_requires], [$LIBTSSCHECKER_REQUIRES_STR])
AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--enable-debug],
[enable debug build(default is no)])],
[debug_build=true],
[debug_build=false])
AC_ARG_ENABLE([plugins],
[AS_HELP_STRING([--enable-plugins],
[enable plugin support(default is no)])],
[plugin_support=true],
[plugin_support=false])
AC_ARG_WITH([img1tool],
[AS_HELP_STRING([--without-img1tool],
[do not build with img1tool @<:@default=yes@:>@])],
[with_img1tool=no],
[with_img1tool=yes])
AC_ARG_WITH([ibootpatcher],
[AS_HELP_STRING([--without-ibootpatcher],
[build with ibootpatcher @<:@default=yes@:>@])],
[with_ibootpatcher=no],
[with_ibootpatcher=yes])
AC_ARG_WITH([kernelpatcher],
[AS_HELP_STRING([--without-kernelpatcher],
[build with kernelpatcher @<:@default=yes@:>@])],
[with_kernelpatcher=no],
[with_kernelpatcher=yes])
AM_CONDITIONAL(WITH_IBOOTPATCHER, test x$with_ibootpatcher == xyes)
AM_CONDITIONAL(WITH_KERNELPATCHER, test x$with_kernelpatcher == xyes)
if test "$debug_build" = true; then
echo "*** Note: debug build requested ***"
CFLAGS+=" -g -O0 -DDEBUG=1"
CXXFLAGS+=" -g -O0 -DDEBUG=1"
fi
if test "x$plugin_support" == "xtrue"; then
if test "x$enable_static" == "xyes"; then
AC_MSG_ERROR("Cannot have plugin support with static build. Configure with '--disable-static'")
fi
AC_DEFINE(WITH_PLUGIN_SUPPORT, [1], [Define if you want to build with plugin support])
fi
if test "x$have_openssl" == "xyes"; then
AC_DEFINE(HAVE_OPENSSL, [1], [Define if you have openssl])
fi
AM_CONDITIONAL([HAVE_OPENSSL], [test "x$have_openssl" = "xyes"])
if test "x$have_img1tool" == "xyes"; then
if test "x$with_img1tool" = "xyes"; then
AC_DEFINE(HAVE_IMG1TOOL, [1], [Define if you have img1tool])
AC_SUBST([libimg1tool_requires], [$LIBIMG1TOOL_REQUIRES_STR])
AC_SUBST(libimg1tool_CFLAGS)
AC_SUBST(libimg1tool_LIBS)
else
echo "*** Note: img1tool has been disabled ***"
fi
else
if test "x$with_img1tool" == "xyes"; then
AC_MSG_ERROR([requested building with img1tool, but library could not be found])
fi
fi
AM_CONDITIONAL([HAVE_IMG1TOOL], [test "x$have_img1tool" = "xyes"])
# Check for functions
AC_CHECK_FUNCS([memmem asprintf strtoul_l])
AC_CONFIG_FILES([Makefile
include/Makefile
libra1nsn0w.pc
tools/iBootPatcher/Makefile
tools/kernelPatcher/Makefile
tools/Makefile
ra1nsn0w/Makefile])
AC_OUTPUT
echo "
Configuration for $PACKAGE-$VERSION:
-------------------------------------------
install prefix ..........: $prefix
have openssl ............: $have_openssl
have img1tool ...........: $have_img1tool
have plugin support .....: $plugin_support
with iBootPatcher .......: $with_ibootpatcher
with kernelPatcher ......: $with_kernelpatcher"
echo " compiler ................: ${CC}
Now type 'make' to build $PACKAGE-$VERSION,
and then 'make install' for installation.
"