Merge branch 'msvc' into maint
[platform/upstream/automake.git] / tests / asm2.test
1 #! /bin/sh
2 # Copyright (C) 2001, 2002, 2003, 2006, 2010 Free Software Foundation,
3 # 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 # Test of basic preprocessed assembly functionality.
19 # Keep this in sync with sister tests asm.test and asm3.test.
20
21 . ./defs || Exit 1
22
23 set -e
24
25 mv configure.in configure.stub
26
27 cat > Makefile.am << 'END'
28 noinst_PROGRAMS = maude
29 maude_SOURCES = maude.S
30 END
31
32 echo '*** Try 1 -- should fail because we need CC and CCAS ***'
33 cat configure.stub - > configure.in << 'END'
34 AC_SUBST([CCASFLAGS])
35 AC_OUTPUT
36 END
37
38 $ACLOCAL
39 AUTOMAKE_fails
40 grep '[Aa]ssembler source.*CCAS.* undefined' stderr
41 grep 'define .*CCAS.* add .*AM_PROG_AS' stderr
42
43 # On fast machines the autom4te.cache created during the above run of
44 # $AUTOMAKE is likely to have the same time stamp as the configure.in
45 # created below; thus causing traces for the old configure.in to be
46 # used.  We could do `$sleep', but it's faster to erase the
47 # directory.  (Erase autom4te*.cache, not autom4te.cache, because some
48 # bogus installations of Autoconf use a versioned cache.)
49 rm -rf autom4te*.cache
50
51 echo '*** Try 2 -- we still need CCAS ***'
52 cat configure.stub - > configure.in << 'END'
53 AC_PROG_CC
54 AC_SUBST([CCASFLAGS])
55 AC_OUTPUT
56 END
57
58 $ACLOCAL
59 AUTOMAKE_fails
60 grep '[Aa]ssembler source.*CCAS.* undefined' stderr
61 grep 'define .*CCAS.* add .*AM_PROG_AS' stderr
62
63 rm -rf autom4te*.cache
64
65 echo '*** Try 3 -- we need CCASFLAGS ***'
66 cat configure.stub - > configure.in << 'END'
67 CCAS='$(CC)'
68 AC_SUBST([CCAS])
69 AC_PROG_CC
70 AC_OUTPUT
71 END
72
73 $ACLOCAL
74 AUTOMAKE_fails
75 grep '[Aa]ssembler source.*CCASFLAGS.* undefined' stderr
76 grep 'define .*CCASFLAGS.* add .*AM_PROG_AS' stderr
77
78 rm -rf autom4te*.cache
79
80 echo '*** Try 4 -- we need dependency tracking. ***'
81 cat configure.stub - > configure.in << 'END'
82 CCAS='$(CC)'
83 AC_SUBST([CCAS])
84 AC_PROG_CC
85 AC_SUBST([CCASFLAGS])
86 AC_OUTPUT
87 END
88
89 $ACLOCAL
90 AUTOMAKE_fails
91 grep ' add .*AM_PROG_AS' stderr
92
93 rm -rf autom4te*.cache
94
95 echo '*** Try 5 -- we have everything needed, expect success. ***'
96 cat configure.stub - > configure.in << 'END'
97 CCAS='$(CC)'
98 AC_SUBST([CCAS])
99 AC_PROG_CC
100 _AM_DEPENDENCIES([CCAS])
101 AC_SUBST([CCASFLAGS])
102 AC_OUTPUT
103 END
104
105 $ACLOCAL
106 $AUTOMAKE
107
108 rm -rf autom4te*.cache
109
110 echo '*** Try 6 -- we have everything needed, expect success. ***'
111 cat configure.stub - > configure.in << 'END'
112 AM_PROG_AS
113 AC_OUTPUT
114 END
115
116 $ACLOCAL
117 $AUTOMAKE
118
119 :