automake-patches
[Top][All Lists]
Advanced

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

[PATCH 01/10] objc++: initial support for Objective C++


From: Stefano Lattarini
Subject: [PATCH 01/10] objc++: initial support for Objective C++
Date: Tue, 1 May 2012 15:52:19 +0200

From: Peter Breitenlohner <address@hidden>

Original thread (dating back to almost three years ago):
<http://lists.gnu.org/archive/html/automake-patches/2009-07/msg00016.html>

* 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 <address@hidden>
Signed-off-by: Stefano Lattarini <address@hidden>
---
 automake.in              |   29 +++++++++++++++++++++++++++--
 lib/Automake/Variable.pm |    2 ++
 m4/depend.m4             |    5 +++--
 m4/init.m4               |    9 ++++++++-
 4 files changed, 40 insertions(+), 5 deletions(-)

diff --git a/automake.in b/automake.in
index a993451..3760ab5 100644
--- a/automake.in
+++ b/automake.in
@@ -759,6 +759,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',
@@ -5801,6 +5819,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
 {
@@ -6065,7 +6089,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};
     }
@@ -6253,13 +6277,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 3520dcb..0cf8720 100644
--- a/m4/init.m4
+++ b/m4/init.m4
@@ -6,7 +6,7 @@
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 18
+# serial 19
 
 # This macro actually does too much.  Some checks are only needed if
 # your package does certain things.  But this isn't really a big deal.
@@ -100,6 +100,13 @@ AC_PROVIDE_IFELSE([AC_PROG_OBJC],
                  [_AM_DEPENDENCIES([OBJC])],
                  [define([AC_PROG_OBJC],
                          defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
+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
 ])
 _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
-- 
1.7.9.5




reply via email to

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