Subject: [PATCH 2/2] Automatically call AM_PROG_CC_C_O as required.

From: Nick Bowler <[email-masked]>
Date: Sun, 13 Jan 2013 15:01:37 -0500

If subdir-objects is made the default Automake behaviour, packages
will need to add AM_PROG_CC_C_O to their configure.ac.  Instead of
that, let's just make the functionality provided by AM_PROG_CC_C_O
mandatory for C projects, and have Automake automatically call it
as required.

This change should have no effect on packages which explicitly call
AM_PROG_CC_C_O already.

* m4/init.m4: Have AM_INIT_AUTOMAKE arrange for AM_PROG_CC_C_O to be
called if necessary.
---
 m4/init.m4 | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/m4/init.m4 b/m4/init.m4
index 7535706..6c48704 100644
--- a/m4/init.m4
+++ b/m4/init.m4
@@ -109,6 +109,11 @@ AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
 		  [m4_define([AC_PROG_OBJCXX],
 			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
 ])
+dnl Automatically invoke AM_PROG_CC_C_O as necessary.  Since AC_PROG_CC is
+dnl usually called after AM_INIT_AUTOMAKE, we arrange for the test to be
+dnl done later by AC_CONFIG_COMMANDS_PRE.
+AC_CONFIG_COMMANDS_PRE([AC_PROVIDE_IFELSE([AC_PROG_CC],
+  [AC_LANG([C]) AM_PROG_CC_C_O])])dnl
 AC_REQUIRE([AM_SILENT_RULES])dnl
 dnl The testsuite driver may need to know about EXEEXT, so add the
 dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
-- 
1.8.1