diff --git a/include/blas_lapack.h b/include/blas_lapack.h
index b5c84c097f09214624bae4c8ae7cfab29b004ea9..25d2becdce139c7c2e02285bb789925de2f2e286 100644
--- a/include/blas_lapack.h
+++ b/include/blas_lapack.h
@@ -17,6 +17,7 @@
 
 #ifndef __BLAS_LAPACK__
 #define __BLAS_LAPACK__
+#if !defined(MATLAB_MEX_FILE) && !defined(OCTAVE_MEX_FILE)
 
 #ifdef __cplusplus
 extern "C"
@@ -184,3 +185,5 @@ void spotri(char*,int*,float*,int*,int*);
 #endif
 
 #endif
+
+#endif