Prevent Matlab on OS X from crashing on error

On my system, when using Matcaffe, if I encounter an error in the matcaffe mex file, Matlab crashes. This is ridiculous, and I figured out that the problem is in the `LOG(FATAL)` and `CHECK()` macros. When `LOG(FATAL)` is hit or a `CHECK()` fails, this crashes Matlab. My fix is to replace all instances of `LOG(FATAL)` and `CHECK()` with an inline function that calls `LOG(ERROR)` and `mexErrMsgTxt`. This returns control to Matlab with a proper error message instead of crashing.

My system:

* OS X 10.9
* XCode 6
* Matlab 2014b (but matcaffe is compiled with Matlab 2014a)