4
0

decl.m4 864 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #serial 5
  2. AC_DEFUN(jm_CHECK_DECLARATION,
  3. [
  4. AC_MSG_CHECKING([whether $1 is declared])
  5. AC_CACHE_VAL(jm_cv_func_decl_$1,
  6. [AC_TRY_COMPILE($2,
  7. [
  8. #ifndef $1
  9. char *(*pfn) = (char *(*)) $1
  10. #endif
  11. ],
  12. eval "jm_cv_func_decl_$1=yes",
  13. eval "jm_cv_func_decl_$1=no")])
  14. if eval "test \"`echo '$jm_cv_func_decl_'$1`\" = yes"; then
  15. AC_MSG_RESULT(yes)
  16. ifelse([$3], , :, [$3])
  17. else
  18. AC_MSG_RESULT(no)
  19. ifelse([$4], , , [$4
  20. ])dnl
  21. fi
  22. ])dnl
  23. dnl jm_CHECK_DECLARATIONS(INCLUDES, FUNCTION... [, ACTION-IF-DECLARED
  24. dnl [, ACTION-IF-NOT-DECLARED]])
  25. AC_DEFUN(jm_CHECK_DECLARATIONS,
  26. [
  27. for jm_func in $2
  28. do
  29. jm_CHECK_DECLARATION($jm_func, $1,
  30. [
  31. jm_tr_func=HAVE_DECL_`echo $jm_func | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`
  32. AC_DEFINE_UNQUOTED($jm_tr_func) $3], $4)dnl
  33. done
  34. ])