Merge branch 'micro' into maint
[platform/upstream/automake.git] / t / ccnoco.sh
1 #! /bin/sh
2 # Copyright (C) 2001-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 we can compile when the compiler doesn't
18 # understand '-c -o'.
19
20 required=gcc # For cc-no-c-o.
21 . test-init.sh
22
23 cat >> configure.ac << 'END'
24 AC_PROG_CC
25 $CC --version || exit 1
26 $CC -v || exit 1
27 AC_OUTPUT
28 END
29
30 cat > Makefile.am << 'END'
31 bin_PROGRAMS = wish
32 wish_SOURCES = a.c
33 # Make sure we need something strange.
34 wish_CFLAGS = -g
35 END
36
37 cat > a.c << 'END'
38 #include <stdio.h>
39
40 int main ()
41 {
42    printf ("hi\n");
43 }
44 END
45
46 # Make sure the compiler doesn't understand '-c -o'.
47 CC=$am_testaux_builddir/cc-no-c-o; export CC
48
49 $ACLOCAL
50 $AUTOCONF -Wall -Werror
51 $AUTOMAKE --copy --add-missing
52
53 for vpath in : false; do
54   if $vpath; then
55     srcdir=..
56     mkdir build
57     cd build
58   else
59     srcdir=.
60   fi
61   $srcdir/configure >stdout || { cat stdout; exit 1; }
62   cat stdout
63   $EGREP 'understands? -c and -o together.* no$' stdout
64   # No repeated checks please.
65   test $(grep -c ".*-c['\" ].*-o['\" ]" stdout) -eq 1
66   $MAKE
67   cd $srcdir
68 done
69
70 $MAKE distcheck
71
72 :