forked from acassen/keepalived
-
Notifications
You must be signed in to change notification settings - Fork 3
/
configure.ac
1465 lines (1339 loc) · 50.4 KB
/
configure.ac
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
#
# Keepalived OpenSource project.
#
# Configuration template file for keepalived.
# autoconf will generate & check deps for proper compilation
#
# Copyright (C) 2001-2017 Alexandre Cassen, <acassen@linux-vs.org>
AC_DEFUN([add_to_var], [$1="$$1 $2"])
AC_DEFUN([add_to_var_ind], [eval $1=\"\$$1 $2\"]) dnl "
AC_DEFUN([add_to_var_ind_unique],
ADD_NEW=
[ eval var=\$$1
for item in $2; do
echo " $var " | $GREP -q " $item "
if test $? -ne 0; then
add_to_var([ADD_NEW], [$item])
fi
done
add_to_var_ind([$1], [$ADD_NEW])
])
AC_DEFUN([add_pkg_config],
[ if test -n "$2"; then
KA_PKG_PFX=$2
else
KA_PKG_PFX=KA
fi
add_to_var_ind_unique([${KA_PKG_PFX}_CPPFLAGS], [`$PKG_CONFIG --cflags-only-I $1`])
add_to_var_ind_unique([${KA_PKG_PFX}_CFLAGS], [`$PKG_CONFIG --cflags-only-other $1`])
add_to_var_ind_unique([${KA_PKG_PFX}_LIBS], [`$PKG_CONFIG --libs $1`])
if test .$3 = .remove-requires; then
REQUIRES=`$PKG_CONFIG --print-requires $1`
eval var=\$${KA_PKG_PFX}_LIBS
for r in $REQUIRES; do
REQ_LIBS=`$PKG_CONFIG --libs $r`
for l in $REQ_LIBS; do
var=`echo " $var " | sed -e "s/ $l / /g"`
done
done
var=`echo $var | sed -e "s/^ *//" -e "s/ *$//"`
eval ${KA_PKG_PFX}_LIBS="\"$var\""
fi
])
AC_DEFUN([add_pkg_config_without_libs],
[ if test -n "$2"; then
KA_PKG_PFX=$2
else
KA_PKG_PFX=KA
fi
add_to_var_ind_unique([${KA_PKG_PFX}_CPPFLAGS], [$($PKG_CONFIG --cflags-only-I $1)])
add_to_var_ind_unique([${KA_PKG_PFX}_CFLAGS], [$($PKG_CONFIG --cflags-only-other $1)])
])
AC_DEFUN([add_build_opt], [add_to_var([BUILD_OPTIONS], [$1])])
AC_DEFUN([get_lib_name],
[
if test $LDD = :; then
AC_MSG_ERROR([ldd is required for dynamic run-time linking support])
fi
SAV_LIBS="$LIBS"
LIBS=-l$1
AC_LINK_IFELSE([AC_LANG_SOURCE([[
extern void $2(void);
int main(void)
{
$2();
return 0;
}
]])], [
LIB_DETAILS=`$LDD ./conftest$EXEEXT | grep $1.so | sed -e "s/^[[ \t]]*//"`
LIB_NAME=`echo $LIB_DETAILS | sed -e "s/ .*//"`
],[
])
LIBS="$SAV_LIBS"
])
# AS_VAR_COPY was introduced in autoconf 2.63b.
# Remove the following definition once require autoconf >= 2.64.
m4_ifndef([AS_VAR_COPY],
[m4_define([AS_VAR_COPY],
[AS_LITERAL_IF([$1[]$2], [$1=$$2], [eval $1=\$$2])])])
dnl ----[ Process this file with autoconf to produce a configure script ]----
AC_PREREQ([2.63])
AC_INIT([Keepalived], [1.3.9], [keepalived-devel@lists.sourceforge.net], [], [http://www.keepalived.org/])
AM_INIT_AUTOMAKE([-Wall -Werror -Woverride foreign])
AC_CONFIG_SRCDIR([keepalived/core/main.c])
AC_CONFIG_HEADERS([lib/config.h])
AH_TOP(
[
#ifndef _CONFIG_H
#define _CONFIG_H
])
AH_BOTTOM(
[
#endif
])
AC_CONFIG_FILES([Makefile keepalived/Makefile lib/Makefile keepalived/core/Makefile keepalived.spec \
genhash/Makefile keepalived/check/Makefile keepalived/vrrp/Makefile doc/Makefile \
bin_install/Makefile keepalived/dbus/Makefile keepalived/etc/Makefile \
keepalived/etc/init/Makefile keepalived/etc/init.d/Makefile])
MAINTAINERCLEANFILES="*~ *.orig *.rej core core.*"
AC_SUBST(MAINTAINERCLEANFILES)
BUILD_OPTIONS=
AM_SILENT_RULES([yes])
PKG_PROG_PKG_CONFIG
dnl ----[ Keepalived specific configure options ]----
AC_ARG_ENABLE(lvs-syncd,
[AS_HELP_STRING([--disable-lvs-syncd], [do not use LVS synchronization daemon])])
AC_ARG_ENABLE(lvs,
[AS_HELP_STRING([--disable-lvs], [do not use the LVS framework])])
AC_ARG_ENABLE(lvs-64bit-stats,
[AS_HELP_STRING([--disable-lvs-64bit-stats], [do not use the LVS 64-bit stats])])
AC_ARG_ENABLE(vrrp,
[AS_HELP_STRING([--disable-vrrp], [do not use the VRRP framework])])
AC_ARG_WITH(kernel-dir,
[AS_HELP_STRING([--with-kernel-dir=DIR], [path to linux kernel source directory])],
[AS_HELP_STRING([kernel_src_path="$withval"],], [[kernel_src_path=""])])
AC_ARG_ENABLE(fwmark,
[AS_HELP_STRING([--disable-fwmark], [compile without SO_MARK support])])
AC_ARG_ENABLE(snmp,
[AS_HELP_STRING([--enable-snmp], [compile with SNMP support])])
AC_ARG_ENABLE(snmp-vrrp,
[AS_HELP_STRING([--enable-snmp-vrrp], [compile with SNMP vrrp support])])
AC_ARG_ENABLE(snmp-keepalived,
[AS_HELP_STRING([--enable-snmp-keepalived], [obsolete - use --enable-snmp-vrrp])])
AC_ARG_ENABLE(snmp-checker,
[AS_HELP_STRING([--enable-snmp-checker], [compile with SNMP checker support])])
AC_ARG_ENABLE(snmp-rfc,
[AS_HELP_STRING([--enable-snmp-rfc], [compile with SNMP RFC2787 (VRRPv2) and SNMP RFC6527 (VRRPv3) support])])
AC_ARG_ENABLE(snmp-rfcv2,
[AS_HELP_STRING([--enable-snmp-rfcv2], [compile with SNMP RFC2787 (VRRPv2) support])])
AC_ARG_ENABLE(snmp-rfcv3,
[AS_HELP_STRING([--enable-snmp-rfcv3], [compile with SNMP RFC6257 (VRRPv3) support])])
AC_ARG_ENABLE(snmp-reply-v3-for-v2,
[AS_HELP_STRING([--disable-snmp-reply-v3-for-v2], [disable RFC6257 responses for VRRPv2 instances])])
AC_ARG_ENABLE(dbus,
[AS_HELP_STRING([--enable-dbus], [compile with dbus support])])
AC_ARG_ENABLE(dbus-create-instance,
[AS_HELP_STRING([--enable-dbus-create-instance], [compile with dbus support for creating instances])])
AC_ARG_ENABLE(sha1,
[AS_HELP_STRING([--enable-sha1], [compile with SHA1 support])])
AC_ARG_WITH(init,
[AS_HELP_STRING([--with-init=(upstart|systemd|SYSV|SUSE|openrc)], [specify init type])],
[init_type="$withval"], [init_type=""])
AC_ARG_ENABLE(vrrp-auth,
[AS_HELP_STRING([--disable-vrrp-auth], [compile without VRRP authentication])])
AC_ARG_ENABLE(chksum_compat,
[AS_HELP_STRING([--disable-checksum_compat], [compile without v1.3.6 and earlier VRRPv3 unicast checksum compatibility])])
AC_ARG_ENABLE(routes,
[AS_HELP_STRING([--disable-routes], [compile without ip rules/routes])])
AC_ARG_ENABLE(gnu-std-paths,
[AS_HELP_STRING([--enable-gnu-std-paths], [use GNU standard paths for pid files etc])])
AC_ARG_ENABLE(dynamic-linking,
[AS_HELP_STRING([--enable-dynamic-linking], [compile with/without dynamically linked libiptc/libipset])])
AC_ARG_ENABLE(libiptc-dynamic,
[AS_HELP_STRING([--enable-libiptc-dynamic], [compile with libiptc dynamically linked])])
AC_ARG_ENABLE(libipset-dynamic,
[AS_HELP_STRING([--disable-libipset-dynamic], [compile with libipset statically linked])])
AC_ARG_ENABLE(libxtables-dynamic,
[AS_HELP_STRING([--enable-libxtables-dynamic], [compile with libxtables dynamically linked])])
AC_ARG_ENABLE(libnl-dynamic,
[AS_HELP_STRING([--enable-libnl-dynamic], [compile with libnl dynamically linked])])
AC_ARG_ENABLE(libiptc,
[AS_HELP_STRING([--disable-libiptc], [compile without libiptc])])
AC_ARG_ENABLE(libipset,
[AS_HELP_STRING([--disable-libipset], [compile without libipset])])
AC_ARG_ENABLE(libnl,
[AS_HELP_STRING([--disable-libnl], [compile without libnl])])
AC_ARG_ENABLE(mem-check,
[AS_HELP_STRING([--enable-mem-check], [compile with memory alloc checking])])
AC_ARG_ENABLE(mem-check-log,
[AS_HELP_STRING([--enable-mem-check-log], [compile with memory alloc checking writing to syslog])])
AC_ARG_ENABLE(debug,
[AS_HELP_STRING([--enable-debug], [compile with debugging flags])])
AC_ARG_ENABLE(stacktrace,
[AS_HELP_STRING([--enable-stacktrace], [compile with stacktrace support])])
AC_ARG_ENABLE(profile,
[AS_HELP_STRING([--enable-profile], [compile with profiling flags])])
AC_ARG_ENABLE(conversion-checks,
[AS_HELP_STRING([--enable-conversion-checks], [compile with conversion warnings if sensible])])
AC_ARG_ENABLE(force-conversion-checks,
[AS_HELP_STRING([--enable-force-conversion-checks], [compile with conversion warnings])])
AC_ARG_ENABLE(Werror,
[AS_HELP_STRING([--enable-Werror], [compile with warnings being errors])])
AC_ARG_ENABLE(json,
[AS_HELP_STRING([--enable-json], [compile with signal to dump configuration and stats as json])])
AC_ARG_WITH([systemdsystemunitdir],
AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
[], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
# Set the kernel headers path
if test -n "$kernel_src_path"; then
kernelinc="-I$kernel_src_path/include"
elif test ! -d /usr/include/linux -a \
-d /usr/src/linux/include; then
kernelinc="-I/usr/src/linux/include"
else
kernelinc=
fi
# Checks for programs.
AC_PROG_CC
AC_PROG_MAKE_SET
AC_PROG_INSTALL
AC_PROG_RANLIB
AC_PROG_GREP
AC_PROG_LN_S
AC_PROG_SED
AC_CHECK_TOOL(STRIP,strip)
AC_CHECK_TOOL(LDD,ldd)
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
ARFLAGS=cr
AC_SUBST(ARFLAGS)
# AC_PROG_LIBTOOL
KA_CPPFLAGS="$kernelinc"
KA_CFLAGS="-Wall -Wunused -Wstrict-prototypes -Wextra -g -O2 -fPIE"
KA_LDFLAGS=
KA_LIBS=
NEED_LIBDL=No
#KA_LIBTOOLFLAGS =
if test "$enable_conversion_checks" = yes; then
# Check if we can sensibly enable -Wconversion
AC_MSG_CHECKING([for usable -Wconversion])
SAV_CFLAGS="$CFLAGS"
CFLAGS="-Wconversion -O2 -Wp,-D_FORTIFY_SOURCE=2 -Werror"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <sys/types.h>
#include <sys/select.h>
#include <stdint.h>
#include <stdbool.h>
#include <linux/rtnetlink.h>
#define VAL 255
static void
fun(uint8_t val)
{
}
int main(int argc, char**argv)
{
fd_set set;
uint8_t val = 42;
unsigned u;
bool b;
size_t size = 17;
char c[2];
char *c_ptr = c;
struct rtattr rta;
struct rtattr *rta_p = &rta;
FD_SET(argc+1, &set);
fun(argc == VAL ? VAL : val);
// vrrp->lower_prio_no_advert = vrrp->strict_mode ? true : global_data->vrrp_lower_prio_no_advert;
u = u ? true : b;
size = RTA_LENGTH(size);
c_ptr = RTA_DATA(c_ptr);
rta_p = RTA_NEXT(rta_p, size);
val = (u < 256 ) ? u & 0xff : 0;
}
]])],
[
AC_MSG_RESULT([yes])
KA_CFLAGS="$KA_CFLAGS -Wconversion"
],
[
AC_MSG_RESULT([no])
AC_MSG_WARN([-Wconversion is not sensible with this compiler. Use --enable-force-conversion-checks to override.])
])
CFLAGS="$SAV_CFLAGS"
elif test "$enable_force_conversion_checks" = yes; then
KA_CFLAGS="$KA_CFLAGS -Wconversion"
fi
if test "$enable_Werror" = yes; then
KA_CFLAGS="$KA_CFLAGS -Werror"
fi
AC_MSG_CHECKING([for -Wimplicit-fallthrough])
SAV_CFLAGS="$CFLAGS"
CFLAGS="-Wimplicit-fallthrough=3"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
int main(int argc, char**argv)
{
}
]])],
[
AC_MSG_RESULT([yes])
KA_CFLAGS="$KA_CFLAGS -Wimplicit-fallthrough=3"
],
[
AC_MSG_RESULT([no])
])
CFLAGS="$SAV_CFLAGS"
AC_SUBST(KA_CPPFLAGS)
AC_SUBST(KA_CFLAGS)
AC_SUBST(KA_LDFLAGS)
AC_SUBST(KA_LIBS)
# AC_SUBST(KA_LIBTOOLFLAGS)
# Checks for libraries.
# Checks for header files.
AC_CHECK_HEADERS([arpa/inet.h fcntl.h limits.h netdb.h netinet/in.h stdint.h stdlib.h string.h sys/ioctl.h sys/param.h sys/prctl.h sys/socket.h sys/time.h syslog.h unistd.h],
[], [AC_MSG_ERROR([Missing/unusable system header file <$ac_header>])])
# check for kernel headers
SAV_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $kernelinc"
dnl -- <linux/netlink.h> needed <sys/socket.h> until Linux 3.1
dnl -- using AC_CHECK_HEADER causes a horrible error message for the user
NETLINK_EXTRA_INCLUDE=
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <linux/netlink.h>
]])], [],
[AC_CHECK_HEADER([linux/netlink.h],
[
AC_DEFINE([NETLINK_H_NEEDS_SYS_SOCKET_H], [ 1 ], [Define to 1 if <linux/netlink.h> needs <sys/socket.h>])
NETLINK_EXTRA_INCLUDE="#include <sys/socket.h>"
], [AC_MSG_ERROR([Missing/unusable kernel header file <linux/netlink.h>])],
[[#include <sys/socket.h>]])])
AC_CHECK_HEADERS([asm/types.h linux/ethtool.h linux/icmpv6.h linux/if_ether.h linux/if_packet.h linux/ip.h linux/sockios.h linux/types.h],
[], [AC_MSG_ERROR([Missing/unusable kernel header file <$ac_header>])])
AC_CHECK_HEADERS([linux/fib_rules.h linux/if_addr.h linux/if_link.h],
[], [AC_MSG_ERROR([Missing/unusable kernel header file <$ac_header>])],
[[$NETLINK_EXTRA_INCLUDE]])
AC_CHECK_HEADERS([linux/if_arp.h],
[], [AC_MSG_ERROR([Missing/unusable <$ac_header>])],
[[#include <sys/socket.h>]])
CPPFLAGS="$SAV_CPPFLAGS"
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_INLINE
AC_TYPE_INT64_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_TYPE_UINT8_T
AC_C_CONST
# Checks for library functions.
AC_FUNC_FORK
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_CHECK_FUNCS([dup2 getcwd gettimeofday memmove memset select setenv socket strcasecmp strchr strdup strerror strpbrk strstr strtol strtoul uname])
dnl - pipe2() since Linux 2.6.27 and glibc 2.9.
AC_CHECK_FUNCS([pipe2], [add_build_opt([PIPE2])])
dnl - Do we want to override dynamic/static linking?
if test -n "$enable_dynamic_linking"; then
enable_libiptc_dynamic=$enable_dynamic_linking
enable_libipset_dynamic=$enable_dynamic_linking
enable_libxtables_dynamic=$enable_dynamic_linking
enable_libnl_dynamic=$enable_dynamic_linking
fi
# check for missing definition - added in glibc 2.8
AC_CHECK_DECLS([ETHERTYPE_IPV6], [],
[
AC_DEFINE([ETHERTYPE_IPV6], [0x86dd], [Defined here if not found in <net/ethernet.h>.])
],
[[#include <net/ethernet.h>]])
BUILD_GENHASH=Yes
dnl ----[ Checks for openssl ]----
# check for openssl headers
NEED_MD5=no
NEED_SSL=no
if test "$enable_vrrp" != no -a \
"$enable_vrrp_auth" != no; then
NEED_MD5=yes
fi
if test "$enable_lvs" != no; then
NEED_MD5=yes
NEED_SSL=yes
fi
AC_CHECK_HEADERS([openssl/ssl.h openssl/err.h], [],
[
if test $NEED_SSL = yes; then
AC_MSG_ERROR([
!!! OpenSSL is not properly installed on your system. !!!
!!! Can not include OpenSSL headers files. !!!])
fi
BUILD_GENHASH=No
NEED_SSL=no
break
])
AC_CHECK_HEADERS([openssl/md5.h], [],
[
if test $NEED_MD5 = yes; then
AC_MSG_ERROR([
!!! OpenSSL is not properly installed on your system. !!!
!!! Can not include OpenSSL MD5 headers files. !!!])
fi
BUILD_GENHASH=No
NEED_MD5=no
break
])
unset LIBS
AC_CHECK_LIB(crypto, MD5_Init, [],
[
if test $NEED_MD5 = yes; then
AC_MSG_ERROR([OpenSSL MD5 libraries are required])
fi
BUILD_GENHASH=No
])
if test $NEED_MD5 = yes; then
add_to_var([KA_LIBS], [$LIBS])
fi
add_to_var([GENHASH_LIBS], [$LIBS])
unset LIBS
AC_CHECK_LIB(ssl, SSL_CTX_new, [],
[
if test $NEED_SSL = yes; then
AC_MSG_ERROR([OpenSSL libraries are required])
fi
BUILD_GENHASH=No
])
if test $NEED_SSL = yes; then
add_to_var([KA_LIBS], [$LIBS])
fi
add_to_var([GENHASH_LIBS], [$LIBS])
unset LIBS
if test $BUILD_GENHASH = No; then
AC_MSG_NOTICE([Unable to build genhash due to missing openssl headers/libraries])
GENHASH_LIBS=
fi
AC_SUBST([GENHASH_LIBS])
AM_CONDITIONAL([BUILD_GENHASH], [test $BUILD_GENHASH = Yes])
dnl ----[ Checks for libraries ]----
NETLINK_VER=0
IPVS_USE_NL=No
IPV4_DEVCONF=No
if test .${enable_libnl} != .no; then
$PKG_CONFIG --exists libnl-3.0
if test $? -eq 0; then
add_pkg_config([libnl-3.0], [NL3], [remove-requires])
NL3_LIB=`echo $NL3_LIBS | sed -e "s/-l//g"`
fi
AC_CHECK_LIB($NL3_LIB, nl_socket_alloc,
[
NETLINK_VER=3
NEED_NL3=No
add_pkg_config([libnl-3.0], [NL3])
if test .$enable_lvs != .no; then
add_pkg_config([libnl-genl-3.0], [GENL], [remove-requires])
GENL_LIB=`echo $GENL_LIBS | sed -e "s/-l//g"`
AC_CHECK_LIB($GENL_LIB, genl_connect, [],
[AC_MSG_ERROR([libnl-3 is installed but not libnl-gen-3. Please, install libnl-gen-3/libnl-genl-3.])])
IPVS_USE_NL=Yes
if test .$enable_libnl_dynamic = .yes; then
add_pkg_config_without_libs([libnl-genl-3.0])
get_lib_name([$GENL_LIB], [genl_connect])
AC_DEFINE_UNQUOTED([NL3_GENL_LIB_NAME], [ "$LIB_NAME" ], [Define the nl-genl-3.0 library name])
else
add_pkg_config([libnl-genl-3.0], [], [remove-requires])
fi
NEED_NL3=Yes
fi
if test $NETLINK_VER -eq 3 -a .$disable_vrrp != .no; then
NEED_NL3=Yes
dnl ----[Check have IPV4_DEVCONF defines - since Linux 3.11]----
SAV_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPP_FLAGS $kernelinc"
IPV4_DEVCONF=Yes
AC_CHECK_DECLS([
IPV4_DEVCONF_ARP_IGNORE,
IPV4_DEVCONF_ACCEPT_LOCAL,
IPV4_DEVCONF_RP_FILTER,
IPV4_DEVCONF_ARPFILTER],
[],
[
IPV4_DEVCONF=No
break
],
[[#include <linux/ip.h>]])
if test $IPV4_DEVCONF = Yes; then
CPPFLAGS="$SAV_CPPFLAGS $NL3_CPPFLAGS"
AC_CHECK_HEADERS([netlink/route/link.h netlink/route/link/inet.h], [], [AC_MSG_ERROR([libnl-3 route link headers missing])])
AC_DEFINE([_HAVE_IPV4_DEVCONF_], [ 1 ], [Define to 1 if have IPv4 netlink device configuration])
add_build_opt([IPV4_DEVCONF])
dnl ----[Check if have net/if.h and netlink/route/link.h namespace collision]----
dnl -- Resolved in libnl3-3.2.26 (release 30/3/2015)
AC_MSG_CHECKING([for net/if.h and libnl3/netlink/route/link.h namespace collision])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <netlink/route/link.h>
#include <net/if.h>
]])], [
AC_MSG_RESULT([no])
], [
AC_MSG_RESULT([yes])
AC_DEFINE([_HAVE_IF_H_LINK_H_COLLISION_], [ 1 ], [Define to 1 if <net/if.h> and <netlink/route/link.h> namespace collision])
add_build_opt([IF_H_LINK_H_COLLISION])
])
fi
CPPFLAGS="$SAV_CPPFLAGS"
fi
if test $IPV4_DEVCONF = Yes; then
add_pkg_config([libnl-route-3.0], [ROUTE], [remove-requires])
ROUTE_LIB=`echo $ROUTE_LIBS | sed -e "s/-l//g"`
AC_CHECK_LIB($ROUTE_LIB, nl_rtgen_request, [],
[AC_MSG_ERROR([libnl-3 is installed but not libnl-route-3. Please, install libnl-route-3.])])
if test .$enable_libnl_dynamic = .yes; then
add_pkg_config_without_libs([libnl-route-3.0])
get_lib_name([$ROUTE_LIB], [rtgen_request])
AC_DEFINE_UNQUOTED([NL3_ROUTE_LIB_NAME], [ "$LIB_NAME" ], [Define the nl-route-3.0 library name])
else
add_pkg_config([libnl-route-3.0], [], [remove-requires])
fi
fi
if test $NEED_NL3 = Yes; then
AC_DEFINE([_HAVE_LIBNL3_], [ 1 ], [Define to 1 if using libnl-3])
add_build_opt([LIBNL3])
if test .$enable_libnl_dynamic = .yes; then
add_build_opt([LIBNL_DYNAMIC])
add_pkg_config_without_libs([libnl-3.0])
AC_DEFINE([_LIBNL_DYNAMIC_], [ 1 ], [Define to 1 if building with libnl dynamic linking])
NEED_LIBDL=Yes
get_lib_name([$NL3_LIB], [nl_socket_alloc])
AC_DEFINE_UNQUOTED([NL3_LIB_NAME], [ "$LIB_NAME" ], [Define the nl-3 library name])
else
add_pkg_config([libnl-3.0])
fi
fi
],
[
if test .$enable_lvs != .no; then
AC_CHECK_LIB(nl, nl_socket_modify_cb,
[
IPVS_USE_NL=Yes
NETLINK_VER=1
AC_DEFINE([_HAVE_LIBNL1_], [ 1 ], [Define to 1 if using libnl-1])
add_build_opt([LIBNL1])
if test .$enable_libnl_dynamic = .yes; then
add_pkg_config_without_libs([libnl-1])
add_build_opt([LIBNL_DYNAMIC])
AC_DEFINE([_LIBNL_DYNAMIC_], [ 1 ], [Define to 1 if building with libnl dynamic linking])
NEED_LIBDL=Yes
get_lib_name([nl], [nl_socket_modify_cb])
AC_DEFINE_UNQUOTED([NL_LIB_NAME], [ "$LIB_NAME" ], [Define the nl library name])
else
add_pkg_config([libnl-1])
fi
],
[
AC_MSG_WARN([keepalived will be built without libnl support.])
])
fi
])
if test $NETLINK_VER -ne 0; then
SAV_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $kernelinc"
AC_CHECK_HEADERS([linux/rtnetlink.h], [], [AC_MSG_ERROR([Unusable linux/rtnetlink.h])], [$NETLINK_EXTRA_INCLUDE])
CPPFLAGS="$SAV_CPPFLAGS $NL3_CPPFLAGS"
AC_CHECK_HEADERS([libnfnetlink/libnfnetlink.h], [], [AC_MSG_ERROR([libnfnetlink headers missing])])
AC_CHECK_HEADERS([netlink/netlink.h], [], [AC_MSG_ERROR([netlink headers missing])])
if test .$disable_lvs != .no; then
AC_CHECK_HEADERS([netlink/genl/ctrl.h netlink/genl/genl.h], [], [AC_MSG_ERROR([netlink genl headers missing])])
fi
CPPFLAGS="$SAV_CPPFLAGS"
fi
fi
AM_CONDITIONAL([LIBNL1], [test $NETLINK_VER -eq 1])
AM_CONDITIONAL([LIBNL3], [test $NETLINK_VER -eq 3])
AM_CONDITIONAL([LIBNL_DYNAMIC], [test .$enable_libnl_dynamic = .yes -a $NETLINK_VER -ne 0])
dnl -- Check for the following variables introduced at various times into Linux
dnl --FRA_OIFNAME dnl -- Linux 2.6.33
dnl --RTAX_QUICKACK dnl -- Linux 3.11
dnl --FRA_SUPPRESS_PREFIXLEN dnl -- Linux 3.12
dnl --FRA_SUPPRESS_IFGROUP dnl -- Linux 3.12
dnl --RTAX_CC_ALGO dnl -- Linux 4.0
dnl --RTA_VIA dnl -- Linux 4.1
dnl --RTA_NEWDST dnl -- Linux 4.1
dnl --RTA_PREF dnl -- Linux 4.1
dnl --FRA_TUN_ID dnl -- Linux 4.3
dnl --RTA_ENCAP dnl -- Linux 4.3
dnl --RTEXT_FILTER_SKIP_STATS dnl -- Linux 4.4
dnl --RTA_EXPIRES dnl -- Linux 4.5
dnl --FRA_UID_RANGE dnl -- Linux 4.10
AC_CHECK_DECLS([RTA_ENCAP, RTA_EXPIRES, RTA_NEWDST, RTA_PREF, FRA_SUPPRESS_PREFIXLEN, FRA_SUPPRESS_IFGROUP, FRA_TUN_ID, RTAX_CC_ALGO, RTAX_QUICKACK, RTEXT_FILTER_SKIP_STATS, FRA_UID_RANGE], [], [],
[[#include <linux/rtnetlink.h>
#include <sys/socket.h>
#include <linux/fib_rules.h>]])
dnl - following only needed for for flag loop
AC_CHECK_DECLS([RTA_VIA, FRA_OIFNAME], [], [],
[[#include <linux/rtnetlink.h>
#include <sys/socket.h>
#include <linux/fib_rules.h>]])
for flag in RTA_ENCAP RTA_EXPIRES RTA_NEWDST RTA_PREF RTA_VIA FRA_OIFNAME FRA_SUPPRESS_PREFIXLEN FRA_SUPPRESS_IFGROUP FRA_TUN_ID RTAX_CC_ALGO RTAX_QUICKACK RTEXT_FILTER_SKIP_STATS FRA_UID_RANGE; do
AS_VAR_COPY([decl_var], [ac_cv_have_decl_$flag])
if test ${decl_var} = yes; then
add_build_opt[${flag}]
fi
done
dnl - Introduced in Linux 3.14
AC_CHECK_DECLS([IFA_FLAGS], [], [], [[#include <linux/if_addr.h>]])
dnl -- RedHat backported ENCAP_IP and ENCAP_IP6 without MPLS and ILA
AC_CHECK_DECLS([LWTUNNEL_ENCAP_MPLS, LWTUNNEL_ENCAP_ILA], [], [],
[[#include <linux/lwtunnel.h>]])
if test ${ac_cv_have_decl_RTA_ENCAP}; then
for flag in LWTUNNEL_ENCAP_MPLS LWTUNNEL_ENCAP_ILA; do
AS_VAR_COPY([decl_var], [ac_cv_have_decl_$flag])
if test ${decl_var} = yes; then
add_build_opt[${flag}]
fi
done
fi
dnl ----[Check for iptables libraries]----
USE_LIBIPTC=No
USE_LIBIPSET=No
if test .${enable_libiptc} != .no -a .$enable_vrrp != .no; then
USE_LIBIPTC=Yes
dnl -- linux/netfilter/x_tables.h since Linux 2.6.16
SAV_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $kernelinc"
AC_CHECK_HEADERS([linux/netfilter/x_tables.h xtables.h libiptc/libip6tc.h libiptc/libiptc.h libiptc/libxtc.h], [],
[
USE_LIBIPTC=No
break
])
CPPFLAGS="$SAV_CPPFLAGS"
if test $USE_LIBIPTC = Yes; then
add_pkg_config([--static libiptc], [IPTC])
LIBS="$IPTC_LIBS"
SAV_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $kernelinc"
AC_CHECK_LIB(iptc, iptc_init,
[
AC_DEFINE([_HAVE_LIBIPTC_], [ 1 ], [Define to 1 if have iptables libraries])
if test .${enable_libiptc_dynamic} != .yes; then
add_pkg_config([--static libiptc])
dnl - Older versions of libiptc produced a requirement for -liptc, but we don't need it
KA_LIBS=`echo $KA_LIBS | sed -e "s/ -liptc//"`
dnl - Even older versions of libiptc don't produce any requirement other than -liptc
IPTC_LIBS=`echo $IPTC_LIBS | sed -e "s/ *-L[[^ ]]* */ /" -e "s/ *-liptc */ /" -e "s/^ *$//"`
if test ".$IPTC_LIBS" = .; then
KA_LIBS=`echo $KA_LIBS -lip4tc -lip6tc`
fi
add_build_opt([LIBIPTC])
else
add_pkg_config_without_libs([libiptc])
add_build_opt([LIBIPTC_DYNAMIC])
AC_DEFINE([_LIBIPTC_DYNAMIC_], [ 1 ], [Define to 1 if building with libiptc dynamic linking])
NEED_LIBDL=Yes
get_lib_name([ip4tc], [iptc_init])
AC_DEFINE_UNQUOTED([IP4TC_LIB_NAME], [ "$LIB_NAME" ], [Define the ip4tc library name])
get_lib_name([ip6tc], [ip6tc_init])
AC_DEFINE_UNQUOTED([IP6TC_LIB_NAME], [ "$LIB_NAME" ], [Define the ip6tc library name])
fi
],
[USE_LIBIPTC=No])
CPPFLAGS="$SAV_CPPFLAGS"
fi
if test $USE_LIBIPTC = Yes; then
if test .$enable_libxtables_dynamic != .yes; then
add_pkg_config([xtables])
else
add_pkg_config_without_libs([xtables])
AC_DEFINE([_LIBXTABLES_DYNAMIC_], [ 1 ], [Define to 1 if building with libxtables dynamic linking])
add_build_opt([XTABLES_DYNAMIC])
NEED_LIBDL=Yes
get_lib_name([xtables], [xtables_insmod])
AC_DEFINE_UNQUOTED([XTABLES_LIB_NAME], [ "$LIB_NAME" ], [Define the xtables library name])
fi
dnl ----[Check for ipset libraries]----
SAV_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $kernelinc"
if test "${enable_libipset}" != no; then
$PKG_CONFIG --exists libipset
if test $? -eq 0; then
add_pkg_config([libipset], [IPSET])
else
IPSET_LIBS="-lipset"
fi
SAV_LIBS=$LIBS
LIBS="$IPTC_LIBS $IPSET_LIBS"
AC_CHECK_LIB(ipset, ipset_session_init,
[
USE_LIBIPSET=Yes
AC_CHECK_HEADERS([libipset/data.h libipset/linux_ip_set.h libipset/session.h libipset/types.h], [],
[
USE_LIBIPSET=No
break
])
if test $USE_LIBIPSET = Yes; then
AC_CHECK_LIB(xtables, xtables_insmod, [], [USE_LIBIPSET=No])
fi
if test $USE_LIBIPSET = Yes; then
dnl -- Need to include <libipset/linux_ip_set.h> for <linux/netfilter/xt_set.h> prior to Linux 3.4
EXTRA_INCLUDE=
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <linux/netfilter/xt_set.h>
]])], [],
[AC_CHECK_HEADER([linux/netfilter/xt_set.h],
[
AC_DEFINE([XT_SET_H_NEEDS_LINUX_IP_SET_H], [ 1 ], [Define to 1 if <linux/netfilter/xt_set.h> needs <libipset/linux_ip_set.h>])
EXTRA_INCLUDE="#include <libipset/linux_ip_set.h>"
], [AC_MSG_ERROR([Missing/unusable kernel header file <linux/netfilter/xt_set.h>])],
[[#include <libipset/linux_ip_set.h>]])])
AC_CHECK_HEADERS([linux/netfilter/xt_set.h], [], [USE_LIBIPSET=No], [$EXTRA_INCLUDE])
AC_DEFINE([_HAVE_LIBIPSET_], [ 1 ], [Define to 1 if have ipset library])
$PKG_CONFIG --exists libipset
if test $? -eq 0; then
if test .${enable_libipset_dynamic} = .no; then
add_pkg_config([libipset])
else
add_pkg_config_without_libs([libipset])
fi
elif test .${enable_libipset_dynamic} = .no; then
add_to_var([KA_LIBS], [-lipset])
fi
if test .${enable_libipset_dynamic} != .no; then
AC_DEFINE([_LIBIPSET_DYNAMIC_], [ 1 ], [Define to 1 if building with libipset dynamic linking])
add_build_opt([LIBIPSET_DYNAMIC])
NEED_LIBDL=Yes
get_lib_name([ipset], [ipset_session_init])
AC_DEFINE_UNQUOTED([IPSET_LIB_NAME], [ "$LIB_NAME" ], [Define the ipset library name])
else
add_build_opt([LIBIPSET])
fi
dnl - xt_set_info_match first introduced in Linux 2.6.39
dnl -- xt_set_info_match_v1 declared since Linux 3.1
AC_CHECK_MEMBER([struct xt_set_info_match_v1.match_set.index], [AC_DEFINE([HAVE_XT_SET_INFO_MATCH_V1], [ 1 ], [Define to 1 if have struct xt_set_info_match_v1])], [],
[
$EXTRA_INCLUDE
#include <linux/netfilter/xt_set.h>
])
dnl -- xt_set_info_match_v1 declared since Linux 3.10
AC_CHECK_MEMBER([struct xt_set_info_match_v3.match_set.index], [AC_DEFINE([HAVE_XT_SET_INFO_MATCH_V3], [ 1 ], [Define to 1 if have struct xt_set_info_match_v3])], [],
[
$EXTRA_INCLUDE
#include <linux/netfilter/xt_set.h>
])
dnl -- xt_set_info_match_v1 declared since Linux 3.19
AC_CHECK_MEMBER([struct xt_set_info_match_v4.match_set.index], [AC_DEFINE([HAVE_XT_SET_INFO_MATCH_V4], [ 1 ], [Define to 1 if have struct xt_set_info_match_v4])], [],
[
$EXTRA_INCLUDE
#include <linux/netfilter/xt_set.h>
])
dnl - ipset type iface introduced in Linux 3.1
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <linux/netfilter/ipset/ip_set.h>
int main(void) { int var = IPSET_ATTR_IFACE; }
]])],
[AC_DEFINE([HAVE_IPSET_ATTR_IFACE], [ 1 ], [Define to 1 if ipset supports iface type])])
dnl - The include guard for <linux/netfilter/ipset/ip_set.h> has the leading _UAPI remove when
dnl - the source code is processed to produce the actual header files.
dnl - Unfortunately libipset provides a copy of the kernel headers, as <libipset/linux_ip_set*.h>,
dnl - but it doesn't remove the _UAPI from the header files when installing them.
dnl - Unfortunately we need to include some libipset header files, which include the
dnl - libipset version, and also <linux/netfilter/xt_set.h> which includes the kernel version.
dnl - To get around this problem, after include one of these we need to define the header guard
dnl - for the other, to stop it being included as well.
dnl - This is reported as a bug against ipset at https://bugzilla.netfilter.org/show_bug.cgi?id=1139
dnl - We will take the kernel version if there is an inclusion collision.
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <linux/netfilter/ipset/ip_set.h>
#include <libipset/linux_ip_set.h>
int main(void) {}
]])], [],
[AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <linux/netfilter/ipset/ip_set.h>
#ifdef _UAPI_IP_SET_H
#error _UAPI_IP_SET_H defined
#endif
int main(void) {}
]])],
[AC_DEFINE([LIBIPSET_H_ADD_UAPI_IP_SET_H_GUARD], [1], [Define to add guard _UAPI_IP_SET_H before including <libipset/linux_ip_set.h>])],
[AC_DEFINE([LIBIPSET_H_ADD_IP_SET_H_GUARD], [1], [Define to add guard _IP_SET_H before including <libipset/linux_ip_set.h>])])
])
fi
])
LIBS="$SAV_LIBS"
fi
dnl -- XT_EXTENSION_MAXNAMELEN not defined until Linux 2.6.35
AC_CHECK_DECL([XT_EXTENSION_MAXNAMELEN], [],
[AC_DEFINE([XT_EXTENSION_MAXNAMELEN], [ (XT_FUNCTION_MAXNAMELEN - 1) ], [Define if <linux/netfilter/x_tables.h> doesnt define it])],
[#include <linux/netfilter/x_tables.h>])
CPPFLAGS="$SAV_CPPFLAGS"
fi
fi
AM_CONDITIONAL([LIBIPTC], [test $USE_LIBIPTC = Yes])
AM_CONDITIONAL([LIBIPSET], [test $USE_LIBIPSET = Yes])
unset LIBS
dnl ----[Check if have linux/if.h and net/if.h namespace collision]----
# Including <linux/if.h> and <net/if.h> can cause a namespace collision.
# Later versions of the headers are OK if linux/if.h is included second
AC_MSG_CHECKING([for linux/if.h and net/if.h namespace collision])
SAV_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $kernelinc"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <net/if.h>
#include <linux/if.h>
]])],
[
AC_MSG_RESULT([no])
],
[
AC_MSG_RESULT([yes])
AC_DEFINE([_HAVE_NET_LINUX_IF_H_COLLISION_], [ 1 ], [Define to 1 if have linux/if.h followed by net/if.h namespace collision])
add_build_opt([NET_LINUX_IF_H_COLLISION])
])
CPPFLAGS="$SAV_CPPFLAGS"
# Linux 4.5 to 4.5.4 has <libiptc/libiptc.h> indirectly including <net/if.h>
# and <linux/if.h> which causes a namespace collision.
AC_MSG_CHECKING([for libiptc/libiptc.h linux/if.h and net/if.h namespace collision])
SAV_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $kernelinc"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <libiptc/libiptc.h>
]])],
[
AC_MSG_RESULT([no])
],
[
AC_MSG_RESULT([yes])
AC_DEFINE([_HAVE_LIBIPTC_LINUX_NET_IF_H_COLLISION_], [ 1 ], [Define to 1 if have libiptc/libiptc.h linux/if.h and net/if.h namespace collision])
add_build_opt([LIBIPTC_LINUX_NET_IF_H_COLLISION])
])
CPPFLAGS="$SAV_CPPFLAGS"
dnl ----[ Checks for LVS and VRRP support ]----
IPVS_SYNCD_ATTRIBUTES=No
IPVS_64BIT_STATS=No
if test "$enable_lvs" != no; then
IPVS_SUPPORT=Yes
add_build_opt([LVS])
AC_DEFINE([_WITH_LVS_], [ 1 ], [Define to 1 if have IPVS support])
dnl -- <linux/ip_vs.h> exists from 2.6.27; prior to that <net/ip_vs.h> is used
AC_CHECK_HEADERS([linux/ip_vs.h],
[
dnl -- From 2.6.35 (but CentOS has it in 2.6.32)
AC_CHECK_DECLS([IP_VS_SVC_F_ONEPACKET], [], [],
[[#include <linux/ip_vs.h>]])
])
if test $IPVS_USE_NL = Yes; then
AC_DEFINE([LIBIPVS_USE_NL], [ 1 ], [Define to 1 if libipvs can use netlink])
add_build_opt([LIBIPVS_NETLINK])
fi
dnl ----[ IPVS syncd options ]---
SAV_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $kernelinc"
dnl -- Since Linux 3.18
AC_CHECK_DECLS([IPVS_DEST_ATTR_ADDR_FAMILY], [add_build_opt([IPVS_DEST_ATTR_ADDR_FAMILY])], [], [#include <linux/ip_vs.h>])
IPVS_SYNCD_ATTRIBUTES=Yes
AC_CHECK_DECLS([
IPVS_DAEMON_ATTR_SYNC_MAXLEN,
IPVS_DAEMON_ATTR_MCAST_GROUP,
IPVS_DAEMON_ATTR_MCAST_GROUP6,
IPVS_DAEMON_ATTR_MCAST_PORT,
IPVS_DAEMON_ATTR_MCAST_TTL], [],
[
IPVS_SYNCD_ATTRIBUTES=No
break
],
[[#include <linux/ip_vs.h>]])
dnl -- Since Linux 4.3
if test $IPVS_SYNCD_ATTRIBUTES = Yes; then
AC_DEFINE([_HAVE_IPVS_SYNCD_ATTRIBUTES_], [ 1 ], [Define to 1 if have IPVS syncd attributes])
add_build_opt([IPVS_SYNCD_ATTRIBUTES])
fi
dnl ----[ IPVS 64-bit stats ]----
dnl -- Since Linux 4.1
if test "$enable_lvs_64bit_stats" != "no"; then
IPVS_64BIT_STATS=Yes
AC_CHECK_DECLS([
IPVS_SVC_ATTR_STATS64,
IPVS_DEST_ATTR_STATS64], [],
[
IPVS_64BIT_STATS=No
break
],
[[#include <linux/ip_vs.h>]])
if test $IPVS_64BIT_STATS = Yes; then
AC_DEFINE([_WITH_LVS_64BIT_STATS_], [ 1 ], [Define to 1 if have IPVS 64 bit stats])
add_build_opt([IPVS_64BIT_STATS])
fi
fi
CPPFLAGS="$SAV_CPPFLAGS"
else
IPVS_SUPPORT=No
fi
AM_CONDITIONAL([WITH_IPVS], [test $IPVS_SUPPORT = Yes])
dnl ----[ Checks for kernel netlink support ]----
VRRP_SUPPORT=No
VRRP_AUTH_SUPPORT=No
MACVLAN_SUPPORT=No
ENABLE_JSON=No
if test "$enable_vrrp" != no; then
VRRP_SUPPORT=Yes
AC_DEFINE([_WITH_VRRP_], [ 1 ], [Define to 1 if have VRRP support])
add_build_opt([VRRP])
dnl ----[ check for VRRP authentication support ]----
if test "${enable_vrrp_auth}" != no; then
VRRP_AUTH_SUPPORT=Yes
AC_DEFINE([_WITH_VRRP_AUTH_], [ 1 ], [Define to 1 if want ARRP authentication support])
add_build_opt([VRRP_AUTH])
fi
dnl ----[ Checks for kernel VMAC support ]----
SAV_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $kernelinc"
MACVLAN_SUPPORT=Yes
dnl -- Since Linux 2.6.33
AC_CHECK_DECLS([
IFLA_MACVLAN_MODE,
MACVLAN_MODE_PRIVATE], [],
[
MACVLAN_SUPPORT=No
break
], [[
#include <sys/socket.h>
#include <linux/if_link.h>
]])
if test $MACVLAN_SUPPORT = Yes; then
AC_DEFINE([_HAVE_VRRP_VMAC_], [ 1 ], [Define to 1 if have MAC VLAN support])
add_build_opt([VRRP_VMAC])
fi
CPPFLAGS="$SAV_CPPFLAGS"
dnl ----[ Json output or not ? ]----
if test "${enable_json}" = yes; then
AC_CHECK_HEADERS(json-c/json.h,,AC_MSG_ERROR([unable to find json-c/json.h]))
AC_DEFINE([_WITH_JSON_], [ 1 ], [Define to 1 to build with json output support])
add_pkg_config([json-c])
ENABLE_JSON=Yes
add_build_opt([JSON])
fi
fi
AM_CONDITIONAL([WITH_VRRP], [test $VRRP_SUPPORT = Yes])
AM_CONDITIONAL([VRRP_AUTH], [test $VRRP_AUTH_SUPPORT = Yes])
AM_CONDITIONAL([VMAC], [test $MACVLAN_SUPPORT = Yes])
AM_CONDITIONAL([WITH_JSON], [test $ENABLE_JSON = Yes])