+lldpd (0.7.15)
+ * Features:
+ + Optional features can be configured with "auto" to autodetect if
+ they are usable.
+
lldpd (0.7.14)
* Features:
+ Shutdown LLPDU are sent on MSAP change and when lldpd exits.
AC_ARG_WITH([readline],
AS_HELP_STRING(
[--with-readline],
- [Enable the use of readline-like library @<:@default=check@:>@]),
+ [Enable the use of readline-like library @<:@default=auto@:>@]),
[],
- [with_readline=check])
+ [with_readline=auto])
if test x"$with_readline" != x"no"; then
AX_LIB_READLINE
- if test x"$with_readline" != x"check"; then
+ if test x"$with_readline" != x"check" -a x"$with_readline" != x"auto"; then
if test x"$ax_cv_lib_readline" = x"no"; then
AC_MSG_FAILURE([*** no readline support found])
fi
AC_ARG_WITH([snmp],
AS_HELP_STRING(
[--with-snmp],
- [Enable the use of SNMP @<:@default=no@:>@]
- ))
-if test x"$with_snmp" = x"yes"; then
- lldp_CHECK_SNMP
-fi
+ [Enable the use of SNMP @<:@default=no@:>@]),
+ [],
+ [with_snmp=no])
+lldp_CHECK_SNMP
# XML
AC_ARG_WITH([xml],
AS_HELP_STRING(
[--with-xml],
- [Enable XML output via libxml2 @<:@default=no@:>@]
- ))
-if test x"$with_xml" = x"yes"; then
- lldp_CHECK_XML2
-fi
+ [Enable XML output via libxml2 @<:@default=no@:>@]),
+ [],
+ [with_xml=no])
+lldp_CHECK_XML2
# JSON
AC_ARG_WITH([json],
AS_HELP_STRING(
[--with-json],
- [Enable JSON output via janson,json-c,no @<:@default=no@:>@]
- ))
-if test x"$with_json" = x"yes"; then
- with_json=jansson
-fi
-if test x"$with_json" = x"jansson"; then
+ [Enable JSON output via janson,json-c,no @<:@default=no@:>@]),
+ [],
+ [with_json=no])
+if test x"$with_json" = x"yes" -o x"$with_json" = x"auto"; then
+ _with_json="$with_json"
+ with_json=auto
+ lldp_CHECK_JANSSON
+ if test x"$with_json" = x"no"; then
+ with_json=auto
+ lldp_CHECK_JSONC
+ fi
+ if test x"$with_json" = x"no" -a x"$_with_json" = x"yes"; then
+ AC_MSG_FAILURE([*** no JSON support found])
+ fi
+else
lldp_CHECK_JANSSON
-elif test x"$with_json" = x"json-c"; then
lldp_CHECK_JSONC
fi
#
AC_DEFUN([lldp_CHECK_JANSSON], [
- PKG_CHECK_MODULES([JANSSON], [jansson >= 2], [],
- [AC_MSG_ERROR([*** unable to find libjansson])])
-
- AC_SUBST([JANSSON_LIBS])
- AC_SUBST([JANSSON_CFLAGS])
- AC_DEFINE_UNQUOTED([USE_JSON], 1, [Define to indicate to enable JSON support])
- AC_DEFINE_UNQUOTED([USE_JANSSON], 1, [Define to indicate to enable JSON support through jansson])
+ if test x"$with_json" = x"auto" -o x"$with_json" = x"jansson"; then
+ PKG_CHECK_MODULES([JANSSON], [jansson >= 2], [
+ AC_SUBST([JANSSON_LIBS])
+ AC_SUBST([JANSSON_CFLAGS])
+ AC_DEFINE_UNQUOTED([USE_JSON], 1, [Define to indicate to enable JSON support])
+ AC_DEFINE_UNQUOTED([USE_JANSSON], 1, [Define to indicate to enable JSON support through jansson])
+ with_json=jansson
+ ],[
+ if test x"$with_json" = x"jansson"; then
+ AC_MSG_ERROR([*** unable to find libjansson])
+ fi
+ with_json=no
+ ])
+ fi
])
#
AC_DEFUN([lldp_CHECK_JSONC], [
- PKG_CHECK_MODULES([JSONC], [json-c], [],
- [PKG_CHECK_MODULES([JSONC], [json], [],
- [AC_MSG_ERROR([*** unable to find json-c])])])
-
- AC_SUBST([JSONC_LIBS])
- AC_SUBST([JSONC_CFLAGS])
- AC_DEFINE_UNQUOTED([USE_JSON], 1, [Define to indicate to enable JSON support])
- AC_DEFINE_UNQUOTED([USE_JSONC], 1, [Define to indicate to enable JSON via json-c support])
+ if test x"$with_json" = x"auto" -o x"$with_json" = x"json-c"; then
+ PKG_CHECK_MODULES([JSONC], [json-c], [
+ AC_SUBST([JSONC_LIBS])
+ AC_SUBST([JSONC_CFLAGS])
+ AC_DEFINE_UNQUOTED([USE_JSON], 1, [Define to indicate to enable JSON support])
+ AC_DEFINE_UNQUOTED([USE_JSONC], 1, [Define to indicate to enable JSON via json-c support])
+ with_json=json-c
+ ],[
+ PKG_CHECK_MODULES([JSONC], [json], [
+ AC_SUBST([JSONC_LIBS])
+ AC_SUBST([JSONC_CFLAGS])
+ AC_DEFINE_UNQUOTED([USE_JSON], 1, [Define to indicate to enable JSON support])
+ AC_DEFINE_UNQUOTED([USE_JSONC], 1, [Define to indicate to enable JSON via json-c support])
+ with_json=json-c
+ ],[
+ if test x"$with_json" = x"json-c"; then
+ AC_MSG_ERROR([*** unable to find json-c])
+ fi
+ with_json=no
+ ])
+ ])
+ fi
])
# lldp_CHECK_SNMP
#
AC_DEFUN([lldp_CHECK_SNMP], [
+ if test x"$with_snmp" != x"no"; then
AC_PATH_TOOL([NETSNMP_CONFIG], [net-snmp-config], [no])
if test x"$NETSNMP_CONFIG" = x"no"; then
- AC_MSG_ERROR([*** unable to find net-snmp-config])
- fi
- NETSNMP_LIBS=`${NETSNMP_CONFIG} --agent-libs`
- NETSNMP_CFLAGS="`${NETSNMP_CONFIG} --base-cflags` -DNETSNMP_NO_INLINE"
+ dnl No luck
+ if test x"$with_snmp" = x"yes"; then
+ AC_MSG_FAILURE([*** no NetSNMP support found])
+ fi
+ with_snmp=no
+ else
+ dnl Check it is working as expected
+ NETSNMP_LIBS=`${NETSNMP_CONFIG} --agent-libs`
+ NETSNMP_CFLAGS="`${NETSNMP_CONFIG} --base-cflags` -DNETSNMP_NO_INLINE"
- _save_flags="$CFLAGS"
- _save_libs="$LIBS"
- CFLAGS="$CFLAGS ${NETSNMP_CFLAGS}"
- LIBS="$LIBS ${NETSNMP_LIBS}"
- AC_MSG_CHECKING([whether C compiler supports flag "${NETSNMP_CFLAGS} ${NETSNMP_LIBS}" from Net-SNMP])
- AC_LINK_IFELSE([AC_LANG_PROGRAM([
+ _save_flags="$CFLAGS"
+ _save_libs="$LIBS"
+ CFLAGS="$CFLAGS ${NETSNMP_CFLAGS}"
+ LIBS="$LIBS ${NETSNMP_LIBS}"
+ AC_MSG_CHECKING([whether C compiler supports flag "${NETSNMP_CFLAGS} ${NETSNMP_LIBS}" from Net-SNMP])
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([
int main(void);
],
[
{
return 0;
}
-])],[AC_MSG_RESULT(yes)],[
-AC_MSG_RESULT(no)
-AC_MSG_ERROR([*** incorrect CFLAGS from net-snmp-config])])
- # Is Net-SNMP usable?
- AC_CHECK_LIB([netsnmp], [snmp_register_callback], [:],
- [AC_MSG_ERROR([*** unable to use net-snmp])], ${NETSNMP_LIBS})
- # Do we have subagent support?
- AC_CHECK_FUNCS([netsnmp_enable_subagent], [:],
- [AC_MSG_ERROR([*** no subagent support in net-snmp])])
-
- AC_SUBST([NETSNMP_LIBS])
- AC_SUBST([NETSNMP_CFLAGS])
- AC_DEFINE_UNQUOTED([USE_SNMP], 1, [Define to indicate to enable SNMP support])
+])],[
+ AC_MSG_RESULT(yes)
+ dnl Is Net-SNMP usable?
+ AC_CHECK_LIB([netsnmp], [snmp_register_callback], [
+ dnl Do we have subagent support?
+ AC_CHECK_FUNCS([netsnmp_enable_subagent], [
+ dnl Yes, we need to check a few more things
+ AC_SUBST([NETSNMP_LIBS])
+ AC_SUBST([NETSNMP_CFLAGS])
+ AC_DEFINE_UNQUOTED([USE_SNMP], 1, [Define to indicate to enable SNMP support])
+ with_snmp=yes
- # Should we use f_create_from_tstring_new or f_create_from_tstring?
- AC_CHECK_MEMBERS([netsnmp_tdomain.f_create_from_tstring_new],,,
- [
+ dnl Should we use f_create_from_tstring_new or f_create_from_tstring?
+ AC_CHECK_MEMBERS([netsnmp_tdomain.f_create_from_tstring_new],,,[
@%:@include <net-snmp/net-snmp-config.h>
@%:@include <net-snmp/net-snmp-includes.h>
@%:@include <net-snmp/library/snmp_transport.h>
-])
- # Do we have a usable <net-snmp/agent/util_funcs.h> header?
- AC_CHECK_HEADERS([net-snmp/agent/util_funcs.h],,,[
+ ])
+ dnl Do we have a usable <net-snmp/agent/util_funcs.h> header?
+ AC_CHECK_HEADERS([net-snmp/agent/util_funcs.h],,,[
@%:@include <net-snmp/net-snmp-config.h>
@%:@include <net-snmp/net-snmp-includes.h>
@%:@include <net-snmp/library/snmp_transport.h>
@%:@include <net-snmp/agent/net-snmp-agent-includes.h>
@%:@include <net-snmp/agent/snmp_vars.h>
- ])
+ ])
+ ],[
+ if test x"$with_snmp" = x"yes"; then
+ AC_MSG_ERROR([*** no subagent support in net-snmp])
+ fi
+ with_snmp=no
+ ])
+ ],[
+ if test x"$with_snmp" = x"yes"; then
+ AC_MSG_ERROR([*** unable to use net-snmp])
+ fi
+ with_snmp=no
+ ])
+ ],[
+ AC_MSG_RESULT(no)
+ if test x"$with_snmp" = x"yes"; then
+ AC_MSG_ERROR([*** incorrect CFLAGS from net-snmp-config])
+ fi
+ with_snmp=no
+ ])
- CFLAGS="$_save_flags"
- LIBS="$_save_libs"
+ CFLAGS="$_save_flags"
+ LIBS="$_save_libs"
+ fi
+ fi
])
AC_DEFUN([lldp_CHECK_XML2], [
- PKG_CHECK_MODULES([XML2], [libxml-2.0], [],
- [AC_MSG_CHECKING([presence of xml2-config])
+ if test x"$with_xml" != x"no"; then
+ PKG_CHECK_MODULES([XML2], [libxml-2.0], [
+ dnl Found through pkg-config
+ AC_DEFINE_UNQUOTED([USE_XML], 1, [Define to indicate to enable XML support])
+ with_xml=yes
+ ],[
+ dnl Fallback to xml2-config
AC_PATH_TOOL([XML2_CONFIG], [xml2-config], [no])
if test x"$XML2_CONFIG" = x"no"; then
- AC_MSG_ERROR([*** unable to find xml2-config])
- fi
- XML2_LIBS=`${XML2_CONFIG} --libs`
- XML2_CFLAGS=`${XML2_CONFIG} --cflags`
- AC_MSG_RESULT([found!])
- ])
+ dnl No luck
+ if test x"$with_xml" = x"yes"; then
+ AC_MSG_FAILURE([*** no libxml2 support found])
+ fi
+ with_xml=no
+ else
+ dnl Check that it's working as expected
+ XML2_LIBS=`${XML2_CONFIG} --libs`
+ XML2_CFLAGS=`${XML2_CONFIG} --cflags`
- # Check if the library is usable
- _save_flags="$CFLAGS"
- _save_libs="$LIBS"
- CFLAGS="$CFLAGS ${XML2_CFLAGS}"
- LIBS="$LIBS ${XML2_LIBS}"
- AC_MSG_CHECKING([whether libxml-2 work as expected])
- AC_LINK_IFELSE([AC_LANG_PROGRAM([
+ _save_flags="$CFLAGS"
+ _save_libs="$LIBS"
+ CFLAGS="$CFLAGS ${XML2_CFLAGS}"
+ LIBS="$LIBS ${XML2_LIBS}"
+ AC_MSG_CHECKING([whether libxml-2 work as expected])
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([
@%:@include <libxml/encoding.h>
@%:@include <libxml/xmlwriter.h>
],[
xmlDocPtr doc;
xmlTextWriterPtr xw = xmlNewTextWriterDoc(&doc, 0);
return (xw != NULL);
-])],[AC_MSG_RESULT(yes)],[
-AC_MSG_RESULT(no)
-AC_MSG_ERROR([*** unable to use libxml-2])])
- CFLAGS="$_save_flags"
- LIBS="$_save_libs"
-
- AC_SUBST([XML2_LIBS])
- AC_SUBST([XML2_CFLAGS])
- AC_DEFINE_UNQUOTED([USE_XML], 1, [Define to indicate to enable XML support])
+])],[
+ AC_MSG_RESULT(yes)
+ AC_SUBST([XML2_LIBS])
+ AC_SUBST([XML2_CFLAGS])
+ AC_DEFINE_UNQUOTED([USE_XML], 1, [Define to indicate to enable XML support])
+ with_xml=yes
+ ],[
+ AC_MSG_RESULT(no)
+ if test x"$with_xml" = x"yes"; then
+ AC_MSG_FAILURE([*** libxml2 not working as expected])
+ fi
+ with_xml=no
+ ])
+ CFLAGS="$_save_flags"
+ LIBS="$_save_libs"
+ fi
+ ])
+ fi
])