[PATCH] Configure: fix build on Windows using non-MSVC compilers

Piotr Sikora piotr.sikora at frickle.com
Thu May 2 21:33:17 UTC 2024


# HG changeset patch
# User Piotr Sikora <piotr at aviatrix.com>
# Date 1714589717 0
#      Wed May 01 18:55:17 2024 +0000
# Node ID 43b04ece77b7132db868122a20c99c8ba89adfb5
# Parent  49dce50fad40bf09db81ca2a35983ecd7b740e43
Configure: fix build on Windows using non-MSVC compilers.

Previously, kernel32 and user32 libraries were linked only when
using MSVC, but they are needed regardless of the compiler.

Signed-off-by: Piotr Sikora <piotr at aviatrix.com>

diff -r 49dce50fad40 -r 43b04ece77b7 auto/cc/msvc
--- a/auto/cc/msvc	Tue Apr 16 18:29:59 2024 +0400
+++ b/auto/cc/msvc	Wed May 01 18:55:17 2024 +0000
@@ -114,8 +114,6 @@
 
 CFLAGS="$CFLAGS $LIBC"
 
-CORE_LIBS="$CORE_LIBS kernel32.lib user32.lib"
-
 # Win32 GUI mode application
 #CORE_LINK="$CORE_LINK -subsystem:windows -entry:mainCRTStartup"
 
diff -r 49dce50fad40 -r 43b04ece77b7 auto/os/win32
--- a/auto/os/win32	Tue Apr 16 18:29:59 2024 +0400
+++ b/auto/os/win32	Wed May 01 18:55:17 2024 +0000
@@ -19,14 +19,14 @@
 case "$NGX_CC_NAME" in
 
     clang | gcc)
-        CORE_LIBS="$CORE_LIBS -ladvapi32 -lws2_32"
+        CORE_LIBS="$CORE_LIBS -lkernel32 -luser32 -ladvapi32 -lws2_32"
         MAIN_LINK="$MAIN_LINK -Wl,--export-all-symbols"
         MAIN_LINK="$MAIN_LINK -Wl,--out-implib=$NGX_OBJS/libnginx.a"
         MODULE_LINK="-shared -L $NGX_OBJS -lnginx"
     ;;
 
     *)
-        CORE_LIBS="$CORE_LIBS advapi32.lib ws2_32.lib"
+        CORE_LIBS="$CORE_LIBS kernel32.lib user32.lib advapi32.lib ws2_32.lib"
     ;;
 
 esac


More information about the nginx-devel mailing list