summaryrefslogtreecommitdiff
path: root/t/suffix-custom-default-ext.sh
blob: bada8d7c2afd15241f3dd5b7d6b6d879968b0f2e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#! /bin/sh
# Copyright (C) 2002-2012 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

# Interaction between user-defined extensions for files in _SOURCES
# and the use of AM_DEFAULT_SOURCE_EXT.

required=c++
. test-init.sh

cat >> configure.ac <<'END'
AC_PROG_CXX
AC_OUTPUT
END

cat > Makefile.am <<'END'
AM_DEFAULT_SOURCE_EXT = .cc
bin_PROGRAMS = foo bar baz qux
%.cc: %.zoo
	sed 's/INTEGER/int/g' $< >$@
EXTRA_DIST = $(addsuffix .zoo,$(bin_PROGRAMS))
generated_cc_sources = $(addsuffix .cc,$(bin_PROGRAMS))
CLEANFILES = $(generated_cc_sources)
# We don't want the generated C++ files to be distributed, and this
# is the best workaround we've found so far.  Not very clean, but it
# works.
dist-hook:
	rm -f $(addprefix $(distdir)/,$(generated_cc_sources))
END

# This is deliberately valid C++, but invalid C.
cat > foo.zoo <<'END'
using namespace std;
INTEGER main (void)
{
  return 0;
}
END
cp foo.zoo bar.zoo
cp foo.zoo baz.zoo
cp foo.zoo qux.zoo

$ACLOCAL
$AUTOMAKE
$AUTOCONF

./configure

$MAKE all
$MAKE distdir
ls -l $distdir
test ! -f $distdir/foo.cc
test ! -f $distdir/bar.cc
test ! -f $distdir/baz.cc
test ! -f $distdir/qux.cc
$MAKE distcheck

: