2 ## Configure template file for Quagga.
3 ## autoconf will generate 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(Quagga, 0.99.24+cl3u4, [https://bugzilla.quagga.net])
13 AC_CONFIG_SRCDIR(lib/zebra.h)
14 AC_CONFIG_MACRO_DIR([m4])
16 dnl -----------------------------------
17 dnl Get hostname and other information.
18 dnl -----------------------------------
23 # Disable portability warnings -- our automake code (in particular
24 # common.am) uses some constructs specific to gmake.
25 AM_INIT_AUTOMAKE([1.6 -Wno-portability])
26 m4_ifndef([AM_SILENT_RULES], [m4_define([AM_SILENT_RULES],[])])
27 AM_SILENT_RULES([yes])
28 AC_CONFIG_HEADERS(config.h)
30 AC_PATH_PROG(PERL, perl)
32 dnl default is to match previous behavior
33 exampledir=${sysconfdir}
34 AC_ARG_ENABLE([exampledir],
35 AS_HELP_STRING([--enable-exampledir],
36 [specify alternate directory for examples]),
37 exampledir="$enableval",)
38 dnl XXX add --exampledir to autoconf standard directory list somehow
41 dnl default is to match previous behavior
44 AC_ARG_ENABLE([pkgsrcrcdir],
45 AS_HELP_STRING([--enable-pkgsrcrcdir],
46 [specify directory for rc.d scripts]),
47 pkgsrcrcdir="$enableval"; pkgsrcdir="pkgsrc",)
48 dnl XXX add --pkgsrcrcdir to autoconf standard directory list somehow
56 [ --with-cflags Set CFLAGS for use in compilation.])
57 if test "x$with_cflags" != "x" ; then
58 CFLAGS="$with_cflags" ; cflags_specified=yes ;
59 elif test -n "$CFLAGS" ; then
60 cflags_specified=yes ;
63 AC_ARG_ENABLE(tcmalloc,
64 [ --enable-tcmalloc Turn on tcmalloc],
65 [case "${enableval}" in
66 yes) tcmalloc_enabled=true
67 LIBS="$LIBS -ltcmalloc_minimal"
69 no) tcmalloc_enabled=false ;;
70 *) AC_MSG_ERROR(bad value ${enableval} for --enable-tcmalloc) ;;
71 esac],[tcmalloc_enabled=false])
74 dnl --------------------
75 dnl Check CC and friends
76 dnl --------------------
84 dnl autoconf 2.59 appears not to support AC_PROG_SED
86 AC_CHECK_PROG([SED],[sed],[sed],[/bin/false])
88 dnl pdflatex and latexmk are needed to build HACKING.pdf
89 AC_CHECK_PROG([PDFLATEX],[pdflatex],[pdflatex],[/bin/false])
90 AC_CHECK_PROG([LATEXMK],[latexmk],[latexmk],[/bin/false])
91 if test "x$PDFLATEX" = "x/bin/false" -o "x$LATEXMK" = "x/bin/false"; then
92 AC_MSG_WARN([Will not be able to make PDF versions of TeX documents])
96 AM_CONDITIONAL([HAVE_LATEX], [test "x$HAVE_LATEX" = "xtrue"])
98 if test "x${GCC}" != "xyes" ; then
99 AC_MSG_CHECKING([whether we are using SunPro compiler])
100 AC_EGREP_CPP([^__SUNPRO_C.*0x5(7|8|9)], ["__SUNPRO_C" __SUNPRO_C],
101 [AC_MSG_RESULT([no])],
103 AC_MSG_RESULT([yes])]
107 dnl ---------------------------------------------
108 dnl If CLFAGS doesn\'t exist set default value
109 dnl AC_PROG_CC will have set minimal default
110 dnl already, eg "-O2 -g" for gcc, "-g" for others
111 dnl (Wall is gcc specific... have to make sure
112 dnl gcc is being used before setting it)
114 dnl Sun Studio 10 / SunPro 5.7 is also supported,
115 dnl so lets set some sane CFLAGS for it.
116 dnl ---------------------------------------------
118 AC_USE_SYSTEM_EXTENSIONS()
119 AC_DEFUN([AC_C_FLAG], [{
121 ac_c_flag_save="$CFLAGS"
123 AC_MSG_CHECKING([[whether $CC supports $1]])
125 [AC_LANG_PROGRAM([[]])],
128 m4_if([$3], [], [], [
129 CFLAGS="$ac_c_flag_save"
133 CFLAGS="$ac_c_flag_save"
140 AC_MSG_CHECKING([whether to set a default CFLAGS])
141 if test "x${cflags_specified}" = "x" ; then
144 CFLAGS="-xO4 -v -g -xspace -xcode=pic32 -xstrconst -xc99"
145 AC_MSG_RESULT([SunPro default])
148 AC_MSG_RESULT([autodetecting])
150 AC_C_FLAG([-diag-error 10006])
151 AC_C_FLAG([-std=gnu99])
156 AC_C_FLAG([-fno-omit-frame-pointer])
159 AC_C_FLAG([-Wmissing-prototypes])
160 AC_C_FLAG([-Wmissing-declarations])
161 AC_C_FLAG([-Wpointer-arith])
162 AC_C_FLAG([-Wbad-function-cast])
163 AC_C_FLAG([-Wwrite-strings])
164 if test x"${enable_gcc_ultra_verbose}" = x"yes" ; then
165 AC_C_FLAG([-Wcast-qual])
166 AC_C_FLAG([-Wstrict-prototypes])
167 AC_C_FLAG([-Wmissing-noreturn])
168 AC_C_FLAG([-Wmissing-format-attribute])
169 AC_C_FLAG([-Wunreachable-code])
170 AC_C_FLAG([-Wpacked])
171 AC_C_FLAG([-Wpadded])
173 AC_C_FLAG([-Wno-unused-result])
175 AC_C_FLAG([-Wno-unused-parameter])
176 AC_C_FLAG([-Wno-missing-field-initializers])
177 # ICC emits a broken warning for const char *x = a ? "b" : "c";
178 # for some reason the string consts get 'promoted' to char *,
179 # triggering a const to non-const conversion warning.
180 AC_C_FLAG([-diag-disable 3179])
184 AC_MSG_RESULT([CFLAGS supplied by user])
187 if test x"${enable_werror}" = x"yes" ; then
198 AC_CHECK_TOOL(AR, ar)
200 dnl ---------------------------
201 dnl We, perhaps unfortunately,
202 dnl depend on GNU Make specific
204 dnl Give the user a warning if
206 dnl ---------------------------
207 AC_CACHE_CHECK([if ${MAKE-make} is GNU make], [quagga_cv_gnu_make],
208 [quagga_cv_gnu_make=no
209 if ${MAKE-make} --version 2>/dev/null | \
210 grep '^GNU Make ' >/dev/null ; then
211 quagga_cv_gnu_make=yes;
216 dnl -----------------
217 dnl System extensions
218 dnl -----------------
226 dnl ----------------------
227 dnl Packages configuration
228 dnl ----------------------
229 AC_ARG_WITH(pkg-extra-version,
230 AS_HELP_STRING([--with-pkg-extra-version=VER], [add extra version field, for packagers/distributions]),
231 [EXTRAVERSION=$withval],)
232 AC_ARG_WITH(pkg-git-version,
233 AS_HELP_STRING([--with-pkg-git-version], [add git information to MOTD and build version string]),
234 [ test "x$withval" != "xno" && with_pkg_git_version="yes" ])
236 AS_HELP_STRING([--disable-vtysh], [do not build integrated vty shell for Quagga]))
238 AS_HELP_STRING([--disable-doc], [do not build docs]))
240 AS_HELP_STRING([--disable-zebra], [do not build zebra daemon]))
242 AS_HELP_STRING([--disable-bgpd], [do not build bgpd]))
244 AS_HELP_STRING([--disable-ripd], [do not build ripd]))
245 AC_ARG_ENABLE(ripngd,
246 AS_HELP_STRING([--disable-ripngd], [do not build ripngd]))
248 AS_HELP_STRING([--disable-ospfd], [do not build ospfd]))
249 AC_ARG_ENABLE(ospf6d,
250 AS_HELP_STRING([--disable-ospf6d], [do not build ospf6d]))
252 AS_HELP_STRING([--enable-ldpd], [build ldpd]))
253 AC_ARG_ENABLE(watchquagga,
254 AS_HELP_STRING([--disable-watchquagga], [do not build watchquagga]))
256 AS_HELP_STRING([--disable-isisd], [do not build isisd]))
258 AS_HELP_STRING([--disable-pimd], [do not build pimd]))
259 AC_ARG_ENABLE(bgp-announce,
260 AS_HELP_STRING([--disable-bgp-announce,], [turn off BGP route announcement]))
261 AC_ARG_ENABLE(bgp-vnc,
262 AS_HELP_STRING([--disable-bgp-vnc],[turn off BGP VNC support]))
263 AC_ARG_WITH(rfp-path,
264 AS_HELP_STRING([--with-rfp-path[=DIR]],[path to replaced stub RFP used with BGP VNC]))
266 AS_HELP_STRING([--enable-snmp=ARG], [enable SNMP support (smux or agentx)]))
268 AS_HELP_STRING([--with-libpam], [use libpam for PAM support in vtysh]))
269 AC_ARG_ENABLE(tcp-zebra,
270 AS_HELP_STRING([--enable-tcp-zebra], [enable TCP/IP socket connection between zebra and protocol daemon]))
271 AC_ARG_ENABLE(ospfapi,
272 AS_HELP_STRING([--disable-ospfapi], [do not build OSPFAPI to access the OSPF LSA Database]))
273 AC_ARG_ENABLE(ospfclient,
274 AS_HELP_STRING([--disable-ospfclient], [do not build OSPFAPI client for OSPFAPI,
275 (this is the default if --disable-ospfapi is set)]))
276 AC_ARG_ENABLE(multipath,
277 AS_HELP_STRING([--enable-multipath=ARG], [enable multipath function, ARG must be digit]))
279 AS_HELP_STRING([--enable-user=USER], [user to run Quagga suite as (default quagga)]))
281 AS_HELP_STRING([--enable-group=GROUP], [group to run Quagga suite as (default quagga)]))
282 AC_ARG_ENABLE(vty_group,
283 AS_HELP_STRING([--enable-vty-group=ARG], [set vty sockets to have specified group as owner]))
284 AC_ARG_ENABLE(configfile_mask,
285 AS_HELP_STRING([--enable-configfile-mask=ARG], [set mask for config files]))
286 AC_ARG_ENABLE(logfile_mask,
287 AS_HELP_STRING([--enable-logfile-mask=ARG], [set mask for log files]))
288 AC_ARG_ENABLE(shell_access,
289 AS_HELP_STRING([--enable-shell-access], [Allow users to access shell/telnet/ssh]))
291 AS_HELP_STRING([--disable-rtadv], [disable IPV6 router advertisement feature]))
293 AS_HELP_STRING([--enable-irdp], [enable IRDP server support in zebra]))
294 AC_ARG_ENABLE(isis_topology,
295 AS_HELP_STRING([--enable-isis-topology], [enable IS-IS topology generator]))
296 AC_ARG_ENABLE(capabilities,
297 AS_HELP_STRING([--disable-capabilities], [disable using POSIX capabilities]))
298 AC_ARG_ENABLE(rusage,
299 AS_HELP_STRING([--disable-rusage], [disable using getrusage]))
300 AC_ARG_ENABLE(gcc_ultra_verbose,
301 AS_HELP_STRING([--enable-gcc-ultra-verbose], [enable ultra verbose GCC warnings]))
302 AC_ARG_ENABLE(linux24_tcp_md5,
303 AS_HELP_STRING([--enable-linux24-tcp-md5], [enable support for old, Linux-2.4 RFC2385 patch]))
304 AC_ARG_ENABLE(gcc-rdynamic,
305 AS_HELP_STRING([--enable-gcc-rdynamic], [enable linking with -rdynamic for better backtraces (default if gcc)]))
306 AC_ARG_ENABLE(backtrace,
307 AS_HELP_STRING([--disable-backtrace,], [disable crash backtraces (default autodetect)]))
308 AC_ARG_ENABLE(time-check,
309 AS_HELP_STRING([--disable-time-check], [disable slow thread warning messages]))
310 AC_ARG_ENABLE(pcreposix,
311 AS_HELP_STRING([--enable-pcreposix], [enable using PCRE Posix libs for regex functions]))
313 AS_HELP_STRING([--enable-fpm], [enable Forwarding Plane Manager support]))
314 AC_ARG_ENABLE(systemd,
315 AS_HELP_STRING([--enable-systemd], [enable Systemd support]))
317 AS_HELP_STRING([--enable-poll], [enable usage of Poll instead of select]))
318 AC_ARG_ENABLE(werror,
319 AS_HELP_STRING([--enable-werror], [enable -Werror (recommended for developers only)]))
320 AC_ARG_ENABLE(cumulus,
321 AS_HELP_STRING([--enable-cumulus], [enable Cumulus Switch Special Extensions]))
322 AC_ARG_ENABLE(rr-semantics,
323 AS_HELP_STRING([--disable-rr-semantics], [disable the v6 Route Replace semantics]))
324 AC_ARG_ENABLE([protobuf],
325 AS_HELP_STRING([--enable-protobuf], [Enable experimental protobuf support]))
327 AC_CHECK_HEADERS(json-c/json.h)
328 AC_CHECK_LIB(json-c, json_object_get, LIBS="$LIBS -ljson-c")
329 if test $ac_cv_lib_json_c_json_object_get = no; then
330 AC_CHECK_LIB(json, json_object_get, LIBS="$LIBS -ljson")
331 if test $ac_cv_lib_json_json_object_get = no; then
332 AC_MSG_ERROR([lib json is needed to compile])
336 AC_ARG_ENABLE([dev_build],
337 AS_HELP_STRING([--enable-dev-build], [build for development]))
339 if test x"${enable_gcc_rdynamic}" != x"no" ; then
340 if test x"${enable_gcc_rdynamic}" = x"yes" -o x"$COMPILER" = x"GCC"; then
341 LDFLAGS="${LDFLAGS} -rdynamic"
345 if test x"${enable_time_check}" != x"no" ; then
346 if test x"${enable_time_check}" = x"yes" -o x"${enable_time_check}" = x ; then
347 AC_DEFINE(CONSUMED_TIME_CHECK,5000000,Consumed Time Check)
349 AC_DEFINE_UNQUOTED(CONSUMED_TIME_CHECK,$enable_time_check,Consumed Time Check)
353 case "${enable_systemd}" in
356 AC_CHECK_LIB(systemd, sd_notify, LIBS="$LIBS -lsystemd")
357 if test $ac_cv_lib_systemd_sd_notify = no; then
358 AC_MSG_ERROR([enable systemd has been specified but systemd development env not found on your system])
360 AC_DEFINE(HAVE_SYSTEMD,,Compile systemd support in)
366 if test "${enable_rr_semantics}" != "no" ; then
367 AC_DEFINE(HAVE_V6_RR_SEMANTICS,, Compile in v6 Route Replacement Semantics)
370 if test "${enable_poll}" = "yes" ; then
371 AC_DEFINE(HAVE_POLL,,Compile systemd support in)
377 AC_MSG_CHECKING(whether this OS has MPLS stack)
380 MPLS_METHOD="zebra_mpls_netlink.o"
381 AC_MSG_RESULT(Linux MPLS)
384 MPLS_METHOD="zebra_mpls_openbsd.o"
385 AC_MSG_RESULT(OpenBSD MPLS)
388 MPLS_METHOD="zebra_mpls_null.o"
389 AC_MSG_RESULT(Unsupported kernel)
392 AC_SUBST(MPLS_METHOD)
394 if test "${enable_cumulus}" = "yes" ; then
395 AC_DEFINE(HAVE_CUMULUS,,Compile Special Cumulus Code in)
398 if test "${enable_shell_access}" = "yes"; then
399 AC_DEFINE(HAVE_SHELL_ACCESS,,Allow user to use ssh/telnet/bash)
402 if test "${enable_fpm}" = "yes"; then
403 AC_DEFINE(HAVE_FPM,,Forwarding Plane Manager support)
406 if test "x${enable_dev_build}" = "xyes"; then
407 AC_DEFINE(DEV_BUILD,,Build for development)
409 AM_CONDITIONAL([DEV_BUILD], [test "x$enable_dev_build" = "xyes"])
412 # Logic for protobuf support.
414 if test "$enable_protobuf" = "yes"; then
418 AC_CHECK_PROG([PROTOC_C], [protoc-c], [protoc-c], [/bin/false])
419 if test "x$PROTOC_C" = "x/bin/false"; then
423 PKG_CHECK_MODULES([PROTOBUF_C], libprotobuf-c >= 0.14,
424 [found_protobuf_c=yes],
425 [AC_MSG_RESULT([pkg-config did not find libprotobuf-c])])
427 if test "x$found_protobuf_c" = "xyes"; then
428 LDFLAGS="$LDFLAGS $PROTOBUF_C_LIBS"
429 CFLAGS="$CFLAGS $PROTOBUF_C_CFLAGS"
431 AC_CHECK_HEADER([google/protobuf-c/protobuf-c.h], [],
432 [have_protobuf=no; AC_MSG_RESULT([Couldn't find google/protobuf-c.h])])
437 # Fail if the user explicity enabled protobuf support and we couldn't
438 # find the compiler or libraries.
439 if test "x$have_protobuf" = "xno" && test "x$enable_protobuf" = "xyes"; then
440 AC_MSG_ERROR([Protobuf enabled explicitly but can't find libraries/tools])
443 if test "x$have_protobuf" = "xyes"; then
444 AC_DEFINE(HAVE_PROTOBUF,, protobuf)
447 AM_CONDITIONAL([HAVE_PROTOBUF], [test "x$have_protobuf" = "xyes"])
450 # End of logic for protobuf support.
453 if test "${enable_tcp_zebra}" = "yes"; then
454 AC_DEFINE(HAVE_TCP_ZEBRA,,Use TCP for zebra communication)
457 if test "${enable_linux24_tcp_md5}" = "yes"; then
458 AC_DEFINE(HAVE_TCP_MD5_LINUX24,,Old Linux 2.4 TCP MD5 Signature Patch)
461 AC_MSG_CHECKING(if zebra should be configurable to send Route Advertisements)
462 if test "${enable_rtadv}" != "no"; then
464 AC_DEFINE(HAVE_RTADV,,Enable IPv6 Routing Advertisement support)
469 if test "${enable_irdp}" = "yes"; then
470 AC_DEFINE(HAVE_IRDP,, IRDP )
473 if test "${enable_isisd}" != "no" && test "${enable_isis_topology}" = yes; then
474 AC_DEFINE(TOPOLOGY_GENERATE,,Enable IS-IS topology generator code)
475 ISIS_TOPOLOGY_INCLUDES="-I\$(srcdir)/topology"
476 ISIS_TOPOLOGY_DIR="topology"
477 ISIS_TOPOLOGY_LIB="./topology/libtopology.a"
480 AC_SUBST(ISIS_TOPOLOGY_INCLUDES)
481 AC_SUBST(ISIS_TOPOLOGY_DIR)
482 AC_SUBST(ISIS_TOPOLOGY_LIB)
484 if test x"${enable_user}" = x"no"; then
487 if test x"${enable_user}" = x"yes" || test x"${enable_user}" = x""; then
490 AC_DEFINE_UNQUOTED(QUAGGA_USER, "${enable_user}", Quagga User)
493 if test x"${enable_group}" = x"no"; then
496 if test x"${enable_group}" = x"yes" || test x"${enable_group}" = x""; then
497 enable_group="quagga"
499 AC_DEFINE_UNQUOTED(QUAGGA_GROUP, "${enable_group}", Quagga Group)
502 if test x"${enable_vty_group}" = x"yes" ; then
503 AC_MSG_ERROR([--enable-vty-group requires a group as argument, not yes])
504 elif test x"${enable_vty_group}" != x""; then
505 if test x"${enable_vty_group}" != x"no"; then
506 AC_DEFINE_UNQUOTED(VTY_GROUP, "${enable_vty_group}", VTY Sockets Group)
509 AC_SUBST([enable_user])
510 AC_SUBST([enable_group])
511 AC_SUBST([enable_vty_group])
513 enable_configfile_mask=${enable_configfile_mask:-0600}
514 AC_DEFINE_UNQUOTED(CONFIGFILE_MASK, ${enable_configfile_mask}, Mask for config files)
516 enable_logfile_mask=${enable_logfile_mask:-0600}
517 AC_DEFINE_UNQUOTED(LOGFILE_MASK, ${enable_logfile_mask}, Mask for log files)
521 case "${enable_multipath}" in
525 [[1-9]|[1-9][0-9]|[1-9][0-9][0-9]])
526 MPATH_NUM="${enable_multipath}"
531 AC_MSG_FAILURE([Please specify digit to enable multipath ARG])
535 AC_DEFINE_UNQUOTED(MULTIPATH_NUM, $MPATH_NUM, Maximum number of paths for a route)
537 dnl -----------------------------------
538 dnl Add extra version string to package
539 dnl name, string and version fields.
540 dnl -----------------------------------
541 if test "x${EXTRAVERSION}" != "x" ; then
542 VERSION="${VERSION}${EXTRAVERSION}"
543 PACKAGE_VERSION="${PACKAGE_VERSION}${EXTRAVERSION}"
544 PACKAGE_STRING="${PACKAGE_STRING}${EXTRAVERSION}"
547 if test "x$with_pkg_git_version" = "xyes"; then
548 if test -d "${srcdir}/.git"; then
549 AC_DEFINE(GIT_VERSION, [1], [include git version info])
550 else with_pkg_git_version="no"
551 AC_MSG_WARN([--with-pkg-git-version given, but this is not a git checkout])
554 AM_CONDITIONAL([GIT_VERSION], [test "x$with_pkg_git_version" = "xyes"])
556 dnl ------------------------------------
557 dnl Check C keywords and standard types
558 dnl ------------------------------------
573 dnl -------------------------
574 dnl Check other header files.
575 dnl -------------------------
576 AC_CHECK_HEADERS([stropts.h sys/ksym.h sys/times.h sys/select.h \
577 sys/types.h linux/version.h netdb.h asm/types.h \
578 sys/cdefs.h sys/param.h limits.h signal.h \
579 sys/socket.h netinet/in.h time.h sys/time.h])
581 dnl Utility macro to avoid retyping includes all the time
582 m4_define([QUAGGA_INCLUDES],
585 #define __EXTENSIONS__
597 # include <sys/types.h>
599 /* sys/conf.h depends on param.h on FBSD at least */
601 # include <sys/param.h>
603 /* Required for MAXSIG */
607 #if HAVE_SYS_SOCKET_H
608 # include <sys/socket.h>
611 # define __APPLE_USE_RFC_3542
613 #if HAVE_NETINET_IN_H
614 # include <netinet/in.h>
616 #ifdef TIME_WITH_SYS_TIME
617 # include <sys/time.h>
620 # ifdef HAVE_SYS_TIME_H
621 # include <sys/time.h>
625 #endif /* TIME_WITH_SYS_TIME */
628 dnl HAVE_NET_IF_H must be discovered by the time the longer AC_CHECK_HEADERS
629 dnl round below execution begins, otherwise it doesn't properly detect
630 dnl HAVE_NETINET6_IN6_VAR_H, HAVE_NET_IF_VAR_H and HAVE_STRUCT_IN6_ALIASREQ
631 dnl on FreeBSD (BZ#408).
633 AC_CHECK_HEADERS([net/if.h], [], [], QUAGGA_INCLUDES)
635 m4_define([QUAGGA_INCLUDES],
642 dnl Same applies for HAVE_NET_IF_VAR_H, which HAVE_NETINET6_ND6_H and
643 dnl HAVE_NETINET_IN_VAR_H depend upon. But if_var.h depends on if.h, hence
644 dnl an additional round for it.
646 AC_CHECK_HEADERS([net/if_var.h], [], [], QUAGGA_INCLUDES)
648 m4_define([QUAGGA_INCLUDES],
650 [#if HAVE_NET_IF_VAR_H
651 # include <net/if_var.h>
655 AC_CHECK_HEADERS([sys/un.h netinet/in_systm.h netinet/in_var.h \
656 net/if_dl.h net/netopt.h net/route.h \
657 inet/nd.h arpa/inet.h netinet/ip_icmp.h \
658 fcntl.h stddef.h sys/ioctl.h syslog.h wchar.h wctype.h \
659 sys/sysctl.h sys/sockio.h kvm.h sys/conf.h],
660 [], [], QUAGGA_INCLUDES)
662 AC_CHECK_HEADERS([ucontext.h], [], [],
665 #endif /* __USE_GNU */
669 m4_define([UCONTEXT_INCLUDES],
670 [#include <ucontext.h>])dnl
672 AC_CHECK_MEMBERS([ucontext_t.uc_mcontext.uc_regs],
673 [], [], [UCONTEXT_INCLUDES])
674 AC_CHECK_MEMBERS([ucontext_t.uc_mcontext.regs],
675 [AC_CHECK_MEMBERS([ucontext_t.uc_mcontext.regs.nip],
676 [], [], [UCONTEXT_INCLUDES])],
677 [], [UCONTEXT_INCLUDES])
678 AC_CHECK_MEMBERS([ucontext_t.uc_mcontext.gregs],
679 [], [], [UCONTEXT_INCLUDES])
681 m4_define([QUAGGA_INCLUDES],
686 #if HAVE_NETINET_IN_SYSTM_H
687 # include <netinet/in_systm.h>
689 #if HAVE_NETINET_IN_VAR_H
690 # include <netinet/in_var.h>
693 # include <net/if_dl.h>
695 #if HAVE_NET_NETOPT_H
696 # include <net/netopt.h>
699 # include <net/route.h>
702 # include <inet/nd.h>
705 # include <arpa/inet.h>
707 /* Required for IDRP */
708 #if HAVE_NETINET_IP_ICMP_H
709 # include <netinet/ip_icmp.h>
713 dnl V6 headers are checked below, after we check for v6
715 dnl Some systems (Solaris 2.x) require libnsl (Network Services Library)
717 [*-sunos5.[6-7]*] | [*-solaris2.[6-7]*])
719 AC_DEFINE(SUNOS_56, 1, SunOS 5.6 to 5.7)
720 AC_DEFINE(SUNOS_5, 1, SunOS 5)
721 AC_CHECK_LIB(xnet, main)
726 | [*-sunos5.1[0-9]] \
727 | [*-sunos5.1[0-9].[0-9]] \
728 | [*-solaris2.[8-9]] \
729 | [*-solaris2.1[0-9]] \
730 | [*-solaris2.1[0-9].[0-9]])
732 AC_DEFINE(SUNOS_59, 1, [SunOS 5.8 up])
733 AC_DEFINE(SUNOS_5, 1, [SunOS 5])
734 AC_CHECK_LIB(socket, main)
735 AC_CHECK_LIB(nsl, main)
736 AC_CHECK_LIB(umem, main)
737 AC_CHECK_FUNCS([printstack],
738 [AC_DEFINE([HAVE_PRINTSTACK],1,[Solaris printstack])
739 AC_DEFINE([HAVE_STACK_TRACE],1,[Stack symbols decode functionality])
744 *-sunos5* | *-solaris2*)
745 AC_DEFINE(SUNOS_5,,SunOS 5, Unknown SunOS)
746 AC_CHECK_LIB(socket, main)
747 AC_CHECK_LIB(nsl, main)
753 AC_DEFINE(GNU_LINUX,,GNU Linux)
757 AC_DEFINE(OPEN_BSD,,OpenBSD)
763 dnl ---------------------
764 dnl Integrated VTY option
765 dnl ---------------------
766 case "${enable_vtysh}" in
769 AC_DEFINE(VTYSH,,VTY shell)
770 dnl Vtysh uses libreadline, which looks for termcap functions at
771 dnl configure time. We follow readlines search order.
772 dnl The required procedures are in libtermcap on NetBSD, in
773 dnl [TODO] on Linux, and in [TODO] on Solaris.
774 AC_CHECK_LIB(termcap, tputs, LIBREADLINE="$LIBREADLINE -ltermcap",
775 [AC_CHECK_LIB(tinfo, tputs, LIBREADLINE="$LIBREADLINE -ltinfo",
776 [AC_CHECK_LIB(curses, tputs, LIBREADLINE="$LIBREADLINE -lcurses",
777 [AC_CHECK_LIB(ncurses, tputs,
778 LIBREADLINE="$LIBREADLINE -lncurses")]
782 AC_CHECK_LIB(readline, main, LIBREADLINE="-lreadline $LIBREADLINE",,
784 if test $ac_cv_lib_readline_main = no; then
785 AC_MSG_ERROR([vtysh needs libreadline but was not found and usable on your system.])
787 AC_CHECK_HEADER(readline/history.h)
788 if test $ac_cv_header_readline_history_h = no;then
789 AC_MSG_ERROR([readline is too old to have readline/history.h, please update to the latest readline library.])
791 AC_CHECK_LIB(readline, rl_completion_matches,
792 LIBREADLINE="$LIBREADLINE",, "$LIBREADLINE")
793 if test $ac_cv_lib_readline_rl_completion_matches = no; then
794 AC_DEFINE(rl_completion_matches,completion_matches,Old readline)
798 AC_SUBST(LIBREADLINE)
799 AM_CONDITIONAL(VTYSH, test "x$VTYSH" = "xvtysh")
804 dnl Quagga detects the PAM library it is built against by checking for a
805 dnl functional pam_misc.h (Linux-PAM) or openpam.h (OpenPAM) header. pam_misc.h
806 dnl is known to #include pam_appl.h, the standard header of a PAM library, and
807 dnl openpam.h doesn't do that, although depends on the header too. Hence a
808 dnl little assistance to AC_CHECK_HEADER is necessary for the proper detection
811 if test "$with_libpam" = "yes"; then
812 AC_CHECK_HEADER([security/pam_misc.h],
813 [AC_DEFINE(HAVE_PAM_MISC_H,,Have pam_misc.h)
814 AC_DEFINE(PAM_CONV_FUNC,misc_conv,Have misc_conv)
815 pam_conv_func="misc_conv"
818 AC_CHECK_HEADER([security/openpam.h],
819 [AC_DEFINE(HAVE_OPENPAM_H,,Have openpam.h)
820 AC_DEFINE(PAM_CONV_FUNC,openpam_ttyconv,Have openpam_ttyconv)
821 pam_conv_func="openpam_ttyconv"
823 [], QUAGGA_INCLUDES[#include <security/pam_appl.h>])
824 if test -z "$ac_cv_header_security_pam_misc_h$ac_cv_header_security_openpam_h" ; then
825 AC_MSG_WARN([*** pam support will not be built ***])
830 if test "$with_libpam" = "yes"; then
831 dnl took this test from proftpds configure.in and suited to our needs
832 dnl -------------------------------------------------------------------------
834 dnl This next check looks funky due to a linker problem with some versions
835 dnl of the PAM library. Prior to 0.72 release, the Linux PAM shared library
836 dnl omitted requiring libdl linking information. PAM-0.72 or better ships
837 dnl with RedHat 6.2 and Debian 2.2 or better.
838 AC_CHECK_LIB(pam, pam_start,
839 [AC_CHECK_LIB(pam, $pam_conv_func,
840 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
842 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
843 LIBPAM="-lpam -lpam_misc"]
847 [AC_CHECK_LIB(pam, pam_end,
848 [AC_CHECK_LIB(pam, $pam_conv_func,
849 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
850 LIBPAM="-lpam -ldl"],
851 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
852 LIBPAM="-lpam -ldl -lpam_misc"]
854 ],AC_MSG_WARN([*** pam support will not be built ***]),
861 dnl -------------------------------
862 dnl Endian-ness check
863 dnl -------------------------------
866 dnl -------------------------------
867 dnl check the size in byte of the C
868 dnl -------------------------------
869 dnl AC_CHECK_SIZEOF(char)
870 dnl AC_CHECK_SIZEOF(int)
871 dnl AC_CHECK_SIZEOF(short)
872 dnl AC_CHECK_SIZEOF(long)
874 dnl ----------------------------
875 dnl check existance of functions
876 dnl ----------------------------
884 AC_FUNC_SELECT_ARGTYPES
886 dnl Avoid AC_FUNC_STRNLEN because it pulls in AC_SYSTEM_EXTENSIONS which
887 dnl can lead to strange side effects. So we just check for strnlen
888 dnl directly, see below.
889 dnl AC_FUNC_STRNLENdnl
892 dnl -------------------------------
893 dnl bgpd needs pow() and hence libm
894 dnl -------------------------------
896 AC_CHECK_HEADER([math.h],
897 [AC_CHECK_LIB([m], [pow],
900 AC_DEFINE(HAVE_LIBM,, Have libm)
901 AC_CHECK_FUNCS(pow,[],[LIBM=""])
904 if test x"$LIBM" = x ; then
905 AC_MSG_WARN([Unable to find working pow function - bgpd may not link])
913 AC_CHECK_FUNCS([dup2 ftruncate getcwd gethostbyname getpagesize gettimeofday \
914 inet_ntoa inet_aton strnlen \
915 memchr memmove memset select socket \
916 strcasecmp strchr strcspn strdup strerror \
917 strncasecmp strndup strrchr strspn strstr \
918 strtol strtoul strlcat strlcpy \
919 daemon snprintf vsnprintf \
920 if_nametoindex if_indextoname getifaddrs \
921 uname fcntl getgrouplist pledge])
923 AC_CHECK_HEADER([asm-generic/unistd.h],
924 [AC_CHECK_DECL(__NR_setns,
925 AC_DEFINE(HAVE_NETNS,, Have netns),,
926 QUAGGA_INCLUDES [#include <asm-generic/unistd.h>
928 AC_CHECK_FUNCS(setns, AC_DEFINE(HAVE_SETNS,, Have setns))]
931 dnl ------------------------------------
932 dnl Determine routing get and set method
933 dnl ------------------------------------
934 AC_MSG_CHECKING(zebra between kernel interface method)
935 if test x"$opsys" = x"gnu-linux"; then
936 AC_MSG_RESULT(netlink)
937 RT_METHOD=rt_netlink.o
938 KERNEL_METHOD=kernel_netlink.o
939 AC_DEFINE(HAVE_NETLINK,,netlink)
941 AC_CHECK_DECLS([IFLA_INFO_SLAVE_KIND], [], [], [#include <linux/if_link.h>])
943 AC_MSG_RESULT(Route socket)
944 KERNEL_METHOD="kernel_socket.o"
945 RT_METHOD="rt_socket.o"
948 AC_SUBST(KERNEL_METHOD)
949 AM_CONDITIONAL([HAVE_NETLINK], [test "x$netlink" = "xyes"])
951 dnl --------------------------
952 dnl Determine IS-IS I/O method
953 dnl --------------------------
954 AC_DEFINE(ISIS_METHOD_PFPACKET, 1, [ constant value for isis method pfpacket ])
955 AC_DEFINE(ISIS_METHOD_DLPI, 2, [ constant value for isis method dlpi ])
956 AC_DEFINE(ISIS_METHOD_BPF, 3, [ constant value for isis method bpf ])
957 AC_CHECK_HEADER(net/bpf.h)
958 AC_CHECK_HEADER(sys/dlpi.h)
959 AC_MSG_CHECKING(zebra IS-IS I/O method)
960 if test x"$opsys" = x"gnu-linux"; then
961 AC_MSG_RESULT(pfpacket)
962 ISIS_METHOD_MACRO="ISIS_METHOD_PFPACKET"
963 elif test x"$opsys" = x"sol2-6" -o x"$opsys" = x"sol8"; then
965 ISIS_METHOD_MACRO="ISIS_METHOD_DLPI"
967 if test $ac_cv_header_net_bpf_h = no; then
968 if test $ac_cv_header_sys_dlpi_h = no; then
970 AC_MSG_WARN([*** IS-IS support will not be built ***])
975 ISIS_METHOD_MACRO="ISIS_METHOD_DLPI"
978 ISIS_METHOD_MACRO="ISIS_METHOD_BPF"
981 AC_DEFINE_UNQUOTED(ISIS_METHOD, $ISIS_METHOD_MACRO, [ selected method for isis, == one of the constants ])
983 dnl ------------------------------------
984 dnl check for broken CMSG_FIRSTHDR macro
985 dnl ------------------------------------
986 AC_MSG_CHECKING(for broken CMSG_FIRSTHDR)
987 AC_RUN_IFELSE([AC_LANG_SOURCE([[
990 #define __EXTENSIONS__
995 #ifdef HAVE_SYS_TYPES_H
996 #include <sys/types.h>
998 #ifdef HAVE_SYS_SOCKET_H
999 #include <sys/socket.h>
1007 msg.msg_control = buf;
1008 msg.msg_controllen = 0;
1010 if (CMSG_FIRSTHDR(&msg) != NULL)
1013 }]])],[AC_MSG_RESULT(yes - using workaround) AC_DEFINE(HAVE_BROKEN_CMSG_FIRSTHDR,,Broken CMSG_FIRSTHDR)],
1014 [AC_MSG_RESULT(no)],[AC_MSG_RESULT(no)])
1016 dnl ------------------------------
1017 dnl check kernel route read method
1018 dnl ------------------------------
1019 AC_CACHE_CHECK([route read method], [quagga_cv_rtread_method],
1020 [if test "x$netlink" = xyes; then
1021 quagga_cv_rtread_method="netlink"
1023 for quagga_cv_rtread_method in /dev/ip /dev/null;
1025 test x`ls $quagga_cv_rtread_method 2>/dev/null` = x"$quagga_cv_rtread_method" && break
1027 case $quagga_cv_rtread_method in
1030 *-freebsd*) quagga_cv_rtread_method="sysctl";;
1031 *) quagga_cv_rtread_method="getmsg";;
1034 quagga_cv_rtread_method="sysctl";;
1037 RTREAD_METHOD=rtread_${quagga_cv_rtread_method}.o
1038 AC_SUBST(RTREAD_METHOD)
1040 dnl -----------------------------
1041 dnl check interface lookup method
1042 dnl -----------------------------
1043 IOCTL_METHOD=ioctl.o
1044 AC_MSG_CHECKING(interface looking up method)
1045 if test "$netlink" = yes; then
1046 AC_MSG_RESULT(netlink)
1047 IF_METHOD=if_netlink.o
1048 elif test "$opsys" = "sol2-6";then
1049 AC_MSG_RESULT(Solaris GIF)
1050 IF_METHOD=if_ioctl.o
1051 elif test "$opsys" = "sol8";then
1052 AC_MSG_RESULT(Solaris GLIF)
1053 IF_METHOD=if_ioctl_solaris.o
1054 IOCTL_METHOD=ioctl_solaris.o
1055 elif test "$opsys" = "openbsd";then
1056 AC_MSG_RESULT(openbsd)
1057 IF_METHOD=if_ioctl.o
1058 elif grep NET_RT_IFLIST /usr/include/sys/socket.h >/dev/null 2>&1; then
1059 AC_MSG_RESULT(sysctl)
1060 IF_METHOD=if_sysctl.o
1061 AC_DEFINE(HAVE_NET_RT_IFLIST,,NET_RT_IFLIST)
1063 AC_MSG_RESULT(ioctl)
1064 IF_METHOD=if_ioctl.o
1067 AC_SUBST(IOCTL_METHOD)
1069 dnl ---------------------------------------------------------------
1070 dnl figure out how to specify an interface in multicast sockets API
1071 dnl ---------------------------------------------------------------
1072 AC_CHECK_MEMBERS([struct ip_mreqn.imr_ifindex], [], [], QUAGGA_INCLUDES)
1074 AC_CHECK_HEADERS([linux/mroute.h], [], [],[
1075 #ifdef HAVE_SYS_SOCKET_H
1076 # include <sys/socket.h>
1078 #ifdef HAVE_NETINET_IN_H
1079 # include <netinet/in.h>
1081 #define _LINUX_IN_H /* For Linux <= 2.6.25 */
1082 #include <linux/types.h>
1085 m4_define([QUAGGA_INCLUDES],
1087 [#if HAVE_LINUX_MROUTE_H
1088 # include <linux/mroute.h>
1092 AC_CHECK_HEADERS([netinet/ip_mroute.h], [], [],[
1093 #ifdef HAVE_SYS_SOCKET_H
1094 # include <sys/socket.h>
1096 #ifdef HAVE_SYS_TYPES_H
1097 # include <sys/types.h>
1099 #ifdef HAVE_NETINET_IN_H
1100 # include <netinet/in.h>
1102 #ifdef HAVE_NET_ROUTE_H
1103 # include <net/route.h>
1107 m4_define([QUAGGA_INCLUDES],
1109 [#if HAVE_NETINET_IP_MROUTE_H
1110 # include <netinet/ip_mroute.h>
1114 AC_MSG_CHECKING([for BSD struct ip_mreq hack])
1115 AC_TRY_COMPILE([#ifdef HAVE_SYS_PARAM_H
1116 #include <sys/param.h>
1117 #endif],[#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)
1120 #error No support for BSD struct ip_mreq hack detected
1121 #endif],[AC_MSG_RESULT(yes)
1122 AC_DEFINE(HAVE_BSD_STRUCT_IP_MREQ_HACK,,[Can pass ifindex in struct ip_mreq])],
1125 AC_MSG_CHECKING([for RFC3678 protocol-independed API])
1127 #include <sys/types.h>
1128 #include <netinet/in.h>
1129 ], [struct group_req gr; int sock; setsockopt(sock, IPPROTO_IP, MCAST_JOIN_GROUP, (void*)&gr, sizeof(gr));
1130 ], [AC_MSG_RESULT(yes)
1131 AC_DEFINE(HAVE_RFC3678,1,[Have RFC3678 protocol-independed API])],
1134 dnl ---------------------------------------------------------------
1135 dnl figure out how to check link-state
1136 dnl ---------------------------------------------------------------
1137 AC_CHECK_HEADER([net/if.h],
1138 [AC_CHECK_HEADER( [net/if_media.h],
1139 [m4_define([LINK_DETECT_INCLUDES],
1141 [#include <net/if_media.h>
1143 AC_CHECK_MEMBERS( [struct ifmediareq.ifm_status],
1144 AC_DEFINE(HAVE_BSD_LINK_DETECT,,[BSD link-detect]),
1145 [], LINK_DETECT_INCLUDES)],
1148 [], QUAGGA_INCLUDES )
1150 dnl ---------------------------------------------------------------
1151 dnl Additional, newer way to check link-state using ifi_link_state.
1152 dnl Not available in all BSD's when ifmediareq available
1153 dnl ---------------------------------------------------------------
1154 AC_CHECK_HEADER([net/if.h],
1155 AC_CHECK_MEMBERS([struct if_data.ifi_link_state],
1156 AC_DEFINE(HAVE_BSD_IFI_LINK_STATE,,[BSD ifi_link_state available]),
1157 [], QUAGGA_INCLUDES),
1160 dnl ------------------------
1161 dnl TCP_MD5SIG socket option
1162 dnl ------------------------
1164 AC_CHECK_HEADER([netinet/tcp.h],
1165 [m4_define([MD5_INCLUDES],
1167 [#include <netinet/tcp.h>
1169 AC_CHECK_DECLS([TCP_MD5SIG], [], [], MD5_INCLUDES)],
1172 if test $ac_cv_have_decl_TCP_MD5SIG = no; then
1173 AC_CHECK_HEADER([linux/tcp.h],
1174 [m4_define([MD5_INCLUDES],
1176 [#include <linux/tcp.h>
1178 AC_CHECK_DECLS([TCP_MD5SIG], [], [], MD5_INCLUDES)])
1181 dnl -----------------------------
1182 dnl check ipforward detect method
1183 dnl -----------------------------
1184 AC_CACHE_CHECK([ipforward method], [quagga_cv_ipforward_method],
1185 [if test x$cross_compiling = xyes; then
1186 if test x"$opsys" = x"gnu-linux"; then
1187 quagga_cv_ipforward_method=/proc/net/snmp
1189 quagga_cv_ipforward_method=/dev/ip
1192 for quagga_cv_ipforward_method in /proc/net/snmp /dev/ip /dev/null;
1194 test x`ls $quagga_cv_ipforward_method 2>/dev/null` = x"$quagga_cv_ipforward_method" && break
1197 case $quagga_cv_ipforward_method in
1198 "/proc/net/snmp") quagga_cv_ipforward_method="proc";;
1201 *-freebsd*) quagga_cv_ipforward_method="sysctl";;
1202 *) quagga_cv_ipforward_method="solaris";;
1204 *) quagga_cv_ipforward_method="sysctl";;
1206 IPFORWARD=ipforward_${quagga_cv_ipforward_method}.o
1209 AC_CHECK_FUNCS(getaddrinfo, [have_getaddrinfo=yes], [have_getaddrinfo=no])
1211 dnl ----------------------------------------------------------------------------
1212 dnl figure out if domainname is available in the utsname struct (GNU extension).
1213 dnl ----------------------------------------------------------------------------
1214 AC_CHECK_MEMBERS([struct utsname.domainname], [], [], [#include <sys/utsname.h>])
1219 AC_MSG_CHECKING(whether does this OS have IPv6 stack)
1223 if grep WIDE /usr/include/netinet6/in6.h >/dev/null 2>&1; then
1224 AC_DEFINE(KAME,1,KAME IPv6)
1226 dnl ------------------------------------
1227 dnl Solaris 9, 10 and potentially higher
1228 dnl ------------------------------------
1229 elif test x"$opsys" = x"sol8"; then
1230 AC_DEFINE(SOLARIS_IPV6, 1, Solaris IPv6)
1231 AC_MSG_RESULT(Solaris IPv6)
1235 elif test x"$opsys" = x"gnu-linux"; then
1236 AC_DEFINE(LINUX_IPV6,1,Linux IPv6 stack)
1237 dnl Linux has a compilation problem with mixing
1238 dnl netinet/in.h and linux/in6.h they are not
1239 dnl compatible. There has been discussion on
1240 dnl how to fix it but no real progress on implementation
1241 dnl when they fix it, remove this
1242 AC_DEFINE(IPV6_MINHOPCOUNT, 73, Linux ipv6 Min Hop Count)
1243 AC_MSG_RESULT(Linux IPv6)
1245 AC_MSG_ERROR([Failed to detect IPv6 stack])
1248 dnl this is unconditial, for compatibility
1249 AC_DEFINE(HAVE_IPV6,1,IPv6)
1251 dnl ------------------
1252 dnl IPv6 header checks
1253 dnl ------------------
1254 AC_CHECK_HEADERS([netinet6/in6.h netinet/in6_var.h netinet/icmp6.h \
1255 netinet6/in6_var.h netinet6/nd6.h], [], [],
1258 m4_define([QUAGGA_INCLUDES],dnl
1260 [#if HAVE_NETINET6_IN6_H
1261 #include <netinet6/in6.h>
1263 #if HAVE_NETINET_IN6_VAR_H
1264 #include <netinet/in6_var.h>
1266 #if HAVE_NETINET_ICMP6_H
1267 # include <netinet/icmp6.h>
1269 #if HAVE_NETINET6_IN6_VAR_H
1270 # include <netinet6/in6_var.h>
1272 #if HAVE_NETINET6_ND6_H
1273 # include <netinet6/nd6.h>
1277 dnl disable doc check
1278 if test "${enable_doc}" = "no";then
1284 dnl --------------------
1285 dnl Daemon disable check
1286 dnl --------------------
1287 if test "${enable_zebra}" = "no";then
1292 AM_CONDITIONAL(ZEBRA, test "x$ZEBRA" = "xzebra")
1294 if test "${enable_bgpd}" = "no";then
1299 AM_CONDITIONAL(BGPD, test "x$BGPD" = "xbgpd")
1301 if test "${enable_ripd}" = "no";then
1306 AM_CONDITIONAL(RIPD, test "x$RIPD" = "xripd")
1308 if test "${enable_ospfd}" = "no";then
1313 AM_CONDITIONAL(OSPFD, test "x$OSPFD" = "xospfd")
1315 if test "${enable_ldpd}" = "yes";then
1320 AM_CONDITIONAL(LDPD, test "x$LDPD" = "xldpd")
1322 if test "${enable_watchquagga}" = "no";then
1325 WATCHQUAGGA="watchquagga"
1327 AM_CONDITIONAL(WATCHQUAGGA, test "x$WATCHQUAGGA" = "xwatchquagga")
1330 if test "${enable_ospfapi}" != "no";then
1331 AC_DEFINE(SUPPORT_OSPF_API,,OSPFAPI)
1333 if test "${enable_ospfclient}" != "no";then
1334 OSPFCLIENT="ospfclient"
1338 AM_CONDITIONAL(OSPFCLIENT, test "x$OSPFCLIENT" = "xospfclient")
1340 case "${enable_ripngd}" in
1342 * ) RIPNGD="ripngd";;
1344 AM_CONDITIONAL(RIPNGD, test "x$RIPNGD" = "xripngd")
1346 case "${enable_ospf6d}" in
1348 * ) OSPF6D="ospf6d";;
1350 AM_CONDITIONAL(OSPF6D, test "x$OSPF6D" = "xospf6d")
1352 case "${enable_isisd}" in
1356 AM_CONDITIONAL(ISISD, test "x$ISISD" = "xisisd")
1358 case "${enable_pimd}" in
1362 AM_CONDITIONAL(PIMD, test "x$PIMD" = "xpimd")
1364 if test "${enable_bgp_announce}" = "no";then
1365 AC_DEFINE(DISABLE_BGP_ANNOUNCE,1,Disable BGP installation to zebra)
1367 AC_DEFINE(DISABLE_BGP_ANNOUNCE,0,Disable BGP installation to zebra)
1370 if test "${with_rfp_path}" = "yes" || test x"${with_rfp_path}" = x""; then
1371 with_rfp_path="bgpd/rfp-example"
1373 if test "${with_rfp_path}" != "no"; then
1374 VNC_RFP_PATH="${with_rfp_path}"
1375 AC_SUBST(VNC_RFP_PATH)
1378 if test "${enable_bgp_vnc}" != "no";then
1379 AC_DEFINE(ENABLE_BGP_VNC,1,Enable BGP VNC support)
1380 RFPTEST="${with_rfp_path}/rfptest"
1381 LIBRFP="${with_rfp_path}/librfp"
1382 RFPINC="${with_rfp_path}/librfp"
1386 RFPINC="bgpd/rfp-example/librfp"
1389 AM_CONDITIONAL([ENABLE_BGP_VNC], [test x${enable_bgp_vnc} != xno])
1402 AC_SUBST(WATCHQUAGGA)
1408 AC_SUBST(OSPFCLIENT)
1410 AC_CHECK_LIB(c, inet_ntop, [AC_DEFINE(HAVE_INET_NTOP,,inet_ntop)])
1411 AC_CHECK_LIB(c, inet_pton, [AC_DEFINE(HAVE_INET_PTON,,inet_pton)])
1412 AC_CHECK_LIB(crypt, crypt)
1413 AC_CHECK_LIB(resolv, res_init)
1415 dnl ---------------------------
1416 dnl check system has PCRE regexp
1417 dnl ---------------------------
1418 if test "x$enable_pcreposix" = "xyes"; then
1419 AC_CHECK_LIB(pcreposix, pcreposix_regexec, ,[enable_pcreposix=no
1420 AC_MSG_WARN([*** falling back to other regex library ***]) ])
1423 if test "x$enable_pcreposix" != "xyes"; then
1424 dnl ---------------------------
1425 dnl check system has GNU regexp
1426 dnl ---------------------------
1427 AC_MSG_CHECKING(whether system has GNU regex)
1428 AC_CHECK_LIB(c, regexec,
1429 [AC_DEFINE(HAVE_GNU_REGEX,,GNU regexp library)
1431 [LIB_REGEX="regex.o"])
1433 AC_SUBST(HAVE_LIBPCREPOSIX)
1436 dnl ------------------
1437 dnl check Net-SNMP library
1438 dnl ------------------
1439 if test "${enable_snmp}" != ""; then
1440 AC_PATH_TOOL([NETSNMP_CONFIG], [net-snmp-config], [no])
1441 if test x"$NETSNMP_CONFIG" = x"no"; then
1442 AC_MSG_ERROR([--enable-snmp given but unable to find net-snmp-config])
1444 LIBS="$LIBS `${NETSNMP_CONFIG} --agent-libs`"
1445 CFLAGS="`${NETSNMP_CONFIG} --base-cflags` $CFLAGS"
1446 AC_MSG_CHECKING([whether we can link to Net-SNMP])
1447 AC_LINK_IFELSE([AC_LANG_PROGRAM([
1454 ])],[AC_MSG_RESULT(yes)],[
1456 AC_MSG_ERROR([--enable-snmp given but not usable])])
1457 AC_DEFINE(HAVE_SNMP,,SNMP)
1458 case "${enable_snmp}" in
1463 SNMP_METHOD="${enable_snmp}"
1466 AC_MSG_ERROR([--enable-snmp given with an unknown method (${enable_snmp}). Use smux or agentx])
1469 AH_TEMPLATE([SNMP_SMUX], [Use SNMP SMUX to interface with snmpd])
1470 AH_TEMPLATE([SNMP_AGENTX], [Use SNMP AgentX to interface with snmpd])
1471 AC_DEFINE_UNQUOTED(AS_TR_CPP(SNMP_${SNMP_METHOD}),,SNMP method to interface with snmpd)
1474 dnl ---------------------------
1475 dnl sockaddr and netinet checks
1476 dnl ---------------------------
1477 AC_CHECK_TYPES([struct sockaddr, struct sockaddr_in,
1478 struct sockaddr_in6, struct sockaddr_un, struct sockaddr_dl,
1479 socklen_t, struct vifctl, struct mfcctl, struct sioc_sg_req,
1480 vifi_t, struct sioc_vif_req, struct igmpmsg,
1481 struct ifaliasreq, struct if6_aliasreq, struct in6_aliasreq,
1482 struct nd_opt_adv_interval, struct rt_addrinfo,
1483 struct nd_opt_homeagent_info, struct nd_opt_adv_interval],
1484 [], [], QUAGGA_INCLUDES)
1486 AC_CHECK_MEMBERS([struct sockaddr.sa_len,
1487 struct sockaddr_in.sin_len, struct sockaddr_un.sun_len,
1488 struct sockaddr_in6.sin6_scope_id,
1489 struct sockaddr_dl.sdl_len,
1490 struct if6_aliasreq.ifra_lifetime,
1491 struct nd_opt_adv_interval.nd_opt_ai_type],
1492 [], [], QUAGGA_INCLUDES)
1494 dnl ---------------------------
1495 dnl IRDP/pktinfo/icmphdr checks
1496 dnl ---------------------------
1497 AC_CHECK_TYPES([struct in_pktinfo],
1498 [AC_CHECK_TYPES([struct icmphdr],
1499 [if test "${enable_irdp}" != "no"; then
1500 AC_DEFINE(HAVE_IRDP,, IRDP)
1502 [if test "${enable_irdp}" = "yes"; then
1503 AC_MSG_ERROR(['IRDP requires in_pktinfo at the moment!'])
1504 fi], [QUAGGA_INCLUDES])],
1505 [if test "${enable_irdp}" = "yes"; then
1506 AC_MSG_ERROR(['IRDP requires in_pktinfo at the moment!'])
1507 fi], [QUAGGA_INCLUDES])
1509 dnl -----------------------
1510 dnl checking for IP_PKTINFO
1511 dnl -----------------------
1512 AC_MSG_CHECKING(for IP_PKTINFO)
1513 AC_TRY_COMPILE([#include <netdb.h>], [
1514 int opt = IP_PKTINFO;
1517 AC_DEFINE(HAVE_IP_PKTINFO, 1, [Have IP_PKTINFO])
1522 dnl ---------------------------
1523 dnl checking for IP_RECVDSTADDR
1524 dnl ---------------------------
1525 AC_MSG_CHECKING(for IP_RECVDSTADDR)
1526 AC_TRY_COMPILE([#include <netinet/in.h>], [
1527 int opt = IP_RECVDSTADDR;
1530 AC_DEFINE(HAVE_IP_RECVDSTADDR, 1, [Have IP_RECVDSTADDR])
1535 dnl ----------------------
1536 dnl checking for IP_RECVIF
1537 dnl ----------------------
1538 AC_MSG_CHECKING(for IP_RECVIF)
1539 AC_TRY_COMPILE([#include <netinet/in.h>], [
1540 int opt = IP_RECVIF;
1543 AC_DEFINE(HAVE_IP_RECVIF, 1, [Have IP_RECVIF])
1548 dnl ----------------------
1549 dnl checking for SO_BINDANY
1550 dnl ----------------------
1551 AC_MSG_CHECKING(for SO_BINDANY)
1552 AC_TRY_COMPILE([#include <sys/socket.h>], [
1553 int opt = SO_BINDANY;
1556 AC_DEFINE(HAVE_SO_BINDANY, 1, [Have SO_BINDANY])
1561 dnl ----------------------
1562 dnl checking for IP_FREEBIND
1563 dnl ----------------------
1564 AC_MSG_CHECKING(for IP_FREEBIND)
1565 AC_TRY_COMPILE([#include <netinet/in.h>], [
1566 int opt = IP_FREEBIND;
1569 AC_DEFINE(HAVE_IP_FREEBIND, 1, [Have IP_FREEBIND])
1574 dnl --------------------------------------
1575 dnl checking for getrusage struct and call
1576 dnl --------------------------------------
1577 if test "${enable_rusage}" != "no"; then
1578 AC_MSG_CHECKING(whether getrusage is available)
1579 AC_TRY_COMPILE([#include <sys/resource.h>],[struct rusage ac_x; getrusage (RUSAGE_SELF, &ac_x);],
1581 AC_DEFINE(HAVE_RUSAGE,,rusage)],
1585 dnl --------------------------------------
1586 dnl checking for clock_time monotonic struct and call
1587 dnl --------------------------------------
1588 AC_CHECK_DECL(CLOCK_MONOTONIC,
1589 [AC_CHECK_LIB(rt, clock_gettime, [LIBS="$LIBS -lrt"])
1590 AC_DEFINE(HAVE_CLOCK_MONOTONIC,, Have monotonic clock)
1591 ], [AC_MSG_RESULT(no)], [QUAGGA_INCLUDES])
1593 dnl --------------------------------------
1594 dnl checking for flex and bison
1595 dnl --------------------------------------
1597 if test "x$LEX" != xflex; then
1598 LEX="$SHELL $missing_dir/missing flex"
1599 AC_SUBST([LEX_OUTPUT_ROOT], [lex.yy])
1600 AC_SUBST([LEXLIB], [''])
1604 dnl -------------------
1605 dnl capabilities checks
1606 dnl -------------------
1607 if test "${enable_capabilities}" != "no"; then
1608 AC_MSG_CHECKING(whether prctl PR_SET_KEEPCAPS is available)
1609 AC_TRY_COMPILE([#include <sys/prctl.h>],[prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0);],
1611 AC_DEFINE(HAVE_PR_SET_KEEPCAPS,,prctl)
1612 quagga_ac_keepcaps="yes"],
1615 if test x"${quagga_ac_keepcaps}" = x"yes"; then
1616 AC_CHECK_HEADERS(sys/capability.h)
1618 if test x"${ac_cv_header_sys_capability_h}" = x"yes"; then
1619 AC_CHECK_LIB(cap, cap_init,
1620 [AC_DEFINE(HAVE_LCAPS,1,Capabilities)
1622 quagga_ac_lcaps="yes"]
1625 AC_CHECK_HEADERS(priv.h,
1626 [AC_MSG_CHECKING(Solaris style privileges are available)
1627 AC_TRY_COMPILE([#include <priv.h>],[getpflags(PRIV_AWARE);],
1629 AC_DEFINE(HAVE_SOLARIS_CAPABILITIES,1,getpflags)
1630 quagga_ac_scaps="yes"],
1636 if test x"${quagga_ac_scaps}" = x"yes" \
1637 -o x"${quagga_ac_lcaps}" = x"yes"; then
1638 AC_DEFINE(HAVE_CAPABILITIES,1,capabilities)
1643 dnl ---------------------------
1644 dnl check for glibc 'backtrace'
1645 dnl ---------------------------
1646 if test x"${enable_backtrace}" != x"no" ; then
1648 AC_CHECK_HEADER([execinfo.h], [
1649 AC_SEARCH_LIBS([backtrace], [execinfo], [
1650 AC_DEFINE(HAVE_GLIBC_BACKTRACE,,[Glibc backtrace])
1651 AC_DEFINE(HAVE_STACK_TRACE,,[Stack symbol decoding])
1656 if test x"${enable_backtrace}" = x"yes" -a x"${backtrace_ok}" = x"no"; then
1657 dnl user explicitly requested backtrace but we failed to find support
1658 AC_MSG_FAILURE([failed to find backtrace support])
1662 dnl -----------------------------------------
1663 dnl check for malloc mallinfo struct and call
1664 dnl this must try and link using LIBS, in
1665 dnl order to check no alternative allocator
1666 dnl has been specified, which might not provide
1667 dnl mallinfo, e.g. such as Umem on Solaris.
1668 dnl -----------------------------------------
1669 AC_CHECK_HEADER([malloc.h],
1670 [AC_MSG_CHECKING(whether mallinfo is available)
1671 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <malloc.h>]],
1672 [[struct mallinfo ac_x; ac_x = mallinfo ();]])],
1674 AC_DEFINE(HAVE_MALLINFO,,mallinfo)],
1677 ], [], QUAGGA_INCLUDES)
1682 CONFDATE=`date '+%Y%m%d'`
1688 if test x"$DEJAGNU" = x
1690 DEJAGNU="\$(top_srcdir)/tests/global-conf.exp"
1692 RUNTESTDEFAULTFLAGS="-x --tool \$\$tool"
1695 AC_SUBST(RUNTESTDEFAULTFLAGS)
1697 dnl ------------------------------
1698 dnl set paths for state directory
1699 dnl ------------------------------
1700 AC_MSG_CHECKING(directory to use for state file)
1701 if test "${prefix}" = "NONE"; then
1702 quagga_statedir_prefix="";
1704 quagga_statedir_prefix=${prefix}
1706 if test "${localstatedir}" = '${prefix}/var'; then
1707 for QUAGGA_STATE_DIR in ${quagga_statedir_prefix}/var/run dnl
1708 ${quagga_statedir_prefix}/var/adm dnl
1709 ${quagga_statedir_prefix}/etc dnl
1715 test -d $QUAGGA_STATE_DIR && break
1717 quagga_statedir=$QUAGGA_STATE_DIR
1719 quagga_statedir=${localstatedir}
1721 if test $quagga_statedir = "/dev/null"; then
1722 AC_MSG_ERROR('STATE DIRECTORY NOT FOUND! FIX OR SPECIFY --localstatedir!')
1724 AC_MSG_RESULT(${quagga_statedir})
1725 AC_SUBST(quagga_statedir)
1727 AC_DEFINE_UNQUOTED(PATH_ZEBRA_PID, "$quagga_statedir/zebra.pid",zebra PID)
1728 AC_DEFINE_UNQUOTED(PATH_RIPD_PID, "$quagga_statedir/ripd.pid",ripd PID)
1729 AC_DEFINE_UNQUOTED(PATH_RIPNGD_PID, "$quagga_statedir/ripngd.pid",ripngd PID)
1730 AC_DEFINE_UNQUOTED(PATH_BGPD_PID, "$quagga_statedir/bgpd.pid",bgpd PID)
1731 AC_DEFINE_UNQUOTED(PATH_OSPFD_PID, "$quagga_statedir/ospfd.pid",ospfd PID)
1732 AC_DEFINE_UNQUOTED(PATH_OSPF6D_PID, "$quagga_statedir/ospf6d.pid",ospf6d PID)
1733 AC_DEFINE_UNQUOTED(PATH_LDPD_PID, "$quagga_statedir/ldpd.pid",ldpd PID)
1734 AC_DEFINE_UNQUOTED(LDPD_SOCKET, "$quagga_statedir/ldpd.sock",ldpd control socket)
1735 AC_DEFINE_UNQUOTED(PATH_ISISD_PID, "$quagga_statedir/isisd.pid",isisd PID)
1736 AC_DEFINE_UNQUOTED(PATH_PIMD_PID, "$quagga_statedir/pimd.pid",pimd PID)
1737 AC_DEFINE_UNQUOTED(PATH_WATCHQUAGGA_PID, "$quagga_statedir/watchquagga.pid",watchquagga PID)
1738 AC_DEFINE_UNQUOTED(ZEBRA_SERV_PATH, "$quagga_statedir/zserv.api",zebra api socket)
1739 AC_DEFINE_UNQUOTED(ZEBRA_VTYSH_PATH, "$quagga_statedir/zebra.vty",zebra vty socket)
1740 AC_DEFINE_UNQUOTED(RIP_VTYSH_PATH, "$quagga_statedir/ripd.vty",rip vty socket)
1741 AC_DEFINE_UNQUOTED(RIPNG_VTYSH_PATH, "$quagga_statedir/ripngd.vty",ripng vty socket)
1742 AC_DEFINE_UNQUOTED(BGP_VTYSH_PATH, "$quagga_statedir/bgpd.vty",bgpd vty socket)
1743 AC_DEFINE_UNQUOTED(OSPF_VTYSH_PATH, "$quagga_statedir/ospfd.vty",ospfd vty socket)
1744 AC_DEFINE_UNQUOTED(OSPF6_VTYSH_PATH, "$quagga_statedir/ospf6d.vty",ospf6d vty socket)
1745 AC_DEFINE_UNQUOTED(LDP_VTYSH_PATH, "$quagga_statedir/ldpd.vty",ldpd vty socket)
1746 AC_DEFINE_UNQUOTED(ISIS_VTYSH_PATH, "$quagga_statedir/isisd.vty",isisd vty socket)
1747 AC_DEFINE_UNQUOTED(PIM_VTYSH_PATH, "$quagga_statedir/pimd.vty",pimd vty socket)
1748 AC_DEFINE_UNQUOTED(DAEMON_VTY_DIR, "$quagga_statedir",daemon vty directory)
1750 dnl -------------------------------
1751 dnl Quagga sources should always be
1752 dnl current wrt interfaces. Dont
1753 dnl allow deprecated interfaces to
1755 dnl -------------------------------
1756 AC_DEFINE(QUAGGA_NO_DEPRECATED_INTERFACES, 1, Hide deprecated interfaces)
1758 dnl ---------------------------
1759 dnl Check htonl works correctly
1760 dnl ---------------------------
1761 AC_MSG_CHECKING(for working htonl)
1762 AC_CACHE_VAL(ac_cv_htonl_works,
1763 [AC_LINK_IFELSE([AC_LANG_PROGRAM([QUAGGA_INCLUDES],[htonl (0);])],
1764 [ac_cv_htonl_works=yes], [ac_cv_htonl_works=no])
1767 AC_MSG_RESULT($ac_cv_htonl_works)
1769 AC_CONFIG_FILES([Makefile lib/Makefile qpb/Makefile zebra/Makefile ripd/Makefile
1770 ripngd/Makefile bgpd/Makefile ospfd/Makefile watchquagga/Makefile
1771 ospf6d/Makefile ldpd/Makefile isisd/Makefile vtysh/Makefile
1772 doc/Makefile ospfclient/Makefile tests/Makefile m4/Makefile
1774 tests/bgpd.tests/Makefile
1775 tests/libzebra.tests/Makefile
1784 isisd/topology/Makefile
1785 pkgsrc/bgpd.sh pkgsrc/ospf6d.sh pkgsrc/ospfd.sh
1786 pkgsrc/ripd.sh pkgsrc/ripngd.sh pkgsrc/zebra.sh])
1788 if test "${enable_bgp_vnc}" != "no"; then
1789 if test "${with_rfp_path}" = "bgpd/rfp-example" ; then
1790 AC_CONFIG_FILES([bgpd/rfp-example/rfptest/Makefile bgpd/rfp-example/librfp/Makefile])
1792 AC_CONFIG_FILES([${with_rfp_path}/rfptest/Makefile ${with_rfp_path}/librfp/Makefile])
1796 AC_CONFIG_FILES([solaris/Makefile])
1798 AC_CONFIG_FILES([vtysh/extract.pl],[chmod +x vtysh/extract.pl])
1800 ## Hack, but working solution to avoid rebuilding of quagga.info.
1801 ## It's already in CVS until texinfo 4.7 is more common.
1805 Quagga configuration
1806 --------------------
1807 quagga version : ${PACKAGE_VERSION}
1808 host operating system : ${host_os}
1809 source code location : ${srcdir}
1811 compiler flags : ${CFLAGS}
1813 linker flags : ${LDFLAGS} ${LIBS} ${LIBCAP} ${LIBREADLINE} ${LIBM}
1814 state file directory : ${quagga_statedir}
1815 config file directory : `eval echo \`echo ${sysconfdir}\``
1816 example directory : `eval echo \`echo ${exampledir}\``
1817 user to run as : ${enable_user}
1818 group to run as : ${enable_group}
1819 group for vty sockets : ${enable_vty_group}
1820 config file mask : ${enable_configfile_mask}
1821 log file mask : ${enable_logfile_mask}
1822 zebra protobuf enabled : ${have_protobuf:-no}
1824 The above user and group must have read/write access to the state file
1825 directory and to the config files in the config file directory."
1827 if test x"$quagga_cv_gnu_make" = x"no"; then echo "
1828 Warning: The ${MAKE-make} programme detected, either in your path or
1829 via the MAKE variable, is not GNU Make. GNU make may be installed as
1830 gmake on some systems. and is required to complete a build of Quagga