apply patches to compile with clang on mac as discussed by email