2 # Copyright (C) 2009-2013 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_INIT([cscope-test], [1.0])
27 AM_INIT_AUTOMAKE([subdir-objects])
28 AC_CONFIG_FILES([Makefile sub/Makefile])
29 AC_SUBST([CC], [who-cares])
30 AC_SUBST([CXX], [who-cares])
31 AC_SUBST([FC], [who-cares])
32 AC_SUBST([GCJ], [who-cares])
39 cat > Makefile.am <<'END'
42 foo_SOURCES = foo.c bar.cpp baz.f90
47 cat > sub/Makefile.am <<'END'
49 bar_SOURCES = subsub/dist.c
50 nodist_bar_SOURCES = subsub/gen.c
53 echo 'int generated_subsub () { return 0; }' > $@
54 CLEANFILES = subsub/gen.c
57 echo 'int foo_func () { return 0; }' > foo.c
58 echo 'int main () { return 0; }' > bar.cpp
64 echo 'int main () { return 0; }' > sub/subsub/dist.c
66 $ACLOCAL || fatal_ "aclocal failed"
67 $AUTOCONF || fatal_ "autoconf failed"
68 $AUTOMAKE -i -a || fatal_ "automake -i -a failed"
70 # Sun cscope is interactive without redirection; also, it might not
71 # support the '-q' option, which is required by our generated recipes.
72 if cscope -q --version </dev/null; then
81 if test -f configure; then
88 && test ! -e cscope.files \
89 && test ! -e cscope.out \
90 && test ! -e cscope.in.out \
91 && test ! -e cscope.po.out \
93 result_ "$r" "[$pfx] make distcheck"
99 $MAKE -n cscope || r='not ok'
100 result_ "$r" "[$pfx] make -n cscope"
102 if test $have_cscope = no; then
104 touch cscope.files cscope.out cscope.in.out cscope.po.out
105 skip_row_ 3 -r "no proper cscope program available"
110 $MAKE cscope 2>stderr || r='not ok'
112 grep 'cannot find file' stderr && r='not ok'
114 result_ "$r" "[$pfx] make cscope"
117 test -f cscope.files \
118 && $FGREP foo.c cscope.files \
119 && $FGREP bar.cpp cscope.files \
120 && $FGREP sub/subsub/dist.c cscope.files \
121 && $FGREP sub/subsub/gen.c cscope.files \
123 result_ "$r" "[$pfx] cscope.files looks correct"
126 # cscope.files might not exist of the earlier "make cscope" failed.
127 cp cscope.files cscope.files1 \
129 && diff cscope.files cscope.files1 \
132 result_ "$r" "[$pfx] second \"make cscope\" is consistent"
137 command_ok_ "[$pfx] configure" \
138 "$1"/configure EMACS=no --with-lispdir=/who/cares
161 skip_row_ 12 -r "cscope in VPATH requires GNU make"