ast_c_compile_check.m4 837 B

123456789101112131415161718192021222324252627
  1. # Check if a given expression will compile using a certain header.
  2. # AST_C_COMPILE_CHECK([package], [expression], [header file], [version], [description])
  3. AC_DEFUN([AST_C_COMPILE_CHECK],
  4. [
  5. if test "x${PBX_$1}" != "x1" -a "${USE_$1}" != "no"; then
  6. AC_MSG_CHECKING(m4_ifval([$5],[for $5],[if "$2" compiles using $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. [ $2; ]
  15. )],
  16. [ AC_MSG_RESULT(yes)
  17. PBX_$1=1
  18. AC_DEFINE([HAVE_$1], 1, [Define if your system has the $1 headers.])
  19. m4_ifval([$4], [AC_DEFINE([HAVE_$1_VERSION], $4, [Define $1 headers version])])
  20. ],
  21. [ AC_MSG_RESULT(no) ]
  22. )
  23. CPPFLAGS="${saved_cppflags}"
  24. fi
  25. ])