Using pthread may affect the compilation too not only the linking.
Therefore pthread is changed from a link flag to a generic flag used for
both compilation and linking.
This fixes an issue when using modules since the use of the pthread flag
makes the BMI files not compatible.