Changes:
Tested on MacOS X, Cygwin, linux and solaris2.6. (Well, it would have worked on solaris if our machine didn't have a beta libpng installed...)