ast_ext_tool_check.m4 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. # Check for a package using $2-config. Similar to AST_EXT_LIB_CHECK,
  2. # but use $2-config to determine cflags and libraries to use.
  3. # $3 and $4 can be used to replace --cflags and --libs in the request
  4. # AST_EXT_TOOL_CHECK([package], [tool name], [--cflags], [--libs], [includes], [expression])
  5. AC_DEFUN([AST_EXT_TOOL_CHECK],
  6. [
  7. if test "x${PBX_$1}" != "x1" -a "${USE_$1}" != "no"; then
  8. PBX_$1=0
  9. AC_PATH_TOOL(CONFIG_$1, $2, No, [${$1_DIR}/bin:$PATH])
  10. if test ! "x${CONFIG_$1}" = xNo; then
  11. if test x"$3" = x ; then A=--cflags ; else A="$3" ; fi
  12. $1_INCLUDE=$(${CONFIG_$1} $A)
  13. if test x"$4" = x ; then A=--libs ; else A="$4" ; fi
  14. $1_LIB=$(${CONFIG_$1} $A)
  15. if test x"$5" != x ; then
  16. saved_cppflags="${CPPFLAGS}"
  17. if test "x${$1_DIR}" != "x"; then
  18. $1_INCLUDE="-I${$1_DIR}/include"
  19. fi
  20. CPPFLAGS="${CPPFLAGS} ${$1_INCLUDE}"
  21. saved_libs="${LIBS}"
  22. LIBS="${$1_LIB}"
  23. AC_LINK_IFELSE(
  24. [ AC_LANG_PROGRAM( [ $5 ],
  25. [ $6; ]
  26. )],
  27. [ PBX_$1=1
  28. AC_DEFINE([HAVE_$1], 1, [Define if your system has the $1 headers.])
  29. ],
  30. []
  31. )
  32. CPPFLAGS="${saved_cppflags}"
  33. LIBS="${saved_libs}"
  34. else
  35. PBX_$1=1
  36. AC_DEFINE([HAVE_$1], 1, [Define if your system has the $1 libraries.])
  37. fi
  38. fi
  39. fi
  40. ])