Fixing compilation on osx

Have not been able to make opencv compile on checkout on my OSX 10.8.4 using gcc or clang since a while back so I thought that I would push my changes upstream (Have not tried libc++ or c++11 yet, only libstdc++ and c++98). 

All changes should be safe since they only add a definition if one is missing, but the opencv system architects might definitely have better places (or solutions) for them.

- Definition of non-standard type uint as uint32_t. Using only standard types it should be an unsigned int, but since the standard does not specify the size of an unsigned int (while since it is mostly used in cuda there is a big chance that implementers expect it to be 32-bit, so i used uint32_t)
- Bugfix of cmake elif/elseif error 
- not the prettiest fix for non-existing isnan in my math.h ( this could probably be done in a more generic way, but at least this should work for any system that has cmath)