fix installation of main module headers

see: http://code.opencv.org/issues/2897

The order of the 2 conditions is really important, as every MATCHES
operator sets ${CMAKE_MATCH_1}, which is needed inside the condition
block. Ideally, this should be done using a single regex with a
negative forward lookahead, but CMake doesn't seem to support this
Fix visibility of g_linked_ptr_mutex on Windows

Reverts some changes in b8ed00bd642971877e1dfda6e0815d7211a7ace2
add accuracy tests while running perf
fix the waring in gemm test
fix a warning
Merge pull request #895 from bitwangyaoyao:2.4_perf
Merge pull request #907 from SpecLad:master
Merge pull request #887 from LeszekSwirski:fix-glinkedptrmutex
Merge pull request #797 from vhdirk:installheaders
Merge commit 'b51a1a7d' (PR #895 from 2.4)

Conflicts:
	modules/ocl/CMakeLists.txt
	modules/ocl/perf/perf_color.cpp
	modules/ocl/perf/perf_match_template.cpp
	modules/ocl/perf/precomp.cpp
	modules/ocl/perf/precomp.hpp