]> git.proxmox.com Git - mirror_frr.git/blobdiff - configure.ac
build: non-recursive ripd & ripngd
[mirror_frr.git] / configure.ac
index 65ba26d5f85bd41b55415fa7a760b42f213158f5..243b18d0f9e0952abf127360010c2fb8fe839ddf 100755 (executable)
@@ -23,7 +23,36 @@ dnl Get hostname and other information.
 dnl -----------------------------------
 AC_CANONICAL_BUILD()
 AC_CANONICAL_HOST()
-AC_CANONICAL_TARGET()
+
+AS_IF([test "$host" != "$build"], [
+  if test "$srcdir" = "."; then
+    AC_MSG_ERROR([cross-compilation is only possible with builddir separate from srcdir.  create a separate directory and run as .../path-to-frr/configure.])
+  fi
+  test -d hosttools || mkdir hosttools
+  abssrc="`cd \"${srcdir}\"; pwd`"
+
+  AC_MSG_NOTICE([...])
+  AC_MSG_NOTICE([... cross-compilation: creating hosttools directory and self-configuring for build platform tools])
+  AC_MSG_NOTICE([... use HOST_CPPFLAGS / HOST_CFLAGS / HOST_LDFLAGS if neccessary])
+  AC_MSG_NOTICE([...])
+
+  ( CPPFLAGS="$HOST_CPPFLAGS"; \
+    CFLAGS="$HOST_CFLAGS"; \
+    LDFLAGS="$HOST_LDFLAGS"; \
+    cd hosttools; "${abssrc}/configure" "--host=$build" "--build=$build"; )
+
+  AC_MSG_NOTICE([...])
+  AC_MSG_NOTICE([... cross-compilation: finished self-configuring for build platform tools])
+  AC_MSG_NOTICE([...])
+
+  build_clippy="false"
+  HOSTTOOLS="hosttools/"
+], [
+  build_clippy="true"
+  HOSTTOOLS=""
+])
+AC_SUBST(HOSTTOOLS)
+AM_CONDITIONAL([BUILD_CLIPPY], [$build_clippy])
 
 # Disable portability warnings -- our automake code (in particular
 # common.am) uses some constructs specific to gmake.
@@ -46,14 +75,13 @@ AC_SUBST(exampledir)
 
 dnl default is to match previous behavior
 pkgsrcrcdir=""
-pkgsrcdir=""
 AC_ARG_ENABLE([pkgsrcrcdir],
          AS_HELP_STRING([--enable-pkgsrcrcdir],
                         [specify directory for rc.d scripts]),
-                        pkgsrcrcdir="$enableval"; pkgsrcdir="pkgsrc",)
+                        pkgsrcrcdir="$enableval",)
 dnl XXX add --pkgsrcrcdir to autoconf standard directory list somehow
-AC_SUBST(pkgsrcdir)
 AC_SUBST(pkgsrcrcdir)
+AM_CONDITIONAL([PKGSRC], [test "x$pkgsrcrcdir" != "x"])
 
 AC_ARG_WITH([moduledir], [AS_HELP_STRING([--with-moduledir=DIR], [module directory (${libdir}/frr/modules)])], [
        moduledir="$withval"
@@ -98,7 +126,7 @@ dnl autoconf 2.59 appears not to support AC_PROG_SED
 dnl AC_PROG_SED
 AC_CHECK_PROG([SED],[sed],[sed],[/bin/false])
 
-dnl try and enable CFLAGS that are useful for Quagga
+dnl try and enable CFLAGS that are useful for FRR
 dnl - specifically, options to control warnings
 
 AC_USE_SYSTEM_EXTENSIONS
@@ -123,6 +151,28 @@ AC_DEFUN([AC_C_FLAG], [{
        AC_LANG_POP(C)
        }])
 
+AC_DEFUN([AC_LINK_IFELSE_FLAGS], [{
+       AC_LANG_PUSH(C)
+       ac_cflags_save="$CFLAGS"
+       ac_libs_save="$LIBS"
+       CFLAGS="$CFLAGS $1"
+       LIBS="$LIBS $2"
+       AC_LINK_IFELSE(
+               [$3],
+               [
+                       AC_MSG_RESULT([yes])
+                       CFLAGS="$ac_cflags_save"
+                       LIBS="$ac_libs_save"
+                       $5
+               ], [
+                       AC_MSG_RESULT([no])
+                       CFLAGS="$ac_cflags_save"
+                       LIBS="$ac_libs_save"
+                       $4
+               ])
+       AC_LANG_POP(C)
+       }])
+
 dnl ICC won't bail on unknown options without -diag-error 10006
 dnl need to do this first so we get useful results for the other options
 AC_C_FLAG([-diag-error 10006])
@@ -198,7 +248,7 @@ AX_PTHREAD([
   CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
   LIBS="$PTHREAD_LIBS $LIBS"
 ], [
-  AC_MSG_FAILURE([This Quagga version needs pthreads])
+  AC_MSG_FAILURE([This FRR version needs pthreads])
 ])
 
 dnl --------------
@@ -232,7 +282,7 @@ AC_ARG_WITH(vtysh_pager,
        AS_HELP_STRING([--with-vtysh-pager=PAGER], [control what pager is compiled in as default]),
        VTYSH_PAGER=$withval, VTYSH_PAGER="more")
 AC_ARG_ENABLE(vtysh,
-  AS_HELP_STRING([--disable-vtysh], [do not build integrated vty shell for Quagga]))
+  AS_HELP_STRING([--disable-vtysh], [do not build integrated vty shell for FRR]))
 AC_ARG_ENABLE(doc,
   AS_HELP_STRING([--disable-doc], [do not build docs]))
 AC_ARG_ENABLE(zebra,
@@ -328,7 +378,7 @@ AC_ARG_ENABLE([oldvpn_commands],
   AS_HELP_STRING([--enable-oldvpn-commands], [Keep old vpn commands]))
 
 AC_CHECK_HEADERS(json-c/json.h)
-AC_CHECK_LIB(json-c, json_object_get, LIBS="$LIBS -ljson-c")
+AC_CHECK_LIB(json-c, json_object_get, LIBS="$LIBS -ljson-c", [], [-lm])
 if test $ac_cv_lib_json_c_json_object_get = no; then
   AC_CHECK_LIB(json, json_object_get, LIBS="$LIBS -ljson")
   if test $ac_cv_lib_json_json_object_get = no; then
@@ -364,26 +414,6 @@ if test "${enable_rr_semantics}" != "no" ; then
   AC_DEFINE(HAVE_V6_RR_SEMANTICS,, Compile in v6 Route Replacement Semantics)
 fi
 
-dnl ----------
-dnl MPLS check
-dnl ----------
-AC_MSG_CHECKING(whether this OS has MPLS stack)
-case "$host" in
-  *-linux*)
-      MPLS_METHOD="zebra_mpls_netlink.o"
-      AC_MSG_RESULT(Linux MPLS)
-  ;;
-  *-openbsd*)
-      MPLS_METHOD="zebra_mpls_openbsd.o"
-      AC_MSG_RESULT(OpenBSD MPLS)
-  ;;
-  *)
-      MPLS_METHOD="zebra_mpls_null.o"
-      AC_MSG_RESULT(Unsupported kernel)
-  ;;
-esac
-AC_SUBST(MPLS_METHOD)
-
 if test "${enable_datacenter}" = "yes" ; then
   AC_DEFINE(HAVE_DATACENTER,,Compile extensions for a DataCenter)
   DFLT_NAME="datacenter"
@@ -409,6 +439,77 @@ if test "x${enable_dev_build}" = "xyes"; then
 fi
 AM_CONDITIONAL([DEV_BUILD], [test "x$enable_dev_build" = "xyes"])
 
+#
+# Python for clippy
+#
+AS_IF([test "$host" = "$build"], [
+  PYTHONCONFIG=""
+
+  # ordering:
+  # 1.  try python3, but respect the user's preference on which minor ver
+  # 2.  try python, which might be py3 or py2 again on the user's preference
+  # 3.  try python2 (can really only be 2.7 but eh)
+  # 4.  try 3.5 > 3.4 > 3.3 > 3.2 > 2.7 through pkg-config (no user pref)
+  #
+  # (AX_PYTHON_DEVEL has no clue about py3 vs py2)
+  # (AX_PYTHON does not do what we need)
+
+  AC_CHECK_TOOLS([PYTHONCONFIG], [python3-config python-config python2-config])
+  if test -n "$PYTHONCONFIG"; then
+    PYTHON_CFLAGS="`\"${PYTHONCONFIG}\" --includes`"
+    PYTHON_LIBS="`\"${PYTHONCONFIG}\" --libs`"
+
+    AC_MSG_CHECKING([whether we found a working Python version])
+    AC_LINK_IFELSE_FLAGS([$PYTHON_CFLAGS], [$PYTHON_LIBS], [AC_LANG_PROGRAM([
+#include <Python.h>
+#if PY_VERSION_HEX < 0x02070000
+#error python too old
+#endif
+int main(void);
+],
+[
+{
+  Py_Initialize();
+  return 0;
+}
+])], [
+      PYTHONCONFIG=""
+      unset PYTHON_LIBS
+      unset PYTHON_CFLAGS
+    ])
+  fi
+
+  if test -z "$PYTHONCONFIG"; then
+    PKG_CHECK_MODULES([PYTHON], python-3.5, [], [
+      PKG_CHECK_MODULES([PYTHON], python-3.4, [], [
+        PKG_CHECK_MODULES([PYTHON], python-3.3, [], [
+          PKG_CHECK_MODULES([PYTHON], python-3.2, [], [
+            PKG_CHECK_MODULES([PYTHON], python-2.7, [], [
+              AC_MSG_FAILURE([could not find python-config or pkg-config python, please install Python development files from libpython-dev or similar])
+              ])])])])])
+
+
+    AC_MSG_CHECKING([whether we found a working Python version])
+    AC_LINK_IFELSE_FLAGS([$PYTHON_CFLAGS], [$PYTHON_LIBS], [AC_LANG_PROGRAM([
+#include <Python.h>
+#if PY_VERSION_HEX < 0x02070000
+#error python too old
+#endif
+int main(void);
+],
+[
+{
+  Py_Initialize();
+  return 0;
+}
+])], [
+      AC_MSG_FAILURE([could not find python-config or pkg-config python, please install Python development files from libpython-dev or similar])
+    ])
+  fi
+])
+AC_SUBST(PYTHON_CFLAGS)
+AC_SUBST(PYTHON_LIBS)
+
 #
 # Logic for protobuf support.
 #
@@ -728,50 +829,62 @@ FRR_INCLUDES
 
 dnl V6 headers are checked below, after we check for v6
 
-dnl Some systems (Solaris 2.x) require libnsl (Network Services Library)
-case "$host" in
-  [*-sunos5.[6-7]*] | [*-solaris2.[6-7]*])
-      opsys=sol2-6
-      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
-      SOLARIS="solaris"
-  ;;
-  [*-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, 1, [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)
-      AC_CHECK_FUNCS([printstack],
-       [AC_DEFINE([HAVE_PRINTSTACK],1,[Solaris printstack])
-        AC_DEFINE([HAVE_STACK_TRACE],1,[Stack symbols decode functionality])
-       ])
-      CURSES=-lcurses
-      SOLARIS="solaris"
-  ;;
-  *-sunos5* | *-solaris2*)
-      AC_DEFINE(SUNOS_5,,SunOS 5, Unknown SunOS)
-      AC_CHECK_LIB(socket, main)
-      AC_CHECK_LIB(nsl, main)
-      CURSES=-lcurses
-      SOLARIS="solaris"
-  ;;
-  *-linux*)
-      opsys=gnu-linux
-      AC_DEFINE(GNU_LINUX,,GNU Linux)
-  ;;
-  *-openbsd*)
-      opsys=openbsd
-      AC_DEFINE(OPEN_BSD,,OpenBSD)
-  ;;
+AC_MSG_CHECKING([which operating system interface to use])
+case "$host_os" in
+  sunos* | solaris2*)
+    AC_MSG_RESULT([Solaris])
+
+    AC_DEFINE(SUNOS_5, 1, [SunOS 5])
+    AC_DEFINE(SOLARIS_IPV6, 1, Solaris IPv6)
+
+    AC_CHECK_LIB(socket, main)
+    AC_CHECK_LIB(nsl, main)
+    AC_CHECK_LIB(umem, main)
+    AC_CHECK_FUNCS([printstack], [
+      AC_DEFINE([HAVE_PRINTSTACK],1,[Solaris printstack])
+      AC_DEFINE([HAVE_STACK_TRACE],1,[Stack symbols decode functionality])
+    ])
+    CURSES=-lcurses
+    SOLARIS="solaris"
+    ;;
+  linux*)
+    AC_MSG_RESULT([Linux])
+
+    AC_DEFINE(GNU_LINUX,,GNU Linux)
+    AC_DEFINE(HAVE_NETLINK,,netlink)
+    AC_DEFINE(LINUX_IPV6,1,Linux IPv6 stack)
+
+    dnl Linux has a compilation problem with mixing
+    dnl netinet/in.h and linux/in6.h they are not
+    dnl compatible.  There has been discussion on
+    dnl how to fix it but no real progress on implementation
+    dnl when they fix it, remove this
+    AC_DEFINE(IPV6_MINHOPCOUNT, 73, Linux ipv6 Min Hop Count)
+
+    AC_CHECK_DECLS([IFLA_INFO_SLAVE_KIND], [], [], [#include <linux/if_link.h>])
+    ;;
+  openbsd*)
+    AC_MSG_RESULT([OpenBSD])
+
+    AC_DEFINE(OPEN_BSD,,OpenBSD)
+    AC_DEFINE(KAME,1,KAME IPv6)
+
+    if test "x${enable_pimd}" != "xno"; then
+      case "$host_os" in
+      openbsd6.0)
+        ;;
+      openbsd[6-9]*)
+        AC_MSG_FAILURE([pimd cannot be enabled as PIM support has been removed from OpenBSD 6.1])
+        ;;
+      esac
+    fi
+    ;;
+  *)
+    AC_MSG_RESULT([BSD])
+
+    AC_DEFINE(HAVE_NET_RT_IFLIST,,NET_RT_IFLIST)
+    AC_DEFINE(KAME,1,KAME IPv6)
+    ;;
 esac
 
 AC_SYS_LARGEFILE
@@ -817,7 +930,7 @@ AM_CONDITIONAL(VTYSH, test "x$VTYSH" = "xvtysh")
 dnl ----------
 dnl PAM module
 dnl
-dnl Quagga detects the PAM library it is built against by checking for a
+dnl FRR detects the PAM library it is built against by checking for a
 dnl functional pam_misc.h (Linux-PAM) or openpam.h (OpenPAM) header. pam_misc.h
 dnl is known to #include pam_appl.h, the standard header of a PAM library, and
 dnl openpam.h doesn't do that, although depends on the header too. Hence a
@@ -927,26 +1040,6 @@ AC_CHECK_HEADER([asm-generic/unistd.h],
                  AC_CHECK_FUNCS(setns)]
                )
 
-dnl ------------------------------------
-dnl Determine routing get and set method
-dnl ------------------------------------
-AC_MSG_CHECKING(zebra between kernel interface method)
-if test x"$opsys" = x"gnu-linux"; then
-  AC_MSG_RESULT(netlink)
-  RT_METHOD=rt_netlink.o
-  KERNEL_METHOD=kernel_netlink.o
-  AC_DEFINE(HAVE_NETLINK,,netlink)
-  netlink=yes
-  AC_CHECK_DECLS([IFLA_INFO_SLAVE_KIND], [], [], [#include <linux/if_link.h>])
-else
-  AC_MSG_RESULT(Route socket)
-  KERNEL_METHOD="kernel_socket.o"
-  RT_METHOD="rt_socket.o"
-fi
-AC_SUBST(RT_METHOD)
-AC_SUBST(KERNEL_METHOD)
-AM_CONDITIONAL([HAVE_NETLINK], [test "x$netlink" = "xyes"])
-
 dnl --------------------------
 dnl Determine IS-IS I/O method
 dnl --------------------------
@@ -956,27 +1049,32 @@ AC_DEFINE(ISIS_METHOD_BPF,       3, [ constant value for isis method bpf ])
 AC_CHECK_HEADER(net/bpf.h)
 AC_CHECK_HEADER(sys/dlpi.h)
 AC_MSG_CHECKING(zebra IS-IS I/O method)
-if test x"$opsys" = x"gnu-linux"; then
-  AC_MSG_RESULT(pfpacket)
-  ISIS_METHOD_MACRO="ISIS_METHOD_PFPACKET"
-elif test x"$opsys" = x"sol2-6" -o x"$opsys" = x"sol8"; then
-  AC_MSG_RESULT(DLPI)
-  ISIS_METHOD_MACRO="ISIS_METHOD_DLPI"
-else
-  if test $ac_cv_header_net_bpf_h = no; then
-    if test $ac_cv_header_sys_dlpi_h = no; then
-      AC_MSG_RESULT(none)
-      AC_MSG_WARN([*** IS-IS support will not be built ***])
-      ISISD=""
+
+case "$host_os" in
+  linux*)
+    AC_MSG_RESULT(pfpacket)
+    ISIS_METHOD_MACRO="ISIS_METHOD_PFPACKET"
+    ;;
+  solaris* | sunos*)
+    AC_MSG_RESULT(DLPI)
+    ISIS_METHOD_MACRO="ISIS_METHOD_DLPI"
+    ;;
+  *)
+    if test $ac_cv_header_net_bpf_h = no; then
+      if test $ac_cv_header_sys_dlpi_h = no; then
+        AC_MSG_RESULT(none)
+        AC_MSG_WARN([*** IS-IS support will not be built ***])
+        ISISD=""
+      else
+        AC_MSG_RESULT(DLPI)
+      fi
+      ISIS_METHOD_MACRO="ISIS_METHOD_DLPI"
     else
-      AC_MSG_RESULT(DLPI)
+      AC_MSG_RESULT(BPF)
+      ISIS_METHOD_MACRO="ISIS_METHOD_BPF"
     fi
-    ISIS_METHOD_MACRO="ISIS_METHOD_DLPI"
-  else
-    AC_MSG_RESULT(BPF)
-    ISIS_METHOD_MACRO="ISIS_METHOD_BPF"
-  fi
-fi
+    ;;
+esac
 AC_DEFINE_UNQUOTED(ISIS_METHOD, $ISIS_METHOD_MACRO, [ selected method for isis, == one of the constants ])
 
 dnl ------------------------------------
@@ -1006,59 +1104,6 @@ main()
 }]])],[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 ------------------------------
-AC_CACHE_CHECK([route read method], [frr_cv_rtread_method],
-[if test "x$netlink" = xyes; then
-  frr_cv_rtread_method="netlink"
-else
-for frr_cv_rtread_method in /dev/ip /dev/null;
-do
-  test x`ls $frr_cv_rtread_method 2>/dev/null` = x"$frr_cv_rtread_method" && break
-done
-case $frr_cv_rtread_method in
-  "/dev/ip")
-                     case "$host" in
-                       *-freebsd*)    frr_cv_rtread_method="sysctl";;
-                       *)             frr_cv_rtread_method="getmsg";;
-                     esac;;
-       *)
-                     frr_cv_rtread_method="sysctl";;
-esac
-fi])
-RTREAD_METHOD=rtread_${frr_cv_rtread_method}.o
-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
-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" = "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
-    AC_MSG_RESULT(ioctl)
-    IF_METHOD=if_ioctl.o
-fi
-AC_SUBST(IF_METHOD)
-AC_SUBST(IOCTL_METHOD)
-
 dnl ---------------------------------------------------------------
 dnl figure out how to specify an interface in multicast sockets API
 dnl ---------------------------------------------------------------
@@ -1154,71 +1199,11 @@ if test $ac_cv_have_decl_TCP_MD5SIG = no; then
        AC_CHECK_DECLS([TCP_MD5SIG], [], [], MD5_INCLUDES)])
 fi
 
-dnl -----------------------------
-dnl check ipforward detect method
-dnl -----------------------------
-AC_CACHE_CHECK([ipforward method], [frr_cv_ipforward_method],
-[if test x$cross_compiling = xyes; then
-  if test x"$opsys" = x"gnu-linux"; then
-    frr_cv_ipforward_method=/proc/net/snmp
-  else
-    frr_cv_ipforward_method=/dev/ip
-  fi
-else
-  for frr_cv_ipforward_method in /proc/net/snmp /dev/ip /dev/null;
-  do
-    test x`ls $frr_cv_ipforward_method 2>/dev/null` = x"$frr_cv_ipforward_method" && break
-  done
-fi
-case $frr_cv_ipforward_method in
-  "/proc/net/snmp")  frr_cv_ipforward_method="proc";;
-  "/dev/ip")         
-                     case "$host" in
-                       *-freebsd*)    frr_cv_ipforward_method="sysctl";;
-                       *)             frr_cv_ipforward_method="solaris";;
-                     esac;;
-  *)                 frr_cv_ipforward_method="sysctl";;
-esac])
-IPFORWARD=ipforward_${frr_cv_ipforward_method}.o
-AC_SUBST(IPFORWARD)
-
 dnl ----------------------------------------------------------------------------
 dnl figure out if domainname is available in the utsname struct (GNU extension).
 dnl ----------------------------------------------------------------------------
 AC_CHECK_MEMBERS([struct utsname.domainname], [], [], [#include <sys/utsname.h>])
 
-dnl ----------
-dnl IPv6 check
-dnl ----------
-AC_MSG_CHECKING(whether does this OS have IPv6 stack)
-dnl ---------
-dnl KAME IPv6
-dnl ---------
-  if grep WIDE /usr/include/netinet6/in6.h >/dev/null 2>&1; then
-    AC_DEFINE(KAME,1,KAME IPv6)
-    AC_MSG_RESULT(KAME)
-dnl ------------------------------------
-dnl Solaris 9, 10 and potentially higher
-dnl ------------------------------------
-  elif test x"$opsys" = x"sol8"; then
-    AC_DEFINE(SOLARIS_IPV6, 1, Solaris IPv6)
-    AC_MSG_RESULT(Solaris IPv6)
-dnl ----------
-dnl Linux IPv6
-dnl ----------
-  elif test x"$opsys" = x"gnu-linux"; then
-    AC_DEFINE(LINUX_IPV6,1,Linux IPv6 stack)
-    dnl Linux has a compilation problem with mixing
-    dnl netinet/in.h and linux/in6.h they are not
-    dnl compatible.  There has been discussion on
-    dnl how to fix it but no real progress on implementation
-    dnl when they fix it, remove this
-    AC_DEFINE(IPV6_MINHOPCOUNT, 73, Linux ipv6 Min Hop Count)
-    AC_MSG_RESULT(Linux IPv6)
-  else
-    AC_MSG_ERROR([Failed to detect IPv6 stack])
-  fi
-
 dnl ------------------
 dnl IPv6 header checks
 dnl ------------------
@@ -1253,12 +1238,7 @@ fi
 dnl --------------------
 dnl Daemon disable check
 dnl --------------------
-if test "${enable_zebra}" = "no";then
-  ZEBRA=""
-else
-  ZEBRA="zebra"
-fi
-AM_CONDITIONAL(ZEBRA, test "x$ZEBRA" = "xzebra")
+AM_CONDITIONAL(ZEBRA, test "${enable_zebra}" != "no")
 
 if test "${enable_bgpd}" = "no";then
   BGPD=""
@@ -1267,12 +1247,7 @@ else
 fi
 AM_CONDITIONAL(BGPD, test "x$BGPD" = "xbgpd")
 
-if test "${enable_ripd}" = "no";then
-  RIPD=""
-else
-  RIPD="ripd"
-fi
-AM_CONDITIONAL(RIPD, test "x$RIPD" = "xripd")
+AM_CONDITIONAL(RIPD, test "${enable_ripd}" != "no")
 
 if test "${enable_ospfd}" = "no";then
   OSPFD=""
@@ -1284,29 +1259,24 @@ AM_CONDITIONAL(OSPFD, test "x$OSPFD" = "xospfd")
 if test "${enable_ldpd}" = "no";then
   LDPD=""
 else
-  AX_PROG_PERL_MODULES(XML::LibXML, , [
-    if test -f "${srcdir}/ldpd/ldp_vty_cmds.c"; then
-      AC_MSG_WARN([XML::LibXML perl module not found, using pregenerated ldp_vty_cmds.c])
-    else
-      AC_MSG_ERROR([XML::LibXML perl module not found and pregenerated ldp_vty_cmds.c missing])
-    fi
-  ])
-
   LDPD="ldpd"
   AC_DEFINE(HAVE_LDPD, 1, ldpd)
 fi
 AM_CONDITIONAL(LDPD, test "x$LDPD" = "xldpd")
 
 NHRPD=""
-if test "$opsys" = "gnu-linux"; then
-  if test "${enable_nhrpd}" != "no"; then
-    NHRPD="nhrpd"
-  fi
-else
-  if test "${enable_nhrpd}" = "yes"; then
-    AC_MSG_ERROR([nhrpd requires kernel APIs that are only present on Linux.])
-  fi
-fi
+case "$host_os" in
+  linux*)
+    if test "${enable_nhrpd}" != "no"; then
+      NHRPD="nhrpd"
+    fi
+    ;;
+  *)
+    if test "${enable_nhrpd}" = "yes"; then
+      AC_MSG_ERROR([nhrpd requires kernel APIs that are only present on Linux.])
+    fi
+    ;;
+esac
 AM_CONDITIONAL(NHRPD, test "x$NHRPD" = "xnhrpd")
 
 if test "${enable_eigrpd}" = "no";then
@@ -1334,11 +1304,7 @@ fi
 
 AM_CONDITIONAL(OSPFCLIENT, test "x$OSPFCLIENT" = "xospfclient")
 
-case "${enable_ripngd}" in
-  "no" ) RIPNGD="";;
-  *    ) RIPNGD="ripngd";;
-esac
-AM_CONDITIONAL(RIPNGD, test "x$RIPNGD" = "xripngd")
+AM_CONDITIONAL(RIPNGD, test "${enable_ripngd}" != "no")
 
 case "${enable_babeld}" in
   "no" ) BABELD="";;
@@ -1392,14 +1358,11 @@ fi
 AM_CONDITIONAL([ENABLE_BGP_VNC], [test x${enable_bgp_vnc} != xno])
 
 AC_SUBST(DOC)
-AC_SUBST(ZEBRA)
 AC_SUBST(RFPTEST)
 AC_SUBST(LIBRFP)
 AC_SUBST(RFPINC)
 AC_SUBST(BABELD)
 AC_SUBST(BGPD)
-AC_SUBST(RIPD)
-AC_SUBST(RIPNGD)
 AC_SUBST(OSPFD)
 AC_SUBST(OSPF6D)
 AC_SUBST(LDPD)
@@ -1413,7 +1376,8 @@ AC_SUBST(VTYSH)
 AC_SUBST(CURSES)
 AC_SUBST(OSPFCLIENT)
 AC_SUBST(OSPFAPI)
-AC_CHECK_LIB(crypt, crypt)
+AC_CHECK_LIB(crypt, crypt, [],
+                   [AC_CHECK_LIB(crypto, DES_crypt)])
 AC_CHECK_LIB(resolv, res_init)
 
 dnl ---------------------------
@@ -1430,7 +1394,9 @@ dnl ------------------
 dnl check C-Ares library
 dnl ------------------
 if test "${NHRPD}" != ""; then
-   PKG_CHECK_MODULES([CARES], [libcares])
+  PKG_CHECK_MODULES([CARES], [libcares], , [
+    AC_MSG_ERROR([trying to build nhrpd, but libcares not found. install c-ares and its -dev headers.])
+  ])
 fi
 
 
@@ -1445,15 +1411,14 @@ if test "${enable_snmp}" != ""; then
    SNMP_LIBS="`${NETSNMP_CONFIG} --agent-libs`"
    SNMP_CFLAGS="`${NETSNMP_CONFIG} --base-cflags`"
    AC_MSG_CHECKING([whether we can link to Net-SNMP])
-   AC_LINK_IFELSE([AC_LANG_PROGRAM([
+   AC_LINK_IFELSE_FLAGS([$SNMP_CFLAGS], [$SNMP_LIBS], [AC_LANG_PROGRAM([
 int main(void);
 ],
 [
 {
   return 0;
 }
-])],[AC_MSG_RESULT(yes)],[
-     AC_MSG_RESULT(no)
+])], [
      AC_MSG_ERROR([--enable-snmp given but not usable])])
    case "${enable_snmp}" in
      yes)
@@ -1474,6 +1439,11 @@ AM_CONDITIONAL([SNMP], [test "x${SNMP_METHOD}" != "x"])
 AC_SUBST(SNMP_LIBS)
 AC_SUBST(SNMP_CFLAGS)
 
+dnl ---------------
+dnl math
+dnl ---------------
+AC_SEARCH_LIBS([sqrt], [m])
+
 dnl ---------------
 dnl dlopen & dlinfo
 dnl ---------------
@@ -1639,10 +1609,10 @@ dnl --------------------------------------
 
 AM_PROG_LEX
 AC_MSG_CHECKING(version of flex)
-quagga_ac_flex_version="$(eval $LEX -V | grep flex | head -n 1)"
-quagga_ac_flex_version="${quagga_ac_flex_version##* }"
-AC_MSG_RESULT([$quagga_ac_flex_version])
-AX_COMPARE_VERSION([$quagga_ac_flex_version], [lt], [2.5.20], [
+frr_ac_flex_version="$(eval $LEX -V | grep flex | head -n 1)"
+frr_ac_flex_version="${frr_ac_flex_version##* }"
+AC_MSG_RESULT([$frr_ac_flex_version])
+AX_COMPARE_VERSION([$frr_ac_flex_version], [lt], [2.5.20], [
   LEX="$SHELL $missing_dir/missing flex"
   if test -f "${srcdir}/lib/command_lex.c" -a -f "${srcdir}/lib/command_lex.h"; then
     AC_MSG_WARN([using pregenerated flex output files])
@@ -1656,38 +1626,38 @@ AX_COMPARE_VERSION([$quagga_ac_flex_version], [lt], [2.5.20], [
 AC_PROG_YACC
 dnl thanks GNU bison for this b*llshit...
 AC_MSG_CHECKING(version of bison)
-quagga_ac_bison_version="$(eval $YACC -V | grep bison | head -n 1)"
-quagga_ac_bison_version="${quagga_ac_bison_version##* }"
-quagga_ac_bison_missing="false"
-case "x${quagga_ac_bison_version}" in
+frr_ac_bison_version="$(eval $YACC -V | grep bison | head -n 1)"
+frr_ac_bison_version="${frr_ac_bison_version##* }"
+frr_ac_bison_missing="false"
+case "x${frr_ac_bison_version}" in
   x2.7*)
     BISON_OPENBRACE='"'
     BISON_CLOSEBRACE='"'
     BISON_VERBOSE=''
-    AC_MSG_RESULT([$quagga_ac_bison_version - 2.7 or older])
+    AC_MSG_RESULT([$frr_ac_bison_version - 2.7 or older])
     ;;
   x2.*|x1.*)
-    AC_MSG_RESULT([$quagga_ac_bison_version])
+    AC_MSG_RESULT([$frr_ac_bison_version])
     AC_MSG_WARN([installed bison is too old.  Please install GNU bison 2.7.x or newer.])
-    quagga_ac_bison_missing="true"
+    frr_ac_bison_missing="true"
     ;;
   x)
     AC_MSG_RESULT([none])
     AC_MSG_WARN([could not determine bison version.  Please install GNU bison 2.7.x or newer.])
-    quagga_ac_bison_missing="true"
+    frr_ac_bison_missing="true"
     ;;
   *)
     BISON_OPENBRACE='{'
     BISON_CLOSEBRACE='}'
     BISON_VERBOSE='-Dparse.error=verbose'
-    AC_MSG_RESULT([$quagga_ac_bison_version - 3.0 or newer])
+    AC_MSG_RESULT([$frr_ac_bison_version - 3.0 or newer])
     ;;
 esac
 AC_SUBST(BISON_OPENBRACE)
 AC_SUBST(BISON_CLOSEBRACE)
 AC_SUBST(BISON_VERBOSE)
 
-if $quagga_ac_bison_missing; then
+if $frr_ac_bison_missing; then
   YACC="$SHELL $missing_dir/missing bison -y"
   if test -f "${srcdir}/lib/command_parse.c" -a -f "${srcdir}/lib/command_parse.h"; then
     AC_MSG_WARN([using pregenerated bison output files])
@@ -1849,20 +1819,17 @@ AC_CACHE_VAL(ac_cv_htonl_works,
 )
 AC_MSG_RESULT($ac_cv_htonl_works)
 
-AC_CONFIG_FILES([Makefile lib/Makefile qpb/Makefile zebra/Makefile ripd/Makefile 
-         ripngd/Makefile bgpd/Makefile ospfd/Makefile watchfrr/Makefile
+AC_CONFIG_FILES([Makefile
+         bgpd/Makefile ospfd/Makefile watchfrr/Makefile
          ospf6d/Makefile ldpd/Makefile isisd/Makefile vtysh/Makefile
-         doc/Makefile ospfclient/Makefile tests/Makefile m4/Makefile
+         doc/Makefile ospfclient/Makefile tests/Makefile
+         bgpd/rfp-example/rfptest/Makefile bgpd/rfp-example/librfp/Makefile
          babeld/Makefile
          pimd/Makefile
          eigrpd/Makefile
          nhrpd/Makefile
-         redhat/Makefile
          tools/Makefile
-         pkgsrc/Makefile
-         fpm/Makefile
-         redhat/frr.spec 
-         snapcraft/Makefile
+         redhat/frr.spec
          snapcraft/snapcraft.yaml
          lib/version.h
          tests/lib/cli/test_cli.refout
@@ -1886,19 +1853,12 @@ AC_CONFIG_FILES([Makefile lib/Makefile qpb/Makefile zebra/Makefile ripd/Makefile
          pkgsrc/ripd.sh pkgsrc/ripngd.sh pkgsrc/zebra.sh
          pkgsrc/eigrpd.sh])
 
-if test "${enable_bgp_vnc}" != "no"; then
-   if test "${with_rfp_path}" = "bgpd/rfp-example" ; then 
-     AC_CONFIG_FILES([bgpd/rfp-example/rfptest/Makefile bgpd/rfp-example/librfp/Makefile])
-   else
-     AC_CONFIG_FILES([${with_rfp_path}/rfptest/Makefile ${with_rfp_path}/librfp/Makefile])
-   fi
-fi
 
 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.
+## Hack, but working solution to avoid rebuilding of frr.info.
 ## It's already in CVS until texinfo 4.7 is more common.
 AC_OUTPUT