Compiling pngwriter, generally speaking, compiling any open source code with IBM compiler on IBM AIX machine is challenging. Sometimes, it only takes few minutes to build it, but, sometimes, it takes more than several days to figure it out that you could not use xlc to compile it in the first place because of compiler compatibility issue. Then, you might end up with gcc and, most likely, it's a snap.
pngwriter-0.5.4 requires libpng, but, avoid version 1.5.2(which is the latest version ATTOW) as much as possible. Instead, pick libpng-1.2.44 to be able to build it and afford going home tonight and have a dinner on time. :)
You will see only one error when you try to build it. Only one! What a day!
The error message is
"pngwriter.cc", line 1533.25: 1540-0217 (S) "__jmpbuf" is not a member of "struct png_struct_def".
pngwriter.h includes png.h for struct png_struct_def, then, along many other header files, /usr/include/sys/context.h is included. This is the reason why the error occurs. A macro to modify jmpbuf to __jmpbuf is defined in context.h and it actually modified it in line 1533 at pngwriter.cc, whereas the struct definition itself remains unmodified.
That's why it think '__jmpbuf is not a member of struct'. One easy solution is to move down the struct definition after context.h. By this way, jmpbuf in the struct definition also will be modified to __jmpbuf.
Moving down #include