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>
8 ## $Id: configure.ac,v 1.89 2005/02/19 13:58:06 hasso Exp $
11 AC_INIT(Quagga, 0.99.0, [http://bugzilla.quagga.net])
12 AC_CONFIG_SRCDIR(lib/zebra.h)
14 AM_CONFIG_HEADER(config.h)
16 dnl default is to match previous behavior
17 exampledir=${sysconfdir}
18 AC_ARG_ENABLE([exampledir],
19 AC_HELP_STRING([--enable-exampledir],
20 [specify alternate directory for examples]),
21 exampledir="$enableval",)
22 dnl XXX add --exampledir to autoconf standard directory list somehow
25 dnl default is to match previous behavior
28 AC_ARG_ENABLE([pkgsrcrcdir],
29 AC_HELP_STRING([--enable-pkgsrcrcdir],
30 [specify directory for rc.d scripts]),
31 pkgsrcrcdir="$enableval"; pkgsrcdir="pkgsrc",)
32 dnl XXX add --pkgsrcrcdir to autoconf standard directory list somehow
36 dnl -----------------------------------
37 dnl Get hostname and other information.
38 dnl -----------------------------------
45 [ --with-cflags Set CFLAGS for use in compilation.])
46 if test "x$with_cflags" != "x" ; then
47 CFLAGS="$with_cflags" ; cflags_specified=yes ;
48 elif test -n "$CFLAGS" ; then
49 cflags_specified=yes ;
57 dnl ---------------------------------------------
58 dnl If CLFAGS doesn\'t exist set default value
59 dnl AC_PROG_CC will have set minimal default
60 dnl already, eg "-O2 -g" for gcc, "-g" for others
61 dnl (Wall is gcc specific... have to make sure
62 dnl gcc is being used before setting it)
63 dnl ---------------------------------------------
65 if test "x$cflags_specified" = "x" ; then
66 if test "x${GCC}" = "xyes"; then
67 CFLAGS="-Os -g -Wall -Wsign-compare -Wpointer-arith"
68 CFLAGS="${CFLAGS} -Wbad-function-cast -Wwrite-strings"
70 # TODO: conditionally addd -Wpacked if handled
80 AC_CHECK_TOOL(RANLIB, ranlib, :)
92 dnl ----------------------
93 dnl Packages configuration
94 dnl ----------------------
96 [ --enable-vtysh include integrated vty shell for Quagga])
98 [ --disable-ipv6 turn off IPv6 related features and daemons])
100 [ --disable-zebra do not build zebra daemon])
102 [ --disable-bgpd do not build bgpd])
104 [ --disable-ripd do not build ripd])
105 AC_ARG_ENABLE(ripngd,
106 [ --disable-ripngd do not build ripngd])
108 [ --disable-ospfd do not build ospfd])
109 AC_ARG_ENABLE(ospf6d,
110 [ --disable-ospf6d do not build ospf6d])
111 AC_ARG_ENABLE(watchquagga,
112 [ --disable-watchquagga do not build watchquagga])
114 [ --enable-isisd build isisd])
115 AC_ARG_ENABLE(bgp-announce,
116 [ --disable-bgp-announce, turn off BGP route announcement])
117 AC_ARG_ENABLE(netlink,
118 [ --enable-netlink force to use Linux netlink interface])
119 AC_ARG_ENABLE(broken-aliases,
120 [ --enable-broken-aliases enable aliases as distinct interfaces for Linux 2.2.X])
122 [ --enable-snmp enable SNMP support])
124 [ --with-libpam use libpam for PAM support in vtysh])
125 AC_ARG_ENABLE(tcp-zebra,
126 [ --enable-tcp-zebra enable TCP/IP socket connection between zebra and protocol daemon])
127 AC_ARG_ENABLE(opaque-lsa,
128 [ --enable-opaque-lsa enable OSPF Opaque-LSA with OSPFAPI support (RFC2370)])
129 AC_ARG_ENABLE(ospfapi,
130 [ --disable-ospfapi do not build OSPFAPI to access the OSPF LSA Database,
131 (this is the default if --enable-opaque-lsa is not set)])
132 AC_ARG_ENABLE(ospfclient,
133 [ --disable-ospfclient do not build OSPFAPI client for OSPFAPI,
134 (this is the default if --disable-ospfapi is set)])
135 AC_ARG_ENABLE(ospf-te,
136 [ --enable-ospf-te enable Traffic Engineering Extension to OSPF])
137 AC_ARG_ENABLE(multipath,
138 [ --enable-multipath=ARG enable multipath function, ARG must be digit])
139 AC_ARG_ENABLE(quagga_user,
140 [ --enable-user=ARG user to run Quagga suite as (default quagga)])
141 AC_ARG_ENABLE(quagga_group,
142 [ --enable-group=ARG group to run Quagga suite as (default quagga)])
143 AC_ARG_ENABLE(vty_group,
144 [ --enable-vty-group=ARG set vty sockets to have specified group as owner])
145 AC_ARG_ENABLE(configfile_mask,
146 [ --enable-configfile-mask=ARG set mask for config files])
147 AC_ARG_ENABLE(logfile_mask,
148 [ --enable-logfile-mask=ARG set mask for log files])
151 [ --disable-rtadv disable IPV6 router advertisement feature])
153 [ --enable-irdp enable IRDP server support in zebra])
154 AC_ARG_ENABLE(capabilities,
155 [ --disable-capabilities disable using POSIX capabilities])
156 AC_ARG_ENABLE(gcc_ultra_verbose,
157 [ --enable-gcc-ultra-verbose enable ultra verbose GCC warnings])
158 AC_ARG_ENABLE(gcc-rdynamic,
159 [ --enable-gcc-rdynamic enable gcc linking with -rdynamic for better backtraces])
161 if test x"${enable_gcc_ultra_verbose}" = x"yes" ; then
162 CFLAGS="${CFLAGS} -W -Wcast-qual -Wstrict-prototypes"
163 CFLAGS="${CFLAGS} -Wmissing-declarations -Wmissing-noreturn"
164 CFLAGS="${CFLAGS} -Wmissing-format-attribute -Wunreachable-code"
165 CFLAGS="${CFLAGS} -Wpacked -Wpadded"
168 if test x"${enable_gcc_rdynamic}" = x"yes" ; then
169 LDFLAGS="${LDFLAGS} -rdynamic"
172 if test "${enable_broken_aliases}" = "yes"; then
173 if test "${enable_netlink}" = "yes"
175 echo "Sorry, you can't use netlink with broken aliases"
178 AC_DEFINE(HAVE_BROKEN_ALIASES,,Broken Alias)
182 if test "${enable_tcp_zebra}" = "yes"; then
183 AC_DEFINE(HAVE_TCP_ZEBRA,,Use TCP for zebra communication)
186 if test "${enable_opaque_lsa}" = "yes"; then
187 AC_DEFINE(HAVE_OPAQUE_LSA,,OSPF Opaque LSA)
190 if test "${enable_ospf_te}" = "yes"; then
191 AC_DEFINE(HAVE_OPAQUE_LSA,,OSPF Opaque LSA)
192 AC_DEFINE(HAVE_OSPF_TE,,OSPF TE)
195 AC_MSG_CHECKING(if zebra should be configurable to send Route Advertisements)
196 if test "${enable_rtadv}" != "no"; then
198 AC_DEFINE(HAVE_RTADV,,Enable IPv6 Routing Advertisement support)
203 if test "${enable_irdp}" = "yes"; then
204 AC_DEFINE(HAVE_IRDP,, IRDP )
207 if test "${enable_user}" = "yes" || test x"${enable_user}" = x""; then
209 elif test "${enable_user}" = "no"; then
212 AC_DEFINE_UNQUOTED(QUAGGA_USER, "${enable_user}", Quagga User)
214 if test "${enable_group}" = "yes" || test x"${enable_group}" = x""; then
215 enable_group="quagga"
216 elif test "${enable_group}" = "no"; then
219 AC_DEFINE_UNQUOTED(QUAGGA_GROUP, "${enable_group}", Quagga Group)
221 if test x"${enable_vty_group}" = x"yes" ; then
222 AC_MSG_ERROR([--enable-vty-group requires a group as argument, not yes])
223 elif test x"${enable_vty_group}" != x""; then
224 if test x"${enable_vty_group}" != x"no"; then
225 AC_DEFINE_UNQUOTED(VTY_GROUP, "${enable_vty_group}", VTY Sockets Group)
229 enable_configfile_mask=${enable_configfile_mask:-0600}
230 AC_DEFINE_UNQUOTED(CONFIGFILE_MASK, ${enable_configfile_mask}, Mask for config files)
232 enable_logfile_mask=${enable_logfile_mask:-0600}
233 AC_DEFINE_UNQUOTED(LOGFILE_MASK, ${enable_logfile_mask}, Mask for log files)
239 case "${enable_multipath}" in
241 MULTIPATH_NUM="${enable_multipath}"
246 echo "Please specify digit to --enable-multipath ARG."
253 AC_SUBST(MULTIPATH_NUM)
255 dnl -------------------
256 dnl Check header files.
257 dnl -------------------
259 AC_CHECK_HEADERS([string.h stropts.h sys/conf.h sys/ksym.h sys/time.h \
260 sys/times.h sys/select.h sys/sysctl.h sys/sockio.h \
261 sys/types.h linux/version.h kvm.h netdb.h asm/types.h \
264 AC_CHECK_HEADERS([sys/socket.h netinet/in_systm.h netinet/in.h \
265 net/if_dl.h net/netopt.h inet/nd.h net/route.h \
266 net/if.h net/if_var.h netinet/in_var.h])
268 dnl V6 headers are checked below, after we check for v6
275 dnl Some systems (Solaris 2.x) require libnsl (Network Services Library)
277 [*-sunos5.[6-8]*] | [*-solaris2.[6-8]*])
279 AC_DEFINE(SUNOS_56, 1, SunOS 5.6 to 5.8)
280 AC_DEFINE(SUNOS_5, 1, SunOS 5)
281 AC_CHECK_LIB(xnet, main)
284 [*-sunos5.[8-9]] | [*-sunos5.1[0-9]] \
285 | [*-solaris2.[8-9]] | [*-solaris2.1[0-9]])
287 AC_DEFINE(SUNOS_59,,SunOS 5.9 up)
288 AC_DEFINE(SUNOS_5, 1, SunOS 5)
289 AC_CHECK_LIB(socket, main)
290 AC_CHECK_LIB(nsl, main)
293 *-sunos5* | *-solaris2*)
294 AC_DEFINE(SUNOS_5,,SunOS 5, Unknown SunOS)
295 AC_CHECK_LIB(socket, main)
296 AC_CHECK_LIB(nsl, main)
301 AC_DEFINE(GNU_LINUX,,GNU Linux)
304 AC_CHECK_LIB(nsl, gethostbyname)
305 AC_CHECK_LIB(socket, socket)
308 AC_DEFINE(FREEBSD_32,,FreeBSD 3.2)
312 AC_DEFINE(OPEN_BSD,,OpenBSD)
316 OTHER_METHOD="mtu_kvm.o"
317 AC_CHECK_LIB(kvm, main)
321 AC_DEFINE(IRIX_65,,IRIX 6.5)
325 dnl ---------------------
326 dnl Integrated VTY option
327 dnl ---------------------
328 case "${enable_vtysh}" in
329 "yes") VTYSH="vtysh";
330 AC_DEFINE(VTYSH,,VTY shell)
331 AC_PATH_PROG(PERL, perl)
332 dnl Vtysh uses libreadline, which looks for termcap functions at
333 dnl configure time. We follow readline's search order.
334 dnl The required procedures are in libtermcap on NetBSD, in
335 dnl [TODO] on Linux, and in [TODO] on Solaris.
336 AC_CHECK_LIB(termcap, tputs, ,
337 AC_CHECK_LIB(tinfo, tputs, ,
338 AC_CHECK_LIB(curses, tputs, ,
339 AC_CHECK_LIB(ncurses, tputs))))
340 AC_CHECK_LIB(readline, main)
341 if test $ac_cv_lib_readline_main = no; then
342 AC_MSG_ERROR([vtysh needs libreadline but was not found and usable on your system.])
344 AC_CHECK_HEADER(readline/history.h)
345 if test $ac_cv_header_readline_history_h = no;then
346 AC_MSG_ERROR([readline is too old to have readline/history.h, please update to the latest readline library.])
348 AC_CHECK_LIB(readline, rl_completion_matches)
349 if test $ac_cv_lib_readline_rl_completion_matches = no; then
350 AC_DEFINE(rl_completion_matches,completion_matches,Old readline)
360 if test "$with_libpam" = "yes"; then
361 AC_CHECK_HEADER(security/pam_misc.h)
362 if test "$ac_cv_header_security_pam_misc_h" = yes; then
363 AC_DEFINE(HAVE_PAM_MISC_H,,Have pam_misc.h)
364 AC_DEFINE(PAM_CONV_FUNC,misc_conv,Have misc_conv)
365 pam_conv_func="misc_conv"
367 AC_CHECK_HEADER(security/openpam.h)
368 if test "$ac_cv_header_security_openpam_h" = yes; then
369 AC_DEFINE(HAVE_OPENPAM_H,,Have openpam.h)
370 AC_DEFINE(PAM_CONV_FUNC,openpam_ttyconv,Have openpam_ttyconv)
371 pam_conv_func="openpam_ttyconv"
373 if test -z "$ac_cv_header_security_pam_misc_h$ac_cv_header_security_openpam_h" ; then
374 AC_MSG_WARN([*** pam support will not be built ***])
379 if test "$with_libpam" = "yes"; then
380 dnl took this test from proftpd's configure.in and suited to our needs
381 dnl -------------------------------------------------------------------------
383 dnl This next check looks funky due to a linker problem with some versions
384 dnl of the PAM library. Prior to 0.72 release, the Linux PAM shared library
385 dnl omitted requiring libdl linking information. PAM-0.72 or better ships
386 dnl with RedHat 6.2 and Debian 2.2 or better.
387 AC_CHECK_LIB(pam, pam_start,
388 [AC_CHECK_LIB(pam, $pam_conv_func,
389 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
391 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
392 LIBPAM="-lpam -lpam_misc"]
396 [AC_CHECK_LIB(pam, pam_end,
397 [AC_CHECK_LIB(pam, $pam_conv_func,
398 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
399 LIBPAM="-lpam -ldl"],
400 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
401 LIBPAM="-lpam -ldl -lpam_misc"]
403 ],AC_MSG_WARN([*** pam support will not be built ***]),
410 dnl -------------------------------
411 dnl Endian-ness check
412 dnl -------------------------------
415 dnl -------------------------------
416 dnl check the size in byte of the C
417 dnl -------------------------------
418 dnl AC_CHECK_SIZEOF(char)
419 dnl AC_CHECK_SIZEOF(int)
420 dnl AC_CHECK_SIZEOF(short)
421 dnl AC_CHECK_SIZEOF(long)
423 dnl ----------------------------
424 dnl check existance of functions
425 dnl ----------------------------
426 AC_CHECK_FUNCS(memset memcpy strerror inet_aton daemon snprintf vsnprintf \
427 strlcat strlcpy if_nametoindex if_indextoname getifaddrs \
429 AC_CHECK_FUNCS(setproctitle, ,
430 [AC_CHECK_LIB(util, setproctitle,
432 AC_DEFINE(HAVE_SETPROCTITLE,, Have setproctitle)
438 dnl ------------------------------------
439 dnl Determine routing get and set method
440 dnl ------------------------------------
441 AC_MSG_CHECKING(zebra between kernel interface method)
442 if test x"$opsys" = x"gnu-linux"; then
443 if test "${enable_netlink}" = "yes";then
444 AC_MSG_RESULT(netlink)
445 RT_METHOD=rt_netlink.o
446 AC_DEFINE(HAVE_NETLINK,,netlink)
448 elif test "${enable_netlink}" = "no"; then
453 AC_MSG_RESULT(netlink)
454 RT_METHOD=rt_netlink.o
455 AC_DEFINE(HAVE_NETLINK,,netlink)
458 elif test x"$opsys" = x"sol2-6";then
459 AC_MSG_RESULT(Route socket)
460 KERNEL_METHOD="kernel_socket.o"
461 RT_METHOD="rt_socket.o"
462 elif test x"$opsys" = x"sol9";then
463 AC_MSG_RESULT(Route socket)
464 KERNEL_METHOD="kernel_socket.o"
465 RT_METHOD="rt_socket.o"
466 elif test "$opsys" = "irix" ; then
467 AC_MSG_RESULT(Route socket)
468 KERNEL_METHOD="kernel_socket.o"
469 RT_METHOD="rt_socket.o"
471 AC_TRY_RUN([#include <errno.h>
472 #include <sys/types.h>
473 #include <sys/socket.h>
479 ac_sock = socket (AF_ROUTE, SOCK_RAW, 0);
480 if (ac_sock < 0 && errno == EINVAL)
484 [KERNEL_METHOD=kernel_socket.o
485 RT_METHOD=rt_socket.o
486 AC_MSG_RESULT(socket)],
487 [RT_METHOD=rt_ioctl.o
488 AC_MSG_RESULT(ioctl)],
489 [KERNEL_METHOD=kernel_socket.o
490 RT_METHOD=rt_socket.o
491 AC_MSG_RESULT(socket)])
494 AC_SUBST(KERNEL_METHOD)
495 AC_SUBST(OTHER_METHOD)
497 dnl ------------------------------------
498 dnl check for broken CMSG_FIRSTHDR macro
499 dnl ------------------------------------
500 AC_MSG_CHECKING(for broken CMSG_FIRSTHDR)
504 #define __EXTENSIONS__
507 #include <sys/types.h>
508 #include <sys/socket.h>
515 msg.msg_control = buf;
516 msg.msg_controllen = 0;
518 if (CMSG_FIRSTHDR(&msg) != NULL)
521 }],[AC_MSG_RESULT(yes - using workaround) AC_DEFINE(HAVE_BROKEN_CMSG_FIRSTHDR,,Broken CMSG_FIRSTHDR)],
524 dnl ------------------------------
525 dnl check kernel route read method
526 dnl ------------------------------
527 AC_CACHE_CHECK(route read method check, zebra_rtread,
528 [if test "$netlink" = yes; then
529 RTREAD_METHOD="rtread_netlink.o"
530 zebra_rtread="netlink"
532 for zebra_rtread in /proc/net/route /dev/ip /dev/null;
534 test x`ls $zebra_rtread 2>/dev/null` = x"$zebra_rtread" && break
536 case $zebra_rtread in
537 "/proc/net/route") RTREAD_METHOD="rtread_proc.o"
538 zebra_rtread="proc";;
541 *-freebsd*) RTREAD_METHOD=rtread_sysctl.o
542 zebra_rtread="sysctl";;
543 *) RTREAD_METHOD="rtread_getmsg.o"
544 zebra_rtread="getmsg";;
546 *) RTREAD_METHOD="rtread_sysctl.o"
547 zebra_rtread="sysctl";;
550 AC_SUBST(RTREAD_METHOD)
552 dnl -----------------------------
553 dnl check interface lookup method
554 dnl -----------------------------
556 AC_MSG_CHECKING(interface looking up method)
557 if test "$netlink" = yes; then
558 AC_MSG_RESULT(netlink)
559 IF_METHOD=if_netlink.o
560 elif test "$opsys" = "sol2-6";then
561 AC_MSG_RESULT(Solaris GIF)
563 elif test "$opsys" = "sol9";then
564 AC_MSG_RESULT(Solaris GLIF)
565 IF_METHOD=if_ioctl_solaris.o
566 IOCTL_METHOD=ioctl_solaris.o
567 elif test "$opsys" = "irix" ; then
570 elif test "$opsys" = "openbsd";then
571 AC_MSG_RESULT(openbsd)
573 elif grep NET_RT_IFLIST /usr/include/sys/socket.h >/dev/null 2>&1; then
574 AC_MSG_RESULT(sysctl)
575 IF_METHOD=if_sysctl.o
576 AC_DEFINE(HAVE_NET_RT_IFLIST,,NET_RT_IFLIST)
582 AC_SUBST(IOCTL_METHOD)
584 dnl -----------------------
585 dnl check proc file system.
586 dnl -----------------------
587 if test -r /proc/net/dev; then
588 AC_DEFINE(HAVE_PROC_NET_DEV,,/proc/net/dev)
592 if test -r /proc/net/if_inet6; then
593 AC_DEFINE(HAVE_PROC_NET_IF_INET6,,/proc/net/if_inet6)
598 dnl -----------------------------
599 dnl check ipforward detect method
600 dnl -----------------------------
601 AC_CACHE_CHECK(ipforward method check, zebra_ipforward_path,
602 [for zebra_ipforward_path in /proc/net/snmp /dev/ip /dev/null;
604 test x`ls $zebra_ipforward_path 2>/dev/null` = x"$zebra_ipforward_path" && break
606 case $zebra_ipforward_path in
607 "/proc/net/snmp") IPFORWARD=ipforward_proc.o
608 zebra_ipforward_path="proc";;
611 *-nec-sysv4*) IPFORWARD=ipforward_ews.o
612 zebra_ipforward_path="ews";;
613 *-freebsd*) IPFORWARD=ipforward_sysctl.o
614 zebra_ipforward_path="sysctl";;
615 *) IPFORWARD=ipforward_solaris.o
616 zebra_ipforward_path="solaris";;
618 *) IPFORWARD=ipforward_sysctl.o
619 zebra_ipforward_path="sysctl";;
623 AC_CHECK_FUNCS(getaddrinfo, [have_getaddrinfo=yes], [have_getaddrinfo=no])
628 AC_MSG_CHECKING(whether does this OS have IPv6 stack)
629 if test "${enable_ipv6}" = "no"; then
630 AC_MSG_RESULT(disabled)
635 if grep IPV6_INRIA_VERSION /usr/include/netinet/in.h >/dev/null 2>&1; then
637 AC_DEFINE(HAVE_IPV6,1,INRIA IPv6)
638 AC_DEFINE(INRIA_IPV6,1,INRIA IPv6)
642 AC_MSG_RESULT(INRIA IPv6)
646 elif grep WIDE /usr/include/netinet6/in6.h >/dev/null 2>&1; then
648 AC_DEFINE(HAVE_IPV6,1,KAME IPv6)
649 AC_DEFINE(KAME,1,KAME IPv6)
652 if test -d /usr/local/v6/lib -a -f /usr/local/v6/lib/libinet6.a; then
653 LIB_IPV6="-L/usr/local/v6/lib -linet6"
656 dnl -------------------------
658 dnl default host check
659 dnl It is not used by Kheops
660 dnl -------------------------
661 elif grep MUSICA /usr/include6/netinet6/in6.h >/dev/null 2>&1; then
663 AC_DEFINE(HAVE_IPV6,1,Musicia IPv6)
664 AC_DEFINE(MUSICA,1,Musica IPv6 stack)
665 AC_DEFINE(KAME,1,KAME IPv6 stack)
668 if test -d /usr/local/v6/lib -a -f /usr/local/v6/lib/libinet6.a; then
669 LIB_IPV6="-L/usr/local/v6/lib -linet6"
671 AC_MSG_RESULT(MUSICA)
675 elif grep NRL /usr/include/netinet6/in6.h >/dev/null 2>&1; then
677 AC_DEFINE(HAVE_IPV6,1,NRL IPv6)
681 if test x"$opsys" = x"bsdi";then
682 AC_DEFINE(BSDI_NRL,,BSDI)
683 AC_MSG_RESULT(BSDI_NRL)
687 dnl ------------------------------------
688 dnl Solaris 9, 10 and potentially higher
689 dnl ------------------------------------
690 elif test x"$opsys" = x"sol9"; then
692 AC_DEFINE(HAVE_IPV6, 1, IPv6)
693 AC_DEFINE(SOLARIS_IPV6, 1, Solaris IPv6)
696 AC_MSG_RESULT(Solaris IPv6)
700 elif test "${enable_ipv6}" = "yes"; then
702 #include <linux/version.h>
703 /* 2.1.128 or later */
704 #if LINUX_VERSION_CODE >= 0x020180
708 zebra_cv_linux_ipv6=yes
709 AC_MSG_RESULT(Linux IPv6)])
711 if test x`ls /proc/net/ipv6_route 2>/dev/null` = x"/proc/net/ipv6_route"
714 zebra_cv_linux_ipv6=yes
715 AC_MSG_RESULT(Linux IPv6)
719 if test "$zebra_cv_linux_ipv6" = "yes";then
720 AC_MSG_CHECKING(for GNU libc >= 2.1)
721 AC_DEFINE(HAVE_IPV6,1,Linux IPv6)
723 #include <features.h>
724 #if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
728 AC_DEFINE(LINUX_IPV6,1,Linux IPv6 stack)
734 if test "$glibc" != "yes"; then
735 INCLUDES="-I/usr/inet6/include"
736 if test x`ls /usr/inet6/lib/libinet6.a 2>/dev/null` != x;then
737 LIB_IPV6="-L/usr/inet6/lib -linet6"
742 dnl -----------------------
743 dnl Set IPv6 related values
744 dnl -----------------------
745 LIBS="$LIB_IPV6 $LIBS"
748 if test x"$RIPNGD" = x""; then
749 AC_MSG_RESULT(IPv4 only)
753 dnl ------------------
754 dnl IPv6 header checks
755 dnl ------------------
756 if test "x${zebra_cv_ipv6}" = "xyes"; then
757 AC_CHECK_HEADERS([netinet6/in6.h netinet/in6_var.h netinet/icmp6.h \
758 netinet6/in6_var.h netinet6/nd6.h])
761 dnl --------------------
762 dnl Daemon disable check
763 dnl --------------------
764 if test "${enable_zebra}" = "no";then
770 if test "${enable_bgpd}" = "no";then
776 if test "${enable_ripd}" = "no";then
782 if test "${enable_ospfd}" = "no";then
788 if test "${enable_watchquagga}" = "no";then
791 WATCHQUAGGA="watchquagga"
795 if test "${enable_opaque_lsa}" = "yes"; then
796 if test "${enable_ospfapi}" != "no";then
797 AC_DEFINE(SUPPORT_OSPF_API,,OSPFAPI)
799 if test "${enable_ospfclient}" != "no";then
800 OSPFCLIENT="ospfclient"
806 case "${enable_ripngd}" in
807 "yes") RIPNGD="ripngd";;
812 case "${enable_ospf6d}" in
813 "yes") OSPF6D="ospf6d";;
818 case "${enable_isisd}" in
819 "yes") ISISD="isisd";;
824 if test "${enable_bgp_announce}" = "no";then
825 AC_DEFINE(DISABLE_BGP_ANNOUNCE,,Disable BGP installation to zebra)
834 AC_SUBST(WATCHQUAGGA)
841 AC_CHECK_LIB(c, inet_ntop, [AC_DEFINE(HAVE_INET_NTOP,,inet_ntop)])
842 AC_CHECK_LIB(c, inet_pton, [AC_DEFINE(HAVE_INET_PTON,,inet_pton)])
843 AC_CHECK_LIB(crypt, crypt)
844 AC_CHECK_LIB(resolv, res_init)
845 AC_CHECK_LIB(m, main)
847 dnl ---------------------------------------------------
848 dnl BSD/OS 4.1 define inet_XtoY function as __inet_XtoY
849 dnl ---------------------------------------------------
850 AC_CHECK_FUNC(__inet_ntop, AC_DEFINE(HAVE_INET_NTOP,,__inet_ntop))
851 AC_CHECK_FUNC(__inet_pton, AC_DEFINE(HAVE_INET_PTON,,__inet_pton))
852 AC_CHECK_FUNC(__inet_aton, AC_DEFINE(HAVE_INET_ATON,,__inet_aton))
854 dnl ---------------------------
855 dnl check system has GNU regexp
856 dnl ---------------------------
857 dnl AC_MSG_CHECKING(whether system has GNU regex)
858 AC_CHECK_LIB(c, regexec,
859 [AC_DEFINE(HAVE_GNU_REGEX,,GNU regexp library)
861 [LIB_REGEX="regex.o"])
864 dnl ------------------
865 dnl check SNMP library
866 dnl ------------------
867 if test "${enable_snmp}" = "yes";then
868 dnl AC_CHECK_LIB(snmp, asn_parse_int, HAVE_SNMP=yes)
869 if test "${HAVE_SNMP}" = ""; then
872 unset ac_cv_lib_snmp_asn_parse_int
873 AC_CHECK_LIB(crypto, main, NEED_CRYPTO=yes, )
874 if test "${NEED_CRYPTO}" = ""; then
875 AC_CHECK_LIB(netsnmp, asn_parse_int, [HAVE_NETSNMP=yes; HAVE_SNMP=yes ])
877 AC_CHECK_LIB(netsnmp, asn_parse_int, [HAVE_NETSNMP=yes; HAVE_SNMP=yes; NEED_CRYPTO=yes;LIBS="$LIBS -lcrypto" ],,"-lcrypto")
881 if test "${HAVE_SNMP}" = ""; then
884 unset ac_cv_lib_snmp_asn_parse_int
885 AC_CHECK_LIB(snmp, asn_parse_int, HAVE_SNMP=yes, )
886 if test "${HAVE_SNMP}" = ""; then
887 unset ac_cv_lib_snmp_asn_parse_int
888 AC_CHECK_LIB(crypto, main, NEED_CRYPTO=yes, )
889 if test "${NEED_CRYPTO}" = "yes"; then
890 AC_CHECK_LIB(snmp, asn_parse_int, [HAVE_SNMP=yes; NEED_CRYPTO=yes; LIBS="$LIBS -lcrypto" ],,"-lcrypto")
896 if test "${HAVE_SNMP}" = ""; then
898 LIBS="-L/usr/local/lib"
899 unset ac_cv_lib_snmp_asn_parse_int
900 AC_CHECK_LIB(snmp, asn_parse_int, HAVE_SNMP=yes)
901 if test "${HAVE_SNMP}" = ""; then
902 unset ac_cv_lib_snmp_asn_parse_int
903 AC_CHECK_LIB(crypto, main, NEED_CRYPTO=yes, )
904 if test "${NEED_CRYPTO}" = "yes"; then
905 AC_CHECK_LIB(snmp, asn_parse_int, [HAVE_SNMP=yes; NEED_CRYPTO=yes; LIBS="$LIBS -lcrypto" ],,"-lcrypto")
911 if test "${HAVE_SNMP}" = "yes"; then
912 for ac_snmp in /usr/include/net-snmp/library/asn1.h /usr/include/ucd-snmp/asn1.h /usr/local/include/ucd-snmp/asn1.h /dev/null
914 test -f "${ac_snmp}" && break
918 /usr/include/net-snmp/*)
919 AC_DEFINE(HAVE_SNMP,,SNMP)
920 AC_DEFINE(HAVE_NETSNMP,,SNMP)
921 AC_DEFINE(UCD_COMPATIBLE,,SNMP)
922 CFLAGS="${CFLAGS} -I/usr/include/net-snmp -I/usr/include/net-snmp/library"
923 if test "${HAVE_NETSNMP}" = "yes"; then
924 LIBS="${LIBS} -lnetsnmp"
926 LIBS="${LIBS} -lsnmp"
929 /usr/include/ucd-snmp/*)
930 AC_DEFINE(HAVE_SNMP,,SNMP)
931 CFLAGS="${CFLAGS} -I/usr/include/ucd-snmp"
932 LIBS="${LIBS} -lsnmp"
934 /usr/local/include/ucd-snmp/*)
935 AC_DEFINE(HAVE_SNMP,,SNMP)
936 CFLAGS="${CFLAGS} -I/usr/local/include/ucd-snmp"
937 LIBS="${LIBS} -L/usr/local/lib -lsnmp"
939 /usr/local/include/net-snmp/*)
940 AC_DEFINE(HAVE_SNMP,,SNMP)
941 AC_DEFINE(HAVE_NET_SNMP,,SNMP)
942 AC_DEFINE(UCD_COMPATIBLE,,SNMP)
943 CFLAGS="${CFLAGS} -I/usr/local/include/net-snmp"
944 LIBS="${LIBS} -L/usr/local/lib -lnetsnmp"
947 if test "${NEED_CRYPTO}" = "yes"; then
948 LIBS="${LIBS} -lcrypto"
953 if test "${enable_snmp}" = "yes" -a "${HAVE_SNMP}" != "yes"; then
954 AC_MSG_ERROR([--enable-snmp given, but cannot find support for SNMP])
957 dnl ----------------------------
958 dnl check sa_len of sockaddr
959 dnl ----------------------------
960 AC_MSG_CHECKING(whether struct sockaddr has a sa_len field)
961 AC_TRY_COMPILE([#include <sys/types.h>
962 #include <sys/socket.h>
963 ],[static struct sockaddr ac_i;int ac_j = sizeof (ac_i.sa_len);],
965 AC_DEFINE(HAVE_SA_LEN,,sa_len)],
968 dnl ----------------------------
969 dnl check sin_len of sockaddr_in
970 dnl ----------------------------
971 AC_MSG_CHECKING(whether struct sockaddr_in has a sin_len field)
972 AC_TRY_COMPILE([#include <sys/types.h>
973 #include <netinet/in.h>
974 ],[static struct sockaddr_in ac_i;int ac_j = sizeof (ac_i.sin_len);],
976 AC_DEFINE(HAVE_SIN_LEN,,sin_len)],
979 dnl ----------------------------
980 dnl check sun_len of sockaddr_un
981 dnl ----------------------------
982 AC_MSG_CHECKING(whether struct sockaddr_un has a sun_len field)
983 AC_TRY_COMPILE([#include <sys/types.h>
985 ],[static struct sockaddr_un ac_i;int ac_j = sizeof (ac_i.sun_len);],
987 AC_DEFINE(HAVE_SUN_LEN,,sun_len)],
990 dnl -----------------------------------
991 dnl check sin6_scope_id of sockaddr_in6
992 dnl -----------------------------------
993 if test "$zebra_cv_ipv6" = yes; then
994 AC_MSG_CHECKING(whether struct sockaddr_in6 has a sin6_scope_id field)
995 AC_TRY_COMPILE([#include <sys/types.h>
996 #include <netinet/in.h>
997 ],[static struct sockaddr_in6 ac_i;int ac_j = sizeof (ac_i.sin6_scope_id);],
999 AC_DEFINE(HAVE_SIN6_SCOPE_ID,,scope id)],
1003 dnl ----------------------------
1004 dnl check socklen_t exist or not
1005 dnl ----------------------------
1006 AC_MSG_CHECKING(whther socklen_t is defined)
1007 AC_TRY_COMPILE([#include <sys/types.h>
1008 #include <sys/socket.h>
1009 #include <netinet/in.h>
1010 ],[socklen_t ac_x;],
1012 AC_DEFINE(HAVE_SOCKLEN_T,,socklen_t)],
1015 dnl ------------------------
1016 dnl check struct sockaddr_dl
1017 dnl ------------------------
1018 AC_MSG_CHECKING(whether struct sockaddr_dl exist)
1019 AC_EGREP_HEADER(sockaddr_dl,
1022 AC_DEFINE(HAVE_SOCKADDR_DL,,sockaddr_dl)],
1025 dnl --------------------------
1026 dnl check structure ifaliasreq
1027 dnl --------------------------
1028 AC_MSG_CHECKING(whether struct ifaliasreq exist)
1029 AC_EGREP_HEADER(ifaliasreq,
1032 AC_DEFINE(HAVE_IFALIASREQ,,ifaliasreq)],
1035 dnl ----------------------------
1036 dnl check structure in6_aliasreq
1037 dnl ----------------------------
1038 AC_MSG_CHECKING(whether struct in6_aliasreq exist)
1039 AC_EGREP_HEADER(in6_aliasreq,
1042 AC_DEFINE(HAVE_IN6_ALIASREQ,,in6_aliasreq)],
1045 dnl -----------------------------------
1046 dnl check ifra_lifetime of in6_aliasreq
1047 dnl -----------------------------------
1048 AC_MSG_CHECKING(whether in6_aliasreq.ifra_lifetime exist)
1049 AC_TRY_COMPILE([#include <sys/types.h>
1050 #include <netinet6/in6_var.h>
1051 ],[static struct if6_aliasreq ac_i;int ac_j = sizeof (ac_i.ifra_lifetime);],
1053 AC_DEFINE(HAVE_IFRA_LIFETIME,,Have in6_aliasreq.ifra_lifetime)],
1056 dnl ---------------------------
1057 dnl check structure rt_addrinfo
1058 dnl ---------------------------
1059 AC_MSG_CHECKING(whether struct rt_addrinfo exist)
1060 AC_EGREP_HEADER(rt_addrinfo,
1063 AC_DEFINE(HAVE_RT_ADDRINFO,,rt_addrinfo)],
1066 dnl --------------------------
1067 dnl check structure in_pktinfo
1068 dnl --------------------------
1069 AC_MSG_CHECKING(whether struct in_pktinfo exist)
1070 AC_TRY_COMPILE([#include <netinet/in.h>
1071 ],[struct in_pktinfo ac_x;],
1073 AC_DEFINE(HAVE_INPKTINFO,,in_pktinfo)],
1076 dnl --------------------------------------
1077 dnl checking for getrusage struct and call
1078 dnl --------------------------------------
1079 AC_MSG_CHECKING(whether getrusage is available)
1080 AC_TRY_COMPILE([#include <sys/resource.h>
1081 ],[struct rusage ac_x; getrusage (RUSAGE_SELF, &ac_x);],
1083 AC_DEFINE(HAVE_RUSAGE,,rusage)],
1086 dnl -------------------
1087 dnl capabilities checks
1088 dnl -------------------
1089 if test "${enable_capabilities}" != "no"; then
1090 AC_MSG_CHECKING(whether prctl PR_SET_KEEPCAPS is available)
1091 AC_TRY_COMPILE([#include <sys/prctl.h>],[prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0);],
1093 AC_DEFINE(HAVE_PR_SET_KEEPCAPS,,prctl)
1094 quagga_ac_keepcaps="yes"],
1097 if test x"${quagga_ac_keepcaps}" = x"yes"; then
1098 AC_CHECK_HEADERS(sys/capability.h)
1100 if test x"${ac_cv_header_sys_capability_h}" = x"yes"; then
1101 AC_CHECK_LIB(cap, cap_init,
1102 [AC_DEFINE(HAVE_LCAPS,1,Capabilities)
1110 dnl -------------------
1111 dnl test for ucontext.h
1112 dnl -------------------
1113 AC_CHECK_HEADERS(ucontext.h)
1115 dnl ---------------------------
1116 dnl check for glibc 'backtrace'
1117 dnl ---------------------------
1118 if test "${glibc}" = "yes"; then
1119 AC_CHECK_HEADER(execinfo.h)
1121 if test x"${ac_cv_header_execinfo_h}" = x"yes"; then
1122 AC_CHECK_FUNC(backtrace,
1123 [AC_DEFINE(HAVE_GLIBC_BACKTRACE,,Glibc backtrace)]
1130 CONFDATE=`date '+%Y%m%d'`
1133 dnl ------------------------------
1134 dnl set paths for state directory
1135 dnl ------------------------------
1136 if test "${prefix}" = "NONE"; then
1137 quagga_statedir_prefix="";
1139 quagga_statedir_prefix=${prefix}
1141 if test "${localstatedir}" = '${prefix}/var'; then
1142 AC_CACHE_CHECK(state directory,ac_statedir,
1143 [for QUAGGA_STATE_DIR in ${quagga_statedir_prefix}/var/run dnl
1144 ${quagga_statedir_prefix}/var/adm dnl
1145 ${quagga_statedir_prefix}/etc dnl
1151 test -d $QUAGGA_STATE_DIR && break
1153 quagga_statedir=$QUAGGA_STATE_DIR])
1155 quagga_statedir=${localstatedir}
1156 AC_MSG_CHECKING(directory to use for state file)
1157 AC_MSG_RESULT(${quagga_statedir})
1159 if test $quagga_statedir = "/dev/null"; then
1160 AC_MSG_ERROR('STATE DIRECTORY NOT FOUND! FIX OR SPECIFY --localstatedir!')
1163 AC_DEFINE_UNQUOTED(PATH_ZEBRA_PID, "$quagga_statedir/zebra.pid",zebra PID)
1164 AC_DEFINE_UNQUOTED(PATH_RIPD_PID, "$quagga_statedir/ripd.pid",ripd PID)
1165 AC_DEFINE_UNQUOTED(PATH_RIPNGD_PID, "$quagga_statedir/ripngd.pid",ripngd PID)
1166 AC_DEFINE_UNQUOTED(PATH_BGPD_PID, "$quagga_statedir/bgpd.pid",bgpd PID)
1167 AC_DEFINE_UNQUOTED(PATH_OSPFD_PID, "$quagga_statedir/ospfd.pid",ospfd PID)
1168 AC_DEFINE_UNQUOTED(PATH_OSPF6D_PID, "$quagga_statedir/ospf6d.pid",ospf6d PID)
1169 AC_DEFINE_UNQUOTED(PATH_ISISD_PID, "$quagga_statedir/isisd.pid",isisd PID)
1170 AC_DEFINE_UNQUOTED(PATH_WATCHQUAGGA_PID, "$quagga_statedir/watchquagga.pid",watchquagga PID)
1171 AC_DEFINE_UNQUOTED(ZEBRA_SERV_PATH, "$quagga_statedir/zserv.api",zebra api socket)
1172 AC_DEFINE_UNQUOTED(ZEBRA_VTYSH_PATH, "$quagga_statedir/zebra.vty",zebra vty socket)
1173 AC_DEFINE_UNQUOTED(RIP_VTYSH_PATH, "$quagga_statedir/ripd.vty",rip vty socket)
1174 AC_DEFINE_UNQUOTED(RIPNG_VTYSH_PATH, "$quagga_statedir/ripngd.vty",ripng vty socket)
1175 AC_DEFINE_UNQUOTED(BGP_VTYSH_PATH, "$quagga_statedir/bgpd.vty",bgpd vty socket)
1176 AC_DEFINE_UNQUOTED(OSPF_VTYSH_PATH, "$quagga_statedir/ospfd.vty",ospfd vty socket)
1177 AC_DEFINE_UNQUOTED(OSPF6_VTYSH_PATH, "$quagga_statedir/ospf6d.vty",ospf6d vty socket)
1178 AC_DEFINE_UNQUOTED(ISIS_VTYSH_PATH, "$quagga_statedir/isisd.vty",isisd vty socket)
1179 AC_DEFINE_UNQUOTED(DAEMON_VTY_DIR, "$quagga_statedir",daemon vty directory)
1181 dnl ---------------------------
1182 dnl Check htonl works correctly
1183 dnl ---------------------------
1184 AC_MSG_CHECKING(for working htonl)
1185 AC_CACHE_VAL(ac_cv_htonl_works, [
1186 AC_TRY_LINK([#ifdef HAVE_SYS_TYPES_H
1187 #include <sys/types.h>
1192 #ifdef HAVE_NETINET_IN_H
1193 #include <netinet/in.h>
1196 ac_cv_htonl_works=yes,
1197 ac_cv_htonl_works=no)])
1198 AC_MSG_RESULT($ac_cv_htonl_works)
1200 AC_CONFIG_FILES([Makefile lib/Makefile zebra/Makefile ripd/Makefile
1201 ripngd/Makefile bgpd/Makefile ospfd/Makefile watchquagga/Makefile
1202 ospf6d/Makefile isisd/Makefile vtysh/Makefile doc/Makefile
1203 ospfclient/Makefile tests/Makefile m4/Makefile redhat/Makefile
1208 pkgsrc/bgpd.sh pkgsrc/ospf6d.sh pkgsrc/ospfd.sh
1209 pkgsrc/ripd.sh pkgsrc/ripngd.sh pkgsrc/zebra.sh])
1210 AC_CONFIG_FILES([vtysh/extract.pl],[chmod +x vtysh/extract.pl])
1211 ## Hack, but working solution to avoid rebuilding of quagga.info.
1212 ## It's already in CVS until texinfo 4.7 is more common.
1213 AC_CONFIG_COMMANDS([info-time],[touch doc/quagga.info])
1217 Quagga configuration
1218 --------------------
1219 quagga version : ${PACKAGE_VERSION}
1220 host operationg system : ${host_os}
1221 source code location : ${srcdir}
1223 compiler flags : ${CFLAGS}
1224 linker flags : ${LDFLAGS} ${LIBS}
1225 state file directory : ${quagga_statedir}
1226 config file directory : `eval echo \`echo ${sysconfdir}\``
1227 example directory : `eval echo \`echo ${exampledir}\``
1228 user to run as : ${enable_user}
1229 group to run as : ${enable_group}
1230 group for vty sockets : ${enable_vty_group}
1231 config file mask : ${enable_configfile_mask}
1232 log file mask : ${enable_logfile_mask}
1234 The above user and group must have read/write access to the state file
1235 directory and to the config files in the config file directory.