-
Notifications
You must be signed in to change notification settings - Fork 5
/
configure.in
938 lines (797 loc) · 25.7 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
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
dnl>
dnl> Copyright (C) 2002-14 Luca Deri <deri@ltop.org>
dnl>
dnl>
dnl> standard Autoconf prolog
dnl>
dnl> lprobe version <major version>.<minor version>.<build date>
AC_INIT([lprobe],[6.16.140306])
AC_PREREQ(2.52)
AC_REVISION([1.0])
AC_CONFIG_MACRO_DIR([m4])
dnl> acconfig.h is deprecated
dnl> AH_TEMPLATE([ DEBUG ], [ Define if you want a debugging version.])
TODAY=`date +%y%m%d`
N2DISK_PACKAGE_VERSION=`cat ./private/n2disk_version.h.in | grep N2DISK_VERSION | head -1 | cut -d \" -f 2|sed "s/@TODAY@/$TODAY/g"`
PFRING_SVN_RELEASE=""
if test -d $HOME/PF_RING; then
PFRING_SVN_RELEASE=`svn info $HOME/PF_RING | grep "^Revision"|cut -d " " -f 2`
fi
PFRING_VERSION=""
if test -f "$HOME/PF_RING/kernel/linux/pf_ring.h"; then
PFRING_VERSION=`cat $HOME/PF_RING/kernel/linux/pf_ring.h | grep RING_VERSION | head -1 | cut -d '"' -f 2`
fi
echo
echo "Welcome to $PACKAGE_NAME, Version $PACKAGE_VERSION"
echo "Copyright (C) 2002-14 Luca Deri <deri@ltop.org>"
echo
THE_UID=`id -u`
if test $THE_UID -eq 0; then
echo "################## WARNING ##################"
echo
echo "Running configure and compiling as root might lead"
echo "to compilation issues."
echo
echo "Please run configure as normal user, not as superuser"
echo
echo "#############################################"
fi
dnl>
dnl> canonicalize the host, target, and build system types
dnl>
\rm -f libtool
AC_CANONICAL_SYSTEM
AM_PROG_LIBTOOL
dnl We need to do this before checking types
AC_CHECK_HEADERS([sys/types.h])
AC_CHECK_TYPE(u_int64_t, unsigned long long)
AC_CHECK_TYPE(u_int32_t, unsigned long)
AC_CHECK_TYPE(u_int16_t, unsigned short)
AC_CHECK_TYPE(u_int8_t, unsigned char)
AC_CHECK_TYPE(int64_t, long long)
AC_CHECK_TYPE(int32_t, long)
AC_CHECK_TYPE(int16_t, short)
AC_CHECK_TYPE(int8_t, char)
dnl>
dnl> perform program name transformation
dnl>
AC_ARG_PROGRAM
AC_ARG_WITH(only-ipv4,
[ --with-only-ipv4 Disable IPv6 support (if available)], [
if test $withval != no
then
CFLAGS="-DIPV4_ONLY $CFLAGS"
fi
],)
AC_ARG_WITH(pcap-root,
[ --with-pcap-root=DIR LBNL pcap located in DIR],
PCAP_ROOT="$withval",
PCAP_ROOT=)
AC_ARG_WITH(static-lprobe,
[ --with-static-lprobe Build static lprobe (make lprobes)],
[ CFLAGS="-DMAKE_STATIC_PLUGINS $CFLAGS"] )
AC_ARG_WITH(napatech,
[ --with-napatech Build without Napatech support (if present)])
LICENSE="yes"
AC_ARG_WITH(no-license,
[ --with-no-license Build without license check],
LICENSE="",)
PLUGIN_LICENSE="yes"
AC_ARG_WITH(no-plugin-license,
[ --with-no-plugin-license Build without plugin licenses],
PLUGIN_LICENSE="no",)
dnl> AM_DISABLE_SHARED
dnl> AM_ENABLE_SHARED
dnl> AM_PROG_LIBTOOL
dnl> set default loader
CCLD=$CC
dnl> Uncomment on FreeBSD
dnl> ACLOCAL_AMFLAGS=-I m4
AC_PROG_CC
AC_PROG_CXX(g++)
AC_SET_MAKE
AC_PROG_INSTALL
dnl>
dnl> set reasonable defaults here
dnl>
DEFS="-DHAVE_CONFIG_H"
dnl> CFLAGS="-g $CFLAGS"
HERE=`pwd`
AC_DEFINE(HAVE_NOW, 1394119422, [Time we compiled lprobe])
dnl Test endianness
AC_C_BIGENDIAN([ AC_DEFINE(lprobe_BIG_ENDIAN, 1, [build for big endian]) ]
, [ AC_DEFINE(lprobe_LITTLE_ENDIAN, 1, [build for little endian]) ]
, [ AC_DEFINE(lprobe_BIG_ENDIAN, 1, [build for big endian]) ]
)
dnl>
dnl> force configure to use current directory
dnl>
AC_CONFIG_AUX_DIR(.)
dnl> FreeBSD
AM_INIT_AUTOMAKE($PACKAGE,$VERSION)
dnl>
dnl> make lprobeDIR the default for the installation
dnl>
AC_PREFIX_DEFAULT(${lprobeDIR:-/usr/local})
dnl> Add /usr/local/ /opt/local
CFLAGS="${CFLAGS} -I/usr/local/include -I/opt/local/include"
CPPFLAGS="${CPPFLAGS} -I/usr/local/include -I/opt/local/include"
LDFLAGS="${LDFLAGS} -L/usr/local/lib -L/opt/local/lib -L/lib"
dnl>
dnl> generate the config header
dnl>
umask 002
dnl> FreeBSD/OSX
AC_CONFIG_HEADERS(config.h)
REV=tac
DYN_FLAGS=
MORESOURCES=
MOREOBJECTS=
SO_VERSION_PATCH=
dnl>MAKE_SHARED_LIBRARY_PARM=""
MAKE_SHARED_LIBRARY_PARM=" -bundle -flat_namespace -undefined suppress"
LIBTOOL_PATH="/usr/bin/libtool"
if ! test -x ${LIBTOOL_PATH}; then
LIBTOOL_PATH=`which libtool`
fi
IS_FREEBSD=
case "$host:$CC" in
*-solaris* )
AC_DEFINE(NEED_INET_ATON, 1, [inet_aton])
CFLAGS="-DSOLARIS $CFLAGS"
CORELIBS="${CORELIBS} -lrt -lnsl"
;;
*-*-freebsd*:* )
CFLAGS="-DFREEBSD -fPIC $CFLAGS"
IS_FREEBSD=1
;;
*darwin* )
CFLAGS="-no-cpp-precomp -fno-color-diagnostics -DDARWIN $CFLAGS"
REV="tail -r"
DYN_FLAGS="-bundle -flat_namespace -undefined suppress $DYN_FLAGS"
KERNEL_VERSION=`uname -r | cut -d '.' -f 1`
# echo $KERNEL_VERSION
if test $KERNEL_VERSION -gt 9; then
CFLAGS="-DSNOW_LEOPARD $CFLAGS"
fi
LIBTOOL_PATH=`which glibtool`
;;
*linux* )
if test `uname -m` == "i686"; then
PIC=""
else
PIC="-fPIC"
fi
esac
dnl>
dnl> License check
dnl>
USE_LICENSE=
if test "$LICENSE" != ""; then
if test -d "./private/license"; then
LICENSELIBS="-L`pwd`/private/license -llicense"
MORELIBS="${MORELIBS} ${LICENSELIBS}"
AC_DEFINE(HAVE_LICENSE, 1, [Check lprobe license])
USE_LICENSE=private/license/liblicense.a
if test "$PLUGIN_LICENSE" != "no"; then
AC_DEFINE(HAVE_PLUGIN_LICENSE, 1, [Check lprobe plugin licenses])
fi
fi
fi
dnl>
dnl> checks for system header files
dnl>
AC_HEADER_STDC
dnl> AC_HEADER_TIME
AC_CHECK_HEADERS(dlfcn.h dl.h)
AC_CHECK_HEADERS([dirent.h])
if test ".${ac_cv_header_dlfcn_h}" != ".yes"; then
echo "Unable to find dlfcn.h"
echo ""
echo "You cannot use dlopen load plugins."
echo "Build lprobe without plugin support or with dynamic plugins."
fi
dnl> MANDATORY general purpose headers
AC_HAVE_HEADERS(pwd.h stdio.h errno.h stdlib.h unistd.h string.h signal.h fcntl.h dnl
sys/time.h sys/wait.h sys/stat.h sys/ioctl sys/un.h)
dnl> OPTIONAL general purpose headers
AC_CHECK_HEADERS(sys/select.h sys/ldr.h sys/sockio.h)
AC_CHECK_LIB([c], [optreset], AC_DEFINE_UNQUOTED(HAVE_OPTRESET, 1, [libc has optreset]))
AC_CHECK_LIB([numa], [numa_available], AC_DEFINE_UNQUOTED(HAVE_LIBNUMA, 1, [libnuma is installed]))
AC_MSG_CHECKING([if libnuma is present])
if test "x$ac_cv_lib_numa_numa_available" = xyes; then :
LIBNUMA="-lnuma"
CORELIBS="${CORELIBS} ${LIBNUMA}"
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT(no)
fi
AC_MSG_CHECKING([if your compiler supports __sync_add_and_fetch])
AC_TRY_LINK(,
[
int v = 1;
return (__sync_add_and_fetch(&v, 1) == 2 ? 0 : 1);
],
[
AC_MSG_RESULT([yes])
AC_DEFINE(HAVE_BUILTIN_ATOMIC, 1, [Define 1 if your version of gcc supports __sync_add_and_fetch])
],
[
AC_MSG_RESULT(no)
]
)
AC_CHECK_HEADERS(sched.h sys/sched.h semaphore.h pthread.h)
AC_CHECK_LIB(pthread, pthread_create)
dnl> Silicom Redirector
AC_CHECK_LIB(rdi, rdi_init)
AC_CHECK_LIB(pthread, [pthread_setaffinity_np], AC_DEFINE_UNQUOTED(HAVE_PTHREAD_SET_AFFINITY, 1, [libpthread has pthread_setaffinity_np]))
dnl> R/W locks are broken on some BSD releases
if test "$IS_FREEBSD" != "1"; then
AC_MSG_CHECKING([if r/w locks are supported])
AC_TRY_RUN([
#include <pthread.h>
int main()
{
pthread_rwlock_t t;
return 0;
}
]
, [ AC_MSG_RESULT(yes) AC_DEFINE_UNQUOTED(HAVE_RW_LOCK, 1, [pthread has rw locks]) ], [AC_MSG_RESULT(no)]
)
fi
AC_MSG_CHECKING([if sockaddr_in6 has sin6_len])
AC_TRY_RUN([
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/ip6.h>
int main()
{
struct sockaddr_in6 addr;
addr.sin6_len = sizeof(struct sockaddr_in6);
return 0;
}
]
, [ AC_MSG_RESULT(yes) AC_DEFINE_UNQUOTED(HAVE_SIN6_LEN, 1, [sockaddr_in6 has sin6_len]) ], [AC_MSG_RESULT(no)]
)
AC_CHECK_LIB(dl, dlopen)
AC_CHECK_LIB(rt, clock_gettime)
if test "x$ac_cv_lib_rt_clock_gettime" = xyes; then :
LIBRT="-lrt"
fi
dnl> MANDATORY universal headers for network programming code
AC_HAVE_HEADERS(sys/socket.h netdb.h netinet/in.h arpa/inet.h net/if.h)
AC_HAVE_HEADERS(netinet/in_systm.h netinet/ip.h netinet/ip_icmp.h netinet/udp.h netinet/tcp.h)
dnl> OPTIONAL headers for network programming headers
AC_CHECK_HEADERS(netinet/if_ether.h arpa/nameser.h net/ethernet.h ethertype.h if.h net/bpf.h)
dnl> OPTIONAL syslog headers
AC_CHECK_HEADERS(sys/syslog.h, [ac_sys_syslog_h="yes"], [ac_sys_syslog_h="no"])
AC_CHECK_HEADERS(syslog.h, [ac_syslog_h="yes"], [ac_syslog_h="no"])
dnl>
dnl> Test ether_header has ea
dnl>
AC_MSG_CHECKING([if ether_header uses ether_addr structs])
AC_TRY_COMPILE([
# include <sys/types.h>
# if __STDC__
/* osf3 has REALLY good prototyes */
struct mbuf;
struct rtentry;
# endif
# include <sys/socket.h>
# include <net/if.h>
# include <netinet/in.h>
# include <netinet/if_ether.h>],
[u_int i =
sizeof(((struct ether_header *)0)->ether_dhost.ether_addr_octet)],
[AC_MSG_RESULT(yes)
AC_DEFINE_UNQUOTED(ETHER_HEADER_HAS_EA,
1,
[ether_header uses ether_addr structs])],
[AC_MSG_RESULT(no)])
dnl> Networking libraries
dnl>
AC_CHECK_LIB(socket, accept)
AC_CHECK_LIB(resolv, inet_aton)
AC_CHECK_HEADERS([netinet/in.h libnetfilter_queue/libnetfilter_queue.h])
AC_CHECK_LIB([netfilter_queue], [nfq_create_queue])
if test "x$ac_cv_lib_netfilter_queue_nfq_create_queue" = xyes; then :
AC_DEFINE_UNQUOTED(HAVE_NETFILTER, 1, [NFQ is present])
LIBS="$LIBS -lnetfilter_queue"
fi
if test "${with_napatech+set}" = set; then
OLD_LIBS=$LIBS
LIBS="-L/opt/napatech3/lib $LIBS"
AC_CHECK_LIB([ntapi],
[NT_Init],
[NT_INC="-I/opt/napatech3/include -D HAVE_NT"; NT_LIB="-L/opt/napatech3/lib -lntapi"; N2DISKNT="n2disknt"],
[], [] )
LIBS=$OLD_LIBS
fi
dnl> SCTP - RFC 3286
dnl>
AC_MSG_CHECKING([sctp])
AC_TRY_LINK([
#include "confdefs.h"
#include <netinet/in.h>
#include <netinet/sctp.h>
#include <sys/socket.h>],
[socket(AF_INET, SOCK_SEQPACKET, IPPROTO_SCTP);],
AC_DEFINE_UNQUOTED(HAVE_SCTP, 1, [SCTP is supported])
AC_MSG_RESULT(yes)
ac_has_sctp=yes,
AC_MSG_RESULT(no)
ac_has_sctp=no)
AC_MSG_CHECKING([Apache Kafka])
KAFKA_HOME="/usr/local/librdkafka"
if test -d "${KAFKA_HOME}"; then
KAFKA_LIB="${KAFKA_HOME}/librdkafka.a"
else
KAFKA_HOME="/opt/rb/include/librdkafka"
if test -d "${KAFKA_HOME}"; then
KAFKA_LIB="/opt/rb/lib/librdkafka.a"
else
KAFKA_HOME=""
fi
fi
if test -z ${KAFKA_HOME}; then
AC_MSG_RESULT([no])
else
AC_DEFINE_UNQUOTED(HAVE_RDKAFKA, 1, [Apache Kafka is present])
LIBS="$LIBS ${KAFKA_LIB}"
CPPFLAGS="${CPPFLAGS} -I${KAFKA_HOME}"
AC_MSG_RESULT([found on ${KAFKA_HOME}])
fi
PWD=`pwd`/..
LIBPCAP_ARM="${PWD}/libpcap-1.1.1-ARM"
PLATFORM=`uname -m`
PF_RING_HOME=${HOME}/PF_RING
if test -d "${PF_RING_HOME}"; then
echo -n ""
else
PF_RING_HOME=${PWD}/PF_RING
fi
if test -d "${PF_RING_HOME}"; then
LDFLAGS="${LDFLAGS} -L${PWD}/PF_RING/userland/lib -L${PWD}/PF_RING/userland/libpcap"
CFLAGS="${CFLAGS} -I${PWD}/PF_RING/userland/lib -I${PWD}/PF_RING/userland/libpcap"
CPPFLAGS="${CPPFLAGS} -I${PWD}/PF_RING/userland/lib -I${PWD}/PF_RING/userland/libpcap"
fi
HAVE_ARM=0
if test -d ${LIBPCAP_ARM}; then
echo "Found ${LIBPCAP_ARM}: we'll be building lprobe for the ARM platform."
AC_DEFINE_UNQUOTED(HAVE_ARM, 1, [ARM is supported])
INCS="${INCS} -I ${LIBPCAP_ARM}"
CORELIBS="${CORELIBS} ${LIBPCAP_ARM}/libpcap.a"
CC="arm-mv5sft-linux-gnueabi-gcc"
CPP=${CC}
LTGCC=${CC}
LTCC=${CC}
CCLD=${CC}
LD=${CC}
PLATFORM=arm
AC_DEFINE_UNQUOTED(HAVE_PCAP_NEXT_EX, 1, [pcap has pcap_next_ex])
HAVE_ARM=1
dnl> ARM
if test -f "/usr/local/lib/libpfring.a" || test -f "${PF_RING_HOME}/userland/lib/libpfring.a"; then
if test -f "pro/pf_ring.h"; then
AC_DEFINE_UNQUOTED(HAVE_PF_RING, 1, [Native PF_RING support])
INCS="${INCS} -I /lib/modules/`uname -r`/source/include -I{PWD}/PF_RING/kernel"
PFRING="pro/pfring.c"
if test -d "${PWD}/PF_RING/"; then
if test -f "${PF_RING_HOME}/userland/lib/libpfring.a"; then
PFRINGLIBS="${PF_RING_HOME}/userland/lib/libpfring.a -lpfring"
else
PFRINGLIBS="/usr/local/lib/libpfring.a"
fi
CORELIBS="${CORELIBS} ${PFRINGLIBS}"
INCS="${INCS} -I ${PWD}/PF_RING/userland/lib -I ${PWD}/PF_RING/kernel"
fi
dnl> Put it here after checking the presence of PF_RING as libpfring is a prerequisite
dnl> when using libpcap over PF_RING
AC_DEFINE_UNQUOTED(HAVE_PCAP_NEXT_EX, 1, [pcap has pcap_next_ex])
fi
fi
dnl> !ARM
else
dnl>
dnl> PF_RING
dnl>
AC_MSG_CHECKING([Native PF_RING support])
if test -f "/usr/local/include/pfring.h" || test -f "${PF_RING_HOME}/userland/lib/pfring.h"; then
if test -f "/usr/local/lib/libpfring.a" || test -f "${PF_RING_HOME}/userland/lib/libpfring.a"; then
if test -f "pro/pf_ring.h"; then
AC_DEFINE_UNQUOTED(HAVE_PF_RING, 1, [Native PF_RING support])
dnl> We suppose to use PF_RING's version of libpcap
AC_DEFINE_UNQUOTED(HAVE_PCAP_NEXT_EX, 1, [pcap has pcap_next_ex])
AC_MSG_RESULT(yes)
INCS="${INCS} -I /lib/modules/`uname -r`/source/include"
PFRING=pro/pfring.c
if test -d "${PF_RING_HOME}/"; then
INCS="${INCS} -I ${PF_RING_HOME}/userland/lib -I ${PF_RING_HOME}/kernel"
CORELIBS="${CORELIBS} -L${PF_RING_HOME}/userland/lib ${PF_RING_HOME}/userland/libpcap/libpcap.a"
if test -f "${PF_RING_HOME}/userland/lib/libpfring.a"; then
PFRINGLIBS="${PF_RING_HOME}/userland/lib/libpfring.a"
else
PFRINGLIBS="/usr/local/lib/libpfring.a"
fi
CORELIBS="${CORELIBS} ${PFRINGLIBS}"
fi
if test -d "${HOME}/drivers/PF_RING/DNA/"; then
INCS="${INCS} -I ${HOME}/drivers/PF_RING/DNA"
AC_DEFINE_UNQUOTED(HAVE_DNA_HEADERS, 1, [dna headers are present])
fi
else
AC_MSG_RESULT(no [missing "pro/pf_ring.h"])
fi
else
AC_MSG_RESULT(no [missing "/usr/local/lib/libpfring.a"])
fi
else
AC_MSG_RESULT(no [missing "/usr/local/include/pfring.h and ${PF_RING_HOME}/userland/lib/pfring.h"])
fi
dnl> End ARM
fi
AC_CHECK_LIB([hiredis], [redisCommand])
if test "x$ac_cv_lib_hiredis_redisCommand" = xyes; then :
LIBS="$LIBS -lhiredis"
AC_DEFINE_UNQUOTED(HAVE_REDIS, 1, [redis is present])
AC_DEFINE_UNQUOTED(HAVE_LIBEVENT, 1, [libevent is present])
REDIS_DEP="redis >= 2.4.10 hiredis >= 0.10.1"
else
REDIS_DEP=""
fi
dnl> AC_CHECK_LIB([zmq], [zmq_send])
dnl> if test "x$ac_cv_lib_zmq_zmq_send" = xyes; then :
dnl> LIBS="$LIBS -lzmq"
dnl> AC_DEFINE_UNQUOTED(HAVE_ZMQ, 1, [ZMQ is present])
dnl> fi
AC_CHECK_LIB([zmq], [zmq_send])
if test "x$ac_cv_lib_zmq_zmq_send" = xyes; then :
AC_CHECK_LIB([zmq], [zmq_socket_monitor])
if test "x$ac_cv_lib_zmq_zmq_socket_monitor" = xyes; then :
LIBS="$LIBS -lzmq"
AC_DEFINE_UNQUOTED(HAVE_ZMQ, 1, [ZMQ is present])
else
echo "ZMQ present but too old: please update to version 3.x"
fi
fi
dnl> nDPI
NDPI_LIB=$HERE/nDPI/src/lib/.libs/libndpi.a
NDPI_INC=$HERE/nDPI/src/include/
dnl>
dnl> Leave it here as it might be needed by those linking lprobe
dnl> against a PF_RING-enabled library
dnl>
dnl> AC_CHECK_LIB(pfring, pfring_open)
dnl> ##################################
dnl> !ARM
dnl> ##################################
if test ${HAVE_ARM} -ne "1"; then
dnl>
dnl> Packet Capture Library by Lawrence Berkeley National Laboratory - Network Research Group
dnl>
dnl> order as follow
dnl> 1. user defined libpcap development tree
dnl> 2. standard installation in /usr/lib and /usr/include respectively
dnl> 3. default package installation in /usr/local/lib and /usr/local/include respectively
dnl> 4. libpcap-0.4 development tree under the same lprobe's root directory or in a subdir
AC_MSG_CHECKING([for libpcap (required package)])
dnl> echo "*** ${PCAP_ROOT} ***"
dnl>
dnl> user defined directory passed as option at configuration time
dnl>
PCAP_EXTRA_LIB_DIR=""
if test ".${PCAP_ROOT}" != .; then
if test -d $PCAP_ROOT &&
dnl> test -r $PCAP_ROOT/libpcap.a &&
test -r $PCAP_ROOT/pcap.h; then
PCAP_ROOT=`cd ${PCAP_ROOT} && pwd`
PCAPLIBS="-L$PCAP_ROOT -lpcap"
CORELIBS="${CORELIBS} ${PCAPLIBS}"
INCS="${INCS} -I$PCAP_ROOT"
PCAP_EXTRA_LIB_DIR=$PCAP_ROOT
AC_MSG_RESULT([found in $PCAP_ROOT])
else
AC_MSG_RESULT([not found in ${PCAP_ROOT}])
AC_MSG_RESULT([ *** FATAL ERROR *** ])
AC_MSG_RESULT([ It looks that you don't have some files needed to use the pcap library.])
AC_MSG_RESULT([ Please check the source tree, compile and, optionally, install the software.])
AC_MSG_RESULT([ When finished please re-run this program.])
AC_MSG_RESULT([ You can download the latest source tarball at http://www.tcpdump.org])
AC_MSG_ERROR([ The LBL Packet Capture Library development tree seems corrupted or incomplete!])
fi
elif test -r ${PF_RING_HOME}/userland/libpcap/pcap.h; then
PCAP_ROOT="${PF_RING_HOME}/userland/libpcap"
PCAP_EXTRA_LIB_DIR=$PCAP_ROOT
PCAPLIBS="-L$PCAP_ROOT -lpcap"
CORELIBS="${CORELIBS} ${PCAPLIBS}"
INCS="${INCS} -I$PCAP_ROOT"
AC_MSG_RESULT([found in $PCAP_ROOT])
dnl>
dnl> installation used by most packagers
dnl>
dnl>elif test -r /usr/lib/libpcap.a &&
elif test -d /usr/local &&
dnl> test -r /usr/local/lib/libpcap.a &&
test -r /usr/local/include/pcap.h; then
PCAP_ROOT="/usr/local"
PCAPLIBS="-L$PCAP_ROOT/lib -lpcap"
CORELIBS="${CORELIBS} ${PCAPLIBS}"
INCS="${INCS} -I$PCAP_ROOT/include"
PCAP_EXTRA_LIB_DIR=$PCAP_ROOT
AC_MSG_RESULT([found in $PCAP_ROOT])
dnl>
dnl> installation used by most packagers
dnl>
dnl>elif test -r /usr/lib/libpcap.a &&
elif test -r /usr/include/pcap.h; then
PCAP_ROOT="standard installation"
PCAPLIBS="-lpcap"
CORELIBS="${CORELIBS} ${PCAPLIBS}"
AC_MSG_RESULT([found in $PCAP_ROOT])
dnl>
dnl> installation used by OSX
dnl>
elif test -r /usr/lib/libpcap.A.dylib &&
test -r /usr/include/pcap.h; then
PCAP_ROOT="standard OSX installation"
PCAPLIBS="-lpcap"
CORELIBS="${CORELIBS} ${PCAPLIBS}"
AC_MSG_RESULT([found in $PCAP_ROOT])
dnl>
dnl> unusual and more complex installation used by some packagers
dnl> (e.g. Red Hat Linux)
dnl>
dnl>elif test -r /usr/lib/libpcap.a &&
elif
test -r /usr/include/pcap/pcap.h; then
PCAP_ROOT="semi-standard installation"
PCAPLIBS="-lpcap"
CORELIBS="${CORELIBS} ${PCAPLIBS}"
INCS="${INCS} -I/usr/include/pcap"
AC_MSG_RESULT([found in $PCAP_ROOT])
else
AC_CHECK_LIB(pcap, pcap_lookupdev)
if test "$ac_tr_lib" != "HAVE_LIBPCAP"; then
AC_MSG_RESULT([not found!])
AC_MSG_RESULT([ *** FATAL ERROR *** ])
AC_MSG_RESULT([ It looks that you don't have the libpcap distribution installed.])
AC_MSG_RESULT([ Download, compile and, optionally, install it.])
AC_MSG_RESULT([ When finished please re-run this program.])
AC_MSG_RESULT([ You can download the latest source tarball at http://www.tcpdump.org/])
AC_MSG_ERROR([ The LBL Packet Capture Library, libpcap, was not found! ])
else
if test -r /usr/include/pcap/pcap.h; then
INCS="${INCS} -I/usr/include/pcap"
PCAP_ROOT="standard installation"
else
AC_MSG_RESULT([ *** FATAL ERROR *** ])
AC_MSG_RESULT([ It looks that you don't have the libpcap distribution installed.])
AC_MSG_RESULT([ Download, compile and, optionally, install it.])
AC_MSG_RESULT([ When finished please re-run this program.])
AC_MSG_RESULT([ You can download the latest source tarball at http://www.tcpdump.org/])
AC_MSG_ERROR([ The LBL Packet Capture Library, libpcap, was not found! ])
fi
fi
fi
SAVE_LIBS=$LIBS
if test -n "$PCAP_EXTRA_LIB_DIR"; then
LIBS="$LIBS -L$PCAP_EXTRA_LIB_DIR"
fi
AC_CHECK_LIB([pcap], [pcap_next_ex], AC_DEFINE_UNQUOTED(HAVE_PCAP_NEXT_EX, 1, [pcap has pcap_next_ex]))
LIBS=$SAVE_LIBS
dnl> ##################################
if test ".${with_static_lprobe}" != ".yes"; then
dnl> GeoIP (http://www.maxmind.com/)
GEOIP_TARGET=
GEOIP_LOCAL_HOME=${HOME}/GeoIP-1.4.8/libGeoIP/
dnl> Check for local install
if test -f "$GEOIP_LOCAL_HOME/.libs/libGeoIP.a"; then
INCS="${INCS} -I$GEOIP_LOCAL_HOME"
CORELIBS="${CORELIBS} $GEOIP_LOCAL_HOME/.libs/libGeoIP.a"
else
dnl> Check for package install
AC_CHECK_LIB([GeoIP], [GeoIP_record_by_ipnum])
AC_HAVE_HEADERS(GeoIP.h)
if test ".${ac_cv_lib_GeoIP_GeoIP_record_by_ipnum}" = ".yes" &&
test ".${ac_cv_header_GeoIP_h}" = ".yes"; then
AC_CHECK_LIB([GeoIP], [GeoIP_record_by_ipnum_v6])
if test ".${ac_cv_lib_GeoIP_GeoIP_record_by_ipnum_v6}" = ".yes"; then
AC_DEFINE_UNQUOTED(HAVE_GEOIP_IPv6, 1, [GeoIP IPv6 support is present])
fi
dnl> LIBS="$LIBS -lGeoIP"
AC_DEFINE_UNQUOTED(HAVE_GEOIP, 1, [GeoIP support is present])
GEOIP_DEP="GeoIP >= 1.4.8"
GEOIP_TARGET=datfiles
else
AC_MSG_RESULT(Build lprobe without geolocation - GeoIP (http://www.maxmind.com/))
GEOIP_DEP=""
fi
dnl > else of GeoIP
fi
dnl> static lprobe
fi
dnl> yaSSL (http://www.yassl.com/yaSSL/)
AC_CHECK_LIB([cyassl], [ssl_DecodePacket])
AC_MSG_CHECKING([yaSSL support])
if test "x$ac_cv_lib_cyassl_ssl_DecodePacket" = x""yes; then
AC_DEFINE_UNQUOTED(HAVE_YASSL, 1, [use yaSSL])
CFLAGS="${CFLAGS} -I/usr/local/include/cyassl"
CPPFLAGS="${CPPFLAGS} -I/usr/local/include/cyassl"
LIBS="${LIBS} -lcyassl"
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
AC_CHECK_LIB([rt], [clock_gettime])
if test -f "../lprobe-utils/extensions/templates.c"; then
AC_DEFINE_UNQUOTED(HAVE_TEMPLATE_EXTENSIONS, 1, [Have template extensions])
INC_TO_ADD="-I$HERE/../lprobe-utils/extensions -I$HERE/../lprobe-utils/extensions/libnfsender/include"
LIBS="${LIBS} $HERE/../lprobe-utils/extensions/libnfsender/lib/libnfsender.a"
CFLAGS="${CFLAGS} ${INC_TO_ADD}"
CPPFLAGS="${CPPFLAGS} ${INC_TO_ADD}"
fi
AC_CHECK_LIB([json-c], [json_object_new_object])
if test "x$ac_cv_lib_json_c_json_object_new_object" = x""yes; then
LIBS="${LIBS} -ljson-c"
if test -d "extensions/"; then
AC_DEFINE_UNQUOTED(HAVE_lprobe_EXTENSIONS, 1, [lprobe extensions present])
fi
fi
if test ".${with_static_lprobe}" != ".yes"; then
PATH=$PATH:/usr/local/mysql/bin
AC_CHECK_TOOL(MYSQL, mysql_config)
dnl> echo "--> $ac_cv_prog_ac_ct_MYSQL"
if test "x$ac_cv_prog_ac_ct_MYSQL" = "xmysql_config"; then
# MYSQLLIBS="`mysql_config --libs_r`|grep Usage"
MYSQLLIBS="`mysql_config --libs_r`"
OLD_LIBS=${LIBS}
OLD_INCS=${INCS}
if test ".$MYSQLLIBS" != "."; then
LIBS="${LIBS} `mysql_config --libs`"
else
LIBS="${LIBS} `mysql_config --libs_r`"
fi
INCS="${INCS} `mysql_config --cflags`"
dnl> The line below is necessary for passing to gcc the new includes
OLD_CPPFLAGS=${CPPFLAGS}
CPPFLAGS="${CPPFLAGS} ${INCS}"
AC_CHECK_HEADERS(mysql.h mysql/mysql.h)
if test ".${ac_cv_header_mysql_h}" != ".yes" &&
test ".${ac_cv_header_mysql_mysql_h}" != ".yes"; then
LIBS=${OLD_LIBS}
INCS=${OLD_INCS}
else
AC_DEFINE_UNQUOTED(HAVE_MYSQL, 1, [use mysql])
LIBS="${LIBS} -lwrap"
fi
CPPFLAGS=${OLD_CPPFLAGS}
MYSQL_DEP="mysql-libs >= 5.1.0 tcp_wrappers-libs >= 7.6"
else
echo "MySQL not found. Database support disabled";
fi
fi
dnl> !ARM
fi
AC_CHECK_LIB([sqlite3], [sqlite3_open], sqlite=true)
if test x$sqlite = xtrue
then
AC_DEFINE_UNQUOTED([HAVE_SQLITE], 1, [We have sqlite])
MORELIBS="${MORELIBS} -lsqlite3"
fi
AC_MSG_CHECKING([OS 32/64 bits])
BITS=`getconf LONG_BIT`
if test $BITS = "64"; then
GEOIP_LIB="/usr/lib64/libGeoIP.so.1"
AC_MSG_RESULT([64])
else
GEOIP_LIB="#"
AC_MSG_RESULT([32])
fi
PLUGINS=plugins
AC_DEFINE_UNQUOTED(ENABLE_PLUGINS, 1, [ Enable plugin support ])
CFLAGS=`echo ${CFLAGS}|sed "s/-g//g"`
dnl>
AC_SUBST(VERSION)
AC_SUBST(INCS)
AC_SUBST(LIBS)
AC_SUBST(CFLAGS)
AC_SUBST(LDFLAGS)
AC_SUBST(DYN_FLAGS)
AC_SUBST(CCLD)
AC_SUBST(LIBTOOL_DEPS)
AC_SUBST(PLUGINS)
AC_SUBST(CORELIBS)
AC_SUBST(MOREOBJECTS)
AC_SUBST(SO_VERSION_PATCH)
AC_SUBST(MAKE_SHARED_LIBRARY_PARM)
AC_SUBST(MORESOURCES)
AC_SUBST(MORELIBS)
AC_SUBST(PFRING)
AC_SUBST(REV)
AC_SUBST(GEO_DIR)
AC_SUBST(GEOIP_DEP)
AC_SUBST(REDIS_DEP)
AC_SUBST(MYSQL_DEP)
AC_SUBST(INSTALL_DIR)
AC_SUBST(PLATFORM)
AC_SUBST(GEOIP_TARGET)
AC_SUBST(USE_LICENSE)
AC_SUBST(PIC)
AC_SUBST(HERE)
AC_SUBST(NDPI_LIB)
AC_SUBST(NDPI_INC)
AC_SUBST(LICENSELIBS)
AC_SUBST(PCAPLIBS)
AC_SUBST(PFRINGLIBS)
AC_SUBST(NT_INC)
AC_SUBST(NT_LIB)
AC_SUBST(N2DISKNT)
AC_SUBST(LIBRT)
AC_SUBST(LIBNUMA)
AC_SUBST(N2DISK_PACKAGE_VERSION)
AC_SUBST(PACKAGE_VERSION)
AC_SUBST(GEOIP_LIB)
AC_SUBST(BITS)
AC_SUBST(PFRING_SVN_RELEASE)
AC_SUBST(PFRING_VERSION)
AC_SUBST(TODAY)
AC_SUBST(NOW)
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([utils/Makefile])
AC_CONFIG_FILES([packages/lprobe.spec])
AC_CONFIG_FILES([packages/n2disk.spec])
AC_CONFIG_FILES([packages/n2disknt.spec])
AC_CONFIG_FILES([private/n2disk_version.h])
dnl> Use plugins/Makefile if you enable plugins
if test -d "./plugins"; then
AC_CONFIG_FILES([plugins/Makefile])
fi
dnl> Create private/ Makefile if available
if test -d "./private" ; then
# echo below needed to avoid failing if private/ is missing
echo ""
AC_CONFIG_FILES([private/Makefile])
fi
AC_OUTPUT()
if test ".${HAVE_ARM}" != .0; then
\rm -f libtool
cp libtool.arm libtool
echo "Using custom libtool for the ARM platform"
else
\/bin/rm -f libtool
ln -s $LIBTOOL_PATH libtool
fi
dnl>
dnl> versioning
dnl>
echo "creating version.c"
/bin/rm -f version.c
echo $PACKAGE_VERSION | sed -e 's/.*/char * version = "&";/' > version.c
./config.guess | sed -e 's/.*/char * osName = "&";/' >> version.c
echo "unsigned int compile_time = 1394119422;" >> version.c
if test ".${HAS_WARNING}" = ".yes"; then
echo "*"
echo "*>>>> A WARNING message was generated - please review the"
echo "*>>>> output before continuing to make lprobe!"
fi
echo "
This is your $PACKAGE_NAME $PACKAGE_VERSION configuration:
Host System Type : ${host} (${PLATFORM})
Compiler (cflags) : ${CC} ${CFLAGS} ${DEFS}
Include path : ${INCS}
System Libs : ${LDFLAGS} ${LIBS}
Core Libs : ${CORELIBS}
Additional Libs : ${MORELIBS}
libpcap in : ${PCAP_ROOT}
Install path : ${prefix}
Now type 'make' or 'gmake' (GNU make) on *BSD and Solaris
systems to build $PACKAGE $VERSION.
"
if test ".${GEOIP_DEP}" != ""; then
echo "
IMPORTANT
Please type 'make datfiles' in order to download the data file
necessary for geolocation.
"
fi
exit 0