Added better pthreads detection/support using m4 from pgsql