summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2025-06-04 11:52:59 +0200
committerGravatar Nikias Bassen2025-06-04 11:52:59 +0200
commitaf3ab2e2e3c63d6412d70d1f2c75c10c54253b95 (patch)
tree1adfecb05f217d2524f3455d200cdbd8d5da6c71
parentfbf48dde192018135b3ac8a3b21e5200e7f4d7f0 (diff)
downloadlibimobiledevice-glue-af3ab2e2e3c63d6412d70d1f2c75c10c54253b95.tar.gz
libimobiledevice-glue-af3ab2e2e3c63d6412d70d1f2c75c10c54253b95.tar.bz2
configure: [Windows] Add --with-winver option to specify minimum Windows version
This effectively defines WINVER and _WIN32_WINNT to the specified value which will compile the code with that minimum supported Windows version instead of the compiler/SDK default. The passed value is expected to be in hex (like 0x0600) or decimal, so passing --with-winver=0x0600 is a valid accepted input. See https://learn.microsoft.com/cpp/porting/modifying-winver-and-win32-winnt for the values of different Windows versions.
-rw-r--r--configure.ac19
1 files changed, 18 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index 0f0a755..5471ad3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -71,7 +71,24 @@ case ${host_os} in
*mingw32*|*cygwin*)
AC_MSG_RESULT([${host_os}])
win32=true
- AC_DEFINE(WINVER, 0x0501, [minimum Windows version])
+ AC_ARG_WITH([winver],
+ [AS_HELP_STRING([--with-winver], [Set the minimum windows version])],
+ [
+ AS_CASE([${withval}],
+ [0x[[0-9A-Fa-f]]|0x[[0-9A-Fa-f]]*[[0-9A-Fa-f]]], [VAL=${withval}],
+ ['' | *[[!0123456789]]*], [VAL=""],
+ [[[!0]]*], [VAL=${withval}],
+ [VAL=""]
+ )
+ AS_IF([test "x$VAL" != "x"], [
+ AC_DEFINE_UNQUOTED(WINVER, ${VAL}, [minimum Windows version])
+ AC_DEFINE_UNQUOTED(_WIN32_WINNT, ${VAL}, [minimum Windows version])
+ ], [
+ AC_MSG_ERROR([--with-winver expects a hexadecimal value like 0x0600, or a decimal, and must not be 0])
+ ])
+ ],
+ []
+ )
;;
darwin*)
AC_MSG_RESULT([${host_os}])