diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 21:11:59 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 21:11:59 +0000 |
commit | 3cd01b932e1c85394272ae64fae67ebeda92fb00 (patch) | |
tree | c5a3115d710afc1879ddea5349362a2bc651733c /m4/pdns_check_os.m4 | |
parent | Initial commit. (diff) | |
download | dnsdist-3cd01b932e1c85394272ae64fae67ebeda92fb00.tar.xz dnsdist-3cd01b932e1c85394272ae64fae67ebeda92fb00.zip |
Adding upstream version 1.8.3.upstream/1.8.3
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'm4/pdns_check_os.m4')
-rw-r--r-- | m4/pdns_check_os.m4 | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/m4/pdns_check_os.m4 b/m4/pdns_check_os.m4 new file mode 100644 index 0000000..bb5f2fd --- /dev/null +++ b/m4/pdns_check_os.m4 @@ -0,0 +1,63 @@ +AC_DEFUN([PDNS_CHECK_OS],[ + THREADFLAGS="" + + case "$host_os" in + solaris2.1*) + LIBS="-lposix4 -lpthread $LIBS" + CXXFLAGS="-D_REENTRANT $CXXFLAGS" + have_solaris="yes" + ;; + solaris2.8 | solaris2.9 ) + AC_DEFINE(NEED_POSIX_TYPEDEF,,[If POSIX typedefs need to be defined]) + AC_DEFINE(NEED_INET_NTOP_PROTO,,[If your OS is so broken that it needs an additional prototype]) + LIBS="-lposix4 -lpthread $LIBS" + CXXFLAGS="-D_REENTRANT $CXXFLAGS" + have_solaris="yes" + ;; + linux*) + THREADFLAGS="-pthread" + have_linux="yes" + ;; + darwin*) + CXXFLAGS="-D__APPLE_USE_RFC_3542 -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE $CXXFLAGS" + have_darwin="yes" + ;; + freebsd*) + THREADFLAGS="-pthread" + have_freebsd="yes" + ;; + openbsd*) + THREADFLAGS="-pthread" + have_openbsd="yes" + ;; + *) + LDFLAGS="-pthread $LDFLAGS" + CXXFLAGS="-pthread $CXXFLAGS" + ;; + esac + + AM_CONDITIONAL([HAVE_FREEBSD], [test "x$have_freebsd" = "xyes"]) + AM_CONDITIONAL([HAVE_OPENBSD], [test "x$have_openbsd" = "xyes"]) + AM_CONDITIONAL([HAVE_LINUX], [test "x$have_linux" = "xyes"]) + AM_CONDITIONAL([HAVE_DARWIN], [test "x$have_darwin" = "xyes"]) + AM_CONDITIONAL([HAVE_SOLARIS], [test "x$have_solaris" = "xyes"]) + + AC_MSG_CHECKING([whether -latomic is needed for __atomic builtins]) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[#include <stdint.h>]], + [[uint64_t val = 0; __atomic_add_fetch(&val, 1, __ATOMIC_RELAXED);]] + )], + [AC_MSG_RESULT([no])], + [LIBS="$LIBS -latomic" + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[#include <stdint.h>]], + [[uint64_t val = 0; __atomic_add_fetch(&val, 1, __ATOMIC_RELAXED);]] + )], + [AC_MSG_RESULT([yes])], + [AC_MSG_FAILURE([libatomic needed, but linking with -latomic failed, cannot continue])] + )] + ) + + AC_SUBST(THREADFLAGS) + AC_SUBST([DYNLINKFLAGS], [-export-dynamic]) +]) |