From 95eda05cfe4231f581d49485565fcdf665a63023 Mon Sep 17 00:00:00 2001 From: Wouter Wijngaards Date: Mon, 5 Jan 2015 09:13:32 +0000 Subject: [PATCH] - getauxval test for ppc64 linux compatibility. git-svn-id: file:///svn/unbound/trunk@3293 be551aaa-1e26-0410-a405-d3ace91eadb9 --- compat/getentropy_linux.c | 14 ++++++++------ config.h.in | 3 +++ configure | 11 +++++++++++ configure.ac | 1 + doc/Changelog | 3 +++ 5 files changed, 26 insertions(+), 6 deletions(-) diff --git a/compat/getentropy_linux.c b/compat/getentropy_linux.c index 32d58a7cd..60e010db7 100644 --- a/compat/getentropy_linux.c +++ b/compat/getentropy_linux.c @@ -474,22 +474,24 @@ getentropy_fallback(void *buf, size_t len) HD(cnt); } -#ifdef AT_RANDOM +#ifdef HAVE_GETAUXVAL +# ifdef AT_RANDOM /* Not as random as you think but we take what we are given */ p = (char *) getauxval(AT_RANDOM); if (p) HR(p, 16); -#endif -#ifdef AT_SYSINFO_EHDR +# endif +# ifdef AT_SYSINFO_EHDR p = (char *) getauxval(AT_SYSINFO_EHDR); if (p) HR(p, pgs); -#endif -#ifdef AT_BASE +# endif +# ifdef AT_BASE p = (char *) getauxval(AT_BASE); if (p) HD(p); -#endif +# endif +#endif /* HAVE_GETAUXVAL */ SHA512_Final(results, &ctx); memcpy((char*)buf + i, results, min(sizeof(results), len - i)); diff --git a/config.h.in b/config.h.in index 2b7770b5c..1be23c388 100644 --- a/config.h.in +++ b/config.h.in @@ -146,6 +146,9 @@ /* Whether getaddrinfo is available */ #undef HAVE_GETADDRINFO +/* Define to 1 if you have the `getauxval' function. */ +#undef HAVE_GETAUXVAL + /* Define to 1 if you have the `getentropy' function. */ #undef HAVE_GETENTROPY diff --git a/configure b/configure index e02f2bb2b..1d230bdd2 100755 --- a/configure +++ b/configure @@ -18254,6 +18254,17 @@ _ACEOF fi +done + + for ac_func in getauxval +do : + ac_fn_c_check_func "$LINENO" "getauxval" "ac_cv_func_getauxval" +if test "x$ac_cv_func_getauxval" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_GETAUXVAL 1 +_ACEOF + +fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing clock_gettime" >&5 diff --git a/configure.ac b/configure.ac index 240556352..df5922793 100644 --- a/configure.ac +++ b/configure.ac @@ -1021,6 +1021,7 @@ if test "$USE_NSS" = "no"; then AC_LIBOBJ(sha512) ]) AC_CHECK_HEADERS([sys/sysctl.h],,, [AC_INCLUDES_DEFAULT]) + AC_CHECK_FUNCS([getauxval]) AC_SEARCH_LIBS([clock_gettime], [rt]) ;; esac diff --git a/doc/Changelog b/doc/Changelog index 3a72bcf80..758ab381f 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,3 +1,6 @@ +5 January 2015: Wouter + - getauxval test for ppc64 linux compatibility. + 9 December 2014: Wouter - svn trunk has 1.5.2 in development. - config.guess and config.sub update from libtoolize. -- 2.47.2