1
1

Add a check for LOCK_SHARED in the sys/synch.h file. If it exists then smash it to avoid problems with preprocessor and C++.

This fixes trac:1477.

Help provided by Jeff and Terry.

This commit was SVN r19533.

The following Trac tickets were found above:
  Ticket 1477 --> https://svn.open-mpi.org/trac/ompi/ticket/1477
Этот коммит содержится в:
Rolf vandeVaart 2008-09-10 12:58:30 +00:00
родитель f326ee356e
Коммит 1ad9d0459e
3 изменённых файлов: 32 добавлений и 2 удалений

Просмотреть файл

@ -11,7 +11,7 @@
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# Copyright (c) 2006-2007 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2006-2007 Sun Microsystems, Inc. All rights reserved.
# Copyright (c) 2006-2008 Sun Microsystems, Inc. All rights reserved.
# Copyright (c) 2006-2007 Los Alamos National Security, LLC. All rights
# reserved.
# $COPYRIGHT$
@ -623,7 +623,7 @@ AC_CHECK_HEADERS([alloca.h aio.h arpa/inet.h dirent.h \
sys/types.h sys/uio.h net/uio.h sys/utsname.h sys/wait.h syslog.h \
time.h termios.h ulimit.h unistd.h util.h utmp.h malloc.h \
ifaddrs.h sys/sysctl.h crt_externs.h regex.h \
ioLib.h sockLib.h hostLib.h shlwapi.h])
ioLib.h sockLib.h hostLib.h shlwapi.h sys/synch.h])
# Needed to work around Darwin requiring sys/socket.h for
# net/if.h
@ -1266,6 +1266,11 @@ 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
if test $ac_cv_header_sys_synch_h = yes ; then
AC_DEFINE(OMPI_HAVE_SYS_SYNCH_H, 1,
[Do not use outside of mpi.h. Define to 1 if you have the <sys/synch.h> header file.])
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,

Просмотреть файл

@ -10,6 +10,7 @@
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2007-2008 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -39,6 +40,9 @@
/* Define to 1 if you have the <sys/time.h> header file. */
#undef OMPI_HAVE_SYS_TIME_H
/* Define to 1 if you have the <sys/synch.h> header file. */
#undef OMPI_HAVE_SYS_SYNCH_H
/* Define to 1 if the system has the type `long long'. */
#undef OMPI_HAVE_LONG_LONG

Просмотреть файл

@ -11,6 +11,7 @@
// Copyright (c) 2004-2005 The Regents of the University of California.
// All rights reserved.
// Copyright (c) 2006-2008 Cisco Systems, Inc. All rights reserved.
// Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved.
// $COPYRIGHT$
//
// Additional copyrights may follow
@ -66,6 +67,26 @@ static const int SEEK_CUR = ompi_stdio_seek_cur;
static const int SEEK_END = ompi_stdio_seek_end;
#endif
#ifdef OMPI_HAVE_SYS_SYNCH_H
// Solaris threads.h pulls in sys/synch.h which in certain versions
// defines LOCK_SHARED.
// include so that we can smash LOCK_SHARED
#include <sys/synch.h>
// a user app may be included on a system with an older version
// sys/synch.h
#ifdef LOCK_SHARED
static const int ompi_synch_lock_shared = LOCK_SHARED;
// smash LOCK_SHARED #defines
#undef LOCK_SHARED
// make globally scoped constants to replace smashed #defines
static const int LOCK_SHARED = ompi_synch_lock_shared;
#endif
#endif
// forward declare so that we can still do inlining
struct opal_mutex_t;