tests: prefer "test ! -e FILE" to check that a file doesn't exist
[platform/upstream/automake.git] / t / lisp6.sh
1 #! /bin/sh
2 # Copyright (C) 2004-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 for conditional _LISP.
18
19 required=emacs
20 . ./defs || exit 1
21
22 cat > Makefile.am << 'EOF'
23 dist_lisp_LISP = am-one.el
24 if WANT_TWO
25   dist_lisp_LISP += am-two.el
26 endif
27 dist_noinst_LISP = am-three.el
28
29 dist-test: distdir
30         test -f $(distdir)/am-one.el
31         test -f $(distdir)/am-two.el
32         test -f $(distdir)/am-three.el
33 EOF
34
35 cat >> configure.ac << 'EOF'
36 AM_CONDITIONAL([WANT_TWO], [test -n "$want_two"])
37 AM_PATH_LISPDIR
38 AC_OUTPUT
39 EOF
40
41 # Avoid possible spurious influences from the environment.
42 want_two=; unset want_two
43
44 echo "(provide 'am-one)" > am-one.el
45 echo "(require 'am-one)" > am-two.el
46 echo "(require 'am-one)" > am-three.el
47
48 $ACLOCAL
49 $AUTOCONF
50 $AUTOMAKE --add-missing
51
52 cwd=$(pwd) || fatal_ "getting current working directory"
53
54 ./configure --with-lispdir="$cwd/lisp"
55
56 $MAKE
57 test -f am-one.elc
58 test ! -e am-two.elc
59 test -f am-three.elc
60 test -f elc-stamp
61
62 $MAKE install
63 test -f lisp/am-one.el
64 test -f lisp/am-one.elc
65 test ! -e lisp/am-two.el
66 test ! -e lisp/am-two.elc
67 test ! -e lisp/am-three.el
68 test ! -e lisp/am-three.elc
69
70 $MAKE dist-test
71
72 $MAKE distclean
73 test ! -e am-one.elc
74 test ! -e am-two.elc
75 test ! -e am-three.elc
76 test ! -e elc-stamp
77
78 ./configure --with-lispdir="$cwd/lisp" want_two=1
79
80 $MAKE
81 test -f am-one.elc
82 test -f am-two.elc
83 test -f am-three.elc
84 test -f elc-stamp
85
86 # Let's mutilate the source tree, to check the recover rule.
87 rm -f am-*.elc
88 $MAKE
89 test -f am-one.elc
90 test -f am-two.elc
91 test -f am-three.elc
92 test -f elc-stamp
93
94 $MAKE install
95 test -f lisp/am-one.el
96 test -f lisp/am-one.elc
97 test -f lisp/am-two.el
98 test -f lisp/am-two.elc
99 test ! -e lisp/am-three.el
100 test ! -e lisp/am-three.elc
101
102 $MAKE dist-test
103
104 $MAKE distclean
105 test ! -e am-one.elc
106 test ! -e am-two.elc
107 test ! -e am-three.elc
108 test ! -e elc-stamp
109
110 :