1`json-c`
2========
3
4Building on Unix with `git`, `gcc` and `autotools`
5--------------------------------------------------
6
7Home page for json-c: https://github.com/json-c/json-c/wiki
8
9Caution: do **NOT** use sources from svn.metaparadigm.com,
10they are old.
11
12Prerequisites:
13
14 - `gcc`, `clang`, or another C compiler
15 - `libtool`
16
17If you're not using a release tarball, you'll also need:
18
19 - `autoconf` (`autoreconf`)
20 - `automake`
21
22Make sure you have a complete `libtool` install, including `libtoolize`.
23
24`json-c` GitHub repo: https://github.com/json-c/json-c
25
26```bash
27$ git clone https://github.com/json-c/json-c.git
28$ cd json-c
29$ sh autogen.sh
30```
31
32followed by
33
34```bash
35$ ./configure
36$ make
37$ make install
38```
39
40To build and run the test programs:
41
42```bash
43$ make check
44```
45
46Linking to `libjson-c`
47----------------------
48
49If your system has `pkgconfig`,
50then you can just add this to your `makefile`:
51
52```make
53CFLAGS += $(shell pkg-config --cflags json-c)
54LDFLAGS += $(shell pkg-config --libs json-c)
55```
56
57Without `pkgconfig`, you would do something like this:
58
59```make
60JSON_C_DIR=/path/to/json_c/install
61CFLAGS += -I$(JSON_C_DIR)/include/json-c
62LDFLAGS+= -L$(JSON_C_DIR)/lib -ljson-c
63```
64