After looking at the automake source I realised that object files are
generated in sub directories for C, so here is a patch to enable it
for C++.

Assuming its desirable to add this functionality, is paperwork needed?

Cheers,
Alex.

These diffs are against CVS, generated using cvs -q diff -c

Index: ChangeLog
===================================================================
RCS file: /cvs/automake/automake/ChangeLog,v
retrieving revision 1.862
diff -c -r1.862 ChangeLog
*** ChangeLog   2000/04/05 21:12:43     1.862
--- ChangeLog   2000/04/11 13:02:34
***************
*** 1,3 ****
--- 1,11 ----
+ 2000-04-11  Alex Hornby <[EMAIL PROTECTED]>
+ 
+       * m4/minuso.m4 (AM_PROG_CXX_C_O): new function
+ 
+       * automake.in (seen_cxx_c_o): new global
+       (lang_cxx_rewrite): added subdir source support
+       (scan_one_configure_file): likewise
+       
  2000-04-05  Tom Tromey  <[EMAIL PROTECTED]>
  
        * header-vars.am (DESTDIR): Commented out definition.
Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.782
diff -c -r1.782 automake.in
*** automake.in 2000/04/05 20:55:48     1.782
--- automake.in 2000/04/11 13:02:41
***************
*** 222,227 ****
--- 222,230 ----
  # TRUE if we've seen AM_PROG_CC_C_O
  $seen_cc_c_o = 0;
  
+ # TRUE if we've seen AM_PROG_CXX_C_O
+ $seen_cxx_c_o = 0;
+ 
  # TRUE if we've seen AM_INIT_AUTOMAKE.
  $seen_init_automake = 0;
  
***************
*** 4482,4487 ****
--- 4485,4491 ----
  
        # Check for `-c -o' code.
        $seen_cc_c_o = 1 if /AM_PROG_CC_C_O/;
+       $seen_cxx_c_o = 1 if /AM_PROG_CXX_C_O/;
  
        # Check for NLS support.
        if (/AM_GNU_GETTEXT/)
***************
*** 4824,4830 ****
  # Rewrite a single C++ source file.
  sub lang_cxx_rewrite
  {
!     return &lang_sub_obj;
  }
  
  # Rewrite a single header file.
--- 4828,4854 ----
  # Rewrite a single C++ source file.
  sub lang_cxx_rewrite
  {
!     local ($directory, $base, $ext) = @_;
!   
!     local ($r) = $LANG_PROCESS;
!     if (defined $options{'subdir-objects'})
!     {
!       $r = $LANG_SUBDIR;
!       $base = $directory . '/' . $base;
! 
!       if (! $seen_cxx_c_o)
!       {
!           # Only give error once.
!           $seen_cxx_c_o = 1;
!           # FIXME: line number.
!           &am_error ("C++ objects in subdir but \`AM_PROG_CXX_C_O' not in 
\`configure.in'");
!       }
! 
!       &require_file ($FOREIGN, 'compile')
!           if $relative_dir eq '.';
!     }
! 
!     return $r;
  }
  
  # Rewrite a single header file.
Index: m4/minuso.m4
===================================================================
RCS file: /cvs/automake/automake/m4/minuso.m4,v
retrieving revision 1.1
diff -c -r1.1 minuso.m4
*** minuso.m4   1999/04/11 13:02:43     1.1
--- minuso.m4   2000/04/11 13:02:41
***************
*** 13,15 ****
--- 13,31 ----
     CC="\$(top_srcdir)/compile $CC"
  fi
  ])
+ 
+ dnl Like AM_PROG_CC_C_O, but  for C++
+ 
+ AC_DEFUN([AM_PROG_CXX_C_O],[
+ AC_REQUIRE([AC_PROG_CC_C_O])
+ dnl FIXME: we rely on the C cache variable name because
+ dnl there is no other way.
+ set dummy $CC; ac_cc="`echo [$]2 |
+ changequote(, )dnl
+                      sed -e 's/[^a-zA-Z0-9_]/_/g' -e 's/^[0-9]/_/'`"
+ changequote([, ])dnl
+ if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" != yes"; then
+    # Losing compiler, so override with the script.
+    CXX="\$(top_srcdir)/compile $CXX"
+ fi
+ ])

Reply via email to