build: fix gcc 4.7 sunos build

gcc 4.7 doesn't understand -threads, use -pthreads instead.

Fixes #4211.