forked from irontec/sngrep
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
264 lines (223 loc) · 8.68 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
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
AC_PREREQ([2.59])
AC_INIT([sngrep], [1.4.3], [[email protected]], [sngrep], [http://www.irontec.com/])
AM_INIT_AUTOMAKE([1.9])
AC_CONFIG_HEADERS([src/config.h])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
m4_ifdef([AC_CONFIG_MACRO_DIRS], AC_CONFIG_MACRO_DIRS([m4]), m4_include([m4/sngrep.m4]))
AC_COPYRIGHT("Irontec S.L.")
# Define _GNU_SOURCE etc.
m4_ifdef([AC_USE_SYSTEM_EXTENSIONS], [AC_USE_SYSTEM_EXTENSIONS])
# debug compilation
AC_ARG_ENABLE(debug,
AC_HELP_STRING(--enable-debug, [Debug compilation (Default = no)]),
enable_debug=$enableval, enable_debug=no)
if test "$enable_debug" = "yes" ; then
CFLAGS="$CFLAGS -g -O0 -Wall -Werror -Wno-unused-but-set-variable"
CXXFLAGS="$CXXFLAGS $CFLAGS"
fi
# Minimum checks for a C program :)
AC_PROG_CC
AC_PROG_CXX
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_EGREP
AC_LANG(C)
#######################################################################
# Check for other REQUIRED libraries
AC_CHECK_LIB([pthread], [pthread_create], [], [
AC_MSG_ERROR([ You need to have libpthread installed to compile sngrep.])
])
AC_CHECK_LIB([pcap], [pcap_open_offline], [], [
AC_MSG_ERROR([ You need to have libpcap installed to compile sngrep.])
])
AC_CHECK_HEADER([pcap.h], [], [
AC_MSG_ERROR([ You need to have libpcap development files installed to compile sngrep.])
])
####
#### Ncurses Wide character support
####
AC_ARG_ENABLE([unicode],
AC_HELP_STRING([--enable-unicode], [Enable Ncurses Unicode support]),
[AC_SUBST(UNICODE, $enableval)],
[AC_SUBST(UNICODE, no)]
)
AS_IF([test "x$enable_unicode" == "xyes"], [
# Ncurses with wide-character support
AC_DEFINE([WITH_UNICODE], [], [Compile With Unicode compatibility])
SNGREP_CHECK_SCRIPT([ncursesw6], [addnwstr], [WITH_UNICODE], "ncursesw6-config",
SNGREP_CHECK_SCRIPT([ncursesw], [addnwstr], [WITH_UNICODE], "ncursesw5-config",
SNGREP_CHECK_SCRIPT([ncurses], [addnwstr], [WITH_UNICODE], "ncurses5-config",
SNGREP_CHECK_LIB([ncursesw6], [addnwstr], [WITH_UNICODE],
SNGREP_CHECK_LIB([ncursesw], [addnwstr], [WITH_UNICODE],
SNGREP_CHECK_LIB([ncurses], [addnwstr], [WITH_UNICODE],
))))))
AC_CHECK_LIB([panelw], [new_panel], [], [
AC_MSG_ERROR([ You need to have ncurses panelw library installed to compile sngrep.])
])
AC_CHECK_LIB([formw], [new_form], [], [
AC_MSG_ERROR([ You need to have ncurses formsw library installed to compile sngrep.])
])
AC_CHECK_LIB([menuw], [new_item], [], [
AC_MSG_ERROR([ You need to have ncurses menuw library installed to compile sngrep.])
])
], [
# Ncurses without wide-character support
AC_CHECK_HEADER([ncurses.h], [], [
AC_MSG_ERROR([ You need to have ncurses development files installed to compile sngrep.])
])
AC_CHECK_LIB([ncurses], [initscr], [], [
AC_MSG_ERROR([ You need to have libncurses installed to compile sngrep.])
])
AC_CHECK_LIB([panel], [new_panel], [], [
AC_MSG_ERROR([ You need to have ncurses panel library installed to compile sngrep.])
])
AC_CHECK_LIB([form], [new_form], [], [
AC_MSG_ERROR([ You need to have ncurses forms library installed to compile sngrep.])
])
AC_CHECK_LIB([menu], [new_item], [], [
AC_MSG_ERROR([ You need to have ncurses menu library installed to compile sngrep.])
])
])
####
#### GnuTLS Support
####
AC_ARG_WITH([gnutls],
AS_HELP_STRING([--with-gnutls], [Enable SSL Support (TLS SIP Transport)]),
[AC_SUBST(WITH_GNUTLS, $withval)],
[AC_SUBST(WITH_GNUTLS, no)]
)
AS_IF([test "x$WITH_GNUTLS" == "xyes"], [
m4_ifdef([PKG_CHECK_MODULES], [
PKG_CHECK_MODULES([LIBGNUTLS], [gnutls])
], [
AC_CHECK_LIB([gnutls], [gnutls_init], [], [
AC_MSG_ERROR([ You need to have gnutls installed to compile sngrep])
])
])
AC_PATH_PROG([LIBGCRYPT_CONFIG],[libgcrypt-config],[no])
if test "x${LIBGCRYPT_CONFIG}" = "xno"; then
AC_MSG_FAILURE([libgcrypt-config not found in PATH])
fi
AC_CHECK_LIB(
[gcrypt],
[gcry_md_map_name],
[LIBGCRYPT_CFLAGS="`${LIBGCRYPT_CONFIG} --cflags`"
LIBGCRYPT_LIBS="`${LIBGCRYPT_CONFIG} --libs`"
],
[AC_MSG_ERROR([ You need to have libgcrypt installed to compile sngrep])],
[`${LIBGCRYPT_CONFIG} --libs --cflags`]
)
AC_DEFINE([WITH_GNUTLS],[],[Compile With GnuTLS compatibility])
AC_SUBST(LIBGCRYPT_CFLAGS)
AC_SUBST(LIBGCRYPT_LIBS)
], [])
####
#### OpenSSL Support
####
AC_ARG_WITH([openssl],
AS_HELP_STRING([--with-openssl], [Enable SSL Support (TLS SIP Transport)]),
[AC_SUBST(WITH_OPENSSL, $withval)],
[AC_SUBST(WITH_OPENSSL, no)]
)
AS_IF([test "x$WITH_OPENSSL" == "xyes"], [
AS_IF([test "x$WITH_GNUTLS" == "xyes"], [
AC_MSG_ERROR([ GnuTLS and OpenSSL can not be enabled at the same time ])
], [])
m4_ifdef([PKG_CHECK_MODULES], [
PKG_CHECK_MODULES([SSL], [libssl libcrypto])
], [
AC_CHECK_LIB([ssl], [SSL_new], [], [
AC_MSG_ERROR([ You need to have libssl installed to compile sngrep])
])
AC_CHECK_LIB([crypto], [EVP_get_cipherbyname], [], [
AC_MSG_ERROR([ You need to have libcrypto installed to compile sngrep])
])
])
AC_DEFINE([WITH_OPENSSL],[],[Compile With Openssl compatibility])
], [])
####
#### PCRE Support
####
AC_ARG_WITH([pcre],
AS_HELP_STRING([--with-pcre], [Enable Perl compatible regular expressions]),
[AC_SUBST(WITH_PCRE, $withval)],
[AC_SUBST(WITH_PCRE, no)]
)
AS_IF([test "x$WITH_PCRE" == "xyes"], [
AC_CHECK_HEADER([pcre.h], [], [
AC_MSG_ERROR([ You need libpcre development files installed to compile with pcre support.])
])
AC_CHECK_LIB([pcre], [pcre_exec], [], [
AC_MSG_ERROR([ You need libpcre library installed to compile with pcre support.])
])
AC_DEFINE([WITH_PCRE],[],[Compile With Perl Compatible regular expressions support])
], [])
####
#### IPv6 Support
####
AC_ARG_ENABLE([ipv6],
AS_HELP_STRING([--enable-ipv6], [Enable IPv6 Support]),
[AC_SUBST(USE_IPV6, $enableval)],
[AC_SUBST(USE_IPV6, no)]
)
AS_IF([test "x$USE_IPV6" == "xyes"], [
AC_CHECK_HEADERS([netinet/in.h netinet/ip6.h], [], [
AC_MSG_ERROR([ You dont seem to have ipv6 support (no ip6.h found).])
], [
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
])
AC_DEFINE([USE_IPV6],[],[Compile With IPv6 support])
], [])
####
#### EEP Support
####
AC_ARG_ENABLE([eep],
AS_HELP_STRING([--enable-eep], [Enable EEP/HEP Support]),
[AC_SUBST(USE_EEP, $enableval)],
[AC_SUBST(USE_EEP, no)]
)
AS_IF([test "x$USE_EEP" == "xyes"], [
AC_DEFINE([USE_EEP],[],[Compile With EEP support])
], [])
# Conditional Source inclusion
AM_CONDITIONAL([WITH_GNUTLS], [test "x$WITH_GNUTLS" == "xyes"])
AM_CONDITIONAL([WITH_OPENSSL], [test "x$WITH_OPENSSL" == "xyes"])
AM_CONDITIONAL([USE_EEP], [test "x$USE_EEP" == "xyes"])
######################################################################
# Print Logo
AC_ARG_ENABLE(logo,
AC_HELP_STRING(--disable-logo, [Disable Irontec Logo from Summary menu]),
[ enable_logo=$enableval],
[ enable_logo=yes])
AS_IF([test "x$enable_logo" == "xyes"], [
echo ''
echo ' ██╗██████╗ ██████╗ ███╗ ██╗████████╗███████╗ ██████╗'
echo ' ██║██╔══██╗██╔═══██╗████╗ ██║╚══██╔══╝██╔════╝██╔════╝'
echo ' ██║██████╔╝██║ ██║██╔██╗ ██║ ██║ █████╗ ██║ '
echo ' ██║██╔══██╗██║ ██║██║╚██╗██║ ██║ ██╔══╝ ██║ '
echo ' ██║██║ ██║╚██████╔╝██║ ╚████║ ██║ ███████╗╚██████╗'
echo ' ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═╝ ╚══════╝ ╚═════╝'
echo ''
])
AC_MSG_NOTICE
AC_MSG_NOTICE( sngrep configure finished )
AC_MSG_NOTICE( ====================================================== )
AC_MSG_NOTICE( GnuTLS Support : ${WITH_GNUTLS} )
AC_MSG_NOTICE( OpenSSL Support : ${WITH_OPENSSL} )
AC_MSG_NOTICE( Unicode Support : ${UNICODE} )
AC_MSG_NOTICE( Perl Expressions Support : ${WITH_PCRE} )
AC_MSG_NOTICE( IPv6 Support : ${USE_IPV6} )
AC_MSG_NOTICE( EEP Support : ${USE_EEP} )
AC_MSG_NOTICE( ====================================================== )
AC_MSG_NOTICE
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([src/Makefile])
AC_CONFIG_FILES([config/Makefile])
AC_CONFIG_FILES([doc/Makefile])
AC_CONFIG_FILES([tests/Makefile])
AC_OUTPUT