-
Notifications
You must be signed in to change notification settings - Fork 3
/
configure.in
255 lines (223 loc) · 8.9 KB
/
configure.in
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
dnl ###########################################################################
dnl ## configure.in
dnl ##
dnl ## This file gives all necessary information to Autoconf to build the
dnl ## DioNiSio configuration script.
dnl ##
dnl ## ------------------------------------------------------------------------
dnl ## dosis - DoS: Internet Sodomizer
dnl ## (C) 2008 Gerardo García Peña <gerardo@kung-foo.net>
dnl ##
dnl ## This program is free software; you can redistribute it and/or modify
dnl ## it under the terms of the GNU General Public License as published by
dnl ## the Free Software Foundation; either version 2 of the License, or (at
dnl ## your option) any later version.
dnl ##
dnl ## This program is distributed in the hope that it will be useful, but
dnl ## WITHOUT ANY WARRANTY; without even the implied warranty of
dnl ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
dnl ## General Public License for more details.
dnl ##
dnl ## You should have received a copy of the GNU General Public License
dnl ## along with this program; if not, write to the Free Software
dnl ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
dnl ## 02110-1301 USA
dnl ##
dnl ###########################################################################
AC_PREREQ(2.13)
dnl ---------------------------------------------------------------------------
dnl Set DioNiSio version
dnl ---------------------------------------------------------------------------
define(DOS_AC_VERSION_MAJOR, 1)
define(DOS_AC_VERSION_MINOR, 0)
define(DOS_AC_VERSION_RELEASE, 0)
define(DOS_AC_VERSION, DOS_AC_VERSION_MAJOR.DOS_AC_VERSION_MINOR.DOS_AC_VERSION_RELEASE)
dnl ---------------------------------------------------------------------------
dnl Basic configuration of autoconf+automake
dnl ---------------------------------------------------------------------------
AC_INIT([Dosis],DOS_AC_VERSION,[gerardo@kung-foo.net],[dosis])
AM_INIT_AUTOMAKE
AM_CONFIG_HEADER(include/autoconfig.h)
dnl ---------------------------------------------------------------------------
dnl Check essential tools and libraries
dnl ---------------------------------------------------------------------------
AC_PROG_INSTALL
AC_PROG_CC
AM_PROG_AS
AC_PROG_RANLIB
AC_PROG_YACC
AC_C_INLINE
AC_C_STRINGIZE
AC_HEADER_STDC
AC_FUNC_STAT
AC_FUNC_VPRINTF
dnl ---------------------------------------------------------------------------
dnl Identify host platform and operating system
dnl ---------------------------------------------------------------------------
AC_C_BIGENDIAN
AC_CANONICAL_HOST
case "$host_os" in
*linux*)
AC_DEFINE([LINUX], [1], [Target OS is Linux (glibc)])
;;
*)
dnl oh yeah! no windows
AC_MSG_ERROR([Only for Linux.])
esac
case "$host_cpu" in
sparc)
# this CPU does not allow unaligned accesses
;;
i386|i486|i586|i686)
ALLOW_UNALIGNED_16=1
ALLOW_UNALIGNED_32=1
;;
*)
AC_MSG_WARN([Unknown CPU '$host_cpu'.])
ALLOW_UNALIGNED_16=1
ALLOW_UNALIGNED_32=1
esac
if test "$ALLOW_UNALIGNED_16" ; then
AC_DEFINE([ALLOW_UNALIGNED_16], [1], [Allows word unaligned memory accesses.])
fi
if test "$ALLOW_UNALIGNED_32" ; then
AC_DEFINE([ALLOW_UNALIGNED_32], [1], [Allows dword unaligned memory accesses.])
fi
dnl ---------------------------------------------------------------------------
dnl Set compiler flags
dnl ---------------------------------------------------------------------------
dnl Try to detect compiler
if test "$GCC" = "yes"; then
dnl Active warnings
CFLAGS="$CFLAGS -Wall"
else
case `$CC -version 2>&1` in
*MIPSpro*)
dnl This is a SGI MIPSpro compiler!
CFLAGS="$CFLAGS -fullwarn"
PIC_FLAG=-KPIC
;;
*)
dnl WTF!?
AC_MSG_WARN("Unknown compiler.");
esac
fi
dnl ---------------------------------------------------------------------------
dnl Basic configuration
dnl ---------------------------------------------------------------------------
AC_CHECK_SIZEOF(char)
AC_CHECK_SIZEOF(short int)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long int)
AC_CHECK_SIZEOF(long long)
AC_CHECK_SIZEOF(void *)
dnl ---------------------------------------------------------------------------
dnl Check that libraries are ok
dnl ---------------------------------------------------------------------------
AC_CHECK_HEADERS([getopt.h \
sys/socket.h \
arpa/inet.h \
netinet/in.h \
pthread.h ],
[],
AC_MSG_ERROR([Essential header file not found.]))
AC_CHECK_HEADERS([linux/netfilter.h \
libipq.h ],
[],
AC_MSG_ERROR([The netfilter development headers (itpables-dev in debian/ubuntu) are needed.]),
[#ifdef HAVE_ARPA_INET_H
# include <arpa/inet.h>
#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
])
AC_CHECK_HEADERS([dlfcn.h], [], [])
AC_CHECK_TYPES([struct sockaddr_in],
[], [I need at least a 'struct sockaddr_in'],
[
#include <sys/socket.h>
#include <netinet/in.h>
])
AC_CHECK_TYPES([struct sockaddr_in6], [], [],
[
#include <sys/socket.h>
#include <netinet/in.h>
])
AC_CHECK_TYPES([int8_t, int16_t, int32_t, int64_t], [], [], [#include <sys/types.h>])
AC_CHECK_TYPES([uint8_t, uint16_t, uint32_t, uint64_t], [], [], [#include <sys/types.h>])
AC_CHECK_TYPES([u_int8_t, u_int16_t, u_int32_t, u_int64_t], [], [], [#include <sys/types.h>])
AC_CHECK_FUNCS([getopt_long], [], AC_MSG_ERROR([This version of getopt does not support long options.]))
AC_ARG_WITH([ssl],
AC_HELP_STRING([--with-ssl], [use ssl (default is YES)]),
[ac_cv_use_ssl=$withval],
[ac_cv_use_ssl=yes])
AC_CHECK_LIB(ipq, ipq_read, [], AC_MSG_ERROR("Missing library."))
AC_CHECK_LIB(m, floor, [], AC_MSG_ERROR("Missing math library."))
AC_CHECK_LIB(pthread, pthread_create, [], AC_MSG_ERROR("Missing library."))
AC_CHECK_LIB(rt, clock_gettime, [], AC_MSG_ERROR("Missing library."))
AC_CHECK_LIB(dl, dlopen, [], [])
dnl ---------------------------------------------------------------------------
dnl SSL configuration
dnl ---------------------------------------------------------------------------
OPENSSL="no"
if test "$ac_cv_use_ssl" = "yes"; then
AC_CHECK_HEADERS([openssl/e_os.h \
openssl/e_os2.h])
AC_CHECK_HEADERS([openssl/lhash.h \
openssl/crypto.h \
openssl/buffer.h \
openssl/x509.h \
openssl/ssl.h \
openssl/err.h \
openssl/rand.h \
openssl/pem.h],
[OPENSSL="yes"])
if test "$OPENSSL" = "yes"; then
AC_CHECK_LIB(ssl, SSL_library_init, [], AC_MSG_ERROR("Missing library."))
AC_DEFINE(HAVE_SSL, 1, [ssl available])
AC_DEFINE(SSL_ENABLED, 1, [enable ssl])
else
AC_MSG_WARN("SSL is disabled")
AC_DEFINE(SSL_ENABLED, 0, [disable ssl])
fi
fi
AM_CONDITIONAL(SSL_ENABLED, test "$OPENSSL" = "yes")
dnl ---------------------------------------------------------------------------
dnl Enable/disable some little things
dnl ---------------------------------------------------------------------------
AC_ARG_ENABLE([parser-debug],
AC_HELP_STRING([--enable-parser-debug],
[compile parser debug facilities (default is NO)]),
[PARSER_DEBUG="$enableval"],
[PARSER_DEBUG="no"])
if test "$PARSER_DEBUG" = "yes"; then
AC_DEFINE([PARSER_DEBUG], 1, [Enable parser debug capabilities.])
fi
AC_ARG_ENABLE([thread-debug],
AC_HELP_STRING([--enable-thread-debug],
[compile pthread debug facilities (default is NO)]),
[PTHREADEX_DEBUG="$enableval"],
[PTHREADEX_DEBUG="no"])
if test "$PTHREADEX_DEBUG" = "yes"; then
AC_DEFINE([PTHREADEX_DEBUG], 1, [Enable pthreads debug capabilities.])
fi
dnl ---------------------------------------------------------------------------
dnl Set directories
dnl ---------------------------------------------------------------------------
dnl Create a definition with the default directory
define(DOS_AC_DEFAULT_PREFIX, /usr/local/AC_PACKAGE_TARNAME-AC_PACKAGE_VERSION)
dnl Set default prefix directory now because we need to write some dirs based
dnl on this value.
AC_PREFIX_DEFAULT(DOS_AC_DEFAULT_PREFIX)
test "$prefix" = "NONE" && prefix='DOS_AC_DEFAULT_PREFIX'
test "$exec_prefix" = "NONE" && exec_prefix='${prefix}'
dnl ---------------------------------------------------------------------------
dnl Tell Autoconf/Automake which files must be generated
dnl ---------------------------------------------------------------------------
AC_CONFIG_FILES([Makefile
doc/man/dosis.1
include/Makefile
src/Makefile
src/dosis/Makefile])
AC_OUTPUT