]> git.proxmox.com Git - mirror_frr.git/commitdiff
Merge pull request #2991 from donaldsharp/mac_compiling
authorDavid Lamparter <equinox@diac24.net>
Sat, 8 Sep 2018 17:45:18 +0000 (19:45 +0200)
committerGitHub <noreply@github.com>
Sat, 8 Sep 2018 17:45:18 +0000 (19:45 +0200)
Mac compiling cleanups

configure.ac
lib/frr_pthread.h
lib/memory_vty.c
vtysh/vtysh.c
vtysh/vtysh_main.c

index 09a6f364fb30981c971a6e33c8c32b6fc0dd7ef7..055cdda957326396ec9739d63e4feafa7117db29 100755 (executable)
@@ -313,6 +313,13 @@ AX_PTHREAD([
   AC_MSG_FAILURE([This FRR version needs pthreads])
 ])
 
+AC_SEARCH_LIBS([pthread_condattr_setclock], [],
+               [frr_cv_pthread_condattr_setclock=yes],
+               [frr_cv_pthread_condattr_setclock=no])
+if test "$frr_cv_pthread_condattr_setclock" = yes; then
+  AC_DEFINE(HAVE_PTHREAD_CONDATTR_SETCLOCK, 1, [Have pthread.h pthread_condattr_setclock])
+fi
+
 dnl --------------
 dnl Check programs
 dnl --------------
@@ -1049,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 cc4fc74337b940abd82f42ad8d4b78bd8ee6326d..732e2925fef67246b6e2b9a6184b2b223ea59ea5 100644 (file)
@@ -234,4 +234,8 @@ void frr_pthread_yield(void);
  */
 uint32_t frr_pthread_get_id(void);
 
+#ifndef HAVE_PTHREAD_CONDATTR_SETCLOCK
+#define pthread_condattr_setclock(A, B)
+#endif
+
 #endif /* _FRR_PTHREAD_H */
index 73a18529a2a80fe270d548f7fc9017c6d425812d..5fd9c3b900437c13a5feb6c2f792d7aa96a08c33 100644 (file)
@@ -28,7 +28,9 @@
 #include <malloc/malloc.h>
 #endif
 #include <dlfcn.h>
+#ifdef HAVE_LINK_H
 #include <link.h>
+#endif
 
 #include "log.h"
 #include "memory.h"
index c249115fd372d8468cb2e5f887c98f6ddc70912b..bcae4407cbccec11e50b43a3ee78b4389f76945d 100644 (file)
@@ -1112,7 +1112,7 @@ static char *command_generator(const char *text, int state)
        return NULL;
 }
 
-static char **new_completion(char *text, int start, int end)
+static char **new_completion(const char *text, int start, int end)
 {
        char **matches;
 
@@ -3386,8 +3386,7 @@ void vtysh_readline_init(void)
        rl_initialize();
        rl_bind_key('?', (rl_command_func_t *)vtysh_rl_describe);
        rl_completion_entry_function = vtysh_completion_entry_function;
-       rl_attempted_completion_function =
-               (rl_completion_func_t *)new_completion;
+       rl_attempted_completion_function = new_completion;
 }
 
 char *vtysh_prompt(void)
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"