]> git.proxmox.com Git - mirror_frr.git/blobdiff - configure.ac
2005-04-16 Paul Jakma <paul@dishone.st>
[mirror_frr.git] / configure.ac
index 8477401d0b17333ffe166ca75c46b9e0fab35bad..08b5214f98378822e4766836356ba6bb891d7c81 100755 (executable)
@@ -1,19 +1,49 @@
 ##
-## Configure template file for Zebra.
+## Configure template file for Quagga.
 ## autoconf will generate configure script.
 ##
 ##  Copyright (c) 1996, 97, 98, 99, 2000 Kunihiro Ishiguro <kunihiro@zebra.org>
+##  Portions Copyright (c) 2003 Paul Jakma <paul@dishone.st>
 ##
-AC_PREREQ(2.13)
+## $Id: configure.ac,v 1.103 2005/04/16 15:38:23 paul Exp $
+AC_PREREQ(2.53)
 
-AC_INIT(lib/zebra.h)
-AM_INIT_AUTOMAKE(zebra, 0.94)
-AM_CONFIG_HEADER(config.h)
+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_HOST
+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],
+         AC_HELP_STRING([--enable-exampledir],
+                        [specify alternate directory for examples]),
+                        exampledir="$enableval",)
+dnl XXX add --exampledir to autoconf standard directory list somehow
+AC_SUBST(exampledir)
+
+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
@@ -26,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)
@@ -52,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 version of zebra])
+[  --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,
@@ -71,6 +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,
+[  --enable-isisd          build isisd])
 AC_ARG_ENABLE(bgp-announce,
 [  --disable-bgp-announce, turn off BGP route announcement])
 AC_ARG_ENABLE(netlink,
@@ -81,11 +158,8 @@ AC_ARG_ENABLE(snmp,
 [  --enable-snmp           enable SNMP support])
 AC_ARG_WITH(libpam,
 [  --with-libpam           use libpam for PAM support in vtysh])
-AC_ARG_ENABLE(tcpsock,
+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,
@@ -98,9 +172,40 @@ AC_ARG_ENABLE(ospf-te,
 [  --enable-ospf-te        enable Traffic Engineering Extension to OSPF])
 AC_ARG_ENABLE(multipath,
 [  --enable-multipath=ARG  enable multipath function, ARG must be digit])
+AC_ARG_ENABLE(quagga_user,
+[  --enable-user=ARG       user to run Quagga suite as (default quagga)])
+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])
+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])
+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
 
-dnl AC_ARG_ENABLE(rtadv,
-dnl [  --enable-rtadv          enable IPV6 router advertisment option])
+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"
@@ -116,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
@@ -129,9 +230,59 @@ if test "${enable_ospf_te}" = "yes"; then
   AC_DEFINE(HAVE_OSPF_TE,,OSPF TE)
 fi
 
-dnl if test "${enable_rtadv}" = "yes"; then
-dnl   AC_DEFINE(HAVE_RTADV)
-dnl fi
+AC_MSG_CHECKING(if zebra should be configurable to send Route Advertisements)
+if test "${enable_rtadv}" != "no"; then
+  AC_MSG_RESULT(yes)
+  AC_DEFINE(HAVE_RTADV,,Enable IPv6 Routing Advertisement support)
+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
+
+if test "${enable_group}" = "yes" || test x"${enable_group}" = x""; then
+  enable_group="quagga"
+elif test "${enable_group}" = "no"; then
+  enable_group="root"
+fi
+
+if test x"${enable_vty_group}" = x"yes" ; then
+  AC_MSG_ERROR([--enable-vty-group requires a group as argument, not yes])
+elif test x"${enable_vty_group}" != x""; then
+  if test x"${enable_vty_group}" != x"no"; 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)
+
+enable_logfile_mask=${enable_logfile_mask:-0600}
+AC_DEFINE_UNQUOTED(LOGFILE_MASK, ${enable_logfile_mask}, Mask for log files)
 
 changequote(, )dnl
 
@@ -156,8 +307,17 @@ AC_SUBST(MULTIPATH_NUM)
 dnl -------------------
 dnl Check header files.
 dnl -------------------
-AC_STDC_HEADERS
-AC_CHECK_HEADERS(string.h stropts.h sys/conf.h sys/ksym.h sys/time.h sys/times.h sys/select.h sys/sysctl.h sys/sockio.h sys/types.h net/if_dl.h net/if_var.h linux/version.h kvm.h netdb.h netinet/in.h net/netopt.h netinet/in_var.h netinet/in6_var.h netinet/in6.h inet/nd.h asm/types.h netinet/icmp6.h netinet6/nd6.h libutil.h)
+AC_HEADER_STDC
+AC_CHECK_HEADERS([string.h stropts.h sys/conf.h sys/ksym.h sys/time.h \
+                 sys/times.h sys/select.h sys/sysctl.h sys/sockio.h \
+                 sys/types.h linux/version.h kvm.h netdb.h asm/types.h \
+                 libutil.h limits.h])
+
+AC_CHECK_HEADERS([sys/socket.h netinet/in_systm.h netinet/in.h \
+                net/if_dl.h net/netopt.h inet/nd.h net/route.h \
+                net/if.h net/if_var.h netinet/in_var.h])
+
+dnl V6 headers are checked below, after we check for v6
 
 dnl check some types
 AC_C_CONST
@@ -166,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)
   ;;
@@ -198,6 +373,10 @@ case "$host" in
       OTHER_METHOD="mtu_kvm.o"
       AC_CHECK_LIB(kvm, main)
   ;;
+  *-irix6.5)
+      opsys=irix
+      AC_DEFINE(IRIX_65,,IRIX 6.5)
+  ;;
 esac
 
 dnl ---------------------
@@ -206,16 +385,28 @@ 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
            AC_MSG_ERROR([readline is too old to have readline/history.h, please update to the latest readline library.])
         fi
-         ;;
+        AC_CHECK_LIB(readline, rl_completion_matches)
+         if test $ac_cv_lib_readline_rl_completion_matches = no; then
+           AC_DEFINE(rl_completion_matches,completion_matches,Old readline)
+        fi
+        ;;
   "no" ) VTYSH="";;
   *    ) ;;
 esac
@@ -223,6 +414,25 @@ esac
 dnl ----------
 dnl PAM module
 dnl ----------
+if test "$with_libpam" = "yes"; then
+  AC_CHECK_HEADER(security/pam_misc.h)
+  if test "$ac_cv_header_security_pam_misc_h" = yes; then
+    AC_DEFINE(HAVE_PAM_MISC_H,,Have pam_misc.h)
+    AC_DEFINE(PAM_CONV_FUNC,misc_conv,Have misc_conv)
+    pam_conv_func="misc_conv"
+  fi
+  AC_CHECK_HEADER(security/openpam.h)
+  if test "$ac_cv_header_security_openpam_h" = yes; then
+    AC_DEFINE(HAVE_OPENPAM_H,,Have openpam.h)
+    AC_DEFINE(PAM_CONV_FUNC,openpam_ttyconv,Have openpam_ttyconv)
+    pam_conv_func="openpam_ttyconv"
+  fi
+  if test -z "$ac_cv_header_security_pam_misc_h$ac_cv_header_security_openpam_h" ; then
+    AC_MSG_WARN([*** pam support will not be built ***])
+    with_libpam="no"
+  fi
+fi
+
 if test "$with_libpam" = "yes"; then
 dnl took this test from proftpd's configure.in and suited to our needs
 dnl -------------------------------------------------------------------------
@@ -232,7 +442,7 @@ dnl of the PAM library.  Prior to 0.72 release, the Linux PAM shared library
 dnl omitted requiring libdl linking information. PAM-0.72 or better ships
 dnl with RedHat 6.2 and Debian 2.2 or better.
 AC_CHECK_LIB(pam, pam_start,
-  [AC_CHECK_LIB(pam, misc_conv,
+  [AC_CHECK_LIB(pam, $pam_conv_func,
     [AC_DEFINE(USE_PAM,,Use PAM for authentication)
      LIBPAM="-lpam"],
     [AC_DEFINE(USE_PAM,,Use PAM for authentication)
@@ -241,10 +451,10 @@ AC_CHECK_LIB(pam, pam_start,
   ],
 
   [AC_CHECK_LIB(pam, pam_end,
-    [AC_CHECK_LIB(pam, misc_conv,
-      [AC_DEFINE(USE_PAM)
+    [AC_CHECK_LIB(pam, $pam_conv_func,
+      [AC_DEFINE(USE_PAM,,Use PAM for authentication)
        LIBPAM="-lpam -ldl"],
-      [AC_DEFINE(USE_PAM)
+      [AC_DEFINE(USE_PAM,,Use PAM for authentication)
        LIBPAM="-lpam -ldl -lpam_misc"]
      )
   ],AC_MSG_WARN([*** pam support will not be built ***]),
@@ -270,8 +480,17 @@ dnl AC_CHECK_SIZEOF(long)
 dnl ----------------------------
 dnl check existance of functions
 dnl ----------------------------
-AC_CHECK_FUNCS(bcopy bzero strerror inet_aton daemon snprintf vsnprintf strlcat strlcpy if_nametoindex if_indextoname getifaddrs)
-AC_CHECK_FUNCS(setproctitle, ,[AC_CHECK_LIB(util, setproctitle, [LIBS="$LIBS -lutil"; AC_DEFINE(HAVE_SETPROCTITLE)])])
+AC_CHECK_FUNCS(memset memcpy strerror inet_aton daemon snprintf vsnprintf \
+               strlcat strlcpy if_nametoindex if_indextoname getifaddrs \
+              fcntl strnlen)
+AC_CHECK_FUNCS(setproctitle, ,
+  [AC_CHECK_LIB(util, setproctitle, 
+     [LIBS="$LIBS -lutil"
+      AC_DEFINE(HAVE_SETPROCTITLE,, Have setproctitle)
+     ]
+   )
+  ]
+)
 
 dnl ------------------------------------
 dnl Determine routing get and set method
@@ -293,13 +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"
-  else
-    AC_TRY_RUN([#include <errno.h>
+  AC_TRY_RUN([#include <errno.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 
@@ -320,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 ------------------------------
@@ -341,8 +593,13 @@ done
 case $zebra_rtread in
   "/proc/net/route") RTREAD_METHOD="rtread_proc.o"
                      zebra_rtread="proc";;
-  "/dev/ip")         RTREAD_METHOD="rtread_getmsg.o"
-                     zebra_rtread="getmsg";;
+  "/dev/ip")
+                     case "$host" in
+                       *-freebsd*)    RTREAD_METHOD=rtread_sysctl.o
+                                      zebra_rtread="sysctl";;
+                       *)             RTREAD_METHOD="rtread_getmsg.o"
+                                      zebra_rtread="getmsg";;
+                     esac;;
   *)                 RTREAD_METHOD="rtread_sysctl.o"
                      zebra_rtread="sysctl";;
 esac
@@ -352,27 +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" = "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.
@@ -403,6 +667,8 @@ case $zebra_ipforward_path in
                      case "$host" in
                        *-nec-sysv4*)  IPFORWARD=ipforward_ews.o
                                       zebra_ipforward_path="ews";;
+                       *-freebsd*)    IPFORWARD=ipforward_sysctl.o
+                                      zebra_ipforward_path="sysctl";;
                        *)             IPFORWARD=ipforward_solaris.o
                                       zebra_ipforward_path="solaris";;
                      esac;;
@@ -423,94 +689,130 @@ else
 dnl ----------
 dnl INRIA IPv6
 dnl ----------
-if grep IPV6_INRIA_VERSION /usr/include/netinet/in.h >/dev/null 2>&1; then
-   zebra_cv_ipv6=yes
-   AC_DEFINE(HAVE_IPV6,,IPv6)
-   AC_DEFINE(INRIA_IPV6,,Inria IPv6)
-   RIPNGD="ripngd"
-   OSPF6D="ospf6d"
-   LIB_IPV6=""
-   AC_MSG_RESULT(INRIA IPv6)
-fi
+  if grep IPV6_INRIA_VERSION /usr/include/netinet/in.h >/dev/null 2>&1; then
+    zebra_cv_ipv6=yes
+    AC_DEFINE(HAVE_IPV6,1,INRIA IPv6)
+    AC_DEFINE(INRIA_IPV6,1,INRIA IPv6)
+    RIPNGD="ripngd"
+    OSPF6D="ospf6d"
+    LIB_IPV6=""
+    AC_MSG_RESULT(INRIA IPv6)
 dnl ---------
 dnl KAME IPv6
 dnl ---------
-if grep WIDE /usr/include/netinet6/in6.h >/dev/null 2>&1; then
-   zebra_cv_ipv6=yes
-   AC_DEFINE(HAVE_IPV6,,IPv6)
-   AC_DEFINE(KAME,,KAME IPv6)
-   RIPNGD="ripngd"
-   OSPF6D="ospf6d"
-   if test -d /usr/local/v6/lib -a -f /usr/local/v6/lib/libinet6.a; then
+  elif grep WIDE /usr/include/netinet6/in6.h >/dev/null 2>&1; then
+    zebra_cv_ipv6=yes
+    AC_DEFINE(HAVE_IPV6,1,KAME IPv6)
+    AC_DEFINE(KAME,1,KAME IPv6)
+    RIPNGD="ripngd"
+    OSPF6D="ospf6d"
+    if test -d /usr/local/v6/lib -a -f /usr/local/v6/lib/libinet6.a; then
       LIB_IPV6="-L/usr/local/v6/lib -linet6"
-   fi
-   AC_MSG_RESULT(KAME)
-fi
+    fi
+    AC_MSG_RESULT(KAME)
+dnl -------------------------
+dnl MUSICA IPv6
+dnl  default host check
+dnl  It is not used by Kheops
+dnl -------------------------
+  elif grep MUSICA /usr/include6/netinet6/in6.h >/dev/null 2>&1; then
+    zebra_cv_ipv6=yes
+    AC_DEFINE(HAVE_IPV6,1,Musicia IPv6)
+    AC_DEFINE(MUSICA,1,Musica IPv6 stack)
+    AC_DEFINE(KAME,1,KAME IPv6 stack)
+    RIPNGD="ripngd"
+    OSPF6D="ospf6d"
+    if test -d /usr/local/v6/lib -a -f /usr/local/v6/lib/libinet6.a; then
+      LIB_IPV6="-L/usr/local/v6/lib -linet6"
+    fi
+    AC_MSG_RESULT(MUSICA)
 dnl ---------
 dnl NRL check
 dnl ---------
-if grep NRL /usr/include/netinet6/in6.h >/dev/null 2>&1; then
-   zebra_cv_ipv6=yes
-   AC_DEFINE(HAVE_IPV6,,IPv6)
-   AC_DEFINE(NRL,,NRL)
-   RIPNGD="ripngd"
-   OSPF6D="ospf6d"
-   if test x"$opsys" = x"bsdi";then
+  elif grep NRL /usr/include/netinet6/in6.h >/dev/null 2>&1; then
+    zebra_cv_ipv6=yes
+    AC_DEFINE(HAVE_IPV6,1,NRL IPv6)
+    AC_DEFINE(NRL,1,NRL)
+    RIPNGD="ripngd"
+    OSPF6D="ospf6d"
+    if test x"$opsys" = x"bsdi";then
       AC_DEFINE(BSDI_NRL,,BSDI)
       AC_MSG_RESULT(BSDI_NRL)
-   else
+    else
       AC_MSG_RESULT(NRL)
-   fi
-fi
-
+    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 ----------
-if test "${enable_ipv6}" = "yes"; then
-   AC_EGREP_CPP(yes, [
-   #include <linux/version.h>
-   /* 2.1.128 or later */
-   #if LINUX_VERSION_CODE >= 0x020180
-   yes
-   #endif],
-   [zebra_cv_ipv6=yes; zebra_cv_linux_ipv6=yes;AC_MSG_RESULT(Linux IPv6)])
-else
-   if test x`ls /proc/net/ipv6_route 2>/dev/null` = x"/proc/net/ipv6_route"
-   then
+  elif test "${enable_ipv6}" = "yes"; then
+    AC_EGREP_CPP(yes, [
+      #include <linux/version.h>
+      /* 2.1.128 or later */
+      #if LINUX_VERSION_CODE >= 0x020180
+      yes
+      #endif],
+      [zebra_cv_ipv6=yes
+       zebra_cv_linux_ipv6=yes
+       AC_MSG_RESULT(Linux IPv6)])
+  else
+    if test x`ls /proc/net/ipv6_route 2>/dev/null` = x"/proc/net/ipv6_route"
+     then
       zebra_cv_ipv6=yes
       zebra_cv_linux_ipv6=yes
       AC_MSG_RESULT(Linux IPv6)
-   fi
-fi
+    fi
+  fi
 
-if test "$zebra_cv_linux_ipv6" = "yes";then
-   AC_DEFINE(HAVE_IPV6)
-   AC_MSG_CHECKING(for GNU libc 2.1)
-   AC_EGREP_CPP(yes, [
+  if test "$zebra_cv_linux_ipv6" = "yes";then
+    AC_MSG_CHECKING(for GNU libc >= 2.1)
+    AC_DEFINE(HAVE_IPV6,1,Linux IPv6)
+    AC_EGREP_CPP(yes, [
 #include <features.h>
 #if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
   yes
-#endif], [glibc=yes; AC_MSG_RESULT(yes)], AC_MSG_RESULT(no))
-   AC_DEFINE(LINUX_IPV6,,Linux IPv6)   
-   RIPNGD="ripngd"
-   OSPF6D="ospf6d"
-   if test "$glibc" != "yes"; then
+#endif], 
+      [glibc=yes
+       AC_DEFINE(LINUX_IPV6,1,Linux IPv6 stack)
+       AC_MSG_RESULT(yes)], 
+      AC_MSG_RESULT(no)
+    )
+    RIPNGD="ripngd"
+    OSPF6D="ospf6d"
+    if test "$glibc" != "yes"; then
       INCLUDES="-I/usr/inet6/include"
       if test x`ls /usr/inet6/lib/libinet6.a 2>/dev/null` != x;then
          LIB_IPV6="-L/usr/inet6/lib -linet6"
       fi
-   fi
-fi
+    fi
+  fi
 
 dnl -----------------------
 dnl Set IPv6 related values
 dnl -----------------------
-LIBS="$LIB_IPV6 $LIBS"
-AC_SUBST(LIB_IPV6)
+  LIBS="$LIB_IPV6 $LIBS"
+  AC_SUBST(LIB_IPV6)
 
-if test x"$RIPNGD" = x""; then
-  AC_MSG_RESULT(IPv4 only)
+  if test x"$RIPNGD" = x""; then
+    AC_MSG_RESULT(IPv4 only)
+  fi
 fi
+
+dnl ------------------
+dnl IPv6 header checks
+dnl ------------------
+if test "x${zebra_cv_ipv6}" = "xyes"; then
+AC_CHECK_HEADERS([netinet6/in6.h netinet/in6_var.h netinet/icmp6.h \
+                netinet6/in6_var.h netinet6/nd6.h])
 fi
 
 dnl --------------------
@@ -540,11 +842,16 @@ else
   OSPFD="ospfd"
 fi
 
-OSPFAPI=""
+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
-    OSPFAPI="-DSUPPORT_OSPF_API"
+    AC_DEFINE(SUPPORT_OSPF_API,,OSPFAPI)
 
     if test "${enable_ospfclient}" != "no";then
       OSPFCLIENT="ospfclient"
@@ -565,6 +872,12 @@ case "${enable_ospf6d}" in
   *    ) ;;
 esac
 
+case "${enable_isisd}" in
+  "yes") ISISD="isisd";;
+  "no" ) ISISD="";;
+  *    ) ;;
+esac
+
 if test "${enable_bgp_announce}" = "no";then
   AC_DEFINE(DISABLE_BGP_ANNOUNCE,,Disable BGP installation to zebra)
 fi
@@ -575,6 +888,8 @@ AC_SUBST(RIPD)
 AC_SUBST(RIPNGD)
 AC_SUBST(OSPFD)
 AC_SUBST(OSPF6D)
+AC_SUBST(WATCHQUAGGA)
+AC_SUBST(ISISD)
 AC_SUBST(VTYSH)
 AC_SUBST(INCLUDES)
 AC_SUBST(CURSES)
@@ -589,9 +904,9 @@ AC_CHECK_LIB(m, main)
 dnl ---------------------------------------------------
 dnl BSD/OS 4.1 define inet_XtoY function as __inet_XtoY
 dnl ---------------------------------------------------
-AC_CHECK_FUNC(__inet_ntop, AC_DEFINE(HAVE_INET_NTOP))
-AC_CHECK_FUNC(__inet_pton, AC_DEFINE(HAVE_INET_PTON))
-AC_CHECK_FUNC(__inet_aton, AC_DEFINE(HAVE_INET_ATON))
+AC_CHECK_FUNC(__inet_ntop, AC_DEFINE(HAVE_INET_NTOP,,__inet_ntop))
+AC_CHECK_FUNC(__inet_pton, AC_DEFINE(HAVE_INET_PTON,,__inet_pton))
+AC_CHECK_FUNC(__inet_aton, AC_DEFINE(HAVE_INET_ATON,,__inet_aton))
 
 dnl ---------------------------
 dnl check system has GNU regexp
@@ -661,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
@@ -670,14 +985,21 @@ 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)
+               SNMP_INCLUDES="${SNMP_INCLUDES} -I/usr/local/include/net-snmp"
+               LIBS="${LIBS} -L/usr/local/lib -lnetsnmp"
+               ;;
     esac
     if test "${NEED_CRYPTO}" = "yes"; then
       LIBS="${LIBS} -lcrypto"
@@ -685,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 ----------------------------
@@ -766,13 +1094,24 @@ net/if.h,
 dnl ----------------------------
 dnl check structure in6_aliasreq
 dnl ----------------------------
-AC_MSG_CHECKING(whether struct if6_aliasreq exist)
+AC_MSG_CHECKING(whether struct in6_aliasreq exist)
 AC_EGREP_HEADER(in6_aliasreq,
 netinet6/in6_var.h,
 [AC_MSG_RESULT(yes)
  AC_DEFINE(HAVE_IN6_ALIASREQ,,in6_aliasreq)],
  AC_MSG_RESULT(no))
 
+dnl -----------------------------------
+dnl check ifra_lifetime of in6_aliasreq
+dnl -----------------------------------
+AC_MSG_CHECKING(whether in6_aliasreq.ifra_lifetime exist)
+AC_TRY_COMPILE([#include <sys/types.h>
+#include <netinet6/in6_var.h>
+],[static struct if6_aliasreq ac_i;int ac_j = sizeof (ac_i.ifra_lifetime);],
+[AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_IFRA_LIFETIME,,Have in6_aliasreq.ifra_lifetime)],
+ AC_MSG_RESULT(no))
+
 dnl ---------------------------
 dnl check structure rt_addrinfo
 dnl ---------------------------
@@ -793,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 --------------------------------------
@@ -803,35 +1172,109 @@ AC_TRY_COMPILE([#include <sys/resource.h>
  AC_DEFINE(HAVE_RUSAGE,,rusage)],
  AC_MSG_RESULT(no))
 
-dnl -------------
-dnl check version
-dnl -------------
-file="${srcdir}/lib/version.h"
-VERSION=`sed -ne 's/^#.*ZEBRA_VERSION.*\"\([^\"]*\)\"$/\1/p' $file`
-AC_SUBST(VERSION)
+dnl -------------------
+dnl capabilities checks
+dnl -------------------
+if test "${enable_capabilities}" != "no"; then
+  AC_MSG_CHECKING(whether prctl PR_SET_KEEPCAPS is available)
+  AC_TRY_COMPILE([#include <sys/prctl.h>],[prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0);],
+    [AC_MSG_RESULT(yes)
+     AC_DEFINE(HAVE_PR_SET_KEEPCAPS,,prctl)
+     quagga_ac_keepcaps="yes"],
+     AC_MSG_RESULT(no)
+  )
+  if test x"${quagga_ac_keepcaps}" = x"yes"; then
+    AC_CHECK_HEADERS(sys/capability.h)
+  fi
+  if test x"${ac_cv_header_sys_capability_h}" = x"yes"; then
+    AC_CHECK_LIB(cap, cap_init, 
+      [AC_DEFINE(HAVE_LCAPS,1,Capabilities)
+       LIBCAP="-lcap"
+      ]
+    )
+  fi
+fi
+AC_SUBST(LIBCAP)
+
+dnl -------------------
+dnl test for ucontext.h
+dnl -------------------
+AC_CHECK_HEADERS(ucontext.h)
+
+dnl ---------------------------
+dnl check for glibc 'backtrace'
+dnl --------------------------- 
+if test "${glibc}" = "yes"; then
+   AC_CHECK_HEADER(execinfo.h)
+fi
+if test x"${ac_cv_header_execinfo_h}" = x"yes"; then
+  AC_CHECK_FUNC(backtrace,
+    [AC_DEFINE(HAVE_GLIBC_BACKTRACE,,Glibc backtrace)]
+  )
+fi
+
+dnl ----------
+dnl configure date
+dnl ----------
+CONFDATE=`date '+%Y%m%d'`
+AC_SUBST(CONFDATE)
 
 dnl ------------------------------
-dnl set paths for process id files
+dnl set paths for state directory
 dnl ------------------------------
-AC_CACHE_CHECK(pid file directory,ac_piddir,
-[for ZEBRA_PID_DIR in /var/run dnl
-                   /var/adm    dnl
-                   /etc                dnl
-                   /dev/null;
-do
-  test -d $ZEBRA_PID_DIR && break
-done
-ac_piddir=$ZEBRA_PID_DIR
-if test $ZEBRA_PID_DIR = "/dev/null"; then
-  echo "PID DIRECTORY NOT FOUND!"
-fi])
-AC_DEFINE_UNQUOTED(PATH_ZEBRA_PID, "$ac_piddir/zebra.pid",zebra PID)
-AC_DEFINE_UNQUOTED(PATH_RIPD_PID, "$ac_piddir/ripd.pid",ripd PID)
-AC_DEFINE_UNQUOTED(PATH_RIPNGD_PID, "$ac_piddir/ripngd.pid",ripngd PID)
-AC_DEFINE_UNQUOTED(PATH_BGPD_PID, "$ac_piddir/bgpd.pid",bgpd PID)
-AC_DEFINE_UNQUOTED(PATH_OSPFD_PID, "$ac_piddir/ospfd.pid",ospfd PID)
-AC_DEFINE_UNQUOTED(PATH_OSPF6D_PID, "$ac_piddir/ospf6d.pid",ospf6d PID)
+if test "${prefix}" = "NONE"; then
+  quagga_statedir_prefix="";
+else
+  quagga_statedir_prefix=${prefix}
+fi
+if test "${localstatedir}" = '${prefix}/var'; then
+  AC_CACHE_CHECK(state directory,ac_statedir,
+  [for QUAGGA_STATE_DIR in ${quagga_statedir_prefix}/var/run dnl
+                       ${quagga_statedir_prefix}/var/adm dnl
+                       ${quagga_statedir_prefix}/etc dnl
+                       /var/run        dnl
+                        /var/adm       dnl
+                        /etc           dnl
+                        /dev/null;
+  do
+    test -d $QUAGGA_STATE_DIR && break
+  done
+  quagga_statedir=$QUAGGA_STATE_DIR])
+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!')
+fi
+
+AC_DEFINE_UNQUOTED(PATH_ZEBRA_PID, "$quagga_statedir/zebra.pid",zebra PID)
+AC_DEFINE_UNQUOTED(PATH_RIPD_PID, "$quagga_statedir/ripd.pid",ripd PID)
+AC_DEFINE_UNQUOTED(PATH_RIPNGD_PID, "$quagga_statedir/ripngd.pid",ripngd PID)
+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)
+AC_DEFINE_UNQUOTED(RIPNG_VTYSH_PATH, "$quagga_statedir/ripngd.vty",ripng vty socket)
+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
@@ -852,15 +1295,44 @@ 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 ospf6d/Makefile vtysh/Makefile doc/Makefile ospfclient/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 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
--------------------
-zebra version           : ${VERSION}
+Quagga configuration
+--------------------
+quagga version          : ${PACKAGE_VERSION}
 host operationg system  : ${host_os}
 source code location    : ${srcdir}
 compiler                : ${CC}
 compiler flags          : ${CFLAGS}
-directory for pid files : ${ac_piddir}
+includes                : ${INCLUDES} ${SNMP_INCLUDES}
+linker flags            : ${LDFLAGS} ${LIBS}
+state file directory    : ${quagga_statedir}
+config file directory   : `eval echo \`echo ${sysconfdir}\``
+example directory       : `eval echo \`echo ${exampledir}\``
+user to run as         : ${enable_user}
+group to run as                : ${enable_group}
+group for vty sockets  : ${enable_vty_group}
+config file mask        : ${enable_configfile_mask}
+log file mask           : ${enable_logfile_mask}
+
+The above user and group must have read/write access to the state file
+directory and to the config files in the config file directory.
 "