]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
rec: fix libsnmp define and make dnsdist's meson.build the only one 15272/head
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Mon, 10 Mar 2025 13:14:52 +0000 (14:14 +0100)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Mon, 10 Mar 2025 13:19:31 +0000 (14:19 +0100)
meson/libsnmp/meson.build
pdns/dnsdistdist/meson/libsnmp [new symlink]
pdns/dnsdistdist/meson/libsnmp/meson.build [deleted file]

index a39100ab58b2beda415e59c7ff59f47d01d04ab3..cdf26a9e5beea18a3fef35cf560cb94e7f86b391 100644 (file)
@@ -1,30 +1,33 @@
 opt_libsnmp = get_option('snmp')
 
-dep_libsnmp = declare_dependency()
+dep_libsnmp = dependency('', required: false)
 
-if get_option('snmp')
+if opt_libsnmp
     snmp_config = find_program('net-snmp-config', required: true)
-    snmp_ldflags_res = run_command(snmp_config, '--libs', check: true)
+    snmp_ldflags_res = run_command(snmp_config, '--netsnmp-agent-libs', check: true)
     snmp_ldflags = snmp_ldflags_res.stdout().strip().split()
-    snmp_ldflags_res = run_command(snmp_config, '--agent-libs', check: true)
-    snmp_ldflags += snmp_ldflags_res.stdout().strip().split()
 
     dep_libsnmp = declare_dependency(
       link_args: snmp_ldflags,
     )
-endif
 
-if dep_libsnmp.found()
-  funcs = [
-    'snmp_select_info2',
-  ]
+    if dep_libsnmp.found()
+        funcs = [
+            'snmp_select_info2',
+        ]
 
-  foreach func: funcs
-    define = 'HAVE_' + func.to_upper()
-    have_func = cxx.has_function(func, dependencies: dep_libsnmp)
-    conf.set(define, have_func, description: 'Have libsnmp ' + func)
-  endforeach
+        foreach func: funcs
+            define = 'HAVE_' + func.to_upper()
+            have_func = cxx.has_function(func, dependencies: dep_libsnmp, prefix: '''#include <net-snmp/net-snmp-config.h>
+                #include <net-snmp/definitions.h>
+                #include <net-snmp/types.h>
+                #include <net-snmp/utilities.h>
+                #include <net-snmp/config_api.h>
+                #include <net-snmp/session_api.h>''')
+            conf.set(define, have_func, description: 'Have libsnmp ' + func)
+        endforeach
+   endif
 endif
 
-conf.set('HAVE_LIBSSNMP', dep_libsnmp.found(), description: 'libsnmp')
+conf.set('HAVE_NET_SNMP', dep_libsnmp.found(), description: 'libsnmp')
 summary('SNMP', dep_libsnmp.found(), bool_yn: true, section: 'Configuration')
diff --git a/pdns/dnsdistdist/meson/libsnmp b/pdns/dnsdistdist/meson/libsnmp
new file mode 120000 (symlink)
index 0000000..d2e7260
--- /dev/null
@@ -0,0 +1 @@
+../../../meson/libsnmp
\ No newline at end of file
diff --git a/pdns/dnsdistdist/meson/libsnmp/meson.build b/pdns/dnsdistdist/meson/libsnmp/meson.build
deleted file mode 100644 (file)
index cdf26a9..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-opt_libsnmp = get_option('snmp')
-
-dep_libsnmp = dependency('', required: false)
-
-if opt_libsnmp
-    snmp_config = find_program('net-snmp-config', required: true)
-    snmp_ldflags_res = run_command(snmp_config, '--netsnmp-agent-libs', check: true)
-    snmp_ldflags = snmp_ldflags_res.stdout().strip().split()
-
-    dep_libsnmp = declare_dependency(
-      link_args: snmp_ldflags,
-    )
-
-    if dep_libsnmp.found()
-        funcs = [
-            'snmp_select_info2',
-        ]
-
-        foreach func: funcs
-            define = 'HAVE_' + func.to_upper()
-            have_func = cxx.has_function(func, dependencies: dep_libsnmp, prefix: '''#include <net-snmp/net-snmp-config.h>
-                #include <net-snmp/definitions.h>
-                #include <net-snmp/types.h>
-                #include <net-snmp/utilities.h>
-                #include <net-snmp/config_api.h>
-                #include <net-snmp/session_api.h>''')
-            conf.set(define, have_func, description: 'Have libsnmp ' + func)
-        endforeach
-   endif
-endif
-
-conf.set('HAVE_NET_SNMP', dep_libsnmp.found(), description: 'libsnmp')
-summary('SNMP', dep_libsnmp.found(), bool_yn: true, section: 'Configuration')