test init: refactor: new function 'am_setup_testdir'
[automake.git] / t / transform3.sh
blobfc37be1fe2dd1c48d355aceca9469acfb633f766
1 #! /bin/sh
2 # Copyright (C) 2012 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)
7 # any later version.
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 # Make sure that --program-transform does not transform too much
18 # stuff (in particular, pgklibdir, pkgdatadir and pkglibexecdir).
20 required=cc
21 . ./defs || exit 1
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
33 cat > Makefile.am <<'END'
34 bin_SCRIPTS = foo
35 pkgdata_DATA = bar.txt
36 pkglib_LIBRARIES = libzap.a
37 pkglibexec_SCRIPTS = mu
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
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
61 cat > libzap.c <<'END'
62 int zap (void)
64 return 0;
66 END
68 echo 'To be or not to be ...' > bar.txt
70 cat > foo <<'END'
71 #!/bin/sh
72 exit 0
73 END
74 cp foo mu
75 chmod a+x foo mu
77 $ACLOCAL
78 $AUTOCONF
79 $AUTOMAKE -a
81 ./configure --program-prefix=gnu- --prefix "$(pwd)/inst"
83 $MAKE test-install
85 $MAKE uninstall
86 test $(find inst -type f -print | wc -l) -eq 0
88 # Opportunistically test for installdirs.
89 rm -rf inst
90 $MAKE test-installdirs