[PATCH 3/7] autotool conversion: converted the subdir. 'src/'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Giorgio <giorgio.nicole@xxxxxxxx>

Use specialized test macros to find 'yacc' and 'lex' in the configure.ac.

Renamed the file 'src/parser.y' to 'src/yacc_parser.y' to avoid having
two header files with the same name, 'parser.h': one under 'src/',
generated by 'yacc' from 'parser.y' and the other under 'include/'.

Added an %option line to 'src/scanner.l': this new %option directive
lets us save a custom recipe in the 'src/Makefile.am'; it replaces the
'lex' command line option '--outfile=scanner.c'.
We don't have any explicit make recipe to call 'lex' on 'scanner.l' to
generate 'scanner.c' and 'scanner.h' as in the old 'Makefile.rules';
listing the file 'scanner.l' in the variable 'nft_SOURCES' of
'src/Makefile.am' is now enough.
---
 configure.ac                    | 13 ++-----------
 src/Makefile.in                 | 31 -------------------------------
 src/scanner.l                   |  3 ++-
 src/{parser.y => yacc_parser.y} |  4 ++--
 4 files changed, 6 insertions(+), 45 deletions(-)
 delete mode 100644 src/Makefile.in
 rename src/{parser.y => yacc_parser.y} (99%)

diff --git a/configure.ac b/configure.ac
index 605d39d..900b26a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -24,6 +24,8 @@ AC_PROG_CC
 AC_PROG_MKDIR_P
 AC_PROG_INSTALL
 AC_PROG_SED
+AC_PROG_YACC
+AM_PROG_LEX
 
 AC_CHECK_PROG(CONFIG_MAN1, [docbook2x-man], [y], [n])
 if test "$CONFIG_MAN1" == "y"
@@ -49,17 +51,6 @@ then
 	AC_MSG_WARN([dblatex not found, no PDF manpages will be built])
 fi
 
-AC_PATH_PROG(LEX, [flex])
-if test -z "$LEX"
-then
-	AC_MSG_ERROR([No suitable version of flex found])
-fi
-
-AC_PATH_PROG(YACC, [bison])
-if test -z "$YACC"
-then
-	AC_MSG_ERROR([No suitable version of bison found])
-fi
 
 # Checks for libraries.
 
diff --git a/src/Makefile.in b/src/Makefile.in
deleted file mode 100644
index 8ac2b46..0000000
--- a/src/Makefile.in
+++ /dev/null
@@ -1,31 +0,0 @@
-PROGRAMS		+= nft
-
-nft-destdir		:= @sbindir@
-
-nft-obj			+= main.o
-nft-obj			+= cli.o
-nft-obj			+= rule.o
-nft-obj			+= statement.o
-nft-obj			+= datatype.o
-nft-obj			+= expression.o
-nft-obj			+= evaluate.o
-nft-obj			+= proto.o
-nft-obj			+= payload.o
-nft-obj			+= exthdr.o
-nft-obj			+= meta.o
-nft-obj			+= ct.o
-nft-obj			+= netlink.o
-nft-obj			+= netlink_linearize.o
-nft-obj			+= netlink_delinearize.o
-nft-obj			+= segtree.o
-nft-obj			+= rbtree.o
-nft-obj			+= gmputil.o
-nft-obj			+= utils.o
-nft-obj			+= erec.o
-nft-obj			+= mnl.o
-
-nft-obj			+= parser.o
-nft-extra-clean-files	+= parser.c parser.h
-
-nft-obj			+= scanner.o
-nft-extra-clean-files	+= scanner.c scanner.h
diff --git a/src/scanner.l b/src/scanner.l
index 73a1a3f..e6b8127 100644
--- a/src/scanner.l
+++ b/src/scanner.l
@@ -20,7 +20,7 @@
 #include <erec.h>
 #include <rule.h>
 #include <parser.h>
-#include "parser.h"
+#include "yacc_parser.h"
 
 #define YY_NO_INPUT
 
@@ -178,6 +178,7 @@ addrstring	({macaddr}|{ip4addr}|{ip6addr})
 %option yylineno
 %option nodefault
 %option warn
+%option outfile="scanner.c"
 
 %%
 
diff --git a/src/parser.y b/src/yacc_parser.y
similarity index 99%
rename from src/parser.y
rename to src/yacc_parser.y
index 3e08e21..7cb790d 100644
--- a/src/parser.y
+++ b/src/yacc_parser.y
@@ -12,6 +12,7 @@
 
 #include <stddef.h>
 #include <stdio.h>
+#include <string.h>
 #include <inttypes.h>
 #include <netinet/ip.h>
 #include <netinet/if_ether.h>
@@ -27,8 +28,7 @@
 #include <parser.h>
 #include <erec.h>
 
-#include "parser.h"
-#include "scanner.h"
+#include "yacc_parser.h"
 
 void parser_init(struct parser_state *state, struct list_head *msgs)
 {
-- 
2.0.1

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux