On Tue, 15 Sep 2009, Ralf Wildenhues wrote:

The other thing I'd like to see either in this patch or in a followup
one is your play-1.1 test rewritten as an Automake testsuite addition,
so that we have one full build test (including distcheck).  (I can do
that if you don't want to.)

Hi Ralf,

attached is a patch adding a new test (objcxx3) doing just that, but you
might want to change that name.  If OBJCXX doesn't work, configure exits
with 77 such that the test is skipped.  It is assumed that a working OBJCXX
implies that OBJC and CXX work as well.

(I think a similar note applies to the configure.ac part of play-1.0 and
the Autoconf testsuite.  If you have any issues with this, or don't want
to do the work, ping me and I'll look into it.)

That would be considerably more difficult for me, because I don't understand
at all how the Autoconf testsuite works.  If you want to do that, please go
ahead.

Regards
Peter Breitenlohner <p...@mppmu.mpg.de>
From 5998a1ac168c99447013301ede8ebb1138a56ef0 Mon Sep 17 00:00:00 2001
From: Peter Breitenlohner <p...@mppmu.mpg.de>
Date: Wed, 25 Nov 2009 10:29:10 +0100
Subject: [PATCH 3/3] A complete demo package using ObjC++ and distcheck

* tests/objcxx3.test: New test.
* tests/Makefile.am: Adjust.

Signed-off-by: Peter Breitenlohner <p...@mppmu.mpg.de>
---
 tests/Makefile.am  |    1 +
 tests/objcxx3.test |   82 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 83 insertions(+), 0 deletions(-)
 create mode 100755 tests/objcxx3.test

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 49708c8..0a4691a 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -487,6 +487,7 @@ objc.test \
 objc2.test \
 objcxx.test \
 objcxx2.test \
+objcxx3.test \
 obsolete.test \
 order.test \
 outdir.test \
diff --git a/tests/objcxx3.test b/tests/objcxx3.test
new file mode 100755
index 0000000..4807e59
--- /dev/null
+++ b/tests/objcxx3.test
@@ -0,0 +1,82 @@
+#! /bin/sh
+# Copyright (C) 2009  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/>.
+
+# Demo package using Objective C++ and doing distcheck.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >configure.in <<'END'
+AC_INIT([play], [1.1], [...@mppmu.mpg.de])
+AC_PREREQ([2.65])
+AC_CONFIG_SRCDIR([play.c])
+AM_INIT_AUTOMAKE([foreign])
+AC_PROG_CC
+AC_PROG_CXX
+AC_PROG_OBJC
+AC_LANG_PUSH([Objective C++])
+AC_CACHE_CHECK([Objective C++ preprocessor],
+               [my_cv_preproc],
+               [AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[#import <objc/Object.h>]],
+                                                   [[[Object class]]])],
+                                  [my_cv_preproc=PASS],
+                                  [my_cv_preproc=FAIL])])
+AC_CACHE_CHECK([Objective C++ compiler],
+               [my_cv_compile],
+               [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>]],
+                                                [[extern void foo(int 
i,...);]])],
+                               [my_cv_compile=PASS],
+                               [my_cv_compile=FAIL])])
+AC_LANG_POP([Objective C++])
+if test "x$my_cv_preproc:$my_cv_compile" != xPASS:PASS; then
+  AC_MSG_ERROR([Objective C++ compilation failed], 77)
+fi
+AC_CONFIG_HEADERS([config.h])
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+END
+
+cat >Makefile.am <<'END'
+bin_PROGRAMS = play
+play_SOURCES = play.c playxx.cxx playobjc.m playobjcxx.mm
+TESTS = play
+END
+
+cat >play.c <<'END'
+#include <config.h>
+#include <stdio.h>
+int main()
+{
+  printf("Hello, world! (" PACKAGE_STRING ")\n");
+  return 0;
+}
+END
+
+echo '//' >>playxx.cxx
+
+echo '/* */' >>playobjc.m
+
+echo '//' >>playobjcxx.mm
+
+$ACLOCAL
+$AUTOCONF
+$AUTOHEADER
+$AUTOMAKE --add-missing
+
+./configure
+$MAKE
+$MAKE distcheck
-- 
1.6.4

Reply via email to