Index: m4/netsnmp.m4
===================================================================
--- m4/netsnmp.m4	(revision 50302)
+++ m4/netsnmp.m4	(revision 50303)
@@ -6,7 +6,7 @@
 # specify whether to default to --with-net-snmp or --without-net-snmp.
 # If not supplied, DEFAULT-ACTION is no.
 #
-# This macro #defines HAVE_SNMP and HAVE_NETSNMP if a required header files is
+# This macro #defines HAVE_NETSNMP if required header files are
 # found, and sets @SNMP_LDFLAGS@ and @SNMP_CFLAGS@ to the necessary
 # values.
 #
@@ -55,7 +55,7 @@
 			esac
 		done
 
-		_full_libnetsnmp_libs="`$_libnetsnmp_config --libs` -lcrypto"
+		_full_libnetsnmp_libs="`$_libnetsnmp_config --netsnmp-libs`"
 		for i in $_full_libnetsnmp_libs; do
 			case $i in
 				-L*)
@@ -68,6 +68,7 @@
 		done
 
 		if test "x$enable_static" = "xyes"; then
+			_full_libnetsnmp_libs="`$_libnetsnmp_config --libs`"
 			for i in $_full_libnetsnmp_libs; do
 				case $i in
 					-lnetsnmp)
@@ -103,7 +104,7 @@
 struct snmp_session session;
 session.localname = "";
 		],
-		AC_DEFINE(HAVE_SNMP_SESSION_LOCALNAME, 1, [Define to 1 if 'session.localname' exist.])
+		AC_DEFINE(HAVE_NETSNMP_SESSION_LOCALNAME, 1, [Define to 1 if 'session.localname' exist.])
 		AC_MSG_RESULT(yes),
 		AC_MSG_RESULT(no))
 
@@ -115,8 +116,6 @@
 		unset _save_netsnmp_libs
 
 		AC_DEFINE(HAVE_NETSNMP, 1, [Define to 1 if Net-SNMP should be enabled.])
-		AC_DEFINE(HAVE_SNMP, 1, [Define to 1 if SNMP should be enabled.])
-		AC_DEFINE([SNMP_NO_DEBUGGING], [], [Disabling debugging messages from Net-SNMP library])
 
 		found_netsnmp="yes"
 	else
Index: include/sysinc.h
===================================================================
--- include/sysinc.h	(revision 50302)
+++ include/sysinc.h	(revision 50303)
@@ -392,6 +392,7 @@
 
 /* Net-SNMP is used */
 #ifdef HAVE_NETSNMP
+#	define SNMP_NO_DEBUGGING		/* disabling debugging messages from Net-SNMP library */
 #	include <net-snmp/net-snmp-config.h>
 #	include <net-snmp/net-snmp-includes.h>
 #endif
Index: src/zabbix_proxy/proxy.c
===================================================================
--- src/zabbix_proxy/proxy.c	(revision 50302)
+++ src/zabbix_proxy/proxy.c	(revision 50303)
@@ -595,7 +595,7 @@
 	else
 		zabbix_open_log(LOG_TYPE_FILE, CONFIG_LOG_LEVEL, CONFIG_LOG_FILE);
 
-#ifdef HAVE_SNMP
+#ifdef HAVE_NETSNMP
 #	define SNMP_FEATURE_STATUS 	"YES"
 #else
 #	define SNMP_FEATURE_STATUS 	" NO"
@@ -738,7 +738,7 @@
 	}
 	else if (proxy_num <= (proxy_count += CONFIG_POLLER_FORKS))
 	{
-#ifdef HAVE_SNMP
+#ifdef HAVE_NETSNMP
 		init_snmp("zabbix_proxy");
 #endif
 
@@ -748,7 +748,7 @@
 	}
 	else if (proxy_num <= (proxy_count += CONFIG_UNREACHABLE_POLLER_FORKS))
 	{
-#ifdef HAVE_SNMP
+#ifdef HAVE_NETSNMP
 		init_snmp("zabbix_proxy");
 #endif
 
@@ -782,7 +782,7 @@
 	}
 	else if (proxy_num <= (proxy_count += CONFIG_DISCOVERER_FORKS))
 	{
-#ifdef HAVE_SNMP
+#ifdef HAVE_NETSNMP
 		init_snmp("zabbix_proxy");
 #endif
 
Index: src/zabbix_server/server.c
===================================================================
--- src/zabbix_server/server.c	(revision 50302)
+++ src/zabbix_server/server.c	(revision 50303)
@@ -579,7 +579,7 @@
 	else
 		zabbix_open_log(LOG_TYPE_FILE, CONFIG_LOG_LEVEL, CONFIG_LOG_FILE);
 
-#ifdef HAVE_SNMP
+#ifdef HAVE_NETSNMP
 #	define SNMP_FEATURE_STATUS	"YES"
 #else
 #	define SNMP_FEATURE_STATUS	" NO"
@@ -758,7 +758,7 @@
 	}
 	else if (server_num <= (server_count += CONFIG_POLLER_FORKS))
 	{
-#ifdef HAVE_SNMP
+#ifdef HAVE_NETSNMP
 		init_snmp("zabbix_server");
 #endif
 
@@ -768,7 +768,7 @@
 	}
 	else if (server_num <= (server_count += CONFIG_UNREACHABLE_POLLER_FORKS))
 	{
-#ifdef HAVE_SNMP
+#ifdef HAVE_NETSNMP
 		init_snmp("zabbix_server");
 #endif
 
@@ -820,7 +820,7 @@
 	}
 	else if (server_num <= (server_count += CONFIG_DISCOVERER_FORKS))
 	{
-#ifdef HAVE_SNMP
+#ifdef HAVE_NETSNMP
 		init_snmp("zabbix_server");
 #endif
 
Index: src/zabbix_server/poller/checks_snmp.c
===================================================================
--- src/zabbix_server/poller/checks_snmp.c	(revision 50302)
+++ src/zabbix_server/poller/checks_snmp.c	(revision 50303)
@@ -22,7 +22,7 @@
 #include "zbxalgo.h"
 #include "zbxjson.h"
 
-#ifdef HAVE_SNMP
+#ifdef HAVE_NETSNMP
 
 extern int	CONFIG_SNMP_BULK_REQUESTS;
 
@@ -449,7 +449,7 @@
 		zabbix_log(LOG_LEVEL_DEBUG, "SNMPv3 [%s@%s]", session.securityName, session.peername);
 	}
 
-#ifdef HAVE_SNMP_SESSION_LOCALNAME
+#ifdef HAVE_NETSNMP_SESSION_LOCALNAME
 	if (NULL != CONFIG_SOURCE_IP)
 	{
 		/* In some cases specifying just local host (without local port) is not enough. We do */
@@ -1679,4 +1679,4 @@
 	zabbix_log(LOG_LEVEL_DEBUG, "End of %s()", __function_name);
 }
 
-#endif	/* HAVE_SNMP */
+#endif	/* HAVE_NETSNMP */
Index: src/zabbix_server/poller/poller.c
===================================================================
--- src/zabbix_server/poller/poller.c	(revision 50302)
+++ src/zabbix_server/poller/poller.c	(revision 50303)
@@ -624,7 +624,7 @@
 	/* retrieve item values */
 	if (SUCCEED == is_snmp_type(items[0].type))
 	{
-#ifdef HAVE_SNMP
+#ifdef HAVE_NETSNMP
 		/* SNMP checks use their own timeouts */
 		get_values_snmp(items, results, errcodes, num);
 #else
Index: src/zabbix_server/discoverer/discoverer.c
===================================================================
--- src/zabbix_server/discoverer/discoverer.c	(revision 50302)
+++ src/zabbix_server/discoverer/discoverer.c	(revision 50303)
@@ -233,7 +233,7 @@
 						ret = FAIL;
 				}
 				else
-#ifdef HAVE_SNMP
+#ifdef HAVE_NETSNMP
 				{
 					item.snmp_community = strdup(dcheck->snmp_community);
 					item.snmp_oid = strdup(dcheck->key_);
@@ -284,7 +284,7 @@
 				}
 #else
 					ret = FAIL;
-#endif	/* HAVE_SNMP */
+#endif	/* HAVE_NETSNMP */
 
 				if (FAIL == ret && ISSET_MSG(&result))
 				{
