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, 1.2.3, [https://bugzilla.quagga.net])
13 AC_CONFIG_SRCDIR(lib/zebra.h)
14 AC_CONFIG_MACRO_DIR([m4])
16 dnl -----------------------------------
17 dnl Get hostname and other information.
18 dnl -----------------------------------
23 # Disable portability warnings -- our automake code (in particular
24 # common.am) uses some constructs specific to gmake.
25 AM_INIT_AUTOMAKE([1.6 -Wno-portability])
27 m4_ifndef([AM_SILENT_RULES], [m4_define([AM_SILENT_RULES],[])])
28 AM_SILENT_RULES([yes])
29 AC_CONFIG_HEADERS(config.h)
31 AC_PATH_PROG(PERL, perl)
32 AC_CHECK_PROG([GAWK],[gawk],[gawk],[not-in-PATH])
33 if test "x$GAWK" = "xnot-in-PATH" ; then
34 AC_MSG_ERROR([GNU awk is required for lib/memtype.h made by memtypes.awk.
35 BSD awk complains: awk: gensub doesn't support backreferences (subst "\1") ])
37 AC_ARG_VAR([GAWK],[GNU AWK])
39 dnl default is to match previous behavior
40 exampledir=${sysconfdir}
41 AC_ARG_ENABLE([exampledir],
42 AS_HELP_STRING([--enable-exampledir],
43 [specify alternate directory for examples]),
44 exampledir="$enableval",)
45 dnl XXX add --exampledir to autoconf standard directory list somehow
48 dnl default is to match previous behavior
51 AC_ARG_ENABLE([pkgsrcrcdir],
52 AS_HELP_STRING([--enable-pkgsrcrcdir],
53 [specify directory for rc.d scripts]),
54 pkgsrcrcdir="$enableval"; pkgsrcdir="pkgsrc",)
55 dnl XXX add --pkgsrcrcdir to autoconf standard directory list somehow
63 [ --with-cflags Set CFLAGS for use in compilation.])
64 if test "x$with_cflags" != "x" ; then
65 CFLAGS="$with_cflags" ; cflags_specified=yes ;
66 elif test -n "$CFLAGS" ; then
67 cflags_specified=yes ;
70 dnl --------------------
71 dnl Check CC and friends
72 dnl --------------------
82 AC_USE_SYSTEM_EXTENSIONS
89 dnl create libtool now, so we can test version below for
90 dnl fstack-protector-strong
93 dnl autoconf 2.59 appears not to support AC_PROG_SED
95 AC_CHECK_PROG([SED],[sed],[sed],[/bin/false])
97 dnl Check for pdflatex and latexmk, in case someone wants to build
98 dnl PDFs from TeX (as used to be case for HACKING)
99 AC_CHECK_PROG([PDFLATEX],[pdflatex],[pdflatex],[/bin/false])
100 AC_CHECK_PROG([LATEXMK],[latexmk],[latexmk],[/bin/false])
101 if test "x$PDFLATEX" = "x/bin/false" -o "x$LATEXMK" = "x/bin/false"; then
102 AC_MSG_WARN([Will not be able to make PDF versions of TeX documents])
106 AM_CONDITIONAL([HAVE_LATEX], [test "x$HAVE_LATEX" = "xtrue"])
107 dnl for making HACKING.pdf from HACKING.md using pandoc
108 AC_CHECK_PROG([PANDOC],[pandoc],[pandoc],[/bin/false])
109 if test "x$PDFLATEX" = "x/bin/false" -o "x$PANDOC" = "x/bin/false"; then
110 AC_MSG_WARN([Will not be able to make PDF versions of MD documents])
114 AM_CONDITIONAL([HAVE_PANDOC], [test "x$HAVE_PANDOC" = "xtrue"])
116 if test "x${GCC}" != "xyes" ; then
117 AC_MSG_CHECKING([whether we are using SunPro compiler])
118 AC_EGREP_CPP([^__SUNPRO_C.*0x5(7|8|9)], ["__SUNPRO_C" __SUNPRO_C],
120 AC_MSG_RESULT([yes])],
121 [AC_MSG_RESULT([no])]
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 Sun Studio 10 / SunPro 5.7 is also supported,
133 dnl so lets set some sane CFLAGS for it.
134 dnl ---------------------------------------------
136 AC_DEFUN([AC_C_FLAG], [{
138 ac_c_flag_save="$CFLAGS"
140 AC_MSG_CHECKING([[whether $CC supports $1]])
142 [AC_LANG_PROGRAM([[]])],
145 m4_if([$3], [], [], [
146 CFLAGS="$ac_c_flag_save"
150 CFLAGS="$ac_c_flag_save"
157 AC_MSG_CHECKING([which default CFLAGS to set])
158 if test "x${cflags_specified}" = "x" ; then
161 AC_MSG_RESULT([Sun Studio])
165 AC_C_FLAG([-xstrconst])
169 dnl AC_C_FLAG([-xlinkopt=2]) SPARC only dnl
170 dnl AC_C_FLAG([-xcode=pic32])dnl
173 AC_MSG_RESULT([autodetecting])
175 AC_C_FLAG([-diag-error 10006])
180 dnl fstack-protector-strong gives __stack_chk_fail_local
181 dnl being an 'Undefined symbol' on OpenIndiana hipster, with gcc 6.
182 dnl gcc -shared is being used to do the link, however the error is
183 dnl from ld. Disable. An issue with libtool < 2.4.6 dropping the
184 dnl -fstack-protector-strong argument from the shared link.
185 AC_MSG_CHECKING([whether libtool can support fstack-protector])
186 if test x"$(./libtool --version | awk 'NR == 1 { print $NF }' \
188 if ($(NF-2) < 2) print 0; \
189 else if ($(NF-2) > 2) print 1; \
190 else if ($(NF-1) < 4) print 0; \
191 else if ($(NF-1) > 4) print 1; \
192 else if ($NF < 6) print 0; \
196 AC_C_FLAG([-fstack-protector-strong])
197 AC_C_FLAG([--param=ssp-buffer-size=4])
200 AC_MSG_WARN([upgrade to libtool >= 2.4.6!])
202 AC_C_FLAG([-D_FORTIFY_SOURCE=2])
203 AC_C_FLAG([-Wformat])
204 AC_C_FLAG([-Wformat-security])
206 AC_C_FLAG([-fno-omit-frame-pointer])
209 AC_C_FLAG([-Wmissing-prototypes])
210 AC_C_FLAG([-Wmissing-declarations])
211 AC_C_FLAG([-Wpointer-arith])
212 AC_C_FLAG([-Wbad-function-cast])
213 AC_C_FLAG([-Wwrite-strings])
214 if test x"${enable_gcc_ultra_verbose}" = x"yes" ; then
215 AC_C_FLAG([-Wcast-qual])
216 AC_C_FLAG([-Wstrict-prototypes])
217 AC_C_FLAG([-Wmissing-noreturn])
218 AC_C_FLAG([-Wmissing-format-attribute])
219 AC_C_FLAG([-Wunreachable-code])
220 AC_C_FLAG([-Wpacked])
221 AC_C_FLAG([-Wpadded])
223 AC_C_FLAG([-Wno-unused-result])
225 AC_C_FLAG([-Wno-unused-parameter])
226 AC_C_FLAG([-Wno-missing-field-initializers])
227 # ICC emits a broken warning for const char *x = a ? "b" : "c";
228 # for some reason the string consts get 'promoted' to char *,
229 # triggering a const to non-const conversion warning.
230 AC_C_FLAG([-diag-disable 3179])
234 AC_MSG_RESULT([CFLAGS supplied by user])
237 if test x"${enable_werror}" = x"yes" ; then
248 AC_CHECK_TOOL(AR, ar)
250 dnl ---------------------------
251 dnl We, perhaps unfortunately,
252 dnl depend on GNU Make specific
254 dnl Give the user a warning if
256 dnl ---------------------------
257 AC_CACHE_CHECK([if ${MAKE-make} is GNU make], [quagga_cv_gnu_make],
258 [quagga_cv_gnu_make=no
259 if ${MAKE-make} --version 2>/dev/null | \
260 grep '^GNU Make ' >/dev/null ; then
261 quagga_cv_gnu_make=yes;
266 dnl -----------------
267 dnl System extensions
268 dnl -----------------
272 dnl ----------------------
273 dnl Packages configuration
274 dnl ----------------------
275 AC_ARG_WITH(pkg-extra-version,
276 AS_HELP_STRING([--with-pkg-extra-version=VER], [add extra version field, for packagers/distributions]),
277 [EXTRAVERSION=$withval],)
278 AC_ARG_WITH(pkg-git-version,
279 AS_HELP_STRING([--with-pkg-git-version], [add git information to MOTD and build version string]),
280 [ test "x$withval" != "xno" && with_pkg_git_version="yes" ])
282 AS_HELP_STRING([--disable-vtysh], [do not build integrated vty shell for Quagga]))
284 AS_HELP_STRING([--disable-doc], [do not build docs]))
286 AS_HELP_STRING([--disable-zebra], [do not build zebra daemon]))
288 AS_HELP_STRING([--disable-bgpd], [do not build bgpd]))
290 AS_HELP_STRING([--disable-ripd], [do not build ripd]))
291 AC_ARG_ENABLE(ripngd,
292 AS_HELP_STRING([--disable-ripngd], [do not build ripngd]))
294 AS_HELP_STRING([--disable-ospfd], [do not build ospfd]))
295 AC_ARG_ENABLE(ospf6d,
296 AS_HELP_STRING([--disable-ospf6d], [do not build ospf6d]))
298 AS_HELP_STRING([--disable-nhrpd], [do not build nhrpd]))
299 AC_ARG_ENABLE(watchquagga,
300 AS_HELP_STRING([--disable-watchquagga], [do not build watchquagga]))
302 AS_HELP_STRING([--disable-isisd], [do not build isisd]))
304 AS_HELP_STRING([--disable-pimd], [do not build pimd]))
305 AC_ARG_ENABLE(bgp-announce,
306 AS_HELP_STRING([--disable-bgp-announce,], [turn off BGP route announcement]))
308 AS_HELP_STRING([--enable-snmp=ARG], [enable SNMP support (smux or agentx)]))
310 AS_HELP_STRING([--with-libpam], [use libpam for PAM support in vtysh]))
311 AC_ARG_ENABLE(tcp-zebra,
312 AS_HELP_STRING([--enable-tcp-zebra], [enable TCP/IP socket connection between zebra and protocol daemon]))
313 AC_ARG_ENABLE(ospfapi,
314 AS_HELP_STRING([--disable-ospfapi], [do not build OSPFAPI to access the OSPF LSA Database]))
315 AC_ARG_ENABLE(ospfclient,
316 AS_HELP_STRING([--disable-ospfclient], [do not build OSPFAPI client for OSPFAPI,
317 (this is the default if --disable-ospfapi is set)]))
318 AC_ARG_ENABLE(multipath,
319 AS_HELP_STRING([--enable-multipath=ARG], [enable multipath function, ARG must be digit]))
321 AS_HELP_STRING([--enable-user=USER], [user to run Quagga suite as (default quagga)]))
323 AS_HELP_STRING([--enable-group=GROUP], [group to run Quagga suite as (default quagga)]))
324 AC_ARG_ENABLE(vty_group,
325 AS_HELP_STRING([--enable-vty-group=ARG], [set vty sockets to have specified group as owner]))
326 AC_ARG_ENABLE(configfile_mask,
327 AS_HELP_STRING([--enable-configfile-mask=ARG], [set mask for config files]))
328 AC_ARG_ENABLE(logfile_mask,
329 AS_HELP_STRING([--enable-logfile-mask=ARG], [set mask for log files]))
332 AS_HELP_STRING([--disable-rtadv], [disable IPV6 router advertisement feature]))
334 AS_HELP_STRING([--enable-irdp], [enable IRDP server support in zebra]))
335 AC_ARG_ENABLE(isis_topology,
336 AS_HELP_STRING([--enable-isis-topology], [enable IS-IS topology generator]))
337 AC_ARG_ENABLE(capabilities,
338 AS_HELP_STRING([--disable-capabilities], [disable using POSIX capabilities]))
339 AC_ARG_ENABLE(rusage,
340 AS_HELP_STRING([--disable-rusage], [disable using getrusage]))
341 AC_ARG_ENABLE(gcc_ultra_verbose,
342 AS_HELP_STRING([--enable-gcc-ultra-verbose], [enable ultra verbose GCC warnings]))
343 AC_ARG_ENABLE(linux24_tcp_md5,
344 AS_HELP_STRING([--enable-linux24-tcp-md5], [enable support for old, Linux-2.4 RFC2385 patch]))
345 AC_ARG_ENABLE(gcc-rdynamic,
346 AS_HELP_STRING([--enable-gcc-rdynamic], [enable linking with -rdynamic for better backtraces (default if gcc)]))
347 AC_ARG_ENABLE(backtrace,
348 AS_HELP_STRING([--disable-backtrace,], [disable crash backtraces (default autodetect)]))
349 AC_ARG_ENABLE(time-check,
350 AS_HELP_STRING([--disable-time-check], [disable slow thread warning messages]))
351 AC_ARG_ENABLE(pcreposix,
352 AS_HELP_STRING([--enable-pcreposix], [enable using PCRE Posix libs for regex functions]))
354 AS_HELP_STRING([--enable-fpm], [enable Forwarding Plane Manager support]))
355 AC_ARG_ENABLE(werror,
356 AS_HELP_STRING([--enable-werror], [enable -Werror (recommended for developers only)]))
357 AC_ARG_ENABLE([protobuf],
358 AS_HELP_STRING([--enable-protobuf], [Enable experimental protobuf support]))
360 AC_ARG_ENABLE([dev_build],
361 AS_HELP_STRING([--enable-dev-build], [build for development]))
363 if test x"${enable_gcc_rdynamic}" != x"no" ; then
364 if test x"${enable_gcc_rdynamic}" = x"yes" -o x"$COMPILER" = x"GCC"; then
365 LDFLAGS="${LDFLAGS} -rdynamic"
369 if test x"${enable_time_check}" != x"no" ; then
370 if test x"${enable_time_check}" = x"yes" -o x"${enable_time_check}" = x ; then
371 AC_DEFINE(CONSUMED_TIME_CHECK,5000000,Consumed Time Check)
373 AC_DEFINE_UNQUOTED(CONSUMED_TIME_CHECK,$enable_time_check,Consumed Time Check)
377 if test "${enable_fpm}" = "yes"; then
378 AC_DEFINE(HAVE_FPM,,Forwarding Plane Manager support)
381 if test "x${enable_dev_build}" = "xyes"; then
382 AC_DEFINE(DEV_BUILD,,Build for development)
384 AM_CONDITIONAL([DEV_BUILD], [test "x$enable_dev_build" = "xyes"])
387 # Logic for protobuf support.
389 if test "$enable_protobuf" = "yes"; then
393 AC_CHECK_PROG([PROTOC_C], [protoc-c], [protoc-c], [/bin/false])
394 if test "x$PROTOC_C" = "x/bin/false"; then
398 PKG_CHECK_MODULES([PROTOBUF_C], libprotobuf-c >= 0.14,
399 [found_protobuf_c=yes],
400 [AC_MSG_RESULT([pkg-config did not find libprotobuf-c])])
402 if test "x$found_protobuf_c" = "xyes"; then
403 LDFLAGS="$LDFLAGS $PROTOBUF_C_LIBS"
404 CFLAGS="$CFLAGS $PROTOBUF_C_CFLAGS"
406 AC_CHECK_HEADER([google/protobuf-c/protobuf-c.h], [],
407 [have_protobuf=no; AC_MSG_RESULT([Couldn't find google/protobuf-c.h])])
412 # Fail if the user explicity enabled protobuf support and we couldn't
413 # find the compiler or libraries.
414 if test "x$have_protobuf" = "xno" && test "x$enable_protobuf" = "xyes"; then
415 AC_MSG_ERROR([Protobuf enabled explicitly but can't find libraries/tools])
418 if test "x$have_protobuf" = "xyes"; then
419 AC_DEFINE(HAVE_PROTOBUF,, protobuf)
422 AM_CONDITIONAL([HAVE_PROTOBUF], [test "x$have_protobuf" = "xyes"])
425 # End of logic for protobuf support.
428 if test "${enable_tcp_zebra}" = "yes"; then
429 AC_DEFINE(HAVE_TCP_ZEBRA,,Use TCP for zebra communication)
432 if test "${enable_linux24_tcp_md5}" = "yes"; then
433 AC_DEFINE(HAVE_TCP_MD5_LINUX24,,Old Linux 2.4 TCP MD5 Signature Patch)
436 AC_MSG_CHECKING(if zebra should be configurable to send Route Advertisements)
437 if test "${enable_rtadv}" != "no"; then
439 AC_DEFINE(HAVE_RTADV,,Enable IPv6 Routing Advertisement support)
444 if test "${enable_irdp}" = "yes"; then
445 AC_DEFINE(HAVE_IRDP,, IRDP )
448 if test "${enable_isisd}" != "no" && test "${enable_isis_topology}" = yes; then
449 AC_DEFINE(TOPOLOGY_GENERATE,,Enable IS-IS topology generator code)
450 ISIS_TOPOLOGY_INCLUDES="-I\$(srcdir)/topology"
451 ISIS_TOPOLOGY_DIR="topology"
452 ISIS_TOPOLOGY_LIB="./topology/libtopology.a"
455 AC_SUBST(ISIS_TOPOLOGY_INCLUDES)
456 AC_SUBST(ISIS_TOPOLOGY_DIR)
457 AC_SUBST(ISIS_TOPOLOGY_LIB)
459 if test x"${enable_user}" = x"no"; then
462 if test x"${enable_user}" = x"yes" || test x"${enable_user}" = x""; then
465 AC_DEFINE_UNQUOTED(QUAGGA_USER, "${enable_user}", Quagga User)
468 if test x"${enable_group}" = x"no"; then
471 if test x"${enable_group}" = x"yes" || test x"${enable_group}" = x""; then
472 enable_group="quagga"
474 AC_DEFINE_UNQUOTED(QUAGGA_GROUP, "${enable_group}", Quagga Group)
477 if test x"${enable_vty_group}" = x"yes" ; then
478 AC_MSG_ERROR([--enable-vty-group requires a group as argument, not yes])
479 elif test x"${enable_vty_group}" != x""; then
480 if test x"${enable_vty_group}" != x"no"; then
481 AC_DEFINE_UNQUOTED(VTY_GROUP, "${enable_vty_group}", VTY Sockets Group)
484 AC_SUBST([enable_user])
485 AC_SUBST([enable_group])
486 AC_SUBST([enable_vty_group])
488 enable_configfile_mask=${enable_configfile_mask:-0600}
489 AC_DEFINE_UNQUOTED(CONFIGFILE_MASK, ${enable_configfile_mask}, Mask for config files)
491 enable_logfile_mask=${enable_logfile_mask:-0600}
492 AC_DEFINE_UNQUOTED(LOGFILE_MASK, ${enable_logfile_mask}, Mask for log files)
496 case "${enable_multipath}" in
500 [[1-9]|[1-9][0-9]|[1-9][0-9][0-9]])
501 MPATH_NUM="${enable_multipath}"
506 AC_MSG_FAILURE([Please specify digit to enable multipath ARG])
510 AC_DEFINE_UNQUOTED(MULTIPATH_NUM, $MPATH_NUM, Maximum number of paths for a route)
512 dnl -----------------------------------
513 dnl Add extra version string to package
514 dnl name, string and version fields.
515 dnl -----------------------------------
516 if test "x${EXTRAVERSION}" != "x" ; then
517 VERSION="${VERSION}${EXTRAVERSION}"
518 PACKAGE_VERSION="${PACKAGE_VERSION}${EXTRAVERSION}"
519 PACKAGE_STRING="${PACKAGE_STRING}${EXTRAVERSION}"
522 if test "x$with_pkg_git_version" = "xyes"; then
523 if test -d "${srcdir}/.git"; then
524 AC_DEFINE(GIT_VERSION, [1], [include git version info])
525 else with_pkg_git_version="no"
526 AC_MSG_WARN([--with-pkg-git-version given, but this is not a git checkout])
529 AM_CONDITIONAL([GIT_VERSION], [test "x$with_pkg_git_version" = "xyes"])
531 dnl ------------------------------------
532 dnl Check C keywords and standard types
533 dnl ------------------------------------
548 dnl -------------------------
549 dnl Check other header files.
550 dnl -------------------------
551 AC_CHECK_HEADERS([stropts.h sys/ksym.h sys/times.h sys/select.h \
552 sys/types.h linux/version.h netdb.h asm/types.h \
553 sys/cdefs.h sys/param.h limits.h signal.h \
554 sys/socket.h netinet/in.h time.h sys/time.h features.h])
556 dnl Utility macro to avoid retyping includes all the time
557 m4_define([QUAGGA_INCLUDES],
560 #define __EXTENSIONS__
572 # include <sys/types.h>
574 /* sys/conf.h depends on param.h on FBSD at least */
576 # include <sys/param.h>
578 /* Required for MAXSIG */
582 #if HAVE_SYS_SOCKET_H
583 # include <sys/socket.h>
586 # define __APPLE_USE_RFC_3542
588 #if HAVE_NETINET_IN_H
589 # include <netinet/in.h>
591 #ifdef TIME_WITH_SYS_TIME
592 # include <sys/time.h>
595 # ifdef HAVE_SYS_TIME_H
596 # include <sys/time.h>
600 #endif /* TIME_WITH_SYS_TIME */
603 dnl HAVE_NET_IF_H must be discovered by the time the longer AC_CHECK_HEADERS
604 dnl round below execution begins, otherwise it doesn't properly detect
605 dnl HAVE_NETINET6_IN6_VAR_H, HAVE_NET_IF_VAR_H and HAVE_STRUCT_IN6_ALIASREQ
606 dnl on FreeBSD (BZ#408).
608 AC_CHECK_HEADERS([net/if.h], [], [], QUAGGA_INCLUDES)
610 m4_define([QUAGGA_INCLUDES],
617 dnl Same applies for HAVE_NET_IF_VAR_H, which HAVE_NETINET6_ND6_H and
618 dnl HAVE_NETINET_IN_VAR_H depend upon. But if_var.h depends on if.h, hence
619 dnl an additional round for it.
621 AC_CHECK_HEADERS([net/if_var.h], [], [], QUAGGA_INCLUDES)
623 m4_define([QUAGGA_INCLUDES],
625 [#if HAVE_NET_IF_VAR_H
626 # include <net/if_var.h>
630 AC_CHECK_HEADERS([sys/un.h netinet/in_systm.h netinet/in_var.h \
631 net/if_dl.h net/netopt.h net/route.h \
632 inet/nd.h arpa/inet.h netinet/ip_icmp.h \
633 fcntl.h stddef.h sys/ioctl.h syslog.h wchar.h wctype.h \
634 sys/sysctl.h sys/sockio.h kvm.h sys/conf.h],
635 [], [], QUAGGA_INCLUDES)
637 AC_CHECK_HEADERS([ucontext.h], [], [],
640 #endif /* __USE_GNU */
644 m4_define([UCONTEXT_INCLUDES],
645 [#include <ucontext.h>])dnl
647 AC_CHECK_MEMBERS([ucontext_t.uc_mcontext.uc_regs],
648 [], [], [UCONTEXT_INCLUDES])
649 AC_CHECK_MEMBERS([ucontext_t.uc_mcontext.regs],
650 [AC_CHECK_MEMBERS([ucontext_t.uc_mcontext.regs.nip],
651 [], [], [UCONTEXT_INCLUDES])],
652 [], [UCONTEXT_INCLUDES])
653 AC_CHECK_MEMBERS([ucontext_t.uc_mcontext.gregs],
654 [], [], [UCONTEXT_INCLUDES])
656 m4_define([QUAGGA_INCLUDES],
661 #if HAVE_NETINET_IN_SYSTM_H
662 # include <netinet/in_systm.h>
664 #if HAVE_NETINET_IN_VAR_H
665 # include <netinet/in_var.h>
668 # include <net/if_dl.h>
670 #if HAVE_NET_NETOPT_H
671 # include <net/netopt.h>
674 # include <net/route.h>
677 # include <inet/nd.h>
680 # include <arpa/inet.h>
682 /* Required for IDRP */
683 #if HAVE_NETINET_IP_ICMP_H
684 # include <netinet/ip_icmp.h>
688 dnl V6 headers are checked below, after we check for v6
690 dnl Some systems (Solaris 2.x) require libnsl (Network Services Library)
692 [*-sunos5.[6-7]*] | [*-solaris2.[6-7]*])
694 AC_DEFINE(SUNOS_56, 1, SunOS 5.6 to 5.7)
695 AC_DEFINE(SUNOS_5, 1, SunOS 5)
696 AC_CHECK_LIB(xnet, main)
701 | [*-sunos5.1[0-9]] \
702 | [*-sunos5.1[0-9].[0-9]] \
703 | [*-solaris2.[8-9]] \
704 | [*-solaris2.1[0-9]] \
705 | [*-solaris2.1[0-9].[0-9]])
707 AC_DEFINE(SUNOS_59, 1, [SunOS 5.8 up])
708 AC_DEFINE(SUNOS_5, 1, [SunOS 5])
709 AC_CHECK_LIB(socket, main)
710 AC_CHECK_LIB(nsl, main)
711 AC_CHECK_LIB(umem, main)
712 AC_CHECK_FUNCS([printstack],
713 [AC_DEFINE([HAVE_PRINTSTACK],1,[Solaris printstack])
714 AC_DEFINE([HAVE_STACK_TRACE],1,[Stack symbols decode functionality])
719 *-sunos5* | *-solaris2*)
720 AC_DEFINE(SUNOS_5,,SunOS 5, Unknown SunOS)
721 AC_CHECK_LIB(socket, main)
722 AC_CHECK_LIB(nsl, main)
728 AC_DEFINE(GNU_LINUX,,GNU Linux)
732 AC_DEFINE(OPEN_BSD,,OpenBSD)
738 dnl ---------------------
739 dnl Integrated VTY option
740 dnl ---------------------
741 case "${enable_vtysh}" in
744 AC_DEFINE(VTYSH,,VTY shell)
745 dnl Vtysh uses libreadline, which looks for termcap functions at
746 dnl configure time. We follow readlines search order.
747 dnl The required procedures are in libtermcap on NetBSD, in
748 dnl [TODO] on Linux, and in [TODO] on Solaris.
749 AC_CHECK_LIB(termcap, tputs, LIBREADLINE="$LIBREADLINE -ltermcap",
750 [AC_CHECK_LIB(tinfo, tputs, LIBREADLINE="$LIBREADLINE -ltinfo",
751 [AC_CHECK_LIB(curses, tputs, LIBREADLINE="$LIBREADLINE -lcurses",
752 [AC_CHECK_LIB(ncurses, tputs,
753 LIBREADLINE="$LIBREADLINE -lncurses")]
757 AC_CHECK_LIB(readline, main, LIBREADLINE="-lreadline $LIBREADLINE",,
759 if test $ac_cv_lib_readline_main = no; then
760 AC_MSG_ERROR([vtysh needs libreadline but was not found and usable on your system.])
762 AC_CHECK_HEADER(readline/history.h)
763 if test $ac_cv_header_readline_history_h = no;then
764 AC_MSG_ERROR([readline is too old to have readline/history.h, please update to the latest readline library.])
766 AC_CHECK_LIB(readline, rl_completion_matches,
767 LIBREADLINE="$LIBREADLINE",, "$LIBREADLINE")
768 if test $ac_cv_lib_readline_rl_completion_matches = no; then
769 AC_DEFINE(rl_completion_matches,completion_matches,Old readline)
774 AC_SUBST(LIBREADLINE)
775 AM_CONDITIONAL(VTYSH, test "x$VTYSH" = "xvtysh")
780 dnl Quagga detects the PAM library it is built against by checking for a
781 dnl functional pam_misc.h (Linux-PAM) or openpam.h (OpenPAM) header. pam_misc.h
782 dnl is known to #include pam_appl.h, the standard header of a PAM library, and
783 dnl openpam.h doesn't do that, although depends on the header too. Hence a
784 dnl little assistance to AC_CHECK_HEADER is necessary for the proper detection
787 if test "$with_libpam" = "yes"; then
788 AC_CHECK_HEADER([security/pam_misc.h],
789 [AC_DEFINE(HAVE_PAM_MISC_H,,Have pam_misc.h)
790 AC_DEFINE(PAM_CONV_FUNC,misc_conv,Have misc_conv)
791 pam_conv_func="misc_conv"
794 AC_CHECK_HEADER([security/openpam.h],
795 [AC_DEFINE(HAVE_OPENPAM_H,,Have openpam.h)
796 AC_DEFINE(PAM_CONV_FUNC,openpam_ttyconv,Have openpam_ttyconv)
797 pam_conv_func="openpam_ttyconv"
799 [], QUAGGA_INCLUDES[#include <security/pam_appl.h>])
800 if test -z "$ac_cv_header_security_pam_misc_h$ac_cv_header_security_openpam_h" ; then
801 AC_MSG_WARN([*** pam support will not be built ***])
806 if test "$with_libpam" = "yes"; then
807 dnl took this test from proftpds configure.in and suited to our needs
808 dnl -------------------------------------------------------------------------
810 dnl This next check looks funky due to a linker problem with some versions
811 dnl of the PAM library. Prior to 0.72 release, the Linux PAM shared library
812 dnl omitted requiring libdl linking information. PAM-0.72 or better ships
813 dnl with RedHat 6.2 and Debian 2.2 or better.
814 AC_CHECK_LIB(pam, pam_start,
815 [AC_CHECK_LIB(pam, $pam_conv_func,
816 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
818 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
819 LIBPAM="-lpam -lpam_misc"]
823 [AC_CHECK_LIB(pam, pam_end,
824 [AC_CHECK_LIB(pam, $pam_conv_func,
825 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
826 LIBPAM="-lpam -ldl"],
827 [AC_DEFINE(USE_PAM,,Use PAM for authentication)
828 LIBPAM="-lpam -ldl -lpam_misc"]
830 ],AC_MSG_WARN([*** pam support will not be built ***]),
837 dnl -------------------------------
838 dnl Endian-ness check
839 dnl -------------------------------
842 dnl -------------------------------
843 dnl check the size in byte of the C
844 dnl -------------------------------
845 dnl AC_CHECK_SIZEOF(char)
846 dnl AC_CHECK_SIZEOF(int)
847 dnl AC_CHECK_SIZEOF(short)
848 dnl AC_CHECK_SIZEOF(long)
850 dnl ----------------------------
851 dnl check existance of functions
852 dnl ----------------------------
860 AC_FUNC_SELECT_ARGTYPES
862 dnl Avoid AC_FUNC_STRNLEN because it pulls in AC_SYSTEM_EXTENSIONS which
863 dnl can lead to strange side effects. So we just check for strnlen
864 dnl directly, see below.
865 dnl AC_FUNC_STRNLENdnl
868 dnl -------------------------------
869 dnl bgpd needs pow() and hence libm
870 dnl -------------------------------
872 AC_CHECK_HEADER([math.h],
873 [AC_CHECK_LIB([m], [pow],
876 AC_DEFINE(HAVE_LIBM,, Have libm)
877 AC_CHECK_FUNCS(pow,[],[LIBM=""])
880 if test x"$LIBM" = x ; then
881 AC_MSG_WARN([Unable to find working pow function - bgpd may not link])
889 AC_CHECK_FUNCS([dup2 ftruncate getcwd gethostbyname getpagesize gettimeofday \
890 inet_ntoa inet_aton strnlen \
891 memchr memmove memset select socket \
892 strcasecmp strchr strcspn strdup strerror \
893 strncasecmp strndup strrchr strspn strstr \
894 strtol strtoul strlcat strlcpy \
895 daemon snprintf vsnprintf \
896 if_nametoindex if_indextoname getifaddrs \
897 uname fcntl getgrouplist])
900 AC_CHECK_HEADER([asm-generic/unistd.h],
901 [AC_CHECK_DECL(__NR_setns,
902 AC_DEFINE(HAVE_NETNS,, Have netns),,
903 QUAGGA_INCLUDES [#include <asm-generic/unistd.h>
905 AC_CHECK_FUNCS(setns, AC_DEFINE(HAVE_SETNS,, Have setns))]
908 dnl ------------------------------------
909 dnl Determine routing get and set method
910 dnl ------------------------------------
911 AC_MSG_CHECKING(zebra between kernel interface method)
912 if test x"$opsys" = x"gnu-linux"; then
913 AC_MSG_RESULT(netlink)
914 RT_METHOD=rt_netlink.o
915 AC_DEFINE(HAVE_NETLINK,,netlink)
918 AC_MSG_RESULT(Route socket)
919 KERNEL_METHOD="kernel_socket.o"
920 RT_METHOD="rt_socket.o"
923 AC_SUBST(KERNEL_METHOD)
924 AM_CONDITIONAL([HAVE_NETLINK], [test "x$netlink" = "xyes"])
926 dnl --------------------------
927 dnl Determine IS-IS I/O method
928 dnl --------------------------
929 AC_DEFINE(ISIS_METHOD_PFPACKET, 1, [ constant value for isis method pfpacket ])
930 AC_DEFINE(ISIS_METHOD_DLPI, 2, [ constant value for isis method dlpi ])
931 AC_DEFINE(ISIS_METHOD_BPF, 3, [ constant value for isis method bpf ])
932 AC_CHECK_HEADER(net/bpf.h)
933 AC_CHECK_HEADER(sys/dlpi.h)
934 AC_MSG_CHECKING(zebra IS-IS I/O method)
935 if test x"$opsys" = x"gnu-linux"; then
936 AC_MSG_RESULT(pfpacket)
937 ISIS_METHOD_MACRO="ISIS_METHOD_PFPACKET"
938 elif test x"$opsys" = x"sol2-6" -o x"$opsys" = x"sol8"; then
940 ISIS_METHOD_MACRO="ISIS_METHOD_DLPI"
942 if test $ac_cv_header_net_bpf_h = no; then
943 if test $ac_cv_header_sys_dlpi_h = no; then
945 AC_MSG_WARN([*** IS-IS support will not be built ***])
950 ISIS_METHOD_MACRO="ISIS_METHOD_DLPI"
953 ISIS_METHOD_MACRO="ISIS_METHOD_BPF"
956 AC_DEFINE_UNQUOTED(ISIS_METHOD, $ISIS_METHOD_MACRO, [ selected method for isis, == one of the constants ])
958 dnl ------------------------------------
959 dnl check for broken CMSG_FIRSTHDR macro
960 dnl ------------------------------------
961 AC_MSG_CHECKING(for broken CMSG_FIRSTHDR)
962 AC_RUN_IFELSE([AC_LANG_SOURCE([[
965 #define __EXTENSIONS__
970 #ifdef HAVE_SYS_TYPES_H
971 #include <sys/types.h>
973 #ifdef HAVE_SYS_SOCKET_H
974 #include <sys/socket.h>
982 msg.msg_control = buf;
983 msg.msg_controllen = 0;
985 if (CMSG_FIRSTHDR(&msg) != NULL)
988 }]])],[AC_MSG_RESULT(yes - using workaround) AC_DEFINE(HAVE_BROKEN_CMSG_FIRSTHDR,,Broken CMSG_FIRSTHDR)],
989 [AC_MSG_RESULT(no)],[AC_MSG_RESULT(no)])
991 dnl ------------------------------
992 dnl check kernel route read method
993 dnl ------------------------------
994 AC_CACHE_CHECK([route read method], [quagga_cv_rtread_method],
995 [if test "x$netlink" = xyes; then
996 quagga_cv_rtread_method="netlink"
998 for quagga_cv_rtread_method in /dev/ip /dev/null;
1000 test x`ls $quagga_cv_rtread_method 2>/dev/null` = x"$quagga_cv_rtread_method" && break
1002 case $quagga_cv_rtread_method in
1005 *-freebsd*) quagga_cv_rtread_method="sysctl";;
1006 *) quagga_cv_rtread_method="getmsg";;
1009 quagga_cv_rtread_method="sysctl";;
1012 RTREAD_METHOD=rtread_${quagga_cv_rtread_method}.o
1013 AC_SUBST(RTREAD_METHOD)
1015 dnl -----------------------------
1016 dnl check interface lookup method
1017 dnl -----------------------------
1018 IOCTL_METHOD=ioctl.o
1019 AC_MSG_CHECKING(interface looking up method)
1020 if test "$netlink" = yes; then
1021 AC_MSG_RESULT(netlink)
1022 IF_METHOD=if_netlink.o
1023 elif test "$opsys" = "sol2-6";then
1024 AC_MSG_RESULT(Solaris GIF)
1025 IF_METHOD=if_ioctl.o
1026 elif test "$opsys" = "sol8";then
1027 AC_MSG_RESULT(Solaris GLIF)
1028 IF_METHOD=if_ioctl_solaris.o
1029 IOCTL_METHOD=ioctl_solaris.o
1030 elif test "$opsys" = "openbsd";then
1031 AC_MSG_RESULT(openbsd)
1032 IF_METHOD=if_ioctl.o
1033 elif grep NET_RT_IFLIST /usr/include/sys/socket.h >/dev/null 2>&1; then
1034 AC_MSG_RESULT(sysctl)
1035 IF_METHOD=if_sysctl.o
1036 AC_DEFINE(HAVE_NET_RT_IFLIST,,NET_RT_IFLIST)
1038 AC_MSG_RESULT(ioctl)
1039 IF_METHOD=if_ioctl.o
1042 AC_SUBST(IOCTL_METHOD)
1044 dnl ---------------------------------------------------------------
1045 dnl figure out how to specify an interface in multicast sockets API
1046 dnl ---------------------------------------------------------------
1047 AC_CHECK_MEMBERS([struct ip_mreqn.imr_ifindex], [], [], QUAGGA_INCLUDES)
1049 AC_CHECK_HEADERS([linux/mroute.h], [], [],
1051 #if HAVE_NETINET_IN_H
1052 #include<netinet/in.h>
1054 AC_MSG_CHECKING([for BSD struct ip_mreq hack])
1055 AC_TRY_COMPILE([#ifdef HAVE_SYS_PARAM_H
1056 #include <sys/param.h>
1057 #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)
1060 #error No support for BSD struct ip_mreq hack detected
1061 #endif],[AC_MSG_RESULT(yes)
1062 AC_DEFINE(HAVE_BSD_STRUCT_IP_MREQ_HACK,,[Can pass ifindex in struct ip_mreq])],
1065 AC_MSG_CHECKING([for RFC3678 protocol-independed API])
1067 #include <sys/types.h>
1068 #include <netinet/in.h>
1069 ], [struct group_req gr; int sock; setsockopt(sock, IPPROTO_IP, MCAST_JOIN_GROUP, (void*)&gr, sizeof(gr));
1070 ], [AC_MSG_RESULT(yes)
1071 AC_DEFINE(HAVE_RFC3678,1,[Have RFC3678 protocol-independed API])],
1074 dnl ---------------------------------------------------------------
1075 dnl figure out how to check link-state
1076 dnl ---------------------------------------------------------------
1077 AC_CHECK_HEADER([net/if.h],
1078 [AC_CHECK_HEADER( [net/if_media.h],
1079 [m4_define([LINK_DETECT_INCLUDES],
1081 [#include <net/if_media.h>
1083 AC_CHECK_MEMBERS( [struct ifmediareq.ifm_status],
1084 AC_DEFINE(HAVE_BSD_LINK_DETECT,,[BSD link-detect]),
1085 [], LINK_DETECT_INCLUDES)],
1088 [], QUAGGA_INCLUDES )
1090 dnl ---------------------------------------------------------------
1091 dnl Additional, newer way to check link-state using ifi_link_state.
1092 dnl Not available in all BSD's when ifmediareq available
1093 dnl ---------------------------------------------------------------
1094 AC_CHECK_HEADER([net/if.h],
1095 AC_CHECK_MEMBERS([struct if_data.ifi_link_state],
1096 AC_DEFINE(HAVE_BSD_IFI_LINK_STATE,,[BSD ifi_link_state available]),
1097 [], QUAGGA_INCLUDES),
1100 dnl ------------------------
1101 dnl TCP_MD5SIG socket option
1102 dnl ------------------------
1104 AC_CHECK_HEADER([netinet/tcp.h],
1105 [m4_define([MD5_INCLUDES],
1107 [#include <netinet/tcp.h>
1109 AC_CHECK_DECLS([TCP_MD5SIG], [], [], MD5_INCLUDES)],
1112 if test $ac_cv_have_decl_TCP_MD5SIG = no; then
1113 AC_CHECK_HEADER([linux/tcp.h],
1114 [m4_define([MD5_INCLUDES],
1116 [#include <linux/tcp.h>
1118 AC_CHECK_DECLS([TCP_MD5SIG], [], [], MD5_INCLUDES)])
1121 dnl -----------------------------
1122 dnl check ipforward detect method
1123 dnl -----------------------------
1124 AC_CACHE_CHECK([ipforward method], [quagga_cv_ipforward_method],
1125 [if test x$cross_compiling = xyes; then
1126 if test x"$opsys" = x"gnu-linux"; then
1127 quagga_cv_ipforward_method=/proc/net/snmp
1129 quagga_cv_ipforward_method=/dev/ip
1132 for quagga_cv_ipforward_method in /proc/net/snmp /dev/ip /dev/null;
1134 test x`ls $quagga_cv_ipforward_method 2>/dev/null` = x"$quagga_cv_ipforward_method" && break
1137 case $quagga_cv_ipforward_method in
1138 "/proc/net/snmp") quagga_cv_ipforward_method="proc";;
1141 *-freebsd*) quagga_cv_ipforward_method="sysctl";;
1142 *) quagga_cv_ipforward_method="solaris";;
1144 *) quagga_cv_ipforward_method="sysctl";;
1146 IPFORWARD=ipforward_${quagga_cv_ipforward_method}.o
1149 AC_CHECK_FUNCS(getaddrinfo, [have_getaddrinfo=yes], [have_getaddrinfo=no])
1154 AC_MSG_CHECKING(whether does this OS have IPv6 stack)
1158 if grep WIDE /usr/include/netinet6/in6.h >/dev/null 2>&1; then
1159 AC_DEFINE(KAME,1,KAME IPv6)
1161 dnl ------------------------------------
1162 dnl Solaris 9, 10 and potentially higher
1163 dnl ------------------------------------
1164 elif test x"$opsys" = x"sol8"; then
1165 AC_DEFINE(SOLARIS_IPV6, 1, Solaris IPv6)
1166 AC_MSG_RESULT(Solaris IPv6)
1170 elif test x"$opsys" = x"gnu-linux"; then
1171 AC_DEFINE(LINUX_IPV6,1,Linux IPv6 stack)
1172 AC_MSG_RESULT(Linux IPv6)
1174 AC_MSG_ERROR([Failed to detect IPv6 stack])
1177 dnl this is unconditial, for compatibility
1178 AC_DEFINE(HAVE_IPV6,1,IPv6)
1180 dnl ------------------
1181 dnl IPv6 header checks
1182 dnl ------------------
1183 AC_CHECK_HEADERS([netinet6/in6.h netinet/in6_var.h netinet/icmp6.h \
1184 netinet6/in6_var.h netinet6/nd6.h], [], [],
1187 m4_define([QUAGGA_INCLUDES],dnl
1189 [#if HAVE_NETINET6_IN6_H
1190 #include <netinet6/in6.h>
1192 #if HAVE_NETINET_IN6_VAR_H
1193 #include <netinet/in6_var.h>
1195 #if HAVE_NETINET_ICMP6_H
1196 # include <netinet/icmp6.h>
1198 #if HAVE_NETINET6_IN6_VAR_H
1199 # include <netinet6/in6_var.h>
1201 #if HAVE_NETINET6_ND6_H
1202 # include <netinet6/nd6.h>
1206 dnl disable doc check
1207 if test "${enable_doc}" = "no";then
1213 dnl --------------------
1214 dnl Daemon disable check
1215 dnl --------------------
1216 if test "${enable_zebra}" = "no";then
1221 AM_CONDITIONAL(ZEBRA, test "x$ZEBRA" = "xzebra")
1223 if test "${enable_bgpd}" = "no";then
1228 AM_CONDITIONAL(BGPD, test "x$BGPD" = "xbgpd")
1230 if test "${enable_ripd}" = "no";then
1235 AM_CONDITIONAL(RIPD, test "x$RIPD" = "xripd")
1237 if test "${enable_ospfd}" = "no";then
1242 AM_CONDITIONAL(OSPFD, test "x$OSPFD" = "xospfd")
1244 if test x"$opsys" != x"gnu-linux"; then
1245 dnl NHRPd works currently with Linux only.
1248 if test "${enable_nhrpd}" = "no";then
1253 AM_CONDITIONAL(NHRPD, test "x$NHRPD" = "xnhrpd")
1255 if test "${enable_watchquagga}" = "no";then
1258 WATCHQUAGGA="watchquagga"
1260 AM_CONDITIONAL(WATCHQUAGGA, test "x$WATCHQUAGGA" = "xwatchquagga")
1263 if test "${enable_ospfapi}" != "no";then
1264 AC_DEFINE(SUPPORT_OSPF_API,,OSPFAPI)
1266 if test "${enable_ospfclient}" != "no";then
1267 OSPFCLIENT="ospfclient"
1271 AM_CONDITIONAL(OSPFCLIENT, test "x$OSPFCLIENT" = "xospfclient")
1273 case "${enable_ripngd}" in
1275 * ) RIPNGD="ripngd";;
1277 AM_CONDITIONAL(RIPNGD, test "x$RIPNGD" = "xripngd")
1279 case "${enable_ospf6d}" in
1281 * ) OSPF6D="ospf6d";;
1283 AM_CONDITIONAL(OSPF6D, test "x$OSPF6D" = "xospf6d")
1285 case "${enable_isisd}" in
1289 AM_CONDITIONAL(ISISD, test "x$ISISD" = "xisisd")
1291 case "${enable_pimd}" in
1295 AM_CONDITIONAL(PIMD, test "x$PIMD" = "xpimd")
1297 if test "${enable_bgp_announce}" = "no";then
1298 AC_DEFINE(DISABLE_BGP_ANNOUNCE,1,Disable BGP installation to zebra)
1300 AC_DEFINE(DISABLE_BGP_ANNOUNCE,0,Disable BGP installation to zebra)
1311 AC_SUBST(WATCHQUAGGA)
1317 AC_SUBST(OSPFCLIENT)
1319 AC_CHECK_LIB(c, inet_ntop, [AC_DEFINE(HAVE_INET_NTOP,,inet_ntop)])
1320 AC_CHECK_LIB(c, inet_pton, [AC_DEFINE(HAVE_INET_PTON,,inet_pton)])
1321 AC_CHECK_LIB(crypt, crypt)
1322 AC_CHECK_LIB(resolv, res_init)
1324 dnl ---------------------------
1325 dnl check system has PCRE regexp
1326 dnl ---------------------------
1327 if test "x$enable_pcreposix" = "xyes"; then
1328 AC_CHECK_LIB(pcreposix, pcreposix_regexec, ,[enable_pcreposix=no
1329 AC_MSG_WARN([*** falling back to other regex library ***]) ])
1332 if test "x$enable_pcreposix" != "xyes"; then
1333 dnl ---------------------------
1334 dnl check system has GNU regexp
1335 dnl ---------------------------
1336 AC_MSG_CHECKING(whether system has GNU regex)
1337 AC_CHECK_LIB(c, regexec,
1338 [AC_DEFINE(HAVE_GNU_REGEX,,GNU regexp library)
1340 [LIB_REGEX="regex.o"])
1342 AC_SUBST(HAVE_LIBPCREPOSIX)
1345 dnl ------------------
1346 dnl check C-Ares library
1347 dnl ------------------
1348 if test "${enable_nhrpd}" != "no";then
1349 PKG_CHECK_MODULES([CARES], [libcares])
1353 dnl ------------------
1354 dnl check Net-SNMP library
1355 dnl ------------------
1356 if test "${enable_snmp}" != ""; then
1357 AC_PATH_TOOL([NETSNMP_CONFIG], [net-snmp-config], [no])
1358 if test x"$NETSNMP_CONFIG" = x"no"; then
1359 AC_MSG_ERROR([--enable-snmp given but unable to find net-snmp-config])
1361 LIBS="$LIBS `${NETSNMP_CONFIG} --agent-libs`"
1362 CFLAGS="`${NETSNMP_CONFIG} --base-cflags` $CFLAGS"
1363 AC_MSG_CHECKING([whether we can link to Net-SNMP])
1364 AC_LINK_IFELSE([AC_LANG_PROGRAM([
1371 ])],[AC_MSG_RESULT(yes)],[
1373 AC_MSG_ERROR([--enable-snmp given but not usable])])
1374 AC_DEFINE(HAVE_SNMP,,SNMP)
1375 case "${enable_snmp}" in
1380 SNMP_METHOD="${enable_snmp}"
1383 AC_MSG_ERROR([--enable-snmp given with an unknown method (${enable_snmp}). Use smux or agentx])
1386 AH_TEMPLATE([SNMP_SMUX], [Use SNMP SMUX to interface with snmpd])
1387 AH_TEMPLATE([SNMP_AGENTX], [Use SNMP AgentX to interface with snmpd])
1388 AC_DEFINE_UNQUOTED(AS_TR_CPP(SNMP_${SNMP_METHOD}),,SNMP method to interface with snmpd)
1391 dnl ---------------------------
1392 dnl sockaddr and netinet checks
1393 dnl ---------------------------
1394 AC_CHECK_TYPES([struct sockaddr, struct sockaddr_in,
1395 struct sockaddr_in6, struct sockaddr_un, struct sockaddr_dl,
1396 socklen_t, struct vifctl, struct mfcctl, struct sioc_sg_req,
1397 vifi_t, struct sioc_vif_req, struct igmpmsg,
1398 struct ifaliasreq, struct if6_aliasreq, struct in6_aliasreq,
1399 struct nd_opt_adv_interval, struct rt_addrinfo,
1400 struct nd_opt_homeagent_info, struct nd_opt_adv_interval],
1401 [], [], QUAGGA_INCLUDES)
1403 AC_CHECK_MEMBERS([struct sockaddr.sa_len,
1404 struct sockaddr_in.sin_len, struct sockaddr_un.sun_len,
1405 struct sockaddr_in6.sin6_scope_id,
1406 struct sockaddr_dl.sdl_len,
1407 struct if6_aliasreq.ifra_lifetime,
1408 struct nd_opt_adv_interval.nd_opt_ai_type],
1409 [], [], QUAGGA_INCLUDES)
1411 dnl ---------------------------
1412 dnl IRDP/pktinfo/icmphdr checks
1413 dnl ---------------------------
1414 AC_CHECK_TYPES([struct in_pktinfo],
1415 [AC_CHECK_TYPES([struct icmphdr],
1416 [if test "${enable_irdp}" != "no"; then
1417 AC_DEFINE(HAVE_IRDP,, IRDP)
1419 [if test "${enable_irdp}" = "yes"; then
1420 AC_MSG_ERROR(['IRDP requires in_pktinfo at the moment!'])
1421 fi], [QUAGGA_INCLUDES])],
1422 [if test "${enable_irdp}" = "yes"; then
1423 AC_MSG_ERROR(['IRDP requires in_pktinfo at the moment!'])
1424 fi], [QUAGGA_INCLUDES])
1426 dnl -----------------------
1427 dnl checking for IP_PKTINFO
1428 dnl -----------------------
1429 AC_MSG_CHECKING(for IP_PKTINFO)
1430 AC_TRY_COMPILE([#include <netdb.h>], [
1431 int opt = IP_PKTINFO;
1434 AC_DEFINE(HAVE_IP_PKTINFO, 1, [Have IP_PKTINFO])
1439 dnl ---------------------------
1440 dnl checking for IP_RECVDSTADDR
1441 dnl ---------------------------
1442 AC_MSG_CHECKING(for IP_RECVDSTADDR)
1443 AC_TRY_COMPILE([#include <netinet/in.h>], [
1444 int opt = IP_RECVDSTADDR;
1447 AC_DEFINE(HAVE_IP_RECVDSTADDR, 1, [Have IP_RECVDSTADDR])
1452 dnl ----------------------
1453 dnl checking for IP_RECVIF
1454 dnl ----------------------
1455 AC_MSG_CHECKING(for IP_RECVIF)
1456 AC_TRY_COMPILE([#include <netinet/in.h>], [
1457 int opt = IP_RECVIF;
1460 AC_DEFINE(HAVE_IP_RECVIF, 1, [Have IP_RECVIF])
1465 dnl --------------------------------------
1466 dnl checking for getrusage struct and call
1467 dnl --------------------------------------
1468 if test "${enable_rusage}" != "no"; then
1469 AC_MSG_CHECKING(whether getrusage is available)
1470 AC_TRY_COMPILE([#include <sys/resource.h>],[struct rusage ac_x; getrusage (RUSAGE_SELF, &ac_x);],
1472 AC_DEFINE(HAVE_RUSAGE,,rusage)],
1476 dnl --------------------------------------
1477 dnl checking for clock_time monotonic struct and call
1478 dnl --------------------------------------
1479 AC_CHECK_DECL(CLOCK_MONOTONIC,
1480 [AC_CHECK_LIB(rt, clock_gettime, [LIBS="$LIBS -lrt"])
1481 AC_DEFINE(HAVE_CLOCK_MONOTONIC,, Have monotonic clock)
1482 ], [AC_MSG_RESULT(no)], [QUAGGA_INCLUDES])
1484 dnl -------------------
1485 dnl capabilities checks
1486 dnl -------------------
1487 if test "${enable_capabilities}" != "no"; then
1488 AC_MSG_CHECKING(whether prctl PR_SET_KEEPCAPS is available)
1489 AC_TRY_COMPILE([#include <sys/prctl.h>],[prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0);],
1491 AC_DEFINE(HAVE_PR_SET_KEEPCAPS,,prctl)
1492 quagga_ac_keepcaps="yes"],
1495 if test x"${quagga_ac_keepcaps}" = x"yes"; then
1496 AC_CHECK_HEADERS(sys/capability.h)
1498 if test x"${ac_cv_header_sys_capability_h}" = x"yes"; then
1499 AC_CHECK_LIB(cap, cap_init,
1500 [AC_DEFINE(HAVE_LCAPS,1,Capabilities)
1502 quagga_ac_lcaps="yes"]
1505 AC_CHECK_HEADERS(priv.h,
1506 [AC_MSG_CHECKING(Solaris style privileges are available)
1507 AC_TRY_COMPILE([#include <priv.h>],[getpflags(PRIV_AWARE);],
1509 AC_DEFINE(HAVE_SOLARIS_CAPABILITIES,1,getpflags)
1510 quagga_ac_scaps="yes"],
1516 if test x"${quagga_ac_scaps}" = x"yes" \
1517 -o x"${quagga_ac_lcaps}" = x"yes"; then
1518 AC_DEFINE(HAVE_CAPABILITIES,1,capabilities)
1523 dnl ---------------------------------------------------------------------------
1524 dnl http://www.gnu.org/software/autoconf-archive/ax_sys_weak_alias.html
1525 dnl Check for and set one of the following = 1
1526 dnl HAVE_SYS_WEAK_ALIAS_ATTRIBUTE
1527 dnl HAVE_SYS_WEAK_ALIAS_PRAGMA
1528 dnl HAVE_SYS_WEAK_ALIAS_HPSECONDARY
1529 dnl HAVE_SYS_WEAK_ALIAS_CRIDUPLICATE
1530 dnl If any scheme is found, set
1531 dnl HAVE_SYS_WEAK_ALIAS=1
1532 dnl The following variable is set to text value
1533 dnl WEAK_ALIAS = "attribute" || "pragma" || "hpsecondary" || "criduplicate" || "no"
1534 dnl If weak alias can cross object file boundaries
1535 dnl WEAK_ALIAS_CROSSFILE = "yes" || "no"
1536 dnl ---------------------------------------------------------------------------
1539 dnl ---------------------------
1540 dnl check for glibc 'backtrace'
1541 dnl ---------------------------
1542 if test x"${enable_backtrace}" != x"no" ; then
1544 AC_CHECK_HEADER([execinfo.h], [
1545 AC_SEARCH_LIBS([backtrace], [execinfo], [
1546 AC_DEFINE(HAVE_GLIBC_BACKTRACE,,[Glibc backtrace])
1547 AC_DEFINE(HAVE_STACK_TRACE,,[Stack symbol decoding])
1552 if test x"${enable_backtrace}" = x"yes" -a x"${backtrace_ok}" = x"no"; then
1553 dnl user explicitly requested backtrace but we failed to find support
1554 AC_MSG_FAILURE([failed to find backtrace support])
1558 dnl -----------------------------------------
1559 dnl check for malloc mallinfo struct and call
1560 dnl this must try and link using LIBS, in
1561 dnl order to check no alternative allocator
1562 dnl has been specified, which might not provide
1563 dnl mallinfo, e.g. such as Umem on Solaris.
1564 dnl -----------------------------------------
1565 AC_CHECK_HEADER([malloc.h],
1566 [AC_MSG_CHECKING(whether mallinfo is available)
1567 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <malloc.h>]],
1568 [[struct mallinfo ac_x; ac_x = mallinfo ();]])],
1570 AC_DEFINE(HAVE_MALLINFO,,mallinfo)],
1573 ], [], QUAGGA_INCLUDES)
1578 CONFDATE=`date '+%Y%m%d'`
1581 dnl ------------------------------
1582 dnl set paths for state directory
1583 dnl ------------------------------
1584 AC_MSG_CHECKING(directory to use for state file)
1585 if test "${prefix}" = "NONE"; then
1586 quagga_statedir_prefix="";
1588 quagga_statedir_prefix=${prefix}
1590 if test "${localstatedir}" = '${prefix}/var'; then
1591 for QUAGGA_STATE_DIR in ${quagga_statedir_prefix}/var/run dnl
1592 ${quagga_statedir_prefix}/var/adm dnl
1593 ${quagga_statedir_prefix}/etc dnl
1599 test -d $QUAGGA_STATE_DIR && break
1601 quagga_statedir=$QUAGGA_STATE_DIR
1603 quagga_statedir=${localstatedir}
1605 if test $quagga_statedir = "/dev/null"; then
1606 AC_MSG_ERROR('STATE DIRECTORY NOT FOUND! FIX OR SPECIFY --localstatedir!')
1608 AC_MSG_RESULT(${quagga_statedir})
1609 AC_SUBST(quagga_statedir)
1611 AC_DEFINE_UNQUOTED(PATH_ZEBRA_PID, "$quagga_statedir/zebra.pid",zebra PID)
1612 AC_DEFINE_UNQUOTED(PATH_RIPD_PID, "$quagga_statedir/ripd.pid",ripd PID)
1613 AC_DEFINE_UNQUOTED(PATH_RIPNGD_PID, "$quagga_statedir/ripngd.pid",ripngd PID)
1614 AC_DEFINE_UNQUOTED(PATH_BGPD_PID, "$quagga_statedir/bgpd.pid",bgpd PID)
1615 AC_DEFINE_UNQUOTED(PATH_OSPFD_PID, "$quagga_statedir/ospfd.pid",ospfd PID)
1616 AC_DEFINE_UNQUOTED(PATH_OSPF6D_PID, "$quagga_statedir/ospf6d.pid",ospf6d PID)
1617 AC_DEFINE_UNQUOTED(PATH_NHRPD_PID, "$quagga_statedir/nhrpd.pid",nhrpd PID)
1618 AC_DEFINE_UNQUOTED(PATH_ISISD_PID, "$quagga_statedir/isisd.pid",isisd PID)
1619 AC_DEFINE_UNQUOTED(PATH_PIMD_PID, "$quagga_statedir/pimd.pid",pimd PID)
1620 AC_DEFINE_UNQUOTED(PATH_WATCHQUAGGA_PID, "$quagga_statedir/watchquagga.pid",watchquagga PID)
1621 AC_DEFINE_UNQUOTED(ZEBRA_SERV_PATH, "$quagga_statedir/zserv.api",zebra api socket)
1622 AC_DEFINE_UNQUOTED(ZEBRA_VTYSH_PATH, "$quagga_statedir/zebra.vty",zebra vty socket)
1623 AC_DEFINE_UNQUOTED(RIP_VTYSH_PATH, "$quagga_statedir/ripd.vty",rip vty socket)
1624 AC_DEFINE_UNQUOTED(RIPNG_VTYSH_PATH, "$quagga_statedir/ripngd.vty",ripng vty socket)
1625 AC_DEFINE_UNQUOTED(BGP_VTYSH_PATH, "$quagga_statedir/bgpd.vty",bgpd vty socket)
1626 AC_DEFINE_UNQUOTED(OSPF_VTYSH_PATH, "$quagga_statedir/ospfd.vty",ospfd vty socket)
1627 AC_DEFINE_UNQUOTED(OSPF6_VTYSH_PATH, "$quagga_statedir/ospf6d.vty",ospf6d vty socket)
1628 AC_DEFINE_UNQUOTED(NHRP_VTYSH_PATH, "$quagga_statedir/nhrpd.vty",nhrpd vty socket)
1629 AC_DEFINE_UNQUOTED(ISIS_VTYSH_PATH, "$quagga_statedir/isisd.vty",isisd vty socket)
1630 AC_DEFINE_UNQUOTED(PIM_VTYSH_PATH, "$quagga_statedir/pimd.vty",pimd vty socket)
1631 AC_DEFINE_UNQUOTED(DAEMON_VTY_DIR, "$quagga_statedir",daemon vty directory)
1633 dnl -------------------------------
1634 dnl Quagga sources should always be
1635 dnl current wrt interfaces. Dont
1636 dnl allow deprecated interfaces to
1638 dnl -------------------------------
1639 AC_DEFINE(QUAGGA_NO_DEPRECATED_INTERFACES, 1, Hide deprecated interfaces)
1641 dnl ---------------------------
1642 dnl Check htonl works correctly
1643 dnl ---------------------------
1644 AC_MSG_CHECKING(for working htonl)
1645 AC_CACHE_VAL(ac_cv_htonl_works,
1646 [AC_LINK_IFELSE([AC_LANG_PROGRAM([QUAGGA_INCLUDES],[htonl (0);])],
1647 [ac_cv_htonl_works=yes], [ac_cv_htonl_works=no])
1650 AC_MSG_RESULT($ac_cv_htonl_works)
1652 AC_CONFIG_FILES([Makefile lib/Makefile qpb/Makefile zebra/Makefile ripd/Makefile
1653 ripngd/Makefile bgpd/Makefile ospfd/Makefile watchquagga/Makefile
1654 ospf6d/Makefile isisd/Makefile vtysh/Makefile
1655 doc/Makefile ospfclient/Makefile tests/Makefile m4/Makefile
1656 pimd/Makefile nhrpd/Makefile
1660 redhat/quagga.spec redhat/quagga.sysconfig
1662 isisd/topology/Makefile
1663 pkgsrc/bgpd.sh pkgsrc/ospf6d.sh pkgsrc/ospfd.sh
1664 pkgsrc/ripd.sh pkgsrc/ripngd.sh pkgsrc/zebra.sh])
1665 AC_CONFIG_FILES([solaris/Makefile])
1667 AC_CONFIG_FILES([vtysh/extract.pl],[chmod +x vtysh/extract.pl])
1668 ## Hack, but working solution to avoid rebuilding of quagga.info.
1669 ## It's already in CVS until texinfo 4.7 is more common.
1673 Quagga configuration
1674 --------------------
1675 quagga version : ${PACKAGE_VERSION}
1676 host operating system : ${host_os}
1677 source code location : ${srcdir}
1679 compiler flags : ${CFLAGS}
1681 linker flags : ${LDFLAGS} ${LIBS} ${LIBCAP} ${LIBREADLINE} ${LIBM}
1682 state file directory : ${quagga_statedir}
1683 config file directory : `eval echo \`echo ${sysconfdir}\``
1684 example directory : `eval echo \`echo ${exampledir}\``
1685 user to run as : ${enable_user}
1686 group to run as : ${enable_group}
1687 group for vty sockets : ${enable_vty_group}
1688 config file mask : ${enable_configfile_mask}
1689 log file mask : ${enable_logfile_mask}
1690 zebra protobuf enabled : ${have_protobuf:-no}
1692 The above user and group must have read/write access to the state file
1693 directory and to the config files in the config file directory."
1695 if test x"$quagga_cv_gnu_make" = x"no"; then echo "
1696 Warning: The ${MAKE-make} programme detected, either in your path or
1697 via the MAKE variable, is not GNU Make. GNU make may be installed as
1698 gmake on some systems. and is required to complete a build of Quagga