check for availability of std::thread and std::mutex .

If not available, we exit with error code 1 and recommend to
reconfigure with --disable-threads or use a C++ compiler which
supports it and we exit.

An alternative might be to implicitely disable threads by setting

  enable_threads="no"

But I think implicite changing the user's settings is dangerous.