test: check that subsecond mtime works with make.
[automake.git] / t / comments-escaped-in-var.sh
blob1f72760c468a99d2bf20eecc94aa7b5ca361d7d0
1 #! /bin/sh
2 # Copyright (C) 2022-2024 Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
7 # any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <https://www.gnu.org/licenses/>.
17 # Make sure Automake preserves escaped comments in the output.
19 . test-init.sh
21 cat >> configure.ac <<'END'
22 AC_OUTPUT
23 END
25 cat > Makefile.am << 'END'
26 # This value should be preserved.
27 var = -DVAL='"\#xxx\#"' # this should be stripped
28 var += -DX=1 # this should be kept
29 END
31 $ACLOCAL
33 # This should fail due to -Werror, as in:
34 # automake-1.16: warnings are treated as errors
35 # Makefile.am:2: warning: escaping \# comment markers is not portable
36 AUTOMAKE_fails
37 grep 'escaping.*comment markers.*portable' stderr
39 # This should pass though.
40 $AUTOMAKE -Wno-portability
42 # For debugging.
43 grep ^var Makefile.in
45 # The full flag should be retained.
46 grep '^var.*\\#xxx\\#.*DX=1' Makefile.in
48 # Only the 2nd comment should be retained.
49 grep '^var.*stripped' Makefile.in && exit 1 || :
50 grep '^var.*should be kept' Makefile.in