TS-2128: Don't link libGeoIP.so.1 into binaries

AC_SEARCH_LIBS always updates $LIBS, but AC_CHECK_LIB doesn't search
properly. So we have to introduce a wrapper around AC_SEARCH_LIBS
that preserves $LIBS so that we can properly test for libraries
without linking them into everything.

Apply the new TS_SEARCH_LIBRARY macro to the geoip_acl plugin so
that libGeoIP is not linked into every binary.
TS-2128: Fix TS_SEARCH_LIBRARY for RHEL5

Looks like m4_ifval isn't present in older versions of m4, however
m4_default is probably a better choice anyway.
TS-2130: pthread_setname_np() detection fails on various platforms