diff options
Diffstat (limited to 'fluent-bit/lib/librdkafka-2.1.0/packaging/cmake')
23 files changed, 695 insertions, 0 deletions
diff --git a/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/Config.cmake.in b/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/Config.cmake.in new file mode 100644 index 000000000..8a6522b06 --- /dev/null +++ b/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/Config.cmake.in @@ -0,0 +1,37 @@ +@PACKAGE_INIT@ + +include(CMakeFindDependencyMacro) + +if(@WITH_ZLIB@) + find_dependency(ZLIB) +endif() + +if(@WITH_CURL@) + find_dependency(CURL) +endif() + +if(@WITH_ZSTD@) + find_library(ZSTD zstd) + if(NOT ZSTD) + message(ERROR "ZSTD library not found!") + else() + message(STATUS "Found ZSTD: " ${ZSTD}) + endif() +endif() + +if(@WITH_SSL@) + if(@WITH_BUNDLED_SSL@) + # TODO: custom SSL library should be installed + else() + find_dependency(OpenSSL) + endif() +endif() + +if(@WITH_LZ4_EXT@) + find_dependency(LZ4) +endif() + +find_dependency(Threads) + +include("${CMAKE_CURRENT_LIST_DIR}/@targets_export_name@.cmake") +check_required_components("@PROJECT_NAME@") diff --git a/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/Modules/FindLZ4.cmake b/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/Modules/FindLZ4.cmake new file mode 100644 index 000000000..594c4290c --- /dev/null +++ b/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/Modules/FindLZ4.cmake @@ -0,0 +1,38 @@ +find_path(LZ4_INCLUDE_DIR + NAMES lz4.h + DOC "lz4 include directory") +mark_as_advanced(LZ4_INCLUDE_DIR) +find_library(LZ4_LIBRARY + NAMES lz4 + DOC "lz4 library") +mark_as_advanced(LZ4_LIBRARY) + +if (LZ4_INCLUDE_DIR) + file(STRINGS "${LZ4_INCLUDE_DIR}/lz4.h" _lz4_version_lines + REGEX "#define[ \t]+LZ4_VERSION_(MAJOR|MINOR|RELEASE)") + string(REGEX REPLACE ".*LZ4_VERSION_MAJOR *\([0-9]*\).*" "\\1" _lz4_version_major "${_lz4_version_lines}") + string(REGEX REPLACE ".*LZ4_VERSION_MINOR *\([0-9]*\).*" "\\1" _lz4_version_minor "${_lz4_version_lines}") + string(REGEX REPLACE ".*LZ4_VERSION_RELEASE *\([0-9]*\).*" "\\1" _lz4_version_release "${_lz4_version_lines}") + set(LZ4_VERSION "${_lz4_version_major}.${_lz4_version_minor}.${_lz4_version_release}") + unset(_lz4_version_major) + unset(_lz4_version_minor) + unset(_lz4_version_release) + unset(_lz4_version_lines) +endif () + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(LZ4 + REQUIRED_VARS LZ4_LIBRARY LZ4_INCLUDE_DIR + VERSION_VAR LZ4_VERSION) + +if (LZ4_FOUND) + set(LZ4_INCLUDE_DIRS "${LZ4_INCLUDE_DIR}") + set(LZ4_LIBRARIES "${LZ4_LIBRARY}") + + if (NOT TARGET LZ4::LZ4) + add_library(LZ4::LZ4 UNKNOWN IMPORTED) + set_target_properties(LZ4::LZ4 PROPERTIES + IMPORTED_LOCATION "${LZ4_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${LZ4_INCLUDE_DIR}") + endif () +endif () diff --git a/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/Modules/FindZSTD.cmake b/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/Modules/FindZSTD.cmake new file mode 100644 index 000000000..7de137e0f --- /dev/null +++ b/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/Modules/FindZSTD.cmake @@ -0,0 +1,27 @@ +# +# - Try to find Facebook zstd library +# This will define +# ZSTD_FOUND +# ZSTD_INCLUDE_DIR +# ZSTD_LIBRARY +# + +find_path(ZSTD_INCLUDE_DIR NAMES zstd.h) + +find_library(ZSTD_LIBRARY_DEBUG NAMES zstdd zstd_staticd) +find_library(ZSTD_LIBRARY_RELEASE NAMES zstd zstd_static) + +include(SelectLibraryConfigurations) +SELECT_LIBRARY_CONFIGURATIONS(ZSTD) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS( + ZSTD DEFAULT_MSG + ZSTD_LIBRARY ZSTD_INCLUDE_DIR +) + +if (ZSTD_FOUND) + message(STATUS "Found Zstd: ${ZSTD_LIBRARY}") +endif() + +mark_as_advanced(ZSTD_INCLUDE_DIR ZSTD_LIBRARY) diff --git a/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/Modules/LICENSE.FindZstd b/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/Modules/LICENSE.FindZstd new file mode 100644 index 000000000..9561f469b --- /dev/null +++ b/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/Modules/LICENSE.FindZstd @@ -0,0 +1,178 @@ +FindZstd.cmake: git@github.com:facebook/folly.git 87f1a403b49552dae75ae94c8610dd5979913477 + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS diff --git a/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/README.md b/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/README.md new file mode 100644 index 000000000..47ad2cb63 --- /dev/null +++ b/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/README.md @@ -0,0 +1,38 @@ +# Build librdkafka with cmake + +The cmake build mode is experimental and not officially supported, +the community is asked to maintain and support this mode through PRs. + +Set up build environment (from top-level librdkafka directory): + + $ cmake -H. -B_cmake_build + +On MacOSX and OpenSSL from Homebrew you might need to do: + + $ cmake -H. -B_cmake_build -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl + + +Build the library: + + $ cmake --build _cmake_build + +If you want to build static library: + + $ cmake --build _cmake_build -DRDKAFKA_BUILD_STATIC=1 + + +Run (local) tests: + + $ (cd _cmake_build && ctest -VV -R RdKafkaTestBrokerLess) + + +Install library: + + $ cmake --build _cmake_build --target install + + +If you use librdkafka as submodule in cmake project and want static link of librdkafka: + + set(RDKAFKA_BUILD_STATIC ON CACHE BOOL "") + add_subdirectory(librdkafka) + target_link_libraries(your_library_or_executable rdkafka) diff --git a/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/config.h.in b/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/config.h.in new file mode 100644 index 000000000..9e356c5f9 --- /dev/null +++ b/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/config.h.in @@ -0,0 +1,52 @@ +#cmakedefine01 WITHOUT_OPTIMIZATION +#cmakedefine01 ENABLE_DEVEL +#cmakedefine01 ENABLE_REFCNT_DEBUG + +#cmakedefine01 HAVE_ATOMICS_32 +#cmakedefine01 HAVE_ATOMICS_32_SYNC + +#if (HAVE_ATOMICS_32) +# if (HAVE_ATOMICS_32_SYNC) +# define ATOMIC_OP32(OP1,OP2,PTR,VAL) __sync_ ## OP1 ## _and_ ## OP2(PTR, VAL) +# else +# define ATOMIC_OP32(OP1,OP2,PTR,VAL) __atomic_ ## OP1 ## _ ## OP2(PTR, VAL, __ATOMIC_SEQ_CST) +# endif +#endif + +#cmakedefine01 HAVE_ATOMICS_64 +#cmakedefine01 HAVE_ATOMICS_64_SYNC + +#if (HAVE_ATOMICS_64) +# if (HAVE_ATOMICS_64_SYNC) +# define ATOMIC_OP64(OP1,OP2,PTR,VAL) __sync_ ## OP1 ## _and_ ## OP2(PTR, VAL) +# else +# define ATOMIC_OP64(OP1,OP2,PTR,VAL) __atomic_ ## OP1 ## _ ## OP2(PTR, VAL, __ATOMIC_SEQ_CST) +# endif +#endif + +#cmakedefine01 WITH_PKGCONFIG +#cmakedefine01 WITH_HDRHISTOGRAM +#cmakedefine01 WITH_ZLIB +#cmakedefine01 WITH_CURL +#cmakedefine01 WITH_OAUTHBEARER_OIDC +#cmakedefine01 WITH_ZSTD +#cmakedefine01 WITH_LIBDL +#cmakedefine01 WITH_PLUGINS +#define WITH_SNAPPY 1 +#define WITH_SOCKEM 1 +#cmakedefine01 WITH_SSL +#cmakedefine01 WITH_SASL +#cmakedefine01 WITH_SASL_SCRAM +#cmakedefine01 WITH_SASL_OAUTHBEARER +#cmakedefine01 WITH_SASL_CYRUS +#cmakedefine01 WITH_LZ4_EXT +#cmakedefine01 HAVE_REGEX +#cmakedefine01 HAVE_STRNDUP +#cmakedefine01 HAVE_RAND_R +#cmakedefine01 HAVE_PTHREAD_SETNAME_GNU +#cmakedefine01 HAVE_PTHREAD_SETNAME_DARWIN +#cmakedefine01 HAVE_PTHREAD_SETNAME_FREEBSD +#cmakedefine01 WITH_C11THREADS +#cmakedefine01 WITH_CRC32C_HW +#define SOLIB_EXT "${CMAKE_SHARED_LIBRARY_SUFFIX}" +#define BUILT_WITH "${BUILT_WITH}" diff --git a/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/parseversion.cmake b/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/parseversion.cmake new file mode 100644 index 000000000..592e8df54 --- /dev/null +++ b/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/parseversion.cmake @@ -0,0 +1,60 @@ +# hex2dec(<out-var> <input>): +# Convert a hexadecimal value <input> to decimal and write the result +# to <out-var>. +macro(hex2dec var val) + set(${var} 0) + + set(hex2dec_idx 0) + string(LENGTH "${val}" hex2dec_len) + + while(hex2dec_idx LESS hex2dec_len) + string(SUBSTRING ${val} ${hex2dec_idx} 1 hex2dec_char) + + if(hex2dec_char MATCHES "[0-9]") + set(hex2dec_char ${hex2dec_char}) + elseif(hex2dec_char MATCHES "[aA]") + set(hex2dec_char 10) + elseif(hex2dec_char MATCHES "[bB]") + set(hex2dec_char 11) + elseif(hex2dec_char MATCHES "[cC]") + set(hex2dec_char 12) + elseif(hex2dec_char MATCHES "[dD]") + set(hex2dec_char 13) + elseif(hex2dec_char MATCHES "[eE]") + set(hex2dec_char 14) + elseif(hex2dec_char MATCHES "[fF]") + set(hex2dec_char 15) + else() + message(FATAL_ERROR "Invalid format for hexidecimal character: " ${hex2dec_char}) + endif() + + math(EXPR hex2dec_char "${hex2dec_char} << ((${hex2dec_len}-${hex2dec_idx}-1)*4)") + math(EXPR ${var} "${${var}}+${hex2dec_char}") + math(EXPR hex2dec_idx "${hex2dec_idx}+1") + endwhile() +endmacro(hex2dec) + +# parseversion(<filepath>): +# Parse the file given by <filepath> for the RD_KAFKA_VERSION constant +# and convert the hex value to decimal version numbers. +# Creates the following CMake variables: +# * RDKAFKA_VERSION +# * RDKAFKA_VERSION_MAJOR +# * RDKAFKA_VERSION_MINOR +# * RDKAFKA_VERSION_REVISION +# * RDKAFKA_VERSION_PRERELEASE +macro(parseversion path) + file(STRINGS ${path} rdkafka_version_def REGEX "#define *RD_KAFKA_VERSION *\(0x[a-f0-9]*\)\.*") + string(REGEX REPLACE "#define *RD_KAFKA_VERSION *0x" "" rdkafka_version_hex ${rdkafka_version_def}) + + string(SUBSTRING ${rdkafka_version_hex} 0 2 rdkafka_version_major_hex) + string(SUBSTRING ${rdkafka_version_hex} 2 2 rdkafka_version_minor_hex) + string(SUBSTRING ${rdkafka_version_hex} 4 2 rdkafka_version_revision_hex) + string(SUBSTRING ${rdkafka_version_hex} 6 2 rdkafka_version_prerelease_hex) + + hex2dec(RDKAFKA_VERSION_MAJOR ${rdkafka_version_major_hex}) + hex2dec(RDKAFKA_VERSION_MINOR ${rdkafka_version_minor_hex}) + hex2dec(RDKAFKA_VERSION_REVISION ${rdkafka_version_revision_hex}) + hex2dec(RDKAFKA_VERSION_PRERELEASE ${rdkafka_version_prerelease_hex}) + set(RDKAFKA_VERSION "${RDKAFKA_VERSION_MAJOR}.${RDKAFKA_VERSION_MINOR}.${RDKAFKA_VERSION_REVISION}") +endmacro(parseversion) diff --git a/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/rdkafka.pc.in b/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/rdkafka.pc.in new file mode 100644 index 000000000..0eb17e856 --- /dev/null +++ b/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/rdkafka.pc.in @@ -0,0 +1,12 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=${prefix} +includedir=${prefix}/include +libdir=${prefix}/lib + +Name: @PKG_CONFIG_NAME@ +Description: @PKG_CONFIG_DESCRIPTION@ +Version: @PKG_CONFIG_VERSION@ +Requires: @PKG_CONFIG_REQUIRES@ +Cflags: @PKG_CONFIG_CFLAGS@ +Libs: @PKG_CONFIG_LIBS@ +Libs.private: @PKG_CONFIG_LIBS_PRIVATE@ diff --git a/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/try_compile/atomic_32_test.c b/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/try_compile/atomic_32_test.c new file mode 100644 index 000000000..b3373bb8b --- /dev/null +++ b/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/try_compile/atomic_32_test.c @@ -0,0 +1,8 @@ +#include <inttypes.h> + +int32_t foo(int32_t i) { + return __atomic_add_fetch(&i, 1, __ATOMIC_SEQ_CST); +} + +int main() { +} diff --git a/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/try_compile/atomic_64_test.c b/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/try_compile/atomic_64_test.c new file mode 100644 index 000000000..31922b85c --- /dev/null +++ b/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/try_compile/atomic_64_test.c @@ -0,0 +1,8 @@ +#include <inttypes.h> + +int64_t foo(int64_t i) { + return __atomic_add_fetch(&i, 1, __ATOMIC_SEQ_CST); +} + +int main() { +} diff --git a/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/try_compile/c11threads_test.c b/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/try_compile/c11threads_test.c new file mode 100644 index 000000000..31681ae61 --- /dev/null +++ b/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/try_compile/c11threads_test.c @@ -0,0 +1,14 @@ +#include <threads.h> + +static int start_func(void *arg) { + int iarg = *(int *)arg; + return iarg; +} + +void main(void) { + thrd_t thr; + int arg = 1; + if (thrd_create(&thr, start_func, (void *)&arg) != thrd_success) { + ; + } +} diff --git a/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/try_compile/crc32c_hw_test.c b/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/try_compile/crc32c_hw_test.c new file mode 100644 index 000000000..e80097803 --- /dev/null +++ b/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/try_compile/crc32c_hw_test.c @@ -0,0 +1,27 @@ +#include <inttypes.h> +#include <stdio.h> +#define LONGx1 "8192" +#define LONGx2 "16384" +void main(void) { + const char *n = "abcdefghijklmnopqrstuvwxyz0123456789"; + uint64_t c0 = 0, c1 = 1, c2 = 2; + uint64_t s; + uint32_t eax = 1, ecx; + __asm__("cpuid" : "=c"(ecx) : "a"(eax) : "%ebx", "%edx"); + __asm__( + "crc32b\t" + "(%1), %0" + : "=r"(c0) + : "r"(n), "0"(c0)); + __asm__( + "crc32q\t" + "(%3), %0\n\t" + "crc32q\t" LONGx1 + "(%3), %1\n\t" + "crc32q\t" LONGx2 "(%3), %2" + : "=r"(c0), "=r"(c1), "=r"(c2) + : "r"(n), "0"(c0), "1"(c1), "2"(c2)); + s = c0 + c1 + c2; + printf("avoiding unused code removal by printing %d, %d, %d\n", (int)s, + (int)eax, (int)ecx); +} diff --git a/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/try_compile/dlopen_test.c b/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/try_compile/dlopen_test.c new file mode 100644 index 000000000..ecb478994 --- /dev/null +++ b/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/try_compile/dlopen_test.c @@ -0,0 +1,11 @@ +#include <string.h> +#include <dlfcn.h> + +int main() { + void *h; + /* Try loading anything, we don't care if it works */ + h = dlopen("__nothing_rdkafka.so", RTLD_NOW | RTLD_LOCAL); + if (h) + dlclose(h); + return 0; +} diff --git a/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/try_compile/libsasl2_test.c b/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/try_compile/libsasl2_test.c new file mode 100644 index 000000000..3f3ab3409 --- /dev/null +++ b/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/try_compile/libsasl2_test.c @@ -0,0 +1,7 @@ +#include <string.h> +#include <sasl/sasl.h> + +int main() { + sasl_done(); + return 0; +} diff --git a/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/try_compile/pthread_setname_darwin_test.c b/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/try_compile/pthread_setname_darwin_test.c new file mode 100644 index 000000000..73e31e069 --- /dev/null +++ b/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/try_compile/pthread_setname_darwin_test.c @@ -0,0 +1,6 @@ +#include <pthread.h> + +int main() { + pthread_setname_np("abc"); + return 0; +} diff --git a/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/try_compile/pthread_setname_freebsd_test.c b/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/try_compile/pthread_setname_freebsd_test.c new file mode 100644 index 000000000..329ace08e --- /dev/null +++ b/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/try_compile/pthread_setname_freebsd_test.c @@ -0,0 +1,7 @@ +#include <pthread.h> +#include <pthread_np.h> + +int main() { + pthread_set_name_np(pthread_self(), "abc"); + return 0; +} diff --git a/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/try_compile/pthread_setname_gnu_test.c b/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/try_compile/pthread_setname_gnu_test.c new file mode 100644 index 000000000..3be1b21bc --- /dev/null +++ b/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/try_compile/pthread_setname_gnu_test.c @@ -0,0 +1,5 @@ +#include <pthread.h> + +int main() { + return pthread_setname_np(pthread_self(), "abc"); +} diff --git a/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/try_compile/rand_r_test.c b/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/try_compile/rand_r_test.c new file mode 100644 index 000000000..be722d0a0 --- /dev/null +++ b/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/try_compile/rand_r_test.c @@ -0,0 +1,7 @@ +#include <stdlib.h> + +int main() { + unsigned int seed = 0xbeaf; + (void)rand_r(&seed); + return 0; +} diff --git a/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/try_compile/rdkafka_setup.cmake b/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/try_compile/rdkafka_setup.cmake new file mode 100644 index 000000000..5ea7f7dc6 --- /dev/null +++ b/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/try_compile/rdkafka_setup.cmake @@ -0,0 +1,122 @@ +try_compile( + HAVE_REGEX + "${CMAKE_CURRENT_BINARY_DIR}/try_compile" + "${TRYCOMPILE_SRC_DIR}/regex_test.c" +) + +try_compile( + HAVE_STRNDUP + "${CMAKE_CURRENT_BINARY_DIR}/try_compile" + "${TRYCOMPILE_SRC_DIR}/strndup_test.c" +) + +try_compile( + HAVE_RAND_R + "${CMAKE_CURRENT_BINARY_DIR}/try_compile" + "${TRYCOMPILE_SRC_DIR}/rand_r_test.c" +) + +try_compile( + HAVE_PTHREAD_SETNAME_GNU + "${CMAKE_CURRENT_BINARY_DIR}/try_compile" + "${TRYCOMPILE_SRC_DIR}/pthread_setname_gnu_test.c" + COMPILE_DEFINITIONS "-D_GNU_SOURCE" + LINK_LIBRARIES "-lpthread" +) + +try_compile( + HAVE_PTHREAD_SETNAME_DARWIN + "${CMAKE_CURRENT_BINARY_DIR}/try_compile" + "${TRYCOMPILE_SRC_DIR}/pthread_setname_darwin_test.c" + COMPILE_DEFINITIONS "-D_DARWIN_C_SOURCE" + LINK_LIBRARIES "-lpthread" +) + +try_compile( + HAVE_PTHREAD_SETNAME_FREEBSD + "${CMAKE_CURRENT_BINARY_DIR}/try_compile" + "${TRYCOMPILE_SRC_DIR}/pthread_setname_freebsd_test.c" + LINK_LIBRARIES "-lpthread" +) + +# Atomic 32 tests { +set(LINK_ATOMIC NO) +set(HAVE_ATOMICS_32 NO) +set(HAVE_ATOMICS_32_SYNC NO) + +try_compile( + _atomics_32 + "${CMAKE_CURRENT_BINARY_DIR}/try_compile" + "${TRYCOMPILE_SRC_DIR}/atomic_32_test.c" +) + +if(_atomics_32) + set(HAVE_ATOMICS_32 YES) +else() + try_compile( + _atomics_32_lib + "${CMAKE_CURRENT_BINARY_DIR}/try_compile" + "${TRYCOMPILE_SRC_DIR}/atomic_32_test.c" + LINK_LIBRARIES "-latomic" + ) + if(_atomics_32_lib) + set(HAVE_ATOMICS_32 YES) + set(LINK_ATOMIC YES) + else() + try_compile( + HAVE_ATOMICS_32_SYNC + "${CMAKE_CURRENT_BINARY_DIR}/try_compile" + "${TRYCOMPILE_SRC_DIR}/sync_32_test.c" + ) + endif() +endif() +# } + +# Atomic 64 tests { +set(HAVE_ATOMICS_64 NO) +set(HAVE_ATOMICS_64_SYNC NO) + +try_compile( + _atomics_64 + "${CMAKE_CURRENT_BINARY_DIR}/try_compile" + "${TRYCOMPILE_SRC_DIR}/atomic_64_test.c" +) + +if(_atomics_64) + set(HAVE_ATOMICS_64 YES) +else() + try_compile( + _atomics_64_lib + "${CMAKE_CURRENT_BINARY_DIR}/try_compile" + "${TRYCOMPILE_SRC_DIR}/atomic_64_test.c" + LINK_LIBRARIES "-latomic" + ) + if(_atomics_64_lib) + set(HAVE_ATOMICS_64 YES) + set(LINK_ATOMIC YES) + else() + try_compile( + HAVE_ATOMICS_64_SYNC + "${CMAKE_CURRENT_BINARY_DIR}/try_compile" + "${TRYCOMPILE_SRC_DIR}/sync_64_test.c" + ) + endif() +endif() +# } + +# C11 threads +try_compile( + WITH_C11THREADS + "${CMAKE_CURRENT_BINARY_DIR}/try_compile" + "${TRYCOMPILE_SRC_DIR}/c11threads_test.c" + LINK_LIBRARIES "-pthread" +) +# } + +# CRC32C { +try_compile( + WITH_CRC32C_HW + "${CMAKE_CURRENT_BINARY_DIR}/try_compile" + "${TRYCOMPILE_SRC_DIR}/crc32c_hw_test.c" +) +# } diff --git a/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/try_compile/regex_test.c b/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/try_compile/regex_test.c new file mode 100644 index 000000000..329098d20 --- /dev/null +++ b/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/try_compile/regex_test.c @@ -0,0 +1,10 @@ +#include <stddef.h> +#include <regex.h> + +int main() { + regcomp(NULL, NULL, 0); + regexec(NULL, NULL, 0, NULL, 0); + regerror(0, NULL, NULL, 0); + regfree(NULL); + return 0; +} diff --git a/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/try_compile/strndup_test.c b/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/try_compile/strndup_test.c new file mode 100644 index 000000000..a10b74526 --- /dev/null +++ b/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/try_compile/strndup_test.c @@ -0,0 +1,5 @@ +#include <string.h> + +int main() { + return strndup("hi", 2) ? 0 : 1; +} diff --git a/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/try_compile/sync_32_test.c b/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/try_compile/sync_32_test.c new file mode 100644 index 000000000..2bc80ab4c --- /dev/null +++ b/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/try_compile/sync_32_test.c @@ -0,0 +1,8 @@ +#include <inttypes.h> + +int32_t foo(int32_t i) { + return __sync_add_and_fetch(&i, 1); +} + +int main() { +} diff --git a/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/try_compile/sync_64_test.c b/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/try_compile/sync_64_test.c new file mode 100644 index 000000000..4b6ad6d38 --- /dev/null +++ b/fluent-bit/lib/librdkafka-2.1.0/packaging/cmake/try_compile/sync_64_test.c @@ -0,0 +1,8 @@ +#include <inttypes.h> + +int64_t foo(int64_t i) { + return __sync_add_and_fetch(&i, 1); +} + +int main() { +} |