Add better OpenMP detection and make an option to enable it.

Bug report and inspiration: http://code.opencv.org/issues/3328
Merge pull request #1667 from SpecLad:detect-openmp