forked from libimobiledevice/idevicerestore
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
178 lines (152 loc) · 5.99 KB
/
configure.ac
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
175
176
177
178
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.68])
AC_INIT([idevicerestore], [m4_esyscmd(./git-version-gen $RELEASE_VERSION)], [https://github.com/libimobiledevice/idevicerestore/issues], [], [https://libimobiledevice.org])
AM_INIT_AUTOMAKE([dist-bzip2 no-dist-gzip])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES])
AC_CONFIG_SRCDIR([src/])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
# Check if we have a version defined
if test -z $PACKAGE_VERSION; then
AC_MSG_ERROR([PACKAGE_VERSION is not defined. Make sure to configure a source tree checked out from git or that .tarball-version is present.])
fi
# Minimum package versions
LIBIRECOVERY_VERSION=1.2.1
LIBIMOBILEDEVICE_VERSION=1.3.0
LIBUSBMUXD_VERSION=2.0.2
LIBPLIST_VERSION=2.6.0
LIMD_GLUE_VERSION=1.3.0
LIBTATSU_VERSION=1.0.4
LIBZIP_VERSION=1.0
LIBCURL_VERSION=7.0
AC_SUBST(LIBIRECOVERY_VERSION)
AC_SUBST(LIBIMOBILEDEVICE_VERSION)
AC_SUBST(LIBUSBMUXD_VERSION)
AC_SUBST(LIBPLIST_VERSION)
AC_SUBST(LIMD_GLUE_VERSION)
AC_SUBST(LIBTATSU_VERSION)
AC_SUBST(LIBZIP_VERSION)
AC_SUBST(LIBCURL_VERSION)
# Checks for programs.
AC_PROG_CC
AM_PROG_CC_C_O
LT_INIT
# Checks for libraries.
PKG_CHECK_MODULES(libirecovery, libirecovery-1.0 >= $LIBIRECOVERY_VERSION)
PKG_CHECK_MODULES(libimobiledevice, libimobiledevice-1.0 >= $LIBIMOBILEDEVICE_VERSION)
PKG_CHECK_MODULES(libusbmuxd, libusbmuxd-2.0 >= $LIBUSBMUXD_VERSION)
PKG_CHECK_MODULES(libplist, libplist-2.0 >= $LIBPLIST_VERSION)
PKG_CHECK_MODULES(limd_glue, libimobiledevice-glue-1.0 >= $LIMD_GLUE_VERSION)
PKG_CHECK_MODULES(libtatsu, libtatsu-1.0 >= $LIBTATSU_VERSION)
PKG_CHECK_MODULES(libzip, libzip >= $LIBZIP_VERSION)
PKG_CHECK_MODULES(libcurl, libcurl >= $LIBCURL_VERSION)
PKG_CHECK_MODULES(zlib, zlib)
AC_CHECK_FUNCS([strsep strcspn mkstemp realpath])
if test x$ac_cv_func_strsep != xyes; then
if test x$ac_cv_func_strcspn != xyes; then
AC_MSG_ERROR([You need either strsep or strcspn to build $PACKAGE])
fi
fi
AC_CHECK_HEADER(endian.h, [ac_cv_have_endian_h="yes"], [ac_cv_have_endian_h="no"])
if test "x$ac_cv_have_endian_h" = "xno"; then
AC_DEFINE(__LITTLE_ENDIAN,1234,[little endian])
AC_DEFINE(__BIG_ENDIAN,4321,[big endian])
AC_C_BIGENDIAN([ac_cv_c_bigendian="yes"], [ac_cv_c_bigendian="no"], [], [])
if test "x$ac_cv_c_bigendian" = "xyes"; then
AC_DEFINE(__BYTE_ORDER,4321,[big endian byte order])
else
AC_DEFINE(__BYTE_ORDER,1234,[little endian byte order])
fi
fi
GLOBAL_CFLAGS="-Wno-multichar -O2"
AC_LDADD=""
AC_LDFLAGS=""
CFLAGS="$CFLAGS $libplist_CFLAGS"
AC_CHECK_DECL([plist_from_json], [], [AC_MSG_ERROR([libplist with JSON format support required to build $PACKAGE_NAME])], [[#include <plist/plist.h>]])
# Check for operating system
AC_MSG_CHECKING([for platform-specific build settings])
case ${host_os} in
*mingw32*|*cygwin*)
AC_MSG_RESULT([${host_os}])
win32=true
GLOBAL_CFLAGS+=" -DWIN32 -D__LITTLE_ENDIAN__=1"
AC_LDFLAGS+=" -static-libgcc"
;;
darwin*)
AC_MSG_RESULT([${host_os}])
AC_DEFINE([_DARWIN_BETTER_REALPATH], [1], [Use better method for realpath])
;;
*)
AC_MSG_RESULT([${host_os}])
;;
esac
AM_CONDITIONAL(WIN32, test x$win32 = xtrue)
if test x$win32 != xtrue; then
if test "x$ac_cv_func_mkstemp" != xyes; then
AC_CHECK_LIB(pthread, [pthread_self], [], [AC_MSG_ERROR([pthread is required to build $PACKAGE])])
fi
fi
CACHED_CFLAGS="$CFLAGS"
CFLAGS+=" $libimobiledevice_CFLAGS"
# check if libimobiledevice has timeout errors
AC_CACHE_CHECK(for IDEVICE_E_TIMEOUT in enum idevice_error_t, ac_cv_idevice_error_has_timeout,
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <libimobiledevice/libimobiledevice.h>
]], [[
return IDEVICE_E_TIMEOUT;
]])],[ac_cv_idevice_error_has_timeout=yes],[ac_cv_idevice_error_has_timeout=no]))
if test "$ac_cv_idevice_error_has_timeout" = "yes"; then
AC_DEFINE(HAVE_IDEVICE_E_TIMEOUT, 1, [Define if enum idevice_error_t defines IDEVICE_E_TIMEOUT])
fi
AC_CACHE_CHECK(for RESTORE_E_RECEIVE_TIMEOUT in enum restored_error_t, ac_cv_restored_error_has_timeout,
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <libimobiledevice/restore.h>
]], [[
return RESTORE_E_RECEIVE_TIMEOUT;
]])],[ac_cv_restored_error_has_timeout=yes],[ac_cv_restored_error_has_timeout=no]))
if test "$ac_cv_restored_error_has_timeout" = "yes"; then
AC_DEFINE(HAVE_RESTORE_E_RECEIVE_TIMEOUT, 1, [Define if enum restored_error_t defines RESTORE_E_RECEIVE_TIMEOUT])
fi
# check if libimobiledevice has enum idevice_connection_type
AC_CACHE_CHECK(for enum idevice_connection_type, ac_cv_enum_idevice_connection_type,
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <libimobiledevice/libimobiledevice.h>
]], [[
enum idevice_connection_type conn_type = CONNECTION_USBMUXD;
]])],[ac_cv_enum_idevice_connection_type=yes],[ac_cv_enum_idevice_connection_type=no]))
if test "$ac_cv_enum_idevice_connection_type" = "yes"; then
AC_DEFINE(HAVE_ENUM_IDEVICE_CONNECTION_TYPE, 1, [Define if enum idevice_connection_type is available])
fi
# check if libimobiledevice has reverse proxy support
AC_CACHE_CHECK(for reverse proxy support in libimobiledevice, ac_cv_reverse_proxy,
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <libimobiledevice/reverse_proxy.h>
#include <stdlib.h>
]], [[
reverse_proxy_client_t rp = NULL;
reverse_proxy_client_create_with_port(NULL, &rp, REVERSE_PROXY_DEFAULT_PORT);
]])],[ac_cv_reverse_proxy=yes],[ac_cv_reverse_proxy=no]))
if test "$ac_cv_reverse_proxy" = "yes"; then
AC_DEFINE(HAVE_REVERSE_PROXY, 1, [Define if libimobiledevice has a reverse proxy implementation])
fi
CFLAGS="$CACHED_CFLAGS"
AC_SUBST(GLOBAL_CFLAGS)
AC_SUBST(AC_LDFLAGS)
AC_SUBST(AC_LDADD)
# check for large file support
AC_SYS_LARGEFILE
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
AC_CONFIG_FILES([
Makefile
src/Makefile
docs/Makefile
])
AC_OUTPUT
echo "
Configuration for $PACKAGE $VERSION:
-------------------------------------------
Install prefix: .........: $prefix
Now type 'make' to build $PACKAGE $VERSION,
and then 'make install' for installation.
"