tests: make 'lzip.test' executable
[automake.git] / tests / target-cflags.test
blobb324568d9275a4740b0004ee41b505b7cdc4b284
1 #! /bin/sh
2 # Copyright (C) 2000, 2001, 2002, 2004, 2010 Free Software Foundation,
3 # Inc.
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2, or (at your option)
8 # any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 # Test to make sure target specific CFLAGS work
19 # Assar Westerlund <assar@sics.se>
21 required=gcc
22 . ./defs || Exit 1
24 cat > configure.in << 'END'
25 AC_INIT(foo.c)
26 AM_INIT_AUTOMAKE(target-cflags,0.0)
27 AC_PROG_CC
28 AM_PROG_CC_C_O
29 AC_OUTPUT(Makefile)
30 END
32 cat > Makefile.am << 'END'
33 AUTOMAKE_OPTIONS = no-dependencies
35 bin_PROGRAMS = foo bar
36 foo_CFLAGS = -DFOO
37 END
39 cat > foo.c << 'END'
40 #include <stdio.h>
41 #ifdef FOO
42 int main(void) {
43 return 0;
45 #endif
46 END
48 cat > bar.c << 'END'
49 #ifndef FOO
50 int main(void)
52 return 0;
54 #endif
55 END
57 set -e
59 $ACLOCAL
60 $AUTOCONF
61 $AUTOMAKE -a
62 mkdir build
64 cd build
65 ../configure
66 $MAKE
67 ./foo
68 ./bar
69 cd ..
71 ./configure
72 $MAKE
73 ./foo
74 ./bar