Improve Gromacs portability
authorErik Lindahl <erik@kth.se>
Wed, 30 Jul 2014 12:34:32 +0000 (14:34 +0200)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Sun, 10 Aug 2014 16:46:10 +0000 (18:46 +0200)
This patch addresses a few general portability issues
that we have experienced at least on Fujitsu compilers
(K computer) and (partly) for Pathscale x86 compilers.
- I have added a generic compiler definition fallback
  for boost, so it will work on unidentified compilers.
- There is now  a define for gmock-1.7.0 to handle
  the case where wcscasecmp() is not available. We use
  this by default since it is not important for us.
- If we do not find atomics for sparc64 we now warn and
  fall back on mutexes rather than the compile dying.
- The compiler flag checks have been updated from
  cmake-3.0, and more warning checks added.
- Since some non-GCC compilers set _GNUC_ for
  compatibilty, we do not assume all such compilers
  support tr1, but use the internal tr1/tuple definition
  in Gmock by default.
- Before using the sched.h affinity functions, we now
  check that all the functions we need are supported,
  rather than just one of them.

Change-Id: I31b7f0f46a9d03a627c73a0789b4a9b24fa860ee

16 files changed:
CMakeLists.txt
cmake/CheckCCompilerFlag.cmake
cmake/CheckCXXCompilerFlag.cmake
cmake/TestSchedAffinity.cmake [moved from cmake/gmxGetMsvcTupleWorkaround.cmake with 57% similarity]
cmake/gmxGetGmockTupleWorkaround.cmake [new file with mode: 0644]
src/config.h.cmakein
src/external/boost/README
src/external/boost/boost/config/compiler/generic.hpp [new file with mode: 0644]
src/external/boost/boost/config/select_compiler_config.hpp
src/external/gmock-1.7.0/CMakeLists.txt
src/external/gmock-1.7.0/README.Gromacs
src/external/gmock-1.7.0/gtest/src/gtest.cc
src/external/thread_mpi/include/thread_mpi/atomic.h
src/gromacs/gmxlib/gmx_cpuid.c
src/gromacs/gmxlib/gmx_thread_affinity.c
src/gromacs/onlinehelp/helpwritercontext.cpp

index 2abc0d729ae97f98181502c46ecb39dbfe5ac876..246920662f930d46748a52914e9a1251f6b40295 100644 (file)
@@ -325,14 +325,20 @@ include(gmxManageOpenMP)
 #####################################################################
 
 # The cmake/Check{C,CXX}CompilerFlag.cmake files in the GROMACS distribution
 #####################################################################
 
 # The cmake/Check{C,CXX}CompilerFlag.cmake files in the GROMACS distribution
-# are used with permission from CMake v2.8.9 so that GROMACS can detect
-# invalid options with the Intel Compilers.
+# are used with permission from CMake v3.0.0 so that GROMACS can detect
+# invalid options with the Intel Compilers, and we have added a line
+# to detect warnings with the Fujitsu compilers on K computer.
+# CMake-3.0 also has a bug where the FAIL_REGEX pattern for AIX contains
+# a semicolon. Since this is also used as a separator in lists inside CMake,
+# that string ends up being split into two separate patterns, and the last
+# part is just a single word that also matches other messages. We solved this
+# by replacing the semicolon with a period that matches any character.
+#
 # These files should be removed from the source tree when a CMake version that
 # includes the features in question becomes required for building GROMACS.
 include(CheckCCompilerFlag)
 include(CheckCXXCompilerFlag)
 
 # These files should be removed from the source tree when a CMake version that
 # includes the features in question becomes required for building GROMACS.
 include(CheckCCompilerFlag)
 include(CheckCXXCompilerFlag)
 
-
 include(gmxCFlags)
 gmx_c_flags()
 
 include(gmxCFlags)
 gmx_c_flags()
 
@@ -410,8 +416,6 @@ check_function_exists(fileno            HAVE_FILENO)
 check_function_exists(_commit           HAVE__COMMIT)
 check_function_exists(sigaction         HAVE_SIGACTION)
 check_function_exists(sysconf           HAVE_SYSCONF)
 check_function_exists(_commit           HAVE__COMMIT)
 check_function_exists(sigaction         HAVE_SIGACTION)
 check_function_exists(sysconf           HAVE_SYSCONF)
-check_function_exists(sched_setaffinity HAVE_SCHED_SETAFFINITY)
-check_function_exists(sched_getaffinity HAVE_SCHED_GETAFFINITY)
 check_function_exists(rsqrt             HAVE_RSQRT)
 check_function_exists(rsqrtf            HAVE_RSQRTF)
 check_function_exists(sqrtf             HAVE_SQRTF)
 check_function_exists(rsqrt             HAVE_RSQRT)
 check_function_exists(rsqrtf            HAVE_RSQRTF)
 check_function_exists(sqrtf             HAVE_SQRTF)
@@ -420,6 +424,9 @@ include(CheckLibraryExists)
 check_library_exists(m sqrt "" HAVE_LIBM)
 check_library_exists(rt clock_gettime "" HAVE_CLOCK_GETTIME)
 
 check_library_exists(m sqrt "" HAVE_LIBM)
 check_library_exists(rt clock_gettime "" HAVE_CLOCK_GETTIME)
 
+include(TestSchedAffinity)
+test_sched_affinity(HAVE_SCHED_AFFINITY)
+
 include(TestBigEndian)
 test_big_endian(GMX_INTEGER_BIG_ENDIAN)
 
 include(TestBigEndian)
 test_big_endian(GMX_INTEGER_BIG_ENDIAN)
 
index e65ba1b4a653bc4337240a478554c450743c3f97..48d8177e09feeb90ae526768cc7eb7cd8f8f5da2 100644 (file)
@@ -64,7 +64,13 @@ MACRO (CHECK_C_COMPILER_FLAG _FLAG _RESULT)
      FAIL_REGEX "[Uu]nknown option"                         # HP
      FAIL_REGEX "[Ww]arning: [Oo]ption"                     # SunPro
      FAIL_REGEX "command option .* is not recognized"       # XL
      FAIL_REGEX "[Uu]nknown option"                         # HP
      FAIL_REGEX "[Ww]arning: [Oo]ption"                     # SunPro
      FAIL_REGEX "command option .* is not recognized"       # XL
+     FAIL_REGEX "command option .* contains an incorrect subargument" # XL
+     FAIL_REGEX "not supported in this configuration. ignored" # AIX
+     FAIL_REGEX "File with unknown suffix passed to linker" # PGI
      FAIL_REGEX "WARNING: unknown flag:"                    # Open64
      FAIL_REGEX "WARNING: unknown flag:"                    # Open64
+     FAIL_REGEX "Incorrect command line option:"            # Borland
+     FAIL_REGEX "Warning: illegal option"                   # SunStudio 12
+     FAIL_REGEX "[Ww]arning: Invalid"                       # Fujitsu
      )
    SET (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}")
 ENDMACRO (CHECK_C_COMPILER_FLAG)
      )
    SET (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}")
 ENDMACRO (CHECK_C_COMPILER_FLAG)
index 660f5aaa62f591b46996e3f3c4afe66e5904f0ac..a11373eb3f06a2cd75cdfa8d2f7e16ea2b96cb41 100644 (file)
@@ -64,9 +64,13 @@ MACRO (CHECK_CXX_COMPILER_FLAG _FLAG _RESULT)
      FAIL_REGEX "[Uu]nknown option"                         # HP
      FAIL_REGEX "[Ww]arning: [Oo]ption"                     # SunPro
      FAIL_REGEX "command option .* is not recognized"       # XL
      FAIL_REGEX "[Uu]nknown option"                         # HP
      FAIL_REGEX "[Ww]arning: [Oo]ption"                     # SunPro
      FAIL_REGEX "command option .* is not recognized"       # XL
-     FAIL_REGEX "not supported in this configuration. ignored"       # AIX
+     FAIL_REGEX "command option .* contains an incorrect subargument" # XL
+     FAIL_REGEX "not supported in this configuration. ignored" # AIX
      FAIL_REGEX "File with unknown suffix passed to linker" # PGI
      FAIL_REGEX "WARNING: unknown flag:"                    # Open64
      FAIL_REGEX "File with unknown suffix passed to linker" # PGI
      FAIL_REGEX "WARNING: unknown flag:"                    # Open64
+     FAIL_REGEX "Incorrect command line option:"            # Borland
+     FAIL_REGEX "Warning: illegal option"                   # SunStudio 12
+     FAIL_REGEX "[Ww]arning: Invalid"                       # Fujitsu
      )
    SET (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}")
 ENDMACRO (CHECK_CXX_COMPILER_FLAG)
      )
    SET (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}")
 ENDMACRO (CHECK_CXX_COMPILER_FLAG)
similarity index 57%
rename from cmake/gmxGetMsvcTupleWorkaround.cmake
rename to cmake/TestSchedAffinity.cmake
index 7096174d1529d6b6c750f78f06c9a0df604e417e..8fd23560735379bb308d25c4491f559247d2f908 100644 (file)
@@ -1,7 +1,7 @@
 #
 # This file is part of the GROMACS molecular simulation package.
 #
 #
 # This file is part of the GROMACS molecular simulation package.
 #
-# Copyright (c) 2014, by the GROMACS development team, led by
+# Copyright (c) 2012,2014, by the GROMACS development team, led by
 # Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
 # and including many others, as listed in the AUTHORS file in the
 # top-level source directory and at http://www.gromacs.org.
 # Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
 # and including many others, as listed in the AUTHORS file in the
 # top-level source directory and at http://www.gromacs.org.
 # To help us fund GROMACS development, we humbly ask that you cite
 # the research papers on the package. Check out http://www.gromacs.org.
 
 # To help us fund GROMACS development, we humbly ask that you cite
 # the research papers on the package. Check out http://www.gromacs.org.
 
-# GMock uses tuples extensively, and MSVC bundles a tuple library that
-# is not compatible with the standard. r675 of googletest works around
-# this properly, but that's not in GMock 1.7.0. That logic is
-# duplicated here. See
-# https://code.google.com/p/googletest/source/detail?r=675#, but note
-# that its summary does not represent its code correctly.
-#
-# This function should be called to get the compile definitions
-# suitable for working around MSVC to compile GMock, if any.
-# Returns a string of options in VARIABLE
-function(GET_MSVC_TUPLE_WORKAROUND_DEFINITIONS VARIABLE)
-    set(${VARIABLE} "")
-    if(MSVC AND MSVC_VERSION VERSION_EQUAL 1700)
-        # Fixes Visual Studio 2012
-        set(${VARIABLE} "_VARIADIC_MAX=10")
-    endif()
-    set(${VARIABLE} ${${VARIABLE}} PARENT_SCOPE)
-endfunction()
+# - Define macro to check if all of the following work:
+# sched_getaffinity()
+# sched_setaffinity()
+# CPU_ZERO()
+# CPU_SET()
+# CPU_ISSET()
+# CPU_CLR()
+# CPU_COUNT()
+
+#  test_sched_affinity(VARIABLE)
+#
+#  VARIABLE will be set to true if all of the functions link fine.
+
+MACRO(test_sched_affinity VARIABLE)
+
+  if(NOT DEFINED sched_affinity_compile)
+    MESSAGE(STATUS "Checking for sched.h GNU affinity API")
+
+    check_c_source_compiles(
+      "#ifndef _GNU_SOURCE
+#define _GNU_SOURCE 1
+#endif
+#include <sched.h>
+int main(void) {
+  int i;
+  cpu_set_t mask;
+  CPU_ZERO(&mask);
+  sched_getaffinity(0, sizeof(cpu_set_t), &mask);
+  if(CPU_ISSET(0,&mask))
+  {
+    CPU_CLR(0,&mask);
+    CPU_SET(0,&mask);
+  }
+  sched_setaffinity(0, sizeof(cpu_set_t), &mask);
+  return CPU_COUNT(&mask);
+}" sched_affinity_compile)
+  endif(NOT DEFINED sched_affinity_compile)
+
+  if(sched_affinity_compile)
+    set(${VARIABLE} 1 CACHE INTERNAL "Result of test for sched.h GNU affinity API" FORCE)
+  else()
+    set(${VARIABLE} 0 CACHE INTERNAL "Result of test for sched.h GNU affinity API" FORCE)
+  endif()
+ENDMACRO(test_sched_affinity VARIABLE)
diff --git a/cmake/gmxGetGmockTupleWorkaround.cmake b/cmake/gmxGetGmockTupleWorkaround.cmake
new file mode 100644 (file)
index 0000000..d9456bb
--- /dev/null
@@ -0,0 +1,73 @@
+#
+# This file is part of the GROMACS molecular simulation package.
+#
+# Copyright (c) 2014, by the GROMACS development team, led by
+# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
+# and including many others, as listed in the AUTHORS file in the
+# top-level source directory and at http://www.gromacs.org.
+#
+# GROMACS is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public License
+# as published by the Free Software Foundation; either version 2.1
+# of the License, or (at your option) any later version.
+#
+# GROMACS is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with GROMACS; if not, see
+# http://www.gnu.org/licenses, or write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
+#
+# If you want to redistribute modifications to GROMACS, please
+# consider that scientific software is very special. Version
+# control is crucial - bugs must be traceable. We will be happy to
+# consider code for inclusion in the official distribution, but
+# derived work must not be called official GROMACS. Details are found
+# in the README & COPYING files - if they are missing, get the
+# official version at http://www.gromacs.org.
+#
+# To help us fund GROMACS development, we humbly ask that you cite
+# the research papers on the package. Check out http://www.gromacs.org.
+
+# GMock uses tuples extensively, but since it is part of tr1 we cannot
+# assume it is present - the Fujitsu compilers on K computer is one
+# example of a system where it is not, and this is likely the case for many
+# embedded systems too.
+#
+# In general, we can ask gmock to use its own internal implementation by
+# defining GTEST_USE_OWN_TR1_TUPLE=1. This is safe for Gromacs, since we do
+# not use tr1/tuple.h elsewhere. However, this workaround itself will not
+# compile on MSVC - but this is the only architecture we know where it does
+# not work. To make things even worse, on MSVC even the standard tr1/tuple
+# implementation is not fully compatible, but we can make it work by setting
+# _VARIADIC_MAX=10. This is similar to r675 of googletest, which is still not
+# present in GMock 1.7.0. See
+# https://code.google.com/p/googletest/source/detail?r=675#, but note
+# that its summary does not represent its code correctly.
+#
+# To make all this work without user intervention, we first check what compiler
+# we have, and if it is not MSVC we simply use the internal version. If we are
+# using MSVC, we rely on the compiler's version, but set the variable necessary
+# to make it compatible.
+#
+# This function should be called to get the compile definitions
+# suitable for making sure we have a tuple implementation that works with gmock.
+#
+# Returns a string of options in VARIABLE
+function(GET_GMOCK_TUPLE_WORKAROUND VARIABLE)
+    set(${VARIABLE} "")
+    if(MSVC OR (WIN32 AND CMAKE_CXX_COMPILER_ID MATCHES "Intel"))
+        if(MSVC_VERSION VERSION_EQUAL 1700)
+            # Fixes Visual Studio 2012
+            set(${VARIABLE} "_VARIADIC_MAX=10")
+        endif()
+        # For MSVC different from 2012, or Intel on Windows, we reply on tr1/tuple working.
+    else()
+        # Use the built-in version on all other compilers.
+        set(${VARIABLE} "GTEST_USE_OWN_TR1_TUPLE=1")
+    endif()
+    set(${VARIABLE} ${${VARIABLE}} PARENT_SCOPE)
+endfunction()
index c0fe73d85ed430207effd2dd2103855fd67a4e45..897dae65df052fb935ebf1db01222fcae3deca94 100644 (file)
 /* Define to 1 if you have the sysconf() function */
 #cmakedefine HAVE_SYSCONF
 
 /* Define to 1 if you have the sysconf() function */
 #cmakedefine HAVE_SYSCONF
 
-/* Define to 1 if you have the sched_getaffinity() function */
-#cmakedefine HAVE_SCHED_GETAFFINITY
-
-/* Define to 1 if you have the sched_setaffinity() function */
-#cmakedefine HAVE_SCHED_SETAFFINITY
+/* Define to 1 if you have the all the affinity functions in sched.h */
+#cmakedefine HAVE_SCHED_AFFINITY
 
 /* Bytes in IEEE fp word are in big-endian order if set, little-endian if not.
    Only relevant when FLOAT_FORMAT_IEEE754 is defined. */
 
 /* Bytes in IEEE fp word are in big-endian order if set, little-endian if not.
    Only relevant when FLOAT_FORMAT_IEEE754 is defined. */
index c63c724ab809fcc803a7eb8c2e0d635b8e79884a..a41bac446d5a98edc01163b884ed118f676425c3 100644 (file)
@@ -2,9 +2,14 @@ Steps to produce minimal version of BOOST:
 1) Download Boost (current minimal version is derived from 1.55.0)
 2) Extract
 3) Edit Boost files to uncomment unnessary includes (search for GMX in minimal version and copy all changes)
 1) Download Boost (current minimal version is derived from 1.55.0)
 2) Extract
 3) Edit Boost files to uncomment unnessary includes (search for GMX in minimal version and copy all changes)
-4) run bcp with required files (currently exception/all.hpp, scoped_ptr.hpp)
-5) delete source files which are not required. Currently:
-       libs/smart_ptr/src/sp_collector.cpp
-       libs/smart_ptr/src/sp_debug_hooks.cpp
+4) Make sure our subset works even with compilers not listed
+   among the boost ones (in particular, Fujistu in native mode):
+   - Edit config/select_compiler_config.hpp to add the fallback
+     to a generic compiler capability file at the end.
+   - Add the generic compiler capability file config/compiler/generic.hpp
+5) run bcp with required files (currently exception/all.hpp, scoped_ptr.hpp)
+6) delete source files which are not required. Currently:
+   - libs/smart_ptr/src/sp_collector.cpp
+   - libs/smart_ptr/src/sp_debug_hooks.cpp
    Make sure that they are really not needed.If any source files are added make sure to add them to cmake.
 
    Make sure that they are really not needed.If any source files are added make sure to add them to cmake.
 
diff --git a/src/external/boost/boost/config/compiler/generic.hpp b/src/external/boost/boost/config/compiler/generic.hpp
new file mode 100644 (file)
index 0000000..5822693
--- /dev/null
@@ -0,0 +1,71 @@
+//  File created by Erik Lindahl July 2014 by copying most of the pathscale.hpp
+//  compiler definition in Boost-1.55. 
+
+//  Use, modification and distribution are subject to the
+//  Boost Software License, Version 1.0. (See accompanying file
+//  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+//  See http://www.boost.org for most recent version.
+
+//  Settings for a generic compiler. We assume that long long exists,
+//  remove all C++11 support, and assume threads work.
+
+#ifndef BOOST_COMPILER
+#  define BOOST_COMPILER "Generic compiler"
+#endif
+
+// It might seem stupid to assume a generic compiler to have threads, but it
+// appears some Boost reference counting might not be thread-safe without this.
+#define BOOST_HAS_THREADS
+#define BOOST_HAS_PTHREADS
+
+#define BOOST_HAS_LONG_LONG
+#define BOOST_NO_CXX11_VARIADIC_TEMPLATES
+#define BOOST_NO_CXX11_UNICODE_LITERALS
+#define BOOST_NO_CXX11_TEMPLATE_ALIASES
+#define BOOST_NO_CXX11_STATIC_ASSERT
+#define BOOST_NO_SFINAE_EXPR
+#define BOOST_NO_CXX11_SCOPED_ENUMS
+#define BOOST_NO_CXX11_RVALUE_REFERENCES
+#define BOOST_NO_CXX11_RANGE_BASED_FOR
+#define BOOST_NO_CXX11_RAW_LITERALS
+#define BOOST_NO_CXX11_NULLPTR
+#define BOOST_NO_CXX11_NUMERIC_LIMITS
+#define BOOST_NO_CXX11_NOEXCEPT
+#define BOOST_NO_CXX11_LAMBDAS
+#define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS
+#define BOOST_NO_MS_INT64_NUMERIC_LIMITS
+#define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS
+#define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
+#define BOOST_NO_CXX11_DELETED_FUNCTIONS
+#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
+#define BOOST_NO_CXX11_DECLTYPE
+#define BOOST_NO_CXX11_DECLTYPE_N3276
+#define BOOST_NO_CXX11_CONSTEXPR
+#define BOOST_NO_COMPLETE_VALUE_INITIALIZATION
+#define BOOST_NO_CXX11_CHAR32_T
+#define BOOST_NO_CXX11_CHAR16_T
+#define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS
+#define BOOST_NO_CXX11_AUTO_DECLARATIONS
+#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
+#define BOOST_NO_CXX11_HDR_UNORDERED_SET
+#define BOOST_NO_CXX11_HDR_UNORDERED_MAP
+#define BOOST_NO_CXX11_HDR_TYPEINDEX
+#define BOOST_NO_CXX11_HDR_TUPLE
+#define BOOST_NO_CXX11_HDR_THREAD
+#define BOOST_NO_CXX11_HDR_SYSTEM_ERROR
+#define BOOST_NO_CXX11_HDR_REGEX
+#define BOOST_NO_CXX11_HDR_RATIO
+#define BOOST_NO_CXX11_HDR_RANDOM
+#define BOOST_NO_CXX11_HDR_MUTEX
+#define BOOST_NO_CXX11_HDR_INITIALIZER_LIST
+#define BOOST_NO_CXX11_HDR_FUTURE
+#define BOOST_NO_CXX11_HDR_FORWARD_LIST
+#define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE
+#define BOOST_NO_CXX11_HDR_CODECVT
+#define BOOST_NO_CXX11_HDR_CHRONO
+#define BOOST_NO_CXX11_USER_DEFINED_LITERALS
+#define BOOST_NO_CXX11_ALIGNAS
+#define BOOST_NO_CXX11_TRAILING_RESULT_TYPES
+#define BOOST_NO_CXX11_INLINE_NAMESPACES
+
index 0eeb7ad3ee6fec7bc6c1c761f758072bf929240b..3b3541671205c8a65a5b534e0e509acf1ca362b8 100644 (file)
 //  example) also #define _MSC_VER
 #   define BOOST_COMPILER_CONFIG "boost/config/compiler/visualc.hpp"
 
 //  example) also #define _MSC_VER
 #   define BOOST_COMPILER_CONFIG "boost/config/compiler/visualc.hpp"
 
-#elif defined (BOOST_ASSERT_CONFIG)
-// this must come last - generate an error if we don't
-// recognise the compiler:
-#  error "Unknown compiler - please configure (http://www.boost.org/libs/config/config.htm#configuring) and report the results to the main boost mailing list (http://www.boost.org/more/mailing_lists.htm#main)"
+#else
+
+#   warning Unknown boost compiler; using generic settings not tested for this compiler.
+#   define BOOST_COMPILER_CONFIG "boost/config/compiler/generic.hpp"
+
 
 #endif
 
 #endif
index 3cb202bfd0ec27f7c3de5b58d0c84a95d330c74d..114e41834bb174a9da76637d49f3cb673427d62e 100644 (file)
@@ -35,8 +35,8 @@
 # As stated in README.Gromacs, this file is not part of GMock, but is written
 # specifically for the GROMACS build system from scratch.
 
 # As stated in README.Gromacs, this file is not part of GMock, but is written
 # specifically for the GROMACS build system from scratch.
 
-include(gmxGetMsvcTupleWorkaround)
-get_msvc_tuple_workaround_definitions(GMOCK_COMPILE_DEFINITIONS)
+include(gmxGetGmockTupleWorkaround)
+get_gmock_tuple_workaround(GMOCK_COMPILE_DEFINITIONS)
 set(GMOCK_COMPILE_DEFINITIONS ${GMOCK_COMPILE_DEFINITIONS} PARENT_SCOPE)
 
 # GTest/GMock suggest linking with pthreads when available for thread safety
 set(GMOCK_COMPILE_DEFINITIONS ${GMOCK_COMPILE_DEFINITIONS} PARENT_SCOPE)
 
 # GTest/GMock suggest linking with pthreads when available for thread safety
index 6275ec1d12731c583ea943aa712cf7a2bc09ccb7..7560c11d5157083df1a45ff465c42583ddd9c27f 100644 (file)
@@ -14,3 +14,9 @@ gmock-1.7.0/gtest/src/
 
 The file CMakeLists.txt in this directory is part of the Gromacs build system
 and has been written from scratch.
 
 The file CMakeLists.txt in this directory is part of the Gromacs build system
 and has been written from scratch.
+
+In the default version, gmock-1.7.0 assumes wcscasecmp() to be present on Linux.
+This is not the case on all platforms, so on line 1610 of gtest/src/gtest.cc
+we have added a define to only use this if GTEST_HAS_WCSCASECMP is set. Since
+we never set this define, we fall back on the alternative internal implementation
+which should be perfectly fine for now.
index 6de53dd0198c3a0bdb3857dbc4b9f7e5be26002a..e2b5c5b6f7a57c4138eabd2c2961a09dce0495fa 100644 (file)
@@ -1607,7 +1607,7 @@ bool String::CaseInsensitiveWideCStringEquals(const wchar_t* lhs,
 
 #if GTEST_OS_WINDOWS
   return _wcsicmp(lhs, rhs) == 0;
 
 #if GTEST_OS_WINDOWS
   return _wcsicmp(lhs, rhs) == 0;
-#elif GTEST_OS_LINUX && !GTEST_OS_LINUX_ANDROID
+#elif GTEST_OS_LINUX && !GTEST_OS_LINUX_ANDROID && GTEST_HAS_WCSCASECMP
   return wcscasecmp(lhs, rhs) == 0;
 #else
   // Android, Mac OS X and Cygwin don't define wcscasecmp.
   return wcscasecmp(lhs, rhs) == 0;
 #else
   // Android, Mac OS X and Cygwin don't define wcscasecmp.
index 895db00ff43300d89488860a71b23d2ae9151643..5a183ab6b51bfff7d9834ff10ea08bc2fc6dc675 100644 (file)
@@ -169,7 +169,8 @@ extern "C"
 #elif defined(__FUJITSU) && defined(__sparc__)
 
 /* Fujitsu FX10 SPARC compiler requires gcc compatibility with -Xg */
 #elif defined(__FUJITSU) && defined(__sparc__)
 
 /* Fujitsu FX10 SPARC compiler requires gcc compatibility with -Xg */
-#error Atomics support for Fujitsu FX10 compiler requires -Xg (gcc compatibility)
+#warning Atomics support for Fujitsu FX10 compiler requires -Xg (gcc compatibility)
+#define TMPI_NO_ATOMICS
 
 #elif defined(_CRAYC)
 
 
 #elif defined(_CRAYC)
 
index 03b83fc43229aabe759ec72d3f19110c781d46d6..fb1b076ee870d1be96996293b053e8f0fb511dea 100644 (file)
 #endif
 
 #ifdef HAVE_SCHED_H
 #endif
 
 #ifdef HAVE_SCHED_H
-#define _GNU_SOURCE
-#include <sched.h>
+#  ifndef _GNU_SOURCE
+#    define _GNU_SOURCE 1
+#  endif
+#  include <sched.h>
 #endif
 
 #include <stdio.h>
 #endif
 
 #include <stdio.h>
@@ -555,7 +557,7 @@ cpuid_check_amd_x86(gmx_cpuid_t                cpuid)
     /* Query APIC information on AMD */
     if (max_extfn >= 0x80000008)
     {
     /* Query APIC information on AMD */
     if (max_extfn >= 0x80000008)
     {
-#if (defined HAVE_SCHED_H && defined HAVE_SCHED_SETAFFINITY && defined HAVE_SYSCONF && defined __linux__)
+#if (defined HAVE_SCHED_AFFINITY && defined HAVE_SYSCONF && defined __linux__)
         /* Linux */
         unsigned int   i;
         cpu_set_t      cpuset, save_cpuset;
         /* Linux */
         unsigned int   i;
         cpu_set_t      cpuset, save_cpuset;
@@ -669,7 +671,7 @@ cpuid_check_intel_x86(gmx_cpuid_t                cpuid)
     if (max_stdfn >= 0xB)
     {
         /* Query x2 APIC information from cores */
     if (max_stdfn >= 0xB)
     {
         /* Query x2 APIC information from cores */
-#if (defined HAVE_SCHED_H && defined HAVE_SCHED_SETAFFINITY && defined HAVE_SYSCONF && defined __linux__)
+#if (defined HAVE_SCHED_AFFINITY && defined HAVE_SYSCONF && defined __linux__)
         /* Linux */
         unsigned int   i;
         cpu_set_t      cpuset, save_cpuset;
         /* Linux */
         unsigned int   i;
         cpu_set_t      cpuset, save_cpuset;
index 90970b6bd29aeb590e2d3bd0686aeb16ba2b11d1..fb2064213ef6fe7bdd5de74ee8bdcb8d60c817b8 100644 (file)
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
-#if defined(HAVE_SCHED_H) && defined(HAVE_SCHED_GETAFFINITY)
-#define _GNU_SOURCE
-#include <sched.h>
-#include <sys/syscall.h>
+#if defined(HAVE_SCHED_H)
+#  ifndef _GNU_SOURCE
+#    define _GNU_SOURCE 1
+#  endif
+#  include <sched.h>
+#  include <sys/syscall.h>
 #endif
 #include <string.h>
 #include <errno.h>
 #endif
 #include <string.h>
 #include <errno.h>
@@ -375,7 +377,7 @@ gmx_check_thread_affinity_set(FILE            gmx_unused *fplog,
                               int             gmx_unused  nthreads_hw_avail,
                               gmx_bool        gmx_unused  bAfterOpenmpInit)
 {
                               int             gmx_unused  nthreads_hw_avail,
                               gmx_bool        gmx_unused  bAfterOpenmpInit)
 {
-#ifdef HAVE_SCHED_GETAFFINITY
+#ifdef HAVE_SCHED_AFFINITY
     cpu_set_t mask_current;
     int       i, ret, cpu_count, cpu_set;
     gmx_bool  bAllSet;
     cpu_set_t mask_current;
     int       i, ret, cpu_count, cpu_set;
     gmx_bool  bAllSet;
@@ -459,5 +461,5 @@ gmx_check_thread_affinity_set(FILE            gmx_unused *fplog,
             fprintf(debug, "Default affinity mask found\n");
         }
     }
             fprintf(debug, "Default affinity mask found\n");
         }
     }
-#endif /* HAVE_SCHED_GETAFFINITY */
+#endif /* HAVE_SCHED_AFFINITY */
 }
 }
index 649ab7849d96ac0541265b9f2300895db6147576..2a30686f39ccdd8077f28cec5799da392da6db6c 100644 (file)
@@ -357,7 +357,7 @@ class WrapperToVector : public WrapperInterface
 std::string toUpperCase(const std::string &text)
 {
     std::string result(text);
 std::string toUpperCase(const std::string &text)
 {
     std::string result(text);
-    transform(result.begin(), result.end(), result.begin(), toupper);
+    std::transform(result.begin(), result.end(), result.begin(), toupper);
     return result;
 }
 
     return result;
 }