Much better support for building on OS X by auto detecting more stuff

These autoconfigure changes have been tested on Linux, OS X and FreeBSD and work properly on all three platforms (and so does the built mtr executable).

* Add support for new --without-glib configure option to disable
  all use of glib (also requires --without-gtk to be effective).
  This has the side effect of disabling the "mtr -z" functionality.

* Improve configure support for detecting which library to link
  with, if any, to get the resolver functions.

* Do not define BIND_8_COMPAT when compiling for Darwin/OS X.

* Autoconfigure whether or not a suitable struct __res_state_ext
  needs to be defined.

* If the arpa/nameser_compat.h header is available and usable,
  include it immediately after arpa/nameser.h.

note: this pull request also includes the curses.c change that's already in a separate pull request as the github pull request interface seems unable to exclude it.  sorry about that.