summaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac367
1 files changed, 278 insertions, 89 deletions
diff --git a/configure.ac b/configure.ac
index a982b7b..c67e896 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,9 +1,9 @@
1# -*- Autoconf -*- 1# -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script. 2# Process this file with autoconf to produce a configure script.
3 3
4AC_PREREQ(2.61) 4AC_PREREQ([2.68])
5AC_INIT(libimobiledevice, 1.1.0, nospam@nowhere.com) 5AC_INIT([libimobiledevice], [m4_esyscmd(./git-version-gen $RELEASE_VERSION)], [https://github.com/libimobiledevice/libimobiledevice/issues], [], [https://libimobiledevice.org])
6AM_INIT_AUTOMAKE([dist-bzip2 no-dist-gzip]) 6AM_INIT_AUTOMAKE([dist-bzip2 no-dist-gzip check-news])
7m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES]) 7m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES])
8AC_CONFIG_SRCDIR([src/]) 8AC_CONFIG_SRCDIR([src/])
9AC_CONFIG_HEADERS([config.h]) 9AC_CONFIG_HEADERS([config.h])
@@ -15,29 +15,51 @@ dnl libtool versioning
15# changes to the signature and the semantic) 15# changes to the signature and the semantic)
16# ? :+1 : ? == just internal changes 16# ? :+1 : ? == just internal changes
17# CURRENT : REVISION : AGE 17# CURRENT : REVISION : AGE
18LIBIMOBILEDEVICE_SO_VERSION=2:0:0 18LIBIMOBILEDEVICE_SO_VERSION=6:0:0
19 19
20AC_SUBST(LIBIMOBILEDEVICE_SO_VERSION) 20AC_SUBST(LIBIMOBILEDEVICE_SO_VERSION)
21 21
22# Check if we have a version defined
23if test -z $PACKAGE_VERSION; then
24 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.])
25fi
26
27dnl Minimum package versions
28LIBUSBMUXD_VERSION=2.0.2
29LIBPLIST_VERSION=2.3.0
30LIMD_GLUE_VERSION=1.3.0
31LIBTATSU_VERSION=1.0.3
32
33AC_SUBST(LIBUSBMUXD_VERSION)
34AC_SUBST(LIBPLIST_VERSION)
35AC_SUBST(LIMD_GLUE_VERSION)
36
22# Checks for programs. 37# Checks for programs.
23AC_PROG_CC 38AC_PROG_CC
24AC_PROG_CXX 39AC_PROG_CXX
25AM_PROG_CC_C_O 40AM_PROG_CC_C_O
26AC_PROG_LIBTOOL 41LT_INIT
27 42
28# Checks for libraries. 43# Checks for libraries.
29PKG_CHECK_MODULES(libusbmuxd, libusbmuxd >= 0.1.4) 44PKG_CHECK_MODULES(libusbmuxd, libusbmuxd-2.0 >= $LIBUSBMUXD_VERSION)
30PKG_CHECK_MODULES(libglib2, glib-2.0 >= 2.14.1) 45PKG_CHECK_MODULES(libplist, libplist-2.0 >= $LIBPLIST_VERSION)
31PKG_CHECK_MODULES(libgthread2, gthread-2.0 >= 2.14.1) 46PKG_CHECK_MODULES(limd_glue, libimobiledevice-glue-1.0 >= $LIMD_GLUE_VERSION)
32PKG_CHECK_MODULES(libgnutls, gnutls >= 1.6.3 ) 47PKG_CHECK_MODULES(libtatsu, libtatsu-1.0 >= $LIBTATSU_VERSION)
33PKG_CHECK_MODULES(libtasn1, libtasn1 >= 1.1) 48AC_ARG_WITH([readline],
34PKG_CHECK_MODULES(libplist, libplist >= 0.15) 49 [AS_HELP_STRING([--without-readline],
35PKG_CHECK_MODULES(libplistmm, libplist++ >= 0.15) 50 [build without support for libreadline (default is yes)])],
36AC_CHECK_LIB(gcrypt, gcry_control, [AC_SUBST(libgcrypt_LIBS,[-lgcrypt])], [AC_MSG_ERROR([libgcrypt is required to build libimobiledevice])]) 51 [check_libreadline=false],
52 [check_libreadline=true])
53if test "$check_libreadline" = "true"; then
54 PKG_CHECK_MODULES(readline, readline >= 1.0, have_readline=yes, have_readline=no)
55 if test "x$have_readline" = "xyes"; then
56 AC_DEFINE(HAVE_READLINE, 1, [Define if readline library is available])
57 fi
58fi
59AM_CONDITIONAL([HAVE_READLINE],[test "x$have_readline" = "xyes"])
37 60
38# Checks for header files. 61# Checks for header files.
39AC_HEADER_STDC 62AC_CHECK_HEADERS([stdint.h stdlib.h string.h sys/time.h])
40AC_CHECK_HEADERS([stdint.h stdlib.h string.h gcrypt.h])
41 63
42# Checks for typedefs, structures, and compiler characteristics. 64# Checks for typedefs, structures, and compiler characteristics.
43AC_C_CONST 65AC_C_CONST
@@ -48,111 +70,278 @@ AC_TYPE_UINT32_T
48AC_TYPE_UINT8_T 70AC_TYPE_UINT8_T
49 71
50# Checks for library functions. 72# Checks for library functions.
51AC_FUNC_MALLOC 73AC_CHECK_FUNCS([asprintf strcasecmp strdup strerror strndup stpcpy vasprintf getifaddrs])
52AC_FUNC_REALLOC
53AC_CHECK_FUNCS([strcasecmp strdup strerror strndup])
54
55AC_ARG_WITH([swig],
56 [AS_HELP_STRING([--without-swig],
57 [build Python bindings using swig (default is yes)])],
58 [build_swig=false],
59 [build_swig=true])
60if test "$build_swig" = "true"; then
61 AM_PATH_PYTHON(2.3)
62 AC_PROG_SWIG(1.3.21)
63 AX_SWIG_ENABLE_CXX
64 SWIG_PYTHON
65else
66 SWIG=false
67fi
68 74
69if [test "x$SWIG" != "xfalse"]; then 75AC_CHECK_HEADER(endian.h, [ac_cv_have_endian_h="yes"], [ac_cv_have_endian_h="no"])
70 python_bindings=yes 76if test "x$ac_cv_have_endian_h" = "xno"; then
71else 77 AC_DEFINE(__LITTLE_ENDIAN,1234,[little endian])
72 python_bindings=no 78 AC_DEFINE(__BIG_ENDIAN,4321,[big endian])
79 AC_C_BIGENDIAN([ac_cv_c_bigendian="yes"], [ac_cv_c_bigendian="no"], [], [])
80 if test "x$ac_cv_c_bigendian" = "xyes"; then
81 AC_DEFINE(__BYTE_ORDER,4321,[big endian byte order])
82 else
83 AC_DEFINE(__BYTE_ORDER,1234,[little endian byte order])
84 fi
73fi 85fi
74 86
75AM_CONDITIONAL([HAVE_SWIG],[test "x$SWIG" != "xfalse"]) 87AC_CHECK_DECL([plist_from_json], [AC_DEFINE([HAVE_PLIST_JSON], [1], [Define if libplist has JSON support])], [], [[#include <plist/plist.h>]])
76 88
77AC_SUBST([DEV_SUB]) 89# Check for operating system
90AC_MSG_CHECKING([for platform-specific build settings])
91case ${host_os} in
92 *mingw32*|*cygwin*)
93 AC_MSG_RESULT([${host_os}])
94 win32=true
95 AC_DEFINE(WINVER, 0x0501, [minimum Windows version])
96 ;;
97 darwin*)
98 AC_MSG_RESULT([${host_os}])
99 darwin=true
100 ;;
101 *)
102 AC_MSG_RESULT([${host_os}])
103 AX_PTHREAD([], [AC_MSG_ERROR([pthread is required to build $PACKAGE_NAME])])
104 AC_CHECK_LIB(pthread, [pthread_once], [], [AC_MSG_ERROR([pthread with pthread_once required to build $PACKAGE_NAME])])
105 ;;
106esac
107AM_CONDITIONAL(WIN32, test x$win32 = xtrue)
108AM_CONDITIONAL(DARWIN, test x$darwin = xtrue)
78 109
110# Check if the C compiler supports __attribute__((constructor))
111AC_CACHE_CHECK([wether the C compiler supports constructor/destructor attributes],
112 ac_cv_attribute_constructor, [
113 ac_cv_attribute_constructor=no
114 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
115 [[
116 static void __attribute__((constructor)) test_constructor(void) {
117 }
118 static void __attribute__((destructor)) test_destructor(void) {
119 }
120 ]], [])],
121 [ac_cv_attribute_constructor=yes]
122 )]
123)
124if test "$ac_cv_attribute_constructor" = "yes"; then
125 AC_DEFINE(HAVE_ATTRIBUTE_CONSTRUCTOR, 1, [Define if the C compiler supports constructor/destructor attributes])
126fi
127
128AC_CHECK_MEMBER(struct dirent.d_type, AC_DEFINE(HAVE_DIRENT_D_TYPE, 1, [define if struct dirent has member d_type]),, [#include <dirent.h>])
79 129
80AC_ARG_ENABLE([dev-tools], 130# Cython Python Bindings
81 [AS_HELP_STRING([--enable-dev-tools], 131AC_ARG_WITH([cython],
82 [build development helper tools (default is no)])], 132 [AS_HELP_STRING([--without-cython],
83 [build_dev_tools=true], 133 [build Python bindings using Cython (default is yes)])],
84 [build_dev_tools=false]) 134 [build_cython=false],
85if test "$build_dev_tools" = true; then 135 [build_cython=true])
86 DEV_SUB=dev 136if test "$build_cython" = "true"; then
87 AC_CHECK_HEADERS([readline/readline.h], 137 AC_PROG_CYTHON([3.0.0])
88 [], 138 if [test "x$CYTHON" != "xfalse"]; then
89 [AC_MSG_ERROR([Please install readline development headers])] 139 AM_PATH_PYTHON([3.0], [
90 ) 140 CYTHON_PYTHON
91 building_dev_tools=yes 141 AS_COMPILER_FLAG([-Wno-cast-function-type -Werror], [
142 CYTHON_CFLAGS+=" -Wno-cast-function-type"
143 AC_SUBST([CYTHON_CFLAGS])
144 ], [])
145 ])
146 else
147 AC_MSG_WARN([Use the "--without-cython" option to avoid this warning.])
148 fi
149else
150 CYTHON=false
151fi
152if [test "x$CYTHON" != "xfalse"]; then
153 PKG_PROG_PKG_CONFIG
154 AC_MSG_CHECKING([for libplist Cython bindings])
155 CYTHON_PLIST_INCLUDE_DIR=$($PKG_CONFIG --variable=includedir libplist-2.0)/plist/cython
156 if [test ! -d "$CYTHON_PLIST_INCLUDE_DIR"]; then
157 CYTHON=false
158 CYTHON_SUB=
159 cython_python_bindings=no
160 AC_MSG_RESULT([no])
161 AC_MSG_WARN([Unable to find libplist Cython bindings. You should install your distribution specific libplist Cython bindings package.])
162 else
163 AC_SUBST([CYTHON_PLIST_INCLUDE_DIR])
164 AC_MSG_RESULT([$CYTHON_PLIST_INCLUDE_DIR])
165 CYTHON_SUB=cython
166 cython_python_bindings=yes
167 fi
92else 168else
93 DEV_SUB= 169 CYTHON_SUB=
94 building_dev_tools=no 170 cython_python_bindings=no
95fi 171fi
172AM_CONDITIONAL([HAVE_CYTHON],[test "x$CYTHON_SUB" = "xcython"])
173AC_SUBST([CYTHON_SUB])
96 174
97AM_CONDITIONAL([ENABLE_DEVTOOLS],[test "x$DEV_SUB" = "xdev"]) 175default_openssl=yes
98 176
99AC_SUBST([DEV_SUB]) 177AC_ARG_WITH([mbedtls],
178 [AS_HELP_STRING([--without-mbedtls],
179 [Do not look for mbedtls])],
180 [use_mbedtls=$withval],
181 [use_mbedtls=no])
182if test "x$use_mbedtls" = "xyes"; then
183 default_openssl=no
184fi
185AC_ARG_WITH([gnutls],
186 [AS_HELP_STRING([--without-gnutls],
187 [Do not look for GnuTLS])],
188 [use_gnutls=$withval],
189 [use_gnutls=no])
190if test "x$use_gnutls" = "xyes"; then
191 default_openssl=no
192fi
193AC_ARG_WITH([openssl],
194 [AS_HELP_STRING([--without-openssl],
195 [Do not look for OpenSSL])],
196 [use_openssl=$withval],
197 [use_openssl=$default_openssl])
100 198
101AC_ARG_ENABLE([debug-code], 199if test "x$use_mbedtls" = "xyes"; then
102 [AS_HELP_STRING([--disable-debug-code], 200 CACHED_CFLAGS="$CFLAGS"
103 [disable debug message reporting in library (default is yes)])], 201 conf_mbedtls_CFLAGS=""
202 if test -n "$mbedtls_INCLUDES"; then
203 CFLAGS=" -I$mbedtls_INCLUDES"
204 conf_mbedtls_CFLAGS="-I$mbedtls_INCLUDES"
205 fi
206 conf_mbedtls_LIBS=""
207 if test -n "$mbedtls_LIBDIR"; then
208 conf_mbedtls_LIBS+=" -L$mbedtls_LIBDIR"
209 fi
210 if test -n "$mbedtls_LIBS"; then
211 conf_mbedtls_LIBS+=" $mbedtls_LIBS"
212 else
213 conf_mbedtls_LIBS+=" -lmbedtls -lmbedx509 -lmbedcrypto"
214 fi
215 AC_CHECK_HEADER(mbedtls/ssl.h, [break], [AC_MSG_ERROR([MbedTLS support explicitly requested, but includes could not be found. Try setting mbedtls_INCLUDES=/path/to/mbedtls/include])])
216 CFLAGS="$CACHED_CFLAGS"
217 AC_DEFINE(HAVE_MBEDTLS, 1, [Define if you have MbedTLS support])
218 ssl_lib_CFLAGS="$conf_mbedtls_CFLAGS"
219 ssl_lib_LIBS="$conf_mbedtls_LIBS"
220 AC_SUBST(ssl_lib_CFLAGS)
221 AC_SUBST(ssl_lib_LIBS)
222 ssl_provider="MbedTLS";
223 ssl_requires=""
224 AC_SUBST(ssl_requires)
225else
226 if test "x$use_openssl" = "xyes"; then
227 pkg_req_openssl="openssl >= 0.9.8"
228 PKG_CHECK_MODULES(openssl, $pkg_req_openssl, have_openssl=yes, have_openssl=no)
229 if test "x$have_openssl" != "xyes"; then
230 AC_MSG_ERROR([OpenSSL support explicitly requested but OpenSSL could not be found])
231 else
232 AC_DEFINE(HAVE_OPENSSL, 1, [Define if you have OpenSSL support])
233 ssl_lib_CFLAGS="$openssl_CFLAGS"
234 ssl_lib_LIBS="$openssl_LIBS"
235 AC_SUBST(ssl_lib_CFLAGS)
236 AC_SUBST(ssl_lib_LIBS)
237 ssl_provider="OpenSSL";
238 ssl_requires="$pkg_req_openssl"
239 # test if we have LibreSSL
240 CACHED_CFLAGS="$CFLAGS"
241 CFLAGS="$openssl_CFLAGS"
242 ac_cv_is_libressl=no
243 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
244 [[
245 #include <openssl/opensslv.h>
246 ]], [
247 #ifndef LIBRESSL_VERSION_NUMBER
248 #error No LibreSSL
249 #endif
250 ])],
251 [
252 ac_cv_is_libressl=yes
253 ],
254 )
255 CFLAGS="$CACHED_CFLAGS"
256 if test "x$ac_cv_is_libressl" = "xyes"; then
257 ssl_provider="LibreSSL"
258 case ${host_os} in
259 darwin*)
260 case ${openssl_LIBS} in
261 *.tbd*)
262 # using system LibreSSL on Darwin
263 ssl_requires=""
264 ;;
265 esac
266 ;;
267 esac
268 fi
269 AC_SUBST(ssl_requires)
270 fi
271 else
272 if test "x$use_gnutls" = "xyes"; then
273 pkg_req_gnutls="gnutls >= 2.2.0"
274 pkg_req_libtasn1="libtasn1 >= 1.1"
275 PKG_CHECK_MODULES(libgnutls, $pkg_req_gnutls)
276 AC_CHECK_HEADERS([gcrypt.h])
277 AC_CHECK_LIB(gcrypt, gcry_control, [AC_SUBST(libgcrypt_LIBS,[-lgcrypt])], [AC_MSG_ERROR([libgcrypt is required to build libimobiledevice with GnuTLS])])
278 PKG_CHECK_MODULES(libtasn1, $pkg_req_libtasn1)
279 AC_DEFINE(HAVE_GCRYPT, 1, [Define if you have libgcrypt support])
280 AC_DEFINE(HAVE_GNUTLS, 1, [Define if you have GnuTLS support])
281 ssl_lib_CFLAGS="$libgnutls_CFLAGS $libtasn1_CFLAGS $libgcrypt_CFLAGS"
282 ssl_lib_LIBS="$libgnutls_LIBS $libtasn1_LIBS $libgcrypt_LIBS"
283 AC_SUBST(ssl_lib_CFLAGS)
284 AC_SUBST(ssl_lib_LIBS)
285 ssl_provider="GnuTLS"
286 ssl_requires="$pkg_req_gnutls $pkg_req_libtasn1"
287 AC_SUBST(ssl_requires)
288 else
289 AC_MSG_ERROR([No SSL library configured. $PACKAGE cannot be built without a supported SSL library.])
290 fi
291 fi
292fi
293AM_CONDITIONAL(HAVE_MBEDTLS, test "x$use_mbedtls" = "xyes")
294AM_CONDITIONAL(HAVE_OPENSSL, test "x$use_openssl" = "xyes")
295AM_CONDITIONAL(HAVE_GCRYPT, test "x$use_gnutls" = "xyes")
296
297AC_ARG_ENABLE([wireless-pairing],
298 [AS_HELP_STRING([--disable-wireless-pairing],
299 [Do not build with wirless pairing support (default is yes)])])
300if test "$enable_wireless_pairing" != "no"; then
301 AC_DEFINE(HAVE_WIRELESS_PAIRING,1,[Define if building with wireless pairing support])
302fi
303AM_CONDITIONAL(HAVE_WIRELESS_PAIRING, test "$enable_wireless_pairing" != "no")
304
305AC_ARG_ENABLE([debug],
306 [AS_HELP_STRING([--enable-debug],
307 [build debug message output code (default is no)])],
104 [no_debug_code=false], 308 [no_debug_code=false],
105 [no_debug_code=true]) 309 [no_debug_code=true])
106if test "$no_debug_code" = true; then 310if test "$no_debug_code" = true; then
107 building_debug_code=no 311 building_debug_code=no
108 AC_DEFINE(STRIP_DEBUG_CODE,1,[Strip debug reporting code]) 312 AC_DEFINE(STRIP_DEBUG_CODE,1,[Define if debug message output code should not be built.])
109else 313else
110 building_debug_code=yes 314 building_debug_code=yes
111fi 315fi
112 316
113AS_COMPILER_FLAGS(GLOBAL_CFLAGS, "-Wall -Wextra -Wmissing-declarations -Wredundant-decls -Wshadow -Wpointer-arith -Wwrite-strings -Wswitch-default -Wno-unused-parameter") 317AS_COMPILER_FLAGS(GLOBAL_CFLAGS, "-Wall -Wextra -Wmissing-declarations -Wredundant-decls -Wshadow -Wpointer-arith -Wwrite-strings -Wswitch-default -Wno-unused-parameter -fsigned-char -fvisibility=hidden")
318
319if test "x$enable_static" = "xyes" -a "x$enable_shared" = "xno"; then
320 GLOBAL_CFLAGS+=" -DLIBIMOBILEDEVICE_STATIC"
321fi
322
114AC_SUBST(GLOBAL_CFLAGS) 323AC_SUBST(GLOBAL_CFLAGS)
115 324
116# check for large file support 325# check for large file support
117AC_SYS_LARGEFILE 326AC_SYS_LARGEFILE
118LFS_CFLAGS=''
119if test "$enable_largefile" != no; then
120 if test "$ac_cv_sys_file_offset_bits" != 'no'; then
121 LFS_CFLAGS="$LFS_CFLAGS -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
122 else
123 AC_MSG_CHECKING(for native large file support)
124 AC_RUN_IFELSE([#include <unistd.h>
125 int main (int argc, char **argv)
126 {
127 exit(!(sizeof(off_t) == 8));
128 }],
129 [ac_cv_sys_file_offset_bits=64; AC_DEFINE(_FILE_OFFSET_BITS,64)
130 AC_MSG_RESULT(yes)],
131 [AC_MSG_RESULT(no)])
132 fi
133 if test "$ac_cv_sys_large_files" != 'no'; then
134 LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES=1"
135 fi
136 AC_FUNC_FSEEKO
137 if test "$ac_cv_sys_largefile_source" != 'no'; then
138 LFS_CFLAGS="$LFS_CFLAGS -D_LARGEFILE_SOURCE=1"
139 fi
140fi
141AC_SUBST(LFS_CFLAGS)
142 327
143m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) 328m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
144 329
145AC_OUTPUT([ 330AC_CONFIG_FILES([
146Makefile 331Makefile
3323rd_party/Makefile
3333rd_party/ed25519/Makefile
3343rd_party/libsrp6a-sha512/Makefile
335common/Makefile
147src/Makefile 336src/Makefile
337src/libimobiledevice-1.0.pc
148include/Makefile 338include/Makefile
149dev/Makefile
150tools/Makefile 339tools/Makefile
151swig/Makefile 340cython/Makefile
152docs/Makefile 341docs/Makefile
153libimobiledevice-1.0.pc
154doxygen.cfg 342doxygen.cfg
155]) 343])
344AC_OUTPUT
156 345
157echo " 346echo "
158Configuration for $PACKAGE $VERSION: 347Configuration for $PACKAGE $VERSION:
@@ -160,8 +349,8 @@ Configuration for $PACKAGE $VERSION:
160 349
161 Install prefix: .........: $prefix 350 Install prefix: .........: $prefix
162 Debug code ..............: $building_debug_code 351 Debug code ..............: $building_debug_code
163 Dev tools ...............: $building_dev_tools 352 Python bindings .........: $cython_python_bindings
164 Python bindings .........: $python_bindings 353 SSL support backend .....: $ssl_provider
165 354
166 Now type 'make' to build $PACKAGE $VERSION, 355 Now type 'make' to build $PACKAGE $VERSION,
167 and then 'make install' for installation. 356 and then 'make install' for installation.