You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

configure.ac 2.7 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. AC_PREREQ(2.52)
  2. # Process this file with autoconf to produce a configure script.
  3. AC_INIT([json-c], 0.11.99, [json-c@googlegroups.com])
  4. AM_INIT_AUTOMAKE
  5. AC_PROG_MAKE_SET
  6. # Checks for programs.
  7. # Checks for libraries.
  8. # Checks for header files.
  9. AM_PROG_CC_C_O
  10. AC_CONFIG_HEADER(config.h)
  11. AC_CONFIG_HEADER(json_config.h)
  12. AC_HEADER_STDC
  13. AC_CHECK_HEADERS(fcntl.h limits.h strings.h syslog.h unistd.h [sys/cdefs.h] [sys/param.h] stdarg.h locale.h)
  14. AC_CHECK_HEADER(inttypes.h,[AC_DEFINE([JSON_C_HAVE_INTTYPES_H],[1],[Public define for json_inttypes.h])])
  15. # Checks for typedefs, structures, and compiler characteristics.
  16. AC_C_CONST
  17. AC_TYPE_SIZE_T
  18. # Checks for library functions.
  19. AC_FUNC_VPRINTF
  20. AC_FUNC_MEMCMP
  21. AC_FUNC_MALLOC
  22. AC_FUNC_REALLOC
  23. AC_CHECK_FUNCS(strcasecmp strdup strerror snprintf vsnprintf vasprintf open vsyslog strncasecmp setlocale)
  24. AC_CHECK_DECLS([INFINITY], [], [], [[#include <math.h>]])
  25. AC_CHECK_DECLS([nan], [], [], [[#include <math.h>]])
  26. AC_CHECK_DECLS([isnan], [], [], [[#include <math.h>]])
  27. AC_CHECK_DECLS([isinf], [], [], [[#include <math.h>]])
  28. AC_CHECK_DECLS([_isnan], [], [], [[#include <float.h>]])
  29. AC_CHECK_DECLS([_finite], [], [], [[#include <float.h>]])
  30. #check if .section.gnu.warning accepts long strings (for __warn_references)
  31. AC_LANG_PUSH([C])
  32. AC_MSG_CHECKING([if .gnu.warning accepts long strings])
  33. AC_LINK_IFELSE([[
  34. extern void json_object_get();
  35. __asm__(".section .gnu.json_object_get,\n\t.ascii \"Please link against libjson-c instead of libjson\"\n\t.text");
  36. int main(int c,char* v) {return 0;}
  37. ]], [
  38. AC_DEFINE(HAS_GNU_WARNING_LONG, 1, [Define if .gnu.warning accepts long strings.])
  39. AC_MSG_RESULT(yes)
  40. ], [
  41. AC_MSG_RESULT(no)
  42. ])
  43. AC_LANG_POP([C])
  44. AM_PROG_LIBTOOL
  45. # Check for the -Bsymbolic-functions linker flag
  46. AC_ARG_ENABLE([Bsymbolic],
  47. [AS_HELP_STRING([--disable-Bsymbolic], [Avoid linking with -Bsymbolic-function])],
  48. [],
  49. [enable_Bsymbolic=check])
  50. AS_IF([test "x$enable_Bsymbolic" = "xcheck"],
  51. [
  52. saved_LDFLAGS="${LDFLAGS}"
  53. AC_MSG_CHECKING([for -Bsymbolic-functions linker flag])
  54. LDFLAGS=-Wl,-Bsymbolic-functions
  55. AC_TRY_LINK([], [int main (void) { return 0; }],
  56. [
  57. AC_MSG_RESULT([yes])
  58. enable_Bsymbolic=yes
  59. ],
  60. [
  61. AC_MSG_RESULT([no])
  62. enable_Bsymbolic=no
  63. ])
  64. LDFLAGS="${saved_LDFLAGS}"
  65. ])
  66. AS_IF([test "x$enable_Bsymbolic" = "xyes"], [JSON_BSYMBOLIC_LDFLAGS=-Wl[,]-Bsymbolic-functions])
  67. AC_SUBST(JSON_BSYMBOLIC_LDFLAGS)
  68. AC_CONFIG_FILES([
  69. Makefile
  70. json-c.pc
  71. tests/Makefile
  72. json-c-uninstalled.pc
  73. ])
  74. AC_OUTPUT