Skip to content

Commit

Permalink
build: fix 'threadsafe' feature detection for older gcc
Browse files Browse the repository at this point in the history
- Add 'threadsafe' to the feature list shown during build if POSIX
  threads are being used.

This is a follow-up to 5adb600 which added support for building a
thread-safe libcurl with older versions of gcc where atomic is not
available but pthread is.

Reported-by: Dan Fandrich

Fixes #12125
Closes #xxxx
  • Loading branch information
jay committed Oct 15, 2023
1 parent e4de693 commit 4585c67
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 3 additions & 2 deletions CMakeLists.txt
Expand Up @@ -1548,8 +1548,9 @@ _add_if("HTTPS-proxy" SSL_ENABLED AND (USE_OPENSSL OR USE_GNUTLS
OR USE_SCHANNEL OR USE_RUSTLS OR USE_BEARSSL OR
USE_MBEDTLS OR USE_SECTRANSP))
_add_if("unicode" ENABLE_UNICODE)
_add_if("threadsafe" HAVE_ATOMIC OR (WIN32 AND
HAVE_WIN32_WINNT GREATER_EQUAL 0x600))
_add_if("threadsafe" HAVE_ATOMIC OR
(USE_THREADS_POSIX AND HAVE_PTHREAD_H) OR
(WIN32 AND HAVE_WIN32_WINNT GREATER_EQUAL 0x600))
_add_if("PSL" USE_LIBPSL)
string(REPLACE ";" " " SUPPORT_FEATURES "${_items}")
message(STATUS "Enabled features: ${SUPPORT_FEATURES}")
Expand Down
3 changes: 3 additions & 0 deletions configure.ac
Expand Up @@ -4612,6 +4612,9 @@ fi

if test "$tst_atomic" = "yes"; then
SUPPORT_FEATURES="$SUPPORT_FEATURES threadsafe"
elif test "x$USE_THREADS_POSIX" = "x1" && \
test "x$ac_cv_header_pthread_h" = "xyes"; then
SUPPORT_FEATURES="$SUPPORT_FEATURES threadsafe"
else
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
Expand Down

0 comments on commit 4585c67

Please sign in to comment.