Add support for building on OpenBSD (#471)

This commit is contained in:
Tobias Heider 2019-03-27 02:13:11 +01:00 committed by Douglas Stebila
parent 0c32a7000e
commit 7005a1d07f
3 changed files with 25 additions and 2 deletions

View File

@ -105,6 +105,19 @@ You need to install the following packages using brew (or a package manager of y
brew install autoconf automake libtool openssl wget
### Install dependencies for OpenBSD
You need to install the following packages using pkg_add:
pkg_add automake libtool
On OpenBSD you have to explicitly set the environment variables `AUTOCONF_VERSION` and
`AUTOMAKE_VERSION` to a version installed on your system.
export AUTOCONF_VERSION=`ls -1 /usr/local/bin/autoreconf-* | sort | tail -n 1 | cut -d'-' -f2`
export AUTOMAKE_VERSION=`ls -1 /usr/local/bin/automake-* | sort | tail -n 1 | cut -d'-' -f2`
### Building
To build, first clone or download the source from GitHub:

View File

@ -16,6 +16,9 @@ AC_DEFUN([DETECT_HOST_AND_CPU], [
linux*)
linux=true
;;
openbsd*)
openbsd=true
;;
*)
#Default Case
AC_MSG_ERROR([Your platform is not currently supported])
@ -24,6 +27,7 @@ AC_DEFUN([DETECT_HOST_AND_CPU], [
AM_CONDITIONAL([ON_DARWIN], [test "x$darwin" = xtrue])
AM_CONDITIONAL([ON_LINUX], [test "x$linux" = xtrue])
AM_CONDITIONAL([ON_OPENBSD], [test "x$openbsd" = xtrue])
# Enable assembly optimizations here
# Appearenly asm optimizations do not work well with darwin

View File

@ -59,11 +59,17 @@ static inline uint64_t AATR_CONST bswap64(uint64_t x) {
#endif
#endif
/* OS X / OpenBSD */
#if defined(__APPLE__) || defined(__OpenBSD__)
/* OS X */
#if defined(__APPLE__)
#include <machine/endian.h>
#endif
/* OpenBSD */
#if defined(__OpenBSD__)
#include <machine/endian.h>
#define HAVE_HOSTSWAP
#endif
/* other BSDs */
#if defined(__FreeBSD__) || defined(__NETBSD__) || defined(__NetBSD__)
#include <sys/endian.h>