summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiulio Benetti <giulio.benetti@benettiengineering.com>2020-03-02 10:09:04 -0800
committerGiulio Benetti <giulio.benetti@benettiengineering.com>2020-03-02 10:09:04 -0800
commit59dd53c209c0eb76769e6deb3ead1e09377f0f3e (patch)
tree6c019e744b53c4da09a22d2f31b6c1fb704dca50
parentb783570c671c9652aeaa9b535a4cb45054aa01e0 (diff)
downloadnss-hg-59dd53c209c0eb76769e6deb3ead1e09377f0f3e.tar.gz
Bug 1614183 - Check if PPC __has_include(<sys/auxv.h>). r=kjacobs
Some build environment doesn't provide <sys/auxv.h> and this causes build failure, so let's check if that header exists by using __has_include() helper. Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
-rw-r--r--lib/freebl/blinit.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/freebl/blinit.c b/lib/freebl/blinit.c
index 002569504..aa7785749 100644
--- a/lib/freebl/blinit.c
+++ b/lib/freebl/blinit.c
@@ -452,8 +452,14 @@ ppc_crypto_support()
#if defined(__powerpc__)
+#ifndef __has_include
+#define __has_include(x) 0
+#endif
+
#if defined(__linux__) || (defined(__FreeBSD__) && __FreeBSD__ >= 12)
+#if __has_include(<sys/auxv.h>)
#include <sys/auxv.h>
+#endif
#elif (defined(__FreeBSD__) && __FreeBSD__ < 12)
#include <sys/sysctl.h>
#endif
@@ -470,10 +476,14 @@ CheckPPCSupport()
unsigned long hwcaps = 0;
#if defined(__linux__)
+#if __has_include(<sys/auxv.h>)
hwcaps = getauxval(AT_HWCAP2);
+#endif
#elif defined(__FreeBSD__)
#if __FreeBSD__ >= 12
+#if __has_include(<sys/auxv.h>)
elf_aux_info(AT_HWCAP2, &hwcaps, sizeof(hwcaps));
+#endif
#else
size_t len = sizeof(hwcaps);
sysctlbyname("hw.cpu_features2", &hwcaps, &len, NULL, 0);