news: some changes for 1.13 has been "de-planned"
[automake.git] / t / objcxx-minidemo.sh
blobe4e776789f108a683e01e9884d3d707746019549
1 #! /bin/sh
2 # Copyright (C) 2012 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 <http://www.gnu.org/licenses/>.
17 # Dummy demo package using Objective C++ and doing distcheck.
18 # See also sister test 'objc-minidemo.sh'.
20 required=native
21 . ./defs || exit 1
23 cat >> configure.ac << 'END'
24 dnl Support for Object C++ was introduced only in Autoconf 2.65.
25 AC_PREREQ([2.65])
26 AC_PROG_OBJCXX
27 AC_CONFIG_HEADERS([config.h])
28 AC_OUTPUT
29 END
31 cat > Makefile.am << 'END'
32 AM_DEFAULT_SOURCE_EXT = .mm
33 bin_PROGRAMS = ok
34 noinst_PROGRAMS = ko
35 TESTS = $(bin_PROGRAMS) $(XFAIL_TESTS)
36 XFAIL_TESTS = $(noinst_PROGRAMS)
37 END
39 cat > ok.mm << 'END'
40 /* The use of #import makes this valid Object C++ but invalid C++. */
41 #import <iostream>
42 #import <config.h>
43 int main (void)
45 std::cout << "Success (" << PACKAGE_STRING << ")\n";
46 return 0;
48 END
50 cat > ko.mm << 'END'
51 /* The use of #import makes this valid Object C++ but invalid C++. */
52 #import <cstdio>
53 int main (void)
55 printf("Failure\n");
56 return 1;
58 END
60 if $ACLOCAL; then
61 : We have a modern enough autoconf, go ahead.
62 elif test $? -eq 63; then
63 skip_ "Object C++ support requires Autoconf 2.65 or later"
64 else
65 exit 1 # Some other aclocal failure.
67 $AUTOCONF
68 $AUTOHEADER
69 $AUTOMAKE --add-missing
71 ./configure
72 $MAKE
73 $MAKE check
74 $MAKE distcheck