From Nicolas Joly:
[automake.git] / tests / ansi5.test
blobd9ce17e5eaba1f81018779ec9c8508f809ed116b
1 #! /bin/sh
3 # Test for ansi2knr in another directory.
5 . $srcdir/defs || exit 1
7 cat > configure.in << 'END'
8 AC_INIT(one/joe.c)
9 AM_INIT_AUTOMAKE(liver, 0.23)
10 AC_PROG_CC
11 AM_C_PROTOTYPES
12 AC_OUTPUT(Makefile one/Makefile two/Makefile)
13 END
15 cat > Makefile.am << 'END'
16 SUBDIRS = one two
17 END
19 mkdir one two
21 cat > one/Makefile.am << 'END'
22 AUTOMAKE_OPTIONS = ansi2knr
23 bin_PROGRAMS = joe
24 END
26 cat > two/Makefile.am << 'END'
27 AUTOMAKE_OPTIONS = ../one/ansi2knr
28 bin_PROGRAMS = maude
29 END
31 cat > one/joe.c << 'END'
32 #include <stdio.h>
33 int
34 main (int argc, char *argv[])
36 printf ("joe\n");
37 return 0;
39 END
41 cat > two/maude.c << 'END'
42 #include <stdio.h>
43 int
44 main (int argc, char *argv[])
46 printf ("maude\n");
47 return 0;
49 END
51 $needs_autoconf
53 (gcc -v) > /dev/null 2>&1 || exit 77
55 set -e
57 $ACLOCAL
58 $AUTOCONF
59 $AUTOMAKE -a
60 CC=gcc ./configure
62 # This is ugly! If we set U at make time then the "wrong" file gets
63 # included.
64 find . -name '*.Po' -print \
65 | while read file; do
66 base="`echo $file | sed -e 's/\.Po//'`"
67 mv $file ${base}_.Po
68 done
70 # So is this! If we set ANSI2KNR on the make command line then the
71 # wrong value is passed to two's Makefile.
72 mv one/Makefile one/Makefile.old
73 sed -e 's,ANSI2KNR =,ANSI2KNR = ./ansi2knr,' < one/Makefile.old > one/Makefile
75 $MAKE U=_
76 ./one/joe
77 ./two/maude