blob: 8c7301f0421e02ab2303ce194adf00e2e3bc2ce8 [file] [log] [blame]
Michael Clarke6c76da2011-06-14 10:04:24 +08001Building on Unix with git, gcc and autotools
Michael Clark4504df72007-03-13 08:26:20 +00002
Eric Haszlakiewicza37ddcf2011-05-03 21:19:55 +00003Home page for json-c:
Eric Haszlakiewiczd1f237e2012-09-10 17:32:14 -05004 https://github.com/json-c/json-c/wiki
Eric Haszlakiewicza37ddcf2011-05-03 21:19:55 +00005
Eric Haszlakiewicz8ce53f92012-07-29 18:43:55 -05006 Caution: do NOT use sources from svn.metaparadigm.com, they are old.
7
Eric Haszlakiewiczd1f237e2012-09-10 17:32:14 -05008Prerequisites:
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 Haszlakiewicz5e8df402013-06-23 18:55:02 -050015 Make sure you have a complete libtool install, including libtoolize
Eric Haszlakiewiczd1f237e2012-09-10 17:32:14 -050016
Michael Clarke6c76da2011-06-14 10:04:24 +080017Github repo for json-c:
18 https://github.com/json-c/json-c
Michael Clark4504df72007-03-13 08:26:20 +000019
Michael Clarke6c76da2011-06-14 10:04:24 +080020 $ git clone https://github.com/json-c/json-c.git
21 $ cd json-c
Jehiah Czebotarc096f5a2011-01-14 18:02:00 +000022 $ sh autogen.sh
Michael Clark4504df72007-03-13 08:26:20 +000023
Jehiah Czebotarc096f5a2011-01-14 18:02:00 +000024Then
Michael Clark4504df72007-03-13 08:26:20 +000025
Jehiah Czebotarc096f5a2011-01-14 18:02:00 +000026 $ ./configure
27 $ make
28 $ make install
Michael Clark4504df72007-03-13 08:26:20 +000029
Jehiah Czebotarc096f5a2011-01-14 18:02:00 +000030To build and run the test programs run
Michael Clark4504df72007-03-13 08:26:20 +000031
Jehiah Czebotarc096f5a2011-01-14 18:02:00 +000032 $ make check
Michael Clark4504df72007-03-13 08:26:20 +000033
Eric Haszlakiewicz8ce53f92012-07-29 18:43:55 -050034Linking to libjson-c
Michael Clark4504df72007-03-13 08:26:20 +000035
36If your system has pkgconfig then you can just add this to your makefile
37
Eric Haszlakiewicz8ce53f92012-07-29 18:43:55 -050038CFLAGS += $(shell pkg-config --cflags json-c)
39LDFLAGS += $(shell pkg-config --libs json-c)
40
41Without pkgconfig, you would do something like this:
42
43JSON_C_DIR=/path/to/json_c/install
44CFLAGS += -I$(JSON_C_DIR)/include/json-c
45LDFLAGS+= -L$(JSON_C_DIR)/lib -ljson-c