]> git.puffer.fish Git - mirror/frr.git/commitdiff
vtysh: Add code to isolate append_history
authorDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 7 Sep 2018 17:50:57 +0000 (13:50 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Sat, 8 Sep 2018 16:00:17 +0000 (12:00 -0400)
The append_history function in lib readline appears to
not be universally available across all of the esoteric
platforms we may want to compile on.  As such
provide a way to gracefully do nothing.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
configure.ac
vtysh/vtysh_main.c

index f1ffd43f5bd7537becde5ac78f9905c11ac5a81c..055cdda957326396ec9739d63e4feafa7117db29 100755 (executable)
@@ -1056,6 +1056,10 @@ dnl       [TODO] on Linux, and in [TODO] on Solaris.
          if test $ac_cv_lib_readline_rl_completion_matches = no; then
            AC_DEFINE(rl_completion_matches,completion_matches,Old readline)
         fi
+        AC_SEARCH_LIBS([append_history], [readline], [frr_cv_append_history=yes], [frr_cv_append_history=no])
+        if test "$frr_cv_append_history" = yes; then
+          AC_DEFINE(HAVE_APPEND_HISTORY, 1, [Have history.h append_history])
+        fi
         ;;
 esac
 AC_SUBST(LIBREADLINE)
index 86fa62f474a44ef13ed536208d27b0e263468745..7e979f2c8f39a5dd9fd0fdec8b7f87d5b7344f73 100644 (file)
 #include <readline/readline.h>
 #include <readline/history.h>
 
+/*
+ * The append_history function only appears in newer versions
+ * of the readline library it appears like.  Since we don't
+ * need this just silently ignore the code on these
+ * ancient platforms.
+ */
+#if !defined HAVE_APPEND_HISTORY
+#define append_history(A, B)
+#endif
+
 #include <lib/version.h>
 #include "getopt.h"
 #include "command.h"