]> git.proxmox.com Git - mirror_frr.git/blob - configure.ac
build: improve clippy options
[mirror_frr.git] / configure.ac
1 ##
2 ## Configure template file for FRRouting.
3 ## autoconf will generate a configure script.
4 ##
5 ## Copyright (c) 1996, 97, 98, 99, 2000 Kunihiro Ishiguro <kunihiro@zebra.org>
6 ## Portions Copyright (c) 2003 Paul Jakma <paul@dishone.st>
7 ##
8 AC_PREREQ([2.60])
9
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])
15
16 CONFIG_ARGS="`echo $ac_configure_args | sed -e \"s% '[[A-Z]]*FLAGS=[[^']]\+'%%g\"`"
17 AC_SUBST([CONFIG_ARGS])
18
19 AC_CONFIG_SRCDIR([lib/zebra.h])
20 AC_CONFIG_MACRO_DIR([m4])
21
22 dnl -----------------------------------
23 dnl Get hostname and other information.
24 dnl -----------------------------------
25 AC_CANONICAL_BUILD()
26 AC_CANONICAL_HOST()
27
28 hosttools_clippy="false"
29 build_clippy="true"
30
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])
35 fi
36
37 CLIPPY="$with_clippy"
38 build_clippy="false"
39 if test ! -x "$with_clippy"; then
40 AC_MSG_ERROR([clippy tool ($with_clippy) is not executable])
41 fi
42
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.])
47 fi
48 test -d hosttools || mkdir hosttools
49 abssrc="`cd \"${srcdir}\"; pwd`"
50
51 AC_MSG_NOTICE([...])
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])
54 AC_MSG_NOTICE([...])
55
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
60
61 AC_MSG_NOTICE([...])
62 AC_MSG_NOTICE([... cross-compilation: finished self-configuring for build platform tools])
63 AC_MSG_NOTICE([...])
64
65 build_clippy="false"
66 hosttools_clippy="true"
67 CLIPPY="hosttools/lib/clippy"
68
69 dnl case 3: normal build internal clippy
70 else
71 CLIPPY="lib/clippy\$(EXEEXT)"
72 fi
73 AC_SUBST([CLIPPY])
74 AM_CONDITIONAL([BUILD_CLIPPY], [$build_clippy])
75 AM_CONDITIONAL([HOSTTOOLS_CLIPPY], [$hosttools_clippy])
76 AM_CONDITIONAL([ONLY_CLIPPY], [test "$enable_clippy_only" = "yes"])
77
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])
84
85 AC_PATH_PROG([PERL], [perl])
86 PKG_PROG_PKG_CONFIG
87
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])
96
97 dnl default is to match previous behavior
98 pkgsrcrcdir=""
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"])
106
107 AC_ARG_WITH([moduledir], [AS_HELP_STRING([--with-moduledir=DIR], [module directory (${libdir}/frr/modules)])], [
108 moduledir="$withval"
109 ], [
110 moduledir="\${libdir}/frr/modules"
111 ])
112 AC_SUBST([moduledir], [$moduledir])
113
114
115 AC_ARG_WITH([yangmodelsdir], [AS_HELP_STRING([--with-yangmodelsdir=DIR], [yang models directory (${datarootdir}/yang)])], [
116 yangmodelsdir="$withval"
117 ], [
118 yangmodelsdir="\${datarootdir}/yang"
119 ])
120 AC_SUBST([yangmodelsdir])
121
122 AC_ARG_WITH([libyang_pluginsdir], [AS_HELP_STRING([--with-libyang-pluginsdir=DIR], [yangmodule plugins directory (${libdir}/frr/libyang_plugins)])], [
123 libyang_pluginsdir="$withval"
124 ], [
125 libyang_pluginsdir="\${libdir}/frr/libyang_plugins"
126 ])
127 AC_SUBST([libyang_pluginsdir])
128
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"
134 ;;
135 no) tcmalloc_enabled=false ;;
136 *) AC_MSG_ERROR([bad value ${enableval} for --enable-tcmalloc]) ;;
137 esac],[tcmalloc_enabled=false])
138
139
140 dnl Thanks autoconf, but we don't want a default -g -O2. We have our own
141 dnl flag determination logic.
142 CFLAGS="${CFLAGS:-}"
143
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"
150 AC_LANG([C])
151 AC_PROG_CC
152 AC_PROG_CPP
153 AC_PROG_CXX
154 AM_PROG_CC_C_O
155 dnl remove autoconf default "-g -O2"
156 CFLAGS="$orig_cflags"
157 CXXFLAGS="$orig_cxxflags"
158 AC_PROG_CC_C99
159 dnl NB: see C11 below
160
161 PKG_PROG_PKG_CONFIG
162
163 dnl it's 2019, sed is sed.
164 SED=sed
165 AC_SUBST([SED])
166
167 dnl try and enable CFLAGS that are useful for FRR
168 dnl - specifically, options to control warnings
169
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, [
174 AC_LANG_PUSH([C])
175 ac_c_flag_save="$CFLAGS"
176 CFLAGS="$CFLAGS $1"
177 AC_COMPILE_IFELSE(
178 [AC_LANG_PROGRAM([[]])],
179 [
180 cachename=yes
181 ], [
182 cachename=no
183 ])
184 CFLAGS="$ac_c_flag_save"
185 AC_LANG_POP([C])
186 ])
187 if test "${cachename}" = yes; then
188 m4_if([$3], [], [CFLAGS="$CFLAGS $1"], [$3])
189 else
190 :
191 $2
192 fi
193 m4_popdef([cachename])
194 }])
195
196 AC_DEFUN([AC_LINK_IFELSE_FLAGS], [{
197 AC_LANG_PUSH([C])
198 ac_cflags_save="$CFLAGS"
199 ac_libs_save="$LIBS"
200 CFLAGS="$CFLAGS $1"
201 LIBS="$LIBS $2"
202 AC_LINK_IFELSE(
203 [$3],
204 [
205 CFLAGS="$ac_cflags_save"
206 LIBS="$ac_libs_save"
207 m4_default([$5], [
208 AC_MSG_RESULT([yes])
209 ])
210 ], [
211 CFLAGS="$ac_cflags_save"
212 LIBS="$ac_libs_save"
213 m4_default([$4], [
214 AC_MSG_RESULT([no])
215 ])
216 ])
217 AC_LANG_POP([C])
218 }])
219
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])
223
224 dnl AC_PROG_CC_C99 may change CC to include -std=gnu99 or something
225 ac_cc="$CC"
226 CC="${CC% -std=gnu99}"
227 CC="${CC% -std=c99}"
228
229 AC_C_FLAG([-std=gnu11], [CC="$ac_cc"], [CC="$CC -std=gnu11"])
230
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])
235 AC_C_FLAG([-O0])
236 fi
237
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
242 AC_C_FLAG([-g3])
243 AC_C_FLAG([-O0])
244 fi
245 if test "x${enable_lua}" = "xyes"; then
246 AX_PROG_LUA([5.3])
247 AX_LUA_HEADERS
248 AX_LUA_LIBS([
249 AC_DEFINE([HAVE_LUA], [1], [Have support for Lua interpreter])
250 LIBS="$LIBS $LUA_LIB"
251 ])
252 fi
253 else
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])
256 fi
257 if test "z$orig_cflags" = "z"; then
258 AC_C_FLAG([-g])
259 AC_C_FLAG([-Os], [
260 AC_C_FLAG([-O2])
261 ])
262 fi
263 fi
264 AM_CONDITIONAL([DEV_BUILD], [test "x$enable_dev_build" = "xyes"])
265
266 dnl always want these CFLAGS
267 AC_C_FLAG([-fno-omit-frame-pointer])
268 AC_C_FLAG([-funwind-tables])
269 AC_C_FLAG([-Wall])
270 AC_C_FLAG([-Wextra])
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])
285 else
286 AC_C_FLAG([-Wno-unused-result])
287 fi
288 AC_C_FLAG([-Wno-unused-parameter])
289 AC_C_FLAG([-Wno-missing-field-initializers])
290
291 AC_C_FLAG([-Wc++-compat], [], [CXX_COMPAT_CFLAGS="-Wc++-compat"])
292 AC_SUBST([CXX_COMPAT_CFLAGS])
293
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])
298
299 if test x"${enable_werror}" = x"yes" ; then
300 WERROR="-Werror"
301 fi
302 AC_SUBST([WERROR])
303
304 SAN_FLAGS=""
305 if test "$enable_address_sanitizer" = "yes"; then
306 AC_C_FLAG([-fsanitize=address], [
307 AC_MSG_ERROR([$CC does not support Address Sanitizer.])
308 ], [
309 SAN_FLAGS="$SAN_FLAGS -fsanitize=address"
310 ])
311 fi
312 if test "$enable_thread_sanitizer" = "yes"; then
313 AC_C_FLAG([-fsanitize=thread], [
314 AC_MSG_ERROR([$CC does not support Thread Sanitizer.])
315 ], [
316 SAN_FLAGS="$SAN_FLAGS -fsanitize=thread"
317 ])
318 fi
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.])
322 ], [
323 SAN_FLAGS="-fsanitize=memory -fPIE -pie"
324 ])
325 fi
326 AC_SUBST([SAN_FLAGS])
327
328 dnl ----------
329 dnl Essentials
330 dnl ----------
331
332 AX_PTHREAD([
333 CC="$PTHREAD_CC"
334 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
335 LIBS="$PTHREAD_LIBS $LIBS"
336 ], [
337 AC_MSG_FAILURE([This FRR version needs pthreads])
338 ])
339
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])
345 fi
346
347 dnl --------------
348 dnl Check programs
349 dnl --------------
350 AC_PROG_INSTALL
351 AC_PROG_LN_S
352 AC_CHECK_TOOL([AR], [ar])
353
354 dnl -------
355 dnl libtool
356 dnl -------
357 AC_ARG_ENABLE([static-bin],
358 AS_HELP_STRING([--enable-static-bin], [link binaries statically]))
359 LT_INIT
360 _LT_CONFIG_LIBTOOL([
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.])
363 ])
364 if test "$enable_static_bin" = "yes"; then
365 AC_LDFLAGS="-static"
366 if test "$enable_static" != "yes"; then
367 AC_MSG_ERROR([The --enable-static-bin option must be combined with --enable-static.])
368 fi
369 fi
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])
372 fi
373 AC_SUBST([AC_LDFLAGS])
374 AM_CONDITIONAL([STATIC_BIN], [test "x$enable_static_bin" = "xyes"])
375
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
379 AC_MSG_RESULT([yes])
380 dnl ARFLAGS is for automake, AR_FLAGS for libtool m-(
381 ARFLAGS="crD"
382 AR_FLAGS="crD"
383 else
384 AC_MSG_RESULT([no])
385 ARFLAGS="cru"
386 AR_FLAGS="cru"
387 fi
388 AC_SUBST([ARFLAGS])
389 AC_SUBST([AR_FLAGS])
390
391 AC_MSG_CHECKING([whether $RANLIB supports D option])
392 if $RANLIB -D conftest.a >/dev/null 2>/dev/null; then
393 AC_MSG_RESULT([yes])
394 RANLIB="$RANLIB -D"
395 else
396 AC_MSG_RESULT([no])
397 fi
398 AC_SUBST([RANLIB])
399
400 test -f conftest.a && rm conftest.a
401
402 dnl ----------------------
403 dnl Packages configuration
404 dnl ----------------------
405 if test -f config.version; then
406 . ./config.version
407 elif test -f "${srcdir}/config.version"; then
408 . "${srcdir}/config.version"
409 fi
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
413 EXTRAVERSION=
414 else
415 EXTRAVERSION=$withval
416 fi
417 ], [])
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]))
428 AC_ARG_ENABLE([doc],
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]))
523 AC_ARG_ENABLE([fpm],
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]))
559
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])
567 fi
568 fi
569 ])
570
571 AC_ARG_ENABLE([dev_build],
572 AS_HELP_STRING([--enable-dev-build], [build for development]))
573
574 AC_ARG_ENABLE([lua],
575 AS_HELP_STRING([--enable-lua], [Build Lua scripting]))
576
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])
580 else
581 AC_DEFINE_UNQUOTED([CONSUMED_TIME_CHECK], [$enable_time_check], [Consumed Time Check])
582 fi
583 fi
584
585 case "${enable_systemd}" in
586 "no") ;;
587 "yes")
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])
591 else
592 AC_DEFINE([HAVE_SYSTEMD], [1], [Compile systemd support in])
593 fi
594 ;;
595 "*") ;;
596 esac
597
598 if test "${enable_rr_semantics}" != "no" ; then
599 AC_DEFINE([HAVE_V6_RR_SEMANTICS], [1], [Compile in v6 Route Replacement Semantics])
600 fi
601
602 if test "${enable_datacenter}" = "yes" ; then
603 AC_DEFINE([HAVE_DATACENTER], [1], [Compile extensions for a DataCenter])
604 DFLT_NAME="datacenter"
605 else
606 DFLT_NAME="traditional"
607 fi
608
609 if test "${enable_fuzzing}" = "yes" ; then
610 AC_DEFINE([HANDLE_ZAPI_FUZZING], [1], [Compile extensions to use with a fuzzer])
611 fi
612
613 if test "${enable_netlink_fuzzing}" = "yes" ; then
614 AC_DEFINE([HANDLE_NETLINK_FUZZING], [1], [Compile extensions to use with a fuzzer for netlink])
615 fi
616
617 if test "${enable_cumulus}" = "yes" ; then
618 AC_DEFINE([HAVE_CUMULUS], [1], [Compile Special Cumulus Code in])
619 fi
620
621 AC_SUBST([DFLT_NAME])
622 AC_DEFINE_UNQUOTED([DFLT_NAME], ["$DFLT_NAME"], [Name of the configuration default set])
623
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])
626 fi
627
628 #
629 # Python for clippy
630 #
631
632 AS_IF([test "$host" = "$build"], [
633 FRR_PYTHON_DEV
634 ], [
635 FRR_PYTHON
636 ])
637
638 FRR_PYTHON_MODULES([pytest])
639
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.])
644 fi
645 ])
646 fi
647 AM_CONDITIONAL([DOC], [test "${enable_doc}" != "no" -a "$frr_py_mod_sphinx" != "false"])
648 AM_CONDITIONAL([DOC_HTML], [test "${enable_doc_html}" = "yes"])
649
650 FRR_PYTHON_MOD_EXEC([sphinx], [--version], [
651 PYSPHINX="-m sphinx"
652 ], [
653 PYSPHINX="-c 'import sys; from sphinx import main; sys.exit(main(sys.argv))'"
654 ])
655 AC_SUBST([PYSPHINX])
656
657 #
658 # Logic for old vpn commands support.
659 #
660 if test "$enable_oldvpn_commands" = "yes"; then
661 AC_DEFINE([KEEP_OLD_VPN_COMMANDS], [1], [Define for compiling with old vpn commands])
662 fi
663
664 #
665 # End of logic for protobuf support.
666 #
667
668 AC_MSG_CHECKING([if zebra should be configurable to send Route Advertisements])
669 if test "${enable_rtadv}" != "no"; then
670 AC_MSG_RESULT([yes])
671 AC_DEFINE([HAVE_RTADV], [1], [Enable IPv6 Routing Advertisement support])
672 else
673 AC_MSG_RESULT([no])
674 fi
675
676 if test x"${enable_user}" = x"no"; then
677 enable_user=""
678 else
679 if test x"${enable_user}" = x"yes" || test x"${enable_user}" = x""; then
680 enable_user="frr"
681 fi
682 AC_DEFINE_UNQUOTED([FRR_USER], ["${enable_user}"], [frr User])
683 fi
684
685 if test x"${enable_group}" = x"no"; then
686 enable_group=""
687 else
688 if test x"${enable_group}" = x"yes" || test x"${enable_group}" = x""; then
689 enable_group="frr"
690 fi
691 AC_DEFINE_UNQUOTED([FRR_GROUP], ["${enable_group}"], [frr Group])
692 fi
693
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])
699 fi
700 fi
701 AC_SUBST([enable_user])
702 AC_SUBST([enable_group])
703 AC_SUBST([enable_vty_group])
704
705 enable_configfile_mask=${enable_configfile_mask:-0600}
706 AC_DEFINE_UNQUOTED([CONFIGFILE_MASK], [${enable_configfile_mask}], [Mask for config files])
707
708 enable_logfile_mask=${enable_logfile_mask:-0600}
709 AC_DEFINE_UNQUOTED([LOGFILE_MASK], [${enable_logfile_mask}], [Mask for log files])
710
711 MPATH_NUM=16
712
713 case "${enable_multipath}" in
714 0)
715 MPATH_NUM=64
716 ;;
717 [[1-9]|[1-9][0-9]|[1-9][0-9][0-9]])
718 MPATH_NUM="${enable_multipath}"
719 ;;
720 "")
721 ;;
722 *)
723 AC_MSG_FAILURE([Please specify digit to enable multipath ARG])
724 ;;
725 esac
726
727 AC_DEFINE_UNQUOTED([MULTIPATH_NUM], [$MPATH_NUM], [Maximum number of paths for a route])
728
729 AC_DEFINE_UNQUOTED([VTYSH_PAGER], ["$VTYSH_PAGER"], [What pager to use])
730
731 dnl --------------------
732 dnl Enable code coverage
733 dnl --------------------
734 AM_CONDITIONAL([HAVE_GCOV], [test '!' "$enable_gcov" = no])
735
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]]'`"
742 fi
743
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}"
753 fi
754 AC_SUBST([EXTRAVERSION])
755
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])
761 fi
762 fi
763 AM_CONDITIONAL([GIT_VERSION], [test "x$with_pkg_git_version" = "xyes"])
764
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], [
768 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`"
772 fi
773 test -f conftest.interp && rm conftest.interp
774 ])
775 ])
776 fi
777 if test -n "$frr_cv_interp"; then
778 AC_DEFINE_UNQUOTED([INTERP], ["$frr_cv_interp"], [.interp value])
779 fi
780
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])
786
787 ac_stdatomic_ok=false
788 AC_DEFINE([FRR_AUTOCONF_ATOMIC], [1], [did autoconf checks for atomic funcs])
789 AC_CHECK_HEADER([stdatomic.h],[
790
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) {
795 _Atomic int i = 0;
796 return i;
797 }
798 ]])], [
799 AC_DEFINE([HAVE_STDATOMIC_H], [1], [found stdatomic.h])
800 AC_MSG_RESULT([yes])
801 ac_stdatomic_ok=true
802 ], [
803 AC_MSG_RESULT([no])
804 ])
805 ])
806
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) {
811 volatile int i = 1;
812 __atomic_store_n (&i, 0, __ATOMIC_RELEASE);
813 return __atomic_load_n (&i, __ATOMIC_ACQUIRE);
814 }
815 ]])], [
816 AC_DEFINE([HAVE___ATOMIC], [1], [found __atomic builtins])
817 AC_MSG_RESULT([yes])
818 ], [
819 AC_MSG_RESULT([no])
820
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) {
825 volatile int i = 1;
826 __sync_fetch_and_sub (&i, 1);
827 return __sync_val_compare_and_swap (&i, 0, 1);
828 }
829 ]])], [
830 AC_DEFINE([HAVE___SYNC], [1], [found __sync builtins])
831 AC_MSG_RESULT([yes])
832
833 AC_MSG_CHECKING([for __sync_swap builtin])
834 AC_LINK_IFELSE([AC_LANG_SOURCE([[
835 int main(int argc, char **argv) {
836 volatile int i = 1;
837 return __sync_swap (&i, 2);
838 }
839 ]])], [
840 AC_DEFINE([HAVE___SYNC_SWAP], 1, [found __sync_swap builtin])
841 AC_MSG_RESULT([yes])
842 ], [
843 AC_MSG_RESULT([no])
844 ])
845
846 ], [
847 AC_MSG_RESULT([no])
848 AC_MSG_FAILURE([stdatomic.h unavailable and $CC has neither __atomic nor __sync builtins])
849 ])
850 ])
851 ])
852
853 AC_CHECK_HEADERS([pthread_np.h],,, [
854 #include <pthread.h>
855 ])
856 AC_CHECK_FUNCS([pthread_setname_np pthread_set_name_np])
857
858 needsync=true
859
860 AS_IF([$needsync], [
861 dnl Linux
862 AC_MSG_CHECKING([for Linux futex() support])
863 AC_LINK_IFELSE([AC_LANG_PROGRAM([
864 #ifndef _GNU_SOURCE
865 #define _GNU_SOURCE
866 #endif
867 #include <unistd.h>
868 #include <limits.h>
869 #include <sys/time.h>
870 #include <sys/syscall.h>
871 #include <linux/futex.h>
872
873 int main(void);
874 ],
875 [
876 {
877 return syscall(SYS_futex, NULL, FUTEX_WAIT, 0, NULL, NULL, 0);
878 }
879 ])], [
880 AC_MSG_RESULT([yes])
881 AC_DEFINE(HAVE_SYNC_LINUX_FUTEX,,Have Linux futex support)
882 needsync=false
883 ], [
884 AC_MSG_RESULT([no])
885 ])
886 ])
887
888 AS_IF([$needsync], [
889 dnl FreeBSD
890 AC_MSG_CHECKING([for FreeBSD _umtx_op() support])
891 AC_LINK_IFELSE([AC_LANG_PROGRAM([
892 #include <errno.h>
893 #include <stdlib.h>
894 #include <sys/types.h>
895 #include <sys/umtx.h>
896 int main(void);
897 ],
898 [
899 {
900 return _umtx_op(NULL, UMTX_OP_WAIT_UINT, 0, NULL, NULL);
901 }
902 ])], [
903 AC_MSG_RESULT([yes])
904 AC_DEFINE(HAVE_SYNC_UMTX_OP,,Have FreeBSD _umtx_op() support)
905 needsync=false
906 ], [
907 AC_MSG_RESULT([no])
908 ])
909 ])
910
911 AS_IF([$needsync], [
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>
917 int main(void);
918 ],
919 [
920 {
921 return futex(NULL, FUTEX_WAIT, 0, NULL, NULL, 0);
922 }
923 ])], [
924 AC_MSG_RESULT([yes])
925 AC_DEFINE(HAVE_SYNC_OPENBSD_FUTEX,,Have OpenBSD futex support)
926 needsync=false
927 ], [
928 AC_MSG_RESULT([no])
929 ])
930 ])
931
932 dnl Utility macro to avoid retyping includes all the time
933 m4_define([FRR_INCLUDES],
934 [#ifdef SUNOS_5
935 #define _POSIX_C_SOURCE 200809L
936 #define __EXTENSIONS__
937 #endif
938 #include <stdio.h>
939 #include <stdlib.h>
940 #include <stddef.h>
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 */
945 #include <signal.h>
946 #include <sys/socket.h>
947 #ifdef __APPLE__
948 # define __APPLE_USE_RFC_3542
949 #endif
950 #include <netinet/in.h>
951 #include <sys/time.h>
952 #include <time.h>
953 #include <net/if.h>
954 ])dnl
955
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.
959
960 AC_CHECK_HEADERS([net/if_var.h], [], [], [FRR_INCLUDES])
961
962 m4_define([FRR_INCLUDES],
963 FRR_INCLUDES
964 [#if HAVE_NET_IF_VAR_H
965 # include <net/if_var.h>
966 #endif
967 ])dnl
968
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])
974
975 AC_CHECK_HEADERS([ucontext.h], [], [],
976 [#ifndef __USE_GNU
977 #define __USE_GNU
978 #endif /* __USE_GNU */
979 FRR_INCLUDES
980 ])
981
982 m4_define([UCONTEXT_INCLUDES],
983 [#include <ucontext.h>])dnl
984
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])
993
994 m4_define([FRR_INCLUDES],
995 FRR_INCLUDES
996 [
997 #include <sys/un.h>
998 #include <netinet/in_systm.h>
999 #if HAVE_NETINET_IN_VAR_H
1000 # include <netinet/in_var.h>
1001 #endif
1002 #if HAVE_NET_IF_DL_H
1003 # include <net/if_dl.h>
1004 #endif
1005 #if HAVE_NET_NETOPT_H
1006 # include <net/netopt.h>
1007 #endif
1008 #include <net/route.h>
1009 #if HAVE_INET_ND_H
1010 # include <inet/nd.h>
1011 #endif
1012 #include <arpa/inet.h>
1013 /* Required for IDRP */
1014 #if HAVE_NETINET_IP_ICMP_H
1015 # include <netinet/ip_icmp.h>
1016 #endif
1017 ])dnl
1018
1019 dnl V6 headers are checked below, after we check for v6
1020
1021 AC_MSG_CHECKING([which operating system interface to use])
1022 case "$host_os" in
1023 sunos* | solaris2*)
1024 AC_MSG_RESULT([Solaris])
1025
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])
1029
1030 AC_CHECK_LIB([socket], [main])
1031 AC_CHECK_LIB([nsl], [main])
1032 AC_CHECK_LIB([umem], [main])
1033 SOLARIS="solaris"
1034 ;;
1035 linux*)
1036 AC_MSG_RESULT([Linux])
1037
1038 AC_DEFINE([GNU_LINUX], [1], [GNU Linux])
1039 AC_DEFINE([HAVE_NETLINK], [1], [netlink])
1040 AC_DEFINE([LINUX_IPV6], [1], [Linux IPv6 stack])
1041
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])
1048 ;;
1049 openbsd*)
1050 AC_MSG_RESULT([OpenBSD])
1051
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])
1055
1056 if test "x${enable_pimd}" != "xno"; then
1057 case "$host_os" in
1058 openbsd6.0)
1059 ;;
1060 openbsd[6-9]*)
1061 AC_MSG_FAILURE([pimd cannot be enabled as PIM support has been removed from OpenBSD 6.1])
1062 ;;
1063 esac
1064 fi
1065 ;;
1066 *)
1067 AC_MSG_RESULT([BSD])
1068
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])
1072 ;;
1073 esac
1074 AM_CONDITIONAL([SOLARIS], [test "${SOLARIS}" = "solaris"])
1075
1076 AC_SYS_LARGEFILE
1077
1078 dnl ------------------------
1079 dnl Integrated REALMS option
1080 dnl ------------------------
1081 if test "${enable_realms}" = "yes"; then
1082 case "$host_os" in
1083 linux*)
1084 AC_DEFINE([SUPPORT_REALMS], [1], [Realms support])
1085 ;;
1086 *)
1087 echo "Sorry, only Linux has REALMS support"
1088 exit 1
1089 ;;
1090 esac
1091 fi
1092
1093 dnl -------------------------------
1094 dnl Endian-ness check
1095 dnl -------------------------------
1096 AC_WORDS_BIGENDIAN
1097
1098 dnl ---------------
1099 dnl other functions
1100 dnl ---------------
1101 AC_CHECK_FUNCS([ \
1102 strlcat strlcpy \
1103 getgrouplist])
1104
1105 dnl ##########################################################################
1106 dnl LARGE if block spans a lot of "configure"!
1107 if test "${enable_clippy_only}" != "yes"; then
1108 dnl ##########################################################################
1109
1110 #
1111 # Logic for protobuf support.
1112 #
1113 if test "$enable_protobuf" = "yes"; then
1114 # Check for protoc & protoc-c
1115
1116 # protoc is not required, it's only for a "be nice" helper target
1117 AC_CHECK_PROGS([PROTOC], [protoc], [/bin/false])
1118
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.])
1122 fi
1123
1124 PKG_CHECK_MODULES([PROTOBUF_C], [libprotobuf-c >= 0.14],, [
1125 AC_MSG_FAILURE([protobuf requested but libprotobuf-c not found. Install protobuf-c.])
1126 ])
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.])
1129 ])
1130
1131 AC_DEFINE([HAVE_PROTOBUF], [1], [protobuf])
1132 fi
1133
1134
1135 dnl ---------------------
1136 dnl Integrated VTY option
1137 dnl ---------------------
1138 case "${enable_vtysh}" in
1139 "no")
1140 VTYSH="";;
1141 *)
1142 VTYSH="vtysh";
1143 AC_DEFINE([VTYSH], [1], [VTY shell])
1144
1145 prev_libs="$LIBS"
1146 AC_CHECK_LIB([readline], [main], [
1147 LIBREADLINE="-lreadline"
1148 ], [
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"
1153 ], [
1154 AC_MSG_ERROR([libreadline (needed for vtysh) not found and/or missing dependencies])
1155 ])
1156
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"
1161 ], [
1162 AC_MSG_ERROR([libreadline (needed for vtysh) not found and/or missing dependencies])
1163 ], [$LIBREADLINE])
1164 ], [])
1165 LIBS="$prev_libs"
1166
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.])
1170 fi
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])
1174 fi
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])
1178 fi
1179 ;;
1180 esac
1181 AC_SUBST([LIBREADLINE])
1182
1183 dnl ----------
1184 dnl PAM module
1185 dnl
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
1191 dnl of OpenPAM.
1192 dnl ----------
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"
1198 ],
1199 [], FRR_INCLUDES)
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"
1204 ],
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 ***])
1208 with_libpam="no"
1209 fi
1210 fi
1211
1212 if test "$with_libpam" = "yes"; then
1213 dnl took this test from proftpds configure.in and suited to our needs
1214 dnl -------------------------------------------------------------------------
1215 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])
1223 LIBPAM="-lpam"],
1224 [AC_DEFINE([USE_PAM], [1], [Use PAM for authentication])
1225 LIBPAM="-lpam -lpam_misc"]
1226 )
1227 ],
1228
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"]
1235 )
1236 ],AC_MSG_WARN([*** pam support will not be built ***]),
1237 [-ldl])
1238 ]
1239 )
1240 fi
1241 AC_SUBST([LIBPAM])
1242
1243 dnl -------------------------------
1244 dnl bgpd needs pow() and hence libm
1245 dnl -------------------------------
1246 TMPLIBS="$LIBS"
1247 LIBS=""
1248 AC_SEARCH_LIBS([pow], [m], [
1249 LIBM="$LIBS"
1250 ], [
1251 AC_MSG_WARN([Unable to find working pow function - bgpd may not link])
1252 ])
1253 LIBS="$TMPLIBS"
1254 AC_SUBST([LIBM])
1255
1256 AC_CHECK_FUNCS([ppoll], [
1257 AC_DEFINE([HAVE_PPOLL], [1], [have Linux/BSD ppoll()])
1258 ])
1259 AC_CHECK_FUNCS([pollts], [
1260 AC_DEFINE([HAVE_POLLTS], [1], [have NetBSD pollts()])
1261 ])
1262
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>
1267 ])
1268 AC_CHECK_FUNCS([setns])]
1269 )
1270
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])
1280
1281 case "$host_os" in
1282 linux*)
1283 AC_MSG_RESULT([pfpacket])
1284 ISIS_METHOD_MACRO="ISIS_METHOD_PFPACKET"
1285 ;;
1286 solaris* | sunos*)
1287 AC_MSG_RESULT([DLPI])
1288 ISIS_METHOD_MACRO="ISIS_METHOD_DLPI"
1289 ;;
1290 *)
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])
1296 fi
1297 AC_MSG_WARN([*** IS-IS support will not be built ***])
1298 enable_isisd="no"
1299 enable_fabricd="no"
1300 else
1301 AC_MSG_RESULT([DLPI])
1302 fi
1303 ISIS_METHOD_MACRO="ISIS_METHOD_DLPI"
1304 else
1305 AC_MSG_RESULT([BPF])
1306 ISIS_METHOD_MACRO="ISIS_METHOD_BPF"
1307 fi
1308 ;;
1309 esac
1310 AC_DEFINE_UNQUOTED([ISIS_METHOD], [$ISIS_METHOD_MACRO], [selected method for isis, == one of the constants])
1311
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)
1316
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>
1322 ])
1323
1324 m4_define([FRR_INCLUDES],
1325 FRR_INCLUDES
1326 [#if HAVE_LINUX_MROUTE_H
1327 # include <linux/mroute.h>
1328 #endif
1329 ])dnl
1330
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>
1336 ])
1337
1338 m4_define([FRR_INCLUDES],
1339 FRR_INCLUDES
1340 [#if HAVE_NETINET_IP_MROUTE_H
1341 # include <netinet/ip_mroute.h>
1342 #endif
1343 ])dnl
1344
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)
1348 return (0);
1349 #else
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]))
1354
1355 AC_MSG_CHECKING([for RFC3678 protocol-independed API])
1356 AC_TRY_COMPILE([
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]))
1363
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],
1369 FRR_INCLUDES
1370 [#include <net/if_media.h>
1371 ])
1372 AC_CHECK_MEMBERS([struct ifmediareq.ifm_status],
1373 AC_DEFINE([HAVE_BSD_LINK_DETECT], [1], [BSD link-detect]),
1374 [], LINK_DETECT_INCLUDES)],
1375 [],
1376 FRR_INCLUDES)
1377
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]),
1384 [], FRR_INCLUDES)
1385
1386 dnl ------------------------
1387 dnl TCP_MD5SIG socket option
1388 dnl ------------------------
1389
1390 AC_CHECK_HEADER([netinet/tcp.h],
1391 [m4_define([MD5_INCLUDES],
1392 FRR_INCLUDES
1393 [#include <netinet/tcp.h>
1394 ])
1395 AC_CHECK_DECLS([TCP_MD5SIG], [], [], MD5_INCLUDES)],
1396 [],
1397 FRR_INCLUDES)
1398 if test $ac_cv_have_decl_TCP_MD5SIG = no; then
1399 AC_CHECK_HEADER([linux/tcp.h],
1400 [m4_define([MD5_INCLUDES],
1401 FRR_INCLUDES
1402 [#include <linux/tcp.h>
1403 ])
1404 AC_CHECK_DECLS([TCP_MD5SIG], [], [], MD5_INCLUDES)])
1405 fi
1406
1407 AC_SUBST([SOLARIS])
1408 AC_CHECK_LIB([crypt], [crypt], [],
1409 [AC_CHECK_LIB([crypto], [DES_crypt])])
1410 AC_CHECK_LIB([resolv], [res_init])
1411
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])
1418 ])
1419 fi
1420 AC_SUBST([HAVE_LIBPCREPOSIX])
1421
1422 dnl ##########################################################################
1423 dnl test "${enable_clippy_only}" != "yes"
1424 fi
1425 dnl END OF LARGE if block
1426 dnl ##########################################################################
1427
1428
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>])
1433
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], [], [],
1439 FRR_INCLUDES)
1440
1441 m4_define([FRR_INCLUDES],dnl
1442 FRR_INCLUDES
1443 [#if HAVE_NETINET6_IN6_H
1444 #include <netinet6/in6.h>
1445 #endif
1446 #if HAVE_NETINET_IN6_VAR_H
1447 #include <netinet/in6_var.h>
1448 #endif
1449 #include <netinet/icmp6.h>
1450 #if HAVE_NETINET6_IN6_VAR_H
1451 # include <netinet6/in6_var.h>
1452 #endif
1453 #if HAVE_NETINET6_ND6_H
1454 # include <netinet6/nd6.h>
1455 #endif
1456 ])dnl
1457
1458 dnl --------------------
1459 dnl Daemon disable check
1460 dnl --------------------
1461
1462 AS_IF([test "${enable_ldpd}" != "no"], [
1463 AC_DEFINE([HAVE_LDPD], [1], [ldpd])
1464 ])
1465
1466 if test "$enable_bfdd" = "no"; then
1467 AC_DEFINE([HAVE_BFDD], [0], [bfdd])
1468 BFDD=""
1469 else
1470 AC_DEFINE([HAVE_BFDD], [1], [bfdd])
1471 BFDD="bfdd"
1472
1473 case $host_os in
1474 linux*)
1475 AC_DEFINE([BFD_LINUX], [1], [bfdd])
1476 ;;
1477
1478 *)
1479 AC_DEFINE([BFD_BSD], [1], [bfdd])
1480 ;;
1481 esac
1482 fi
1483
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"])
1486 fi
1487
1488 NHRPD=""
1489 case "$host_os" in
1490 linux*)
1491 if test "${enable_nhrpd}" != "no"; then
1492 NHRPD="nhrpd"
1493 fi
1494 ;;
1495 *)
1496 if test "${enable_nhrpd}" = "yes"; then
1497 AC_MSG_ERROR([nhrpd requires kernel APIs that are only present on Linux.])
1498 fi
1499 ;;
1500 esac
1501
1502 if test "${enable_watchfrr}" = "no";then
1503 WATCHFRR=""
1504 else
1505 WATCHFRR="watchfrr"
1506 fi
1507
1508 OSPFCLIENT=""
1509 if test "${enable_ospfapi}" != "no";then
1510 AC_DEFINE([SUPPORT_OSPF_API], [1], [OSPFAPI])
1511
1512 if test "${enable_ospfclient}" != "no";then
1513 OSPFCLIENT="ospfclient"
1514 fi
1515 fi
1516
1517 if test "${enable_bgp_announce}" = "no";then
1518 AC_DEFINE([DISABLE_BGP_ANNOUNCE], [1], [Disable BGP installation to zebra])
1519 else
1520 AC_DEFINE([DISABLE_BGP_ANNOUNCE], [0], [Disable BGP installation to zebra])
1521 fi
1522
1523 if test "${enable_bgp_vnc}" != "no";then
1524 AC_DEFINE([ENABLE_BGP_VNC], [1], [Enable BGP VNC support])
1525 fi
1526
1527 dnl ##########################################################################
1528 dnl LARGE if block
1529 if test "${enable_clippy_only}" != "yes"; then
1530 dnl ##########################################################################
1531
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.])
1538 ])
1539 fi
1540
1541
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])
1549 fi
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'`"
1556 done
1557 AC_MSG_CHECKING([whether we can link to Net-SNMP])
1558 AC_LINK_IFELSE_FLAGS([$SNMP_CFLAGS], [$SNMP_LIBS], [AC_LANG_PROGRAM([
1559 int main(void);
1560 ],
1561 [
1562 {
1563 return 0;
1564 }
1565 ])], [
1566 AC_MSG_RESULT([no])
1567 AC_MSG_ERROR([--enable-snmp given but not usable])])
1568 case "${enable_snmp}" in
1569 yes)
1570 SNMP_METHOD=agentx
1571 ;;
1572 agentx)
1573 SNMP_METHOD="${enable_snmp}"
1574 ;;
1575 *)
1576 AC_MSG_ERROR([--enable-snmp given with an unknown method (${enable_snmp}). Use yes or agentx])
1577 ;;
1578 esac
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])
1581 fi
1582 AC_SUBST([SNMP_LIBS])
1583 AC_SUBST([SNMP_CFLAGS])
1584
1585 dnl ---------------
1586 dnl libyang
1587 dnl ---------------
1588 PKG_CHECK_MODULES([LIBYANG], [libyang >= 0.16.7], , [
1589 AC_MSG_ERROR([libyang (>= 0.16.7) was not found on your system.])
1590 ])
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])
1597 ])
1598 ], [[#include <libyang/libyang.h>]])
1599 CFLAGS="$ac_cflags_save"
1600
1601 dnl ---------------
1602 dnl configuration rollbacks
1603 dnl ---------------
1604 SQLITE3=false
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])
1609 SQLITE3=true
1610 ], [
1611 AC_MSG_ERROR([--enable-config-rollbacks given but sqlite3 was not found on your system.])
1612 ])
1613 fi
1614
1615 dnl ---------------
1616 dnl confd
1617 dnl ---------------
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.])]
1622 fi
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])
1628 fi
1629
1630 dnl ---------------
1631 dnl sysrepo
1632 dnl ---------------
1633 if test "$enable_sysrepo" = "yes"; then
1634 PKG_CHECK_MODULES([SYSREPO], [libsysrepo],
1635 [AC_DEFINE([HAVE_SYSREPO], [1], [Enable sysrepo integration])
1636 SYSREPO=true],
1637 [SYSREPO=false
1638 AC_MSG_ERROR([sysrepo was not found on your system.])]
1639 )
1640 fi
1641
1642 dnl ---------------
1643 dnl gRPC
1644 dnl ---------------
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.])
1650 fi
1651
1652 AC_DEFINE([HAVE_GRPC], [1], [Enable the gRPC northbound plugin])
1653 GRPC=true
1654 ], [
1655 GRPC=false
1656 AC_MSG_ERROR([grpc/grpc++ were not found on your system.])
1657 ])
1658 fi
1659
1660 dnl ------
1661 dnl ZeroMQ
1662 dnl ------
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])
1666 ZEROMQ=true
1667 ], [
1668 if test "x$enable_zeromq" = "xyes"; then
1669 AC_MSG_ERROR([configuration specifies --enable-zeromq but libzmq was not found])
1670 fi
1671 ])
1672 fi
1673
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],
1679 [RPKI=true],
1680 [RPKI=false
1681 AC_MSG_ERROR([rtrlib was not found on your system or is too old.])]
1682 )
1683 fi
1684
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])],
1693 AC_MSG_RESULT([no])
1694 )
1695
1696 dnl ---------------
1697 dnl dlopen & dlinfo
1698 dnl ---------------
1699 AC_SEARCH_LIBS([dlopen], [dl dld], [], [
1700 AC_MSG_ERROR([unable to find the dlopen()])
1701 ])
1702
1703 AC_CHECK_HEADERS([link.h])
1704
1705 AC_CACHE_CHECK([for dlinfo(RTLD_DI_ORIGIN)], [frr_cv_rtld_di_origin], [
1706 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1707 #include <stdlib.h>
1708 #ifdef HAVE_LINK_H
1709 #include <link.h>
1710 #endif
1711 #include <dlfcn.h>
1712 ]], [[
1713 char origin[1];
1714 dlinfo (NULL, RTLD_DI_ORIGIN, &origin);
1715 ]])], [
1716 frr_cv_rtld_di_origin=yes
1717 ], [
1718 frr_cv_rtld_di_origin=no
1719 ])
1720 ])
1721 if test "$frr_cv_rtld_di_origin" = yes; then
1722 AC_DEFINE([HAVE_DLINFO_ORIGIN], [1], [Have dlinfo RTLD_DI_ORIGIN])
1723 fi
1724
1725 AC_CACHE_CHECK([for dlinfo(RTLD_DI_LINKMAP)], [frr_cv_rtld_di_linkmap], [
1726 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1727 #include <stdlib.h>
1728 #ifdef HAVE_LINK_H
1729 #include <link.h>
1730 #endif
1731 #include <dlfcn.h>
1732 ]], [[
1733 struct link_map *lm = NULL;
1734 dlinfo (NULL, RTLD_DI_LINKMAP, &lm);
1735 ]])], [
1736 frr_cv_rtld_di_linkmap=yes
1737 ], [
1738 frr_cv_rtld_di_linkmap=no
1739 ])
1740 ])
1741 if test "$frr_cv_rtld_di_linkmap" = yes; then
1742 AC_DEFINE([HAVE_DLINFO_LINKMAP], [1], [Have dlinfo RTLD_DI_LINKMAP])
1743 fi
1744
1745 dnl ##########################################################################
1746 dnl test "${enable_clippy_only}" != "yes"
1747 fi
1748 dnl END OF LARGE if block
1749 dnl ##########################################################################
1750
1751 dnl ---------------------------
1752 dnl sockaddr and netinet checks
1753 dnl ---------------------------
1754 AC_CHECK_TYPES([
1755 struct sockaddr_dl,
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)
1763
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)
1770
1771 dnl ---------------------------
1772 dnl IRDP/pktinfo/icmphdr checks
1773 dnl ---------------------------
1774
1775 AC_CHECK_TYPES([struct in_pktinfo], [
1776 AC_CHECK_TYPES([struct icmphdr], [
1777 IRDP=true
1778 ], [
1779 IRDP=false
1780 ], [FRR_INCLUDES])
1781 ], [
1782 IRDP=false
1783 ], [FRR_INCLUDES])
1784
1785 case "${enable_irdp}" in
1786 yes)
1787 $IRDP || AC_MSG_ERROR(['IRDP requires in_pktinfo at the moment!'])
1788 ;;
1789 no)
1790 IRDP=false
1791 ;;
1792 esac
1793
1794
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;
1801 ], [
1802 AC_MSG_RESULT([yes])
1803 AC_DEFINE([HAVE_IP_PKTINFO], [1], [Have IP_PKTINFO])
1804 ], [
1805 AC_MSG_RESULT([no])
1806 ])
1807
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;
1814 ], [
1815 AC_MSG_RESULT([yes])
1816 AC_DEFINE([HAVE_IP_RECVDSTADDR], [1], [Have IP_RECVDSTADDR])
1817 ], [
1818 AC_MSG_RESULT([no])
1819 ])
1820
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;
1827 ], [
1828 AC_MSG_RESULT([yes])
1829 AC_DEFINE([HAVE_IP_RECVIF], [1], [Have IP_RECVIF])
1830 ], [
1831 AC_MSG_RESULT([no])
1832 ])
1833
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;
1840 ], [
1841 AC_MSG_RESULT([yes])
1842 AC_DEFINE([HAVE_SO_BINDANY], [1], [Have SO_BINDANY])
1843 ], [
1844 AC_MSG_RESULT([no])
1845 ])
1846
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;
1853 ], [
1854 AC_MSG_RESULT([yes])
1855 AC_DEFINE([HAVE_IP_FREEBIND], [1], [Have IP_FREEBIND])
1856 ], [
1857 AC_MSG_RESULT([no])
1858 ])
1859
1860 dnl --------------------------------------
1861 dnl checking for be32dec existence or not
1862 dnl --------------------------------------
1863 AC_CHECK_DECLS([be32enc, be32dec], [], [],
1864 [#include <sys/endian.h>])
1865
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])
1873
1874 dnl --------------------------------------
1875 dnl checking for flex and bison
1876 dnl --------------------------------------
1877
1878 AM_PROG_LEX
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])
1887 else
1888 AC_MSG_ERROR([flex failure and pregenerated files not included (probably a git build)])
1889 fi
1890 AC_SUBST([LEX_OUTPUT_ROOT], [lex.yy])
1891 AC_SUBST([LEXLIB], [''])
1892 ])
1893
1894 AC_PROG_YACC
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
1901 x2.7*)
1902 BISON_OPENBRACE='"'
1903 BISON_CLOSEBRACE='"'
1904 BISON_VERBOSE=''
1905 AC_MSG_RESULT([$frr_ac_bison_version - 2.7 or older])
1906 ;;
1907 x2.*|x1.*)
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"
1911 ;;
1912 x)
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"
1916 ;;
1917 x3.[012][^0-9]*)
1918 BISON_OPENBRACE='{'
1919 BISON_CLOSEBRACE='}'
1920 BISON_VERBOSE='-Dparse.error=verbose'
1921 AC_MSG_RESULT([$frr_ac_bison_version - 3.0 to 3.2])
1922 ;;
1923 *)
1924 BISON_OPENBRACE='{'
1925 BISON_CLOSEBRACE='}'
1926 BISON_VERBOSE='-Dparse.error=verbose -Wno-yacc'
1927 AC_MSG_RESULT([$frr_ac_bison_version - 3.3 or newer])
1928 ;;
1929 esac
1930 AC_SUBST([BISON_OPENBRACE])
1931 AC_SUBST([BISON_CLOSEBRACE])
1932 AC_SUBST([BISON_VERBOSE])
1933
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])
1938 else
1939 AC_MSG_ERROR([bison failure and pregenerated files not included (probably a git build)])
1940 fi
1941 fi
1942
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"],
1952 AC_MSG_RESULT([no])
1953 )
1954 if test x"${frr_ac_keepcaps}" = x"yes"; then
1955 AC_CHECK_HEADERS([sys/capability.h])
1956 fi
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])
1960 LIBCAP="-lcap"
1961 frr_ac_lcaps="yes"]
1962 )
1963 else
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"],
1970 AC_MSG_RESULT(no)
1971 )
1972 ]
1973 )
1974 fi
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])
1978 fi
1979 fi
1980 AC_SUBST([LIBCAP])
1981
1982 dnl ---------------------------
1983 dnl check for glibc 'backtrace'
1984 dnl ---------------------------
1985 if test x"${enable_backtrace}" != x"no" ; then
1986 backtrace_ok=no
1987 PKG_CHECK_MODULES([UNWIND], [libunwind], [
1988 AC_DEFINE([HAVE_LIBUNWIND], [1], [libunwind])
1989 backtrace_ok=yes
1990 ], [
1991 case "$host_os" in
1992 sunos* | solaris2*)
1993 AC_CHECK_FUNCS([printstack], [
1994 AC_DEFINE([HAVE_PRINTSTACK], [1], [Solaris printstack])
1995 backtrace_ok=yes
1996 ])
1997 ;;
1998 esac
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])
2003 backtrace_ok=yes
2004 ],, [-lm])
2005 ])
2006 fi
2007 ])
2008
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])
2012 fi
2013 fi
2014
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])
2023
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
2027 #include <malloc.h>
2028 #endif
2029 #ifdef HAVE_MALLOC_NP_H
2030 #include <malloc_np.h>
2031 #endif
2032 #ifdef HAVE_MALLOC_MALLOC_H
2033 #include <malloc/malloc.h>
2034 #endif
2035 ]], [[
2036 struct mallinfo ac_x; ac_x = mallinfo ();
2037 ]])], [
2038 frr_cv_mallinfo=yes
2039 ], [
2040 frr_cv_mallinfo=no
2041 ])
2042 ])
2043 if test "$frr_cv_mallinfo" = yes; then
2044 AC_DEFINE([HAVE_MALLINFO], [1], [mallinfo])
2045 fi
2046
2047 AC_MSG_CHECKING([whether malloc_usable_size is available])
2048 AC_LINK_IFELSE([AC_LANG_PROGRAM([FRR_INCLUDES [
2049 #ifdef HAVE_MALLOC_H
2050 #include <malloc.h>
2051 #endif
2052 #ifdef HAVE_MALLOC_MALLOC_H
2053 #include <malloc/malloc.h>
2054 #endif
2055 ]], [[
2056 size_t ac_x; ac_x = malloc_usable_size(NULL);
2057 ]])], [
2058 AC_MSG_RESULT([yes])
2059 AC_DEFINE([HAVE_MALLOC_USABLE_SIZE], [1], [malloc_usable_size])
2060 ], [
2061 AC_MSG_RESULT([no])
2062
2063 AC_MSG_CHECKING([whether malloc_size is available])
2064 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2065 #ifdef HAVE_MALLOC_H
2066 #include <malloc.h>
2067 #endif
2068 #ifdef HAVE_MALLOC_MALLOC_H
2069 #include <malloc/malloc.h>
2070 #endif
2071 ]], [[
2072 size_t ac_x; ac_x = malloc_size(NULL);
2073 ]])], [
2074 AC_MSG_RESULT([yes])
2075 AC_DEFINE([HAVE_MALLOC_SIZE], [1], [malloc_size])
2076 ], [
2077 AC_MSG_RESULT([no])
2078 ])
2079 ])
2080
2081 dnl ----------
2082 dnl configure date
2083 dnl ----------
2084 dev_version=`echo $VERSION | grep dev`
2085 #don't expire deprecated code in non 'dev' branch
2086 if test "${dev_version}" = ""; then
2087 CONFDATE=0
2088 else
2089 CONFDATE=`date '+%Y%m%d'`
2090 fi
2091 AC_SUBST([CONFDATE])
2092
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="";
2099 else
2100 frr_statedir_prefix=${prefix}
2101 fi
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
2106 /var/run dnl
2107 /var/adm dnl
2108 /etc dnl
2109 /dev/null;
2110 do
2111 test -d $FRR_STATE_DIR && break
2112 done
2113 frr_statedir=$FRR_STATE_DIR
2114 else
2115 frr_statedir=${localstatedir}
2116 fi
2117 if test $frr_statedir = "/dev/null"; then
2118 AC_MSG_ERROR([STATE DIRECTORY NOT FOUND! FIX OR SPECIFY --localstatedir!])
2119 fi
2120 AC_MSG_RESULT([${frr_statedir}])
2121 AC_SUBST([frr_statedir])
2122
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])
2128
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}'
2132
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\""
2137 done
2138 AC_DEFINE_UNQUOTED([VTYSH_BIN_PATH], ["$vtysh_bin"], [path to vtysh binary])
2139 AC_SUBST([vtysh_bin])
2140
2141 CFG_SYSCONF="$sysconfdir"
2142 CFG_SBIN="$sbindir"
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\""
2154 done
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])
2165
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])
2169 dnl northbound
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"])
2175 dnl plugins
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"])
2181 dnl daemons
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"])
2203
2204 AC_CONFIG_FILES([Makefile],[sed -e 's/^#AUTODERP# //' -i Makefile])
2205
2206 AC_CONFIG_FILES([
2207 config.version
2208 changelog-auto
2209 redhat/frr.spec
2210 solaris/Makefile
2211 alpine/APKBUILD
2212 snapcraft/snapcraft.yaml
2213 lib/version.h
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
2217 pkgsrc/eigrpd.sh])
2218
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])
2224
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" \
2229 > "${dst}.tmp"
2230 test -f "${dst}" \
2231 && diff "${dst}.tmp" "${dst}" >/dev/null 2>/dev/null \
2232 && rm "${dst}.tmp" \
2233 || mv "${dst}.tmp" "${dst}"
2234 ], [
2235 PERL="$PERL"
2236 ])
2237
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}" \
2243 > "${dst}.tmp"
2244 test -f "${dst}" \
2245 && diff "${dst}.tmp" "${dst}" >/dev/null 2>/dev/null \
2246 && rm "${dst}.tmp" \
2247 || mv "${dst}.tmp" "${dst}"
2248 ], [
2249 PERL="$PERL"
2250 ])
2251 ])
2252
2253 ## Hack, but working solution to avoid rebuilding of frr.info.
2254 ## It's already in CVS until texinfo 4.7 is more common.
2255 AC_OUTPUT
2256
2257 echo "
2258 FRRouting configuration
2259 ------------------------------
2260 FRR version : ${PACKAGE_VERSION}
2261 host operating system : ${host_os}
2262 source code location : ${srcdir}
2263 compiler : ${CC}
2264 compiler flags : ${CFLAGS} ${SAN_FLAGS}
2265 make : ${MAKE-make}
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}
2277
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."
2280
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])
2283 fi
2284 if test "$frr_py_mod_pytest" = false; then
2285 AC_MSG_WARN([pytest is missing, unit tests cannot be performed])
2286 fi