Improved Automatic support for OSX. Also, consolidated code so that C and OpenCL code uses same source files.