--- /dev/null
+--- a/autoconf/ast_ext_tool_check.m4
++++ b/autoconf/ast_ext_tool_check.m4
+@@ -8,13 +8,16 @@ AC_DEFUN([AST_EXT_TOOL_CHECK],
+ AC_REQUIRE([AST_PROG_SED])dnl
+ if test "x${PBX_$1}" != "x1" -a "${USE_$1}" != "no"; then
+ PBX_$1=0
+- AC_PATH_TOOL(CONFIG_$1, $2, No, [${$1_DIR}/bin:$PATH])
++ if test "x${$1_DIR}" != "x"; then
++ AC_PATH_TOOL(CONFIG_$1, $2, No, [${$1_DIR}/bin:$PATH])
++ else
++ AC_PATH_TOOL(CONFIG_$1, $2, No, [$PATH])
++ fi
+ if test ! "x${CONFIG_$1}" = xNo; then
+ $1_INCLUDE=$(${CONFIG_$1} m4_default([$3],[--cflags]))
+- $1_INCLUDE=$(echo ${$1_INCLUDE} | $SED -e "s|-I|-I${$1_DIR}|g" -e "s|-std=c99||g")
++ $1_INCLUDE=$(echo ${$1_INCLUDE} | $SED -e "s|-std=c99||g")
+
+ $1_LIB=$(${CONFIG_$1} m4_default([$4],[--libs]))
+- $1_LIB=$(echo ${$1_LIB} | $SED -e "s|-L|-L${$1_DIR}|g")
+
+ m4_ifval([$5], [
+ saved_cppflags="${CPPFLAGS}"