blob: 64f9cbe57a96ae6b720569fa55c7c0f7f06ce56b [file] [log] [blame]
Michael Clark4504df72007-03-13 08:26:20 +00001AC_PREREQ(2.52)
2
3# Process this file with autoconf to produce a configure script.
Eric Haszlakiewicz42071472013-04-02 21:22:59 -05004AC_INIT([json-c], 0.11.99, [json-c@googlegroups.com])
Michael Clark4504df72007-03-13 08:26:20 +00005
6AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
7
Eric Haszlakiewicz1e89ba62012-04-22 10:27:50 -05008AC_PROG_MAKE_SET
9
Eric Haszlakiewicz075b7832012-07-29 17:48:22 -050010AC_ARG_ENABLE(oldname-compat,
11 AS_HELP_STRING([--disable-oldname-compat],
12 [Don't include the old libjson.so library and include/json directory.]),
13[],
14[enable_oldname_compat=yes]
15)
16AM_CONDITIONAL(ENABLE_OLDNAME_COMPAT, [test "x${enable_oldname_compat}" != "xno"])
17
Michael Clark4504df72007-03-13 08:26:20 +000018# Checks for programs.
19
20# Checks for libraries.
21
22# Checks for header files.
Thomas Gstädtner36ec47d2013-03-03 00:17:25 +010023AC_CONFIG_HEADER(config.h)
24AC_CONFIG_HEADER(json_config.h)
Michael Clark4504df72007-03-13 08:26:20 +000025AC_HEADER_STDC
Remi Collet16a4a322012-11-27 11:06:49 +010026AC_CHECK_HEADERS(fcntl.h limits.h strings.h syslog.h unistd.h [sys/cdefs.h] [sys/param.h] stdarg.h locale.h)
Eric Haszlakiewiczb21b1372012-02-15 20:44:54 -060027AC_CHECK_HEADER(inttypes.h,[AC_DEFINE([JSON_C_HAVE_INTTYPES_H],[1],[Public define for json_inttypes.h])])
Michael Clark4504df72007-03-13 08:26:20 +000028
29# Checks for typedefs, structures, and compiler characteristics.
30AC_C_CONST
31AC_TYPE_SIZE_T
32
33# Checks for library functions.
34AC_FUNC_VPRINTF
35AC_FUNC_MEMCMP
36AC_FUNC_MALLOC
37AC_FUNC_REALLOC
Even Rouault1a957c22013-08-12 20:49:19 +020038AC_CHECK_FUNCS(strcasecmp strdup strerror snprintf vsnprintf vasprintf open vsyslog strncasecmp setlocale)
Michael Clark4504df72007-03-13 08:26:20 +000039
Lin Xue7e06002012-09-09 17:33:35 -070040#check if .section.gnu.warning accepts long strings (for __warn_references)
41AC_LANG_PUSH([C])
42
43AC_MSG_CHECKING([if .gnu.warning accepts long strings])
44AC_LINK_IFELSE([[
45extern void json_object_get();
46__asm__(".section .gnu.json_object_get,\n\t.ascii \"Please link against libjson-c instead of libjson\"\n\t.text");
47
48int main(int c,char* v) {return 0;}
49]], [
50 AC_DEFINE(HAS_GNU_WARNING_LONG, 1, [Define if .gnu.warning accepts long strings.])
51 AC_MSG_RESULT(yes)
52], [
53 AC_MSG_RESULT(no)
54])
55
56AC_LANG_POP([C])
57
Michael Clark4504df72007-03-13 08:26:20 +000058AM_PROG_LIBTOOL
59
Eric Haszlakiewicz1e89ba62012-04-22 10:27:50 -050060AC_CONFIG_FILES([
Michael Clark4504df72007-03-13 08:26:20 +000061Makefile
Eric Haszlakiewicz1f9d1992012-07-29 18:25:09 -050062json.pc
Keith Derrick30dd3672012-03-30 12:28:32 -070063json-c.pc
Eric Haszlakiewicz1e89ba62012-04-22 10:27:50 -050064tests/Makefile
Eric Haszlakiewicz1f9d1992012-07-29 18:25:09 -050065json-c-uninstalled.pc
Michael Clark4504df72007-03-13 08:26:20 +000066])
Eric Haszlakiewicz1e89ba62012-04-22 10:27:50 -050067
68AC_OUTPUT
69