tests: cosmetic changes in t/extra-sources.sh
[platform/upstream/automake.git] / t / ccnoco-lt.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 libtool libraries when the compiler
18 # doesn't understand '-c -o'.
19
20 required='gcc libtoolize' # For cc-no-c-o.
21 . test-init.sh
22
23 cat >> configure.ac << 'END'
24 AC_PROG_CC
25 AM_PROG_AR
26 LT_INIT
27 $CC --version
28 $CC -v
29 AC_OUTPUT
30 END
31
32 cat > Makefile.am << 'END'
33 lib_LTLIBRARIES = libwish.la
34 END
35
36 cat > libwish.c << 'END'
37 int wish_granted (void)
38 {
39    return 0;
40 }
41 END
42
43 # Make sure the compiler doesn't understand '-c -o'.
44 CC=$am_testaux_builddir/cc-no-c-o; export CC
45
46 libtoolize --verbose --install
47 $ACLOCAL
48 $AUTOCONF
49 $AUTOMAKE --copy --add-missing
50
51 for vpath in : false; do
52   if $vpath; then
53     srcdir=..
54     mkdir build
55     cd build
56   else
57     srcdir=.
58   fi
59   $srcdir/configure >stdout || { cat stdout; exit 1; }
60   cat stdout
61   $EGREP 'understands? -c and -o together.* no$' stdout
62   # No repeated checks please.
63   test $(grep ".*-c['\" ].*-o['\" ]" stdout \
64           | $FGREP -v ' -c -o file.o' | wc -l) -eq 1
65   # Once we have rewritten $CC to use our 'compile' wrapper script,
66   # libtool should pick it up correctly, and not mess with the
67   # redefinition.
68   grep '^checking if .*/compile .*supports -c -o file\.o\.\.\. yes' stdout
69   # And of course, we should be able to build our package.
70   $MAKE
71   cd $srcdir
72 done
73
74 $MAKE distcheck
75
76 :