+ AC_CHECK_LIB([rdkafka], [rd_kafka_new],
+ [with_librdkafka="yes"],
+ [with_librdkafka="no (Symbol 'rd_kafka_new' not found)"])
+
+ AC_CHECK_LIB([rdkafka], [rd_kafka_conf_set_log_cb],
+ [with_librdkafka_log_cb="yes"],
+ [with_librdkafka_log_cb="no"])
+
+ AC_CHECK_LIB([rdkafka], [rd_kafka_set_logger],
+ [with_librdkafka_logger="yes"],
+ [with_librdkafka_logger="no"]
+ )
+
+ LDFLAGS="$SAVE_LDFLAGS"
+fi
+
+if test "x$with_librdkafka" = "xyes"; then
+ BUILD_WITH_LIBRDKAFKA_CPPFLAGS="$with_librdkafka_cppflags"
+ BUILD_WITH_LIBRDKAFKA_LDFLAGS="$with_librdkafka_ldflags"
+
+ if test "x$with_librdkafka_rpath" != "x"; then
+ BUILD_WITH_LIBRDKAFKA_LIBS="-Wl,-rpath,$with_librdkafka_rpath -lrdkafka"
+ else
+ BUILD_WITH_LIBRDKAFKA_LIBS="-lrdkafka"
+ fi
+
+ if test "x$with_librdkafka_log_cb" = "xyes"; then
+ AC_DEFINE(HAVE_LIBRDKAFKA_LOG_CB, 1, [Define if librdkafka log facility is present and usable.])
+ else if test "x$with_librdkafka_logger" = "xyes"; then
+ AC_DEFINE(HAVE_LIBRDKAFKA_LOGGER, 1, [Define if librdkafka log facility is present and usable.])
+ fi; fi
+fi
+
+AC_SUBST([BUILD_WITH_LIBRDKAFKA_CPPFLAGS])
+AC_SUBST([BUILD_WITH_LIBRDKAFKA_LDFLAGS])
+AC_SUBST([BUILD_WITH_LIBRDKAFKA_LIBS])
+# }}}
+
+# --with-librouteros {{{
+AC_ARG_WITH([librouteros],
+ [AS_HELP_STRING([--with-librouteros@<:@=PREFIX@:>@], [Path to librouteros.])],
+ [
+ if test "x$withval" = "xyes" || test "x$withval" = "xno"; then
+ with_librouteros="$witval"
+ else
+ with_librouteros_cppflags="-I$withval/include"
+ with_librouteros_ldflags="-L$withval/lib"
+ with_librouteros="yes"
+ fi
+ ],
+ [with_librouteros="yes"]
+)
+
+if test "x$with_librouteros" = "xyes"; then
+ SAVE_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS $with_librouteros_cppflags"
+
+ AC_CHECK_HEADERS([routeros_api.h],
+ [with_librouteros="yes"],
+ [with_librouteros="no (routeros_api.h not found)"]
+ )
+
+ CPPFLAGS="$SAVE_CPPFLAGS"
+fi
+
+if test "x$with_librouteros" = "xyes"; then
+ SAVE_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $with_librouteros_ldflags"
+
+ AC_CHECK_LIB([routeros], [ros_interface],
+ [with_librouteros="yes"],
+ [with_librouteros="no (symbol 'ros_interface' not found)"]
+ )
+
+ LDFLAGS="$SAVE_LDFLAGS"
+fi
+
+if test "x$with_librouteros" = "xyes"; then
+ BUILD_WITH_LIBROUTEROS_CPPFLAGS="$with_librouteros_cppflags"
+ BUILD_WITH_LIBROUTEROS_LDFLAGS="$with_librouteros_ldflags"
+fi
+
+AC_SUBST([BUILD_WITH_LIBROUTEROS_CPPFLAGS])
+AC_SUBST([BUILD_WITH_LIBROUTEROS_LDFLAGS])
+# }}}
+
+# --with-librrd {{{
+librrd_threadsafe="no"
+librrd_rrdc_update="no"
+AC_ARG_WITH([librrd],
+ [AS_HELP_STRING([--with-librrd@<:@=PREFIX@:>@], [Path to rrdtool.])],
+ [
+ if test "x$withval" != "xno" && test "x$withval" != "xyes"; then
+ librrd_cflags="-I$withval/include"
+ librrd_ldflags="-L$withval/lib"
+ with_librrd="yes"
+ else
+ with_librrd="$withval"
+ fi
+ ],
+ [with_librrd="yes"]
+)
+
+if test "x$with_librrd" = "xyes"; then
+ SAVE_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $librrd_ldflags"
+ PKG_CHECK_MODULES([RRD], [librrd >= 1.6.0],
+ [
+ AC_CHECK_LIB([rrd], [rrd_update_r],
+ [librrd_threadsafe="yes"],
+ [:]
+ )
+ AC_CHECK_LIB([rrd], [rrdc_update],
+ [librrd_rrdc_update="yes"],
+ [:]
+ )
+ ],[:]
+ )
+ LDFLAGS="$SAVE_LDFLAGS"
+
+ SAVE_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS $RRD_CFLAGS $librrd_cflags"
+
+ AC_CHECK_HEADERS([rrd.h],, [with_librrd="no (rrd.h not found)"])
+
+ CPPFLAGS="$SAVE_CPPFLAGS"
+fi
+
+if test "x$with_librrd" = "xyes" && test "x$librrd_threadsafe" = "xno"; then
+ SAVE_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $librrd_ldflags"
+
+ AC_CHECK_LIB([rrd_th], [rrd_update_r],