Fix .c files' compile flags.

(This also fixed glew.c warnings about __dllimport consistency
when using mingw cross-GCC)
fix Windows (mingw) build
Add new logging mechanism.

Description in next commit.
Switch from std::cerr to new logging infrastructure.

(This is just a giant find/replace from std::cerr to LOG,
plus refactoring one thing in main.cpp that this didn't work with
because the thing in main.cpp was badly written.)

This has the following effects:
* None of the <iostream> header static-variable-per-cpp-file
    inefficiency nonsense.
* Avoid depending on any hidden state of standard file I/O mechanisms:
    we call write() now, which is a syscall on Unixy systems, and
    exists on Mingw too (If it breaks on a system that Lasercake
    otherwise compiles on, we can re-evaluate).  Being a syscall
    means that pthread_cancel() won't e.g. lock any locks in the
    wrong state.  I have not demonstrated that there are no issues in
    Windows -- though we don't rely on sim thread termination currently
    -- this might be a bug waiting to happen a year from now.  Or it
    might not.  Sending the data through the main thread, or researching
    and using Windows API calls, could be sensible.  Also someday
    we're going to have the sim be a separate process rather than just
    a separate thread and this will become irrelevant.
* Allow us to redirect the output in some other way in the future.
    For example, it could be channeled through the main thread, or
    disabled entirely.
* Probably makes logging somewhat faster or slower, but probably not
    terribly inefficient so it doesn't matter. (I didn't measure
    but I did use a char buffer; you can tweak the size of the buffer
    in config.hpp.  It's currently 200 chars.)
fix bounds-checked-ints
fix bounds overflow (size() of max sized box)

Yes there's rounding error far away from the viewer, here,
but anything that far away from the viewer is VERY OBVIOUSLY
not within the viewing frustum.