From https://lists.gnu.org/archive/html/automake/2025-06/msg00016.html.
* t/mdate5.sh: allow years 19xx for old SOURCE_DATE_EPOCH.
* t/txinfo-vtexi3.sh: likewise.
* t/txinfo-vtexi4.sh: if SDE is set, use mdate-sh to parse it into
the expected UPDATED and UPDATED-MONTH values.
Report from Frederic Berat.
* NEWS: mention this.
For planned incompatibilities in a possible future Automake 2.0 release,
please see NEWS-future and start following the advice there now.
+* Bugs fixed
+
+ - Keep Automake tests working when SOURCE_DATE_EPOCH is set.
+ (https://lists.gnu.org/archive/html/automake/2025-06/msg00016.html)
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
New in 1.18 (2025-05-25):
test $# = 3
case $1$3 in *[!0-9]*) exit 1;; esac
test $1 -lt 32
-# Hopefully automake will be obsolete in 80 years ;-)
-case $3 in 20[0-9][0-9]) :;; *) exit 1;; esac
+case $3 in
+ 19[0-9][0-9]) :;; # for old SOURCE_DATE_EPOCH.
+ 20[0-9][0-9]) :;; # Hopefully automake will be obsolete in 80 years ;-)
+ *) exit 1;;
+esac
case $2 in
January|February|March|April|May|June|July|August) ;;
September|October|November|December) ;;
*) exit 1
esac
-# Stricter checks on the year required a POSIX date(1) command.
-if year=$(date +%Y) && test $year -gt 2010; then
+# Stricter checks on the year required a POSIX date(1) command,
+# and that SOURCE_DATE_EPOCH is not set.
+if year=$(date +%Y) \
+ && test -z "$SOURCE_DATE_EPOCH" \
+ && test $year -gt 2010; then
test $year = $3 || exit 1
fi
day='([1-9]|1[0-9]|2[0-9]|3[01])'
month='(January|February|March|April|May|June|July|August|September|October|November|December)'
-year='20[0-9][0-9]' # Hopefully automake will be obsolete in 80 years ;-)
+year='(20|19)[0-9][0-9]' # Hopefully automake will be obsolete in 80 years ;-)
+ # Allow 19xx for SOURCE_DATE_EPOCH possibilities.
+#
date="$day $month $year"
do_check ()
# differ depending on local time.
TZ=UTC0; export TZ
-test $(LC_ALL=C date '+%u') -gt 0 && test $(LC_ALL=C date '+%u') -lt 8 \
- && day=$(LC_ALL=C date '+%d') && test -n "$day" \
- && month=$(LC_ALL=C date '+%B') && test -n "$month" \
- && year=$(LC_ALL=C date '+%Y') && test -n "$year" \
- || skip_ "'date' is not POSIX-compliant enough"
+if test -n "$SOURCE_DATE_EPOCH"; then
+ # use mdate-sh to parse SOURCE_DATE_EPOCH.
+ get_shell_script mdate-sh
+ result=`mdate-sh /irrelevant`
+ echo "result of mdate-sh: $result"
+ day=`echo $result | awk '{print $1}'`
+ month=`echo $result | awk '{print $2}'`
+ year=`echo $result | awk '{print $3}'`
+else
+ test $(LC_ALL=C date '+%u') -gt 0 && test $(LC_ALL=C date '+%u') -lt 8 \
+ && day=$(LC_ALL=C date '+%d') && test -n "$day" \
+ && month=$(LC_ALL=C date '+%B') && test -n "$month" \
+ && year=$(LC_ALL=C date '+%Y') && test -n "$year" \
+ || skip_ "'date' is not POSIX-compliant enough"
+fi
+#
day=$(echo "$day" | sed 's/^0//')
cat > configure.ac << END