[git administrivia] remove auto-built quagga.info, add to gitignore.
[jleu-quagga.git] / configure.ac
blobaca49e90a8d2013fe0e5d2b47f4db1a0734787c1
1 ##
2 ## Configure template file for Quagga.
3 ## autoconf will generate configure script.
4 ##
5 ##  Copyright (c) 1996, 97, 98, 99, 2000 Kunihiro Ishiguro <kunihiro@zebra.org>
6 ##  Portions Copyright (c) 2003 Paul Jakma <paul@dishone.st>
7 ##
8 ## $Id: configure.ac,v 1.113 2005/09/29 14:39:32 paul Exp $
9 AC_PREREQ(2.53)
11 AC_INIT(Quagga, 0.99.1, [http://bugzilla.quagga.net])
12 AC_CONFIG_SRCDIR(lib/zebra.h)
14 dnl -----------------------------------
15 dnl Get hostname and other information.
16 dnl -----------------------------------
17 AC_CANONICAL_BUILD()
18 AC_CANONICAL_HOST()
19 AC_CANONICAL_TARGET()
21 AM_INIT_AUTOMAKE(1.6)
22 AM_CONFIG_HEADER(config.h)
24 dnl we need gawk for memtypes.awk
25 AC_CHECK_PROG([GAWK],[gawk],[gawk],[/bin/false])
26 AC_ARG_VAR([GAWK],[GNU AWK])
28 dnl default is to match previous behavior
29 exampledir=${sysconfdir}
30 AC_ARG_ENABLE([exampledir],
31           AC_HELP_STRING([--enable-exampledir],
32                          [specify alternate directory for examples]),
33                          exampledir="$enableval",)
34 dnl XXX add --exampledir to autoconf standard directory list somehow
35 AC_SUBST(exampledir)
37 dnl default is to match previous behavior
38 pkgsrcrcdir=""
39 pkgsrcdir=""
40 AC_ARG_ENABLE([pkgsrcrcdir],
41           AC_HELP_STRING([--enable-pkgsrcrcdir],
42                          [specify directory for rc.d scripts]),
43                          pkgsrcrcdir="$enableval"; pkgsrcdir="pkgsrc",)
44 dnl XXX add --pkgsrcrcdir to autoconf standard directory list somehow
45 AC_SUBST(pkgsrcdir)
46 AC_SUBST(pkgsrcrcdir)
48 dnl ------------
49 dnl Check CFLAGS
50 dnl ------------
51 AC_ARG_WITH(cflags,
52 [  --with-cflags           Set CFLAGS for use in compilation.])
53 if test "x$with_cflags" != "x" ; then
54   CFLAGS="$with_cflags" ; cflags_specified=yes ;
55 elif test -n "$CFLAGS" ; then
56   cflags_specified=yes ;
59 dnl --------------------
60 dnl Check CC and friends
61 dnl --------------------
62 AC_PROG_CC
63 AC_PROG_CPP
64 AC_PROG_EGREP
66 dnl ------------------------------------------------------------------
67 dnl Intel compiler check. Although Intel tries really hard to make icc
68 dnl look like gcc, there are some differences. It's very verbose with
69 dnl -Wall and it doesn't support the individual -W options.
70 dnl ------------------------------------------------------------------
71 AC_MSG_CHECKING([whether we are using the Intel compiler])
72 AC_EGREP_CPP([^__INTEL_COMPILER], [__INTEL_COMPILER],
73     ICC="no"
74     AC_MSG_RESULT([no]),
75     ICC="yes"
76     AC_MSG_RESULT([yes])
79 dnl ---------------------------------------------
80 dnl If CLFAGS doesn\'t exist set default value
81 dnl AC_PROG_CC will have set minimal default
82 dnl already, eg "-O2 -g" for gcc, "-g" for others
83 dnl (Wall is gcc specific... have to make sure
84 dnl  gcc is being used before setting it)
85 dnl Intel icc 8.0 also sets __GNUC__, but
86 dnl doesn't support all these fancy -W options.
87 dnl ---------------------------------------------
88 dnl
89 if test "x$cflags_specified" = "x" ; then
90   if test "x${GCC}" = "xyes" && test "x${ICC}" = "xno"; then
91         CFLAGS="-Os -fno-omit-frame-pointer -g  -Wall"
92         CFLAGS="${CFLAGS} -Wsign-compare -Wpointer-arith"
93         CFLAGS="${CFLAGS} -Wbad-function-cast -Wwrite-strings"
94         CFLAGS="${CFLAGS} -Wmissing-prototypes -Wmissing-declarations"
95         CFLAGS="${CFLAGS} -Wchar-subscripts -Wcast-qual"
96   fi
97   # TODO: conditionally addd -Wpacked if handled
100 dnl ---------------------------------------------------------------------
101 dnl Intel compiler warnings we ignore:
102 dnl 279: controlling expression is constant.
103 dnl 869: parameter "xxx" was never referenced - to avoid massive warnings
104 dnl      about "self", "vty", "argc" and "argv" never referenced in DEFUN
105 dnl      macro.
106 dnl 981: operands are evaluated in unspecified order.
107 dnl ---------------------------------------------------------------------
109 if test "$ICC" = "yes"; then
110     CFLAGS="-Os -g -Wall -wd 279,869,981"
113 dnl --------------
114 dnl Check programs
115 dnl --------------
116 AC_PROG_INSTALL
117 AC_PROG_MAKE_SET
118 AC_CHECK_TOOL(AR, ar)
119 AC_CHECK_TOOL(RANLIB, ranlib, :)
121 dnl ---------
122 dnl AIX check
123 dnl ---------
124 AC_AIX
126 dnl -------
127 dnl libtool
128 dnl -------
129 AC_PROG_LIBTOOL
131 dnl ----------------------
132 dnl Packages configuration
133 dnl ----------------------
134 AC_ARG_ENABLE(vtysh,
135 [  --enable-vtysh          include integrated vty shell for Quagga])
136 AC_ARG_ENABLE(ipv6,
137 [  --disable-ipv6          turn off IPv6 related features and daemons])
138 AC_ARG_ENABLE(zebra,
139 [  --disable-zebra         do not build zebra daemon])
140 AC_ARG_ENABLE(bgpd,
141 [  --disable-bgpd          do not build bgpd])
142 AC_ARG_ENABLE(ripd,
143 [  --disable-ripd          do not build ripd])
144 AC_ARG_ENABLE(ripngd,
145 [  --disable-ripngd        do not build ripngd])
146 AC_ARG_ENABLE(ospfd,
147 [  --disable-ospfd         do not build ospfd])
148 AC_ARG_ENABLE(ospf6d,
149 [  --disable-ospf6d        do not build ospf6d])
150 AC_ARG_ENABLE(watchquagga,
151 [  --disable-watchquagga   do not build watchquagga])
152 AC_ARG_ENABLE(isisd,
153 [  --enable-isisd          build isisd])
154 AC_ARG_ENABLE(bgp-announce,
155 [  --disable-bgp-announce, turn off BGP route announcement])
156 AC_ARG_ENABLE(netlink,
157 [  --enable-netlink        force to use Linux netlink interface])
158 AC_ARG_ENABLE(broken-aliases,
159 [  --enable-broken-aliases enable aliases as distinct interfaces for Linux 2.2.X])
160 AC_ARG_ENABLE(snmp,
161 [  --enable-snmp           enable SNMP support])
162 AC_ARG_WITH(libpam,
163 [  --with-libpam           use libpam for PAM support in vtysh])
164 AC_ARG_ENABLE(tcp-zebra,
165 [  --enable-tcp-zebra      enable TCP/IP socket connection between zebra and protocol daemon])
166 AC_ARG_ENABLE(opaque-lsa,
167 [  --enable-opaque-lsa     enable OSPF Opaque-LSA with OSPFAPI support (RFC2370)])
168 AC_ARG_ENABLE(ospfapi,
169 [  --disable-ospfapi       do not build OSPFAPI to access the OSPF LSA Database, 
170                           (this is the default if --enable-opaque-lsa is not set)])
171 AC_ARG_ENABLE(ospfclient,
172 [  --disable-ospfclient    do not build OSPFAPI client for OSPFAPI, 
173                           (this is the default if --disable-ospfapi is set)])
174 AC_ARG_ENABLE(ospf-te,
175 [  --enable-ospf-te        enable Traffic Engineering Extension to OSPF])
176 AC_ARG_ENABLE(multipath,
177 [  --enable-multipath=ARG  enable multipath function, ARG must be digit])
178 AC_ARG_ENABLE(quagga_user,
179 [  --enable-user=ARG       user to run Quagga suite as (default quagga)])
180 AC_ARG_ENABLE(quagga_group,
181 [  --enable-group=ARG      group to run Quagga suite as (default quagga)])
182 AC_ARG_ENABLE(vty_group,
183 [  --enable-vty-group=ARG  set vty sockets to have specified group as owner])
184 AC_ARG_ENABLE(configfile_mask,
185 [  --enable-configfile-mask=ARG  set mask for config files])
186 AC_ARG_ENABLE(logfile_mask,
187 [  --enable-logfile-mask=ARG     set mask for log files])
189 AC_ARG_ENABLE(rtadv,
190 [  --disable-rtadv               disable IPV6 router advertisement feature])
191 AC_ARG_ENABLE(irdp,
192 [  --enable-irdp                 enable IRDP server support in zebra])
193 AC_ARG_ENABLE(isis_topology,
194 [  --enable-isis-topology        enable IS-IS topology generator])
195 AC_ARG_ENABLE(capabilities,
196 [  --disable-capabilities        disable using POSIX capabilities])
197 AC_ARG_ENABLE(gcc_ultra_verbose,
198 [  --enable-gcc-ultra-verbose    enable ultra verbose GCC warnings])
199 AC_ARG_ENABLE(gcc-rdynamic,
200 [  --enable-gcc-rdynamic   enable gcc linking with -rdynamic for better backtraces])
201 AC_ARG_ENABLE(time-check,
202 [  --disable-time-check          disable slow thread warning messages])
204 if test x"${enable_gcc_ultra_verbose}" = x"yes" ; then
205   CFLAGS="${CFLAGS} -W -Wcast-qual -Wstrict-prototypes"
206   CFLAGS="${CFLAGS} -Wmissing-declarations -Wmissing-noreturn"
207   CFLAGS="${CFLAGS} -Wmissing-format-attribute -Wunreachable-code"
208   CFLAGS="${CFLAGS} -Wpacked -Wpadded"
211 if test x"${enable_gcc_rdynamic}" = x"yes" ; then
212   LDFLAGS="${LDFLAGS} -rdynamic"
215 if test x"${enable_time_check}" != x"no" ; then
216   if test x"${enable_time_check}" = x"yes" -o x"${enable_time_check}" = x ; then
217     AC_DEFINE(CONSUMED_TIME_CHECK,5000000,Consumed Time Check)
218   else
219     AC_DEFINE_UNQUOTED(CONSUMED_TIME_CHECK,$enable_time_check,Consumed Time Check)
220   fi
223 if test "${enable_broken_aliases}" = "yes"; then
224   if test "${enable_netlink}" = "yes"
225   then
226     echo "Sorry, you can't use netlink with broken aliases"
227     exit 1
228   fi
229   AC_DEFINE(HAVE_BROKEN_ALIASES,,Broken Alias)
230   enable_netlink=no
233 if test "${enable_tcp_zebra}" = "yes"; then
234   AC_DEFINE(HAVE_TCP_ZEBRA,,Use TCP for zebra communication)
237 if test "${enable_opaque_lsa}" = "yes"; then
238   AC_DEFINE(HAVE_OPAQUE_LSA,,OSPF Opaque LSA)
241 if test "${enable_ospf_te}" = "yes"; then
242   AC_DEFINE(HAVE_OPAQUE_LSA,,OSPF Opaque LSA)
243   AC_DEFINE(HAVE_OSPF_TE,,OSPF TE)
246 AC_MSG_CHECKING(if zebra should be configurable to send Route Advertisements)
247 if test "${enable_rtadv}" != "no"; then
248   AC_MSG_RESULT(yes)
249   AC_DEFINE(HAVE_RTADV,,Enable IPv6 Routing Advertisement support)
250 else
251   AC_MSG_RESULT(no)
254 if test "${enable_irdp}" = "yes"; then
255   AC_DEFINE(HAVE_IRDP,, IRDP )
258 if test "${enable_isisd}" = "yes" && test "${enable_isis_topology}" = yes; then
259   AC_DEFINE(TOPOLOGY_GENERATE,,Enable IS-IS topology generator code)
260   ISIS_TOPOLOGY_INCLUDES="-I./topology"
261   ISIS_TOPOLOGY_DIR="topology"
262   ISIS_TOPOLOGY_LIB="./topology/libtopology.a"
265 AC_SUBST(ISIS_TOPOLOGY_INCLUDES)
266 AC_SUBST(ISIS_TOPOLOGY_DIR)
267 AC_SUBST(ISIS_TOPOLOGY_LIB)
269 if test "${enable_user}" = "yes" || test x"${enable_user}" = x""; then
270   enable_user="quagga"
271 elif test "${enable_user}" = "no"; then
272   enable_user="root"
275 if test "${enable_group}" = "yes" || test x"${enable_group}" = x""; then
276   enable_group="quagga"
277 elif test "${enable_group}" = "no"; then
278   enable_group="root"
281 if test x"${enable_vty_group}" = x"yes" ; then
282   AC_MSG_ERROR([--enable-vty-group requires a group as argument, not yes])
283 elif test x"${enable_vty_group}" != x""; then
284   if test x"${enable_vty_group}" != x"no"; then
285     AC_DEFINE_UNQUOTED(VTY_GROUP, "${enable_vty_group}", VTY Sockets Group)
286   fi
288 AC_SUBST([enable_user])
289 AC_SUBST([enable_group])
290 AC_SUBST([enable_vty_group])
291 AC_DEFINE_UNQUOTED(QUAGGA_USER, "${enable_user}", Quagga User)
292 AC_DEFINE_UNQUOTED(QUAGGA_GROUP, "${enable_group}", Quagga Group)
294 enable_configfile_mask=${enable_configfile_mask:-0600}
295 AC_DEFINE_UNQUOTED(CONFIGFILE_MASK, ${enable_configfile_mask}, Mask for config files)
297 enable_logfile_mask=${enable_logfile_mask:-0600}
298 AC_DEFINE_UNQUOTED(LOGFILE_MASK, ${enable_logfile_mask}, Mask for log files)
300 changequote(, )dnl
302 MULTIPATH_NUM=1
304 case "${enable_multipath}" in
305   [0-9]|[1-9][0-9])
306     MULTIPATH_NUM="${enable_multipath}"
307     ;;
308   "")
309     ;;
310   *)           
311     echo "Please specify digit to --enable-multipath ARG."
312     exit 1
313     ;;
314 esac
316 changequote([, ])dnl
318 AC_SUBST(MULTIPATH_NUM)
320 dnl -------------------
321 dnl Check header files.
322 dnl -------------------
323 AC_HEADER_STDC
324 AC_CHECK_HEADERS([string.h stropts.h sys/conf.h sys/ksym.h sys/time.h \
325                  sys/times.h sys/select.h sys/sysctl.h sys/sockio.h \
326                  sys/types.h linux/version.h kvm.h netdb.h asm/types.h \
327                  sys/param.h libutil.h limits.h])
329 AC_CHECK_HEADERS([sys/socket.h netinet/in_systm.h netinet/in.h \
330                  net/if_dl.h net/netopt.h inet/nd.h net/route.h \
331                  net/if.h net/if_var.h netinet/in_var.h])
333 dnl V6 headers are checked below, after we check for v6
335 dnl check some types
336 AC_C_CONST
337 dnl AC_TYPE_PID_T
338 AC_TYPE_SIGNAL
340 dnl Some systems (Solaris 2.x) require libnsl (Network Services Library)
341 case "$host" in
342   [*-sunos5.[6-7]*] | [*-solaris2.[6-7]*])
343       opsys=sol2-6
344       AC_DEFINE(SUNOS_56, 1, SunOS 5.6 to 5.7)
345       AC_DEFINE(SUNOS_5, 1, SunOS 5)
346       AC_CHECK_LIB(xnet, main)
347       CURSES=-lcurses
348   ;;
349   [*-sunos5.[8-9]] \
350   | [*-sunos5.1[0-9]] \
351   | [*-sunos5.1[0-9].[0-9]] \
352   | [*-solaris2.[8-9]] \
353   | [*-solaris2.1[0-9]] \
354   | [*-solaris2.1[0-9].[0-9]])
355       opsys=sol8
356       AC_DEFINE(SUNOS_59,,SunOS 5.8 up)
357       AC_DEFINE(SUNOS_5, 1, SunOS 5)
358       AC_CHECK_LIB(socket, main)
359       AC_CHECK_LIB(nsl, main)
360       AC_CHECK_LIB(umem, main)
361       CURSES=-lcurses
362   ;;
363   *-sunos5* | *-solaris2*)
364       AC_DEFINE(SUNOS_5,,SunOS 5, Unknown SunOS)
365       AC_CHECK_LIB(socket, main)
366       AC_CHECK_LIB(nsl, main)
367       CURSES=-lcurses
368   ;;
369   *-linux*)
370       opsys=gnu-linux
371       AC_DEFINE(GNU_LINUX,,GNU Linux)
372   ;;
373   *-nec-sysv4*)
374       AC_CHECK_LIB(nsl, gethostbyname)
375       AC_CHECK_LIB(socket, socket)
376   ;;
377   *-openbsd*)
378       opsys=openbsd
379       AC_DEFINE(OPEN_BSD,,OpenBSD)
380   ;;
381   *-bsdi*)
382       opsys=bsdi
383       OTHER_METHOD="mtu_kvm.o"
384       AC_CHECK_LIB(kvm, main)
385   ;;
386   *-irix6.5)
387       opsys=irix
388       AC_DEFINE(IRIX_65,,IRIX 6.5)
389   ;;
390 esac
392 dnl ---------------------
393 dnl Integrated VTY option
394 dnl ---------------------
395 case "${enable_vtysh}" in
396   "yes") VTYSH="vtysh";
397          AC_DEFINE(VTYSH,,VTY shell)
398          AC_PATH_PROG(PERL, perl)
399 dnl      Vtysh uses libreadline, which looks for termcap functions at
400 dnl      configure time.  We follow readline's search order.
401 dnl      The required procedures are in libtermcap on NetBSD, in
402 dnl      [TODO] on Linux, and in [TODO] on Solaris.
403          AC_CHECK_LIB(termcap, tputs, LIBREADLINE="$LIBREADLINE -ltermcap",
404            [AC_CHECK_LIB(tinfo, tputs, LIBREADLINE="$LIBREADLINE -ltinfo",
405              [AC_CHECK_LIB(curses, tputs, LIBREADLINE="$LIBREADLINE -lcurses",
406                [AC_CHECK_LIB(ncurses, tputs, 
407                              LIBREADLINE="$LIBREADLINE -lncurses")]
408               )]
409             )]
410           )
411          AC_CHECK_LIB(readline, main, LIBREADLINE="$LIBREADLINE -lreadline",,
412                       "$LIBREADLINE")
413          if test $ac_cv_lib_readline_main = no; then
414            AC_MSG_ERROR([vtysh needs libreadline but was not found and usable on your system.])
415          fi
416          AC_CHECK_HEADER(readline/history.h)
417          if test $ac_cv_header_readline_history_h = no;then
418            AC_MSG_ERROR([readline is too old to have readline/history.h, please update to the latest readline library.])
419          fi
420          AC_CHECK_LIB(readline, rl_completion_matches, 
421                       LIBREADLINE="$LIBREADLINE",, "$LIBREADLINE")
422          if test $ac_cv_lib_readline_rl_completion_matches = no; then
423            AC_DEFINE(rl_completion_matches,completion_matches,Old readline)
424          fi
425          ;;
426   "no" ) VTYSH="";;
427   *    ) ;;
428 esac
429 AC_SUBST(LIBREADLINE)
431 dnl ----------
432 dnl PAM module
433 dnl ----------
434 if test "$with_libpam" = "yes"; then
435   AC_CHECK_HEADER(security/pam_misc.h)
436   if test "$ac_cv_header_security_pam_misc_h" = yes; then
437     AC_DEFINE(HAVE_PAM_MISC_H,,Have pam_misc.h)
438     AC_DEFINE(PAM_CONV_FUNC,misc_conv,Have misc_conv)
439     pam_conv_func="misc_conv"
440   fi
441   AC_CHECK_HEADER(security/openpam.h)
442   if test "$ac_cv_header_security_openpam_h" = yes; then
443     AC_DEFINE(HAVE_OPENPAM_H,,Have openpam.h)
444     AC_DEFINE(PAM_CONV_FUNC,openpam_ttyconv,Have openpam_ttyconv)
445     pam_conv_func="openpam_ttyconv"
446   fi
447   if test -z "$ac_cv_header_security_pam_misc_h$ac_cv_header_security_openpam_h" ; then
448     AC_MSG_WARN([*** pam support will not be built ***])
449     with_libpam="no"
450   fi
453 if test "$with_libpam" = "yes"; then
454 dnl took this test from proftpd's configure.in and suited to our needs
455 dnl -------------------------------------------------------------------------
457 dnl This next check looks funky due to a linker problem with some versions
458 dnl of the PAM library.  Prior to 0.72 release, the Linux PAM shared library
459 dnl omitted requiring libdl linking information. PAM-0.72 or better ships
460 dnl with RedHat 6.2 and Debian 2.2 or better.
461 AC_CHECK_LIB(pam, pam_start,
462   [AC_CHECK_LIB(pam, $pam_conv_func,
463     [AC_DEFINE(USE_PAM,,Use PAM for authentication)
464      LIBPAM="-lpam"],
465     [AC_DEFINE(USE_PAM,,Use PAM for authentication)
466      LIBPAM="-lpam -lpam_misc"]
467     )
468   ],
470   [AC_CHECK_LIB(pam, pam_end,
471     [AC_CHECK_LIB(pam, $pam_conv_func,
472       [AC_DEFINE(USE_PAM,,Use PAM for authentication)
473        LIBPAM="-lpam -ldl"],
474       [AC_DEFINE(USE_PAM,,Use PAM for authentication)
475        LIBPAM="-lpam -ldl -lpam_misc"]
476      )
477   ],AC_MSG_WARN([*** pam support will not be built ***]),
478   [-ldl])
479   ]
482 AC_SUBST(LIBPAM)
484 dnl -------------------------------
485 dnl Endian-ness check
486 dnl -------------------------------
487 AC_WORDS_BIGENDIAN
489 dnl -------------------------------
490 dnl check the size in byte of the C
491 dnl -------------------------------
492 dnl AC_CHECK_SIZEOF(char)
493 dnl AC_CHECK_SIZEOF(int)
494 dnl AC_CHECK_SIZEOF(short)
495 dnl AC_CHECK_SIZEOF(long)
497 dnl ----------------------------
498 dnl check existance of functions
499 dnl ----------------------------
500 AC_CHECK_FUNCS(memset memcpy strerror inet_aton daemon snprintf vsnprintf \
501                strlcat strlcpy if_nametoindex if_indextoname getifaddrs \
502                fcntl strnlen strndup)
503 AC_CHECK_FUNCS(setproctitle, ,
504   [AC_CHECK_LIB(util, setproctitle, 
505      [LIBS="$LIBS -lutil"
506       AC_DEFINE(HAVE_SETPROCTITLE,, Have setproctitle)
507      ]
508    )
509   ]
512 dnl ------------------------------------
513 dnl Determine routing get and set method
514 dnl ------------------------------------
515 AC_MSG_CHECKING(zebra between kernel interface method)
516 if test x"$opsys" = x"gnu-linux"; then
517   if test "${enable_netlink}" = "yes";then
518     AC_MSG_RESULT(netlink)
519     RT_METHOD=rt_netlink.o
520     AC_DEFINE(HAVE_NETLINK,,netlink)
521     netlink=yes
522   elif test "${enable_netlink}" = "no"; then
523     AC_MSG_RESULT(ioctl)
524     RT_METHOD=rt_ioctl.o
525     netlink=no
526   else
527     AC_MSG_RESULT(netlink)
528     RT_METHOD=rt_netlink.o
529     AC_DEFINE(HAVE_NETLINK,,netlink)
530     netlink=yes
531   fi
532 elif test x"$opsys" = x"sol2-6";then
533   AC_MSG_RESULT(Route socket)
534   KERNEL_METHOD="kernel_socket.o"
535   RT_METHOD="rt_socket.o"
536 elif test x"$opsys" = x"sol8";then
537   AC_MSG_RESULT(Route socket)
538   KERNEL_METHOD="kernel_socket.o"
539   RT_METHOD="rt_socket.o"
540 elif test "$opsys" = "irix" ; then
541   AC_MSG_RESULT(Route socket)
542   KERNEL_METHOD="kernel_socket.o"
543   RT_METHOD="rt_socket.o"
544 else
545   AC_TRY_RUN([#include <errno.h>
546 #include <sys/types.h>
547 #include <sys/socket.h>
549 main ()
551   int ac_sock;
553   ac_sock = socket (AF_ROUTE, SOCK_RAW, 0);
554   if (ac_sock < 0 && errno == EINVAL)
555     exit (1);
556   exit (0);
558   [KERNEL_METHOD=kernel_socket.o
559    RT_METHOD=rt_socket.o
560    AC_MSG_RESULT(socket)],
561   [RT_METHOD=rt_ioctl.o
562    AC_MSG_RESULT(ioctl)],
563   [KERNEL_METHOD=kernel_socket.o
564    RT_METHOD=rt_socket.o
565    AC_MSG_RESULT(socket)])
567 AC_SUBST(RT_METHOD)
568 AC_SUBST(KERNEL_METHOD)
569 AC_SUBST(OTHER_METHOD)
571 dnl ------------------------------------
572 dnl check for broken CMSG_FIRSTHDR macro
573 dnl ------------------------------------
574 AC_MSG_CHECKING(for broken CMSG_FIRSTHDR)
575 AC_RUN_IFELSE([AC_LANG_SOURCE([[
576 #ifdef SUNOS_5
577 #define _XPG4_2
578 #define __EXTENSIONS__
579 #endif
580 #include <stdlib.h>
581 #include <sys/types.h>
582 #include <sys/socket.h>
584 main()
586   struct msghdr msg;
587   char buf[4];
589   msg.msg_control = buf;
590   msg.msg_controllen = 0;
592   if (CMSG_FIRSTHDR(&msg) != NULL)
593     exit(0);
594   exit (1);
595 }]])],[AC_MSG_RESULT(yes - using workaround) AC_DEFINE(HAVE_BROKEN_CMSG_FIRSTHDR,,Broken CMSG_FIRSTHDR)],
596 [AC_MSG_RESULT(no)],[AC_MSG_RESULT(no)])
598 dnl ------------------------------
599 dnl check kernel route read method
600 dnl ------------------------------
601 AC_CACHE_CHECK(route read method check, zebra_rtread,
602 [if test "$netlink" = yes; then
603   RTREAD_METHOD="rtread_netlink.o"
604   zebra_rtread="netlink"
605 else
606 for zebra_rtread in /proc/net/route /dev/ip /dev/null;
608   test x`ls $zebra_rtread 2>/dev/null` = x"$zebra_rtread" && break
609 done
610 case $zebra_rtread in
611   "/proc/net/route") RTREAD_METHOD="rtread_proc.o"
612                      zebra_rtread="proc";;
613   "/dev/ip")
614                      case "$host" in
615                        *-freebsd*)    RTREAD_METHOD=rtread_sysctl.o
616                                       zebra_rtread="sysctl";;
617                        *)             RTREAD_METHOD="rtread_getmsg.o"
618                                       zebra_rtread="getmsg";;
619                      esac;;
620   *)                 RTREAD_METHOD="rtread_sysctl.o"
621                      zebra_rtread="sysctl";;
622 esac
623 fi])
624 AC_SUBST(RTREAD_METHOD)
626 dnl -----------------------------
627 dnl check interface lookup method
628 dnl -----------------------------
629 IOCTL_METHOD=ioctl.o
630 AC_MSG_CHECKING(interface looking up method)
631 if test "$netlink" = yes; then
632   AC_MSG_RESULT(netlink)
633   IF_METHOD=if_netlink.o
634 elif test "$opsys" = "sol2-6";then
635   AC_MSG_RESULT(Solaris GIF)
636   IF_METHOD=if_ioctl.o
637 elif test "$opsys" = "sol8";then
638   AC_MSG_RESULT(Solaris GLIF)
639   IF_METHOD=if_ioctl_solaris.o
640   IOCTL_METHOD=ioctl_solaris.o
641 elif test "$opsys" = "irix" ; then
642   AC_MSG_RESULT(IRIX)
643   IF_METHOD=if_ioctl.o
644 elif test "$opsys" = "openbsd";then
645   AC_MSG_RESULT(openbsd)
646   IF_METHOD=if_ioctl.o
647 elif grep NET_RT_IFLIST /usr/include/sys/socket.h >/dev/null 2>&1; then
648   AC_MSG_RESULT(sysctl)
649     IF_METHOD=if_sysctl.o
650     AC_DEFINE(HAVE_NET_RT_IFLIST,,NET_RT_IFLIST)
651 else
652     AC_MSG_RESULT(ioctl)
653     IF_METHOD=if_ioctl.o
655 AC_SUBST(IF_METHOD)
656 AC_SUBST(IOCTL_METHOD)
658 dnl ---------------------------------------------------------------
659 dnl figure out how to specify an interface in multicast sockets API
660 dnl ---------------------------------------------------------------
661 AC_CHECK_MEMBERS([struct ip_mreqn.imr_ifindex],,,[#ifdef HAVE_SYS_TYPES_H
662 #include <sys/types.h>
663 #endif
664 #ifdef HAVE_NETINET_IN_H
665 #include <netinet/in.h>
666 #endif])
668 AC_MSG_CHECKING([for BSD struct ip_mreq hack])
669 AC_TRY_COMPILE([#ifdef HAVE_SYS_PARAM_H
670 #include <sys/param.h>
671 #endif],[#if (defined(__FreeBSD__) && (__FreeBSD_version >= 500022 || (__FreeBSD_version < 500000 && __FreeBSD_version >= 440000))) || (defined(__NetBSD__) && defined(__NetBSD_Version__) && __NetBSD_Version__ >= 106010000)
672   return (0);
673 #else
674   #error No support for BSD struct ip_mreq hack detected
675 #endif],[AC_MSG_RESULT(yes)
676 AC_DEFINE(HAVE_BSD_STRUCT_IP_MREQ_HACK,,[Can pass ifindex in struct ip_mreq])],
677 AC_MSG_RESULT(no))
679 dnl -----------------------
680 dnl check proc file system.
681 dnl -----------------------
682 if test -r /proc/net/dev; then
683   AC_DEFINE(HAVE_PROC_NET_DEV,,/proc/net/dev)
684   IF_PROC=if_proc.o
687 if test -r /proc/net/if_inet6; then
688   AC_DEFINE(HAVE_PROC_NET_IF_INET6,,/proc/net/if_inet6)
689   IF_PROC=if_proc.o
691 AC_SUBST(IF_PROC)
693 dnl -----------------------------
694 dnl check ipforward detect method
695 dnl -----------------------------
696 AC_CACHE_CHECK(ipforward method check, zebra_ipforward_path,
697 [for zebra_ipforward_path in /proc/net/snmp /dev/ip /dev/null;
699   test x`ls $zebra_ipforward_path 2>/dev/null` = x"$zebra_ipforward_path" && break
700 done
701 case $zebra_ipforward_path in
702   "/proc/net/snmp")  IPFORWARD=ipforward_proc.o
703                      zebra_ipforward_path="proc";;
704   "/dev/ip")         
705                      case "$host" in
706                        *-nec-sysv4*)  IPFORWARD=ipforward_ews.o
707                                       zebra_ipforward_path="ews";;
708                        *-freebsd*)    IPFORWARD=ipforward_sysctl.o
709                                       zebra_ipforward_path="sysctl";;
710                        *)             IPFORWARD=ipforward_solaris.o
711                                       zebra_ipforward_path="solaris";;
712                      esac;;
713   *)                 IPFORWARD=ipforward_sysctl.o
714                      zebra_ipforward_path="sysctl";;
715 esac])
716 AC_SUBST(IPFORWARD)
718 AC_CHECK_FUNCS(getaddrinfo, [have_getaddrinfo=yes], [have_getaddrinfo=no])
720 dnl ----------
721 dnl IPv6 check
722 dnl ----------
723 AC_MSG_CHECKING(whether does this OS have IPv6 stack)
724 if test "${enable_ipv6}" = "no"; then
725   AC_MSG_RESULT(disabled)
726 else
727 dnl ----------
728 dnl INRIA IPv6
729 dnl ----------
730   if grep IPV6_INRIA_VERSION /usr/include/netinet/in.h >/dev/null 2>&1; then
731     zebra_cv_ipv6=yes
732     AC_DEFINE(HAVE_IPV6,1,INRIA IPv6)
733     AC_DEFINE(INRIA_IPV6,1,INRIA IPv6)
734     RIPNGD="ripngd"
735     OSPF6D="ospf6d"
736     LIB_IPV6=""
737     AC_MSG_RESULT(INRIA IPv6)
738 dnl ---------
739 dnl KAME IPv6
740 dnl ---------
741   elif grep WIDE /usr/include/netinet6/in6.h >/dev/null 2>&1; then
742     zebra_cv_ipv6=yes
743     AC_DEFINE(HAVE_IPV6,1,KAME IPv6)
744     AC_DEFINE(KAME,1,KAME IPv6)
745     RIPNGD="ripngd"
746     OSPF6D="ospf6d"
747     if test -d /usr/local/v6/lib -a -f /usr/local/v6/lib/libinet6.a; then
748       LIB_IPV6="-L/usr/local/v6/lib -linet6"
749     fi
750     AC_MSG_RESULT(KAME)
751 dnl -------------------------
752 dnl MUSICA IPv6
753 dnl  default host check
754 dnl  It is not used by Kheops
755 dnl -------------------------
756   elif grep MUSICA /usr/include6/netinet6/in6.h >/dev/null 2>&1; then
757     zebra_cv_ipv6=yes
758     AC_DEFINE(HAVE_IPV6,1,Musicia IPv6)
759     AC_DEFINE(MUSICA,1,Musica IPv6 stack)
760     AC_DEFINE(KAME,1,KAME IPv6 stack)
761     RIPNGD="ripngd"
762     OSPF6D="ospf6d"
763     if test -d /usr/local/v6/lib -a -f /usr/local/v6/lib/libinet6.a; then
764       LIB_IPV6="-L/usr/local/v6/lib -linet6"
765     fi
766     AC_MSG_RESULT(MUSICA)
767 dnl ---------
768 dnl NRL check
769 dnl ---------
770   elif grep NRL /usr/include/netinet6/in6.h >/dev/null 2>&1; then
771     zebra_cv_ipv6=yes
772     AC_DEFINE(HAVE_IPV6,1,NRL IPv6)
773     AC_DEFINE(NRL,1,NRL)
774     RIPNGD="ripngd"
775     OSPF6D="ospf6d"
776     if test x"$opsys" = x"bsdi";then
777       AC_DEFINE(BSDI_NRL,,BSDI)
778       AC_MSG_RESULT(BSDI_NRL)
779     else
780       AC_MSG_RESULT(NRL)
781     fi
782 dnl ------------------------------------
783 dnl Solaris 9, 10 and potentially higher
784 dnl ------------------------------------
785   elif test x"$opsys" = x"sol8"; then
786     zebra_cv_ipv6=yes;
787     AC_DEFINE(HAVE_IPV6, 1, IPv6)
788     AC_DEFINE(SOLARIS_IPV6, 1, Solaris IPv6)
789     RIPNGD="ripngd"
790     OSPF6D="ospf6d"
791     AC_MSG_RESULT(Solaris IPv6)
792 dnl ----------
793 dnl Linux IPv6
794 dnl ----------
795   elif test "${enable_ipv6}" = "yes"; then
796     AC_EGREP_CPP(yes, [
797       #include <linux/version.h>
798       /* 2.1.128 or later */
799       #if LINUX_VERSION_CODE >= 0x020180
800       yes
801       #endif],
802       [zebra_cv_ipv6=yes
803        zebra_cv_linux_ipv6=yes
804        AC_MSG_RESULT(Linux IPv6)])
805   else
806     if test x`ls /proc/net/ipv6_route 2>/dev/null` = x"/proc/net/ipv6_route"
807      then
808       zebra_cv_ipv6=yes
809       zebra_cv_linux_ipv6=yes
810       AC_MSG_RESULT(Linux IPv6)
811     fi
812   fi
814   if test "$zebra_cv_linux_ipv6" = "yes";then
815     AC_MSG_CHECKING(whether libc has IPv6 support)
816     AC_TRY_LINK([#include <netinet/in.h>
817     ],[ int a; a = (int) in6addr_any.s6_addr[0]; if (a != 12345) return a; ],
818     [AC_MSG_RESULT(yes)
819       zebra_cv_ipv6=yes
820       zebra_cv_linux_ipv6=yes],
821     [AC_MSG_RESULT(no)
822       zebra_cv_ipv6=no
823       zebra_cv_linux_ipv6=no])
824   fi
826   if test "$zebra_cv_linux_ipv6" = "yes";then
827     AC_MSG_CHECKING(for GNU libc >= 2.1)
828     AC_DEFINE(HAVE_IPV6,1,Linux IPv6)
829     AC_EGREP_CPP(yes, [
830 #include <features.h>
831 #if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
832   yes
833 #endif], 
834       [glibc=yes
835        AC_DEFINE(LINUX_IPV6,1,Linux IPv6 stack)
836        AC_MSG_RESULT(yes)], 
837       AC_MSG_RESULT(no)
838     )
839     RIPNGD="ripngd"
840     OSPF6D="ospf6d"
841     if test "$glibc" != "yes"; then
842       INCLUDES="-I/usr/inet6/include"
843       if test x`ls /usr/inet6/lib/libinet6.a 2>/dev/null` != x;then
844          LIB_IPV6="-L/usr/inet6/lib -linet6"
845       fi
846     fi
847   fi
849 dnl -----------------------
850 dnl Set IPv6 related values
851 dnl -----------------------
852   LIBS="$LIB_IPV6 $LIBS"
853   AC_SUBST(LIB_IPV6)
855   if test x"$RIPNGD" = x""; then
856     AC_MSG_RESULT(IPv4 only)
857   fi
860 dnl ------------------
861 dnl IPv6 header checks
862 dnl ------------------
863 if test "x${zebra_cv_ipv6}" = "xyes"; then
864 AC_CHECK_HEADERS([netinet6/in6.h netinet/in6_var.h netinet/icmp6.h \
865                  netinet6/in6_var.h netinet6/nd6.h])
868 dnl --------------------
869 dnl Daemon disable check
870 dnl --------------------
871 if test "${enable_zebra}" = "no";then
872   ZEBRA=""
873 else
874   ZEBRA="zebra"
877 if test "${enable_bgpd}" = "no";then
878   BGPD=""
879 else
880   BGPD="bgpd"
883 if test "${enable_ripd}" = "no";then
884   RIPD=""
885 else
886   RIPD="ripd"
889 if test "${enable_ospfd}" = "no";then
890   OSPFD=""
891 else
892   OSPFD="ospfd"
895 if test "${enable_watchquagga}" = "no";then
896   WATCHQUAGGA=""
897 else
898   WATCHQUAGGA="watchquagga"
901 OSPFCLIENT=""
902 if test "${enable_opaque_lsa}" = "yes"; then
903   if test "${enable_ospfapi}" != "no";then
904     AC_DEFINE(SUPPORT_OSPF_API,,OSPFAPI)
906     if test "${enable_ospfclient}" != "no";then
907       OSPFCLIENT="ospfclient"
908     fi
909   fi
913 case "${enable_ripngd}" in
914   "yes") RIPNGD="ripngd";;
915   "no" ) RIPNGD="";;
916   *    ) ;;
917 esac
919 case "${enable_ospf6d}" in
920   "yes") OSPF6D="ospf6d";;
921   "no" ) OSPF6D="";;
922   *    ) ;;
923 esac
925 case "${enable_isisd}" in
926   "yes") ISISD="isisd";;
927   "no" ) ISISD="";;
928   *    ) ;;
929 esac
931 if test "${enable_bgp_announce}" = "no";then
932   AC_DEFINE(DISABLE_BGP_ANNOUNCE,,Disable BGP installation to zebra)
935 AC_SUBST(ZEBRA)
936 AC_SUBST(BGPD)
937 AC_SUBST(RIPD)
938 AC_SUBST(RIPNGD)
939 AC_SUBST(OSPFD)
940 AC_SUBST(OSPF6D)
941 AC_SUBST(WATCHQUAGGA)
942 AC_SUBST(ISISD)
943 AC_SUBST(VTYSH)
944 AC_SUBST(INCLUDES)
945 AC_SUBST(CURSES)
946 AC_SUBST(OSPFCLIENT)
947 AC_SUBST(OSPFAPI)
948 AC_CHECK_LIB(c, inet_ntop, [AC_DEFINE(HAVE_INET_NTOP,,inet_ntop)])
949 AC_CHECK_LIB(c, inet_pton, [AC_DEFINE(HAVE_INET_PTON,,inet_pton)])
950 AC_CHECK_LIB(crypt, crypt)
951 AC_CHECK_LIB(resolv, res_init)
952 AC_CHECK_LIB(m, main)
954 dnl ---------------------------------------------------
955 dnl BSD/OS 4.1 define inet_XtoY function as __inet_XtoY
956 dnl ---------------------------------------------------
957 AC_CHECK_FUNC(__inet_ntop, AC_DEFINE(HAVE_INET_NTOP,,__inet_ntop))
958 AC_CHECK_FUNC(__inet_pton, AC_DEFINE(HAVE_INET_PTON,,__inet_pton))
959 AC_CHECK_FUNC(__inet_aton, AC_DEFINE(HAVE_INET_ATON,,__inet_aton))
961 dnl ---------------------------
962 dnl check system has GNU regexp
963 dnl ---------------------------
964 dnl AC_MSG_CHECKING(whether system has GNU regex)
965 AC_CHECK_LIB(c, regexec,
966 [AC_DEFINE(HAVE_GNU_REGEX,,GNU regexp library)
967  LIB_REGEX=""],
968 [LIB_REGEX="regex.o"])
969 AC_SUBST(LIB_REGEX)
971 dnl ------------------
972 dnl check SNMP library
973 dnl ------------------
974 if test "${enable_snmp}" = "yes";then
975 dnl  AC_CHECK_LIB(snmp, asn_parse_int, HAVE_SNMP=yes)
976   if test "${HAVE_SNMP}" = ""; then
977     old_libs="${LIBS}"
978     LIBS="-L/usr/lib"
979     unset ac_cv_lib_snmp_asn_parse_int
980     AC_CHECK_LIB(crypto, main, NEED_CRYPTO=yes, )
981     if test "${NEED_CRYPTO}" = ""; then
982       AC_CHECK_LIB(netsnmp, asn_parse_int, [HAVE_NETSNMP=yes; HAVE_SNMP=yes ])
983     else
984       AC_CHECK_LIB(netsnmp, asn_parse_int, [HAVE_NETSNMP=yes; HAVE_SNMP=yes; NEED_CRYPTO=yes;LIBS="$LIBS -lcrypto" ],,"-lcrypto")
985     fi
986     LIBS="${old_libs}"
987   fi
988   if test "${HAVE_SNMP}" = ""; then
989     old_libs="${LIBS}"
990     LIBS="-L/usr/lib"
991     unset ac_cv_lib_snmp_asn_parse_int
992     AC_CHECK_LIB(snmp, asn_parse_int, HAVE_SNMP=yes, )
993     if test "${HAVE_SNMP}" = ""; then
994       unset ac_cv_lib_snmp_asn_parse_int
995       AC_CHECK_LIB(crypto, main, NEED_CRYPTO=yes, )
996       if test "${NEED_CRYPTO}" = "yes"; then 
997         AC_CHECK_LIB(snmp, asn_parse_int, [HAVE_SNMP=yes; NEED_CRYPTO=yes; LIBS="$LIBS -lcrypto" ],,"-lcrypto")
998       fi
999     fi
1000     LIBS="${old_libs}"
1001   fi
1003   if test "${HAVE_SNMP}" = ""; then
1004     old_libs="${LIBS}"
1005     LIBS="-L/usr/local/lib"
1006     unset ac_cv_lib_snmp_asn_parse_int
1007     AC_CHECK_LIB(snmp, asn_parse_int, HAVE_SNMP=yes)
1008     if test "${HAVE_SNMP}" = ""; then
1009       unset ac_cv_lib_snmp_asn_parse_int
1010       AC_CHECK_LIB(crypto, main, NEED_CRYPTO=yes, )
1011       if test "${NEED_CRYPTO}" = "yes"; then
1012         AC_CHECK_LIB(snmp, asn_parse_int, [HAVE_SNMP=yes; NEED_CRYPTO=yes; LIBS="$LIBS -lcrypto" ],,"-lcrypto")
1013       fi
1014     fi
1015     LIBS="${old_libs}"
1016   fi
1018   if test "${HAVE_SNMP}" = "yes"; then
1019     for ac_snmp in /usr/include/net-snmp/library/asn1.h /usr/include/ucd-snmp/asn1.h /usr/local/include/ucd-snmp/asn1.h /dev/null
1020     do
1021       test -f "${ac_snmp}" && break
1022     done
1024     case ${ac_snmp} in
1025       /usr/include/net-snmp/*)
1026                   AC_DEFINE(HAVE_SNMP,,SNMP)
1027                   AC_DEFINE(HAVE_NETSNMP,,SNMP)
1028                   AC_DEFINE(UCD_COMPATIBLE,,SNMP)
1029                   SNMP_INCLUDES="${SNMP_INCLUDES} -I/usr/include/net-snmp -I/usr/include/net-snmp/library"
1030                   if test "${HAVE_NETSNMP}" = "yes"; then
1031                         LIBS="${LIBS} -lnetsnmp"
1032                   else
1033                         LIBS="${LIBS} -lsnmp"
1034                   fi
1035                   ;;
1036       /usr/include/ucd-snmp/*) 
1037                   AC_DEFINE(HAVE_SNMP,,SNMP)
1038                   SNMP_INCLUDES="${SNMP_INCLUDES} -I/usr/include/ucd-snmp"
1039                   LIBS="${LIBS} -lsnmp"
1040                   ;;
1041       /usr/local/include/ucd-snmp/*) 
1042                   AC_DEFINE(HAVE_SNMP,,SNMP)
1043                   SNMP_INCLUDES="${SNMP_INCLUDES} -I/usr/local/include/ucd-snmp"
1044                   LIBS="${LIBS} -L/usr/local/lib -lsnmp"
1045                   ;;
1046       /usr/local/include/net-snmp/*)
1047                 AC_DEFINE(HAVE_SNMP,,SNMP)
1048                 AC_DEFINE(HAVE_NET_SNMP,,SNMP)
1049                 AC_DEFINE(UCD_COMPATIBLE,,SNMP)
1050                 SNMP_INCLUDES="${SNMP_INCLUDES} -I/usr/local/include/net-snmp"
1051                 LIBS="${LIBS} -L/usr/local/lib -lnetsnmp"
1052                 ;;
1053     esac
1054     if test "${NEED_CRYPTO}" = "yes"; then
1055       LIBS="${LIBS} -lcrypto"
1056     fi
1057   fi
1060 if test "${enable_snmp}" = "yes" -a "${HAVE_SNMP}" != "yes"; then
1061   AC_MSG_ERROR([--enable-snmp given, but cannot find support for SNMP])
1064 AC_SUBST(SNMP_INCLUDES)
1066 dnl ----------------------------
1067 dnl check sa_len of sockaddr
1068 dnl ----------------------------
1069 AC_MSG_CHECKING(whether struct sockaddr has a sa_len field)
1070 AC_TRY_COMPILE([#include <sys/types.h>
1071 #include <sys/socket.h>
1072 ],[static struct sockaddr ac_i;int ac_j = sizeof (ac_i.sa_len);],
1073 [AC_MSG_RESULT(yes)
1074  AC_DEFINE(HAVE_SA_LEN,,sa_len)],
1075  AC_MSG_RESULT(no))
1077 dnl ----------------------------
1078 dnl check sin_len of sockaddr_in
1079 dnl ----------------------------
1080 AC_MSG_CHECKING(whether struct sockaddr_in has a sin_len field)
1081 AC_TRY_COMPILE([#include <sys/types.h>
1082 #include <netinet/in.h>
1083 ],[static struct sockaddr_in ac_i;int ac_j = sizeof (ac_i.sin_len);],
1084 [AC_MSG_RESULT(yes)
1085  AC_DEFINE(HAVE_SIN_LEN,,sin_len)],
1086  AC_MSG_RESULT(no))
1088 dnl ----------------------------
1089 dnl check sun_len of sockaddr_un
1090 dnl ----------------------------
1091 AC_MSG_CHECKING(whether struct sockaddr_un has a sun_len field)
1092 AC_TRY_COMPILE([#include <sys/types.h>
1093 #include <sys/un.h>
1094 ],[static struct sockaddr_un ac_i;int ac_j = sizeof (ac_i.sun_len);],
1095 [AC_MSG_RESULT(yes)
1096  AC_DEFINE(HAVE_SUN_LEN,,sun_len)],
1097  AC_MSG_RESULT(no))
1099 dnl -----------------------------------
1100 dnl check sin6_scope_id of sockaddr_in6
1101 dnl -----------------------------------
1102 if test "$zebra_cv_ipv6" = yes; then
1103   AC_MSG_CHECKING(whether struct sockaddr_in6 has a sin6_scope_id field)
1104   AC_TRY_COMPILE([#include <sys/types.h>
1105 #include <netinet/in.h>
1106 ],[static struct sockaddr_in6 ac_i;int ac_j = sizeof (ac_i.sin6_scope_id);],
1107 [AC_MSG_RESULT(yes)
1108  AC_DEFINE(HAVE_SIN6_SCOPE_ID,,scope id)],
1109  AC_MSG_RESULT(no))
1112 dnl ----------------------------
1113 dnl check socklen_t exist or not
1114 dnl ----------------------------
1115 AC_MSG_CHECKING(whther socklen_t is defined)
1116 AC_TRY_COMPILE([#include <sys/types.h>
1117 #include <sys/socket.h>
1118 #include <netinet/in.h>
1119 ],[socklen_t ac_x;],
1120 [AC_MSG_RESULT(yes)
1121  AC_DEFINE(HAVE_SOCKLEN_T,,socklen_t)],
1122  AC_MSG_RESULT(no))
1124 dnl ------------------------
1125 dnl check struct sockaddr_dl
1126 dnl ------------------------
1127 AC_MSG_CHECKING(whether struct sockaddr_dl exist)
1128 AC_EGREP_HEADER(sockaddr_dl,
1129 net/if_dl.h,
1130 [AC_MSG_RESULT(yes)
1131  AC_DEFINE(HAVE_SOCKADDR_DL,,sockaddr_dl)],
1132  AC_MSG_RESULT(no))
1134 dnl --------------------------
1135 dnl check structure ifaliasreq
1136 dnl --------------------------
1137 AC_MSG_CHECKING(whether struct ifaliasreq exist)
1138 AC_EGREP_HEADER(ifaliasreq,
1139 net/if.h,
1140 [AC_MSG_RESULT(yes)
1141  AC_DEFINE(HAVE_IFALIASREQ,,ifaliasreq)],
1142  AC_MSG_RESULT(no))
1144 dnl ----------------------------
1145 dnl check structure in6_aliasreq
1146 dnl ----------------------------
1147 AC_MSG_CHECKING(whether struct in6_aliasreq exist)
1148 AC_EGREP_HEADER(in6_aliasreq,
1149 netinet6/in6_var.h,
1150 [AC_MSG_RESULT(yes)
1151  AC_DEFINE(HAVE_IN6_ALIASREQ,,in6_aliasreq)],
1152  AC_MSG_RESULT(no))
1154 dnl -----------------------------------
1155 dnl check ifra_lifetime of in6_aliasreq
1156 dnl -----------------------------------
1157 AC_MSG_CHECKING(whether in6_aliasreq.ifra_lifetime exist)
1158 AC_TRY_COMPILE([#include <sys/types.h>
1159 #include <netinet6/in6_var.h>
1160 ],[static struct if6_aliasreq ac_i;int ac_j = sizeof (ac_i.ifra_lifetime);],
1161 [AC_MSG_RESULT(yes)
1162  AC_DEFINE(HAVE_IFRA_LIFETIME,,Have in6_aliasreq.ifra_lifetime)],
1163  AC_MSG_RESULT(no))
1165 dnl ---------------------------
1166 dnl check structure rt_addrinfo
1167 dnl ---------------------------
1168 AC_MSG_CHECKING(whether struct rt_addrinfo exist)
1169 AC_EGREP_HEADER(rt_addrinfo,
1170 net/route.h,
1171 [AC_MSG_RESULT(yes)
1172  AC_DEFINE(HAVE_RT_ADDRINFO,,rt_addrinfo)],
1173  AC_MSG_RESULT(no))
1175 dnl --------------------------
1176 dnl check structure in_pktinfo
1177 dnl --------------------------
1178 AC_MSG_CHECKING(whether struct in_pktinfo exist)
1179 AC_TRY_COMPILE([#include <netinet/in.h>
1180 ],[struct in_pktinfo ac_x;],
1181 [AC_MSG_RESULT(yes)
1182  AC_DEFINE(HAVE_INPKTINFO,,in_pktinfo)],
1183  AC_MSG_RESULT(no))
1185 dnl ----------------------------------
1186 dnl check struct nd_opt_homeagent_info
1187 dnl ----------------------------------
1188 AC_MSG_CHECKING(whether struct nd_opt_homeagent_info exist)
1189 AC_EGREP_HEADER(nd_opt_homeagent_info,
1190 netinet/icmp6.h,
1191 [AC_MSG_RESULT(yes)
1192  AC_DEFINE(HAVE_ND_OPT_HOMEAGENT_INFO,,nd_opt_homeagent_info)],
1193  AC_MSG_RESULT(no))
1195 dnl --------------------------------
1196 dnl check struct nd_opt_adv_interval
1197 dnl --------------------------------
1198 AC_MSG_CHECKING(whether struct nd_opt_adv_interval exist)
1199 AC_EGREP_HEADER(nd_opt_adv_interval,
1200 netinet/icmp6.h,
1201 [AC_MSG_RESULT(yes)
1202  AC_DEFINE(HAVE_ND_OPT_ADV_INTERVAL,,nd_opt_adv_interval)],
1203  AC_MSG_RESULT(no))
1205 dnl ------------------------------------
1206 dnl check fields in  nd_opt_adv_interval
1207 dnl ------------------------------------
1208 AC_MSG_CHECKING(whether nd_opt_ai_type field exist)
1209 AC_EGREP_HEADER(nd_opt_ai_type,
1210 netinet/icmp6.h,
1211 [AC_MSG_RESULT(yes)
1212  AC_DEFINE(HAVE_ND_OPT_ADV_INTERVAL_AI_FIELDS,,nd_opt_ai_type)],
1213  AC_MSG_RESULT(no))
1215 dnl --------------------------------------
1216 dnl checking for getrusage struct and call
1217 dnl --------------------------------------
1218 AC_MSG_CHECKING(whether getrusage is available)
1219 AC_TRY_COMPILE([#include <sys/resource.h>
1220 ],[struct rusage ac_x; getrusage (RUSAGE_SELF, &ac_x);],
1221 [AC_MSG_RESULT(yes)
1222  AC_DEFINE(HAVE_RUSAGE,,rusage)],
1223  AC_MSG_RESULT(no))
1225 dnl -------------------
1226 dnl capabilities checks
1227 dnl -------------------
1228 if test "${enable_capabilities}" != "no"; then
1229   AC_MSG_CHECKING(whether prctl PR_SET_KEEPCAPS is available)
1230   AC_TRY_COMPILE([#include <sys/prctl.h>],[prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0);],
1231     [AC_MSG_RESULT(yes)
1232      AC_DEFINE(HAVE_PR_SET_KEEPCAPS,,prctl)
1233      quagga_ac_keepcaps="yes"],
1234      AC_MSG_RESULT(no)
1235   )
1236   if test x"${quagga_ac_keepcaps}" = x"yes"; then
1237     AC_CHECK_HEADERS(sys/capability.h)
1238   fi
1239   if test x"${ac_cv_header_sys_capability_h}" = x"yes"; then
1240     AC_CHECK_LIB(cap, cap_init, 
1241       [AC_DEFINE(HAVE_LCAPS,1,Capabilities)
1242        LIBCAP="-lcap"
1243        quagga_ac_lcaps="yes"]
1244     )
1245   else
1246     AC_CHECK_HEADERS(priv.h,
1247      [AC_MSG_CHECKING(Solaris style privileges are available)
1248       AC_TRY_COMPILE([#include <priv.h>],[getpflags(PRIV_AWARE);],
1249           [AC_MSG_RESULT(yes)
1250            AC_DEFINE(HAVE_SOLARIS_CAPABILITIES,1,getpflags)
1251            quagga_ac_scaps="yes"],
1252            AC_MSG_RESULT(no)
1253       )
1254      ]
1255    )
1256   fi
1257   if test x"${quagga_ac_scaps}" = x"yes" \
1258        -o x"${quagga_ac_lcaps}" = x"yes"; then
1259     AC_DEFINE(HAVE_CAPABILITIES,1,capabilities)
1260   fi
1262 AC_SUBST(LIBCAP)
1264 dnl -------------------
1265 dnl test for ucontext.h
1266 dnl -------------------
1267 AC_CHECK_HEADERS(ucontext.h)
1269 dnl ---------------------------
1270 dnl check for glibc 'backtrace'
1271 dnl --------------------------- 
1272 if test "${glibc}" = "yes"; then
1273    AC_CHECK_HEADER(execinfo.h)
1275 if test x"${ac_cv_header_execinfo_h}" = x"yes"; then
1276   AC_CHECK_FUNC(backtrace,
1277     [AC_DEFINE(HAVE_GLIBC_BACKTRACE,,Glibc backtrace)]
1278   )
1281 dnl ----------
1282 dnl configure date
1283 dnl ----------
1284 CONFDATE=`date '+%Y%m%d'`
1285 AC_SUBST(CONFDATE)
1287 dnl ------------------------------
1288 dnl set paths for state directory
1289 dnl ------------------------------
1290 if test "${prefix}" = "NONE"; then
1291   quagga_statedir_prefix="";
1292 else
1293   quagga_statedir_prefix=${prefix}
1295 if test "${localstatedir}" = '${prefix}/var'; then
1296   AC_CACHE_CHECK(state directory,ac_statedir,
1297   [for QUAGGA_STATE_DIR in ${quagga_statedir_prefix}/var/run dnl
1298                         ${quagga_statedir_prefix}/var/adm dnl
1299                         ${quagga_statedir_prefix}/etc dnl
1300                         /var/run        dnl
1301                         /var/adm        dnl
1302                         /etc            dnl
1303                         /dev/null;
1304   do
1305     test -d $QUAGGA_STATE_DIR && break
1306   done
1307   quagga_statedir=$QUAGGA_STATE_DIR])
1308 else
1309   quagga_statedir=${localstatedir}
1310   AC_MSG_CHECKING(directory to use for state file)
1311   AC_MSG_RESULT(${quagga_statedir})
1312   AC_SUBST(quagga_statedir)
1314 if test $quagga_statedir = "/dev/null"; then
1315     AC_MSG_ERROR('STATE DIRECTORY NOT FOUND! FIX OR SPECIFY --localstatedir!')
1318 AC_DEFINE_UNQUOTED(PATH_ZEBRA_PID, "$quagga_statedir/zebra.pid",zebra PID)
1319 AC_DEFINE_UNQUOTED(PATH_RIPD_PID, "$quagga_statedir/ripd.pid",ripd PID)
1320 AC_DEFINE_UNQUOTED(PATH_RIPNGD_PID, "$quagga_statedir/ripngd.pid",ripngd PID)
1321 AC_DEFINE_UNQUOTED(PATH_BGPD_PID, "$quagga_statedir/bgpd.pid",bgpd PID)
1322 AC_DEFINE_UNQUOTED(PATH_OSPFD_PID, "$quagga_statedir/ospfd.pid",ospfd PID)
1323 AC_DEFINE_UNQUOTED(PATH_OSPF6D_PID, "$quagga_statedir/ospf6d.pid",ospf6d PID)
1324 AC_DEFINE_UNQUOTED(PATH_ISISD_PID, "$quagga_statedir/isisd.pid",isisd PID)
1325 AC_DEFINE_UNQUOTED(PATH_WATCHQUAGGA_PID, "$quagga_statedir/watchquagga.pid",watchquagga PID)
1326 AC_DEFINE_UNQUOTED(ZEBRA_SERV_PATH, "$quagga_statedir/zserv.api",zebra api socket)
1327 AC_DEFINE_UNQUOTED(ZEBRA_VTYSH_PATH, "$quagga_statedir/zebra.vty",zebra vty socket)
1328 AC_DEFINE_UNQUOTED(RIP_VTYSH_PATH, "$quagga_statedir/ripd.vty",rip vty socket)
1329 AC_DEFINE_UNQUOTED(RIPNG_VTYSH_PATH, "$quagga_statedir/ripngd.vty",ripng vty socket)
1330 AC_DEFINE_UNQUOTED(BGP_VTYSH_PATH, "$quagga_statedir/bgpd.vty",bgpd vty socket)
1331 AC_DEFINE_UNQUOTED(OSPF_VTYSH_PATH, "$quagga_statedir/ospfd.vty",ospfd vty socket)
1332 AC_DEFINE_UNQUOTED(OSPF6_VTYSH_PATH, "$quagga_statedir/ospf6d.vty",ospf6d vty socket)
1333 AC_DEFINE_UNQUOTED(ISIS_VTYSH_PATH, "$quagga_statedir/isisd.vty",isisd vty socket)
1334 AC_DEFINE_UNQUOTED(DAEMON_VTY_DIR, "$quagga_statedir",daemon vty directory)
1336 dnl -------------------------------
1337 dnl Quagga sources should always be 
1338 dnl current wrt interfaces. Dont
1339 dnl allow deprecated interfaces to
1340 dnl be exposed.
1341 dnl -------------------------------
1342 AC_DEFINE(QUAGGA_NO_DEPRECATED_INTERFACES, 1, Hide deprecated interfaces)
1344 dnl ---------------------------
1345 dnl Check htonl works correctly
1346 dnl ---------------------------
1347 AC_MSG_CHECKING(for working htonl)
1348 AC_CACHE_VAL(ac_cv_htonl_works, [
1349 AC_TRY_LINK([#ifdef HAVE_SYS_TYPES_H
1350 #include <sys/types.h>
1351 #endif
1352 #ifdef HAVE_NETDB_H
1353 #include <netdb.h>
1354 #endif
1355 #ifdef HAVE_NETINET_IN_H
1356 #include <netinet/in.h>
1357 #endif],
1358 [htonl (0);],
1359 ac_cv_htonl_works=yes,
1360 ac_cv_htonl_works=no)])
1361 AC_MSG_RESULT($ac_cv_htonl_works)
1363 AC_CONFIG_FILES([Makefile lib/Makefile zebra/Makefile ripd/Makefile 
1364           ripngd/Makefile bgpd/Makefile ospfd/Makefile watchquagga/Makefile
1365           ospf6d/Makefile isisd/Makefile vtysh/Makefile doc/Makefile 
1366           ospfclient/Makefile tests/Makefile m4/Makefile redhat/Makefile
1367           pkgsrc/Makefile
1368           redhat/quagga.spec 
1369           lib/version.h
1370           doc/defines.texi
1371           isisd/topology/Makefile
1372           pkgsrc/bgpd.sh pkgsrc/ospf6d.sh pkgsrc/ospfd.sh
1373           pkgsrc/ripd.sh pkgsrc/ripngd.sh pkgsrc/zebra.sh])
1374 AC_CONFIG_FILES([solaris/Makefile])
1376 AC_CONFIG_FILES([vtysh/extract.pl],[chmod +x vtysh/extract.pl])
1377 ## Hack, but working solution to avoid rebuilding of quagga.info.
1378 ## It's already in CVS until texinfo 4.7 is more common.
1379 AC_CONFIG_COMMANDS([info-time],[touch doc/quagga.info])
1380 AC_OUTPUT
1382 echo "
1383 Quagga configuration
1384 --------------------
1385 quagga version          : ${PACKAGE_VERSION}
1386 host operationg system  : ${host_os}
1387 source code location    : ${srcdir}
1388 compiler                : ${CC}
1389 compiler flags          : ${CFLAGS}
1390 includes                : ${INCLUDES} ${SNMP_INCLUDES}
1391 linker flags            : ${LDFLAGS} ${LIBS} ${LIBCAP} ${LIBREADLINE}
1392 state file directory    : ${quagga_statedir}
1393 config file directory   : `eval echo \`echo ${sysconfdir}\``
1394 example directory       : `eval echo \`echo ${exampledir}\``
1395 user to run as          : ${enable_user}
1396 group to run as         : ${enable_group}
1397 group for vty sockets   : ${enable_vty_group}
1398 config file mask        : ${enable_configfile_mask}
1399 log file mask           : ${enable_logfile_mask}
1401 The above user and group must have read/write access to the state file
1402 directory and to the config files in the config file directory.