am-ft: make the environment available earlier
[platform/upstream/automake.git] / t / transform3.sh
1 #! /bin/sh
2 # Copyright (C) 2012-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 # Make sure that --program-transform does not transform too much
18 # stuff (in particular, pgklibdir, pkgdatadir and pkglibexecdir).
19
20 required=cc
21 . test-init.sh
22
23 cat > configure.ac <<'END'
24 AC_INIT([foo], [1.0])
25 AM_INIT_AUTOMAKE
26 AC_CONFIG_FILES([Makefile])
27 AC_PROG_CC
28 AM_PROG_AR
29 AC_PROG_RANLIB
30 AC_OUTPUT
31 END
32
33 cat > Makefile.am <<'END'
34 bin_SCRIPTS = foo
35 pkgdata_DATA = bar.txt
36 pkglib_LIBRARIES = libzap.a
37 pkglibexec_SCRIPTS = mu
38
39 test-install: install
40         find $(prefix) ;: For debugging.
41         test   -f $(bindir)/gnu-foo
42         test   -x $(bindir)/gnu-foo
43         test   -f $(datadir)/foo/bar.txt
44         test ! -d $(datadir)/gnu-foo
45         test   -f $(libdir)/foo/libzap.a
46         test ! -d $(libdir)/gnu-foo
47         test   -f $(libexecdir)/foo/gnu-mu
48         test   -x $(libexecdir)/foo/gnu-mu
49         test ! -d $(libexecdir)/gnu-foo
50
51 test-installdirs: installdirs
52         find $(prefix) ;: For debugging.
53         test   -d $(datadir)/foo
54         test ! -d $(datadir)/gnu-foo
55         test   -d $(libdir)/foo
56         test ! -d $(libdir)/gnu-foo
57         test   -d $(libexecdir)/foo
58         test ! -d $(libexecdir)/gnu-foo
59 END
60
61 cat > libzap.c <<'END'
62 int zap (void)
63 {
64   return 0;
65 }
66 END
67
68 echo 'To be or not to be ...' > bar.txt
69
70 cat > foo <<'END'
71 #!/bin/sh
72 exit 0
73 END
74 cp foo mu
75 chmod a+x foo mu
76
77 $ACLOCAL
78 $AUTOCONF
79 $AUTOMAKE -a
80
81 ./configure --program-prefix=gnu- --prefix "$(pwd)/inst"
82
83 $MAKE test-install
84
85 $MAKE uninstall
86 test $(find inst -type f -print | wc -l) -eq 0
87
88 # Opportunistically test for installdirs.
89 rm -rf inst
90 $MAKE test-installdirs
91
92 :