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.23, [https://bugzilla.quagga.net])
11 AC_CONFIG_SRCDIR(lib/zebra.h)
12 AC_CONFIG_MACRO_DIR([m4])
14 dnl -----------------------------------
15 dnl Get hostname and other information.
16 dnl -----------------------------------
22 AC_CONFIG_HEADERS(config.h)
24 AC_PATH_PROG(PERL, perl)
25 AC_CHECK_PROG([GAWK],[gawk],[gawk],[not-in-PATH])
26 if test "x$GAWK" = "xnot-in-PATH" ; then
27 AC_MSG_ERROR([GNU awk is required for lib/memtype.h made by memtypes.awk.
28 BSD awk complains: awk: gensub doesn't support backreferences (subst "\1") ])
30 AC_ARG_VAR([GAWK],[GNU AWK])
32 dnl default is to match previous behavior
33 exampledir=${sysconfdir}
34 AC_ARG_ENABLE([exampledir],
35 AC_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 AC_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
52 LIBS="$LIBS -L/usr/include/json/ -ljson"
58 [ --with-cflags Set CFLAGS for use in compilation.])
59 if test "x$with_cflags" != "x" ; then
60 CFLAGS="$with_cflags" ; cflags_specified=yes ;
61 elif test -n "$CFLAGS" ; then
62 cflags_specified=yes ;
65 AC_ARG_ENABLE(tcmalloc,
66 [ --enable-tcmalloc Turn on tcmalloc],
67 [case "${enableval}" in
68 yes) tcmalloc_enabled=true
69 LIBS="$LIBS -ltcmalloc_minimal"
71 no) tcmalloc_enabled=false ;;
72 *) AC_MSG_ERROR(bad value ${enableval} for --enable-tcmalloc) ;;
73 esac],[tcmalloc_enabled=false])
76 dnl --------------------
77 dnl Check CC and friends
78 dnl --------------------
85 dnl autoconf 2.59 appears not to support AC_PROG_SED
87 AC_CHECK_PROG([SED],[sed],[sed],[/bin/false])
89 dnl pdflatex and latexmk are needed to build HACKING.pdf
90 AC_CHECK_PROG([PDFLATEX],[pdflatex],[pdflatex],[/bin/false])
91 AC_CHECK_PROG([LATEXMK],[latexmk],[latexmk],[/bin/false])
92 if test "x$PDFLATEX" = "x/bin/false" -o "x$LATEXMK" = "x/bin/false"; then
93 AC_MSG_WARN([Will not be able to make PDF versions of TeX documents])
97 AM_CONDITIONAL([HAVE_LATEX], [test "x$HAVE_LATEX" = "xtrue"])
99 dnl ------------------------------------------------------------------
100 dnl Intel compiler check. Although Intel tries really hard to make icc
101 dnl look like gcc, there are some differences. It's very verbose with
102 dnl -Wall and it doesn't support the individual -W options.
103 dnl ------------------------------------------------------------------
104 if test "x${GCC}" = "xyes" ; then
106 AC_MSG_CHECKING([whether we are using the Intel compiler])
107 AC_EGREP_CPP([^__INTEL_COMPILER], [__INTEL_COMPILER],
108 [AC_MSG_RESULT([no])],
110 AC_MSG_RESULT([yes])]
113 AC_MSG_CHECKING([whether we are using SunPro compiler])
114 AC_EGREP_CPP([^__SUNPRO_C.*0x5(7|8|9)], ["__SUNPRO_C" __SUNPRO_C],
115 [AC_MSG_RESULT([no])],
117 AC_MSG_RESULT([yes])]
121 dnl ---------------------------------------------
122 dnl If CLFAGS doesn\'t exist set default value
123 dnl AC_PROG_CC will have set minimal default
124 dnl already, eg "-O2 -g" for gcc, "-g" for others
125 dnl (Wall is gcc specific... have to make sure
126 dnl gcc is being used before setting it)
128 dnl Intel icc 8.0 also sets __GNUC__,
129 dnl but doesn't support all these fancy -W options.
130 dnl Intel compiler warnings we ignore:
131 dnl 279: controlling expression is constant.
132 dnl 869: parameter "xxx" was never referenced - to avoid massive warnings
133 dnl about "self", "vty", "argc" and "argv" never referenced in DEFUN
135 dnl 981: operands are evaluated in unspecified order.
137 dnl Sun Studio 10 / SunPro 5.7 is also supported,
138 dnl so lets set some sane CFLAGS for it.
139 dnl ---------------------------------------------
141 AC_MSG_CHECKING([whether to set a default CFLAGS])
142 if test "x${cflags_specified}" = "x" ; then
145 CFLAGS="-Os -g -Wall"
146 AC_MSG_RESULT([Intel default])
149 CFLAGS="-Os -fno-omit-frame-pointer -g -std=gnu99 -Wall"
150 CFLAGS="${CFLAGS} -Wsign-compare -Wpointer-arith"
151 CFLAGS="${CFLAGS} -Wbad-function-cast -Wwrite-strings"
152 CFLAGS="${CFLAGS} -Wmissing-prototypes -Wmissing-declarations"
153 CFLAGS="${CFLAGS} -Wchar-subscripts -Wcast-qual"
154 # TODO: conditionally addd -Wpacked if handled
155 AC_MSG_RESULT([gcc default])
158 CFLAGS="-xO4 -v -g -xspace -xcode=pic32 -xstrconst -xc99"
159 AC_MSG_RESULT([SunPro default])
162 AC_MSG_RESULT([unknown compiler])
166 AC_MSG_RESULT([CFLAGS supplied by user])
175 AC_CHECK_TOOL(AR, ar)
177 dnl ---------------------------
178 dnl We, perhaps unfortunately,
179 dnl depend on GNU Make specific
181 dnl Give the user a warning if
183 dnl ---------------------------
184 AC_CACHE_CHECK([if ${MAKE-make} is GNU make], [quagga_cv_gnu_make],
185 [quagga_cv_gnu_make=no
186 if ${MAKE-make} --version 2>/dev/null | \
187 grep '^GNU Make ' >/dev/null ; then
188 quagga_cv_gnu_make=yes;
193 dnl -----------------
194 dnl System extensions
195 dnl -----------------
203 dnl ----------------------
204 dnl Packages configuration
205 dnl ----------------------
206 AC_ARG_WITH(pkg-extra-version,
207 AS_HELP_STRING([--with-pkg-extra-version=VER], [add extra version field, for packagers/distributions]),
208 [EXTRAVERSION=$withval],)
209 AC_ARG_WITH(pkg-git-version,
210 AS_HELP_STRING([--with-pkg-git-version], [add git information to MOTD and build version string]),
211 [ test "x$withval" != "xno" && with_pkg_git_version="yes" ])
213 [ --enable-vtysh include integrated vty shell for Quagga])
215 [ --disable-ipv6 turn off IPv6 related features and daemons])
217 [ --disable-doc do not build docs])
219 [ --disable-zebra do not build zebra daemon])
221 [ --disable-bgpd do not build bgpd])
223 [ --disable-ripd do not build ripd])
224 AC_ARG_ENABLE(ripngd,
225 [ --disable-ripngd do not build ripngd])
227 [ --disable-ospfd do not build ospfd])
228 AC_ARG_ENABLE(ospf6d,
229 [ --disable-ospf6d do not build ospf6d])
230 AC_ARG_ENABLE(babeld,
231 [ --disable-babeld do not build babeld])
232 AC_ARG_ENABLE(watchquagga,
233 [ --disable-watchquagga do not build watchquagga])
235 [ --enable-isisd build isisd])
236 AC_ARG_ENABLE(solaris,
237 [ --enable-solaris build solaris])
238 AC_ARG_ENABLE(bgp-announce,
239 [ --disable-bgp-announce, turn off BGP route announcement])
240 AC_ARG_ENABLE(netlink,
241 [ --enable-netlink force to use Linux netlink interface])
242 AC_ARG_ENABLE(broken-aliases,
243 [ --enable-broken-aliases enable aliases as distinct interfaces for Linux 2.2.X])
245 [ --enable-snmp=ARG enable SNMP support (smux or agentx)])
247 [ --with-libpam use libpam for PAM support in vtysh])
248 AC_ARG_ENABLE(tcp-zebra,
249 [ --enable-tcp-zebra enable TCP/IP socket connection between zebra and protocol daemon])
250 AC_ARG_ENABLE(opaque-lsa,
251 AC_HELP_STRING([--disable-opaque-lsa],[do not build OSPF Opaque-LSA with OSPFAPI support (RFC2370)]))
252 AC_ARG_ENABLE(ospfapi,
253 [ --disable-ospfapi do not build OSPFAPI to access the OSPF LSA Database])
254 AC_ARG_ENABLE(ospfclient,
255 [ --disable-ospfclient do not build OSPFAPI client for OSPFAPI,
256 (this is the default if --disable-ospfapi is set)])
257 AC_ARG_ENABLE(ospf-te,
258 AC_HELP_STRING([--disable-ospf-te],[disable Traffic Engineering Extension to OSPF]))
259 AC_ARG_ENABLE(multipath,
260 [ --enable-multipath=ARG enable multipath function, ARG must be digit])
262 AC_HELP_STRING([--enable-user=user], [user to run Quagga suite as (default quagga)]))
264 AC_HELP_STRING([--enable-group=group], [group to run Quagga suite as (default quagga)]))
265 AC_ARG_ENABLE(vty_group,
266 [ --enable-vty-group=ARG set vty sockets to have specified group as owner])
267 AC_ARG_ENABLE(configfile_mask,
268 [ --enable-configfile-mask=ARG set mask for config files])
269 AC_ARG_ENABLE(logfile_mask,
270 [ --enable-logfile-mask=ARG set mask for log files])
273 [ --disable-rtadv disable IPV6 router advertisement feature])
275 [ --enable-irdp enable IRDP server support in zebra])
276 AC_ARG_ENABLE(isis_topology,
277 [ --enable-isis-topology enable IS-IS topology generator])
278 AC_ARG_ENABLE(capabilities,
279 [ --disable-capabilities disable using POSIX capabilities])
280 AC_ARG_ENABLE(rusage,
281 [ --disable-rusage disable using getrusage])
282 AC_ARG_ENABLE(gcc_ultra_verbose,
283 [ --enable-gcc-ultra-verbose enable ultra verbose GCC warnings])
284 AC_ARG_ENABLE(linux24_tcp_md5,
285 [ --enable-linux24-tcp-md5 enable support for old, Linux-2.4 RFC2385 patch])
286 AC_ARG_ENABLE(gcc-rdynamic,
287 [ --enable-gcc-rdynamic enable linking with -rdynamic for better backtraces (default if gcc)])
288 AC_ARG_ENABLE(backtrace,
289 [ --disable-backtrace, disable crash backtraces (default autodetect)])
290 AC_ARG_ENABLE(time-check,
291 [ --disable-time-check disable slow thread warning messages])
292 AC_ARG_ENABLE(pcreposix,
293 [ --enable-pcreposix enable using PCRE Posix libs for regex functions])
295 [ --enable-fpm enable Forwarding Plane Manager support])
297 if test x"${enable_gcc_ultra_verbose}" = x"yes" ; then
298 CFLAGS="${CFLAGS} -W -Wcast-qual -Wstrict-prototypes"
299 CFLAGS="${CFLAGS} -Wmissing-declarations -Wmissing-noreturn"
300 CFLAGS="${CFLAGS} -Wmissing-format-attribute -Wunreachable-code"
301 CFLAGS="${CFLAGS} -Wpacked -Wpadded"
304 if test x"${enable_gcc_rdynamic}" != x"no" ; then
305 if test x"${enable_gcc_rdynamic}" = x"yes" -o x"$COMPILER" = x"GCC"; then
306 LDFLAGS="${LDFLAGS} -rdynamic"
310 if test x"${enable_time_check}" != x"no" ; then
311 if test x"${enable_time_check}" = x"yes" -o x"${enable_time_check}" = x ; then
312 AC_DEFINE(CONSUMED_TIME_CHECK,5000000,Consumed Time Check)
314 AC_DEFINE_UNQUOTED(CONSUMED_TIME_CHECK,$enable_time_check,Consumed Time Check)
318 if test "${enable_fpm}" = "yes"; then
319 AC_DEFINE(HAVE_FPM,,Forwarding Plane Manager support)
322 if test "${enable_broken_aliases}" = "yes"; then
323 if test "${enable_netlink}" = "yes"
325 AC_MSG_FAILURE([Sorry you can not use netlink with broken aliases])
327 AC_DEFINE(HAVE_BROKEN_ALIASES,,Broken Alias)
331 if test "${enable_tcp_zebra}" = "yes"; then
332 AC_DEFINE(HAVE_TCP_ZEBRA,,Use TCP for zebra communication)
335 if test "${enable_opaque_lsa}" != "no"; then
336 AC_DEFINE(HAVE_OPAQUE_LSA,,OSPF Opaque LSA)
339 if test "${enable_ospf_te}" != "no"; then
340 AC_DEFINE(HAVE_OPAQUE_LSA,,OSPF Opaque LSA)
341 AC_DEFINE(HAVE_OSPF_TE,,OSPF TE)
344 if test "${enable_linux24_tcp_md5}" = "yes"; then
345 AC_DEFINE(HAVE_TCP_MD5_LINUX24,,Old Linux 2.4 TCP MD5 Signature Patch)
348 AC_MSG_CHECKING(if zebra should be configurable to send Route Advertisements)
349 if test "${enable_rtadv}" != "no"; then
351 AC_DEFINE(HAVE_RTADV,,Enable IPv6 Routing Advertisement support)
356 if test "${enable_irdp}" = "yes"; then
357 AC_DEFINE(HAVE_IRDP,, IRDP )
360 if test "${enable_isisd}" = "yes" && test "${enable_isis_topology}" = yes; then
361 AC_DEFINE(TOPOLOGY_GENERATE,,Enable IS-IS topology generator code)
362 ISIS_TOPOLOGY_INCLUDES="-I\$(srcdir)/topology"
363 ISIS_TOPOLOGY_DIR="topology"
364 ISIS_TOPOLOGY_LIB="./topology/libtopology.a"
367 AC_SUBST(ISIS_TOPOLOGY_INCLUDES)
368 AC_SUBST(ISIS_TOPOLOGY_DIR)
369 AC_SUBST(ISIS_TOPOLOGY_LIB)
371 if test "${enable_user}" = "yes" || test x"${enable_user}" = x""; then
373 elif test "${enable_user}" = "no"; then
377 if test "${enable_group}" = "yes" || test x"${enable_group}" = x""; then
378 enable_group="quagga"
379 elif test "${enable_group}" = "no"; then
383 if test x"${enable_vty_group}" = x"yes" ; then
384 AC_MSG_ERROR([--enable-vty-group requires a group as argument, not yes])
385 elif test x"${enable_vty_group}" != x""; then
386 if test x"${enable_vty_group}" != x"no"; then
387 AC_DEFINE_UNQUOTED(VTY_GROUP, "${enable_vty_group}", VTY Sockets Group)
390 AC_SUBST([enable_user])
391 AC_SUBST([enable_group])
392 AC_SUBST([enable_vty_group])
393 AC_DEFINE_UNQUOTED(QUAGGA_USER, "${enable_user}", Quagga User)
394 AC_DEFINE_UNQUOTED(QUAGGA_GROUP, "${enable_group}", Quagga Group)
396 enable_configfile_mask=${enable_configfile_mask:-0600}
397 AC_DEFINE_UNQUOTED(CONFIGFILE_MASK, ${enable_configfile_mask}, Mask for config files)
399 enable_logfile_mask=${enable_logfile_mask:-0600}
400 AC_DEFINE_UNQUOTED(LOGFILE_MASK, ${enable_logfile_mask}, Mask for log files)
404 case "${enable_multipath}" in
406 MULTIPATH_NUM="${enable_multipath}"
411 AC_MSG_FAILURE([Please specify digit to enable multipath ARG])
415 AC_SUBST(MULTIPATH_NUM)
417 dnl -----------------------------------
418 dnl Add extra version string to package
419 dnl name, string and version fields.
420 dnl -----------------------------------
421 if test "x${EXTRAVERSION}" != "x" ; then
422 VERSION="${VERSION}${EXTRAVERSION}"
423 PACKAGE_VERSION="${PACKAGE_VERSION}${EXTRAVERSION}"
424 PACKAGE_STRING="${PACKAGE_STRING}${EXTRAVERSION}"
427 if test "x$with_pkg_git_version" = "xyes"; then
428 if test -d "${srcdir}/.git"; then
429 AC_DEFINE(GIT_VERSION, [1], [include git version info])
430 else with_pkg_git_version="no"
431 AC_MSG_WARN([--with-pkg-git-version given, but this is not a git checkout])
434 AM_CONDITIONAL([GIT_VERSION], [test "x$with_pkg_git_version" = "xyes"])
436 dnl ------------------------------------
437 dnl Check C keywords and standard types
438 dnl ------------------------------------
453 dnl -------------------------
454 dnl Check other header files.
455 dnl -------------------------
456 AC_CHECK_HEADERS([stropts.h sys/ksym.h sys/times.h sys/select.h \
457 sys/types.h linux/version.h netdb.h asm/types.h \
458 sys/cdefs.h sys/param.h limits.h signal.h \
459 sys/socket.h netinet/in.h time.h sys/time.h])
461 dnl Utility macro to avoid retyping includes all the time
462 m4_define([QUAGGA_INCLUDES],
465 #define __EXTENSIONS__
477 # include <sys/types.h>
479 /* sys/conf.h depends on param.h on FBSD at least */
481 # include <sys/param.h>
483 /* Required for MAXSIG */
487 #if HAVE_SYS_SOCKET_H
488 # include <sys/socket.h>
491 # define __APPLE_USE_RFC_3542
493 #if HAVE_NETINET_IN_H
494 # include <netinet/in.h>
496 #ifdef TIME_WITH_SYS_TIME
497 # include <sys/time.h>
500 # ifdef HAVE_SYS_TIME_H
501 # include <sys/time.h>
505 #endif /* TIME_WITH_SYS_TIME */
508 dnl HAVE_NET_IF_H must be discovered by the time the longer AC_CHECK_HEADERS
509 dnl round below execution begins, otherwise it doesn't properly detect
510 dnl HAVE_NETINET6_IN6_VAR_H, HAVE_NET_IF_VAR_H and HAVE_STRUCT_IN6_ALIASREQ
511 dnl on FreeBSD (BZ#408).
513 AC_CHECK_HEADERS([net/if.h], [], [], QUAGGA_INCLUDES)
515 m4_define([QUAGGA_INCLUDES],
522 dnl Same applies for HAVE_NET_IF_VAR_H, which HAVE_NETINET6_ND6_H and
523 dnl HAVE_NETINET_IN_VAR_H depend upon. But if_var.h depends on if.h, hence
524 dnl an additional round for it.
526 AC_CHECK_HEADERS([net/if_var.h], [], [], QUAGGA_INCLUDES)
528 m4_define([QUAGGA_INCLUDES],
530 [#if HAVE_NET_IF_VAR_H
531 # include <net/if_var.h>
535 AC_CHECK_HEADERS([sys/un.h netinet/in_systm.h netinet/in_var.h \
536 net/if_dl.h net/netopt.h net/route.h \
537 inet/nd.h arpa/inet.h netinet/ip_icmp.h \
538 fcntl.h stddef.h sys/ioctl.h syslog.h wchar.h wctype.h \
539 sys/sysctl.h sys/sockio.h kvm.h sys/conf.h],
540 [], [], QUAGGA_INCLUDES)
542 AC_CHECK_HEADERS([ucontext.h], [], [],
545 #endif /* __USE_GNU */
549 m4_define([QUAGGA_INCLUDES],
554 #if HAVE_NETINET_IN_SYSTM_H
555 # include <netinet/in_systm.h>
557 #if HAVE_NETINET_IN_VAR_H
558 # include <netinet/in_var.h>
561 # include <net/if_dl.h>
563 #if HAVE_NET_NETOPT_H
564 # include <net/netopt.h>
567 # include <net/route.h>
570 # include <inet/nd.h>
573 # include <arpa/inet.h>
575 /* Required for IDRP */
576 #if HAVE_NETINET_IP_ICMP_H
577 # include <netinet/ip_icmp.h>
581 dnl V6 headers are checked below, after we check for v6
583 dnl Some systems (Solaris 2.x) require libnsl (Network Services Library)
585 [*-sunos5.[6-7]*] | [*-solaris2.[6-7]*])
587 AC_DEFINE(SUNOS_56, 1, SunOS 5.6 to 5.7)
588 AC_DEFINE(SUNOS_5, 1, SunOS 5)
589 AC_CHECK_LIB(xnet, main)
593 | [*-sunos5.1[0-9]] \
594 | [*-sunos5.1[0-9].[0-9]] \
595 | [*-solaris2.[8-9]] \
596 | [*-solaris2.1[0-9]] \
597 | [*-solaris2.1[0-9].[0-9]])
599 AC_DEFINE(SUNOS_59, 1, [SunOS 5.8 up])
600 AC_DEFINE(SUNOS_5, 1, [SunOS 5])
601 AC_CHECK_LIB(socket, main)
602 AC_CHECK_LIB(nsl, main)
603 AC_CHECK_LIB(umem, main)
604 AC_CHECK_FUNCS([printstack],
605 [AC_DEFINE([HAVE_PRINTSTACK],1,[Solaris printstack])
606 AC_DEFINE([HAVE_STACK_TRACE],1,[Stack symbols decode functionality])
610 *-sunos5* | *-solaris2*)
611 AC_DEFINE(SUNOS_5,,SunOS 5, Unknown SunOS)
612 AC_CHECK_LIB(socket, main)
613 AC_CHECK_LIB(nsl, main)
618 AC_DEFINE(GNU_LINUX,,GNU Linux)
621 AC_CHECK_LIB(nsl, gethostbyname)
622 AC_CHECK_LIB(socket, socket)
626 AC_DEFINE(OPEN_BSD,,OpenBSD)
630 OTHER_METHOD="mtu_kvm.o"
631 AC_CHECK_LIB(kvm, main)
635 AC_DEFINE(IRIX_65,,IRIX 6.5)
641 dnl ---------------------
642 dnl Integrated VTY option
643 dnl ---------------------
644 case "${enable_vtysh}" in
645 "yes") VTYSH="vtysh";
646 AC_DEFINE(VTYSH,,VTY shell)
647 dnl Vtysh uses libreadline, which looks for termcap functions at
648 dnl configure time. We follow readlines search order.
649 dnl The required procedures are in libtermcap on NetBSD, in
650 dnl [TODO] on Linux, and in [TODO] on Solaris.
651 AC_CHECK_LIB(termcap, tputs, LIBREADLINE="$LIBREADLINE -ltermcap",
652 [AC_CHECK_LIB(tinfo, tputs, LIBREADLINE="$LIBREADLINE -ltinfo",
653 [AC_CHECK_LIB(curses, tputs, LIBREADLINE="$LIBREADLINE -lcurses",
654 [AC_CHECK_LIB(ncurses, tputs,
655 LIBREADLINE="$LIBREADLINE -lncurses")]
659 AC_CHECK_LIB(readline, main, LIBREADLINE="$LIBREADLINE -lreadline",,
661 if test $ac_cv_lib_readline_main = no; then
662 AC_MSG_ERROR([vtysh needs libreadline but was not found and usable on your system.])
664 AC_CHECK_HEADER(readline/history.h)
665 if test $ac_cv_header_readline_history_h = no;then
666 AC_MSG_ERROR([readline is too old to have readline/history.h, please update to the latest readline library.])
668 AC_CHECK_LIB(readline, rl_completion_matches,
669 LIBREADLINE="$LIBREADLINE",, "$LIBREADLINE")
670 if test $ac_cv_lib_readline_rl_completion_matches = no; then
671 AC_DEFINE(rl_completion_matches,completion_matches,Old readline)
677 AC_SUBST(LIBREADLINE)
678 AM_CONDITIONAL(VTYSH, test "x$VTYSH" = "xvtysh")
683 dnl Quagga detects the PAM library it is built against by checking for a
684 dnl functional pam_misc.h (Linux-PAM) or openpam.h (OpenPAM) header. pam_misc.h
685 dnl is known to #include pam_appl.h, the standard header of a PAM library, and
686 dnl openpam.h doesn't do that, although depends on the header too. Hence a
687 dnl little assistance to AC_CHECK_HEADER is necessary for the proper detection
690 if test "$with_libpam" = "yes"; then
691 AC_CHECK_HEADER([security/pam_misc.h],
692 [AC_DEFINE(HAVE_PAM_MISC_H,,Have pam_misc.h)
693 AC_DEFINE(PAM_CONV_FUNC,misc_conv,Have misc_conv)
694 pam_conv_func="misc_conv"
697 AC_CHECK_HEADER([security/openpam.h],
698 [AC_DEFINE(HAVE_OPENPAM_H,,Have openpam.h)
699 AC_DEFINE(PAM_CONV_FUNC,openpam_ttyconv,Have openpam_ttyconv)
700 pam_conv_func="openpam_ttyconv"
702 [], QUAGGA_INCLUDES[#include <security/pam_appl.h>])
703 if test -z "$ac_cv_header_security_pam_misc_h$ac_cv_header_security_openpam_h" ; then
704 AC_MSG_WARN([*** pam support will not be built ***])
709 if test "$with_libpam" = "yes"; then
710 dnl took this test from proftpds configure.in and suited to our needs
711 dnl -------------------------------------------------------------------------
713 dnl This next check looks funky due to a linker problem with some versions
714 dnl of the PAM library. Prior to 0.72 release, the Linux PAM shared library
715 dnl omitted requiring libdl linking information. PAM-0.72 or better ships
716 dnl with RedHat 6.2 and Debian 2.2 or better.
717 AC_CHECK_LIB(pam, pam_start,
718 [AC_CHECK_LIB(pam, $pam_conv_func,
719 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
721 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
722 LIBPAM="-lpam -lpam_misc"]
726 [AC_CHECK_LIB(pam, pam_end,
727 [AC_CHECK_LIB(pam, $pam_conv_func,
728 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
729 LIBPAM="-lpam -ldl"],
730 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
731 LIBPAM="-lpam -ldl -lpam_misc"]
733 ],AC_MSG_WARN([*** pam support will not be built ***]),
740 dnl -------------------------------
741 dnl Endian-ness check
742 dnl -------------------------------
745 dnl -------------------------------
746 dnl check the size in byte of the C
747 dnl -------------------------------
748 dnl AC_CHECK_SIZEOF(char)
749 dnl AC_CHECK_SIZEOF(int)
750 dnl AC_CHECK_SIZEOF(short)
751 dnl AC_CHECK_SIZEOF(long)
753 dnl ----------------------------
754 dnl check existance of functions
755 dnl ----------------------------
763 AC_FUNC_SELECT_ARGTYPES
765 dnl Avoid AC_FUNC_STRNLEN because it pulls in AC_SYSTEM_EXTENSIONS which
766 dnl can lead to strange side effects. So we just check for strnlen
767 dnl directly, see below.
768 dnl AC_FUNC_STRNLENdnl
771 dnl -------------------------------
772 dnl bgpd needs pow() and hence libm
773 dnl -------------------------------
775 AC_CHECK_HEADER([math.h],
776 [AC_CHECK_LIB([m], [pow],
779 AC_DEFINE(HAVE_LIBM,, Have libm)
780 AC_CHECK_FUNCS(pow,[],[LIBM=""])
783 if test x"$LIBM" = x ; then
784 AC_MSG_WARN([Unable to find working pow function - bgpd may not link])
792 AC_CHECK_FUNCS([dup2 ftruncate getcwd gethostbyname getpagesize gettimeofday \
793 inet_ntoa inet_aton strnlen \
794 memchr memmove memset select socket \
795 strcasecmp strchr strcspn strdup strerror \
796 strncasecmp strndup strrchr strspn strstr \
797 strtol strtoul strlcat strlcpy \
798 daemon snprintf vsnprintf \
799 if_nametoindex if_indextoname getifaddrs \
802 AC_CHECK_FUNCS(setproctitle, ,
803 [AC_CHECK_LIB(util, setproctitle,
805 AC_DEFINE(HAVE_SETPROCTITLE,, Have setproctitle)
811 dnl ------------------------------------
812 dnl Determine routing get and set method
813 dnl ------------------------------------
814 AC_MSG_CHECKING(zebra between kernel interface method)
815 if test x"$opsys" = x"gnu-linux"; then
816 if test "${enable_netlink}" = "yes";then
817 AC_MSG_RESULT(netlink)
818 RT_METHOD=rt_netlink.o
819 AC_DEFINE(HAVE_NETLINK,,netlink)
821 elif test "${enable_netlink}" = "no"; then
826 AC_MSG_RESULT(netlink)
827 RT_METHOD=rt_netlink.o
828 AC_DEFINE(HAVE_NETLINK,,netlink)
831 elif test x"$opsys" = x"sol2-6";then
832 AC_MSG_RESULT(Route socket)
833 KERNEL_METHOD="kernel_socket.o"
834 RT_METHOD="rt_socket.o"
835 elif test x"$opsys" = x"sol8";then
836 AC_MSG_RESULT(Route socket)
837 KERNEL_METHOD="kernel_socket.o"
838 RT_METHOD="rt_socket.o"
839 elif test "$opsys" = "irix" ; then
840 AC_MSG_RESULT(Route socket)
841 KERNEL_METHOD="kernel_socket.o"
842 RT_METHOD="rt_socket.o"
844 AC_TRY_RUN([#include <errno.h>
845 #include <sys/types.h>
846 #include <sys/socket.h>
852 ac_sock = socket (AF_ROUTE, SOCK_RAW, 0);
853 if (ac_sock < 0 && errno == EINVAL)
857 [KERNEL_METHOD=kernel_socket.o
858 RT_METHOD=rt_socket.o
859 AC_MSG_RESULT(socket)],
860 [RT_METHOD=rt_ioctl.o
861 AC_MSG_RESULT(ioctl)],
862 [KERNEL_METHOD=kernel_socket.o
863 RT_METHOD=rt_socket.o
864 AC_MSG_RESULT(socket)])
867 AC_SUBST(KERNEL_METHOD)
868 AC_SUBST(OTHER_METHOD)
869 AM_CONDITIONAL([HAVE_NETLINK], [test "x$netlink" = "xyes"])
871 dnl --------------------------
872 dnl Determine IS-IS I/O method
873 dnl --------------------------
874 AC_DEFINE(ISIS_METHOD_PFPACKET, 1, [ constant value for isis method pfpacket ])
875 AC_DEFINE(ISIS_METHOD_DLPI, 2, [ constant value for isis method dlpi ])
876 AC_DEFINE(ISIS_METHOD_BPF, 3, [ constant value for isis method bpf ])
877 AC_CHECK_HEADER(net/bpf.h)
878 AC_CHECK_HEADER(sys/dlpi.h)
879 AC_MSG_CHECKING(zebra IS-IS I/O method)
880 if test x"$opsys" = x"gnu-linux"; then
881 AC_MSG_RESULT(pfpacket)
882 ISIS_METHOD_MACRO="ISIS_METHOD_PFPACKET"
883 elif test x"$opsys" = x"sol2-6" -o x"$opsys" = x"sol8"; then
885 ISIS_METHOD_MACRO="ISIS_METHOD_DLPI"
887 if test $ac_cv_header_net_bpf_h = no; then
888 if test $ac_cv_header_sys_dlpi_h = no; then
890 AC_MSG_WARN([*** IS-IS support will not be built ***])
895 ISIS_METHOD_MACRO="ISIS_METHOD_DLPI"
898 ISIS_METHOD_MACRO="ISIS_METHOD_BPF"
901 AC_DEFINE_UNQUOTED(ISIS_METHOD, $ISIS_METHOD_MACRO, [ selected method for isis, == one of the constants ])
903 dnl ------------------------------------
904 dnl check for broken CMSG_FIRSTHDR macro
905 dnl ------------------------------------
906 AC_MSG_CHECKING(for broken CMSG_FIRSTHDR)
907 AC_RUN_IFELSE([AC_LANG_SOURCE([[
910 #define __EXTENSIONS__
915 #ifdef HAVE_SYS_TYPES_H
916 #include <sys/types.h>
918 #ifdef HAVE_SYS_SOCKET_H
919 #include <sys/socket.h>
927 msg.msg_control = buf;
928 msg.msg_controllen = 0;
930 if (CMSG_FIRSTHDR(&msg) != NULL)
933 }]])],[AC_MSG_RESULT(yes - using workaround) AC_DEFINE(HAVE_BROKEN_CMSG_FIRSTHDR,,Broken CMSG_FIRSTHDR)],
934 [AC_MSG_RESULT(no)],[AC_MSG_RESULT(no)])
936 dnl ------------------------------
937 dnl check kernel route read method
938 dnl ------------------------------
939 AC_CACHE_CHECK([route read method], [quagga_cv_rtread_method],
940 [if test "x$netlink" = xyes; then
941 quagga_cv_rtread_method="netlink"
943 for quagga_cv_rtread_method in /proc/net/route /dev/ip /dev/null;
945 test x`ls $quagga_cv_rtread_method 2>/dev/null` = x"$quagga_cv_rtread_method" && break
947 case $quagga_cv_rtread_method in
948 "/proc/net/route") quagga_cv_rtread_method="proc";;
951 *-freebsd*) quagga_cv_rtread_method="sysctl";;
952 *) quagga_cv_rtread_method="getmsg";;
955 quagga_cv_rtread_method="sysctl";;
958 RTREAD_METHOD=rtread_${quagga_cv_rtread_method}.o
959 AC_SUBST(RTREAD_METHOD)
961 dnl -----------------------------
962 dnl check interface lookup method
963 dnl -----------------------------
965 AC_MSG_CHECKING(interface looking up method)
966 if test "$netlink" = yes; then
967 AC_MSG_RESULT(netlink)
968 IF_METHOD=if_netlink.o
969 elif test "$opsys" = "sol2-6";then
970 AC_MSG_RESULT(Solaris GIF)
972 elif test "$opsys" = "sol8";then
973 AC_MSG_RESULT(Solaris GLIF)
974 IF_METHOD=if_ioctl_solaris.o
975 IOCTL_METHOD=ioctl_solaris.o
976 elif test "$opsys" = "irix" ; then
979 elif test "$opsys" = "openbsd";then
980 AC_MSG_RESULT(openbsd)
982 elif grep NET_RT_IFLIST /usr/include/sys/socket.h >/dev/null 2>&1; then
983 AC_MSG_RESULT(sysctl)
984 IF_METHOD=if_sysctl.o
985 AC_DEFINE(HAVE_NET_RT_IFLIST,,NET_RT_IFLIST)
991 AC_SUBST(IOCTL_METHOD)
993 dnl ---------------------------------------------------------------
994 dnl figure out how to specify an interface in multicast sockets API
995 dnl ---------------------------------------------------------------
996 AC_CHECK_MEMBERS([struct ip_mreqn.imr_ifindex], [], [], QUAGGA_INCLUDES)
998 AC_MSG_CHECKING([for BSD struct ip_mreq hack])
999 AC_TRY_COMPILE([#ifdef HAVE_SYS_PARAM_H
1000 #include <sys/param.h>
1001 #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__)
1004 #error No support for BSD struct ip_mreq hack detected
1005 #endif],[AC_MSG_RESULT(yes)
1006 AC_DEFINE(HAVE_BSD_STRUCT_IP_MREQ_HACK,,[Can pass ifindex in struct ip_mreq])],
1009 AC_MSG_CHECKING([for RFC3678 protocol-independed API])
1011 #include <sys/types.h>
1012 #include <netinet/in.h>
1013 ], [struct group_req gr; int sock; setsockopt(sock, IPPROTO_IP, MCAST_JOIN_GROUP, (void*)&gr, sizeof(gr));
1014 ], [AC_MSG_RESULT(yes)
1015 AC_DEFINE(HAVE_RFC3678,1,[Have RFC3678 protocol-independed API])],
1018 dnl ---------------------------------------------------------------
1019 dnl figure out how to check link-state
1020 dnl ---------------------------------------------------------------
1021 AC_CHECK_HEADER([net/if.h],
1022 [AC_CHECK_HEADER( [net/if_media.h],
1023 [m4_define([LINK_DETECT_INCLUDES],
1025 [#include <net/if_media.h>
1027 AC_CHECK_MEMBERS( [struct ifmediareq.ifm_status],
1028 AC_DEFINE(HAVE_BSD_LINK_DETECT,,[BSD link-detect]),
1029 [], LINK_DETECT_INCLUDES)],
1032 [], QUAGGA_INCLUDES )
1034 dnl ---------------------------------------------------------------
1035 dnl Additional, newer way to check link-state using ifi_link_state.
1036 dnl Not available in all BSD's when ifmediareq available
1037 dnl ---------------------------------------------------------------
1038 AC_CHECK_HEADER([net/if.h],
1039 AC_CHECK_MEMBERS([struct if_data.ifi_link_state],
1040 AC_DEFINE(HAVE_BSD_IFI_LINK_STATE,,[BSD ifi_link_state available]),
1041 [], QUAGGA_INCLUDES),
1044 dnl ------------------------
1045 dnl TCP_MD5SIG socket option
1046 dnl ------------------------
1048 AC_CHECK_HEADER([netinet/tcp.h],
1049 [m4_define([MD5_INCLUDES],
1051 [#include <netinet/tcp.h>
1053 AC_CHECK_DECLS([TCP_MD5SIG], [], [], MD5_INCLUDES)],
1056 if test $ac_cv_have_decl_TCP_MD5SIG = no; then
1057 AC_CHECK_HEADER([linux/tcp.h],
1058 [m4_define([MD5_INCLUDES],
1060 [#include <linux/tcp.h>
1062 AC_CHECK_DECLS([TCP_MD5SIG], [], [], MD5_INCLUDES)])
1065 dnl -----------------------
1066 dnl check proc file system.
1067 dnl -----------------------
1068 if test "$netlink" != yes; then
1069 if test -r /proc/net/dev; then
1070 AC_DEFINE(HAVE_PROC_NET_DEV,,/proc/net/dev)
1073 if test -r /proc/net/if_inet6; then
1074 AC_DEFINE(HAVE_PROC_NET_IF_INET6,,/proc/net/if_inet6)
1080 dnl -----------------------------
1081 dnl check ipforward detect method
1082 dnl -----------------------------
1083 AC_CACHE_CHECK([ipforward method], [quagga_cv_ipforward_method],
1084 [if test x$cross_compiling = xyes; then
1085 if test x"$opsys" = x"gnu-linux"; then
1086 quagga_cv_ipforward_method=/proc/net/snmp
1088 quagga_cv_ipforward_method=/dev/ip
1091 for quagga_cv_ipforward_method in /proc/net/snmp /dev/ip /dev/null;
1093 test x`ls $quagga_cv_ipforward_method 2>/dev/null` = x"$quagga_cv_ipforward_method" && break
1096 case $quagga_cv_ipforward_method in
1097 "/proc/net/snmp") quagga_cv_ipforward_method="proc";;
1100 *-nec-sysv4*) quagga_cv_ipforward_method="ews";;
1101 *-freebsd*) quagga_cv_ipforward_method="sysctl";;
1102 *) quagga_cv_ipforward_method="solaris";;
1104 *) quagga_cv_ipforward_method="sysctl";;
1106 IPFORWARD=ipforward_${quagga_cv_ipforward_method}.o
1109 AC_CHECK_FUNCS(getaddrinfo, [have_getaddrinfo=yes], [have_getaddrinfo=no])
1114 AC_MSG_CHECKING(whether does this OS have IPv6 stack)
1115 if test "${enable_ipv6}" = "no"; then
1116 AC_MSG_RESULT(disabled)
1121 if grep IPV6_INRIA_VERSION /usr/include/netinet/in.h >/dev/null 2>&1; then
1123 AC_DEFINE(HAVE_IPV6,1,INRIA IPv6)
1124 AC_DEFINE(INRIA_IPV6,1,INRIA IPv6)
1128 AC_MSG_RESULT(INRIA IPv6)
1132 elif grep WIDE /usr/include/netinet6/in6.h >/dev/null 2>&1; then
1134 AC_DEFINE(HAVE_IPV6,1,KAME IPv6)
1135 AC_DEFINE(KAME,1,KAME IPv6)
1138 if test -d /usr/local/v6/lib -a -f /usr/local/v6/lib/libinet6.a; then
1139 LIB_IPV6="-L/usr/local/v6/lib -linet6"
1142 dnl -------------------------
1144 dnl default host check
1145 dnl It is not used by Kheops
1146 dnl -------------------------
1147 elif grep MUSICA /usr/include6/netinet6/in6.h >/dev/null 2>&1; then
1149 AC_DEFINE(HAVE_IPV6,1,Musicia IPv6)
1150 AC_DEFINE(MUSICA,1,Musica IPv6 stack)
1151 AC_DEFINE(KAME,1,KAME IPv6 stack)
1154 if test -d /usr/local/v6/lib -a -f /usr/local/v6/lib/libinet6.a; then
1155 LIB_IPV6="-L/usr/local/v6/lib -linet6"
1157 AC_MSG_RESULT(MUSICA)
1161 elif grep NRL /usr/include/netinet6/in6.h >/dev/null 2>&1; then
1163 AC_DEFINE(HAVE_IPV6,1,NRL IPv6)
1164 AC_DEFINE(NRL,1,NRL)
1167 if test x"$opsys" = x"bsdi";then
1168 AC_DEFINE(BSDI_NRL,,BSDI)
1169 AC_MSG_RESULT(BSDI_NRL)
1173 dnl ------------------------------------
1174 dnl Solaris 9, 10 and potentially higher
1175 dnl ------------------------------------
1176 elif test x"$opsys" = x"sol8"; then
1178 AC_DEFINE(HAVE_IPV6, 1, IPv6)
1179 AC_DEFINE(SOLARIS_IPV6, 1, Solaris IPv6)
1182 AC_MSG_RESULT(Solaris IPv6)
1186 elif test "${enable_ipv6}" = "yes"; then
1188 #include <linux/version.h>
1189 /* 2.1.128 or later */
1190 #if LINUX_VERSION_CODE >= 0x020180
1194 zebra_cv_linux_ipv6=yes
1195 AC_MSG_RESULT(Linux IPv6)])
1197 if test x`ls /proc/net/ipv6_route 2>/dev/null` = x"/proc/net/ipv6_route"
1200 zebra_cv_linux_ipv6=yes
1201 AC_MSG_RESULT(Linux IPv6)
1205 if test "$zebra_cv_linux_ipv6" = "yes";then
1206 AC_MSG_CHECKING(whether libc has IPv6 support)
1207 AC_TRY_LINK([#include <netinet/in.h>
1208 ],[ int a; a = (int) in6addr_any.s6_addr[0]; if (a != 12345) return a; ],
1211 zebra_cv_linux_ipv6=yes],
1214 zebra_cv_linux_ipv6=no])
1217 if test "$zebra_cv_linux_ipv6" = "yes";then
1218 AC_MSG_CHECKING(for GNU libc >= 2.1)
1219 AC_DEFINE(HAVE_IPV6,1,Linux IPv6)
1220 AC_DEFINE(LINUX_IPV6,1,Linux IPv6 stack)
1223 #include <features.h>
1224 #if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
1228 AC_MSG_RESULT(yes)],
1233 if test "$glibc" != "yes"; then
1234 if test x`ls /usr/inet6/lib/libinet6.a 2>/dev/null` != x;then
1235 INCLUDES="-I/usr/inet6/include"
1236 LIB_IPV6="-L/usr/inet6/lib -linet6"
1241 dnl -----------------------
1242 dnl Set IPv6 related values
1243 dnl -----------------------
1244 LIBS="$LIB_IPV6 $LIBS"
1247 if test x"$RIPNGD" = x""; then
1248 AC_MSG_RESULT(IPv4 only)
1252 dnl ------------------
1253 dnl IPv6 header checks
1254 dnl ------------------
1255 if test "x${zebra_cv_ipv6}" = "xyes"; then
1256 AC_CHECK_HEADERS([netinet6/in6.h netinet/in6_var.h netinet/icmp6.h \
1257 netinet6/in6_var.h netinet6/nd6.h], [], [],
1261 m4_define([QUAGGA_INCLUDES],dnl
1263 [#if HAVE_NETINET6_IN6_H
1264 #include <netinet6/in6.h>
1266 #if HAVE_NETINET_IN6_VAR_H
1267 #include <netinet/in6_var.h>
1269 #if HAVE_NETINET_ICMP6_H
1270 # include <netinet/icmp6.h>
1272 #if HAVE_NETINET6_IN6_VAR_H
1273 # include <netinet6/in6_var.h>
1275 #if HAVE_NETINET6_ND6_H
1276 # include <netinet6/nd6.h>
1280 dnl disable doc check
1281 if test "${enable_doc}" = "no";then
1287 dnl --------------------
1288 dnl Daemon disable check
1289 dnl --------------------
1290 if test "${enable_zebra}" = "no";then
1295 AM_CONDITIONAL(ZEBRA, test "x$ZEBRA" = "xzebra")
1297 if test "${enable_bgpd}" = "no";then
1302 AM_CONDITIONAL(BGPD, test "x$BGPD" = "xbgpd")
1304 if test "${enable_ripd}" = "no";then
1309 AM_CONDITIONAL(RIPD, test "x$RIPD" = "xripd")
1311 if test "${enable_ospfd}" = "no";then
1316 AM_CONDITIONAL(OSPFD, test "x$OSPFD" = "xospfd")
1318 if test "${enable_babeld}" = "no";then
1323 AM_CONDITIONAL(BABELD, test "x$BABELD" = "xbabeld")
1325 if test "${enable_watchquagga}" = "no";then
1328 WATCHQUAGGA="watchquagga"
1330 AM_CONDITIONAL(WATCHQUAGGA, test "x$WATCHQUAGGA" = "xwatchquagga")
1333 if test "${enable_opaque_lsa}" != "no"; then
1334 if test "${enable_ospfapi}" != "no";then
1335 AC_DEFINE(SUPPORT_OSPF_API,,OSPFAPI)
1337 if test "${enable_ospfclient}" != "no";then
1338 OSPFCLIENT="ospfclient"
1343 AM_CONDITIONAL(OSPFCLIENT, test "x$OSPFCLIENT" = "xospfclient")
1345 case "${enable_ripngd}" in
1346 "yes") RIPNGD="ripngd";;
1350 AM_CONDITIONAL(RIPNGD, test "x$RIPNGD" = "xripngd")
1352 case "${enable_ospf6d}" in
1353 "yes") OSPF6D="ospf6d";;
1357 AM_CONDITIONAL(OSPF6D, test "x$OSPF6D" = "xospf6d")
1359 case "${enable_isisd}" in
1360 "yes") ISISD="isisd";;
1364 AM_CONDITIONAL(ISISD, test "x$ISISD" = "xisisd")
1366 # XXX Perhaps auto-enable on Solaris, but that's messy for cross builds.
1367 case "${enable_solaris}" in
1368 "yes") SOLARIS="solaris";;
1373 if test "${enable_bgp_announce}" = "no";then
1374 AC_DEFINE(DISABLE_BGP_ANNOUNCE,1,Disable BGP installation to zebra)
1376 AC_DEFINE(DISABLE_BGP_ANNOUNCE,0,Disable BGP installation to zebra)
1387 AC_SUBST(WATCHQUAGGA)
1393 AC_SUBST(OSPFCLIENT)
1395 AC_CHECK_LIB(c, inet_ntop, [AC_DEFINE(HAVE_INET_NTOP,,inet_ntop)])
1396 AC_CHECK_LIB(c, inet_pton, [AC_DEFINE(HAVE_INET_PTON,,inet_pton)])
1397 AC_CHECK_LIB(crypt, crypt)
1398 AC_CHECK_LIB(resolv, res_init)
1400 dnl ---------------------------------------------------
1401 dnl BSD/OS 4.1 define inet_XtoY function as __inet_XtoY
1402 dnl ---------------------------------------------------
1403 AC_CHECK_FUNC(__inet_ntop, AC_DEFINE(HAVE_INET_NTOP,,__inet_ntop))
1404 AC_CHECK_FUNC(__inet_pton, AC_DEFINE(HAVE_INET_PTON,,__inet_pton))
1405 AC_CHECK_FUNC(__inet_aton, AC_DEFINE(HAVE_INET_ATON,,__inet_aton))
1407 dnl ---------------------------
1408 dnl check system has PCRE regexp
1409 dnl ---------------------------
1410 if test "x$enable_pcreposix" = "xyes"; then
1411 AC_CHECK_LIB(pcreposix, pcreposix_regexec, ,[enable_pcreposix=no
1412 AC_MSG_WARN([*** falling back to other regex library ***]) ])
1415 if test "x$enable_pcreposix" != "xyes"; then
1416 dnl ---------------------------
1417 dnl check system has GNU regexp
1418 dnl ---------------------------
1419 AC_MSG_CHECKING(whether system has GNU regex)
1420 AC_CHECK_LIB(c, regexec,
1421 [AC_DEFINE(HAVE_GNU_REGEX,,GNU regexp library)
1423 [LIB_REGEX="regex.o"])
1425 AC_SUBST(HAVE_LIBPCREPOSIX)
1428 dnl ------------------
1429 dnl check Net-SNMP library
1430 dnl ------------------
1431 if test "${enable_snmp}" != ""; then
1432 AC_PATH_TOOL([NETSNMP_CONFIG], [net-snmp-config], [no])
1433 if test x"$NETSNMP_CONFIG" = x"no"; then
1434 AC_MSG_ERROR([--enable-snmp given but unable to find net-snmp-config])
1436 LIBS="$LIBS `${NETSNMP_CONFIG} --agent-libs`"
1437 CFLAGS="`${NETSNMP_CONFIG} --base-cflags` $CFLAGS"
1438 AC_MSG_CHECKING([whether we can link to Net-SNMP])
1439 AC_LINK_IFELSE([AC_LANG_PROGRAM([
1446 ])],[AC_MSG_RESULT(yes)],[
1448 AC_MSG_ERROR([--enable-snmp given but not usable])])
1449 AC_DEFINE(HAVE_SNMP,,SNMP)
1450 case "${enable_snmp}" in
1455 SNMP_METHOD="${enable_snmp}"
1458 AC_MSG_ERROR([--enable-snmp given with an unknown method (${enable_snmp}). Use smux or agentx])
1461 AH_TEMPLATE([SNMP_SMUX], [Use SNMP SMUX to interface with snmpd])
1462 AH_TEMPLATE([SNMP_AGENTX], [Use SNMP AgentX to interface with snmpd])
1463 AC_DEFINE_UNQUOTED(AS_TR_CPP(SNMP_${SNMP_METHOD}),,SNMP method to interface with snmpd)
1466 dnl ---------------------------
1467 dnl sockaddr and netinet checks
1468 dnl ---------------------------
1469 AC_CHECK_TYPES([struct sockaddr, struct sockaddr_in,
1470 struct sockaddr_in6, struct sockaddr_un, struct sockaddr_dl,
1472 struct ifaliasreq, struct if6_aliasreq, struct in6_aliasreq,
1473 struct nd_opt_adv_interval, struct rt_addrinfo,
1474 struct nd_opt_homeagent_info, struct nd_opt_adv_interval],
1475 [], [], QUAGGA_INCLUDES)
1477 AC_CHECK_MEMBERS([struct sockaddr.sa_len,
1478 struct sockaddr_in.sin_len, struct sockaddr_un.sun_len,
1479 struct sockaddr_in6.sin6_scope_id,
1480 struct sockaddr_dl.sdl_len,
1481 struct if6_aliasreq.ifra_lifetime,
1482 struct nd_opt_adv_interval.nd_opt_ai_type],
1483 [], [], QUAGGA_INCLUDES)
1485 dnl ---------------------------
1486 dnl IRDP/pktinfo/icmphdr checks
1487 dnl ---------------------------
1488 AC_CHECK_TYPES([struct in_pktinfo],
1489 [AC_CHECK_TYPES([struct icmphdr],
1490 [if test "${enable_irdp}" != "no"; then
1491 AC_DEFINE(HAVE_IRDP,, IRDP)
1493 [if test "${enable_irdp}" = "yes"; then
1494 AC_MSG_ERROR(['IRDP requires in_pktinfo at the moment!'])
1495 fi], [QUAGGA_INCLUDES])],
1496 [if test "${enable_irdp}" = "yes"; then
1497 AC_MSG_ERROR(['IRDP requires in_pktinfo at the moment!'])
1498 fi], [QUAGGA_INCLUDES])
1500 dnl --------------------------------------
1501 dnl checking for getrusage struct and call
1502 dnl --------------------------------------
1503 if test "${enable_rusage}" != "no"; then
1504 AC_MSG_CHECKING(whether getrusage is available)
1505 AC_TRY_COMPILE([#include <sys/resource.h>],[struct rusage ac_x; getrusage (RUSAGE_SELF, &ac_x);],
1507 AC_DEFINE(HAVE_RUSAGE,,rusage)],
1511 dnl --------------------------------------
1512 dnl checking for clock_time monotonic struct and call
1513 dnl --------------------------------------
1514 AC_CHECK_DECL(CLOCK_MONOTONIC,
1515 [AC_CHECK_LIB(rt, clock_gettime, [LIBS="$LIBS -lrt"])
1516 AC_DEFINE(HAVE_CLOCK_MONOTONIC,, Have monotonic clock)
1517 ], [AC_MSG_RESULT(no)], [QUAGGA_INCLUDES])
1519 dnl -------------------
1520 dnl capabilities checks
1521 dnl -------------------
1522 if test "${enable_capabilities}" != "no"; then
1523 AC_MSG_CHECKING(whether prctl PR_SET_KEEPCAPS is available)
1524 AC_TRY_COMPILE([#include <sys/prctl.h>],[prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0);],
1526 AC_DEFINE(HAVE_PR_SET_KEEPCAPS,,prctl)
1527 quagga_ac_keepcaps="yes"],
1530 if test x"${quagga_ac_keepcaps}" = x"yes"; then
1531 AC_CHECK_HEADERS(sys/capability.h)
1533 if test x"${ac_cv_header_sys_capability_h}" = x"yes"; then
1534 AC_CHECK_LIB(cap, cap_init,
1535 [AC_DEFINE(HAVE_LCAPS,1,Capabilities)
1537 quagga_ac_lcaps="yes"]
1540 AC_CHECK_HEADERS(priv.h,
1541 [AC_MSG_CHECKING(Solaris style privileges are available)
1542 AC_TRY_COMPILE([#include <priv.h>],[getpflags(PRIV_AWARE);],
1544 AC_DEFINE(HAVE_SOLARIS_CAPABILITIES,1,getpflags)
1545 quagga_ac_scaps="yes"],
1551 if test x"${quagga_ac_scaps}" = x"yes" \
1552 -o x"${quagga_ac_lcaps}" = x"yes"; then
1553 AC_DEFINE(HAVE_CAPABILITIES,1,capabilities)
1558 dnl ---------------------------------------------------------------------------
1559 dnl http://www.gnu.org/software/autoconf-archive/ax_sys_weak_alias.html
1560 dnl Check for and set one of the following = 1
1561 dnl HAVE_SYS_WEAK_ALIAS_ATTRIBUTE
1562 dnl HAVE_SYS_WEAK_ALIAS_PRAGMA
1563 dnl HAVE_SYS_WEAK_ALIAS_HPSECONDARY
1564 dnl HAVE_SYS_WEAK_ALIAS_CRIDUPLICATE
1565 dnl If any scheme is found, set
1566 dnl HAVE_SYS_WEAK_ALIAS=1
1567 dnl The following variable is set to text value
1568 dnl WEAK_ALIAS = "attribute" || "pragma" || "hpsecondary" || "criduplicate" || "no"
1569 dnl If weak alias can cross object file boundaries
1570 dnl WEAK_ALIAS_CROSSFILE = "yes" || "no"
1571 dnl ---------------------------------------------------------------------------
1574 dnl ---------------------------
1575 dnl check for glibc 'backtrace'
1576 dnl ---------------------------
1577 if test x"${enable_backtrace}" != x"no" ; then
1579 AC_CHECK_HEADER([execinfo.h], [
1580 AC_SEARCH_LIBS([backtrace], [execinfo], [
1581 AC_DEFINE(HAVE_GLIBC_BACKTRACE,,[Glibc backtrace])
1582 AC_DEFINE(HAVE_STACK_TRACE,,[Stack symbol decoding])
1587 if test x"${enable_backtrace}" = x"yes" -a x"${backtrace_ok}" = x"no"; then
1588 dnl user explicitly requested backtrace but we failed to find support
1589 AC_MSG_FAILURE([failed to find backtrace support])
1593 dnl -----------------------------------------
1594 dnl check for malloc mallinfo struct and call
1595 dnl this must try and link using LIBS, in
1596 dnl order to check no alternative allocator
1597 dnl has been specified, which might not provide
1598 dnl mallinfo, e.g. such as Umem on Solaris.
1599 dnl -----------------------------------------
1600 AC_CHECK_HEADER([malloc.h],
1601 [AC_MSG_CHECKING(whether mallinfo is available)
1602 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <malloc.h>]],
1603 [[struct mallinfo ac_x; ac_x = mallinfo ();]])],
1605 AC_DEFINE(HAVE_MALLINFO,,mallinfo)],
1608 ], [], QUAGGA_INCLUDES)
1613 CONFDATE=`date '+%Y%m%d'`
1616 dnl Conditionally enable PIE support for GNU toolchains.
1617 AC_ARG_ENABLE(pie, AS_HELP_STRING([--disable-pie], [Do not build tools as a Position Independent Executables]))
1618 if test "$enable_pie" != "no"; then
1619 AC_CACHE_CHECK([whether $CC accepts PIE flags], [ap_cv_cc_pie], [
1621 save_LDFLAGS=$LDFLAGS
1622 CFLAGS="$CFLAGS -fPIE"
1623 LDFLAGS="$LDFLAGS -pie"
1624 AC_LINK_IFELSE([AC_LANG_SOURCE([[static int foo[30000]; int main () { return 0; }]])],
1625 [ap_cv_cc_pie=yes], [ap_cv_cc_pie=no]
1628 LDFLAGS=$save_LDFLAGS
1630 if test "$ap_cv_cc_pie" = "yes"; then
1642 if test x"$DEJAGNU" = x
1644 DEJAGNU="\$(top_srcdir)/tests/global-conf.exp"
1646 RUNTESTDEFAULTFLAGS="-x --tool \$\$tool"
1649 AC_SUBST(RUNTESTDEFAULTFLAGS)
1651 dnl ------------------------------
1652 dnl set paths for state directory
1653 dnl ------------------------------
1654 AC_MSG_CHECKING(directory to use for state file)
1655 if test "${prefix}" = "NONE"; then
1656 quagga_statedir_prefix="";
1658 quagga_statedir_prefix=${prefix}
1660 if test "${localstatedir}" = '${prefix}/var'; then
1661 for QUAGGA_STATE_DIR in ${quagga_statedir_prefix}/var/run dnl
1662 ${quagga_statedir_prefix}/var/adm dnl
1663 ${quagga_statedir_prefix}/etc dnl
1669 test -d $QUAGGA_STATE_DIR && break
1671 quagga_statedir=$QUAGGA_STATE_DIR
1673 quagga_statedir=${localstatedir}
1675 if test $quagga_statedir = "/dev/null"; then
1676 AC_MSG_ERROR('STATE DIRECTORY NOT FOUND! FIX OR SPECIFY --localstatedir!')
1678 AC_MSG_RESULT(${quagga_statedir})
1679 AC_SUBST(quagga_statedir)
1681 AC_DEFINE_UNQUOTED(PATH_ZEBRA_PID, "$quagga_statedir/zebra.pid",zebra PID)
1682 AC_DEFINE_UNQUOTED(PATH_RIPD_PID, "$quagga_statedir/ripd.pid",ripd PID)
1683 AC_DEFINE_UNQUOTED(PATH_RIPNGD_PID, "$quagga_statedir/ripngd.pid",ripngd PID)
1684 AC_DEFINE_UNQUOTED(PATH_BGPD_PID, "$quagga_statedir/bgpd.pid",bgpd PID)
1685 AC_DEFINE_UNQUOTED(PATH_OSPFD_PID, "$quagga_statedir/ospfd.pid",ospfd PID)
1686 AC_DEFINE_UNQUOTED(PATH_OSPF6D_PID, "$quagga_statedir/ospf6d.pid",ospf6d PID)
1687 AC_DEFINE_UNQUOTED(PATH_BABELD_PID, "$quagga_statedir/babeld.pid",babeld PID)
1688 AC_DEFINE_UNQUOTED(PATH_ISISD_PID, "$quagga_statedir/isisd.pid",isisd PID)
1689 AC_DEFINE_UNQUOTED(PATH_WATCHQUAGGA_PID, "$quagga_statedir/watchquagga.pid",watchquagga PID)
1690 AC_DEFINE_UNQUOTED(ZEBRA_SERV_PATH, "$quagga_statedir/zserv.api",zebra api socket)
1691 AC_DEFINE_UNQUOTED(ZEBRA_VTYSH_PATH, "$quagga_statedir/zebra.vty",zebra vty socket)
1692 AC_DEFINE_UNQUOTED(RIP_VTYSH_PATH, "$quagga_statedir/ripd.vty",rip vty socket)
1693 AC_DEFINE_UNQUOTED(RIPNG_VTYSH_PATH, "$quagga_statedir/ripngd.vty",ripng vty socket)
1694 AC_DEFINE_UNQUOTED(BGP_VTYSH_PATH, "$quagga_statedir/bgpd.vty",bgpd vty socket)
1695 AC_DEFINE_UNQUOTED(OSPF_VTYSH_PATH, "$quagga_statedir/ospfd.vty",ospfd vty socket)
1696 AC_DEFINE_UNQUOTED(OSPF6_VTYSH_PATH, "$quagga_statedir/ospf6d.vty",ospf6d vty socket)
1697 AC_DEFINE_UNQUOTED(BABEL_VTYSH_PATH, "$quagga_statedir/babeld.vty",babeld vty socket)
1698 AC_DEFINE_UNQUOTED(ISIS_VTYSH_PATH, "$quagga_statedir/isisd.vty",isisd vty socket)
1699 AC_DEFINE_UNQUOTED(DAEMON_VTY_DIR, "$quagga_statedir",daemon vty directory)
1701 dnl -------------------------------
1702 dnl Quagga sources should always be
1703 dnl current wrt interfaces. Dont
1704 dnl allow deprecated interfaces to
1706 dnl -------------------------------
1707 AC_DEFINE(QUAGGA_NO_DEPRECATED_INTERFACES, 1, Hide deprecated interfaces)
1709 dnl ---------------------------
1710 dnl Check htonl works correctly
1711 dnl ---------------------------
1712 AC_MSG_CHECKING(for working htonl)
1713 AC_CACHE_VAL(ac_cv_htonl_works,
1714 [AC_LINK_IFELSE([AC_LANG_PROGRAM([QUAGGA_INCLUDES],[htonl (0);])],
1715 [ac_cv_htonl_works=yes], [ac_cv_htonl_works=no])
1718 AC_MSG_RESULT($ac_cv_htonl_works)
1720 AC_CONFIG_FILES([Makefile lib/Makefile zebra/Makefile ripd/Makefile
1721 ripngd/Makefile bgpd/Makefile ospfd/Makefile watchquagga/Makefile
1722 ospf6d/Makefile isisd/Makefile babeld/Makefile vtysh/Makefile
1723 doc/Makefile ospfclient/Makefile tests/Makefile m4/Makefile
1724 tests/bgpd.tests/Makefile
1725 tests/libzebra.tests/Makefile
1731 isisd/topology/Makefile
1732 pkgsrc/bgpd.sh pkgsrc/ospf6d.sh pkgsrc/ospfd.sh
1733 pkgsrc/ripd.sh pkgsrc/ripngd.sh pkgsrc/zebra.sh])
1734 AC_CONFIG_FILES([solaris/Makefile])
1736 AC_CONFIG_FILES([vtysh/extract.pl],[chmod +x vtysh/extract.pl])
1737 ## Hack, but working solution to avoid rebuilding of quagga.info.
1738 ## It's already in CVS until texinfo 4.7 is more common.
1742 Quagga configuration
1743 --------------------
1744 quagga version : ${PACKAGE_VERSION}
1745 host operating system : ${host_os}
1746 source code location : ${srcdir}
1748 compiler flags : ${CFLAGS}
1750 includes : ${INCLUDES}
1751 linker flags : ${LDFLAGS} ${LIBS} ${LIBCAP} ${LIBREADLINE} ${LIBM}
1752 state file directory : ${quagga_statedir}
1753 config file directory : `eval echo \`echo ${sysconfdir}\``
1754 example directory : `eval echo \`echo ${exampledir}\``
1755 user to run as : ${enable_user}
1756 group to run as : ${enable_group}
1757 group for vty sockets : ${enable_vty_group}
1758 config file mask : ${enable_configfile_mask}
1759 log file mask : ${enable_logfile_mask}
1761 The above user and group must have read/write access to the state file
1762 directory and to the config files in the config file directory."
1764 if test x"$quagga_cv_gnu_make" = x"no"; then echo "
1765 Warning: The ${MAKE-make} programme detected, either in your path or
1766 via the MAKE variable, is not GNU Make. GNU make may be installed as
1767 gmake on some systems. and is required to complete a build of Quagga