On 04/27/2012 10:19 AM, Stefano Lattarini wrote: > From: Peter Breitenlohner <p...@mppmu.mpg.de> > > * t/objcxx-basic.test: New test. > * t/objcxx-demo.test: Likewise. > * t/list-of-tests.mk: Add them. > > Signed-off-by: Peter Breitenlohner <p...@mppmu.mpg.de> > Signed-off-by: Stefano Lattarini <stefano.lattar...@gmail.com> > --- > t/list-of-tests.mk | 2 ++ > t/objcxx-basic.sh | 37 +++++++++++++++++++++++++++++++ > t/objcxx-demo.sh | 61 > ++++++++++++++++++++++++++++++++++++++++++++++++++++ > 3 files changed, 100 insertions(+) > create mode 100755 t/objcxx-basic.sh > create mode 100755 t/objcxx-demo.sh
> diff --git a/t/objcxx-basic.sh b/t/objcxx-basic.sh > new file mode 100755 > index 0000000..ae0f969 > --- /dev/null > +++ b/t/objcxx-basic.sh > @@ -0,0 +1,37 @@ > +#! /bin/sh > +# Copyright (C) 2009 Free Software Foundation, Inc. > Oops. I forgot to update the copyright year. Consider this fixed. The rest of this test case seems OK. > diff --git a/t/objcxx-demo.sh b/t/objcxx-demo.sh > new file mode 100755 > index 0000000..7af089f > --- /dev/null > +++ b/t/objcxx-demo.sh > @@ -0,0 +1,61 @@ > +#! /bin/sh > > +# Demo package using Objective C++ and doing distcheck. > + > +required='cc c++' > +. ./defs || Exit 1 > + > +cat >> configure.ac << 'END' > +AC_PROG_CC > +AC_PROG_CXX > +AC_PROG_OBJC > +AC_PROG_OBJCXX > Here, we should ensure the test is skipped if any of AC_PROG_OBJC or is undefined AC_PROG_OBJCXX (because the autoconf version being used is too old, i.e., < 2.66 if I'm not mistaken). That can be done in a follow-up patch though. > +AC_CONFIG_HEADERS([config.h]) > +AC_OUTPUT > +END > + > +cat > Makefile.am << 'END' > +bin_PROGRAMS = play > +play_SOURCES = play.c playxx.cxx playobjc.m playobjcxx.mm > > +END > + > +cat > play.c << 'END' > +#include <config.h> > +#include <stdio.h> > +int main (void) > +{ > + printf("Hello, world! (" PACKAGE_STRING ")\n"); > + return 0; > +} > +END > + > +echo '//' >> playxx.cxx > + > +echo '/* */' >> playobjc.m > + > +echo '//' >> playobjcxx.mm > + Rather than having dummy files, I'd like to have files with real content here, to ensure better similarity with real-world usage. Extra points if you can make the content of the '.m' file valid only as ObjC (not as ObjC++, C, nor C++) and the content of the '.mm' file valid only as ObjC++ (not as ObjC C, nor C++), to ensure the correct compiler is being used based on the file extension. Even more kudos if you can make the all the functions defined in all of 'playxx.cxx', 'playobjc.m' and 'playobjcxx.mm' actually invoked by the 'main()' function. > +$ACLOCAL > +$AUTOCONF > +$AUTOHEADER > +$AUTOMAKE --add-missing > + > +./configure > +$MAKE > +$MAKE distcheck > + > +: Also, for a better coverage, I'd like to have two more tests (in new files): - one that tests automatic dependency tracking for '.mm' files (t/objcxx-deps.sh) - one that checks the use of global compile flags '$(AM_OBJCXXFLAGS)', per-taget compile flags '$(foo_OBJCXXFLAGS)', that the latter takes precedence on the former, and that user-specified compile flags '$(OBJCXXFLAGS)' take precedence over both (objcxx-flags.sh) Similar tests should also be added for the Objective C case; but that's material for a follow-up patch. Thanks, Stefano