summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile.am2
-rw-r--r--configure.ac6
-rw-r--r--grammar/Makefile.am7
-rw-r--r--grammar/makefile.stand-alone (renamed from grammar/makefile)4
-rw-r--r--grammar/rscript-lex.l (renamed from grammar/rscript.l)12
-rw-r--r--grammar/utils.c4
-rw-r--r--tools/Makefile.am2
7 files changed, 29 insertions, 8 deletions
diff --git a/Makefile.am b/Makefile.am
index d689b9ee..7bf9dd0e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -66,7 +66,7 @@ EXTRA_DIST = \
contrib/gnutls/key.pem \
rsyslog.service.in
-SUBDIRS = doc runtime . plugins/immark plugins/imuxsock plugins/imtcp plugins/imudp plugins/omtesting
+SUBDIRS = doc runtime grammar . plugins/immark plugins/imuxsock plugins/imtcp plugins/imudp plugins/omtesting
if ENABLE_RSYSLOGD
SUBDIRS += tools
diff --git a/configure.ac b/configure.ac
index b0e71c20..1a239ca4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -24,6 +24,8 @@ if test x"$HAVE_JAVAC" = x""; then
fi
# Checks for programs.
+AC_PROG_LEX
+AC_PROG_YACC
AC_PROG_CC
AM_PROG_CC_C_O
if test "$GCC" = "yes"
@@ -707,6 +709,7 @@ AC_ARG_ENABLE(rsyslogrt,
if test "x$enable_rsyslogrt" = "xyes"; then
RSRT_CFLAGS="-I\$(top_srcdir)/runtime -I\$(top_srcdir)"
RSRT_LIBS="\$(top_builddir)/runtime/librsyslog.la"
+ CNF_LIBS="\$(top_builddir)/grammar/libgrammar.la"
fi
AM_CONDITIONAL(ENABLE_RSYSLOGRT, test x$enable_rsyslogrt = xyes)
AC_SUBST(RSRT_CFLAGS)
@@ -779,7 +782,7 @@ AM_CONDITIONAL(ENABLE_MAIL, test x$enable_mail = xyes)
# would complicate things if we first needed to tell them how to enable imdiag.
# rgerhards, 2008-07-25
AC_ARG_ENABLE(imdiag,
- [AS_HELP_STRING([--enable-imdiag],[Enable imdiag @<:@default=yes@:>@])],
+ [AS_HELP_STRING([--enable-imdiag],[Enable imdiag @<:@default=no@:>@])],
[case "${enableval}" in
yes) enable_imdiag="yes" ;;
no) enable_imdiag="no" ;;
@@ -1224,6 +1227,7 @@ AM_CONDITIONAL(ENABLE_OMMONGODB, test x$enable_ommongodb = xyes)
AC_CONFIG_FILES([Makefile \
runtime/Makefile \
+ grammar/Makefile \
tools/Makefile \
doc/Makefile \
plugins/imudp/Makefile \
diff --git a/grammar/Makefile.am b/grammar/Makefile.am
new file mode 100644
index 00000000..b2bd3430
--- /dev/null
+++ b/grammar/Makefile.am
@@ -0,0 +1,7 @@
+noinst_LTLIBRARIES = libgrammar.la
+
+libgrammar_la_SOURCES = \
+ utils.c \
+ utils.h \
+ rscript-lex.l \
+ rscript.y
diff --git a/grammar/makefile b/grammar/makefile.stand-alone
index eb6c9522..b998a39d 100644
--- a/grammar/makefile
+++ b/grammar/makefile.stand-alone
@@ -1,5 +1,5 @@
rscript: lex.yy.c utils.o rscript.tab.h utils.h
- gcc -g -o rscript lex.yy.c rscript.tab.c utils.o -lestr
+ gcc -DSTAND_ALONE -g -o rscript lex.yy.c rscript.tab.c utils.o -lestr
lex.yy.c: rscript.l rscript.tab.h
flex rscript.l
@@ -8,7 +8,7 @@ rscript.tab.h: rscript.y
bison -d rscript.y
utils.o: utils.c utils.h
- gcc -g -Wall -c utils.c
+ gcc -g -DSTAND_ALONE -Wall -c utils.c
clean:
rm *.o
diff --git a/grammar/rscript.l b/grammar/rscript-lex.l
index a7410b15..1c7b963e 100644
--- a/grammar/rscript.l
+++ b/grammar/rscript-lex.l
@@ -16,6 +16,10 @@
%option noyywrap nodefault case-insensitive yylineno
/*%option noyywrap nodefault case-insensitive */
+/* avoid compiler warning: `yyunput' defined but not used */
+%option nounput noinput
+
+
%x INOBJ
/* INOBJ is selected if we are inside an object (name/value pairs!) */
%x COMMENT
@@ -51,6 +55,9 @@ struct bufstack {
} *currbs = NULL;
char *currfn; /* name of currently processed file */
+
+int popfile(void);
+int cnfSetLexFile(char *fname);
%}
%%
@@ -163,7 +170,8 @@ char *currfn; /* name of currently processed file */
%%
/* set a new buffers. Returns 0 on success, something else otherwise. */
-int cnfSetLexFile(char *fname)
+int
+cnfSetLexFile(char *fname)
{
es_str_t *str = NULL;
FILE *fp;
@@ -192,7 +200,7 @@ int cnfSetLexFile(char *fname)
currbs->lineno = yylineno;
bs->prev = currbs;
bs->fn = strdup(fname);
- bs->bs = yy_scan_buffer(es_getBufAddr(str), es_strlen(str));
+ bs->bs = yy_scan_buffer((char*)es_getBufAddr(str), es_strlen(str));
currbs = bs;
currfn = bs->fn;
yylineno = 1;
diff --git a/grammar/utils.c b/grammar/utils.c
index 16cad201..e488ebda 100644
--- a/grammar/utils.c
+++ b/grammar/utils.c
@@ -389,7 +389,7 @@ cnfexprEval(struct cnfexpr *expr, struct exprret *ret)
}
inline static void
-doIndent(indent)
+doIndent(int indent)
{
int i;
for(i = 0 ; i < indent ; ++i)
@@ -611,6 +611,7 @@ cnffuncNew(es_str_t *fname, struct cnffparamlst* paramlst)
}
/* debug helper */
+#ifdef STAND_ALONE
void
cstrPrint(char *text, es_str_t *estr)
{
@@ -632,4 +633,5 @@ main(int argc, char *argv[])
printf("yyparse() returned %d\n", r);
return r;
}
+#endif /* #ifdef STAND_ALONE */
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 5c3f7a40..f3b176f2 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -35,7 +35,7 @@ rsyslogd_SOURCES = \
pidfile.h \
\
../dirty.h
-rsyslogd_CPPFLAGS = $(PTHREADS_CFLAGS) $(RSRT_CFLAGS)
+rsyslogd_CPPFLAGS = $(PTHREADS_CFLAGS) $(RSRT_CFLAGS) $(CNF_LIBS)
rsyslogd_LDADD = $(ZLIB_LIBS) $(PTHREADS_LIBS) $(RSRT_LIBS) $(SOL_LIBS) $(LIBEE_LIBS) $(LIBLOGNORM_LIBS)
rsyslogd_LDFLAGS = -export-dynamic