configure: Drop check_lib()/require() in favor of check_lib2()/require2()

The latter can do everything the former can do, but also handle conditions
the former cannot like multiple header #includes and checking for headers
and functions in a single test program, which is necessary for certain
library tests.
