1 # Copyright © 2023-2024 Nick Bowler
3 # Autotest monkey patches to fix some issues. This should be included before
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.
10 m4_define([DX_PATCH_MACRO], [m4_ifdef([$1],
11 [m4_define([$1], m4_bpatsubst(m4_dquote(m4_defn([$1])), [$2], [$3]))])])
13 # In a shell function, redirections on : are not correctly handled by some
14 # shells, including Solaris 10 /bin/sh. Work around the problem using 'eval'.
15 # See the following Autoconf patch description for further details:
17 # https://lists.gnu.org/archive/html/autoconf-patches/2021-03/msg00000.html
18 DX_PATCH_MACRO([AT_INIT],
19 [^\( *\)\(: >"\$at_stdout".*$\)],
22 # Parsing of command-line options with arguments is busted in the two-argument
23 # form if the option name contains a hyphen. Apply a fix for this bug. See
24 # the following Autoconf patch description for further details:
26 # https://lists.gnu.org/archive/html/autoconf-patches/2020-02/msg00000.html
27 DX_PATCH_MACRO([_AT_ARG_OPTION],
28 [at_prev=--AT_first_option_tr],
29 [at_prev=--AT_first_option])
31 # The computation of the elapsed time can crash the testsuite on DJGPP because
32 # in this environment date +%s can return a string that starts with a 0, which
33 # bash interprets as octal digits in arithmetic expansions. With a working
34 # GNU-like date +%s the output should never start with a 0 so just reject
36 DX_PATCH_MACRO([AT_INIT],
38 [[1-9][0-9]*,[1-9][0-9]*])
40 # When testing DOS/Windows applications we cannot assume that the line endings
41 # actually output by the programs under test will match the output of the shell.
43 # For example, the MSYS bash shell and most utilities generate UNIX-style line
44 # endings while programs output DOS-style. A similar situation occurs when
45 # running the test suite on a POSIX host while the tested applications are run
46 # using something like wine.
48 # So on DOS-like hosts, if a trailing CR is seen by 'sed' from the test output,
49 # remove it. The "left" file, which is the expected output, is left unchanged.
51 # For this to work, the package must arrange for host_os to be defined in the
52 # test suite (e.g., via atlocal).
53 DX_PATCH_MACRO([AT_INIT],
58 sed 's/
\r$//' "$[2]" >"$[2].nl" &&
59 $at_diff_ "$[1]" "$[2].nl" && rm -f "$[2].nl"
63 [mingw*|msdos*], [at_diff_=$at_diff; at_diff=at_fn_diff_dosnl])])