automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 5/5] objc++: add first tests


From: Peter Breitenlohner
Subject: Re: [PATCH 5/5] objc++: add first tests
Date: Fri, 27 Apr 2012 12:00:35 +0200 (CEST)
User-agent: Alpine 2.00 (LNX 1167 2008-08-23)

On Fri, 27 Apr 2012, Stefano Lattarini wrote:

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
AC_PROG_OBJCXX is undefined (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.

According to my info (from 2009) and the Autoconf-2.68 NEWS it is < 2.65. How to do such a test when Automake already requires 2.68.

+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.

No problem.

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.

I'll try, but that might go beyong my knowledge of ObjC/ObjC++.

I am doing all this for the TeX Live build system that contains two programs
where the Mac OS X versions use .m and .mm files.  Until now the .mm file
is invoked via a C++ wrapper and put into a separate library libxetexmm.a
compiled with libxetexmm_a_CXXFLAGS=-ObjC++ -- what a kludge.

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.

Should be simple enough with main() in playobjcxx.mm [or the (Obj)C(++)
functions invoked indirectly via C functions in the respective (Obj)C(++)
files], as long as you don't require that the program actually runs and does
anything useful.

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.

I think part of that could be done by extending existing tests (ext2.sh,
specflg-dummy.sh, and/or specflg2.sh), the rest by new tests inspired by
those.  Will have a look.

Regards
Peter Breitenlohner <address@hidden>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]