[libpng17] Ported recent changes from libpng16 to libpng17

Fixed 'minimal' builds. Various obviously useful minimal configurations
  don't build because of missing contrib/libtests test programs and overly
  complex dependencies in scripts/pnglibconf.dfa. This change adds
  contrib/conftest/*.dfa files that can be used in automatic build
  scripts to ensure that these configurations continue to build.
Enabled WRITE_INVERT and WRITE_PACK in contrib/pngminim/encoder.
[libpng17] Revert recent change to pngvalid.c.
Missing changes from libpng16

Signed-off-by: John Bowler <jbowler@acm.org>