fixed the matlab compilation script for mac

The ‘isunix()’ function returns true if the environment is osx, which
make the script goes into wrong direction.

also, I have made the include/linking directories more general.