can_build = compiler.compiles(code, name: 'uint64x2_t tests')
endif
+if target_machine.cpu_family() in ['x86', 'x86_64']
+ funcs = ['_mm_loadu_si64']
+ foreach func: funcs
+ has = cxx.has_header_symbol('emmintrin.h', func)
+ if not has
+ can_build = false
+ endif
+ endforeach
+endif
dep_ipcrypt2 = declare_dependency()
if can_build
-lib_ipcrypt2 = static_library(
- 'ipcrypt2',
- 'ipcrypt2.c',
- extra_files: [
- 'include/ipcrypt2.h',
- 'LICENSE',
- 'README.md',
- ],
-)
+ lib_ipcrypt2 = static_library(
+ 'ipcrypt2',
+ 'ipcrypt2.c',
+ extra_files: [
+ 'include/ipcrypt2.h',
+ 'LICENSE',
+ 'README.md',
+ ],
+ )
-dep_ipcrypt2 = declare_dependency(
- link_with: lib_ipcrypt2,
- include_directories: include_directories('./include'),
-)
+ dep_ipcrypt2 = declare_dependency(
+ link_with: lib_ipcrypt2,
+ include_directories: include_directories('./include'),
+ )
endif
if not can_build and opt_ipcrypt2.enabled()
+++ /dev/null
-AC_DEFUN([PDNS_CHECK_AARCH64_UINT64X2_T], [
- AC_CANONICAL_BUILD()
- AS_IF([test "$build_cpu" = "aarch64"], [
- AC_MSG_CHECKING([whether the compiler supports calculations with uint64x2_t])
- AC_LANG_PUSH([C++])
- AC_COMPILE_IFELSE([AC_LANG_SOURCE([
-# if defined(_MSC_VER) && defined(_M_ARM64)
-# include <arm64_neon.h>
-# else
-# include <arm_neon.h>
-# endif
-int main() {
- uint64x2_t foo = {0, 0};
- uint64x2_t bar = vshrq_n_u8(foo, 1);
- return 0;
-}
- ])],[
- dnl We just define this. Proper detection is only done in Meson
- AC_DEFINE([HAVE_IPCRYPT2], [1], [Define to 1 to build with IPCrypt2])
- AC_MSG_RESULT([ok])
- ],[
- AC_MSG_FAILURE([no])
- ])
- AC_LANG_POP()
- ])
-])
AC_DEFUN([PDNS_ENABLE_IPCRYPT2], [
AC_MSG_CHECKING([whether to enable ipcrypt2 support])
AC_ARG_ENABLE([ipcrypt2],
- AS_HELP_STRING([--enable-ipcrypt2], [enable ipcrypt2 support @<:@default=yes@:>@]),
+ AS_HELP_STRING([--enable-ipcrypt2], [enable ipcrypt2 support @<:@default=auto@:>@]),
[enable_ipcrypt2=$enableval],
- [enable_ipcrypt2=yes]
+ [enable_ipcrypt2=auto]
)
+
AC_MSG_RESULT([$enable_ipcrypt2])
- AM_CONDITIONAL([HAVE_IPCRYPT2], [test "x$enable_ipcrypt2" != "xno"])
+ HAVE_IPCRYPT2=0
+
+ AS_IF([test "x$enable_ipcrypt2" != "xno"], [
+ AC_CANONICAL_BUILD()
+ AS_IF([test "$build_cpu" = "aarch64"], [
+ AC_MSG_CHECKING([whether the compiler supports calculations with uint64x2_t and _mm_loadu_si64])
+ AC_LANG_PUSH([C++])
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([
+# if defined(_MSC_VER) && defined(_M_ARM64)
+# include <arm64_neon.h>
+# else
+# include <arm_neon.h>
+# endif
+#include <emmintrin.h>
+int main() {
+ uint64x2_t foo = {0, 0};
+ uint64x2_t bar = vshrq_n_u8(foo, 1);
+ void *a = (void*) &_mm_loadu_si64;
+ long long b = (long long) a;
+ return (int) b;
+}
+ ])],[
+ [HAVE_IPCRYPT2=1]
+ AC_MSG_RESULT([ok])
+ ], [
+ AC_MSG_RESULT([no])
+ ])
+ AC_LANG_POP()
+ ], [
+ AC_MSG_CHECKING([whether the compiler supports _mm_loadu_si64])
+ AC_LANG_PUSH([C++])
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([
+#include <emmintrin.h>
+int main() {
+ void *a = (void*) &_mm_loadu_si64;
+ long long b = (long long) a;
+ return (int) b;
+}
+ ])],[
+ [HAVE_IPCRYPT2=1]
+ AC_MSG_RESULT([ok])
+ ], [
+ AC_MSG_RESULT([no])
+ ])
+ AC_LANG_POP()
+ ])
+ ])
+
+ AM_CONDITIONAL([HAVE_IPCRYPT2], [test "x$HAVE_IPCRYPT2" != "x0"])
+
+ AS_IF([test "x$enable_ipcrypt2" = "xyes"], [
+ AS_IF([test x"$HAVE_IPCRYPT2" = "x0"], [
+ AC_MSG_ERROR([ipcrypt2 support requested but is not available])
+ ])
+ ])
+
AM_COND_IF([HAVE_IPCRYPT2], [
AC_DEFINE([HAVE_IPCRYPT2], [1], [Define to 1 if you enable ipcrypt2 support])
])