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.
Remove http_struct.h usage in sample/https-client.c
Another tweak to https-client.c
Add a test with an active_later event at event_base_free time.
event_base_update_cache_time should be a no-op if the loop isn't running
evdns: New flag to make evdns not prevent the event loop from exiting

Here is the brief description of problem:
When you are use evdns to resolve domains to IP adresses (see
./sample/dns-example) you loop never returns from event_base_dispatch(),
and because of this the program will never terminated.

Because existing programs may be depending on the old behavior, we
only apply the fix when evdns_base_new() is created with a new flag -
EVDNS_BASE_DISABLE_WHEN_INACTIVE.

 (Commit message edited by Nick while squashing the branch.)
Merge branch '21_evdns_disable_when_inactive'
Merge remote-tracking branch 'origin/pr/36' into patches-2.0
Merge remote-tracking branch 'origin/patches-2.0'

Conflicts:
	configure.ac
Fix a warning introduced in 0c6ec5d8
Fix another warning introduced in 0c6ec5d8
Add new error_cb for actual reporting of HTTP request errors.

It is useful to know why you callback called with NULL (i.e. it failed),
for example if you set max_body with evhttp_connection_set_max_body_size()
you must know that it failed because of body was longer than this size.

 (Commit message tweaked by Nick)
Add test for EVREQ_HTTP_REQUEST_CANCEL into http_cancel_test()
Drop extra header http_struct.h from regress_http.c
Merge branch '21_http_error_cb_squashed'
Make all tests pass under EVENT_DEBUG_MODE=1

The fix was easy: the tests that were failing were those tests that
also enabled debug mode themselves. So, let them know when
EVENT_DEBUG_MODE is on, so they won't do that.
Implement event_finalize() and related functions to avoid certain deadlocks
Add some verbose notes to bufferevent unit tests
Use finalization feature so bufferevents can avoid deadlocks

Since the bufferevents' events are now EV_FINALIZE (name pending),
they won't deadlock.  To clean up properly, though, we must use the
finalization feature.

This patch also split bufferevent deallocation into an "unlink" step
that happens fast, and a "destruct" step that happens after
finalization.

More work is needed: there needs to be a way to specify a finalizer
for the bufferevent's argument itself.  Also, this finalizer business
makes lots of the reference counting we were doing unnecessary.

Also, more testing is needed.