1
0
Fork 0
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
..
AUTHORS
Android.configure.mk
Android.mk
COPYING
ChangeLog
Doxyfile
Makefile.am
Makefile.am.inc
README
README-WIN32.html
README.html
README.md
RELEASE_CHECKLIST.txt
arraylist.c
arraylist.h
autogen.sh
bits.h
check.log
config.h
config.h.in
configure.ac
debug.c
debug.h
json-c-uninstalled.pc.in
json-c.pc.in
json.h
json_c_version.c
json_c_version.h
json_config.h
json_config.h.in
json_inttypes.h
json_object.c
json_object.h
json_object_iterator.c
json_object_iterator.h
json_object_private.h
json_tokener.c
json_tokener.h
json_util.c
json_util.h
libjson.c
linkhash.c
linkhash.h
math_compat.h
printbuf.c
printbuf.h
random_seed.c
random_seed.h

README.md

json-c

Building on Unix with git, gcc and autotools

Home page for json-c: https://github.com/json-c/json-c/wiki

Caution: do NOT use sources from svn.metaparadigm.com, they are old.

Prerequisites:

  • gcc, clang, or another C compiler
  • libtool

If you're not using a release tarball, you'll also need:

  • autoconf (autoreconf)
  • automake

Make sure you have a complete libtool install, including libtoolize.

json-c GitHub repo: https://github.com/json-c/json-c

$ git clone https://github.com/json-c/json-c.git
$ cd json-c
$ sh autogen.sh

followed by

$ ./configure
$ make
$ make install

To build and run the test programs:

$ make check

Linking to libjson-c

If your system has pkgconfig, then you can just add this to your makefile:

CFLAGS += $(shell pkg-config --cflags json-c)
LDFLAGS += $(shell pkg-config --libs json-c)

Without pkgconfig, you would do something like this:

JSON_C_DIR=/path/to/json_c/install
CFLAGS += -I$(JSON_C_DIR)/include/json-c
LDFLAGS+= -L$(JSON_C_DIR)/lib -ljson-c