build: check for pthreads with and without additional cflags