configure: Properly check for pthread