Make macro json_object_object_foreach multiple-use safe
[platform/upstream/json-c.git] / configure.in
1 AC_PREREQ(2.52)
2
3 # Process this file with autoconf to produce a configure script.
4 AC_INIT([json-c], 0.10, [json-c@googlegroups.com])
5
6 AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
7
8 AC_PROG_MAKE_SET
9
10 AC_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 )
16 AM_CONDITIONAL(ENABLE_OLDNAME_COMPAT, [test "x${enable_oldname_compat}" != "xno"])
17
18 # Checks for programs.
19
20 # Checks for libraries.
21
22 # Checks for header files.
23 AM_CONFIG_HEADER(config.h)
24 AM_CONFIG_HEADER(json_config.h)
25 AC_HEADER_STDC
26 AC_CHECK_HEADERS(fcntl.h limits.h strings.h syslog.h unistd.h [sys/cdefs.h] [sys/param.h] stdarg.h)
27 AC_CHECK_HEADER(inttypes.h,[AC_DEFINE([JSON_C_HAVE_INTTYPES_H],[1],[Public define for json_inttypes.h])])
28
29 # Checks for typedefs, structures, and compiler characteristics.
30 AC_C_CONST
31 AC_TYPE_SIZE_T
32
33 # Checks for library functions.
34 AC_FUNC_VPRINTF
35 AC_FUNC_MEMCMP
36 AC_FUNC_MALLOC
37 AC_FUNC_REALLOC
38 AC_CHECK_FUNCS(strcasecmp strdup strndup strerror snprintf vsnprintf vasprintf open vsyslog strncasecmp)
39
40 #check if .section.gnu.warning accepts long strings (for __warn_references)
41 AC_LANG_PUSH([C])
42
43 AC_MSG_CHECKING([if .gnu.warning accepts long strings])
44 AC_LINK_IFELSE([[
45 extern 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
48 int 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
56 AC_LANG_POP([C])
57
58 AM_PROG_LIBTOOL
59
60 AC_CONFIG_FILES([
61 Makefile
62 json.pc
63 json-c.pc
64 tests/Makefile
65 json-c-uninstalled.pc
66 ])
67
68 AC_OUTPUT
69