]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Fix to define _OPENBSD_SOURCE to get reallocarray on NetBSD.
authorW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Tue, 28 May 2019 09:12:05 +0000 (11:12 +0200)
committerW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Tue, 28 May 2019 09:12:05 +0000 (11:12 +0200)
config.h.in
configure
configure.ac
doc/Changelog

index 74c14d16175ea40584e4fd448f72e2aafd7e54dc..e8795c7ef158cdea188b327b57388ce3bfa27793 100644 (file)
 /* Define to 1 if you have the `RAND_cleanup' function. */
 #undef HAVE_RAND_CLEANUP
 
-/* Define to 1 if you have the `reallocarray' function. */
+/* If we have reallocarray(3) */
 #undef HAVE_REALLOCARRAY
 
 /* Define to 1 if you have the `recvmsg' function. */
index 777649c666b40fd860d31128222ea2ce810fb1f2..6a83da1642bbc2231f93af9d248322a2549cad96 100755 (executable)
--- a/configure
+++ b/configure
 
 LIBOBJ_WITHOUT_CTIMEARC4="$LIBOBJS"
 
-ac_fn_c_check_func "$LINENO" "reallocarray" "ac_cv_func_reallocarray"
-if test "x$ac_cv_func_reallocarray" = xyes; then :
-  $as_echo "#define HAVE_REALLOCARRAY 1" >>confdefs.h
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for reallocarray" >&5
+$as_echo_n "checking for reallocarray... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$ac_includes_default
+
+#define _OPENBSD_SOURCE 1
+#include <stdlib.h>
+int main(void) {
+       void* p = reallocarray(NULL, 10, 100);
+       free(p);
+       return 0;
+}
+
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+$as_echo "#define HAVE_REALLOCARRAY 1" >>confdefs.h
+
 
 else
-  case " $LIBOBJS " in
+
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+       case " $LIBOBJS " in
   *" reallocarray.$ac_objext "* ) ;;
   *) LIBOBJS="$LIBOBJS reallocarray.$ac_objext"
  ;;
 esac
 
-fi
-
 
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 if test "$USE_NSS" = "no"; then
        ac_fn_c_check_func "$LINENO" "arc4random" "ac_cv_func_arc4random"
 if test "x$ac_cv_func_arc4random" = xyes; then :
index abbecf0bad0b8ef4634cbcd0447f44cb2a5d56b3..05acbe8a08f09dc206d84445c9c55b4a74b4bf7f 100644 (file)
@@ -1447,7 +1447,22 @@ AC_REPLACE_FUNCS(explicit_bzero)
 dnl without CTIME, ARC4-functions and without reallocarray.
 LIBOBJ_WITHOUT_CTIMEARC4="$LIBOBJS"
 AC_SUBST(LIBOBJ_WITHOUT_CTIMEARC4)
-AC_REPLACE_FUNCS(reallocarray)
+AC_MSG_CHECKING([for reallocarray])
+AC_LINK_IFELSE([AC_LANG_SOURCE(AC_INCLUDES_DEFAULT
+[[
+#define _OPENBSD_SOURCE 1
+#include <stdlib.h>
+int main(void) {
+       void* p = reallocarray(NULL, 10, 100);
+       free(p);
+       return 0;
+}
+]])], [AC_MSG_RESULT(yes)
+       AC_DEFINE(HAVE_REALLOCARRAY, 1, [If we have reallocarray(3)])
+], [
+       AC_MSG_RESULT(no)
+       AC_LIBOBJ(reallocarray)
+])
 if test "$USE_NSS" = "no"; then
        AC_REPLACE_FUNCS(arc4random)
        AC_REPLACE_FUNCS(arc4random_uniform)
index 6fde836997e8861fab58746d5579f11312077ab6..b970ada2f3b7bf09d0be3df2f31aba85c91ab821 100644 (file)
@@ -1,3 +1,6 @@
+28 May 2019: Wouter
+       - Fix to define _OPENBSD_SOURCE to get reallocarray on NetBSD.
+
 27 May 2019: Wouter
        - Fix double file close in tcp pipelined response code.