Removed all the references to tr1 (and any #if defined(__APPLE__)...) and changed cc.d and cpp.d in m4/R.m4. Looks like it succesfully compiled on both systems I have here.