tests: cosmetic changes in t/extra-sources.sh
[platform/upstream/automake.git] / t / target-cflags.sh
1 #! /bin/sh
2 # Copyright (C) 2000-2013 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=cc
21 . test-init.sh
22
23 cat >> configure.ac << 'END'
24 AC_PROG_CC
25 AC_OUTPUT
26 END
27
28 cat > Makefile.am << 'END'
29 AUTOMAKE_OPTIONS = no-dependencies
30
31 bin_PROGRAMS = foo bar
32 foo_CFLAGS   = -DFOO
33 END
34
35 cat > foo.c << 'END'
36 #include <stdio.h>
37 #ifdef FOO
38 int main(void)
39 {
40   return 0;
41 }
42 #endif
43 END
44
45 cat > bar.c << 'END'
46 #ifndef FOO
47 int main(void)
48 {
49   return 0;
50 }
51 #endif
52 END
53
54 $ACLOCAL
55 $AUTOCONF
56 $AUTOMAKE -a
57 mkdir build
58
59 cd build
60 ../configure
61 $MAKE
62 if ! cross_compiling; then
63   ./foo
64   ./bar
65 fi
66 cd ..
67
68 ./configure
69 $MAKE
70 if ! cross_compiling; then
71   ./foo
72   ./bar
73 fi
74
75 :