Re: [PATCH 1/5] objc++: initial support for Objective C++

2012-04-30 Thread Stefano Lattarini
On 04/30/2012 01:11 PM, Peter Breitenlohner wrote:
> On Mon, 30 Apr 2012, Stefano Lattarini wrote:
> 
>> Unfortunately, this patch breaks automake with older autoconfs (e.g., 2.62),
>> even when the  Objective C++ is not used.  For example:
>>  ...
>> This is due to the unconditional use of 'AC_PROG_OBJCXX' in 
>> AM_INIT_AUTOMAKE.  I've
>> squashed in the diff below, that solves the issue.
> 
> Hi Stefano,
> 
> Oops.  Initially in 2009 the idea was to require Autoconf 2.65,
>
I think bumping the required autoconf version to 2.65 will be ok for the
next major Automake release (1.13), but not for a maintenance release like
Automake 1.12.1.

> but with this workaround there is no need to do that.  You should,
> however, add this to the list of things to clean up once Automake
> requires Autoconf >= 2.65 (assuming there is such a list).
>
On the todo list for master then.

Thanks,
  Stefano



Re: [PATCH 1/5] objc++: initial support for Objective C++

2012-04-30 Thread Peter Breitenlohner

On Mon, 30 Apr 2012, Stefano Lattarini wrote:


Unfortunately, this patch breaks automake with older autoconfs (e.g., 2.62),
even when the  Objective C++ is not used.  For example:
 ...
This is due to the unconditional use of 'AC_PROG_OBJCXX' in AM_INIT_AUTOMAKE.  
I've
squashed in the diff below, that solves the issue.


Hi Stefano,

Oops.  Initially in 2009 the idea was to require Autoconf 2.65, but with
this workaround there is no need to do that.  You should, however, add this
to the list of things to clean up once Automake requires Autoconf >= 2.65
(assuming there is such a list).

Regards
Peter



Re: [PATCH 1/5] objc++: initial support for Objective C++

2012-04-30 Thread Stefano Lattarini
Hi Peter, sorry for the delay.

On 04/27/2012 10:19 AM, Stefano Lattarini wrote:
> From: Peter Breitenlohner 
> 
> Original thread (dating back to almost three years ago):
> 
> 
> * automake.in: Register new language 'objcxx'.
> (lang_objcxx_rewrite): New subroutine.
> (resolve_linker): Add OBJCXXLINK.
> (%_am_macro_for_cond): Add am__fastdepOBJCXX and AC_PROG_OBJCXX.
> (%_ac_macro_for_var): Add OBJCXX and OBJCXXFLAGS.
> * m4/depend.m4 (_AM_DEPENDENCIES): Add OBJCXX.
> * m4/init.m4 (AM_INIT_AUTOMAKE): Add AC_PROG_OBJCXX hook.
> 
Unfortunately, this patch breaks automake with older autoconfs (e.g., 2.62),
even when the  Objective C++ is not used.  For example:

  $ cat t/whoami.sh
  #! /bin/sh
  # Copyright (C) 1998-2012 Free Software Foundation, Inc.
  # ...
  . ./defs || Exit 1
  cat >> configure.ac << 'END'
  WHO_AM_I=17
  END
  $ACLOCAL

  $ PATH=/opt/extra/autoconf-2.62/bin:$PATH t/whoami.sh
  whoami: exec /bin/sh t/whoami.sh
  Running from installcheck: no
  Using TAP: no
  PATH = ...
  ++ pwd
  /home/stefano/src/am/branches/objc++-support/t/whoami.dir
  + cat
  + aclocal-1.12a -Werror
  configure.ac:2: error: defn: undefined macro: AC_PROG_OBJCXX
  /home/stefano/src/am/branches/objc++-support/m4/options.m4:31: _AM_IF_OPTION 
is expanded from...
  /home/stefano/src/am/branches/objc++-support/m4/init.m4:25: AM_INIT_AUTOMAKE 
is expanded from...
  configure.ac:2: the top level
  autom4te: /usr/bin/m4 failed with exit status: 1
  aclocal: error: autom4te failed with exit status: 1
  + exit_status=1
  + set +e
  + cd /home/stefano/src/am/branches/objc++-support
  + test no = yes
  + case $am_explicit_skips in
  + test 1 -eq 0
  + keep_testdirs=yes
  + am_keeping_testdirs
  + case $keep_testdirs in
  + return 0
  + set +x
  whoami: exit 1

This is due to the unconditional use of 'AC_PROG_OBJCXX' in AM_INIT_AUTOMAKE.  
I've
squashed in the diff below, that solves the issue.

Regards,
  Stefano

-*-*-

diff --git a/m4/init.m4 b/m4/init.m4
index dd4ac67..07ed584 100644
--- a/m4/init.m4
+++ b/m4/init.m4
@@ -100,10 +100,13 @@ AC_PROVIDE_IFELSE([AC_PROG_OBJC],
  [_AM_DEPENDENCIES([OBJC])],
  [define([AC_PROG_OBJC],
  defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
-AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
+dnl Support for Objective C++ was only introduced in Autoconf 2.65,
+dnl but we still cater to Autoconf 2.62.
+m4_ifdef([AC_PROG_OBJCXX],
+[AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
  [_AM_DEPENDENCIES([OBJCXX])],
  [define([AC_PROG_OBJCXX],
- 
defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
+ 
defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])])dnl
 ])
 _AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
 dnl The 'parallel-tests' driver may need to know about EXEEXT, so add the



[PATCH 1/5] objc++: initial support for Objective C++

2012-04-27 Thread Stefano Lattarini
From: Peter Breitenlohner 

Original thread (dating back to almost three years ago):


* automake.in: Register new language 'objcxx'.
(lang_objcxx_rewrite): New subroutine.
(resolve_linker): Add OBJCXXLINK.
(%_am_macro_for_cond): Add am__fastdepOBJCXX and AC_PROG_OBJCXX.
(%_ac_macro_for_var): Add OBJCXX and OBJCXXFLAGS.
* m4/depend.m4 (_AM_DEPENDENCIES): Add OBJCXX.
* m4/init.m4 (AM_INIT_AUTOMAKE): Add AC_PROG_OBJCXX hook.

Signed-off-by: Peter Breitenlohner 
Signed-off-by: Stefano Lattarini 
---
 automake.in  |   29 +++--
 lib/Automake/Variable.pm |2 ++
 m4/depend.m4 |5 +++--
 m4/init.m4   |6 +-
 4 files changed, 37 insertions(+), 5 deletions(-)

diff --git a/automake.in b/automake.in
index 43a7ba6..c8c5b01 100644
--- a/automake.in
+++ b/automake.in
@@ -760,6 +760,24 @@ register_language ('name' => 'objc',
   'pure' => 1,
   'extensions' => ['.m']);
 
+# Objective C++.
+register_language ('name' => 'objcxx',
+  'Name' => 'Objective C++',
+  'config_vars' => ['OBJCXX'],
+  'linker' => 'OBJCXXLINK',
+  'link' => '$(OBJCXXLD) $(AM_OBJCXXFLAGS) $(OBJCXXFLAGS) 
$(AM_LDFLAGS) $(LDFLAGS) -o $@',
+  'autodep' => 'OBJCXX',
+  'flags' => ['OBJCXXFLAGS', 'CPPFLAGS'],
+  'compile' => '$(OBJCXX) $(DEFS) $(DEFAULT_INCLUDES) 
$(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCXXFLAGS) $(OBJCXXFLAGS)',
+  'ccer' => 'OBJCXX',
+  'compiler' => 'OBJCXXCOMPILE',
+  'compile_flag' => '-c',
+  'output_flag' => '-o',
+  'lder' => 'OBJCXXLD',
+  'ld' => '$(OBJCXX)',
+  'pure' => 1,
+  'extensions' => ['.mm']);
+
 # Unified Parallel C.
 register_language ('name' => 'upc',
   'Name' => 'Unified Parallel C',
@@ -5793,6 +5811,12 @@ sub lang_objc_rewrite
 return &lang_sub_obj;
 }
 
+# Rewrite a single Objective C++ file.
+sub lang_objcxx_rewrite
+{
+return &lang_sub_obj;
+}
+
 # Rewrite a single Unified Parallel C file.
 sub lang_upc_rewrite
 {
@@ -6057,7 +6081,7 @@ sub resolve_linker
 {
 my (%linkers) = @_;
 
-foreach my $l (qw(GCJLINK CXXLINK F77LINK FCLINK OBJCLINK UPCLINK))
+foreach my $l (qw(GCJLINK OBJCXXLINK CXXLINK F77LINK FCLINK OBJCLINK 
UPCLINK))
 {
return $l if defined $linkers{$l};
 }
@@ -6245,13 +6269,14 @@ sub make_conditional_string ($$)
 my %_am_macro_for_cond =
   (
   AMDEP => "one of the compiler tests\n"
-  . "AC_PROG_CC, AC_PROG_CXX, AC_PROG_CXX, AC_PROG_OBJC,\n"
+  . "AC_PROG_CC, AC_PROG_CXX, AC_PROG_OBJC, AC_PROG_OBJCXX,\n"
   . "AM_PROG_AS, AM_PROG_GCJ, AM_PROG_UPC",
   am__fastdepCC => 'AC_PROG_CC',
   am__fastdepCCAS => 'AM_PROG_AS',
   am__fastdepCXX => 'AC_PROG_CXX',
   am__fastdepGCJ => 'AM_PROG_GCJ',
   am__fastdepOBJC => 'AC_PROG_OBJC',
+  am__fastdepOBJCXX => 'AC_PROG_OBJCXX',
   am__fastdepUPC => 'AM_PROG_UPC'
   );
 
diff --git a/lib/Automake/Variable.pm b/lib/Automake/Variable.pm
index 4d346f0..d4d230f 100644
--- a/lib/Automake/Variable.pm
+++ b/lib/Automake/Variable.pm
@@ -185,6 +185,8 @@ my %_ac_macro_for_var =
FCFLAGS => 'AC_PROG_FC',
OBJC => 'AC_PROG_OBJC',
OBJCFLAGS => 'AC_PROG_OBJC',
+   OBJCXX => 'AC_PROG_OBJCXX',
+   OBJCXXFLAGS => 'AC_PROG_OBJCXX',
RANLIB => 'AC_PROG_RANLIB',
UPC => 'AM_PROG_UPC',
UPCFLAGS => 'AM_PROG_UPC',
diff --git a/m4/depend.m4 b/m4/depend.m4
index 8d7adf6..cee3199 100644
--- a/m4/depend.m4
+++ b/m4/depend.m4
@@ -5,7 +5,7 @@
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 16
+# serial 17
 
 # There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
 # written in clear, in which case automake, when reading aclocal.m4,
@@ -17,7 +17,7 @@
 # _AM_DEPENDENCIES(NAME)
 # --
 # See how the compiler implements dependency checking.
-# NAME is "CC", "CXX", "GCJ", or "OBJC".
+# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
 # We try a few techniques and use that to set a single cache variable.
 #
 # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
@@ -33,6 +33,7 @@ AC_REQUIRE([AM_DEP_TRACK])dnl
 m4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
   [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
   [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
+  [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
   [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
   [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
 [depcc="$$1"   am_compiler_list=])
diff --git a/m4/init.m4 b/m4/init.m4
index 6a69244..dd4ac67 100644
--- a/m4/init.m4
+++ b/m4/ini