Change SIMD detection to instead check for compilers with __get_cpuid.
Verified that this compiles and runs on macOS El Capitan with homebrew gcc.
Also added an #error if SIMD checking is missing. Compilers that have no
SIMD should make that explicit.
[sw: Merged original commits and slightly polished the commit message]
[sw: Removed test for __MINGW32__ which is no longer needed]
Signed-off-by: Stefan Weil <sw@weilnetz.de>
This information is not needed for normal runs, so it is sufficient
to show it on request (like versions and OpenCL information).
This also fixes a crash caused by undefined order of global constructors:
When the global variable SIMDDetect::detector is initialized before the
global variable debug_file, the first tprintf call in simddetect.cpp
crashes because of a NULL pointer in debug_file. This was only seen when
running with a shared library (libtesseract.so).
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Modify also the code to use a singleton. This simplifies the code as
no locking is needed. It also slightly improves the performance because
no check whether the architecture was tested is needed.
Signed-off-by: Stefan Weil <sw@weilnetz.de>