-
Notifications
You must be signed in to change notification settings - Fork 118
/
configure.ac
248 lines (194 loc) · 6.71 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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.67])
AC_INIT([cardpeek],[0.8.5],[[email protected]])
AM_INIT_AUTOMAKE
#
# Include marcros in m4/
# AC_CONFIG_MACRO_DIR([m4]) does not work on all platforms.
# so we do this 'by hand'
#
m4_include([m4/iconv.m4])
m4_include([m4/lib-ld.m4])
m4_include([m4/lib-link.m4])
m4_include([m4/lib-prefix.m4])
m4_include([m4/ax_lib_readline.m4])
m4_include([m4/ax_check_openssl.m4])
AC_CONFIG_SRCDIR([main.c])
AC_CONFIG_HEADERS([config.h])
# silent build by default
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
# Checks for programs.
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_MAKE_SET
# AC_PROG_OBJ is only needed on a Mac when --enable-osx-bundle
# Cardpeek does not need objective C to compile, but this directive is needed
# to silence autoconf errors.
AC_PROG_OBJC
#
# Our own checks
#
PKG_CHECK_MODULES([GLIB],[glib-2.0 >= 2.32.0])
PKG_CHECK_MODULES([GTK],[gtk+-3.0 >= 3.4])
AC_ARG_ENABLE([osx-bundle],
AS_HELP_STRING([--enable-osx-bundle], [Compiles for the purpose of creating a MacOSX application bundle.]))
AM_CONDITIONAL([OSX_BUNDLE], [test "x$enable_osx_bundle" = "xyes"])
AM_COND_IF([OSX_BUNDLE], [
AC_CONFIG_FILES([osx/Info-cardpeek.plist])
])
AC_CANONICAL_HOST
AS_CASE([$host],
[*-*-darwin*], [HOST_TYPE=darwin],
[*freebsd*], [HOST_TYPE=freebsd],
[HOST_TYPE=default]
)
if test "$HOST_TYPE" = "darwin"; then
if test ! -e "/Applications/Xcode.app/"; then
AC_MSG_ERROR([Could not find /Applications/Xcode.app/.
This program requires the PCSC framework that is distributed with XCode on OS X.
Please install XCode first.])
fi
PCSC_HEADERS=`ls -d /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/*.sdk/System/Library/Frameworks/PCSC.framework/Versions/Current/Headers/ | sort | head -1`
PCSC_CFLAGS="-Wno-deprecated-declarations -I$PCSC_HEADERS"
PCSC_LIBS="-framework PCSC"
else
PKG_CHECK_MODULES([PCSC],[libpcsclite])
AM_COND_IF([OSX_BUNDLE],[
AC_MSG_ERROR([Bundles are only available on MacOSX (--enable-osx-bunlde).])
])
fi
#
# Check for LUA 5.2
#
PKG_CHECK_MODULES([LUA],[lua-5.2],,[
PKG_CHECK_MODULES([LUA],[lua5.2],,[
PKG_CHECK_MODULES([LUA],[lua >= 5.2],,[
AC_SEARCH_LIBS([lua_close], [lua.5.2 lua-5.2 lua5.2], [HAVE_LIBLUA=yes], [HAVE_LIBLUA=no])
if test x$HAVE_LIBLUA != xyes; then
AC_MSG_ERROR([Could not find lua 5.2-dev.
This program requires the lua 5.2 development library.
Please install the lua 5.2 library first.])
fi
])
])
])
#
# Check for CURL
#
PKG_CHECK_MODULES([CURL],[libcurl],,[
AC_SEARCH_LIBS([curl_easy_init],[curl], [HAVE_LIBCURL=yes], [HAVE_LIBCURL=no])
if test x$HAVE_LIBCURL != xyes; then
AC_MSG_ERROR([Cloud not find libcurl.
This program requires the libcurl development library.
Please install the required library first.])
fi
])
#
# Check for OPENSSL
#
AX_CHECK_OPENSSL([],
if test "$HOST_TYPE" = "darwin"; then
AC_MSG_ERROR([
OpenSSL headers cannot be located. Consider using the --with-openssl option to specify an appropriate path.
Note:
OpenSSL has been removed on newer versions of Mac OS X.
You may need to install your own version of OpenSSL and then specify the root of the OpenSSL directory with the option --with-openssl=...
For example if you are using howebrew:
brew install openssl
./configure --with-openssl=/usr/local/opt/openssl
])
else
AC_MSG_ERROR([
OpenSSL headers cannot be located. Consider using the --with-openssl option to specify an appropriate path.
])
fi)
#AC_CHECK_LIB([ssl],[SSL_free],,
# AC_MSG_ERROR([Could not find openssl-dev.
# This program requires the openssl dev. library.
# Please install it first.]))
#
#AC_CHECK_LIB([crypto],[CRYPTO_free],,
# AC_MSG_ERROR([Could not find openssl-dev.
# This program requires the openssl dev. library.
# Please install it first.]))
#old_CPPFLAGS="$CPPFLAGS"
#CPPFLAGS="$OPENSSL_INCLUDES"
#AC_CHECK_HEADERS([openssl/des.h openssl/sha.h openssl/err.h openssl/ssl.h],[],[AC_MSG_ERROR([OpenSSL headers cannot be located. Consider using the --with-openssl option to specify an appropriate path.])])
#CPPFLAGS="$old_CPPFLAGS"
#
# Check for BACKTRACE lib (optional)
#
AC_CHECK_LIB([execinfo],[backtrace],,)
AC_CHECK_DECLS([backtrace], [], [], [[#include <execinfo.h>]])
#
# Check for ICONV
#
AC_ARG_VAR(ICONV_LIBS,[linker flags for ICONV (e.g. -l iconv), overriding the detected value.])
AM_ICONV
if test ! $ICONV_LIBS; then
AC_SUBST([ICONV_LIBS],[$LIBICONV])
fi
#
# Check for GLIB_COMPILE_RESOURCES
#
AC_PATH_PROG(GLIB_COMPILE_RESOURCES,[glib-compile-resources],no)
if test x$GLIB_COMPILE_RESOURCES = xno ; then
AC_MSG_ERROR([glib-compile-resources cannot be found in PATH.
It is usually included with GTK+2.0 dev. libraries.
Please install this tool first.
])
fi
AC_SUBST(GLIB_COMPILE_RESOURCES)
#
# Check for GDK_PIXBUF_PIXDATA
#
AC_PATH_PROG(GDK_PIXBUF_PIXDATA,[gdk-pixbuf-pixdata],no)
if test x$GDK_PIXBUF_PIXDATA = xno ; then
AC_MSG_ERROR([gdk-pixbuf-pixdata cannot be found in PATH.
It is usually included with GTK+2.0 dev. libraries and is needed by glib-compile-resources.
Please install this tool first.
])
fi
#
# Check for READLINE
#
AX_LIB_READLINE
if test -z "$ax_cv_lib_readline"; then
AC_MSG_ERROR([Could not find readline library.
This program requires the readline dev. library.
Please install it first.])
fi
#
# Checks for header files.
#
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS([fcntl.h limits.h stdlib.h string.h sys/time.h termios.h unistd.h])
#
# Checks for typedefs, structures, and compiler characteristics.
#
AC_C_CONST
AC_TYPE_SIZE_T
AC_HEADER_TIME
CFLAGS="$GLIB_CFLAGS $CFLAGS"
AC_CHECK_TYPES([GStatBuf],[],[],[#include <glib/gstdio.h>])
#
# Checks for library functions.
#
AC_FUNC_MALLOC
AC_FUNC_MEMCMP
AC_FUNC_REALLOC
AC_FUNC_SELECT_ARGTYPES
AC_FUNC_STAT
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([bzero getcwd memmove memset select strcasecmp strdup strerror strncasecmp strrchr strtol])
AC_CONFIG_FILES([Makefile])
if test "$HOST_TYPE" = "freebsd" -a ! "$ICONV_LIBS"; then
AC_MSG_WARN([
********
On FreeBSD, you may need to specify the environement variable ICONV_LIBS='-l iconv' before running 'configure', as detailed in doc/build-freebsd.md. Otherwise 'make' may fail.
********])
fi
AC_OUTPUT