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.6 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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([isnan], [], [], [[#include <math.h>]])
  25. AC_CHECK_DECLS([isinf], [], [], [[#include <math.h>]])
  26. AC_CHECK_DECLS([_isnan], [], [], [[#include <float.h>]])
  27. AC_CHECK_DECLS([_finite], [], [], [[#include <float.h>]])
  28. #check if .section.gnu.warning accepts long strings (for __warn_references)
  29. AC_LANG_PUSH([C])
  30. AC_MSG_CHECKING([if .gnu.warning accepts long strings])
  31. AC_LINK_IFELSE([[
  32. extern void json_object_get();
  33. __asm__(".section .gnu.json_object_get,\n\t.ascii \"Please link against libjson-c instead of libjson\"\n\t.text");
  34. int main(int c,char* v) {return 0;}
  35. ]], [
  36. AC_DEFINE(HAS_GNU_WARNING_LONG, 1, [Define if .gnu.warning accepts long strings.])
  37. AC_MSG_RESULT(yes)
  38. ], [
  39. AC_MSG_RESULT(no)
  40. ])
  41. AC_LANG_POP([C])
  42. AM_PROG_LIBTOOL
  43. # Check for the -Bsymbolic-functions linker flag
  44. AC_ARG_ENABLE([Bsymbolic],
  45. [AS_HELP_STRING([--disable-Bsymbolic], [Avoid linking with -Bsymbolic-function])],
  46. [],
  47. [enable_Bsymbolic=check])
  48. AS_IF([test "x$enable_Bsymbolic" = "xcheck"],
  49. [
  50. saved_LDFLAGS="${LDFLAGS}"
  51. AC_MSG_CHECKING([for -Bsymbolic-functions linker flag])
  52. LDFLAGS=-Wl,-Bsymbolic-functions
  53. AC_TRY_LINK([], [int main (void) { return 0; }],
  54. [
  55. AC_MSG_RESULT([yes])
  56. enable_Bsymbolic=yes
  57. ],
  58. [
  59. AC_MSG_RESULT([no])
  60. enable_Bsymbolic=no
  61. ])
  62. LDFLAGS="${saved_LDFLAGS}"
  63. ])
  64. AS_IF([test "x$enable_Bsymbolic" = "xyes"], [JSON_BSYMBOLIC_LDFLAGS=-Wl[,]-Bsymbolic-functions])
  65. AC_SUBST(JSON_BSYMBOLIC_LDFLAGS)
  66. AC_CONFIG_FILES([
  67. Makefile
  68. json-c.pc
  69. tests/Makefile
  70. json-c-uninstalled.pc
  71. ])
  72. AC_OUTPUT