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