]> git.proxmox.com Git - mirror_frr.git/blobdiff - configure.ac
2005-04-16 Paul Jakma <paul@dishone.st>
[mirror_frr.git] / configure.ac
index 7d594494159e8bfe57aebdfa52c1843c76193814..08b5214f98378822e4766836356ba6bb891d7c81 100755 (executable)
@@ -5,14 +5,26 @@
 ##  Copyright (c) 1996, 97, 98, 99, 2000 Kunihiro Ishiguro <kunihiro@zebra.org>
 ##  Portions Copyright (c) 2003 Paul Jakma <paul@dishone.st>
 ##
-## $Id: configure.ac,v 1.49 2004/04/07 22:48:47 gdt Exp $
+## $Id: configure.ac,v 1.103 2005/04/16 15:38:23 paul Exp $
 AC_PREREQ(2.53)
 
-AC_INIT(quagga, 0.96.4, [http://bugzilla.quagga.net])
+AC_INIT(Quagga, 0.99.0, [http://bugzilla.quagga.net])
 AC_CONFIG_SRCDIR(lib/zebra.h)
+
+dnl -----------------------------------
+dnl Get hostname and other information.
+dnl -----------------------------------
+AC_CANONICAL_BUILD()
+AC_CANONICAL_HOST()
+AC_CANONICAL_TARGET()
+
 AM_INIT_AUTOMAKE(1.6)
 AM_CONFIG_HEADER(config.h)
 
+dnl we need gawk for memtypes.awk
+AC_CHECK_PROG([GAWK],[gawk],[gawk],[/bin/false])
+AC_ARG_VAR([GAWK],[GNU AWK])
+
 dnl default is to match previous behavior
 exampledir=${sysconfdir}
 AC_ARG_ENABLE([exampledir],
@@ -22,10 +34,16 @@ AC_ARG_ENABLE([exampledir],
 dnl XXX add --exampledir to autoconf standard directory list somehow
 AC_SUBST(exampledir)
 
-dnl -----------------------------------
-dnl Get hostname and other information.
-dnl -----------------------------------
-AC_CANONICAL_HOST
+dnl default is to match previous behavior
+pkgsrcrcdir=""
+pkgsrcdir=""
+AC_ARG_ENABLE([pkgsrcrcdir],
+         AC_HELP_STRING([--enable-pkgsrcrcdir],
+                        [specify directory for rc.d scripts]),
+                        pkgsrcrcdir="$enableval"; pkgsrcdir="pkgsrc",)
+dnl XXX add --pkgsrcrcdir to autoconf standard directory list somehow
+AC_SUBST(pkgsrcdir)
+AC_SUBST(pkgsrcrcdir)
 
 dnl ------------
 dnl Check CFLAGS
@@ -38,22 +56,60 @@ elif test -n "$CFLAGS" ; then
   cflags_specified=yes ;
 fi
 
-dnl --------
-dnl Check CC
-dnl --------
+dnl --------------------
+dnl Check CC and friends
+dnl --------------------
 AC_PROG_CC
+AC_PROG_CPP
+AC_PROG_EGREP
+
+dnl ------------------------------------------------------------------
+dnl Intel compiler check. Although Intel tries really hard to make icc
+dnl look like gcc, there are some differences. It's very verbose with
+dnl -Wall and it doesn't support the individual -W options.
+dnl ------------------------------------------------------------------
+AC_MSG_CHECKING([whether we are using the Intel compiler])
+AC_EGREP_CPP([^__INTEL_COMPILER], [__INTEL_COMPILER],
+    ICC="no"
+    AC_MSG_RESULT([no]),
+    ICC="yes"
+    AC_MSG_RESULT([yes])
+)
 
-dnl -----------------------------------------
+dnl ---------------------------------------------
 dnl If CLFAGS doesn\'t exist set default value
-dnl -----------------------------------------
+dnl AC_PROG_CC will have set minimal default
+dnl already, eg "-O2 -g" for gcc, "-g" for others
+dnl (Wall is gcc specific... have to make sure
+dnl  gcc is being used before setting it)
+dnl Intel icc 8.0 also sets __GNUC__, but
+dnl doesn't support all these fancy -W options.
+dnl ---------------------------------------------
+dnl
 if test "x$cflags_specified" = "x" ; then
-  CFLAGS="$CFLAGS -Wall"
+  if test "x${GCC}" = "xyes" && test "x${ICC}" = "xno"; then
+       CFLAGS="-Os -g  -Wall -Wsign-compare -Wpointer-arith"
+       CFLAGS="${CFLAGS} -Wbad-function-cast -Wwrite-strings"
+  fi
+  # TODO: conditionally addd -Wpacked if handled
+fi
+
+dnl ---------------------------------------------------------------------
+dnl Intel compiler warnings we ignore:
+dnl 279: controlling expression is constant.
+dnl 869: parameter "xxx" was never referenced - to avoid massive warnings
+dnl      about "self", "vty", "argc" and "argv" never referenced in DEFUN
+dnl      macro.
+dnl 981: operands are evaluated in unspecified order.
+dnl ---------------------------------------------------------------------
+
+if test "$ICC" = "yes"; then
+    CFLAGS="-Os -g -Wall -wd 279,869,981"
 fi
 
 dnl --------------
 dnl Check programs
 dnl --------------
-AC_PROG_CPP
 AC_PROG_INSTALL
 AC_PROG_MAKE_SET
 AC_CHECK_TOOL(AR, ar)
@@ -64,11 +120,16 @@ dnl AIX check
 dnl ---------
 AC_AIX
 
+dnl -------
+dnl libtool
+dnl -------
+AC_PROG_LIBTOOL
+
 dnl ----------------------
 dnl Packages configuration
 dnl ----------------------
 AC_ARG_ENABLE(vtysh,
-[  --enable-vtysh,       Make integrated vty shell for Quagga])
+[  --enable-vtysh          include integrated vty shell for Quagga])
 AC_ARG_ENABLE(ipv6,
 [  --disable-ipv6          turn off IPv6 related features and daemons])
 AC_ARG_ENABLE(zebra,
@@ -83,8 +144,10 @@ AC_ARG_ENABLE(ospfd,
 [  --disable-ospfd         do not build ospfd])
 AC_ARG_ENABLE(ospf6d,
 [  --disable-ospf6d        do not build ospf6d])
+AC_ARG_ENABLE(watchquagga,
+[  --disable-watchquagga   do not build watchquagga])
 AC_ARG_ENABLE(isisd,
-[  --disable-isisd         do not build isisd])
+[  --enable-isisd          build isisd])
 AC_ARG_ENABLE(bgp-announce,
 [  --disable-bgp-announce, turn off BGP route announcement])
 AC_ARG_ENABLE(netlink,
@@ -97,9 +160,6 @@ AC_ARG_WITH(libpam,
 [  --with-libpam           use libpam for PAM support in vtysh])
 AC_ARG_ENABLE(tcp-zebra,
 [  --enable-tcp-zebra      enable TCP/IP socket connection between zebra and protocol daemon])
-dnl Temporary option until OSPF NSSA implementation complete
-AC_ARG_ENABLE(nssa,
-[  --enable-nssa           enable OSPF NSSA option])
 AC_ARG_ENABLE(opaque-lsa,
 [  --enable-opaque-lsa     enable OSPF Opaque-LSA with OSPFAPI support (RFC2370)])
 AC_ARG_ENABLE(ospfapi,
@@ -117,16 +177,35 @@ AC_ARG_ENABLE(quagga_user,
 AC_ARG_ENABLE(quagga_group,
 [  --enable-group=ARG      group to run Quagga suite as (default quagga)])
 AC_ARG_ENABLE(vty_group,
-[  --enable-vty-group=ARG      set vty sockets to have specified group as owner])
+[  --enable-vty-group=ARG  set vty sockets to have specified group as owner])
 AC_ARG_ENABLE(configfile_mask,
 [  --enable-configfile-mask=ARG  set mask for config files])
 AC_ARG_ENABLE(logfile_mask,
 [  --enable-logfile-mask=ARG     set mask for log files])
 
 AC_ARG_ENABLE(rtadv,
-[  --disable-rtadv         disable IPV6 router advertisement feature])
+[  --disable-rtadv               disable IPV6 router advertisement feature])
+AC_ARG_ENABLE(irdp,
+[  --enable-irdp                 enable IRDP server support in zebra])
+AC_ARG_ENABLE(isis_topology,
+[  --enable-isis-topology        enable IS-IS topology generator])
 AC_ARG_ENABLE(capabilities,
 [  --disable-capabilities        disable using POSIX capabilities])
+AC_ARG_ENABLE(gcc_ultra_verbose,
+[  --enable-gcc-ultra-verbose    enable ultra verbose GCC warnings])
+AC_ARG_ENABLE(gcc-rdynamic,
+[  --enable-gcc-rdynamic   enable gcc linking with -rdynamic for better backtraces])
+
+if test x"${enable_gcc_ultra_verbose}" = x"yes" ; then
+  CFLAGS="${CFLAGS} -W -Wcast-qual -Wstrict-prototypes"
+  CFLAGS="${CFLAGS} -Wmissing-declarations -Wmissing-noreturn"
+  CFLAGS="${CFLAGS} -Wmissing-format-attribute -Wunreachable-code"
+  CFLAGS="${CFLAGS} -Wpacked -Wpadded"
+fi
+
+if test x"${enable_gcc_rdynamic}" = x"yes" ; then
+  LDFLAGS="${LDFLAGS} -rdynamic"
+fi
 
 if test "${enable_broken_aliases}" = "yes"; then
   if test "${enable_netlink}" = "yes"
@@ -142,10 +221,6 @@ if test "${enable_tcp_zebra}" = "yes"; then
   AC_DEFINE(HAVE_TCP_ZEBRA,,Use TCP for zebra communication)
 fi
 
-if test "${enable_nssa}" = "yes"; then
-  AC_DEFINE(HAVE_NSSA,,OSPF NSSA)
-fi
-
 if test "${enable_opaque_lsa}" = "yes"; then
   AC_DEFINE(HAVE_OPAQUE_LSA,,OSPF Opaque LSA)
 fi
@@ -163,19 +238,32 @@ else
   AC_MSG_RESULT(no)
 fi
 
+if test "${enable_irdp}" = "yes"; then
+  AC_DEFINE(HAVE_IRDP,, IRDP )
+fi
+
+if test "${enable_isisd}" = "yes" && test "${enable_isis_topology}" = yes; then
+  AC_DEFINE(TOPOLOGY_GENERATE,,Enable IS-IS topology generator code)
+  ISIS_TOPOLOGY_INCLUDES="-I./topology"
+  ISIS_TOPOLOGY_DIR="topology"
+  ISIS_TOPOLOGY_LIB="./topology/libtopology.a"
+fi
+
+AC_SUBST(ISIS_TOPOLOGY_INCLUDES)
+AC_SUBST(ISIS_TOPOLOGY_DIR)
+AC_SUBST(ISIS_TOPOLOGY_LIB)
+
 if test "${enable_user}" = "yes" || test x"${enable_user}" = x""; then
   enable_user="quagga"
 elif test "${enable_user}" = "no"; then
   enable_user="root"
 fi
-AC_DEFINE_UNQUOTED(QUAGGA_USER, "${enable_user}", Quagga User)
 
 if test "${enable_group}" = "yes" || test x"${enable_group}" = x""; then
   enable_group="quagga"
 elif test "${enable_group}" = "no"; then
   enable_group="root"
 fi
-AC_DEFINE_UNQUOTED(QUAGGA_GROUP, "${enable_group}", Quagga Group)
 
 if test x"${enable_vty_group}" = x"yes" ; then
   AC_MSG_ERROR([--enable-vty-group requires a group as argument, not yes])
@@ -184,6 +272,11 @@ elif test x"${enable_vty_group}" != x""; then
     AC_DEFINE_UNQUOTED(VTY_GROUP, "${enable_vty_group}", VTY Sockets Group)
   fi
 fi
+AC_SUBST([enable_user])
+AC_SUBST([enable_group])
+AC_SUBST([enable_vty_group])
+AC_DEFINE_UNQUOTED(QUAGGA_USER, "${enable_user}", Quagga User)
+AC_DEFINE_UNQUOTED(QUAGGA_GROUP, "${enable_group}", Quagga Group)
 
 enable_configfile_mask=${enable_configfile_mask:-0600}
 AC_DEFINE_UNQUOTED(CONFIGFILE_MASK, ${enable_configfile_mask}, Mask for config files)
@@ -233,19 +326,34 @@ AC_TYPE_SIGNAL
 
 dnl Some systems (Solaris 2.x) require libnsl (Network Services Library)
 case "$host" in
-  *-sunos5.6* | *-solaris2.6*)
+  [*-sunos5.[6-7]*] | [*-solaris2.[6-7]*])
       opsys=sol2-6
-      AC_DEFINE(SUNOS_5,,SunOS 5)
+      AC_DEFINE(SUNOS_56, 1, SunOS 5.6 to 5.7)
+      AC_DEFINE(SUNOS_5, 1, SunOS 5)
       AC_CHECK_LIB(xnet, main)
       CURSES=-lcurses
   ;;
+  [*-sunos5.[8-9]] \
+  | [*-sunos5.1[0-9]] \
+  | [*-sunos5.1[0-9].[0-9]] \
+  | [*-solaris2.[8-9]] \
+  | [*-solaris2.1[0-9]] \
+  | [*-solaris2.1[0-9].[0-9]])
+      opsys=sol8
+      AC_DEFINE(SUNOS_59,,SunOS 5.8 up)
+      AC_DEFINE(SUNOS_5, 1, SunOS 5)
+      AC_CHECK_LIB(socket, main)
+      AC_CHECK_LIB(nsl, main)
+      AC_CHECK_LIB(umem, main)
+      CURSES=-lcurses
+  ;;
   *-sunos5* | *-solaris2*)
-      AC_DEFINE(SUNOS_5,,SunOS 5)
+      AC_DEFINE(SUNOS_5,,SunOS 5, Unknown SunOS)
       AC_CHECK_LIB(socket, main)
       AC_CHECK_LIB(nsl, main)
       CURSES=-lcurses
   ;;
-  *-linux-*)
+  *-linux*)
       opsys=gnu-linux
       AC_DEFINE(GNU_LINUX,,GNU Linux)
   ;;
@@ -277,10 +385,18 @@ dnl ---------------------
 case "${enable_vtysh}" in
   "yes") VTYSH="vtysh";
          AC_DEFINE(VTYSH,,VTY shell)
-        AC_CHECK_LIB(tinfo, tputs, , AC_CHECK_LIB(ncurses, tputs))
+        AC_PATH_PROG(PERL, perl)
+dnl     Vtysh uses libreadline, which looks for termcap functions at
+dnl     configure time.  We follow readline's search order.
+dnl     The required procedures are in libtermcap on NetBSD, in
+dnl     [TODO] on Linux, and in [TODO] on Solaris.
+        AC_CHECK_LIB(termcap, tputs, ,
+               AC_CHECK_LIB(tinfo, tputs, ,
+               AC_CHECK_LIB(curses, tputs, ,
+               AC_CHECK_LIB(ncurses, tputs))))
          AC_CHECK_LIB(readline, main)
          if test $ac_cv_lib_readline_main = no; then
-           AC_MSG_ERROR([vtysh needs libreadline but was not found on your system.])
+           AC_MSG_ERROR([vtysh needs libreadline but was not found and usable on your system.])
          fi
         AC_CHECK_HEADER(readline/history.h)
         if test $ac_cv_header_readline_history_h = no;then
@@ -366,7 +482,7 @@ dnl check existance of functions
 dnl ----------------------------
 AC_CHECK_FUNCS(memset memcpy strerror inet_aton daemon snprintf vsnprintf \
                strlcat strlcpy if_nametoindex if_indextoname getifaddrs \
-              fcntl)
+              fcntl strnlen)
 AC_CHECK_FUNCS(setproctitle, ,
   [AC_CHECK_LIB(util, setproctitle, 
      [LIBS="$LIBS -lutil"
@@ -396,17 +512,20 @@ if test x"$opsys" = x"gnu-linux"; then
     AC_DEFINE(HAVE_NETLINK,,netlink)
     netlink=yes
   fi
+elif test x"$opsys" = x"sol2-6";then
+  AC_MSG_RESULT(Route socket)
+  KERNEL_METHOD="kernel_socket.o"
+  RT_METHOD="rt_socket.o"
+elif test x"$opsys" = x"sol8";then
+  AC_MSG_RESULT(Route socket)
+  KERNEL_METHOD="kernel_socket.o"
+  RT_METHOD="rt_socket.o"
+elif test "$opsys" = "irix" ; then
+  AC_MSG_RESULT(Route socket)
+  KERNEL_METHOD="kernel_socket.o"
+  RT_METHOD="rt_socket.o"
 else
-  if test "$opsys" = "sol2-6";then
-    AC_MSG_RESULT(solaris)
-    KERNEL_METHOD="kernel_socket.o"
-    RT_METHOD="rt_socket.o"
-  elif test "$opsys" = "irix" ; then
-    AC_MSG_RESULT(irix)
-    KERNEL_METHOD="kernel_socket.o"
-    RT_METHOD="rt_socket.o"
-  else
-    AC_TRY_RUN([#include <errno.h>
+  AC_TRY_RUN([#include <errno.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 
@@ -427,12 +546,38 @@ main ()
   [KERNEL_METHOD=kernel_socket.o
    RT_METHOD=rt_socket.o
    AC_MSG_RESULT(socket)])
-  fi
 fi
 AC_SUBST(RT_METHOD)
 AC_SUBST(KERNEL_METHOD)
 AC_SUBST(OTHER_METHOD)
 
+dnl ------------------------------------
+dnl check for broken CMSG_FIRSTHDR macro
+dnl ------------------------------------
+AC_MSG_CHECKING(for broken CMSG_FIRSTHDR)
+AC_RUN_IFELSE([AC_LANG_SOURCE([[
+#ifdef SUNOS_5
+#define _XPG4_2
+#define __EXTENSIONS__
+#endif
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+
+main()
+{
+  struct msghdr msg;
+  char buf[4];
+
+  msg.msg_control = buf;
+  msg.msg_controllen = 0;
+
+  if (CMSG_FIRSTHDR(&msg) != NULL)
+    exit(0);
+  exit (1);
+}]])],[AC_MSG_RESULT(yes - using workaround) AC_DEFINE(HAVE_BROKEN_CMSG_FIRSTHDR,,Broken CMSG_FIRSTHDR)],
+[AC_MSG_RESULT(no)],[AC_MSG_RESULT(no)])
+
 dnl ------------------------------
 dnl check kernel route read method
 dnl ------------------------------
@@ -464,30 +609,34 @@ AC_SUBST(RTREAD_METHOD)
 dnl -----------------------------
 dnl check interface lookup method
 dnl -----------------------------
+IOCTL_METHOD=ioctl.o
 AC_MSG_CHECKING(interface looking up method)
 if test "$netlink" = yes; then
   AC_MSG_RESULT(netlink)
   IF_METHOD=if_netlink.o
-else
-  if test "$opsys" = "sol2-6";then
-    AC_MSG_RESULT(solaris)
-    IF_METHOD=if_ioctl.o
-  elif test "$opsys" = "irix" ; then
-    AC_MSG_RESULT(irix)
-     IF_METHOD=if_ioctl.o
-  elif test "$opsys" = "openbsd";then
-    AC_MSG_RESULT(openbsd)
-    IF_METHOD=if_ioctl.o
-  elif grep NET_RT_IFLIST /usr/include/sys/socket.h >/dev/null 2>&1; then
-    AC_MSG_RESULT(sysctl)
+elif test "$opsys" = "sol2-6";then
+  AC_MSG_RESULT(Solaris GIF)
+  IF_METHOD=if_ioctl.o
+elif test "$opsys" = "sol8";then
+  AC_MSG_RESULT(Solaris GLIF)
+  IF_METHOD=if_ioctl_solaris.o
+  IOCTL_METHOD=ioctl_solaris.o
+elif test "$opsys" = "irix" ; then
+  AC_MSG_RESULT(IRIX)
+  IF_METHOD=if_ioctl.o
+elif test "$opsys" = "openbsd";then
+  AC_MSG_RESULT(openbsd)
+  IF_METHOD=if_ioctl.o
+elif grep NET_RT_IFLIST /usr/include/sys/socket.h >/dev/null 2>&1; then
+  AC_MSG_RESULT(sysctl)
     IF_METHOD=if_sysctl.o
     AC_DEFINE(HAVE_NET_RT_IFLIST,,NET_RT_IFLIST)
-  else
+else
     AC_MSG_RESULT(ioctl)
     IF_METHOD=if_ioctl.o
-  fi
 fi
 AC_SUBST(IF_METHOD)
+AC_SUBST(IOCTL_METHOD)
 
 dnl -----------------------
 dnl check proc file system.
@@ -592,6 +741,16 @@ dnl ---------
     else
       AC_MSG_RESULT(NRL)
     fi
+dnl ------------------------------------
+dnl Solaris 9, 10 and potentially higher
+dnl ------------------------------------
+  elif test x"$opsys" = x"sol8"; then
+    zebra_cv_ipv6=yes;
+    AC_DEFINE(HAVE_IPV6, 1, IPv6)
+    AC_DEFINE(SOLARIS_IPV6, 1, Solaris IPv6)
+    RIPNGD="ripngd"
+    OSPF6D="ospf6d"
+    AC_MSG_RESULT(Solaris IPv6)
 dnl ----------
 dnl Linux IPv6
 dnl ----------
@@ -683,6 +842,12 @@ else
   OSPFD="ospfd"
 fi
 
+if test "${enable_watchquagga}" = "no";then
+  WATCHQUAGGA=""
+else
+  WATCHQUAGGA="watchquagga"
+fi
+
 OSPFCLIENT=""
 if test "${enable_opaque_lsa}" = "yes"; then
   if test "${enable_ospfapi}" != "no";then
@@ -710,7 +875,7 @@ esac
 case "${enable_isisd}" in
   "yes") ISISD="isisd";;
   "no" ) ISISD="";;
-  *    ) ISISD="isisd";;
+  *    ) ;;
 esac
 
 if test "${enable_bgp_announce}" = "no";then
@@ -723,6 +888,7 @@ AC_SUBST(RIPD)
 AC_SUBST(RIPNGD)
 AC_SUBST(OSPFD)
 AC_SUBST(OSPF6D)
+AC_SUBST(WATCHQUAGGA)
 AC_SUBST(ISISD)
 AC_SUBST(VTYSH)
 AC_SUBST(INCLUDES)
@@ -810,7 +976,7 @@ dnl  AC_CHECK_LIB(snmp, asn_parse_int, HAVE_SNMP=yes)
                   AC_DEFINE(HAVE_SNMP,,SNMP)
                  AC_DEFINE(HAVE_NETSNMP,,SNMP)
                   AC_DEFINE(UCD_COMPATIBLE,,SNMP)
-                  CFLAGS="${CFLAGS} -I/usr/include/net-snmp -I/usr/include/net-snmp/library"
+                  SNMP_INCLUDES="${SNMP_INCLUDES} -I/usr/include/net-snmp -I/usr/include/net-snmp/library"
                  if test "${HAVE_NETSNMP}" = "yes"; then
                        LIBS="${LIBS} -lnetsnmp"
                  else
@@ -819,19 +985,19 @@ dnl  AC_CHECK_LIB(snmp, asn_parse_int, HAVE_SNMP=yes)
                   ;;
       /usr/include/ucd-snmp/*) 
                   AC_DEFINE(HAVE_SNMP,,SNMP)
-                  CFLAGS="${CFLAGS} -I/usr/include/ucd-snmp"
+                  SNMP_INCLUDES="${SNMP_INCLUDES} -I/usr/include/ucd-snmp"
                  LIBS="${LIBS} -lsnmp"
                   ;;
       /usr/local/include/ucd-snmp/*) 
                   AC_DEFINE(HAVE_SNMP,,SNMP)
-                 CFLAGS="${CFLAGS} -I/usr/local/include/ucd-snmp"
+                 SNMP_INCLUDES="${SNMP_INCLUDES} -I/usr/local/include/ucd-snmp"
                  LIBS="${LIBS} -L/usr/local/lib -lsnmp"
                   ;;
       /usr/local/include/net-snmp/*)
                AC_DEFINE(HAVE_SNMP,,SNMP)
                AC_DEFINE(HAVE_NET_SNMP,,SNMP)
                AC_DEFINE(UCD_COMPATIBLE,,SNMP)
-               CFLAGS="${CFLAGS} -I/usr/local/include/net-snmp"
+               SNMP_INCLUDES="${SNMP_INCLUDES} -I/usr/local/include/net-snmp"
                LIBS="${LIBS} -L/usr/local/lib -lnetsnmp"
                ;;
     esac
@@ -841,6 +1007,12 @@ dnl  AC_CHECK_LIB(snmp, asn_parse_int, HAVE_SNMP=yes)
   fi
 fi
 
+if test "${enable_snmp}" = "yes" -a "${HAVE_SNMP}" != "yes"; then
+  AC_MSG_ERROR([--enable-snmp given, but cannot find support for SNMP])
+fi
+
+AC_SUBST(SNMP_INCLUDES)
+
 dnl ----------------------------
 dnl check sa_len of sockaddr
 dnl ----------------------------
@@ -960,6 +1132,36 @@ AC_TRY_COMPILE([#include <netinet/in.h>
  AC_DEFINE(HAVE_INPKTINFO,,in_pktinfo)],
  AC_MSG_RESULT(no))
 
+dnl ----------------------------------
+dnl check struct nd_opt_homeagent_info
+dnl ----------------------------------
+AC_MSG_CHECKING(whether struct nd_opt_homeagent_info exist)
+AC_EGREP_HEADER(nd_opt_homeagent_info,
+netinet/icmp6.h,
+[AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_ND_OPT_HOMEAGENT_INFO,,nd_opt_homeagent_info)],
+ AC_MSG_RESULT(no))
+
+dnl --------------------------------
+dnl check struct nd_opt_adv_interval
+dnl --------------------------------
+AC_MSG_CHECKING(whether struct nd_opt_adv_interval exist)
+AC_EGREP_HEADER(nd_opt_adv_interval,
+netinet/icmp6.h,
+[AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_ND_OPT_ADV_INTERVAL,,nd_opt_adv_interval)],
+ AC_MSG_RESULT(no))
+
+dnl ------------------------------------
+dnl check fields in  nd_opt_adv_interval
+dnl ------------------------------------
+AC_MSG_CHECKING(whether nd_opt_ai_type field exist)
+AC_EGREP_HEADER(nd_opt_ai_type,
+netinet/icmp6.h,
+[AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_ND_OPT_ADV_INTERVAL_AI_FIELDS,,nd_opt_ai_type)],
+ AC_MSG_RESULT(no))
+
 dnl --------------------------------------
 dnl checking for getrusage struct and call
 dnl --------------------------------------
@@ -994,6 +1196,11 @@ if test "${enable_capabilities}" != "no"; then
 fi
 AC_SUBST(LIBCAP)
 
+dnl -------------------
+dnl test for ucontext.h
+dnl -------------------
+AC_CHECK_HEADERS(ucontext.h)
+
 dnl ---------------------------
 dnl check for glibc 'backtrace'
 dnl --------------------------- 
@@ -1037,6 +1244,7 @@ else
   quagga_statedir=${localstatedir}
   AC_MSG_CHECKING(directory to use for state file)
   AC_MSG_RESULT(${quagga_statedir})
+  AC_SUBST(quagga_statedir)
 fi
 if test $quagga_statedir = "/dev/null"; then
     AC_MSG_ERROR('STATE DIRECTORY NOT FOUND! FIX OR SPECIFY --localstatedir!')
@@ -1049,6 +1257,7 @@ AC_DEFINE_UNQUOTED(PATH_BGPD_PID, "$quagga_statedir/bgpd.pid",bgpd PID)
 AC_DEFINE_UNQUOTED(PATH_OSPFD_PID, "$quagga_statedir/ospfd.pid",ospfd PID)
 AC_DEFINE_UNQUOTED(PATH_OSPF6D_PID, "$quagga_statedir/ospf6d.pid",ospf6d PID)
 AC_DEFINE_UNQUOTED(PATH_ISISD_PID, "$quagga_statedir/isisd.pid",isisd PID)
+AC_DEFINE_UNQUOTED(PATH_WATCHQUAGGA_PID, "$quagga_statedir/watchquagga.pid",watchquagga PID)
 AC_DEFINE_UNQUOTED(ZEBRA_SERV_PATH, "$quagga_statedir/zserv.api",zebra api socket)
 AC_DEFINE_UNQUOTED(ZEBRA_VTYSH_PATH, "$quagga_statedir/zebra.vty",zebra vty socket)
 AC_DEFINE_UNQUOTED(RIP_VTYSH_PATH, "$quagga_statedir/ripd.vty",rip vty socket)
@@ -1057,6 +1266,15 @@ AC_DEFINE_UNQUOTED(BGP_VTYSH_PATH, "$quagga_statedir/bgpd.vty",bgpd vty socket)
 AC_DEFINE_UNQUOTED(OSPF_VTYSH_PATH, "$quagga_statedir/ospfd.vty",ospfd vty socket)
 AC_DEFINE_UNQUOTED(OSPF6_VTYSH_PATH, "$quagga_statedir/ospf6d.vty",ospf6d vty socket)
 AC_DEFINE_UNQUOTED(ISIS_VTYSH_PATH, "$quagga_statedir/isisd.vty",isisd vty socket)
+AC_DEFINE_UNQUOTED(DAEMON_VTY_DIR, "$quagga_statedir",daemon vty directory)
+
+dnl -------------------------------
+dnl Quagga sources should always be 
+dnl current wrt interfaces. Dont
+dnl allow deprecated interfaces to
+dnl be exposed.
+dnl -------------------------------
+AC_DEFINE(QUAGGA_NO_DEPRECATED_INTERFACES, 1, Hide deprecated interfaces)
 
 dnl ---------------------------
 dnl Check htonl works correctly
@@ -1077,21 +1295,34 @@ ac_cv_htonl_works=yes,
 ac_cv_htonl_works=no)])
 AC_MSG_RESULT($ac_cv_htonl_works)
 
-AC_OUTPUT(Makefile lib/Makefile zebra/Makefile ripd/Makefile 
-         ripngd/Makefile bgpd/Makefile ospfd/Makefile 
+AC_CONFIG_FILES([Makefile lib/Makefile zebra/Makefile ripd/Makefile 
+         ripngd/Makefile bgpd/Makefile ospfd/Makefile watchquagga/Makefile
          ospf6d/Makefile isisd/Makefile vtysh/Makefile doc/Makefile 
-         ospfclient/Makefile
-         redhat/Makefile redhat/quagga.spec
-         lib/version.h)
+         ospfclient/Makefile tests/Makefile m4/Makefile redhat/Makefile
+         pkgsrc/Makefile
+         redhat/quagga.spec 
+         lib/version.h
+         doc/defines.texi
+         isisd/topology/Makefile
+         pkgsrc/bgpd.sh pkgsrc/ospf6d.sh pkgsrc/ospfd.sh
+         pkgsrc/ripd.sh pkgsrc/ripngd.sh pkgsrc/zebra.sh])
+AC_CONFIG_FILES([solaris/Makefile])
+
+AC_CONFIG_FILES([vtysh/extract.pl],[chmod +x vtysh/extract.pl])
+## Hack, but working solution to avoid rebuilding of quagga.info.
+## It's already in CVS until texinfo 4.7 is more common.
+AC_CONFIG_COMMANDS([info-time],[touch doc/quagga.info])
+AC_OUTPUT
 
 echo "
-zebra configuration
--------------------
-quagga version           : ${PACKAGE_VERSION}
+Quagga configuration
+--------------------
+quagga version          : ${PACKAGE_VERSION}
 host operationg system  : ${host_os}
 source code location    : ${srcdir}
 compiler                : ${CC}
 compiler flags          : ${CFLAGS}
+includes                : ${INCLUDES} ${SNMP_INCLUDES}
 linker flags            : ${LDFLAGS} ${LIBS}
 state file directory    : ${quagga_statedir}
 config file directory   : `eval echo \`echo ${sysconfdir}\``