Преглед изворни кода

Fixed compilation issues with tdm-gcc

Eric Tsau пре 10 година
родитељ
комит
706770ad62
3 измењених фајлова са 7 додато и 6 уклоњено
  1. 1 1
      Makefile
  2. 4 4
      src/civetweb.c
  3. 2 1
      src/main.c

+ 1 - 1
Makefile

@@ -131,7 +131,7 @@ endif
 
 ifneq (, $(findstring mingw32, $(shell $(CC) -dumpmachine)))
   BUILD_RESOURCES = $(BUILD_DIR)/$(WINDOWS_RESOURCES:.rc=.o)
-  LIBS := -lws2_32 -mwindows
+  LIBS += -lws2_32 -mwindows
   SHARED_LIB = dll
 else
   SHARED_LIB = so

+ 4 - 4
src/civetweb.c

@@ -24,6 +24,9 @@
 #if !defined(_CRT_SECURE_NO_WARNINGS)
 #define _CRT_SECURE_NO_WARNINGS /* Disable deprecation warning in VS2005 */
 #endif
+#ifndef _WIN32_WINNT /* defined for tdm-gcc so we can use getnameinfo */
+#define _WIN32_WINNT 0x0501
+#endif
 #else
 #if defined(__GNUC__) && !defined(_GNU_SOURCE)
 #define _GNU_SOURCE /* for setgroups() */
@@ -86,10 +89,6 @@ mg_static_assert(sizeof(void *) >= sizeof(int), "data type size check");
 #define WIN32_LEAN_AND_MEAN
 #endif
 
-#if defined(_WIN32)
-#include <ws2tcpip.h>
-#endif
-
 #if defined(__SYMBIAN32__)
 #define NO_SSL /* SSL is not supported */
 #define NO_CGI /* CGI is not supported */
@@ -180,6 +179,7 @@ mg_static_assert(MAX_WORKER_THREADS >= 1,
 #if defined(_WIN32) && !defined(__SYMBIAN32__) /* Windows specific */
 #include <windows.h>
 #include <winsock2.h> /* DTL add for SO_EXCLUSIVE */
+#include <ws2tcpip.h>
 
 typedef const char *SOCK_OPT_TYPE;
 

+ 2 - 1
src/main.c

@@ -45,6 +45,7 @@
 
 #include <sys/stat.h>
 #include <stdio.h>
+#include <stdint.h>
 #include <stdlib.h>
 #include <signal.h>
 #include <string.h>
@@ -59,7 +60,7 @@
 
 #ifdef _WIN32
 #ifndef _WIN32_WINNT
-#define _WIN32_WINNT 0x0501 /* Target Windows XP or higher */
+#define _WIN32_WINNT 0x0501 /* for tdm-gcc so we can use getconsolewindow */
 #endif
 #undef UNICODE
 #include <windows.h>