| Michael Clark | e6c76da | 2011-06-14 10:04:24 +0800 | [diff] [blame] | 1 | Building on Unix with git, gcc and autotools |
| Michael Clark | 4504df7 | 2007-03-13 08:26:20 +0000 | [diff] [blame] | 2 | |
| Eric Haszlakiewicz | a37ddcf | 2011-05-03 21:19:55 +0000 | [diff] [blame] | 3 | Home page for json-c: |
| Eric Haszlakiewicz | d1f237e | 2012-09-10 17:32:14 -0500 | [diff] [blame] | 4 | https://github.com/json-c/json-c/wiki |
| Eric Haszlakiewicz | a37ddcf | 2011-05-03 21:19:55 +0000 | [diff] [blame] | 5 | |
| Eric Haszlakiewicz | 8ce53f9 | 2012-07-29 18:43:55 -0500 | [diff] [blame] | 6 | Caution: do NOT use sources from svn.metaparadigm.com, they are old. |
| 7 | |
| Eric Haszlakiewicz | d1f237e | 2012-09-10 17:32:14 -0500 | [diff] [blame] | 8 | Prerequisites: |
| 9 | gcc (or another C compiler) |
| 10 | libtool |
| 11 | |
| 12 | If you're not using a release tarball, you'll also need: |
| 13 | autoconf (autoreconf) |
| 14 | automake |
| 15 | |
| Michael Clark | e6c76da | 2011-06-14 10:04:24 +0800 | [diff] [blame] | 16 | Github repo for json-c: |
| 17 | https://github.com/json-c/json-c |
| Michael Clark | 4504df7 | 2007-03-13 08:26:20 +0000 | [diff] [blame] | 18 | |
| Michael Clark | e6c76da | 2011-06-14 10:04:24 +0800 | [diff] [blame] | 19 | $ git clone https://github.com/json-c/json-c.git |
| 20 | $ cd json-c |
| Jehiah Czebotar | c096f5a | 2011-01-14 18:02:00 +0000 | [diff] [blame] | 21 | $ sh autogen.sh |
| Michael Clark | 4504df7 | 2007-03-13 08:26:20 +0000 | [diff] [blame] | 22 | |
| Jehiah Czebotar | c096f5a | 2011-01-14 18:02:00 +0000 | [diff] [blame] | 23 | Then |
| Michael Clark | 4504df7 | 2007-03-13 08:26:20 +0000 | [diff] [blame] | 24 | |
| Jehiah Czebotar | c096f5a | 2011-01-14 18:02:00 +0000 | [diff] [blame] | 25 | $ ./configure |
| 26 | $ make |
| 27 | $ make install |
| Michael Clark | 4504df7 | 2007-03-13 08:26:20 +0000 | [diff] [blame] | 28 | |
| Jehiah Czebotar | c096f5a | 2011-01-14 18:02:00 +0000 | [diff] [blame] | 29 | To build and run the test programs run |
| Michael Clark | 4504df7 | 2007-03-13 08:26:20 +0000 | [diff] [blame] | 30 | |
| Jehiah Czebotar | c096f5a | 2011-01-14 18:02:00 +0000 | [diff] [blame] | 31 | $ make check |
| Michael Clark | 4504df7 | 2007-03-13 08:26:20 +0000 | [diff] [blame] | 32 | |
| Eric Haszlakiewicz | 8ce53f9 | 2012-07-29 18:43:55 -0500 | [diff] [blame] | 33 | Linking to libjson-c |
| Michael Clark | 4504df7 | 2007-03-13 08:26:20 +0000 | [diff] [blame] | 34 | |
| 35 | If your system has pkgconfig then you can just add this to your makefile |
| 36 | |
| Eric Haszlakiewicz | 8ce53f9 | 2012-07-29 18:43:55 -0500 | [diff] [blame] | 37 | CFLAGS += $(shell pkg-config --cflags json-c) |
| 38 | LDFLAGS += $(shell pkg-config --libs json-c) |
| 39 | |
| 40 | Without pkgconfig, you would do something like this: |
| 41 | |
| 42 | JSON_C_DIR=/path/to/json_c/install |
| 43 | CFLAGS += -I$(JSON_C_DIR)/include/json-c |
| 44 | LDFLAGS+= -L$(JSON_C_DIR)/lib -ljson-c |