blob: ac1e812b96917127ad77756ddb08db94e01c5582 [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
15
Michael Clarke6c76da2011-06-14 10:04:24 +080016Github repo for json-c:
17 https://github.com/json-c/json-c
Michael Clark4504df72007-03-13 08:26:20 +000018
Michael Clarke6c76da2011-06-14 10:04:24 +080019 $ git clone https://github.com/json-c/json-c.git
20 $ cd json-c
Jehiah Czebotarc096f5a2011-01-14 18:02:00 +000021 $ sh autogen.sh
Michael Clark4504df72007-03-13 08:26:20 +000022
Jehiah Czebotarc096f5a2011-01-14 18:02:00 +000023Then
Michael Clark4504df72007-03-13 08:26:20 +000024
Jehiah Czebotarc096f5a2011-01-14 18:02:00 +000025 $ ./configure
26 $ make
27 $ make install
Michael Clark4504df72007-03-13 08:26:20 +000028
Jehiah Czebotarc096f5a2011-01-14 18:02:00 +000029To build and run the test programs run
Michael Clark4504df72007-03-13 08:26:20 +000030
Jehiah Czebotarc096f5a2011-01-14 18:02:00 +000031 $ make check
Michael Clark4504df72007-03-13 08:26:20 +000032
Eric Haszlakiewicz8ce53f92012-07-29 18:43:55 -050033Linking to libjson-c
Michael Clark4504df72007-03-13 08:26:20 +000034
35If your system has pkgconfig then you can just add this to your makefile
36
Eric Haszlakiewicz8ce53f92012-07-29 18:43:55 -050037CFLAGS += $(shell pkg-config --cflags json-c)
38LDFLAGS += $(shell pkg-config --libs json-c)
39
40Without pkgconfig, you would do something like this:
41
42JSON_C_DIR=/path/to/json_c/install
43CFLAGS += -I$(JSON_C_DIR)/include/json-c
44LDFLAGS+= -L$(JSON_C_DIR)/lib -ljson-c