1
1
openmpi/config/ompi_check_bool_struct_copy.m4
Jeff Squyres f0932a0701 A workaround for a bug in the PGI 6.2 compiler series. This bug has
been fixed in the 7.0 PGI series, but is unlikely to be fixed in the
6.2 series:

 * Add a configure test looking for the bad behavior (the PGI compiler
   chokes on C code where structs containing bool's are copied by
   value)
 * Set OMPI_BOOL_STRUCT_COPY to 1 if it's ok, 0 if it's not (i.e., PGI
   6.2 series will have this value set to 0)
 * In two places in the code base -- orte-clean and btl_openib_ini.h,
   we have a struct that contains a bool that is copied by value.  In
   these two places, check OMPI_BOOL_STRUCT_COPY and if it's 1, use
   the "int" type instead of "bool".

Fixes trac:739

This commit was SVN r13076.

The following Trac tickets were found above:
  Ticket 739 --> https://svn.open-mpi.org/trac/ompi/ticket/739
2007-01-11 02:21:26 +00:00

52 строки
1.8 KiB
Bash

dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
dnl University Research and Technology
dnl Corporation. All rights reserved.
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
dnl of Tennessee Research Foundation. All rights
dnl reserved.
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
AC_DEFUN([OMPI_CHECK_BOOL_STRUCT_COPY],[
dnl
dnl Portland PGI 6.2.x will choke when compiling a C code that copies
dnl a struct by value that contains bool members. This bug was fixed in
dnl PGI 7.0.
dnl
AC_MSG_CHECKING([whether structs containing bools can be copied by value])
AC_TRY_COMPILE([
/* If we do not have bool, just provide some test that will trivially
compile (because OMPI will set its own type for bool later) */
#if !defined(SIZEOF_BOOL)
int foo(void) { return 1; }
#else
#if OMPI_USE_STDBOOL_H
#include <stdbool.h>
#endif
struct bar_t {
bool a;
};
void foo(void) {
struct bar_t c, d;
c = d; /* this is where the error occurs */
}
#endif
],[],[ompi_ac_sbc=1 ompi_ac_sbc_msg=yes],[ompi_ac_sbc=0 ompi_ac_sbc_msg=no])
AC_DEFINE_UNQUOTED([OPAL_BOOL_STRUCT_COPY], [$ompi_ac_sbc],
[Whether the compiler supports copying structs by value that contain bool members (PGI 6.2.x had a bug such that this would choke the compiler)])
AC_MSG_RESULT([$ompi_ac_sbc_msg])])dnl