Revert Automake license to GPLv2+.
[platform/upstream/automake.git] / tests / target-cflags.test
1 #! /bin/sh
2 # Copyright (C) 2000, 2001, 2002, 2004  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 to make sure target specific CFLAGS work
18 # Assar Westerlund <assar@sics.se>
19
20 required=gcc
21 . ./defs || Exit 1
22
23 cat > configure.in << 'END'
24 AC_INIT(foo.c)
25 AM_INIT_AUTOMAKE(target-cflags,0.0)
26 AC_PROG_CC
27 AM_PROG_CC_C_O
28 AC_OUTPUT(Makefile)
29 END
30
31 cat > Makefile.am << 'END'
32 AUTOMAKE_OPTIONS = foreign no-dependencies
33
34 bin_PROGRAMS = foo bar
35 foo_CFLAGS   = -DFOO
36 END
37
38 cat > foo.c << 'END'
39 #include <stdio.h>
40 #ifdef FOO
41 int main(void) {
42   return 0;
43 }
44 #endif
45 END
46
47 cat > bar.c << 'END'
48 #ifndef FOO
49 int main(void)
50 {
51   return 0;
52 }
53 #endif
54 END
55
56 set -e
57
58 $ACLOCAL
59 $AUTOCONF
60 $AUTOMAKE -a
61 mkdir build
62
63 cd build
64 ../configure
65 $MAKE
66 ./foo
67 ./bar
68 cd ..
69
70 ./configure
71 $MAKE
72 ./foo
73 ./bar