Merge branch 'maint'
[platform/upstream/automake.git] / t / transform2.sh
1 #! /bin/sh
2 # Copyright (C) 2002-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 # Make sure that --program-transform works even when multiple files are
18 # collapsed.
19
20 required=cc
21 . ./defs || Exit 1
22
23 cat >>configure.ac <<'END'
24 AC_PROG_CC
25 AC_OUTPUT
26 END
27
28 cat >Makefile.am <<'EOF'
29 bin_PROGRAMS = p1 p2
30 bin_SCRIPTS = s1.sh s2.sh
31 man_MANS = m1.1 m2.1
32
33 test-install: install
34         test -f inst/bin/p$(EXEEXT)
35         test -f inst/bin/s.sh
36         test -f inst/man/man1/m.1
37
38 test-install-foo: install
39         test -f inst/bin/foo$(EXEEXT)
40         test -f inst/bin/foo
41         test -f inst/man/man1/foo.1
42         test ! -f inst/bin/p1$(EXEEXT)
43         test ! -f inst/bin/p2$(EXEEXT)
44         test ! -f inst/bin/s1.sh
45         test ! -f inst/bin/s2.sh
46         test ! -f inst/man/man/m1.1
47         test ! -f inst/man/man/m2.1
48 EOF
49
50 cat >p1.c <<'EOF'
51 int
52 main ()
53 {
54   return 0;
55 }
56 EOF
57
58 cp p1.c p2.c
59
60 : > s1.sh
61 : > s2.sh
62 : > m1.1
63 : > m2.1
64
65 $ACLOCAL
66 $AUTOCONF
67 $AUTOMAKE
68
69 ./configure --program-transform-name='s/[12]//' --prefix "`pwd`/inst" --mandir "`pwd`/inst/man"
70 $MAKE
71 $MAKE test-install
72 $MAKE uninstall
73 test `find inst -type f -print | wc -l` = 0
74
75 # Also squash all file types in question.
76
77 # On newer Cygwin versions, that won't work, likely due to overly
78 # aggressive appending of '.exe' suffix when copying/renaming Windows
79 # executables).  So let's skip this part of the test if we detect the
80 # faulty heuristic is present.  See also:
81 # <http://lists.gnu.org/archive/html/automake-patches/2010-08/msg00153.html>
82 # <http://thread.gmane.org/gmane.os.cygwin/119380>
83 echo Foo > foo
84 echo Bar > bar.exe
85 chmod a+x foo bar.exe
86 cp foo bar && cmp foo bar \
87   || skip_ "your Cygwin is too aggressive in tweaking '.exe' suffixes"
88
89 ./configure --program-transform-name='s/.*/foo/' --prefix "`pwd`/inst" --mandir "`pwd`/inst/man"
90 $MAKE
91 $MAKE test-install-foo
92 $MAKE uninstall
93 test `find inst -type f -print | wc -l` = 0
94
95 :