libgd: add support for libgd with png, jpeg and freetype backends