1dnl # 2dnl # If -latomic exists, it's needed for __atomic intrinsics. 3dnl # 4dnl # Some systems (like FreeBSD 13) don't have a libatomic at all because 5dnl # their toolchain doesn't ship it – they obviously don't need it. 6dnl # 7dnl # Others (like sufficiently ancient CentOS) have one, 8dnl # but terminally broken or unlinkable (e.g. it's a dangling symlink, 9dnl # or a linker script that points to a nonexistent file) – 10dnl # most arches affected by this don't actually need -latomic (and if they do, 11dnl # then they should have libatomic that actually exists and links, 12dnl # so don't fall into this category). 13dnl # 14dnl # Technically, we could check if the platform *actually* needs -latomic, 15dnl # or if it has native support for all the intrinsics we use, 16dnl # but it /really/ doesn't matter, and C11 recommends to always link it. 17dnl # 18AC_DEFUN([ZFS_AC_CONFIG_USER_LIBATOMIC], [ 19 AC_MSG_CHECKING([whether -latomic is present]) 20 21 saved_libs="$LIBS" 22 LIBS="$LIBS -latomic" 23 24 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [ 25 LIBATOMIC_LIBS="-latomic" 26 AC_MSG_RESULT([yes]) 27 ], [ 28 LIBATOMIC_LIBS="" 29 AC_MSG_RESULT([no]) 30 ]) 31 32 LIBS="$saved_libs" 33 AC_SUBST([LIBATOMIC_LIBS]) 34]) 35