From sourceforge matio, modified for Cmake/Mac compile