diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2020-10-01 18:44:43 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2020-10-01 18:44:43 +0300 |
commit | 7e364798939f474e3223c0794046d73c129aad45 (patch) | |
tree | 6c8947c05b5251fdc78becd952be542cb2f97112 | |
parent | be89295a4c72993c6a93b7ac16acb9ad564d02b1 (diff) | |
download | libmicrohttpd-7e364798939f474e3223c0794046d73c129aad45.tar.gz libmicrohttpd-7e364798939f474e3223c0794046d73c129aad45.zip |
configure: check and report target W32 version.
Default W32 version is now Vista or later.
WinXP is still supported by MHD
-rw-r--r-- | configure.ac | 176 | ||||
-rw-r--r-- | src/include/mhd_options.h | 2 |
2 files changed, 173 insertions, 5 deletions
diff --git a/configure.ac b/configure.ac index 2dbafcb5..ca62015a 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -376,6 +376,172 @@ AS_CASE(["$host_os"], | |||
376 | AM_CONDITIONAL([CYGWIN_TARGET], [[test "x$os_is_windows" = "xyes" && \ | 376 | AM_CONDITIONAL([CYGWIN_TARGET], [[test "x$os_is_windows" = "xyes" && \ |
377 | test "x${os_is_native_w32}" != "xyes"]]) | 377 | test "x${os_is_native_w32}" != "xyes"]]) |
378 | 378 | ||
379 | AS_VAR_IF([os_is_windows], ["yes"], | ||
380 | [ | ||
381 | AC_MSG_CHECKING([[wheather target W32 version is specified by precomiler defines]]) | ||
382 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | ||
383 | /* Note: check logic is reversed for easy log reading */ | ||
384 | #ifdef WINVER | ||
385 | #error WINVER is defined | ||
386 | choke me now; | ||
387 | #endif | ||
388 | #ifdef _WIN32_WINNT | ||
389 | #error _WIN32_WINNT is defined | ||
390 | choke me now; | ||
391 | #endif | ||
392 | #ifdef NTDDI | ||
393 | #error NTDDI is defined | ||
394 | choke me now; | ||
395 | #endif | ||
396 | ]],[[(void)0]]) | ||
397 | ], [[mhd_w32_ver_preselect=no]], [[mhd_w32_ver_preselect=yes]] | ||
398 | ) | ||
399 | AC_MSG_RESULT([[${mhd_w32_ver_preselect}]]) | ||
400 | AC_CHECK_HEADERS([windows.h sdkddkver.h], [], [], [AC_INCLUDES_DEFAULT]) | ||
401 | AS_VAR_IF([mhd_w32_ver_preselect],["yes"], | ||
402 | [ | ||
403 | AC_MSG_CHECKING([[for specified target W32 version]]) | ||
404 | AS_UNSET([[mhd_w32_ver]]) | ||
405 | AS_UNSET([[mhd_w32_ver_msg]]) | ||
406 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | ||
407 | #if _WIN32_WINNT+0 < 0x0501 | ||
408 | /* Check before headers inclusion */ | ||
409 | #error _WIN32_WINNT is less than 0x0501 | ||
410 | choke me now; | ||
411 | #endif | ||
412 | |||
413 | #ifdef HAVE_SDKDDKVER_H | ||
414 | #include <sdkddkver.h> | ||
415 | #endif | ||
416 | #ifdef HAVE_WINDOWS_H | ||
417 | #include <windows.h> | ||
418 | #endif | ||
419 | |||
420 | #if _WIN32_WINNT+0 < 0x0501 | ||
421 | #error _WIN32_WINNT is less than 0x0501 | ||
422 | choke me now; | ||
423 | #endif | ||
424 | ]],[[(void)0]]) | ||
425 | ], [], [ | ||
426 | AC_MSG_RESULT([[pre-WinXP]]) | ||
427 | AC_MSG_ERROR([[libmicrohttpd cannot be compiled for Windows version before Windows XP]]) | ||
428 | ] | ||
429 | ) | ||
430 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | ||
431 | #ifdef HAVE_SDKDDKVER_H | ||
432 | #include <sdkddkver.h> | ||
433 | #endif | ||
434 | #ifdef HAVE_WINDOWS_H | ||
435 | #include <windows.h> | ||
436 | #endif | ||
437 | |||
438 | #if _WIN32_WINNT+0 == 0x0501 | ||
439 | #error _WIN32_WINNT is 0x0501 | ||
440 | choke me now; | ||
441 | #endif | ||
442 | #if _WIN32_WINNT+0 == 0x0502 | ||
443 | #error _WIN32_WINNT is 0x0502 | ||
444 | choke me now; | ||
445 | #endif | ||
446 | ]],[[(void)0]]) | ||
447 | ], [], [ | ||
448 | mhd_w32_ver="WinXP" | ||
449 | mhd_w32_ver_msg="WinXP (selected by precompiler flags)" | ||
450 | ] | ||
451 | ) | ||
452 | AS_VAR_SET_IF([mhd_w32_ver], [], | ||
453 | [ | ||
454 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | ||
455 | #ifdef HAVE_SDKDDKVER_H | ||
456 | #include <sdkddkver.h> | ||
457 | #endif | ||
458 | #ifdef HAVE_WINDOWS_H | ||
459 | #include <windows.h> | ||
460 | #endif | ||
461 | |||
462 | #if _WIN32_WINNT+0 < 0x0600 | ||
463 | #error _WIN32_WINNT is less than 0x0600 but greater than 0x0502 | ||
464 | choke me now; | ||
465 | #endif | ||
466 | ]],[[(void)0]]) | ||
467 | ], [], [ | ||
468 | AC_MSG_ERROR([[_WIN32_WINNT value is wrong (less than 0x0600 but greater than 0x0502)]]) | ||
469 | ] | ||
470 | ) | ||
471 | |||
472 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | ||
473 | #ifdef HAVE_SDKDDKVER_H | ||
474 | #include <sdkddkver.h> | ||
475 | #endif | ||
476 | #ifdef HAVE_WINDOWS_H | ||
477 | #include <windows.h> | ||
478 | #endif | ||
479 | |||
480 | #if _WIN32_WINNT+0 == 0x0600 | ||
481 | #error _WIN32_WINNT is 0x0600 | ||
482 | choke me now; | ||
483 | #endif | ||
484 | ]],[[(void)0]]) | ||
485 | ], [], [ | ||
486 | mhd_w32_ver="Vista" | ||
487 | mhd_w32_ver_msg="Vista (selected by precompiler flags)" | ||
488 | ] | ||
489 | ) | ||
490 | ] | ||
491 | ) | ||
492 | |||
493 | AS_VAR_SET_IF([mhd_w32_ver], [], | ||
494 | [ | ||
495 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | ||
496 | #ifdef HAVE_SDKDDKVER_H | ||
497 | #include <sdkddkver.h> | ||
498 | #endif | ||
499 | #ifdef HAVE_WINDOWS_H | ||
500 | #include <windows.h> | ||
501 | #endif | ||
502 | |||
503 | #if _WIN32_WINNT+0 > 0x0600 | ||
504 | #error _WIN32_WINNT is greater than 0x0600 | ||
505 | choke me now; | ||
506 | #endif | ||
507 | ]],[[(void)0]]) | ||
508 | ], [ | ||
509 | mhd_w32_ver="unknown" | ||
510 | mhd_w32_ver_msg="unknown (cannot be detected)" | ||
511 | ], [ | ||
512 | mhd_w32_ver="newer than Vista" | ||
513 | mhd_w32_ver_msg="newer than Vista (selected by precompiler flags)" | ||
514 | ] | ||
515 | ) | ||
516 | ] | ||
517 | ) | ||
518 | AC_MSG_RESULT([[${mhd_w32_ver}]]) | ||
519 | ], [ | ||
520 | mhd_w32_ver="Vista" | ||
521 | mhd_w32_ver_msg="Vista (default, override by CPPFLAGS=-D_WIN32_WINNT=0xNNNN)" | ||
522 | CPPFLAGS="$CPPFLAGS -D_WIN32_WINNT=0x0600" | ||
523 | AC_MSG_CHECKING([[wheather headers accept _WIN32_WINNT=0x0600]]) | ||
524 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | ||
525 | #ifdef HAVE_SDKDDKVER_H | ||
526 | #include <sdkddkver.h> | ||
527 | #endif | ||
528 | #ifdef HAVE_WINDOWS_H | ||
529 | #include <windows.h> | ||
530 | #endif | ||
531 | #include <stdio.h> | ||
532 | ]],[[(void)0]]) | ||
533 | ], [ | ||
534 | AC_MSG_RESULT([[yes]]) | ||
535 | ], [ | ||
536 | AC_MSG_RESULT([[no]]) | ||
537 | AC_MSG_ERROR([Headers do not accept _WIN32_WINNT=0x0600. Consider override target W32 version by CPPFLAGS=-D_WIN32_WINNT=0xNNNN]) | ||
538 | ] | ||
539 | ) | ||
540 | ] | ||
541 | ) | ||
542 | ] | ||
543 | ) | ||
544 | |||
379 | AC_ARG_WITH([threads], | 545 | AC_ARG_WITH([threads], |
380 | [AS_HELP_STRING([--with-threads=LIB],[choose threading library (posix, w32, auto, none) [auto]])], | 546 | [AS_HELP_STRING([--with-threads=LIB],[choose threading library (posix, w32, auto, none) [auto]])], |
381 | [], [with_threads='auto']) | 547 | [], [with_threads='auto']) |
@@ -748,9 +914,6 @@ AS_IF([test "$enable_poll" != "no"], | |||
748 | [AC_INCLUDES_DEFAULT]), | 914 | [AC_INCLUDES_DEFAULT]), |
749 | [AC_MSG_CHECKING([for WSAPoll()]) | 915 | [AC_MSG_CHECKING([for WSAPoll()]) |
750 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ | 916 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
751 | #if defined(_WIN32) && ! defined(__CYGWIN__) && ! defined(_WIN32_WINNT) | ||
752 | #define _WIN32_WINNT 0x0501 | ||
753 | #endif | ||
754 | #include <winsock2.h> | 917 | #include <winsock2.h> |
755 | ]],[[ | 918 | ]],[[ |
756 | WSAPOLLFD fda[2]; | 919 | WSAPOLLFD fda[2]; |
@@ -2137,10 +2300,15 @@ AS_IF([test "x$enable_curl" != "xyes"], | |||
2137 | [MSG_CURL="no, many unit tests will not run"], | 2300 | [MSG_CURL="no, many unit tests will not run"], |
2138 | [MSG_CURL="yes"]) | 2301 | [MSG_CURL="yes"]) |
2139 | 2302 | ||
2303 | AS_VAR_IF([os_is_windows], ["yes"], | ||
2304 | [os_ver_msg=" | ||
2305 | Target W32 ver: ${mhd_w32_ver_msg}"], [AS_UNSET([[os_ver_msg]])]) | ||
2306 | |||
2307 | |||
2140 | AC_MSG_NOTICE([GNU libmicrohttpd ${PACKAGE_VERSION} Configuration Summary: | 2308 | AC_MSG_NOTICE([GNU libmicrohttpd ${PACKAGE_VERSION} Configuration Summary: |
2141 | Target directory: ${prefix} | 2309 | Target directory: ${prefix} |
2142 | Cross-compiling: ${cross_compiling} | 2310 | Cross-compiling: ${cross_compiling} |
2143 | Operating System: ${host_os} | 2311 | Operating System: ${host_os}${os_ver_msg} |
2144 | Shutdown of listening socket trigger select: ${mhd_cv_host_shtdwn_trgr_select} | 2312 | Shutdown of listening socket trigger select: ${mhd_cv_host_shtdwn_trgr_select} |
2145 | Inter-thread comm: ${use_itc} | 2313 | Inter-thread comm: ${use_itc} |
2146 | poll support: ${enable_poll=no} | 2314 | poll support: ${enable_poll=no} |
diff --git a/src/include/mhd_options.h b/src/include/mhd_options.h index 354ccb45..dddc336f 100644 --- a/src/include/mhd_options.h +++ b/src/include/mhd_options.h | |||
@@ -87,7 +87,7 @@ | |||
87 | /* Do not warn about POSIX name usage */ | 87 | /* Do not warn about POSIX name usage */ |
88 | #define _CRT_NONSTDC_NO_WARNINGS 1 | 88 | #define _CRT_NONSTDC_NO_WARNINGS 1 |
89 | #ifndef _WIN32_WINNT | 89 | #ifndef _WIN32_WINNT |
90 | #define _WIN32_WINNT 0x0501 | 90 | #define _WIN32_WINNT 0x0600 |
91 | #else /* _WIN32_WINNT */ | 91 | #else /* _WIN32_WINNT */ |
92 | #if _WIN32_WINNT < 0x0501 | 92 | #if _WIN32_WINNT < 0x0501 |
93 | #error "Headers for Windows XP or later are required" | 93 | #error "Headers for Windows XP or later are required" |