diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-05 12:08:03 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-05 12:08:18 +0000 |
commit | 5da14042f70711ea5cf66e034699730335462f66 (patch) | |
tree | 0f6354ccac934ed87a2d555f45be4c831cf92f4a /src/fluent-bit/lib/luajit-cmake/Modules/FindUnwind.cmake | |
parent | Releasing debian version 1.44.3-2. (diff) | |
download | netdata-5da14042f70711ea5cf66e034699730335462f66.tar.xz netdata-5da14042f70711ea5cf66e034699730335462f66.zip |
Merging upstream version 1.45.3+dfsg.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/fluent-bit/lib/luajit-cmake/Modules/FindUnwind.cmake')
-rw-r--r-- | src/fluent-bit/lib/luajit-cmake/Modules/FindUnwind.cmake | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/src/fluent-bit/lib/luajit-cmake/Modules/FindUnwind.cmake b/src/fluent-bit/lib/luajit-cmake/Modules/FindUnwind.cmake new file mode 100644 index 000000000..a3649a5e8 --- /dev/null +++ b/src/fluent-bit/lib/luajit-cmake/Modules/FindUnwind.cmake @@ -0,0 +1,60 @@ +# - Try to find libunwind +# Once done this will define +# +# unwind_FOUND - system has libunwind +# unwind - cmake target for libunwind + +find_library (UNWIND_LIBRARY NAMES unwind DOC "unwind library") +include (CheckIncludeFile) + +check_include_file (unwind.h HAVE_UNWIND_H) +if (NOT HAVE_UNWIND_H) + check_include_file (libunwind.h HAVE_UNWIND_H) +endif () + +if (CMAKE_SYSTEM_PROCESSOR MATCHES "^arm") + set(LIBUNWIND_ARCH "arm") +elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "^aarch64") + set(LIBUNWIND_ARCH "aarch64") +elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" OR + CMAKE_SYSTEM_PROCESSOR STREQUAL "amd64" OR + CMAKE_SYSTEM_PROCESSOR STREQUAL "corei7-64") + set(LIBUNWIND_ARCH "x86_64") +elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "^i.86$") + set(LIBUNWIND_ARCH "x86") +elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "^ppc64") + set(LIBUNWIND_ARCH "ppc64") +elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "^ppc") + set(LIBUNWIND_ARCH "ppc32") +elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "^mips") + set(LIBUNWIND_ARCH "mips") +elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "^hppa") + set(LIBUNWIND_ARCH "hppa") +elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "^ia64") + set(LIBUNWIND_ARCH "ia64") +endif() + +if (UNWIND_LIBRARY MATCHES "_FOUND") + set(UNWIND_LIBRARY unwind) + set(HAVE_UNWIND_LIB ON) +else() + find_library (UNWIND_LIBRARY NAMES "unwind-${LIBUNWIND_ARCH}" DOC "unwind library platform") + if (UNWIND_LIBRARY MATCHES "_FOUND") + set(HAVE_UNWIND_LIB ON) + set(UNWIND_LIBRARY unwind-${LIBUNWIND_ARCH}) + endif () +endif() + +if (HAVE_UNWIND_LIB AND HAVE_UNWIND_H) + set(unwind_FOUND ON) +elseif(HAVE_UNWIND_H) + if (CMAKE_SYSTEM_PROCESSOR STREQUAL aarch64 + AND CMAKE_C_COMPILER_ID STREQUAL zig + AND NOT ANDROID + AND NOT IOS) + set(UNWIND_LIBRARY unwind) + set(HAVE_UNWIND_LIB ON) + endif() +else () + unset(UNWIND_LIBRARY) +endif () |