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 3.3 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. AC_PREREQ(2.52)
  2. # Process this file with autoconf to produce a configure script.
  3. AC_INIT([json-c], 0.12.1, [json-c@googlegroups.com])
  4. AM_INIT_AUTOMAKE
  5. AC_PROG_MAKE_SET
  6. AC_ARG_ENABLE(rdrand,
  7. AS_HELP_STRING([--enable-rdrand],
  8. [Enable RDRAND Hardware RNG Hash Seed generation on supported x86/x64 platforms.]),
  9. [if test x$enableval = xyes; then
  10. enable_rdrand=yes
  11. AC_DEFINE(ENABLE_RDRAND, 1, [Enable RDRANR Hardware RNG Hash Seed])
  12. fi])
  13. if test "x$enable_rdrand" = "xyes"; then
  14. AC_MSG_RESULT([RDRAND Hardware RNG Hash Seed enabled on supported x86/x64 platforms])
  15. else
  16. AC_MSG_RESULT([RDRAND Hardware RNG Hash Seed disabled. Use --enable-rdrand to enable])
  17. fi
  18. # Checks for programs.
  19. # Checks for libraries.
  20. # Checks for header files.
  21. AM_PROG_CC_C_O
  22. AC_CONFIG_HEADER(config.h)
  23. AC_CONFIG_HEADER(json_config.h)
  24. AC_HEADER_STDC
  25. AC_CHECK_HEADERS(fcntl.h limits.h strings.h syslog.h unistd.h [sys/cdefs.h] [sys/param.h] stdarg.h locale.h endian.h)
  26. AC_CHECK_HEADER(inttypes.h,[AC_DEFINE([JSON_C_HAVE_INTTYPES_H],[1],[Public define for json_inttypes.h])])
  27. # Checks for typedefs, structures, and compiler characteristics.
  28. AC_C_CONST
  29. AC_TYPE_SIZE_T
  30. # Checks for library functions.
  31. AC_FUNC_VPRINTF
  32. AC_FUNC_MEMCMP
  33. AC_FUNC_MALLOC
  34. AC_FUNC_REALLOC
  35. AC_CHECK_FUNCS(strcasecmp strdup strerror snprintf vsnprintf vasprintf open vsyslog strncasecmp setlocale)
  36. AC_CHECK_DECLS([INFINITY], [], [], [[#include <math.h>]])
  37. AC_CHECK_DECLS([nan], [], [], [[#include <math.h>]])
  38. AC_CHECK_DECLS([isnan], [], [], [[#include <math.h>]])
  39. AC_CHECK_DECLS([isinf], [], [], [[#include <math.h>]])
  40. AC_CHECK_DECLS([_isnan], [], [], [[#include <float.h>]])
  41. AC_CHECK_DECLS([_finite], [], [], [[#include <float.h>]])
  42. #check if .section.gnu.warning accepts long strings (for __warn_references)
  43. AC_LANG_PUSH([C])
  44. AC_MSG_CHECKING([if .gnu.warning accepts long strings])
  45. AC_LINK_IFELSE([AC_LANG_SOURCE([[
  46. extern void json_object_get();
  47. __asm__(".section .gnu.json_object_get,\n\t.ascii \"Please link against libjson-c instead of libjson\"\n\t.text");
  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. AC_LANG_POP([C])
  56. AM_PROG_LIBTOOL
  57. # Check for the -Bsymbolic-functions linker flag
  58. AC_ARG_ENABLE([Bsymbolic],
  59. [AS_HELP_STRING([--disable-Bsymbolic], [Avoid linking with -Bsymbolic-function])],
  60. [],
  61. [enable_Bsymbolic=check])
  62. AS_IF([test "x$enable_Bsymbolic" = "xcheck"],
  63. [
  64. saved_LDFLAGS="${LDFLAGS}"
  65. AC_MSG_CHECKING([for -Bsymbolic-functions linker flag])
  66. LDFLAGS=-Wl,-Bsymbolic-functions
  67. AC_TRY_LINK([], [int main (void) { return 0; }],
  68. [
  69. AC_MSG_RESULT([yes])
  70. enable_Bsymbolic=yes
  71. ],
  72. [
  73. AC_MSG_RESULT([no])
  74. enable_Bsymbolic=no
  75. ])
  76. LDFLAGS="${saved_LDFLAGS}"
  77. ])
  78. AS_IF([test "x$enable_Bsymbolic" = "xyes"], [JSON_BSYMBOLIC_LDFLAGS=-Wl[,]-Bsymbolic-functions])
  79. AC_SUBST(JSON_BSYMBOLIC_LDFLAGS)
  80. AC_CONFIG_FILES([
  81. Makefile
  82. json-c.pc
  83. tests/Makefile
  84. json-c-uninstalled.pc
  85. ])
  86. AC_OUTPUT