summaryrefslogtreecommitdiff
path: root/acinclude.m4
diff options
context:
space:
mode:
authorMarc Hoersken <info@marc-hoersken.de>2021-03-06 15:52:09 +0100
committerMarc Hoersken <info@marc-hoersken.de>2021-03-15 17:01:30 +0100
commitcc615f48e712202fc26297bc7597e3a1e9188aac (patch)
tree68414bd77b161ba574aa2c2a34acc6991fc10813 /acinclude.m4
parent71529574215190baa15e49e0f825aed79e6566d4 (diff)
downloadcurl-cc615f48e712202fc26297bc7597e3a1e9188aac.tar.gz
config: fix building SMB with configure using Win32 Crypto
Align conditions for NTLM features between CMake and configure builds by differentiating between USE_NTLM and USE_CURL_NTLM_CORE, just like curl_setup.h does internally to detect support of: - USE_NTLM: required for NTLM crypto authentication feature - USE_CURL_NTLM_CORE: required for SMB protocol Implement USE_WIN32_CRYPTO detection by checking for Crypt functions in wincrypt.h which are not available in the Windows App environment. Link advapi32 and crypt32 for Crypto API and Schannel SSL backend. Fix condition of Schannel SSL backend in CMake build accordingly. Reviewed-by: Marcel Raad Closes #6277
Diffstat (limited to 'acinclude.m4')
-rw-r--r--acinclude.m476
1 files changed, 76 insertions, 0 deletions
diff --git a/acinclude.m4 b/acinclude.m4
index c65e1ab62..de88852b3 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -347,6 +347,39 @@ AC_DEFUN([CURL_CHECK_HEADER_WS2TCPIP], [
])
+dnl CURL_CHECK_HEADER_WINCRYPT
+dnl -------------------------------------------------
+dnl Check for compilable and valid wincrypt.h header
+
+AC_DEFUN([CURL_CHECK_HEADER_WINCRYPT], [
+ AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
+ AC_CACHE_CHECK([for wincrypt.h], [curl_cv_header_wincrypt_h], [
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([[
+#undef inline
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN
+#endif
+#include <windows.h>
+#include <wincrypt.h>
+ ]],[[
+ int dummy=2*PROV_RSA_FULL;
+ ]])
+ ],[
+ curl_cv_header_wincrypt_h="yes"
+ ],[
+ curl_cv_header_wincrypt_h="no"
+ ])
+ ])
+ case "$curl_cv_header_wincrypt_h" in
+ yes)
+ AC_DEFINE_UNQUOTED(HAVE_WINCRYPT_H, 1,
+ [Define to 1 if you have the wincrypt.h header file.])
+ ;;
+ esac
+])
+
+
dnl CURL_CHECK_HEADER_WINLDAP
dnl -------------------------------------------------
dnl Check for compilable and valid winldap.h header
@@ -2353,11 +2386,54 @@ AC_DEFUN([CURL_CHECK_WIN32_LARGEFILE], [
AC_MSG_RESULT([yes (large file enabled)])
AC_DEFINE_UNQUOTED(USE_WIN32_LARGE_FILES, 1,
[Define to 1 if you are building a Windows target with large file support.])
+ AC_SUBST(USE_WIN32_LARGE_FILES, [1])
;;
win32_small_files)
AC_MSG_RESULT([yes (large file disabled)])
AC_DEFINE_UNQUOTED(USE_WIN32_SMALL_FILES, 1,
[Define to 1 if you are building a Windows target without large file support.])
+ AC_SUBST(USE_WIN32_SMALL_FILES, [1])
+ ;;
+ *)
+ AC_MSG_RESULT([no])
+ ;;
+ esac
+])
+
+dnl CURL_CHECK_WIN32_CRYPTO
+dnl -------------------------------------------------
+dnl Check if curl's WIN32 crypto lib can be used
+
+AC_DEFUN([CURL_CHECK_WIN32_CRYPTO], [
+ AC_REQUIRE([CURL_CHECK_HEADER_WINCRYPT])dnl
+ AC_MSG_CHECKING([whether build target supports WIN32 crypto API])
+ curl_win32_crypto_api="no"
+ if test "$curl_cv_header_wincrypt_h" = "yes"; then
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([[
+#undef inline
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN
+#endif
+#include <windows.h>
+#include <wincrypt.h>
+ ]],[[
+ HCRYPTPROV hCryptProv;
+ if(CryptAcquireContext(&hCryptProv, NULL, NULL, PROV_RSA_FULL,
+ CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) {
+ CryptReleaseContext(hCryptProv, 0);
+ }
+ ]])
+ ],[
+ curl_win32_crypto_api="yes"
+ ])
+ fi
+ case "$curl_win32_crypto_api" in
+ yes)
+ AC_MSG_RESULT([yes])
+ AC_DEFINE_UNQUOTED(USE_WIN32_CRYPTO, 1,
+ [Define to 1 if you are building a Windows target with crypto API support.])
+ AC_SUBST(USE_WIN32_CRYPTO, [1])
;;
*)
AC_MSG_RESULT([no])