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