Update ABD stats for linear page Linux
[zfs.git] / config / user-libatomic.m4
blobd15069f9c445b6d26b3f8d9717c1d0c89d768d1b
1 dnl #
2 dnl # If -latomic exists and atomic.c doesn't link without it,
3 dnl # it's needed for __atomic intrinsics.
4 dnl #
5 AC_DEFUN([ZFS_AC_CONFIG_USER_LIBATOMIC], [
6         AC_MSG_CHECKING([whether -latomic is required])
8         saved_libs="$LIBS"
9         LIBS="$LIBS -latomic"
10         LIBATOMIC_LIBS=""
12         AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [
13                 LIBS="$saved_libs"
14                 saved_cflags="$CFLAGS"
15                 CFLAGS="$CFLAGS -isystem lib/libspl/include"
16                 AC_LINK_IFELSE([AC_LANG_PROGRAM([#include "lib/libspl/atomic.c"], [])], [], [LIBATOMIC_LIBS="-latomic"])
17                 CFLAGS="$saved_cflags"
18         ])
20         if test -n "$LIBATOMIC_LIBS"; then
21                 AC_MSG_RESULT([yes])
22         else
23                 AC_MSG_RESULT([no])
24         fi
26         LIBS="$saved_libs"
27         AC_SUBST([LIBATOMIC_LIBS])