forked from FRRouting/frr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
2930 lines (2640 loc) · 87.2 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
##
## Configure template file for FRRouting.
## autoconf will generate a configure script.
##
## Copyright (c) 1996, 97, 98, 99, 2000 Kunihiro Ishiguro <[email protected]>
## Portions Copyright (c) 2003 Paul Jakma <[email protected]>
##
AC_PREREQ([2.69])
AC_INIT([frr], [9.0-dev], [https://github.com/frrouting/frr/issues])
PACKAGE_URL="https://frrouting.org/"
AC_SUBST([PACKAGE_URL])
PACKAGE_FULLNAME="FRRouting"
AC_SUBST([PACKAGE_FULLNAME])
CONFIG_ARGS="`echo $ac_configure_args | sed -e \"s% '[[A-Z]]*FLAGS=[[^']]\+'%%g\"`"
AC_SUBST([CONFIG_ARGS])
AC_CONFIG_SRCDIR([lib/zebra.h])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_AUX_DIR([m4/ac])
dnl -----------------------------------
dnl Get hostname and other information.
dnl -----------------------------------
AC_CANONICAL_BUILD()
AC_CANONICAL_HOST()
AC_ARG_VAR([AR],[archiver command])
AC_ARG_VAR([LD],[linker command])
AC_ARG_VAR([OBJCOPY],[objcopy command])
AC_ARG_VAR([OBJDUMP],[objdump command])
AC_ARG_VAR([RANLIB],[ranlib command])
AC_ARG_VAR([STRIP],[strip command])
hosttools_clippy="false"
build_clippy="true"
dnl case 1: external clippy
if test -n "$with_clippy" -a "$with_clippy" != "no" -a "$with_clippy" != "yes"; then
if test "$enable_clippy_only" = "yes"; then
AC_MSG_ERROR([--enable-clippy-only does not make sense with --with-clippy])
fi
CLIPPY="$with_clippy"
build_clippy="false"
if test ! -x "$with_clippy"; then
AC_MSG_ERROR([clippy tool ($with_clippy) is not executable])
fi
dnl case 2: cross-compiling internal clippy
elif test "$host" != "$build"; then
if test "$srcdir" = "."; then
AC_MSG_ERROR([cross-compilation is only possible with builddir separate from srcdir or by building clippy separately and using the --with-clippy option. create a separate directory and run as .../path-to-frr/configure.])
fi
test -d hosttools || mkdir hosttools
abssrc="`cd \"${srcdir}\"; pwd`"
AC_MSG_NOTICE([...])
AC_MSG_NOTICE([... cross-compilation: creating hosttools directory and self-configuring for build platform tools])
AC_MSG_NOTICE([... use HOST_CPPFLAGS / HOST_CFLAGS / HOST_LDFLAGS if necessary])
AC_MSG_NOTICE([...])
(
for var in $ac_precious_vars; do
dnl special cases
case "$var" in
YACC|YFLAGS) continue;;
PYTHON*) retain=true;;
*) retain=false;
esac
eval "hostvar=\"\${HOST_$var}\""
eval "targetvar=\"\${$var}\""
if test -n "$hostvar"; then
eval "$var='$hostvar'"
_AS_ECHO_LOG([host $var='$hostvar'])
elif $retain; then
_AS_ECHO_LOG([host retain $var='$targetvar'])
else
eval "unset $var"
_AS_ECHO_LOG([host unset $var])
fi
done
cd hosttools
"${abssrc}/configure" "--host=$build" "--build=$build" "--enable-clippy-only" "--disable-nhrpd" "--disable-vtysh"
) || exit 1
AC_MSG_NOTICE([...])
AC_MSG_NOTICE([... cross-compilation: finished self-configuring for build platform tools])
AC_MSG_NOTICE([...])
build_clippy="false"
hosttools_clippy="true"
CLIPPY="hosttools/lib/clippy"
dnl case 3: normal build internal clippy
else
CLIPPY="lib/clippy\$(EXEEXT)"
fi
AC_SUBST([CLIPPY])
AM_CONDITIONAL([BUILD_CLIPPY], [$build_clippy])
AM_CONDITIONAL([HOSTTOOLS_CLIPPY], [$hosttools_clippy])
AM_CONDITIONAL([ONLY_CLIPPY], [test "$enable_clippy_only" = "yes"])
# Disable portability warnings -- our automake code (in particular
# common.am) uses some constructs specific to gmake.
AM_INIT_AUTOMAKE([1.12 -Wno-portability foreign])
m4_ifndef([AM_SILENT_RULES], [m4_define([AM_SILENT_RULES],[])])
AM_SILENT_RULES([yes])
AC_CONFIG_HEADERS([config.h])
AC_PATH_PROG([PERL], [perl])
PKG_PROG_PKG_CONFIG
dnl default is to match previous behavior
pkgsrcrcdir=""
AC_ARG_ENABLE([pkgsrcrcdir],
AS_HELP_STRING([--enable-pkgsrcrcdir],
[specify directory for rc.d scripts]),
pkgsrcrcdir="$enableval",)
dnl XXX add --pkgsrcrcdir to autoconf standard directory list somehow
AC_SUBST([pkgsrcrcdir])
AM_CONDITIONAL([PKGSRC], [test "$pkgsrcrcdir" != ""])
AC_ARG_WITH([moduledir], [AS_HELP_STRING([--with-moduledir=DIR], [module directory (${libdir}/frr/modules)])], [
moduledir="$withval"
], [
moduledir="\${libdir}/frr/modules"
])
AC_SUBST([moduledir], [$moduledir])
AC_ARG_WITH([scriptdir], [AS_HELP_STRING([--with-scriptdir=DIR], [script directory (${sysconfdir}/scripts)])], [
scriptdir="$withval"
], [
scriptdir="\${sysconfdir}/scripts"
])
AC_SUBST([scriptdir], [$scriptdir])
AC_ARG_WITH([yangmodelsdir], [AS_HELP_STRING([--with-yangmodelsdir=DIR], [yang models directory (${datarootdir}/yang)])], [
yangmodelsdir="$withval"
], [
yangmodelsdir="\${datarootdir}/yang"
])
AC_SUBST([yangmodelsdir])
AC_ARG_WITH([vici-socket], [AS_HELP_STRING([--with-vici-socket=PATH], [vici-socket (/var/run/charon.vici)])], [
vici_socket="$withval"
], [
vici_socket="/var/run/charon.vici"
])
AC_DEFINE_UNQUOTED([VICI_SOCKET], ["$vici_socket"], [StrongSWAN vici socket path])
AC_ARG_ENABLE(tcmalloc,
AS_HELP_STRING([--enable-tcmalloc], [Turn on tcmalloc]),
[case "${enableval}" in
yes) tcmalloc_enabled=true
LIBS="$LIBS -ltcmalloc_minimal"
;;
no) tcmalloc_enabled=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-tcmalloc]) ;;
esac],[tcmalloc_enabled=false])
dnl Thanks autoconf, but we don't want a default -g -O2. We have our own
dnl flag determination logic.
CFLAGS="${CFLAGS:-}"
dnl --------------------
dnl Check CC and friends
dnl --------------------
dnl note orig_cflags is also used further down
orig_cflags="$CFLAGS"
orig_cxxflags="$CXXFLAGS"
AC_LANG([C])
AC_PROG_CC
AC_PROG_CPP
AC_PROG_CXX
AM_PROG_CC_C_O
dnl remove autoconf default "-g -O2"
CFLAGS="$orig_cflags"
CXXFLAGS="$orig_cxxflags"
dnl Some special handling for ICC later on
if test "$CC" = "icc"; then
cc_is_icc="yes"
fi
PKG_PROG_PKG_CONFIG
dnl it's 2019, sed is sed.
SED=sed
AC_SUBST([SED])
dnl try and enable CFLAGS that are useful for FRR
dnl - specifically, options to control warnings
AC_SUBST([AC_CFLAGS])
AC_USE_SYSTEM_EXTENSIONS
AC_DEFUN([AC_C_FLAG], [{
m4_pushdef([cachename],[m4_translit([frr_cv_$1],[ =-+/{}$],[________])])
AC_CACHE_CHECK([[whether $CC supports $1]], cachename, [
AC_LANG_PUSH([C])
ac_c_flag_save="$CFLAGS"
CFLAGS="$CFLAGS $1"
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[$4]])],
[
cachename=yes
], [
cachename=no
])
CFLAGS="$ac_c_flag_save"
AC_LANG_POP([C])
])
if test "$cachename" = "yes"; then
m4_if([$3], [], [AC_CFLAGS="$AC_CFLAGS $1"], [$3])
else
:
$2
fi
m4_popdef([cachename])
}])
AC_DEFUN([AC_LINK_IFELSE_FLAGS], [{
AC_LANG_PUSH([C])
ac_cflags_save="$CFLAGS"
ac_libs_save="$LIBS"
CFLAGS="$CFLAGS $1"
LIBS="$LIBS $2"
AC_LINK_IFELSE(
[$3],
[
CFLAGS="$ac_cflags_save"
LIBS="$ac_libs_save"
m4_default([$5], [
AC_MSG_RESULT([yes])
])
], [
CFLAGS="$ac_cflags_save"
LIBS="$ac_libs_save"
m4_default([$4], [
AC_MSG_RESULT([no])
])
])
AC_LANG_POP([C])
}])
dnl ICC won't bail on unknown options without -diag-error 10006
dnl need to do this first so we get useful results for the other options
if test "$cc_is_icc" = "yes"; then
AC_C_FLAG([-diag-error 10006])
fi
dnl autoconf 2.69 AC_PROG_CC_C99 is "state of the art"
dnl autoconf 2.70 AC_PROG_CC_C99 is deprecated and AC_PROC_CC tries to do C11
m4_if(m4_version_compare(m4_defn([AC_AUTOCONF_VERSION]), [2.70]), [-1], [dnl
dnl autoconf < 2.70
AC_PROG_CC_C99
dnl AC_PROG_CC_C99 may change CC to include -std=gnu99 or something
ac_cc="$CC"
CC="${CC% -std=gnu99}"
CC="${CC% -std=c99}"
AC_C_FLAG([-std=gnu11], [CC="$ac_cc"], [CC="$CC -std=gnu11"])
], [
dnl autoconf >= 2.70
if test "$ac_cv_prog_cc_c11" = "no"; then
AC_MSG_ERROR([ISO C11 compiler support (with GNU extensions) is required.])
fi
])
dnl if the user has specified any CFLAGS, override our settings
if test "$enable_gcov" = "yes"; then
if test "$orig_cflags" = ""; then
AC_C_FLAG([--coverage])
AC_C_FLAG([-O0])
fi
AC_LDFLAGS="${AC_LDFLAGS} --coverage"
fi
if test "$enable_clang_coverage" = "yes"; then
AC_C_FLAG([-fprofile-instr-generate], [
AC_MSG_ERROR([$CC does not support -fprofile-instr-generate.])
])
AC_C_FLAG([-fcoverage-mapping], [
AC_MSG_ERROR([$CC does not support -fcoverage-mapping.])
])
fi
AM_CONDITIONAL([SCRIPTING], [test "$enable_scripting" = "yes"])
if test "$enable_scripting" = "yes"; then
AX_PROG_LUA([5.3], [5.4], [], [
AC_MSG_ERROR([Lua 5.3 is required to build with Lua support. No other version is supported.])
])
AX_LUA_HEADERS([], [
AC_MSG_ERROR([Lua 5.3 headers are required to build with Lua support. No other version is supported.])
])
PKG_CHECK_MODULES([LUA], [lua5.3], [
AC_DEFINE([HAVE_SCRIPTING], [1], [Have support for scripting])
LIBS="$LIBS $LUA_LIBS"
SCRIPTING=true
], [
AX_LUA_LIBS([
AC_DEFINE([HAVE_SCRIPTING], [1], [Have support for scripting])
LIBS="$LIBS $LUA_LIB"
SCRIPTING=true
], [
SCRIPTING=false
AC_MSG_ERROR([Lua 5.3 libraries are required to build with Lua support. No other version is supported.])
])
])
fi
dnl the following flags go in CFLAGS rather than AC_CFLAGS since they make
dnl sense to be overridden by the user
if test "$enable_dev_build" = "yes"; then
AC_DEFINE([DEV_BUILD], [1], [Build for development])
if test "$orig_cflags" = ""; then
AC_C_FLAG([-O0],,[CFLAGS="$CFLAGS -O0"])
AC_C_FLAG([-g3],,[CFLAGS="$CFLAGS -g3"])
AC_C_FLAG([-ggdb3],,[CFLAGS="$CFLAGS -ggdb3"])
fi
else
if test "$orig_cflags" = ""; then
AC_C_FLAG([-g],,[CFLAGS="$CFLAGS -g"])
AC_C_FLAG([-O2],,[CFLAGS="$CFLAGS -O2"])
fi
fi
dnl just stick -g into LDFLAGS, if we don't have it in CFLAGS it won't do much
LDFLAGS="$LDFLAGS -g"
AM_CONDITIONAL([DEV_BUILD], [test "$enable_dev_build" = "yes"])
dnl -fms-extensions causes clang to have a built-in __wchar_t on OpenBSD,
dnl which just straight up breaks compiling any code.
dnl (2022-04-04 / OpenBSD 7 / clang 11.1.0)
AH_VERBATIM([OpenBSD], [
#ifdef __OpenBSD__
#define __wchar_t __wchar_t_ignore
#include <stdint.h>
#undef __wchar_t
#endif
])
dnl always want these CFLAGS
AC_C_FLAG([-fms-extensions], [
AC_MSG_ERROR([$CC does not support unnamed struct fields (-fms-extensions)])
])
AC_C_FLAG([-fno-omit-frame-pointer])
AC_C_FLAG([-funwind-tables])
AC_C_FLAG([-Wall])
AC_C_FLAG([-Wextra])
AC_C_FLAG([-Wformat-nonliteral])
AC_C_FLAG([-Wformat-security])
AC_C_FLAG([-Wswitch-enum])
AC_C_FLAG([-Wstrict-prototypes])
AC_C_FLAG([-Wmissing-prototypes])
AC_C_FLAG([-Wmissing-declarations])
AC_C_FLAG([-Wpointer-arith])
AC_C_FLAG([-Wbad-function-cast])
AC_C_FLAG([-Wwrite-strings])
AC_C_FLAG([-Wundef])
if test "$enable_gcc_ultra_verbose" = "yes" ; then
AC_C_FLAG([-Wcast-qual])
AC_C_FLAG([-Wmissing-noreturn])
AC_C_FLAG([-Wmissing-format-attribute])
AC_C_FLAG([-Wunreachable-code])
AC_C_FLAG([-Wpacked])
AC_C_FLAG([-Wpadded])
AC_C_FLAG([-Wshadow])
else
AC_C_FLAG([-Wno-unused-result])
fi
AC_C_FLAG([-Wno-unused-parameter])
AC_C_FLAG([-Wno-missing-field-initializers])
AC_C_FLAG([-Wc++-compat], [], [CXX_COMPAT_CFLAGS="-Wc++-compat"])
AC_SUBST([CXX_COMPAT_CFLAGS])
dnl ICC emits a broken warning for const char *x = a ? "b" : "c";
dnl for some reason the string consts get 'promoted' to char *,
dnl triggering a const to non-const conversion warning.
if test "$cc_is_icc" = "yes"; then
AC_C_FLAG([-diag-disable 3179])
fi
if test "$enable_werror" = "yes" ; then
WERROR="-Werror"
fi
AC_SUBST([WERROR])
SAN_FLAGS=""
if test "$enable_address_sanitizer" = "yes"; then
AC_C_FLAG([-fsanitize=address], [
AC_MSG_ERROR([$CC does not support Address Sanitizer.])
], [
SAN_FLAGS="$SAN_FLAGS -fsanitize=address"
])
fi
if test "$enable_thread_sanitizer" = "yes"; then
AC_C_FLAG([-fsanitize=thread], [
AC_MSG_ERROR([$CC does not support Thread Sanitizer.])
], [
SAN_FLAGS="$SAN_FLAGS -fsanitize=thread"
])
fi
if test "$enable_memory_sanitizer" = "yes"; then
AC_C_FLAG([-fsanitize=memory -fPIE -pie], [
AC_MSG_ERROR([$CC does not support Memory Sanitizer.])
], [
SAN_FLAGS="$SAN_FLAGS -fsanitize=memory -fPIE -pie"
])
fi
if test "$enable_undefined_sanitizer" = "yes"; then
AC_C_FLAG([-fsanitize=undefined], [
AC_MSG_ERROR([$CC does not support UndefinedBehaviorSanitizer.])
], [
SAN_FLAGS="$SAN_FLAGS -fsanitize=undefined"
])
fi
AC_SUBST([SAN_FLAGS])
dnl frr-format.so
if test "$with_frr_format" != "no" -a "$with_frr_format" != "yes" -a -n "$with_frr_format"; then
AC_C_FLAG([-fplugin=${with_frr_format}], [
AC_MSG_ERROR([specified frr-format plugin ($with_frr_format) does not work])
],,[
#ifndef _FRR_ATTRIBUTE_PRINTFRR
#error plugin not loaded
#endif
#if _FRR_ATTRIBUTE_PRINTFRR < 0x10000
#error plugin too old
#endif
])
elif test "$with_frr_format" = "no"; then
: #nothing
else
AC_C_FLAG([-fplugin=tools/gcc-plugins/frr-format.so],[
AC_C_FLAG([-fplugin=frr-format],[
if test "$with_frr_format" = "yes"; then
AC_MSG_ERROR([frr-format plugin requested but not found])
fi
],,[
#ifndef _FRR_ATTRIBUTE_PRINTFRR
#error plugin not loaded
#endif
#if _FRR_ATTRIBUTE_PRINTFRR < 0x10000
#error plugin too old
#endif
])
],,[
#ifndef _FRR_ATTRIBUTE_PRINTFRR
#error plugin not loaded
#endif
#if _FRR_ATTRIBUTE_PRINTFRR < 0x10000
#error plugin too old
#endif
])
fi
AC_MSG_CHECKING([whether linker supports __start/stop_section symbols])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <stdio.h>
int __attribute__((section("secttest"))) var = 1;
extern int __start_secttest, __stop_secttest;
]], [[
void *a = &var, *b = &__start_secttest, *c = &__stop_secttest;
printf("%p %p %p\n", a, b, c);
]])], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_SECTION_SYMS, 1, [have __start/stop_section symbols])
], [
AC_MSG_RESULT(no)
])
dnl ----------
dnl Essentials
dnl ----------
AX_PTHREAD([
CC="$PTHREAD_CC"
AC_CFLAGS="$AC_CFLAGS $PTHREAD_CFLAGS"
LIBS="$PTHREAD_LIBS $LIBS"
], [
AC_MSG_FAILURE([This FRR version needs pthreads])
])
orig_cflags="$CFLAGS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
AC_SEARCH_LIBS([pthread_condattr_setclock], [],
[frr_cv_pthread_condattr_setclock=yes],
[frr_cv_pthread_condattr_setclock=no])
if test "$frr_cv_pthread_condattr_setclock" = "yes"; then
AC_DEFINE([HAVE_PTHREAD_CONDATTR_SETCLOCK], [1], [Have pthread.h pthread_condattr_setclock])
fi
AC_CHECK_HEADERS([pthread_np.h],,, [
#include <pthread.h>
])
AC_CHECK_FUNCS([pthread_setname_np pthread_set_name_np pthread_getthreadid_np])
CFLAGS="$orig_cflags"
dnl --------------
dnl Check programs
dnl --------------
AC_PROG_INSTALL
AC_PROG_LN_S
AC_CHECK_TOOL([AR], [ar])
dnl -------
dnl libtool
dnl -------
AC_ARG_ENABLE([static-bin],
AS_HELP_STRING([--enable-static-bin], [link binaries statically]))
LT_INIT
_LT_CONFIG_LIBTOOL([
patch -N -i "${srcdir}/m4/libtool-whole-archive.patch" libtool >&AS_MESSAGE_LOG_FD || \
AC_MSG_WARN([Could not patch libtool for static linking support. Loading modules into a statically linked daemon will fail.])
dnl the -i option is not POSIX sed and the BSDs implement it differently
dnl cat'ing the output back instead of mv/cp keeps permissions on libtool intact
sed -e 's%func_warning "relinking%true #\0%' libtool > libtool.sed && cat libtool.sed > libtool
sed -e 's%func_warning "remember to run%true #\0%' libtool > libtool.sed && cat libtool.sed > libtool
sed -e 's%func_warning ".*has not been installed in%true #\0%' libtool > libtool.sed && cat libtool.sed > libtool
test -f libtool.sed && rm libtool.sed
])
if test "$enable_static_bin" = "yes"; then
AC_LDFLAGS_EXEC="-static"
if test "$enable_static" != "yes"; then
AC_MSG_ERROR([The --enable-static-bin option must be combined with --enable-static.])
fi
fi
if test "$enable_shared" != "yes"; then
AC_MSG_ERROR([FRR cannot be built with --disable-shared. If you want statically linked daemons, use --enable-shared --enable-static --enable-static-bin])
fi
AC_SUBST([AC_LDFLAGS])
AC_SUBST([AC_LDFLAGS_EXEC])
AM_CONDITIONAL([STATIC_BIN], [test "$enable_static_bin" = "yes"])
dnl libtool, the repository of all knowledge related linkers, is too stupid to
dnl correctly tell the linker how to build modules.
if test -z "$module_cmds"; then
module_cmds="`echo \"$archive_cmds\" | sed -e 's%$wl-soname $wl$soname%%'`"
fi
if test -z "$module_expsym_cmds"; then
module_expsym_cmds="`echo \"$archive_expsym_cmds\" | sed -e 's%$wl-soname $wl$soname%%'`"
fi
AC_ARG_ENABLE([rpath],
[AS_HELP_STRING([--enable-rpath], [set hardcoded rpaths in the executable @<:@default=yes@:>@])],
[],
[enable_rpath=yes])
dnl $AR and $RANLIB are set by LT_INIT above
AC_MSG_CHECKING([whether $AR supports D option])
if $AR crD conftest.a >/dev/null 2>/dev/null; then
AC_MSG_RESULT([yes])
dnl ARFLAGS is for automake, AR_FLAGS for libtool m-(
ARFLAGS="crD"
AR_FLAGS="crD"
else
AC_MSG_RESULT([no])
ARFLAGS="cru"
AR_FLAGS="cru"
fi
AC_SUBST([ARFLAGS])
AC_SUBST([AR_FLAGS])
AC_MSG_CHECKING([whether $RANLIB supports D option])
if $RANLIB -D conftest.a >conftest.err 2>&1; then
if grep -q -- '-D' conftest.err; then
AC_MSG_RESULT([no])
else
AC_MSG_RESULT([yes])
RANLIB="$RANLIB -D"
fi
else
AC_MSG_RESULT([no])
fi
AC_SUBST([RANLIB])
test -f conftest.err && rm conftest.err
test -f conftest.a && rm conftest.a
dnl ----------------------
dnl Packages configuration
dnl ----------------------
if test -f config.version; then
. ./config.version
elif test -f "${srcdir}/config.version"; then
. "${srcdir}/config.version"
fi
AC_ARG_WITH([pkg-extra-version],
AS_HELP_STRING([--with-pkg-extra-version=VER], [add extra version field, for packagers/distributions]), [
if test "$withval" = "no"; then
EXTRAVERSION=
else
EXTRAVERSION=$withval
fi
], [])
AC_ARG_WITH([pkg-git-version],
AS_HELP_STRING([--with-pkg-git-version], [add git information to MOTD and build version string]),
[ test "$withval" != "no" && with_pkg_git_version="yes" ])
AC_ARG_WITH([clippy],
AS_HELP_STRING([--with-clippy=PATH], [use external clippy helper program]))
AC_ARG_WITH([vtysh_pager],
AS_HELP_STRING([--with-vtysh-pager=PAGER], [control what pager is compiled in as default]),
VTYSH_PAGER=$withval, VTYSH_PAGER="more")
AC_ARG_ENABLE([vtysh],
AS_HELP_STRING([--disable-vtysh], [do not build integrated vty shell for FRR]))
AC_ARG_ENABLE([doc],
AS_HELP_STRING([--disable-doc], [do not build docs]))
AC_ARG_ENABLE([doc-html],
AS_HELP_STRING([--enable-doc-html], [build HTML docs]))
AC_ARG_ENABLE([zebra],
AS_HELP_STRING([--disable-zebra], [do not build zebra daemon]))
AC_ARG_ENABLE([bgpd],
AS_HELP_STRING([--disable-bgpd], [do not build bgpd]))
AC_ARG_ENABLE([mgmtd],
AS_HELP_STRING([--disable-mgmtd], [do not build mgmtd]))
AC_ARG_ENABLE([mgmtd_local_validations],
AS_HELP_STRING([--enable-mgmtd-local-validations], [dev: unimplemented local validation]))
AC_ARG_ENABLE([ripd],
AS_HELP_STRING([--disable-ripd], [do not build ripd]))
AC_ARG_ENABLE([ripngd],
AS_HELP_STRING([--disable-ripngd], [do not build ripngd]))
AC_ARG_ENABLE([ospfd],
AS_HELP_STRING([--disable-ospfd], [do not build ospfd]))
AC_ARG_ENABLE([ospf6d],
AS_HELP_STRING([--disable-ospf6d], [do not build ospf6d]))
AC_ARG_ENABLE([ldpd],
AS_HELP_STRING([--disable-ldpd], [do not build ldpd]))
AC_ARG_ENABLE([nhrpd],
AS_HELP_STRING([--disable-nhrpd], [do not build nhrpd]))
AC_ARG_ENABLE([eigrpd],
AS_HELP_STRING([--disable-eigrpd], [do not build eigrpd]))
AC_ARG_ENABLE([babeld],
AS_HELP_STRING([--disable-babeld], [do not build babeld]))
AC_ARG_ENABLE([watchfrr],
AS_HELP_STRING([--disable-watchfrr], [do not build watchfrr]))
AC_ARG_ENABLE([isisd],
AS_HELP_STRING([--disable-isisd], [do not build isisd]))
AC_ARG_ENABLE([pimd],
AS_HELP_STRING([--disable-pimd], [do not build pimd]))
AC_ARG_ENABLE([pim6d],
AS_HELP_STRING([--disable-pim6d], [do not build pim6d]))
AC_ARG_ENABLE([pbrd],
AS_HELP_STRING([--disable-pbrd], [do not build pbrd]))
AC_ARG_ENABLE([sharpd],
AS_HELP_STRING([--enable-sharpd], [build sharpd]))
AC_ARG_ENABLE([staticd],
AS_HELP_STRING([--disable-staticd], [do not build staticd]))
AC_ARG_ENABLE([fabricd],
AS_HELP_STRING([--disable-fabricd], [do not build fabricd]))
AC_ARG_ENABLE([vrrpd],
AS_HELP_STRING([--disable-vrrpd], [do not build vrrpd]))
AC_ARG_ENABLE([pathd],
AS_HELP_STRING([--disable-pathd], [do not build pathd]))
AC_ARG_ENABLE([bgp-announce],
AS_HELP_STRING([--disable-bgp-announce], [turn off BGP route announcement]))
AC_ARG_ENABLE([bgp-vnc],
AS_HELP_STRING([--disable-bgp-vnc],[turn off BGP VNC support]))
AC_ARG_ENABLE([bgp-bmp],
AS_HELP_STRING([--disable-bgp-bmp],[turn off BGP BMP support]))
AC_ARG_ENABLE([snmp],
AS_HELP_STRING([--enable-snmp], [enable SNMP support for agentx]))
AC_ARG_ENABLE([config_rollbacks],
AS_HELP_STRING([--enable-config-rollbacks], [enable configuration rollbacks (requires sqlite3)]))
AC_ARG_ENABLE([confd],
AS_HELP_STRING([--enable-confd=ARG], [enable confd integration]))
AC_ARG_ENABLE([sysrepo],
AS_HELP_STRING([--enable-sysrepo], [enable sysrepo integration]))
AC_ARG_ENABLE([grpc],
AS_HELP_STRING([--enable-grpc], [enable the gRPC northbound plugin]))
AC_ARG_ENABLE([zeromq],
AS_HELP_STRING([--enable-zeromq], [enable ZeroMQ handler (libfrrzmq)]))
AC_ARG_ENABLE([lttng],
AS_HELP_STRING([--enable-lttng], [enable LTTng tracing]))
AC_ARG_ENABLE([usdt],
AS_HELP_STRING([--enable-usdt], [enable USDT probes]))
AC_ARG_WITH([libpam],
AS_HELP_STRING([--with-libpam], [use libpam for PAM support in vtysh]))
AC_ARG_ENABLE([ospfapi],
AS_HELP_STRING([--disable-ospfapi], [do not build OSPFAPI to access the OSPF LSA Database]))
AC_ARG_ENABLE([ospfclient],
AS_HELP_STRING([--disable-ospfclient], [do not build OSPFAPI client for OSPFAPI,
(this is the default if --disable-ospfapi is set)]))
AC_ARG_WITH([log_timestamp_precision],
AS_HELP_STRING([--with-log-timestamp-precision=ARG], [set startup log timestamp precision, ARG must be 0-12]))
AC_ARG_ENABLE([multipath],
AS_HELP_STRING([--enable-multipath=ARG], [enable multipath function, ARG must be digit]))
AC_ARG_WITH([service_timeout],
AS_HELP_STRING([--with-service-timeout=ARG], [set service timeout value (2 minutes by default), ARG must be digit]))
AC_ARG_ENABLE([user],
AS_HELP_STRING([--enable-user=USER], [user to run FRR suite as (default frr)]))
AC_ARG_ENABLE([group],
AS_HELP_STRING([--enable-group=GROUP], [group to run FRR suite as (default frr)]))
AC_ARG_ENABLE([vty_group],
AS_HELP_STRING([--enable-vty-group=ARG], [set vty sockets to have specified group as owner]))
AC_ARG_ENABLE([configfile_mask],
AS_HELP_STRING([--enable-configfile-mask=ARG], [set mask for config files]))
AC_ARG_ENABLE([logfile_mask],
AS_HELP_STRING([--enable-logfile-mask=ARG], [set mask for log files]))
AC_ARG_ENABLE([shell_access],
AS_HELP_STRING([--enable-shell-access], [Allow users to access shell/telnet/ssh]))
AC_ARG_ENABLE([realms],
AS_HELP_STRING([--enable-realms], [enable REALMS support under Linux]))
AC_ARG_ENABLE([rtadv],
AS_HELP_STRING([--disable-rtadv], [disable IPV6 router advertisement feature]))
AC_ARG_ENABLE([irdp],
AS_HELP_STRING([--disable-irdp], [disable IRDP server support in zebra (enabled by default if supported)]))
AC_ARG_ENABLE([capabilities],
AS_HELP_STRING([--disable-capabilities], [disable using POSIX capabilities]))
AC_ARG_ENABLE([gcc_ultra_verbose],
AS_HELP_STRING([--enable-gcc-ultra-verbose], [enable ultra verbose GCC warnings]))
AC_ARG_ENABLE([backtrace],
AS_HELP_STRING([--disable-backtrace], [disable crash backtraces (default autodetect)]))
AC_ARG_ENABLE([time-check],
AS_HELP_STRING([--disable-time-check], [disable slow thread warning messages]))
AC_ARG_ENABLE([cpu-time],
AS_HELP_STRING([--disable-cpu-time], [disable cpu usage data gathering]))
AC_ARG_ENABLE([pcreposix],
AS_HELP_STRING([--enable-pcreposix], [enable using PCRE Posix libs for regex functions]))
AC_ARG_ENABLE([pcre2posix],
AS_HELP_STRING([--enable-pcre2posix], [enable using PCRE2 Posix libs for regex functions]))
AC_ARG_ENABLE([fpm],
AS_HELP_STRING([--enable-fpm], [enable Forwarding Plane Manager support]))
AC_ARG_ENABLE([werror],
AS_HELP_STRING([--enable-werror], [enable -Werror (recommended for developers only)]))
AC_ARG_ENABLE([cumulus],
AS_HELP_STRING([--enable-cumulus], [enable Cumulus Switch Special Extensions]))
AC_ARG_ENABLE([datacenter],
AS_HELP_STRING([--enable-datacenter], [enable Compilation for Data Center Extensions]))
AC_ARG_ENABLE([rr-semantics],
AS_HELP_STRING([--disable-rr-semantics], [disable the v6 Route Replace semantics]))
AC_ARG_ENABLE([protobuf],
AS_HELP_STRING([--enable-protobuf], [Enable experimental protobuf support]))
AC_ARG_ENABLE([oldvpn_commands],
AS_HELP_STRING([--enable-oldvpn-commands], [Keep old vpn commands]))
AC_ARG_ENABLE([rpki],
AS_HELP_STRING([--enable-rpki], [enable RPKI prefix validation support]))
AC_ARG_ENABLE([clippy-only],
AS_HELP_STRING([--enable-clippy-only], [Only build clippy]))
AC_ARG_ENABLE([numeric_version],
AS_HELP_STRING([--enable-numeric-version], [Only numeric digits allowed in version (for Alpine)]))
AC_ARG_ENABLE([gcov],
AS_HELP_STRING([--enable-gcov], [Collect coverage information with gcov]))
AC_ARG_ENABLE([clang_coverage],
AS_HELP_STRING([--enable-clang-coverage], [Collect coverage information with Clang Coverage]))
AC_ARG_ENABLE([bfdd],
AS_HELP_STRING([--disable-bfdd], [do not build bfdd]))
AC_ARG_ENABLE([address-sanitizer],
AS_HELP_STRING([--enable-address-sanitizer], [enable AddressSanitizer support for detecting a wide variety of memory allocation and deallocation errors]))
AC_ARG_ENABLE([thread-sanitizer],
AS_HELP_STRING([--enable-thread-sanitizer], [enable ThreadSanitizer support for detecting data races]))
AC_ARG_ENABLE([memory-sanitizer],
AS_HELP_STRING([--enable-memory-sanitizer], [enable MemorySanitizer support for detecting uninitialized memory reads]))
AC_ARG_ENABLE([undefined-sanitizer],
AS_HELP_STRING([--enable-undefined-sanitizer], [enable UndefinedBehaviorSanitizer support for detecting undefined behavior]))
AC_ARG_WITH([crypto],
AS_HELP_STRING([--with-crypto=<internal|openssl>], [choose between different implementations of cryptographic functions(default value is --with-crypto=internal)]))
AC_ARG_WITH([frr-format],
AS_HELP_STRING([--with-frr-format[=<.../frr-format.so>]], [use frr-format GCC plugin]))
AC_ARG_ENABLE([version-build-config],
AS_HELP_STRING([--disable-version-build-config], [do not include build configs in show version command]))
#if openssl, else use the internal
AS_IF([test "$with_crypto" = "openssl"], [
AC_CHECK_LIB([crypto], [EVP_DigestInit], [LIBS="$LIBS -lcrypto"], [], [])
if test "$ac_cv_lib_crypto_EVP_DigestInit" = "no"; then
AC_MSG_ERROR([build with openssl has been specified but openssl library was not found on your system])
else
AC_DEFINE([CRYPTO_OPENSSL], [1], [Compile with openssl support])
fi
], [test "$with_crypto" = "internal" || test "$with_crypto" = "" ], [AC_DEFINE([CRYPTO_INTERNAL], [1], [Compile with internal cryptographic implementation])
], [AC_MSG_ERROR([Unknown value for --with-crypto])]
)
AS_IF([test "$enable_clippy_only" != "yes"], [
AC_CHECK_HEADERS([json-c/json.h])
AC_CHECK_LIB([json-c], [json_object_get], [LIBS="$LIBS -ljson-c"], [], [-lm])
if test "$ac_cv_lib_json_c_json_object_get" = "no"; then
AC_CHECK_LIB([json], [json_object_get], [LIBS="$LIBS -ljson"])
if test "$ac_cv_lib_json_json_object_get" = "no"; then
AC_MSG_ERROR([libjson is needed to compile])
fi
fi
])
AC_ARG_ENABLE([ccls],
AS_HELP_STRING([--enable-ccls], [Write .ccls config for this build]))
AC_ARG_ENABLE([dev_build],
AS_HELP_STRING([--enable-dev-build], [build for development]))
AC_ARG_ENABLE([scripting],
AS_HELP_STRING([--enable-scripting], [Build with scripting support]))
AC_ARG_ENABLE([netlink-debug],
AS_HELP_STRING([--disable-netlink-debug], [don't pretty print netlink debug messages]))
if test "$enable_netlink_debug" != "no" ; then
AC_DEFINE([NETLINK_DEBUG], [1], [Netlink extra debugging code])
fi
AM_CONDITIONAL([NETLINK_DEBUG], [test "$enable_netlink_debug" != "no"])
if test "$enable_time_check" != "no" ; then
if test "$enable_time_check" = "yes" -o "$enable_time_check" = "" ; then
AC_DEFINE([CONSUMED_TIME_CHECK], [5000000], [Consumed Time Check])
else
AC_DEFINE_UNQUOTED([CONSUMED_TIME_CHECK], [$enable_time_check], [Consumed Time Check])
fi
fi
case "${enable_cpu_time}" in
"no")
AC_DEFINE([EXCLUDE_CPU_TIME], [1], [Exclude getrusage data gathering])
;;
"*")
;;
esac
if test "$enable_rr_semantics" != "no" ; then
AC_DEFINE([HAVE_V6_RR_SEMANTICS], [1], [Compile in v6 Route Replacement Semantics])
fi
if test "$enable_datacenter" = "yes" ; then
AC_DEFINE([HAVE_DATACENTER], [1], [Compile extensions for a DataCenter])
DFLT_NAME="datacenter"
else
DFLT_NAME="traditional"
fi
if test "$enable_cumulus" = "yes" ; then
AC_DEFINE([HAVE_CUMULUS], [1], [Compile Special Cumulus Code in])
fi
AC_SUBST([DFLT_NAME])
AC_DEFINE_UNQUOTED([DFLT_NAME], ["$DFLT_NAME"], [Name of the configuration default set])
if test "$enable_shell_access" = "yes"; then
AC_DEFINE([HAVE_SHELL_ACCESS], [1], [Allow user to use ssh/telnet/bash, be aware this is considered insecure])
fi
#
# Python for clippy
#
AS_IF([test "$host" = "$build"], [
AM_PATH_PYTHON([3])
AC_CHECK_HEADER([gelf.h], [], [
AC_MSG_ERROR([libelf headers are required for building clippy. (Host only when cross-compiling.)])
])
LIBS_save="$LIBS"
AC_CHECK_LIB([elf], [elf_memory], [], [
AC_MSG_ERROR([libelf is required for building clippy. (Host only when cross-compiling.)])
])
AC_CHECK_LIB([elf], [elf_getdata_rawchunk], [
AC_DEFINE([HAVE_ELF_GETDATA_RAWCHUNK], [1], [Have elf_getdata_rawchunk()])
])
AC_CHECK_LIB([elf], [gelf_getnote], [
AC_DEFINE([HAVE_GELF_GETNOTE], [1], [Have gelf_getnote()])
])
LIBS="$LIBS_save"
unset LIBS_save
FRR_PYTHON_DEV
], [
FRR_PYTHON
])
FRR_PYTHON_MODULES([pytest])
if test "$enable_doc" != "no"; then
FRR_PYTHON_MODULES([sphinx], , [
if test "$enable_doc" = "yes"; then
AC_MSG_ERROR([Documentation was explicitly requested with --enable-doc but sphinx is not available for $PYTHON. Please disable docs or install sphinx.])
fi
])
fi
AM_CONDITIONAL([DOC], [test "$enable_doc" != "no" -a "$frr_py_mod_sphinx" != "false"])
AM_CONDITIONAL([DOC_HTML], [test "$enable_doc_html" = "yes"])
FRR_PYTHON_MOD_EXEC([sphinx], [--version], [
PYSPHINX="-m sphinx"
], [
PYSPHINX="-c 'import sys; from sphinx import main; sys.exit(main(sys.argv))'"
])
AC_SUBST([PYSPHINX])
#
# Logic for old vpn commands support.
#
if test "$enable_oldvpn_commands" = "yes"; then
AC_DEFINE([KEEP_OLD_VPN_COMMANDS], [1], [Define for compiling with old vpn commands])
fi
AC_MSG_CHECKING([if zebra should be configurable to send Route Advertisements])
if test "$enable_rtadv" != "no"; then
AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_RTADV], [1], [Enable IPv6 Routing Advertisement support])
else
AC_MSG_RESULT([no])
fi
if test "$enable_user" = "no"; then
enable_user=""
else
if test "$enable_user" = "yes" || test "$enable_user" = ""; then
enable_user="frr"
fi
AC_DEFINE_UNQUOTED([FRR_USER], ["${enable_user}"], [frr User])
fi
if test "$enable_group" = "no"; then
enable_group=""
else
if test "$enable_group" = "yes" || test "$enable_group" = ""; then
enable_group="frr"
fi
AC_DEFINE_UNQUOTED([FRR_GROUP], ["${enable_group}"], [frr Group])
fi
if test "$enable_vty_group" = "yes" ; then
AC_MSG_ERROR([--enable-vty-group requires a group as argument, not yes])
elif test "$enable_vty_group" != ""; then
if test "$enable_vty_group" != "no"; then
AC_DEFINE_UNQUOTED([VTY_GROUP], ["${enable_vty_group}"], [VTY Sockets Group])
fi
fi
AC_SUBST([enable_user])
AC_SUBST([enable_group])
AC_SUBST([enable_vty_group])
enable_configfile_mask=${enable_configfile_mask:-0600}
AC_DEFINE_UNQUOTED([CONFIGFILE_MASK], [${enable_configfile_mask}], [Mask for config files])
AC_SUBST([enable_configfile_mask])
enable_logfile_mask=${enable_logfile_mask:-0600}
AC_DEFINE_UNQUOTED([LOGFILE_MASK], [${enable_logfile_mask}], [Mask for log files])
MPATH_NUM=16
case "${enable_multipath}" in
0)
MPATH_NUM=64
;;
[[1-9]|[1-9][0-9]|[1-9][0-9][0-9]])
MPATH_NUM="${enable_multipath}"
;;
"")
;;
*)
AC_MSG_FAILURE([Please specify digit to enable multipath ARG])
;;
esac
AC_DEFINE_UNQUOTED([MULTIPATH_NUM], [$MPATH_NUM], [Maximum number of paths for a route])
case "${with_log_timestamp_precision}" in
[[0-9]|1[012]])
;;
"")
;;
*)
AC_MSG_FAILURE([Please specify a number from 0-12 for log precision ARG])
;;
esac
with_log_timestamp_precision=${with_log_timestamp_precision:-0}
AC_DEFINE_UNQUOTED([LOG_TIMESTAMP_PRECISION], [${with_log_timestamp_precision}], [Startup zlog timestamp precision])
AC_DEFINE_UNQUOTED([VTYSH_PAGER], ["$VTYSH_PAGER"], [What pager to use])
TIMEOUT_MIN=2
case "${with_service_timeout}" in
[[1-9]|[1-9][0-9]|[1-9][0-9][0-9]])
TIMEOUT_MIN="${with_service_timeout}"
;;
0|"")
;;
*)
AC_MSG_FAILURE([Please specify digit for timeout ARG])
;;
esac
AC_SUBST([TIMEOUT_MIN])
dnl --------------------
dnl Enable code coverage
dnl --------------------
AM_CONDITIONAL([HAVE_GCOV], [test "$enable_gcov" != "no"])