Merge branch 'msvc' into maint
[platform/upstream/automake.git] / tests / ansi5.test
1 #! /bin/sh
2 # Copyright (C) 2001, 2002, 2003  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 for ansi2knr in another directory.
18
19 required=gcc
20 . ./defs || Exit 1
21
22 cat > configure.in << 'END'
23 AC_INIT(one/joe.c)
24 AM_INIT_AUTOMAKE(liver, 0.23)
25 AC_PROG_CC
26 AM_C_PROTOTYPES
27 AC_OUTPUT(Makefile one/Makefile two/Makefile)
28 END
29
30 cat > Makefile.am << 'END'
31 SUBDIRS = one two
32 END
33
34 mkdir one two
35
36 cat > one/Makefile.am << 'END'
37 AUTOMAKE_OPTIONS = ansi2knr
38 bin_PROGRAMS = joe
39 END
40
41 cat > two/Makefile.am << 'END'
42 AUTOMAKE_OPTIONS = ../one/ansi2knr
43 bin_PROGRAMS = maude
44 END
45
46 cat > one/joe.c << 'END'
47 #include <stdio.h>
48 int
49 main (int argc, char *argv[])
50 {
51    printf ("joe\n");
52    return 0;
53 }
54 END
55
56 cat > two/maude.c << 'END'
57 #include <stdio.h>
58 int
59 main (int argc, char *argv[])
60 {
61    printf ("maude\n");
62    return 0;
63 }
64 END
65
66 set -e
67
68 $ACLOCAL
69 $AUTOCONF -Wno-obsolete
70 $AUTOMAKE -Wno-obsolete -a
71 # Ignore user CFLAGS.
72 CFLAGS=
73 export CFLAGS
74 CC=gcc ./configure
75
76 # This is ugly!  If we set U at make time then the "wrong" file gets
77 # included.
78 find . -name '*.Po' -print \
79 | while read file; do
80     base="`echo $file | sed -e 's/\.Po//'`"
81     mv $file ${base}_.Po
82 done
83
84 # So is this!  If we set ANSI2KNR on the make command line then the
85 # wrong value is passed to two's Makefile.
86 mv one/Makefile one/Makefile.old
87 sed -e 's,ANSI2KNR =,ANSI2KNR = ./ansi2knr,' < one/Makefile.old > one/Makefile
88
89 U=_ $MAKE -e
90 ./one/joe
91 ./two/maude