From e8c3bb45baa1f7b8c17d82ca7a5b0944d57b6a0d Mon Sep 17 00:00:00 2001
From: Gisle Vanem <gvanem@broadpark.no>
Date: Sun, 2 Oct 2005 16:52:07 +0000
Subject: [PATCH] Fix for building with MS Visual-C and single-threaded runtime
 libs.

---
 lib/hostthre.c | 4 ++++
 lib/setup.h    | 8 ++++++++
 2 files changed, 12 insertions(+)

diff --git a/lib/hostthre.c b/lib/hostthre.c
index a1204cf9cb..c364ebfab5 100644
--- a/lib/hostthre.c
+++ b/lib/hostthre.c
@@ -88,6 +88,10 @@
 /* The last #include file should be: */
 #include "memdebug.h"
 
+#if defined(_MSC_VER) && defined(CURL_NO__BEGINTHREADEX)
+#pragma message ("No _beginthreadex() available in this RTL")
+#endif
+
 /***********************************************************************
  * Only for Windows threaded name resolves builds
  **********************************************************************/
diff --git a/lib/setup.h b/lib/setup.h
index 201e783d5e..4b3a50765f 100644
--- a/lib/setup.h
+++ b/lib/setup.h
@@ -262,6 +262,14 @@ typedef int curl_socket_t;
 #endif
 #endif
 
+/* "cl -ML" or "cl -MLd" implies a single-threaded runtime library where
+   _beginthreadex() is not available */
+#if defined(_MSC_VER) && !defined(_MT) && !defined(USE_ARES)
+#undef USE_THREADING_GETADDRINFO
+#undef USE_THREADING_GETHOSTBYNAME
+#define CURL_NO__BEGINTHREADEX
+#endif
+
 #ifdef mpeix
 #define IOCTL_3_ARGS
 #endif
-- 
GitLab