forked from kohler/click
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.in
2125 lines (1733 loc) · 75.1 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
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])
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
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([dpdk],
[AS_HELP_STRING([ --enable-dpdk], [use Intel DPDK])],
[:], [enable_dpdk=no])
if test "x$enable_dpdk" = xyes; then
if test "x$enable_user_multithread" != xyes; then
AC_MSG_ERROR([
=========================================
--enable-dpdk requires --enable-user-multithread which was not provided.
=========================================])
fi
if test ! -f "$RTE_SDK/$RTE_TARGET/include/rte_eal.h"; then
AC_MSG_ERROR([
=========================================
Cannot find \$RTE_SDK/\$RTE_TARGET/include/rte_eal.h for Intel DPDK.
Define \$RTE_SDK and \$RTE_TARGET as per Intel DPDK documentation.
=========================================])
fi
if test ! -f "$RTE_SDK/$RTE_TARGET/lib/librte_eal.a"; then
AC_MSG_ERROR([
=========================================
Cannot find \$RTE_SDK/\$RTE_TARGET/lib/librte_eal.a for Intel DPDK.
Define \$RTE_SDK and \$RTE_TARGET as per Intel DPDK documentation.
=========================================])
fi
rte_ver_major=`grep "#define RTE_VER_MAJOR" "$RTE_SDK/$RTE_TARGET/include/rte_version.h" | head -n 1 | awk '{print $3}'`
rte_ver_minor=`grep "#define RTE_VER_MINOR" "$RTE_SDK/$RTE_TARGET/include/rte_version.h" | head -n 1 | awk '{print $3}'`
rte_ver_year=`grep "#define RTE_VER_YEAR" "$RTE_SDK/$RTE_TARGET/include/rte_version.h" | head -n 1 | awk '{print $3}'`
rte_ver_month=`grep "#define RTE_VER_MONTH" "$RTE_SDK/$RTE_TARGET/include/rte_version.h" | head -n 1 | awk '{print $3}'`
AC_SUBST(RTE_SDK)
AC_SUBST(RTE_TARGET)
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_DEFINE([HAVE_DPDK])
AC_SUBST(USE_DPDK, yes)
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(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)
ELEMENTS_ARG_ENABLE(local, [include local elements], NO)
ELEMENTS_ARG_ENABLE(radio, [include radio 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(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)
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
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
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"
AC_CACHE_CHECK([whether accept() uses socklen_t], [ac_cv_accept_socklen_t],
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
#include <sys/socket.h>
]], [[socklen_t sl; (void) accept(0, (struct sockaddr *) 0, &sl);]])],
ac_cv_accept_socklen_t=yes, ac_cv_accept_socklen_t=no)])
if test "$ac_cv_accept_socklen_t" = yes; then
AC_DEFINE([HAVE_ACCEPT_SOCKLEN_T], [1], [Define if accept() uses socklen_t.])
fi
fi
AC_SUBST(SOCKET_LIBS)
AC_LANG_CPLUSPLUS
dnl
dnl large file support
dnl
CLICK_CHECK_LARGE_FILE_SUPPORT
dnl
dnl mmap
dnl
AC_LANG_C
AC_CHECK_HEADERS_ONCE([sys/mman.h])
AC_FUNC_MMAP
AC_LANG_CPLUSPLUS
AC_CHECK_FUNCS(madvise)
AC_CHECK_DECLS(madvise, [], [], [#if HAVE_SYS_MMAN_H
#include <sys/types.h>
#include <sys/mman.h>
#endif])
dnl
dnl objects required by element collections
dnl
EXTRA_DRIVER_OBJS=
EXTRA_TOOL_OBJS=
if test "x$enable_ip6" = xyes; then
EXTRA_DRIVER_OBJS="ip6address.o ip6flowid.o ip6table.o $EXTRA_DRIVER_OBJS"
EXTRA_TOOL_OBJS="ip6address.o $EXTRA_TOOL_OBJS"
fi
AC_SUBST(EXTRA_DRIVER_OBJS)
AC_SUBST(EXTRA_TOOL_OBJS)
dnl
dnl stuff in the linux kernel
dnl
if test $ac_have_linux_kernel = y; then
dnl Look for System.map
if test "$linux_system_map" = NONE; then
linux_system_map=`find_linuxpath System.map`
if test "x$linux_system_map_boot" != xno -a ! -f "$linux_system_map"; then
linux_system_map=/boot/System.map-"$linux_system_map_boot"
fi
fi
AC_MSG_CHECKING([for Linux System.map])
if test -r "$linux_system_map"; then
AC_MSG_RESULT([$linux_system_map])
elif test -f "$linux_system_map"; then
AC_MSG_RESULT([$linux_system_map (unreadable)])
AC_MSG_ERROR([
=========================================
$linux_system_map exists, but is unreadable.
Run 'sudo ./configure', run 'sudo chmod go+r $linux_system_map',
or use the --with-linux=DIR and/or --with-linux-map=MAP options.
=========================================])
else
if test "x$enable_linuxmodule_default" = xyes; then
AC_MSG_WARN([
=========================================
Can't find Linux System.map file $linux_system_map,
so I won't compile the linuxmodule driver.
(You may need the --with-linux=DIR and/or --with-linux-map=MAP options.)
=========================================])
ac_have_linux_kernel=no
else
if test "$linux_system_map" = /nonexistent_file; then
linux_system_map="in $linuxpath"
fi
AC_MSG_ERROR([
=========================================
Can't find Linux System.map file $linux_system_map.
(You may need the --with-linux=DIR and/or --with-linux-map=MAP options.)
=========================================])
dnl ' fix syntax highlighting
fi
fi
fi
dnl Check for Linux 2.6
if test $ac_have_linux_kernel = y; then
AC_MSG_CHECKING([Linux version])
linuxpath_makefile=`find_linuxpath Makefile`
linux_version=`grep '^VERSION[[ ]]*=[[ ]]*[[0-9]][[0-9]]*[[ ]]*$' "$linuxpath_makefile" | tr -c -d 0-9`
linux_patchlevel=`grep '^PATCHLEVEL[[ ]]*=[[ ]]*[[0-9]][[0-9]]*[[ ]]*$' "$linuxpath_makefile" | tr -c -d 0-9`
linux_sublevel=`grep '^SUBLEVEL[[ ]]*=[[ ]]*[[0-9]][[0-9]]*[[ ]]*$' "$linuxpath_makefile" | tr -c -d 0-9`
if test -n "$linux_version" -a -n "$linux_patchlevel" -a -z "$linux_sublevel"; then linux_sublevel=0; fi
if test -n "$linux_version" -a -n "$linux_patchlevel" -a -n "$linux_sublevel"; then
AC_MSG_RESULT([$linux_version.$linux_patchlevel.$linux_sublevel])
linux_version_code=`expr $linux_version '*' 65536 + $linux_patchlevel '*' 256 + $linux_sublevel`
else
AC_MSG_RESULT([unknown])
linux_version_code=0
fi
LINUXMODULE_2_6=0
if test "$linux_version.$linux_patchlevel" = 2.6 -o "$linux_version" -ge 3; then
LINUXMODULE_2_6=1
AC_DEFINE([HAVE_LINUXMODULE_2_6], [1], [Define if the Click linuxmodule is compiled for a 2.6 or later kernel.])
fi
if test "$LINUXMODULE_2_6" = 0; then
AC_MSG_ERROR([
=========================================
Click no longer supports in-kernel compilation on Linux 2.4 kernels.
Update your Linux or try an older version of Click.
=========================================])
fi
AC_SUBST(LINUXMODULE_2_6)
AC_CACHE_CHECK([for Click Linux kernel extensions], ac_cv_click_kernel,
[if grep "register_net_in" $linux_system_map >/dev/null 2>&1; then
ac_cv_click_kernel=yes
else ac_cv_click_kernel=no; fi])
if test $ac_cv_click_kernel = yes; then
AC_DEFINE(HAVE_CLICK_KERNEL)
fi
AC_CACHE_CHECK([for Click Linux kernel extensions for transmit notification], ac_cv_click_kernel_tx_notify,
[if grep "register_net_tx" $linux_system_map >/dev/null 2>&1; then
ac_cv_click_kernel_tx_notify=yes
else ac_cv_click_kernel_tx_notify=no; fi])
if test $ac_cv_click_kernel_tx_notify = yes; then
AC_DEFINE(HAVE_CLICK_KERNEL_TX_NOTIFY)
fi
AC_CACHE_CHECK([for read_net_skbcount kernel extension], ac_cv_linux_read_net_skbcount,
[if grep "read_net_skbcount" $linux_system_map >/dev/null 2>&1; then
ac_cv_linux_read_net_skbcount=yes
else ac_cv_linux_read_net_skbcount=no; fi])
if test $ac_cv_linux_read_net_skbcount = yes; then
AC_DEFINE(HAVE_LINUX_READ_NET_SKBCOUNT)
fi
AC_CACHE_CHECK([for strlen kernel symbol], ac_cv_linux_strlen_exposed,
[if grep ' strlen' $linux_system_map >/dev/null 2>&1; then
ac_cv_linux_strlen_exposed=yes
else ac_cv_linux_strlen_exposed=no; fi])
if test $ac_cv_linux_strlen_exposed = yes; then
AC_DEFINE(HAVE_LINUX_STRLEN_EXPOSED)
fi
AC_CACHE_CHECK([for tulip_interrupt_hook kernel symbol], ac_cv_linux_tulip_intr_hook,
[if grep ' tulip_interrupt_hook' $linux_system_map >/dev/null 2>&1; then
ac_cv_linux_tulip_intr_hook=yes
else ac_cv_linux_tulip_intr_hook=no; fi])
if test $ac_cv_linux_tulip_intr_hook = yes; then
AC_DEFINE(HAVE_LINUX_TULIP_INTERRUPT_HOOK)
fi
AC_CACHE_CHECK([for files_lock kernel symbol], ac_cv_linux_files_lock,
[if grep "__ksymtab_files_lock" $linux_system_map >/dev/null 2>&1; then
ac_cv_linux_files_lock=yes
else ac_cv_linux_files_lock=no; fi])
if test $ac_cv_linux_files_lock = yes; then
AC_DEFINE(HAVE_LINUX_FILES_LOCK)
fi
AC_CACHE_CHECK([for files_lglock kernel symbol], ac_cv_linux_files_lglock,
[if grep "__ksymtab_files_lglock" $linux_system_map >/dev/null 2>&1; then
ac_cv_linux_files_lglock=yes
else ac_cv_linux_files_lglock=no; fi])
if test $ac_cv_linux_files_lglock = yes; then
AC_DEFINE(HAVE_LINUX_FILES_LGLOCK)
fi
AC_CACHE_CHECK([for sb_lock kernel symbol], ac_cv_linux_sb_lock,
[if grep "__ksymtab_sb_lock" $linux_system_map >/dev/null 2>&1; then
ac_cv_linux_sb_lock=yes
else ac_cv_linux_sb_lock=no; fi])
if test $ac_cv_linux_sb_lock = yes; then
AC_DEFINE(HAVE_LINUX_SB_LOCK)
fi
AC_CACHE_CHECK([for dev_ioctl kernel symbol], ac_cv_linux_dev_ioctl,
[if grep "__ksymtab_dev_ioctl" $linux_system_map >/dev/null 2>&1; then
ac_cv_linux_dev_ioctl=yes
else ac_cv_linux_dev_ioctl=no; fi])
if test $ac_cv_linux_dev_ioctl = yes; then
AC_DEFINE(HAVE_LINUX_DEV_IOCTL)
fi
AC_CACHE_CHECK([for devinet_ioctl kernel symbol], ac_cv_linux_devinet_ioctl,
[if grep "__ksymtab_devinet_ioctl" $linux_system_map >/dev/null 2>&1; then
ac_cv_linux_devinet_ioctl=yes
else ac_cv_linux_devinet_ioctl=no; fi])
if test $ac_cv_linux_devinet_ioctl = yes; then
AC_DEFINE(HAVE_LINUX_DEVINET_IOCTL)
fi
AC_CACHE_CHECK([for inet_ioctl kernel symbol], ac_cv_linux_inet_ioctl,
[if grep "__ksymtab_inet_ioctl" $linux_system_map >/dev/null 2>&1; then
ac_cv_linux_inet_ioctl=yes
else ac_cv_linux_inet_ioctl=no; fi])
if test $ac_cv_linux_inet_ioctl = yes; then
AC_DEFINE(HAVE_LINUX_INET_IOCTL)
fi
AC_CACHE_CHECK([for inet_ctl_sock_create kernel symbol], ac_cv_linux_inet_ctl_sock_create,
[if grep "__ksymtab_inet_ctl_sock_create" $linux_system_map >/dev/null 2>&1; then
ac_cv_linux_inet_ctl_sock_create=yes
else ac_cv_linux_inet_ctl_sock_create=no; fi])
if test $ac_cv_linux_inet_ctl_sock_create = yes; then
AC_DEFINE(HAVE_LINUX_INET_CTL_SOCK_CREATE)
fi
AC_CACHE_CHECK([for <linux/ktime.h>], ac_cv_linux_ktime_h,
[if grep ktime_t `find_linuxpath include/linux/ktime.h` >/dev/null 2>&1; then
ac_cv_linux_ktime_h=yes
else ac_cv_linux_ktime_h=no; fi])
if test $ac_cv_linux_ktime_h = yes; then
AC_DEFINE(HAVE_LINUX_KTIME_H)
fi
fi
dnl
dnl stuff in the bsd kernel
dnl
if test $ac_have_bsd_kernel = y; then
KERNEL_CXX="$KERNEL_CXX -fpermissive"
AC_CACHE_CHECK(FreeBSD version, ac_cv_freebsd_version, [
save_flags="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS -I$freebsd_includedir"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/param.h>