Skip to content

Commit b41f52f

Browse files
Roguelazerben-healthforge
authored andcommitted
Convert buildsystem to autotools
1 parent 3eebd46 commit b41f52f

13 files changed

+93
-20
lines changed

.gitignore

+34-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,35 @@
1-
json_parser.tab.c
2-
json_parser.tab.h
3-
json_scanner.yy.c
4-
json_scanner.yy.h
1+
json_parser.c
2+
json_parser.h
3+
json_scanner.c
4+
json_scanner.h
55
jsonval
6+
7+
*.o
8+
9+
# autotools stuff
10+
*.in
11+
*.la
12+
*.lo
13+
.deps/
14+
.libs/
15+
Makefile
16+
aclocal.m4
17+
autom4te.cache
18+
autoscan.log
19+
compile
20+
config.guess
21+
config.h
22+
config.h.in~
23+
config.log
24+
config.status
25+
config.sub
26+
configure
27+
configure.scan
28+
depcomp
29+
install-sh
30+
libtool
31+
ltmain.sh
32+
m4/
33+
missing
34+
stamp*
35+
ylwrap

AUTHORS

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Ben Spencer <[email protected]>
2+
Joey Adams <[email protected]>
3+
Vasili Sviridov <[email protected]>
4+
James Brown <[email protected]>

ChangeLog

Whitespace-only changes.

INSTALL

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
autoreconf -i ; ./configure --prefix=/foo ; make ; sudo make install

Makefile

-9
This file was deleted.

Makefile.am

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
AM_YFLAGS = -d
2+
AM_LFLAGS = -d
3+
jsonval_SOURCES = common.h json_parser.y json_scanner.l main.c
4+
5+
bin_PROGRAMS = jsonval

NEWS

Whitespace-only changes.

README

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Simple C program to validate JSON

common.h

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#ifndef JSONVAL_COMMON_H
2+
#define JSONVAL_COMMON_H
3+
4+
/*
5+
* Reference yylex() and yytext from flex
6+
*/
7+
typedef void* yyscan_t;
8+
typedef int YYSTYPE;
9+
extern int yylex (YYSTYPE* yylval_param, yyscan_t scanner);
10+
11+
extern void yyerror(yyscan_t, const char *);
12+
13+
#endif

configure.ac

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# -*- Autoconf -*-
2+
# Process this file with autoconf to produce a configure script.
3+
4+
AC_PREREQ([2.69])
5+
AC_INIT([FULL-PACKAGE-NAME], [VERSION], [BUG-REPORT-ADDRESS])
6+
AC_CONFIG_SRCDIR([json_parser.y])
7+
AC_CONFIG_HEADERS([config.h])
8+
9+
# Checks for programs.
10+
AC_PROG_CC
11+
AC_PROG_YACC
12+
AM_PROG_LEX
13+
14+
# Checks for libraries.
15+
16+
# Checks for header files.
17+
AC_CHECK_HEADERS([stdlib.h])
18+
19+
# Checks for typedefs, structures, and compiler characteristics.
20+
AC_CHECK_HEADER_STDBOOL
21+
22+
# Checks for library functions.
23+
24+
AM_INIT_AUTOMAKE
25+
26+
AC_CONFIG_FILES([Makefile])
27+
AC_OUTPUT

json_parser.y

+2-3
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,9 @@
1818
*/
1919

2020
%{
21-
#include "json_parser.tab.h"
22-
#include "json_scanner.yy.h"
21+
#include "common.h"
2322

24-
extern void yyerror(yyscan_t, const char *);
23+
#include "json_parser.h"
2524
%}
2625

2726
%defines

json_scanner.l

+4-2
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,15 @@
1818
*/
1919

2020
%{
21-
#include "json_parser.tab.h"
21+
#include "common.h"
22+
23+
#include "json_parser.h"
2224
%}
2325

2426
%option 8bit reentrant bison-bridge
2527
%option yylineno noyywrap nounput
2628
%option warn nodefault
27-
%option outfile="json_scanner.yy.c" header-file="json_scanner.yy.h"
29+
%option outfile="json_scanner.c" header-file="json_scanner.h"
2830

2931
%x str
3032

main.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
#include <stdio.h>
2121
#include <stdlib.h>
2222
#include <getopt.h>
23-
#include "json_parser.tab.h"
24-
#include "json_scanner.yy.h"
23+
#include "json_parser.h"
24+
#include "json_scanner.h"
2525

2626
extern int yyparse(yyscan_t scanner);
2727
unsigned char parse_and_report(const char *);

0 commit comments

Comments
 (0)