Fix PTHREAD_LIBS and adapt it to apache2 way.
Submitted by: Xin Li Approved by: nork (mentor/implicitly)