Index: configure.ac
===================================================================
--- configure.ac	(revision 17505)
+++ configure.ac	(working copy)
@@ -1209,6 +1209,27 @@
 ompi_show_subtitle "Wrapper compiler flags"
 OMPI_SETUP_WRAPPER_FINAL

+# Recreate some defines prefixed with OMPI_ so that there are no bare
+# autoconf macro defines in mpi.h.  Since AC sometimes changes whether
+# things are defined as null tokens or an integer result, two projects
+# with different versions of AC can cause problems.
+if test $ac_cv_header_stdc = yes; then
+  AC_DEFINE(OMPI_STDC_HEADERS, 1,
+	    [Do not use outside of mpi.h.  Define to 1 if you have the ANSI C header files.])
+fi
+if test $ac_cv_header_sys_time_h = yes ; then
+  AC_DEFINE(OMPI_HAVE_SYS_TIME_H, 1,
+	    [Do not use outside of mpi.h.  Define to 1 if you have the <sys/time.h> header file.])
+fi
+if test $ac_cv_type_long_long = yes ; then
+  AC_DEFINE(OMPI_HAVE_LONG_LONG, 1,
+	    [Do not use outside of mpi.h.  Define to 1 if the system has the type `long long'.]) dnl `
+fi
+AC_DEFINE_UNQUOTED(OMPI_SIZEOF_BOOL, $ac_cv_sizeof_bool,
+          [Do not use outside of mpi.h.  The size of a `bool', as computed by sizeof.]) dnl `
+AC_DEFINE_UNQUOTED(OMPI_SIZEOF_INT, $ac_cv_sizeof_int,
+          [Do not use outside of mpi.h.  The size of a `int', as computed by sizeof.]) dnl `
+
 ############################################################################
 # Party on
 ############################################################################
Index: ompi/include/mpi.h.in
===================================================================
--- ompi/include/mpi.h.in	(revision 17505)
+++ ompi/include/mpi.h.in	(working copy)
@@ -33,6 +33,21 @@
    ompi_config.h must be included before all other files, so this
    should be good enough */

+/* Define to 1 if you have the ANSI C header files. */
+#undef OMPI_STDC_HEADERS
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#undef OMPI_HAVE_SYS_TIME_H
+
+/* Define to 1 if the system has the type `long long'. */
+#undef OMPI_HAVE_LONG_LONG
+
+/* The size of a `bool', as computed by sizeof. */
+#undef OMPI_SIZEOF_BOOL
+
+/* The size of a `int', as computed by sizeof. */
+#undef OMPI_SIZEOF_INT
+
 /* Whether we have FORTRAN LOGICAL*1 or not */
 #undef OMPI_HAVE_FORTRAN_LOGICAL1

@@ -72,18 +87,6 @@
 /* Whether we have FORTRAN REAL*8 or not */
 #undef OMPI_HAVE_FORTRAN_REAL8

-/* Define to 1 if you have the <sys/time.h> header file. */
-#undef HAVE_SYS_TIME_H
-
-/* Define to 1 if the system has the type `long long'. */
-#undef HAVE_LONG_LONG
-
-/* The size of a `bool', as computed by sizeof. */
-#undef SIZEOF_BOOL
-
-/* The size of a `int', as computed by sizeof. */
-#undef SIZEOF_INT
-
 /* Type of MPI_Offset -- has to be defined here and typedef'ed later because mpi.h does not get AC SUBST's */
 #undef OMPI_MPI_OFFSET_TYPE

@@ -111,9 +114,6 @@
 /* MPI datatype corresponding to MPI_Offset */
 #undef OMPI_OFFSET_DATATYPE

-/* Define to 1 if you have the ANSI C header files. */
-#undef STDC_HEADERS
-
 /* Major, minor, and release version of Open MPI */
 #undef OMPI_MAJOR_VERSION
 #undef OMPI_MINOR_VERSION
@@ -158,7 +158,7 @@
 /* @OMPI_END_CONFIGURE_SECTION@ */

 /* include for ptrdiff_t */
-#ifdef STDC_HEADERS
+#ifdef OMPI_STDC_HEADERS
 #include <stddef.h>
 #endif

@@ -748,11 +748,11 @@
 #define MPI_UB (&ompi_mpi_ub)
 #define MPI_LB (&ompi_mpi_lb)
 #define MPI_WCHAR (&ompi_mpi_wchar)
-#if HAVE_LONG_LONG
+#if OMPI_HAVE_LONG_LONG
 #define MPI_LONG_LONG_INT (&ompi_mpi_long_long_int)
 #define MPI_LONG_LONG (&ompi_mpi_long_long_int)
 #define MPI_UNSIGNED_LONG_LONG (&ompi_mpi_unsigned_long_long)
-#endif  /* HAVE_LONG_LONG */
+#endif  /* OMPI_HAVE_LONG_LONG */
 #define MPI_2COMPLEX (&ompi_mpi_2cplex)
 #define MPI_2DOUBLE_COMPLEX (&ompi_mpi_2dblcplex)

Index: ompi/mpi/cxx/comm_inln.h
===================================================================
--- ompi/mpi/cxx/comm_inln.h	(revision 17505)
+++ ompi/mpi/cxx/comm_inln.h	(working copy)
@@ -648,7 +648,7 @@
 			 void* extra_state, void* attribute_val_in,
 			 void* attribute_val_out, bool& flag)
 {
-#if SIZEOF_BOOL != SIZEOF_INT
+#if OMPI_SIZEOF_BOOL != OMPI_SIZEOF_INT
   int f = (int)flag;
   int ret;
   ret = MPI_DUP_FN(oldcomm, comm_keyval, extra_state, attribute_val_in,
