handle a sparse array of invalid fds
teach poll how to handle file handles as well as sockets

Do this by alternating a loop between WaitForMultipleObjects for non-sockets
and and select for sockets.

I tried to implement this all in terms of WaitForMultipleObjects with a select
'poll' at the end to get extra specific socket status. However, the cost of
setting up an event handle for each socket, setting the WSAEventSelect
attributes, and cleaning them up reliably was pretty high. Since the event
handle associated with a socket  is also global, creating a new one cancels the
previous one or can be disabled externally.

In addition, the 'FD_WRITE' status of a socket event handle does not behave in
an expected fashion, being triggered by an edge on a write event rather than
being level triggered.

See here for various additional horror stories:

http://www.postgresql.org/message-id/4351.1336927207@sss.pgh.pa.us
don't assume a default build optimization level

Packagers, etc. will set a CFLAGS=-O2 on configure anyway, so don't set it.
more poll updates, handle console peeking