2 ## Configure template file for FRRouting.
3 ## autoconf will generate a configure script.
5 ## Copyright (c) 1996, 97, 98, 99, 2000 Kunihiro Ishiguro <kunihiro@zebra.org>
6 ## Portions Copyright (c) 2003 Paul Jakma <paul@dishone.st>
10 AC_INIT([frr], [7.2-dev], [https://github.com/frrouting/frr/issues])
11 PACKAGE_URL="https://frrouting.org/"
12 AC_SUBST([PACKAGE_URL])
13 PACKAGE_FULLNAME="FRRouting"
14 AC_SUBST([PACKAGE_FULLNAME])
16 CONFIG_ARGS="`echo $ac_configure_args | sed -e \"s% '[[A-Z]]*FLAGS=[[^']]\+'%%g\"`"
17 AC_SUBST([CONFIG_ARGS])
19 AC_CONFIG_SRCDIR([lib/zebra.h])
20 AC_CONFIG_MACRO_DIR([m4])
22 dnl -----------------------------------
23 dnl Get hostname and other information.
24 dnl -----------------------------------
28 hosttools_clippy="false"
31 dnl case 1: external clippy
32 if test -n "$with_clippy" -a "$with_clippy" != "no" -a "$with_clippy" != "yes"; then
33 if test "$enable_clippy_only" == "yes"; then
34 AC_MSG_ERROR([--enable-clippy-only does not make sense with --with-clippy])
39 if test ! -x "$with_clippy"; then
40 AC_MSG_ERROR([clippy tool ($with_clippy) is not executable])
43 dnl case 2: cross-compiling internal clippy
44 elif test "$host" != "$build"; then
45 if test "$srcdir" = "."; then
46 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.])
48 test -d hosttools || mkdir hosttools
49 abssrc="`cd \"${srcdir}\"; pwd`"
52 AC_MSG_NOTICE([... cross-compilation: creating hosttools directory and self-configuring for build platform tools])
53 AC_MSG_NOTICE([... use HOST_CPPFLAGS / HOST_CFLAGS / HOST_LDFLAGS if neccessary])
56 ( CPPFLAGS="$HOST_CPPFLAGS"; \
57 CFLAGS="$HOST_CFLAGS"; \
58 LDFLAGS="$HOST_LDFLAGS"; \
59 cd hosttools; "${abssrc}/configure" "--host=$build" "--build=$build" "--enable-clippy-only" "--disable-nhrpd" "--disable-vtysh"; ) || exit 1
62 AC_MSG_NOTICE([... cross-compilation: finished self-configuring for build platform tools])
66 hosttools_clippy="true"
67 CLIPPY="hosttools/lib/clippy"
69 dnl case 3: normal build internal clippy
71 CLIPPY="lib/clippy\$(EXEEXT)"
74 AM_CONDITIONAL([BUILD_CLIPPY], [$build_clippy])
75 AM_CONDITIONAL([HOSTTOOLS_CLIPPY], [$hosttools_clippy])
76 AM_CONDITIONAL([ONLY_CLIPPY], [test "$enable_clippy_only" = "yes"])
78 # Disable portability warnings -- our automake code (in particular
79 # common.am) uses some constructs specific to gmake.
80 AM_INIT_AUTOMAKE([1.12 -Wno-portability foreign])
81 m4_ifndef([AM_SILENT_RULES], [m4_define([AM_SILENT_RULES],[])])
82 AM_SILENT_RULES([yes])
83 AC_CONFIG_HEADERS([config.h])
85 AC_PATH_PROG([PERL], [perl])
88 dnl default is to match previous behavior
89 exampledir=${sysconfdir}
90 AC_ARG_ENABLE([exampledir],
91 AS_HELP_STRING([--enable-exampledir],
92 [specify alternate directory for examples]),
93 exampledir="$enableval",)
94 dnl XXX add --exampledir to autoconf standard directory list somehow
95 AC_SUBST([exampledir])
97 dnl default is to match previous behavior
99 AC_ARG_ENABLE([pkgsrcrcdir],
100 AS_HELP_STRING([--enable-pkgsrcrcdir],
101 [specify directory for rc.d scripts]),
102 pkgsrcrcdir="$enableval",)
103 dnl XXX add --pkgsrcrcdir to autoconf standard directory list somehow
104 AC_SUBST([pkgsrcrcdir])
105 AM_CONDITIONAL([PKGSRC], [test "x$pkgsrcrcdir" != "x"])
107 AC_ARG_WITH([moduledir], [AS_HELP_STRING([--with-moduledir=DIR], [module directory (${libdir}/frr/modules)])], [
110 moduledir="\${libdir}/frr/modules"
112 AC_SUBST([moduledir], [$moduledir])
115 AC_ARG_WITH([yangmodelsdir], [AS_HELP_STRING([--with-yangmodelsdir=DIR], [yang models directory (${datarootdir}/yang)])], [
116 yangmodelsdir="$withval"
118 yangmodelsdir="\${datarootdir}/yang"
120 AC_SUBST([yangmodelsdir])
122 AC_ARG_WITH([libyang_pluginsdir], [AS_HELP_STRING([--with-libyang-pluginsdir=DIR], [yangmodule plugins directory (${libdir}/frr/libyang_plugins)])], [
123 libyang_pluginsdir="$withval"
125 libyang_pluginsdir="\${libdir}/frr/libyang_plugins"
127 AC_SUBST([libyang_pluginsdir])
129 AC_ARG_ENABLE(tcmalloc,
130 AS_HELP_STRING([--enable-tcmalloc], [Turn on tcmalloc]),
131 [case "${enableval}" in
132 yes) tcmalloc_enabled=true
133 LIBS="$LIBS -ltcmalloc_minimal"
135 no) tcmalloc_enabled=false ;;
136 *) AC_MSG_ERROR([bad value ${enableval} for --enable-tcmalloc]) ;;
137 esac],[tcmalloc_enabled=false])
140 dnl Thanks autoconf, but we don't want a default -g -O2. We have our own
141 dnl flag determination logic.
144 dnl --------------------
145 dnl Check CC and friends
146 dnl --------------------
147 dnl note orig_cflags is also used further down
148 orig_cflags="$CFLAGS"
149 orig_cxxflags="$CXXFLAGS"
155 dnl remove autoconf default "-g -O2"
156 CFLAGS="$orig_cflags"
157 CXXFLAGS="$orig_cxxflags"
159 dnl NB: see C11 below
163 dnl it's 2019, sed is sed.
167 dnl try and enable CFLAGS that are useful for FRR
168 dnl - specifically, options to control warnings
170 AC_USE_SYSTEM_EXTENSIONS
171 AC_DEFUN([AC_C_FLAG], [{
172 m4_pushdef([cachename],[m4_translit([frr_cv_$1],[ =-+],[____])])
173 AC_CACHE_CHECK([[whether $CC supports $1]], cachename, [
175 ac_c_flag_save="$CFLAGS"
178 [AC_LANG_PROGRAM([[]])],
184 CFLAGS="$ac_c_flag_save"
187 if test "${cachename}" = yes; then
188 m4_if([$3], [], [CFLAGS="$CFLAGS $1"], [$3])
193 m4_popdef([cachename])
196 AC_DEFUN([AC_LINK_IFELSE_FLAGS], [{
198 ac_cflags_save="$CFLAGS"
205 CFLAGS="$ac_cflags_save"
211 CFLAGS="$ac_cflags_save"
220 dnl ICC won't bail on unknown options without -diag-error 10006
221 dnl need to do this first so we get useful results for the other options
222 AC_C_FLAG([-diag-error 10006])
224 dnl AC_PROG_CC_C99 may change CC to include -std=gnu99 or something
226 CC="${CC% -std=gnu99}"
229 AC_C_FLAG([-std=gnu11], [CC="$ac_cc"], [CC="$CC -std=gnu11"])
231 dnl if the user has specified any CFLAGS, override our settings
232 if test "x${enable_gcov}" = "xyes"; then
233 if test "z$orig_cflags" = "z"; then
234 AC_C_FLAG([-coverage])
238 LDFLAGS="${LDFLAGS} -lgcov"
239 elif test "x${enable_dev_build}" = "xyes"; then
240 AC_DEFINE([DEV_BUILD], [1], [Build for development])
241 if test "z$orig_cflags" = "z"; then
245 if test "x${enable_lua}" = "xyes"; then
249 AC_DEFINE([HAVE_LUA], [1], [Have support for Lua interpreter])
250 LIBS="$LIBS $LUA_LIB"
254 if test "x${enable_lua}" = "xyes"; then
255 AC_MSG_ERROR([Lua is not meant to be built/used outside of development at this time])
257 if test "z$orig_cflags" = "z"; then
264 AM_CONDITIONAL([DEV_BUILD], [test "x$enable_dev_build" = "xyes"])
266 dnl always want these CFLAGS
267 AC_C_FLAG([-fno-omit-frame-pointer])
268 AC_C_FLAG([-funwind-tables])
271 AC_C_FLAG([-Wmissing-prototypes])
272 AC_C_FLAG([-Wmissing-declarations])
273 AC_C_FLAG([-Wpointer-arith])
274 AC_C_FLAG([-Wbad-function-cast])
275 AC_C_FLAG([-Wwrite-strings])
276 if test x"${enable_gcc_ultra_verbose}" = x"yes" ; then
277 AC_C_FLAG([-Wcast-qual])
278 AC_C_FLAG([-Wstrict-prototypes])
279 AC_C_FLAG([-Wmissing-noreturn])
280 AC_C_FLAG([-Wmissing-format-attribute])
281 AC_C_FLAG([-Wunreachable-code])
282 AC_C_FLAG([-Wpacked])
283 AC_C_FLAG([-Wpadded])
284 AC_C_FLAG([-Wshadow])
286 AC_C_FLAG([-Wno-unused-result])
288 AC_C_FLAG([-Wno-unused-parameter])
289 AC_C_FLAG([-Wno-missing-field-initializers])
291 AC_C_FLAG([-Wc++-compat], [], [CXX_COMPAT_CFLAGS="-Wc++-compat"])
292 AC_SUBST([CXX_COMPAT_CFLAGS])
294 dnl ICC emits a broken warning for const char *x = a ? "b" : "c";
295 dnl for some reason the string consts get 'promoted' to char *,
296 dnl triggering a const to non-const conversion warning.
297 AC_C_FLAG([-diag-disable 3179])
299 if test x"${enable_werror}" = x"yes" ; then
305 if test "$enable_address_sanitizer" = "yes"; then
306 AC_C_FLAG([-fsanitize=address], [
307 AC_MSG_ERROR([$CC does not support Address Sanitizer.])
309 SAN_FLAGS="$SAN_FLAGS -fsanitize=address"
312 if test "$enable_thread_sanitizer" = "yes"; then
313 AC_C_FLAG([-fsanitize=thread], [
314 AC_MSG_ERROR([$CC does not support Thread Sanitizer.])
316 SAN_FLAGS="$SAN_FLAGS -fsanitize=thread"
319 if test "$enable_memory_sanitizer" = "yes"; then
320 AC_C_FLAG([-fsanitize=thread -fPIE -pie], [
321 AC_MSG_ERROR([$CC does not support Thread Sanitizer.])
323 SAN_FLAGS="-fsanitize=memory -fPIE -pie"
326 AC_SUBST([SAN_FLAGS])
334 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
335 LIBS="$PTHREAD_LIBS $LIBS"
337 AC_MSG_FAILURE([This FRR version needs pthreads])
340 AC_SEARCH_LIBS([pthread_condattr_setclock], [],
341 [frr_cv_pthread_condattr_setclock=yes],
342 [frr_cv_pthread_condattr_setclock=no])
343 if test "$frr_cv_pthread_condattr_setclock" = yes; then
344 AC_DEFINE([HAVE_PTHREAD_CONDATTR_SETCLOCK], [1], [Have pthread.h pthread_condattr_setclock])
352 AC_CHECK_TOOL([AR], [ar])
357 AC_ARG_ENABLE([static-bin],
358 AS_HELP_STRING([--enable-static-bin], [link binaries statically]))
361 patch -N -i "${srcdir}/m4/libtool-whole-archive.patch" libtool >&AS_MESSAGE_LOG_FD || \
362 AC_MSG_WARN([Could not patch libtool for static linking support. Loading modules into a statically linked daemon will fail.])
364 if test "$enable_static_bin" = "yes"; then
366 if test "$enable_static" != "yes"; then
367 AC_MSG_ERROR([The --enable-static-bin option must be combined with --enable-static.])
370 if test "$enable_shared" != "yes"; then
371 AC_MSG_ERROR([FRR cannot be built with --disable-shared. If you want statically linked daemons, use --enable-shared --enable-static --enable-static-bin])
373 AC_SUBST([AC_LDFLAGS])
374 AM_CONDITIONAL([STATIC_BIN], [test "x$enable_static_bin" = "xyes"])
376 dnl $AR and $RANLIB are set by LT_INIT above
377 AC_MSG_CHECKING([whether $AR supports D option])
378 if $AR crD conftest.a >/dev/null 2>/dev/null; then
380 dnl ARFLAGS is for automake, AR_FLAGS for libtool m-(
391 AC_MSG_CHECKING([whether $RANLIB supports D option])
392 if $RANLIB -D conftest.a >/dev/null 2>/dev/null; then
400 test -f conftest.a && rm conftest.a
402 dnl ----------------------
403 dnl Packages configuration
404 dnl ----------------------
405 if test -f config.version; then
407 elif test -f "${srcdir}/config.version"; then
408 . "${srcdir}/config.version"
410 AC_ARG_WITH([pkg-extra-version],
411 AS_HELP_STRING([--with-pkg-extra-version=VER], [add extra version field, for packagers/distributions]), [
412 if test "$withval" = "no"; then
415 EXTRAVERSION=$withval
418 AC_ARG_WITH([pkg-git-version],
419 AS_HELP_STRING([--with-pkg-git-version], [add git information to MOTD and build version string]),
420 [ test "x$withval" != "xno" && with_pkg_git_version="yes" ])
421 AC_ARG_WITH([clippy],
422 AS_HELP_STRING([--with-clippy=PATH], [use external clippy helper program]))
423 AC_ARG_WITH([vtysh_pager],
424 AS_HELP_STRING([--with-vtysh-pager=PAGER], [control what pager is compiled in as default]),
425 VTYSH_PAGER=$withval, VTYSH_PAGER="more")
426 AC_ARG_ENABLE([vtysh],
427 AS_HELP_STRING([--disable-vtysh], [do not build integrated vty shell for FRR]))
429 AS_HELP_STRING([--disable-doc], [do not build docs]))
430 AC_ARG_ENABLE([doc-html],
431 AS_HELP_STRING([--enable-doc-html], [build HTML docs]))
432 AC_ARG_ENABLE([zebra],
433 AS_HELP_STRING([--disable-zebra], [do not build zebra daemon]))
434 AC_ARG_ENABLE([bgpd],
435 AS_HELP_STRING([--disable-bgpd], [do not build bgpd]))
436 AC_ARG_ENABLE([ripd],
437 AS_HELP_STRING([--disable-ripd], [do not build ripd]))
438 AC_ARG_ENABLE([ripngd],
439 AS_HELP_STRING([--disable-ripngd], [do not build ripngd]))
440 AC_ARG_ENABLE([ospfd],
441 AS_HELP_STRING([--disable-ospfd], [do not build ospfd]))
442 AC_ARG_ENABLE([ospf6d],
443 AS_HELP_STRING([--disable-ospf6d], [do not build ospf6d]))
444 AC_ARG_ENABLE([ldpd],
445 AS_HELP_STRING([--disable-ldpd], [do not build ldpd]))
446 AC_ARG_ENABLE([nhrpd],
447 AS_HELP_STRING([--disable-nhrpd], [do not build nhrpd]))
448 AC_ARG_ENABLE([eigrpd],
449 AS_HELP_STRING([--disable-eigrpd], [do not build eigrpd]))
450 AC_ARG_ENABLE([babeld],
451 AS_HELP_STRING([--disable-babeld], [do not build babeld]))
452 AC_ARG_ENABLE([watchfrr],
453 AS_HELP_STRING([--disable-watchfrr], [do not build watchfrr]))
454 AC_ARG_ENABLE([isisd],
455 AS_HELP_STRING([--disable-isisd], [do not build isisd]))
456 AC_ARG_ENABLE([pimd],
457 AS_HELP_STRING([--disable-pimd], [do not build pimd]))
458 AC_ARG_ENABLE([pbrd],
459 AS_HELP_STRING([--disable-pbrd], [do not build pbrd]))
460 AC_ARG_ENABLE([sharpd],
461 AS_HELP_STRING([--enable-sharpd], [build sharpd]))
462 AC_ARG_ENABLE([staticd],
463 AS_HELP_STRING([--disable-staticd], [do not build staticd]))
464 AC_ARG_ENABLE([fabricd],
465 AS_HELP_STRING([--disable-fabricd], [do not build fabricd]))
466 AC_ARG_ENABLE([bgp-announce],
467 AS_HELP_STRING([--disable-bgp-announce,], [turn off BGP route announcement]))
468 AC_ARG_ENABLE([vrrpd],
469 AS_HELP_STRING([--disable-vrrpd], [do not build vrrpd]))
470 AC_ARG_ENABLE([bgp-vnc],
471 AS_HELP_STRING([--disable-bgp-vnc],[turn off BGP VNC support]))
472 AC_ARG_ENABLE([snmp],
473 AS_HELP_STRING([--enable-snmp], [enable SNMP support for agentx]))
474 AC_ARG_ENABLE([config_rollbacks],
475 AS_HELP_STRING([--enable-config-rollbacks], [enable configuration rollbacks (requires sqlite3)]))
476 AC_ARG_ENABLE([confd],
477 AS_HELP_STRING([--enable-confd=ARG], [enable confd integration]))
478 AC_ARG_ENABLE([sysrepo],
479 AS_HELP_STRING([--enable-sysrepo], [enable sysrepo integration]))
480 AC_ARG_ENABLE([grpc],
481 AS_HELP_STRING([--enable-grpc], [enable the gRPC northbound plugin]))
482 AC_ARG_ENABLE([zeromq],
483 AS_HELP_STRING([--enable-zeromq], [enable ZeroMQ handler (libfrrzmq)]))
484 AC_ARG_WITH([libpam],
485 AS_HELP_STRING([--with-libpam], [use libpam for PAM support in vtysh]))
486 AC_ARG_ENABLE([ospfapi],
487 AS_HELP_STRING([--disable-ospfapi], [do not build OSPFAPI to access the OSPF LSA Database]))
488 AC_ARG_ENABLE([ospfclient],
489 AS_HELP_STRING([--disable-ospfclient], [do not build OSPFAPI client for OSPFAPI,
490 (this is the default if --disable-ospfapi is set)]))
491 AC_ARG_ENABLE([multipath],
492 AS_HELP_STRING([--enable-multipath=ARG], [enable multipath function, ARG must be digit]))
493 AC_ARG_ENABLE([user],
494 AS_HELP_STRING([--enable-user=USER], [user to run FRR suite as (default frr)]))
495 AC_ARG_ENABLE([group],
496 AS_HELP_STRING([--enable-group=GROUP], [group to run FRR suite as (default frr)]))
497 AC_ARG_ENABLE([vty_group],
498 AS_HELP_STRING([--enable-vty-group=ARG], [set vty sockets to have specified group as owner]))
499 AC_ARG_ENABLE([configfile_mask],
500 AS_HELP_STRING([--enable-configfile-mask=ARG], [set mask for config files]))
501 AC_ARG_ENABLE([logfile_mask],
502 AS_HELP_STRING([--enable-logfile-mask=ARG], [set mask for log files]))
503 AC_ARG_ENABLE([shell_access],
504 AS_HELP_STRING([--enable-shell-access], [Allow users to access shell/telnet/ssh]))
505 AC_ARG_ENABLE([realms],
506 AS_HELP_STRING([--enable-realms], [enable REALMS support under Linux]))
507 AC_ARG_ENABLE([rtadv],
508 AS_HELP_STRING([--disable-rtadv], [disable IPV6 router advertisement feature]))
509 AC_ARG_ENABLE([irdp],
510 AS_HELP_STRING([--disable-irdp], [enable IRDP server support in zebra (default if supported)]))
511 AC_ARG_ENABLE([capabilities],
512 AS_HELP_STRING([--disable-capabilities], [disable using POSIX capabilities]))
513 AC_ARG_ENABLE([rusage],
514 AS_HELP_STRING([--disable-rusage], [disable using getrusage]))
515 AC_ARG_ENABLE([gcc_ultra_verbose],
516 AS_HELP_STRING([--enable-gcc-ultra-verbose], [enable ultra verbose GCC warnings]))
517 AC_ARG_ENABLE([backtrace],
518 AS_HELP_STRING([--disable-backtrace,], [disable crash backtraces (default autodetect)]))
519 AC_ARG_ENABLE([time-check],
520 AS_HELP_STRING([--disable-time-check], [disable slow thread warning messages]))
521 AC_ARG_ENABLE([pcreposix],
522 AS_HELP_STRING([--enable-pcreposix], [enable using PCRE Posix libs for regex functions]))
524 AS_HELP_STRING([--enable-fpm], [enable Forwarding Plane Manager support]))
525 AC_ARG_ENABLE([systemd],
526 AS_HELP_STRING([--enable-systemd], [enable Systemd support]))
527 AC_ARG_ENABLE([werror],
528 AS_HELP_STRING([--enable-werror], [enable -Werror (recommended for developers only)]))
529 AC_ARG_ENABLE([cumulus],
530 AS_HELP_STRING([--enable-cumulus], [enable Cumulus Switch Special Extensions]))
531 AC_ARG_ENABLE([datacenter],
532 AS_HELP_STRING([--enable-datacenter], [enable Compilation for Data Center Extensions]))
533 AC_ARG_ENABLE([fuzzing],
534 AS_HELP_STRING([--enable-fuzzing], [enable ability to fuzz various parts of FRR]))
535 AC_ARG_ENABLE([netlink_fuzzing],
536 AS_HELP_STRING([--enable-netlink-fuzzing], [enable ability to fuzz netlink listening socket in zebra]))
537 AC_ARG_ENABLE([rr-semantics],
538 AS_HELP_STRING([--disable-rr-semantics], [disable the v6 Route Replace semantics]))
539 AC_ARG_ENABLE([protobuf],
540 AS_HELP_STRING([--enable-protobuf], [Enable experimental protobuf support]))
541 AC_ARG_ENABLE([oldvpn_commands],
542 AS_HELP_STRING([--enable-oldvpn-commands], [Keep old vpn commands]))
543 AC_ARG_ENABLE([rpki],
544 AS_HELP_STRING([--enable-rpki], [enable RPKI prefix validation support]))
545 AC_ARG_ENABLE([clippy-only],
546 AS_HELP_STRING([--enable-clippy-only], [Only build clippy]))
547 AC_ARG_ENABLE([numeric_version],
548 AS_HELP_STRING([--enable-numeric-version], [Only numeric digits allowed in version (for Alpine)]))
549 AC_ARG_ENABLE([gcov],
550 AS_HELP_STRING([--enable-gcov], [Add code coverage information]))
551 AC_ARG_ENABLE([bfdd],
552 AS_HELP_STRING([--disable-bfdd], [do not build bfdd]))
553 AC_ARG_ENABLE([address-sanitizer],
554 AS_HELP_STRING([--enable-address-sanitizer], [enable AddressSanitizer support for detecting a wide variety of memory allocation and deallocation errors]))
555 AC_ARG_ENABLE([thread-sanitizer],
556 AS_HELP_STRING([--enable-thread-sanitizer], [enable ThreadSanitizer support for detecting data races]))
557 AC_ARG_ENABLE([memory-sanitizer],
558 AS_HELP_STRING([--enable-memory-sanitizer], [enable MemorySanitizer support for detecting uninitialized memory reads]))
560 AS_IF([test "${enable_clippy_only}" != "yes"], [
561 AC_CHECK_HEADERS([json-c/json.h])
562 AC_CHECK_LIB([json-c], [json_object_get], [LIBS="$LIBS -ljson-c"], [], [-lm])
563 if test "$ac_cv_lib_json_c_json_object_get" = no; then
564 AC_CHECK_LIB([json], [json_object_get], [LIBS="$LIBS -ljson"])
565 if test "$ac_cv_lib_json_json_object_get" = no; then
566 AC_MSG_ERROR([libjson is needed to compile])
571 AC_ARG_ENABLE([dev_build],
572 AS_HELP_STRING([--enable-dev-build], [build for development]))
575 AS_HELP_STRING([--enable-lua], [Build Lua scripting]))
577 if test x"${enable_time_check}" != x"no" ; then
578 if test x"${enable_time_check}" = x"yes" -o x"${enable_time_check}" = x ; then
579 AC_DEFINE([CONSUMED_TIME_CHECK], [5000000], [Consumed Time Check])
581 AC_DEFINE_UNQUOTED([CONSUMED_TIME_CHECK], [$enable_time_check], [Consumed Time Check])
585 case "${enable_systemd}" in
588 AC_CHECK_LIB([systemd], [sd_notify], [LIBS="$LIBS -lsystemd"])
589 if test $ac_cv_lib_systemd_sd_notify = no; then
590 AC_MSG_ERROR([enable systemd has been specified but systemd development env not found on your system])
592 AC_DEFINE([HAVE_SYSTEMD], [1], [Compile systemd support in])
598 if test "${enable_rr_semantics}" != "no" ; then
599 AC_DEFINE([HAVE_V6_RR_SEMANTICS], [1], [Compile in v6 Route Replacement Semantics])
602 if test "${enable_datacenter}" = "yes" ; then
603 AC_DEFINE([HAVE_DATACENTER], [1], [Compile extensions for a DataCenter])
604 DFLT_NAME="datacenter"
606 DFLT_NAME="traditional"
609 if test "${enable_fuzzing}" = "yes" ; then
610 AC_DEFINE([HANDLE_ZAPI_FUZZING], [1], [Compile extensions to use with a fuzzer])
613 if test "${enable_netlink_fuzzing}" = "yes" ; then
614 AC_DEFINE([HANDLE_NETLINK_FUZZING], [1], [Compile extensions to use with a fuzzer for netlink])
617 if test "${enable_cumulus}" = "yes" ; then
618 AC_DEFINE([HAVE_CUMULUS], [1], [Compile Special Cumulus Code in])
621 AC_SUBST([DFLT_NAME])
622 AC_DEFINE_UNQUOTED([DFLT_NAME], ["$DFLT_NAME"], [Name of the configuration default set])
624 if test "${enable_shell_access}" = "yes"; then
625 AC_DEFINE([HAVE_SHELL_ACCESS], [1], [Allow user to use ssh/telnet/bash, be aware this is considered insecure])
632 AS_IF([test "$host" = "$build"], [
638 FRR_PYTHON_MODULES([pytest])
640 if test "${enable_doc}" != "no"; then
641 FRR_PYTHON_MODULES([sphinx], , [
642 if test "${enable_doc}" = "yes"; then
643 AC_MSG_ERROR([Documentation was explicitly requested with --enable-doc but sphinx is not available for $PYTHON. Please disable docs or install sphinx.])
647 AM_CONDITIONAL([DOC], [test "${enable_doc}" != "no" -a "$frr_py_mod_sphinx" != "false"])
648 AM_CONDITIONAL([DOC_HTML], [test "${enable_doc_html}" = "yes"])
650 FRR_PYTHON_MOD_EXEC([sphinx], [--version], [
653 PYSPHINX="-c 'import sys; from sphinx import main; sys.exit(main(sys.argv))'"
658 # Logic for old vpn commands support.
660 if test "$enable_oldvpn_commands" = "yes"; then
661 AC_DEFINE([KEEP_OLD_VPN_COMMANDS], [1], [Define for compiling with old vpn commands])
665 # End of logic for protobuf support.
668 AC_MSG_CHECKING([if zebra should be configurable to send Route Advertisements])
669 if test "${enable_rtadv}" != "no"; then
671 AC_DEFINE([HAVE_RTADV], [1], [Enable IPv6 Routing Advertisement support])
676 if test x"${enable_user}" = x"no"; then
679 if test x"${enable_user}" = x"yes" || test x"${enable_user}" = x""; then
682 AC_DEFINE_UNQUOTED([FRR_USER], ["${enable_user}"], [frr User])
685 if test x"${enable_group}" = x"no"; then
688 if test x"${enable_group}" = x"yes" || test x"${enable_group}" = x""; then
691 AC_DEFINE_UNQUOTED([FRR_GROUP], ["${enable_group}"], [frr Group])
694 if test x"${enable_vty_group}" = x"yes" ; then
695 AC_MSG_ERROR([--enable-vty-group requires a group as argument, not yes])
696 elif test x"${enable_vty_group}" != x""; then
697 if test x"${enable_vty_group}" != x"no"; then
698 AC_DEFINE_UNQUOTED([VTY_GROUP], ["${enable_vty_group}"], [VTY Sockets Group])
701 AC_SUBST([enable_user])
702 AC_SUBST([enable_group])
703 AC_SUBST([enable_vty_group])
705 enable_configfile_mask=${enable_configfile_mask:-0600}
706 AC_DEFINE_UNQUOTED([CONFIGFILE_MASK], [${enable_configfile_mask}], [Mask for config files])
708 enable_logfile_mask=${enable_logfile_mask:-0600}
709 AC_DEFINE_UNQUOTED([LOGFILE_MASK], [${enable_logfile_mask}], [Mask for log files])
713 case "${enable_multipath}" in
717 [[1-9]|[1-9][0-9]|[1-9][0-9][0-9]])
718 MPATH_NUM="${enable_multipath}"
723 AC_MSG_FAILURE([Please specify digit to enable multipath ARG])
727 AC_DEFINE_UNQUOTED([MULTIPATH_NUM], [$MPATH_NUM], [Maximum number of paths for a route])
729 AC_DEFINE_UNQUOTED([VTYSH_PAGER], ["$VTYSH_PAGER"], [What pager to use])
731 dnl --------------------
732 dnl Enable code coverage
733 dnl --------------------
734 AM_CONDITIONAL([HAVE_GCOV], [test '!' "$enable_gcov" = no])
736 dnl ------------------------------------
737 dnl Alpine only accepts numeric versions
738 dnl ------------------------------------
739 if test "x${enable_numeric_version}" != "x" ; then
740 VERSION="`echo ${VERSION} | tr -c -d '[[.0-9]]'`"
741 PACKAGE_VERSION="`echo ${PACKAGE_VERSION} | tr -c -d '[[.0-9]]'`"
744 dnl -----------------------------------
745 dnl Add extra version string to package
746 dnl name, string and version fields.
747 dnl -----------------------------------
748 if test "x${EXTRAVERSION}" != "x" ; then
749 VERSION="${VERSION}${EXTRAVERSION}"
750 PACKAGE_VERSION="${PACKAGE_VERSION}${EXTRAVERSION}"
751 AC_SUBST(PACKAGE_EXTRAVERSION, ["${EXTRAVERSION}"])
752 PACKAGE_STRING="${PACKAGE_STRING}${EXTRAVERSION}"
754 AC_SUBST([EXTRAVERSION])
756 if test "x$with_pkg_git_version" = "xyes"; then
757 if test -d "${srcdir}/.git"; then
758 AC_DEFINE([GIT_VERSION], [1], [include git version info])
759 else with_pkg_git_version="no"
760 AC_MSG_WARN([--with-pkg-git-version given, but this is not a git checkout])
763 AM_CONDITIONAL([GIT_VERSION], [test "x$with_pkg_git_version" = "xyes"])
765 AC_CHECK_TOOL([OBJCOPY], [objcopy], [:])
766 if test "x${OBJCOPY}" != "x:"; then
767 AC_CACHE_CHECK([for .interp value to use], [frr_cv_interp], [
769 AC_LINK_IFELSE([AC_LANG_SOURCE([[int main() { return 0; }]])], [
770 if $OBJCOPY -j.interp -Obinary conftest conftest.interp; then
771 frr_cv_interp="`xargs -0 echo < conftest.interp`"
773 test -f conftest.interp && rm conftest.interp
777 if test -n "$frr_cv_interp"; then
778 AC_DEFINE_UNQUOTED([INTERP], ["$frr_cv_interp"], [.interp value])
781 dnl -------------------------
782 dnl Check other header files.
783 dnl -------------------------
784 AC_CHECK_HEADERS([stropts.h sys/ksym.h \
785 linux/version.h asm/types.h])
787 ac_stdatomic_ok=false
788 AC_DEFINE([FRR_AUTOCONF_ATOMIC], [1], [did autoconf checks for atomic funcs])
789 AC_CHECK_HEADER([stdatomic.h],[
791 AC_MSG_CHECKING([whether _Atomic qualifier works])
792 AC_LINK_IFELSE([AC_LANG_SOURCE([[
793 #include <stdatomic.h>
794 int main(int argc, char **argv) {
799 AC_DEFINE([HAVE_STDATOMIC_H], [1], [found stdatomic.h])
807 AS_IF([$ac_stdatomic_ok], [true], [
808 AC_MSG_CHECKING([for __atomic_* builtins])
809 AC_LINK_IFELSE([AC_LANG_SOURCE([[
810 int main(int argc, char **argv) {
812 __atomic_store_n (&i, 0, __ATOMIC_RELEASE);
813 return __atomic_load_n (&i, __ATOMIC_ACQUIRE);
816 AC_DEFINE([HAVE___ATOMIC], [1], [found __atomic builtins])
821 dnl FreeBSD 9 has a broken stdatomic.h where _Atomic doesn't work
822 AC_MSG_CHECKING([for __sync_* builtins])
823 AC_LINK_IFELSE([AC_LANG_SOURCE([[
824 int main(int argc, char **argv) {
826 __sync_fetch_and_sub (&i, 1);
827 return __sync_val_compare_and_swap (&i, 0, 1);
830 AC_DEFINE([HAVE___SYNC], [1], [found __sync builtins])
833 AC_MSG_CHECKING([for __sync_swap builtin])
834 AC_LINK_IFELSE([AC_LANG_SOURCE([[
835 int main(int argc, char **argv) {
837 return __sync_swap (&i, 2);
840 AC_DEFINE([HAVE___SYNC_SWAP], 1, [found __sync_swap builtin])
848 AC_MSG_FAILURE([stdatomic.h unavailable and $CC has neither __atomic nor __sync builtins])
853 AC_CHECK_HEADERS([pthread_np.h],,, [
856 AC_CHECK_FUNCS([pthread_setname_np pthread_set_name_np])
862 AC_MSG_CHECKING([for Linux futex() support])
863 AC_LINK_IFELSE([AC_LANG_PROGRAM([
869 #include <sys/time.h>
870 #include <sys/syscall.h>
871 #include <linux/futex.h>
877 return syscall(SYS_futex, NULL, FUTEX_WAIT, 0, NULL, NULL, 0);
881 AC_DEFINE(HAVE_SYNC_LINUX_FUTEX,,Have Linux futex support)
890 AC_MSG_CHECKING([for FreeBSD _umtx_op() support])
891 AC_LINK_IFELSE([AC_LANG_PROGRAM([
894 #include <sys/types.h>
895 #include <sys/umtx.h>
900 return _umtx_op(NULL, UMTX_OP_WAIT_UINT, 0, NULL, NULL);
904 AC_DEFINE(HAVE_SYNC_UMTX_OP,,Have FreeBSD _umtx_op() support)
912 dnl OpenBSD patch (not upstream at the time of writing this)
913 dnl https://marc.info/?l=openbsd-tech&m=147299508409549&w=2
914 AC_MSG_CHECKING([for OpenBSD futex() support])
915 AC_LINK_IFELSE([AC_LANG_PROGRAM([
916 #include <sys/futex.h>
921 return futex(NULL, FUTEX_WAIT, 0, NULL, NULL, 0);
925 AC_DEFINE(HAVE_SYNC_OPENBSD_FUTEX,,Have OpenBSD futex support)
932 dnl Utility macro to avoid retyping includes all the time
933 m4_define([FRR_INCLUDES],
935 #define _POSIX_C_SOURCE 200809L
936 #define __EXTENSIONS__
941 #include <sys/types.h>
942 /* sys/conf.h depends on param.h on FBSD at least */
943 #include <sys/param.h>
944 /* Required for MAXSIG */
946 #include <sys/socket.h>
948 # define __APPLE_USE_RFC_3542
950 #include <netinet/in.h>
951 #include <sys/time.h>
956 dnl Same applies for HAVE_NET_IF_VAR_H, which HAVE_NETINET6_ND6_H and
957 dnl HAVE_NETINET_IN_VAR_H depend upon. But if_var.h depends on if.h, hence
958 dnl an additional round for it.
960 AC_CHECK_HEADERS([net/if_var.h], [], [], [FRR_INCLUDES])
962 m4_define([FRR_INCLUDES],
964 [#if HAVE_NET_IF_VAR_H
965 # include <net/if_var.h>
969 AC_CHECK_HEADERS([netinet/in_var.h \
970 net/if_dl.h net/netopt.h \
971 inet/nd.h netinet/ip_icmp.h \
972 sys/sysctl.h sys/sockio.h sys/conf.h],
973 [], [], [FRR_INCLUDES])
975 AC_CHECK_HEADERS([ucontext.h], [], [],
978 #endif /* __USE_GNU */
982 m4_define([UCONTEXT_INCLUDES],
983 [#include <ucontext.h>])dnl
985 AC_CHECK_MEMBERS([ucontext_t.uc_mcontext.uc_regs],
986 [], [], [UCONTEXT_INCLUDES])
987 AC_CHECK_MEMBERS([ucontext_t.uc_mcontext.regs],
988 [AC_CHECK_MEMBERS([ucontext_t.uc_mcontext.regs.nip],
989 [], [], [UCONTEXT_INCLUDES])],
990 [], [UCONTEXT_INCLUDES])
991 AC_CHECK_MEMBERS([ucontext_t.uc_mcontext.gregs],
992 [], [], [UCONTEXT_INCLUDES])
994 m4_define([FRR_INCLUDES],
998 #include <netinet/in_systm.h>
999 #if HAVE_NETINET_IN_VAR_H
1000 # include <netinet/in_var.h>
1002 #if HAVE_NET_IF_DL_H
1003 # include <net/if_dl.h>
1005 #if HAVE_NET_NETOPT_H
1006 # include <net/netopt.h>
1008 #include <net/route.h>
1010 # include <inet/nd.h>
1012 #include <arpa/inet.h>
1013 /* Required for IDRP */
1014 #if HAVE_NETINET_IP_ICMP_H
1015 # include <netinet/ip_icmp.h>
1019 dnl V6 headers are checked below, after we check for v6
1021 AC_MSG_CHECKING([which operating system interface to use])
1024 AC_MSG_RESULT([Solaris])
1026 AC_DEFINE([SUNOS_5], [1], [SunOS 5])
1027 AC_DEFINE([SOLARIS_IPV6], [1], Solaris IPv6)
1028 AC_DEFINE([_POSIX_C_SOURCE], [200809L], [enable POSIX.1-2008 and XPG7/SUSv4])
1030 AC_CHECK_LIB([socket], [main])
1031 AC_CHECK_LIB([nsl], [main])
1032 AC_CHECK_LIB([umem], [main])
1036 AC_MSG_RESULT([Linux])
1038 AC_DEFINE([GNU_LINUX], [1], [GNU Linux])
1039 AC_DEFINE([HAVE_NETLINK], [1], [netlink])
1040 AC_DEFINE([LINUX_IPV6], [1], [Linux IPv6 stack])
1042 dnl Linux has a compilation problem with mixing
1043 dnl netinet/in.h and linux/in6.h they are not
1044 dnl compatible. There has been discussion on
1045 dnl how to fix it but no real progress on implementation
1046 dnl when they fix it, remove this
1047 AC_DEFINE([IPV6_MINHOPCOUNT], [73], [Linux ipv6 Min Hop Count])
1050 AC_MSG_RESULT([OpenBSD])
1052 AC_DEFINE([OPEN_BSD], [1], [OpenBSD])
1053 AC_DEFINE([KAME], [1], [KAME IPv6])
1054 AC_DEFINE([BSD_V6_SYSCTL], [1], [BSD v6 sysctl to turn on and off forwarding])
1056 if test "x${enable_pimd}" != "xno"; then
1061 AC_MSG_FAILURE([pimd cannot be enabled as PIM support has been removed from OpenBSD 6.1])
1067 AC_MSG_RESULT([BSD])
1069 AC_DEFINE([HAVE_NET_RT_IFLIST], [1], [NET_RT_IFLIST])
1070 AC_DEFINE([KAME], [1], [KAME IPv6])
1071 AC_DEFINE([BSD_V6_SYSCTL], [1], [BSD v6 sysctl to turn on and off forwarding])
1074 AM_CONDITIONAL([SOLARIS], [test "${SOLARIS}" = "solaris"])
1078 dnl ------------------------
1079 dnl Integrated REALMS option
1080 dnl ------------------------
1081 if test "${enable_realms}" = "yes"; then
1084 AC_DEFINE([SUPPORT_REALMS], [1], [Realms support])
1087 echo "Sorry, only Linux has REALMS support"
1093 dnl -------------------------------
1094 dnl Endian-ness check
1095 dnl -------------------------------
1105 dnl ##########################################################################
1106 dnl LARGE if block spans a lot of "configure"!
1107 if test "${enable_clippy_only}" != "yes"; then
1108 dnl ##########################################################################
1111 # Logic for protobuf support.
1113 if test "$enable_protobuf" = "yes"; then
1114 # Check for protoc & protoc-c
1116 # protoc is not required, it's only for a "be nice" helper target
1117 AC_CHECK_PROGS([PROTOC], [protoc], [/bin/false])
1119 AC_CHECK_PROGS([PROTOC_C], [protoc-c], [/bin/false])
1120 if test "$PROTOC_C" = "/bin/false"; then
1121 AC_MSG_FAILURE([protobuf requested but protoc-c not found. Install protobuf-c.])
1124 PKG_CHECK_MODULES([PROTOBUF_C], [libprotobuf-c >= 0.14],, [
1125 AC_MSG_FAILURE([protobuf requested but libprotobuf-c not found. Install protobuf-c.])
1127 AC_CHECK_HEADER([google/protobuf-c/protobuf-c.h], [], [
1128 AC_MSG_FAILURE([protobuf requested but protobuf-c.h not found. Install protobuf-c.])
1131 AC_DEFINE([HAVE_PROTOBUF], [1], [protobuf])
1135 dnl ---------------------
1136 dnl Integrated VTY option
1137 dnl ---------------------
1138 case "${enable_vtysh}" in
1143 AC_DEFINE([VTYSH], [1], [VTY shell])
1146 AC_CHECK_LIB([readline], [main], [
1147 LIBREADLINE="-lreadline"
1149 dnl readline failed - it might be incorrectly linked and missing its
1150 dnl termcap/tinfo/curses dependency. see if we can fix that...
1151 AC_SEARCH_LIBS([tputs], [termcap tinfo curses ncurses], [
1152 LIBREADLINE="$ac_cv_search_tputs"
1154 AC_MSG_ERROR([libreadline (needed for vtysh) not found and/or missing dependencies])
1157 dnl re-try with the lib we found above
1158 unset ac_cv_lib_readline_main
1159 AC_CHECK_LIB([readline], [main], [
1160 LIBREADLINE="-lreadline $LIBREADLINE"
1162 AC_MSG_ERROR([libreadline (needed for vtysh) not found and/or missing dependencies])
1167 AC_CHECK_HEADER([readline/history.h])
1168 if test $ac_cv_header_readline_history_h = no;then
1169 AC_MSG_ERROR([readline is too old to have readline/history.h, please update to the latest readline library.])
1171 AC_CHECK_LIB([readline], [rl_completion_matches], [true], [], [$LIBREADLINE])
1172 if test $ac_cv_lib_readline_rl_completion_matches = no; then
1173 AC_DEFINE([rl_completion_matches], [completion_matches], [Old readline])
1175 AC_CHECK_LIB([readline], [append_history], [frr_cv_append_history=yes], [frr_cv_append_history=no], [$LIBREADLINE])
1176 if test "$frr_cv_append_history" = yes; then
1177 AC_DEFINE([HAVE_APPEND_HISTORY], [1], [Have history.h append_history])
1181 AC_SUBST([LIBREADLINE])
1186 dnl FRR detects the PAM library it is built against by checking for a
1187 dnl functional pam_misc.h (Linux-PAM) or openpam.h (OpenPAM) header. pam_misc.h
1188 dnl is known to #include pam_appl.h, the standard header of a PAM library, and
1189 dnl openpam.h doesn't do that, although depends on the header too. Hence a
1190 dnl little assistance to AC_CHECK_HEADER is necessary for the proper detection
1193 if test "$with_libpam" = "yes"; then
1194 AC_CHECK_HEADER([security/pam_misc.h],
1195 [AC_DEFINE([HAVE_PAM_MISC_H], [1], [Have pam_misc.h])
1196 AC_DEFINE([PAM_CONV_FUNC], [misc_conv], [Have misc_conv])
1197 pam_conv_func="misc_conv"
1200 AC_CHECK_HEADER([security/openpam.h],
1201 [AC_DEFINE([HAVE_OPENPAM_H], [1], [Have openpam.h])
1202 AC_DEFINE([PAM_CONV_FUNC], [openpam_ttyconv], [Have openpam_ttyconv])
1203 pam_conv_func="openpam_ttyconv"
1205 [], FRR_INCLUDES[#include <security/pam_appl.h>])
1206 if test -z "$ac_cv_header_security_pam_misc_h$ac_cv_header_security_openpam_h" ; then
1207 AC_MSG_WARN([*** pam support will not be built ***])
1212 if test "$with_libpam" = "yes"; then
1213 dnl took this test from proftpds configure.in and suited to our needs
1214 dnl -------------------------------------------------------------------------
1216 dnl This next check looks funky due to a linker problem with some versions
1217 dnl of the PAM library. Prior to 0.72 release, the Linux PAM shared library
1218 dnl omitted requiring libdl linking information. PAM-0.72 or better ships
1219 dnl with RedHat 6.2 and Debian 2.2 or better.
1220 AC_CHECK_LIB([pam], [pam_start],
1221 [AC_CHECK_LIB([pam], [$pam_conv_func],
1222 [AC_DEFINE([USE_PAM], [1], [Use PAM for authentication])
1224 [AC_DEFINE([USE_PAM], [1], [Use PAM for authentication])
1225 LIBPAM="-lpam -lpam_misc"]
1229 [AC_CHECK_LIB([pam], [pam_end],
1230 [AC_CHECK_LIB([pam], [$pam_conv_func],
1231 [AC_DEFINE([USE_PAM], [1], [Use PAM for authentication])
1232 LIBPAM="-lpam -ldl"],
1233 [AC_DEFINE([USE_PAM], [1], [Use PAM for authentication])
1234 LIBPAM="-lpam -ldl -lpam_misc"]
1236 ],AC_MSG_WARN([*** pam support will not be built ***]),
1243 dnl -------------------------------
1244 dnl bgpd needs pow() and hence libm
1245 dnl -------------------------------
1248 AC_SEARCH_LIBS([pow], [m], [
1251 AC_MSG_WARN([Unable to find working pow function - bgpd may not link])
1256 AC_CHECK_FUNCS([ppoll], [
1257 AC_DEFINE([HAVE_PPOLL], [1], [have Linux/BSD ppoll()])
1259 AC_CHECK_FUNCS([pollts], [
1260 AC_DEFINE([HAVE_POLLTS], [1], [have NetBSD pollts()])
1263 AC_CHECK_HEADER([asm-generic/unistd.h],
1264 [AC_CHECK_DECL(__NR_setns,
1265 AC_DEFINE([HAVE_NETNS], [1], [Have netns]),,
1266 FRR_INCLUDES [#include <asm-generic/unistd.h>
1268 AC_CHECK_FUNCS([setns])]
1271 dnl --------------------------
1272 dnl Determine IS-IS I/O method
1273 dnl --------------------------
1274 AC_DEFINE([ISIS_METHOD_PFPACKET], [1], [constant value for isis method pfpacket])
1275 AC_DEFINE([ISIS_METHOD_DLPI], [2], [constant value for isis method dlpi])
1276 AC_DEFINE([ISIS_METHOD_BPF], [3], [constant value for isis method bpf])
1277 AC_CHECK_HEADER([net/bpf.h])
1278 AC_CHECK_HEADER([sys/dlpi.h])
1279 AC_MSG_CHECKING([zebra IS-IS I/O method])
1283 AC_MSG_RESULT([pfpacket])
1284 ISIS_METHOD_MACRO="ISIS_METHOD_PFPACKET"
1287 AC_MSG_RESULT([DLPI])
1288 ISIS_METHOD_MACRO="ISIS_METHOD_DLPI"
1291 if test $ac_cv_header_net_bpf_h = no; then
1292 if test $ac_cv_header_sys_dlpi_h = no; then
1293 AC_MSG_RESULT([none])
1294 if test "${enable_isisd}" = yes -o "${enable_fabricd}" = yes; then
1295 AC_MSG_FAILURE([IS-IS support requested but no packet backend found])
1297 AC_MSG_WARN([*** IS-IS support will not be built ***])
1301 AC_MSG_RESULT([DLPI])
1303 ISIS_METHOD_MACRO="ISIS_METHOD_DLPI"
1305 AC_MSG_RESULT([BPF])
1306 ISIS_METHOD_MACRO="ISIS_METHOD_BPF"
1310 AC_DEFINE_UNQUOTED([ISIS_METHOD], [$ISIS_METHOD_MACRO], [selected method for isis, == one of the constants])
1312 dnl ---------------------------------------------------------------
1313 dnl figure out how to specify an interface in multicast sockets API
1314 dnl ---------------------------------------------------------------
1315 AC_CHECK_MEMBERS([struct ip_mreqn.imr_ifindex], [], [], FRR_INCLUDES)
1317 AC_CHECK_HEADERS([linux/mroute.h], [], [],[
1318 #include <sys/socket.h>
1319 #include <netinet/in.h>
1320 #define _LINUX_IN_H /* For Linux <= 2.6.25 */
1321 #include <linux/types.h>
1324 m4_define([FRR_INCLUDES],
1326 [#if HAVE_LINUX_MROUTE_H
1327 # include <linux/mroute.h>
1331 AC_CHECK_HEADERS([netinet/ip_mroute.h], [], [],[
1332 #include <sys/socket.h>
1333 #include <sys/types.h>
1334 #include <netinet/in.h>
1335 #include <net/route.h>
1338 m4_define([FRR_INCLUDES],
1340 [#if HAVE_NETINET_IP_MROUTE_H
1341 # include <netinet/ip_mroute.h>
1345 AC_MSG_CHECKING([for BSD struct ip_mreq hack])
1346 AC_TRY_COMPILE([#include <sys/param.h>],
1347 [#if (defined(__FreeBSD__) && ((__FreeBSD_version >= 500022 && __FreeBSD_version < 700000) || (__FreeBSD_version < 500000 && __FreeBSD_version >= 440000))) || (defined(__NetBSD__) && defined(__NetBSD_Version__) && __NetBSD_Version__ >= 106010000) || defined(__OpenBSD__) || defined(__APPLE__) || defined(__DragonFly__) || defined(__sun)
1350 #error No support for BSD struct ip_mreq hack detected
1351 #endif],[AC_MSG_RESULT([yes])
1352 AC_DEFINE([HAVE_BSD_STRUCT_IP_MREQ_HACK], [1], [Can pass ifindex in struct ip_mreq])],
1353 AC_MSG_RESULT([no]))
1355 AC_MSG_CHECKING([for RFC3678 protocol-independed API])
1357 #include <sys/types.h>
1358 #include <netinet/in.h>
1359 ], [struct group_req gr; int sock; setsockopt(sock, IPPROTO_IP, MCAST_JOIN_GROUP, (void*)&gr, sizeof(gr));
1360 ], [AC_MSG_RESULT([yes])
1361 AC_DEFINE([HAVE_RFC3678], [1], [Have RFC3678 protocol-independed API])],
1362 AC_MSG_RESULT([no]))
1364 dnl ---------------------------------------------------------------
1365 dnl figure out how to check link-state
1366 dnl ---------------------------------------------------------------
1367 AC_CHECK_HEADER([net/if_media.h],
1368 [m4_define([LINK_DETECT_INCLUDES],
1370 [#include <net/if_media.h>
1372 AC_CHECK_MEMBERS([struct ifmediareq.ifm_status],
1373 AC_DEFINE([HAVE_BSD_LINK_DETECT], [1], [BSD link-detect]),
1374 [], LINK_DETECT_INCLUDES)],
1378 dnl ---------------------------------------------------------------
1379 dnl Additional, newer way to check link-state using ifi_link_state.
1380 dnl Not available in all BSD's when ifmediareq available
1381 dnl ---------------------------------------------------------------
1382 AC_CHECK_MEMBERS([struct if_data.ifi_link_state],
1383 AC_DEFINE([HAVE_BSD_IFI_LINK_STATE], [1], [BSD ifi_link_state available]),
1386 dnl ------------------------
1387 dnl TCP_MD5SIG socket option
1388 dnl ------------------------
1390 AC_CHECK_HEADER([netinet/tcp.h],
1391 [m4_define([MD5_INCLUDES],
1393 [#include <netinet/tcp.h>
1395 AC_CHECK_DECLS([TCP_MD5SIG], [], [], MD5_INCLUDES)],
1398 if test $ac_cv_have_decl_TCP_MD5SIG = no; then
1399 AC_CHECK_HEADER([linux/tcp.h],
1400 [m4_define([MD5_INCLUDES],
1402 [#include <linux/tcp.h>
1404 AC_CHECK_DECLS([TCP_MD5SIG], [], [], MD5_INCLUDES)])
1408 AC_CHECK_LIB([crypt], [crypt], [],
1409 [AC_CHECK_LIB([crypto], [DES_crypt])])
1410 AC_CHECK_LIB([resolv], [res_init])
1412 dnl ---------------------------
1413 dnl check system has PCRE regexp
1414 dnl ---------------------------
1415 if test "x$enable_pcreposix" = "xyes"; then
1416 AC_CHECK_LIB([pcreposix], [regexec], [], [
1417 AC_MSG_ERROR([--enable-pcreposix given but unable to find libpcreposix])
1420 AC_SUBST([HAVE_LIBPCREPOSIX])
1422 dnl ##########################################################################
1423 dnl test "${enable_clippy_only}" != "yes"
1425 dnl END OF LARGE if block
1426 dnl ##########################################################################
1429 dnl ----------------------------------------------------------------------------
1430 dnl figure out if domainname is available in the utsname struct (GNU extension).
1431 dnl ----------------------------------------------------------------------------
1432 AC_CHECK_MEMBERS([struct utsname.domainname], [], [], [#include <sys/utsname.h>])
1434 dnl ------------------
1435 dnl IPv6 header checks
1436 dnl ------------------
1437 AC_CHECK_HEADERS([netinet6/in6.h netinet/in6_var.h \
1438 netinet6/in6_var.h netinet6/nd6.h], [], [],
1441 m4_define([FRR_INCLUDES],dnl
1443 [#if HAVE_NETINET6_IN6_H
1444 #include <netinet6/in6.h>
1446 #if HAVE_NETINET_IN6_VAR_H
1447 #include <netinet/in6_var.h>
1449 #include <netinet/icmp6.h>
1450 #if HAVE_NETINET6_IN6_VAR_H
1451 # include <netinet6/in6_var.h>
1453 #if HAVE_NETINET6_ND6_H
1454 # include <netinet6/nd6.h>
1458 dnl --------------------
1459 dnl Daemon disable check
1460 dnl --------------------
1462 AS_IF([test "${enable_ldpd}" != "no"], [
1463 AC_DEFINE([HAVE_LDPD], [1], [ldpd])
1466 if test "$enable_bfdd" = "no"; then
1467 AC_DEFINE([HAVE_BFDD], [0], [bfdd])
1470 AC_DEFINE([HAVE_BFDD], [1], [bfdd])
1475 AC_DEFINE([BFD_LINUX], [1], [bfdd])
1479 AC_DEFINE([BFD_BSD], [1], [bfdd])
1484 if test "$ac_cv_lib_json_c_json_object_get" = no -a "x$BFDD" = "xbfdd"; then
1485 AC_MSG_ERROR(["you must use json-c library to use bfdd"])
1491 if test "${enable_nhrpd}" != "no"; then
1496 if test "${enable_nhrpd}" = "yes"; then
1497 AC_MSG_ERROR([nhrpd requires kernel APIs that are only present on Linux.])
1502 if test "${enable_watchfrr}" = "no";then
1509 if test "${enable_ospfapi}" != "no";then
1510 AC_DEFINE([SUPPORT_OSPF_API], [1], [OSPFAPI])
1512 if test "${enable_ospfclient}" != "no";then
1513 OSPFCLIENT="ospfclient"
1517 if test "${enable_bgp_announce}" = "no";then
1518 AC_DEFINE([DISABLE_BGP_ANNOUNCE], [1], [Disable BGP installation to zebra])
1520 AC_DEFINE([DISABLE_BGP_ANNOUNCE], [0], [Disable BGP installation to zebra])
1523 if test "${enable_bgp_vnc}" != "no";then
1524 AC_DEFINE([ENABLE_BGP_VNC], [1], [Enable BGP VNC support])
1527 dnl ##########################################################################
1529 if test "${enable_clippy_only}" != "yes"; then
1530 dnl ##########################################################################
1532 dnl ------------------
1533 dnl check C-Ares library
1534 dnl ------------------
1535 if test "${NHRPD}" != ""; then
1536 PKG_CHECK_MODULES([CARES], [libcares], ,[
1537 AC_MSG_ERROR([trying to build nhrpd, but libcares not found. install c-ares and its -dev headers.])
1542 dnl ------------------
1543 dnl check Net-SNMP library
1544 dnl ------------------
1545 if test "${enable_snmp}" != "" -a "${enable_snmp}" != "no"; then
1546 AC_PATH_TOOL([NETSNMP_CONFIG], [net-snmp-config], [no])
1547 if test x"$NETSNMP_CONFIG" = x"no"; then
1548 AC_MSG_ERROR([--enable-snmp given but unable to find net-snmp-config])
1550 SNMP_LIBS="`${NETSNMP_CONFIG} --agent-libs`"
1551 SNMP_CFLAGS="`${NETSNMP_CONFIG} --base-cflags`"
1552 # net-snmp lists all of its own dependencies. we absolutely do not want that
1553 # among other things we avoid a GPL vs. OpenSSL license conflict here
1554 for removelib in crypto ssl sensors pci wrap; do
1555 SNMP_LIBS="`echo $SNMP_LIBS | sed -e 's/\(^\|\s\)-l'$removelib'\b/ /g' -e 's/\(^\|\s\)\([^\s]*\/\)\?lib'$removelib'\.[^\s]\+\b/ /g'`"
1557 AC_MSG_CHECKING([whether we can link to Net-SNMP])
1558 AC_LINK_IFELSE_FLAGS([$SNMP_CFLAGS], [$SNMP_LIBS], [AC_LANG_PROGRAM([
1567 AC_MSG_ERROR([--enable-snmp given but not usable])])
1568 case "${enable_snmp}" in
1573 SNMP_METHOD="${enable_snmp}"
1576 AC_MSG_ERROR([--enable-snmp given with an unknown method (${enable_snmp}). Use yes or agentx])
1579 AH_TEMPLATE([SNMP_AGENTX], [Use SNMP AgentX to interface with snmpd])
1580 AC_DEFINE_UNQUOTED(AS_TR_CPP(SNMP_${SNMP_METHOD}),,[SNMP method to interface with snmpd])
1582 AC_SUBST([SNMP_LIBS])
1583 AC_SUBST([SNMP_CFLAGS])
1588 PKG_CHECK_MODULES([LIBYANG], [libyang >= 0.16.7], , [
1589 AC_MSG_ERROR([libyang (>= 0.16.7) was not found on your system.])
1591 ac_cflags_save="$CFLAGS"
1592 CFLAGS="$CFLAGS $LIBYANG_CFLAGS"
1593 AC_CHECK_MEMBER([struct lyd_node.priv], [], [
1594 AC_MSG_ERROR([m4_normalize([
1595 libyang needs to be compiled with ENABLE_LYD_PRIV=ON.
1596 Instructions for this are included in the build documentation for your platform at http://docs.frrouting.org/projects/dev-guide/en/latest/building.html])
1598 ], [[#include <libyang/libyang.h>]])
1599 CFLAGS="$ac_cflags_save"
1602 dnl configuration rollbacks
1605 if test "$enable_config_rollbacks" = "yes"; then
1606 PKG_CHECK_MODULES([SQLITE3], [sqlite3], [
1607 AC_DEFINE([HAVE_CONFIG_ROLLBACKS], [1], [Enable configuration rollbacks])
1608 AC_DEFINE([HAVE_SQLITE3], [1], [Enable sqlite3 database])
1611 AC_MSG_ERROR([--enable-config-rollbacks given but sqlite3 was not found on your system.])
1618 if test "$enable_confd" != "" -a "$enable_confd" != "no"; then
1619 AC_CHECK_PROG([CONFD], [confd], [confd], [/bin/false], "${enable_confd}/bin")
1620 if test "x$CONFD" = "x/bin/false"; then
1621 AC_MSG_ERROR([confd was not found on your system.])]
1623 CONFD_CFLAGS="-I${enable_confd}/include -L${enable_confd}/lib"
1624 AC_SUBST([CONFD_CFLAGS])
1625 CONFD_LIBS="-lconfd"
1626 AC_SUBST([CONFD_LIBS])
1627 AC_DEFINE([HAVE_CONFD], [1], [Enable confd integration])
1633 if test "$enable_sysrepo" = "yes"; then
1634 PKG_CHECK_MODULES([SYSREPO], [libsysrepo],
1635 [AC_DEFINE([HAVE_SYSREPO], [1], [Enable sysrepo integration])
1638 AC_MSG_ERROR([sysrepo was not found on your system.])]
1645 if test "$enable_grpc" = "yes"; then
1646 PKG_CHECK_MODULES([GRPC], [grpc grpc++ protobuf], [
1647 AC_CHECK_PROGS([PROTOC], [protoc], [/bin/false])
1648 if test "$PROTOC" = "/bin/false"; then
1649 AC_MSG_FAILURE([grpc requested but protoc not found.])
1652 AC_DEFINE([HAVE_GRPC], [1], [Enable the gRPC northbound plugin])
1656 AC_MSG_ERROR([grpc/grpc++ were not found on your system.])
1663 if test "x$enable_zeromq" != "xno"; then
1664 PKG_CHECK_MODULES([ZEROMQ], [libzmq >= 4.0.0], [
1665 AC_DEFINE([HAVE_ZEROMQ], [1], [Enable ZeroMQ support])
1668 if test "x$enable_zeromq" = "xyes"; then
1669 AC_MSG_ERROR([configuration specifies --enable-zeromq but libzmq was not found])
1674 dnl ------------------------------------
1675 dnl Enable RPKI and add librtr to libs
1676 dnl ------------------------------------
1677 if test "${enable_rpki}" = "yes"; then
1678 PKG_CHECK_MODULES([RTRLIB], [rtrlib >= 0.5.0],
1681 AC_MSG_ERROR([rtrlib was not found on your system or is too old.])]
1685 dnl ------------------------------------------
1686 dnl Check whether rtrlib was build with ssh support
1687 dnl ------------------------------------------
1688 AC_MSG_CHECKING([whether the RTR Library is compiled with SSH])
1689 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "rtrlib/rtrlib.h"]],
1690 [[struct tr_ssh_config config;]])],
1691 [AC_MSG_RESULT([yes])
1692 AC_DEFINE([FOUND_SSH], [1], [found_ssh])],
1699 AC_SEARCH_LIBS([dlopen], [dl dld], [], [
1700 AC_MSG_ERROR([unable to find the dlopen()])
1703 AC_CHECK_HEADERS([link.h])
1705 AC_CACHE_CHECK([for dlinfo(RTLD_DI_ORIGIN)], [frr_cv_rtld_di_origin], [
1706 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1714 dlinfo (NULL, RTLD_DI_ORIGIN, &origin);
1716 frr_cv_rtld_di_origin=yes
1718 frr_cv_rtld_di_origin=no
1721 if test "$frr_cv_rtld_di_origin" = yes; then
1722 AC_DEFINE([HAVE_DLINFO_ORIGIN], [1], [Have dlinfo RTLD_DI_ORIGIN])
1725 AC_CACHE_CHECK([for dlinfo(RTLD_DI_LINKMAP)], [frr_cv_rtld_di_linkmap], [
1726 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1733 struct link_map *lm = NULL;
1734 dlinfo (NULL, RTLD_DI_LINKMAP, &lm);
1736 frr_cv_rtld_di_linkmap=yes
1738 frr_cv_rtld_di_linkmap=no
1741 if test "$frr_cv_rtld_di_linkmap" = yes; then
1742 AC_DEFINE([HAVE_DLINFO_LINKMAP], [1], [Have dlinfo RTLD_DI_LINKMAP])
1745 dnl ##########################################################################
1746 dnl test "${enable_clippy_only}" != "yes"
1748 dnl END OF LARGE if block
1749 dnl ##########################################################################
1751 dnl ---------------------------
1752 dnl sockaddr and netinet checks
1753 dnl ---------------------------
1756 struct vifctl, struct mfcctl, struct sioc_sg_req,
1757 vifi_t, struct sioc_vif_req, struct igmpmsg,
1758 struct ifaliasreq, struct if6_aliasreq, struct in6_aliasreq,
1759 struct nd_opt_adv_interval,
1760 struct nd_opt_homeagent_info, struct nd_opt_adv_interval,
1761 struct nd_opt_rdnss, struct nd_opt_dnssl],
1762 [], [], FRR_INCLUDES)
1764 AC_CHECK_MEMBERS([struct sockaddr.sa_len,
1765 struct sockaddr_in.sin_len, struct sockaddr_un.sun_len,
1766 struct sockaddr_dl.sdl_len,
1767 struct if6_aliasreq.ifra_lifetime,
1768 struct nd_opt_adv_interval.nd_opt_ai_type],
1769 [], [], FRR_INCLUDES)
1771 dnl ---------------------------
1772 dnl IRDP/pktinfo/icmphdr checks
1773 dnl ---------------------------
1775 AC_CHECK_TYPES([struct in_pktinfo], [
1776 AC_CHECK_TYPES([struct icmphdr], [
1785 case "${enable_irdp}" in
1787 $IRDP || AC_MSG_ERROR(['IRDP requires in_pktinfo at the moment!'])
1795 dnl -----------------------
1796 dnl checking for IP_PKTINFO
1797 dnl -----------------------
1798 AC_MSG_CHECKING([for IP_PKTINFO])
1799 AC_TRY_COMPILE([#include <netdb.h>], [
1800 int opt = IP_PKTINFO;
1802 AC_MSG_RESULT([yes])
1803 AC_DEFINE([HAVE_IP_PKTINFO], [1], [Have IP_PKTINFO])
1808 dnl ---------------------------
1809 dnl checking for IP_RECVDSTADDR
1810 dnl ---------------------------
1811 AC_MSG_CHECKING([for IP_RECVDSTADDR])
1812 AC_TRY_COMPILE([#include <netinet/in.h>], [
1813 int opt = IP_RECVDSTADDR;
1815 AC_MSG_RESULT([yes])
1816 AC_DEFINE([HAVE_IP_RECVDSTADDR], [1], [Have IP_RECVDSTADDR])
1821 dnl ----------------------
1822 dnl checking for IP_RECVIF
1823 dnl ----------------------
1824 AC_MSG_CHECKING([for IP_RECVIF])
1825 AC_TRY_COMPILE([#include <netinet/in.h>], [
1826 int opt = IP_RECVIF;
1828 AC_MSG_RESULT([yes])
1829 AC_DEFINE([HAVE_IP_RECVIF], [1], [Have IP_RECVIF])
1834 dnl ----------------------
1835 dnl checking for SO_BINDANY
1836 dnl ----------------------
1837 AC_MSG_CHECKING([for SO_BINDANY])
1838 AC_TRY_COMPILE([#include <sys/socket.h>], [
1839 int opt = SO_BINDANY;
1841 AC_MSG_RESULT([yes])
1842 AC_DEFINE([HAVE_SO_BINDANY], [1], [Have SO_BINDANY])
1847 dnl ----------------------
1848 dnl checking for IP_FREEBIND
1849 dnl ----------------------
1850 AC_MSG_CHECKING([for IP_FREEBIND])
1851 AC_TRY_COMPILE([#include <netinet/in.h>], [
1852 int opt = IP_FREEBIND;
1854 AC_MSG_RESULT([yes])
1855 AC_DEFINE([HAVE_IP_FREEBIND], [1], [Have IP_FREEBIND])
1860 dnl --------------------------------------
1861 dnl checking for be32dec existence or not
1862 dnl --------------------------------------
1863 AC_CHECK_DECLS([be32enc, be32dec], [], [],
1864 [#include <sys/endian.h>])
1866 dnl --------------------------------------
1867 dnl checking for clock_time monotonic struct and call
1868 dnl --------------------------------------
1869 AC_CHECK_DECL([CLOCK_MONOTONIC],
1870 [AC_CHECK_LIB([rt], [clock_gettime], [LIBS="$LIBS -lrt"])
1871 AC_DEFINE([HAVE_CLOCK_MONOTONIC], [1], [Have monotonic clock])
1872 ], [AC_MSG_RESULT([no])], [FRR_INCLUDES])
1874 dnl --------------------------------------
1875 dnl checking for flex and bison
1876 dnl --------------------------------------
1879 AC_MSG_CHECKING([version of flex])
1880 frr_ac_flex_version="$(eval $LEX -V | grep flex | head -n 1)"
1881 frr_ac_flex_version="${frr_ac_flex_version##* }"
1882 AC_MSG_RESULT([$frr_ac_flex_version])
1883 AX_COMPARE_VERSION([$frr_ac_flex_version], [lt], [2.5.20], [
1884 LEX="$SHELL $missing_dir/missing flex"
1885 if test -f "${srcdir}/lib/command_lex.c" -a -f "${srcdir}/lib/command_lex.h"; then
1886 AC_MSG_WARN([using pregenerated flex output files])
1888 AC_MSG_ERROR([flex failure and pregenerated files not included (probably a git build)])
1890 AC_SUBST([LEX_OUTPUT_ROOT], [lex.yy])
1891 AC_SUBST([LEXLIB], [''])
1895 dnl thanks GNU bison for this b*llshit...
1896 AC_MSG_CHECKING([version of bison])
1897 frr_ac_bison_version="$(eval $YACC -V | grep bison | head -n 1)"
1898 frr_ac_bison_version="${frr_ac_bison_version##* }"
1899 frr_ac_bison_missing="false"
1900 case "x${frr_ac_bison_version}x" in
1903 BISON_CLOSEBRACE='"'
1905 AC_MSG_RESULT([$frr_ac_bison_version - 2.7 or older])
1908 AC_MSG_RESULT([$frr_ac_bison_version])
1909 AC_MSG_WARN([installed bison is too old. Please install GNU bison 2.7.x or newer.])
1910 frr_ac_bison_missing="true"
1913 AC_MSG_RESULT([none])
1914 AC_MSG_WARN([could not determine bison version. Please install GNU bison 2.7.x or newer.])
1915 frr_ac_bison_missing="true"
1919 BISON_CLOSEBRACE='}'
1920 BISON_VERBOSE='-Dparse.error=verbose'
1921 AC_MSG_RESULT([$frr_ac_bison_version - 3.0 to 3.2])
1925 BISON_CLOSEBRACE='}'
1926 BISON_VERBOSE='-Dparse.error=verbose -Wno-yacc'
1927 AC_MSG_RESULT([$frr_ac_bison_version - 3.3 or newer])
1930 AC_SUBST([BISON_OPENBRACE])
1931 AC_SUBST([BISON_CLOSEBRACE])
1932 AC_SUBST([BISON_VERBOSE])
1934 if $frr_ac_bison_missing; then
1935 YACC="$SHELL $missing_dir/missing bison -y"
1936 if test -f "${srcdir}/lib/command_parse.c" -a -f "${srcdir}/lib/command_parse.h"; then
1937 AC_MSG_WARN([using pregenerated bison output files])
1939 AC_MSG_ERROR([bison failure and pregenerated files not included (probably a git build)])
1943 dnl -------------------
1944 dnl capabilities checks
1945 dnl -------------------
1946 if test "${enable_capabilities}" != "no"; then
1947 AC_MSG_CHECKING([whether prctl PR_SET_KEEPCAPS is available])
1948 AC_TRY_COMPILE([#include <sys/prctl.h>], [prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0);],
1949 [AC_MSG_RESULT([yes])
1950 AC_DEFINE([HAVE_PR_SET_KEEPCAPS], [1], [prctl])
1951 frr_ac_keepcaps="yes"],
1954 if test x"${frr_ac_keepcaps}" = x"yes"; then
1955 AC_CHECK_HEADERS([sys/capability.h])
1957 if test x"${ac_cv_header_sys_capability_h}" = x"yes"; then
1958 AC_CHECK_LIB([cap], [cap_init],
1959 [AC_DEFINE([HAVE_LCAPS], [1], [Capabilities])
1964 AC_CHECK_HEADERS([priv.h],
1965 [AC_MSG_CHECKING([Solaris style privileges are available])
1966 AC_TRY_COMPILE([#include <priv.h>], [getpflags(PRIV_AWARE);],
1967 [AC_MSG_RESULT([yes])
1968 AC_DEFINE([HAVE_SOLARIS_CAPABILITIES], [1], [getpflags])
1969 frr_ac_scaps="yes"],
1975 if test x"${frr_ac_scaps}" = x"yes" \
1976 -o x"${frr_ac_lcaps}" = x"yes"; then
1977 AC_DEFINE([HAVE_CAPABILITIES], [1], [capabilities])
1982 dnl ---------------------------
1983 dnl check for glibc 'backtrace'
1984 dnl ---------------------------
1985 if test x"${enable_backtrace}" != x"no" ; then
1987 PKG_CHECK_MODULES([UNWIND], [libunwind], [
1988 AC_DEFINE([HAVE_LIBUNWIND], [1], [libunwind])
1993 AC_CHECK_FUNCS([printstack], [
1994 AC_DEFINE([HAVE_PRINTSTACK], [1], [Solaris printstack])
1999 if test "$backtrace_ok" = no; then
2000 AC_CHECK_HEADER([execinfo.h], [
2001 AC_SEARCH_LIBS([backtrace], [execinfo], [
2002 AC_DEFINE([HAVE_GLIBC_BACKTRACE], [1], [Glibc backtrace])
2009 if test x"${enable_backtrace}" = x"yes" -a x"${backtrace_ok}" = x"no"; then
2010 dnl user explicitly requested backtrace but we failed to find support
2011 AC_MSG_FAILURE([failed to find backtrace or libunwind support])
2015 dnl -----------------------------------------
2016 dnl check for malloc mallinfo struct and call
2017 dnl this must try and link using LIBS, in
2018 dnl order to check no alternative allocator
2019 dnl has been specified, which might not provide
2020 dnl mallinfo, e.g. such as Umem on Solaris.
2021 dnl -----------------------------------------
2022 AC_CHECK_HEADERS([malloc.h malloc_np.h malloc/malloc.h],,, [FRR_INCLUDES])
2024 AC_CACHE_CHECK([whether mallinfo is available], [frr_cv_mallinfo], [
2025 AC_LINK_IFELSE([AC_LANG_PROGRAM([FRR_INCLUDES [
2026 #ifdef HAVE_MALLOC_H
2029 #ifdef HAVE_MALLOC_NP_H
2030 #include <malloc_np.h>
2032 #ifdef HAVE_MALLOC_MALLOC_H
2033 #include <malloc/malloc.h>
2036 struct mallinfo ac_x; ac_x = mallinfo ();
2043 if test "$frr_cv_mallinfo" = yes; then
2044 AC_DEFINE([HAVE_MALLINFO], [1], [mallinfo])
2047 AC_MSG_CHECKING([whether malloc_usable_size is available])
2048 AC_LINK_IFELSE([AC_LANG_PROGRAM([FRR_INCLUDES [
2049 #ifdef HAVE_MALLOC_H
2052 #ifdef HAVE_MALLOC_MALLOC_H
2053 #include <malloc/malloc.h>
2056 size_t ac_x; ac_x = malloc_usable_size(NULL);
2058 AC_MSG_RESULT([yes])
2059 AC_DEFINE([HAVE_MALLOC_USABLE_SIZE], [1], [malloc_usable_size])
2063 AC_MSG_CHECKING([whether malloc_size is available])
2064 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2065 #ifdef HAVE_MALLOC_H
2068 #ifdef HAVE_MALLOC_MALLOC_H
2069 #include <malloc/malloc.h>
2072 size_t ac_x; ac_x = malloc_size(NULL);
2074 AC_MSG_RESULT([yes])
2075 AC_DEFINE([HAVE_MALLOC_SIZE], [1], [malloc_size])
2084 dev_version=`echo $VERSION | grep dev`
2085 #don't expire deprecated code in non 'dev' branch
2086 if test "${dev_version}" = ""; then
2089 CONFDATE=`date '+%Y%m%d'`
2091 AC_SUBST([CONFDATE])
2093 dnl ------------------------------
2094 dnl set paths for state directory
2095 dnl ------------------------------
2096 AC_MSG_CHECKING([directory to use for state file])
2097 if test "${prefix}" = "NONE"; then
2098 frr_statedir_prefix="";
2100 frr_statedir_prefix=${prefix}
2102 if test "${localstatedir}" = '${prefix}/var'; then
2103 for FRR_STATE_DIR in ${frr_statedir_prefix}/var/run dnl
2104 ${frr_statedir_prefix}/var/adm dnl
2105 ${frr_statedir_prefix}/etc dnl
2111 test -d $FRR_STATE_DIR && break
2113 frr_statedir=$FRR_STATE_DIR
2115 frr_statedir=${localstatedir}
2117 if test $frr_statedir = "/dev/null"; then
2118 AC_MSG_ERROR([STATE DIRECTORY NOT FOUND! FIX OR SPECIFY --localstatedir!])
2120 AC_MSG_RESULT([${frr_statedir}])
2121 AC_SUBST([frr_statedir])
2123 AC_DEFINE_UNQUOTED([LDPD_SOCKET], ["$frr_statedir%s%s/ldpd.sock"], [ldpd control socket])
2124 AC_DEFINE_UNQUOTED([ZEBRA_SERV_PATH], ["$frr_statedir%s%s/zserv.api"], [zebra api socket])
2125 AC_DEFINE_UNQUOTED([BFDD_CONTROL_SOCKET], ["$frr_statedir%s%s/bfdd.sock"], [bfdd control socket])
2126 AC_DEFINE_UNQUOTED([DAEMON_VTY_DIR], ["$frr_statedir%s%s"], [daemon vty directory])
2127 AC_DEFINE_UNQUOTED([DAEMON_DB_DIR], ["$frr_statedir"], [daemon database directory])
2129 dnl autoconf does this, but it does it too late...
2130 test "x$prefix" = xNONE && prefix=$ac_default_prefix
2131 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
2133 dnl get the full path, recursing through variables...
2134 vtysh_bin="$bindir/vtysh"
2135 for I in 1 2 3 4 5 6 7 8 9 10; do
2136 eval vtysh_bin="\"$vtysh_bin\""
2138 AC_DEFINE_UNQUOTED([VTYSH_BIN_PATH], ["$vtysh_bin"], [path to vtysh binary])
2139 AC_SUBST([vtysh_bin])
2141 CFG_SYSCONF="$sysconfdir"
2143 CFG_STATE="$frr_statedir"
2144 CFG_MODULE="$moduledir"
2145 CFG_YANGMODELS="$yangmodelsdir"
2146 CFG_LIBYANG_PLUGINS="$libyang_pluginsdir"
2147 for I in 1 2 3 4 5 6 7 8 9 10; do
2148 eval CFG_SYSCONF="\"$CFG_SYSCONF\""
2149 eval CFG_SBIN="\"$CFG_SBIN\""
2150 eval CFG_STATE="\"$CFG_STATE\""
2151 eval CFG_MODULE="\"$CFG_MODULE\""
2152 eval CFG_YANGMODELS="\"$CFG_YANGMODELS\""
2153 eval CFG_LIBYANG_PLUGINS="\"$CFG_LIBYANG_PLUGINS\""
2155 AC_SUBST([CFG_SYSCONF])
2156 AC_SUBST([CFG_SBIN])
2157 AC_SUBST([CFG_STATE])
2158 AC_SUBST([CFG_MODULE])
2159 AC_SUBST([CFG_YANGMODELS])
2160 AC_SUBST([CFG_LIBYANG_PLUGINS])
2161 AC_DEFINE_UNQUOTED([MODULE_PATH], ["$CFG_MODULE"], [path to modules])
2162 AC_DEFINE_UNQUOTED([YANG_MODELS_PATH], ["$CFG_YANGMODELS"], [path to YANG data models])
2163 AC_DEFINE_UNQUOTED([LIBYANG_PLUGINS_PATH], ["$CFG_LIBYANG_PLUGINS"], [path to libyang plugins])
2164 AC_DEFINE_UNQUOTED([WATCHFRR_SH_PATH], ["${CFG_SBIN%/}/watchfrr.sh"], [path to watchfrr.sh])
2166 dnl various features
2167 AM_CONDITIONAL([SUPPORT_REALMS], [test "${enable_realms}" = "yes"])
2168 AM_CONDITIONAL([ENABLE_BGP_VNC], [test x${enable_bgp_vnc} != xno])
2170 AM_CONDITIONAL([SQLITE3], [$SQLITE3])
2171 AM_CONDITIONAL([CONFD], [test "x$enable_confd" != "x"])
2172 AM_CONDITIONAL([SYSREPO], [test "x$enable_sysrepo" = "xyes"])
2173 AM_CONDITIONAL([GRPC], [test "x$enable_grpc" = "xyes"])
2174 AM_CONDITIONAL([ZEROMQ], [test "x$ZEROMQ" = "xtrue"])
2176 AM_CONDITIONAL([RPKI], [test "x$RPKI" = "xtrue"])
2177 AM_CONDITIONAL([SNMP], [test "x$SNMP_METHOD" = "xagentx"])
2178 AM_CONDITIONAL([IRDP], [$IRDP])
2179 AM_CONDITIONAL([FPM], [test "x$enable_fpm" = "xyes"])
2180 AM_CONDITIONAL([HAVE_PROTOBUF], [test "x$enable_protobuf" = "xyes"])
2182 AM_CONDITIONAL([VTYSH], [test "x$VTYSH" = "xvtysh"])
2183 AM_CONDITIONAL([ZEBRA], [test "${enable_zebra}" != "no"])
2184 AM_CONDITIONAL([BGPD], [test "x${enable_bgpd}" != "no"])
2185 AM_CONDITIONAL([RIPD], [test "${enable_ripd}" != "no"])
2186 AM_CONDITIONAL([OSPFD], [test "${enable_ospfd}" != "no"])
2187 AM_CONDITIONAL([LDPD], [test "${enable_ldpd}" != "no"])
2188 AM_CONDITIONAL([BFDD], [test "x$BFDD" = "xbfdd"])
2189 AM_CONDITIONAL([NHRPD], [test "x$NHRPD" = "xnhrpd"])
2190 AM_CONDITIONAL([EIGRPD], [test "${enable_eigrpd}" != "no"])
2191 AM_CONDITIONAL([WATCHFRR], [test "x$WATCHFRR" = "xwatchfrr"])
2192 AM_CONDITIONAL([OSPFCLIENT], [test "x$OSPFCLIENT" = "xospfclient"])
2193 AM_CONDITIONAL([RIPNGD], [test "${enable_ripngd}" != "no"])
2194 AM_CONDITIONAL([BABELD], [test "${enable_babeld}" != "no"])
2195 AM_CONDITIONAL([OSPF6D], [test "${enable_ospf6d}" != "no"])
2196 AM_CONDITIONAL([ISISD], [test "${enable_isisd}" != "no"])
2197 AM_CONDITIONAL([PIMD], [test "${enable_pimd}" != "no"])
2198 AM_CONDITIONAL([PBRD], [test "${enable_pbrd}" != "no"])
2199 AM_CONDITIONAL([SHARPD], [test "${enable_sharpd}" = "yes"])
2200 AM_CONDITIONAL([STATICD], [test "${enable_staticd}" != "no"])
2201 AM_CONDITIONAL([FABRICD], [test "${enable_fabricd}" != "no"])
2202 AM_CONDITIONAL([VRRPD], [test "${enable_vrrpd}" != "no"])
2204 AC_CONFIG_FILES([Makefile],[sed -e 's/^#AUTODERP# //' -i Makefile])
2212 snapcraft/snapcraft.yaml
2214 tests/lib/cli/test_cli.refout
2215 pkgsrc/bgpd.sh pkgsrc/ospf6d.sh pkgsrc/ospfd.sh
2216 pkgsrc/ripd.sh pkgsrc/ripngd.sh pkgsrc/zebra.sh
2219 AC_CONFIG_FILES([vtysh/extract.pl], [chmod +x vtysh/extract.pl])
2220 AC_CONFIG_FILES([tools/frr], [chmod +x tools/frr])
2221 AC_CONFIG_FILES([tools/watchfrr.sh], [chmod +x tools/watchfrr.sh])
2222 AC_CONFIG_FILES([tools/frrinit.sh], [chmod +x tools/frrinit.sh])
2223 AC_CONFIG_FILES([tools/frrcommon.sh])
2225 AC_CONFIG_COMMANDS([lib/route_types.h], [
2226 dst="${ac_abs_top_builddir}/lib/route_types.h"
2227 ${PERL} "${ac_abs_top_srcdir}/lib/route_types.pl" \
2228 < "${ac_abs_top_srcdir}/lib/route_types.txt" \
2231 && diff "${dst}.tmp" "${dst}" >/dev/null 2>/dev/null \
2232 && rm "${dst}.tmp" \
2233 || mv "${dst}.tmp" "${dst}"
2238 AS_IF([test "x$with_pkg_git_version" = "xyes"], [
2239 AC_CONFIG_COMMANDS([lib/gitversion.h], [
2240 dst="${ac_abs_top_builddir}/lib/gitversion.h"
2241 ${PERL} "${ac_abs_top_srcdir}/lib/gitversion.pl" \
2242 "${ac_abs_top_srcdir}" \
2245 && diff "${dst}.tmp" "${dst}" >/dev/null 2>/dev/null \
2246 && rm "${dst}.tmp" \
2247 || mv "${dst}.tmp" "${dst}"
2253 ## Hack, but working solution to avoid rebuilding of frr.info.
2254 ## It's already in CVS until texinfo 4.7 is more common.
2258 FRRouting configuration
2259 ------------------------------
2260 FRR version : ${PACKAGE_VERSION}
2261 host operating system : ${host_os}
2262 source code location : ${srcdir}
2264 compiler flags : ${CFLAGS} ${SAN_FLAGS}
2266 linker flags : ${LDFLAGS} ${SAN_FLAGS} ${LIBS} ${LIBCAP} ${LIBREADLINE} ${LIBM}
2267 state file directory : ${frr_statedir}
2268 config file directory : `eval echo \`echo ${sysconfdir}\``
2269 example directory : `eval echo \`echo ${exampledir}\``
2270 module directory : ${CFG_MODULE}
2271 user to run as : ${enable_user}
2272 group to run as : ${enable_group}
2273 group for vty sockets : ${enable_vty_group}
2274 config file mask : ${enable_configfile_mask}
2275 log file mask : ${enable_logfile_mask}
2276 zebra protobuf enabled : ${enable_protobuf:-no}
2278 The above user and group must have read/write access to the state file
2279 directory and to the config files in the config file directory."
2281 if test "${enable_doc}" != "no" -a "$frr_py_mod_sphinx" = false; then
2282 AC_MSG_WARN([sphinx is missing but required to build documentation])
2284 if test "$frr_py_mod_pytest" = false; then
2285 AC_MSG_WARN([pytest is missing, unit tests cannot be performed])