From 5998a1ac168c99447013301ede8ebb1138a56ef0 Mon Sep 17 00:00:00 2001 From: Peter Breitenlohner 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 --- 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 . + +# Demo package using Objective C++ and doing distcheck. + +. ./defs || Exit 1 + +set -e + +cat >configure.in <<'END' +AC_INIT([play], [1.1], address@hidden) +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 ]], + [[[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 ]], + [[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 +#include +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