File: user-libatomic.m4

package info (click to toggle)
zfs-linux 2.3.4~git20250812.3b64a96-1
  • links: PTS, VCS
  • area: contrib
  • in suites: experimental
  • size: 70,688 kB
  • sloc: ansic: 393,668; sh: 68,068; asm: 47,734; python: 8,160; makefile: 5,125; perl: 859; sed: 41
file content (28 lines) | stat: -rw-r--r-- 692 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
dnl #
dnl # If -latomic exists and atomic.c doesn't link without it,
dnl # it's needed for __atomic intrinsics.
dnl #
AC_DEFUN([ZFS_AC_CONFIG_USER_LIBATOMIC], [
	AC_MSG_CHECKING([whether -latomic is required])

	saved_libs="$LIBS"
	LIBS="$LIBS -latomic"
	LIBATOMIC_LIBS=""

	AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [
		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
		AC_MSG_RESULT([yes])
	else
		AC_MSG_RESULT([no])
	fi

	LIBS="$saved_libs"
	AC_SUBST([LIBATOMIC_LIBS])
])