Merge branch 'msvc' into maint
[platform/upstream/automake.git] / tests / transform2.test
1 #! /bin/sh
2 # Copyright (C) 2002, 2003, 2004, 2007, 2008, 2012 Free Software
3 # Foundation, Inc.
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2, or (at your option)
8 # any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
18 # Make sure that --program-transform works even when multiple files are
19 # collapsed.
20
21 . ./defs || Exit 1
22
23 set -e
24
25 cat >>configure.in <<'END'
26 AC_PROG_CC
27 AC_OUTPUT
28 END
29
30 cat >Makefile.am <<'EOF'
31 bin_PROGRAMS = p1 p2
32 bin_SCRIPTS = s1.sh s2.sh
33 man_MANS = m1.1 m2.1
34
35 test-install: install
36         test -f inst/bin/p$(EXEEXT)
37         test -f inst/bin/s.sh
38         test -f inst/man/man1/m.1
39
40 test-install-foo: install
41         test -f inst/bin/foo$(EXEEXT)
42         test -f inst/bin/foo
43         test -f inst/man/man1/foo.1
44         test ! -f inst/bin/p1$(EXEEXT)
45         test ! -f inst/bin/p2$(EXEEXT)
46         test ! -f inst/bin/s1.sh
47         test ! -f inst/bin/s2.sh
48         test ! -f inst/man/man/m1.1
49         test ! -f inst/man/man/m2.1
50 EOF
51
52 cat >p1.c <<'EOF'
53 int
54 main ()
55 {
56   return 0;
57 }
58 EOF
59
60 cp p1.c p2.c
61
62 : > s1.sh
63 : > s2.sh
64 : > m1.1
65 : > m2.1
66
67 $ACLOCAL
68 $AUTOCONF
69 $AUTOMAKE
70
71 ./configure --program-transform-name='s/[12]//' --prefix "`pwd`/inst" --mandir "`pwd`/inst/man"
72 $MAKE
73 $MAKE test-install
74 $MAKE uninstall
75 test `find inst -type f -print | wc -l` = 0
76
77 # Also squash all file types in question.
78
79 # On newer Cygwin versions, that won't work, likely due to overly
80 # aggressive appending of '.exe' suffix when copying/renaming Windows
81 # executables).  So let's skip this part of the test if we detect the
82 # faulty heuristic is present.  See also:
83 # <http://lists.gnu.org/archive/html/automake-patches/2010-08/msg00153.html>
84 # <http://thread.gmane.org/gmane.os.cygwin/119380>
85 echo Foo > foo
86 echo Bar > bar.exe
87 chmod a+x foo bar.exe
88 cp foo bar && cmp foo bar \
89   || skip_ "your Cygwin is too aggressive in tweaking '.exe' suffixes"
90
91 ./configure --program-transform-name='s/.*/foo/' --prefix "`pwd`/inst" --mandir "`pwd`/inst/man"
92 $MAKE
93 $MAKE test-install-foo
94 $MAKE uninstall
95 test `find inst -type f -print | wc -l` = 0
96
97 :