summaryrefslogtreecommitdiffstats
path: root/Resources
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2010-05-13 16:01:50 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2010-05-13 16:01:50 (GMT)
commitae06433ab0ca13838c2762c8fad165a041d64c42 (patch)
tree72d645731c00953c3daf6dad8a1cf0dc97326943 /Resources
parent940931aa853602b0b6edfd4ca1a6526fd7975dd2 (diff)
downloadhdf5-ae06433ab0ca13838c2762c8fad165a041d64c42.zip
hdf5-ae06433ab0ca13838c2762c8fad165a041d64c42.tar.gz
hdf5-ae06433ab0ca13838c2762c8fad165a041d64c42.tar.bz2
[svn-r18793] Add files to support building library with CMake
Tested: Local linux
Diffstat (limited to 'Resources')
-rw-r--r--Resources/CMake/FindSZIP.cmake179
-rw-r--r--Resources/CheckTypeSize.cmake48
-rw-r--r--Resources/ConversionTests.c422
-rw-r--r--Resources/GetTimeOfDayTest.cpp15
-rw-r--r--Resources/H5cxx_config.h.in5
-rw-r--r--Resources/H5pubconf.h.in745
-rw-r--r--Resources/HDF5Config.cmake.in32
-rw-r--r--Resources/HDF5Macros.cmake122
-rw-r--r--Resources/HDF5Tests.c366
-rw-r--r--Resources/hdf5_zlib.h.in1
-rw-r--r--Resources/libhdf5.settings.cmake.in68
-rw-r--r--Resources/runTest.cmake82
-rw-r--r--Resources/xlatefile.c56
13 files changed, 2141 insertions, 0 deletions
diff --git a/Resources/CMake/FindSZIP.cmake b/Resources/CMake/FindSZIP.cmake
new file mode 100644
index 0000000..190b0b5
--- /dev/null
+++ b/Resources/CMake/FindSZIP.cmake
@@ -0,0 +1,179 @@
+
+# - Find SZIP library
+# - Derived from the FindTiff.cmake that is included with cmake
+# Find the native SZIP includes and library
+# This module defines
+# SZIP_INCLUDE_DIRS, where to find tiff.h, etc.
+# SZIP_LIBRARIES, libraries to link against to use SZIP.
+# SZIP_FOUND, If false, do not try to use SZIP.
+# also defined, but not for general use are
+# SZIP_LIBRARY, where to find the SZIP library.
+# SZIP_LIBRARY_DEBUG - Debug version of tiff library
+# SZIP_LIBRARY_RELEASE - Release Version of tiff library
+
+# MESSAGE (STATUS "Finding Szip library and headers..." )
+
+############################################
+#
+# Check the existence of the libraries.
+#
+############################################
+# This macro was taken directly from the FindQt4.cmake file that is included
+# with the CMake distribution. This is NOT my work. All work was done by the
+# original authors of the FindQt4.cmake file. Only minor modifications were
+# made to remove references to Qt and make this file more generally applicable
+#########################################################################
+
+MACRO (SZIP_ADJUST_LIB_VARS basename)
+ IF (${basename}_INCLUDE_DIR)
+
+ # if only the release version was found, set the debug variable also to the release version
+ IF (${basename}_LIBRARY_RELEASE AND NOT ${basename}_LIBRARY_DEBUG)
+ SET (${basename}_LIBRARY_DEBUG ${${basename}_LIBRARY_RELEASE})
+ SET (${basename}_LIBRARY ${${basename}_LIBRARY_RELEASE})
+ SET (${basename}_LIBRARIES ${${basename}_LIBRARY_RELEASE})
+ ENDIF (${basename}_LIBRARY_RELEASE AND NOT ${basename}_LIBRARY_DEBUG)
+
+ # if only the debug version was found, set the release variable also to the debug version
+ IF (${basename}_LIBRARY_DEBUG AND NOT ${basename}_LIBRARY_RELEASE)
+ SET (${basename}_LIBRARY_RELEASE ${${basename}_LIBRARY_DEBUG})
+ SET (${basename}_LIBRARY ${${basename}_LIBRARY_DEBUG})
+ SET (${basename}_LIBRARIES ${${basename}_LIBRARY_DEBUG})
+ ENDIF (${basename}_LIBRARY_DEBUG AND NOT ${basename}_LIBRARY_RELEASE)
+ IF (${basename}_LIBRARY_DEBUG AND ${basename}_LIBRARY_RELEASE)
+ # if the generator supports configuration types then set
+ # optimized and debug libraries, or if the CMAKE_BUILD_TYPE has a value
+ IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
+ SET (${basename}_LIBRARY optimized ${${basename}_LIBRARY_RELEASE} debug ${${basename}_LIBRARY_DEBUG})
+ ELSE(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
+ # if there are no configuration types and CMAKE_BUILD_TYPE has no value
+ # then just use the release libraries
+ SET (${basename}_LIBRARY ${${basename}_LIBRARY_RELEASE} )
+ ENDIF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
+ SET (${basename}_LIBRARIES optimized ${${basename}_LIBRARY_RELEASE} debug ${${basename}_LIBRARY_DEBUG})
+ ENDIF (${basename}_LIBRARY_DEBUG AND ${basename}_LIBRARY_RELEASE)
+
+ SET (${basename}_LIBRARY ${${basename}_LIBRARY} CACHE FILEPATH "The ${basename} library")
+
+ IF (${basename}_LIBRARY)
+ SET (${basename}_FOUND 1)
+ ENDIF (${basename}_LIBRARY)
+
+ ENDIF (${basename}_INCLUDE_DIR )
+
+ # Make variables changeble to the advanced user
+ MARK_AS_ADVANCED (${basename}_LIBRARY ${basename}_LIBRARY_RELEASE ${basename}_LIBRARY_DEBUG ${basename}_INCLUDE_DIR )
+ENDMACRO (SZIP_ADJUST_LIB_VARS)
+
+
+# Look for the header file.
+SET (SZIP_INCLUDE_SEARCH_DIRS
+ $ENV{SZIP_INSTALL}/include
+ $ENV{SZIP_INSTALL}/include/szip
+ /usr/include
+ /usr/include/szip
+)
+
+SET (SZIP_LIB_SEARCH_DIRS
+ $ENV{SZIP_INSTALL}/lib
+ /usr/lib
+)
+
+SET (SZIP_BIN_SEARCH_DIRS
+ $ENV{SZIP_INSTALL}/bin
+ /usr/bin
+)
+
+FIND_PATH (SZIP_INCLUDE_DIR
+ NAMES szlib.h
+ PATHS ${SZIP_INCLUDE_SEARCH_DIRS}
+ NO_DEFAULT_PATH
+)
+
+IF (WIN32 AND NOT MINGW)
+ SET (SZIP_SEARCH_DEBUG_NAMES "sz_d;libsz_d")
+ SET (SZIP_SEARCH_RELEASE_NAMES "sz;libsz")
+ELSE (WIN32 AND NOT MINGW)
+ SET (SZIP_SEARCH_DEBUG_NAMES "sz_d")
+ SET (SZIP_SEARCH_RELEASE_NAMES "sz")
+ENDIF (WIN32 AND NOT MINGW)
+
+# Look for the library.
+FIND_LIBRARY (SZIP_LIBRARY_DEBUG
+ NAMES ${SZIP_SEARCH_DEBUG_NAMES}
+ PATHS ${SZIP_LIB_SEARCH_DIRS}
+ NO_DEFAULT_PATH
+)
+
+FIND_LIBRARY (SZIP_LIBRARY_RELEASE
+ NAMES ${SZIP_SEARCH_RELEASE_NAMES}
+ PATHS ${SZIP_LIB_SEARCH_DIRS}
+ NO_DEFAULT_PATH
+)
+
+SZIP_ADJUST_LIB_VARS (SZIP)
+
+IF (SZIP_INCLUDE_DIR AND SZIP_LIBRARY)
+ SET (SZIP_FOUND 1)
+ SET (SZIP_LIBRARIES ${SZIP_LIBRARY})
+ SET (SZIP_INCLUDE_DIRS ${SZIP_INCLUDE_DIR})
+ IF (SZIP_LIBRARY_DEBUG)
+ GET_FILENAME_COMPONENT (SZIP_LIBRARY_PATH ${SZIP_LIBRARY_DEBUG} PATH)
+ SET (SZIP_LIB_DIR ${SZIP_LIBRARY_PATH})
+ ELSEIF (SZIP_LIBRARY_RELEASE)
+ GET_FILENAME_COMPONENT (SZIP_LIBRARY_PATH ${SZIP_LIBRARY_RELEASE} PATH)
+ SET (SZIP_LIB_DIR ${SZIP_LIBRARY_PATH})
+ ENDIF (SZIP_LIBRARY_DEBUG)
+
+ELSE (SZIP_INCLUDE_DIR AND SZIP_LIBRARY)
+ SET (SZIP_FOUND 0)
+ SET (SZIP_LIBRARIES)
+ SET (SZIP_INCLUDE_DIRS)
+ENDIF (SZIP_INCLUDE_DIR AND SZIP_LIBRARY)
+
+# Report the results.
+IF (NOT SZIP_FOUND)
+ SET (SZIP_DIR_MESSAGE
+ "SZip was not found. Make sure SZIP_LIBRARY and SZIP_INCLUDE_DIR are set or set the SZIP_INSTALL environment variable."
+ )
+ IF (NOT SZIP_FIND_QUIETLY)
+ MESSAGE (STATUS "${SZIP_DIR_MESSAGE}")
+ ELSE (NOT SZIP_FIND_QUIETLY)
+ IF (SZIP_FIND_REQUIRED)
+ MESSAGE (FATAL_ERROR "SZip was NOT found and is Required by this project")
+ ENDIF (SZIP_FIND_REQUIRED)
+ ENDIF (NOT SZIP_FIND_QUIETLY)
+ENDIF (NOT SZIP_FOUND)
+
+IF (SZIP_FOUND)
+ INCLUDE (CheckSymbolExists)
+ #############################################
+ # Find out if SZIP was build using dll's
+ #############################################
+ # Save required variable
+ SET (CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES})
+ SET (CMAKE_REQUIRED_FLAGS_SAVE ${CMAKE_REQUIRED_FLAGS})
+ # Add SZIP_INCLUDE_DIR to CMAKE_REQUIRED_INCLUDES
+ SET (CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES};${SZIP_INCLUDE_DIRS}")
+
+ CHECK_SYMBOL_EXISTS (SZIP_BUILT_AS_DYNAMIC_LIB "SZconfig.h" HAVE_SZIP_DLL)
+
+ IF (HAVE_SZIP_DLL STREQUAL "TRUE")
+ SET (HAVE_SZIP_DLL "1")
+ ENDIF (HAVE_SZIP_DLL STREQUAL "TRUE")
+
+ # Restore CMAKE_REQUIRED_INCLUDES and CMAKE_REQUIRED_FLAGS variables
+ SET (CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE})
+ SET (CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_SAVE})
+ #
+ #############################################
+ENDIF (SZIP_FOUND)
+
+IF (FIND_SZIP_DEBUG)
+ MESSAGE (STATUS "SZIP_INCLUDE_DIR: ${SZIP_INCLUDE_DIR}")
+ MESSAGE (STATUS "SZIP_INCLUDE_DIRS: ${SZIP_INCLUDE_DIRS}")
+ MESSAGE (STATUS "SZIP_LIBRARY_DEBUG: ${SZIP_LIBRARY_DEBUG}")
+ MESSAGE (STATUS "SZIP_LIBRARY_RELEASE: ${SZIP_LIBRARY_RELEASE}")
+ MESSAGE (STATUS "HAVE_SZIP_DLL: ${HAVE_SZIP_DLL}")
+ MESSAGE (STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
+ENDIF (FIND_SZIP_DEBUG)
diff --git a/Resources/CheckTypeSize.cmake b/Resources/CheckTypeSize.cmake
new file mode 100644
index 0000000..2e83080
--- /dev/null
+++ b/Resources/CheckTypeSize.cmake
@@ -0,0 +1,48 @@
+#
+# Check if the type exists and determine size of type. if the type
+# exists, the size will be stored to the variable.
+#
+# CHECK_TYPE_SIZE - macro which checks the size of type
+# VARIABLE - variable to store size if the type exists.
+# HAVE_${VARIABLE} - does the variable exists or not
+#
+
+MACRO (HDF_CHECK_TYPE_SIZE TYPE VARIABLE)
+ SET (CMAKE_ALLOW_UNKNOWN_VARIABLE_READ_ACCESS 1)
+ IF ("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$")
+ SET (MACRO_CHECK_TYPE_SIZE_FLAGS
+ "-DCHECK_TYPE_SIZE_TYPE=\"${TYPE}\" ${CMAKE_REQUIRED_FLAGS}"
+ )
+ FOREACH (def HAVE_SYS_TYPES_H HAVE_STDINT_H HAVE_STDDEF_H HAVE_INTTYPES_H)
+ IF ("${def}")
+ SET (MACRO_CHECK_TYPE_SIZE_FLAGS "${MACRO_CHECK_TYPE_SIZE_FLAGS} -D${def}")
+ ENDIF("${def}")
+ ENDFOREACH (def)
+
+ MESSAGE (STATUS "Check size of ${TYPE}")
+ IF (CMAKE_REQUIRED_LIBRARIES)
+ SET (CHECK_TYPE_SIZE_ADD_LIBRARIES
+ "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}"
+ )
+ ENDIF (CMAKE_REQUIRED_LIBRARIES)
+ TRY_RUN (${VARIABLE} HAVE_${VARIABLE}
+ ${CMAKE_BINARY_DIR}
+ ${HDF5_PROJECT_DIR}/Resources/CheckTypeSize.c
+ CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_TYPE_SIZE_FLAGS}
+ "${CHECK_TYPE_SIZE_ADD_LIBRARIES}"
+ OUTPUT_VARIABLE OUTPUT
+ )
+ IF (HAVE_${VARIABLE})
+ MESSAGE (STATUS "Check size of ${TYPE} - done")
+ FILE (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeOutput.log
+ "Determining size of ${TYPE} passed with the following output:\n${OUTPUT}\n\n"
+ )
+ ELSE (HAVE_${VARIABLE})
+ MESSAGE (STATUS "Check size of ${TYPE} - failed")
+ FILE (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log
+ "Determining size of ${TYPE} failed with the following output:\n${OUTPUT}\n\n"
+ )
+ ENDIF (HAVE_${VARIABLE})
+ ENDIF ("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$")
+ SET (CMAKE_ALLOW_UNKNOWN_VARIABLE_READ_ACCESS)
+ENDMACRO (HDF_CHECK_TYPE_SIZE)
diff --git a/Resources/ConversionTests.c b/Resources/ConversionTests.c
new file mode 100644
index 0000000..0e24954
--- /dev/null
+++ b/Resources/ConversionTests.c
@@ -0,0 +1,422 @@
+#ifdef H5_FP_TO_INTEGER_OVERFLOW_WORKS_TEST
+
+int main(void)
+{
+ float f = 2147483648.0f;
+ int i;
+
+ i = (int)f;
+
+ done:
+ exit(0);
+}
+
+#endif
+
+#ifdef H5_FP_TO_ULLONG_ACCURATE_TEST
+
+int main(void)
+{
+ float f = 111.60f;
+ double d = 222.55L;
+ unsigned long long l1 = (unsigned long long)f;
+ unsigned long long l2 = (unsigned long long)d;
+ int ret = 0;
+
+ if(l1 == 112)
+ ret = 1;
+ if(l2 == 223)
+ ret = 1;
+
+ done:
+ exit(ret);
+}
+
+#endif
+
+#ifdef H5_FP_TO_ULLONG_RIGHT_MAXIMUM_TEST
+int main(void)
+{
+ float f = 9701917572145405952.00f;
+ double d1 = 9701917572145405952.00L;
+ long double d2 = 9701917572145405952.00L;
+ double d3 = 2e40L;
+ unsigned long long l1 = (unsigned long long)f;
+ unsigned long long l2 = (unsigned long long)d1;
+ unsigned long long l3 = (unsigned long long)d2;
+ unsigned long long l4;
+ unsigned long long l5 = 0x7fffffffffffffffULL;
+ int ret = 0;
+
+ if(l1 <= l5 || l2 <= l5 || l3 <= l5)
+ ret = 1;
+
+ l4 = (unsigned long long)d3;
+ if(l4 <= l5)
+ ret = 1;
+
+ done:
+ exit(ret);
+}
+
+#endif
+
+#ifdef H5_LDOUBLE_TO_INTEGER_WORKS_TEST
+int main(void)
+{
+ void *align;
+ long double ld = 9701917572145405952.00L;
+ unsigned char v1;
+ short v2;
+ unsigned int v3;
+ int ret = 0;
+
+ align = (void*) malloc(sizeof(long double));
+ memcpy(align, &ld, sizeof(long double));
+
+ /*For HU-UX11.00, there's floating exception(core dump) when doing some of casting
+ *from 'long double' to integers*/
+ v1 = (unsigned char) (*((long double*) align));
+ v2 = (short) (*((long double*) align));
+ v3 = (unsigned int) (*((long double*) align));
+
+ done: exit(ret);
+}
+
+#endif
+
+#ifdef H5_LDOUBLE_TO_LLONG_ACCURATE_TEST
+int main(void)
+{
+ long double ld = 20041683600089727.779961L;
+ long long ll;
+ unsigned long long ull;
+ unsigned char s[16];
+ int ret = 0;
+
+ if(sizeof(long double) == 16)
+ {
+ /*make sure the long double type is the same as the failing type
+ *which has 16 bytes in size and 11 bits of exponent. If it is,
+ *the bit sequence should be like below. It's not
+ *a decent way to check but this info isn't available. */
+ memcpy(s, &ld, 16);
+ if(s[0]==0x43 && s[1]==0x51 && s[2]==0xcc && s[3]==0xf3 &&
+ s[4]==0x85 && s[5]==0xeb && s[6]==0xc8 && s[7]==0xa0 &&
+ s[8]==0xbf && s[9]==0xcc && s[10]==0x2a && s[11]==0x3c)
+ {
+
+ /*slightly adjust the bit sequence (s[8]=0xdf). The converted
+ *values will go wild on Mac OS 10.4 and IRIX64 6.5.*/
+ s[0]=0x43; s[1]=0x51; s[2]=0xcc; s[3]=0xf3;
+ s[4]=0x85; s[5]=0xeb; s[6]=0xc8; s[7]=0xa0;
+ s[8]=0xdf; s[9]=0xcc; s[10]=0x2a; s[11]=0x3c;
+ s[12]=0x3d; s[13]=0x85; s[14]=0x56; s[15]=0x20;
+
+ memcpy(&ld, s, 16);
+ ll = (long long)ld;
+ ull = (unsigned long long)ld;
+
+ if(ll != 20041683600089728 || ull != 20041683600089728)
+ ret = 1;
+ }
+ }
+ done:
+ exit(ret);
+}
+#endif
+
+#ifdef H5_LDOUBLE_TO_UINT_ACCURATE_TEST
+int main(void)
+{
+ long double ld = 2733248032.9183987530L;
+ unsigned int i;
+ int ret = 0;
+
+ i = (unsigned int)ld;
+ if(i!=2733248032 && i!=2733248031 && i!=2733248033)
+ ret = 1;
+
+ done:
+ exit(ret);
+}
+#endif
+
+#ifdef H5_LLONG_TO_LDOUBLE_CORRECT_TEST
+int main(void)
+{
+ long double ld;
+ long long ll;
+ unsigned long long ull;
+ unsigned char s[16];
+ int flag=0, ret=0;
+
+ /*Determine if long double has 16 byte in size, 11 bit exponent, and
+ *the bias is 0x3ff */
+ if(sizeof(long double) == 16)
+ {
+ ld = 1.0L;
+ memcpy(s, &ld, 16);
+ if(s[0]==0x3f && s[1]==0xf0 && s[2]==0x00 && s[3]==0x00 &&
+ s[4]==0x00 && s[5]==0x00 && s[6]==0x00 && s[7]==0x00)
+ flag = 1;
+ }
+
+ if(flag==1 && sizeof(long long)==8)
+ {
+ ll = 0x01ffffffffffffffLL;
+ ld = (long double)ll;
+ memcpy(s, &ld, 16);
+ /*Check if the bit sequence is as supposed to be*/
+ if(s[0]!=0x43 || s[1]!=0x7f || s[2]!=0xff || s[3]!=0xff ||
+ s[4]!=0xff || s[5]!=0xff || s[6]!=0xff || s[7]!=0xff ||
+ s[8]!=0xf0 || s[9]!=0x00 || s[10]!=0x00 || s[11]!=0x00)
+ ret = 1;
+ }
+ if(flag==1 && sizeof(unsigned long long)==8)
+ {
+ ull = 0x01ffffffffffffffULL;
+ ld = (long double)ull;
+ memcpy(s, &ld, 16);
+ if(s[0]!=0x43 || s[1]!=0x7f || s[2]!=0xff || s[3]!=0xff ||
+ s[4]!=0xff || s[5]!=0xff || s[6]!=0xff || s[7]!=0xff ||
+ s[8]!=0xf0 || s[9]!=0x00 || s[10]!=0x00 || s[11]!=0x00)
+ ret = 1;
+ }
+ done:
+ exit(ret);
+}
+#endif
+
+#ifdef H5_NO_ALIGNMENT_RESTRICTIONS_TEST
+
+#include <stdlib.h>
+#include <string.h>
+
+typedef struct
+{
+ size_t len;
+ void *p;
+}hvl_t;
+
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+# ifdef __cplusplus
+extern "C"
+# endif
+int FC_DUMMY_MAIN()
+{ return 1;}
+#endif
+#endif
+int
+main ()
+{
+
+ char *chp = "beefs";
+ char **chpp = malloc (2 * sizeof (char *));
+ char **chpp2;
+ hvl_t vl =
+ { 12345, (void *) chp};
+ hvl_t *vlp;
+ hvl_t *vlp2;
+
+ memcpy ((void *) ((char *) chpp + 1), &chp, sizeof (char *));
+ chpp2 = (char **) ((char *) chpp + 1);
+ if (strcmp (*chpp2, chp))
+ {
+ free (chpp);
+ return 1;
+ }
+ free (chpp);
+
+ vlp = malloc (2 * sizeof (hvl_t));
+ memcpy ((void *) ((char *) vlp + 1), &vl, sizeof (hvl_t));
+ vlp2 = (hvl_t *) ((char *) vlp + 1);
+ if (vlp2->len != vl.len || vlp2->p != vl.p)
+ {
+ free (vlp);
+ return 1;
+ }
+ free (vlp);
+
+ ;
+ return 0;
+}
+
+#endif
+
+#ifdef H5_ULLONG_TO_LDOUBLE_PRECISION_TEST
+
+#include <stddef.h>
+
+
+int main(void)
+{
+ /* General variables */
+ int endian;
+ int tst_value = 1;
+ int ret = 0;
+
+ /* For FreeBSD */
+ unsigned long long l = 0xa601e80bda85fcefULL;
+ long double ld;
+ unsigned char *c1, *c2;
+ size_t size;
+
+ /* For Cygwin */
+ unsigned long long l_cyg = 0xfffffffffffffff0ULL;
+ long double ld_cyg;
+ unsigned char *c2_cyg;
+ size_t size_cyg;
+
+ /* Determine this system's endianess */
+ c1 = (unsigned char*)calloc(1, sizeof(int));
+ memcpy((void*)c1, &tst_value, sizeof(int));
+ if(c1[0]==1)
+ endian = 0; /* little endian */
+ else
+ endian = 1; /* big endian */
+
+ /* For FreeBSD */
+ size = sizeof(long double);
+ memset(&ld, 0, size);
+ ld = (long double)l;
+
+ c2 = (unsigned char*)calloc(1, size);
+ memcpy((void*)c2, &ld, size);
+
+ /* Test if the last 2 bytes of mantissa are lost. Mainly for FreeBSD on Intel
+ * architecture(sleipnir) where it happens. */
+ /*if(endian==0 && c2[0]==0 && c2[1]==0)*//*little endian*/
+ if(endian==0 && c2[0]==0)
+ { /*little endian*/
+ ret = 1;
+ goto done;
+ }
+
+ /* For Cygwin */
+ size_cyg = sizeof(long double);
+ memset(&ld_cyg, 0, size);
+ ld_cyg = (long double)l_cyg;
+
+ c2_cyg = (unsigned char*)calloc(1, size_cyg);
+ memcpy((void*)c2_cyg, &ld_cyg, size_cyg);
+
+ /* Test if the last 4 bytes(roughly) of mantissa are rounded up. Mainly for Cygwin
+ * where the values like 0xffffffffffffffff, 0xfffffffffffffffe, ...,
+ * 0xfffffffffffff000 ... are rounded up as 0x0000403f8000000000000000
+ * instead of 0x0000403effffffffffffffff, 0x0000403efffffffffffffffe, ...,
+ * 0x0000403efffffffffffff000 ...
+ */
+ if(endian==0 && c2_cyg[0]==0 && c2_cyg[1]==0 && c2_cyg[2]==0 && c2_cyg[3]==0)
+ ret = 1;
+
+ done:
+ if(c1)
+ free(c1);
+ if(c2)
+ free(c2);
+ if(c2_cyg)
+ free(c2_cyg);
+ exit(ret);
+}
+
+#endif
+
+
+#ifdef H5_ULONG_TO_FLOAT_ACCURATE_TEST
+
+int main(void)
+{
+ int ret = 0;
+ unsigned long l1;
+ unsigned long l2;
+ unsigned long l3;
+ float f1;
+ float f2;
+ float f3;
+
+
+ if(sizeof(unsigned long)==8) {
+ l1 = 0xffffffffffffffffUL;
+ l2 = 0xffffffffffff0000UL;
+ l3 = 0xf000000000000000UL;
+
+ f1 = (float)l1;
+ f2 = (float)l2;
+ f3 = (float)l3;
+
+ if((f1 < 0) || (f2 < 0) || (f3 < 0))
+ ret = 1;
+ }
+
+done:
+ exit(ret);
+}
+
+#endif
+
+#ifdef H5_ULONG_TO_FP_BOTTOM_BIT_ACCURATE_TEST
+
+#include <string.h>
+
+
+int main(void)
+{
+ unsigned long l1;
+ unsigned long l2;
+ unsigned long l3;
+ unsigned long l4;
+ unsigned long long ld1;
+ unsigned long long ld2;
+ unsigned long long ld3;
+ unsigned long long ld4;
+ double d1, d2, d3, d4;
+ unsigned char s[8];
+ int ret = 0;
+
+ if(sizeof(unsigned long)==8) {
+ l1 = 0xf000000000000b00UL; /*Round-down case*/
+ l2 = 0xf000000000000401UL; /*Round-up case*/
+ l3 = 0xf000000000000400UL; /*Round-down case*/
+ l4 = 0xf000000000000c00UL; /*Round-up case*/
+
+ d1 = (double)l1;
+ d2 = (double)l2;
+ d3 = (double)l3;
+ d4 = (double)l4;
+ } else if(sizeof(unsigned long long)==8) {
+ ld1 = 0xf000000000000b00ULL; /*Round-down case*/
+ ld2 = 0xf000000000000401ULL; /*Round-up case*/
+ ld3 = 0xf000000000000400ULL; /*Round-down case*/
+ ld4 = 0xf000000000000c00ULL; /*Round-up case*/
+
+ d1 = (double)ld1;
+ d2 = (double)ld2;
+ d3 = (double)ld3;
+ d4 = (double)ld4;
+ } else {
+ ret = 1;
+ goto done;
+ }
+
+ memcpy(s, &d1, 8);
+ if(s[7]!=1)
+ ret = 1;
+
+ memcpy(s, &d2, 8);
+ if(s[7]!=1)
+ ret = 1;
+
+ memcpy(s, &d3, 8);
+ if(s[7]!=0)
+ ret = 1;
+
+ memcpy(s, &d4, 8);
+ if(s[7]!=2)
+ ret = 1;
+
+done:
+ exit(ret);
+}
+#endif
diff --git a/Resources/GetTimeOfDayTest.cpp b/Resources/GetTimeOfDayTest.cpp
new file mode 100644
index 0000000..3b5bf60
--- /dev/null
+++ b/Resources/GetTimeOfDayTest.cpp
@@ -0,0 +1,15 @@
+#if defined (TRY_SYS_TIME_H)
+#include <sys/time.h>
+/* #include <time.h> */
+#endif
+
+
+#if defined (TRY_TIME_H)
+#include <time.h>
+#endif
+
+int main(int argc, char **argv) {
+ struct timeval t1;
+ gettimeofday(&t1, 0x00);
+ return 0;
+}
diff --git a/Resources/H5cxx_config.h.in b/Resources/H5cxx_config.h.in
new file mode 100644
index 0000000..c4e1c03
--- /dev/null
+++ b/Resources/H5cxx_config.h.in
@@ -0,0 +1,5 @@
+/* src/H5cxx_config.h.in Created manually. */
+
+/* Define if offsetof extension is present */
+#cmakedefine HAVE_OFFSETOF ${HAVE_OFFSETOF}
+
diff --git a/Resources/H5pubconf.h.in b/Resources/H5pubconf.h.in
new file mode 100644
index 0000000..3f4bdc5
--- /dev/null
+++ b/Resources/H5pubconf.h.in
@@ -0,0 +1,745 @@
+/* H5pubconf.h Generated By CMake during the configuration */
+
+#ifndef H5_CONFIG_H_
+#define H5_CONFIG_H_
+
+/* Define if the Windows virtual file driver should be compiled */
+#cmakedefine H5_HAVE_WINDOWS @H5_HAVE_WINDOWS@
+
+/* Define if the Windows virtual file driver should use buffered IO functions */
+/* #undef WINDOWS_USE_STDIO */
+
+/* Define the maximum write size for the Windows file driver. Larger writes
+ will be split into many writes. Safe values are 1 <= WINDOWS_MAX_BUF <= 2GB-1. */
+#cmakedefine WINDOWS_MAX_BUF (1024 * 1024 * 1024)
+
+/* Defined if HDF5 was built with CMake AND build as a shared library */
+#cmakedefine H5_BUILT_AS_DYNAMIC_LIB @H5_BUILT_AS_DYNAMIC_LIB@
+
+/* Defined if HDF5 CPP was built with CMake AND build as a shared library */
+#cmakedefine H5_CPP_BUILT_AS_DYNAMIC_LIB @H5_CPP_BUILT_AS_DYNAMIC_LIB@
+
+/* Defined if HDF5 HL was built with CMake AND build as a shared library */
+#cmakedefine H5_HL_BUILT_AS_DYNAMIC_LIB @H5_HL_BUILT_AS_DYNAMIC_LIB@
+
+/* Define if building universal (internal helper macro) */
+#cmakedefine H5_AC_APPLE_UNIVERSAL_BUILD @H5_AC_APPLE_UNIVERSAL_BUILD@
+
+/* Define if your system generates wrong code for log2 routine. */
+#cmakedefine H5_BAD_LOG2_CODE_GENERATED @H5_BAD_LOG2_CODE_GENERATED@
+
+/* Define if the memory buffers being written to disk should be cleared before
+ writing. */
+#cmakedefine H5_CLEAR_MEMORY @H5_CLEAR_MEMORY@
+
+/* Define if your system can handle converting denormalized floating-point
+ values. */
+#cmakedefine H5_CONVERT_DENORMAL_FLOAT @H5_CONVERT_DENORMAL_FLOAT@
+
+/* Define if C++ compiler recognizes offsetof */
+#cmakedefine H5_CXX_HAVE_OFFSETOF @H5_CXX_HAVE_OFFSETOF@
+
+/* Define the default virtual file driver to compile */
+#cmakedefine H5_DEFAULT_VFD @H5_DEFAULT_VFD@
+
+/* Define if `dev_t' is a scalar */
+#cmakedefine H5_DEV_T_IS_SCALAR @H5_DEV_T_IS_SCALAR@
+
+/* Define to dummy `main' function (if any) required to link to the Fortran
+ libraries. */
+#cmakedefine H5_FC_DUMMY_MAIN @H5_FC_DUMMY_MAIN@
+
+/* Define if F77 and FC dummy `main' functions are identical. */
+#cmakedefine H5_FC_DUMMY_MAIN_EQ_F77 @H5_FC_DUMMY_MAIN_EQ_F77@
+
+/* Define to a macro mangling the given C identifier (in lower and upper
+ case), which must not contain underscores, for linking with Fortran. */
+#define @H5_FC_FUNC@
+
+/* As FC_FUNC, but for C identifiers containing underscores. */
+#define @H5_FC_FUNC_@
+
+/* Define if your system can handle overflow converting floating-point to
+ integer values. */
+#cmakedefine H5_FP_TO_INTEGER_OVERFLOW_WORKS @H5_FP_TO_INTEGER_OVERFLOW_WORKS@
+
+/* Define if your system roundup accurately converting floating-point to
+ unsigned long long values. */
+#cmakedefine H5_FP_TO_ULLONG_ACCURATE @H5_FP_TO_ULLONG_ACCURATE@
+
+/* Define if your system has right maximum convert floating-point to unsigned
+ long long values. */
+#cmakedefine H5_FP_TO_ULLONG_RIGHT_MAXIMUM @H5_FP_TO_ULLONG_RIGHT_MAXIMUM@
+
+/* Define if gettimeofday() populates the tz pointer passed in */
+#cmakedefine H5_GETTIMEOFDAY_GIVES_TZ @H5_GETTIMEOFDAY_GIVES_TZ@
+
+/* Define to 1 if you have the `alarm' function. */
+#cmakedefine H5_HAVE_ALARM @H5_HAVE_ALARM@
+
+/* Define if the __attribute__(()) extension is present */
+#cmakedefine H5_HAVE_ATTRIBUTE @H5_HAVE_ATTRIBUTE@
+
+/* Define to 1 if you have the `BSDgettimeofday' function. */
+#cmakedefine H5_HAVE_BSDGETTIMEOFDAY @H5_HAVE_BSDGETTIMEOFDAY@
+
+/* Define if the compiler understands C99 designated initialization of structs
+ and unions */
+#cmakedefine H5_HAVE_C99_DESIGNATED_INITIALIZER @H5_HAVE_C99_DESIGNATED_INITIALIZER@
+
+/* Define if the compiler understands the __func__ keyword */
+#cmakedefine H5_HAVE_C99_FUNC @H5_HAVE_C99_FUNC@
+
+/* Define if the function stack tracing code is to be compiled in */
+#cmakedefine H5_HAVE_CODESTACK @H5_HAVE_CODESTACK@
+
+/* Define to 1 if you have the declaration of `tzname', and to 0 if you don't.
+ */
+#cmakedefine H5_HAVE_DECL_TZNAME @H5_HAVE_DECL_TZNAME@
+
+/* Define to 1 if you have the `difftime' function. */
+#cmakedefine H5_HAVE_DIFFTIME @H5_HAVE_DIFFTIME@
+
+/* Define if the direct I/O virtual file driver should be compiled */
+#cmakedefine H5_HAVE_DIRECT @H5_HAVE_DIRECT@
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#cmakedefine H5_HAVE_DLFCN_H @H5_HAVE_DLFCN_H@
+
+/* Define to 1 if you have the <dmalloc.h> header file. */
+#cmakedefine H5_HAVE_DMALLOC_H @H5_HAVE_DMALLOC_H@
+
+/* Define if library information should be embedded in the executables */
+#cmakedefine H5_HAVE_EMBEDDED_LIBINFO @H5_HAVE_EMBEDDED_LIBINFO@
+
+/* Define to 1 if you have the <features.h> header file. */
+#cmakedefine H5_HAVE_FEATURES_H @H5_HAVE_FEATURES_H@
+
+/* Define if support for deflate (zlib) filter is enabled */
+#cmakedefine H5_HAVE_FILTER_DEFLATE @H5_HAVE_FILTER_DEFLATE@
+
+/* Define if support for Fletcher32 checksum is enabled */
+#cmakedefine H5_HAVE_FILTER_FLETCHER32 @H5_HAVE_FILTER_FLETCHER32@
+
+/* Define if support for nbit filter is enabled */
+#cmakedefine H5_HAVE_FILTER_NBIT @H5_HAVE_FILTER_NBIT@
+
+/* Define if support for scaleoffset filter is enabled */
+#cmakedefine H5_HAVE_FILTER_SCALEOFFSET @H5_HAVE_FILTER_SCALEOFFSET@
+
+/* Define if support for shuffle filter is enabled */
+#cmakedefine H5_HAVE_FILTER_SHUFFLE @H5_HAVE_FILTER_SHUFFLE@
+
+/* Define if support for szip filter is enabled */
+#cmakedefine H5_HAVE_FILTER_SZIP @H5_HAVE_FILTER_SZIP@
+
+/* Define to 1 if you have the `fork' function. */
+#cmakedefine H5_HAVE_FORK @H5_HAVE_FORK@
+
+/* Define to 1 if you have the `frexpf' function. */
+#cmakedefine H5_HAVE_FREXPF @H5_HAVE_FREXPF@
+
+/* Define to 1 if you have the `frexpl' function. */
+#cmakedefine H5_HAVE_FREXPL @H5_HAVE_FREXPL@
+
+/* Define to 1 if you have the `fseek64' function. */
+#cmakedefine H5_HAVE_FSEEK64 @H5_HAVE_FSEEK64@
+
+/* Define to 1 if you have the `fseeko' function. */
+#cmakedefine H5_HAVE_FSEEKO @H5_HAVE_FSEEKO@
+
+/* Define to 1 if you have the `fstat64' function. */
+#cmakedefine H5_HAVE_FSTAT64 @H5_HAVE_FSTAT64@
+
+/* Define to 1 if you have the `ftello' function. */
+#cmakedefine H5_HAVE_FTELLO @H5_HAVE_FTELLO@
+
+/* Define to 1 if you have the `ftruncate64' function. */
+#cmakedefine H5_HAVE_FTRUNCATE64 @H5_HAVE_FTRUNCATE64@
+
+/* Define if the compiler understands the __FUNCTION__ keyword */
+#cmakedefine H5_HAVE_FUNCTION @H5_HAVE_FUNCTION@
+
+/* Define to 1 if you have the `GetConsoleScreenBufferInfo' function. */
+#cmakedefine H5_HAVE_GETCONSOLESCREENBUFFERINFO @H5_HAVE_GETCONSOLESCREENBUFFERINFO@
+
+/* Define to 1 if you have the `gethostname' function. */
+#cmakedefine H5_HAVE_GETHOSTNAME @H5_HAVE_GETHOSTNAME@
+
+/* Define to 1 if you have the `getpwuid' function. */
+#cmakedefine H5_HAVE_GETPWUID @H5_HAVE_GETPWUID@
+
+/* Define to 1 if you have the `getrusage' function. */
+#cmakedefine H5_HAVE_GETRUSAGE @H5_HAVE_GETRUSAGE@
+
+/* Define to 1 if you have the `gettextinfo' function. */
+#cmakedefine H5_HAVE_GETTEXTINFO @H5_HAVE_GETTEXTINFO@
+
+/* Define to 1 if you have the `gettimeofday' function. */
+#cmakedefine H5_HAVE_GETTIMEOFDAY @H5_HAVE_GETTIMEOFDAY@
+
+/* Define to 1 if you have the `gettimeofday' function declared in time.h . */
+#cmakedefine H5_HAVE_TIME_GETTIMEOFDAY @H5_HAVE_TIME_GETTIMEOFDAY@
+
+/* Define to 1 if you have the `gettimeofday' function declared in time.h . */
+#cmakedefine H5_HAVE_SYS_TIME_GETTIMEOFDAY @H5_HAVE_SYS_TIME_GETTIMEOFDAY@
+
+/* Define to 1 if you have the `get_fpc_csr' function. */
+#cmakedefine H5_HAVE_GET_FPC_CSR @H5_HAVE_GET_FPC_CSR@
+
+/* Define if we have GPFS support */
+#cmakedefine H5_HAVE_GPFS @H5_HAVE_GPFS@
+
+/* Define to 1 if you have the <gpfs.h> header file. */
+#cmakedefine H5_HAVE_GPFS_H @H5_HAVE_GPFS_H@
+
+/* Define if h5dump packed bits feature is enabled */
+#cmakedefine H5_HAVE_H5DUMP_PACKED_BITS @H5_HAVE_H5DUMP_PACKED_BITS@
+
+/* Define if library will contain instrumentation to detect correct
+ optimization operation */
+#cmakedefine H5_HAVE_INSTRUMENTED_LIBRARY @H5_HAVE_INSTRUMENTED_LIBRARY@
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#cmakedefine H5_HAVE_INTTYPES_H @H5_HAVE_INTTYPES_H@
+
+/* Define to 1 if you have the `ioctl' function. */
+#cmakedefine H5_HAVE_IOCTL @H5_HAVE_IOCTL@
+
+/* Define to 1 if you have the <io.h> header file. */
+#cmakedefine H5_HAVE_IO_H @H5_HAVE_IO_H@
+
+/* Define to 1 if you have the `dmalloc' library (-ldmalloc). */
+#cmakedefine H5_HAVE_LIBDMALLOC @H5_HAVE_LIBDMALLOC@
+
+/* Define to 1 if you have the `lmpe' library (-llmpe). */
+#cmakedefine H5_HAVE_LIBLMPE @H5_HAVE_LIBLMPE@
+
+/* Define to 1 if you have the `m' library (-lm). */
+#cmakedefine H5_HAVE_LIBM @H5_HAVE_LIBM@
+
+/* Define to 1 if you have the `mpe' library (-lmpe). */
+#cmakedefine H5_HAVE_LIBMPE @H5_HAVE_LIBMPE@
+
+/* Define to 1 if you have the `mpi' library (-lmpi). */
+#cmakedefine H5_HAVE_LIBMPI @H5_HAVE_LIBMPI@
+
+/* Define to 1 if you have the `mpich' library (-lmpich). */
+#cmakedefine H5_HAVE_LIBMPICH @H5_HAVE_LIBMPICH@
+
+/* Define to 1 if you have the `mpio' library (-lmpio). */
+#cmakedefine H5_HAVE_LIBMPIO @H5_HAVE_LIBMPIO@
+
+/* Define to 1 if you have the `nsl' library (-lnsl). */
+#cmakedefine H5_HAVE_LIBNSL @H5_HAVE_LIBNSL@
+
+/* Define to 1 if you have the `pthread' library (-lpthread). */
+#cmakedefine H5_HAVE_LIBPTHREAD @H5_HAVE_LIBPTHREAD@
+
+/* Define to 1 if you have the `socket' library (-lsocket). */
+#cmakedefine H5_HAVE_LIBSOCKET @H5_HAVE_LIBSOCKET@
+
+/* Define to 1 if you have the `sz' library (-lsz). */
+#cmakedefine H5_HAVE_LIBSZ @H5_HAVE_LIBSZ@
+
+/* Define to 1 if you have the `z' library (-lz). */
+#cmakedefine H5_HAVE_LIBZ @H5_HAVE_LIBZ@
+
+/* Define to 1 if you have the `longjmp' function. */
+#cmakedefine H5_HAVE_LONGJMP @H5_HAVE_LONGJMP@
+
+/* Define to 1 if you have the `lseek64' function. */
+#cmakedefine H5_HAVE_LSEEK64 @H5_HAVE_LSEEK64@
+
+/* Define to 1 if you have the `lstat' function. */
+#cmakedefine H5_HAVE_LSTAT @H5_HAVE_LSTAT@
+
+/* Define to 1 if you have the <memory.h> header file. */
+#cmakedefine H5_HAVE_MEMORY_H @H5_HAVE_MEMORY_H@
+
+/* Define if we have MPE support */
+#cmakedefine H5_HAVE_MPE @H5_HAVE_MPE@
+
+/* Define to 1 if you have the <mpe.h> header file. */
+#cmakedefine H5_HAVE_MPE_H @H5_HAVE_MPE_H@
+
+/* Define if MPI_File_get_size works correctly */
+#cmakedefine H5_HAVE_MPI_GET_SIZE @H5_HAVE_MPI_GET_SIZE@
+
+/* Define if `MPI_Comm_c2f' and `MPI_Comm_f2c' exists */
+#cmakedefine H5_HAVE_MPI_MULTI_LANG_Comm @H5_HAVE_MPI_MULTI_LANG_Comm@
+
+/* Define if `MPI_Info_c2f' and `MPI_Info_f2c' exists */
+#cmakedefine H5_HAVE_MPI_MULTI_LANG_Info @H5_HAVE_MPI_MULTI_LANG_Info@
+
+/* Define if we have parallel support */
+#cmakedefine H5_HAVE_PARALLEL @H5_HAVE_PARALLEL@
+
+/* Define to 1 if you have the <pthread.h> header file. */
+#cmakedefine H5_HAVE_PTHREAD_H @H5_HAVE_PTHREAD_H@
+
+/* Define to 1 if you have the `random' function. */
+#cmakedefine H5_HAVE_RANDOM @H5_HAVE_RANDOM@
+
+/* Define to 1 if you have the `rand_r' function. */
+#cmakedefine H5_HAVE_RAND_R @H5_HAVE_RAND_R@
+
+/* Define to 1 if you have the <setjmp.h> header file. */
+#cmakedefine H5_HAVE_SETJMP_H @H5_HAVE_SETJMP_H@
+
+/* Define to 1 if you have the `setsysinfo' function. */
+#cmakedefine H5_HAVE_SETSYSINFO @H5_HAVE_SETSYSINFO@
+
+/* Define to 1 if you have the `sigaction' function. */
+#cmakedefine H5_HAVE_SIGACTION @H5_HAVE_SIGACTION@
+
+/* Define to 1 if you have the `siglongjmp' function. */
+#cmakedefine H5_HAVE_SIGLONGJMP @H5_HAVE_SIGLONGJMP@
+
+/* Define to 1 if you have the `signal' function. */
+#cmakedefine H5_HAVE_SIGNAL @H5_HAVE_SIGNAL@
+
+/* Define to 1 if you have the `snprintf' function. */
+#cmakedefine H5_HAVE_SNPRINTF @H5_HAVE_SNPRINTF@
+
+/* Define to 1 if you have the `srandom' function. */
+#cmakedefine H5_HAVE_SRANDOM @H5_HAVE_SRANDOM@
+
+/* Define to 1 if you have the `stat64' function. */
+#cmakedefine H5_HAVE_STAT64 @H5_HAVE_STAT64@
+
+/* Define if `struct stat' has the `st_blocks' field */
+#cmakedefine H5_HAVE_STAT_ST_BLOCKS @H5_HAVE_STAT_ST_BLOCKS@
+
+/* Define to 1 if you have the <stddef.h> header file. */
+#cmakedefine H5_HAVE_STDDEF_H @H5_HAVE_STDDEF_H@
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#cmakedefine H5_HAVE_STDINT_H @H5_HAVE_STDINT_H@
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#cmakedefine H5_HAVE_STDLIB_H @H5_HAVE_STDLIB_H@
+
+/* Define to 1 if you have the `strdup' function. */
+#cmakedefine H5_HAVE_STRDUP @H5_HAVE_STRDUP@
+
+/* Define to 1 if you have the <strings.h> header file. */
+#cmakedefine H5_HAVE_STRINGS_H @H5_HAVE_STRINGS_H@
+
+/* Define to 1 if you have the <string.h> header file. */
+#cmakedefine H5_HAVE_STRING_H @H5_HAVE_STRING_H@
+
+/* Define if `struct text_info' is defined */
+#cmakedefine H5_HAVE_STRUCT_TEXT_INFO @H5_HAVE_STRUCT_TEXT_INFO@
+
+/* Define if `struct timezone' is defined */
+#cmakedefine H5_HAVE_STRUCT_TIMEZONE @H5_HAVE_STRUCT_TIMEZONE@
+
+/* Define to 1 if `struct tm' is a member of `tm_zone'. */
+#cmakedefine H5_HAVE_STRUCT_TM_TM_ZONE @H5_HAVE_STRUCT_TM_TM_ZONE@
+
+/* Define if `struct videoconfig' is defined */
+#cmakedefine H5_HAVE_STRUCT_VIDEOCONFIG @H5_HAVE_STRUCT_VIDEOCONFIG@
+
+/* Define to 1 if you have the `symlink' function. */
+#cmakedefine H5_HAVE_SYMLINK @H5_HAVE_SYMLINK@
+
+/* Define to 1 if you have the `system' function. */
+#cmakedefine H5_HAVE_SYSTEM @H5_HAVE_SYSTEM@
+
+/* Define to 1 if you have the <sys/fpu.h> header file. */
+#cmakedefine H5_HAVE_SYS_FPU_H @H5_HAVE_SYS_FPU_H@
+
+/* Define to 1 if you have the <sys/ioctl.h> header file. */
+#cmakedefine H5_HAVE_SYS_IOCTL_H @H5_HAVE_SYS_IOCTL_H@
+
+/* Define to 1 if you have the <sys/proc.h> header file. */
+#cmakedefine H5_HAVE_SYS_PROC_H @H5_HAVE_SYS_PROC_H@
+
+/* Define to 1 if you have the <sys/resource.h> header file. */
+#cmakedefine H5_HAVE_SYS_RESOURCE_H @H5_HAVE_SYS_RESOURCE_H@
+
+/* Define to 1 if you have the <sys/socket.h> header file. */
+#cmakedefine H5_HAVE_SYS_SOCKET_H @H5_HAVE_SYS_SOCKET_H@
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#cmakedefine H5_HAVE_SYS_STAT_H @H5_HAVE_SYS_STAT_H@
+
+/* Define to 1 if you have the <sys/sysinfo.h> header file. */
+#cmakedefine H5_HAVE_SYS_SYSINFO_H @H5_HAVE_SYS_SYSINFO_H@
+
+/* Define to 1 if you have the <sys/timeb.h> header file. */
+#cmakedefine H5_HAVE_SYS_TIMEB_H @H5_HAVE_SYS_TIMEB_H@
+
+/* Define to 1 if you have the <time.h> header file. */
+#cmakedefine H5_HAVE_TIME_H @H5_HAVE_TIME_H@
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#cmakedefine H5_HAVE_SYS_TIME_H @H5_HAVE_SYS_TIME_H@
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#cmakedefine H5_HAVE_SYS_TYPES_H @H5_HAVE_SYS_TYPES_H@
+
+/* Define to 1 if you have the <szlib.h> header file. */
+#cmakedefine H5_HAVE_SZLIB_H @H5_HAVE_SZLIB_H@
+
+/* Define if we have thread safe support */
+#cmakedefine H5_HAVE_THREADSAFE @H5_HAVE_THREADSAFE@
+
+/* Define if `timezone' is a global variable */
+#cmakedefine H5_HAVE_TIMEZONE @H5_HAVE_TIMEZONE@
+
+/* Define if the ioctl TIOCGETD is defined */
+#cmakedefine H5_HAVE_TIOCGETD @H5_HAVE_TIOCGETD@
+
+/* Define if the ioctl TIOGWINSZ is defined */
+#cmakedefine H5_HAVE_TIOCGWINSZ @H5_HAVE_TIOCGWINSZ@
+
+/* Define to 1 if you have the `tmpfile' function. */
+#cmakedefine H5_HAVE_TMPFILE @H5_HAVE_TMPFILE@
+
+/* Define if `tm_gmtoff' is a member of `struct tm' */
+#cmakedefine H5_HAVE_TM_GMTOFF @H5_HAVE_TM_GMTOFF@
+
+/* Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use
+ `HAVE_STRUCT_TM_TM_ZONE' instead. */
+#cmakedefine H5_HAVE_TM_ZONE @H5_HAVE_TM_ZONE@
+
+/* Define to 1 if you don't have `tm_zone' but do have the external array
+ `tzname'. */
+#cmakedefine H5_HAVE_TZNAME @H5_HAVE_TZNAME@
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#cmakedefine H5_HAVE_UNISTD_H @H5_HAVE_UNISTD_H@
+
+/* Define to 1 if you have the `vasprintf' function. */
+#cmakedefine H5_HAVE_VASPRINTF @H5_HAVE_VASPRINTF@
+
+/* Define to 1 if you have the `vsnprintf' function. */
+#cmakedefine H5_HAVE_VSNPRINTF @H5_HAVE_VSNPRINTF@
+
+/* Define to 1 if you have the `waitpid' function. */
+#cmakedefine H5_HAVE_WAITPID @H5_HAVE_WAITPID@
+
+/* Define if your system has window style path name. */
+#cmakedefine H5_HAVE_WINDOW_PATH @H5_HAVE_WINDOW_PATH@
+
+/* Define to 1 if you have the <winsock.h> header file. */
+#cmakedefine H5_HAVE_WINSOCK_H @H5_HAVE_WINSOCK_H@
+
+/* Define to 1 if you have the <zlib.h> header file. */
+#cmakedefine H5_HAVE_ZLIB_H @H5_HAVE_ZLIB_H@
+
+/* Define to 1 if you have the `_getvideoconfig' function. */
+#cmakedefine H5_HAVE__GETVIDEOCONFIG @H5_HAVE__GETVIDEOCONFIG@
+
+/* Define to 1 if you have the `_scrsize' function. */
+#cmakedefine H5_HAVE__SCRSIZE @H5_HAVE__SCRSIZE@
+
+/* Define if `__tm_gmtoff' is a member of `struct tm' */
+#cmakedefine H5_HAVE___TM_GMTOFF @H5_HAVE___TM_GMTOFF@
+
+/* Define if your system can't handle converting floating-point values to long
+ long. */
+#cmakedefine H5_HW_FP_TO_LLONG_NOT_WORKS @H5_HW_FP_TO_LLONG_NOT_WORKS@
+
+/* Define if HDF5's high-level library headers should be included in hdf5.h */
+#cmakedefine H5_INCLUDE_HL @H5_INCLUDE_HL@
+
+/* Define if your system can accurately convert from integers to long double
+ values. */
+#cmakedefine H5_INTEGER_TO_LDOUBLE_ACCURATE @H5_INTEGER_TO_LDOUBLE_ACCURATE@
+
+/* Define if your system can convert long double to integers accurately. */
+#cmakedefine H5_LDOUBLE_TO_INTEGER_ACCURATE @H5_LDOUBLE_TO_INTEGER_ACCURATE@
+
+/* Define if your system can convert from long double to integer values. */
+#cmakedefine H5_LDOUBLE_TO_INTEGER_WORKS @H5_LDOUBLE_TO_INTEGER_WORKS@
+
+/* Define if your system can convert long double to (unsigned) long long
+ values correctly. */
+#cmakedefine H5_LDOUBLE_TO_LLONG_ACCURATE @H5_LDOUBLE_TO_LLONG_ACCURATE@
+
+/* Define if your system can convert long double to unsigned int values
+ correctly. */
+#cmakedefine H5_LDOUBLE_TO_UINT_ACCURATE @H5_LDOUBLE_TO_UINT_ACCURATE@
+
+/* Define if your system can compile long long to floating-point casts. */
+#cmakedefine H5_LLONG_TO_FP_CAST_WORKS @H5_LLONG_TO_FP_CAST_WORKS@
+
+/* Define if your system can convert (unsigned) long long to long double
+ values correctly. */
+#cmakedefine H5_LLONG_TO_LDOUBLE_CORRECT @H5_LLONG_TO_LDOUBLE_CORRECT@
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+ */
+#cmakedefine H5_LT_OBJDIR @H5_LT_OBJDIR@
+
+/* Define if the metadata trace file code is to be compiled in */
+#cmakedefine H5_METADATA_TRACE_FILE @H5_METADATA_TRACE_FILE@
+
+/* Define if your system can handle complicated MPI derived datatype
+ correctly. */
+#cmakedefine H5_MPI_COMPLEX_DERIVED_DATATYPE_WORKS @H5_MPI_COMPLEX_DERIVED_DATATYPE_WORKS@
+
+/* Define if your system's `MPI_File_set_size' function works for files over
+ 2GB. */
+#cmakedefine H5_MPI_FILE_SET_SIZE_BIG @H5_MPI_FILE_SET_SIZE_BIG@
+
+/* Define if your system can handle special collective IO properly. */
+#cmakedefine H5_MPI_SPECIAL_COLLECTIVE_IO_WORKS @H5_MPI_SPECIAL_COLLECTIVE_IO_WORKS@
+
+/* Define if we can violate pointer alignment restrictions */
+#cmakedefine H5_NO_ALIGNMENT_RESTRICTIONS @H5_NO_ALIGNMENT_RESTRICTIONS@
+
+/* Define if deprecated public API symbols are disabled */
+#cmakedefine H5_NO_DEPRECATED_SYMBOLS @H5_NO_DEPRECATED_SYMBOLS@
+
+/* Define if shared writing must be disabled (CodeWarrior only) */
+#cmakedefine H5_NO_SHARED_WRITING @H5_NO_SHARED_WRITING@
+
+/* Name of package */
+#define H5_PACKAGE "@HDF5_PACKAGE@"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define H5_PACKAGE_BUGREPORT "@HDF5_PACKAGE_BUGREPORT@"
+
+/* Define to the full name of this package. */
+#define H5_PACKAGE_NAME "@HDF5_PACKAGE_NAME@"
+
+/* Define to the full name and version of this package. */
+#define H5_PACKAGE_STRING "@HDF5_PACKAGE_STRING@"
+
+/* Define to the one symbol short name of this package. */
+#define H5_PACKAGE_TARNAME "@HDF5_PACKAGE_TARNAME@"
+
+/* Define to the home page for this package. */
+#define H5_PACKAGE_URL "@HDF5_PACKAGE_URL@"
+
+/* Define to the version of this package. */
+#define H5_PACKAGE_VERSION "@HDF5_PACKAGE_VERSION@"
+
+/* Width for printf() for type `long long' or `__int64', use `ll' */
+#cmakedefine H5_PRINTF_LL_WIDTH @H5_PRINTF_LL_WIDTH@
+
+/* The size of `char', as computed by sizeof. */
+#define H5_SIZEOF_CHAR @H5_SIZEOF_CHAR@
+
+/* The size of `double', as computed by sizeof. */
+#define H5_SIZEOF_DOUBLE @H5_SIZEOF_DOUBLE@
+
+/* The size of `float', as computed by sizeof. */
+#define H5_SIZEOF_FLOAT @H5_SIZEOF_FLOAT@
+
+/* The size of `int', as computed by sizeof. */
+#define H5_SIZEOF_INT @H5_SIZEOF_INT@
+
+/* The size of `int16_t', as computed by sizeof. */
+#define H5_SIZEOF_INT16_T @H5_SIZEOF_INT16_T@
+
+/* The size of `int32_t', as computed by sizeof. */
+#define H5_SIZEOF_INT32_T @H5_SIZEOF_INT32_T@
+
+/* The size of `int64_t', as computed by sizeof. */
+#define H5_SIZEOF_INT64_T @H5_SIZEOF_INT64_T@
+
+/* The size of `int8_t', as computed by sizeof. */
+#define H5_SIZEOF_INT8_T @H5_SIZEOF_INT8_T@
+
+/* The size of `int_fast16_t', as computed by sizeof. */
+#define H5_SIZEOF_INT_FAST16_T @H5_SIZEOF_INT_FAST16_T@
+
+/* The size of `int_fast32_t', as computed by sizeof. */
+#define H5_SIZEOF_INT_FAST32_T @H5_SIZEOF_INT_FAST32_T@
+
+/* The size of `int_fast64_t', as computed by sizeof. */
+#define H5_SIZEOF_INT_FAST64_T @H5_SIZEOF_INT_FAST64_T@
+
+/* The size of `int_fast8_t', as computed by sizeof. */
+#define H5_SIZEOF_INT_FAST8_T @H5_SIZEOF_INT_FAST8_T@
+
+/* The size of `int_least16_t', as computed by sizeof. */
+#define H5_SIZEOF_INT_LEAST16_T @H5_SIZEOF_INT_LEAST16_T@
+
+/* The size of `int_least32_t', as computed by sizeof. */
+#define H5_SIZEOF_INT_LEAST32_T @H5_SIZEOF_INT_LEAST32_T@
+
+/* The size of `int_least64_t', as computed by sizeof. */
+#define H5_SIZEOF_INT_LEAST64_T @H5_SIZEOF_INT_LEAST64_T@
+
+/* The size of `int_least8_t', as computed by sizeof. */
+#define H5_SIZEOF_INT_LEAST8_T @H5_SIZEOF_INT_LEAST8_T@
+
+#if !defined(__APPLE__)
+/* The size of `size_t', as computed by sizeof. */
+#define H5_SIZEOF_SIZE_T @H5_SIZEOF_SIZE_T@
+
+/* The size of `ssize_t', as computed by sizeof. */
+#define H5_SIZEOF_SSIZE_T @H5_SIZEOF_SSIZE_T@
+
+/* The size of `long', as computed by sizeof. */
+#define H5_SIZEOF_LONG @H5_SIZEOF_LONG@
+
+#else
+ # if defined(__LP64__) && __LP64__
+ #define H5_SIZEOF_LONG 8
+ #define H5_SIZEOF_SIZE_T 8
+ #define H5_SIZEOF_SSIZE_T 8
+ # else
+ #define H5_SIZEOF_LONG 4
+ #define H5_SIZEOF_SIZE_T 4
+ #define H5_SIZEOF_SSIZE_T 4
+ # endif
+
+#endif
+
+/* The size of `long double', as computed by sizeof. */
+#define H5_SIZEOF_LONG_DOUBLE @H5_SIZEOF_LONG_DOUBLE@
+
+/* Define size of long long and/or __int64 bit integer type only if the type
+ exists. */
+#if !defined(__APPLE__)
+ #define H5_SIZEOF_LONG_LONG @H5_SIZEOF_LONG_LONG@
+#else
+ #define H5_SIZEOF_LONG_LONG 8
+#endif
+
+/* The size of `off64_t', as computed by sizeof. */
+#define H5_SIZEOF_OFF64_T @H5_SIZEOF_OFF64_T@
+
+/* The size of `off_t', as computed by sizeof. */
+#define H5_SIZEOF_OFF_T @H5_SIZEOF_OFF_T@
+
+/* The size of `short', as computed by sizeof. */
+#define H5_SIZEOF_SHORT @H5_SIZEOF_SHORT@
+
+/* The size of `uint16_t', as computed by sizeof. */
+#define H5_SIZEOF_UINT16_T @H5_SIZEOF_UINT16_T@
+
+/* The size of `uint32_t', as computed by sizeof. */
+#define H5_SIZEOF_UINT32_T @H5_SIZEOF_UINT32_T@
+
+/* The size of `uint64_t', as computed by sizeof. */
+#define H5_SIZEOF_UINT64_T @H5_SIZEOF_UINT64_T@
+
+/* The size of `uint8_t', as computed by sizeof. */
+#define H5_SIZEOF_UINT8_T @H5_SIZEOF_UINT8_T@
+
+/* The size of `uint_fast16_t', as computed by sizeof. */
+#define H5_SIZEOF_UINT_FAST16_T @H5_SIZEOF_UINT_FAST16_T@
+
+/* The size of `uint_fast32_t', as computed by sizeof. */
+#define H5_SIZEOF_UINT_FAST32_T @H5_SIZEOF_UINT_FAST32_T@
+
+/* The size of `uint_fast64_t', as computed by sizeof. */
+#define H5_SIZEOF_UINT_FAST64_T @H5_SIZEOF_UINT_FAST64_T@
+
+/* The size of `uint_fast8_t', as computed by sizeof. */
+#define H5_SIZEOF_UINT_FAST8_T @H5_SIZEOF_UINT_FAST8_T@
+
+/* The size of `uint_least16_t', as computed by sizeof. */
+#define H5_SIZEOF_UINT_LEAST16_T @H5_SIZEOF_UINT_LEAST16_T@
+
+/* The size of `uint_least32_t', as computed by sizeof. */
+#define H5_SIZEOF_UINT_LEAST32_T @H5_SIZEOF_UINT_LEAST32_T@
+
+/* The size of `uint_least64_t', as computed by sizeof. */
+#define H5_SIZEOF_UINT_LEAST64_T @H5_SIZEOF_UINT_LEAST64_T@
+
+/* The size of `uint_least8_t', as computed by sizeof. */
+#define H5_SIZEOF_UINT_LEAST8_T @H5_SIZEOF_UINT_LEAST8_T@
+
+/* The size of `unsigned', as computed by sizeof. */
+#define H5_SIZEOF_UNSIGNED @H5_SIZEOF_UNSIGNED@
+
+/* The size of `__int64', as computed by sizeof. */
+#define H5_SIZEOF___INT64 @H5_SIZEOF___INT64@
+
+/* Define to 1 if you have the ANSI C header files. */
+#cmakedefine H5_STDC_HEADERS @H5_STDC_HEADERS@
+
+/* Define if strict file format checks are enabled */
+#cmakedefine H5_STRICT_FORMAT_CHECKS @H5_STRICT_FORMAT_CHECKS@
+
+/* Define if your system supports pthread_attr_setscope(&attribute,
+ PTHREAD_SCOPE_SYSTEM) call. */
+#cmakedefine H5_SYSTEM_SCOPE_THREADS @H5_SYSTEM_SCOPE_THREADS@
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+#cmakedefine H5_TIME_WITH_SYS_TIME @H5_TIME_WITH_SYS_TIME@
+
+/* Define to 1 if your <sys/time.h> declares `struct tm'. */
+#cmakedefine H5_TM_IN_SYS_TIME @H5_TM_IN_SYS_TIME@
+
+/* Define if your system can compile unsigned long long to floating-point
+ casts. */
+#cmakedefine H5_ULLONG_TO_FP_CAST_WORKS @H5_ULLONG_TO_FP_CAST_WORKS@
+
+/* Define if your system can convert unsigned long long to long double with
+ correct precision. */
+#cmakedefine H5_ULLONG_TO_LDOUBLE_PRECISION @H5_ULLONG_TO_LDOUBLE_PRECISION@
+
+/* Define if your system accurately converting unsigned long to float values.
+ */
+#cmakedefine H5_ULONG_TO_FLOAT_ACCURATE @H5_ULONG_TO_FLOAT_ACCURATE@
+
+/* Define if your system can accurately convert unsigned (long) long values to
+ floating-point values. */
+#cmakedefine H5_ULONG_TO_FP_BOTTOM_BIT_ACCURATE @H5_ULONG_TO_FP_BOTTOM_BIT_ACCURATE@
+
+/* Define using v1.6 public API symbols by default */
+#cmakedefine H5_USE_16_API_DEFAULT @H5_USE_16_API_DEFAULT@
+
+/* Define if a memory checking tool will be used on the library, to cause
+ library to be very picky about memory operations and also disable the
+ internal free list manager code. */
+#cmakedefine H5_USING_MEMCHECKER @H5_USING_MEMCHECKER@
+
+/* Version number of package */
+#define VERSION "@HDF5_PACKAGE_VERSION@"
+
+/* Define if vsnprintf() returns the correct value for formatted strings that
+ don't fit into size allowed */
+#cmakedefine H5_VSNPRINTF_WORKS @H5_VSNPRINTF_WORKS@
+
+/* Data accuracy is prefered to speed during data conversions */
+#cmakedefine H5_WANT_DATA_ACCURACY @H5_WANT_DATA_ACCURACY@
+
+/* Check exception handling functions during data conversions */
+#cmakedefine H5_WANT_DCONV_EXCEPTION @H5_WANT_DCONV_EXCEPTION@
+
+/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
+ significant byte first (like Motorola and SPARC, unlike Intel). */
+#if !defined(__APPLE__)
+# ifndef WORDS_BIGENDIAN
+# undef WORDS_BIGENDIAN
+# endif
+#else
+# if defined __BIG_ENDIAN__
+# define WORDS_BIGENDIAN 1
+# endif
+#endif
+
+/* Define to empty if `const' does not conform to ANSI C. */
+#cmakedefine H5_const
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+ calls it, or to nothing if 'inline' is not supported under any name. */
+#ifndef __cplusplus
+#cmakedefine H5_inline @H5_inline@
+#endif
+
+/* Define to `long int' if <sys/types.h> does not define. */
+#cmakedefine H5_off_t
+
+/* Define to `unsigned long' if <sys/types.h> does not define. */
+#cmakedefine H5_size_t
+
+/* Define to `long' if <sys/types.h> does not define. */
+#cmakedefine H5_ssize_t
+
+#if defined(__cplusplus) && defined(inline)
+#undef inline
+#endif
+
+#endif \ No newline at end of file
diff --git a/Resources/HDF5Config.cmake.in b/Resources/HDF5Config.cmake.in
new file mode 100644
index 0000000..f7d1fd6
--- /dev/null
+++ b/Resources/HDF5Config.cmake.in
@@ -0,0 +1,32 @@
+#
+# HDF5 Config file for CMake
+#
+
+SET(HDF5_INCLUDE_DIRS "@HDF5_INCLUDE_DIRECTORIES@i" )
+SET(HDF5_LIBRARIES "@HDF5_LIBRARIES@" )
+SET(HDF5_LINK_DIRECTORIES "@CMAKE_LIBRARY_OUTPUT_DIRECTORY@" )
+
+# Names for hdf5 library
+SET(HDF5_LIB_NAME "@HDF5_LIB_NAME@")
+SET(HDF5_LIB_NAME_RELEASE "@HDF5_LIB_NAME_RELEASE@")
+SET(HDF5_LIB_NAME_DEBUG "@HDF5_LIB_NAME_DEBUG@")
+
+# Names for hdf5_hl library
+SET(HDF5_HL_LIB_NAME "@HDF5_HL_LIB_NAME@")
+SET(HDF5_HL_LIB_NAME_RELEASE "@HDF5_HL_LIB_NAME_RELEASE@")
+SET(HDF5_HL_LIB_NAME_DEBUG "@HDF5_HL_LIB_NAME_DEBUG@")
+
+# Names for hdf5_cpp library
+SET(HDF5_CPP_LIB_NAME "@HDF5_CPP_LIB_NAME@")
+SET(HDF5_CPP_LIB_NAME_RELEASE "@HDF5_CPP_LIB_NAME_RELEASE@")
+SET(HDF5_CPP_LIB_NAME_DEBUG "@HDF5_CPP_LIB_NAME_DEBUG@")
+
+# Names for hdf5_test library
+SET(HDF5_TEST_LIB_NAME "@HDF5_TEST_LIB_NAME@")
+SET(HDF5_TEST_LIB_NAME_RELEASE "@HDF5_TEST_LIB_NAME_RELEASE@")
+SET(HDF5_TEST_LIB_NAME_DEBUG "@HDF5_TEST_LIB_NAME_DEBUG@")
+
+# Names for hdf5_test library
+SET(HDF5_TOOLS_LIB_NAME "@HDF5_TOOLS_LIB_NAME@")
+SET(HDF5_TOOLS_LIB_NAME_RELEASE "@HDF5_TOOLS_LIB_NAME_RELEASE@")
+SET(HDF5_TOOLS_LIB_NAME_DEBUG "@HDF5_TOOLS_LIB_NAME_DEBUG@")
diff --git a/Resources/HDF5Macros.cmake b/Resources/HDF5Macros.cmake
new file mode 100644
index 0000000..cb1b300
--- /dev/null
+++ b/Resources/HDF5Macros.cmake
@@ -0,0 +1,122 @@
+#-------------------------------------------------------------------------------
+MACRO (SET_GLOBAL_VARIABLE name value)
+ SET (${name} ${value} CACHE INTERNAL "Used to pass variables between directories" FORCE)
+ENDMACRO (SET_GLOBAL_VARIABLE)
+
+#-------------------------------------------------------------------------------
+MACRO (IDE_GENERATED_PROPERTIES SOURCE_PATH HEADERS SOURCES)
+ #set(source_group_path "Source/AIM/${NAME}")
+ STRING (REPLACE "/" "\\\\" source_group_path ${SOURCE_PATH})
+ source_group(${source_group_path} FILES ${HEADERS} ${SOURCES})
+
+ #-- The following is needed if we ever start to use OS X Frameworks but only
+ #-- works on CMake 2.6 and greater
+ #SET_PROPERTY (SOURCE ${HEADERS}
+ # PROPERTY MACOSX_PACKAGE_LOCATION Headers/${NAME}
+ #)
+ENDMACRO (IDE_GENERATED_PROPERTIES)
+
+#-------------------------------------------------------------------------------
+MACRO (IDE_SOURCE_PROPERTIES SOURCE_PATH HEADERS SOURCES)
+ # INSTALL (FILES ${HEADERS}
+ # DESTINATION include/R3D/${NAME}
+ # COMPONENT Headers
+ # )
+
+ STRING (REPLACE "/" "\\\\" source_group_path ${SOURCE_PATH} )
+ source_group (${source_group_path} FILES ${HEADERS} ${SOURCES})
+
+ #-- The following is needed if we ever start to use OS X Frameworks but only
+ #-- works on CMake 2.6 and greater
+ #SET_PROPERTY (SOURCE ${HEADERS}
+ # PROPERTY MACOSX_PACKAGE_LOCATION Headers/${NAME}
+ #)
+ENDMACRO (IDE_SOURCE_PROPERTIES)
+
+#-------------------------------------------------------------------------------
+MACRO (H5_NAMING target)
+ IF (WIN32 AND NOT MINGW)
+ IF (BUILD_SHARED_LIBS)
+ IF (H5_LEGACY_NAMING)
+ SET_TARGET_PROPERTIES (${target} PROPERTIES OUTPUT_NAME "dll")
+ SET_TARGET_PROPERTIES (${target} PROPERTIES PREFIX "${target}")
+ ELSE (H5_LEGACY_NAMING)
+ SET_TARGET_PROPERTIES (${target} PROPERTIES OUTPUT_NAME "${target}dll")
+ ENDIF (H5_LEGACY_NAMING)
+ ENDIF (BUILD_SHARED_LIBS)
+ ENDIF (WIN32 AND NOT MINGW)
+ENDMACRO (H5_NAMING)
+
+#-------------------------------------------------------------------------------
+MACRO (H5_SET_LIB_OPTIONS libtarget libname libtype)
+ # message (STATUS "${libname} libtype: ${libtype}")
+ IF (${libtype} MATCHES "SHARED")
+ IF (WIN32 AND NOT MINGW)
+ IF (H5_LEGACY_NAMING)
+ SET (LIB_RELEASE_NAME "${libname}dll")
+ SET (LIB_DEBUG_NAME "${libname}ddll")
+ ELSE (H5_LEGACY_NAMING)
+ SET (LIB_RELEASE_NAME "${libname}")
+ SET (LIB_DEBUG_NAME "${libname}_D")
+ ENDIF (H5_LEGACY_NAMING)
+ ELSE (WIN32 AND NOT MINGW)
+ SET (LIB_RELEASE_NAME "${libname}")
+ SET (LIB_DEBUG_NAME "${libname}_debug")
+ ENDIF (WIN32 AND NOT MINGW)
+ ELSE (${libtype} MATCHES "SHARED")
+ IF (WIN32 AND NOT MINGW)
+ IF (H5_LEGACY_NAMING)
+ SET (LIB_RELEASE_NAME "${libname}")
+ SET (LIB_DEBUG_NAME "${libname}d")
+ ELSE (H5_LEGACY_NAMING)
+ SET (LIB_RELEASE_NAME "lib${libname}")
+ SET (LIB_DEBUG_NAME "lib${libname}_D")
+ ENDIF (H5_LEGACY_NAMING)
+ ELSE (WIN32 AND NOT MINGW)
+ SET (LIB_RELEASE_NAME "lib${libname}")
+ SET (LIB_DEBUG_NAME "lib${libname}_debug")
+ ENDIF (WIN32 AND NOT MINGW)
+ ENDIF (${libtype} MATCHES "SHARED")
+
+ SET_TARGET_PROPERTIES (${libtarget}
+ PROPERTIES
+ DEBUG_OUTPUT_NAME ${LIB_DEBUG_NAME}
+ RELEASE_OUTPUT_NAME ${LIB_RELEASE_NAME}
+ MINSIZEREL_OUTPUT_NAME ${LIB_RELEASE_NAME}
+ RELWITHDEBINFO_OUTPUT_NAME ${LIB_RELEASE_NAME}
+ )
+
+ #----- Use MSVC Naming conventions for Shared Libraries
+ IF (MINGW AND BUILD_SHARED_LIBS)
+ SET_TARGET_PROPERTIES (${libtarget}
+ PROPERTIES
+ IMPORT_SUFFIX ".lib"
+ IMPORT_PREFIX ""
+ PREFIX ""
+ )
+ ENDIF (MINGW AND BUILD_SHARED_LIBS)
+
+ IF (BUILD_SHARED_LIBS)
+ IF (WIN32)
+ SET (LIBHDF_VERSION HDF5_PACKAGE_VERSION_MAJOR)
+ ELSE (WIN32)
+ SET (LIBHDF_VERSION ${HDF5_PACKAGE_VERSION})
+ ENDIF (WIN32)
+ SET_TARGET_PROPERTIES (${libtarget} PROPERTIES VERSION ${LIBHDF_VERSION})
+ SET_TARGET_PROPERTIES (${libtarget} PROPERTIES SOVERSION ${LIBHDF_VERSION})
+ ENDIF (BUILD_SHARED_LIBS)
+
+ #-- Apple Specific install_name for libraries
+ IF (APPLE)
+ OPTION (HDF5_BUILD_WITH_INSTALL_NAME "Build with library install_name set to the installation path" OFF)
+ IF (HDF5_BUILD_WITH_INSTALL_NAME)
+ SET_TARGET_PROPERTIES(${libtarget} PROPERTIES
+ LINK_FLAGS "-current_version ${HDF5_PACKAGE_VERSION} -compatibility_version ${HDF5_PACKAGE_VERSION}"
+ INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib"
+ BUILD_WITH_INSTALL_RPATH ${HDF5_BUILD_WITH_INSTALL_NAME}
+ )
+ ENDIF (HDF5_BUILD_WITH_INSTALL_NAME)
+ ENDIF (APPLE)
+
+ENDMACRO (H5_SET_LIB_OPTIONS)
+
diff --git a/Resources/HDF5Tests.c b/Resources/HDF5Tests.c
new file mode 100644
index 0000000..35e7258
--- /dev/null
+++ b/Resources/HDF5Tests.c
@@ -0,0 +1,366 @@
+#define SIMPLE_TEST(x) int main(){ x; return 0; }
+
+#ifdef CXX_HAVE_OFFSETOF
+ #include <stdio.h>
+#include <stddef.h>
+
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+# ifdef __cplusplus
+extern "C"
+# endif
+int FC_DUMMY_MAIN()
+{ return 1;}
+#endif
+#endif
+int
+main ()
+{
+
+ struct index_st
+ {
+ unsigned char type;
+ unsigned char num;
+ unsigned int len;
+ };
+ typedef struct index_st index_t;
+ int x,y;
+ x = offsetof(struct index_st, len);
+ y = offsetof(index_t, num)
+
+ ;
+ return 0;
+}
+#endif
+
+#ifdef HAVE_C99_DESIGNATED_INITIALIZER
+
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+# ifdef __cplusplus
+extern "C"
+# endif
+int FC_DUMMY_MAIN()
+{ return 1;}
+#endif
+#endif
+int
+main ()
+{
+
+ typedef struct
+ {
+ int x;
+ union
+ {
+ int i;
+ double d;
+ }u;
+ }di_struct_t;
+ di_struct_t x =
+ { 0,
+ { .d = 0.0}};
+ ;
+ return 0;
+}
+
+#endif
+
+#ifdef HAVE_C99_FUNC
+
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+# ifdef __cplusplus
+ extern "C"
+# endif
+ int FC_DUMMY_MAIN() { return 1; }
+#endif
+#endif
+int
+main ()
+{
+ const char *fname = __func__;
+ ;
+ return 0;
+}
+
+#endif
+
+#ifdef VSNPRINTF_WORKS
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+
+int test_vsnprintf(const char *fmt,...)
+{
+ va_list ap;
+ char *s = malloc(16);
+ int ret;
+
+ va_start(ap, fmt);
+ ret=vsnprintf(s,16,"%s",ap);
+ va_end(ap);
+
+ return(ret!=42 ? 1 : 0);
+}
+
+int main(void)
+{
+ exit(test_vsnprintf("%s","A string that is longer than 16 characters"));
+}
+#endif
+
+
+#ifdef TIME_WITH_SYS_TIME
+/* Time with sys/time test */
+
+#include <sys/types.h>
+#include <sys/time.h>
+#include <time.h>
+
+int
+main ()
+{
+if ((struct tm *) 0)
+return 0;
+ ;
+ return 0;
+}
+
+#endif
+
+#ifdef STDC_HEADERS
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+int main() { return 0; }
+#endif /* STDC_HEADERS */
+
+#ifdef HAVE_TM_ZONE
+
+#include <sys/types.h>
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#include <time.h>
+SIMPLE_TEST(struct tm tm; tm.tm_zone);
+
+#endif /* HAVE_TM_ZONE */
+
+#ifdef HAVE_STRUCT_TM_TM_ZONE
+
+#include <sys/types.h>
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#include <time.h>
+SIMPLE_TEST(struct tm tm; tm.tm_zone);
+
+#endif /* HAVE_STRUCT_TM_TM_ZONE */
+
+#ifdef HAVE_ATTRIBUTE
+
+#if 0
+static void test int __attribute((unused)) var)
+{
+ int __attribute__((unused)) x = var;
+}
+
+int main(void)
+{
+ test(19);
+}
+
+#else
+int
+main ()
+{
+int __attribute__((unused)) x
+ ;
+ return 0;
+}
+#endif
+
+
+#endif /* HAVE_ATTRIBUTE */
+
+#ifdef HAVE_FUNCTION
+
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+# ifdef __cplusplus
+ extern "C"
+# endif
+ int FC_DUMMY_MAIN() { return 1; }
+#endif
+#endif
+int
+main ()
+{
+(void)__FUNCTION__
+ ;
+ return 0;
+}
+
+#endif /* HAVE_FUNCTION */
+
+#ifdef HAVE_TM_GMTOFF
+
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#include <time.h>
+SIMPLE_TEST(struct tm tm; tm.tm_gmtoff=0);
+
+#endif /* HAVE_TM_GMTOFF */
+
+#ifdef HAVE_TIMEZONE
+
+#include <sys/time.h>
+#include <time.h>
+SIMPLE_TEST(timezone=0);
+
+#endif /* HAVE_TIMEZONE */
+
+#ifdef HAVE_STRUCT_TIMEZONE
+
+#include <sys/types.h>
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#include <time.h>
+SIMPLE_TEST(struct timezone tz; tz.tz_minuteswest=0);
+
+#endif /* HAVE_STRUCT_TIMEZONE */
+
+#ifdef HAVE_STAT_ST_BLOCKS
+
+#include <sys/stat.h>
+SIMPLE_TEST(struct stat sb; sb.st_blocks=0);
+
+#endif /* HAVE_STAT_ST_BLOCKS */
+
+#ifdef PRINTF_LL_WIDTH
+
+#ifdef HAVE_LONG_LONG
+# define LL_TYPE long long
+#else /* HAVE_LONG_LONG */
+# define LL_TYPE __int64
+#endif /* HAVE_LONG_LONG */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+int main(void)
+{
+ char *llwidthArgs[] = { "l64", "l", "L", "q", "ll", NULL };
+ char *s = malloc(128);
+ char **currentArg = NULL;
+ LL_TYPE x = (LL_TYPE)1048576 * (LL_TYPE)1048576;
+ for (currentArg = llwidthArgs; *currentArg != NULL; currentArg++)
+ {
+ char formatString[64];
+ sprintf(formatString, "%%%sd", *currentArg);
+ sprintf(s, formatString, x);
+ if (strcmp(s, "1099511627776") == 0)
+ {
+ printf("PRINTF_LL_WIDTH=[%s]\n", *currentArg);
+ exit(0);
+ }
+ }
+ exit(1);
+}
+
+#endif /* PRINTF_LL_WIDTH */
+
+#ifdef SYSTEM_SCOPE_THREADS
+#include <stdlib.h>
+#include <pthread.h>
+
+int main(void)
+{
+ pthread_attr_t attribute;
+ int ret;
+
+ pthread_attr_init(&attribute);
+ ret=pthread_attr_setscope(&attribute, PTHREAD_SCOPE_SYSTEM);
+ exit(ret==0 ? 0 : 1);
+}
+
+#endif /* SYSTEM_SCOPE_THREADS */
+
+#ifdef HAVE_SOCKLEN_T
+
+#include <stdio.h>
+#include <stdlib.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+
+SIMPLE_TEST(socklen_t foo);
+
+#endif /* HAVE_SOCKLEN_T */
+
+#ifdef DEV_T_IS_SCALAR
+
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+
+int main ()
+{
+ dev_t d1, d2;
+ if(d1==d2)
+ return 0;
+ return 1;
+}
+
+#endif /* DEV_T_IS_SCALAR */
+
+#if defined( INLINE_TEST_inline ) || defined( INLINE_TEST___inline__ ) || defined( INLINE_TEST___inline )
+#ifndef __cplusplus
+typedef int foo_t;
+static INLINE_TEST_INLINE foo_t static_foo () { return 0; }
+INLINE_TEST_INLINE foo_t foo () {return 0; }
+int main() { return 0; }
+#endif
+
+#endif /* INLINE_TEST */
+
+#ifdef HAVE_OFF64_T
+#include <sys/types.h>
+int main()
+{
+ off64_t n = 0;
+ return (int)n;
+}
+#endif
+
+
+#ifdef GETTIMEOFDAY_GIVES_TZ
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#include <time.h>
+int main(void)
+{
+ struct timeval tv;
+ struct timezone tz;
+ tz.tz_minuteswest = 7777; /* Initialize to an unreasonable number */
+ tz.tz_dsttime = 7;
+ gettimeofday(&tv, &tz);
+ /* Check whether the function returned any value at all */
+ if(tz.tz_minuteswest == 7777 && tz.tz_dsttime == 7)
+ exit(1);
+ else exit (0);
+}
+#endif
+
diff --git a/Resources/hdf5_zlib.h.in b/Resources/hdf5_zlib.h.in
new file mode 100644
index 0000000..104db27
--- /dev/null
+++ b/Resources/hdf5_zlib.h.in
@@ -0,0 +1 @@
+#include <@H5_ZLIB_HEADER@>
diff --git a/Resources/libhdf5.settings.cmake.in b/Resources/libhdf5.settings.cmake.in
new file mode 100644
index 0000000..a3032e5
--- /dev/null
+++ b/Resources/libhdf5.settings.cmake.in
@@ -0,0 +1,68 @@
+ SUMMARY OF THE HDF5 CONFIGURATION
+ =================================
+
+General Information:
+-------------------
+ HDF5 Version: @H5_VERSION@
+ Configured on: @CONFIG_DATE@
+ Configured by: @CONFIG_USER@
+ Configure mode: @CONFIG_MODE@
+ Host system: @host_cpu@-@host_vendor@-@host_os@
+ Uname information: @UNAME_INFO@
+ Byte sex: @BYTESEX@
+ Libraries: @STATIC_SHARED@
+ Installation point: @prefix@
+
+Compiling Options:
+------------------
+ Compilation Mode: @CONFIG_MODE@
+ C Compiler: @CC_VERSION@
+ CFLAGS: @CFLAGS@
+ H5_CFLAGS: @H5_CFLAGS@
+ AM_CFLAGS: @AM_CFLAGS@
+ CPPFLAGS: @CPPFLAGS@
+ H5_CPPFLAGS: @H5_CPPFLAGS@
+ AM_CPPFLAGS: @AM_CPPFLAGS@
+ Shared Libraries: @enable_shared@
+ Static Libraries: @enable_static@
+ Statically Linked Executables: @STATIC_EXEC@
+ LDFLAGS: @LDFLAGS@
+ AM_LDFLAGS: @AM_LDFLAGS@
+ Extra libraries: @LIBS@
+ Archiver: @AR@
+ Ranlib: @RANLIB@
+ Debugged Packages: @DEBUG_PKG@
+ API Tracing: @TRACE_API@
+
+Languages:
+----------
+ Fortran: @HDF_FORTRAN@
+@BUILD_FORTRAN_CONDITIONAL_TRUE@ Fortran Compiler: @FC@
+@BUILD_FORTRAN_CONDITIONAL_TRUE@ Fortran Flags: @FCFLAGS@
+@BUILD_FORTRAN_CONDITIONAL_TRUE@ H5 Fortran Flags: @H5_FCFLAGS@
+@BUILD_FORTRAN_CONDITIONAL_TRUE@ AM Fortran Flags: @AM_FCFLAGS@
+ C++: @HDF_CXX@
+@BUILD_CXX_CONDITIONAL_TRUE@ C++ Compiler: @CXX@
+@BUILD_CXX_CONDITIONAL_TRUE@ C++ Flags: @CXXFLAGS@
+@BUILD_CXX_CONDITIONAL_TRUE@ H5 C++ Flags: @H5_CXXFLAGS@
+@BUILD_CXX_CONDITIONAL_TRUE@ AM C++ Flags: @AM_CXXFLAGS@
+
+Features:
+---------
+ Parallel HDF5: @PARALLEL@
+ High Level library: @HDF5_HL@
+ Threadsafety: @THREADSAFE@
+ Default API Mapping: @DEFAULT_API_VERSION@
+ With Deprecated Public Symbols: @DEPRECATED_SYMBOLS@
+ I/O filters (external): @EXTERNAL_FILTERS@
+ I/O filters (internal): @FILTERS@
+ MPE: @MPE@
+ Direct VFD: @DIRECT_VFD@
+ dmalloc: @HAVE_DMALLOC@
+Clear file buffers before write: @CLEARFILEBUF@
+ Using memory checker: @USINGMEMCHECKER@
+ Function Stack Tracing: @CODESTACK@
+ GPFS: @GPFS@
+ Strict File Format Checks: @STRICT_FORMAT_CHECKS@
+ Optimization Instrumentation: @INSTRUMENT@
+ Linux Large File Support (LFS): @LINUX_LFS@
diff --git a/Resources/runTest.cmake b/Resources/runTest.cmake
new file mode 100644
index 0000000..4218671
--- /dev/null
+++ b/Resources/runTest.cmake
@@ -0,0 +1,82 @@
+# runTest.cmake executes a command and captures the output in a file. File is then compared
+# against a reference file. Exit status of command can also be compared.
+
+# arguments checking
+IF (NOT TEST_PROGRAM)
+ MESSAGE (FATAL_ERROR "Require TEST_PROGRAM to be defined")
+ENDIF (NOT TEST_PROGRAM)
+#IF (NOT TEST_ARGS)
+# MESSAGE (STATUS "Require TEST_ARGS to be defined")
+#ENDIF (NOT TEST_ARGS)
+IF (NOT TEST_FOLDER)
+ MESSAGE ( FATAL_ERROR "Require TEST_FOLDER to be defined")
+ENDIF (NOT TEST_FOLDER)
+IF (NOT TEST_OUTPUT)
+ MESSAGE (FATAL_ERROR "Require TEST_OUTPUT to be defined")
+ENDIF (NOT TEST_OUTPUT)
+#IF (NOT TEST_EXPECT)
+# MESSAGE (STATUS "Require TEST_EXPECT to be defined")
+#ENDIF (NOT TEST_EXPECT)
+IF (NOT TEST_REFERENCE)
+ MESSAGE (FATAL_ERROR "Require TEST_REFERENCE to be defined")
+ENDIF (NOT TEST_REFERENCE)
+
+SET (ERROR_APPEND 1)
+
+MESSAGE (STATUS "COMMAND: ${TEST_PROGRAM} ${TEST_ARGS}")
+
+# run the test program, capture the stdout/stderr and the result var
+EXECUTE_PROCESS (
+ COMMAND ${TEST_PROGRAM} ${TEST_ARGS}
+ WORKING_DIRECTORY ${TEST_FOLDER}
+ RESULT_VARIABLE TEST_RESULT
+ OUTPUT_FILE ${TEST_OUTPUT}
+ ERROR_FILE ${TEST_OUTPUT}.err
+ OUTPUT_VARIABLE TEST_ERROR
+ ERROR_VARIABLE TEST_ERROR
+)
+
+MESSAGE (STATUS "COMMAND Result: ${TEST_RESULT}")
+
+IF (ERROR_APPEND)
+ FILE (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM)
+ FILE (APPEND ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}")
+ENDIF (ERROR_APPEND)
+
+IF (TEST_APPEND)
+ FILE (APPEND ${TEST_OUTPUT} "${TEST_APPEND} ${TEST_RESULT}\n")
+ENDIF (TEST_APPEND)
+
+# if the return value is !=0 bail out
+IF (NOT ${TEST_RESULT} STREQUAL ${TEST_EXPECT})
+ MESSAGE ( FATAL_ERROR "Failed: Test program ${TEST_PROGRAM} exited != 0.\n${TEST_ERROR}")
+ENDIF (NOT ${TEST_RESULT} STREQUAL ${TEST_EXPECT})
+
+MESSAGE (STATUS "COMMAND Error: ${TEST_ERROR}")
+
+IF (TEST_MASK)
+ FILE (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM)
+ #STRING(REGEX REPLACE "Modified:[^\n]+\n" "Modified: XXXX-XX-XX XX:XX:XX XXX\n" TEST_STREAM "${TEST_STREAM}")
+ STRING(REGEX REPLACE "Storage:[^\n]+\n" "Storage: <details removed for portability>\n" TEST_STREAM "${TEST_STREAM}")
+ FILE (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}")
+ENDIF (TEST_MASK)
+
+IF (WIN32 AND NOT MINGW)
+ FILE (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM)
+ FILE (WRITE ${TEST_FOLDER}/${TEST_REFERENCE} "${TEST_STREAM}")
+ENDIF (WIN32 AND NOT MINGW)
+
+# now compare the output with the reference
+EXECUTE_PROCESS (
+ COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_OUTPUT} ${TEST_REFERENCE}
+ RESULT_VARIABLE TEST_RESULT
+)
+
+# again, if return value is !=0 scream and shout
+IF (TEST_RESULT)
+ MESSAGE (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did not match ${TEST_REFERENCE}")
+ENDIF (TEST_RESULT)
+
+# everything went fine...
+MESSAGE ("Passed: The output of ${TEST_PROGRAM} matches ${TEST_REFERENCE}")
+
diff --git a/Resources/xlatefile.c b/Resources/xlatefile.c
new file mode 100644
index 0000000..c16f573
--- /dev/null
+++ b/Resources/xlatefile.c
@@ -0,0 +1,56 @@
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#define BUFFERSIZE 1024
+
+int main(int argc, char *argv[]) {
+ FILE *infile = NULL;
+ FILE *outfile = NULL;
+ char *buffer = NULL;
+ char argbuf[8];
+ unsigned int bytes = 0;
+ unsigned int idx = 0;
+ unsigned int lineidx = 0;
+ unsigned int stripXlines = 3;
+
+ if(argc < 3)
+ exit(1);
+ if(NULL == (infile = fopen(argv[1], "rb")))
+ exit(2);
+ if(NULL == (outfile = fopen(argv[2], "wb+")))
+ exit(3);
+ if(argc > 3)
+ if(argv[3][0] == '-')
+ if(argv[3][1] == 'l') {
+ strcpy(argbuf, &argv[3][2]);
+ stripXlines = atoi(argbuf);
+ }
+ buffer = (char*)malloc(BUFFERSIZE);
+ if(buffer) {
+ while(!feof(infile)) {
+ /* read the file into the buffer. */
+ bytes = fread(buffer, 1, BUFFERSIZE, infile);
+ if(lineidx < stripXlines) {
+ for(idx = 0; idx < bytes; idx++) {
+ if(buffer[idx] == '\n') {
+ lineidx++;
+ if(buffer[idx+1] == '\r')
+ idx++;
+ }
+ if(lineidx >= stripXlines) {
+ fwrite(&buffer[idx+1], 1, bytes-idx-1, outfile);
+ idx = bytes;
+ }
+ }
+ }
+ else
+ fwrite(buffer, 1, bytes, outfile);
+ }
+ free(buffer);
+ }
+ fclose(outfile);
+ fclose(infile);
+
+ return 0;
+}