source: trunk/essentials/sys-devel/automake-1.9/tests/subcond2.test

Last change on this file was 3086, checked in by bird, 18 years ago

automake 1.9.6

File size: 2.3 KB
Line 
1#! /bin/sh
2# Copyright (C) 2002, 2003 Free Software Foundation, Inc.
3#
4# This file is part of GNU Automake.
5#
6# GNU Automake is free software; you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation; either version 2, or (at your option)
9# any later version.
10#
11# GNU Automake is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License
17# along with Automake; see the file COPYING. If not, write to
18# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19# Boston, MA 02110-1301, USA.
20
21# The for conditional SUBDIRS.
22# SUBDIRS + AM_CONDITIONAL setup from the manual.
23# Lots of lines here are duplicated in subcond3.test.
24
25. ./defs || exit 1
26
27set -e
28
29cat >>configure.in <<'END'
30AM_CONDITIONAL([COND_OPT], [test "$want_opt" = yes])
31AC_CONFIG_FILES([src/Makefile opt/Makefile])
32AC_OUTPUT
33END
34
35cat >Makefile.am << 'END'
36if COND_OPT
37 MAYBE_OPT = opt
38endif
39SUBDIRS = src $(MAYBE_OPT)
40
41# Testing targets.
42#
43# We want to ensure that
44# - src/source and opt/source are always distributed.
45# - src/result is always built
46# - opt/result is built conditionally
47#
48# We rely on `distcheck' to run `check-local' and use
49# `sanity1' and `sanity2' as evidences that test-build was run.
50
51if COND_OPT
52test-build: all
53 test -f src/result
54 test -f opt/result
55 : > $(top_builddir)/../../sanity2
56else
57test-build: all
58 test -f src/result
59 test ! -f opt/result
60 : > $(top_builddir)/../../sanity1
61endif
62
63test-dist: distdir
64 test -f $(distdir)/src/source
65 test -f $(distdir)/opt/source
66
67check-local: test-build test-dist
68END
69
70mkdir src opt
71: > src/source
72: > opt/source
73
74cat >src/Makefile.am << 'END'
75EXTRA_DIST = source
76all-local: result
77CLEANFILES = result
78
79result: source
80 cp $(srcdir)/source result
81END
82
83# We want in opt/ the same Makefile as in src/. Let's exercise `include'.
84cat >opt/Makefile.am << 'END'
85include ../src/Makefile.am
86END
87
88$ACLOCAL
89$AUTOCONF
90$AUTOMAKE --add-missing
91./configure
92$MAKE distcheck
93test -f sanity1
94DISTCHECK_CONFIGURE_FLAGS=want_opt=yes $MAKE distcheck
95test -f sanity2
Note: See TracBrowser for help on using the repository browser.