Merge branch 'maint'
[platform/upstream/automake.git] / t / tags-pr12372.sh
1 #! /bin/sh
2 # Copyright (C) 2012 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 AC_OUTPUT
27 END
28
29 cat > Makefile.am <<'END'
30 all-local: tags
31 .pc.o:
32         sed -e 's/\[/{/' -e 's/\]/}/' $(srcdir)/$*.pc >$*.c
33         $(CC) $(DEFS) $(CPPFLAGS) $(CFLAGS) -c $*.c
34         rm -f $*.c
35
36 LINK = $(CCLD) $(CFLAGS) $(LDFLAGS) -o $@
37 noinst_PROGRAMS = foo
38 foo_SOURCES = foo-main.pc barbar.c
39 SUBDIRS = sub
40 END
41
42 mkdir sub
43 cat > sub/Makefile.am <<'END'
44 all-local: tags
45 .pc.o:
46         sed -e 's/@/a/g' $(srcdir)/$*.pc >$*.c
47         $(CC) $(DEFS) $(CPPFLAGS) $(CFLAGS) -c $*.c
48         rm -f $*.c
49
50 LINK = $(CCLD) $(CFLAGS) $(LDFLAGS) -o $@
51 noinst_PROGRAMS = zap
52 zap_SOURCES = zardoz.pc
53 END
54
55 echo 'int main(void) [ return bar(1); ]' > foo-main.pc
56 echo 'int bar(int x) { return !x; }' > barbar.c
57 echo 'int m@in(void) { return 0; }' > sub/zardoz.pc
58
59 $ACLOCAL
60 $AUTOCONF
61 $AUTOMAKE
62
63 ./configure
64
65 $MAKE
66 cat TAGS
67 cat sub/TAGS
68 $FGREP foo-main.pc TAGS
69 $FGREP barbar.c TAGS
70 $FGREP zardoz.pc sub/TAGS
71
72 $MAKE distcheck
73
74 :