Whilst working on the Reproducible Builds effort [0] we noticed
that re2c could not be built reproducibly.
This is because it used the current build date in the manual page and was
originally filed in Debian as #934697 [1].
This patch uses the SOURCE_DATE_EPOCH [2] environment variable.
[0] https://reproducible-builds.org/
[1] https://bugs.debian.org/934697
[2] https://reproducible-builds.org/specs/source-date-epoch/
Signed-off-by: Chris Lamb <lamby@debian.org>
AC_CONFIG_SRCDIR([src/main.cc])
AC_CONFIG_HEADERS([config.h])
-
-AC_SUBST(PACKAGE_DATE, `date +'%d %b %Y'`)
+if test -n "$SOURCE_DATE_EPOCH"; then
+ PACKAGE_DATE=`LC_ALL=C date --utc --date="@$SOURCE_DATE_EPOCH" +'%b %d %Y'`
+else
+ PACKAGE_DATE=`date +'%d %b %Y'`
+fi
+AC_SUBST(PACKAGE_DATE, $PACKAGE_DATE)
AC_SUBST(PACKAGE_VERSION)
AC_SUBST(PACKAGE_NAME)
AC_SUBST(PACKAGE_TARNAME)