configure.ac 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. AC_PREREQ([2.60])
  2. AC_INIT([jansson], [2.9], [petri@digip.org])
  3. AC_CONFIG_AUX_DIR([.])
  4. AM_INIT_AUTOMAKE([1.10 foreign])
  5. AC_CONFIG_SRCDIR([src/value.c])
  6. AC_CONFIG_HEADERS([jansson_private_config.h])
  7. # Checks for programs.
  8. AC_PROG_CC
  9. AC_PROG_LIBTOOL
  10. AM_CONDITIONAL([GCC], [test x$GCC = xyes])
  11. # Checks for libraries.
  12. # Checks for header files.
  13. AC_CHECK_HEADERS([endian.h fcntl.h locale.h sched.h unistd.h sys/param.h sys/stat.h sys/time.h sys/types.h])
  14. # Checks for typedefs, structures, and compiler characteristics.
  15. AC_TYPE_INT32_T
  16. AC_TYPE_UINT32_T
  17. AC_TYPE_UINT16_T
  18. AC_TYPE_UINT8_T
  19. AC_TYPE_LONG_LONG_INT
  20. AC_C_INLINE
  21. case $ac_cv_c_inline in
  22. yes) json_inline=inline;;
  23. no) json_inline=;;
  24. *) json_inline=$ac_cv_c_inline;;
  25. esac
  26. AC_SUBST([json_inline])
  27. # Checks for library functions.
  28. AC_CHECK_FUNCS([close getpid gettimeofday localeconv open read sched_yield strtoll])
  29. AC_MSG_CHECKING([for gcc __sync builtins])
  30. have_sync_builtins=no
  31. AC_TRY_LINK(
  32. [], [unsigned long val; __sync_bool_compare_and_swap(&val, 0, 1);],
  33. [have_sync_builtins=yes],
  34. )
  35. if test "x$have_sync_builtins" = "xyes"; then
  36. AC_DEFINE([HAVE_SYNC_BUILTINS], [1],
  37. [Define to 1 if gcc's __sync builtins are available])
  38. fi
  39. AC_MSG_RESULT([$have_sync_builtins])
  40. AC_MSG_CHECKING([for gcc __atomic builtins])
  41. have_atomic_builtins=no
  42. AC_TRY_LINK(
  43. [], [char l; unsigned long v; __atomic_test_and_set(&l, __ATOMIC_RELAXED); __atomic_store_n(&v, 1, __ATOMIC_RELEASE); __atomic_load_n(&v, __ATOMIC_ACQUIRE);],
  44. [have_atomic_builtins=yes],
  45. )
  46. if test "x$have_atomic_builtins" = "xyes"; then
  47. AC_DEFINE([HAVE_ATOMIC_BUILTINS], [1],
  48. [Define to 1 if gcc's __atomic builtins are available])
  49. fi
  50. AC_MSG_RESULT([$have_atomic_builtins])
  51. case "$ac_cv_type_long_long_int$ac_cv_func_strtoll" in
  52. yesyes) json_have_long_long=1;;
  53. *) json_have_long_long=0;;
  54. esac
  55. AC_SUBST([json_have_long_long])
  56. case "$ac_cv_header_locale_h$ac_cv_func_localeconv" in
  57. yesyes) json_have_localeconv=1;;
  58. *) json_have_localeconv=0;;
  59. esac
  60. AC_SUBST([json_have_localeconv])
  61. # Features
  62. AC_ARG_ENABLE([urandom],
  63. [AS_HELP_STRING([--disable-urandom],
  64. [Don't use /dev/urandom to seed the hash function])],
  65. [use_urandom=$enableval], [use_urandom=yes])
  66. if test "x$use_urandom" = xyes; then
  67. AC_DEFINE([USE_URANDOM], [1],
  68. [Define to 1 if /dev/urandom should be used for seeding the hash function])
  69. fi
  70. AC_ARG_ENABLE([windows-cryptoapi],
  71. [AS_HELP_STRING([--disable-windows-cryptoapi],
  72. [Don't use CryptGenRandom to seed the hash function])],
  73. [use_windows_cryptoapi=$enableval], [use_windows_cryptoapi=yes])
  74. if test "x$use_windows_cryptoapi" = xyes; then
  75. AC_DEFINE([USE_WINDOWS_CRYPTOAPI], [1],
  76. [Define to 1 if CryptGenRandom should be used for seeding the hash function])
  77. fi
  78. AC_ARG_ENABLE([initial-hashtable-order],
  79. [AS_HELP_STRING([--enable-initial-hashtable-order=VAL],
  80. [Number of buckets new object hashtables contain is 2 raised to this power. The default is 3, so empty hashtables contain 2^3 = 8 buckets.])],
  81. [initial_hashtable_order=$enableval], [initial_hashtable_order=3])
  82. AC_DEFINE_UNQUOTED([INITIAL_HASHTABLE_ORDER], [$initial_hashtable_order],
  83. [Number of buckets new object hashtables contain is 2 raised to this power. E.g. 3 -> 2^3 = 8.])
  84. if test x$GCC = xyes; then
  85. AM_CFLAGS="-Wall -Wextra -Wdeclaration-after-statement"
  86. fi
  87. AC_SUBST([AM_CFLAGS])
  88. AC_CONFIG_FILES([
  89. jansson.pc
  90. Makefile
  91. doc/Makefile
  92. src/Makefile
  93. src/jansson_config.h
  94. test/Makefile
  95. test/bin/Makefile
  96. test/suites/Makefile
  97. test/suites/api/Makefile
  98. ])
  99. AC_OUTPUT