blob: 20adddcc9f18185f74bae07ce01e874af7d058ff [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:
4 http://oss.metaparadigm.com/json-c/
5
Eric Haszlakiewicz8ce53f92012-07-29 18:43:55 -05006 Caution: do NOT use sources from svn.metaparadigm.com, they are old.
7
Michael Clarke6c76da2011-06-14 10:04:24 +08008Github repo for json-c:
9 https://github.com/json-c/json-c
Michael Clark4504df72007-03-13 08:26:20 +000010
Michael Clarke6c76da2011-06-14 10:04:24 +080011 $ git clone https://github.com/json-c/json-c.git
12 $ cd json-c
Jehiah Czebotarc096f5a2011-01-14 18:02:00 +000013 $ sh autogen.sh
Michael Clark4504df72007-03-13 08:26:20 +000014
Jehiah Czebotarc096f5a2011-01-14 18:02:00 +000015Then
Michael Clark4504df72007-03-13 08:26:20 +000016
Jehiah Czebotarc096f5a2011-01-14 18:02:00 +000017 $ ./configure
18 $ make
19 $ make install
Michael Clark4504df72007-03-13 08:26:20 +000020
Jehiah Czebotarc096f5a2011-01-14 18:02:00 +000021To build and run the test programs run
Michael Clark4504df72007-03-13 08:26:20 +000022
Jehiah Czebotarc096f5a2011-01-14 18:02:00 +000023 $ make check
Michael Clark4504df72007-03-13 08:26:20 +000024
Eric Haszlakiewicz8ce53f92012-07-29 18:43:55 -050025Linking to libjson-c
Michael Clark4504df72007-03-13 08:26:20 +000026
27If your system has pkgconfig then you can just add this to your makefile
28
Eric Haszlakiewicz8ce53f92012-07-29 18:43:55 -050029CFLAGS += $(shell pkg-config --cflags json-c)
30LDFLAGS += $(shell pkg-config --libs json-c)
31
32Without pkgconfig, you would do something like this:
33
34JSON_C_DIR=/path/to/json_c/install
35CFLAGS += -I$(JSON_C_DIR)/include/json-c
36LDFLAGS+= -L$(JSON_C_DIR)/lib -ljson-c