summaryrefslogtreecommitdiffstats
path: root/src/fluent-bit/lib/luajit-cmake/Modules/DetectFPUApi.cmake
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-05 12:08:03 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-05 12:08:18 +0000
commit5da14042f70711ea5cf66e034699730335462f66 (patch)
tree0f6354ccac934ed87a2d555f45be4c831cf92f4a /src/fluent-bit/lib/luajit-cmake/Modules/DetectFPUApi.cmake
parentReleasing debian version 1.44.3-2. (diff)
downloadnetdata-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/DetectFPUApi.cmake')
-rwxr-xr-xsrc/fluent-bit/lib/luajit-cmake/Modules/DetectFPUApi.cmake68
1 files changed, 68 insertions, 0 deletions
diff --git a/src/fluent-bit/lib/luajit-cmake/Modules/DetectFPUApi.cmake b/src/fluent-bit/lib/luajit-cmake/Modules/DetectFPUApi.cmake
new file mode 100755
index 000000000..0aa2528bf
--- /dev/null
+++ b/src/fluent-bit/lib/luajit-cmake/Modules/DetectFPUApi.cmake
@@ -0,0 +1,68 @@
+
+##===- DetectArchitecture.cmake -------------------------------------------===##
+#
+# Performs a try_compile to determine the architecture of the target.
+#
+##===----------------------------------------------------------------------===##
+
+get_filename_component(__check_fpu_mode_dir "${CMAKE_CURRENT_LIST_FILE}" PATH)
+
+macro(detect_fpu_mode variable)
+ try_compile(HAVE_${variable}
+ ${CMAKE_BINARY_DIR}
+ ${__check_fpu_mode_dir}/DetectFpuAbi.c
+ OUTPUT_VARIABLE OUTPUT
+ COPY_FILE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/DetectFpuAbi.bin)
+
+ if(HAVE_${variable})
+ file(STRINGS ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/DetectFpuAbi.bin
+ DETECT_FPU_STRING LIMIT_COUNT 1 REGEX "FPU IS")
+ if(DETECT_FPU_STRING)
+ string(REGEX MATCH "[^ ]*$" DETECT_FPU_MATCH ${DETECT_FPU_STRING})
+ if(DETECT_FPU_MATCH)
+ message(STATUS "Check target fpu: ${DETECT_FPU_STRING}")
+ set(${variable} ${DETECT_FPU_MATCH})
+ else()
+ message(SEND_ERROR "Could not detect target fpu mode!")
+ endif()
+ else()
+ message(SEND_ERROR "Could not detect fpu mode!")
+ endif()
+ else()
+ message(STATUS "Determine the fpu mode - failed")
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "Determining the fpu mode failed with the following output:\n${OUTPUT}")
+ set(${variable})
+ endif()
+
+endmacro(detect_fpu_mode)
+
+macro(detect_fpu_abi variable)
+ try_compile(HAVE_${variable}
+ ${CMAKE_BINARY_DIR}
+ ${__check_fpu_mode_dir}/DetectFpuAbi.c
+ OUTPUT_VARIABLE OUTPUT
+ COPY_FILE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/DetectFpuAbi.bin)
+
+ if(HAVE_${variable})
+ file(STRINGS ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/DetectFpuAbi.bin
+ DETECT_FPU_ABI_STRING LIMIT_COUNT 1 REGEX "FPU ABI IS")
+ if(DETECT_FPU_ABI_STRING)
+ string(REGEX MATCH "[^ ]*$" DETECT_FPU_ABI_MATCH ${DETECT_FPU_ABI_STRING})
+ if(DETECT_FPU_ABI_MATCH)
+ message(STATUS "Check target fpu abi: ${DETECT_FPU_ABI_STRING}")
+ set(${variable} ${DETECT_FPU_ABI_MATCH})
+ else()
+ message(SEND_ERROR "Could not detect target fpu abi!")
+ endif()
+ else()
+ message(SEND_ERROR "Could not detect fpu abi!")
+ endif()
+ else()
+ message(STATUS "Determine the fpu abi - failed")
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "Determining the fpu abi failed with the following output:\n${OUTPUT}")
+ set(${variable})
+ endif()
+
+endmacro(detect_fpu_abi)