configure: detect whether -lpthreads is necessary for pthreads