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