workaround for bug in mkmf

works-around a known bug in mkmf, which was resolved in
https://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/39717

Since the current Windows Ruby distribution doesn't include this fix yet,
we work around it by detecting whether mkmf is functioning properly or
not, and fixing it if it's not. This behavior will degrade gracefully if
the user is running a version of mkmf with the fix.
Add type checks and GC guards before accessing the query options hash in the result object. See #321.
Merge pull request #393 from monban/mkmf-workaround

workaround for bug in mkmf
Merge pull request #346 from sodabrew/gc_guard_hash_dup

Per #321 use RB_GC_GUARD around rb_hash_dup