-
Notifications
You must be signed in to change notification settings - Fork 44
/
configure.in
340 lines (325 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
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
dnl configure.in
dnl
dnl Copyright (c) 2000 Dug Song <[email protected]>
dnl
dnl $Id: configure.in,v 1.27 2000/12/20 16:31:21 dugsong Exp $
AC_INIT(dsniff.c)
AC_CONFIG_HEADER(config.h)
dnl Initialize prefix.
if test "$prefix" = "NONE"; then
prefix="/usr/local"
fi
dnl Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_RANLIB
dnl Checks for header files.
AC_PATH_XTRA
AC_HEADER_STDC
AC_CHECK_HEADERS(err.h fcntl.h sys/ioctl.h sys/queue.h unistd.h libgen.h net/if_tun.h)
dnl XXX - Solaris sux.
AC_MSG_CHECKING(for MIN and MAX in sys/param.h)
AC_EGREP_CPP(yes, [
#include <sys/param.h>
#if defined(MAX) && defined(MIN)
yes
#endif
],
[ AC_MSG_RESULT(yes); AC_DEFINE(HAVE_MINMAX) ],
[ AC_MSG_RESULT(no) ]
)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T
AC_STRUCT_TM
dnl XXX - Solaris sux.
AC_CHECK_TYPE(u_int32_t, uint32_t)
AC_CHECK_TYPE(u_int64_t, uint64_t)
dnl XXX - Linux sux.
AC_CHECK_TYPE(in_addr_t, u_int32_t)
CFLAGS="$CFLAGS -D_BSD_SOURCE"
dnl Checks for library functions.
AC_PROG_GCC_TRADITIONAL
AC_FUNC_MEMCMP
AC_TYPE_SIGNAL
AC_FUNC_STRFTIME
AC_CHECK_FUNCS(gethostname socket strdup strstr)
AC_CHECK_LIB(rpcsvc, xdr_fhstatus)
dnl XXX - Solaris sux.
AC_CHECK_LIB(socket, socket)
AC_CHECK_LIB(nsl, gethostbyname)
dnl XXX - feh, everything except OpenBSD sux.
AC_CHECK_LIB(resolv, dn_expand)
AC_REPLACE_FUNCS(dirname strlcpy strlcat strsep)
needmd5=no
AC_CHECK_FUNCS(MD5Update, , [needmd5=yes])
if test $needmd5 = yes; then
LIBOBJS="$LIBOBJS md5.o"
fi
neederr=no
AC_CHECK_FUNCS(warnx, , [neederr=yes])
if test $neederr = yes; then
LIBOBJS="$LIBOBJS err.o"
fi
needethers=no
AC_CHECK_FUNCS(ether_ntoa, , [needethers=yes])
if test $needethers = yes; then
LIBOBJS="$LIBOBJS ethers.o"
fi
dnl Checks for BSD tunnel device
dnl if test "x$ac_cv_header_net_if_tun_h" = "xyes"; then
dnl TCPHIJACK="tcphijack"
dnl fi
AC_SUBST(TCPHIJACK)
dnl Checks for X11
if test "x$no_x" = "x"; then
WEBSPY="webspy"; AC_SUBST(WEBSPY)
fi
dnl Checks for Berkeley DB
AC_MSG_CHECKING(for Berkeley DB with 1.85 compatibility)
AC_ARG_WITH(db,
[ --with-db=DIR use Berkeley DB (with --enable-compat185) in DIR],
[ case "$withval" in
yes|no)
AC_MSG_RESULT(no)
;;
*)
AC_MSG_RESULT($withval)
if test -f $withval/build_unix/db_185.h -a \
-f $withval/build_unix/libdb.a; then
owd=`pwd`
if cd $withval; then withval=`pwd`; cd $owd; fi
AC_DEFINE(HAVE_DB_185_H)
DBINC="-I$withval/build_unix"
DBLIB="-L$withval/build_unix -ldb"
elif test -f $withval/dist/db_185.h -a \
-f $withval/dist/libdb.a; then
owd=`pwd`
if cd $withval; then withval=`pwd`; cd $owd; fi
AC_DEFINE(HAVE_DB_185_H)
DBINC="-I$withval/dist"
DBLIB="-L$withval/dist -ldb"
elif test -f $withval/include/db_185.h -a \
-f $withval/lib/libdb.a; then
owd=`pwd`
if cd $withval; then withval=`pwd`; cd $owd; fi
AC_DEFINE(HAVE_DB_185_H)
DBINC="-I$withval/include"
DBLIB="-L$withval/lib -ldb"
else
AC_ERROR(db_185.h or libdb.a not found in $withval or not configured with --enable-compat185)
fi
;;
esac ],
[ for dir in ${prefix}/BerkeleyDB.3.1 ${prefix}/BerkeleyDB.3.0 \
${prefix}/BerkeleyDB ${prefix}/db ${prefix}; do
if test -f ${dir}/include/db_185.h; then
AC_DEFINE(HAVE_DB_185_H)
DBINC="-I${dir}/include"
DBLIB="-L${dir}/lib -ldb"
have_db=yes
break
elif test -f ${dir}/include/db.h; then
AC_DEFINE(HAVE_DB_H)
DBINC="-I${dir}/include"
DBLIB="-L${dir}/lib -ldb"
have_db=yes
break
fi
done
if test "x$have_db" = "x"; then
if test -f /usr/include/db2/db_185.h; then
AC_DEFINE(HAVE_DB_185_H)
DBINC="-I/usr/include/db2"
DBLIB="-ldb2"
have_db=yes
elif test -f /usr/include/db_185.h; then
AC_DEFINE(HAVE_DB_185_H)
DBLIB="-ldb"
have_db=yes
elif test -f /usr/include/db.h; then
AC_DEFINE(HAVE_DB_H)
have_db=yes
fi
fi
if test "x$have_db" = "x"; then
AC_ERROR(Berkeley DB with 1.85 compatibility not found)
fi
AC_MSG_RESULT(yes) ]
)
AC_SUBST(DBINC)
AC_SUBST(DBLIB)
dnl Checks for libpcap
AC_MSG_CHECKING(for libpcap)
AC_ARG_WITH(libpcap,
[ --with-libpcap=DIR use libpcap in DIR],
[ case "$withval" in
yes|no)
AC_MSG_RESULT(no)
;;
*)
AC_MSG_RESULT($withval)
if test -f $withval/pcap.h -a -f $withval/libpcap.a; then
owd=`pwd`
if cd $withval; then withval=`pwd`; cd $owd; fi
PCAPINC="-I$withval -I$withval/bpf"
PCAPLIB="-L$withval -lpcap"
elif test -f $withval/include/pcap.h -a \
-f $withval/include/net/bpf.h -a \
-f $withval/lib/libpcap.a; then
owd=`pwd`
if cd $withval; then withval=`pwd`; cd $owd; fi
PCAPINC="-I$withval/include"
PCAPLIB="-L$withval/lib -lpcap"
else
AC_ERROR(pcap.h, net/bpf.h, or libpcap.a not found in $withval)
fi
;;
esac ],
[ if test -f ${prefix}/include/pcap.h; then
PCAPINC="-I${prefix}/include"
PCAPLIB="-L${prefix}/lib -lpcap"
elif test -f /usr/include/pcap/pcap.h; then
PCAPINC="-I/usr/include/pcap"
PCAPLIB="-lpcap"
elif test -f /usr/include/pcap.h; then
PCAPLIB="-lpcap"
else
AC_MSG_RESULT(no)
AC_ERROR(libpcap not found)
fi
AC_MSG_RESULT(yes) ]
)
AC_SUBST(PCAPINC)
AC_SUBST(PCAPLIB)
dnl Checks for libnet
AC_MSG_CHECKING(for libnet)
AC_ARG_WITH(libnet,
[ --with-libnet=DIR use libnet in DIR],
[ case "$withval" in
yes|no)
AC_MSG_RESULT(no)
;;
*)
AC_MSG_RESULT($withval)
if test -f $withval/include/libnet.h -a -f $withval/lib/libnet.a; then
owd=`pwd`
if cd $withval; then withval=`pwd`; cd $owd; fi
if test -f $withval/bin/libnet-config; then
CFLAGS="$CFLAGS `$withval/bin/libnet-config --defines`"
elif test -f $withval/libnet-config; then
CFLAGS="$CFLAGS `$withval/libnet-config --defines`"
else
CFLAGS="$CFLAGS `libnet-config --defines`"
fi
LNETINC="-I$withval/include"
LNETLIB="-L$withval/lib -lnet"
else
AC_ERROR(libnet.h or libnet.a not found in $withval)
fi
;;
esac ],
[ if test -f ${prefix}/include/libnet.h; then
CFLAGS="$CFLAGS `${prefix}/bin/libnet-config --defines`"
LNETINC="-I${prefix}/include"
LNETLIB="-L${prefix}/lib -lnet"
elif test -f /usr/include/libnet.h; then
CFLAGS="$CFLAGS `libnet-config --defines`"
LNETLIB="-lnet"
else
AC_MSG_RESULT(no)
AC_ERROR(libnet not found)
fi
AC_MSG_RESULT(yes) ]
)
AC_SUBST(LNETINC)
AC_SUBST(LNETLIB)
dnl Checks for libnids
AC_MSG_CHECKING(for libnids)
AC_ARG_WITH(libnids,
[ --with-libnids=DIR use libnids in DIR],
[ case "$withval" in
yes|no)
AC_MSG_RESULT(no)
;;
*)
AC_MSG_RESULT($withval)
if test -f $withval/src/nids.h -a -f $withval/src/libnids.a; then
owd=`pwd`
if cd $withval; then withval=`pwd`; cd $owd; fi
NIDSINC="-I$withval/src"
NIDSLIB="-L$withval/src -lnids"
elif test -f $withval/include/nids.h -a -f $withval/lib/libnids.a; then
owd=`pwd`
if cd $withval; then withval=`pwd`; cd $owd; fi
NIDSINC="-I$withval/include"
NIDSLIB="-L$withval/lib -lnids"
else
AC_ERROR(nids.h or libnids.a not found in $withval)
fi
;;
esac ],
[ if test -f ${prefix}/include/nids.h; then
NIDSINC="-I${prefix}/include"
NIDSLIB="-L${prefix}/lib -lnids"
elif test -f /usr/include/nids.h; then
NIDSLIB="-lnids"
else
AC_MSG_RESULT(no)
AC_ERROR(libnids not found)
fi
AC_MSG_RESULT(yes) ]
)
save_cppflags="$CPPFLAGS"
CPPFLAGS="$NIDSINC"
AC_MSG_CHECKING(whether libnids version is good)
AC_EGREP_HEADER(pcap_filter, nids.h, AC_MSG_RESULT(yes),
[ AC_MSG_RESULT(no); AC_ERROR(libnids version 1.13 or greater required) ])
CPPFLAGS="$save_cppflags"
AC_SUBST(NIDSINC)
AC_SUBST(NIDSLIB)
dnl Checks for OpenSSL
AC_MSG_CHECKING(for OpenSSL)
AC_ARG_WITH(openssl,
[ --with-openssl=DIR use OpenSSL in DIR],
[ case "$withval" in
yes|no)
AC_MSG_RESULT(no)
;;
*)
AC_MSG_RESULT($withval)
if test -f $withval/include/openssl/ssl.h -a -f $withval/libssl.a; then
owd=`pwd`
if cd $withval; then withval=`pwd`; cd $owd; fi
SSLINC="-I$withval/include"
SSLLIB="-L$withval -lssl -lcrypto"
elif test -f $withval/include/openssl/ssl.h -a \
-f $withval/lib/libssl.a; then
owd=`pwd`
if cd $withval; then withval=`pwd`; cd $owd; fi
SSLINC="-I$withval/include"
SSLLIB="-L$withval/lib -lssl -lcrypto"
else
AC_ERROR(ssl.h or libssl.a not found in $withval)
fi
WEBMITM="webmitm"
;;
esac ],
[ if test -f ${prefix}/include/openssl/ssl.h; then
SSLINC="-I${prefix}/include"
SSLLIB="-L${prefix}/lib -lssl -lcrypto"
elif test -f ${prefix}/ssl/include/openssl/ssl.h; then
SSLINC="-I${prefix}/ssl/include"
SSLLIB="-L${prefix}/ssl/lib -lssl -lcrypto"
elif test -f /usr/include/openssl/ssl.h; then
SSLLIB="-lssl -lcrypto"
else
AC_MSG_RESULT(no)
AC_ERROR(OpenSSL not found)
fi
AC_MSG_RESULT(yes)
]
)
AC_SUBST(SSLINC)
AC_SUBST(SSLLIB)
AC_OUTPUT(Makefile)