mingw-related fixes

adds some patches for mingw support, and avoids some MSVC assumptions.

Still cannot build full pyzmq with bundled libzmq with mingw yet.
Better error handling in Socket.bind_to_random_port

Raise exception if errno is not EADDRINUSE.
Merge pull request #273 from Lothiraldan/master

Better error handling in Socket.bind_to_random_port

only retry on EADDRINUSE, raise otherwise.
Better exception reraising in Socket.bind_to_random_port

It keeps traceback that way.
Merge pull request #274 from Lothiraldan/master

Better exception reraising in Socket.bind_to_random_port
allow 2.x-style hwm to imply both snd/rcvhwm in 3.x

`socket.hwm = value` now behaves the same on libzmq-2.x and 3.x
use new hwm attr in tests
Merge pull request #275 from minrk/hwm

allow 2.x-style hwm to imply both snd/rcvhwm in 3.x

`socket.hwm = value` now behaves the same on libzmq-2.x and 3.x
add socket.disconnect

obviously libzmq3-specific
add socket.unbind

obviously libzmq3-specific
don't release gil on connect/bind

disconnect/unbind would segfault on libzmq2 due to PyErrSetString, plus it's dumb
explicitly check ZMQ_VERSION_MAJOR for unbind/disconnect

raises NotImplementedError
Merge pull request #272 from minrk/mingw

MinGW-related fixes

adds some patches for MinGW support, and avoids some MSVC assumptions.

Still cannot build full pyzmq with bundled libzmq with MinGW yet.

closes #270
closes #249
Merge pull request #279 from minrk/disconnect

add socket.disconnect and socket.unbind

obviously libzmq3-specific

closes #278
add cast_bytes / cast_unicode
use cleaner bytes/unicode in test_message
clean up unicode handling in log handler

test included
Merge pull request #281 from minrk/logunicode

some bytes/unicode cleanup

particularly in the log handler

closes #280
avoid degenerate name at zmq.core.device

zmq.core.device ends up pointing to zmq.core.device.device,
which causes some confusion in tools like reload.

repro:  `reload(zmq.core)`

Solution: rename *module* `zmq.core._device`, so the name is not degenerate, and zmq.core.device always refers to the function.

See ipython/ipython#2721
fix device imports

avoids ordering issues