Add pthread wherever it is necessary

* pthread is required on linux for POSIXSemaphoreImpl.
* ACE library on some conditions requires pthread.
* Extern SQLite library requires pthread.

Fix #25