tests: avoid a spurious failure on MSYS
[platform/upstream/automake.git] / t / tags-pr12372.sh
1 #! /bin/sh
2 # Copyright (C) 2012-2013 Free Software Foundation, Inc.
3 #
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.
8 #
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.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
17 # Test to make sure tags are processed also for files with non-standard
18 # extensions.  See automake bug#12372.
19
20 required='cc etags'
21 . test-init.sh
22
23 cat >> configure.ac <<'END'
24 AC_PROG_CC
25 AC_CONFIG_FILES([sub/Makefile])
26 # Fake linking.  Help avoid possible spurious errors from make
27 # or from the linker; errors that are irrelevant to this test.
28 AC_SUBST([LINK], ['echo $(CCLD) $(CFLAGS) $(LDFLAGS) -o $@'])
29 AC_OUTPUT
30 END
31
32 cat > Makefile.am <<'END'
33 all-local: tags
34 .pc.o:
35         sed -e 's/\[/{/' -e 's/\]/}/' $(srcdir)/$*.pc >$*.c
36         $(CC) $(DEFS) $(CPPFLAGS) $(CFLAGS) -c $*.c
37         rm -f $*.c
38
39 noinst_PROGRAMS = foo
40 foo_SOURCES = foo-main.pc barbar.c
41 SUBDIRS = sub
42 END
43
44 mkdir sub
45 cat > sub/Makefile.am <<'END'
46 all-local: tags
47 .pc.o:
48         sed -e 's/@/a/g' $(srcdir)/$*.pc >$*.c
49         $(CC) $(DEFS) $(CPPFLAGS) $(CFLAGS) -c $*.c
50         rm -f $*.c
51
52 noinst_PROGRAMS = zap
53 zap_SOURCES = zardoz.pc
54 END
55
56 echo 'int main(void) [ return bar(1); ]' > foo-main.pc
57 echo 'int bar(int x) { return !x; }' > barbar.c
58 echo 'int m@in(void) { return 0; }' > sub/zardoz.pc
59
60 $ACLOCAL
61 $AUTOCONF
62 $AUTOMAKE
63
64 ./configure
65
66 $MAKE
67 cat TAGS
68 cat sub/TAGS
69 $FGREP foo-main.pc TAGS
70 $FGREP barbar.c TAGS
71 $FGREP zardoz.pc sub/TAGS
72
73 $MAKE distcheck
74
75 :