build: support windows

NOTE: this include the series of fixups pull request, only top level patch differ
I wrote this anyway as there is autotool magic that needs to be done.

support cross compile into windows binaries using mingw-w64 compiler.
this can work under linux or cygwin.
    
1. getopt exists in mingw-w64
2. random is implemented per platform.
3. password is not trivial as-is so additions are complex.
    
*NOT TESTED ON WINDOWS*

To build:
1. obtain mingw-w64 toolchain[1]
2. execute:
./configure --host=x86_64-w64-mingw32 # win64
./configure --host=i686-w64-mingw32   # win32
make

[1] http://mingw-w64.sourceforge.net/