Hi Chris,
I tested out your branch and I think that in theory it should work, but in practice doesn't... some things I don't understand (which I think have more to do with the underlying autoconf macros):
1) It does 2 checks: presence of the header and usability of the header. Fair enough, but according to the config log, the usability test is run first (which fails, more on that below) and the presence test is run second. That seems backwards to me. Or maybe not, depending on if the availability test is what actually controls whether it gets used. But then, why run the presence test at all if the usability test fails?
2) The usability test fails, probably because on OSX, gdkquartz.h seems to include headers that use Objective-C syntax. We probably need to add -x objective-c on Darwin systems so that it doesn't choke on that. I haven't found a simple way to do that, as adding it to CFLAGS in the configure script does not seem to cause it to be used. That may or may not be a quirk of my build environment. Will test further and report back if I can't resolve that problem myself.
3.) More troubling, the 2 tests seem to use different gcc command line options. The usability test finds gdkquartz.h because it adds a bunch of stuff specified by pkg-config, which seems logical. The presence test only uses -I/usr/include -I/usr/X11/include (which seems pointless since my GTK isn't X11 based). Because you're using a pre-packaged test macro, I'd say some of these problems are buried in that macro, so we may have to do things the hard way.
Bill