fix the matlab compilation script for mac

The ‘isunix’ function returns true if the environment is osx, which
make the script goes into wrong direction.

made the include/linking more general.