tests: prune some weed in a non-POSIX test
[platform/upstream/automake.git] / t / libobj19.sh
1 #! /bin/sh
2 # Copyright (C) 2010-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 support for AC_CONFIG_LIBOBJ_DIR.
18
19 required=cc
20 . test-init.sh
21
22 cat >> configure.ac << 'END'
23 AC_CONFIG_LIBOBJ_DIR([libobj-dir])
24 AC_PROG_CC
25 AM_PROG_CC_C_O
26 AM_PROG_AR
27 AC_PROG_RANLIB
28 AC_LIBOBJ([foobar])
29 AC_OUTPUT
30 END
31
32 cat > Makefile.am << 'END'
33 AUTOMAKE_OPTIONS = subdir-objects
34 noinst_LIBRARIES = libtu.a
35 libtu_a_SOURCES =
36 libtu_a_LIBADD = $(LIBOBJS)
37 ## Hack with this variable ans with extra make recursion in the check-local
38 ## rule are required for when we move this Makefile in a subdir, later.
39 my_distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)
40 check-local:
41         (cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) distdir)
42         ls -l $(top_srcdir)/* $(top_builddir)/* $(my_distdir)/*
43         test -f libtu.a
44         test ! -r $(top_srcdir)/foobar.c
45         test -f $(top_srcdir)/libobj-dir/foobar.c
46         test ! -r $(my_distdir)/foobar.c
47         test -f $(my_distdir)/libobj-dir/foobar.c
48         $(AR) t libtu.a
49         $(AR) t libtu.a | grep foobar
50 END
51
52 mkdir libobj-dir
53 cat > libobj-dir/foobar.c << 'END'
54 extern int dummy;
55 END
56
57 cp "$am_scriptdir/ar-lib" . || fatal_ "fetching auxiliary script 'ar-lib'"
58 cp "$am_scriptdir/compile" . || fatal_ "fetching auxiliary script 'compile'"
59
60 $ACLOCAL
61 $AUTOCONF
62 $AUTOMAKE
63
64 ./configure
65
66 $MAKE
67 $MAKE check
68 $MAKE distcheck
69
70 # Same check, but with the Makefile.am using $(LIBOBJS) not being
71 # the top-level one.
72
73 $MAKE distclean
74 rm -rf autom4te*.cache aclocal.m4 configure
75
76 mkdir sub
77 mv -f Makefile.am sub
78 echo SUBDIRS = sub > Makefile.am
79
80 sed '/^AC_OUTPUT/i\
81 AC_CONFIG_FILES([sub/Makefile])
82 ' configure.ac > t
83 mv -f t configure.ac
84 cat configure.ac # For debugging.
85
86 $ACLOCAL
87 $AUTOCONF
88 $AUTOMAKE
89
90 ./configure
91
92 $MAKE
93 $MAKE check
94 $MAKE distcheck
95
96 :