CMake: add configure checks for pthread_rwlock_init and pthread_getspecific