Make compileable under Windows

Available to compile with MINGW under Windows, and changed directory checking in mklab.cpp with stat instead of dirent for the sake of being portable, and actually working under Windows, as dirent did not.