CHECK_FUNCTION_EXISTS(posix_memalign HAVE_POSIX_MEMALIGN)
CHECK_FUNCTION_EXISTS(_aligned_malloc HAVE__ALIGNED_MALLOC)
+if(FREEBSD OR NETBSD)
+ set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -gdwarf-4")
+endif()
+
# these end up in the config file
CHECK_C_COMPILER_FLAG(-fvisibility=hidden HAS_C_HIDDEN)
CHECK_CXX_COMPILER_FLAG(-fvisibility=hidden HAS_CXX_HIDDEN)
set(FREEBSD true)
endif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
+if(CMAKE_SYSTEM_NAME MATCHES "NetBSD")
+ set(NETBSD true)
+endif(CMAKE_SYSTEM_NAME MATCHES "NetBSD")
+
if (LINUX AND (ARCH_IA32 OR ARCH_X86_64))
option(FAT_RUNTIME "Build a library that supports multiple microarchitectures" ON)
else()
#elif defined(ARCH_PPC64EL)
#include "util/arch/ppc64el/ppc64el.h"
#endif
+#ifdef __NetBSD__
+#include <strings.h>
+#define HAVE_LOCAL_POPCOUNT
+#endif
#endif // UTIL_ARCH_X86_H_
#include "ue2common.h"
#include "util/arch.h"
-#ifdef __NetBSD__
-#include <strings.h>
-#endif
-
-#ifndef __NetBSD__
+#ifndef HAVE_LOCAL_POPCOUNT
static really_inline
u32 popcount32(u32 x) {
return __builtin_popcount(x);
// return (((x + (x >> 4)) & 0xf0f0f0f) * 0x1010101) >> 24;
// #endif
}
-#endif /* __NetBSD__ */
+#endif /* HAVE_LOCAL_POPCOUNT */
static really_inline
u32 popcount32x4(u32 const *x) {
return sum;
}
-#ifndef __NetBSD__
+#ifndef HAVE_LOCAL_POPCOUNT
static really_inline
u32 popcount64(u64a x) {
return __builtin_popcountll(x);
// return popcount32(x >> 32) + popcount32(x);
// #endif
}
-#endif /* __NetBSD__ */
+#endif /* HAVE_LOCAL_POPCOUNT */
static really_inline
u32 popcount64x4(u64a const *x) {