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