-
-
Notifications
You must be signed in to change notification settings - Fork 735
/
configure.ac
3643 lines (3340 loc) · 127 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-2018 Alexandre Cassen, <[email protected]>
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`])
if test .$3 = .remove-requires; then
REQUIRES=`$PKG_CONFIG --print-requires $1`
var=`$PKG_CONFIG --libs-only-l $1`
for r in $REQUIRES; do
REQ_LIBS=`$PKG_CONFIG --libs-only-l $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\""
var=`echo $var | sed -e "s/-l//g"`
eval ${KA_PKG_PFX}_LIB_NAMES="\"$var\""
else
add_to_var_ind_unique([${KA_PKG_PFX}_LIBS], [`$PKG_CONFIG --libs $1`])
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_config_opt], [add_to_var([CONFIG_OPTIONS], [$1])])
AC_DEFUN([add_system_opt], [add_to_var([SYSTEM_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="$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], [2.3.1], [[email protected]], [], [http://www.keepalived.org/])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])
AC_LANG([C])
AM_INIT_AUTOMAKE([-Wall -Werror -Woverride foreign])
AC_CONFIG_SRCDIR([keepalived/core/main.c])
AC_CONFIG_HEADERS([lib/config.h lib/config_warnings.h])
AH_TOP(
[
#ifndef _CONFIG_H
#define _CONFIG_H
])
AH_BOTTOM(
[
#include "config_warnings.h"
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#endif])
AC_CONFIG_FILES([Makefile keepalived/Makefile lib/Makefile keepalived/core/Makefile keepalived.spec \
Dockerfile \
keepalived/check/Makefile keepalived/vrrp/Makefile \
keepalived/bfd/Makefile doc/Makefile bin_install/Makefile keepalived/dbus/Makefile \
keepalived/etc/Makefile keepalived/etc/init/Makefile keepalived/etc/init.d/Makefile \
keepalived/etc/sysconfig/Makefile keepalived/etc/keepalived/Makefile \
keepalived/trackers/Makefile \
doc/man/man8/Makefile doc/man/man5/Makefile doc/man/man1/Makefile])
MAINTAINERCLEANFILES="*~ *.orig *.rej core core.*"
AC_SUBST(MAINTAINERCLEANFILES)
CONFIG_OPTIONS=
SYSTEM_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_ENABLE(bfd,
[AS_HELP_STRING([--enable-bfd], [use the BFD 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_WITH(samples-dir,
[AS_HELP_STRING([--with-samples-dir=DIR], [specify location to install sample config files [SYSCONFDIR/samples]])])
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 RFC6527 (VRRPv3) support])])
AC_ARG_ENABLE(snmp-reply-v3-for-v2,
[AS_HELP_STRING([--disable-snmp-reply-v3-for-v2], [disable RFC6527 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(regex,
[AS_HELP_STRING([--enable-regex], [build with HTTP_GET regex checking])])
AC_ARG_ENABLE(vmac,
[AS_HELP_STRING([--disable-vmac], [build without VMAC support])])
AC_ARG_ENABLE(nm,
[AS_HELP_STRING([--enable-nm], [enable setting VMACs unmanaged by NetworkManager (for pre 1.18 NM)])])
AC_ARG_ENABLE(regex-timers,
[AS_HELP_STRING([--enable-regex-timers], [build with HTTP_GET regex timers])])
AC_ARG_ENABLE(json,
[AS_HELP_STRING([--enable-json], [compile with signal to dump configuration and stats as json])])
AC_ARG_ENABLE(clang,
[AS_HELP_STRING([--enable-clang], [use clang compiler])])
AC_ARG_ENABLE(lto,
[AS_HELP_STRING([--enable-lto], [use Link Time Optimisation])])
AC_ARG_ENABLE(reproducible-build,
[AS_HELP_STRING([--enable-reproducible-build], [make builds reproducible])])
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(checksum_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(linkbeat,
[AS_HELP_STRING([--disable-linkbeat], [build without linkbeat support])])
AC_ARG_ENABLE(sockaddr_storage,
[AS_HELP_STRING([--enable-sockaddr-storage], [build using sockaddr_storage rather than smaller sockaddr for IPv4/6 only])])
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/libnl])])
AC_ARG_ENABLE(iptables,
[AS_HELP_STRING([--disable-iptables], [compile without iptables support])],
[], [IPTABLES_SILENT=Yes])
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(libnl-dynamic,
[AS_HELP_STRING([--enable-libnl-dynamic], [compile with libnl dynamically linked])])
AC_ARG_ENABLE(libipset,
[AS_HELP_STRING([--disable-libipset], [compile without libipset])])
AC_ARG_ENABLE(nftables,
[AS_HELP_STRING([--disable-nftables], [build without nftables support])],
[], [NFTABLES_SILENT=Yes])
AC_ARG_ENABLE(libnl,
[AS_HELP_STRING([--disable-libnl], [compile without libnl])])
AC_ARG_ENABLE(track-process,
[AS_HELP_STRING([--disable-track-process], [build without track-process functionality])])
AC_ARG_ENABLE(systemd,
[AS_HELP_STRING([--disable-systemd], [build without systemd integration])])
AC_ARG_WITH(run-dir,
[AS_HELP_STRING([--with-run-dir=PATH_TO_RUN], [DEPRECATED - use --runstatedir=PATH_TO_RUN])])
AC_ARG_WITH(tmp-dir,
[AS_HELP_STRING([--with-tmp-dir=PATH_TO_TMP], [specify directory where run-time temporary files are to be located])],
[TMP_DIR_SPECIFIED=Y], [TMP_DIR_SPECIFIED=N])
AC_ARG_WITH(iproute-usr-dir,
[AS_HELP_STRING([--with-iproute-usr-dir=PATH_TO_CONFIG_FILES], [specify usr directory iproute2 uses for config files])])
AC_ARG_WITH(iproute-etc-dir,
[AS_HELP_STRING([--with-iproute-etc-dir=PATH_TO_CONFIG_FILES], [specify etc directory iproute2 uses for config files])])
AC_ARG_ENABLE(strict-config-checks,
[AS_HELP_STRING([--enable-strict-config-checks], [build with strict configuration checking])])
AC_ARG_ENABLE(hardening,
[AS_HELP_STRING([--disable-hardening], [do not build with security hardening])])
AC_ARG_ENABLE(optimise,
[AS_HELP_STRING([--enable-optimise], [compiler optimisation level])], [], [enable_optimise=not-specified])
AC_ARG_ENABLE(warnings,
[AS_HELP_STRING([--enable-warnings[[=WARNINGS]]], [additional compiler warnings, disable for reduced set])], [], [enable_warnings=yes])
AC_ARG_ENABLE(extra-warnings,
[AS_HELP_STRING([--enable-extra-warnings], [extra compiler warnings that will probably produce many warnings])])
AC_ARG_ENABLE(mem-check,
[AS_HELP_STRING([--enable-mem-check], [compile with memory alloc checking - e.g. no writes before or after buffer, everything allocated is freed])])
AC_ARG_ENABLE(mem-check-log,
[AS_HELP_STRING([--enable-mem-check-log], [compile with memory alloc checking writing to syslog])])
AC_ARG_ENABLE(openssl-mem-check,
[AS_HELP_STRING([--enable-openssl-mem-check], [compile with OpenSSL memory alloc checking - e.g. no writes before or after buffer, everything allocated is freed])])
AC_ARG_ENABLE(malloc-check,
[AS_HELP_STRING([--enable-malloc-check], [compile with malloc checking - i.e. malloc etc returning NULL])])
AC_ARG_ENABLE(timer-check,
[AS_HELP_STRING([--enable-timer-check], [compile with set time logging])])
AC_ARG_ENABLE(debug,
[AS_HELP_STRING([--enable-debug], [compile with most debugging options])])
AC_ARG_ENABLE(netlink-timers,
[AS_HELP_STRING([--enable-netlink-timers], [compile with netlink command timers])])
AC_ARG_ENABLE(smtp-alert-debug,
[AS_HELP_STRING([--enable-smtp-alert-debug], [compile with smtp-alert debugging])])
AC_ARG_ENABLE(stacktrace,
[AS_HELP_STRING([--enable-stacktrace], [compile with stacktrace support])])
AC_ARG_ENABLE(perf,
[AS_HELP_STRING([--enable-perf], [compile with perf performance data recording support for vrrp process])])
AC_ARG_ENABLE(sanitize-address,
[AS_HELP_STRING([--enable-sanitize-address], [compile with sanitize=address (ASAN) support])])
AC_ARG_ENABLE(sanitize-address-options,
[AS_HELP_STRING([--enable-sanitize-address-options], [compile with sanitize=address (ASAN) default options])])
AC_ARG_ENABLE(sanitize-hwaddress,
[AS_HELP_STRING([--enable-sanitize-hwaddress], [compile with sanitize=hwaddress (HWASAN) support])])
AC_ARG_ENABLE(sanitize-hwaddress-options,
[AS_HELP_STRING([--enable-sanitize-hwaddress-options], [compile with sanitize=hwaddress (HWASAN) default options])])
AC_ARG_ENABLE(sanitize-undefined,
[AS_HELP_STRING([--enable-sanitize-undefined], [compile with sanitize=undefined (UBSAN) support])])
AC_ARG_ENABLE(sanitize-undefined-options,
[AS_HELP_STRING([--enable-sanitize-undefined-options], [compile with sanitize=undefined (UBSAN) default options])])
AC_ARG_ENABLE(sanitize-memory,
[AS_HELP_STRING([--enable-sanitize-memory], [compile with sanitize=memory (MSAN) support])])
AC_ARG_ENABLE(sanitize-memory-options,
[AS_HELP_STRING([--enable-sanitize-memory-options], [compile with sanitize=memory (MSAN) default options])])
AC_ARG_ENABLE(sanitize-leak,
[AS_HELP_STRING([--enable-sanitize-leak], [compile with sanitize=leak (LSAN) support])])
AC_ARG_ENABLE(sanitize-leak-options,
[AS_HELP_STRING([--enable-sanitize-leak-options], [compile with sanitize=leak (LSAN) default options])])
AC_ARG_ENABLE(sanitize-scudo,
[AS_HELP_STRING([--enable-sanitize-scudo], [compile with sanitize=scudo support])])
AC_ARG_ENABLE(sanitize-scudo-options,
[AS_HELP_STRING([--enable-sanitize-scudo-options], [compile with sanitize=scudo default options])])
AC_ARG_ENABLE(log-file,
[AS_HELP_STRING([--enable-log-file], [enable logging to file (-g)])])
AC_ARG_ENABLE(dump-threads,
[AS_HELP_STRING([--enable-dump-threads], [compile with thread dumping support])])
AC_ARG_ENABLE(epoll-debug,
[AS_HELP_STRING([--enable-epoll-debug], [compile with epoll_wait() debugging support])])
AC_ARG_ENABLE(epoll-thread-dump,
[AS_HELP_STRING([--enable-epoll-thread-dump], [compile with epoll thread dumping support])])
AC_ARG_ENABLE(regex-debug,
[AS_HELP_STRING([--enable-regex-debug], [compile with regex debugging support])])
AC_ARG_ENABLE(tsm-debug,
[AS_HELP_STRING([--enable-tsm-debug], [compile with TSM debugging support])])
AC_ARG_ENABLE(vrrp-fd-debug,
[AS_HELP_STRING([--enable-vrrp-fd-debug], [compile with vrrp fd debugging support])])
AC_ARG_ENABLE(recvmsg-debug,
[AS_HELP_STRING([--enable-recvmsg-debug], [compile with recvmsg() debugging support])])
AC_ARG_ENABLE(eintr-debug,
[AS_HELP_STRING([--enable-eintr-debug], [compile with EINTR debugging support, set to check/not check for EINTR])])
AC_ARG_ENABLE(track-process-debug,
[AS_HELP_STRING([--enable-track-process-debug], [compile with track process debugging support, set to log all process connector events])])
AC_ARG_ENABLE(parser-debug,
[AS_HELP_STRING([--enable-parser-debug], [compile with parser debugging support])])
AC_ARG_ENABLE(checksum-debug,
[AS_HELP_STRING([--enable-checksum-debug], [compile with checksum debugging support])])
AC_ARG_ENABLE(checker-debug,
[AS_HELP_STRING([--enable-checker-debug], [compile with checker debugging support])])
AC_ARG_ENABLE(smtp-connect-debug,
[AS_HELP_STRING([--enable-smtp-connect-debug], [compile with smtp connect debugging support])])
AC_ARG_ENABLE(mem-err-debug,
[AS_HELP_STRING([--enable-mem-err-debug], [compile with MALLOC/FREE error debugging support])])
AC_ARG_ENABLE(script-debug,
[AS_HELP_STRING([--enable-script-debug], [compile with script termination debugging support])])
AC_ARG_ENABLE(one-process-debug,
[AS_HELP_STRING([--enable-one-process-debug], [compile with all functionality running in a single process])])
AC_ARG_ENABLE(dump-keywords,
[AS_HELP_STRING([--enable-dump-keywords], [compile with keyword dumping support])])
AC_ARG_ENABLE(network-timestamp,
[AS_HELP_STRING([--enable-network-timestamp], [compile with network timestamp debugging support])])
AC_ARG_ENABLE(asserts,
[AS_HELP_STRING([--enable-asserts], [compile with assert() enabled])])
AC_ARG_WITH(fixed-if-type,
[AS_HELP_STRING([--with-fixed-if-type=TYPE], [treat interface type TYPE as unchangeable])])
AC_ARG_WITH(default-config-file,
AS_HELP_STRING([--with-default-config-file=FILE], [Default configuration file]),
[default_config_file="$withval"], [default_config_file=""])
AC_ARG_WITH(default-runtime-options,
AS_HELP_STRING([--with-default-runtime-options=OPTIONS], [Default runtime options]),
[default_runtime_options="$withval"], [default_runtime_options="-D"])
AC_ARG_ENABLE(profile,
[AS_HELP_STRING([--enable-profile], [compile with profiling flags])])
AC_ARG_ENABLE(strict-cast-align,
[AS_HELP_STRING([--enable-strict-cast-align], [compile with strict cast alignment warnings])])
AC_ARG_ENABLE(cast-align-checks,
[AS_HELP_STRING([--enable-cast-align-checks], [runtime cast alignment checks])])
AC_ARG_ENABLE(cast-via-void,
[AS_HELP_STRING([--enable-cast-via-void], [enable pointer cast via void * (default if warns without)])]
[AS_HELP_STRING([--disable-cast-via-void], [disable pointer cast via void * (default if does not warn without)])])
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_WITH([systemdsystemunitdir],
[AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files])],,
[with_systemdsystemunitdir=auto])
AC_ARG_WITH([dbus-data-dir],
[AS_HELP_STRING([--with-dbus-data-dir=DIR], [Directory for Dbus interface files])])
AC_ARG_ENABLE([cflags],
[AS_HELP_STRING([--enable-cflags=flags], [additional CFLAGS])])
AC_ARG_ENABLE([cppflags],
[AS_HELP_STRING([--enable-cppflags=flags], [additional CPPFLAGS])])
AC_ARG_ENABLE([ldflags],
[AS_HELP_STRING([--enable-ldflags=flags], [additional LDFLAGS])])
# Set the kernel headers path
if test -n "$kernel_src_path"; then
if test ! -d $kernel_src_path/include; then
AC_MSG_ERROR([kernel source path $kernel_src_path/include does not exist])
fi
if test ! -d $kernel_src_path/include/linux; then
AC_MSG_ERROR([kernel source path $kernel_src_path/include does not appear to include linux header files])
fi
if test -d $kernel_src_path/include/uapi/linux; then
AC_MSG_ERROR([kernel source path $kernel_src_path appears to be an unprocessed kernel source tree])
fi
kernelinc="-isystem $kernel_src_path/include"
elif test ! -d /usr/include/linux -a \
-d /usr/src/linux/include; then
kernelinc="-isystem /usr/src/linux/include"
else
kernelinc=
fi
SRC_DIR=`AS_DIRNAME([$0])`
AS_IF([test -n "$with_samples_dir"],
[
AS_IF([test $with_samples_dir = yes -o $with_samples_dir = no],
[AC_MSG_ERROR([--with-samples-dir requires a directory])])
SAMPLES_DIR=$with_samples_dir
],[SAMPLES_DIR="\${sysconfdir}/$PACKAGE/samples"])
AC_SUBST([SAMPLES_DIR])
CPPFLAGS="$kernelinc $CPPFLAGS"
AS_IF([test .$enable_clang = .yes ],
[
USE_CC=clang
AC_CHECK_TOOL([USE_LLD], [lld], [:])
AS_IF([test $USE_LLD != :], [LDFLAGS+=" -fuse-ld=lld -rtlib=compiler-rt"])
],
[
USE_CC="gcc cc"
])
# Checks for programs.
AC_PROG_CC($USE_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)
# Default settings
ENABLE_LOG_FILE_APPEND=No
# AC_PROG_LIBTOOL
# Ensure we don't override FORTIFY_SOURCE
ADD_FORTIFY_SOURCE=1
grep -q -- "-D *_FORTIFY_SOURCE=" <<<$CPPFLAGS
AS_IF([test $? -eq 0],
[
FORTIFY_SOURCE=$(<<<$CPPFLAGS $SED -e "s/.*-D *_FORTIFY_SOURCE=//" -e "s/ .*//")
ADD_FORTIFY_SOURCE=0
],[FORTIFY_SOURCE=2])
#
# save the configure arguments
#
args=`echo $ac_configure_args | $SED -e "s/'//g"`
AS_IF([test .$enable_reproducible_build = .yes], [`echo $ac_configure_args | $SED -e "s/-ffile-prefix-map=[[^ ]]*//g"`])
AC_DEFINE_UNQUOTED(KEEPALIVED_CONFIGURE_OPTIONS,"$args", [configure options specified])
AS_IF([test .$enable_lto = .yes],
[
AS_IF([test .$enable_clang = .yes], [CFLAGS+=" -flto"], [CFLAGS+=" -flto=auto -ffat-lto-objects"])
])
# Save the CPPFLAGS, CFLAGS, LDFLAGS and LDLIBS settings for make time
KA_CPPFLAGS="$kernelinc -D_GNU_SOURCE $CPPFLAGS"
KA_CFLAGS="-g $CFLAGS"
KA_LDFLAGS=$LDFLAGS
KA_LIBS=$LDLIBS
# Set any additional compiler flags
AS_IF([test -n "$enable_cflags" -a "$enable_cflags" != no], [add_to_var([KA_CFLAGS], ["$enable_cflags"])])
AS_IF([test -n "$enable_cppflags" -a "$enable_cppflags" != no], [add_to_var([KA_CPPFLAGS], ["$enable_cppflags"])])
AS_IF([test -n "$enable_ldflags" -a "$enable_ldflags" != no], [add_to_var([KA_LDFLAGS], ["$enable_ldflags"])])
# For reporting GCC bugs, uncomment the next two lines
#KA_CPPFLAGS="$KA_CPPFLAGS -v -save-temps"
#KA_CFLAGS="$KA_CFLAGS -v -save-temps"
# To produce mixed source and assembly
#KA_CFLAGS="$KA_CFLAGS -Wa,adhln"
NEED_LIBDL=No
#KA_LIBTOOLFLAGS =
# Set up the compiler warnings we want
dnl -- Unused warnings - traditional c90-c99-compat c99-c11-compat c++-compat larger-than=4096 long-long packed stringop-overflow switch-default vla vla-larger-than=ANY-SIZE
dnl alloca-size-larger-than= (since alloca warning)
MAX_FRAME_SIZE=5120
WARNINGS_BASIC="all extra unused strict-prototypes"
WARNINGS_STD="abi absolute-value address-of-packed-member alloca alloc-larger-than=4096 alloc-zero arith-conversion array-bounds=2 attribute-alias=2 bad-function-cast c11-c2x-compat cast-align cast-qual chkp date-time disabled-optimization double-promotion duplicated-branches duplicated-cond float-conversion float-equal format-overflow format-security format-signedness format-truncation frame-larger-than=$MAX_FRAME_SIZE implicit-fallthrough=3 init-self inline invalid-pch jump-misses-init logical-op missing-declarations missing-field-initializers missing-include-dirs missing-prototypes nested-externs normalized null-dereference old-style-definition overlength-strings pointer-arith redundant-decls shadow shift-overflow=2 stack-protector strict-overflow=4 stringop-overflow=2 stringop-truncation suggest-attribute=cold suggest-attribute=const suggest-attribute=format suggest-attribute=malloc suggest-attribute=noreturn suggest-attribute=pure sync-nand trampolines undef uninitialized unknown-pragmas unsafe-loop-optimizations unsuffixed-float-constants unused-const-variable=2 unused-macros variadic-macros write-strings"
WARNINGS_EXTRA="aggregate-return cast-align=strict conversion format-nonliteral format-overflow=2 format-truncation=2 padded pedantic sign-conversion stack-usage=$MAX_FRAME_SIZE strict-overflow=5 stringop-overflow=3 stringop-overflow=4 switch-enum system-headers traditional-conversion"
# We want _GNU_SOURCE defined always
add_to_var([CPPFLAGS], [-D_GNU_SOURCE])
# fpclassify() needs -lm
add_to_var([KA_LIBS], [-lm])
# Some sanity checks on configure options
AS_IF([test .$enable_vrrp = .no],
AS_IF([test .$IPTABLES_SILENT == .Yes], [enable_iptables=no])
AS_IF([test .$enable_perf != .], [AC_MSG_ERROR([enable-perf requires vrrp])])
AS_IF([test $with_fixed_if_type], [AC_MSG_ERROR([with-fixed-if-type requires vrrp])])
AS_IF([test .$enable_vrrp_fd_debug != .], [AC_MSG_ERROR([enable-vrrp-fd-debug requires vrrp])])
AS_IF([test .$enable_tsm_debug != .], [AC_MSG_ERROR([enable-tsm-debug requires vrrp])])
AS_IF([test .$enable_recvmsg_debug != .], [AC_MSG_ERROR([enable-recvmsg-debug requires vrrp])])
AS_IF([test .$enable_json != .], [AC_MSG_ERROR([enable-json requires vrrp])])
AS_IF([test .$enable_snmp_vrrp != .], [AC_MSG_ERROR([enable-snmp-vrrp requires vrrp])])
AS_IF([test .$enable_snmp_keepalived != .], [AC_MSG_ERROR([enable-snmp-keepalived requires vrrp])])
AS_IF([test .$enable_snmp_rfc != .], [AC_MSG_ERROR([enable-snmp-rfc requires vrrp])])
AS_IF([test .$enable_snmp_rfcv2 != .], [AC_MSG_ERROR([enable-snmp-rfcv2 requires vrrp])])
AS_IF([test .$enable_snmp_rfcv3 != .], [AC_MSG_ERROR([enable-snmp-rfcv3 requires vrrp])])
AS_IF([test .$enable_dbus != .], [AC_MSG_ERROR([enable-dbus requires vrrp])])
AS_IF([test .$enable_vrrp_auth != .], [AC_MSG_ERROR([disable-vrrp-auth requires vrrp])])
AS_IF([test .$enable_checksum_compat != .], [AC_MSG_ERROR([disable-checksum-compat requires vrrp])])
AS_IF([test .$enable_routes != .], [AC_MSG_ERROR([disable-routes requires vrrp])])
AS_IF([test .$enable_linkbeat != .], [AC_MSG_ERROR([disable-linkbeat requires vrrp])])
AS_IF([test .$enable_bfd != .], [AC_MSG_ERROR([enable-bfd requires vrrp])])
AS_IF([test .$enable_iptables != .no], [AC_MSG_ERROR([disable-iptables requires vrrp])])
AS_IF([test .$enable_track_process != .], [AC_MSG_ERROR([disable-track-process requires vrrp])])
AS_IF([test .$enable_network_timestamp != .], [AC_MSG_ERROR([enable-network-timestamp requires vrrp])])
AS_IF([test .$enable_netlink_timers != .], [AC_MSG_ERROR([enable-netlink-timers requires vrrp])])
)
AS_IF([test .$enable_iptables = .no],
AS_IF([test .$enable_libipset != .], [AC_MSG_ERROR([disable-libipset requires vrrp and iptables])])
)
AS_IF([test .$enable_libipset = .no],
AS_IF([test .$enable_libipset_dynamic != .], [AC_MSG_ERROR([disable-libipset-dynamic requires ipsets])])
)
AS_IF([test .$enable_snmp_rfc != .yes -a .$enable_snmp_rfcv3 != yes],
AS_IF([test .$enable_snmp_reply_v3_for_v2 != .], [AC_MSG_ERROR([disable-snmp-reply-v3-for-v2 requires enable-snmp-rfcv3 or enable-snmp-rfc])])
)
AS_IF([test .$enable_dbus != .yes],
AS_IF([test .$enable_dbus_create_instance != .], [AC_MSG_ERROR([enable-dbus-create-instance requires enable-dbus])])
)
AS_IF([test .$enable_lvs = .no],
AS_IF([test .$enable_regex != .], [AC_MSG_ERROR([enable-regex requires lvs])])
AS_IF([test .$enable_libnl != .], [AC_MSG_ERROR([disable-libnl requires lvs])])
AS_IF([test .$enable_lvs_syncd != .], [AC_MSG_ERROR([disable-lvs-syncd requires lvs])])
AS_IF([test .$enable_lvs_64bit_stats != .], [AC_MSG_ERROR([disable-lvs-64bit-stats requires lvs])])
AS_IF([test .$enable_fwmark != .], [AC_MSG_ERROR([disable-fwmark requires lvs])])
AS_IF([test .$enable_checker_debug != .], [AC_MSG_ERROR([enable-checker-debug requires lvs])])
AS_IF([test .$enable_openssl_mem_check != .], [AC_MSG_ERROR([enable-openssl-mem-check requires lvs])])
)
AS_IF([test .$enable_libnl = .no],
AS_IF([test .$enable_libnl_dynamic != .], [AC_MSG_ERROR([enable-libnl-dynamic requires lvs and libnl])])
)
AS_IF([test .$enable_regex != .yes],
AS_IF([test .$enable_regex_timers != .], [AC_MSG_ERROR([enable-regex-timers requires enable-regex])])
AS_IF([test .$enable_regex_debug != .], [AC_MSG_ERROR([enable-regex-debug requires enable-regex])])
)
AS_IF([test .$enable_track_process = .no],
AS_IF([test .$enable_track_process_debug != .], [AC_MSG_ERROR([enable-track-process-debug incompatible with disable-track-process])])
)
AS_IF([test .$enable_mem_check != .yes],
AS_IF([test .$enable_mem_err_debug != .], [AC_MSG_ERROR([enable-mem-err-debug requires --enable-mem-check])])
)
# --enable-debug enables most debugging if not explicitly disabled, but NOT one-process-debug
AS_IF([test .$enable_debug = .yes],
[
# If we are debugging, we want to be able to write logs to files
AS_IF([test .$enable_log_file = .], [enable_log_file=yes])
AS_IF([test .$enable_asserts = .], [enable_asserts=yes])
AS_IF([test .$enable_epoll_debug = .], [enable_epoll_debug=yes])
AS_IF([test .$enable_epoll_thread_dump = .], [enable_epoll_thread_dump=yes])
AS_IF([test .$enable_eintr_debug = .], [enable_eintr_debug=yes])
AS_IF([test .$enable_parser_debug = .], [enable_parser_debug=yes])
AS_IF([test .$enable_timer_check = .], [enable_timer_check=yes])
AS_IF([test .$enable_smtp_alert_debug = .], [enable_smtp_alert_debug=yes])
AS_IF([test .$enable_smtp_connect_debug = .], [enable_smtp_connect_debug=yes])
AS_IF([test .$enable_dump_keywords = .], [enable_dump_keywords=yes])
AS_IF([test .$enable_script_debug = .], [enable_script_debug=yes])
AS_IF([test .$enable_vrrp != .no],
[
AS_IF([test .$enable_vrrp_fd_debug = .], [enable_vrrp_fd_debug=yes])
AS_IF([test .$enable_tsm_debug = .], [enable_tsm_debug=yes])
AS_IF([test .$enable_recvmsg_debug = .], [enable_recvmsg_debug=yes])
AS_IF([test .$enable_track_process_debug = .], [enable_track_process_debug=yes])
AS_IF([test .$enable_checksum_debug = .], [enable_checksum_debug=yes])
AS_IF([test .$enable_netlink_timers = .], [enable_netlink_timers=yes])
AS_IF([test .$enable_network_timestamp = .], [enable_network_timestamp=yes])
])
AS_IF([test .$enable_lvs != .no],
[
AS_IF([test .$enable_checker_debug = .], [enable_checker_debug=yes])
AS_IF([test .$enable_regex = .yes],
[
AS_IF([test .$enable_regex_timers = .], [enable_regex_timers=yes])
AS_IF([test .$enable_regex_debug = .], [enable_regex_debug=yes])
])
])
AS_IF([test .$enable_mem_check = .yes],
[
AS_IF([test .$enable_mem_err_debug = .], [enable_mem_err_debug=yes])
])
])
dnl --with-run-dir duplicates standard --runstatedir
AS_IF([test .$with_run_dir != .], [AC_MSG_ERROR([--with-run-dir is deprecated, use --runstatedir=${with_run_dir}/run instead])])
dnl -- Do we want -Wcast-align=strict?
AS_IF([test .$enable_strict_cast_align = .yes],
[WARNINGS_STD=`echo $WARNINGS_STD | sed -e "s/cast-align /cast-align=strict /"`])
#### find the actual value for $datadir that we'll end up with
## (I know this is broken and should be done in the Makefile, but
## that's a major pain and almost nobody actually seems to care)
## In fact the "Built Sources Example" section of the automake
## manual suggests using configure as an option.
AS_AC_EXPAND(EXPANDED_DATADIR, "$datadir")
AS_IF([test .$with_dbus_data_dir != .],
[DBUS_DATADIR=$with_dbus_data_dir], [DBUS_DATADIR=$EXPANDED_DATADIR])
AC_SUBST(DBUS_DATADIR)
AC_DEFINE_UNQUOTED(DBUS_DATADIR,"$DBUS_DATADIR", [Directory for installing DBUS data files])
dnl We want /run to be the default runstatedir, not ${localstatedir}/run which defaults to /usr/local/var/run
dnl We want to know if --runstatedir or equivalent was specified
echo "$ac_configure_args" | grep -q "'--r"
RUNSTATEDIR_SPECIFIED=$?
AS_IF([test $RUNSTATEDIR_SPECIFIED -eq 1],
[
echo "$ac_configure_args" | grep -q "'-runstatedir"
RUNSTATEDIR_SPECIFIED=$?
])
AS_IF([test $RUNSTATEDIR_SPECIFIED -eq 0],
[AS_AC_EXPAND(RUNSTATEDIR, "$runstatedir")],
[RUNSTATEDIR=/run])
AC_DEFINE_UNQUOTED(RUNSTATEDIR, "$RUNSTATEDIR", [Directory for runtime state files])
GCC_LTO=no
AS_IF([test $CC = gcc],
[
dnl -- check if we are using LTO. There is a GCC bug which means that when addattr_l()
dnl -- is inlined, GCC (up to at least v11.1.1) ignores RELAX_STRINGOP_OVERFLOW and issues
dnl -- -Wstringop-overflow warnings
dnl -- I haven't been able to produce a test case to demonstrate this GCC bug, so we can't
dnl -- test it here, nor have I been able to report a bug upstream to GCC.
AC_MSG_CHECKING([if using GCC Link Time Optimisation])
echo " $CFLAGS " | grep -q -- " -flto=auto "
AS_IF([test $? -eq 0],
[
AC_MSG_RESULT([yes])
GCC_LTO=yes
], [
AC_MSG_RESULT([no])
])
])
AS_IF([test $GCC_LTO = yes],
[AC_DEFINE([GCC_LTO_NOINLINE], [ __attribute__((noinline)) ], [Define to not inline if using GCC LTO])],
[AC_DEFINE([GCC_LTO_NOINLINE], [], [Define to not inline if using GCC LTO])])
dnl -- ulibc/glibc differences
AC_MSG_CHECKING([msghdr.msg_controllen is size_t])
SAV_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -Werror"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <sys/socket.h>
#include <stdio.h>
int main(void)
{
struct msghdr msgh = { .msg_controllen = 0 };
printf("%zu", msgh.msg_controllen);
}
]])],
[
AC_MSG_RESULT([yes])
AC_DEFINE([PRI_MSG_CONTROLLEN], [ "zu" ], [Define to zu if msghdr.msg_controllen is size_t, else u])
],
[
AC_MSG_RESULT([no])
AC_DEFINE([PRI_MSG_CONTROLLEN], [ "u" ], [Define to zu if msghdr.msg_controllen is size_t, else u])
])
CFLAGS=$SAV_CFLAGS
dnl -- printing time types (32 bit Ubuntu uses long long int for time_t timeval tv_sec/tv_usec and timespec tv_sec - but timespec tv_nsec is long int!)
dnl -- normally all the fields are long int
AC_MSG_CHECKING([time print types])
AH_TEMPLATE([PRI_time_t], [Define for print format for time_t])
AH_TEMPLATE([PRI_tv_sec], [Define for print format for struct timeval tv_sec])
AH_TEMPLATE([PRI_tv_usec], [Define for print format for struct timeval tv_usec])
AH_TEMPLATE([PRI_ts_sec], [Define for print format for struct timespec tv_sec])
AH_TEMPLATE([PRI_ts_nsec], [Define for print format for struct timespec tv_nsec])
SAV_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -Wformat -Wformat-signedness"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
int main(void)
{
}
]])],
[
signs="d u"
WARN_SIGN="-Werror=format-signedness"
],
[
signs="d"
WARN_SIGN=""
])
CFLAGS="$CFLAGS -Werror=format $WARN_SIGN"
for field in t tv.tv_sec tv.tv_usec ts.tv_sec ts.tv_nsec; do
for sign in $signs; do
for len in "" l ll; do
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <time.h>
#include <sys/time.h>
#include <stdio.h>
int main(void)
{
time_t t = 1;
struct timeval tv = { .tv_sec = 2 };
struct timespec ts = { .tv_sec = 3 };
printf("%$len$sign", $field);
}
]])],
[
if [[ $field = t ]]; then
name=time_t
else
name=$(<<<$field $SED -e "s/\.tv//")
fi
AC_DEFINE_UNQUOTED([PRI_$name], [ "$len$sign" ])
], [])
done
done
done
CFLAGS=$SAV_CFLAGS
AC_MSG_RESULT([done])
dnl -- Check for diagnostic pragmas in functions - GCC 4.6.0
AC_MSG_CHECKING([diagnostic pragmas in functions])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
int main(void)
{
_Pragma("GCC diagnostic warning \"-Wall\"")
}
]])],
[
AC_MSG_RESULT([yes])
AC_DEFINE([_HAVE_FUNCTION_DIAGNOSTIC_PRAGMAS_], [ 1 ], [Define to 1 if can have _Pragma GCC diagnostic in functions])
],
[
AC_MSG_RESULT([no])
])
AM_CONDITIONAL([DEBUG], [test .$enable_debug = .yes])
dnl -- Check for diagnostic push/pop pragmas - GCC 4.6.0
AC_MSG_CHECKING([diagnostic push/pop pragmas])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
int main(void)
{
_Pragma("GCC diagnostic push")
}
]])],
[
AC_MSG_RESULT([yes])
AC_DEFINE([_HAVE_DIAGNOSTIC_PUSH_POP_PRAGMAS_], [ 1 ], [Define to 1 if can have _Pragma GCC diagnostic push/pop])
],
[
AC_MSG_RESULT([no])
])
dnl - Set up warnings list
AS_IF([test ".$enable_warnings" = .no],
[WARNINGS_ENABLED=$WARNINGS_BASIC],
[WARNINGS_ENABLED="$WARNINGS_BASIC $WARNINGS_STD"
AS_IF([test ".$enable_warnings" != .yes],
[WARN_LIST=`echo $enable_warnings | sed -e "s/-W//g"`
add_to_var([WARNINGS_ENABLED], ["$WARN_LIST"])
])
]
)
AS_IF([test .$enable_extra_warnings = .yes],
[add_to_var([WARNINGS_ENABLED], ["$WARNINGS_EXTRA"])])
if test "$enable_conversion_checks" = yes; then
# Check if we can sensibly enable -Wconversion
AC_MSG_CHECKING([for usable -Wconversion])
SAV_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Wconversion -O2 -Werror"
AS_IF([test $ADD_FORTIFY_SOURCE -eq 1], [CFLAGS="$CFLAGS -Wp,-D_FORTIFY_SOURCE=$FORTIFY_SOURCE"])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <sys/types.h>
#include <sys/select.h>
#include <stdint.h>
#include <stdbool.h>
#include <sys/socket.h>
#include <linux/rtnetlink.h>
#define VAL 255
static void
fun(uint8_t val)
{
}
int main(void)
{
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])
add_to_var([WARNINGS_ENABLED], [conversion])
],
[
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
add_to_var([WARNINGS_ENABLED], [conversion])
fi
if test "$enable_Werror" = yes; then
add_to_var([WARNINGS_ENABLED], [error])
fi
CONFIG_WARNINGS=$SRC_DIR/lib/config_warnings.h.in
SAV_CFLAGS="$CFLAGS"
for WARN in $WARNINGS_ENABLED
do
AC_MSG_CHECKING([for -W$WARN])
CFLAGS="$SAV_CFLAGS -W$WARN -Werror"
WARN_VAR=_HAVE_WARNING_`echo $WARN | tr "a-z=-" "A-Z__"`_
LOCAL_WARN_VAR=HAVE_WARNING_`echo $WARN | sed -e "s/=.*//" | tr "a-z-" "A-Z_"`
grep -q "^#undef $WARN_VAR$" $CONFIG_WARNINGS
AS_IF([test $? -ne 0],
[echo -e "\n/* Define to 1 if -W$WARN in use */\n#undef $WARN_VAR" >>$CONFIG_WARNINGS]
)
test `echo $WARN | grep "=[[0-9]][[0-9]]*$"`
AS_IF([test $? -eq 0],
[ WARN_SHORT=`echo $WARN | sed -e 's/=[[0-9]][[0-9]]*$//'`
WARN_VAR_SHORT=_HAVE_WARNING_`echo $WARN_SHORT | tr "a-z=-" "A-Z__"`_
grep -q "^#undef $WARN_VAR_SHORT$" $CONFIG_WARNINGS
AS_IF([test $? -ne 0],
[echo -e "\n/* Define to 1 if -W$WARN_SHORT in use */\n#undef $WARN_VAR_SHORT" >>$CONFIG_WARNINGS]
)
],
[ unset WARN_VAR_SHORT ]
)
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
int main(void)
{
}
]])],
[
# gcc 9 removed -Wchkp and doesn't error if it is specified,
# but rather outputs:
# warning: switch '-Wchkp' is no longer supported
# so check for the warning.
touch conftest.err
grep -q "is no longer supported" conftest.err
AS_IF([test $? -ne 0],
[
AC_MSG_RESULT([yes])
eval $LOCAL_WARN_VAR=yes
add_to_var([KA_CFLAGS], [-W$WARN])
AC_DEFINE_UNQUOTED([$WARN_VAR], [ 1 ])
AS_IF([test -z "$WARN_VAR_SHORT"], [],
[AC_DEFINE_UNQUOTED([$WARN_VAR_SHORT], [ 1 ])]
)
],
[
AC_MSG_RESULT([no])
eval $LOCAL_WARN_VAR=no
])
],
[
AC_MSG_RESULT([no])
eval $LOCAL_WARN_VAR=no
])
done
AS_IF([test .$HAVE_WARNING_STRICT_OVERFLOW = .yes],
[
# The following is not supported in gcc 5.4.0
CFLAGS="$CFLAGS -Werror"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
_Pragma("GCC diagnostic warning \"-Wstrict-overflow=1\"")
int main(void)
{
}
]])],
[AC_DEFINE([_HAVE_PRAGMA_WARN_STRICT_OVERFLOW_1_], [ 1 ], [Define to 1 if _Pragma("GCC diagnostic warning \"-Wstrict-overflow=1\"") supported])
])
]
)
CFLAGS="$SAV_CFLAGS"
# keepalived is not suitable for assuming strict aliasing (it does a lot of type casting)
add_to_var([KA_CFLAGS], [-fno-strict-aliasing])
dnl ---- [ Is function __attribute__((error(msg))) supported? ] ----
AC_MSG_CHECKING([for function __attribute__((error(msg))) support])
AC_COMPILE_IFELSE(
[
AC_LANG_PROGRAM(
[[
#include <stdio.h>
static int func(int i) __attribute__((error("deliberate-error")));
static int func(int i)
{
return i * 2;
}
]],
[[
int i = func(2);
printf("%d", i);
]]
)
],
[
dnl -- The logic is inverted here. If the attribute is supported,
dnl -- the compilation will fail!
AC_MSG_RESULT([no])
],
[
AC_MSG_RESULT([yes])
AC_DEFINE([_HAVE_FUNCTION_ATTRIBUTE_ERROR_], [ 1 ], [Define to 1 if function __attribute__((error(msg))) supported])
])
SAV_CFLAGS="$CFLAGS"
CFLAGS="$SAV_CFLAGS -Werror=attributes"
dnl ---- [ Is function __attribute__((warn_unused_result)) supported? ] ----
AC_MSG_CHECKING([for function __attribute__((warn_unused_result)) support])
AC_COMPILE_IFELSE(
[
AC_LANG_PROGRAM(
[[
#include <stdio.h>
static int func(int i) __attribute__((warn_unused_result));
static int func(int i)
{
return i * 2;
}
]],
[[
func(2);
printf("%d", 2);
]]
)
],
[
AC_MSG_RESULT([yes])
AC_DEFINE([_HAVE_FUNCTION_WARN_UNUSED_RESULTS_], [ 1 ], [Define to 1 if function __attribute__((warn_unused_results)) supported])
],
[
AC_MSG_RESULT([no])
])
CFLAGS="$SAV_CFLAGS"
dnl ---- [ Do we want stricter configuration checking? ] ----
STRICT_CONFIG=No
if test "$enable_strict_config_checks" = yes; then
AC_DEFINE([_STRICT_CONFIG_], [ 1 ], [Define to 1 if want stricter configuration checking])
STRICT_CONFIG=Yes
add_config_opt([STRICT_CONFIG])
fi
AM_CONDITIONAL([WITH_STRICT_CONFIG_CHECKS], [test $STRICT_CONFIG = Yes])
if test "$enable_hardening" != no; then
AC_MSG_CHECKING([for PIE support])
SAV_CFLAGS="$CFLAGS"
SAV_LDFLAGS="$LDFLAGS"
CFLAGS="$CFLAGS -fPIE"
if test "${enable_profile}" = yes; then
# RHEL 7 and others have a problem with profiling with PIE
CFLAGS="$CFLAGS -pg"
fi
LDFLAGS="$LDFLAGS -pie"
AC_LINK_IFELSE([AC_LANG_SOURCE([[
int main(void)
{