Use one emergethread if build without THREADS
fix NO_THREAD_LOCAL
fix build
fix run with !CMAKE_THREADS