From 0f1d005a2a7123f4077dbe3ff446ced8f240f1f8 Mon Sep 17 00:00:00 2001 From: Magnus Lundborg Date: Mon, 4 Nov 2013 14:18:29 +0100 Subject: Let CMake check endianness for MD5. Remove GROMACS header. diff --git a/include/md5.h b/include/md5.h index 5aef902..5776af8 100644 --- a/include/md5.h +++ b/include/md5.h @@ -1,3 +1,7 @@ + +/* This file has been modified in the TNG library distribution. Modifications + * are marked below. */ + /* Copyright (C) 1999, 2002 Aladdin Enterprises. All rights reserved. @@ -49,6 +53,9 @@ #ifndef md5_INCLUDED # define md5_INCLUDED + +/* The comment below does not apply to the version included in the TNG + * library. */ /* * This package supports both compile-time and run-time determination of CPU * byte order. If ARCH_IS_BIG_ENDIAN is defined as 0, the code will be @@ -70,16 +77,20 @@ typedef struct md5_state_s { } md5_state_t; #ifdef __cplusplus -extern "C" +extern "C" { #endif +/* The USE_WINDOWS define below was added in TNG library distribution of this + * file in order to compile properly in MSVC */ #ifndef USE_WINDOWS #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64) #define USE_WINDOWS #endif /* win32... */ #endif /* not defined USE_WINDOWS */ +/* The DECLSPECDLLEXPORT define below was added in the TNG library distribution + * of this file. It is also used in the function declarations. */ #ifndef DECLSPECDLLEXPORT #ifdef USE_WINDOWS #define DECLSPECDLLEXPORT __declspec(dllexport) diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt index 20923d8..45e13d2 100644 --- a/src/lib/CMakeLists.txt +++ b/src/lib/CMakeLists.txt @@ -15,6 +15,14 @@ if(HAVE_INTTYPES_H) set_property(TARGET tng_io APPEND PROPERTY COMPILE_DEFINITIONS USE_STD_INTTYPES_H) endif() +# This test is for md5. The TNG library itself determines the actual byte order - +# not just if it is small or big endian. +include(TestBigEndian) +test_big_endian(TNG_INTEGER_BIG_ENDIAN) +if(TNG_INTEGER_BIG_ENDIAN) + set_property(TARGET tng_io APPEND PROPERTY COMPILE_DEFINITIONS TNG_INTEGER_BIG_ENDIAN) +endif() + if(ZLIB_FOUND) set_property(TARGET tng_io APPEND PROPERTY COMPILE_DEFINITIONS USE_ZLIB) target_link_libraries(tng_io tng_compress ${ZLIB_LIBRARIES}) diff --git a/src/lib/md5.c b/src/lib/md5.c index 8ea5b13..bd11de3 100644 --- a/src/lib/md5.c +++ b/src/lib/md5.c @@ -1,46 +1,16 @@ -/* - * - * This source code is distributed with - * - * G R O M A C S - * - * GROningen MAchine for Chemical Simulations - * - * VERSION 4.5 - * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others. - * Copyright (c) 1991-2010, The GROMACS development team, - * check out http://www.gromacs.org for more information. - * - * Gromacs is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * If you want to redistribute modifications, 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 www.gromacs.org. - * - * To help us fund GROMACS development, we humbly ask that you cite - * the papers on the package - you can find them in the top README file. - * - * For more info, check our website at http://www.gromacs.org - * - * And Hey: - * GROningen Mixture of Alchemy and Childrens' Stories - */ -#ifdef HAVE_CONFIG_H -#include -#endif +/* This file has been modified in the TNG library distribution. Modifications + * are marked below. */ -#ifdef GMX_INTEGER_BIG_ENDIAN +/* The define below was added in the TNG library distribution of this file. */ +#ifdef TNG_INTEGER_BIG_ENDIAN #define ARCH_IS_BIG_ENDIAN 1 #else #define ARCH_IS_BIG_ENDIAN 0 #endif +/* The defines below were added in TNG library distribution of this file + * in order to compile properly in MSVC */ + #ifndef USE_WINDOWS #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64) #define USE_WINDOWS @@ -181,6 +151,7 @@ #define T63 0x2ad7d2bb #define T64 /* 0xeb86d391 */ (T_MASK ^ 0x14792c6e) +/* In the TNG library inline has been changed to TNG_INLINE */ static TNG_INLINE void md5_process(md5_state_t *pms, const md5_byte_t *data /*[64]*/) { -- cgit v0.10.1