2 # Copyright (C) 2009-2012 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)
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 <http://www.gnu.org/licenses/>.
17 # Test cscope functionality.
23 ocwd=$(pwd) || fatal_ "getting top-level directory"
25 cat >> configure.ac << 'END'
26 AC_CONFIG_FILES([sub/Makefile])
27 AC_SUBST([CC], [who-cares])
28 AC_SUBST([CXX], [who-cares])
29 AC_SUBST([FC], [who-cares])
30 AC_SUBST([GCJ], [who-cares])
37 cat > Makefile.am <<'END'
40 foo_SOURCES = foo.c bar.cpp baz.f90
45 cat > sub/Makefile.am <<'END'
47 bar_SOURCES = subsub/dist.c
48 nodist_bar_SOURCES = subsub/gen.c
51 echo 'int generated_subsub () { return 0; }' > $@
52 CLEANFILES = subsub/gen.c
55 echo 'int foo_func () { return 0; }' > foo.c
56 echo 'int main () { return 0; }' > bar.cpp
62 echo 'int main () { return 0; }' > sub/subsub/dist.c
64 $ACLOCAL || fatal_ "aclocal failed"
65 $AUTOCONF || fatal_ "autoconf failed"
66 $AUTOMAKE -i -a || fatal_ "automake -i -a failed"
68 # Sun cscope is interactive without redirection; also, it might not
69 # support the '-q' option, which is required by our generated recipes.
70 if cscope -q --version </dev/null; then
79 if test -f configure; then
86 && test ! -e cscope.files \
87 && test ! -e cscope.out \
88 && test ! -e cscope.in.out \
89 && test ! -e cscope.po.out \
91 result_ "$r" "[$pfx] make distcheck"
97 $MAKE -n cscope || r='not ok'
98 result_ "$r" "[$pfx] make -n cscope"
100 if test $have_cscope = no; then
102 touch cscope.files cscope.out cscope.in.out cscope.po.out
103 skip_row_ 3 -r "no proper cscope program available"
108 $MAKE cscope 2>stderr || r='not ok'
110 grep 'cannot find file' stderr && r='not ok'
112 result_ "$r" "[$pfx] make cscope"
115 test -f cscope.files \
116 && $FGREP foo.c cscope.files \
117 && $FGREP bar.cpp cscope.files \
118 && $FGREP sub/subsub/dist.c cscope.files \
119 && $FGREP sub/subsub/gen.c cscope.files \
121 result_ "$r" "[$pfx] cscope.files looks correct"
124 # cscope.files might not exist of the earlier "make cscope" failed.
125 cp cscope.files cscope.files1 \
127 && diff cscope.files cscope.files1 \
130 result_ "$r" "[$pfx] second \"make cscope\" is consistent"
135 command_ok_ "[$pfx] configure" \
136 "$1"/configure EMACS=no --with-lispdir=/who/cares
159 skip_row_ 12 -r "cscope in VPATH required GNU make"