]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Pull request #3327: build: compile against libatomic if present
authorMike Stepanek (mstepane) <mstepane@cisco.com>
Wed, 30 Mar 2022 12:19:00 +0000 (12:19 +0000)
committerMike Stepanek (mstepane) <mstepane@cisco.com>
Wed, 30 Mar 2022 12:19:00 +0000 (12:19 +0000)
Merge in SNORT/snort3 from ~OSERHIIE/snort3:libatomic to master

Squashed commit of the following:

commit 720d367bae80b58612840d74a6af2d626ba1e4ad
Author: Oleksandr Serhiienko <oserhiie@cisco.com>
Date:   Mon Mar 28 21:19:14 2022 +0300

    build: compile against libatomic if present

    Thanks to W. Michael Petullo <mike@flyn.org>

CMakeLists.txt
cmake/FindAtomic.cmake [new file with mode: 0644]
cmake/include_libraries.cmake
configure_cmake.sh
src/CMakeLists.txt

index 1e80b12de39b97f3d43227e4af464d0065739b3a..c761523218d4fa35dadd565a7e1b38d76352eb83 100644 (file)
@@ -116,6 +116,14 @@ else ()
     DAQ Modules:    Dynamic")
 endif ()
 
+if (HAVE_ATOMIC)
+    message("\
+    libatomic:      User-specified")
+else ()
+    message("\
+    libatomic:      System-provided")
+endif ()
+
 if (HAVE_FLATBUFFERS)
     message("\
     Flatbuffers:    ON")
diff --git a/cmake/FindAtomic.cmake b/cmake/FindAtomic.cmake
new file mode 100644 (file)
index 0000000..f1c376f
--- /dev/null
@@ -0,0 +1,11 @@
+find_library(ATOMIC_LIBRARIES NAMES atomic
+    HINTS ${ATOMIC_LIBRARIES_DIR_HINT})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Atomic DEFAULT_MSG ATOMIC_LIBRARIES)
+
+mark_as_advanced(ATOMIC_LIBRARIES)
+
+if (ATOMIC_LIBRARIES)
+    set(HAVE_ATOMIC "1")
+endif()
index 6e3f6f33c21fc1194a2fb9b19132d85272aecc45..4f4edeafa5a47c6e66c8df83d7f2b423475e37ba 100644 (file)
@@ -15,6 +15,7 @@ if (ENABLE_UNIT_TESTS)
 endif (ENABLE_UNIT_TESTS)
 
 # optional libraries
+find_package(Atomic QUIET)
 find_package(LibLZMA QUIET)
 find_package(Asciidoc QUIET)
 find_package(DBLATEX QUIET)
index 8c2d2b147167439ed0a536c789638056d5c21d8c..6d901de1a3873cd3136b67e4769110b952bdb0fb 100755 (executable)
@@ -108,6 +108,8 @@ Optional Packages:
                             libhs include directory
     --with-hyperscan-libraries=DIR
                             libhs library directory
+    --with-atomic-libraries=DIR
+                            atomic library directory
     --with-flatbuffers-includes=DIR
                             flatbuffers include directory
     --with-flatbuffers-libraries=DIR
@@ -447,6 +449,9 @@ while [ $# -ne 0 ]; do
         --with-hyperscan-libraries=*)
             append_cache_entry HS_LIBRARIES_DIR PATH $optarg
             ;;
+        --with-atomic-libraries=*)
+            append_cache_entry ATOMIC_LIBRARIES_DIR_HINT PATH $optarg
+            ;;
         --with-flatbuffers-includes=*)
             append_cache_entry FLATBUFFERS_INCLUDE_DIR_HINT PATH $optarg
             ;;
index 756be158933aa10786150592baba86a35ecda5a4..e737d536c5ac5fd43364978d26341b1a4f47d6be 100644 (file)
@@ -29,6 +29,10 @@ if ( ENABLE_STATIC_DAQ )
     LIST(APPEND EXTERNAL_LIBRARIES ${DAQ_STATIC_MODULE_LIBS})
 endif ()
 
+if ( HAVE_ATOMIC )
+    LIST(APPEND EXTERNAL_LIBRARIES ${ATOMIC_LIBRARIES})
+endif()
+
 if ( HAVE_FLATBUFFERS )
     LIST(APPEND EXTERNAL_LIBRARIES ${FLATBUFFERS_LIBRARIES})
 endif()