[libpng16] Restored contrib/timepng to default build but check for check for

presence of clock_gettime() in configure.ac and Makefile.am.
diff --git a/ANNOUNCE b/ANNOUNCE
index 681017d..998b6de 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -1,4 +1,4 @@
-Libpng 1.6.22rc02 - May 16, 2016
+Libpng 1.6.22rc02 - May 17, 2016
 
 This is not intended to be a public release.  It will be replaced
 within a few weeks by a public version or by another test version.
@@ -102,9 +102,14 @@
 Version 1.6.22rc01 [May 14, 2016]
   No changes.
 
-Version 1.6.22rc02 [May 16, 2016]
+Version 1.6.22rc02 [May 17, 2016]
   Removed contrib/timepng from default build; it does not build on platforms
     that don't supply clock_gettime().
+  Check for CLOCK_PROCESS_CPUTIME_ID when building /contrib/libtests/timepng.
+
+Version 1.6.22rc03 [May 16, 2016]
+  Restored contrib/timepng to default build but check for check for presence
+    of clock_gettime() in configure.ac and Makefile.am.
 
 Send comments/corrections/commendations to png-mng-implement at lists.sf.net
 (subscription required; visit
diff --git a/CHANGES b/CHANGES
index 2a6aefa..707dd95 100644
--- a/CHANGES
+++ b/CHANGES
@@ -5566,6 +5566,10 @@
   Removed contrib/timepng from default build; it does not build on platforms
     that don't supply clock_gettime().
 
+Version 1.6.22rc03 [May 17, 2016]
+  Restored contrib/timepng to default build but check for check for presence
+    of clock_gettime() in configure.ac and Makefile.am.
+
 Send comments/corrections/commendations to png-mng-implement at lists.sf.net
 (subscription required; visit
 https://lists.sourceforge.net/lists/listinfo/png-mng-implement
diff --git a/Makefile.am b/Makefile.am
index 54f8d63..7212951 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -13,6 +13,9 @@
 
 # test programs - run on make check, make distcheck
 check_PROGRAMS= pngtest pngunknown pngstest pngvalid pngimage
+if HAVE_CLOCK_GETTIME
+check_PROGRAMS += timepng
+endif
 
 # Utilities - installed
 bin_PROGRAMS= pngfix png-fix-itxt
@@ -42,6 +45,9 @@
 pngimage_SOURCES = contrib/libtests/pngimage.c
 pngimage_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
 
+timepng_SOURCES = contrib/libtests/timepng.c
+timepng_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
+
 pngfix_SOURCES = contrib/tools/pngfix.c
 pngfix_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
 
@@ -220,6 +226,7 @@
 contrib/libtests/pngvalid.o: pnglibconf.h
 contrib/libtests/readpng.o: pnglibconf.h
 contrib/libtests/tarith.o: pnglibconf.h
+contrib/libtests/timepng.o: pnglibconf.h
 
 contrib/tools/makesRGB.o: pnglibconf.h
 contrib/tools/pngfix.o: pnglibconf.h
diff --git a/configure.ac b/configure.ac
index e752a05..37ef0a1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -146,6 +146,12 @@
 AC_FUNC_STRTOD
 AC_CHECK_FUNCS([memset], , AC_MSG_ERROR(memset not found in libc))
 AC_CHECK_FUNCS([pow], , AC_CHECK_LIB(m, pow, , AC_MSG_ERROR(cannot find pow)) )
+
+# Some later POSIX 1003.1 functions are required for test programs, failure here
+# is soft (the corresponding test program is not built).
+AC_CHECK_FUNC([clock_gettime],,[AC_MSG_WARN([not building timepng])])
+AM_CONDITIONAL([HAVE_CLOCK_GETTIME], [test "$ac_cv_func_clock_gettime" = "yes"])
+
 AC_ARG_WITH(zlib-prefix,
    AS_HELP_STRING([[[--with-zlib-prefix]]],
       [prefix that may have been used in installed zlib]),