]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Pull request #4638: build: add version check for numactl library
authorDenys Zikratyi -X (dzikraty - SOFTSERVE INC at Cisco) <dzikraty@cisco.com>
Wed, 5 Mar 2025 15:46:55 +0000 (15:46 +0000)
committerSteven Baigal (sbaigal) <sbaigal@cisco.com>
Wed, 5 Mar 2025 15:46:55 +0000 (15:46 +0000)
Merge in SNORT/snort3 from ~DZIKRATY/snort3:add_version_check_for_numactl to master

Squashed commit of the following:

commit 3bdbc66908dce164db28ec693021224e38d8263d
Author: Denys Zikratyi -X (dzikraty - SOFTSERVE INC at Cisco) <dzikraty@cisco.com>
Date:   Wed Feb 26 07:13:27 2025 -0500

    build: add version check for numactl

cmake/FindNUMA.cmake
configure_cmake.sh
src/main/dev_notes.txt

index f518363960ecd2d351714bb2aa1dab768ae73cf8..ab3c35085e9a4e91230ac70d1466ed795a3ead9b 100644 (file)
@@ -1,23 +1,24 @@
-find_path(NUMA_INCLUDE_DIRS numa.h)
-find_library(NUMA_LIBRARIES NAMES numa)
+find_package(PkgConfig)
+pkg_check_modules(PC_NUMA numa>=2.0.14)
 
-if(NUMA_INCLUDE_DIRS AND NUMA_LIBRARIES)
-    set(NUMA_FOUND TRUE)
-    set(NUMA_LIBRARIES ${NUMA_LIBRARIES})
-    set(NUMA_INCLUDE_DIRS ${NUMA_INCLUDE_DIRS})
-endif()
-
-if (NOT NUMA_FOUND)
-    find_package(PkgConfig)
-    pkg_check_modules(PC_NUMA libnuma)
+if(PC_NUMA_FOUND)
+    find_path(NUMA_INCLUDE_DIRS 
+        numa.h
+        HINTS ${NUMA_INCLUDE_DIR_HINT} ${PC_NUMA_INCLUDEDIR}
+    )
+    find_library(NUMA_LIBRARIES
+        NAMES numa
+        HINTS ${NUMA_LIBRARIES_DIR_HINT} ${PC_NUMA_LIBDIR}
+    )
 
-    if(PC_NUMA_FOUND)
+    if(NUMA_INCLUDE_DIRS AND NUMA_LIBRARIES)
         set(NUMA_FOUND TRUE)
-        set(NUMA_INCLUDE_DIRS ${PC_NUMA_INCLUDEDIR} ${PC_NUMA_INCLUDE_DIRS})
-        set(NUMA_LIBRARIES ${PC_NUMA_LIBDIR} ${PC_NUMA_LIBRARY_DIRS})
+        set(NUMA_LIBRARIES ${NUMA_LIBRARIES})
+        set(NUMA_INCLUDE_DIRS ${NUMA_INCLUDE_DIRS})
     endif()
 endif()
 
+
 if(NUMA_FOUND)
     set(HAVE_NUMA "1")
 endif()
@@ -25,4 +26,4 @@ endif()
 include(FindPackageHandleStandardArgs)
 find_package_handle_standard_args(NUMA DEFAULT_MSG NUMA_LIBRARIES NUMA_INCLUDE_DIRS)
 
-mark_as_advanced(NUMA_INCLUDE_DIRS NUMA_LIBRARIES)
\ No newline at end of file
+mark_as_advanced(NUMA_INCLUDE_DIRS NUMA_LIBRARIES)
index d758628282becc3520de6e5e8b8bad4b6d630f43..a6a1b4e84858c0cca9db9452f4874315998b24be 100755 (executable)
@@ -126,6 +126,10 @@ Optional Packages:
     --with-libml-libraries=DIR
                             libml library directory
     --without-libml         build Snort ML with mock of LibML
+    --with-libnuma-includes=DIR
+                            libnuma include directory
+    --with-libnuma-libraries=DIR
+                            libnuma library directory
 
 Some influential variable definitions:
     SIGNAL_SNORT_RELOAD=<int>
@@ -487,6 +491,12 @@ while [ $# -ne 0 ]; do
         --without-libml)
             append_cache_entry USE_LIBML_MOCK BOOL true
             ;;
+        --with-libnuma-includes=*)
+            append_cache_entry NUMA_INCLUDE_DIR_HINT PATH $optarg
+            ;;
+        --with-libnuma-libraries=*)
+            append_cache_entry NUMA_LIBRARIES_DIR_HINT PATH $optarg
+            ;;
         SIGNAL_SNORT_RELOAD=*)
             append_cache_entry SIGNAL_SNORT_RELOAD STRING $optarg
             ;;
index a42602e34b5a543b51b9a4a34155bb7cdf684df8..f1e1f3dd719c8ec626d78af634c99857cb4a96b5 100644 (file)
@@ -70,12 +70,13 @@ the NUMA (Non Uniform Memory Access) policy that is supported by
 the Linux kernel. Preferred memory mode support for NUMA systems 
 has been added. set_mempolicy() is used to establish the memory policy 
 for packet threads operating on different nodes within a NUMA system. 
-The libnuma-dev library must be installed to enable this support. 
-In systems without NUMA architecture, this feature will not affect system 
-performance or behavior. This, alongside with libhwloc, presents an efficient 
-cross-platform mechanism for thread configuration and managing CPU affinity 
-of threads, not only considering CPU architecture but also memory access policies, 
-providing a more balanced and optimized execution environment.
+The libnuma-dev library, version 2.0.14 or higher, must be installed to 
+enable this support. In systems without NUMA architecture, this feature 
+will not affect system performance or behavior. This, alongside with libhwloc, 
+presents an efficient cross-platform mechanism for thread configuration and 
+managing CPU affinity of threads, not only considering CPU architecture but 
+also memory access policies, providing a more balanced and optimized 
+execution environment.
 
 use of get_relative_instance_number() in thread.cc: