build_linux=no
build_freebsd=no
+build_openbsd=no
# Detect the target system
case "${host_os}" in
;;
freebsd*)
build_freebsd=yes
- ;;
+ ;;
+ openbsd*)
+ build_openbsd=yes
+ ;;
*)
AC_MSG_ERROR(["OS $host_os is not supported"])
;;
# Pass the conditionals to automake
AM_CONDITIONAL([BUILD_FOR_LINUX], [test "$build_linux" = "yes"])
AM_CONDITIONAL([BUILD_FOR_FREEBSD], [test "$build_freebsd" = "yes"])
+AM_CONDITIONAL([BUILD_FOR_OPENBSD], [test "$build_openbsd" = "yes"])
if test "x$build_linux" = "xyes" ; then
AC_DEFINE([CONFIG_FOR_LINUX], 1, [Build for Linux.])
if test "x$build_freebsd" = "xyes" ; then
AC_DEFINE([CONFIG_FOR_FREEBSD], 1, [Build for FreeBSD.])
fi
+if test "x$build_openbsd" = "xyes" ; then
+ AC_DEFINE([CONFIG_FOR_OPENBSD], 1, [Build for OpenBSD.])
+fi
AC_CHECK_PROGS([GIT], [git])
if test -n "$GIT" && test -e ".git/index" ; then
AC_ARG_WITH([systemd-startup],[AS_HELP_STRING([--with-systemd-startup],[install a systemd startup script during a make install])])
AM_CONDITIONAL([INSTALL_SYSTEMD_STARTUP], [test "x$with_systemd_startup" = "xyes"])
-# Check to see if we should include the systemd stuff to define it as a service
+# Check to see if we should include the FreeBSD stuff to define it as a service
AC_ARG_WITH([freebsd-startup],[AS_HELP_STRING([--with-freebsd-startup],[install a FreeBSD startup script during a make install])])
AM_CONDITIONAL([INSTALL_FREEBSD_STARTUP], [test "x$with_freebsd_startup" = "xyes"])
# Checks for libraries.
AC_CHECK_LIB([pthread],[pthread_create], , AC_MSG_ERROR(pthread library needed))
-AC_CHECK_LIB([rt],[clock_gettime], , AC_MSG_ERROR(librt needed for shared memory library))
+if test "x$build_openbsd" = "xno" ; then
+ # part of libc
+ AC_CHECK_LIB([rt],[clock_gettime], , AC_MSG_ERROR(librt needed for shared memory library))
+fi
# Checks for header files.
AC_CHECK_HEADERS([arpa/inet.h inttypes.h netdb.h stdlib.h string.h sys/socket.h unistd.h])
#include <netdb.h>
#include <sys/socket.h>
-#ifdef CONFIG_FOR_FREEBSD
+#if defined(CONFIG_FOR_FREEBSD) || defined(CONFIG_FOR_OPENBSD)
#include <netinet/in.h>
#include <sys/socket.h>
#endif
die("failed to set size of shared memory \"%s\".", NQPTP_INTERFACE_NAME);
}
-#ifdef CONFIG_FOR_FREEBSD
+#if defined(CONFIG_FOR_FREEBSD) || defined(CONFIG_FOR_OPENBSD)
shared_memory = (struct shm_structure *)mmap(NULL, sizeof(struct shm_structure),
PROT_READ | PROT_WRITE, MAP_SHARED, shm_fd, 0);
#endif