kloczek / rpms / net-snmp

Forked from rpms/net-snmp 6 years ago
Clone
Blob Blame History Raw
--- net-snmp-5.7.3/configure.d/config_os_libs2
+++ net-snmp-5.7.3/configure.d/config_os_libs2
@@ -511,6 +511,16 @@ if test "x$with_mysql" = "xyes" ; then
       [AC_MSG_RESULT(no)
        AC_DEFINE([HAVE_BROKEN_LIBMYSQLCLIENT], 1,
                  [Define if using MY_INIT() causes a linker error])])
+  AC_MSG_CHECKING([whether my_load_defaults() exists])
+  AC_LINK_IFELSE([
+    AC_LANG_PROGRAM(
+      [[#include <my_global.h>
+        #include <my_sys.h>]],
+      [[my_load_defaults("my_init_test")]])],
+      [AC_MSG_RESULT(yes)
+       AC_DEFINE([HAVE_MY_LOAD_DEFAULTS], 1,
+                 [Define if having my_load_defaults])],
+      [AC_MSG_RESULT(no)])
   CPPFLAGS="${_cppflags}"
   LIBS="${_libs}"
   AC_MSG_CACHE_ADD(MYSQL Trap Logging:         enabled)
--- net-snmp-5.7.3/include/net-snmp/net-snmp-config.h.in
+++ net-snmp-5.7.3/include/net-snmp/net-snmp-config.h.in
@@ -464,6 +464,9 @@
 /* Define to 1 if you have the <mtab.h> header file. */
 #undef HAVE_MTAB_H
 
+/* Define if having my_load_defaults */
+#undef HAVE_MY_LOAD_DEFAULTS
+
 /* Define to 1 if you have the <nbutil.h> header file. */
 #undef HAVE_NBUTIL_H
 
--- net-snmp-5.7.3/apps/snmptrapd_sql.c
+++ net-snmp-5.7.3/apps/snmptrapd_sql.c
@@ -444,8 +444,12 @@
 #endif
 
     /** load .my.cnf values */
+#if HAVE_MY_LOAD_DEFAULTS
+    my_load_defaults ("my", _sql.groups, &not_argc, &not_argv, 0);
+#else
     load_defaults ("my", _sql.groups, &not_argc, &not_argv);
 #endif
+#endif
     for(i=0; i < not_argc; ++i) {
         if (NULL == not_argv[i])
             continue;