-
Notifications
You must be signed in to change notification settings - Fork 81
/
configure.in
2984 lines (2441 loc) · 103 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
AX_CHECK_COMPILE_FLAG(-Winconsistent-missing-override,CXXFLAGS="$CXXFLAGS -Wno-inconsistent-missing-override",:,[-Werror])
AC_RUN_IFELSE([AC_LANG_SOURCE([[#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(READELF, readelf, :)
AC_CHECK_TOOL(STRIP, strip, :)
conf_auxdir='$(top_srcdir)'
AC_SUBST(conf_auxdir)
test -z "$AR_CREATEFLAGS" && AR_CREATEFLAGS=cru
AC_SUBST(AR_CREATEFLAGS)
EXTRA_DRIVER_OBJS=
EXTRA_TOOL_OBJS=
INCLUDES_LLVM=
LLVM_OBJS=
LIBS_LLVM=
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=yes])
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_ARG_ENABLE([bpf],
[AS_HELP_STRING([ --disable-bpf], [Compile without BPF support])],
[:], [enable_bpf=yes])
AC_SEARCH_LIBS([bpf_prog_load_xattr], [bpf], [ac_have_libbpf=yes], [ac_have_libbpf=no])
AC_CHECK_HEADERS([bpf/bpf.h], [ac_have_libbpf_h=yes], [ac_have_libbpf_h=no])
if test "x$ac_have_libbpf$ac_have_libbpf_h$enable_bpf" = "xyesyesyes"; then
AC_DEFINE([HAVE_BPF])
have_libbpf=yes
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <bpf/bpf.h>
enum bpf_stats_type test;
]], [[]])], ac_cv_bpf_has_bpf_stats_type=yes, ac_cv_bpf_has_bpf_stats_type=no)
if test "x$ac_cv_bpf_has_bpf_stats_type" = "xyes"; then
AC_DEFINE([HAVE_BPF_STATS_TYPE])
fi
else
have_libbpf=no
enable_bpf=no
fi
AC_SEARCH_LIBS([curl_global_init], [curl], [ac_have_curl=yes], [ac_have_curl=no])
AC_CHECK_HEADERS([curl/curl.h], [ac_have_curl_h=yes], [ac_have_curl_h=no])
if test "$ac_have_curl$ac_have_curl_h" = yesyes; then
AC_DEFINE([HAVE_CURL])
fi
AC_SEARCH_LIBS([elf_version], [elf], [ac_have_elf=yes], [ac_have_elf=no])
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],[1],[Have the hyperscan library for regex matching.])
else
have_hyperscan=no
fi
AC_SEARCH_LIBS([PAPI_start_counters], [papi], [ac_have_papi=yes], [ac_have_papi=no])
AC_CHECK_HEADERS([papi.h], [ac_have_papi_h=yes], [ac_have_papi_h=no])
if test "x$ac_have_papi_h$ac_have_papi" = "xyesyes"; then
AC_DEFINE([HAVE_PAPI],[1],[Have the libpapi library for performance counters.])
have_papi=yes
else
have_papi=no
fi
AC_DEFINE([HAVE_JSON])
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([rand-align],
[AS_HELP_STRING([ --enable-rand-align], [enable random alignment of element])],
[:], [enable_rand_align=no])
if test "x$enable_rand_align" = "xyes"; then
AC_DEFINE([HAVE_RAND_ALIGN])
AC_SUBST(DO_RAND_ALIGN,1)
else
AC_SUBST(DO_RAND_ALIGN,0)
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
dnl
dnl check whether tools should be built for host or build
dnl
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-xchg],
[AS_HELP_STRING([ --enable-dpdk-xchg], [use DPDK XCHG API])],
[:], [enable_dpdk_xchg=no])
AC_ARG_ENABLE([dpdk-packet],
[AS_HELP_STRING([ --enable-dpdk-packet],
[Click packets are DPDK packet])],
[:], [enable_dpdk_packet=no])
AC_ARG_ENABLE([dpdk-softqueue],
[AS_HELP_STRING([ --disable-dpdk-softqueue],
[Do not use internal software queue in TX to buffer packets before flushing.])],
[:], [AC_DEFINE(HAVE_IQUEUE)])
AC_ARG_ENABLE([flow-api], [AS_HELP_STRING([ --enable-flow-api], [Support for the HW flow classification API. Also needs DPDK>=20.02])], [:], [enable_flow_api=no])
AC_ARG_ENABLE([click-pool],
[AS_HELP_STRING([ --disable-click-pool], [allow usage of Click Packet pool. It will still only be effectively enabled in specific (but most) cases, see packet.hh])],
[:], [enable_click_pool=yes;AC_DEFINE(HAVE_ALLOW_CLICK_PACKET_POOL,[1],[Define if Click packet pool can be used if others flags allow it (see packet.hh).])])
AC_ARG_ENABLE([pool-inlining],
[AS_HELP_STRING([ --disable-pool-inlining],
[Do not optimize pool_prepare_data_burst function before data structure reordering done at the IR level.])],
[:], [AC_DEFINE(POOL_INLINING)])
AC_ARG_ENABLE([inlined-allanno],
[AS_HELP_STRING([ --enable-inlined-allanno],
[Inline AllAnno struct into Packet class, facilitating the data structure reordering.])],
[:], [enable_inlined_allanno=no])
if test "x$enable_inlined_allanno" = "xyes"; then
AC_DEFINE([INLINED_ALLANNO])
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
AC_ARG_ENABLE([clone],
[AS_HELP_STRING([ --disable-clone], [disable packet cloning])],
[AC_DEFINE(CLICK_NOINDIRECT)],[:])
AC_ARG_ENABLE([rsspp],
[AS_HELP_STRING([ --disable-rsspp], [disable RSS++ (enabled if --enable-cpu-load by default)])],
[:],[enable_rsspp=yes])
dnl linuxmodule driver and features
AC_ARG_ENABLE([linuxmodule],
[AS_HELP_STRING([--enable-linuxmodule], [disable Linux kernel driver])],
[:], [enable_linuxmodule=no; enable_linuxmodule_default=no])
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, IF_YES, COND_FOR_ENABLE_ALL)
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 \)$5 && [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, enable_flow=yes, [ -a "x$enable_batch" = xyes ] )
ELEMENTS_ARG_ENABLE(ctx, [include Context-based elements], NO, enable_ctx=yes , [ -a "x$enable_flow" = xyes ] )
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(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" '=' xyes && 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 "unsupported"
#endif
return 0;]])], ac_cv_under_linux=yes, ac_cv_under_linux=no)])
AC_CACHE_CHECK([whether we are compiling for Apple Mach], [ac_cv_under_mach],
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[#if !(defined(__MACH__) && defined(__APPLE__))
#error "unsupported"
#endif
return 0;]])], ac_cv_under_mach=yes, ac_cv_under_mach=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([C++])
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
AX_CXX_COMPILE_STDCXX(17,[],optional)
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 if clock_gettime is available)])])
# 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([simtime],
[AS_HELP_STRING([--enable-simtime], [enable support for simulated timing])],
[AC_DEFINE([HAVE_SIMTIME])], [enable_simtime=no])
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.])
if test -z "${CXX##*clang*}" ; then
AC_MSG_ERROR([--enable-bound-port-transfer does not work with Clang! A better solution is to use click-devirtualize in any case. Remove this option or use GCC (you probably have your CXX environment variable set to clang++).])
fi
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
AC_SUBST(USE_FLOW, yes)
fi
if test "x$enable_ctx" = xyes; then
AC_DEFINE(HAVE_CTX)
AC_SUBST(USE_CTX, yes)
else
enable_ctx="no"
fi
m4_divert_once([HELP_ENABLE], [[ Optional features about flow and context:]])
AC_ARG_ENABLE([ctx-global-timeout],
[AS_HELP_STRING([ --disable-ctx-global-timeout], [disable sloppy CTX timeouts. Enabled if CTX is enabled by default.])],
[:], [enable_ctx_global_timeout=$enable_ctx])
if test "x$enable_ctx_global_timeout" = xyes; then
AC_DEFINE(HAVE_CTX_GLOBAL_TIMEOUT)
fi
AC_ARG_ENABLE([flow-atomic],
[AS_HELP_STRING([ --disable-flow-atomic], [use non-atomic flow reference counting])],
[:], [enable_flow_atomic=yes])
if test "x$enable_flow_atomic" = xyes; then
AC_DEFINE(FLOW_ATOMIC_USE_COUNT)
fi
AC_ARG_ENABLE([flow-dynamic],
[AS_HELP_STRING([ --enable-flow-dynamic], [enable dynamic reference counting to automatically acquire and relealse flow control blocksic flow system])],
[:], [enable_flow_dynamic=no])
if test "x$enable_flow$enable_flow_dynamic" = xyesyes; then
AC_DEFINE(HAVE_FLOW_DYNAMIC)
fi
AC_ARG_ENABLE([flow-structure],
[AS_HELP_STRING([ --disable-flow-structure], [do not free classifier nodes in pool, mark them as released to somehow keep the receive strucutre intact])],
[:], [enable_flow_structure=yes])
if test "x$enable_flow_structure" = xyes; then
AC_DEFINE(FLOW_KEEP_STRUCTURE)
fi
AC_ARG_ENABLE([flow-hash],
[AS_HELP_STRING([ --enable-flow-hash=[[reset|keep|epoch]]], [set flow hashtable release mechanism])],
[:], [enable_flow_hash=""])
if echo "$enable_flow_hash" | grep epoch >/dev/null 2>&1; then
AC_DEFINE([FLOW_HASH_RELEASE], [2], [Flow hash is in epoch mode.])
elif echo "$enable_flow_hash" | grep keep >/dev/null 2>&1; then
AC_DEFINE([FLOW_HASH_RELEASE], [1], [Flow hash is in keep mode.])
elif echo "$enable_flow_hash" | grep reset >/dev/null 2>&1; then
AC_DEFINE([FLOW_HASH_RELEASE], [0], [Flow hash is in reset mode.])
else
if test "x$enable_flow_structure" = xyes; then
AC_DEFINE([FLOW_HASH_RELEASE], [1], [Flow hash is in keep mode.])
else
AC_DEFINE([FLOW_HASH_RELEASE], [2], [Flow hash is in epoch mode.])
fi
fi
AC_ARG_ENABLE(tools,
[AS_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