summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorSteve Lhomme <robux4@ycbcr.xyz>2020-05-27 21:13:43 +0000
committerDmitry Baryshkov <dbaryshkov@gmail.com>2020-05-27 21:13:43 +0000
commite0fa7550c0458a95ea5ca011e1d8c405c18b0f1d (patch)
tree315b6b8d296cd024cc6f6b602ba85d18ca8540da /configure.ac
parent12080aa26a8d963acdfa3aa1b8b444f5f58af6bd (diff)
downloadgnutls-e0fa7550c0458a95ea5ca011e1d8c405c18b0f1d.tar.gz
configure.ac: determine if the Vista APIs can be linked statically
If _WIN32_WINNT is higher or equal to 0x0600, Vista API's are allowed during the build. We can assume that the minimum platform the code will run on is Vista [1] In that case there's no need to call API's (ncrypt) dynamically when it can be done statically. [1] https://docs.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt Signed-off-by: Steve Lhomme <robux4@ycbcr.xyz>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac17
1 files changed, 17 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 3413a3dc99..9ea53b7344 100644
--- a/configure.ac
+++ b/configure.ac
@@ -111,6 +111,7 @@ AM_CONDITIONAL(ENABLE_CXX, test "$use_cxx" != "no")
dnl Detect windows build
use_accel=yes
+have_vista_dynamic=yes
case "$host" in
*android*)
have_android=yes
@@ -121,6 +122,22 @@ case "$host" in
AC_DEFINE([_UNICODE], [1], [Defined to 1 for Unicode (wide chars) APIs])
LIB_CRYPT32="-lcrypt32"
AC_SUBST([LIB_CRYPT32])
+ AC_PREPROC_IFELSE([AC_LANG_PROGRAM(
+ [[#include <windows.h>
+ #if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0600
+ # error Vista APIs allowed statically
+ #endif
+ ]],[[;]])],[have_vista_dynamic=yes],[have_vista_dynamic=no])
+ AC_ARG_ENABLE(dyn_ncrypt,
+ AS_HELP_STRING([--enable-dyn-ncrypt], [use ncrypt dynamically]),
+ enable_dyn_ncrypt=$enableval, enable_dyn_ncrypt=$have_vista_dynamic
+ )
+ if test "x$enable_dyn_ncrypt" = "xyes"; then
+ AC_DEFINE([DYN_NCRYPT], 1, [Dynamic use of ncrypt API (win32)])
+ else
+ LIBNCRYPT="-lncrypt"
+ fi
+ AC_SUBST([LIBNCRYPT])
;;
*darwin*)
have_macosx=yes