2021-04-19 08:13:24 +03:00
|
|
|
dnl #
|
2021-07-13 23:50:48 +03:00
|
|
|
dnl # If -latomic exists and atomic.c doesn't link without it,
|
|
|
|
dnl # it's needed for __atomic intrinsics.
|
2021-04-19 08:13:24 +03:00
|
|
|
dnl #
|
|
|
|
AC_DEFUN([ZFS_AC_CONFIG_USER_LIBATOMIC], [
|
2021-07-13 23:50:48 +03:00
|
|
|
AC_MSG_CHECKING([whether -latomic is required])
|
2021-04-19 08:13:24 +03:00
|
|
|
|
|
|
|
saved_libs="$LIBS"
|
|
|
|
LIBS="$LIBS -latomic"
|
2021-07-13 23:50:48 +03:00
|
|
|
LIBATOMIC_LIBS=""
|
2021-04-19 08:13:24 +03:00
|
|
|
|
|
|
|
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [
|
2021-07-13 23:50:48 +03:00
|
|
|
LIBS="$saved_libs"
|
|
|
|
saved_cflags="$CFLAGS"
|
|
|
|
CFLAGS="$CFLAGS -isystem lib/libspl/include"
|
|
|
|
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include "lib/libspl/atomic.c"], [])], [], [LIBATOMIC_LIBS="-latomic"])
|
|
|
|
CFLAGS="$saved_cflags"
|
|
|
|
])
|
|
|
|
|
|
|
|
if test -n "$LIBATOMIC_LIBS"; then
|
2021-04-19 08:13:24 +03:00
|
|
|
AC_MSG_RESULT([yes])
|
2021-07-13 23:50:48 +03:00
|
|
|
else
|
2021-04-19 08:13:24 +03:00
|
|
|
AC_MSG_RESULT([no])
|
2021-07-13 23:50:48 +03:00
|
|
|
fi
|
2021-04-19 08:13:24 +03:00
|
|
|
|
|
|
|
LIBS="$saved_libs"
|
|
|
|
AC_SUBST([LIBATOMIC_LIBS])
|
|
|
|
])
|