Merge branch 'msvc' into maint
[platform/upstream/automake.git] / tests / conflnk3.test
1 #! /bin/sh
2 # Copyright (C) 2003, 2004, 2010 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 that AC_CONFIG_LINKS using a variable source
18 # is not broken.
19
20 . ./defs || Exit 1
21
22 set -e
23
24 cat > Makefile.am << 'END'
25 SUBDIRS = sdir
26 .PHONY: test
27 test: distdir
28         test ! -r $(distdir)/sdir/dest3
29         test ! -r $(distdir)/sdir/dest2
30         test ! -r $(distdir)/dest3
31         test ! -r $(distdir)/dest2
32         test -f $(distdir)/src2
33 ## src3 cannot be distributed, Automake knows nothing about it
34         test ! -r $(distdir)/sdir/src3
35         test ! -r $(distdir)/src3
36 END
37
38 : > src
39 : > src2
40 mkdir sdir
41 : > sdir/Makefile.am
42 : > sdir/src3
43
44 cat >>configure.in << 'EOF'
45 AC_CONFIG_FILES([sdir/Makefile])
46 my_src_dir=sdir
47 my_dest=dest
48 AC_CONFIG_LINKS([sdir/dest2:src2 sdir/dest3:$my_src_dir/src3])
49 AC_CONFIG_LINKS([$my_dest:src])
50 # the following is a link whose source is itself a link
51 AC_CONFIG_LINKS([dest4:sdir/dest2])
52 # Some package prefer to compute links.
53 cmplink='dest5:src';
54 AC_CONFIG_LINKS([$cmplink])
55 AC_OUTPUT
56 EOF
57
58 $ACLOCAL
59 $AUTOCONF
60 $AUTOMAKE
61
62 # $my_src_dir and $my_dest are variables local to configure, they should
63 # not appear in Makefile.
64 grep my_src_dir Makefile.in && Exit 1
65 grep my_dest Makefile.in && Exit 1
66
67 ./configure
68 test -r sdir/dest2
69 test -r sdir/dest3
70 test -r dest
71 test -r dest4
72 test -r dest5
73 $MAKE test
74
75 $MAKE distclean
76 test ! -r sdir/dest2
77 test ! -r sdir/dest3
78 test -r dest  # Should still exist, Automake knows nothing about it.
79 test -r dest5 # ditto
80 rm -f dest dest5
81 test ! -r dest4
82
83 mkdir build
84 cd build
85 ../configure
86 $MAKE test
87
88 :