configure.ac 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. AC_PREREQ([2.60])
  2. AC_INIT([jansson], [2.6], [petri@digip.org])
  3. AC_CONFIG_MACRO_DIR([m4])
  4. AM_INIT_AUTOMAKE([1.10 foreign])
  5. m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
  6. AC_CONFIG_SRCDIR([src/value.c])
  7. AC_CONFIG_HEADERS([config.h])
  8. # Checks for programs.
  9. AC_PROG_CC
  10. AC_PROG_LIBTOOL
  11. AM_CONDITIONAL([GCC], [test x$GCC = xyes])
  12. # Checks for libraries.
  13. # Checks for header files.
  14. 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])
  15. # Checks for typedefs, structures, and compiler characteristics.
  16. AC_TYPE_INT32_T
  17. AC_TYPE_UINT32_T
  18. AC_TYPE_LONG_LONG_INT
  19. AC_C_INLINE
  20. case $ac_cv_c_inline in
  21. yes) json_inline=inline;;
  22. no) json_inline=;;
  23. *) json_inline=$ac_cv_c_inline;;
  24. esac
  25. AC_SUBST([json_inline])
  26. # Checks for library functions.
  27. AC_CHECK_FUNCS([close getpid gettimeofday localeconv open read sched_yield strtoll])
  28. AC_MSG_CHECKING([for gcc __sync builtins])
  29. have_sync_builtins=no
  30. AC_TRY_LINK(
  31. [], [unsigned long val; __sync_bool_compare_and_swap(&val, 0, 1);],
  32. [have_sync_builtins=yes],
  33. )
  34. if test "x$have_sync_builtins" = "xyes"; then
  35. AC_DEFINE([HAVE_SYNC_BUILTINS], [1],
  36. [Define to 1 if gcc's __sync builtins are available])
  37. fi
  38. AC_MSG_RESULT([$have_sync_builtins])
  39. AC_MSG_CHECKING([for gcc __atomic builtins])
  40. have_atomic_builtins=no
  41. AC_TRY_LINK(
  42. [], [char l; unsigned long v; __atomic_test_and_set(&l, __ATOMIC_RELAXED); __atomic_store_n(&v, 1, __ATOMIC_ACQ_REL); __atomic_load_n(&v, __ATOMIC_ACQUIRE);],
  43. [have_atomic_builtins=yes],
  44. )
  45. if test "x$have_atomic_builtins" = "xyes"; then
  46. AC_DEFINE([HAVE_ATOMIC_BUILTINS], [1],
  47. [Define to 1 if gcc's __atomic builtins are available])
  48. fi
  49. AC_MSG_RESULT([$have_atomic_builtins])
  50. case "$ac_cv_type_long_long_int$ac_cv_func_strtoll" in
  51. yesyes) json_have_long_long=1;;
  52. *) json_have_long_long=0;;
  53. esac
  54. AC_SUBST([json_have_long_long])
  55. case "$ac_cv_header_locale_h$ac_cv_func_localeconv" in
  56. yesyes) json_have_localeconv=1;;
  57. *) json_have_localeconv=0;;
  58. esac
  59. AC_SUBST([json_have_localeconv])
  60. # Features
  61. AC_ARG_ENABLE([urandom],
  62. [AS_HELP_STRING([--disable-urandom],
  63. [Don't use /dev/urandom to seed the hash function])],
  64. [use_urandom=$enableval], [use_urandom=yes])
  65. if test "x$use_urandom" = xyes; then
  66. AC_DEFINE([USE_URANDOM], [1],
  67. [Define to 1 if /dev/urandom should be used for seeding the hash function])
  68. fi
  69. AC_ARG_ENABLE([windows-cryptoapi],
  70. [AS_HELP_STRING([--disable-windows-cryptoapi],
  71. [Don't use CryptGenRandom to seed the hash function])],
  72. [use_windows_cryptoapi=$enableval], [use_windows_cryptoapi=yes])
  73. if test "x$use_windows_cryptoapi" = xyes; then
  74. AC_DEFINE([USE_WINDOWS_CRYPTOAPI], [1],
  75. [Define to 1 if CryptGenRandom should be used for seeding the hash function])
  76. fi
  77. AC_CONFIG_FILES([
  78. jansson.pc
  79. Makefile
  80. src/Makefile
  81. src/jansson_config.h
  82. ])
  83. AC_OUTPUT