The current build system is too restrictive. I did an ad-hoc fix to get my setup to work, but a proper solution should respect the following configuration options:
win32 vs posix
determines things like binary suffix or which libraries need to be linked (-lm -lpthread vs -lws2_32 -lmswsock ...)