fixed autoconf for mac systems, also fixed errors in tdm and gem