aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Make-inst.am4
-rw-r--r--src/Make-shared.am2
-rw-r--r--src/Make-static.am2
-rw-r--r--src/Make.am7
-rw-r--r--src/grecs-gram.y1
-rw-r--r--src/grecs-lex.l1
-rw-r--r--src/libgrecs.m447
-rw-r--r--src/preproc.c8
-rw-r--r--src/yygrecs.h28
9 files changed, 89 insertions, 11 deletions
diff --git a/src/Make-inst.am b/src/Make-inst.am
index d895a7e..c6860c5 100644
--- a/src/Make-inst.am
+++ b/src/Make-inst.am
@@ -19,2 +19,4 @@ lib_LTLIBRARIES=libgrecs.la
libgrecs_la_SOURCES = $(GRECS_SRC)
-include_HEADERS = grecs.h
+include_HEADERS = grecs.h wordsplit.h
+m4datadir = $(datadir)/aclocal
+dist_m4data_DATA = libgrecs.m4
diff --git a/src/Make-shared.am b/src/Make-shared.am
index fb6f806..8d9f9ff 100644
--- a/src/Make-shared.am
+++ b/src/Make-shared.am
@@ -18,2 +18,2 @@ noinst_LT_LIBRARIES=libgrecs.la
libgrecs_la_SOURCES = $(GRECS_SRC)
-noinst_HEADERS = grecs.h
+noinst_HEADERS += grecs.h wordsplit.h
diff --git a/src/Make-static.am b/src/Make-static.am
index 6029f2d..709cfb7 100644
--- a/src/Make-static.am
+++ b/src/Make-static.am
@@ -18,2 +18,2 @@ noinst_LIBRARIES=libgrecs.a
libgrecs_a_SOURCES = $(GRECS_SRC)
-noinst_HEADERS = grecs.h
+noinst_HEADERS += grecs.h wordsplit.h
diff --git a/src/Make.am b/src/Make.am
index f246099..50f9170 100644
--- a/src/Make.am
+++ b/src/Make.am
@@ -31,4 +31,5 @@ GRECS_SRC = \
version.c\
- wordsplit.c\
- wordsplit.h
+ wordsplit.c
+
+noinst_HEADERS = yygrecs.h
@@ -39,4 +40,2 @@ AM_YFLAGS = -dtv
AM_LFLAGS = -d
-# Use a modified ylwrap implementation that understands the --prefix option.
-YLWRAP = $(top_srcdir)/$(grex_topdir)grecs/build-aux/ylwrap --prefix yy_grecs
diff --git a/src/grecs-gram.y b/src/grecs-gram.y
index 3d4cb2f..a805702 100644
--- a/src/grecs-gram.y
+++ b/src/grecs-gram.y
@@ -20,2 +20,3 @@
#endif
+#include "yygrecs.h"
#include <grecs.h>
diff --git a/src/grecs-lex.l b/src/grecs-lex.l
index d474548..faf6c4c 100644
--- a/src/grecs-lex.l
+++ b/src/grecs-lex.l
@@ -5,2 +5,3 @@
#endif
+#include "yygrecs.h"
}
diff --git a/src/libgrecs.m4 b/src/libgrecs.m4
new file mode 100644
index 0000000..88ce312
--- /dev/null
+++ b/src/libgrecs.m4
@@ -0,0 +1,47 @@
+# libgrecs.m4 serial 1
+dnl This file is part of Grecs
+dnl Copyright (C) 2007, 2009-2011 Sergey Poznyakoff
+dnl
+dnl Grecs is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 3, or (at your option)
+dnl any later version.
+dnl
+dnl Grecs is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+dnl GNU General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with Grecs. If not, see <http://www.gnu.org/licenses/>.
+
+dnl AM_LIBGRECS([minversion],[if-found],[if-notfound])
+AC_DEFUN([AM_LIBGRECS],[
+ cv_libgrecs=no
+ save_LIBS=$LIBS
+ AC_CHECK_LIB([grecs],[grecs_parse],
+ [AC_CHECK_HEADER([grecs.h], [cv_libgrecs=yes])])
+ if test "$cv_libgrecs" = "yes"; then
+ LIBS="$save_LIBS -lgrecs"
+ m4_if($1,,,[
+ AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>
+ #include <grecs.h>
+ ]],
+ [exit(grecs_version_cmp("[libgrecs ]$1"));])],
+ [],
+ [cv_libgrecs=no])])
+ if test "$cv_libgrecs" = "yes"; then
+ m4_if($2,,[
+ AC_DEFINE([HAVE_GRECS_H],[1],
+ [Define if <grecs.h> is available])
+ AC_DEFINE([HAVE_LIBGRECS],[1],
+ [Define if libgrecs is available])
+ save_LIBS=$LIBS
+ ],[
+ $2])
+ else
+ m4_if($3,,:,[$3])
+ fi
+ LIBS=$save_LIBS
+ fi
+ ])
diff --git a/src/preproc.c b/src/preproc.c
index 28f473f..cff8224 100644
--- a/src/preproc.c
+++ b/src/preproc.c
@@ -50,3 +50,3 @@ struct buffer_ctx {
-extern int yy_grecs_flex_debug;
+extern int grecs_yy_flex_debug;
static struct buffer_ctx *context_stack;
@@ -434,3 +434,3 @@ push_source(const char *name, int once)
- if (yy_grecs_flex_debug)
+ if (grecs_yy_flex_debug)
fprintf (stderr, "Processing file `%s'\n", name);
@@ -458,3 +458,3 @@ pop_source()
if (!context_stack) {
- if (yy_grecs_flex_debug)
+ if (grecs_yy_flex_debug)
fprintf (stderr, "End of input\n");
@@ -465,3 +465,3 @@ pop_source()
- if (yy_grecs_flex_debug)
+ if (grecs_yy_flex_debug)
fprintf (stderr, "Resuming file `%s' at line %lu\n",
diff --git a/src/yygrecs.h b/src/yygrecs.h
new file mode 100644
index 0000000..1b3bf31
--- /dev/null
+++ b/src/yygrecs.h
@@ -0,0 +1,28 @@
+/* grecs - Gray's Extensible Configuration System
+ Copyright (C) 2007-2011 Sergey Poznyakoff
+
+ Grecs is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 3 of the License, or (at your
+ option) any later version.
+
+ Grecs is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with Grecs. If not, see <http://www.gnu.org/licenses/>. */
+
+#define yyparse grecs_yyparse
+#define yylex grecs_yylex
+#define yyerror grecs_yyerror
+#define yynerrs grecs_yynerrs
+#define yylval grecs_yylval
+#define yylloc grecs_yylloc
+#define yychar grecs_yychar
+#define yydebug grecs_yydebug
+#define yy_flex_debug grecs_yy_flex_debug
+
+int yylex(void);
+int yyerror(char *s);

Return to:

Send suggestions and report system problems to the System administrator.