| 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 |
| Eric Haszlakiewicz | 5e8df40 | 2013-06-23 18:55:02 -0500 | [diff] [blame^] | 15 | Make sure you have a complete libtool install, including libtoolize |
| Eric Haszlakiewicz | d1f237e | 2012-09-10 17:32:14 -0500 | [diff] [blame] | 16 | |
| Michael Clark | e6c76da | 2011-06-14 10:04:24 +0800 | [diff] [blame] | 17 | Github repo for json-c: |
| 18 | https://github.com/json-c/json-c |
| Michael Clark | 4504df7 | 2007-03-13 08:26:20 +0000 | [diff] [blame] | 19 | |
| Michael Clark | e6c76da | 2011-06-14 10:04:24 +0800 | [diff] [blame] | 20 | $ git clone https://github.com/json-c/json-c.git |
| 21 | $ cd json-c |
| Jehiah Czebotar | c096f5a | 2011-01-14 18:02:00 +0000 | [diff] [blame] | 22 | $ sh autogen.sh |
| Michael Clark | 4504df7 | 2007-03-13 08:26:20 +0000 | [diff] [blame] | 23 | |
| Jehiah Czebotar | c096f5a | 2011-01-14 18:02:00 +0000 | [diff] [blame] | 24 | Then |
| Michael Clark | 4504df7 | 2007-03-13 08:26:20 +0000 | [diff] [blame] | 25 | |
| Jehiah Czebotar | c096f5a | 2011-01-14 18:02:00 +0000 | [diff] [blame] | 26 | $ ./configure |
| 27 | $ make |
| 28 | $ make install |
| Michael Clark | 4504df7 | 2007-03-13 08:26:20 +0000 | [diff] [blame] | 29 | |
| Jehiah Czebotar | c096f5a | 2011-01-14 18:02:00 +0000 | [diff] [blame] | 30 | To build and run the test programs run |
| Michael Clark | 4504df7 | 2007-03-13 08:26:20 +0000 | [diff] [blame] | 31 | |
| Jehiah Czebotar | c096f5a | 2011-01-14 18:02:00 +0000 | [diff] [blame] | 32 | $ make check |
| Michael Clark | 4504df7 | 2007-03-13 08:26:20 +0000 | [diff] [blame] | 33 | |
| Eric Haszlakiewicz | 8ce53f9 | 2012-07-29 18:43:55 -0500 | [diff] [blame] | 34 | Linking to libjson-c |
| Michael Clark | 4504df7 | 2007-03-13 08:26:20 +0000 | [diff] [blame] | 35 | |
| 36 | If your system has pkgconfig then you can just add this to your makefile |
| 37 | |
| Eric Haszlakiewicz | 8ce53f9 | 2012-07-29 18:43:55 -0500 | [diff] [blame] | 38 | CFLAGS += $(shell pkg-config --cflags json-c) |
| 39 | LDFLAGS += $(shell pkg-config --libs json-c) |
| 40 | |
| 41 | Without pkgconfig, you would do something like this: |
| 42 | |
| 43 | JSON_C_DIR=/path/to/json_c/install |
| 44 | CFLAGS += -I$(JSON_C_DIR)/include/json-c |
| 45 | LDFLAGS+= -L$(JSON_C_DIR)/lib -ljson-c |