Improve portability of open system call

The mode parameter of the open system call isn't very portable.

Before using the mode parameter symbolic constants, clog now
checks to see if they are defined. If they are defined they are used,
otherwise they are not.

This adds support for GCC on the mingw platform.