fi
# XML2
-if test ! -f /usr/include/libxml2/libxml/xpath.h; then
- AC_MSG_NOTICE([checking for libxml2... no])
- AC_MSG_ERROR([libxml2: xpath.h is not found in the system PATH. make sure libxml2 headres are installed.])
-else
- AC_MSG_NOTICE([checking for libxml2... yes])
- XML2_INC_DIR=/usr/include/libxml2/
+AC_MSG_CHECKING(--enable-xml2 argument)
+AC_ARG_ENABLE(xml2,
+ [ --enable-xml2 Enable mstflint libxml2 dependant features],
+ [enable_xml2="yes"],
+ [enable_xml2="no"])
+AC_MSG_RESULT($enable_xml2)
+if test "x$enable_xml2" = "xyes"; then
+ # XML2 checks
+ if test ! -f /usr/include/libxml2/libxml/xpath.h; then
+ AC_MSG_NOTICE([checking for libxml2... no])
+ AC_MSG_ERROR([libxml2: xpath.h is not found in the system PATH. make sure libxml2 headres are installed.])
+ else
+ AC_MSG_NOTICE([checking for libxml2... yes])
+ XML2_INC_DIR=/usr/include/libxml2/
+ fi
+ AC_CHECK_LIB(xml2, xmlDocDumpFormatMemoryEnc,, AC_MSG_ERROR([cannot find xml2 xmlDocDumpFormatMemoryEnc() function. Try re-installing the library...]))
+ AC_SUBST(XML2_INC_DIR)
fi
-AC_CHECK_LIB(xml2, xmlDocDumpFormatMemoryEnc,, AC_MSG_ERROR([cannot find xml2 xmlDocDumpFormatMemoryEnc() function. Try re-installing the library...]))
-AC_SUBST(XML2_INC_DIR)
+AM_CONDITIONAL(DISABLE_XML2, [test "x$enable_xml2" = "xno"])
+AC_SUBST(DISABLE_XML2)
AM_CONDITIONAL(ENABLE_DC, [test "x$enable_dc" = "xyes"])
AC_SUBST(ENABLE_DC)
AC_MSG_CHECKING(--enable-cs argument)
AC_ARG_ENABLE(cs,
- [ --enable-cs Enable mstflint "checksum" command, dependant of openssl library],
+ [ --enable-cs Enable mstflint "checksum" command, dependant of openssl library],
[enable_cs="yes"],
[enable_cs="no"])
AC_MSG_RESULT($enable_cs)
SUBDIRS = mlxconfig_dbs
AM_CPPFLAGS = -I. -I$(USER_DIR) -I$(top_srcdir)/include/mtcr_ul -I$(MTCR_DIR) -I$(COMMON_DIR) $(WIN64_INC)\
- -I $(LAYOUTS_DIR) -I $(UTILS_DIR) -I$(DEV_MGT_DIR) -I$(CMDIF_DIR) -I$(XML2_INC_DIR)
+ -I $(LAYOUTS_DIR) -I $(UTILS_DIR) -I$(DEV_MGT_DIR) -I$(CMDIF_DIR)
+
AM_CXXFLAGS = -Wall -W -g -MP -MD -pipe -DDATA_PATH=\"$(pkgdatadir)\"
bin_PROGRAMS = mstconfig
-mstconfig_LDADD = $(UTILS_LIB) $(EXT_LIB_DIR)/sqlite/libsqlite3.a $(EXT_LIB_DIR)/muparser/libmuparser.a -lxml2\
+mstconfig_LDADD = $(UTILS_LIB) $(EXT_LIB_DIR)/sqlite/libsqlite3.a $(EXT_LIB_DIR)/muparser/libmuparser.a\
$(CMDIF_DIR)/libcmdif.a ../reg_access/libreg_access.a $(LAYOUTS_LIB) $(MTCR_DIR)/libmtcr_ul.a\
$(DEV_MGT_DIR)/libdev_mgt.a $(MLNXOS_PPC_LIBS) $(LIBSTD_CPP) -ldl
+if DISABLE_XML2
+AM_CXXFLAGS += -DDISABLE_XML2
+else
+AM_CPPFLAGS += -I$(XML2_INC_DIR)
+mstconfig_LDADD += -lxml2
+endif
+
mstconfig_SOURCES = mlxcfg_ui.h mlxcfg_parser.cpp mlxcfg_ui.cpp\
mlxcfg_status.h mlxcfg_utils.h mlxcfg_utils.cpp mlxcfg_view.h\
mlxcfg_db_manager.h mlxcfg_db_manager.cpp mlxcfg_param.h mlxcfg_param.cpp mlxcfg_tlv.h mlxcfg_tlv.cpp\
#include "mlxcfg_tlv.h"
#include "mlxcfg_status.h"
-#include <libxml/parser.h>
-#include <libxml/tree.h>
+#if ! defined(DISABLE_XML2)
+ #include <libxml/parser.h>
+ #include <libxml/tree.h>
+#endif
#define TLVCLASS_OFFSET 24
#define TLVCLASS_SIZE 8
void GenericCommander::XML2TLVConf(const string xmlContent, vector<TLVConf*>& tlvs)
{
+#if ! defined(DISABLE_XML2)
xmlDocPtr doc;
xmlNodePtr root, currTlv, currParam;
xmlChar* portAttr = NULL, *hostAttr = NULL,
throw e;
}
xmlFreeDoc(doc);
+#else
+ (void) xmlContent;
+ (void) tlvs;
+ throw MlxcfgException("Can not run the command, the tool was not compiled against libxml2");
+#endif
}
void GenericCommander::XML2Raw(const string xmlContent, string& raw)