From ac6a6579e9765efbd7b855ae3369fb0881c91a1e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Fonseca?= Date: Fri, 26 Aug 2011 08:55:32 +0100 Subject: [PATCH] Replicate some of snappy autoconf tests. --- thirdparty/snappy/.gitignore | 1 + thirdparty/snappy/CMakeLists.txt | 28 +++++++++++++++- thirdparty/snappy/config.h.in | 56 ++++++++++++++------------------ 3 files changed, 52 insertions(+), 33 deletions(-) create mode 100644 thirdparty/snappy/.gitignore diff --git a/thirdparty/snappy/.gitignore b/thirdparty/snappy/.gitignore new file mode 100644 index 0000000..0e56cf2 --- /dev/null +++ b/thirdparty/snappy/.gitignore @@ -0,0 +1 @@ +config.h diff --git a/thirdparty/snappy/CMakeLists.txt b/thirdparty/snappy/CMakeLists.txt index 92d1248..b727854 100644 --- a/thirdparty/snappy/CMakeLists.txt +++ b/thirdparty/snappy/CMakeLists.txt @@ -1,4 +1,30 @@ -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) +# We only do the subset of the snappy autoconf that actually affect the library +# (as most of them are for the tests which we don't build.) + +include (CheckIncludeFileCXX) +include (CheckCXXSourceCompiles) +include (TestBigEndian) + +check_include_file_cxx (sys/mman.h HAVE_SYS_MMAN_H) + +check_cxx_source_compiles ( + "main() { return __builtin_expect(1, 1) ? 1 : 0; }" + HAVE_BUILTIN_EXPECT +) + +check_cxx_source_compiles ( + "main() { return (__builtin_ctzll(0x100000000LL) == 32) ? 1 : 0; }" + HAVE_BUILTIN_CTZ +) + +test_big_endian (WORDS_BIGENDIAN) + +configure_file (config.h.in config.h) + +add_definitions (-DHAVE_CONFIG_H) + + +include_directories (${CMAKE_CURRENT_BINARY_DIR}) add_library (snappy_bundled STATIC snappy.cc diff --git a/thirdparty/snappy/config.h.in b/thirdparty/snappy/config.h.in index ac468d9..e82da40 100644 --- a/thirdparty/snappy/config.h.in +++ b/thirdparty/snappy/config.h.in @@ -4,73 +4,73 @@ #undef AC_APPLE_UNIVERSAL_BUILD /* Define to 1 if the compiler supports __builtin_ctz and friends. */ -#undef HAVE_BUILTIN_CTZ +#cmakedefine HAVE_BUILTIN_CTZ /* Define to 1 if the compiler supports __builtin_expect. */ -#undef HAVE_BUILTIN_EXPECT +#cmakedefine HAVE_BUILTIN_EXPECT /* Define to 1 if you have the header file. */ -#undef HAVE_DLFCN_H +#cmakedefine HAVE_DLFCN_H /* Use the gflags package for command-line parsing. */ -#undef HAVE_GFLAGS +#cmakedefine HAVE_GFLAGS /* Defined when Google Test is available. */ -#undef HAVE_GTEST +#cmakedefine HAVE_GTEST /* Define to 1 if you have the header file. */ -#undef HAVE_INTTYPES_H +#cmakedefine HAVE_INTTYPES_H /* Define to 1 if you have the `fastlz' library (-lfastlz). */ -#undef HAVE_LIBFASTLZ +#cmakedefine HAVE_LIBFASTLZ /* Define to 1 if you have the `lzf' library (-llzf). */ -#undef HAVE_LIBLZF +#cmakedefine HAVE_LIBLZF /* Define to 1 if you have the `lzo2' library (-llzo2). */ -#undef HAVE_LIBLZO2 +#cmakedefine HAVE_LIBLZO2 /* Define to 1 if you have the `quicklz' library (-lquicklz). */ -#undef HAVE_LIBQUICKLZ +#cmakedefine HAVE_LIBQUICKLZ /* Define to 1 if you have the `z' library (-lz). */ -#undef HAVE_LIBZ +#cmakedefine HAVE_LIBZ /* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H +#cmakedefine HAVE_MEMORY_H /* Define to 1 if you have the header file. */ -#undef HAVE_STDDEF_H +#cmakedefine HAVE_STDDEF_H /* Define to 1 if you have the header file. */ -#undef HAVE_STDINT_H +#cmakedefine HAVE_STDINT_H /* Define to 1 if you have the header file. */ -#undef HAVE_STDLIB_H +#cmakedefine HAVE_STDLIB_H /* Define to 1 if you have the header file. */ -#undef HAVE_STRINGS_H +#cmakedefine HAVE_STRINGS_H /* Define to 1 if you have the header file. */ -#undef HAVE_STRING_H +#cmakedefine HAVE_STRING_H /* Define to 1 if you have the header file. */ -#undef HAVE_SYS_MMAN_H +#cmakedefine HAVE_SYS_MMAN_H /* Define to 1 if you have the header file. */ -#undef HAVE_SYS_RESOURCE_H +#cmakedefine HAVE_SYS_RESOURCE_H /* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STAT_H +#cmakedefine HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TYPES_H +#cmakedefine HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ -#undef HAVE_UNISTD_H +#cmakedefine HAVE_UNISTD_H /* Define to 1 if you have the header file. */ -#undef HAVE_WINDOWS_H +#cmakedefine HAVE_WINDOWS_H /* Define to the sub-directory in which libtool stores uninstalled libraries. */ @@ -105,12 +105,4 @@ /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ -#if defined AC_APPLE_UNIVERSAL_BUILD -# if defined __BIG_ENDIAN__ -# define WORDS_BIGENDIAN 1 -# endif -#else -# ifndef WORDS_BIGENDIAN -# undef WORDS_BIGENDIAN -# endif -#endif +#cmakedefine WORDS_BIGENDIAN -- 2.43.0