Skip to content
Snippets Groups Projects
Commit a8da4e1b authored by Alexandre Savard's avatar Alexandre Savard
Browse files

[#2524] Add libyaml in configure and makefile

parent 257fbcc2
No related branches found
No related tags found
No related merge requests found
...@@ -268,6 +268,21 @@ xml_LIBS=-lexpat ...@@ -268,6 +268,21 @@ xml_LIBS=-lexpat
AC_SUBST(xml_CFLAGS) AC_SUBST(xml_CFLAGS)
AC_SUBST(xml_LIBS) AC_SUBST(xml_LIBS)
AC_CHECK_LIB([yaml], yaml_parser_initialize,
[AC_CHECK_HEADERS(expat.h, have_expat=true, have_expat=false)],
have_yaml = false)
if ! $have_yaml; then
AC_MSG_ERROR([You need the eXpat xml parser]
[http://expat.sourceforge.net/])
fi
yaml_CFLAGS=
yaml_LIBS=lyaml
AC_SUBST(yaml_CFLAGS)
AC_SUBST(yaml_LIBS)
AC_CHECK_LIB([pthread], pthread_create, AC_CHECK_LIB([pthread], pthread_create,
[AC_CHECK_HEADERS(pthread.h, have_pthread=true, have_pthread=false)], [AC_CHECK_HEADERS(pthread.h, have_pthread=true, have_pthread=false)],
have_pthread=false) have_pthread=false)
...@@ -292,6 +307,7 @@ AC_SUBST(PCRE_CFLAGS) ...@@ -292,6 +307,7 @@ AC_SUBST(PCRE_CFLAGS)
# For the tools/, we need libdbus-c++ for the "build" architecture as well # For the tools/, we need libdbus-c++ for the "build" architecture as well
AM_CONDITIONAL(CROSS_COMPILING, test "$cross_compiling" = "yes") AM_CONDITIONAL(CROSS_COMPILING, test "$cross_compiling" = "yes")
......
...@@ -3,4 +3,21 @@ SUBDIRS = ...@@ -3,4 +3,21 @@ SUBDIRS =
noinst_LTLIBRARIES = libconfig.la noinst_LTLIBRARIES = libconfig.la
libconfig_la_SOURCES = \ libconfig_la_SOURCES = \
config.cpp config.h config.cpp \
yamlengine.cpp \
yamlemitter.cpp \
yamlparser.cpp
noinst_HEADERS = \
config.h \
engine.h \
serializable.h \
yamlengine.h \
yamlemitter.h \
yamlparser.h
libconfig_la_LDFLAGS = \
${yaml_LIBS}
libconfig_la_CFLAGS = \
${yaml_CFLAGS}
\ No newline at end of file
...@@ -31,10 +31,11 @@ ...@@ -31,10 +31,11 @@
#ifndef __YAMLENGINE_H__ #ifndef __YAMLENGINE_H__
#define __YAMLENGINE_H__ #define __YAMLENGINE_H__
#include "engine.h"
#include "yamlparser.h" #include "yamlparser.h"
#include "yamlemiter.h" #include "yamlemitter.h"
class YamlEngine : Engine { class YamlEngine : public Engine {
public: public:
...@@ -54,7 +55,7 @@ class YamlEngine : Engine { ...@@ -54,7 +55,7 @@ class YamlEngine : Engine {
YamlParser *parser; YamlParser *parser;
YamlEmiter *emiter; YamlEmitter *emitter;
}; };
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
YamlParser::YamlParser() YamlParser::YamlParser()
{ {
memset(buffer, 0, BUFFER_SIZE); memset(buffer, 0, PARSER_BUFFERSIZE);
open(); open();
} }
...@@ -69,12 +69,12 @@ void YamlParser::close() ...@@ -69,12 +69,12 @@ void YamlParser::close()
void YamlParser::parse() void YamlParser::parse()
{ {
bool done; bool done = false;
yaml_event_t event; yaml_event_t event;
while(!done) { while(!done) {
if(!yaml_parser_parse(&parse, &event)) if(!yaml_parser_parse(&parser, &event))
throw 20; throw 20;
done = (event.type == YAML_STREAM_END_EVENT); done = (event.type == YAML_STREAM_END_EVENT);
......
...@@ -43,7 +43,7 @@ class YamlParser { ...@@ -43,7 +43,7 @@ class YamlParser {
YamlParser(); YamlParser();
~YamlParsere(); ~YamlParser();
void open(); void open();
...@@ -68,7 +68,7 @@ class YamlParser { ...@@ -68,7 +68,7 @@ class YamlParser {
/** /**
* The event structure array. * The event structure array.
*/ */
yaml_event_t event[PARSER_MAXEVENT]; yaml_event_t events[PARSER_MAXEVENT];
/** /**
* *
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment