소스 검색

Merge pull request #134 from Dialga/master

Fix various compilations issues
bel2125 10 년 전
부모
커밋
2f932355f0
4개의 변경된 파일12개의 추가작업 그리고 15개의 파일을 삭제
  1. 2 8
      Makefile
  2. 1 1
      resources/Makefile.in-lua
  3. 7 5
      src/civetweb.c
  4. 2 1
      src/main.c

+ 2 - 8
Makefile

@@ -91,12 +91,6 @@ endif
 
 ifdef WITH_WEBSOCKET
   CFLAGS += -DUSE_WEBSOCKET
-  ifdef WITH_LUA
-    CFLAGS += -DUSE_TIMERS
-    ifeq ($(TARGET_OS),LINUX)
-      LIBS += -lrt
-    endif
-  endif
 endif
 
 ifdef CONFIG_FILE
@@ -135,9 +129,9 @@ ifdef WITH_LUA_SHARED
   LIBS += -llua5.2
 endif
 
-ifneq (, $(findstring mingw32, $(shell gcc -dumpmachine)))
+ifneq (, $(findstring mingw32, $(shell $(CC) -dumpmachine)))
   BUILD_RESOURCES = $(BUILD_DIR)/$(WINDOWS_RESOURCES:.rc=.o)
-  LIBS := $(filter-out -lrt, $(LIBS)) -lws2_32 -lcomdlg32 -mwindows
+  LIBS += -lws2_32 -mwindows
   SHARED_LIB = dll
 else
   SHARED_LIB = so

+ 1 - 1
resources/Makefile.in-lua

@@ -12,7 +12,7 @@ endif
 LUA_DIR = src/third_party/lua-5.2.4/src
 LUA_CFLAGS = -I$(LUA_DIR) -DLUA_COMPAT_ALL -DUSE_LUA
 
-ifneq ($(OS),Windows_NT)
+ifneq ($(TARGET_OS),WIN32)
   LUA_CFLAGS += -DLUA_USE_POSIX -DLUA_USE_DLOPEN
 endif
 

+ 7 - 5
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;
 
@@ -222,7 +222,8 @@ typedef long off_t;
 /* Visual Studio 6 does not know __func__ or __FUNCTION__
  * The rest of MS compilers use __FUNCTION__, not C99 __func__
  * Also use _strtoui64 on modern M$ compilers */
-#if defined(_MSC_VER) && (_MSC_VER < 1300)
+#if defined(_MSC_VER)
+#if (_MSC_VER < 1300)
 #define STRX(x) #x
 #define STR(x) STRX(x)
 #define __func__ __FILE__ ":" STR(__LINE__)
@@ -232,6 +233,7 @@ typedef long off_t;
 #define __func__ __FUNCTION__
 #define strtoull(x, y, z) (_strtoui64(x, y, z))
 #define strtoll(x, y, z) (_strtoi64(x, y, z))
+#endif
 #endif /* _MSC_VER */
 
 #define ERRNO ((int)(GetLastError()))

+ 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>