Commit a2cd2cd3 authored by David CARLIER's avatar David CARLIER Committed by Robert Bindar

Mac M1 build support proposal (minus rocksdb option)

parent 744e9752
...@@ -152,7 +152,7 @@ ...@@ -152,7 +152,7 @@
# if defined(__i386__) || defined(__ppc__) # if defined(__i386__) || defined(__ppc__)
# define SIZEOF_CHARP 4 # define SIZEOF_CHARP 4
# define SIZEOF_LONG 4 # define SIZEOF_LONG 4
# elif defined(__x86_64__) || defined(__ppc64__) # elif defined(__x86_64__) || defined(__ppc64__) || defined(__aarch64__) || defined(__arm64__)
# define SIZEOF_CHARP 8 # define SIZEOF_CHARP 8
# define SIZEOF_LONG 8 # define SIZEOF_LONG 8
# else # else
......
...@@ -4,6 +4,29 @@ ...@@ -4,6 +4,29 @@
#if defined(HAVE_ARMV8_CRC) #if defined(HAVE_ARMV8_CRC)
#if defined(__APPLE__)
#include <sys/sysctl.h>
static int pmull_supported;
int crc32_aarch64_available(void)
{
int ret;
size_t len = sizeof(ret);
if (sysctlbyname("hw.optional.armv8_crc32", &ret, &len, NULL, 0) == -1)
return 0;
return ret;
}
const char *crc32c_aarch64_available(void)
{
if (crc32_aarch64_available() == 0)
return NULL;
pmull_supported = 1;
return "Using ARMv8 crc32 + pmull instructions";
}
#else
#include <sys/auxv.h> #include <sys/auxv.h>
#if defined(__FreeBSD__) #if defined(__FreeBSD__)
static unsigned long getauxval(unsigned int key) static unsigned long getauxval(unsigned int key)
...@@ -50,6 +73,7 @@ const char *crc32c_aarch64_available(void) ...@@ -50,6 +73,7 @@ const char *crc32c_aarch64_available(void)
return "Using ARMv8 crc32 instructions"; return "Using ARMv8 crc32 instructions";
} }
#endif /* __APPLE__ */
#endif /* HAVE_ARMV8_CRC */ #endif /* HAVE_ARMV8_CRC */
#ifndef HAVE_ARMV8_CRC_CRYPTO_INTRINSICS #ifndef HAVE_ARMV8_CRC_CRYPTO_INTRINSICS
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment