Merge branch 'fix-pr13588-pax-hangs' into branch-1.13.2
[automake.git] / t / target-cflags.sh
blob3c7d72093b557dd4b965404b92644a85b9cd320f
1 #! /bin/sh
2 # Copyright (C) 2000-2013 Free Software Foundation, Inc.
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.
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.
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/>.
17 # Test to make sure target specific CFLAGS work
18 # Assar Westerlund <assar@sics.se>
20 required=cc
21 . test-init.sh
23 cat >> configure.ac << 'END'
24 AC_PROG_CC
25 AM_PROG_CC_C_O
26 AC_OUTPUT
27 END
29 cat > Makefile.am << 'END'
30 AUTOMAKE_OPTIONS = no-dependencies
32 bin_PROGRAMS = foo bar
33 foo_CFLAGS = -DFOO
34 END
36 cat > foo.c << 'END'
37 #include <stdio.h>
38 #ifdef FOO
39 int main(void)
41 return 0;
43 #endif
44 END
46 cat > bar.c << 'END'
47 #ifndef FOO
48 int main(void)
50 return 0;
52 #endif
53 END
55 $ACLOCAL
56 $AUTOCONF
57 $AUTOMAKE -a
58 mkdir build
60 cd build
61 ../configure
62 $MAKE
63 if ! cross_compiling; then
64 ./foo
65 ./bar
67 cd ..
69 ./configure
70 $MAKE
71 if ! cross_compiling; then
72 ./foo
73 ./bar