forked from tihmstar/img4tool
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfigure.ac
More file actions
151 lines (119 loc) · 4.24 KB
/
configure.ac
File metadata and controls
151 lines (119 loc) · 4.24 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
AC_PREREQ([2.69])
AC_INIT([img4tool], 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([subdir-objects])
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
AC_PROG_CC
crypto_backend="none"
# Check for operating system
AC_MSG_CHECKING([whether we need platform-specific build settings])
case $host_os in
darwin* )
AC_DEFINE(HAVE_COMMCRYPTO, 1, [Define if you have CommonCrypto (macOS)])
crypto_backend="CommCrypto"
;;
esac
CXXFLAGS+=" -std=c++11"
CFLAGS+=" -std=c11"
# Versioning.
# Checks for libraries.
OPENSSL_REQUIRES_STR="openssl >= 0.9.8"
LIBPLIST_REQUIRES_STR="libplist-2.0 >= 2.2.0"
LIBGENERAL_REQUIRES_STR="libgeneral >= 39"
PKG_CHECK_MODULES(openssl, $OPENSSL_REQUIRES_STR, have_openssl=yes, have_openssl=no)
PKG_CHECK_MODULES(libplist, $LIBPLIST_REQUIRES_STR, have_plist=yes, have_plist=no)
PKG_CHECK_MODULES(libgeneral, $LIBGENERAL_REQUIRES_STR)
AC_SUBST([libgeneral_requires], [$LIBGENERAL_REQUIRES_STR])
AC_ARG_WITH([plist],
[AS_HELP_STRING([--without-plist],
[do not build with libplist @<:@default=yes@:>@])],
[with_plist=no],
[with_plist=yes])
AC_ARG_WITH([openssl],
[AS_HELP_STRING([--without-openssl],
[do not build with openssl @<:@default=yes@:>@])],
[with_openssl=no],
[with_openssl=yes])
if test "x$with_plist" == "xyes"; then
if test "x$have_plist" = "xyes"; then
AC_DEFINE(HAVE_PLIST, 1, [Define if you have libplist])
AC_SUBST([HEADER_HAVE_PLIST], [1])
AC_SUBST([libplist_requires], [$LIBPLIST_REQUIRES_STR])
AC_SUBST(libplist_CFLAGS)
AC_SUBST(libplist_LIBS)
else
echo "*** Note: libplist has been disabled ***"
AC_SUBST([HEADER_HAVE_PLIST], [0])
fi
else
if test "x$with_plist" == "xyes"; then
AC_MSG_ERROR([requested building with libplist, but library could not be found])
fi
fi
if test "x$with_openssl" == "xyes"; then
if test "x$have_openssl" = "xyes"; then
AC_DEFINE(HAVE_OPENSSL, 1, [Define if you have openssl])
AC_SUBST([HEADER_HAVE_OPENSSL], [1])
AC_SUBST([openssl_requires], [$OPENSSL_REQUIRES_STR])
AC_SUBST(openssl_CFLAGS)
AC_SUBST(openssl_LIBS)
crypto_backend="openssl"
else
echo "*** Note: openssl has been disabled ***"
AC_SUBST([HEADER_HAVE_OPENSSL], [0])
fi
else
if test "x$with_openssl" == "xyes"; then
AC_MSG_ERROR([requested building with openssl, but library could not be found])
fi
fi
if test "x$crypto_backend" != "xnone"; then
AC_DEFINE(HAVE_CRYPTO, 1, [Define if you have either openssl or CommCrypto])
AC_SUBST([HEADER_HAVE_CRYPTO], [1])
else
AC_SUBST([HEADER_HAVE_CRYPTO], [0])
fi
# Checks for header files.
AC_CHECK_HEADERS([arpa/inet.h stdint.h stdlib.h string.h unistd.h])
# Check for libraries
AC_CHECK_LIB([compression], [compression_decode_buffer], [], [
AC_CHECK_LIB([lzfse], [lzfse_decode_buffer], [], [
echo "Error! Either libcompression or liblzfse is needed!"
exit -1
])
])
# Checks for typedefs, structures, and compiler characteristics.
AC_CHECK_HEADER_STDBOOL
AC_TYPE_SIZE_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_TYPE_UINT8_T
AC_CHECK_FUNCS([memmem])
AC_CONFIG_FILES([Makefile
include/Makefile
libimg4tool.pc
include/img4tool/img4tool.hpp
img4tool/Makefile])
AC_OUTPUT
echo "
Configuration for $PACKAGE-$VERSION:
-------------------------------------------
install prefix ..........: $prefix
have plist ..............: $have_plist
crypto backend ..........: $crypto_backend"
echo " compiler ................: ${CC}
Now type 'make' to build $PACKAGE-$VERSION,
and then 'make install' for installation.
"
if test "x$crypto_backend" != "xopenssl"; then
echo "WARNING: crypto_backend is not openssl, some features will be missing"
fi