libgd: misc compilation tweaks