]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Fix compile on Mac for unbound, provide explicit_bzero when libc
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Mon, 17 Sep 2018 07:06:57 +0000 (07:06 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Mon, 17 Sep 2018 07:06:57 +0000 (07:06 +0000)
  does not have it.

git-svn-id: file:///svn/unbound/trunk@4907 be551aaa-1e26-0410-a405-d3ace91eadb9

config.h.in
configure
configure.ac
doc/Changelog

index d187e00105069cf26593e41366ffbf6361ac4018..7ffb3c989b103dd57e1add2982a221a83ac29095 100644 (file)
@@ -3,6 +3,9 @@
 /* apply the noreturn attribute to a function that exits the program */
 #undef ATTR_NORETURN
 
+/* apply the weak attribute to a symbol */
+#undef ATTR_WEAK
+
 /* Directory to chroot to */
 #undef CHROOT_DIR
 
 /* Define to 1 if you have the <expat.h> header file. */
 #undef HAVE_EXPAT_H
 
+/* Define to 1 if you have the `explicit_bzero' function. */
+#undef HAVE_EXPLICIT_BZERO
+
 /* Define to 1 if you have the `fcntl' function. */
 #undef HAVE_FCNTL
 
@@ -1150,6 +1156,11 @@ char *strsep(char **stringp, const char *delim);
 int isblank(int c);
 #endif
 
+#ifndef HAVE_EXPLICIT_BZERO
+#define explicit_bzero unbound_explicit_bzero
+void explicit_bzero(void* buf, size_t len);
+#endif
+
 #if defined(HAVE_INET_NTOP) && !HAVE_DECL_INET_NTOP
 const char *inet_ntop(int af, const void *src, char *dst, size_t size);
 #endif
@@ -1182,7 +1193,6 @@ void *reallocarray(void *ptr, size_t nmemb, size_t size);
 #  endif
 #endif /* HAVE_LIBRESSL */
 #ifndef HAVE_ARC4RANDOM
-void explicit_bzero(void* buf, size_t len);
 int getentropy(void* buf, size_t len);
 uint32_t arc4random(void);
 void arc4random_buf(void* buf, size_t n);
index 6666e45469b4eadf3f14644585c4e640ae4e3b86..4f134fca0bcff9a5a510b635455e71c32fe05ff6 100755 (executable)
--- a/configure
+++ b/configure
@@ -6266,6 +6266,9 @@ if test $ac_cv_c_weak_attribute = yes; then
 
 $as_echo "#define HAVE_ATTR_WEAK 1" >>confdefs.h
 
+
+$as_echo "#define ATTR_WEAK __attribute__((weak))" >>confdefs.h
+
 fi
 
 
@@ -20079,6 +20082,20 @@ esac
 fi
 
 
+ac_fn_c_check_func "$LINENO" "explicit_bzero" "ac_cv_func_explicit_bzero"
+if test "x$ac_cv_func_explicit_bzero" = xyes; then :
+  $as_echo "#define HAVE_EXPLICIT_BZERO 1" >>confdefs.h
+
+else
+  case " $LIBOBJS " in
+  *" explicit_bzero.$ac_objext "* ) ;;
+  *) LIBOBJS="$LIBOBJS explicit_bzero.$ac_objext"
+ ;;
+esac
+
+fi
+
+
 LIBOBJ_WITHOUT_CTIMEARC4="$LIBOBJS"
 
 ac_fn_c_check_func "$LINENO" "reallocarray" "ac_cv_func_reallocarray"
 
 
        if test "$ac_cv_func_arc4random" = "no"; then
-               case " $LIBOBJS " in
-  *" explicit_bzero.$ac_objext "* ) ;;
-  *) LIBOBJS="$LIBOBJS explicit_bzero.$ac_objext"
- ;;
-esac
-
                case " $LIBOBJS " in
   *" arc4_lock.$ac_objext "* ) ;;
   *) LIBOBJS="$LIBOBJS arc4_lock.$ac_objext"
index 449cf32664645535f3d9ff363e01ea783062539d..772a1417a987ee75daf8defed41e4d5c64d22d7b 100644 (file)
@@ -1422,6 +1422,7 @@ AC_REPLACE_FUNCS(strlcpy)
 AC_REPLACE_FUNCS(memmove)
 AC_REPLACE_FUNCS(gmtime_r)
 AC_REPLACE_FUNCS(isblank)
+AC_REPLACE_FUNCS(explicit_bzero)
 dnl without CTIME, ARC4-functions and without reallocarray.
 LIBOBJ_WITHOUT_CTIMEARC4="$LIBOBJS"
 AC_SUBST(LIBOBJ_WITHOUT_CTIMEARC4)
@@ -1430,7 +1431,6 @@ if test "$USE_NSS" = "no"; then
        AC_REPLACE_FUNCS(arc4random)
        AC_REPLACE_FUNCS(arc4random_uniform)
        if test "$ac_cv_func_arc4random" = "no"; then
-               AC_LIBOBJ(explicit_bzero)
                AC_LIBOBJ(arc4_lock)
                AC_CHECK_FUNCS([getentropy],,[
                    if test "$USE_WINSOCK" = 1; then
@@ -1755,6 +1755,11 @@ char *strsep(char **stringp, const char *delim);
 int isblank(int c);
 #endif
 
+#ifndef HAVE_EXPLICIT_BZERO
+#define explicit_bzero unbound_explicit_bzero
+void explicit_bzero(void* buf, size_t len);
+#endif
+
 #if defined(HAVE_INET_NTOP) && !HAVE_DECL_INET_NTOP
 const char *inet_ntop(int af, const void *src, char *dst, size_t size);
 #endif
@@ -1787,7 +1792,6 @@ void *reallocarray(void *ptr, size_t nmemb, size_t size);
 #  endif
 #endif /* HAVE_LIBRESSL */
 #ifndef HAVE_ARC4RANDOM
-void explicit_bzero(void* buf, size_t len);
 int getentropy(void* buf, size_t len);
 uint32_t arc4random(void);
 void arc4random_buf(void* buf, size_t n);
index 45fe8eadc543c39316906ef79fea377593ce1899..520aa6cf7ab6d85ad97682410cb868ff8c74b05d 100644 (file)
@@ -1,3 +1,7 @@
+17 September 2018: Wouter
+       - Fix compile on Mac for unbound, provide explicit_bzero when libc
+         does not have it.
+
 13 September 2018: Wouter
        - Fix seed for random backup code to use explicit zero when wiped.
        - exit log routine is annotated as noreturn function.