Various fixes to make libDAI build successfully under modern OSX versions