On Thu, 21 Feb 2008, Jeff Squyres wrote:
While I agree that having AC actually define them to a value is a Good Thing (better than just defining it to be empty), I do see the pickle that it has put us in. :-\ I don't see an obvious solution.
I do :). Try the attached patch. It sneaks in at the last minute and defines (for example) both SIZEOF_BOOL and OMPI_SIZEOF_BOOL. mpi.h only has the define for OMPI_SIZEOF_BOOL. opal_config.h has both, but a note saying not to use the OMPI_ version. Seems to work.
Brian
Index: configure.ac =================================================================== --- configure.ac (revision 17548) +++ configure.ac (working copy) @@ -73,6 +73,29 @@ OMPI_SAVE_VERSION([OPAL], [Open Portable Access Layer], [$srcdir/VERSION], [opal/include/opal/version.h]) + +# 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 ` + + AM_CONFIG_HEADER([opal/include/opal_config.h orte/include/orte_config.h ompi/include/ompi_config.h ompi/include/mpi.h]) # override/fixup the version numbers set by AC_INIT, since on Index: ompi/include/mpi.h.in =================================================================== --- ompi/include/mpi.h.in (revision 17548) +++ 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