]> git.draconx.ca Git - dxcommon.git/blob - snippet/at-compat.at
at-compat.at: Add patch to avoid DJGPP date issue.
[dxcommon.git] / snippet / at-compat.at
1 # Copyright © 2023 Nick Bowler
2 #
3 # Autotest monkey patches to fix some issues.  This should be included before
4 # expanding AT_INIT.
5 #
6 # License WTFPL2: Do What The Fuck You Want To Public License, version 2.
7 # This is free software: you are free to do what the fuck you want to.
8 # There is NO WARRANTY, to the extent permitted by law.
9
10 # In a shell function, redirections on : are not correctly handled
11 # by Solaris /bin/sh.  See the following Autoconf patch for details:
12 #
13 #   https://lists.gnu.org/archive/html/autoconf-patches/2021-03/msg00000.html
14 m4_define([AT_INIT],
15   m4_bpatsubst(m4_dquote(m4_defn([AT_INIT])),
16     [^\( *\)\(: >"\$at_stdout".*$\)], [\1eval '\2']))
17
18 # The computation of the elapsed time can crash the testsuite on DJGPP because
19 # in this environment date +%s can return a string that starts with a 0, which
20 # bash interprets as octal digits in arithmetic expansions.  With a working
21 # GNU-like date +%s the output should never start with a 0 so just reject
22 # anything that does.
23 m4_define([AT_INIT],
24   m4_bpatsubst(m4_dquote(m4_defn([AT_INIT])),
25     [\[0-9]\*,\[0-9]\*], [[1-9][0-9]*,[1-9][0-9]*]))