MAIN: Don't run deinit() in the exit handler

The exit handler is run by the thread that initiated the exit(),
which is not necessarily the main thread. Our deinitialization
needs to run in the main thread, though...
MAIN: Enable the debug manager before the other subsystems
BUILD: Restructure the Makefile.am a bit

Adding new files should be less annoying now, and diffs
should read clearer (and hopefully merge better), since we
now don't have to add a \ to the end of the previous line.
COMMON: Add functions to generate unique number IDs
BUILD: Extend boost.m4 to check for Boost.Atomic
BUILD: Add dependency on Boost.Atomic
COMMON: Make generateIDNumber() thread-safe
COMMON: Split generateIDNumber() and generateIDNumberString()
COMMON: Add StackException::isEmpty()
COMMON: Add copy-constructor for std::exception to StackException
EVENTS: Handle exceptions thrown in functions forced into the main thread
EVENTS: Fix a case of reading uninitialized data
EVENTS: Register one custom event with SDL (ITC)