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