Improved config.m4 and added initial support for macosx.