diff -ruN net-snmp-5.9-orig/agent/mibgroup/host/hr_swrun.c net-snmp-5.9/agent/mibgroup/host/hr_swrun.c --- net-snmp-5.9-orig/agent/mibgroup/host/hr_swrun.c 2020-08-14 16:41:47.000000000 -0500 +++ net-snmp-5.9/agent/mibgroup/host/hr_swrun.c 2021-01-29 05:51:21.000000000 -0600 @@ -39,9 +39,6 @@ #if HAVE_SYS_PROC_H #include #endif -#if HAVE_KVM_H -#include -#endif #if HAVE_SYS_SYSCTL_H #include #endif diff -ruN net-snmp-5.9-orig/agent/mibgroup/ip-mib/ipv4InterfaceTable/ipv4InterfaceTable_data_access.c net-snmp-5.9/agent/mibgroup/ip-mib/ipv4InterfaceTable/ipv4InterfaceTable_data_access.c --- net-snmp-5.9-orig/agent/mibgroup/ip-mib/ipv4InterfaceTable/ipv4InterfaceTable_data_access.c 2020-08-14 16:41:47.000000000 -0500 +++ net-snmp-5.9/agent/mibgroup/ip-mib/ipv4InterfaceTable/ipv4InterfaceTable_data_access.c 2021-01-29 05:50:49.000000000 -0600 @@ -127,7 +127,7 @@ /* * do we have a corresponding row? */ - ip4if_rrc = CONTAINER_FIND(c, ift_rrc); + ip4if_rrc = (ifTable_rowreq_ctx*)CONTAINER_FIND(c, ift_rrc); if (NULL == ip4if_rrc) { /* * no corresponding row. should we have one? diff -ruN net-snmp-5.9-orig/agent/mibgroup/ip-mib/ipv4InterfaceTable/ipv4InterfaceTable_interface.c net-snmp-5.9/agent/mibgroup/ip-mib/ipv4InterfaceTable/ipv4InterfaceTable_interface.c --- net-snmp-5.9-orig/agent/mibgroup/ip-mib/ipv4InterfaceTable/ipv4InterfaceTable_interface.c 2020-08-14 16:41:47.000000000 -0500 +++ net-snmp-5.9/agent/mibgroup/ip-mib/ipv4InterfaceTable/ipv4InterfaceTable_interface.c 2021-01-29 05:53:32.000000000 -0600 @@ -505,7 +505,7 @@ { int rc = SNMP_ERR_NOERROR; ipv4InterfaceTable_rowreq_ctx *rowreq_ctx = - netsnmp_container_table_row_extract(requests); + (ipv4InterfaceTable_rowreq_ctx*)netsnmp_container_table_row_extract(requests); DEBUGMSGTL(("internal:ipv4InterfaceTable:_mfd_ipv4InterfaceTable_object_lookup", "called\n")); @@ -596,7 +596,7 @@ netsnmp_request_info *requests) { ipv4InterfaceTable_rowreq_ctx *rowreq_ctx = - netsnmp_container_table_row_extract(requests); + (ipv4InterfaceTable_rowreq_ctx*)netsnmp_container_table_row_extract(requests); netsnmp_table_request_info *tri; u_char *old_string; void (*dataFreeHook) (void *); @@ -762,7 +762,7 @@ netsnmp_request_info *requests) { ipv4InterfaceTable_rowreq_ctx *rowreq_ctx = - netsnmp_container_table_row_extract(requests); + (ipv4InterfaceTable_rowreq_ctx*)netsnmp_container_table_row_extract(requests); netsnmp_table_request_info *tri; int rc; @@ -846,7 +846,7 @@ { int rc; ipv4InterfaceTable_rowreq_ctx *rowreq_ctx = - netsnmp_container_table_row_extract(requests); + (ipv4InterfaceTable_rowreq_ctx*)netsnmp_container_table_row_extract(requests); DEBUGMSGTL(("internal:ipv4InterfaceTable:_mfd_ipv4InterfaceTable_undo_setup", "called\n")); @@ -908,7 +908,7 @@ netsnmp_request_info *requests) { ipv4InterfaceTable_rowreq_ctx *rowreq_ctx = - netsnmp_container_table_row_extract(requests); + (ipv4InterfaceTable_rowreq_ctx*)netsnmp_container_table_row_extract(requests); int rc; DEBUGMSGTL(("internal:ipv4InterfaceTable:_mfd_ipv4InterfaceTable_undo_cleanup", "called\n")); @@ -988,7 +988,7 @@ netsnmp_request_info *requests) { ipv4InterfaceTable_rowreq_ctx *rowreq_ctx = - netsnmp_container_table_row_extract(requests); + (ipv4InterfaceTable_rowreq_ctx*)netsnmp_container_table_row_extract(requests); netsnmp_table_request_info *tri; int rc = SNMP_ERR_NOERROR; @@ -1036,7 +1036,7 @@ { int rc; ipv4InterfaceTable_rowreq_ctx *rowreq_ctx = - netsnmp_container_table_row_extract(requests); + (ipv4InterfaceTable_rowreq_ctx*)netsnmp_container_table_row_extract(requests); DEBUGMSGTL(("internal:ipv4InterfaceTable:_mfd_ipv4InterfaceTable_commit", "called\n")); @@ -1070,7 +1070,7 @@ { int rc; ipv4InterfaceTable_rowreq_ctx *rowreq_ctx = - netsnmp_container_table_row_extract(requests); + (ipv4InterfaceTable_rowreq_ctx*)netsnmp_container_table_row_extract(requests); DEBUGMSGTL(("internal:ipv4InterfaceTable:_mfd_ipv4InterfaceTable_undo_commit", "called\n")); @@ -1149,7 +1149,7 @@ { int rc; ipv4InterfaceTable_rowreq_ctx *rowreq_ctx = - netsnmp_container_table_row_extract(requests); + (ipv4InterfaceTable_rowreq_ctx*)netsnmp_container_table_row_extract(requests); netsnmp_table_request_info *tri; DEBUGMSGTL(("internal:ipv4InterfaceTable:_mfd_ipv4InterfaceTable_undo_values", "called\n")); @@ -1204,7 +1204,7 @@ netsnmp_request_info *requests) { ipv4InterfaceTable_rowreq_ctx *rowreq_ctx = - netsnmp_container_table_row_extract(requests); + (ipv4InterfaceTable_rowreq_ctx*)netsnmp_container_table_row_extract(requests); DEBUGMSGTL(("internal:ipv4InterfaceTable:_mfd_ipv4InterfaceTable_irreversible:commit", "called\n")); @@ -1321,7 +1321,7 @@ return NULL; rowreq_ctx = - CONTAINER_FIND(ipv4InterfaceTable_if_ctx.container, &oid_idx); + (ipv4InterfaceTable_rowreq_ctx*)CONTAINER_FIND(ipv4InterfaceTable_if_ctx.container, &oid_idx); return rowreq_ctx; } diff -ruN net-snmp-5.9-orig/agent/mibgroup/mibII/data_access/at_sysctl.c net-snmp-5.9/agent/mibgroup/mibII/data_access/at_sysctl.c --- net-snmp-5.9-orig/agent/mibgroup/mibII/data_access/at_sysctl.c 2020-08-14 16:41:47.000000000 -0500 +++ net-snmp-5.9/agent/mibgroup/mibII/data_access/at_sysctl.c 2021-01-29 05:53:52.000000000 -0600 @@ -67,7 +67,7 @@ if (sysctl(mib, 6, NULL, &needed, NULL, 0) < 0) snmp_log_perror("route-sysctl-estimate"); else { - if ((at = malloc(needed ? needed : 1)) == NULL) + if ((at = (char*)malloc(needed ? needed : 1)) == NULL) snmp_log_perror("malloc"); else { if (sysctl(mib, 6, at, &needed, NULL, 0) < 0) diff -ruN net-snmp-5.9-orig/agent/mibgroup/mibII/icmp.h net-snmp-5.9/agent/mibgroup/mibII/icmp.h --- net-snmp-5.9-orig/agent/mibgroup/mibII/icmp.h 2020-08-14 16:41:47.000000000 -0500 +++ net-snmp-5.9/agent/mibgroup/mibII/icmp.h 2021-01-29 19:53:09.000000000 -0600 @@ -10,7 +10,7 @@ #elif defined(linux) config_require(mibII/kernel_linux) #elif defined(freebsd4) || defined(openbsd4) || defined(dragonfly2) || \ - defined(darwin10) + defined(darwin) config_require(mibII/kernel_sysctl) #elif defined(netbsd) || defined(netbsdelf) config_require(mibII/kernel_netbsd) diff -ruN net-snmp-5.9-orig/agent/mibgroup/mibII/ipAddr.c net-snmp-5.9/agent/mibgroup/mibII/ipAddr.c --- net-snmp-5.9-orig/agent/mibgroup/mibII/ipAddr.c 2020-08-14 16:41:47.000000000 -0500 +++ net-snmp-5.9/agent/mibgroup/mibII/ipAddr.c 2021-01-29 05:55:04.000000000 -0600 @@ -772,7 +772,7 @@ if (sysctl(mib, 6, 0, &len, 0, 0) < 0) return; - ifbuf = malloc(len); + ifbuf = (char*)malloc(len); if (ifbuf == 0) return; if (sysctl(mib, 6, ifbuf, &len, 0, 0) < 0) { diff -ruN net-snmp-5.9-orig/agent/mibgroup/mibII/tcpTable.c net-snmp-5.9/agent/mibgroup/mibII/tcpTable.c --- net-snmp-5.9-orig/agent/mibgroup/mibII/tcpTable.c 2020-08-14 16:41:47.000000000 -0500 +++ net-snmp-5.9/agent/mibgroup/mibII/tcpTable.c 2021-01-29 05:55:21.000000000 -0600 @@ -967,7 +967,7 @@ */ len = 0; if (sysctl(sname, 4, 0, &len, 0, 0) < 0 || - (tcpcb_buf = malloc(len)) == NULL) + (tcpcb_buf = (char*)malloc(len)) == NULL) return -1; if (sysctl(sname, 4, tcpcb_buf, &len, 0, 0) < 0) { free(tcpcb_buf); diff -ruN net-snmp-5.9-orig/agent/mibgroup/mibII/udpTable.c net-snmp-5.9/agent/mibgroup/mibII/udpTable.c --- net-snmp-5.9-orig/agent/mibgroup/mibII/udpTable.c 2020-08-14 16:41:47.000000000 -0500 +++ net-snmp-5.9/agent/mibgroup/mibII/udpTable.c 2021-01-29 05:55:39.000000000 -0600 @@ -685,7 +685,7 @@ */ len = 0; if (sysctl(sname, 4, 0, &len, 0, 0) < 0 || - (udpcb_buf = malloc(len)) == NULL) + (udpcb_buf = (char*)malloc(len)) == NULL) return -1; if (sysctl(sname, 4, udpcb_buf, &len, 0, 0) < 0) { free(udpcb_buf); diff -ruN net-snmp-5.9-orig/agent/mibgroup/mibII/var_route.c net-snmp-5.9/agent/mibgroup/mibII/var_route.c --- net-snmp-5.9-orig/agent/mibgroup/mibII/var_route.c 2020-08-14 16:41:47.000000000 -0500 +++ net-snmp-5.9/agent/mibgroup/mibII/var_route.c 2021-01-29 05:56:01.000000000 -0600 @@ -1803,7 +1803,7 @@ if (len > rtbuflen) { char *newbuf; - newbuf = realloc(rtbuf, len); + newbuf = (char*)realloc(rtbuf, len); if (newbuf == 0) return -1; rtbuf = newbuf; diff -ruN net-snmp-5.9-orig/agent/mibgroup/ucd-snmp/dlmod.c net-snmp-5.9/agent/mibgroup/ucd-snmp/dlmod.c --- net-snmp-5.9-orig/agent/mibgroup/ucd-snmp/dlmod.c 2020-08-14 16:41:47.000000000 -0500 +++ net-snmp-5.9/agent/mibgroup/ucd-snmp/dlmod.c 2021-01-29 05:56:37.000000000 -0600 @@ -232,7 +232,7 @@ dl_function_ptr dl_init; snprintf(sym_init, sizeof(sym_init), "init_%s", dlm->name); - dl_init = dlmod_dlsym(dlm->handle, sym_init); + dl_init = (int (*)())dlmod_dlsym(dlm->handle, sym_init); if (dl_init == NULL) { dlmod_dlclose(dlm->handle); free(dlm->error); @@ -259,10 +259,10 @@ return; snprintf(sym_deinit, sizeof(sym_deinit), "deinit_%s", dlm->name); - dl_deinit = dlmod_dlsym(dlm->handle, sym_deinit); + dl_deinit = (int (*)())dlmod_dlsym(dlm->handle, sym_deinit); if (!dl_deinit) { snprintf(sym_deinit, sizeof(sym_deinit), "shutdown_%s", dlm->name); - dl_deinit = dlmod_dlsym(dlm->handle, sym_deinit); + dl_deinit = (int (*)())dlmod_dlsym(dlm->handle, sym_deinit); } if (dl_deinit) { DEBUGMSGTL(("dlmod", "Calling %s()\n", sym_deinit)); diff -ruN net-snmp-5.9-orig/agent/mibgroup/ucd-snmp/memory_darwin7.c net-snmp-5.9/agent/mibgroup/ucd-snmp/memory_darwin7.c --- net-snmp-5.9-orig/agent/mibgroup/ucd-snmp/memory_darwin7.c 2020-08-14 16:41:47.000000000 -0500 +++ net-snmp-5.9/agent/mibgroup/ucd-snmp/memory_darwin7.c 2021-01-29 05:57:19.000000000 -0600 @@ -44,6 +44,12 @@ #include "memory.h" #include "memory_darwin7.h" +#ifdef HAVE_VM_REGION_64 +#define VM_REGION_FUNC vm_region_64 +#else +#define VM_REGION_FUNC vm_region +#endif + /* * * Swap info * */ @@ -383,7 +389,7 @@ for (address = 0;; address += size) { /* Get memory region. */ count = VM_REGION_EXTENDED_INFO_COUNT; - if (vm_region(tasks[j], &address, &size, VM_REGION_EXTENDED_INFO, (vm_region_extended_info_t)&info, &count, &object_name) != KERN_SUCCESS) { + if (VM_REGION_FUNC(tasks[j], &address, &size, VM_REGION_EXTENDED_INFO, (vm_region_extended_info_t)&info, &count, &object_name) != KERN_SUCCESS) { /* No more memory regions. */ break; } diff -ruN net-snmp-5.9-orig/agent/mibgroup/utilities/iquery.c net-snmp-5.9/agent/mibgroup/utilities/iquery.c --- net-snmp-5.9-orig/agent/mibgroup/utilities/iquery.c 2020-08-14 16:41:47.000000000 -0500 +++ net-snmp-5.9/agent/mibgroup/utilities/iquery.c 2021-01-29 05:57:37.000000000 -0600 @@ -229,7 +229,7 @@ ss->community = netsnmp_memdup(secName, strlen(secName)); ss->community_len = strlen(secName); } - ss->myvoid = netsnmp_check_outstanding_agent_requests; + ss->myvoid = (void*)netsnmp_check_outstanding_agent_requests; ss->flags |= SNMP_FLAGS_RESP_CALLBACK | SNMP_FLAGS_DONT_PROBE; } #endif diff -ruN net-snmp-5.9-orig/configure net-snmp-5.9/configure --- net-snmp-5.9-orig/configure 2020-08-20 12:35:50.000000000 -0500 +++ net-snmp-5.9/configure 2021-01-29 05:59:47.000000000 -0600 @@ -17320,37 +17320,9 @@ ;; darwin*) - # Flat Namespace linking (Mac OS/X) + # Add frameworks (macOS) # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether darwin ld might need -flat_namespace" >&5 -$as_echo_n "checking whether darwin ld might need -flat_namespace... " >&6; } - if test -z "$MACOSX_DEPLOYMENT_TARGET"; then - saved_LDFLAGS="$LDFLAGS" - LDFLAGS="-flat_namespace -framework CoreFoundation -framework CoreServices -framework DiskArbitration -framework IOKit $LDFLAGS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else - LDFLAGS="$saved_LDFLAGS"; { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - fi + LDFLAGS="-Wl,-framework,CoreFoundation -Wl,-framework,CoreServices -Wl,-framework,DiskArbitration -Wl,-framework,IOKit $LDFLAGS" ;; *) diff -ruN net-snmp-5.9-orig/configure.d/config_os_functions net-snmp-5.9/configure.d/config_os_functions --- net-snmp-5.9-orig/configure.d/config_os_functions 2020-08-14 16:41:47.000000000 -0500 +++ net-snmp-5.9/configure.d/config_os_functions 2021-01-29 06:00:49.000000000 -0600 @@ -169,7 +169,8 @@ [sigaction sigblock sighold ] dnl [sigprocmask ] dnl [statfs statvfs stime ] dnl - [strncasecmp system usleep ] ) + [strncasecmp system usleep ] dnl + [vm_region vm_region_64 ] ) # Apps: AC_CHECK_FUNCS([getdtablesize ] dnl diff -ruN net-snmp-5.9-orig/configure.d/config_os_progs net-snmp-5.9/configure.d/config_os_progs --- net-snmp-5.9-orig/configure.d/config_os_progs 2020-08-14 16:41:47.000000000 -0500 +++ net-snmp-5.9/configure.d/config_os_progs 2021-01-29 06:26:13.000000000 -0600 @@ -418,15 +418,7 @@ # Flat Namespace linking (Mac OS/X) # AC_MSG_CHECKING([whether darwin ld might need -flat_namespace]) - if test -z "$MACOSX_DEPLOYMENT_TARGET"; then - saved_LDFLAGS="$LDFLAGS" - LDFLAGS="-flat_namespace -framework CoreFoundation -framework CoreServices -framework DiskArbitration -framework IOKit $LDFLAGS" - AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], - [AC_MSG_RESULT([yes])], - [LDFLAGS="$saved_LDFLAGS"; AC_MSG_RESULT([no])]) - else AC_MSG_RESULT([no]) - fi ;; *) diff -ruN net-snmp-5.9-orig/configure.d/config_project_perl_python net-snmp-5.9/configure.d/config_project_perl_python --- net-snmp-5.9-orig/configure.d/config_project_perl_python 2020-08-14 16:41:47.000000000 -0500 +++ net-snmp-5.9/configure.d/config_project_perl_python 2021-01-29 06:28:09.000000000 -0600 @@ -87,7 +87,7 @@ if test "x$enable_perl_cc_checks" != "xno" ; then AC_MSG_CHECKING([for Perl cc]) changequote(, ) - PERLCC=`$myperl -V:cc | $myperl -n -e 'print if (s/^\s*cc=.([-=\w\s\/]+).;\s*/$1/);'` + PERLCC=`$myperl -V:cc | $myperl -n -e 'print if (s/^\s*cc=.([-=\w\s\.\/]+).;\s*/$1/);'` changequote([, ]) if test "x$PERLCC" != "x" ; then AC_MSG_RESULT([$PERLCC]) @@ -192,7 +192,7 @@ # if test "x$embed_perl" != "xno" ; then AC_MSG_CHECKING([for Perl CFLAGS]) - perlcflags=`$myperl -MExtUtils::Embed -e ccopts` + perlcflags=`$myperl -MExtUtils::Embed -e ccopts | /usr/bin/sed -e 's,-arch [^ ]*,,g'` if test "x$perlcflags" != "x" ; then AC_MSG_RESULT([$perlcflags]) CFLAGS="$CFLAGS $perlcflags" @@ -209,7 +209,7 @@ # if test "x$embed_perl" != "xno" ; then AC_MSG_CHECKING([for Perl LDFLAGS]) - netsnmp_perlldopts=`$myperl -MExtUtils::Embed -e ldopts` + netsnmp_perlldopts=`$myperl -MExtUtils::Embed -e ldopts | /usr/bin/sed -e 's,-arch [^ ]*,,g'` if test "x$netsnmp_perlldopts" != "x" ; then AC_MSG_RESULT([$netsnmp_perlldopts]) else @@ -228,7 +228,7 @@ # AC_MSG_CHECKING([for Perl CCDLFLAGS]) changequote(, ) - netsnmp_perlccdlflags=`$myperl -V:ccdlflags | $myperl -n -e 'print $1 '"if (/^\s*ccdlflags='([^']+)';/);"` + netsnmp_perlccdlflags=`$myperl -V:ccdlflags | /usr/bin/sed -e 's,-arch [^ ]*,,g'` changequote([, ]) AC_MSG_RESULT([$netsnmp_perlccdlflags]) PERLLDOPTS_FOR_APPS="$netsnmp_perlccdlflags" diff -ruN net-snmp-5.9-orig/net-snmp-config.in net-snmp-5.9/net-snmp-config.in --- net-snmp-5.9-orig/net-snmp-config.in 2020-08-14 16:41:47.000000000 -0500 +++ net-snmp-5.9/net-snmp-config.in 2021-01-29 06:28:55.000000000 -0600 @@ -51,17 +51,17 @@ echo "@datarootdir@" >/dev/null NSC_LDFLAGS="@LDFLAGS@" -NSC_LIBS="@LIBS@" -NSC_LNETSNMPLIBS="@LNETSNMPLIBS@" -NSC_LAGENTLIBS="@LAGENTLIBS@ @PERLLDOPTS_FOR_APPS@" -NSC_LMIBLIBS="@LMIBLIBS@" +#NSC_LIBS="@LIBS@" +#NSC_LNETSNMPLIBS="@LNETSNMPLIBS@" +#NSC_LAGENTLIBS="@LAGENTLIBS@ @PERLLDOPTS_FOR_APPS@" +#NSC_LMIBLIBS="@LMIBLIBS@" NSC_INCLUDEDIR=${includedir} NSC_LIBDIR=-L${libdir} NSC_SNMPLIBS="-lnetsnmp ${NSC_LNETSNMPLIBS}" NSC_SUBAGENTLIBS="-lnetsnmpagent ${NSC_LAGENTLIBS} ${NSC_SNMPLIBS}" -NSC_AGENTLIBS="-lnetsnmpmibs ${NSC_LMIBLIBS} ${NSC_SUBAGENTLIBS}" +#NSC_AGENTLIBS="-lnetsnmpmibs ${NSC_LMIBLIBS} ${NSC_SUBAGENTLIBS}" NSC_PREFIX=$prefix NSC_EXEC_PREFIX=$exec_prefix @@ -146,7 +146,7 @@ echo @CFLAGS@ @CPPFLAGS@ -I${NSC_INCLUDEDIR} ;; --cflags|--cf*) - echo @CFLAGS@ @DEVFLAGS@ @CPPFLAGS@ -I. -I${NSC_INCLUDEDIR} + echo @CFLAGS@ @DEVFLAGS@ -I. @CPPFLAGS@ -I${NSC_INCLUDEDIR} ;; --srcdir) echo $NSC_SRCDIR diff -ruN net-snmp-5.9-orig/perl/ASN/Makefile.PL net-snmp-5.9/perl/ASN/Makefile.PL --- net-snmp-5.9-orig/perl/ASN/Makefile.PL 2020-08-14 16:41:47.000000000 -0500 +++ net-snmp-5.9/perl/ASN/Makefile.PL 2021-01-29 06:34:52.000000000 -0600 @@ -81,10 +81,19 @@ die "net-snmp-config failed\n"; if (lc($opts->{'insource'}) eq "true") { - $Params{'LIBS'} = - "-L" . abs_path("../../snmplib/.libs") . - " -L" . abs_path("../../snmplib") . - " " . $Params{'LIBS'}; + my %local_libs = ( + 'netsnmp' => 'snmplib', + 'netsnmpagent' => 'agent', + 'netsnmphelpers' => 'agent/helpers', + 'netsnmpmibs' => 'agent', + 'netsnmptrapd' => 'apps', + ); + foreach (split ' ', $Params{'LIBS'}) { + if (s/^-l// && exists $local_libs{$_}) { + $Params{'LDDLFLAGS'} = $opts->{'rootpath'} . "../$local_libs{$_}/.libs/lib$_.dylib " . $Params{'LDDLFLAGS'}; + } + } + $Params{'LIBS'} = ' '; } } return (%Params); diff -ruN net-snmp-5.9-orig/perl/OID/Makefile.PL net-snmp-5.9/perl/OID/Makefile.PL --- net-snmp-5.9-orig/perl/OID/Makefile.PL 2020-08-14 16:41:47.000000000 -0500 +++ net-snmp-5.9/perl/OID/Makefile.PL 2021-01-29 06:35:34.000000000 -0600 @@ -76,10 +76,19 @@ $lib_version = `$opts->{'nsconfig'} --version` or die "net-snmp-config failed\n"; if (lc($opts->{'insource'}) eq "true") { - $Params{'LIBS'} = - "-L" . abs_path("../../snmplib/.libs") . - " -L" . abs_path("../../snmplib") . - " " . $Params{'LIBS'}; + my %local_libs = ( + 'netsnmp' => 'snmplib', + 'netsnmpagent' => 'agent', + 'netsnmphelpers' => 'agent/helpers', + 'netsnmpmibs' => 'agent', + 'netsnmptrapd' => 'apps', + ); + foreach (split ' ', $Params{'LIBS'}) { + if (s/^-l// && exists $local_libs{$_}) { + $Params{'LDDLFLAGS'} = $opts->{'rootpath'} . "../$local_libs{$_}/.libs/lib$_.dylib " . $Params{'LDDLFLAGS'}; + } + } + $Params{'LIBS'} = ' '; # } else { # $Params{'PREREQ_PM'} = {'SNMP' => '5.0'}; } diff -ruN net-snmp-5.9-orig/perl/SNMP/Makefile.PL net-snmp-5.9/perl/SNMP/Makefile.PL --- net-snmp-5.9-orig/perl/SNMP/Makefile.PL 2020-08-14 16:41:47.000000000 -0500 +++ net-snmp-5.9/perl/SNMP/Makefile.PL 2021-01-29 06:36:24.000000000 -0600 @@ -87,10 +87,19 @@ $lib_version = `$opts->{'nsconfig'} --version` or die "net-snmp-config failed\n"; if (lc($opts->{'insource'}) eq "true") { - $Params{'LIBS'} = - "-L" . abs_path("../../snmplib/.libs") . - " -L" . abs_path("../../snmplib") . - " " . $Params{'LIBS'}; + my %local_libs = ( + 'netsnmp' => 'snmplib', + 'netsnmpagent' => 'agent', + 'netsnmphelpers' => 'agent/helpers', + 'netsnmpmibs' => 'agent', + 'netsnmptrapd' => 'apps', + ); + foreach (split ' ', $Params{'LIBS'}) { + if (s/^-l// && exists $local_libs{$_}) { + $Params{'LDDLFLAGS'} = $opts->{'rootpath'} . "../$local_libs{$_}/.libs/lib$_.dylib " . $Params{'LDDLFLAGS'}; + } + } + $Params{'LIBS'} = ' '; # } else { # $Params{'PREREQ_PM'} = { 'NetSNMP::default_store' => 0.01 }; } diff -ruN net-snmp-5.9-orig/perl/TrapReceiver/Makefile.PL net-snmp-5.9/perl/TrapReceiver/Makefile.PL --- net-snmp-5.9-orig/perl/TrapReceiver/Makefile.PL 2020-08-14 16:41:47.000000000 -0500 +++ net-snmp-5.9/perl/TrapReceiver/Makefile.PL 2021-01-29 06:37:01.000000000 -0600 @@ -108,14 +108,19 @@ chomp($Params{'LIBS'}); if (lc($opts->{'insource'}) eq "true") { - $Params{'LIBS'} = - "-L" . abs_path("../../apps/.libs") . - " -L" . abs_path("../../apps") . - " -L" . abs_path("../../agent/.libs") . - " -L" . abs_path("../../agent") . - " -L" . abs_path("../../snmplib/.libs") . - " -L" . abs_path("../../snmplib") . - " " . $Params{'LIBS'}; + my %local_libs = ( + 'netsnmp' => 'snmplib', + 'netsnmpagent' => 'agent', + 'netsnmphelpers' => 'agent/helpers', + 'netsnmpmibs' => 'agent', + 'netsnmptrapd' => 'apps', + ); + foreach (split ' ', $Params{'LIBS'}) { + if (s/^-l// && exists $local_libs{$_}) { + $Params{'LDDLFLAGS'} = $opts->{'rootpath'} . "../$local_libs{$_}/.libs/lib$_.dylib " . $Params{'LDDLFLAGS'}; + } + } + $Params{'LIBS'} = ' '; } else { $Params{'LIBS'} = `$opts->{'nsconfig'} --libdir` . " $Params{'LIBS'}"; } diff -ruN net-snmp-5.9-orig/perl/agent/Makefile.PL net-snmp-5.9/perl/agent/Makefile.PL --- net-snmp-5.9-orig/perl/agent/Makefile.PL 2020-08-14 16:41:47.000000000 -0500 +++ net-snmp-5.9/perl/agent/Makefile.PL 2021-01-29 06:39:31.000000000 -0600 @@ -81,12 +81,19 @@ $lib_version = `$opts->{'nsconfig'} --version` or die "net-snmp-config failed\n"; if (lc($opts->{'insource'}) eq "true") { - $Params{'LIBS'} = - "-L" . abs_path("../../snmplib/.libs") . - " -L" . abs_path("../../snmplib") . - " -L" . abs_path("../../agent/.libs") . - " -L" . abs_path("../../agent") . - " " . $Params{'LIBS'}; + my %local_libs = ( + 'netsnmp' => 'snmplib', + 'netsnmpagent' => 'agent', + 'netsnmphelpers' => 'agent/helpers', + 'netsnmpmibs' => 'agent', + 'netsnmptrapd' => 'apps', + ); + foreach (split ' ', $Params{'LIBS'}) { + if (s/^-l// && exists $local_libs{$_}) { + $Params{'LDDLFLAGS'} = $opts->{'rootpath'} . "../$local_libs{$_}/.libs/lib$_.dylib " . $Params{'LDDLFLAGS'}; + } + } + $Params{'LIBS'} = ' '; # } else { $Params{'LIBS'} = `$opts->{'nsconfig'} --libdir` . $Params{'LIBS'}; # $Params{'PREREQ_PM'} = {'NetSNMP::OID' => '0.1'}; diff -ruN net-snmp-5.9-orig/perl/agent/Support/Makefile.PL net-snmp-5.9/perl/agent/Support/Makefile.PL --- net-snmp-5.9-orig/perl/agent/Support/Makefile.PL 2020-08-14 16:41:47.000000000 -0500 +++ net-snmp-5.9/perl/agent/Support/Makefile.PL 2021-01-29 06:41:18.000000000 -0600 @@ -71,6 +71,7 @@ } else { + $Params{'LDDLFLAGS'} = "$Config{lddlflags} " . `$opts->{'nsconfig'} --ldflags`; $Params{'LIBS'} = `$opts->{'nsconfig'} --libs` or die "net-snmp-config failed\n"; chomp($Params{'LIBS'}); diff -ruN net-snmp-5.9-orig/perl/agent/default_store/Makefile.PL net-snmp-5.9/perl/agent/default_store/Makefile.PL --- net-snmp-5.9-orig/perl/agent/default_store/Makefile.PL 2020-08-14 16:41:47.000000000 -0500 +++ net-snmp-5.9/perl/agent/default_store/Makefile.PL 2021-01-29 06:41:06.000000000 -0600 @@ -66,16 +66,26 @@ } } else { + $Params{'LDDLFLAGS'} = "$Config{lddlflags} " . `$opts->{'nsconfig'} --ldflags`; $Params{'LIBS'} = `$opts->{'nsconfig'} --libs` or die "net-snmp-config failed\n"; chomp($Params{'LIBS'}); $lib_version = `$opts->{'nsconfig'} --version` or die "net-snmp-config failed\n"; if ($opts->{'insource'} eq "true") { - $Params{'LIBS'} = - "-L" . abs_path("../../../snmplib/.libs") . - " -L" . abs_path("../../../snmplib") . - " " . $Params{'LIBS'}; + my %local_libs = ( + 'netsnmp' => 'snmplib', + 'netsnmpagent' => 'agent', + 'netsnmphelpers' => 'agent/helpers', + 'netsnmpmibs' => 'agent', + 'netsnmptrapd' => 'apps', + ); + foreach (split ' ', $Params{'LIBS'}) { + if (s/^-l// && exists $local_libs{$_}) { + $Params{'LDDLFLAGS'} = $opts->{'rootpath'} . "../$local_libs{$_}/.libs/lib$_.dylib " . $Params{'LDDLFLAGS'}; + } + } + $Params{'LIBS'} = ' '; } } diff -ruN net-snmp-5.9-orig/perl/default_store/Makefile.PL net-snmp-5.9/perl/default_store/Makefile.PL --- net-snmp-5.9-orig/perl/default_store/Makefile.PL 2020-08-14 16:41:47.000000000 -0500 +++ net-snmp-5.9/perl/default_store/Makefile.PL 2021-01-29 06:41:45.000000000 -0600 @@ -71,10 +71,19 @@ $lib_version = `$opts->{'nsconfig'} --version` or die "net-snmp-config failed\n"; if (lc($opts->{'insource'}) eq "true") { - $Params{'LIBS'} = - "-L" . abs_path("../../snmplib/.libs") . - " -L" . abs_path("../../snmplib") . - " " . $Params{'LIBS'}; + my %local_libs = ( + 'netsnmp' => 'snmplib', + 'netsnmpagent' => 'agent', + 'netsnmphelpers' => 'agent/helpers', + 'netsnmpmibs' => 'agent', + 'netsnmptrapd' => 'apps', + ); + foreach (split ' ', $Params{'LIBS'}) { + if (s/^-l// && exists $local_libs{$_}) { + $Params{'LDDLFLAGS'} = $opts->{'rootpath'} . "../$local_libs{$_}/.libs/lib$_.dylib " . $Params{'LDDLFLAGS'}; + } + } + $Params{'LIBS'} = ' '; } } diff -ruN net-snmp-5.9-orig/testing/Makefile.in net-snmp-5.9/testing/Makefile.in --- net-snmp-5.9-orig/testing/Makefile.in 2020-08-14 16:41:47.000000000 -0500 +++ net-snmp-5.9/testing/Makefile.in 2021-01-29 06:43:12.000000000 -0600 @@ -11,7 +11,7 @@ @NON_GNU_VPATH@ $(srcdir) USELIBS = ../snmplib/libsnmp.$(LIB_EXTENSION)$(LIB_VERSION) -LIBS = -L../snmplib $(CC_RUNTIME_ARG) -lsnmp @LIBS@ +LIBS = $(CC_RUNTIME_ARG) @LIBS@ PARSEOBJS = diff -ruN net-snmp-5.9-orig/testing/fulltests/default/T070com2sec_simple net-snmp-5.9/testing/fulltests/default/T070com2sec_simple --- net-snmp-5.9-orig/testing/fulltests/default/T070com2sec_simple 2020-08-14 16:41:47.000000000 -0500 +++ net-snmp-5.9/testing/fulltests/default/T070com2sec_simple 2021-01-29 06:43:50.000000000 -0600 @@ -131,7 +131,8 @@ SAVECHECKAGENT '<"c405k", 0.0.0.0/0.0.0.0> => "t405k"' SAVECHECKAGENT '<"c405l", 0.0.0.0/0.0.0.0> => "t405l"' SAVECHECKAGENT '<"c406a", 255.255.255.255/255.255.255.255> => "t406a"' -SAVECHECKAGENT 'line 30: Error:' # msg from h_strerror so it varies +# test fails if "no.such.address." resolves due to DNS wildcarding +# SAVECHECKAGENT 'line 30: Error:' # msg from h_strerror so it varies SAVECHECKAGENT 'line 31: Error:' # msg from h_strerror so it varies if false; then diff -ruN net-snmp-5.9-orig/testing/fulltests/default/T071com2sec6_simple net-snmp-5.9/testing/fulltests/default/T071com2sec6_simple --- net-snmp-5.9-orig/testing/fulltests/default/T071com2sec6_simple 2020-08-14 16:41:47.000000000 -0500 +++ net-snmp-5.9/testing/fulltests/default/T071com2sec6_simple 2021-01-29 06:44:33.000000000 -0600 @@ -139,7 +139,7 @@ # https://en.wikipedia.org/wiki/DNS_rebinding. # 608 - CHECKAGENT '<"c608a"' + #CHECKAGENT '<"c608a"' if [ "$snmp_last_test_result" -eq 0 ] ; then CHECKAGENT 'line 29: Error:' errnum=`expr $errnum - 1` @@ -150,7 +150,7 @@ FINISHED fi - CHECKAGENTCOUNT atleastone '<"c608b"' + #CHECKAGENTCOUNT atleastone '<"c608b"' if [ "$snmp_last_test_result" -eq 0 ] ; then CHECKAGENT 'line 30: Error:' if [ "$snmp_last_test_result" -eq 1 ] ; then