Compile without warnings on mingw64

This is mostly a matter of catching cases where we were still
assuming that evutil_socket_t could be used as an int.
Fix compilation on mingw64 with -DUSE_DEBUG
Fix renegotiation test to work around openssl 1.0.1 bug

There's a bug in openssl 1.0.1 where TLS1.1 and TLS1.2 can't
renegotiate with themselves.  When testing renegotiation with OpenSSL
>=1.0.1 and <1.0.1d, disable those protocols.
Warn when openssl version in unit test mismatches compiled version.
Make rpcgen_wrapper.sh work on systems without a "python2" binary
remove stray 'x' so print_err will compile when uncommented
Avoid crash when event_pending() called with no event_base set on event

Instead, give a warning and return 0.

Reported by Antony Dovgal on github as
   https://github.com/libevent/libevent/issues/19
Make ssl version check in unit tests work
Changelog for 2.0.21-stable
Increment version to 2.0.21-stable
Increment libtool version for 2.0.21 too
Increment version to 2.0.21-stable-dev
Fix compilation with WIN32_HAVE_CONDITION_VARIABLES enabled

Reported by Xiuqiang Jiang
Avoid leaking fds on evconnlistener with no callback set

There's no way to retrieve an fd from an evconnlistener whose
callback has been cleared, so we had better close any such fd.

Found by coverity; CID 739725.
Avoid double-close on getsockname error in evutil_ersatz_socketpair

Found by coverity; CID 739726
Fix missing AC_PROG_SED on older Autoconfs

For pre-2.59b Autoconfs, AC_PROG_SED is not available [1]; on such
systems, avoid calling AC_PROG_SED, while providing a sensible SED.

This aids backporting to Autoconf 2.59.

[1] http://lists.gnu.org/archive/html/autotools-announce/2004-08/msg00002.html
Backport libevent to vanilla Autoconf 2.59 (as used in RHEL5)

This is a backport of ad03952.
Fix a mistake in evbuffer_remove() arguments in example http server code

(commit message by nickm)
Fix a locking error in bufferevent_socket_get_dns_error.

Patch from Ka-Hing Cheung.
Use AC_CONFIG_HEADERS in place of AM_CONFIG_HEADERS for autmake 1.13 compat

Patch from cazfi.