ast_c_define_check.m4 861 B

123456789101112131415161718192021222324252627282930313233
  1. # Check if a given macro is defined in a certain header.
  2. # AST_C_DEFINE_CHECK([package], [macro name], [header file], [version])
  3. AC_DEFUN([AST_C_DEFINE_CHECK],
  4. [
  5. if test "x${PBX_$1}" != "x1"; then
  6. AC_MSG_CHECKING([for $2 in $3])
  7. saved_cppflags="${CPPFLAGS}"
  8. if test "x${$1_DIR}" != "x"; then
  9. $1_INCLUDE="-I${$1_DIR}/include"
  10. fi
  11. CPPFLAGS="${CPPFLAGS} ${$1_INCLUDE}"
  12. AC_COMPILE_IFELSE(
  13. [ AC_LANG_PROGRAM( [#include <$3>],
  14. [#if defined($2)
  15. int foo = 0;
  16. #else
  17. int foo = bar;
  18. #endif
  19. 0
  20. ])],
  21. [ AC_MSG_RESULT(yes)
  22. PBX_$1=1
  23. AC_DEFINE([HAVE_$1], 1, [Define if your system has the $1 headers.])
  24. m4_ifval([$4], [AC_DEFINE([HAVE_$1_VERSION], $4, [Define $1 headers version])])
  25. ],
  26. [ AC_MSG_RESULT(no) ]
  27. )
  28. CPPFLAGS="${saved_cppflags}"
  29. fi
  30. AC_SUBST(PBX_$1)
  31. ])