From 7d03300a766b9cfcc4922601d391893bf12c947b Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Tue, 26 Feb 2008 01:45:32 +0000 Subject: [PATCH] Based on a patch from Brian about how to remove "naked" AC defined macros in mpi.h. (e.g., HAVE_LONG_LONG); instead, prefix _all_ macros with "OMPI_". This commit was SVN r17591. --- configure.ac | 21 +++++++++++++++++++++ ompi/include/mpi.h.in | 38 +++++++++++++++++++------------------- ompi/mpi/cxx/comm_inln.h | 2 +- 3 files changed, 41 insertions(+), 20 deletions(-) diff --git a/configure.ac b/configure.ac index 605d4e4ded..ae5a39db1c 100644 --- a/configure.ac +++ b/configure.ac @@ -1209,6 +1209,27 @@ AC_SUBST([AMCA_PARAM_SETS_DIR], ['$(pkgdatadir)/amca-param-sets']) 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 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 ############################################################################ diff --git a/ompi/include/mpi.h.in b/ompi/include/mpi.h.in index 932c50457b..336f03f012 100644 --- a/ompi/include/mpi.h.in +++ b/ompi/include/mpi.h.in @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2007 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2007-2008 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -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 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 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 #endif @@ -748,11 +748,11 @@ OMPI_DECLSPEC extern MPI_Fint *MPI_F_STATUSES_IGNORE; #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) diff --git a/ompi/mpi/cxx/comm_inln.h b/ompi/mpi/cxx/comm_inln.h index 618a344d8c..b18f002a9d 100644 --- a/ompi/mpi/cxx/comm_inln.h +++ b/ompi/mpi/cxx/comm_inln.h @@ -648,7 +648,7 @@ MPI::Comm::DUP_FN(const MPI::Comm& oldcomm, int comm_keyval, 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,