% brew install boost cmake gcc libpcap pkg-config ragel sqlite
```
+### NetBSD
+In NetBSD you will almost certainly need to have a newer compiler installed.
+Using the example of gcc12 from pkgsrc, one will need to set three
+environment variables before starting:
+export CC="/usr/pkg/gcc12/bin/cc"
+export CXX="/usr/pkg/gcc12/bin/g++"
+export CXXFLAGS="-gdwarf-4"
+
+Then continue with the build as below.
+
+
## Configure & build
In order to configure with `cmake` first create and cd into a build directory:
set(FREEBSD true)
endif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
-if (ARCH_IA32 OR ARCH_X86_64)
+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()
option(FAT_RUNTIME "Build a library that supports multiple microarchitectures" OFF)
#include <netinet/tcp.h>
#include <netinet/udp.h>
#include <netinet/ip_icmp.h>
+#ifdef __NetBSD__
+#include <net/ethertypes.h>
+#include <net/if_ether.h>
+#else
#include <net/ethernet.h>
+#endif /* __NetBSD__ */
#include <arpa/inet.h>
#include <pcap.h>
#include <netinet/tcp.h>
#include <netinet/udp.h>
#include <netinet/ip_icmp.h>
+#ifdef __NetBSD__
+#include <net/ethertypes.h>
+#include <net/if_ether.h>
+#else
#include <net/ethernet.h>
+#endif /* __NetBSD__ */
#include <arpa/inet.h>
#include <pcap.h>
#include "ue2common.h"
#include "util/arch.h"
+#ifdef __NetBSD__
+#include <strings.h>
+#endif
+
+#ifndef __NetBSD__
static really_inline
u32 popcount32(u32 x) {
return __builtin_popcount(x);
// return (((x + (x >> 4)) & 0xf0f0f0f) * 0x1010101) >> 24;
// #endif
}
+#endif /* __NetBSD__ */
static really_inline
u32 popcount32x4(u32 const *x) {
return sum;
}
+#ifndef __NetBSD__
static really_inline
u32 popcount64(u64a x) {
return __builtin_popcountll(x);
// return popcount32(x >> 32) + popcount32(x);
// #endif
}
+#endif /* __NetBSD__ */
static really_inline
u32 popcount64x4(u64a const *x) {