[trunk] Properly copy/paste code from the autotools
gcc correctly fails compiling this code, I needed to move the code outside the main function to get the error. This actually match the autotools (incorrect) code. We'll see how they fix this code in future release.
This make the code compatible with previous openjpeg version and remove C99 requirement.
Fixes issue 316