Revert Automake license to GPLv2+.
[automake.git] / tests / ansi7.test
blobe97f517441eed676334fefef8c735df64129c76e
1 #! /bin/sh
2 # Copyright (C) 2002, 2008 Free Software Foundation, Inc.
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.
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.
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/>.
17 # Check ansi2knr on a source file in subdirectory.
18 # ansi6.test is the same test without subdir-objects.
19 # From Kevin Ryde.
21 required=gcc
22 . ./defs || Exit 1
24 cat > configure.in << 'END'
25 AC_INIT(ansi6, 1.0)
26 AM_INIT_AUTOMAKE
27 AC_PROG_CC
28 AC_PROG_CC_STDC
29 AM_PROG_CC_C_O
30 AM_C_PROTOTYPES
31 AC_CONFIG_FILES(Makefile)
32 AC_OUTPUT
33 END
35 cat > Makefile.am << 'END'
36 AUTOMAKE_OPTIONS = ansi2knr subdir-objects
37 bin_PROGRAMS = hello
38 hello_SOURCES = hello.c sub/dir.c
39 END
41 cat > hello.c << 'END'
42 #include <stdio.h>
44 extern int foo ();
46 int
47 main (int argc, char **argv)
49 printf ("%d\n", foo ());
51 END
53 mkdir sub
55 cat > sub/dir.c << 'END'
56 int
57 foo ()
59 return 23;
61 END
63 set -e
65 $ACLOCAL
66 $AUTOCONF
67 $AUTOMAKE -a
69 # Sanity check: make sure it's ok to set ac_cv_prog_cc_stdc as we do.
70 test `grep -c ac_cv_prog_cc_stdc configure` -gt 1
72 ./configure ac_cv_prog_cc_stdc=no
73 $MAKE
75 test -f hello_.c
76 test -f sub/dir_.c # Must be in sub directory, unlike ansi6.test.
77 test ! -f dir_.c
78 $MAKE distclean
79 test ! -f hello_.c
80 test ! -f sub/dir_.c
82 # Also run without forcing ansi2knr, so we make sure the
83 # rules work with ANSI compilers.
84 # Report from Andreas Schwab.
86 ./configure
87 $MAKE