From 074a8e39284ec521cb4fd8cb38f17605c197e5b0 Mon Sep 17 00:00:00 2001 From: Brent Cook Date: Sun, 28 Dec 2014 20:23:04 -0600 Subject: [PATCH] FreeBSD compatibility fixes EAI_NODATA has been made obsolete. Properly detect MD5Init in -lmd --- config.patch | 23 ++++++++++++++++++++--- configure.ac | 6 ++++-- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/config.patch b/config.patch index c67e4f0..31d12d0 100644 --- a/config.patch +++ b/config.patch @@ -1,5 +1,5 @@ ---- config.orig 2014-12-28 12:15:23.139241646 -0600 -+++ config.c 2014-12-28 12:15:58.843242420 -0600 +--- config.orig Sun Dec 28 20:17:46 2014 ++++ config.c Sun Dec 28 20:19:48 2014 @@ -75,7 +75,9 @@ if ((h = calloc(1, sizeof(struct ntp_addr))) == NULL) fatal(NULL); @@ -20,7 +20,24 @@ sa_in6->sin6_family = AF_INET6; memcpy(&sa_in6->sin6_addr, &((struct sockaddr_in6 *)res->ai_addr)->sin6_addr, -@@ -141,12 +145,16 @@ +@@ -124,8 +128,14 @@ + hints.ai_family = PF_UNSPEC; + hints.ai_socktype = SOCK_DGRAM; /* DUMMY */ + error = getaddrinfo(s, NULL, &hints, &res0); +- if (error == EAI_AGAIN || error == EAI_NODATA || error == EAI_NONAME) +- return (0); ++ switch (error) { ++ case EAI_AGAIN: ++#ifdef EAI_NODATA ++ case EAI_NODATA: ++#endif ++ case EAI_NONAME: ++ return (0); ++ } + if (error) { + log_warnx("could not parse \"%s\": %s", s, + gai_strerror(error)); +@@ -141,12 +151,16 @@ h->ss.ss_family = res->ai_family; if (res->ai_family == AF_INET) { sa_in = (struct sockaddr_in *)&h->ss; diff --git a/configure.ac b/configure.ac index 12e8870..e17b92d 100644 --- a/configure.ac +++ b/configure.ac @@ -93,7 +93,8 @@ AC_CHECK_FUNC([ibuf_open],, # Share test results with automake AM_CONDITIONAL([HAVE_ADJFREQ], [test "x$ac_cv_func_adjfreq" = xyes]) -AM_CONDITIONAL([HAVE_ARC4RANDOM], [test "x$ac_cv_func_arc4random" = xyes]) +AM_CONDITIONAL([HAVE_ARC4RANDOM], + [test "x$ac_cv_func_arc4random" = xyes -o "ac_cv_search_arc4random" != xno]) AM_CONDITIONAL([HAVE_ARC4RANDOM_UNIFORM], [test "x$ac_cv_func_arc4random_uniform" = xyes]) AM_CONDITIONAL([HAVE_ASPRINTF], [test "x$ac_cv_func_asprintf" = xyes]) AM_CONDITIONAL([HAVE_EXPLICIT_BZERO], [test "x$ac_cv_func_explicit_bzero" = xyes]) @@ -108,7 +109,8 @@ AM_CONDITIONAL([HAVE_STRLCPY], [test "x$ac_cv_func_strlcpy" = xyes]) AM_CONDITIONAL([HAVE_STRNDUP], [test "x$ac_cv_func_strndup" = xyes]) AM_CONDITIONAL([HAVE_STRNLEN], [test "x$ac_cv_func_strnlen" = xyes]) AM_CONDITIONAL([HAVE_STRTONUM], [test "x$ac_cv_func_strtonum" = xyes]) -AM_CONDITIONAL([HAVE_MD5], [test "x$ac_cv_func_MD5Init" = xyes]) +AM_CONDITIONAL([HAVE_MD5], + [test "x$ac_cv_func_MD5Init" = xyes -o "ac_cv_search_MD5Init" != xno]) AM_CONDITIONAL([HAVE_SHA512], [test "x$ac_cv_func_SHA512Init" = xyes]) AM_CONDITIONAL([HAVE_IMSG], [test "x$ac_cv_func_ibuf_open" = xyes])