diff options
author | Daniel Katz <katzdm@gmail.com> | 2022-07-20 20:20:42 -0400 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2022-07-21 16:30:19 +0200 |
commit | e7511f853aa5ab64923c3074224f9ba2f9361876 (patch) | |
tree | f2c2ba21ed7b242ca0852c99c3249cce9a1d8a37 /m4/curl-functions.m4 | |
parent | 6657602f504e49d27b5aa667a5ed04076ac2c4f6 (diff) | |
download | curl-e7511f853aa5ab64923c3074224f9ba2f9361876.tar.gz |
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
Diffstat (limited to 'm4/curl-functions.m4')
-rw-r--r-- | m4/curl-functions.m4 | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/m4/curl-functions.m4 b/m4/curl-functions.m4 index 1459f3d26..8d2824740 100644 --- a/m4/curl-functions.m4 +++ b/m4/curl-functions.m4 @@ -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]) |