forked from tbarbette/fastclick
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.in
2599 lines (2116 loc) · 89.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
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
dnl -*- mode: shell-script -*-
dnl Process this file with autoconf to produce a configure script.
dnl
dnl Permission is hereby granted, free of charge, to any person obtaining a
dnl copy of this software and associated documentation files (the "Software"),
dnl to deal in the Software without restriction, subject to the conditions
dnl listed in the Click LICENSE file. These conditions include: you must
dnl preserve this copyright notice, and you cannot mention the copyright
dnl holders in advertising related to the Software without their permission.
dnl The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. This
dnl notice is a summary of the Click LICENSE file; the license in that file is
dnl legally binding.
AC_INIT([click], [2.1])
AC_PREREQ(2.60)
AC_CONFIG_HEADERS([include/click/config.h:config.h.in], [echo > stamp-h])
AC_CONFIG_HEADERS([include/click/pathvars.h:pathvars.h.in])
AC_CONFIG_HEADERS([include/click/config-bsdmodule.h:config-bsdmodule.h.in include/click/config-linuxmodule.h:config-linuxmodule.h.in include/click/config-ns.h:config-ns.h.in include/click/config-userlevel.h:config-userlevel.h.in include/click/config-minios.h:config-minios.h.in])
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([bin/click-buildtool:click-buildtool.in], [chmod +x bin/click-buildtool])
AC_CONFIG_FILES([bin/click-compile:click-compile.in], [chmod +x bin/click-compile])
AC_CONFIG_FILES([installch], [chmod +x installch])
AC_CONFIG_FILES([share/click/config.mk:config.mk.in share/click/pkg-config.mk])
AC_CONFIG_FILES([doc/Makefile etc/libclick/Makefile tools/Makefile tools/lib/Makefile])
AC_CONFIG_SRCDIR([click-buildtool.in])
ac_user_cxx=${CXX+y}
CLICK_VERSION=$PACKAGE_VERSION
dnl NB a real tab character!
tabchar=' '
AC_SUBST(ac_configure_args)
AC_DEFINE_UNQUOTED([CLICK_VERSION], ["$CLICK_VERSION"])
AC_SUBST(CLICK_VERSION)
click_version_code_in=`echo "$CLICK_VERSION" | sed -e 's/[[a-z]].*//' | sed -e 's/$/.0/' | tr . , | sed -e 's/^\([[0-9]]*,[[0-9]]*,[[0-9]]\).*/\1/'`
AC_DEFINE_UNQUOTED([CLICK_VERSION_CODE], [CLICK_MAKE_VERSION_CODE($click_version_code_in)])
CLICK_INIT('$(top_srcdir)')
dnl support for cross compiling
AC_CANONICAL_SYSTEM
dnl This is wrong!!
AC_CHECK_TOOL(CC, gcc)
AC_CHECK_TOOL(CXX, g++)
CLICK_PROG_CC
AC_PROG_CPP
AC_C_INLINE
CLICK_PROG_CXX
AC_PROG_CXXCPP
AC_TRY_RUN([#include <new>
int main() {
std::size_t sz = 8;
std::align_val_t al{64};
void* a = operator new(sz,al);
return (a == nullptr?1:0);
}],AC_DEFINE([HAVE_ALIGNED_NEW]))
CLICK_PROG_KERNEL_CC
CLICK_PROG_KERNEL_CXX
ac_preset_ar="$AR"
AC_CHECK_TOOL(AR, ar)
AC_CHECK_TOOL(LD, ld)
AC_CHECK_TOOL(NM, nm)
AC_CHECK_TOOL(OBJCOPY, objcopy)
AC_CHECK_TOOL(RANLIB, ranlib, :)
AC_CHECK_TOOL(STRIP, strip, :)
conf_auxdir='$(top_srcdir)'
AC_SUBST(conf_auxdir)
test -z "$AR_CREATEFLAGS" && AR_CREATEFLAGS=cru
AC_SUBST(AR_CREATEFLAGS)
dnl
dnl drivers
dnl
dnl userlevel driver and features
AC_ARG_ENABLE([userlevel],
[AS_HELP_STRING([--disable-userlevel], [disable user-level driver])],
[:], [enable_userlevel=yes])
AC_ARG_ENABLE([user-multithread],
[AS_HELP_STRING([ --enable-user-multithread], [support userlevel multithreading])],
[:], [enable_user_multithread=no])
AC_ARG_ENABLE([fullpush-nonatomic],
[AS_HELP_STRING([ --disable-fullpush-nonatomic], [disable nonatomic access to packet when single-threaded fullpush context is detected])],
[:], [enable_fullpush_nonatomic=yes])
if test "x$enable_fullpush_nonatomic" = "xyes"; then
AC_DEFINE([HAVE_FULLPUSH_NONATOMIC])
fi
AC_ARG_ENABLE([batch],
[AS_HELP_STRING([ --disable-batch], [disable batching support])],
[:], [enable_batch=$enable_userlevel])
if test "x$enable_batch" = "xyes"; then
if test "x$enable_userlevel" != "xyes"; then
AC_MSG_ERROR([
=========================================
--enable-batch requires --enable-userlevel which was not provided.
=========================================])
fi
AC_DEFINE([HAVE_BATCH])
AC_SUBST(HAVE_BATCH, yes)
fi
AC_ARG_ENABLE([verbose-batch],
[AS_HELP_STRING([ --disable-verbose-batch], [disable warnings and information about batching])],
[:], [enable_verbose_batch=yes])
if test "x$enable_verbose_batch" = "xyes"; then
AC_DEFINE([HAVE_VERBOSE_BATCH])
fi
AC_ARG_ENABLE([auto-batch],
[AS_HELP_STRING([ --enable-auto-batch=[[list|jump|port]]], [make vanilla elements batch-compatible automatically])],
[:], [enable_auto_batch=no])
if test "x$enable_auto_batch" = "xno" ; then
:
elif test "x$enable_auto_batch" = "xyes" -o "x$enable_auto_batch" = "xport"; then
AC_DEFINE([HAVE_AUTO_BATCH],[AUTO_BATCH_PORT], [Define if make vanilla elements batch-compatible automatically])
elif test "x$enable_auto_batch" = "xlist"; then
AC_DEFINE([HAVE_AUTO_BATCH],[AUTO_BATCH_LIST], [Define if make vanilla elements batch-compatible automatically])
elif test "x$enable_auto_batch" = "xjump"; then
AC_DEFINE([HAVE_AUTO_BATCH],[AUTO_BATCH_JUMP], [Define if make vanilla elements batch-compatible automatically])
else
AC_MSG_ERROR([
=========================================
--enable-auto-batch only accepts jump, list or port as modes
=========================================])
fi
AC_ARG_ENABLE([netmap-pool],
[AS_HELP_STRING([ --enable-netmap-pool], [use netmap buffers instead of standard Click buffers])],
[:], [enable_netmap_pool=no])
PTHREAD_LIBS=""
AC_SUBST(PTHREAD_LIBS)
if test "x$enable_user_multithread" = xyes; then
SAVE_LIBS="$LIBS"
AC_SEARCH_LIBS([pthread_create], [pthread], [ac_have_libpthread=yes], [ac_have_libpthread=no])
AC_CHECK_HEADERS([pthread.h], [ac_have_pthread_h=yes], [ac_have_pthread_h=no])
if test "$ac_have_libpthread$ac_have_pthread_h" = yesyes; then
AC_DEFINE([HAVE_USER_MULTITHREAD])
AC_CHECK_DECLS([pthread_setaffinity_np], [], [], [#define _GNU_SOURCE
#include <pthread.h>])
if echo "$LIBS" | grep -e -lpthread >/dev/null 2>&1; then
PTHREAD_LIBS="-lpthread"
fi
else
AC_MSG_ERROR([
=========================================
Can't find -lpthread and/or <pthread.h>, so I can't compile with
--enable-user-multithread.
=========================================])
fi
LIBS="$SAVE_LIBS"
fi
save_cpp="$CPPFLAGS"
save_libs="$LIBS"
CPPFLAGS="$CPPFLAGS -I/usr/local/include/mbglib/"
LIBS="$LIBS -lmbgdevio"
AC_SEARCH_LIBS([mbg_open_device], [mbgdevio], [ac_have_libmbdevio=yes], [ac_have_libmbdevio=no])
AC_CHECK_HEADERS([mbgdevio.h], [ac_have_mbgdevio_h=yes], [ac_have_mbgdevio_h=no])
#if test "$ac_have_libpthread$ac_have_pthread_h" = yesyes; then
if test "$ac_have_mbgdevio_h" = yes; then
AC_DEFINE([HAVE_MBGLIB])
else
CPPFLAGS="$save_cpp"
LIBS="$save_libs"
fi
AC_SEARCH_LIBS([MHD_start_daemon], [microhttpd], [ac_have_libmicrohttpd=yes], [ac_have_libmicrohttpd=no])
AC_CHECK_HEADERS([microhttpd.h], [ac_have_microhttpd_h=yes], [ac_have_microhttpd_h=no])
if test "x$ac_have_libmicrohttpd$ac_have_microhttpd_h" = "xyesyes"; then
have_httpd=yes
AC_DEFINE([HAVE_MICROHTTPD])
else
have_httpd=no
fi
AC_CHECK_LIB([re2], [main], [ac_have_re2=yes], [ac_have_re2=no])
AC_CHECK_HEADERS([re2/re2.h], [ac_have_re2_h=yes], [ac_have_re2_h=no])
if test "x$ac_have_re2$ac_have_re2_h" = "xyesyes"; then
have_re2=yes
LIBS="$LIBS -lre2"
AC_DEFINE([HAVE_RE2])
else
have_re2=no
fi
AC_CHECK_LIB([hs], [hs_compile_multi], [ac_have_hyperscan=yes], [ac_have_hyperscan=no])
AC_CHECK_HEADERS([hs/hs.h], [ac_have_hyperscan_h=yes], [ac_have_hyperscan_h=no])
if test "x$ac_have_hyperscan$ac_have_hyperscan_h" = "xyesyes"; then
have_hyperscan=yes
LIBS="$LIBS -lhs"
AC_DEFINE([HAVE_HYPERSCAN])
else
have_hyperscan=no
fi
AC_ARG_ENABLE([json],
[AS_HELP_STRING([ --enable-json], [enable JSON support])],
[:], [enable_json=no])
if test "x$enable_json" = "xyes"; then
have_json=yes
AC_DEFINE([HAVE_JSON])
else
have_json=no
fi
AC_CHECK_LIB([pci], [main], [ac_have_pci=yes], [ac_have_pci=no])
AC_CHECK_HEADERS([pci/pci.h], [ac_have_pci_h=yes], [ac_have_pci_h=no])
if test "x$ac_have_pci$ac_have_pci_h" = "xyesyes"; then
have_pci=yes
LIBS="$LIBS -lpci"
AC_DEFINE([HAVE_PCI])
else
have_pci=no
fi
AC_ARG_ENABLE([select],
[AS_HELP_STRING([ --enable-select=[[select|poll|kqueue]]], [set file descriptor wait mechanism])
AS_HELP_STRING([ --disable-select], [do not use select()])],
[:], [enable_select="select poll kqueue"])
AC_ARG_ENABLE([poll],
[AS_HELP_STRING([ --disable-poll], [do not use poll()])],
[:], [enable_poll=yes])
AC_ARG_ENABLE([kqueue],
[AS_HELP_STRING([ --disable-kqueue], [do not use kqueue()])],
[:], [enable_kqueue=yes])
if test "$enable_select" = yes; then
enable_select='select poll kqueue'
elif test "$enable_select" = no; then
enable_select='poll kqueue'
fi
if echo "$enable_select" | grep select >/dev/null 2>&1; then
AC_DEFINE([HAVE_ALLOW_SELECT], [1], [Define if select() may be used to wait for file descriptor events.])
fi
if echo "$enable_select" | grep poll >/dev/null 2>&1 && test "$enable_poll" = yes; then
AC_DEFINE([HAVE_ALLOW_POLL], [1], [Define if poll() may be used to wait for file descriptor events.])
fi
if echo "$enable_select" | grep kqueue >/dev/null 2>&1 && test "$enable_kqueue" = yes; then
AC_DEFINE([HAVE_ALLOW_KQUEUE], [1], [Define if kqueue() may be used to wait for file descriptor events.])
fi
AC_ARG_ENABLE([xdp],
[AS_HELP_STRING([ --enable-xdp], [use XDP])],
[:], [enable_xdp=yes])
if test "x$enable_xdp" = "xyes"; then
AC_SUBST(USE_XDP, yes)
LIBS="$LIBS -lbpf"
fi
AC_ARG_ENABLE([dpdk],
[AS_HELP_STRING([ --enable-dpdk], [use DPDK])],
[:], [enable_dpdk=no])
AC_ARG_ENABLE([dpdk-pool],
[AS_HELP_STRING([ --enable-dpdk-pool], [use DPDK buffer instead of standard Click buffer])],
[:], [enable_dpdk_pool=no])
AC_ARG_ENABLE([dpdk-packet],
[AS_HELP_STRING([ --enable-dpdk-packet],
[Click packets are DPDK packet])],
[:], [enable_dpdk_packet=no])
if test "x$enable_dpdk" = "xyes"; then
AC_MSG_CHECKING([for DPDK library])
if test -z "$RTE_SDK_BIN"; then
RTE_SDK_BIN=$RTE_SDK/$RTE_TARGET
fi
if test ! -d "$RTE_SDK_BIN"; then
RTE_SDK_BIN=$RTE_SDK/build/
fi
if test -z "$RTE_LIBNAME"; then
RTE_LIBNAME=dpdk
fi
if test -z "$RTE_SRCDIR"; then
RTE_SRCDIR=$RTE_SDK
fi
if test "x$enable_user_multithread" != "xyes"; then
AC_MSG_ERROR([
=========================================
--enable-dpdk requires --enable-user-multithread which was not provided.
=========================================])
fi
if pkg-config --exists libdpdk ; then
RTE_LIB=pkg-config --variable=libdir libdpdk
else
RTE_LIB="$RTE_SDK_BIN/lib"
if test ! -f "$RTE_SDK_BIN/include/rte_eal.h"; then
AC_MSG_ERROR([
=========================================
Cannot find \$RTE_SDK_BIN/include/rte_eal.h for DPDK.
Define \$RTE_SDK and \$RTE_TARGET as per DPDK documentation,
or install DPDK using meson, or the system package manager.
=========================================])
fi
AC_MSG_RESULT([yes, found at $RTE_SDK_BIN])
if test -e "$RTE_SRCDIR/VERSION"; then
rte_ver_year=`cat $RTE_SRCDIR/VERSION | sed -e 's/-rc/.-rc./' -e 's/$/..99/' | awk -F '.' '{print int($1)}'`
rte_ver_month=`cat $RTE_SRCDIR/VERSION | sed -e 's/-rc/.-rc./' -e 's/$/..99/' | awk -F '.' '{print int($2)}'`
rte_ver_minor=`cat $RTE_SRCDIR/VERSION | sed -e 's/-rc/.-rc./' -e 's/$/..99/' | awk -F '.' '{print int($3)}'`
else
if grep "#define RTE_VER_MAJOR" "$RTE_SDK_BIN/include/rte_config.h" &> /dev/null ; then
verfile=rte_config
else
verfile=rte_version
fi
rte_ver_major=`grep "#define RTE_VER_MAJOR" "$RTE_SDK_BIN/include/$verfile.h" | head -n 1 | awk '{print $3}'`
rte_ver_minor=`grep "#define RTE_VER_MINOR" "$RTE_SDK_BIN/include/$verfile.h" | head -n 1 | awk '{print $3}'`
rte_ver_year=`grep "#define RTE_VER_YEAR" "$RTE_SDK_BIN/include/$verfile.h" | head -n 1 | awk '{print $3}'`
rte_ver_month=`grep "#define RTE_VER_MONTH" "$RTE_SDK_BIN/include/$verfile.h" | head -n 1 | awk '{print $3}'`
fi
AC_SUBST(RTE_SDK)
AC_SUBST(RTE_TARGET)
AC_SUBST(RTE_SDK_BIN)
AC_SUBST(RTE_VER_MAJOR, $rte_ver_major)
AC_SUBST(RTE_VER_MINOR, $rte_ver_minor)
AC_SUBST(RTE_VER_YEAR, $rte_ver_year)
AC_SUBST(RTE_VER_MONTH, $rte_ver_month)
AC_SUBST(DPDK_INCLUDES, -I${RTE_SDK_BIN}/include/)
AC_MSG_CHECKING([whether DPDK has rte_eth_read_clock])
if readelf -Ws "$RTE_LIB/librte_ethdev.a" | grep rte_eth_read_clock &> /dev/null ; then
AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_DPDK_READ_CLOCK])
else
AC_MSG_RESULT([no])
fi
fi
AC_DEFINE([HAVE_DPDK])
AC_SUBST(USE_DPDK, yes)
fi
if test "x$enable_dpdk_pool" = "xyes"; then
if test "x$enable_dpdk" != "xyes"; then
AC_MSG_ERROR([
=========================================
--enable-dpdk-pool requires --enable-dpdk which was not provided.
=========================================])
fi
AC_DEFINE([HAVE_DPDK_PACKET_POOL])
fi
if test "x$enable_dpdk_packet" = "xyes"; then
if test "x$enable_dpdk" != "xyes"; then
AC_MSG_ERROR([
=========================================
--enable-dpdk-packet requires --enable-dpdk which was not provided.
=========================================])
fi
AC_DEFINE([CLICK_PACKET_USE_DPDK])
fi
AC_ARG_ENABLE([zerocopy],
[AS_HELP_STRING([ --disable-zerocopy], [disable Zero Copy])],
[:], [enable_zerocopy=yes])
if test "x$enable_zerocopy" = xyes; then
AC_DEFINE(HAVE_ZEROCOPY)
fi
dnl linuxmodule driver and features
AC_ARG_ENABLE([linuxmodule],
[AS_HELP_STRING([--disable-linuxmodule], [disable Linux kernel driver])],
[:], [enable_linuxmodule=yes; enable_linuxmodule_default=yes])
AC_ARG_ENABLE([fixincludes],
[AS_HELP_STRING([ --disable-fixincludes], [do not patch Linux kernel headers for C++])],
[:], [enable_fixincludes=yes])
LINUXMODULE_FIXINCLUDES=
if test "$enable_fixincludes" = yes; then
LINUXMODULE_FIXINCLUDES=1
fi
AC_SUBST(LINUXMODULE_FIXINCLUDES)
AC_ARG_ENABLE([multithread],
[AS_HELP_STRING([ --enable-multithread], [support kernel multithreading])],
[:], [enable_multithread=no])
if test "$enable_multithread" != no -a "$enable_multithread" != 1; then
AC_DEFINE_UNQUOTED(__MTCLICK__, 1)
AC_DEFINE_UNQUOTED(HAVE_LINUXMODULE_MULTITHREAD, 1)
saveflags="$CPPFLAGS"
CPPFLAGS="$saveflags -D__MTCLICK__"
else
enable_multithread=no
fi
AC_ARG_ENABLE([warp9],
[AS_HELP_STRING([ --enable-warp9], [reduce PollDevice functionality for speed])],
[:], [enable_warp9=no])
if test "x$enable_warp9" = xyes; then
AC_DEFINE(CLICK_WARP9)
fi
AC_DEFINE(HAVE_CLICKFS)
AC_ARG_ENABLE([kassert],
[AS_HELP_STRING([ --enable-kassert], [enable kernel assertions])],
[:], [enable_kassert=no])
if test $enable_kassert = yes; then
AC_DEFINE(HAVE_KERNEL_ASSERT)
fi
AC_ARG_ENABLE([adaptive],
[AS_HELP_STRING([ --enable-adaptive], [use adaptive scheduler to flexibly arbitrate
between Click and the kernel (EXPERIMENTAL)])],
[:], [enable_adaptive=no])
if test "x$enable_adaptive" = xyes; then
AC_DEFINE(HAVE_ADAPTIVE_SCHEDULER)
fi
AC_ARG_ENABLE([linux-symbols],
[AS_HELP_STRING([ --disable-linux-symbols], [do not export Click symbols (breaks packages)])],
[:], [enable_linux_symbols=yes])
INCLUDE_KSYMS=no
if test "x$enable_linux_symbols" = xyes; then
INCLUDE_KSYMS=yes
fi
AC_SUBST(INCLUDE_KSYMS)
dnl bsdmodule driver and features
AC_ARG_ENABLE([bsdmodule],
[AS_HELP_STRING([--enable-bsdmodule], [enable FreeBSD kernel driver (EXPERIMENTAL)])],
[:], [enable_bsdmodule=no])
AC_ARG_ENABLE([netisr],
[AS_HELP_STRING([ --disable-netisr], [disable NETISR scheduling in BSD])],
[:], [enable_netisr=yes])
if test $enable_netisr = yes; then
AC_DEFINE(BSD_NETISRSCHED)
fi
dnl nsclick driver and features
AC_ARG_ENABLE([nsclick],
[AS_HELP_STRING([--enable-nsclick], [enable NS simulator driver])],
[:], [enable_nsclick=no])
dnl minios driver
AC_ARG_ENABLE([minios],
[AS_HELP_STRING([--enable-minios], [enable MiniOS application])],
[:], [enable_minios=no])
AC_ARG_WITH([xen],
[AS_HELP_STRING([[--with-xen[=PATH]]], [Xen source code is in PATH])],
[xenpath=$withval], [xenpath=NONE])
AC_ARG_WITH([minios],
[AS_HELP_STRING([[--with-minios[=PATH]]], [MiniOS source code is in PATH])],
[miniospath=$withval], [miniospath=NONE])
AC_ARG_WITH([newlib],
[AS_HELP_STRING([[--with-newlib[=PATH]]], [Newlib is installed in PATH])],
[newlibpath=$withval], [newlibpath=NONE])
AC_ARG_WITH([lwip],
[AS_HELP_STRING([[--with-lwip[=PATH]]], [Lwip is installed in PATH])],
[lwippath=$withval], [lwippath=NONE])
if test "$enable_minios" = yes; then
if test "$xenpath" = NONE; then
xenpath="../xen"
fi
if test "$miniospath" = NONE; then
miniospath="../mini-os"
fi
if test "$newlibpath" = NONE; then
newlibpath="../toolchain/x86_64-root/x86_64-xen-elf"
fi
if test "$lwippath" = NONE; then
lwippath="../toolchain/x86_64-root/x86_64-xen-elf"
fi
xenpath="`readlink -f $xenpath`"
if test ! -d "$xenpath"; then
AC_MSG_ERROR([
=========================================
Can't find $xenpath, so I can't compile the minios driver!
(You may need the --with-xen=DIR option.)
=========================================])
fi
miniospath="`readlink -f $miniospath`"
if test ! -d "$miniospath"; then
AC_MSG_ERROR([
=========================================
Can't find $miniospath, so I can't compile the minios driver!
(You may need the --with-minios=DIR option.)
=========================================])
fi
newlibpath="`readlink -f $newlibpath`"
if test ! -d "$newlibpath"; then
AC_MSG_ERROR([
=========================================
Can't find $newlibpath, so I can't compile the minios driver!
(You may need the --with-newlib=DIR option.)
=========================================])
fi
lwippath="`readlink -f $lwippath`"
if test ! -d "$lwippath"; then
AC_MSG_ERROR([
=========================================
Can't find $lwippath, so I can't compile the minios driver!
(You may need the --with-lwip=DIR option.)
=========================================])
fi
xen_dir=$xenpath
AC_SUBST(xen_dir)
minios_dir=$miniospath
AC_SUBST(minios_dir)
newlib_dir=$newlibpath
AC_SUBST(newlib_dir)
lwip_dir=$lwippath
AC_SUBST(lwip_dir)
fi
dnl
dnl How to build linuxmodule driver?
dnl
AC_ARG_WITH([linux],
[AS_HELP_STRING([[--with-linux[=PATH]]], [Linux source code is in PATH])],
[linuxpath=$withval], [linuxpath=NONE])
test -z "$linuxpath" -o "$linuxpath" = yes && linuxpath=yes
AC_ARG_WITH([linux-map],
[AS_HELP_STRING([[--with-linux-map[=FILE]]], [filename for Linux System.map [LINUXDIR/System.map]])],
[linux_system_map=$withval; if test -z "$withval" -o "$withval" = yes; then linux_system_map=NONE; fi],
[linux_system_map=NONE])
linux_system_map_boot=no
if test "x$linuxpath" = xNONE -o "x$linuxpath" = xyes; then
if uname -r 2>/dev/null | grep '^\(2\.6\|3\.\)' >/dev/null 2>&1; then
linuxpath=/lib/modules/"`uname -r`"/build
linux_system_map_boot="`uname -r`"
else
linuxpath=/usr/src/linux
fi
if test ! -d "$linuxpath" -a "x$enable_linuxmodule" = xyes; then
if test "x$enable_linuxmodule_default" = xyes; then
linuxpath=NONE; enable_linuxmodule=no
else
AC_MSG_ERROR([
=========================================
Can't find $linuxpath, so I can't compile the linuxmodule driver!
(You may need the --with-linux=DIR option.)
=========================================])
fi
fi
fi
dnl find files in the Linux path
find_linuxpath () {
path="$linuxpath"
while test -n "$path"; do
l=`echo "$path" | sed 's/^\([[^:]]*\).*/\1/'`
path=`echo "$path" | sed 's/^[[^:]]*:*//'`
if test -n "$l" -a -f "$l/$1"; then
echo "$l/$1"
return
fi
done
echo "/nonexistent_file"
}
if test "x$linuxpath" = xNONE -o "x$linuxpath" = xno -o "x$enable_linuxmodule" != xyes; then
ac_have_linux_kernel=n
linuxpath=NONE
linux_srcdir=NONE
linux_builddir=NONE
else
dnl check $linuxpath for relative directories
path="$linuxpath"
while test -n "$path"; do
l=`echo "$path" | sed 's/^\([[^:]]*\).*/\1/'`
path=`echo "$path" | sed 's/^[[^>]]*:*//'`
if test -n "$l" && expr "_$l" : '_[[^/\\]]' >/dev/null; then
AC_MSG_ERROR([
=========================================
The --with-linux directory $l is relative.
All Linux directories must be absolute paths starting with /.
=========================================])
fi
done
linux_skbuff_h=`find_linuxpath include/linux/skbuff.h`
if test -r "$linux_skbuff_h"; then
linux_srcdir=`echo "$linux_skbuff_h" | sed 's_include/linux/skbuff\.h__'`
ac_have_linux_kernel=y
else
AC_MSG_ERROR([
=========================================
Can't find include/linux/skbuff.h in $linuxpath.
Are you sure $linuxpath contains Linux kernel source?
=========================================])
dnl ' fix syntax highlighting
fi
linux_config=`find_linuxpath .config`
if test -r "$linux_config"; then
linux_builddir=`echo "$linux_config" | sed 's_/\.config__'`
else
AC_MSG_ERROR([
=========================================
Can't find .config in $linuxpath.
Are you sure $linuxpath contains a Linux kernel build?
=========================================])
dnl ' fix syntax highlighting
fi
fi
AC_SUBST(linux_builddir)
AC_SUBST(linux_srcdir)
AC_DEFINE_UNQUOTED(LINUX_SRCDIR, "${linux_srcdir}")
dnl
dnl element collections
dnl
AC_ARG_ENABLE([all-elements], [AS_HELP_STRING([--enable-all-elements], [include all provided element groups])])
dnl ELEMENTS_ARG_ENABLE(COLLECTION, HELP-STRING, DEFAULT-VALUE)
element_groups=""
AC_SUBST(element_groups)
AC_DEFUN([ELEMENTS_ARG_ENABLE],
[AC_ARG_ENABLE($1, [ --]builtin(substr, builtin(ifelse, [$3], yes, dis, en)[able-$1 ], 0, 21)[ ]builtin(ifelse, [$3], yes, [do not ], [])[$2], ,
[enable_]patsubst([$1], -, _)=$3)dnl
test "x$enable_all_elements" = xyes -a \( ["x$enable_]patsubst([$1], -, _)["] = xNO -o ["x$enable_]patsubst([$1], -, _)["] = x \) && [enable_]patsubst([$1], -, _)[=yes]
if test ["x$enable_]patsubst([$1], -, _)["] = xyes; then
:
$4
fi])
ELEMENTS_ARG_ENABLE(analysis, [include elements for network analysis], yes)
ELEMENTS_ARG_ENABLE(app, [include application-level elements], yes)
ELEMENTS_ARG_ENABLE(aqm, [include active queue management elements], yes)
ELEMENTS_ARG_ENABLE(ethernet, [include Ethernet elements], yes)
ELEMENTS_ARG_ENABLE(etherswitch, [include Ethernet switch elements], NO)
ELEMENTS_ARG_ENABLE(flow, [include Enable flow system and elements], NO)
ELEMENTS_ARG_ENABLE(grid, [include Grid elements (see FAQ)], NO)
ELEMENTS_ARG_ENABLE(icmp, [include ICMP elements], yes)
ELEMENTS_ARG_ENABLE(ip, [include IP elements], yes)
ELEMENTS_ARG_ENABLE(ip6, [include IPv6 elements], NO, AC_DEFINE(HAVE_IP6))
ELEMENTS_ARG_ENABLE(ipsec, [include IP security elements], NO, AC_DEFINE(HAVE_IPSEC))
ELEMENTS_ARG_ENABLE(json, [include JSON helpers], NO, AC_DEFINE(HAVE_JSON))
ELEMENTS_ARG_ENABLE(local, [include local elements], NO)
ELEMENTS_ARG_ENABLE(radio, [include radio elements], NO)
ELEMENTS_ARG_ENABLE(research, [include research elements], NO)
ELEMENTS_ARG_ENABLE(simple, [include simple versions of other elements], yes)
dnl ELEMENTS_ARG_ENABLE(snmp, [include SNMP elements], NO)
ELEMENTS_ARG_ENABLE(standard, [include standard elements], yes)
ELEMENTS_ARG_ENABLE(tcpudp, [include TCP and UDP elements], yes)
ELEMENTS_ARG_ENABLE(test, [include regression test elements], yes)
ELEMENTS_ARG_ENABLE(threads, [include thread management elements], yes)
ELEMENTS_ARG_ENABLE(tunnel, [include tunnelling elements], NO)
ELEMENTS_ARG_ENABLE(wifi, [include wifi elements and support], NO)
AC_ARG_ENABLE(experimental, [AS_HELP_STRING([--enable-experimental], [enable experimental elements in normal groups])], :, enable_experimental=no)
AC_ARG_ENABLE(skip-elements, [AS_HELP_STRING([--enable-skip-elements=ELTS], [disable comma-separated elements])], :, enable_skip_elements=no)
all_element_groups=
for i in `(cd $srcdir/elements; ls | sed '/^CVS$/d;/^\.git/d;/^bsdmodule$/d;/^linuxmodule$/d;/^ns$/d;/^userlevel$/d;/^minios$/d')`; do
enableval=`eval 'echo $'"enable_$i"`
test "x$enable_all_elements" = xyes -a "x$enableval" '!=' xno && enableval=yes
test -d "$srcdir/elements/$i" -a "$enableval" = "yes" && element_groups="$element_groups $i"
test -d "$srcdir/elements/$i" && all_element_groups="$all_element_groups$i "
done
AC_SUBST([all_element_groups])
FINDELEMFLAGS=
if test "x$enable_skip_elements" != xno -a "x$enable_skip_elements" != xyes; then
FINDELEMFLAGS="-x '$enable_skip_elements'"
fi
AC_SUBST([FINDELEMFLAGS])
dnl
dnl How to build bsdmodule driver?
dnl
AC_ARG_WITH(freebsd, [[ --with-freebsd[=SRC,INC] FreeBSD source code is in SRC [/usr/src/sys],
include directory is INC [/usr/include]]],
[freebsddir=$withval; if test -z "$withval" -o "$withval" = yes; then freebsddir=/usr/src/sys,/usr/include; fi],
freebsddir=NONE)
if test "x$freebsddir" = xNONE; then
if test -d /usr/src/sys -a -d /usr/include; then
freebsddir=/usr/src/sys,/usr/include
elif test "x$enable_bsdmodule" = xyes; then
AC_MSG_WARN([
=========================================
Can't find /usr/src/sys and/or /usr/include, so I'm not compiling
the bsdmodule driver. (You may need the --with-freebsd=DIR option.)
=========================================])
fi
fi
freebsd_srcdir=`echo "$freebsddir," | sed -e 's/,.*//'`
freebsd_includedir=`echo "$freebsddir,/usr/include," | sed -e 's/^[[^,]]*,\([[^,]]*\),.*$/\1/'`
if test "x$freebsddir" = xNONE -o "x$freebsddir" = xno -o "x$enable_bsdmodule" != xyes; then
ac_have_bsd_kernel=n
freebsddir=NONE
elif expr '(' "_$freebsd_includedir" : '_[[^/\\]]' ')' '|' '(' "_$freebsd_srcdir" : '_[[^/\\]]' ')'; then
AC_MSG_ERROR([
=========================================
The --with-freebsd directories $freebsd_srcdir,$freebsd_includedir
are relative. You must supply absolute paths starting with /.
=========================================])
elif test -r $freebsd_includedir/net/if_var.h -a -r $freebsd_srcdir/kern/vnode_if.src; then
ac_have_bsd_kernel=y
else
AC_MSG_ERROR([
=========================================
Can't find $freebsd_includedir/net/if_var.h and/or
$freebsd_srcdir/kern/vnode_if.src. Are you sure $freebsd_srcdir
and $freebsd_includedir contain FreeBSD kernel source?
=========================================])
dnl ' fix syntax highlighting
fi
AC_SUBST(freebsd_srcdir)
AC_SUBST(freebsd_includedir)
AC_DEFINE_UNQUOTED(FREEBSD_INCLUDEDIR, "${freebsd_includedir}")
dnl
dnl check whether target is Linux
dnl
AC_CACHE_CHECK([whether we are compiling for Linux], [ac_cv_under_linux],
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[#ifndef __linux__
#error "fuckers! fuckers!"
#endif
return 0;]])], ac_cv_under_linux=yes, ac_cv_under_linux=no)])
dnl
dnl functions
dnl
AC_LANG_C
AC_REPLACE_FUNCS(strerror)
AC_CHECK_FUNCS(random snprintf strnlen strtof strtold strtoul tcgetpgrp vsnprintf aligned_alloc)
AC_LANG_CPLUSPLUS
dnl
dnl integer types, endianness, int64, addressable va_list
dnl
AC_ARG_ENABLE([smaller-code],
[AS_HELP_STRING([--enable-smaller-code], [generate smaller code (sometimes slower)])],
[:], [enable_smaller_code=no])
if test "x$enable_smaller_code" = xyes; then
AC_DEFINE([CLICK_OPTIMIZE_SIZE], [1], [Define to generate smaller object files.])
fi
AC_ARG_ENABLE([int64],
[AS_HELP_STRING([--disable-int64], [disable 64-bit integer support])],
[:], [enable_int64=yes])
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(size_t)
AC_CHECK_SIZEOF(ptrdiff_t)
AC_CHECK_SIZEOF([void *])
CLICK_CHECK_INTEGER_TYPES
CLICK_CHECK_ALIGNMENT
if test "x$enable_int64" = xyes; then
AC_CHECK_SIZEOF([long long])
CLICK_CHECK_INT64_TYPES
fi
CLICK_CHECK_ENDIAN
CLICK_CHECK_SIGNED_SHIFT
CLICK_CHECK_ADDRESSABLE_VA_LIST
CLICK_CHECK_COMPILER_INTRINSICS
dnl
dnl timestamps
dnl
AC_CHECK_HEADERS_ONCE([time.h])
AC_CHECK_SIZEOF([struct timeval])
AC_CHECK_TYPES([struct timespec], [have_timespec=yes], [have_timespec=no],
[AC_INCLUDES_DEFAULT
[#ifdef HAVE_TIME_H]
[# include <time.h>]
[#endif]])
if test "x$have_timespec" = xyes; then
AC_CHECK_SIZEOF([struct timespec])
fi
CLICK_CHECK_POSIX_CLOCKS
AC_ARG_ENABLE([nanotimestamp],
[AS_HELP_STRING([--enable-nanotimestamp], [enable nanosecond timestamps])])
# Default to nanosecond-precision timestamps if clock_gettime is available.
if test "x$enable_nanotimestamp" = x -a "x$have_clock_gettime" = xyes; then
enable_nanotimestamp=yes
fi
if test "x$enable_nanotimestamp" = xyes; then
AC_DEFINE([HAVE_NANOTIMESTAMP_ENABLED], [1], [Define if nanosecond-granularity timestamps are enabled.])
fi
AC_ARG_ENABLE([user_timestamp],
[AS_HELP_STRING([--enable-user-timestamp], [enable support for user-provided clock system])],
[:], [enable_user_timestamp=no])
if test "x$enable_user_timestamp" = xyes; then
if test "x$have_int64_types" != xyes; then
AC_MSG_ERROR([
=========================================
User-based timestamp needs 64bits types !
=========================================])
fi
AC_DEFINE([HAVE_USER_TIMING], [1], [Define if user-provided clock system is supported.])
fi
dnl
dnl check forms of port transfer
dnl
AC_ARG_ENABLE(bound-port-transfer,
[AS_HELP_STRING([--enable-bound-port-transfer], [enable port transfer function ptr optimization])],
:, enable_bound_port_transfer=no)
if test "$enable_bound_port_transfer" = yes; then
AC_DEFINE([HAVE_BOUND_PORT_TRANSFER], [1], [Define if Port::push/Port::pull should use bound function pointers.])
CXXFLAGS="$CXXFLAGS -Wno-pmf-conversions"
fi
AX_CHECK_COMPILE_FLAG([-faligned-new], [have_aligned_new=yes], [have_aligned_new=no])
if test "x$have_aligned_new" = xyes; then
CXXFLAGS="$CXXFLAGS -faligned-new"
fi
if test "x$enable_flow" = xyes; then
if test "x$enable_batch" != xyes; then
AC_MSG_ERROR([--enable-flow needs --enable-batch! Flow subsystem will be disabled.])
else
AC_DEFINE(HAVE_FLOW)
fi
fi
dnl
dnl check whether tools should be built for host or build
dnl
AC_ARG_ENABLE(tools,
[AC_HELP_STRING([--enable-tools=WHERE], [enable tools (host/build/mixed/no) [[mixed]]])],
:, enable_tools=mixed)
if test "$enable_tools" != mixed -a "$enable_tools" != host -a "$enable_tools" != build -a "$enable_tools" != no; then
AC_MSG_ERROR([
=========================================
Bad value for --enable-tools. Try 'host', 'build', 'mixed', or 'no'.
=========================================])
elif test "$enable_tools" = no; then
HOST_TOOLS=host
elif test "$cross_compiling" = no -o "$enable_tools" = host; then
HOST_TOOLS=host
else
dnl This is wrong!! Should at least check that HOST_CC and HOST_CXX work.
AC_CHECK_PROGS(BUILD_CC, gcc)
AC_CHECK_PROGS(BUILD_CXX, g++)
CLICK_PROG_BUILD_CXX
AC_CHECK_PROGS(BUILD_AR, ar)
AC_CHECK_PROGS(BUILD_RANLIB, ranlib, :)
HOST_TOOLS=$enable_tools
fi
AC_SUBST(HOST_TOOLS)
dnl
dnl headers, event detection, dynamic linking
dnl
AC_CHECK_HEADERS_ONCE([termio.h netdb.h sys/event.h pwd.h grp.h execinfo.h])
CLICK_CHECK_POLL_H
AC_CHECK_FUNCS([pselect sigaction])
AC_CHECK_FUNCS([kqueue], [have_kqueue=yes])
if test "x$have_kqueue" = xyes; then
AC_CACHE_CHECK([whether EV_SET last argument is void *], [ac_cv_ev_set_udata_pointer],
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
#include <sys/event.h>
#include <sys/time.h>]], [[struct kevent kev; EV_SET(&kev, 1, EVFILT_WRITE, EV_ADD, 0, 0, (void *) &kev);]])], [ac_cv_ev_set_udata_pointer=yes], [ac_cv_ev_set_udata_pointer=no])])
if test $ac_cv_ev_set_udata_pointer = yes; then
AC_DEFINE([HAVE_EV_SET_UDATA_POINTER], [1], [Define if the last argument to EV_SET has pointer type.])
fi
fi
AC_ARG_ENABLE(dynamic-linking,
[AS_HELP_STRING([--disable-dynamic-linking], [disable dynamic linking])],
:, enable_dynamic_linking=yes)
if test "x$enable_dynamic_linking" = xyes; then
CLICK_CHECK_DYNAMIC_LINKING
if test "$HOST_TOOLS" != host -a "$enable_tools" != no; then
CLICK_CHECK_BUILD_DYNAMIC_LINKING
fi
fi
dnl
dnl sockets
dnl
AC_LANG_C
SOCKET_LIBS=
if test "$enable_userlevel" = yes; then
savelibs="$LIBS"; LIBS=
AC_SEARCH_LIBS(gethostbyname, nsl, , , $savelibs)
AC_SEARCH_LIBS(connect, socket, , , $savelibs)
SOCKET_LIBS="$LIBS"; LIBS="$savelibs"