2
0

check-libheader.m4 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. dnl
  2. dnl CHECK-LIBHEADER(FEATURE-NAME, LIB-NAME, LIB-FUNCTION, HEADER-NAME,
  3. dnl ACTION-IF-FOUND, ACTION-IF-NOT-FOUND,
  4. dnl EXTRA-LDFLAGS, EXTRA-CPPFLAGS)
  5. dnl
  6. dnl FEATURE-NAME - feature name; library and header files are treated
  7. dnl as feature, which we look for
  8. dnl LIB-NAME - library name as in AC_CHECK_LIB macro
  9. dnl LIB-FUNCTION - library symbol as in AC_CHECK_LIB macro
  10. dnl HEADER-NAME - header file name as in AC_CHECK_HEADER
  11. dnl ACTION-IF-FOUND - when feature is found then execute given action
  12. dnl ACTION-IF-NOT-FOUND - when feature is not found then execute given action
  13. dnl EXTRA-LDFLAGS - extra linker flags (-L or -l)
  14. dnl EXTRA-CPPFLAGS - extra C preprocessor flags, i.e. -I/usr/X11R6/include
  15. dnl
  16. dnl Based on GST_CHECK_LIBHEADER from gstreamer plugins 0.3.1.
  17. dnl
  18. AC_DEFUN([CHECK_LIBHEADER],
  19. [
  20. AC_CHECK_LIB([$2], [$3], HAVE_[$1]=yes, HAVE_[$1]=no, [$7])
  21. check_libheader_feature_name=translit([$1], A-Z, a-z)
  22. if test "x$HAVE_[$1]" = "xyes"; then
  23. check_libheader_save_CPPFLAGS=$CPPFLAGS
  24. CPPFLAGS="[$8] $CPPFLAGS"
  25. AC_CHECK_HEADER([$4], :, HAVE_[$1]=no)
  26. CPPFLAGS=$check_libheader_save_CPPFLAGS
  27. fi
  28. if test "x$HAVE_[$1]" = "xyes"; then
  29. ifelse([$5], , :, [$5])
  30. AC_MSG_NOTICE($check_libheader_feature_name was found)
  31. else
  32. ifelse([$6], , :, [$6])
  33. AC_MSG_WARN($check_libheader_feature_name not found)
  34. fi
  35. AC_SUBST(HAVE_[$1])
  36. ]
  37. )