summaryrefslogtreecommitdiff
path: root/usr.sbin/nsd/configure.ac
diff options
context:
space:
mode:
authorStuart Henderson <sthen@cvs.openbsd.org>2015-09-10 14:12:39 +0000
committerStuart Henderson <sthen@cvs.openbsd.org>2015-09-10 14:12:39 +0000
commit64282473e01db2ac8893d6177443a3df493654d8 (patch)
tree436ad864830b63ecc2e6e582c311065c42c34b6a /usr.sbin/nsd/configure.ac
parent90bfaded186412c4f5d1900e6312972d192bb716 (diff)
Fix handling of compat/b64_{ntop,pton} by using __-prefixed versions directly,
similar to what ssh does. Otherwise they need resolv.h including, which causes problems on OS with newer resolv.h/nameser.h headers which cause conflicts with NSD's T_xxx resource record #defines. autoconf bits adapted from tmux portable. ok florian@
Diffstat (limited to 'usr.sbin/nsd/configure.ac')
-rw-r--r--usr.sbin/nsd/configure.ac47
1 files changed, 39 insertions, 8 deletions
diff --git a/usr.sbin/nsd/configure.ac b/usr.sbin/nsd/configure.ac
index fcbf40b075c..60ea50d2bf2 100644
--- a/usr.sbin/nsd/configure.ac
+++ b/usr.sbin/nsd/configure.ac
@@ -654,12 +654,45 @@ AC_REPLACE_FUNCS(snprintf)
AC_REPLACE_FUNCS(strlcat)
AC_REPLACE_FUNCS(strlcpy)
AC_REPLACE_FUNCS(strptime)
-AC_REPLACE_FUNCS(b64_pton)
-AC_REPLACE_FUNCS(b64_ntop)
AC_REPLACE_FUNCS(pselect)
AC_REPLACE_FUNCS(memmove)
AC_REPLACE_FUNCS(reallocarray)
+#
+# Check for b64_ntop (and assume result applies to b64_pton as well).
+# The functions are actually prefixed with __ and resolv.h defines
+# macros for the unprefixed versions, however including this header
+# causes conflicts with our T_xx defines.
+#
+AC_MSG_CHECKING(for __b64_ntop)
+AC_TRY_LINK([#include <stddef.h>],
+ [__b64_ntop(NULL, 0, NULL, 0);],
+ found_b64_ntop=yes,
+ found_b64_ntop=no
+)
+if test "x$found_b64_ntop" = xno; then
+ AC_MSG_RESULT(no)
+
+ AC_MSG_CHECKING(for __b64_ntop with -lresolv)
+ LIBS="$LIBS -lresolv"
+ AC_TRY_LINK([#include <stddef.h>],
+ [__b64_ntop(NULL, 0, NULL, 0);],
+ found_b64_ntop=yes,
+ found_b64_ntop=no
+ )
+ if test "x$found_b64_ntop" = xno; then
+ AC_MSG_RESULT(no)
+ fi
+fi
+if test "x$found_b64_ntop" = xyes; then
+ AC_DEFINE(HAVE_B64_NTOP)
+ AC_DEFINE(HAVE_B64_PTON)
+ AC_MSG_RESULT(yes)
+else
+ AC_LIBOBJ([b64_ntop])
+ AC_LIBOBJ([b64_pton])
+fi
+
AC_MSG_CHECKING(for pselect prototype in sys/select.h)
AC_EGREP_HEADER([[^a-zA-Z_]*pselect[^a-zA-Z_]], sys/select.h, AC_DEFINE(HAVE_PSELECT_PROTO, 1,
[if sys/select.h provides pselect prototype]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
@@ -941,13 +974,11 @@ AH_BOTTOM([
])
AH_BOTTOM([
-#ifndef HAVE_B64_NTOP
-int b64_ntop(uint8_t const *src, size_t srclength,
+int __b64_ntop(uint8_t const *src, size_t srclength,
char *target, size_t targsize);
-#endif /* !HAVE_B64_NTOP */
-#ifndef HAVE_B64_PTON
-int b64_pton(char const *src, uint8_t *target, size_t targsize);
-#endif /* !HAVE_B64_PTON */
+int __b64_pton(char const *src, uint8_t *target, size_t targsize);
+])
+AH_BOTTOM([
#ifndef HAVE_FSEEKO
#define fseeko fseek
#define ftello ftell