ast_c_declare_check.m4 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. # Check if a given symbol is declared using a certain header.
  2. # Check whether SYMBOL (a function, variable, or constant) is declared.
  3. # AST_C_DECLARE_CHECK([package], [symbol], [header file], [version])
  4. AC_DEFUN([AST_C_DECLARE_CHECK],
  5. [
  6. if test "x${PBX_$1}" != "x1" -a "${USE_$1}" != "no"; then
  7. AC_MSG_CHECKING([for $2 declared in $3])
  8. saved_cppflags="${CPPFLAGS}"
  9. if test "x${$1_DIR}" != "x"; then
  10. $1_INCLUDE="-I${$1_DIR}/include"
  11. fi
  12. CPPFLAGS="${CPPFLAGS} ${$1_INCLUDE}"
  13. AC_COMPILE_IFELSE(
  14. [ AC_LANG_PROGRAM( [#include <$3>],
  15. [#if !defined($2)
  16. (void) $2;
  17. #endif
  18. ])],
  19. [ AC_MSG_RESULT(yes)
  20. PBX_$1=1
  21. AC_DEFINE([HAVE_$1], 1, [Define if your system has $2 declared.])
  22. m4_ifval([$4], [AC_DEFINE([HAVE_$1_VERSION], $4, [Define $1 headers version])])
  23. ],
  24. [ AC_MSG_RESULT(no) ]
  25. )
  26. CPPFLAGS="${saved_cppflags}"
  27. fi
  28. ])