]> git.proxmox.com Git - mirror_frr.git/blobdiff - configure.ac
Merge pull request #3506 from opensourcerouting/6.0-init-fixes
[mirror_frr.git] / configure.ac
index 91b9c5352d91267ab4e51361bb4d8d00303d7da3..701c2ee2111ed74932a4d056147b8083885fee87 100755 (executable)
@@ -13,7 +13,7 @@ AC_SUBST(PACKAGE_URL)
 PACKAGE_FULLNAME="FRRouting"
 AC_SUBST(PACKAGE_FULLNAME)
 
-CONFIG_ARGS="$ac_configure_args"
+CONFIG_ARGS="`echo $ac_configure_args | sed -e \"s% '[[A-Z]]*FLAGS=[[^']]\+'%%g\"`"
 AC_SUBST(CONFIG_ARGS)
 
 AC_CONFIG_SRCDIR(lib/zebra.h)
@@ -301,12 +301,48 @@ dnl libtool
 dnl -------
 LT_INIT
 
+dnl $AR and $RANLIB are set by LT_INIT above
+AC_MSG_CHECKING([whether $AR supports D option])
+if $AR crD conftest.a; then
+  AC_MSG_RESULT([yes])
+  dnl ARFLAGS is for automake, AR_FLAGS for libtool m-(
+  ARFLAGS="crD"
+  AR_FLAGS="crD"
+else
+  AC_MSG_RESULT([no])
+  ARFLAGS="cru"
+  AR_FLAGS="cru"
+fi
+AC_SUBST(ARFLAGS)
+AC_SUBST(AR_FLAGS)
+
+AC_MSG_CHECKING([whether $RANLIB supports D option])
+if $RANLIB -D conftest.a; then
+  AC_MSG_RESULT([yes])
+  RANLIB="$RANLIB -D"
+else
+  AC_MSG_RESULT([no])
+fi
+AC_SUBST(RANLIB)
+
+test -f conftest.a && rm conftest.a
+
 dnl ----------------------
 dnl Packages configuration
 dnl ----------------------
+if test -f config.version; then
+  . ./config.version
+elif test -f "${srcdir}/config.version"; then
+  . "${srcdir}/config.version"
+fi
 AC_ARG_WITH(pkg-extra-version,
-       AS_HELP_STRING([--with-pkg-extra-version=VER], [add extra version field, for packagers/distributions]),
-       [EXTRAVERSION=$withval],)
+  AS_HELP_STRING([--with-pkg-extra-version=VER], [add extra version field, for packagers/distributions]), [
+  if test "$withval" = "no"; then
+    EXTRAVERSION=
+  else
+    EXTRAVERSION=$withval
+  fi
+], [])
 AC_ARG_WITH(pkg-git-version,
        AS_HELP_STRING([--with-pkg-git-version], [add git information to MOTD and build version string]),
        [ test "x$withval" != "xno" && with_pkg_git_version="yes" ])
@@ -438,9 +474,9 @@ AC_ARG_ENABLE([memory-sanitizer],
 AS_IF([test "${enable_clippy_only}" != "yes"], [
 AC_CHECK_HEADERS(json-c/json.h)
 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
+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
+  if test "$ac_cv_lib_json_json_object_get" = no; then
       AC_MSG_ERROR([lib json is needed to compile])
   fi
 fi
@@ -715,6 +751,7 @@ if test "x${EXTRAVERSION}" != "x" ; then
   AC_SUBST(PACKAGE_EXTRAVERSION, ["${EXTRAVERSION}"])
   PACKAGE_STRING="${PACKAGE_STRING}${EXTRAVERSION}"
 fi
+AC_SUBST(EXTRAVERSION)
 
 if test "x$with_pkg_git_version" = "xyes"; then
        if test -d "${srcdir}/.git"; then
@@ -915,7 +952,6 @@ case "$host_os" in
       AC_DEFINE([HAVE_PRINTSTACK],1,[Solaris printstack])
       AC_DEFINE([HAVE_STACK_TRACE],1,[Stack symbols decode functionality])
     ])
-    CURSES=-lcurses
     SOLARIS="solaris"
     ;;
   linux*)
@@ -981,36 +1017,47 @@ dnl ---------------------
 dnl Integrated VTY option
 dnl ---------------------
 case "${enable_vtysh}" in
-  "no") VTYSH="";;
-  *)    VTYSH="vtysh";
-         AC_DEFINE(VTYSH,,VTY shell)
-dnl     Vtysh uses libreadline, which looks for termcap functions at
-dnl     configure time.  We follow readlines 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, LIBREADLINE="$LIBREADLINE -ltermcap",
-          [AC_CHECK_LIB(tinfo, tputs, LIBREADLINE="$LIBREADLINE -ltinfo",
-            [AC_CHECK_LIB(curses, tputs, LIBREADLINE="$LIBREADLINE -lcurses",
-              [AC_CHECK_LIB(ncurses, tputs, 
-                            LIBREADLINE="$LIBREADLINE -lncurses")]
-             )]
-           )]
-         )
-         AC_CHECK_LIB(readline, main, LIBREADLINE="-lreadline $LIBREADLINE",,
-                      "$LIBREADLINE")
-         if test $ac_cv_lib_readline_main = no; then
-           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, 
-                     LIBREADLINE="$LIBREADLINE",, "$LIBREADLINE")
-         if test $ac_cv_lib_readline_rl_completion_matches = no; then
-           AC_DEFINE(rl_completion_matches,completion_matches,Old readline)
-        fi
-        ;;
+"no")
+  VTYSH="";;
+*)
+  VTYSH="vtysh";
+  AC_DEFINE(VTYSH,,VTY shell)
+
+  prev_libs="$LIBS"
+  AC_CHECK_LIB(readline, main, [
+    LIBREADLINE="-lreadline"
+  ], [
+    dnl readline failed - it might be incorrectly linked and missing its
+    dnl termcap/tinfo/curses dependency.  see if we can fix that...
+    AC_SEARCH_LIBS(tputs, [termcap tinfo curses ncurses], [
+      LIBREADLINE="$ac_cv_search_tputs"
+    ], [
+      AC_MSG_ERROR([libreadline (needed for vtysh) not found and/or missing dependencies])
+    ])
+
+    dnl re-try with the lib we found above
+    unset ac_cv_lib_readline_main
+    AC_CHECK_LIB(readline, main, [
+      LIBREADLINE="-lreadline $LIBREADLINE"
+    ], [
+      AC_MSG_ERROR([libreadline (needed for vtysh) not found and/or missing dependencies])
+    ], [$LIBREADLINE])
+  ], [])
+  LIBS="$prev_libs"
+
+  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, [true], [], [$LIBREADLINE])
+  if test $ac_cv_lib_readline_rl_completion_matches = no; then
+    AC_DEFINE(rl_completion_matches,completion_matches,Old readline)
+  fi
+  AC_CHECK_LIB(readline, [append_history], [frr_cv_append_history=yes], [frr_cv_append_history=no], [$LIBREADLINE])
+  if test "$frr_cv_append_history" = yes; then
+    AC_DEFINE(HAVE_APPEND_HISTORY, 1, [Have history.h append_history])
+  fi
+  ;;
 esac
 AC_SUBST(LIBREADLINE)
 AM_CONDITIONAL(VTYSH, test "x$VTYSH" = "xvtysh")
@@ -1349,7 +1396,7 @@ fi
 
 AM_CONDITIONAL(BFDD, [test "x$BFDD" = "xbfdd"])
 
-if test $ac_cv_lib_json_c_json_object_get = no -a "x$BFDD" = "xbfdd"; then
+if test "$ac_cv_lib_json_c_json_object_get" = no -a "x$BFDD" = "xbfdd"; then
   AC_MSG_ERROR(["you must use json-c library to use bfdd"])
 fi
 
@@ -1408,7 +1455,6 @@ fi
 AM_CONDITIONAL([ENABLE_BGP_VNC], [test x${enable_bgp_vnc} != xno])
 
 AC_SUBST(SOLARIS)
-AC_SUBST(CURSES)
 AC_CHECK_LIB(crypt, crypt, [],
                    [AC_CHECK_LIB(crypto, DES_crypt)])
 AC_CHECK_LIB(resolv, res_init)
@@ -1443,6 +1489,11 @@ if test "${enable_snmp}" != "" -a "${enable_snmp}" != "no"; then
    fi
    SNMP_LIBS="`${NETSNMP_CONFIG} --agent-libs`"
    SNMP_CFLAGS="`${NETSNMP_CONFIG} --base-cflags`"
+   # net-snmp lists all of its own dependencies.  we absolutely do not want that
+   # among other things we avoid a GPL vs. OpenSSL license conflict here
+   for removelib in crypto ssl sensors pci wrap; do
+     SNMP_LIBS="`echo $SNMP_LIBS | sed -e 's/\(^\|\s\)-l'$removelib'\b/ /g' -e 's/\(^\|\s\)\([^\s]*\/\)\?lib'$removelib'\.[^\s]\+\b/ /g'`"
+   done
    AC_MSG_CHECKING([whether we can link to Net-SNMP])
    AC_LINK_IFELSE_FLAGS([$SNMP_CFLAGS], [$SNMP_LIBS], [AC_LANG_PROGRAM([
 int main(void);
@@ -1961,6 +2012,7 @@ AC_MSG_RESULT($ac_cv_htonl_works)
 AC_CONFIG_FILES([Makefile],[sed -e 's/^#AUTODERP# //' -i Makefile])
 
 AC_CONFIG_FILES([
+         config.version
          redhat/frr.spec
          solaris/Makefile
          debianpkg/changelog
@@ -1974,6 +2026,9 @@ AC_CONFIG_FILES([
 
 AC_CONFIG_FILES([vtysh/extract.pl],[chmod +x vtysh/extract.pl])
 AC_CONFIG_FILES([tools/frr],[chmod +x tools/frr])
+AC_CONFIG_FILES([tools/watchfrr.sh],[chmod +x tools/watchfrr.sh])
+AC_CONFIG_FILES([tools/frrinit.sh],[chmod +x tools/frrinit.sh])
+AC_CONFIG_FILES([tools/frrcommon.sh])
 
 AC_CONFIG_COMMANDS([lib/route_types.h], [
        dst="${ac_abs_top_builddir}/lib/route_types.h"