mirror of
https://github.com/curl/curl.git
synced 2025-01-30 14:22:33 +08:00
curl-functions.m4: check whether atomics can link rather than just compile
Some build toolchains support C11 atomics (i.e., _Atomic types), but will not link the associated atomics runtime unless a flag is passed. In such an environment, linking an application with libcurl.a can fail due to undefined symbols for atomic load/store functions. I encountered this behavior when upgrading curl to 7.84.0 and attempting to build with Solaris Studio 12.6. Solaris provides the flag -xatomic=[gcc | studio], allowing users to link to one of two atomics runtime implementations. However, if the user does not provide this flag, then neither runtime is linked. This led to builds failing in CI. Closes #9190
This commit is contained in:
parent
6657602f50
commit
e7511f853a
@ -5905,11 +5905,12 @@ dnl
|
||||
AC_DEFUN([CURL_ATOMIC],[
|
||||
AC_CHECK_HEADERS(stdatomic.h, [
|
||||
AC_MSG_CHECKING([if _Atomic is available])
|
||||
AC_COMPILE_IFELSE([
|
||||
AC_LINK_IFELSE([
|
||||
AC_LANG_PROGRAM([[
|
||||
$curl_includes_unistd
|
||||
]],[[
|
||||
_Atomic int i = 0;
|
||||
i = 4; // Force an atomic-write operation.
|
||||
]])
|
||||
],[
|
||||
AC_MSG_RESULT([yes])
|
||||
|
Loading…
Reference in New Issue
Block a user