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+cl3u2, [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 -----------------------------------
24 AM_SILENT_RULES([yes])
25 AC_CONFIG_HEADERS(config.h)
27 AC_PATH_PROG(PERL, perl)
28 AC_CHECK_PROG([GAWK],[gawk],[gawk],[not-in-PATH])
29 if test "x$GAWK" = "xnot-in-PATH" ; then
30 AC_MSG_ERROR([GNU awk is required for lib/memtype.h made by memtypes.awk.
31 BSD awk complains: awk: gensub doesn't support backreferences (subst "\1") ])
33 AC_ARG_VAR([GAWK],[GNU AWK])
35 dnl default is to match previous behavior
36 exampledir=${sysconfdir}
37 AC_ARG_ENABLE([exampledir],
38 AS_HELP_STRING([--enable-exampledir],
39 [specify alternate directory for examples]),
40 exampledir="$enableval",)
41 dnl XXX add --exampledir to autoconf standard directory list somehow
44 dnl default is to match previous behavior
47 AC_ARG_ENABLE([pkgsrcrcdir],
48 AS_HELP_STRING([--enable-pkgsrcrcdir],
49 [specify directory for rc.d scripts]),
50 pkgsrcrcdir="$enableval"; pkgsrcdir="pkgsrc",)
51 dnl XXX add --pkgsrcrcdir to autoconf standard directory list somehow
55 LIBS="$LIBS -L/usr/include/json/ -ljson-c"
61 [ --with-cflags Set CFLAGS for use in compilation.])
62 if test "x$with_cflags" != "x" ; then
63 CFLAGS="$with_cflags" ; cflags_specified=yes ;
64 elif test -n "$CFLAGS" ; then
65 cflags_specified=yes ;
68 AC_ARG_ENABLE(tcmalloc,
69 [ --enable-tcmalloc Turn on tcmalloc],
70 [case "${enableval}" in
71 yes) tcmalloc_enabled=true
72 LIBS="$LIBS -ltcmalloc_minimal"
74 no) tcmalloc_enabled=false ;;
75 *) AC_MSG_ERROR(bad value ${enableval} for --enable-tcmalloc) ;;
76 esac],[tcmalloc_enabled=false])
79 dnl --------------------
80 dnl Check CC and friends
81 dnl --------------------
89 dnl autoconf 2.59 appears not to support AC_PROG_SED
91 AC_CHECK_PROG([SED],[sed],[sed],[/bin/false])
93 dnl pdflatex and latexmk are needed to build HACKING.pdf
94 AC_CHECK_PROG([PDFLATEX],[pdflatex],[pdflatex],[/bin/false])
95 AC_CHECK_PROG([LATEXMK],[latexmk],[latexmk],[/bin/false])
96 if test "x$PDFLATEX" = "x/bin/false" -o "x$LATEXMK" = "x/bin/false"; then
97 AC_MSG_WARN([Will not be able to make PDF versions of TeX documents])
101 AM_CONDITIONAL([HAVE_LATEX], [test "x$HAVE_LATEX" = "xtrue"])
103 dnl ------------------------------------------------------------------
104 dnl Intel compiler check. Although Intel tries really hard to make icc
105 dnl look like gcc, there are some differences. It's very verbose with
106 dnl -Wall and it doesn't support the individual -W options.
107 dnl ------------------------------------------------------------------
108 if test "x${GCC}" = "xyes" ; then
110 AC_MSG_CHECKING([whether we are using the Intel compiler])
111 AC_EGREP_CPP([^__INTEL_COMPILER], [__INTEL_COMPILER],
112 [AC_MSG_RESULT([no])],
114 AC_MSG_RESULT([yes])]
117 AC_MSG_CHECKING([whether we are using SunPro compiler])
118 AC_EGREP_CPP([^__SUNPRO_C.*0x5(7|8|9)], ["__SUNPRO_C" __SUNPRO_C],
119 [AC_MSG_RESULT([no])],
121 AC_MSG_RESULT([yes])]
125 dnl ---------------------------------------------
126 dnl If CLFAGS doesn\'t exist set default value
127 dnl AC_PROG_CC will have set minimal default
128 dnl already, eg "-O2 -g" for gcc, "-g" for others
129 dnl (Wall is gcc specific... have to make sure
130 dnl gcc is being used before setting it)
132 dnl Intel icc 8.0 also sets __GNUC__,
133 dnl but doesn't support all these fancy -W options.
134 dnl Intel compiler warnings we ignore:
135 dnl 279: controlling expression is constant.
136 dnl 869: parameter "xxx" was never referenced - to avoid massive warnings
137 dnl about "self", "vty", "argc" and "argv" never referenced in DEFUN
139 dnl 981: operands are evaluated in unspecified order.
141 dnl Sun Studio 10 / SunPro 5.7 is also supported,
142 dnl so lets set some sane CFLAGS for it.
143 dnl ---------------------------------------------
145 AC_MSG_CHECKING([whether to set a default CFLAGS])
146 if test "x${cflags_specified}" = "x" ; then
149 CFLAGS="-Os -g -Wall"
150 AC_MSG_RESULT([Intel default])
153 CFLAGS="-Os -fno-omit-frame-pointer -g -std=gnu99 -Wall"
154 CFLAGS="${CFLAGS} -Wsign-compare -Wpointer-arith"
155 CFLAGS="${CFLAGS} -Wbad-function-cast -Wwrite-strings"
156 CFLAGS="${CFLAGS} -Wmissing-prototypes -Wmissing-declarations"
157 CFLAGS="${CFLAGS} -Wchar-subscripts -Wcast-qual"
158 # TODO: conditionally addd -Wpacked if handled
159 AC_MSG_RESULT([gcc default])
162 CFLAGS="-xO4 -v -g -xspace -xcode=pic32 -xstrconst -xc99"
163 AC_MSG_RESULT([SunPro default])
166 AC_MSG_RESULT([unknown compiler])
170 AC_MSG_RESULT([CFLAGS supplied by user])
173 if test x"${enable_werror}" = x"yes" ; then
184 AC_CHECK_TOOL(AR, ar)
186 dnl ---------------------------
187 dnl We, perhaps unfortunately,
188 dnl depend on GNU Make specific
190 dnl Give the user a warning if
192 dnl ---------------------------
193 AC_CACHE_CHECK([if ${MAKE-make} is GNU make], [quagga_cv_gnu_make],
194 [quagga_cv_gnu_make=no
195 if ${MAKE-make} --version 2>/dev/null | \
196 grep '^GNU Make ' >/dev/null ; then
197 quagga_cv_gnu_make=yes;
202 dnl -----------------
203 dnl System extensions
204 dnl -----------------
212 dnl ----------------------
213 dnl Packages configuration
214 dnl ----------------------
215 AC_ARG_WITH(pkg-extra-version,
216 AS_HELP_STRING([--with-pkg-extra-version=VER], [add extra version field, for packagers/distributions]),
217 [EXTRAVERSION=$withval],)
218 AC_ARG_WITH(pkg-git-version,
219 AS_HELP_STRING([--with-pkg-git-version], [add git information to MOTD and build version string]),
220 [ test "x$withval" != "xno" && with_pkg_git_version="yes" ])
222 AS_HELP_STRING([--disable-vtysh], [do not build integrated vty shell for Quagga]))
224 AS_HELP_STRING([--disable-doc], [do not build docs]))
226 AS_HELP_STRING([--disable-zebra], [do not build zebra daemon]))
228 AS_HELP_STRING([--disable-bgpd], [do not build bgpd]))
230 AS_HELP_STRING([--disable-ripd], [do not build ripd]))
231 AC_ARG_ENABLE(ripngd,
232 AS_HELP_STRING([--disable-ripngd], [do not build ripngd]))
234 AS_HELP_STRING([--disable-ospfd], [do not build ospfd]))
235 AC_ARG_ENABLE(ospf6d,
236 AS_HELP_STRING([--disable-ospf6d], [do not build ospf6d]))
237 AC_ARG_ENABLE(watchquagga,
238 AS_HELP_STRING([--disable-watchquagga], [do not build watchquagga]))
240 AS_HELP_STRING([--disable-isisd], [do not build isisd]))
242 AS_HELP_STRING([--disable-pimd], [do not build pimd]))
243 AC_ARG_ENABLE(bgp-announce,
244 AS_HELP_STRING([--disable-bgp-announce,], [turn off BGP route announcement]))
246 AS_HELP_STRING([--enable-snmp=ARG], [enable SNMP support (smux or agentx)]))
248 AS_HELP_STRING([--with-libpam], [use libpam for PAM support in vtysh]))
249 AC_ARG_ENABLE(tcp-zebra,
250 AS_HELP_STRING([--enable-tcp-zebra], [enable TCP/IP socket connection between zebra and protocol daemon]))
251 AC_ARG_ENABLE(opaque-lsa,
252 AS_HELP_STRING([--disable-opaque-lsa],[do not build OSPF Opaque-LSA with OSPFAPI support (RFC2370)]))
253 AC_ARG_ENABLE(ospfapi,
254 AS_HELP_STRING([--disable-ospfapi], [do not build OSPFAPI to access the OSPF LSA Database]))
255 AC_ARG_ENABLE(ospfclient,
256 AS_HELP_STRING([--disable-ospfclient], [do not build OSPFAPI client for OSPFAPI,
257 (this is the default if --disable-ospfapi is set)]))
258 AC_ARG_ENABLE(ospf-te,
259 AS_HELP_STRING([--disable-ospf-te],[disable Traffic Engineering Extension to OSPF]))
260 AC_ARG_ENABLE(multipath,
261 AS_HELP_STRING([--enable-multipath=ARG], [enable multipath function, ARG must be digit]))
263 AS_HELP_STRING([--enable-user=USER], [user to run Quagga suite as (default quagga)]))
265 AS_HELP_STRING([--enable-group=GROUP], [group to run Quagga suite as (default quagga)]))
266 AC_ARG_ENABLE(vty_group,
267 AS_HELP_STRING([--enable-vty-group=ARG], [set vty sockets to have specified group as owner]))
268 AC_ARG_ENABLE(configfile_mask,
269 AS_HELP_STRING([--enable-configfile-mask=ARG], [set mask for config files]))
270 AC_ARG_ENABLE(logfile_mask,
271 AS_HELP_STRING([--enable-logfile-mask=ARG], [set mask for log files]))
272 AC_ARG_ENABLE(shell_access,
273 AS_HELP_STRING([--enable-shell-access], [Allow users to access shell/telnet/ssh]))
275 AS_HELP_STRING([--disable-rtadv], [disable IPV6 router advertisement feature]))
277 AS_HELP_STRING([--enable-irdp], [enable IRDP server support in zebra]))
278 AC_ARG_ENABLE(isis_topology,
279 AS_HELP_STRING([--enable-isis-topology], [enable IS-IS topology generator]))
280 AC_ARG_ENABLE(capabilities,
281 AS_HELP_STRING([--disable-capabilities], [disable using POSIX capabilities]))
282 AC_ARG_ENABLE(rusage,
283 AS_HELP_STRING([--disable-rusage], [disable using getrusage]))
284 AC_ARG_ENABLE(gcc_ultra_verbose,
285 AS_HELP_STRING([--enable-gcc-ultra-verbose], [enable ultra verbose GCC warnings]))
286 AC_ARG_ENABLE(linux24_tcp_md5,
287 AS_HELP_STRING([--enable-linux24-tcp-md5], [enable support for old, Linux-2.4 RFC2385 patch]))
288 AC_ARG_ENABLE(gcc-rdynamic,
289 AS_HELP_STRING([--enable-gcc-rdynamic], [enable linking with -rdynamic for better backtraces (default if gcc)]))
290 AC_ARG_ENABLE(backtrace,
291 AS_HELP_STRING([--disable-backtrace,], [disable crash backtraces (default autodetect)]))
292 AC_ARG_ENABLE(time-check,
293 AS_HELP_STRING([--disable-time-check], [disable slow thread warning messages]))
294 AC_ARG_ENABLE(pcreposix,
295 AS_HELP_STRING([--enable-pcreposix], [enable using PCRE Posix libs for regex functions]))
297 AS_HELP_STRING([--enable-fpm], [enable Forwarding Plane Manager support]))
298 AC_ARG_ENABLE(systemd,
299 AS_HELP_STRING([--enable-systemd], [enable Systemd support]))
301 AS_HELP_STRING([--enable-poll], [enable usage of Poll instead of select]))
302 AC_ARG_ENABLE(werror,
303 AS_HELP_STRING([--enable-werror], [enable -Werror (recommended for developers only)]))
304 AC_ARG_ENABLE(cumulus,
305 AS_HELP_STRING([--enable-cumulus], [enable Cumulus Switch Special Extensions]))
307 if test x"${enable_gcc_ultra_verbose}" = x"yes" ; then
308 CFLAGS="${CFLAGS} -W -Wcast-qual -Wstrict-prototypes"
309 CFLAGS="${CFLAGS} -Wmissing-declarations -Wmissing-noreturn"
310 CFLAGS="${CFLAGS} -Wmissing-format-attribute -Wunreachable-code"
311 CFLAGS="${CFLAGS} -Wpacked -Wpadded"
314 if test x"${enable_gcc_rdynamic}" != x"no" ; then
315 if test x"${enable_gcc_rdynamic}" = x"yes" -o x"$COMPILER" = x"GCC"; then
316 LDFLAGS="${LDFLAGS} -rdynamic"
320 if test x"${enable_time_check}" != x"no" ; then
321 if test x"${enable_time_check}" = x"yes" -o x"${enable_time_check}" = x ; then
322 AC_DEFINE(CONSUMED_TIME_CHECK,5000000,Consumed Time Check)
324 AC_DEFINE_UNQUOTED(CONSUMED_TIME_CHECK,$enable_time_check,Consumed Time Check)
328 if test "${enable_systemd}" = "yes" ; then
329 AC_DEFINE(HAVE_SYSTEMD,,Compile systemd support in)
330 LIBS="$LIBS -lsystemd "
333 if test "${enable_poll}" = "yes" ; then
334 AC_DEFINE(HAVE_POLL,,Compile systemd support in)
337 if test "${enable_cumulus}" = "yes" ; then
338 AC_DEFINE(HAVE_CUMULUS,,Compile Special Cumulus Code in)
341 if test "${enable_shell_access}" = "yes"; then
342 AC_DEFINE(HAVE_SHELL_ACCESS,,Allow user to use ssh/telnet/bash)
345 if test "${enable_fpm}" = "yes"; then
346 AC_DEFINE(HAVE_FPM,,Forwarding Plane Manager support)
349 if test "${enable_tcp_zebra}" = "yes"; then
350 AC_DEFINE(HAVE_TCP_ZEBRA,,Use TCP for zebra communication)
353 if test "${enable_opaque_lsa}" != "no"; then
354 AC_DEFINE(HAVE_OPAQUE_LSA,,OSPF Opaque LSA)
357 if test "${enable_ospf_te}" != "no"; then
358 AC_DEFINE(HAVE_OPAQUE_LSA,,OSPF Opaque LSA)
359 AC_DEFINE(HAVE_OSPF_TE,,OSPF TE)
362 if test "${enable_linux24_tcp_md5}" = "yes"; then
363 AC_DEFINE(HAVE_TCP_MD5_LINUX24,,Old Linux 2.4 TCP MD5 Signature Patch)
366 AC_MSG_CHECKING(if zebra should be configurable to send Route Advertisements)
367 if test "${enable_rtadv}" != "no"; then
369 AC_DEFINE(HAVE_RTADV,,Enable IPv6 Routing Advertisement support)
374 if test "${enable_irdp}" = "yes"; then
375 AC_DEFINE(HAVE_IRDP,, IRDP )
378 if test "${enable_isisd}" != "no" && test "${enable_isis_topology}" = yes; then
379 AC_DEFINE(TOPOLOGY_GENERATE,,Enable IS-IS topology generator code)
380 ISIS_TOPOLOGY_INCLUDES="-I\$(srcdir)/topology"
381 ISIS_TOPOLOGY_DIR="topology"
382 ISIS_TOPOLOGY_LIB="./topology/libtopology.a"
385 AC_SUBST(ISIS_TOPOLOGY_INCLUDES)
386 AC_SUBST(ISIS_TOPOLOGY_DIR)
387 AC_SUBST(ISIS_TOPOLOGY_LIB)
389 if test "${enable_user}" = "yes" || test x"${enable_user}" = x""; then
391 elif test "${enable_user}" = "no"; then
395 if test "${enable_group}" = "yes" || test x"${enable_group}" = x""; then
396 enable_group="quagga"
397 elif test "${enable_group}" = "no"; then
401 if test x"${enable_vty_group}" = x"yes" ; then
402 AC_MSG_ERROR([--enable-vty-group requires a group as argument, not yes])
403 elif test x"${enable_vty_group}" != x""; then
404 if test x"${enable_vty_group}" != x"no"; then
405 AC_DEFINE_UNQUOTED(VTY_GROUP, "${enable_vty_group}", VTY Sockets Group)
408 AC_SUBST([enable_user])
409 AC_SUBST([enable_group])
410 AC_SUBST([enable_vty_group])
411 AC_DEFINE_UNQUOTED(QUAGGA_USER, "${enable_user}", Quagga User)
412 AC_DEFINE_UNQUOTED(QUAGGA_GROUP, "${enable_group}", Quagga Group)
414 enable_configfile_mask=${enable_configfile_mask:-0600}
415 AC_DEFINE_UNQUOTED(CONFIGFILE_MASK, ${enable_configfile_mask}, Mask for config files)
417 enable_logfile_mask=${enable_logfile_mask:-0600}
418 AC_DEFINE_UNQUOTED(LOGFILE_MASK, ${enable_logfile_mask}, Mask for log files)
422 case "${enable_multipath}" in
426 [[1-9]|[1-9][0-9]|[1-9][0-9][0-9]])
427 MPATH_NUM="${enable_multipath}"
432 AC_MSG_FAILURE([Please specify digit to enable multipath ARG])
436 AC_DEFINE_UNQUOTED(MULTIPATH_NUM, $MPATH_NUM, Maximum number of paths for a route)
438 dnl -----------------------------------
439 dnl Add extra version string to package
440 dnl name, string and version fields.
441 dnl -----------------------------------
442 if test "x${EXTRAVERSION}" != "x" ; then
443 VERSION="${VERSION}${EXTRAVERSION}"
444 PACKAGE_VERSION="${PACKAGE_VERSION}${EXTRAVERSION}"
445 PACKAGE_STRING="${PACKAGE_STRING}${EXTRAVERSION}"
448 if test "x$with_pkg_git_version" = "xyes"; then
449 if test -d "${srcdir}/.git"; then
450 AC_DEFINE(GIT_VERSION, [1], [include git version info])
451 else with_pkg_git_version="no"
452 AC_MSG_WARN([--with-pkg-git-version given, but this is not a git checkout])
455 AM_CONDITIONAL([GIT_VERSION], [test "x$with_pkg_git_version" = "xyes"])
457 dnl ------------------------------------
458 dnl Check C keywords and standard types
459 dnl ------------------------------------
475 dnl -------------------------
476 dnl Check other header files.
477 dnl -------------------------
478 AC_CHECK_HEADERS([stropts.h sys/ksym.h sys/times.h sys/select.h \
479 sys/types.h linux/version.h netdb.h asm/types.h \
480 sys/cdefs.h sys/param.h limits.h signal.h \
481 sys/socket.h netinet/in.h time.h sys/time.h])
483 dnl Utility macro to avoid retyping includes all the time
484 m4_define([QUAGGA_INCLUDES],
487 #define __EXTENSIONS__
499 # include <sys/types.h>
501 /* sys/conf.h depends on param.h on FBSD at least */
503 # include <sys/param.h>
505 /* Required for MAXSIG */
509 #if HAVE_SYS_SOCKET_H
510 # include <sys/socket.h>
513 # define __APPLE_USE_RFC_3542
515 #if HAVE_NETINET_IN_H
516 # include <netinet/in.h>
518 #ifdef TIME_WITH_SYS_TIME
519 # include <sys/time.h>
522 # ifdef HAVE_SYS_TIME_H
523 # include <sys/time.h>
527 #endif /* TIME_WITH_SYS_TIME */
530 dnl HAVE_NET_IF_H must be discovered by the time the longer AC_CHECK_HEADERS
531 dnl round below execution begins, otherwise it doesn't properly detect
532 dnl HAVE_NETINET6_IN6_VAR_H, HAVE_NET_IF_VAR_H and HAVE_STRUCT_IN6_ALIASREQ
533 dnl on FreeBSD (BZ#408).
535 AC_CHECK_HEADERS([net/if.h], [], [], QUAGGA_INCLUDES)
537 m4_define([QUAGGA_INCLUDES],
544 dnl Same applies for HAVE_NET_IF_VAR_H, which HAVE_NETINET6_ND6_H and
545 dnl HAVE_NETINET_IN_VAR_H depend upon. But if_var.h depends on if.h, hence
546 dnl an additional round for it.
548 AC_CHECK_HEADERS([net/if_var.h], [], [], QUAGGA_INCLUDES)
550 m4_define([QUAGGA_INCLUDES],
552 [#if HAVE_NET_IF_VAR_H
553 # include <net/if_var.h>
557 AC_CHECK_HEADERS([sys/un.h netinet/in_systm.h netinet/in_var.h \
558 net/if_dl.h net/netopt.h net/route.h \
559 inet/nd.h arpa/inet.h netinet/ip_icmp.h \
560 fcntl.h stddef.h sys/ioctl.h syslog.h wchar.h wctype.h \
561 sys/sysctl.h sys/sockio.h kvm.h sys/conf.h],
562 [], [], QUAGGA_INCLUDES)
564 AC_CHECK_HEADERS([ucontext.h], [], [],
567 #endif /* __USE_GNU */
571 m4_define([UCONTEXT_INCLUDES],
572 [#include <ucontext.h>])dnl
574 AC_CHECK_MEMBERS([ucontext_t.uc_mcontext.uc_regs],
575 [], [], [UCONTEXT_INCLUDES])
576 AC_CHECK_MEMBERS([ucontext_t.uc_mcontext.regs],
577 [AC_CHECK_MEMBERS([ucontext_t.uc_mcontext.regs.nip],
578 [], [], [UCONTEXT_INCLUDES])],
579 [], [UCONTEXT_INCLUDES])
580 AC_CHECK_MEMBERS([ucontext_t.uc_mcontext.gregs],
581 [], [], [UCONTEXT_INCLUDES])
583 m4_define([QUAGGA_INCLUDES],
588 #if HAVE_NETINET_IN_SYSTM_H
589 # include <netinet/in_systm.h>
591 #if HAVE_NETINET_IN_VAR_H
592 # include <netinet/in_var.h>
595 # include <net/if_dl.h>
597 #if HAVE_NET_NETOPT_H
598 # include <net/netopt.h>
601 # include <net/route.h>
604 # include <inet/nd.h>
607 # include <arpa/inet.h>
609 /* Required for IDRP */
610 #if HAVE_NETINET_IP_ICMP_H
611 # include <netinet/ip_icmp.h>
615 dnl V6 headers are checked below, after we check for v6
617 dnl Some systems (Solaris 2.x) require libnsl (Network Services Library)
619 [*-sunos5.[6-7]*] | [*-solaris2.[6-7]*])
621 AC_DEFINE(SUNOS_56, 1, SunOS 5.6 to 5.7)
622 AC_DEFINE(SUNOS_5, 1, SunOS 5)
623 AC_CHECK_LIB(xnet, main)
628 | [*-sunos5.1[0-9]] \
629 | [*-sunos5.1[0-9].[0-9]] \
630 | [*-solaris2.[8-9]] \
631 | [*-solaris2.1[0-9]] \
632 | [*-solaris2.1[0-9].[0-9]])
634 AC_DEFINE(SUNOS_59, 1, [SunOS 5.8 up])
635 AC_DEFINE(SUNOS_5, 1, [SunOS 5])
636 AC_CHECK_LIB(socket, main)
637 AC_CHECK_LIB(nsl, main)
638 AC_CHECK_LIB(umem, main)
639 AC_CHECK_FUNCS([printstack],
640 [AC_DEFINE([HAVE_PRINTSTACK],1,[Solaris printstack])
641 AC_DEFINE([HAVE_STACK_TRACE],1,[Stack symbols decode functionality])
646 *-sunos5* | *-solaris2*)
647 AC_DEFINE(SUNOS_5,,SunOS 5, Unknown SunOS)
648 AC_CHECK_LIB(socket, main)
649 AC_CHECK_LIB(nsl, main)
655 AC_DEFINE(GNU_LINUX,,GNU Linux)
659 AC_DEFINE(OPEN_BSD,,OpenBSD)
665 dnl ---------------------
666 dnl Integrated VTY option
667 dnl ---------------------
668 case "${enable_vtysh}" in
671 AC_DEFINE(VTYSH,,VTY shell)
672 dnl Vtysh uses libreadline, which looks for termcap functions at
673 dnl configure time. We follow readlines search order.
674 dnl The required procedures are in libtermcap on NetBSD, in
675 dnl [TODO] on Linux, and in [TODO] on Solaris.
676 AC_CHECK_LIB(termcap, tputs, LIBREADLINE="$LIBREADLINE -ltermcap",
677 [AC_CHECK_LIB(tinfo, tputs, LIBREADLINE="$LIBREADLINE -ltinfo",
678 [AC_CHECK_LIB(curses, tputs, LIBREADLINE="$LIBREADLINE -lcurses",
679 [AC_CHECK_LIB(ncurses, tputs,
680 LIBREADLINE="$LIBREADLINE -lncurses")]
684 AC_CHECK_LIB(readline, main, LIBREADLINE="$LIBREADLINE -lreadline",,
686 if test $ac_cv_lib_readline_main = no; then
687 AC_MSG_ERROR([vtysh needs libreadline but was not found and usable on your system.])
689 AC_CHECK_HEADER(readline/history.h)
690 if test $ac_cv_header_readline_history_h = no;then
691 AC_MSG_ERROR([readline is too old to have readline/history.h, please update to the latest readline library.])
693 AC_CHECK_LIB(readline, rl_completion_matches,
694 LIBREADLINE="$LIBREADLINE",, "$LIBREADLINE")
695 if test $ac_cv_lib_readline_rl_completion_matches = no; then
696 AC_DEFINE(rl_completion_matches,completion_matches,Old readline)
701 AC_SUBST(LIBREADLINE)
702 AM_CONDITIONAL(VTYSH, test "x$VTYSH" = "xvtysh")
707 dnl Quagga detects the PAM library it is built against by checking for a
708 dnl functional pam_misc.h (Linux-PAM) or openpam.h (OpenPAM) header. pam_misc.h
709 dnl is known to #include pam_appl.h, the standard header of a PAM library, and
710 dnl openpam.h doesn't do that, although depends on the header too. Hence a
711 dnl little assistance to AC_CHECK_HEADER is necessary for the proper detection
714 if test "$with_libpam" = "yes"; then
715 AC_CHECK_HEADER([security/pam_misc.h],
716 [AC_DEFINE(HAVE_PAM_MISC_H,,Have pam_misc.h)
717 AC_DEFINE(PAM_CONV_FUNC,misc_conv,Have misc_conv)
718 pam_conv_func="misc_conv"
721 AC_CHECK_HEADER([security/openpam.h],
722 [AC_DEFINE(HAVE_OPENPAM_H,,Have openpam.h)
723 AC_DEFINE(PAM_CONV_FUNC,openpam_ttyconv,Have openpam_ttyconv)
724 pam_conv_func="openpam_ttyconv"
726 [], QUAGGA_INCLUDES[#include <security/pam_appl.h>])
727 if test -z "$ac_cv_header_security_pam_misc_h$ac_cv_header_security_openpam_h" ; then
728 AC_MSG_WARN([*** pam support will not be built ***])
733 if test "$with_libpam" = "yes"; then
734 dnl took this test from proftpds configure.in and suited to our needs
735 dnl -------------------------------------------------------------------------
737 dnl This next check looks funky due to a linker problem with some versions
738 dnl of the PAM library. Prior to 0.72 release, the Linux PAM shared library
739 dnl omitted requiring libdl linking information. PAM-0.72 or better ships
740 dnl with RedHat 6.2 and Debian 2.2 or better.
741 AC_CHECK_LIB(pam, pam_start,
742 [AC_CHECK_LIB(pam, $pam_conv_func,
743 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
745 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
746 LIBPAM="-lpam -lpam_misc"]
750 [AC_CHECK_LIB(pam, pam_end,
751 [AC_CHECK_LIB(pam, $pam_conv_func,
752 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
753 LIBPAM="-lpam -ldl"],
754 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
755 LIBPAM="-lpam -ldl -lpam_misc"]
757 ],AC_MSG_WARN([*** pam support will not be built ***]),
764 dnl -------------------------------
765 dnl Endian-ness check
766 dnl -------------------------------
769 dnl -------------------------------
770 dnl check the size in byte of the C
771 dnl -------------------------------
772 dnl AC_CHECK_SIZEOF(char)
773 dnl AC_CHECK_SIZEOF(int)
774 dnl AC_CHECK_SIZEOF(short)
775 dnl AC_CHECK_SIZEOF(long)
777 dnl ----------------------------
778 dnl check existance of functions
779 dnl ----------------------------
787 AC_FUNC_SELECT_ARGTYPES
789 dnl Avoid AC_FUNC_STRNLEN because it pulls in AC_SYSTEM_EXTENSIONS which
790 dnl can lead to strange side effects. So we just check for strnlen
791 dnl directly, see below.
792 dnl AC_FUNC_STRNLENdnl
795 dnl -------------------------------
796 dnl bgpd needs pow() and hence libm
797 dnl -------------------------------
799 AC_CHECK_HEADER([math.h],
800 [AC_CHECK_LIB([m], [pow],
803 AC_DEFINE(HAVE_LIBM,, Have libm)
804 AC_CHECK_FUNCS(pow,[],[LIBM=""])
807 if test x"$LIBM" = x ; then
808 AC_MSG_WARN([Unable to find working pow function - bgpd may not link])
816 AC_CHECK_FUNCS([dup2 ftruncate getcwd gethostbyname getpagesize gettimeofday \
817 inet_ntoa inet_aton strnlen \
818 memchr memmove memset select socket \
819 strcasecmp strchr strcspn strdup strerror \
820 strncasecmp strndup strrchr strspn strstr \
821 strtol strtoul strlcat strlcpy \
822 daemon snprintf vsnprintf \
823 if_nametoindex if_indextoname getifaddrs \
824 uname fcntl getgrouplist])
826 dnl ------------------------------------
827 dnl Determine routing get and set method
828 dnl ------------------------------------
829 AC_MSG_CHECKING(zebra between kernel interface method)
830 if test x"$opsys" = x"gnu-linux"; then
831 AC_MSG_RESULT(netlink)
832 RT_METHOD=rt_netlink.o
833 AC_DEFINE(HAVE_NETLINK,,netlink)
835 AC_CHECK_DECLS([IFLA_INFO_SLAVE_KIND], [], [], [#include <linux/if_link.h>])
837 AC_MSG_RESULT(Route socket)
838 KERNEL_METHOD="kernel_socket.o"
839 RT_METHOD="rt_socket.o"
842 AC_SUBST(KERNEL_METHOD)
843 AM_CONDITIONAL([HAVE_NETLINK], [test "x$netlink" = "xyes"])
845 dnl --------------------------
846 dnl Determine IS-IS I/O method
847 dnl --------------------------
848 AC_DEFINE(ISIS_METHOD_PFPACKET, 1, [ constant value for isis method pfpacket ])
849 AC_DEFINE(ISIS_METHOD_DLPI, 2, [ constant value for isis method dlpi ])
850 AC_DEFINE(ISIS_METHOD_BPF, 3, [ constant value for isis method bpf ])
851 AC_CHECK_HEADER(net/bpf.h)
852 AC_CHECK_HEADER(sys/dlpi.h)
853 AC_MSG_CHECKING(zebra IS-IS I/O method)
854 if test x"$opsys" = x"gnu-linux"; then
855 AC_MSG_RESULT(pfpacket)
856 ISIS_METHOD_MACRO="ISIS_METHOD_PFPACKET"
857 elif test x"$opsys" = x"sol2-6" -o x"$opsys" = x"sol8"; then
859 ISIS_METHOD_MACRO="ISIS_METHOD_DLPI"
861 if test $ac_cv_header_net_bpf_h = no; then
862 if test $ac_cv_header_sys_dlpi_h = no; then
864 AC_MSG_WARN([*** IS-IS support will not be built ***])
869 ISIS_METHOD_MACRO="ISIS_METHOD_DLPI"
872 ISIS_METHOD_MACRO="ISIS_METHOD_BPF"
875 AC_DEFINE_UNQUOTED(ISIS_METHOD, $ISIS_METHOD_MACRO, [ selected method for isis, == one of the constants ])
877 dnl ------------------------------------
878 dnl check for broken CMSG_FIRSTHDR macro
879 dnl ------------------------------------
880 AC_MSG_CHECKING(for broken CMSG_FIRSTHDR)
881 AC_RUN_IFELSE([AC_LANG_SOURCE([[
884 #define __EXTENSIONS__
889 #ifdef HAVE_SYS_TYPES_H
890 #include <sys/types.h>
892 #ifdef HAVE_SYS_SOCKET_H
893 #include <sys/socket.h>
901 msg.msg_control = buf;
902 msg.msg_controllen = 0;
904 if (CMSG_FIRSTHDR(&msg) != NULL)
907 }]])],[AC_MSG_RESULT(yes - using workaround) AC_DEFINE(HAVE_BROKEN_CMSG_FIRSTHDR,,Broken CMSG_FIRSTHDR)],
908 [AC_MSG_RESULT(no)],[AC_MSG_RESULT(no)])
910 dnl ------------------------------
911 dnl check kernel route read method
912 dnl ------------------------------
913 AC_CACHE_CHECK([route read method], [quagga_cv_rtread_method],
914 [if test "x$netlink" = xyes; then
915 quagga_cv_rtread_method="netlink"
917 for quagga_cv_rtread_method in /dev/ip /dev/null;
919 test x`ls $quagga_cv_rtread_method 2>/dev/null` = x"$quagga_cv_rtread_method" && break
921 case $quagga_cv_rtread_method in
924 *-freebsd*) quagga_cv_rtread_method="sysctl";;
925 *) quagga_cv_rtread_method="getmsg";;
928 quagga_cv_rtread_method="sysctl";;
931 RTREAD_METHOD=rtread_${quagga_cv_rtread_method}.o
932 AC_SUBST(RTREAD_METHOD)
934 dnl -----------------------------
935 dnl check interface lookup method
936 dnl -----------------------------
938 AC_MSG_CHECKING(interface looking up method)
939 if test "$netlink" = yes; then
940 AC_MSG_RESULT(netlink)
941 IF_METHOD=if_netlink.o
942 elif test "$opsys" = "sol2-6";then
943 AC_MSG_RESULT(Solaris GIF)
945 elif test "$opsys" = "sol8";then
946 AC_MSG_RESULT(Solaris GLIF)
947 IF_METHOD=if_ioctl_solaris.o
948 IOCTL_METHOD=ioctl_solaris.o
949 elif test "$opsys" = "openbsd";then
950 AC_MSG_RESULT(openbsd)
952 elif grep NET_RT_IFLIST /usr/include/sys/socket.h >/dev/null 2>&1; then
953 AC_MSG_RESULT(sysctl)
954 IF_METHOD=if_sysctl.o
955 AC_DEFINE(HAVE_NET_RT_IFLIST,,NET_RT_IFLIST)
961 AC_SUBST(IOCTL_METHOD)
963 dnl ---------------------------------------------------------------
964 dnl figure out how to specify an interface in multicast sockets API
965 dnl ---------------------------------------------------------------
966 AC_CHECK_MEMBERS([struct ip_mreqn.imr_ifindex], [], [], QUAGGA_INCLUDES)
968 AC_CHECK_HEADERS([linux/mroute.h], [], [],
970 #if HAVE_NETINET_IN_H
971 #include<netinet/in.h>
973 AC_MSG_CHECKING([for BSD struct ip_mreq hack])
974 AC_TRY_COMPILE([#ifdef HAVE_SYS_PARAM_H
975 #include <sys/param.h>
976 #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)
979 #error No support for BSD struct ip_mreq hack detected
980 #endif],[AC_MSG_RESULT(yes)
981 AC_DEFINE(HAVE_BSD_STRUCT_IP_MREQ_HACK,,[Can pass ifindex in struct ip_mreq])],
984 AC_MSG_CHECKING([for RFC3678 protocol-independed API])
986 #include <sys/types.h>
987 #include <netinet/in.h>
988 ], [struct group_req gr; int sock; setsockopt(sock, IPPROTO_IP, MCAST_JOIN_GROUP, (void*)&gr, sizeof(gr));
989 ], [AC_MSG_RESULT(yes)
990 AC_DEFINE(HAVE_RFC3678,1,[Have RFC3678 protocol-independed API])],
993 dnl ---------------------------------------------------------------
994 dnl figure out how to check link-state
995 dnl ---------------------------------------------------------------
996 AC_CHECK_HEADER([net/if.h],
997 [AC_CHECK_HEADER( [net/if_media.h],
998 [m4_define([LINK_DETECT_INCLUDES],
1000 [#include <net/if_media.h>
1002 AC_CHECK_MEMBERS( [struct ifmediareq.ifm_status],
1003 AC_DEFINE(HAVE_BSD_LINK_DETECT,,[BSD link-detect]),
1004 [], LINK_DETECT_INCLUDES)],
1007 [], QUAGGA_INCLUDES )
1009 dnl ---------------------------------------------------------------
1010 dnl Additional, newer way to check link-state using ifi_link_state.
1011 dnl Not available in all BSD's when ifmediareq available
1012 dnl ---------------------------------------------------------------
1013 AC_CHECK_HEADER([net/if.h],
1014 AC_CHECK_MEMBERS([struct if_data.ifi_link_state],
1015 AC_DEFINE(HAVE_BSD_IFI_LINK_STATE,,[BSD ifi_link_state available]),
1016 [], QUAGGA_INCLUDES),
1019 dnl ------------------------
1020 dnl TCP_MD5SIG socket option
1021 dnl ------------------------
1023 AC_CHECK_HEADER([netinet/tcp.h],
1024 [m4_define([MD5_INCLUDES],
1026 [#include <netinet/tcp.h>
1028 AC_CHECK_DECLS([TCP_MD5SIG], [], [], MD5_INCLUDES)],
1031 if test $ac_cv_have_decl_TCP_MD5SIG = no; then
1032 AC_CHECK_HEADER([linux/tcp.h],
1033 [m4_define([MD5_INCLUDES],
1035 [#include <linux/tcp.h>
1037 AC_CHECK_DECLS([TCP_MD5SIG], [], [], MD5_INCLUDES)])
1040 dnl -----------------------------
1041 dnl check ipforward detect method
1042 dnl -----------------------------
1043 AC_CACHE_CHECK([ipforward method], [quagga_cv_ipforward_method],
1044 [if test x$cross_compiling = xyes; then
1045 if test x"$opsys" = x"gnu-linux"; then
1046 quagga_cv_ipforward_method=/proc/net/snmp
1048 quagga_cv_ipforward_method=/dev/ip
1051 for quagga_cv_ipforward_method in /proc/net/snmp /dev/ip /dev/null;
1053 test x`ls $quagga_cv_ipforward_method 2>/dev/null` = x"$quagga_cv_ipforward_method" && break
1056 case $quagga_cv_ipforward_method in
1057 "/proc/net/snmp") quagga_cv_ipforward_method="proc";;
1060 *-freebsd*) quagga_cv_ipforward_method="sysctl";;
1061 *) quagga_cv_ipforward_method="solaris";;
1063 *) quagga_cv_ipforward_method="sysctl";;
1065 IPFORWARD=ipforward_${quagga_cv_ipforward_method}.o
1068 AC_CHECK_FUNCS(getaddrinfo, [have_getaddrinfo=yes], [have_getaddrinfo=no])
1073 AC_MSG_CHECKING(whether does this OS have IPv6 stack)
1077 if grep WIDE /usr/include/netinet6/in6.h >/dev/null 2>&1; then
1078 AC_DEFINE(KAME,1,KAME IPv6)
1080 dnl ------------------------------------
1081 dnl Solaris 9, 10 and potentially higher
1082 dnl ------------------------------------
1083 elif test x"$opsys" = x"sol8"; then
1084 AC_DEFINE(SOLARIS_IPV6, 1, Solaris IPv6)
1085 AC_MSG_RESULT(Solaris IPv6)
1089 elif test x"$opsys" = x"gnu-linux"; then
1090 AC_DEFINE(LINUX_IPV6,1,Linux IPv6 stack)
1091 dnl Linux has a compilation problem with mixing
1092 dnl netinet/in.h and linux/in6.h they are not
1093 dnl compatible. There has been discussion on
1094 dnl how to fix it but no real progress on implementation
1095 dnl when they fix it, remove this
1096 AC_DEFINE(IPV6_MINHOPCOUNT, 73, Linux ipv6 Min Hop Count)
1097 AC_MSG_RESULT(Linux IPv6)
1099 AC_MSG_ERROR([Failed to detect IPv6 stack])
1102 dnl this is unconditial, for compatibility
1103 AC_DEFINE(HAVE_IPV6,1,IPv6)
1105 dnl ------------------
1106 dnl IPv6 header checks
1107 dnl ------------------
1108 AC_CHECK_HEADERS([netinet6/in6.h netinet/in6_var.h netinet/icmp6.h \
1109 netinet6/in6_var.h netinet6/nd6.h], [], [],
1112 m4_define([QUAGGA_INCLUDES],dnl
1114 [#if HAVE_NETINET6_IN6_H
1115 #include <netinet6/in6.h>
1117 #if HAVE_NETINET_IN6_VAR_H
1118 #include <netinet/in6_var.h>
1120 #if HAVE_NETINET_ICMP6_H
1121 # include <netinet/icmp6.h>
1123 #if HAVE_NETINET6_IN6_VAR_H
1124 # include <netinet6/in6_var.h>
1126 #if HAVE_NETINET6_ND6_H
1127 # include <netinet6/nd6.h>
1131 dnl disable doc check
1132 if test "${enable_doc}" = "no";then
1138 dnl --------------------
1139 dnl Daemon disable check
1140 dnl --------------------
1141 if test "${enable_zebra}" = "no";then
1146 AM_CONDITIONAL(ZEBRA, test "x$ZEBRA" = "xzebra")
1148 if test "${enable_bgpd}" = "no";then
1153 AM_CONDITIONAL(BGPD, test "x$BGPD" = "xbgpd")
1155 if test "${enable_ripd}" = "no";then
1160 AM_CONDITIONAL(RIPD, test "x$RIPD" = "xripd")
1162 if test "${enable_ospfd}" = "no";then
1167 AM_CONDITIONAL(OSPFD, test "x$OSPFD" = "xospfd")
1169 if test "${enable_watchquagga}" = "no";then
1172 WATCHQUAGGA="watchquagga"
1174 AM_CONDITIONAL(WATCHQUAGGA, test "x$WATCHQUAGGA" = "xwatchquagga")
1177 if test "${enable_opaque_lsa}" != "no"; then
1178 if test "${enable_ospfapi}" != "no";then
1179 AC_DEFINE(SUPPORT_OSPF_API,,OSPFAPI)
1181 if test "${enable_ospfclient}" != "no";then
1182 OSPFCLIENT="ospfclient"
1187 AM_CONDITIONAL(OSPFCLIENT, test "x$OSPFCLIENT" = "xospfclient")
1189 case "${enable_ripngd}" in
1191 * ) RIPNGD="ripngd";;
1193 AM_CONDITIONAL(RIPNGD, test "x$RIPNGD" = "xripngd")
1195 case "${enable_ospf6d}" in
1197 * ) OSPF6D="ospf6d";;
1199 AM_CONDITIONAL(OSPF6D, test "x$OSPF6D" = "xospf6d")
1201 case "${enable_isisd}" in
1205 AM_CONDITIONAL(ISISD, test "x$ISISD" = "xisisd")
1207 case "${enable_pimd}" in
1211 AM_CONDITIONAL(PIMD, test "x$PIMD" = "xpimd")
1213 if test "${enable_bgp_announce}" = "no";then
1214 AC_DEFINE(DISABLE_BGP_ANNOUNCE,1,Disable BGP installation to zebra)
1216 AC_DEFINE(DISABLE_BGP_ANNOUNCE,0,Disable BGP installation to zebra)
1226 AC_SUBST(WATCHQUAGGA)
1232 AC_SUBST(OSPFCLIENT)
1234 AC_CHECK_LIB(c, inet_ntop, [AC_DEFINE(HAVE_INET_NTOP,,inet_ntop)])
1235 AC_CHECK_LIB(c, inet_pton, [AC_DEFINE(HAVE_INET_PTON,,inet_pton)])
1236 AC_CHECK_LIB(crypt, crypt)
1237 AC_CHECK_LIB(resolv, res_init)
1239 dnl ---------------------------
1240 dnl check system has PCRE regexp
1241 dnl ---------------------------
1242 if test "x$enable_pcreposix" = "xyes"; then
1243 AC_CHECK_LIB(pcreposix, pcreposix_regexec, ,[enable_pcreposix=no
1244 AC_MSG_WARN([*** falling back to other regex library ***]) ])
1247 if test "x$enable_pcreposix" != "xyes"; then
1248 dnl ---------------------------
1249 dnl check system has GNU regexp
1250 dnl ---------------------------
1251 AC_MSG_CHECKING(whether system has GNU regex)
1252 AC_CHECK_LIB(c, regexec,
1253 [AC_DEFINE(HAVE_GNU_REGEX,,GNU regexp library)
1255 [LIB_REGEX="regex.o"])
1257 AC_SUBST(HAVE_LIBPCREPOSIX)
1260 dnl ------------------
1261 dnl check Net-SNMP library
1262 dnl ------------------
1263 if test "${enable_snmp}" != ""; then
1264 AC_PATH_TOOL([NETSNMP_CONFIG], [net-snmp-config], [no])
1265 if test x"$NETSNMP_CONFIG" = x"no"; then
1266 AC_MSG_ERROR([--enable-snmp given but unable to find net-snmp-config])
1268 LIBS="$LIBS `${NETSNMP_CONFIG} --agent-libs`"
1269 CFLAGS="`${NETSNMP_CONFIG} --base-cflags` $CFLAGS"
1270 AC_MSG_CHECKING([whether we can link to Net-SNMP])
1271 AC_LINK_IFELSE([AC_LANG_PROGRAM([
1278 ])],[AC_MSG_RESULT(yes)],[
1280 AC_MSG_ERROR([--enable-snmp given but not usable])])
1281 AC_DEFINE(HAVE_SNMP,,SNMP)
1282 case "${enable_snmp}" in
1287 SNMP_METHOD="${enable_snmp}"
1290 AC_MSG_ERROR([--enable-snmp given with an unknown method (${enable_snmp}). Use smux or agentx])
1293 AH_TEMPLATE([SNMP_SMUX], [Use SNMP SMUX to interface with snmpd])
1294 AH_TEMPLATE([SNMP_AGENTX], [Use SNMP AgentX to interface with snmpd])
1295 AC_DEFINE_UNQUOTED(AS_TR_CPP(SNMP_${SNMP_METHOD}),,SNMP method to interface with snmpd)
1298 dnl ---------------------------
1299 dnl sockaddr and netinet checks
1300 dnl ---------------------------
1301 AC_CHECK_TYPES([struct sockaddr, struct sockaddr_in,
1302 struct sockaddr_in6, struct sockaddr_un, struct sockaddr_dl,
1303 socklen_t, struct vifctl, struct mfcctl, struct sioc_sg_req,
1304 vifi_t, struct sioc_vif_req, struct igmpmsg,
1305 struct ifaliasreq, struct if6_aliasreq, struct in6_aliasreq,
1306 struct nd_opt_adv_interval, struct rt_addrinfo,
1307 struct nd_opt_homeagent_info, struct nd_opt_adv_interval],
1308 [], [], QUAGGA_INCLUDES)
1310 AC_CHECK_MEMBERS([struct sockaddr.sa_len,
1311 struct sockaddr_in.sin_len, struct sockaddr_un.sun_len,
1312 struct sockaddr_in6.sin6_scope_id,
1313 struct sockaddr_dl.sdl_len,
1314 struct if6_aliasreq.ifra_lifetime,
1315 struct nd_opt_adv_interval.nd_opt_ai_type],
1316 [], [], QUAGGA_INCLUDES)
1318 dnl ---------------------------
1319 dnl IRDP/pktinfo/icmphdr checks
1320 dnl ---------------------------
1321 AC_CHECK_TYPES([struct in_pktinfo],
1322 [AC_CHECK_TYPES([struct icmphdr],
1323 [if test "${enable_irdp}" != "no"; then
1324 AC_DEFINE(HAVE_IRDP,, IRDP)
1326 [if test "${enable_irdp}" = "yes"; then
1327 AC_MSG_ERROR(['IRDP requires in_pktinfo at the moment!'])
1328 fi], [QUAGGA_INCLUDES])],
1329 [if test "${enable_irdp}" = "yes"; then
1330 AC_MSG_ERROR(['IRDP requires in_pktinfo at the moment!'])
1331 fi], [QUAGGA_INCLUDES])
1333 dnl -----------------------
1334 dnl checking for IP_PKTINFO
1335 dnl -----------------------
1336 AC_MSG_CHECKING(for IP_PKTINFO)
1337 AC_TRY_COMPILE([#include <netdb.h>], [
1338 int opt = IP_PKTINFO;
1341 AC_DEFINE(HAVE_IP_PKTINFO, 1, [Have IP_PKTINFO])
1346 dnl ---------------------------
1347 dnl checking for IP_RECVDSTADDR
1348 dnl ---------------------------
1349 AC_MSG_CHECKING(for IP_RECVDSTADDR)
1350 AC_TRY_COMPILE([#include <netinet/in.h>], [
1351 int opt = IP_RECVDSTADDR;
1354 AC_DEFINE(HAVE_IP_RECVDSTADDR, 1, [Have IP_RECVDSTADDR])
1359 dnl ----------------------
1360 dnl checking for IP_RECVIF
1361 dnl ----------------------
1362 AC_MSG_CHECKING(for IP_RECVIF)
1363 AC_TRY_COMPILE([#include <netinet/in.h>], [
1364 int opt = IP_RECVIF;
1367 AC_DEFINE(HAVE_IP_RECVIF, 1, [Have IP_RECVIF])
1372 dnl --------------------------------------
1373 dnl checking for getrusage struct and call
1374 dnl --------------------------------------
1375 if test "${enable_rusage}" != "no"; then
1376 AC_MSG_CHECKING(whether getrusage is available)
1377 AC_TRY_COMPILE([#include <sys/resource.h>],[struct rusage ac_x; getrusage (RUSAGE_SELF, &ac_x);],
1379 AC_DEFINE(HAVE_RUSAGE,,rusage)],
1383 dnl --------------------------------------
1384 dnl checking for clock_time monotonic struct and call
1385 dnl --------------------------------------
1386 AC_CHECK_DECL(CLOCK_MONOTONIC,
1387 [AC_CHECK_LIB(rt, clock_gettime, [LIBS="$LIBS -lrt"])
1388 AC_DEFINE(HAVE_CLOCK_MONOTONIC,, Have monotonic clock)
1389 ], [AC_MSG_RESULT(no)], [QUAGGA_INCLUDES])
1391 dnl -------------------
1392 dnl capabilities checks
1393 dnl -------------------
1394 if test "${enable_capabilities}" != "no"; then
1395 AC_MSG_CHECKING(whether prctl PR_SET_KEEPCAPS is available)
1396 AC_TRY_COMPILE([#include <sys/prctl.h>],[prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0);],
1398 AC_DEFINE(HAVE_PR_SET_KEEPCAPS,,prctl)
1399 quagga_ac_keepcaps="yes"],
1402 if test x"${quagga_ac_keepcaps}" = x"yes"; then
1403 AC_CHECK_HEADERS(sys/capability.h)
1405 if test x"${ac_cv_header_sys_capability_h}" = x"yes"; then
1406 AC_CHECK_LIB(cap, cap_init,
1407 [AC_DEFINE(HAVE_LCAPS,1,Capabilities)
1409 quagga_ac_lcaps="yes"]
1412 AC_CHECK_HEADERS(priv.h,
1413 [AC_MSG_CHECKING(Solaris style privileges are available)
1414 AC_TRY_COMPILE([#include <priv.h>],[getpflags(PRIV_AWARE);],
1416 AC_DEFINE(HAVE_SOLARIS_CAPABILITIES,1,getpflags)
1417 quagga_ac_scaps="yes"],
1423 if test x"${quagga_ac_scaps}" = x"yes" \
1424 -o x"${quagga_ac_lcaps}" = x"yes"; then
1425 AC_DEFINE(HAVE_CAPABILITIES,1,capabilities)
1430 dnl ---------------------------
1431 dnl check for glibc 'backtrace'
1432 dnl ---------------------------
1433 if test x"${enable_backtrace}" != x"no" ; then
1435 AC_CHECK_HEADER([execinfo.h], [
1436 AC_SEARCH_LIBS([backtrace], [execinfo], [
1437 AC_DEFINE(HAVE_GLIBC_BACKTRACE,,[Glibc backtrace])
1438 AC_DEFINE(HAVE_STACK_TRACE,,[Stack symbol decoding])
1443 if test x"${enable_backtrace}" = x"yes" -a x"${backtrace_ok}" = x"no"; then
1444 dnl user explicitly requested backtrace but we failed to find support
1445 AC_MSG_FAILURE([failed to find backtrace support])
1449 dnl -----------------------------------------
1450 dnl check for malloc mallinfo struct and call
1451 dnl this must try and link using LIBS, in
1452 dnl order to check no alternative allocator
1453 dnl has been specified, which might not provide
1454 dnl mallinfo, e.g. such as Umem on Solaris.
1455 dnl -----------------------------------------
1456 AC_CHECK_HEADER([malloc.h],
1457 [AC_MSG_CHECKING(whether mallinfo is available)
1458 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <malloc.h>]],
1459 [[struct mallinfo ac_x; ac_x = mallinfo ();]])],
1461 AC_DEFINE(HAVE_MALLINFO,,mallinfo)],
1464 ], [], QUAGGA_INCLUDES)
1469 CONFDATE=`date '+%Y%m%d'`
1475 if test x"$DEJAGNU" = x
1477 DEJAGNU="\$(top_srcdir)/tests/global-conf.exp"
1479 RUNTESTDEFAULTFLAGS="-x --tool \$\$tool"
1482 AC_SUBST(RUNTESTDEFAULTFLAGS)
1484 dnl ------------------------------
1485 dnl set paths for state directory
1486 dnl ------------------------------
1487 AC_MSG_CHECKING(directory to use for state file)
1488 if test "${prefix}" = "NONE"; then
1489 quagga_statedir_prefix="";
1491 quagga_statedir_prefix=${prefix}
1493 if test "${localstatedir}" = '${prefix}/var'; then
1494 for QUAGGA_STATE_DIR in ${quagga_statedir_prefix}/var/run dnl
1495 ${quagga_statedir_prefix}/var/adm dnl
1496 ${quagga_statedir_prefix}/etc dnl
1502 test -d $QUAGGA_STATE_DIR && break
1504 quagga_statedir=$QUAGGA_STATE_DIR
1506 quagga_statedir=${localstatedir}
1508 if test $quagga_statedir = "/dev/null"; then
1509 AC_MSG_ERROR('STATE DIRECTORY NOT FOUND! FIX OR SPECIFY --localstatedir!')
1511 AC_MSG_RESULT(${quagga_statedir})
1512 AC_SUBST(quagga_statedir)
1514 AC_DEFINE_UNQUOTED(PATH_ZEBRA_PID, "$quagga_statedir/zebra.pid",zebra PID)
1515 AC_DEFINE_UNQUOTED(PATH_RIPD_PID, "$quagga_statedir/ripd.pid",ripd PID)
1516 AC_DEFINE_UNQUOTED(PATH_RIPNGD_PID, "$quagga_statedir/ripngd.pid",ripngd PID)
1517 AC_DEFINE_UNQUOTED(PATH_BGPD_PID, "$quagga_statedir/bgpd.pid",bgpd PID)
1518 AC_DEFINE_UNQUOTED(PATH_OSPFD_PID, "$quagga_statedir/ospfd.pid",ospfd PID)
1519 AC_DEFINE_UNQUOTED(PATH_OSPF6D_PID, "$quagga_statedir/ospf6d.pid",ospf6d PID)
1520 AC_DEFINE_UNQUOTED(PATH_ISISD_PID, "$quagga_statedir/isisd.pid",isisd PID)
1521 AC_DEFINE_UNQUOTED(PATH_PIMD_PID, "$quagga_statedir/pimd.pid",pimd PID)
1522 AC_DEFINE_UNQUOTED(PATH_WATCHQUAGGA_PID, "$quagga_statedir/watchquagga.pid",watchquagga PID)
1523 AC_DEFINE_UNQUOTED(ZEBRA_SERV_PATH, "$quagga_statedir/zserv.api",zebra api socket)
1524 AC_DEFINE_UNQUOTED(ZEBRA_VTYSH_PATH, "$quagga_statedir/zebra.vty",zebra vty socket)
1525 AC_DEFINE_UNQUOTED(RIP_VTYSH_PATH, "$quagga_statedir/ripd.vty",rip vty socket)
1526 AC_DEFINE_UNQUOTED(RIPNG_VTYSH_PATH, "$quagga_statedir/ripngd.vty",ripng vty socket)
1527 AC_DEFINE_UNQUOTED(BGP_VTYSH_PATH, "$quagga_statedir/bgpd.vty",bgpd vty socket)
1528 AC_DEFINE_UNQUOTED(OSPF_VTYSH_PATH, "$quagga_statedir/ospfd.vty",ospfd vty socket)
1529 AC_DEFINE_UNQUOTED(OSPF6_VTYSH_PATH, "$quagga_statedir/ospf6d.vty",ospf6d vty socket)
1530 AC_DEFINE_UNQUOTED(ISIS_VTYSH_PATH, "$quagga_statedir/isisd.vty",isisd vty socket)
1531 AC_DEFINE_UNQUOTED(PIM_VTYSH_PATH, "$quagga_statedir/pimd.vty",pimd vty socket)
1532 AC_DEFINE_UNQUOTED(DAEMON_VTY_DIR, "$quagga_statedir",daemon vty directory)
1534 dnl -------------------------------
1535 dnl Quagga sources should always be
1536 dnl current wrt interfaces. Dont
1537 dnl allow deprecated interfaces to
1539 dnl -------------------------------
1540 AC_DEFINE(QUAGGA_NO_DEPRECATED_INTERFACES, 1, Hide deprecated interfaces)
1542 dnl ---------------------------
1543 dnl Check htonl works correctly
1544 dnl ---------------------------
1545 AC_MSG_CHECKING(for working htonl)
1546 AC_CACHE_VAL(ac_cv_htonl_works,
1547 [AC_LINK_IFELSE([AC_LANG_PROGRAM([QUAGGA_INCLUDES],[htonl (0);])],
1548 [ac_cv_htonl_works=yes], [ac_cv_htonl_works=no])
1551 AC_MSG_RESULT($ac_cv_htonl_works)
1553 AC_CONFIG_FILES([Makefile lib/Makefile zebra/Makefile ripd/Makefile
1554 ripngd/Makefile bgpd/Makefile ospfd/Makefile watchquagga/Makefile
1555 ospf6d/Makefile isisd/Makefile vtysh/Makefile
1556 doc/Makefile ospfclient/Makefile tests/Makefile m4/Makefile
1558 tests/bgpd.tests/Makefile
1559 tests/libzebra.tests/Makefile
1565 isisd/topology/Makefile
1566 pkgsrc/bgpd.sh pkgsrc/ospf6d.sh pkgsrc/ospfd.sh
1567 pkgsrc/ripd.sh pkgsrc/ripngd.sh pkgsrc/zebra.sh])
1568 AC_CONFIG_FILES([solaris/Makefile])
1570 AC_CONFIG_FILES([vtysh/extract.pl],[chmod +x vtysh/extract.pl])
1571 ## Hack, but working solution to avoid rebuilding of quagga.info.
1572 ## It's already in CVS until texinfo 4.7 is more common.
1576 Quagga configuration
1577 --------------------
1578 quagga version : ${PACKAGE_VERSION}
1579 host operating system : ${host_os}
1580 source code location : ${srcdir}
1582 compiler flags : ${CFLAGS}
1584 linker flags : ${LDFLAGS} ${LIBS} ${LIBCAP} ${LIBREADLINE} ${LIBM}
1585 state file directory : ${quagga_statedir}
1586 config file directory : `eval echo \`echo ${sysconfdir}\``
1587 example directory : `eval echo \`echo ${exampledir}\``
1588 user to run as : ${enable_user}
1589 group to run as : ${enable_group}
1590 group for vty sockets : ${enable_vty_group}
1591 config file mask : ${enable_configfile_mask}
1592 log file mask : ${enable_logfile_mask}
1594 The above user and group must have read/write access to the state file
1595 directory and to the config files in the config file directory."
1597 if test x"$quagga_cv_gnu_make" = x"no"; then echo "
1598 Warning: The ${MAKE-make} programme detected, either in your path or
1599 via the MAKE variable, is not GNU Make. GNU make may be installed as
1600 gmake on some systems. and is required to complete a build of Quagga