Since Octave 5, mkoctfile no longer links MEX files against shared libraries (other than libc/libstdc++/libgfortran), so we now mimick that behaviour.