Require pthreads for compilation with OpenCL support.

Fixes a part of ticket #2422.

Reviewed-by: James Almer