]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
build: fix 'threadsafe' feature detection for older gcc
authorJay Satiro <raysatiro@yahoo.com>
Sun, 15 Oct 2023 01:55:42 +0000 (21:55 -0400)
committerJay Satiro <raysatiro@yahoo.com>
Tue, 17 Oct 2023 07:33:42 +0000 (03:33 -0400)
- Add 'threadsafe' to the feature list shown during build if POSIX
  threads are being used.

This is a follow-up to 5adb6000 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
Co-authored-by: Dan Fandrich
Fixes https://github.com/curl/curl/issues/12125
Closes https://github.com/curl/curl/pull/12127

CMakeLists.txt
configure.ac

index ced0e2683cff41069b40ade846ee49d72f1e0208..03dc1306863a1dc7de2eaf676b7d0f004347c2ae 100644 (file)
@@ -1560,8 +1560,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}")
index 2d71c838f86b63053b3b5fde85f75b407f3e6700..1861e1e59fa0830c396d758bbd3b96db7bfbbeaf 100644 (file)
@@ -4612,6 +4612,9 @@ fi
 
 if test "$tst_atomic" = "yes"; then
   SUPPORT_FEATURES="$SUPPORT_FEATURES threadsafe"
+elif test "x$USE_THREADS_POSIX" = "x1" -a \
+     "x$ac_cv_header_pthread_h" = "xyes"; then
+  SUPPORT_FEATURES="$SUPPORT_FEATURES threadsafe"
 else
   AC_COMPILE_IFELSE([
     AC_LANG_PROGRAM([[