configure.ac: Improve detection and usage of pthread_set_name_np(3).