+
+if test "x$with_libmysql" = "xyes"; then
+ with_mysql_libs=`$with_mysql_config --libs_r 2>/dev/null`
+ if test $? -ne 0; then
+ with_libmysql="no ($with_mysql_config failed)"
+ else
+ SAVE_LIBS="$LIBS"
+ LIBS="$with_mysql_libs"
+
+ AC_SEARCH_LIBS([mysql_get_server_version],
+ [],
+ [with_libmysql="yes"],
+ [with_libmysql="no (symbol 'mysql_get_server_version' not found in ${LIBS})"],
+ []
+ )
+ LIBS="$SAVE_LIBS"
+ fi
+fi
+
+if test "x$with_libmysql" = "xyes"; then
+ BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags"
+ BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs"
+fi
+
+AC_SUBST([BUILD_WITH_LIBMYSQL_CFLAGS])
+AC_SUBST([BUILD_WITH_LIBMYSQL_LIBS])
+# }}}
+
+# --with-libmnl {{{
+AC_ARG_WITH([libmnl],
+ [AS_HELP_STRING([--with-libmnl@<:@=PREFIX@:>@], [Path to libmnl.])],
+ [
+ if test "x$withval" = "xyes"; then
+ with_libmnl="yes"
+ else if test "x$withval" = "xno"; then
+ with_libmnl="no"
+ else
+ if test -d "$withval/include"; then
+ with_libmnl_cflags="-I$withval/include"
+ with_libmnl_libs="-L$withval/lib -lmnl"
+ with_libmnl="yes"
+ else
+ AC_MSG_ERROR("no such directory: $withval/include")
+ fi
+ fi; fi
+ ],
+ [
+ if test "x$ac_system" = "xLinux"; then
+ with_libmnl="yes"
+ else
+ with_libmnl="no (Linux only library)"
+ fi
+ ]
+)
+
+if test "x$with_libmnl" = "xyes"; then
+ if $PKG_CONFIG --exists libmnl 2>/dev/null; then
+ with_libmnl_cflags="$with_libmnl_ldflags `$PKG_CONFIG --cflags libmnl`"
+ with_libmnl_libs="$with_libmnl_libs `$PKG_CONFIG --libs libmnl`"
+ fi
+
+ AC_CHECK_HEADERS([libmnl.h libmnl/libmnl.h],
+ [
+ with_libmnl="yes"
+ break
+ ],
+ [],
+ [[
+ #include <stdio.h>
+ #include <sys/types.h>
+ #include <asm/types.h>
+ #include <sys/socket.h>
+ #include <linux/netlink.h>
+ #include <linux/rtnetlink.h>]]
+ )
+
+ AC_CHECK_HEADERS([linux/gen_stats.h linux/pkt_sched.h],
+ [],
+ [],
+ [[
+ #include <stdio.h>
+ #include <sys/types.h>
+ #include <asm/types.h>
+ #include <sys/socket.h>
+ ]]
+ )
+
+ AC_COMPILE_IFELSE(
+ [
+ AC_LANG_PROGRAM(
+ [[
+ #include <stdio.h>
+ #include <sys/types.h>
+ #include <asm/types.h>
+ #include <sys/socket.h>
+ #include <linux/netlink.h>
+ #include <linux/rtnetlink.h>
+ ]],
+ [[
+ int retval = TCA_STATS2;
+ return retval;
+ ]]
+ )
+ ],
+ [AC_DEFINE([HAVE_TCA_STATS2], [1], [True if the enum-member TCA_STATS2 exists])]
+ )
+
+ AC_COMPILE_IFELSE(
+ [
+ AC_LANG_PROGRAM(
+ [[
+ #include <stdio.h>
+ #include <sys/types.h>
+ #include <asm/types.h>
+ #include <sys/socket.h>
+ #include <linux/netlink.h>
+ #include <linux/rtnetlink.h>
+ ]],
+ [[
+ int retval = TCA_STATS;
+ return retval;
+ ]]
+ )
+ ],
+ [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])]
+ )
+
+ AC_CHECK_MEMBERS([struct rtnl_link_stats64.tx_window_errors],
+ [AC_DEFINE(HAVE_RTNL_LINK_STATS64, 1, [Define if struct rtnl_link_stats64 exists and is usable.])],
+ [],
+ [[#include <linux/if_link.h>]]
+ )
+
+ AC_CHECK_LIB([mnl], [mnl_nlmsg_get_payload],
+ [with_libmnl="yes"],
+ [with_libmnl="no (symbol 'mnl_nlmsg_get_payload' not found)"],
+ [$with_libmnl_libs]
+ )
+fi
+
+if test "x$with_libmnl" = "xyes"; then
+ BUILD_WITH_LIBMNL_CFLAGS="$with_libmnl_cflags"
+ BUILD_WITH_LIBMNL_LIBS="$with_libmnl_libs"
+fi
+AC_SUBST([BUILD_WITH_LIBMNL_CFLAGS])
+AC_SUBST([BUILD_WITH_LIBMNL_LIBS])
+# }}}
+
+# --with-libnetapp {{{
+AC_ARG_VAR([LIBNETAPP_CPPFLAGS], [C preprocessor flags required to build with libnetapp])
+AC_ARG_VAR([LIBNETAPP_LDFLAGS], [Linker flags required to build with libnetapp])
+AC_ARG_VAR([LIBNETAPP_LIBS], [Other libraries required to link against libnetapp])
+AC_ARG_WITH([libnetapp],
+ [AS_HELP_STRING([--with-libnetapp@<:@=PREFIX@:>@], [Path to libnetapp.])],
+ [
+ if test -d "$withval"; then
+ LIBNETAPP_CPPFLAGS="$LIBNETAPP_CPPFLAGS -I$withval/include"
+ LIBNETAPP_LDFLAGS="$LIBNETAPP_LDFLAGS -L$withval/lib"
+ with_libnetapp="yes"
+ else
+ with_libnetapp="$withval"
+ fi
+ ],
+ [with_libnetapp="yes"]
+)
+
+SAVE_CPPFLAGS="$CPPFLAGS"
+SAVE_LDFLAGS="$LDFLAGS"
+CPPFLAGS="$CPPFLAGS $LIBNETAPP_CPPFLAGS"
+LDFLAGS="$LDFLAGS $LIBNETAPP_LDFLAGS"
+
+if test "x$with_libnetapp" = "xyes"; then
+ if test "x$LIBNETAPP_CPPFLAGS" != "x"; then
+ AC_MSG_NOTICE([netapp CPPFLAGS: $LIBNETAPP_CPPFLAGS])
+ fi
+ AC_CHECK_HEADERS([netapp_api.h],
+ [with_libnetapp="yes"],
+ [with_libnetapp="no (netapp_api.h not found)"]
+ )
+fi
+
+if test "x$with_libnetapp" = "xyes"; then
+ if test "x$LIBNETAPP_LDFLAGS" != "x"; then
+ AC_MSG_NOTICE([netapp LDFLAGS: $LIBNETAPP_LDFLAGS])
+ fi
+
+ if test "x$LIBNETAPP_LIBS" = "x"; then
+ LIBNETAPP_LIBS="$PTHREAD_LIBS -lxml -ladt -lssl -lm -lcrypto -lz"
+ fi
+
+ AC_MSG_NOTICE([netapp LIBS: $LIBNETAPP_LIBS])
+
+ AC_CHECK_LIB([netapp], [na_server_invoke_elem],
+ [with_libnetapp="yes"],
+ [with_libnetapp="no (symbol na_server_invoke_elem not found)"],
+ [$LIBNETAPP_LIBS]
+ )
+
+ LIBNETAPP_LIBS="-lnetapp $LIBNETAPP_LIBS"
+fi
+
+CPPFLAGS="$SAVE_CPPFLAGS"
+LDFLAGS="$SAVE_LDFLAGS"
+
+AC_SUBST([LIBNETAPP_CPPFLAGS])
+AC_SUBST([LIBNETAPP_LDFLAGS])
+AC_SUBST([LIBNETAPP_LIBS])
+# }}}
+
+# --with-libnetsnmp {{{
+AC_ARG_WITH([libnetsnmp],
+ [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to libnetsnmp.])],
+ [
+ if test "x$withval" = "xno"; then
+ with_libnetsnmp="no"
+ else if test "x$withval" = "xyes"; then
+ with_libnetsnmp="yes"
+ else
+ with_libnetsnmp_cppflags="-I$withval/include"
+ with_libnetsnmp_ldflags="-I$withval/lib"
+ with_libnetsnmp="yes"
+ fi; fi
+ ],
+ [with_libnetsnmp="yes"]
+)
+
+if test "x$with_libnetsnmp" = "xyes"; then
+ SAVE_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS $with_libnetsnmp_cppflags"
+
+ AC_CHECK_HEADERS([net-snmp/net-snmp-config.h],
+ [with_libnetsnmp="yes"],
+ [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"]
+ )
+
+ AC_CHECK_HEADERS([net-snmp/net-snmp-includes.h],
+ [with_libnetsnmp="yes"],
+ [with_libnetsnmp="no (net-snmp/net-snmp-includes.h not found)"],
+ [[
+ #if HAVE_NET_SNMP_NET_SNMP_CONFIG_H
+ # include <net-snmp/net-snmp-config.h>
+ #endif
+ ]]
+ )
+
+ CPPFLAGS="$SAVE_CPPFLAGS"
+fi
+
+if test "x$with_libnetsnmp" = "xyes"; then
+ SAVE_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $with_libnetsnmp_ldflags"
+
+ AC_CHECK_LIB([netsnmp], [init_snmp],
+ [with_libnetsmp="yes"],
+ [with_libnetsnmp="no (libnetsnmp not found)"]
+ )
+
+ LDFLAGS="$SAVE_LDFLAGS"
+fi
+
+if test "x$with_libnetsnmp" = "xyes"; then
+ BUILD_WITH_LIBNETSNMP_CPPFLAGS="$with_libnetsnmp_cppflags"
+ BUILD_WITH_LIBNETSNMP_LDFLAGS="$with_libnetsnmp_ldflags"
+ BUILD_WITH_LIBNETSNMP_LIBS="-lnetsnmp"
+fi
+
+AC_SUBST([BUILD_WITH_LIBNETSNMP_CPPFLAGS])
+AC_SUBST([BUILD_WITH_LIBNETSNMP_LDFLAGS])
+AC_SUBST([BUILD_WITH_LIBNETSNMP_LIBS])
+# }}}
+
+# --with-libnetsmpagent {{{
+AC_ARG_WITH([libnetsnmpagent],
+ [AS_HELP_STRING([--with-libnetsnmpagent@<:@=PREFIX@:>@], [Path to libnetsnmpagent.])],
+ [
+ if test "x$withval" = "xno"; then
+ with_libnetsnmpagent="no"
+ else if test "x$withval" = "xyes"; then
+ with_libnetsnmpagent="yes"
+ else
+ with_libnetsnmpagent_cppflags="-I$withval/include"
+ with_libnetsnmpagent_ldflags="-I$withval/lib"
+ with_libnetsnmpagent="yes"
+ fi; fi
+ ],
+ [with_libnetsnmpagent="yes"]
+)
+
+if test "x$with_libnetsnmpagent" = "xyes"; then
+ SAVE_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS $with_libnetsnmpagent_cppflags"
+
+ AC_CHECK_HEADERS([net-snmp/agent/net-snmp-agent-includes.h],
+ [],
+ [with_libnetsnmpagent="no (net-snmp/agent/net-snmp-agent-includes.h not found)"],
+ [[
+ #if HAVE_NET_SNMP_NET_SNMP_CONFIG_H
+ # include <net-snmp/net-snmp-config.h>
+ #endif
+ #if HAVE_NET_SNMP_NET_SNMP_INCLUDES_H
+ # include <net-snmp/net-snmp-includes.h>
+ #endif
+ ]]
+ )
+
+ CPPFLAGS="$SAVE_CPPFLAGS"
+fi
+
+if test "x$with_libnetsnmpagent" = "xyes"; then
+ SAVE_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $with_libnetsnmpagent_ldflags"
+
+ # older versions of libnetsnmpagent fail to link
+ # against the helpers library, so do that explicitly
+ AC_CHECK_LIB([netsnmphelpers], [netsnmp_init_helpers],
+ [libnetsnmphelpers="-lnetsnmphelpers"],
+ [libnetsnmphelpers=""]
+ )
+
+ AC_CHECK_LIB([netsnmpagent], [init_agent],
+ [with_libnetsnmpagent="yes"],
+ [with_libnetsnmpagent="no (libnetsnmpagent not found)"],
+ [$libnetsnmphelpers]
+ )
+
+ LDFLAGS="$SAVE_LDFLAGS"
+fi
+
+if test "x$with_libnetsnmpagent" = "xyes"; then
+ BUILD_WITH_LIBNETSNMPAGENT_LIBS="-lnetsnmpagent $libnetsnmphelpers"
+fi
+
+AC_SUBST([BUILD_WITH_LIBNETSNMPAGENT_CPPFLAGS])
+AC_SUBST([BUILD_WITH_LIBNETSNMPAGENT_LDFLAGS])
+AC_SUBST([BUILD_WITH_LIBNETSNMPAGENT_LIBS])
+# }}}
+
+# --with-liboping {{{
+AC_ARG_WITH([liboping],
+ [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
+ [
+ if test "x$withval" = "xyes"; then
+ with_liboping="yes"
+ else if test "x$withval" = "xno"; then
+ with_liboping="no"
+ else
+ with_liboping="yes"
+ LIBOPING_CPPFLAGS="-I$withval/include"
+ LIBOPING_LDFLAGS="-L$withval/lib"
+ fi; fi
+ ],
+ [with_liboping="yes"]
+)
+
+SAVE_CPPFLAGS="$CPPFLAGS"
+SAVE_LDFLAGS="$LDFLAGS"
+CPPFLAGS="$CPPFLAGS $LIBOPING_CPPFLAGS"
+LDFLAGS="$LDFLAGS $LIBOPING_LDFLAGS"
+
+if test "x$with_liboping" = "xyes"; then
+ AC_CHECK_HEADERS([oping.h],
+ [with_liboping="yes"],
+ [with_liboping="no (oping.h not found)"]
+ )
+fi
+
+if test "x$with_liboping" = "xyes"; then
+ AC_CHECK_LIB([oping], [ping_construct],
+ [with_liboping="yes"],
+ [with_liboping="no (symbol 'ping_construct' not found)"]
+ )
+fi
+
+CPPFLAGS="$SAVE_CPPFLAGS"
+LDFLAGS="$SAVE_LDFLAGS"
+
+if test "x$with_liboping" = "xyes"; then
+ BUILD_WITH_LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS"
+ BUILD_WITH_LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS"
+fi
+
+AC_SUBST([BUILD_WITH_LIBOPING_CPPFLAGS])
+AC_SUBST([BUILD_WITH_LIBOPING_LDFLAGS])
+# }}}
+
+# --with-oracle {{{
+AC_ARG_WITH([oracle],
+ [AS_HELP_STRING([--with-oracle@<:@=ORACLE_HOME@:>@], [Path to Oracle.])],
+ [
+ if test "x$withval" = "xyes"; then
+ if test "x$ORACLE_HOME" = "x"; then
+ AC_MSG_WARN([Use of the Oracle library has been forced, but the environment variable ORACLE_HOME is not set.])
+ fi
+ with_oracle="yes"
+ else if test "x$withval" = "xno"; then
+ with_oracle="no"
+ else
+ with_oracle="yes"
+ ORACLE_HOME="$withval"
+ fi; fi
+ ],
+ [
+ if test "x$ORACLE_HOME" = "x"; then
+ with_oracle="no (ORACLE_HOME is not set)"
+ else
+ with_oracle="yes"
+ fi
+ ]
+)
+
+if test "x$ORACLE_HOME" != "x"; then
+ with_oracle_cppflags="-I$ORACLE_HOME/rdbms/public"
+ if test -e "$ORACLE_HOME/lib/ldflags"; then
+ with_oracle_libs=`cat "$ORACLE_HOME/lib/ldflags"`
+ fi
+ with_oracle_libs="-L$ORACLE_HOME/lib -lclntsh"
+fi
+
+if test "x$with_oracle" = "xyes"; then
+ SAVE_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
+
+ AC_CHECK_HEADERS([oci.h],
+ [with_oracle="yes"],
+ [with_oracle="no (oci.h not found)"]
+ )
+
+ CPPFLAGS="$SAVE_CPPFLAGS"
+fi
+
+if test "x$with_oracle" = "xyes"; then
+ SAVE_CPPFLAGS="$CPPFLAGS"
+ SAVE_LIBS="$LIBS"
+ CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
+ LIBS="$LIBS $with_oracle_libs"
+
+ AC_CHECK_FUNC([OCIEnvCreate],
+ [with_oracle="yes"],
+ [with_oracle="no (Symbol 'OCIEnvCreate' not found)"]
+ )
+
+ CPPFLAGS="$SAVE_CPPFLAGS"
+ LIBS="$SAVE_LIBS"
+fi
+
+if test "x$with_oracle" = "xyes"; then
+ BUILD_WITH_ORACLE_CPPFLAGS="$with_oracle_cppflags"
+ BUILD_WITH_ORACLE_LIBS="$with_oracle_libs"
+fi
+
+AC_SUBST([BUILD_WITH_ORACLE_CPPFLAGS])
+AC_SUBST([BUILD_WITH_ORACLE_LIBS])
+# }}}
+
+# --with-libowcapi {{{
+AC_ARG_WITH([libowcapi],
+ [AS_HELP_STRING([--with-libowcapi@<:@=PREFIX@:>@], [Path to libowcapi.])],
+ [
+ if test "x$withval" != "xno" && test "x$withval" != "xyes"; then
+ with_libowcapi_cppflags="-I$withval/include"
+ with_libowcapi_ldflags="-L$withval/lib"
+ with_libowcapi="yes"
+ else
+ with_libowcapi="$withval"
+ fi
+ ],
+ [with_libowcapi="yes"]
+)
+
+if test "x$with_libowcapi" = "xyes"; then
+ SAVE_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS $with_libowcapi_cppflags"
+
+ AC_CHECK_HEADERS([owcapi.h],
+ [with_libowcapi="yes"],
+ [with_libowcapi="no (owcapi.h not found)"]
+ )
+
+ CPPFLAGS="$SAVE_CPPFLAGS"