fix link issues with MinGW - a substitute declaration(correctByteOrder) for itoln...
authorAntony Riakiotakis <kalast@gmail.com>
Tue, 6 Sep 2011 11:17:29 +0000 (11:17 +0000)
committerAntony Riakiotakis <kalast@gmail.com>
Tue, 6 Sep 2011 11:17:29 +0000 (11:17 +0000)
CMakeLists.txt
build_files/scons/config/win32-mingw-config.py
intern/guardedalloc/MEM_sys_types.h
source/blender/blenloader/BLO_sys_types.h

index b54b18a..8b5693f 100644 (file)
@@ -797,7 +797,7 @@ elseif(WIN32)
        else()
                # keep GCC spesific stuff here
                if(CMAKE_COMPILER_IS_GNUCC)
-                       set(PLATFORM_LINKLIBS "-lshell32 -lshfolder -lgdi32 -lmsvcrt -lwinmm -lmingw32 -lm -lws2_32 -lz -lstdc++ -lole32 -luuid")
+                       set(PLATFORM_LINKLIBS "-lshell32 -lshfolder -lgdi32 -lmsvcrt -lwinmm -lmingw32 -lm -lws2_32 -lz -lstdc++ -lole32 -luuid -lwsock32")
                        set(PLATFORM_CFLAGS "-pipe -funsigned-char -fno-strict-aliasing")
 
                        add_definitions(-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE)
index c815b76..37d693d 100644 (file)
@@ -174,7 +174,7 @@ C_WARN = ['-Wno-char-subscripts', '-Wdeclaration-after-statement', '-Wstrict-pro
 
 CC_WARN = [ '-Wall' ]
 
-LLIBS = ['-lshell32', '-lshfolder', '-lgdi32', '-lmsvcrt', '-lwinmm', '-lmingw32', '-lm', '-lws2_32', '-lz', '-lstdc++','-lole32','-luuid']
+LLIBS = ['-lshell32', '-lshfolder', '-lgdi32', '-lmsvcrt', '-lwinmm', '-lmingw32', '-lm', '-lws2_32', '-lz', '-lstdc++','-lole32','-luuid', '-lwsock32']
 
 PLATFORM_LINKFLAGS = ['--stack,2097152']
 
index 48230db..4debb32 100644 (file)
@@ -98,7 +98,8 @@ typedef unsigned long uintptr_t;
 #include <inttypes.h>
 
 #elif defined(FREE_WINDOWS)
-
+/* define htoln here, there must be a syntax error in winsock2.h in MinGW */
+unsigned long __attribute__((__stdcall__)) htonl(unsigned long);
 #include <stdint.h>
 
 #else
@@ -109,12 +110,14 @@ typedef unsigned long uintptr_t;
 #endif /* ifdef platform for types */
 
 #ifdef _WIN32
+#ifndef FREE_WINDOWS
 #ifndef htonl
 #define htonl(x) correctByteOrder(x)
 #endif
 #ifndef ntohl
 #define ntohl(x) correctByteOrder(x)
 #endif
+#endif
 #elif defined (__FreeBSD__) || defined (__OpenBSD__) 
 #include <sys/param.h>
 #elif defined (__APPLE__)
index 2114fc3..4b3902d 100644 (file)
@@ -93,7 +93,8 @@ typedef unsigned long uintptr_t;
 #include <inttypes.h>
 
 #elif defined(FREE_WINDOWS)
-
+/* define htoln here, there must be a syntax error in winsock2.h in MinGW */
+unsigned long __attribute__((__stdcall__)) htonl(unsigned long);
 #include <stdint.h>
 
 #else
@@ -105,8 +106,14 @@ typedef unsigned long uintptr_t;
 
 
 #ifdef _WIN32
+#ifndef FREE_WINDOWS
+#ifndef htonl
 #define htonl(x) correctByteOrder(x)
+#endif
+#ifndef ntohl
 #define ntohl(x) correctByteOrder(x)
+#endif
+#endif
 #elif defined (__FreeBSD__) || defined (__OpenBSD__) 
 #include <sys/param.h>
 #elif defined (__APPLE__)