Fix cross-compilation to Windows target on Linux system using i686-w64-mingw32

In order to be able to build seafile on a Linux system with Win32 as target using the i686-w64-mingw32 toolchain as provided on Fedora 18, these patches were required.

I did not (yet) test the resulting binaries on a Windows system, so please review/test this thoroughly before pulling in the changes. I do not intend to maintain them.