maint: Update HACKING
[automake.git] / t / ccnoco-lt.sh
blob3088b1a352ce8b68eaabcb2364928744a4b7ff9b
1 #! /bin/sh
2 # Copyright (C) 2001-2017 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 <https://www.gnu.org/licenses/>.
17 # Test to make sure we can compile libtool libraries when the compiler
18 # doesn't understand '-c -o'.
20 required='gcc libtoolize' # For cc-no-c-o.
21 . test-init.sh
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
32 cat > Makefile.am << 'END'
33 lib_LTLIBRARIES = libwish.la
34 END
36 cat > libwish.c << 'END'
37 int wish_granted (void)
39 return 0;
41 END
43 # Make sure the compiler doesn't understand '-c -o'.
44 CC=$am_testaux_builddir/cc-no-c-o; export CC
46 libtoolize --verbose --install
47 $ACLOCAL
48 $AUTOCONF
49 $AUTOMAKE --copy --add-missing
51 for vpath in : false; do
52 if $vpath; then
53 srcdir=..
54 mkdir build
55 cd build
56 else
57 srcdir=.
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
74 $MAKE distcheck