am-ft: make the environment available earlier
[platform/upstream/automake.git] / t / lisp6.sh
1 #! /bin/sh
2 # Copyright (C) 2004-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 for conditional _LISP.
18
19 required=emacs
20 . test-init.sh
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 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
61 $MAKE install
62 test -f lisp/am-one.el
63 test -f lisp/am-one.elc
64 test ! -e lisp/am-two.el
65 test ! -e lisp/am-two.elc
66 test ! -e lisp/am-three.el
67 test ! -e lisp/am-three.elc
68
69 $MAKE dist-test
70
71 $MAKE distclean
72 test ! -e am-one.elc
73 test ! -e am-two.elc
74 test ! -e am-three.elc
75
76 ./configure --with-lispdir="$cwd/lisp" want_two=1
77
78 $MAKE
79 test -f am-one.elc
80 test -f am-two.elc
81 test -f am-three.elc
82
83 # Let's mutilate the source tree, to check the recover rule.
84 rm -f am-*.elc
85 $MAKE
86 test -f am-one.elc
87 test -f am-two.elc
88 test -f am-three.elc
89
90 $MAKE install
91 test -f lisp/am-one.el
92 test -f lisp/am-one.elc
93 test -f lisp/am-two.el
94 test -f lisp/am-two.elc
95 test ! -e lisp/am-three.el
96 test ! -e lisp/am-three.elc
97
98 $MAKE dist-test
99
100 $MAKE distclean
101 test ! -e am-one.elc
102 test ! -e am-two.elc
103 test ! -e am-three.elc
104
105 :