Added --with-libxml2 to configure
This commit is contained in:
parent
e55a27bcac
commit
5b39b63698
8 changed files with 36 additions and 38 deletions
|
|
@ -141,14 +141,14 @@
|
||||||
|
|
||||||
### Minor changes
|
### Minor changes
|
||||||
|
|
||||||
* Regexp improvements
|
* Regexp improvements: Added libxml2 XSD regexp mode as alternative to posix translation
|
||||||
* Added libxml2 XSD regexp mode as alternative to posix translation
|
* Configure with: `./configure --with-libxml2`
|
||||||
|
* Set `CLICON_YANG_REGEXP` to libxml2 (default is posix)
|
||||||
* Better compliance with XSD regexps (when transforming to Posix regexps)
|
* Better compliance with XSD regexps (when transforming to Posix regexps)
|
||||||
* Added `\p{L}` and `\p{N}`
|
* Added `\p{L}` and `\p{N}`
|
||||||
* Added escaping of `$`
|
* Added escaping of `$`
|
||||||
* Added `CLICON_YANG_REGEXP`option with possible values libxml2 and posix
|
|
||||||
* Added clixon_util_regexp utility function
|
* Added clixon_util_regexp utility function
|
||||||
* Added regexp test [test/test_pattern.sh]
|
* Added regexp test [test/test_pattern.sh] for both posix and libxml2
|
||||||
* Yang state get improvements
|
* Yang state get improvements
|
||||||
* Integrated state and config into same tree on retrieval, not separate trees
|
* Integrated state and config into same tree on retrieval, not separate trees
|
||||||
* Added cli functions `cli_show_config_state()` and `cli_show_auto_state()` for showing combined config and state info.
|
* Added cli functions `cli_show_config_state()` and `cli_show_auto_state()` for showing combined config and state info.
|
||||||
|
|
|
||||||
|
|
@ -497,9 +497,9 @@ main(int argc,
|
||||||
if (help)
|
if (help)
|
||||||
usage(h, argv[0]);
|
usage(h, argv[0]);
|
||||||
|
|
||||||
#ifndef HAVE_LIBXML_XMLREGEXP_H
|
#ifndef HAVE_LIBXML2
|
||||||
if (strcmp(clicon_yang_regexp(h), "libxml2")==0){
|
if (strcmp(clicon_yang_regexp(h), "libxml2")==0){
|
||||||
clicon_err(OE_FATAL, 0, "CLICON_YANG_REGEXP set to libxml2, but HAVE_LIBXM_XMLREGEXP_H not set (Either change CLICON_YANG_REGEXP to posix, or configure with libxml2?))");
|
clicon_err(OE_FATAL, 0, "CLICON_YANG_REGEXP set to libxml2, but HAVE_LIBXML2 not set (Either change CLICON_YANG_REGEXP to posix, or run: configure --with-libxml2))");
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -447,11 +447,11 @@ main(int argc, char **argv)
|
||||||
usage(h, argv[0]);
|
usage(h, argv[0]);
|
||||||
|
|
||||||
if (strcmp(clicon_yang_regexp(h), "libxml2")==0){
|
if (strcmp(clicon_yang_regexp(h), "libxml2")==0){
|
||||||
#ifdef HAVE_LIBXML_XMLREGEXP_H
|
#ifdef HAVE_LIBXML2
|
||||||
/* Enable XSD libxml2 */
|
/* Enable XSD libxml2 regex engine */
|
||||||
cligen_regex_set(cli_cligen(h), 1);
|
cligen_regex_xsd_set(cli_cligen(h), 1);
|
||||||
#else
|
#else
|
||||||
clicon_err(OE_FATAL, 0, "CLICON_YANG_REGEXP set to libxml2, but HAVE_LIBXML_XMLREGEXP_H not set (Either change CLICON_YANG_REGEXP to posix, or configure with libxml2))");
|
clicon_err(OE_FATAL, 0, "CLICON_YANG_REGEXP set to libxml2, but HAVE_LIBXML2 not set (Either change CLICON_YANG_REGEXP to posix, or run: configure --with-libxml2))");
|
||||||
goto done;
|
goto done;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
||||||
31
configure
vendored
31
configure
vendored
|
|
@ -717,6 +717,7 @@ enable_publish
|
||||||
with_restconf
|
with_restconf
|
||||||
with_wwwuser
|
with_wwwuser
|
||||||
with_configfile
|
with_configfile
|
||||||
|
with_libxml2
|
||||||
'
|
'
|
||||||
ac_precious_vars='build_alias
|
ac_precious_vars='build_alias
|
||||||
host_alias
|
host_alias
|
||||||
|
|
@ -1365,6 +1366,7 @@ Optional Packages:
|
||||||
--without-restconf disable support for restconf
|
--without-restconf disable support for restconf
|
||||||
--with-wwwuser=<user> Set www user different from www-data
|
--with-wwwuser=<user> Set www user different from www-data
|
||||||
--with-configfile=FILE set default path to config file
|
--with-configfile=FILE set default path to config file
|
||||||
|
--with-libxml2 use gnome/libxml2 regex engine
|
||||||
|
|
||||||
Some influential environment variables:
|
Some influential environment variables:
|
||||||
CC C compiler command
|
CC C compiler command
|
||||||
|
|
@ -4417,8 +4419,18 @@ _ACEOF
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# This is for libxml2 code which we can use for XSD regexp
|
# This is for libxml2 XSD regex engine
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for xmlRegexpCompile in -lxml2" >&5
|
# Note this only enables the compiling of the code. In order to actually
|
||||||
|
# use it you need to set Clixon config option CLICON_YANG_REGEXP to libxml2
|
||||||
|
|
||||||
|
# Check whether --with-libxml2 was given.
|
||||||
|
if test "${with_libxml2+set}" = set; then :
|
||||||
|
withval=$with_libxml2;
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test "${with_libxml2}"; then
|
||||||
|
# Find libxml2 lib
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for xmlRegexpCompile in -lxml2" >&5
|
||||||
$as_echo_n "checking for xmlRegexpCompile in -lxml2... " >&6; }
|
$as_echo_n "checking for xmlRegexpCompile in -lxml2... " >&6; }
|
||||||
if ${ac_cv_lib_xml2_xmlRegexpCompile+:} false; then :
|
if ${ac_cv_lib_xml2_xmlRegexpCompile+:} false; then :
|
||||||
$as_echo_n "(cached) " >&6
|
$as_echo_n "(cached) " >&6
|
||||||
|
|
@ -4463,23 +4475,8 @@ _ACEOF
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Libxml2 may hide its include files under /usr/include/libxml2/libxml
|
|
||||||
# You may need to prepend CFLAGS="-I/usr/include/libxml2 to configure
|
|
||||||
for ac_header in libxml/xmlregexp.h
|
|
||||||
do :
|
|
||||||
ac_fn_c_check_header_compile "$LINENO" "libxml/xmlregexp.h" "ac_cv_header_libxml_xmlregexp_h" "#include \"libxml/xmlversion.h\"
|
|
||||||
"
|
|
||||||
if test "x$ac_cv_header_libxml_xmlregexp_h" = xyes; then :
|
|
||||||
cat >>confdefs.h <<_ACEOF
|
|
||||||
#define HAVE_LIBXML_XMLREGEXP_H 1
|
|
||||||
_ACEOF
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
done
|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
for ac_func in inet_aton sigaction sigvec strlcpy strsep strndup alphasort versionsort
|
for ac_func in inet_aton sigaction sigvec strlcpy strsep strndup alphasort versionsort
|
||||||
do :
|
do :
|
||||||
|
|
|
||||||
14
configure.ac
14
configure.ac
|
|
@ -220,12 +220,14 @@ AC_CHECK_LIB(socket, socket)
|
||||||
AC_CHECK_LIB(nsl, xdr_char)
|
AC_CHECK_LIB(nsl, xdr_char)
|
||||||
AC_CHECK_LIB(dl, dlopen)
|
AC_CHECK_LIB(dl, dlopen)
|
||||||
|
|
||||||
# This is for libxml2 code which we can use for XSD regexp
|
# This is for libxml2 XSD regex engine
|
||||||
AC_CHECK_LIB(xml2, xmlRegexpCompile)
|
# Note this only enables the compiling of the code. In order to actually
|
||||||
|
# use it you need to set Clixon config option CLICON_YANG_REGEXP to libxml2
|
||||||
# Libxml2 may hide its include files under /usr/include/libxml2/libxml
|
AC_ARG_WITH(libxml2, [ --with-libxml2 use gnome/libxml2 regex engine ] )
|
||||||
# You may need to prepend CFLAGS="-I/usr/include/libxml2 to configure
|
if test "${with_libxml2}"; then
|
||||||
AC_CHECK_HEADERS([libxml/xmlregexp.h], [], [], [#include "libxml/xmlversion.h"])
|
# Find libxml2 lib
|
||||||
|
AC_CHECK_LIB(xml2, xmlRegexpCompile)
|
||||||
|
fi
|
||||||
|
|
||||||
#
|
#
|
||||||
AC_CHECK_FUNCS(inet_aton sigaction sigvec strlcpy strsep strndup alphasort versionsort)
|
AC_CHECK_FUNCS(inet_aton sigaction sigvec strlcpy strsep strndup alphasort versionsort)
|
||||||
|
|
|
||||||
|
|
@ -60,9 +60,6 @@
|
||||||
/* Define to 1 if you have the `xml2' library (-lxml2). */
|
/* Define to 1 if you have the `xml2' library (-lxml2). */
|
||||||
#undef HAVE_LIBXML2
|
#undef HAVE_LIBXML2
|
||||||
|
|
||||||
/* Define to 1 if you have the <libxml/xmlregexp.h> header file. */
|
|
||||||
#undef HAVE_LIBXML_XMLREGEXP_H
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <linux/if_vlan.h> header file. */
|
/* Define to 1 if you have the <linux/if_vlan.h> header file. */
|
||||||
#undef HAVE_LINUX_IF_VLAN_H
|
#undef HAVE_LINUX_IF_VLAN_H
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -76,9 +76,11 @@ expectfn "$clixon_cli -1 -f $cfg set interfaces interface fddi&< type ianaift:et
|
||||||
new "cli failed validate"
|
new "cli failed validate"
|
||||||
expectfn "$clixon_cli -1 -f $cfg -l o validate" 255 "Validate failed. Edit and try again or discard changes: application missing-element Mandatory variable <bad-element>type</bad-element>"
|
expectfn "$clixon_cli -1 -f $cfg -l o validate" 255 "Validate failed. Edit and try again or discard changes: application missing-element Mandatory variable <bad-element>type</bad-element>"
|
||||||
|
|
||||||
new "cli configure more"
|
new "cli configure ip addr"
|
||||||
expectfn "$clixon_cli -1 -f $cfg set interfaces interface eth/0/0 ipv4 address 1.2.3.4 prefix-length 24" 0 "^$"
|
expectfn "$clixon_cli -1 -f $cfg set interfaces interface eth/0/0 ipv4 address 1.2.3.4 prefix-length 24" 0 "^$"
|
||||||
|
new "cli configure ip descr"
|
||||||
expectfn "$clixon_cli -1 -f $cfg set interfaces interface eth/0/0 description mydesc" 0 "^$"
|
expectfn "$clixon_cli -1 -f $cfg set interfaces interface eth/0/0 description mydesc" 0 "^$"
|
||||||
|
new "cli configure ip type"
|
||||||
expectfn "$clixon_cli -1 -f $cfg set interfaces interface eth/0/0 type ex:eth" 0 "^$"
|
expectfn "$clixon_cli -1 -f $cfg set interfaces interface eth/0/0 type ex:eth" 0 "^$"
|
||||||
|
|
||||||
new "cli show xpath description"
|
new "cli show xpath description"
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,7 @@ regex_posix(char *regexp,
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
char *posix = NULL;
|
char *posix = NULL;
|
||||||
char pattern[1024];
|
char pattern[1024];
|
||||||
int status;
|
int status = 0;
|
||||||
regex_t re;
|
regex_t re;
|
||||||
char errbuf[1024];
|
char errbuf[1024];
|
||||||
int len0;
|
int len0;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue