build: detect and add pthread

Signed-off-by: Paweł Dziepak <pdziepak@quarnos.org>
master: initial slave and work management

Signed-off-by: Paweł Dziepak <pdziepak@quarnos.org>