You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
1.2 KiB

  1. --- a/m4/pdns_check_os.m4
  2. +++ b/m4/pdns_check_os.m4
  3. @@ -35,16 +35,21 @@
  4. AM_CONDITIONAL([HAVE_LINUX], [test "x$have_linux" = "xyes"])
  5. AM_CONDITIONAL([HAVE_SOLARIS], [test "x$have_solaris" = "xyes"])
  6. - case "$host" in
  7. - mips* | powerpc-* )
  8. - AC_MSG_CHECKING([whether the linker accepts -latomic])
  9. - LDFLAGS="-latomic $LDFLAGS"
  10. - AC_LINK_IFELSE([m4_default([],[AC_LANG_PROGRAM()])],
  11. - [AC_MSG_RESULT([yes])],
  12. - [AC_MSG_ERROR([Unable to link against libatomic, cannot continue])]
  13. - )
  14. - ;;
  15. - esac
  16. + AC_MSG_CHECKING([whether -latomic is needed for __atomic builtins])
  17. + AC_LINK_IFELSE(
  18. + [AC_LANG_PROGRAM([[#include <stdint.h>]],
  19. + [[uint64_t val = 0; __atomic_add_fetch(&val, 1, __ATOMIC_RELAXED);]]
  20. + )],
  21. + [AC_MSG_RESULT([no])],
  22. + [LIBS="$LIBS -latomic"
  23. + AC_LINK_IFELSE(
  24. + [AC_LANG_PROGRAM([[#include <stdint.h>]],
  25. + [[uint64_t val = 0; __atomic_add_fetch(&val, 1, __ATOMIC_RELAXED);]]
  26. + )],
  27. + [AC_MSG_RESULT([yes])],
  28. + [AC_MSG_FAILURE([libatomic needed, but linking with -latomic failed, cannot continue])]
  29. + )]
  30. + )
  31. AC_SUBST(THREADFLAGS)
  32. AC_SUBST([DYNLINKFLAGS], [-export-dynamic])