-
Notifications
You must be signed in to change notification settings - Fork 1
/
configure.in
777 lines (702 loc) · 20.8 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
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
# Process this file with autoconf to produce a configure script.
AC_INIT(honeyd)
AC_CONFIG_SRCDIR(honeyd.c)
AC_CANONICAL_SYSTEM
AC_CANONICAL_HOST
AM_INIT_AUTOMAKE(honeyd, 1.5c)
AM_CONFIG_HEADER(config.h)
AM_MAINTAINER_MODE
AM_PROG_LIBTOOL
dnl Initialize prefix.
if test "$prefix" = "NONE"; then
prefix="/usr/local"
fi
disable_kqueue=no
disable_poll=no
case $host in
*-*-darwin* )
# Don't use kqueue or poll on bfp interface
AC_MSG_NOTICE([You are running Mac OS X; disable kqueue and poll for
libevent, we can only use select on pcap file descriptors])
disable_kqueue=yes
disable_poll=yes
esac
if test x"$disable_kqueue" == x"yes"; then
AC_DEFINE(DISABLE_KQUEUE, 1, [Define kqueue should be disabled for libevent])
fi
if test x"$disable_poll" == x"yes"; then
AC_DEFINE(DISABLE_POLL, 1, [Define poll should be disabled for libevent])
fi
# Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
AM_PROG_LEX
AC_PROG_YACC
AC_CHECK_LIB(dl, dlopen, [ LIBDL="-ldl"
LIBS="$LIBS -ldl" ],,)
AC_SUBST(LIBDL)
# Checks for libraries.
dnl Checks for libpcap
AC_MSG_CHECKING(for libpcap)
AC_ARG_WITH(libpcap,
[ --with-libpcap=DIR use libpcap build directory],
[ 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"
else
AC_ERROR(pcap.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)
LIB=$PCAPLIB
CLFAGS=$PCAPINC
have_pcap_get_selectable_fd="no"
AC_CHECK_LIB([pcap], [pcap_get_selectable_fd],
[have_pcap_get_selectable_fd="yes"],,)
if test x"$have_pcap_get_selectable_fd" == x"yes"; then
AC_DEFINE(HAVE_PCAP_GET_SELECTABLE_FD, 1,
[Define if libpcap has pcap_get_selectable_fd])
fi
LIB=""
CFLAGS=""
dnl Checks for (installed) libdnet
AC_ARG_WITH(libdnet,
[ --with-libdnet=DIR use libdnet in DIR],
[ case "$withval" in
yes|no)
AC_ERROR([Please specify directory containing dnet-config when using --with-libdnet])
;;
*)
AC_MSG_CHECKING(for libdnet)
AC_MSG_RESULT($withval)
if test -f $withval/src/libdnet.a; then
DNETINC="-I$withval/include"
DNETLIB="-L$withval/src -ldnet `$withval/dnet-config --libs`"
elif test -x $withval/bin/dnet-config; then
DNETINC="`$withval/bin/dnet-config --cflags`"
DNETLIB="`$withval/bin/dnet-config --libs`"
else
AC_MSG_RESULT(no)
AC_ERROR(dnet-config not found in $withval/bin)
fi
;;
esac
AC_MSG_RESULT(yes) ],
[ dnl This is the default case so let's just use AC_PATH_PROG! --CPK.
AC_PATH_PROG(dnetconfig, dnet-config, "no")
if test "$dnetconfig" = "no"; then
AC_ERROR(dnet-config not found)
else
DNETINC="`$dnetconfig --cflags`"
DNETLIB="`$dnetconfig --libs`"
fi]
)
dnl We still need to check whether it's dnet or dumbnet as
dnl for example on Debian. We test by looking at the content
dnl of DNETLIB and derive from the library name what version
dnl we're dealing with. If we find a libdumbnet, we prefix
dnl compat/libdnet to our inclusion path. It provides a dnet.h
dnl that transparently includes dumbnet.h for those systems. --CPK.
AC_MSG_CHECKING([whether libdnet is a libdumbnet])
if test `echo $DNETLIB | sed -e '/dumb/=;d'`; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_DUMBNET, 1,
[Define if our libdnet is a libdumbnet])
DNETCOMPAT="compat/libdnet"
else
AC_MSG_RESULT(no)
fi
AC_SUBST(DNETCOMPAT)
AC_SUBST(DNETINC)
AC_SUBST(DNETLIB)
dnl Checks for libevent
AC_MSG_CHECKING(for libevent)
AC_ARG_WITH(libevent,
[ --with-libevent=DIR use libevent build directory],
[ case "$withval" in
yes|no)
AC_MSG_RESULT(no)
;;
*)
AC_MSG_RESULT($withval)
if test -f $withval/event.h -a -f $withval/libevent.a; then
owd=`pwd`
if cd $withval; then withval=`pwd`; cd $owd; fi
EVENTINC="-I$withval"
EVENTLIB="-L$withval -levent"
elif test -f $withval/include/event.h -a -f $withval/lib/libevent.a; then
owd=`pwd`
if cd $withval; then withval=`pwd`; cd $owd; fi
EVENTINC="-I$withval/include"
EVENTLIB="-L$withval/lib -levent"
else
AC_ERROR(event.h or libevent.a not found in $withval)
fi
;;
esac ],
[ if test -f ${prefix}/include/event.h; then
EVENTINC="-I${prefix}/include"
EVENTLIB="-L${prefix}/lib -levent"
elif test -f /usr/include/event/event.h; then
EVENTINC="-I/usr/include/event"
EVENTLIB="-levent"
elif test -f /usr/include/event.h; then
EVENTLIB="-levent"
else
AC_MSG_RESULT(no)
AC_ERROR(libevent not found)
fi
AC_MSG_RESULT(yes) ]
)
AC_SUBST(EVENTINC)
AC_SUBST(EVENTLIB)
LIBS=$EVENTLIB
CFLAGS=$EVENTINC
AC_CHECK_LIB(event, event_priority_init,, AC_MSG_ERROR(["libevent is too old - you need to install a newer version. Check http://www.monkey.org/~provos/libevent/" ]))
LIBS=""
CFLAGS=""
dnl Checks for (installed) libpcre
AC_ARG_WITH(libpcre,
[ --with-libpcre=DIR use libpcre in DIR],
[ case "$withval" in
yes|no)
AC_MSG_CHECKING(for libpcre)
AC_MSG_RESULT(no)
;;
*)
AC_MSG_CHECKING(for libpcre)
AC_MSG_RESULT($withval)
if test -f $withval/src/libpcre.a; then
PCREINC="-I$withval/include"
PCRELIB="-L$withval/src -lpcre `$withval/pcre-config --libs`"
elif test -x $withval/bin/pcre-config; then
PCREINC="`$withval/bin/pcre-config --cflags`"
PCRELIB="`$withval/bin/pcre-config --libs`"
else
AC_MSG_RESULT(no)
fi
;;
esac
if test x"$PCREINC" != x ; then
AC_MSG_RESULT(yes)
fi ],
[ dnl This is the default case so let's just use AC_PATH_PROG! --CPK.
AC_PATH_PROG(pcreconfig, pcre-config, "no")
if test "$pcreconfig" != "no"; then
PCREINC="`$pcreconfig --cflags`"
PCRELIB="`$pcreconfig --libs`"
fi]
)
if test x"$PCREINC" != x ; then
AC_SUBST([SMTP_BIN], ['smtp${EXEEXT}'])
AC_SUBST([PROXY_BIN], ['proxy${EXEEXT}'])
fi
AC_SUBST(PCREINC)
AC_SUBST(PCRELIB)
dnl Checks for libraries.
AC_MSG_CHECKING(for libedit)
AC_ARG_WITH(libedit,
[ --with-libedit=DIR use libedit build directory],
[ case "$withval" in
yes|no)
AC_MSG_RESULT(no)
;;
*)
AC_MSG_RESULT($withval)
if test -f $withval/histedit.h -a -f $withval/libedit.a; then
owd=`pwd`
if cd $withval; then withval=`pwd`; cd $owd; fi
AC_DEFINE(HAVE_LIBEDIT, 1, [Define if you have libedit])
EDITINC="-I$withval"
EDITLIB="-L$withval -ledit"
else
AC_ERROR(histedit.h or libedit.a not found in $withval)
fi
;;
esac ],
[ if test -f ${prefix}/include/histedit.h; then
EDITINC="-I${prefix}/include"
EDITLIB="-L${prefix}/lib -ledit"
elif test -f /usr/include/edit/histedit.h; then
EDITINC="-I/usr/include/edit"
EDITLIB="-ledit"
elif test -f /usr/include/histedit.h; then
EDITLIB="-ledit"
else
AC_MSG_RESULT(no)
fi
if test ! -z "$EDITLIB" ; then
AC_DEFINE(HAVE_LIBEDIT, 1, [Define if you have libedit])
AC_MSG_RESULT(yes)
fi ]
)
AC_SUBST(EDITINC)
AC_SUBST(EDITLIB)
if test -z "$EDITLIB" ; then
AC_MSG_CHECKING(for libreadline)
AC_ARG_WITH(libreadline,
[ --with-libreadline=DIR use libreadline build directory],
[ case "$withval" in
yes|no)
AC_MSG_RESULT(no)
;;
*)
AC_MSG_RESULT($withval)
if test -f $withval/readline/readline.h -a -f $withval/libreadline.a; then
owd=`pwd`
if cd $withval; then withval=`pwd`; cd $owd; fi
AC_DEFINE(HAVE_LIBREADLINE, 1, [Define if you have libreadline])
EDITINC="-I$withval"
EDITLIB="-L$withval -lreadline"
else
AC_ERROR(readline/readline.h or libreadline.a not found in $withval)
fi
;;
esac ],
[ if test -f ${prefix}/include/readline/readline.h; then
EDITINC="-I${prefix}/include"
EDITLIB="-L${prefix}/lib -lreadline"
elif test -f /usr/include/readline/readline.h; then
EDITLIB="-lreadline"
else
AC_MSG_RESULT(no)
fi
if test ! -z "$EDITLIB" ; then
AC_DEFINE(HAVE_LIBREADLINE, 1, [Define if you have libreadline])
AC_MSG_RESULT(yes)
fi ]
)
AC_SUBST(EDITINC)
AC_SUBST(EDITLIB)
fi
if test -z "$EDITLIB" ; then
AC_ERROR(need either libedit or libreadline; install one of them)
fi
dnl zlib is required
ZLIB="-lz"
AC_ARG_WITH(zlib,
[ --with-zlib=DIR Use zlib in DIR],
[
if test "x$withval" = "xno" ; then
AC_MSG_ERROR([zlib is required])
fi
if test -d "$withval/lib"; then
ZLIB="-L${withval}/lib"
else
ZLIB="-L${withval}"
fi
if test -d "$withval/include"; then
ZINC="-I${withval}/include"
else
ZINC="-I${withval}"
fi
]
)
AC_SUBST(ZLIB)
AC_SUBST(ZINC)
LIBS=$ZLIB
CFLAGS=$ZINC
AC_CHECK_LIB(z, deflate,, AC_MSG_ERROR([zlib ismissing - you need to install it]))
LIBS=""
CFLAGS=""
AC_CHECK_LIB(ncurses, tgetstr, [ LIBCURSES="-lncurses" ],,)
if test -z "$LIBCURSES" ; then
AC_CHECK_LIB(curses, tgetstr, [ LIBCURSES="-lcurses" ],,)
fi
if test -z "$LIBCURSES" ; then
AC_CHECK_LIB(termcap, tgetstr, [ LIBCURSES="-ltermcap" ],,)
fi
AC_SUBST(LIBCURSES)
AC_PATH_PROG(PATH_RRDTOOL, rrdtool)
AC_SUBST(PATH_RRDTOOL)
AC_ARG_WITH(python,
[ --with-python support for python services ],
[ case "$withval" in
no)
DO_PYTHON=""
;;
*)
DO_PYTHON=define
;;
esac ], [])
AC_PATH_PROG(PATH_PYTHON, python)
if test x"$PATH_PYTHON" != x -a x"$DO_PYTHON" = xdefine ; then
pv_gv=`$PATH_PYTHON -c 'import sys; print sys.version[[:3]] > "2.3.0"'`
if test "$pv_gv" == "False" ; then
AC_PATH_PROG(PATH_PYTHON24, python2.4)
if test x"$PATH_PYTHON24" != x ; then
PATH_PYTHON=$PATH_PYTHON24
DO_PYTHON=define
else
AC_ERROR(need at least Python 2.4)
fi
else
DO_PYTHON=define
fi
else
DO_PYTHON=""
fi
AC_SUBST(PATH_PYTHON)
dnl Libraries and flags for embedded Python.
dnl FIXME: I wish there was a less icky way to get this.
if test x"$DO_PYTHON" = xdefine ; then
AC_MSG_CHECKING(for Python linkage)
py_prefix=`$PATH_PYTHON -c 'import sys; print sys.prefix'`
py_ver=`$PATH_PYTHON -c 'import sys; print sys.version[[:3]]'`
py_libdir="${py_prefix}/lib/python${py_ver}"
PYTHONINC="-I${py_prefix}/include/python${py_ver}"
py_libs=`grep '^LIBS=' $py_libdir/config/Makefile | sed -e 's/^.*=//'`
py_libc=`grep '^LIBC=' $py_libdir/config/Makefile | sed -e 's/^.*=//'`
py_libm=`grep '^LIBM=' $py_libdir/config/Makefile | sed -e 's/^.*=//'`
py_liblocalmod=`grep '^LOCALMODLIBS=' $py_libdir/config/Makefile | sed -e 's/^.*=//'`
py_libbasemod=`grep '^BASEMODLIBS=' $py_libdir/config/Makefile | sed -e 's/^.*=//'`
PYTHONLIB="-L$py_libdir/config $py_libs $py_libc $py_libm -lpython$py_ver $py_liblocalmod $py_libbasemod"
PYTHON_LIB=`echo $PYTHON_LIB | sed -e 's/[ \\t]*/ /g'`
AC_MSG_RESULT($py_libdir)
AC_DEFINE(HAVE_PYTHON, 1, [Define if we want to link with Python support])
PYEXTEND="pyextend.o pydataprocessing.o pydatahoneyd.o"
# Figure out if we have our modules
AC_MSG_CHECKING(for Python dnet module)
py_dnet=`$PATH_PYTHON -c 'import dnet; print "ok"' 2>/dev/null`
AM_CONDITIONAL([COND_REGRESS], [test x"$py_dnet" = xok])
if test x"$py_dnet" = xok; then
AC_DEFINE(HAVE_PYDNET, 1,
[Define if Python knows about the dnet modules])
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no - regression tests will not run)
fi
# run these tests only if the dnet python module is available
if test x"$py_dnet" = xok; then
AC_MSG_CHECKING(for Python pcap module)
py_pcap=`$PATH_PYTHON -c 'import pcap; print "ok"' 2>/dev/null`
AM_CONDITIONAL([COND_PYPCAP], [test x"$py_pcap" != xok])
if test x"$py_pcap" = xok; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
AC_MSG_CHECKING(for Python dpkt module)
py_dpkt=`$PATH_PYTHON -c 'import dpkt; print "ok"' 2>/dev/null`
AM_CONDITIONAL([COND_PYDPKT], [test x"$py_dpkt" != xok])
if test x"$py_dpkt" = xok; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
else
AM_CONDITIONAL([COND_PYPCAP], [test x != x])
AM_CONDITIONAL([COND_PYDPKT], [test x != x])
fi
else
AM_CONDITIONAL([COND_PYPCAP], [test x != x])
AM_CONDITIONAL([COND_PYDPKT], [test x != x])
AM_CONDITIONAL([COND_REGRESS], [test x != x])
PYEXTEND=""
PYTHONLIB=""
PYTHONINC=""
fi
AC_SUBST(PYEXTEND)
AC_SUBST(PYTHONLIB)
AC_SUBST(PYTHONINC)
# Checks for header files.
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(stdarg.h errno.h fcntl.h paths.h stdlib.h string.h time.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h sys/ioccom.h sys/file.h net/bpf.h syslog.h unistd.h assert.h)
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_UID_T
AC_CHECK_TYPE(u_int, unsigned int)
AC_CHECK_TYPE(u_int64_t, unsigned long long)
AC_CHECK_TYPE(u_int32_t, unsigned int)
AC_CHECK_TYPE(u_int16_t, unsigned short)
AC_CHECK_TYPE(u_int8_t, unsigned char)
AC_HEADER_TIME
# Checks for library functions.
AC_PROG_GCC_TRADITIONAL
AC_TYPE_SIGNAL
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(asprintf dup2 fgetln gettimeofday memmove memset strcasecmp strchr strdup strncasecmp strtoul strspn getaddrinfo getnameinfo freeaddrinfo setgroups sendmsg recvmsg setregid setruid kqueue)
AC_REPLACE_FUNCS(daemon err strsep strlcpy strlcat getopt_long)
needsha1=no
AC_CHECK_FUNCS(SHA1Update, , [needsha1=yes])
if test $needsha1 = yes; then
AC_LIBOBJ(sha1)
fi
dnl make sure we're using the real structure members and not defines
AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
ac_cv_have_accrights_in_msghdr, [
AC_TRY_RUN(
[
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/uio.h>
int main() {
#ifdef msg_accrights
exit(1);
#endif
struct msghdr m;
m.msg_accrights = 0;
exit(0);
}
],
[ ac_cv_have_accrights_in_msghdr="yes" ],
[ ac_cv_have_accrights_in_msghdr="no" ]
)
])
if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR,1 ,
[Define if your system uses access rights style file descriptor passing])
fi
AC_MSG_CHECKING([for sun_len in socketaddr_un])
AC_TRY_COMPILE([
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>],
[struct sockaddr_un x; x.sun_len = 0],
[AC_MSG_RESULT([yes])
AC_DEFINE(HAVE_SUN_LEN, 1, [Set if you have sun_len in socketaddr_un])
],
AC_MSG_RESULT([no])
)
AC_CACHE_CHECK([for msg_control field in struct msghdr],
ac_cv_have_control_in_msghdr, [
AC_TRY_RUN(
[
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/uio.h>
int main() {
#ifdef msg_control
exit(1);
#endif
struct msghdr m;
m.msg_control = 0;
exit(0);
}
],
[ ac_cv_have_control_in_msghdr="yes" ],
[ ac_cv_have_control_in_msghdr="no" ]
)
])
if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
AC_DEFINE(HAVE_CONTROL_IN_MSGHDR,1,
[Define if your system uses ancillary data style file descriptor passing])
fi
AC_MSG_CHECKING([for timeradd in sys/time.h])
AC_EGREP_CPP(yes,
[
#include <sys/time.h>
#ifdef timeradd
yes
#endif
], [ AC_DEFINE(HAVE_TIMERADD, 1,
[Define if timeradd is define in <sys/time.h>])
AC_MSG_RESULT([yes])], AC_MSG_RESULT([no])
)
AC_MSG_CHECKING([for isblank in ctype.h])
AC_EGREP_CPP(yes,
[
#include <ctype.h>
#ifdef isblank
yes
#endif
], [ AC_DEFINE(HAVE_ISBLANK, 1,
[Define if isblank is defined in <ctype.h>])
AC_MSG_RESULT([yes])],
[ AC_MSG_RESULT([no])
AC_CHECK_FUNCS(isblank)
]
)
if test -z "$DNETCOMPAT"
then
CFLAGS="$DNETINC"
else
CFLAGS="-I$DNETCOMPAT $DNETINC"
fi
LIBS=$DNETLIB
AC_MSG_CHECKING(for working addr_cmp in libdnet)
AC_TRY_RUN(
#include <sys/types.h>
#include <stdlib.h>
#include <dnet.h>
int
main(int argc, char **argv)
{
struct addr a1;
struct addr a2;
memset(&a1, 0, sizeof(a1));
memset(&a2, 0, sizeof(a2));
a1.addr_type = a2.addr_type = ADDR_TYPE_IP;
a1.addr_bits = a2.addr_bits = IP_ADDR_BITS;
memset(&a2.addr_ip, 1, sizeof(a2.addr_ip));
exit(addr_cmp(&a1, &a2) > 0);
}, AC_MSG_RESULT(yes), [
AC_ERROR(you need to install a more recent version of libdnet)
], AC_MSG_RESULT(yes))
AC_MSG_CHECKING(for addr_net in libdnet)
AC_TRY_LINK([
#include <sys/types.h>
#include <stdlib.h>
#include <dnet.h>
],[
struct addr a1;
struct addr a2;
addr_net(&a1, &a2);
], AC_MSG_RESULT(yes), [
AC_ERROR(you need to install a more recent version of libdnet)
], AC_MSG_RESULT(yes))
CFLAGS=""
LIBS=""
AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
AC_TRY_COMPILE(
[
#include <sys/types.h>
#include <sys/socket.h>
],
[ struct sockaddr_storage s; ],
[ ac_cv_have_struct_sockaddr_storage="yes" ],
[ ac_cv_have_struct_sockaddr_storage="no" ]
)
])
if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
[Define if your system defines struct sockaddr_storage])
fi
if test "$ac_cv_header_sys_socket_h" = yes ; then
AC_MSG_CHECKING(for sa_len in sockaddr struct)
AC_CACHE_VAL(ac_cv_sockaddr_has_sa_len,
AC_TRY_COMPILE([
# include <sys/types.h>
# include <sys/socket.h>],
[u_int i = sizeof(((struct sockaddr *)0)->sa_len)],
ac_cv_sockaddr_has_sa_len=yes,
ac_cv_sockaddr_has_sa_len=no))
AC_MSG_RESULT($ac_cv_sockaddr_has_sa_len)
if test $ac_cv_sockaddr_has_sa_len = yes ; then
AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1,
[Define if sockaddr struct has sa_len.])
fi
fi
dnl check if underscores are needed
AC_MSG_CHECKING(if underscores are needed for symbols)
AC_TRY_RUN(
#include <dlfcn.h>
#include <stdio.h>
int underscoreprobe(void) { return (31415); }
int
main(int argc, char **argv)
{
void *dh;
if ((dh = dlopen(NULL, 0)) == NULL)
exit(1);
if (dlsym(dh, "_underscoreprobe") != NULL)
exit(0);
exit(1);
}, [AC_MSG_RESULT(yes)
AC_DEFINE(DL_NEED_UNDERSCORE, 1, [Do symbols need underscores?])],
AC_MSG_RESULT(no), AC_MSG_RESULT(no))
HAVEMETHOD=no
AC_MSG_CHECKING(if we can access libc without dlopen)
AC_TRY_RUN(
#include <dlfcn.h>
#include <stdio.h>
int
main(int argc, char **argv)
{
void *dh;
dh = (void *)-1L;
if (dlsym(dh, "printf") != NULL || dlsym(dh, "_printf") != NULL)
exit(0);
exit(1);
}, [AC_MSG_RESULT(yes)
AC_DEFINE(NODLOPEN, 1, [Do we need to call dlopen()?])
HAVEMETHOD=yes], AC_MSG_RESULT(no), AC_MSG_RESULT(no))
if test "$HAVEMETHOD" = "no"; then
dnl Make sure we use libld if necessary -- CPK
LIBS="$LIBDL $LIBS"
dnl ugly, ugly hack
LIBCGUESS=`echo /lib/libc.so.*`
USRLIBCGUESS=`echo /usr/lib/libc.so*`
if test "$USRLIBCGUESS" = "/usr/lib/libc.so.*"; then
USRLIBCGUESS=""
fi
if test "$LIBCGUESS" = "/lib/libc.so.*"; then
LIBCGUESS=""
fi
for TESTLIB in libc.so `echo $USRLIBCGUESS` `echo $LIBCGUESS`
do
AC_MSG_CHECKING(if we can access libc with $TESTLIB)
AC_TRY_RUN(
#include <dlfcn.h>
#include <stdio.h>
int
main(int argc, char **argv)
{
void *dh;
if (dlopen("$TESTLIB", RTLD_LAZY) != NULL)
exit(0);
exit(1);
}, [AC_MSG_RESULT(yes)
AC_DEFINE_UNQUOTED(DLOPENLIBC, "$TESTLIB",
[Defines which libc to preload])
HAVEMETHOD=yes], AC_MSG_RESULT(no), AC_MSG_RESULT(no))
if test "$HAVEMETHOD" = "yes"; then
break
fi
done
fi
if test "$HAVEMETHOD" = "no"; then
AC_MSG_ERROR(Couldn't figure out how to access libc)
fi
dnl ##################################################
dnl # Plugin setup
dnl ##################################################
AC_MSG_CHECKING(for plugins to build in)
AC_ARG_WITH(plugins,
[ --with-plugins=LIST use the list of libraries given as plugins.
Specify any libraries you want to build into honeyd as plugins using
the --with-plugins option. Pass a list of the library names as used
when linking, separated by commas. For example, if you have two plugin
libraries called libhum and libbee, you would use --with-plugins=hum,bee.],
[ for name in `echo "$withval" | sed -e 's/,/\n/g'`
do
PLUGINLIB="$PLUGINLIB -l$name"
PLUGINS="$PLUGINS &plugin_$name,"
PLUGINSDECLARE="$PLUGINSDECLARE extern struct honeyd_plugin plugin_$name;"
done
PLUGINS=`echo $PLUGINS | sed -e 's/ //g'`
AC_MSG_RESULT(using$PLUGINLIB) ],
[ AC_MSG_RESULT(none) ])
AC_SUBST(PLUGINLIB)
AC_SUBST(PLUGINS)
AC_SUBST(PLUGINSDECLARE)
AC_CONFIG_FILES([Makefile regress/Makefile pypcap/Makefile])
AC_OUTPUT