Fix handling --cfgdir

Fixes #1225
 Fix compilation on Windows
Fix duplicate timestamps on selection

Fixes #1226
Fix copying timestamp with server-time and indent nicks off
configure: Add option to run clang static analysis