]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
add an argument for extra headers to AC_EXT_LIB_CHECK,
authorLuigi Rizzo <rizzo@icir.org>
Tue, 20 Nov 2007 15:39:00 +0000 (15:39 +0000)
committerLuigi Rizzo <rizzo@icir.org>
Tue, 20 Nov 2007 15:39:00 +0000 (15:39 +0000)
and on passing simplify the code.
Too bad that every time we need to regenerate configure...

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89452 65c4cc65-6c06-0410-ace0-fbb531ad65f3

acinclude.m4
configure
configure.ac

index bb389eaeb6103cca5495a79c790058c58e30fe22..045e3682cae1411b8f5e31f21258d9c5136823d8 100644 (file)
@@ -117,11 +117,13 @@ AC_DEFUN([AST_C_DEFINE_CHECK],
 # in a library, or, if no function is supplied, only check for the
 # existence of the header files.
 
-# AST_EXT_LIB_CHECK([package], [library], [function], [header], [additional LIB data], [version])
+# AST_EXT_LIB_CHECK([package], [library], [function], [header],
+#       [extra libs], [extra cflags], [version])
 AC_DEFUN([AST_EXT_LIB_CHECK],
 [
 if test "x${PBX_$1}" != "x1" -a "${USE_$1}" != "no"; then
    pbxlibdir=""
+   # if --with-$1=DIR has been specified, use it.
    if test "x${$1_DIR}" != "x"; then
       if test -d ${$1_DIR}/lib; then
         pbxlibdir="-L${$1_DIR}/lib"
@@ -136,22 +138,21 @@ if test "x${PBX_$1}" != "x1" -a "${USE_$1}" != "no"; then
       AC_CHECK_LIB([$2], [${pbxfuncname}], [AST_$1_FOUND=yes], [AST_$1_FOUND=no], ${pbxlibdir} $5)
    fi
 
+   # now check for the header.
    if test "${AST_$1_FOUND}" = "yes"; then
-      $1_LIB="-l$2 $5"
-      $1_HEADER_FOUND="1"
+      $1_LIB="${pbxlibdir} -l$2 $5"
+      # if --with-$1=DIR has been specified, use it.
       if test "x${$1_DIR}" != "x"; then
-         $1_LIB="${pbxlibdir} ${$1_LIB}"
         $1_INCLUDE="-I${$1_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${$1_DIR}/include"
-        if test "x$4" != "x" ; then
-           AC_CHECK_HEADER([${$1_DIR}/include/$4], [$1_HEADER_FOUND=1], [$1_HEADER_FOUND=0])
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "x$4" != "x" ; then
-            AC_CHECK_HEADER([$4], [$1_HEADER_FOUND=1], [$1_HEADER_FOUND=0])
-        fi
+      fi
+      $1_INCLUDE="${$1_INCLUDE} $6"
+      if test "x$4" = "x" ; then       # no header, assume found
+         $1_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${$1_INCLUDE} $6"
+        AC_CHECK_HEADER([$4], [$1_HEADER_FOUND=1], [$1_HEADER_FOUND=0])
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${$1_HEADER_FOUND}" = "x0" ; then
          $1_LIB=""
index 84921d8346a6ab3bcaef01ba897e304302c7aec3..a6c60971b8a0ab7fb9d78b07e459d30cc489670c 100755 (executable)
--- a/configure
+++ b/configure
@@ -17860,6 +17860,7 @@ _ACEOF
 
 if test "x${PBX_ALSA}" != "x1" -a "${USE_ALSA}" != "no"; then
    pbxlibdir=""
+   # if --with-ALSA=DIR has been specified, use it.
    if test "x${ALSA_DIR}" != "x"; then
       if test -d ${ALSA_DIR}/lib; then
         pbxlibdir="-L${ALSA_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_ALSA_FOUND}" = "yes"; then
-      ALSA_LIB="-lasound -lm -ldl"
-      ALSA_HEADER_FOUND="1"
+      ALSA_LIB="${pbxlibdir} -lasound -lm -ldl"
+      # if --with-ALSA=DIR has been specified, use it.
       if test "x${ALSA_DIR}" != "x"; then
-         ALSA_LIB="${pbxlibdir} ${ALSA_LIB}"
         ALSA_INCLUDE="-I${ALSA_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${ALSA_DIR}/include"
-        if test "xalsa/asoundlib.h" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${ALSA_DIR}/include/alsa/asoundlib.h" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${ALSA_DIR}/include/alsa/asoundlib.h" >&5
-echo $ECHO_N "checking for ${ALSA_DIR}/include/alsa/asoundlib.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${ALSA_DIR}/include/alsa/asoundlib.h usability" >&5
-echo $ECHO_N "checking ${ALSA_DIR}/include/alsa/asoundlib.h usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <${ALSA_DIR}/include/alsa/asoundlib.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking ${ALSA_DIR}/include/alsa/asoundlib.h presence" >&5
-echo $ECHO_N "checking ${ALSA_DIR}/include/alsa/asoundlib.h presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${ALSA_DIR}/include/alsa/asoundlib.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${ALSA_DIR}/include/alsa/asoundlib.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${ALSA_DIR}/include/alsa/asoundlib.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ALSA_DIR}/include/alsa/asoundlib.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${ALSA_DIR}/include/alsa/asoundlib.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${ALSA_DIR}/include/alsa/asoundlib.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${ALSA_DIR}/include/alsa/asoundlib.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ALSA_DIR}/include/alsa/asoundlib.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${ALSA_DIR}/include/alsa/asoundlib.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ALSA_DIR}/include/alsa/asoundlib.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${ALSA_DIR}/include/alsa/asoundlib.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ALSA_DIR}/include/alsa/asoundlib.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${ALSA_DIR}/include/alsa/asoundlib.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ALSA_DIR}/include/alsa/asoundlib.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${ALSA_DIR}/include/alsa/asoundlib.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ALSA_DIR}/include/alsa/asoundlib.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${ALSA_DIR}/include/alsa/asoundlib.h: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${ALSA_DIR}/include/alsa/asoundlib.h" >&5
-echo $ECHO_N "checking for ${ALSA_DIR}/include/alsa/asoundlib.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  ALSA_HEADER_FOUND=1
-else
-  ALSA_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "xalsa/asoundlib.h" != "x" ; then
-            if test "${ac_cv_header_alsa_asoundlib_h+set}" = set; then
+      fi
+      ALSA_INCLUDE="${ALSA_INCLUDE} "
+      if test "xalsa/asoundlib.h" = "x" ; then # no header, assume found
+         ALSA_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${ALSA_INCLUDE} "
+        if test "${ac_cv_header_alsa_asoundlib_h+set}" = set; then
   { echo "$as_me:$LINENO: checking for alsa/asoundlib.h" >&5
 echo $ECHO_N "checking for alsa/asoundlib.h... $ECHO_C" >&6; }
 if test "${ac_cv_header_alsa_asoundlib_h+set}" = set; then
@@ -18222,7 +18088,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${ALSA_HEADER_FOUND}" = "x0" ; then
          ALSA_LIB=""
@@ -18251,6 +18117,7 @@ fi
 
 if test "x${PBX_CURSES}" != "x1" -a "${USE_CURSES}" != "no"; then
    pbxlibdir=""
+   # if --with-CURSES=DIR has been specified, use it.
    if test "x${CURSES_DIR}" != "x"; then
       if test -d ${CURSES_DIR}/lib; then
         pbxlibdir="-L${CURSES_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_CURSES_FOUND}" = "yes"; then
-      CURSES_LIB="-lcurses "
-      CURSES_HEADER_FOUND="1"
+      CURSES_LIB="${pbxlibdir} -lcurses "
+      # if --with-CURSES=DIR has been specified, use it.
       if test "x${CURSES_DIR}" != "x"; then
-         CURSES_LIB="${pbxlibdir} ${CURSES_LIB}"
         CURSES_INCLUDE="-I${CURSES_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${CURSES_DIR}/include"
-        if test "xcurses.h" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${CURSES_DIR}/include/curses.h" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${CURSES_DIR}/include/curses.h" >&5
-echo $ECHO_N "checking for ${CURSES_DIR}/include/curses.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${CURSES_DIR}/include/curses.h usability" >&5
-echo $ECHO_N "checking ${CURSES_DIR}/include/curses.h usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <${CURSES_DIR}/include/curses.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking ${CURSES_DIR}/include/curses.h presence" >&5
-echo $ECHO_N "checking ${CURSES_DIR}/include/curses.h presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${CURSES_DIR}/include/curses.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${CURSES_DIR}/include/curses.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${CURSES_DIR}/include/curses.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${CURSES_DIR}/include/curses.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${CURSES_DIR}/include/curses.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${CURSES_DIR}/include/curses.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${CURSES_DIR}/include/curses.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${CURSES_DIR}/include/curses.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${CURSES_DIR}/include/curses.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${CURSES_DIR}/include/curses.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${CURSES_DIR}/include/curses.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${CURSES_DIR}/include/curses.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${CURSES_DIR}/include/curses.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${CURSES_DIR}/include/curses.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${CURSES_DIR}/include/curses.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${CURSES_DIR}/include/curses.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${CURSES_DIR}/include/curses.h: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${CURSES_DIR}/include/curses.h" >&5
-echo $ECHO_N "checking for ${CURSES_DIR}/include/curses.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  CURSES_HEADER_FOUND=1
-else
-  CURSES_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "xcurses.h" != "x" ; then
-            if test "${ac_cv_header_curses_h+set}" = set; then
+      fi
+      CURSES_INCLUDE="${CURSES_INCLUDE} "
+      if test "xcurses.h" = "x" ; then # no header, assume found
+         CURSES_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${CURSES_INCLUDE} "
+        if test "${ac_cv_header_curses_h+set}" = set; then
   { echo "$as_me:$LINENO: checking for curses.h" >&5
 echo $ECHO_N "checking for curses.h... $ECHO_C" >&6; }
 if test "${ac_cv_header_curses_h+set}" = set; then
@@ -18613,7 +18345,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${CURSES_HEADER_FOUND}" = "x0" ; then
          CURSES_LIB=""
@@ -18643,6 +18375,7 @@ if test "x${host_os}" = "xlinux-gnu" ; then
 
 if test "x${PBX_CAP}" != "x1" -a "${USE_CAP}" != "no"; then
    pbxlibdir=""
+   # if --with-CAP=DIR has been specified, use it.
    if test "x${CAP_DIR}" != "x"; then
       if test -d ${CAP_DIR}/lib; then
         pbxlibdir="-L${CAP_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_CAP_FOUND}" = "yes"; then
-      CAP_LIB="-lcap "
-      CAP_HEADER_FOUND="1"
+      CAP_LIB="${pbxlibdir} -lcap "
+      # if --with-CAP=DIR has been specified, use it.
       if test "x${CAP_DIR}" != "x"; then
-         CAP_LIB="${pbxlibdir} ${CAP_LIB}"
         CAP_INCLUDE="-I${CAP_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${CAP_DIR}/include"
-        if test "xsys/capability.h" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${CAP_DIR}/include/sys/capability.h" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${CAP_DIR}/include/sys/capability.h" >&5
-echo $ECHO_N "checking for ${CAP_DIR}/include/sys/capability.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+      fi
+      CAP_INCLUDE="${CAP_INCLUDE} "
+      if test "xsys/capability.h" = "x" ; then # no header, assume found
+         CAP_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${CAP_INCLUDE} "
+        if test "${ac_cv_header_sys_capability_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for sys/capability.h" >&5
+echo $ECHO_N "checking for sys/capability.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_sys_capability_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_sys_capability_h" >&5
+echo "${ECHO_T}$ac_cv_header_sys_capability_h" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${CAP_DIR}/include/sys/capability.h usability" >&5
-echo $ECHO_N "checking ${CAP_DIR}/include/sys/capability.h usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking sys/capability.h usability" >&5
+echo $ECHO_N "checking sys/capability.h usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -18755,7 +18490,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <${CAP_DIR}/include/sys/capability.h>
+#include <sys/capability.h>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -18787,15 +18522,15 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking ${CAP_DIR}/include/sys/capability.h presence" >&5
-echo $ECHO_N "checking ${CAP_DIR}/include/sys/capability.h presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking sys/capability.h presence" >&5
+echo $ECHO_N "checking sys/capability.h presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <${CAP_DIR}/include/sys/capability.h>
+#include <sys/capability.h>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -18828,147 +18563,10 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${CAP_DIR}/include/sys/capability.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${CAP_DIR}/include/sys/capability.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${CAP_DIR}/include/sys/capability.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${CAP_DIR}/include/sys/capability.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${CAP_DIR}/include/sys/capability.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${CAP_DIR}/include/sys/capability.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${CAP_DIR}/include/sys/capability.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${CAP_DIR}/include/sys/capability.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${CAP_DIR}/include/sys/capability.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${CAP_DIR}/include/sys/capability.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${CAP_DIR}/include/sys/capability.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${CAP_DIR}/include/sys/capability.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${CAP_DIR}/include/sys/capability.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${CAP_DIR}/include/sys/capability.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${CAP_DIR}/include/sys/capability.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${CAP_DIR}/include/sys/capability.h: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${CAP_DIR}/include/sys/capability.h" >&5
-echo $ECHO_N "checking for ${CAP_DIR}/include/sys/capability.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  CAP_HEADER_FOUND=1
-else
-  CAP_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "xsys/capability.h" != "x" ; then
-            if test "${ac_cv_header_sys_capability_h+set}" = set; then
-  { echo "$as_me:$LINENO: checking for sys/capability.h" >&5
-echo $ECHO_N "checking for sys/capability.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_sys_capability_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_sys_capability_h" >&5
-echo "${ECHO_T}$ac_cv_header_sys_capability_h" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking sys/capability.h usability" >&5
-echo $ECHO_N "checking sys/capability.h usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <sys/capability.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking sys/capability.h presence" >&5
-echo $ECHO_N "checking sys/capability.h presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <sys/capability.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: sys/capability.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: sys/capability.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: sys/capability.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: sys/capability.h: proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: sys/capability.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: sys/capability.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: sys/capability.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: sys/capability.h: proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
@@ -19005,7 +18603,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${CAP_HEADER_FOUND}" = "x0" ; then
          CAP_LIB=""
@@ -19036,6 +18634,7 @@ fi
 
 if test "x${PBX_EXP2L}" != "x1" -a "${USE_EXP2L}" != "no"; then
    pbxlibdir=""
+   # if --with-EXP2L=DIR has been specified, use it.
    if test "x${EXP2L_DIR}" != "x"; then
       if test -d ${EXP2L_DIR}/lib; then
         pbxlibdir="-L${EXP2L_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_EXP2L_FOUND}" = "yes"; then
-      EXP2L_LIB="-lm "
-      EXP2L_HEADER_FOUND="1"
+      EXP2L_LIB="${pbxlibdir} -lm "
+      # if --with-EXP2L=DIR has been specified, use it.
       if test "x${EXP2L_DIR}" != "x"; then
-         EXP2L_LIB="${pbxlibdir} ${EXP2L_LIB}"
         EXP2L_INCLUDE="-I${EXP2L_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${EXP2L_DIR}/include"
-        if test "x" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${EXP2L_DIR}/include/" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${EXP2L_DIR}/include/" >&5
-echo $ECHO_N "checking for ${EXP2L_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${EXP2L_DIR}/include/ usability" >&5
-echo $ECHO_N "checking ${EXP2L_DIR}/include/ usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <${EXP2L_DIR}/include/>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking ${EXP2L_DIR}/include/ presence" >&5
-echo $ECHO_N "checking ${EXP2L_DIR}/include/ presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${EXP2L_DIR}/include/>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${EXP2L_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${EXP2L_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${EXP2L_DIR}/include/: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${EXP2L_DIR}/include/: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${EXP2L_DIR}/include/: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${EXP2L_DIR}/include/: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${EXP2L_DIR}/include/:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${EXP2L_DIR}/include/:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${EXP2L_DIR}/include/: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${EXP2L_DIR}/include/: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${EXP2L_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${EXP2L_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${EXP2L_DIR}/include/: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${EXP2L_DIR}/include/: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${EXP2L_DIR}/include/: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${EXP2L_DIR}/include/: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${EXP2L_DIR}/include/" >&5
-echo $ECHO_N "checking for ${EXP2L_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  EXP2L_HEADER_FOUND=1
-else
-  EXP2L_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "x" != "x" ; then
-            if test "${ac_cv_header_+set}" = set; then
+      fi
+      EXP2L_INCLUDE="${EXP2L_INCLUDE} "
+      if test "x" = "x" ; then # no header, assume found
+         EXP2L_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${EXP2L_INCLUDE} "
+        if test "${ac_cv_header_+set}" = set; then
   { echo "$as_me:$LINENO: checking for " >&5
 echo $ECHO_N "checking for ... $ECHO_C" >&6; }
 if test "${ac_cv_header_+set}" = set; then
@@ -19398,7 +18862,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${EXP2L_HEADER_FOUND}" = "x0" ; then
          EXP2L_LIB=""
@@ -19426,6 +18890,7 @@ fi
 
 if test "x${PBX_LOG2L}" != "x1" -a "${USE_LOG2L}" != "no"; then
    pbxlibdir=""
+   # if --with-LOG2L=DIR has been specified, use it.
    if test "x${LOG2L_DIR}" != "x"; then
       if test -d ${LOG2L_DIR}/lib; then
         pbxlibdir="-L${LOG2L_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_LOG2L_FOUND}" = "yes"; then
-      LOG2L_LIB="-lm "
-      LOG2L_HEADER_FOUND="1"
+      LOG2L_LIB="${pbxlibdir} -lm "
+      # if --with-LOG2L=DIR has been specified, use it.
       if test "x${LOG2L_DIR}" != "x"; then
-         LOG2L_LIB="${pbxlibdir} ${LOG2L_LIB}"
         LOG2L_INCLUDE="-I${LOG2L_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${LOG2L_DIR}/include"
-        if test "x" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${LOG2L_DIR}/include/" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${LOG2L_DIR}/include/" >&5
-echo $ECHO_N "checking for ${LOG2L_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+      fi
+      LOG2L_INCLUDE="${LOG2L_INCLUDE} "
+      if test "x" = "x" ; then # no header, assume found
+         LOG2L_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${LOG2L_INCLUDE} "
+        if test "${ac_cv_header_+set}" = set; then
+  { echo "$as_me:$LINENO: checking for " >&5
+echo $ECHO_N "checking for ... $ECHO_C" >&6; }
+if test "${ac_cv_header_+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
+echo "${ECHO_T}$ac_cv_header_" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${LOG2L_DIR}/include/ usability" >&5
-echo $ECHO_N "checking ${LOG2L_DIR}/include/ usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking  usability" >&5
+echo $ECHO_N "checking  usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -19538,7 +19005,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <${LOG2L_DIR}/include/>
+#include <>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -19570,15 +19037,15 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking ${LOG2L_DIR}/include/ presence" >&5
-echo $ECHO_N "checking ${LOG2L_DIR}/include/ presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking  presence" >&5
+echo $ECHO_N "checking  presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <${LOG2L_DIR}/include/>
+#include <>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -19611,147 +19078,10 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${LOG2L_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${LOG2L_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${LOG2L_DIR}/include/: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${LOG2L_DIR}/include/: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${LOG2L_DIR}/include/: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${LOG2L_DIR}/include/: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${LOG2L_DIR}/include/:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${LOG2L_DIR}/include/:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${LOG2L_DIR}/include/: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${LOG2L_DIR}/include/: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${LOG2L_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${LOG2L_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${LOG2L_DIR}/include/: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${LOG2L_DIR}/include/: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${LOG2L_DIR}/include/: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${LOG2L_DIR}/include/: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${LOG2L_DIR}/include/" >&5
-echo $ECHO_N "checking for ${LOG2L_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  LOG2L_HEADER_FOUND=1
-else
-  LOG2L_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "x" != "x" ; then
-            if test "${ac_cv_header_+set}" = set; then
-  { echo "$as_me:$LINENO: checking for " >&5
-echo $ECHO_N "checking for ... $ECHO_C" >&6; }
-if test "${ac_cv_header_+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
-echo "${ECHO_T}$ac_cv_header_" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking  usability" >&5
-echo $ECHO_N "checking  usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking  presence" >&5
-echo $ECHO_N "checking  presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: : proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: : proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: : proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: : proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
@@ -19788,7 +19118,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${LOG2L_HEADER_FOUND}" = "x0" ; then
          LOG2L_LIB=""
@@ -19816,6 +19146,7 @@ fi
 
 if test "x${PBX_EXP10L}" != "x1" -a "${USE_EXP10L}" != "no"; then
    pbxlibdir=""
+   # if --with-EXP10L=DIR has been specified, use it.
    if test "x${EXP10L_DIR}" != "x"; then
       if test -d ${EXP10L_DIR}/lib; then
         pbxlibdir="-L${EXP10L_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_EXP10L_FOUND}" = "yes"; then
-      EXP10L_LIB="-lm "
-      EXP10L_HEADER_FOUND="1"
+      EXP10L_LIB="${pbxlibdir} -lm "
+      # if --with-EXP10L=DIR has been specified, use it.
       if test "x${EXP10L_DIR}" != "x"; then
-         EXP10L_LIB="${pbxlibdir} ${EXP10L_LIB}"
         EXP10L_INCLUDE="-I${EXP10L_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${EXP10L_DIR}/include"
-        if test "x" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${EXP10L_DIR}/include/" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${EXP10L_DIR}/include/" >&5
-echo $ECHO_N "checking for ${EXP10L_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${EXP10L_DIR}/include/ usability" >&5
-echo $ECHO_N "checking ${EXP10L_DIR}/include/ usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <${EXP10L_DIR}/include/>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking ${EXP10L_DIR}/include/ presence" >&5
-echo $ECHO_N "checking ${EXP10L_DIR}/include/ presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${EXP10L_DIR}/include/>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${EXP10L_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${EXP10L_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${EXP10L_DIR}/include/: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${EXP10L_DIR}/include/: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${EXP10L_DIR}/include/: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${EXP10L_DIR}/include/: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${EXP10L_DIR}/include/:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${EXP10L_DIR}/include/:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${EXP10L_DIR}/include/: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${EXP10L_DIR}/include/: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${EXP10L_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${EXP10L_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${EXP10L_DIR}/include/: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${EXP10L_DIR}/include/: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${EXP10L_DIR}/include/: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${EXP10L_DIR}/include/: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${EXP10L_DIR}/include/" >&5
-echo $ECHO_N "checking for ${EXP10L_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  EXP10L_HEADER_FOUND=1
-else
-  EXP10L_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "x" != "x" ; then
-            if test "${ac_cv_header_+set}" = set; then
+      fi
+      EXP10L_INCLUDE="${EXP10L_INCLUDE} "
+      if test "x" = "x" ; then # no header, assume found
+         EXP10L_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${EXP10L_INCLUDE} "
+        if test "${ac_cv_header_+set}" = set; then
   { echo "$as_me:$LINENO: checking for " >&5
 echo $ECHO_N "checking for ... $ECHO_C" >&6; }
 if test "${ac_cv_header_+set}" = set; then
@@ -20178,7 +19374,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${EXP10L_HEADER_FOUND}" = "x0" ; then
          EXP10L_LIB=""
@@ -20206,6 +19402,7 @@ fi
 
 if test "x${PBX_LOG10L}" != "x1" -a "${USE_LOG10L}" != "no"; then
    pbxlibdir=""
+   # if --with-LOG10L=DIR has been specified, use it.
    if test "x${LOG10L_DIR}" != "x"; then
       if test -d ${LOG10L_DIR}/lib; then
         pbxlibdir="-L${LOG10L_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_LOG10L_FOUND}" = "yes"; then
-      LOG10L_LIB="-lm "
-      LOG10L_HEADER_FOUND="1"
+      LOG10L_LIB="${pbxlibdir} -lm "
+      # if --with-LOG10L=DIR has been specified, use it.
       if test "x${LOG10L_DIR}" != "x"; then
-         LOG10L_LIB="${pbxlibdir} ${LOG10L_LIB}"
         LOG10L_INCLUDE="-I${LOG10L_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${LOG10L_DIR}/include"
-        if test "x" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${LOG10L_DIR}/include/" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${LOG10L_DIR}/include/" >&5
-echo $ECHO_N "checking for ${LOG10L_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+      fi
+      LOG10L_INCLUDE="${LOG10L_INCLUDE} "
+      if test "x" = "x" ; then # no header, assume found
+         LOG10L_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${LOG10L_INCLUDE} "
+        if test "${ac_cv_header_+set}" = set; then
+  { echo "$as_me:$LINENO: checking for " >&5
+echo $ECHO_N "checking for ... $ECHO_C" >&6; }
+if test "${ac_cv_header_+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
+echo "${ECHO_T}$ac_cv_header_" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${LOG10L_DIR}/include/ usability" >&5
-echo $ECHO_N "checking ${LOG10L_DIR}/include/ usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking  usability" >&5
+echo $ECHO_N "checking  usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -20318,7 +19517,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <${LOG10L_DIR}/include/>
+#include <>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -20350,15 +19549,15 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking ${LOG10L_DIR}/include/ presence" >&5
-echo $ECHO_N "checking ${LOG10L_DIR}/include/ presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking  presence" >&5
+echo $ECHO_N "checking  presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <${LOG10L_DIR}/include/>
+#include <>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -20391,147 +19590,10 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${LOG10L_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${LOG10L_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${LOG10L_DIR}/include/: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${LOG10L_DIR}/include/: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${LOG10L_DIR}/include/: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${LOG10L_DIR}/include/: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${LOG10L_DIR}/include/:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${LOG10L_DIR}/include/:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${LOG10L_DIR}/include/: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${LOG10L_DIR}/include/: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${LOG10L_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${LOG10L_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${LOG10L_DIR}/include/: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${LOG10L_DIR}/include/: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${LOG10L_DIR}/include/: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${LOG10L_DIR}/include/: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${LOG10L_DIR}/include/" >&5
-echo $ECHO_N "checking for ${LOG10L_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  LOG10L_HEADER_FOUND=1
-else
-  LOG10L_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "x" != "x" ; then
-            if test "${ac_cv_header_+set}" = set; then
-  { echo "$as_me:$LINENO: checking for " >&5
-echo $ECHO_N "checking for ... $ECHO_C" >&6; }
-if test "${ac_cv_header_+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
-echo "${ECHO_T}$ac_cv_header_" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking  usability" >&5
-echo $ECHO_N "checking  usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking  presence" >&5
-echo $ECHO_N "checking  presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: : proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: : proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: : proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: : proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
@@ -20568,7 +19630,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${LOG10L_HEADER_FOUND}" = "x0" ; then
          LOG10L_LIB=""
@@ -20596,6 +19658,7 @@ fi
 
 if test "x${PBX_SINL}" != "x1" -a "${USE_SINL}" != "no"; then
    pbxlibdir=""
+   # if --with-SINL=DIR has been specified, use it.
    if test "x${SINL_DIR}" != "x"; then
       if test -d ${SINL_DIR}/lib; then
         pbxlibdir="-L${SINL_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_SINL_FOUND}" = "yes"; then
-      SINL_LIB="-lm "
-      SINL_HEADER_FOUND="1"
+      SINL_LIB="${pbxlibdir} -lm "
+      # if --with-SINL=DIR has been specified, use it.
       if test "x${SINL_DIR}" != "x"; then
-         SINL_LIB="${pbxlibdir} ${SINL_LIB}"
         SINL_INCLUDE="-I${SINL_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${SINL_DIR}/include"
-        if test "x" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${SINL_DIR}/include/" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${SINL_DIR}/include/" >&5
-echo $ECHO_N "checking for ${SINL_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${SINL_DIR}/include/ usability" >&5
-echo $ECHO_N "checking ${SINL_DIR}/include/ usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <${SINL_DIR}/include/>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking ${SINL_DIR}/include/ presence" >&5
-echo $ECHO_N "checking ${SINL_DIR}/include/ presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${SINL_DIR}/include/>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${SINL_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${SINL_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SINL_DIR}/include/: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${SINL_DIR}/include/: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${SINL_DIR}/include/: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${SINL_DIR}/include/: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SINL_DIR}/include/:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${SINL_DIR}/include/:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SINL_DIR}/include/: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${SINL_DIR}/include/: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SINL_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${SINL_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SINL_DIR}/include/: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${SINL_DIR}/include/: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SINL_DIR}/include/: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${SINL_DIR}/include/: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${SINL_DIR}/include/" >&5
-echo $ECHO_N "checking for ${SINL_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  SINL_HEADER_FOUND=1
-else
-  SINL_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "x" != "x" ; then
-            if test "${ac_cv_header_+set}" = set; then
+      fi
+      SINL_INCLUDE="${SINL_INCLUDE} "
+      if test "x" = "x" ; then # no header, assume found
+         SINL_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${SINL_INCLUDE} "
+        if test "${ac_cv_header_+set}" = set; then
   { echo "$as_me:$LINENO: checking for " >&5
 echo $ECHO_N "checking for ... $ECHO_C" >&6; }
 if test "${ac_cv_header_+set}" = set; then
@@ -20958,7 +19886,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${SINL_HEADER_FOUND}" = "x0" ; then
          SINL_LIB=""
@@ -20986,6 +19914,7 @@ fi
 
 if test "x${PBX_COSL}" != "x1" -a "${USE_COSL}" != "no"; then
    pbxlibdir=""
+   # if --with-COSL=DIR has been specified, use it.
    if test "x${COSL_DIR}" != "x"; then
       if test -d ${COSL_DIR}/lib; then
         pbxlibdir="-L${COSL_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_COSL_FOUND}" = "yes"; then
-      COSL_LIB="-lm "
-      COSL_HEADER_FOUND="1"
+      COSL_LIB="${pbxlibdir} -lm "
+      # if --with-COSL=DIR has been specified, use it.
       if test "x${COSL_DIR}" != "x"; then
-         COSL_LIB="${pbxlibdir} ${COSL_LIB}"
         COSL_INCLUDE="-I${COSL_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${COSL_DIR}/include"
-        if test "x" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${COSL_DIR}/include/" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${COSL_DIR}/include/" >&5
-echo $ECHO_N "checking for ${COSL_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+      fi
+      COSL_INCLUDE="${COSL_INCLUDE} "
+      if test "x" = "x" ; then # no header, assume found
+         COSL_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${COSL_INCLUDE} "
+        if test "${ac_cv_header_+set}" = set; then
+  { echo "$as_me:$LINENO: checking for " >&5
+echo $ECHO_N "checking for ... $ECHO_C" >&6; }
+if test "${ac_cv_header_+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
+echo "${ECHO_T}$ac_cv_header_" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${COSL_DIR}/include/ usability" >&5
-echo $ECHO_N "checking ${COSL_DIR}/include/ usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking  usability" >&5
+echo $ECHO_N "checking  usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -21098,7 +20029,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <${COSL_DIR}/include/>
+#include <>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -21130,15 +20061,15 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking ${COSL_DIR}/include/ presence" >&5
-echo $ECHO_N "checking ${COSL_DIR}/include/ presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking  presence" >&5
+echo $ECHO_N "checking  presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <${COSL_DIR}/include/>
+#include <>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -21171,147 +20102,10 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${COSL_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${COSL_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${COSL_DIR}/include/: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${COSL_DIR}/include/: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${COSL_DIR}/include/: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${COSL_DIR}/include/: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${COSL_DIR}/include/:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${COSL_DIR}/include/:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${COSL_DIR}/include/: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${COSL_DIR}/include/: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${COSL_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${COSL_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${COSL_DIR}/include/: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${COSL_DIR}/include/: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${COSL_DIR}/include/: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${COSL_DIR}/include/: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${COSL_DIR}/include/" >&5
-echo $ECHO_N "checking for ${COSL_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  COSL_HEADER_FOUND=1
-else
-  COSL_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "x" != "x" ; then
-            if test "${ac_cv_header_+set}" = set; then
-  { echo "$as_me:$LINENO: checking for " >&5
-echo $ECHO_N "checking for ... $ECHO_C" >&6; }
-if test "${ac_cv_header_+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
-echo "${ECHO_T}$ac_cv_header_" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking  usability" >&5
-echo $ECHO_N "checking  usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking  presence" >&5
-echo $ECHO_N "checking  presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: : proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: : proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: : proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: : proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
@@ -21348,7 +20142,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${COSL_HEADER_FOUND}" = "x0" ; then
          COSL_LIB=""
@@ -21376,6 +20170,7 @@ fi
 
 if test "x${PBX_TANL}" != "x1" -a "${USE_TANL}" != "no"; then
    pbxlibdir=""
+   # if --with-TANL=DIR has been specified, use it.
    if test "x${TANL_DIR}" != "x"; then
       if test -d ${TANL_DIR}/lib; then
         pbxlibdir="-L${TANL_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_TANL_FOUND}" = "yes"; then
-      TANL_LIB="-lm "
-      TANL_HEADER_FOUND="1"
+      TANL_LIB="${pbxlibdir} -lm "
+      # if --with-TANL=DIR has been specified, use it.
       if test "x${TANL_DIR}" != "x"; then
-         TANL_LIB="${pbxlibdir} ${TANL_LIB}"
         TANL_INCLUDE="-I${TANL_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${TANL_DIR}/include"
-        if test "x" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${TANL_DIR}/include/" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${TANL_DIR}/include/" >&5
-echo $ECHO_N "checking for ${TANL_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${TANL_DIR}/include/ usability" >&5
-echo $ECHO_N "checking ${TANL_DIR}/include/ usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <${TANL_DIR}/include/>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking ${TANL_DIR}/include/ presence" >&5
-echo $ECHO_N "checking ${TANL_DIR}/include/ presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${TANL_DIR}/include/>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${TANL_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${TANL_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TANL_DIR}/include/: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${TANL_DIR}/include/: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${TANL_DIR}/include/: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${TANL_DIR}/include/: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TANL_DIR}/include/:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${TANL_DIR}/include/:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TANL_DIR}/include/: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${TANL_DIR}/include/: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TANL_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${TANL_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TANL_DIR}/include/: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${TANL_DIR}/include/: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TANL_DIR}/include/: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${TANL_DIR}/include/: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${TANL_DIR}/include/" >&5
-echo $ECHO_N "checking for ${TANL_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  TANL_HEADER_FOUND=1
-else
-  TANL_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "x" != "x" ; then
-            if test "${ac_cv_header_+set}" = set; then
+      fi
+      TANL_INCLUDE="${TANL_INCLUDE} "
+      if test "x" = "x" ; then # no header, assume found
+         TANL_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${TANL_INCLUDE} "
+        if test "${ac_cv_header_+set}" = set; then
   { echo "$as_me:$LINENO: checking for " >&5
 echo $ECHO_N "checking for ... $ECHO_C" >&6; }
 if test "${ac_cv_header_+set}" = set; then
@@ -21738,7 +20398,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${TANL_HEADER_FOUND}" = "x0" ; then
          TANL_LIB=""
@@ -21766,6 +20426,7 @@ fi
 
 if test "x${PBX_ASINL}" != "x1" -a "${USE_ASINL}" != "no"; then
    pbxlibdir=""
+   # if --with-ASINL=DIR has been specified, use it.
    if test "x${ASINL_DIR}" != "x"; then
       if test -d ${ASINL_DIR}/lib; then
         pbxlibdir="-L${ASINL_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_ASINL_FOUND}" = "yes"; then
-      ASINL_LIB="-lm "
-      ASINL_HEADER_FOUND="1"
+      ASINL_LIB="${pbxlibdir} -lm "
+      # if --with-ASINL=DIR has been specified, use it.
       if test "x${ASINL_DIR}" != "x"; then
-         ASINL_LIB="${pbxlibdir} ${ASINL_LIB}"
         ASINL_INCLUDE="-I${ASINL_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${ASINL_DIR}/include"
-        if test "x" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${ASINL_DIR}/include/" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${ASINL_DIR}/include/" >&5
-echo $ECHO_N "checking for ${ASINL_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+      fi
+      ASINL_INCLUDE="${ASINL_INCLUDE} "
+      if test "x" = "x" ; then # no header, assume found
+         ASINL_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${ASINL_INCLUDE} "
+        if test "${ac_cv_header_+set}" = set; then
+  { echo "$as_me:$LINENO: checking for " >&5
+echo $ECHO_N "checking for ... $ECHO_C" >&6; }
+if test "${ac_cv_header_+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
+echo "${ECHO_T}$ac_cv_header_" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${ASINL_DIR}/include/ usability" >&5
-echo $ECHO_N "checking ${ASINL_DIR}/include/ usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking  usability" >&5
+echo $ECHO_N "checking  usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -21878,7 +20541,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <${ASINL_DIR}/include/>
+#include <>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -21910,152 +20573,15 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking ${ASINL_DIR}/include/ presence" >&5
-echo $ECHO_N "checking ${ASINL_DIR}/include/ presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking  presence" >&5
+echo $ECHO_N "checking  presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <${ASINL_DIR}/include/>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${ASINL_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${ASINL_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ASINL_DIR}/include/: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${ASINL_DIR}/include/: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${ASINL_DIR}/include/: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${ASINL_DIR}/include/: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ASINL_DIR}/include/:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${ASINL_DIR}/include/:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ASINL_DIR}/include/: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${ASINL_DIR}/include/: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ASINL_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${ASINL_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ASINL_DIR}/include/: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${ASINL_DIR}/include/: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ASINL_DIR}/include/: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${ASINL_DIR}/include/: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${ASINL_DIR}/include/" >&5
-echo $ECHO_N "checking for ${ASINL_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  ASINL_HEADER_FOUND=1
-else
-  ASINL_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "x" != "x" ; then
-            if test "${ac_cv_header_+set}" = set; then
-  { echo "$as_me:$LINENO: checking for " >&5
-echo $ECHO_N "checking for ... $ECHO_C" >&6; }
-if test "${ac_cv_header_+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
-echo "${ECHO_T}$ac_cv_header_" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking  usability" >&5
-echo $ECHO_N "checking  usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking  presence" >&5
-echo $ECHO_N "checking  presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <>
+#include <>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -22128,7 +20654,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${ASINL_HEADER_FOUND}" = "x0" ; then
          ASINL_LIB=""
@@ -22156,6 +20682,7 @@ fi
 
 if test "x${PBX_ACOSL}" != "x1" -a "${USE_ACOSL}" != "no"; then
    pbxlibdir=""
+   # if --with-ACOSL=DIR has been specified, use it.
    if test "x${ACOSL_DIR}" != "x"; then
       if test -d ${ACOSL_DIR}/lib; then
         pbxlibdir="-L${ACOSL_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_ACOSL_FOUND}" = "yes"; then
-      ACOSL_LIB="-lm "
-      ACOSL_HEADER_FOUND="1"
+      ACOSL_LIB="${pbxlibdir} -lm "
+      # if --with-ACOSL=DIR has been specified, use it.
       if test "x${ACOSL_DIR}" != "x"; then
-         ACOSL_LIB="${pbxlibdir} ${ACOSL_LIB}"
         ACOSL_INCLUDE="-I${ACOSL_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${ACOSL_DIR}/include"
-        if test "x" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${ACOSL_DIR}/include/" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${ACOSL_DIR}/include/" >&5
-echo $ECHO_N "checking for ${ACOSL_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${ACOSL_DIR}/include/ usability" >&5
-echo $ECHO_N "checking ${ACOSL_DIR}/include/ usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <${ACOSL_DIR}/include/>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking ${ACOSL_DIR}/include/ presence" >&5
-echo $ECHO_N "checking ${ACOSL_DIR}/include/ presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${ACOSL_DIR}/include/>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${ACOSL_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${ACOSL_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ACOSL_DIR}/include/: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${ACOSL_DIR}/include/: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${ACOSL_DIR}/include/: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${ACOSL_DIR}/include/: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ACOSL_DIR}/include/:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${ACOSL_DIR}/include/:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ACOSL_DIR}/include/: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${ACOSL_DIR}/include/: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ACOSL_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${ACOSL_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ACOSL_DIR}/include/: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${ACOSL_DIR}/include/: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ACOSL_DIR}/include/: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${ACOSL_DIR}/include/: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${ACOSL_DIR}/include/" >&5
-echo $ECHO_N "checking for ${ACOSL_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  ACOSL_HEADER_FOUND=1
-else
-  ACOSL_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "x" != "x" ; then
-            if test "${ac_cv_header_+set}" = set; then
+      fi
+      ACOSL_INCLUDE="${ACOSL_INCLUDE} "
+      if test "x" = "x" ; then # no header, assume found
+         ACOSL_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${ACOSL_INCLUDE} "
+        if test "${ac_cv_header_+set}" = set; then
   { echo "$as_me:$LINENO: checking for " >&5
 echo $ECHO_N "checking for ... $ECHO_C" >&6; }
 if test "${ac_cv_header_+set}" = set; then
@@ -22518,7 +20910,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${ACOSL_HEADER_FOUND}" = "x0" ; then
          ACOSL_LIB=""
@@ -22546,6 +20938,7 @@ fi
 
 if test "x${PBX_ATANL}" != "x1" -a "${USE_ATANL}" != "no"; then
    pbxlibdir=""
+   # if --with-ATANL=DIR has been specified, use it.
    if test "x${ATANL_DIR}" != "x"; then
       if test -d ${ATANL_DIR}/lib; then
         pbxlibdir="-L${ATANL_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_ATANL_FOUND}" = "yes"; then
-      ATANL_LIB="-lm "
-      ATANL_HEADER_FOUND="1"
+      ATANL_LIB="${pbxlibdir} -lm "
+      # if --with-ATANL=DIR has been specified, use it.
       if test "x${ATANL_DIR}" != "x"; then
-         ATANL_LIB="${pbxlibdir} ${ATANL_LIB}"
         ATANL_INCLUDE="-I${ATANL_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${ATANL_DIR}/include"
-        if test "x" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${ATANL_DIR}/include/" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${ATANL_DIR}/include/" >&5
-echo $ECHO_N "checking for ${ATANL_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+      fi
+      ATANL_INCLUDE="${ATANL_INCLUDE} "
+      if test "x" = "x" ; then # no header, assume found
+         ATANL_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${ATANL_INCLUDE} "
+        if test "${ac_cv_header_+set}" = set; then
+  { echo "$as_me:$LINENO: checking for " >&5
+echo $ECHO_N "checking for ... $ECHO_C" >&6; }
+if test "${ac_cv_header_+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
+echo "${ECHO_T}$ac_cv_header_" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${ATANL_DIR}/include/ usability" >&5
-echo $ECHO_N "checking ${ATANL_DIR}/include/ usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking  usability" >&5
+echo $ECHO_N "checking  usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -22658,7 +21053,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <${ATANL_DIR}/include/>
+#include <>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -22690,15 +21085,15 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking ${ATANL_DIR}/include/ presence" >&5
-echo $ECHO_N "checking ${ATANL_DIR}/include/ presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking  presence" >&5
+echo $ECHO_N "checking  presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <${ATANL_DIR}/include/>
+#include <>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -22731,147 +21126,10 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${ATANL_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${ATANL_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ATANL_DIR}/include/: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${ATANL_DIR}/include/: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${ATANL_DIR}/include/: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${ATANL_DIR}/include/: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ATANL_DIR}/include/:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${ATANL_DIR}/include/:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ATANL_DIR}/include/: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${ATANL_DIR}/include/: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ATANL_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${ATANL_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ATANL_DIR}/include/: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${ATANL_DIR}/include/: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ATANL_DIR}/include/: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${ATANL_DIR}/include/: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${ATANL_DIR}/include/" >&5
-echo $ECHO_N "checking for ${ATANL_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  ATANL_HEADER_FOUND=1
-else
-  ATANL_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "x" != "x" ; then
-            if test "${ac_cv_header_+set}" = set; then
-  { echo "$as_me:$LINENO: checking for " >&5
-echo $ECHO_N "checking for ... $ECHO_C" >&6; }
-if test "${ac_cv_header_+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
-echo "${ECHO_T}$ac_cv_header_" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking  usability" >&5
-echo $ECHO_N "checking  usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking  presence" >&5
-echo $ECHO_N "checking  presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: : proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: : proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: : proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: : proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
@@ -22908,7 +21166,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${ATANL_HEADER_FOUND}" = "x0" ; then
          ATANL_LIB=""
@@ -22936,6 +21194,7 @@ fi
 
 if test "x${PBX_ATAN2L}" != "x1" -a "${USE_ATAN2L}" != "no"; then
    pbxlibdir=""
+   # if --with-ATAN2L=DIR has been specified, use it.
    if test "x${ATAN2L_DIR}" != "x"; then
       if test -d ${ATAN2L_DIR}/lib; then
         pbxlibdir="-L${ATAN2L_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_ATAN2L_FOUND}" = "yes"; then
-      ATAN2L_LIB="-lm "
-      ATAN2L_HEADER_FOUND="1"
+      ATAN2L_LIB="${pbxlibdir} -lm "
+      # if --with-ATAN2L=DIR has been specified, use it.
       if test "x${ATAN2L_DIR}" != "x"; then
-         ATAN2L_LIB="${pbxlibdir} ${ATAN2L_LIB}"
         ATAN2L_INCLUDE="-I${ATAN2L_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${ATAN2L_DIR}/include"
-        if test "x" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${ATAN2L_DIR}/include/" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${ATAN2L_DIR}/include/" >&5
-echo $ECHO_N "checking for ${ATAN2L_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${ATAN2L_DIR}/include/ usability" >&5
-echo $ECHO_N "checking ${ATAN2L_DIR}/include/ usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <${ATAN2L_DIR}/include/>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking ${ATAN2L_DIR}/include/ presence" >&5
-echo $ECHO_N "checking ${ATAN2L_DIR}/include/ presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${ATAN2L_DIR}/include/>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${ATAN2L_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${ATAN2L_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ATAN2L_DIR}/include/: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${ATAN2L_DIR}/include/: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${ATAN2L_DIR}/include/: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${ATAN2L_DIR}/include/: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ATAN2L_DIR}/include/:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${ATAN2L_DIR}/include/:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ATAN2L_DIR}/include/: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${ATAN2L_DIR}/include/: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ATAN2L_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${ATAN2L_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ATAN2L_DIR}/include/: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${ATAN2L_DIR}/include/: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ATAN2L_DIR}/include/: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${ATAN2L_DIR}/include/: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${ATAN2L_DIR}/include/" >&5
-echo $ECHO_N "checking for ${ATAN2L_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  ATAN2L_HEADER_FOUND=1
-else
-  ATAN2L_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "x" != "x" ; then
-            if test "${ac_cv_header_+set}" = set; then
+      fi
+      ATAN2L_INCLUDE="${ATAN2L_INCLUDE} "
+      if test "x" = "x" ; then # no header, assume found
+         ATAN2L_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${ATAN2L_INCLUDE} "
+        if test "${ac_cv_header_+set}" = set; then
   { echo "$as_me:$LINENO: checking for " >&5
 echo $ECHO_N "checking for ... $ECHO_C" >&6; }
 if test "${ac_cv_header_+set}" = set; then
@@ -23298,7 +21422,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${ATAN2L_HEADER_FOUND}" = "x0" ; then
          ATAN2L_LIB=""
@@ -23326,6 +21450,7 @@ fi
 
 if test "x${PBX_POWL}" != "x1" -a "${USE_POWL}" != "no"; then
    pbxlibdir=""
+   # if --with-POWL=DIR has been specified, use it.
    if test "x${POWL_DIR}" != "x"; then
       if test -d ${POWL_DIR}/lib; then
         pbxlibdir="-L${POWL_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_POWL_FOUND}" = "yes"; then
-      POWL_LIB="-lm "
-      POWL_HEADER_FOUND="1"
+      POWL_LIB="${pbxlibdir} -lm "
+      # if --with-POWL=DIR has been specified, use it.
       if test "x${POWL_DIR}" != "x"; then
-         POWL_LIB="${pbxlibdir} ${POWL_LIB}"
         POWL_INCLUDE="-I${POWL_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${POWL_DIR}/include"
-        if test "x" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${POWL_DIR}/include/" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${POWL_DIR}/include/" >&5
-echo $ECHO_N "checking for ${POWL_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+      fi
+      POWL_INCLUDE="${POWL_INCLUDE} "
+      if test "x" = "x" ; then # no header, assume found
+         POWL_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${POWL_INCLUDE} "
+        if test "${ac_cv_header_+set}" = set; then
+  { echo "$as_me:$LINENO: checking for " >&5
+echo $ECHO_N "checking for ... $ECHO_C" >&6; }
+if test "${ac_cv_header_+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
+echo "${ECHO_T}$ac_cv_header_" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${POWL_DIR}/include/ usability" >&5
-echo $ECHO_N "checking ${POWL_DIR}/include/ usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking  usability" >&5
+echo $ECHO_N "checking  usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -23438,7 +21565,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <${POWL_DIR}/include/>
+#include <>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -23470,15 +21597,15 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking ${POWL_DIR}/include/ presence" >&5
-echo $ECHO_N "checking ${POWL_DIR}/include/ presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking  presence" >&5
+echo $ECHO_N "checking  presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <${POWL_DIR}/include/>
+#include <>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -23511,147 +21638,10 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${POWL_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${POWL_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${POWL_DIR}/include/: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${POWL_DIR}/include/: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${POWL_DIR}/include/: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${POWL_DIR}/include/: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${POWL_DIR}/include/:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${POWL_DIR}/include/:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${POWL_DIR}/include/: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${POWL_DIR}/include/: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${POWL_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${POWL_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${POWL_DIR}/include/: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${POWL_DIR}/include/: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${POWL_DIR}/include/: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${POWL_DIR}/include/: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${POWL_DIR}/include/" >&5
-echo $ECHO_N "checking for ${POWL_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  POWL_HEADER_FOUND=1
-else
-  POWL_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "x" != "x" ; then
-            if test "${ac_cv_header_+set}" = set; then
-  { echo "$as_me:$LINENO: checking for " >&5
-echo $ECHO_N "checking for ... $ECHO_C" >&6; }
-if test "${ac_cv_header_+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
-echo "${ECHO_T}$ac_cv_header_" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking  usability" >&5
-echo $ECHO_N "checking  usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking  presence" >&5
-echo $ECHO_N "checking  presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: : proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: : proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: : proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: : proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
@@ -23688,7 +21678,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${POWL_HEADER_FOUND}" = "x0" ; then
          POWL_LIB=""
@@ -23716,6 +21706,7 @@ fi
 
 if test "x${PBX_SQRTL}" != "x1" -a "${USE_SQRTL}" != "no"; then
    pbxlibdir=""
+   # if --with-SQRTL=DIR has been specified, use it.
    if test "x${SQRTL_DIR}" != "x"; then
       if test -d ${SQRTL_DIR}/lib; then
         pbxlibdir="-L${SQRTL_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_SQRTL_FOUND}" = "yes"; then
-      SQRTL_LIB="-lm "
-      SQRTL_HEADER_FOUND="1"
+      SQRTL_LIB="${pbxlibdir} -lm "
+      # if --with-SQRTL=DIR has been specified, use it.
       if test "x${SQRTL_DIR}" != "x"; then
-         SQRTL_LIB="${pbxlibdir} ${SQRTL_LIB}"
         SQRTL_INCLUDE="-I${SQRTL_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${SQRTL_DIR}/include"
-        if test "x" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${SQRTL_DIR}/include/" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${SQRTL_DIR}/include/" >&5
-echo $ECHO_N "checking for ${SQRTL_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${SQRTL_DIR}/include/ usability" >&5
-echo $ECHO_N "checking ${SQRTL_DIR}/include/ usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <${SQRTL_DIR}/include/>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking ${SQRTL_DIR}/include/ presence" >&5
-echo $ECHO_N "checking ${SQRTL_DIR}/include/ presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${SQRTL_DIR}/include/>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${SQRTL_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${SQRTL_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SQRTL_DIR}/include/: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${SQRTL_DIR}/include/: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${SQRTL_DIR}/include/: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${SQRTL_DIR}/include/: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SQRTL_DIR}/include/:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${SQRTL_DIR}/include/:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SQRTL_DIR}/include/: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${SQRTL_DIR}/include/: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SQRTL_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${SQRTL_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SQRTL_DIR}/include/: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${SQRTL_DIR}/include/: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SQRTL_DIR}/include/: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${SQRTL_DIR}/include/: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${SQRTL_DIR}/include/" >&5
-echo $ECHO_N "checking for ${SQRTL_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  SQRTL_HEADER_FOUND=1
-else
-  SQRTL_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "x" != "x" ; then
-            if test "${ac_cv_header_+set}" = set; then
+      fi
+      SQRTL_INCLUDE="${SQRTL_INCLUDE} "
+      if test "x" = "x" ; then # no header, assume found
+         SQRTL_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${SQRTL_INCLUDE} "
+        if test "${ac_cv_header_+set}" = set; then
   { echo "$as_me:$LINENO: checking for " >&5
 echo $ECHO_N "checking for ... $ECHO_C" >&6; }
 if test "${ac_cv_header_+set}" = set; then
@@ -24078,7 +21934,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${SQRTL_HEADER_FOUND}" = "x0" ; then
          SQRTL_LIB=""
@@ -24106,6 +21962,7 @@ fi
 
 if test "x${PBX_RINTL}" != "x1" -a "${USE_RINTL}" != "no"; then
    pbxlibdir=""
+   # if --with-RINTL=DIR has been specified, use it.
    if test "x${RINTL_DIR}" != "x"; then
       if test -d ${RINTL_DIR}/lib; then
         pbxlibdir="-L${RINTL_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_RINTL_FOUND}" = "yes"; then
-      RINTL_LIB="-lm "
-      RINTL_HEADER_FOUND="1"
+      RINTL_LIB="${pbxlibdir} -lm "
+      # if --with-RINTL=DIR has been specified, use it.
       if test "x${RINTL_DIR}" != "x"; then
-         RINTL_LIB="${pbxlibdir} ${RINTL_LIB}"
         RINTL_INCLUDE="-I${RINTL_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${RINTL_DIR}/include"
-        if test "x" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${RINTL_DIR}/include/" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${RINTL_DIR}/include/" >&5
-echo $ECHO_N "checking for ${RINTL_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+      fi
+      RINTL_INCLUDE="${RINTL_INCLUDE} "
+      if test "x" = "x" ; then # no header, assume found
+         RINTL_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${RINTL_INCLUDE} "
+        if test "${ac_cv_header_+set}" = set; then
+  { echo "$as_me:$LINENO: checking for " >&5
+echo $ECHO_N "checking for ... $ECHO_C" >&6; }
+if test "${ac_cv_header_+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
+echo "${ECHO_T}$ac_cv_header_" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${RINTL_DIR}/include/ usability" >&5
-echo $ECHO_N "checking ${RINTL_DIR}/include/ usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking  usability" >&5
+echo $ECHO_N "checking  usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -24218,7 +22077,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <${RINTL_DIR}/include/>
+#include <>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -24250,15 +22109,15 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking ${RINTL_DIR}/include/ presence" >&5
-echo $ECHO_N "checking ${RINTL_DIR}/include/ presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking  presence" >&5
+echo $ECHO_N "checking  presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <${RINTL_DIR}/include/>
+#include <>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -24291,147 +22150,10 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${RINTL_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${RINTL_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${RINTL_DIR}/include/: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${RINTL_DIR}/include/: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${RINTL_DIR}/include/: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${RINTL_DIR}/include/: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${RINTL_DIR}/include/:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${RINTL_DIR}/include/:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${RINTL_DIR}/include/: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${RINTL_DIR}/include/: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${RINTL_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${RINTL_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${RINTL_DIR}/include/: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${RINTL_DIR}/include/: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${RINTL_DIR}/include/: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${RINTL_DIR}/include/: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${RINTL_DIR}/include/" >&5
-echo $ECHO_N "checking for ${RINTL_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  RINTL_HEADER_FOUND=1
-else
-  RINTL_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "x" != "x" ; then
-            if test "${ac_cv_header_+set}" = set; then
-  { echo "$as_me:$LINENO: checking for " >&5
-echo $ECHO_N "checking for ... $ECHO_C" >&6; }
-if test "${ac_cv_header_+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
-echo "${ECHO_T}$ac_cv_header_" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking  usability" >&5
-echo $ECHO_N "checking  usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking  presence" >&5
-echo $ECHO_N "checking  presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: : proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: : proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: : proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: : proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
@@ -24468,7 +22190,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${RINTL_HEADER_FOUND}" = "x0" ; then
          RINTL_LIB=""
@@ -24496,6 +22218,7 @@ fi
 
 if test "x${PBX_EXPL}" != "x1" -a "${USE_EXPL}" != "no"; then
    pbxlibdir=""
+   # if --with-EXPL=DIR has been specified, use it.
    if test "x${EXPL_DIR}" != "x"; then
       if test -d ${EXPL_DIR}/lib; then
         pbxlibdir="-L${EXPL_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_EXPL_FOUND}" = "yes"; then
-      EXPL_LIB="-lm "
-      EXPL_HEADER_FOUND="1"
+      EXPL_LIB="${pbxlibdir} -lm "
+      # if --with-EXPL=DIR has been specified, use it.
       if test "x${EXPL_DIR}" != "x"; then
-         EXPL_LIB="${pbxlibdir} ${EXPL_LIB}"
         EXPL_INCLUDE="-I${EXPL_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${EXPL_DIR}/include"
-        if test "x" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${EXPL_DIR}/include/" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${EXPL_DIR}/include/" >&5
-echo $ECHO_N "checking for ${EXPL_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${EXPL_DIR}/include/ usability" >&5
-echo $ECHO_N "checking ${EXPL_DIR}/include/ usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <${EXPL_DIR}/include/>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking ${EXPL_DIR}/include/ presence" >&5
-echo $ECHO_N "checking ${EXPL_DIR}/include/ presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${EXPL_DIR}/include/>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${EXPL_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${EXPL_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${EXPL_DIR}/include/: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${EXPL_DIR}/include/: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${EXPL_DIR}/include/: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${EXPL_DIR}/include/: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${EXPL_DIR}/include/:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${EXPL_DIR}/include/:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${EXPL_DIR}/include/: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${EXPL_DIR}/include/: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${EXPL_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${EXPL_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${EXPL_DIR}/include/: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${EXPL_DIR}/include/: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${EXPL_DIR}/include/: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${EXPL_DIR}/include/: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${EXPL_DIR}/include/" >&5
-echo $ECHO_N "checking for ${EXPL_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  EXPL_HEADER_FOUND=1
-else
-  EXPL_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "x" != "x" ; then
-            if test "${ac_cv_header_+set}" = set; then
+      fi
+      EXPL_INCLUDE="${EXPL_INCLUDE} "
+      if test "x" = "x" ; then # no header, assume found
+         EXPL_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${EXPL_INCLUDE} "
+        if test "${ac_cv_header_+set}" = set; then
   { echo "$as_me:$LINENO: checking for " >&5
 echo $ECHO_N "checking for ... $ECHO_C" >&6; }
 if test "${ac_cv_header_+set}" = set; then
@@ -24858,7 +22446,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${EXPL_HEADER_FOUND}" = "x0" ; then
          EXPL_LIB=""
@@ -24886,6 +22474,7 @@ fi
 
 if test "x${PBX_LOGL}" != "x1" -a "${USE_LOGL}" != "no"; then
    pbxlibdir=""
+   # if --with-LOGL=DIR has been specified, use it.
    if test "x${LOGL_DIR}" != "x"; then
       if test -d ${LOGL_DIR}/lib; then
         pbxlibdir="-L${LOGL_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_LOGL_FOUND}" = "yes"; then
-      LOGL_LIB="-lm "
-      LOGL_HEADER_FOUND="1"
+      LOGL_LIB="${pbxlibdir} -lm "
+      # if --with-LOGL=DIR has been specified, use it.
       if test "x${LOGL_DIR}" != "x"; then
-         LOGL_LIB="${pbxlibdir} ${LOGL_LIB}"
         LOGL_INCLUDE="-I${LOGL_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${LOGL_DIR}/include"
-        if test "x" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${LOGL_DIR}/include/" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${LOGL_DIR}/include/" >&5
-echo $ECHO_N "checking for ${LOGL_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+      fi
+      LOGL_INCLUDE="${LOGL_INCLUDE} "
+      if test "x" = "x" ; then # no header, assume found
+         LOGL_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${LOGL_INCLUDE} "
+        if test "${ac_cv_header_+set}" = set; then
+  { echo "$as_me:$LINENO: checking for " >&5
+echo $ECHO_N "checking for ... $ECHO_C" >&6; }
+if test "${ac_cv_header_+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
+echo "${ECHO_T}$ac_cv_header_" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${LOGL_DIR}/include/ usability" >&5
-echo $ECHO_N "checking ${LOGL_DIR}/include/ usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking  usability" >&5
+echo $ECHO_N "checking  usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -24998,7 +22589,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <${LOGL_DIR}/include/>
+#include <>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -25030,152 +22621,15 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking ${LOGL_DIR}/include/ presence" >&5
-echo $ECHO_N "checking ${LOGL_DIR}/include/ presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking  presence" >&5
+echo $ECHO_N "checking  presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <${LOGL_DIR}/include/>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${LOGL_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${LOGL_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${LOGL_DIR}/include/: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${LOGL_DIR}/include/: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${LOGL_DIR}/include/: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${LOGL_DIR}/include/: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${LOGL_DIR}/include/:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${LOGL_DIR}/include/:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${LOGL_DIR}/include/: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${LOGL_DIR}/include/: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${LOGL_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${LOGL_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${LOGL_DIR}/include/: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${LOGL_DIR}/include/: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${LOGL_DIR}/include/: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${LOGL_DIR}/include/: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${LOGL_DIR}/include/" >&5
-echo $ECHO_N "checking for ${LOGL_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  LOGL_HEADER_FOUND=1
-else
-  LOGL_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "x" != "x" ; then
-            if test "${ac_cv_header_+set}" = set; then
-  { echo "$as_me:$LINENO: checking for " >&5
-echo $ECHO_N "checking for ... $ECHO_C" >&6; }
-if test "${ac_cv_header_+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
-echo "${ECHO_T}$ac_cv_header_" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking  usability" >&5
-echo $ECHO_N "checking  usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking  presence" >&5
-echo $ECHO_N "checking  presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <>
+#include <>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -25248,7 +22702,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${LOGL_HEADER_FOUND}" = "x0" ; then
          LOGL_LIB=""
@@ -25276,6 +22730,7 @@ fi
 
 if test "x${PBX_REMAINDERL}" != "x1" -a "${USE_REMAINDERL}" != "no"; then
    pbxlibdir=""
+   # if --with-REMAINDERL=DIR has been specified, use it.
    if test "x${REMAINDERL_DIR}" != "x"; then
       if test -d ${REMAINDERL_DIR}/lib; then
         pbxlibdir="-L${REMAINDERL_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_REMAINDERL_FOUND}" = "yes"; then
-      REMAINDERL_LIB="-lm "
-      REMAINDERL_HEADER_FOUND="1"
+      REMAINDERL_LIB="${pbxlibdir} -lm "
+      # if --with-REMAINDERL=DIR has been specified, use it.
       if test "x${REMAINDERL_DIR}" != "x"; then
-         REMAINDERL_LIB="${pbxlibdir} ${REMAINDERL_LIB}"
         REMAINDERL_INCLUDE="-I${REMAINDERL_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${REMAINDERL_DIR}/include"
-        if test "x" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${REMAINDERL_DIR}/include/" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${REMAINDERL_DIR}/include/" >&5
-echo $ECHO_N "checking for ${REMAINDERL_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${REMAINDERL_DIR}/include/ usability" >&5
-echo $ECHO_N "checking ${REMAINDERL_DIR}/include/ usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <${REMAINDERL_DIR}/include/>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking ${REMAINDERL_DIR}/include/ presence" >&5
-echo $ECHO_N "checking ${REMAINDERL_DIR}/include/ presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${REMAINDERL_DIR}/include/>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${REMAINDERL_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${REMAINDERL_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${REMAINDERL_DIR}/include/: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${REMAINDERL_DIR}/include/: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${REMAINDERL_DIR}/include/: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${REMAINDERL_DIR}/include/: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${REMAINDERL_DIR}/include/:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${REMAINDERL_DIR}/include/:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${REMAINDERL_DIR}/include/: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${REMAINDERL_DIR}/include/: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${REMAINDERL_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${REMAINDERL_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${REMAINDERL_DIR}/include/: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${REMAINDERL_DIR}/include/: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${REMAINDERL_DIR}/include/: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${REMAINDERL_DIR}/include/: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${REMAINDERL_DIR}/include/" >&5
-echo $ECHO_N "checking for ${REMAINDERL_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  REMAINDERL_HEADER_FOUND=1
-else
-  REMAINDERL_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "x" != "x" ; then
-            if test "${ac_cv_header_+set}" = set; then
+      fi
+      REMAINDERL_INCLUDE="${REMAINDERL_INCLUDE} "
+      if test "x" = "x" ; then # no header, assume found
+         REMAINDERL_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${REMAINDERL_INCLUDE} "
+        if test "${ac_cv_header_+set}" = set; then
   { echo "$as_me:$LINENO: checking for " >&5
 echo $ECHO_N "checking for ... $ECHO_C" >&6; }
 if test "${ac_cv_header_+set}" = set; then
@@ -25638,7 +22958,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${REMAINDERL_HEADER_FOUND}" = "x0" ; then
          REMAINDERL_LIB=""
@@ -25666,6 +22986,7 @@ fi
 
 if test "x${PBX_FMODL}" != "x1" -a "${USE_FMODL}" != "no"; then
    pbxlibdir=""
+   # if --with-FMODL=DIR has been specified, use it.
    if test "x${FMODL_DIR}" != "x"; then
       if test -d ${FMODL_DIR}/lib; then
         pbxlibdir="-L${FMODL_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_FMODL_FOUND}" = "yes"; then
-      FMODL_LIB="-lm "
-      FMODL_HEADER_FOUND="1"
+      FMODL_LIB="${pbxlibdir} -lm "
+      # if --with-FMODL=DIR has been specified, use it.
       if test "x${FMODL_DIR}" != "x"; then
-         FMODL_LIB="${pbxlibdir} ${FMODL_LIB}"
         FMODL_INCLUDE="-I${FMODL_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${FMODL_DIR}/include"
-        if test "x" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${FMODL_DIR}/include/" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${FMODL_DIR}/include/" >&5
-echo $ECHO_N "checking for ${FMODL_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+      fi
+      FMODL_INCLUDE="${FMODL_INCLUDE} "
+      if test "x" = "x" ; then # no header, assume found
+         FMODL_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${FMODL_INCLUDE} "
+        if test "${ac_cv_header_+set}" = set; then
+  { echo "$as_me:$LINENO: checking for " >&5
+echo $ECHO_N "checking for ... $ECHO_C" >&6; }
+if test "${ac_cv_header_+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
+echo "${ECHO_T}$ac_cv_header_" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${FMODL_DIR}/include/ usability" >&5
-echo $ECHO_N "checking ${FMODL_DIR}/include/ usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking  usability" >&5
+echo $ECHO_N "checking  usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -25778,7 +23101,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <${FMODL_DIR}/include/>
+#include <>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -25810,15 +23133,15 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking ${FMODL_DIR}/include/ presence" >&5
-echo $ECHO_N "checking ${FMODL_DIR}/include/ presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking  presence" >&5
+echo $ECHO_N "checking  presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <${FMODL_DIR}/include/>
+#include <>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -25851,147 +23174,10 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${FMODL_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${FMODL_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${FMODL_DIR}/include/: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${FMODL_DIR}/include/: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${FMODL_DIR}/include/: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${FMODL_DIR}/include/: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${FMODL_DIR}/include/:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${FMODL_DIR}/include/:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${FMODL_DIR}/include/: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${FMODL_DIR}/include/: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${FMODL_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${FMODL_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${FMODL_DIR}/include/: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${FMODL_DIR}/include/: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${FMODL_DIR}/include/: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${FMODL_DIR}/include/: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${FMODL_DIR}/include/" >&5
-echo $ECHO_N "checking for ${FMODL_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  FMODL_HEADER_FOUND=1
-else
-  FMODL_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "x" != "x" ; then
-            if test "${ac_cv_header_+set}" = set; then
-  { echo "$as_me:$LINENO: checking for " >&5
-echo $ECHO_N "checking for ... $ECHO_C" >&6; }
-if test "${ac_cv_header_+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
-echo "${ECHO_T}$ac_cv_header_" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking  usability" >&5
-echo $ECHO_N "checking  usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking  presence" >&5
-echo $ECHO_N "checking  presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: : proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: : proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: : proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: : proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
@@ -26028,7 +23214,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${FMODL_HEADER_FOUND}" = "x0" ; then
          FMODL_LIB=""
@@ -26056,6 +23242,7 @@ fi
 
 if test "x${PBX_ROUNDL}" != "x1" -a "${USE_ROUNDL}" != "no"; then
    pbxlibdir=""
+   # if --with-ROUNDL=DIR has been specified, use it.
    if test "x${ROUNDL_DIR}" != "x"; then
       if test -d ${ROUNDL_DIR}/lib; then
         pbxlibdir="-L${ROUNDL_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_ROUNDL_FOUND}" = "yes"; then
-      ROUNDL_LIB="-lm "
-      ROUNDL_HEADER_FOUND="1"
+      ROUNDL_LIB="${pbxlibdir} -lm "
+      # if --with-ROUNDL=DIR has been specified, use it.
       if test "x${ROUNDL_DIR}" != "x"; then
-         ROUNDL_LIB="${pbxlibdir} ${ROUNDL_LIB}"
         ROUNDL_INCLUDE="-I${ROUNDL_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${ROUNDL_DIR}/include"
-        if test "x" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${ROUNDL_DIR}/include/" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${ROUNDL_DIR}/include/" >&5
-echo $ECHO_N "checking for ${ROUNDL_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${ROUNDL_DIR}/include/ usability" >&5
-echo $ECHO_N "checking ${ROUNDL_DIR}/include/ usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <${ROUNDL_DIR}/include/>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking ${ROUNDL_DIR}/include/ presence" >&5
-echo $ECHO_N "checking ${ROUNDL_DIR}/include/ presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${ROUNDL_DIR}/include/>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${ROUNDL_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${ROUNDL_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ROUNDL_DIR}/include/: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${ROUNDL_DIR}/include/: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${ROUNDL_DIR}/include/: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${ROUNDL_DIR}/include/: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ROUNDL_DIR}/include/:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${ROUNDL_DIR}/include/:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ROUNDL_DIR}/include/: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${ROUNDL_DIR}/include/: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ROUNDL_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${ROUNDL_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ROUNDL_DIR}/include/: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${ROUNDL_DIR}/include/: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ROUNDL_DIR}/include/: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${ROUNDL_DIR}/include/: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${ROUNDL_DIR}/include/" >&5
-echo $ECHO_N "checking for ${ROUNDL_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  ROUNDL_HEADER_FOUND=1
-else
-  ROUNDL_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "x" != "x" ; then
-            if test "${ac_cv_header_+set}" = set; then
+      fi
+      ROUNDL_INCLUDE="${ROUNDL_INCLUDE} "
+      if test "x" = "x" ; then # no header, assume found
+         ROUNDL_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${ROUNDL_INCLUDE} "
+        if test "${ac_cv_header_+set}" = set; then
   { echo "$as_me:$LINENO: checking for " >&5
 echo $ECHO_N "checking for ... $ECHO_C" >&6; }
 if test "${ac_cv_header_+set}" = set; then
@@ -26418,7 +23470,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${ROUNDL_HEADER_FOUND}" = "x0" ; then
          ROUNDL_LIB=""
@@ -26446,6 +23498,7 @@ fi
 
 if test "x${PBX_TRUNCL}" != "x1" -a "${USE_TRUNCL}" != "no"; then
    pbxlibdir=""
+   # if --with-TRUNCL=DIR has been specified, use it.
    if test "x${TRUNCL_DIR}" != "x"; then
       if test -d ${TRUNCL_DIR}/lib; then
         pbxlibdir="-L${TRUNCL_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_TRUNCL_FOUND}" = "yes"; then
-      TRUNCL_LIB="-lm "
-      TRUNCL_HEADER_FOUND="1"
+      TRUNCL_LIB="${pbxlibdir} -lm "
+      # if --with-TRUNCL=DIR has been specified, use it.
       if test "x${TRUNCL_DIR}" != "x"; then
-         TRUNCL_LIB="${pbxlibdir} ${TRUNCL_LIB}"
         TRUNCL_INCLUDE="-I${TRUNCL_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${TRUNCL_DIR}/include"
-        if test "x" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${TRUNCL_DIR}/include/" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${TRUNCL_DIR}/include/" >&5
-echo $ECHO_N "checking for ${TRUNCL_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+      fi
+      TRUNCL_INCLUDE="${TRUNCL_INCLUDE} "
+      if test "x" = "x" ; then # no header, assume found
+         TRUNCL_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${TRUNCL_INCLUDE} "
+        if test "${ac_cv_header_+set}" = set; then
+  { echo "$as_me:$LINENO: checking for " >&5
+echo $ECHO_N "checking for ... $ECHO_C" >&6; }
+if test "${ac_cv_header_+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
+echo "${ECHO_T}$ac_cv_header_" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${TRUNCL_DIR}/include/ usability" >&5
-echo $ECHO_N "checking ${TRUNCL_DIR}/include/ usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking  usability" >&5
+echo $ECHO_N "checking  usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -26558,7 +23613,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <${TRUNCL_DIR}/include/>
+#include <>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -26590,15 +23645,15 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking ${TRUNCL_DIR}/include/ presence" >&5
-echo $ECHO_N "checking ${TRUNCL_DIR}/include/ presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking  presence" >&5
+echo $ECHO_N "checking  presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <${TRUNCL_DIR}/include/>
+#include <>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -26631,147 +23686,10 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${TRUNCL_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${TRUNCL_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TRUNCL_DIR}/include/: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${TRUNCL_DIR}/include/: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${TRUNCL_DIR}/include/: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${TRUNCL_DIR}/include/: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TRUNCL_DIR}/include/:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${TRUNCL_DIR}/include/:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TRUNCL_DIR}/include/: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${TRUNCL_DIR}/include/: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TRUNCL_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${TRUNCL_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TRUNCL_DIR}/include/: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${TRUNCL_DIR}/include/: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TRUNCL_DIR}/include/: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${TRUNCL_DIR}/include/: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${TRUNCL_DIR}/include/" >&5
-echo $ECHO_N "checking for ${TRUNCL_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  TRUNCL_HEADER_FOUND=1
-else
-  TRUNCL_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "x" != "x" ; then
-            if test "${ac_cv_header_+set}" = set; then
-  { echo "$as_me:$LINENO: checking for " >&5
-echo $ECHO_N "checking for ... $ECHO_C" >&6; }
-if test "${ac_cv_header_+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
-echo "${ECHO_T}$ac_cv_header_" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking  usability" >&5
-echo $ECHO_N "checking  usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking  presence" >&5
-echo $ECHO_N "checking  presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: : proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: : proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: : proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: : proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
@@ -26808,7 +23726,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${TRUNCL_HEADER_FOUND}" = "x0" ; then
          TRUNCL_LIB=""
@@ -26836,6 +23754,7 @@ fi
 
 if test "x${PBX_STRTOLD}" != "x1" -a "${USE_STRTOLD}" != "no"; then
    pbxlibdir=""
+   # if --with-STRTOLD=DIR has been specified, use it.
    if test "x${STRTOLD_DIR}" != "x"; then
       if test -d ${STRTOLD_DIR}/lib; then
         pbxlibdir="-L${STRTOLD_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_STRTOLD_FOUND}" = "yes"; then
-      STRTOLD_LIB="-lc "
-      STRTOLD_HEADER_FOUND="1"
+      STRTOLD_LIB="${pbxlibdir} -lc "
+      # if --with-STRTOLD=DIR has been specified, use it.
       if test "x${STRTOLD_DIR}" != "x"; then
-         STRTOLD_LIB="${pbxlibdir} ${STRTOLD_LIB}"
         STRTOLD_INCLUDE="-I${STRTOLD_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${STRTOLD_DIR}/include"
-        if test "xstdlib.h" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${STRTOLD_DIR}/include/stdlib.h" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${STRTOLD_DIR}/include/stdlib.h" >&5
-echo $ECHO_N "checking for ${STRTOLD_DIR}/include/stdlib.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${STRTOLD_DIR}/include/stdlib.h usability" >&5
-echo $ECHO_N "checking ${STRTOLD_DIR}/include/stdlib.h usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <${STRTOLD_DIR}/include/stdlib.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking ${STRTOLD_DIR}/include/stdlib.h presence" >&5
-echo $ECHO_N "checking ${STRTOLD_DIR}/include/stdlib.h presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${STRTOLD_DIR}/include/stdlib.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${STRTOLD_DIR}/include/stdlib.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${STRTOLD_DIR}/include/stdlib.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${STRTOLD_DIR}/include/stdlib.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${STRTOLD_DIR}/include/stdlib.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${STRTOLD_DIR}/include/stdlib.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${STRTOLD_DIR}/include/stdlib.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${STRTOLD_DIR}/include/stdlib.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${STRTOLD_DIR}/include/stdlib.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${STRTOLD_DIR}/include/stdlib.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${STRTOLD_DIR}/include/stdlib.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${STRTOLD_DIR}/include/stdlib.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${STRTOLD_DIR}/include/stdlib.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${STRTOLD_DIR}/include/stdlib.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${STRTOLD_DIR}/include/stdlib.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${STRTOLD_DIR}/include/stdlib.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${STRTOLD_DIR}/include/stdlib.h: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${STRTOLD_DIR}/include/stdlib.h" >&5
-echo $ECHO_N "checking for ${STRTOLD_DIR}/include/stdlib.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  STRTOLD_HEADER_FOUND=1
-else
-  STRTOLD_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "xstdlib.h" != "x" ; then
-            if test "${ac_cv_header_stdlib_h+set}" = set; then
+      fi
+      STRTOLD_INCLUDE="${STRTOLD_INCLUDE} "
+      if test "xstdlib.h" = "x" ; then # no header, assume found
+         STRTOLD_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${STRTOLD_INCLUDE} "
+        if test "${ac_cv_header_stdlib_h+set}" = set; then
   { echo "$as_me:$LINENO: checking for stdlib.h" >&5
 echo $ECHO_N "checking for stdlib.h... $ECHO_C" >&6; }
 if test "${ac_cv_header_stdlib_h+set}" = set; then
@@ -27198,7 +23982,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${STRTOLD_HEADER_FOUND}" = "x0" ; then
          STRTOLD_LIB=""
@@ -27226,6 +24010,7 @@ fi
 
 if test "x${PBX_FLOORL}" != "x1" -a "${USE_FLOORL}" != "no"; then
    pbxlibdir=""
+   # if --with-FLOORL=DIR has been specified, use it.
    if test "x${FLOORL_DIR}" != "x"; then
       if test -d ${FLOORL_DIR}/lib; then
         pbxlibdir="-L${FLOORL_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_FLOORL_FOUND}" = "yes"; then
-      FLOORL_LIB="-lm "
-      FLOORL_HEADER_FOUND="1"
+      FLOORL_LIB="${pbxlibdir} -lm "
+      # if --with-FLOORL=DIR has been specified, use it.
       if test "x${FLOORL_DIR}" != "x"; then
-         FLOORL_LIB="${pbxlibdir} ${FLOORL_LIB}"
         FLOORL_INCLUDE="-I${FLOORL_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${FLOORL_DIR}/include"
-        if test "x" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${FLOORL_DIR}/include/" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${FLOORL_DIR}/include/" >&5
-echo $ECHO_N "checking for ${FLOORL_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+      fi
+      FLOORL_INCLUDE="${FLOORL_INCLUDE} "
+      if test "x" = "x" ; then # no header, assume found
+         FLOORL_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${FLOORL_INCLUDE} "
+        if test "${ac_cv_header_+set}" = set; then
+  { echo "$as_me:$LINENO: checking for " >&5
+echo $ECHO_N "checking for ... $ECHO_C" >&6; }
+if test "${ac_cv_header_+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
+echo "${ECHO_T}$ac_cv_header_" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${FLOORL_DIR}/include/ usability" >&5
-echo $ECHO_N "checking ${FLOORL_DIR}/include/ usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking  usability" >&5
+echo $ECHO_N "checking  usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -27338,7 +24125,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <${FLOORL_DIR}/include/>
+#include <>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -27370,15 +24157,15 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking ${FLOORL_DIR}/include/ presence" >&5
-echo $ECHO_N "checking ${FLOORL_DIR}/include/ presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking  presence" >&5
+echo $ECHO_N "checking  presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <${FLOORL_DIR}/include/>
+#include <>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -27411,147 +24198,10 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${FLOORL_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${FLOORL_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${FLOORL_DIR}/include/: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${FLOORL_DIR}/include/: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${FLOORL_DIR}/include/: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${FLOORL_DIR}/include/: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${FLOORL_DIR}/include/:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${FLOORL_DIR}/include/:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${FLOORL_DIR}/include/: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${FLOORL_DIR}/include/: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${FLOORL_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${FLOORL_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${FLOORL_DIR}/include/: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${FLOORL_DIR}/include/: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${FLOORL_DIR}/include/: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${FLOORL_DIR}/include/: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${FLOORL_DIR}/include/" >&5
-echo $ECHO_N "checking for ${FLOORL_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  FLOORL_HEADER_FOUND=1
-else
-  FLOORL_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "x" != "x" ; then
-            if test "${ac_cv_header_+set}" = set; then
-  { echo "$as_me:$LINENO: checking for " >&5
-echo $ECHO_N "checking for ... $ECHO_C" >&6; }
-if test "${ac_cv_header_+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
-echo "${ECHO_T}$ac_cv_header_" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking  usability" >&5
-echo $ECHO_N "checking  usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking  presence" >&5
-echo $ECHO_N "checking  presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: : proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: : proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: : proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: : proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
@@ -27588,7 +24238,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${FLOORL_HEADER_FOUND}" = "x0" ; then
          FLOORL_LIB=""
@@ -27616,6 +24266,7 @@ fi
 
 if test "x${PBX_CEILL}" != "x1" -a "${USE_CEILL}" != "no"; then
    pbxlibdir=""
+   # if --with-CEILL=DIR has been specified, use it.
    if test "x${CEILL_DIR}" != "x"; then
       if test -d ${CEILL_DIR}/lib; then
         pbxlibdir="-L${CEILL_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_CEILL_FOUND}" = "yes"; then
-      CEILL_LIB="-lm "
-      CEILL_HEADER_FOUND="1"
+      CEILL_LIB="${pbxlibdir} -lm "
+      # if --with-CEILL=DIR has been specified, use it.
       if test "x${CEILL_DIR}" != "x"; then
-         CEILL_LIB="${pbxlibdir} ${CEILL_LIB}"
         CEILL_INCLUDE="-I${CEILL_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${CEILL_DIR}/include"
-        if test "x" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${CEILL_DIR}/include/" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${CEILL_DIR}/include/" >&5
-echo $ECHO_N "checking for ${CEILL_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${CEILL_DIR}/include/ usability" >&5
-echo $ECHO_N "checking ${CEILL_DIR}/include/ usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <${CEILL_DIR}/include/>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking ${CEILL_DIR}/include/ presence" >&5
-echo $ECHO_N "checking ${CEILL_DIR}/include/ presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${CEILL_DIR}/include/>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${CEILL_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${CEILL_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${CEILL_DIR}/include/: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${CEILL_DIR}/include/: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${CEILL_DIR}/include/: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${CEILL_DIR}/include/: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${CEILL_DIR}/include/:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${CEILL_DIR}/include/:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${CEILL_DIR}/include/: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${CEILL_DIR}/include/: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${CEILL_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${CEILL_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${CEILL_DIR}/include/: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${CEILL_DIR}/include/: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${CEILL_DIR}/include/: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${CEILL_DIR}/include/: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${CEILL_DIR}/include/" >&5
-echo $ECHO_N "checking for ${CEILL_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  CEILL_HEADER_FOUND=1
-else
-  CEILL_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "x" != "x" ; then
-            if test "${ac_cv_header_+set}" = set; then
+      fi
+      CEILL_INCLUDE="${CEILL_INCLUDE} "
+      if test "x" = "x" ; then # no header, assume found
+         CEILL_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${CEILL_INCLUDE} "
+        if test "${ac_cv_header_+set}" = set; then
   { echo "$as_me:$LINENO: checking for " >&5
 echo $ECHO_N "checking for ... $ECHO_C" >&6; }
 if test "${ac_cv_header_+set}" = set; then
@@ -27978,7 +24494,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${CEILL_HEADER_FOUND}" = "x0" ; then
          CEILL_LIB=""
@@ -28006,6 +24522,7 @@ fi
 
 if test "x${PBX_EXP2}" != "x1" -a "${USE_EXP2}" != "no"; then
    pbxlibdir=""
+   # if --with-EXP2=DIR has been specified, use it.
    if test "x${EXP2_DIR}" != "x"; then
       if test -d ${EXP2_DIR}/lib; then
         pbxlibdir="-L${EXP2_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_EXP2_FOUND}" = "yes"; then
-      EXP2_LIB="-lm "
-      EXP2_HEADER_FOUND="1"
+      EXP2_LIB="${pbxlibdir} -lm "
+      # if --with-EXP2=DIR has been specified, use it.
       if test "x${EXP2_DIR}" != "x"; then
-         EXP2_LIB="${pbxlibdir} ${EXP2_LIB}"
         EXP2_INCLUDE="-I${EXP2_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${EXP2_DIR}/include"
-        if test "x" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${EXP2_DIR}/include/" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${EXP2_DIR}/include/" >&5
-echo $ECHO_N "checking for ${EXP2_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+      fi
+      EXP2_INCLUDE="${EXP2_INCLUDE} "
+      if test "x" = "x" ; then # no header, assume found
+         EXP2_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${EXP2_INCLUDE} "
+        if test "${ac_cv_header_+set}" = set; then
+  { echo "$as_me:$LINENO: checking for " >&5
+echo $ECHO_N "checking for ... $ECHO_C" >&6; }
+if test "${ac_cv_header_+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
+echo "${ECHO_T}$ac_cv_header_" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${EXP2_DIR}/include/ usability" >&5
-echo $ECHO_N "checking ${EXP2_DIR}/include/ usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking  usability" >&5
+echo $ECHO_N "checking  usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -28118,7 +24637,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <${EXP2_DIR}/include/>
+#include <>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -28150,152 +24669,15 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking ${EXP2_DIR}/include/ presence" >&5
-echo $ECHO_N "checking ${EXP2_DIR}/include/ presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking  presence" >&5
+echo $ECHO_N "checking  presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <${EXP2_DIR}/include/>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${EXP2_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${EXP2_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${EXP2_DIR}/include/: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${EXP2_DIR}/include/: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${EXP2_DIR}/include/: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${EXP2_DIR}/include/: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${EXP2_DIR}/include/:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${EXP2_DIR}/include/:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${EXP2_DIR}/include/: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${EXP2_DIR}/include/: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${EXP2_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${EXP2_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${EXP2_DIR}/include/: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${EXP2_DIR}/include/: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${EXP2_DIR}/include/: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${EXP2_DIR}/include/: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${EXP2_DIR}/include/" >&5
-echo $ECHO_N "checking for ${EXP2_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  EXP2_HEADER_FOUND=1
-else
-  EXP2_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "x" != "x" ; then
-            if test "${ac_cv_header_+set}" = set; then
-  { echo "$as_me:$LINENO: checking for " >&5
-echo $ECHO_N "checking for ... $ECHO_C" >&6; }
-if test "${ac_cv_header_+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
-echo "${ECHO_T}$ac_cv_header_" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking  usability" >&5
-echo $ECHO_N "checking  usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking  presence" >&5
-echo $ECHO_N "checking  presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <>
+#include <>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -28368,7 +24750,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${EXP2_HEADER_FOUND}" = "x0" ; then
          EXP2_LIB=""
@@ -28396,6 +24778,7 @@ fi
 
 if test "x${PBX_LOG2}" != "x1" -a "${USE_LOG2}" != "no"; then
    pbxlibdir=""
+   # if --with-LOG2=DIR has been specified, use it.
    if test "x${LOG2_DIR}" != "x"; then
       if test -d ${LOG2_DIR}/lib; then
         pbxlibdir="-L${LOG2_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_LOG2_FOUND}" = "yes"; then
-      LOG2_LIB="-lm "
-      LOG2_HEADER_FOUND="1"
+      LOG2_LIB="${pbxlibdir} -lm "
+      # if --with-LOG2=DIR has been specified, use it.
       if test "x${LOG2_DIR}" != "x"; then
-         LOG2_LIB="${pbxlibdir} ${LOG2_LIB}"
         LOG2_INCLUDE="-I${LOG2_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${LOG2_DIR}/include"
-        if test "x" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${LOG2_DIR}/include/" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${LOG2_DIR}/include/" >&5
-echo $ECHO_N "checking for ${LOG2_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${LOG2_DIR}/include/ usability" >&5
-echo $ECHO_N "checking ${LOG2_DIR}/include/ usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <${LOG2_DIR}/include/>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking ${LOG2_DIR}/include/ presence" >&5
-echo $ECHO_N "checking ${LOG2_DIR}/include/ presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${LOG2_DIR}/include/>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${LOG2_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${LOG2_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${LOG2_DIR}/include/: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${LOG2_DIR}/include/: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${LOG2_DIR}/include/: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${LOG2_DIR}/include/: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${LOG2_DIR}/include/:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${LOG2_DIR}/include/:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${LOG2_DIR}/include/: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${LOG2_DIR}/include/: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${LOG2_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${LOG2_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${LOG2_DIR}/include/: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${LOG2_DIR}/include/: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${LOG2_DIR}/include/: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${LOG2_DIR}/include/: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${LOG2_DIR}/include/" >&5
-echo $ECHO_N "checking for ${LOG2_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  LOG2_HEADER_FOUND=1
-else
-  LOG2_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "x" != "x" ; then
-            if test "${ac_cv_header_+set}" = set; then
+      fi
+      LOG2_INCLUDE="${LOG2_INCLUDE} "
+      if test "x" = "x" ; then # no header, assume found
+         LOG2_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${LOG2_INCLUDE} "
+        if test "${ac_cv_header_+set}" = set; then
   { echo "$as_me:$LINENO: checking for " >&5
 echo $ECHO_N "checking for ... $ECHO_C" >&6; }
 if test "${ac_cv_header_+set}" = set; then
@@ -28758,7 +25006,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${LOG2_HEADER_FOUND}" = "x0" ; then
          LOG2_LIB=""
@@ -28786,6 +25034,7 @@ fi
 
 if test "x${PBX_EXP10}" != "x1" -a "${USE_EXP10}" != "no"; then
    pbxlibdir=""
+   # if --with-EXP10=DIR has been specified, use it.
    if test "x${EXP10_DIR}" != "x"; then
       if test -d ${EXP10_DIR}/lib; then
         pbxlibdir="-L${EXP10_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_EXP10_FOUND}" = "yes"; then
-      EXP10_LIB="-lm "
-      EXP10_HEADER_FOUND="1"
+      EXP10_LIB="${pbxlibdir} -lm "
+      # if --with-EXP10=DIR has been specified, use it.
       if test "x${EXP10_DIR}" != "x"; then
-         EXP10_LIB="${pbxlibdir} ${EXP10_LIB}"
         EXP10_INCLUDE="-I${EXP10_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${EXP10_DIR}/include"
-        if test "x" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${EXP10_DIR}/include/" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${EXP10_DIR}/include/" >&5
-echo $ECHO_N "checking for ${EXP10_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+      fi
+      EXP10_INCLUDE="${EXP10_INCLUDE} "
+      if test "x" = "x" ; then # no header, assume found
+         EXP10_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${EXP10_INCLUDE} "
+        if test "${ac_cv_header_+set}" = set; then
+  { echo "$as_me:$LINENO: checking for " >&5
+echo $ECHO_N "checking for ... $ECHO_C" >&6; }
+if test "${ac_cv_header_+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
+echo "${ECHO_T}$ac_cv_header_" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${EXP10_DIR}/include/ usability" >&5
-echo $ECHO_N "checking ${EXP10_DIR}/include/ usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking  usability" >&5
+echo $ECHO_N "checking  usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -28898,7 +25149,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <${EXP10_DIR}/include/>
+#include <>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -28930,15 +25181,15 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking ${EXP10_DIR}/include/ presence" >&5
-echo $ECHO_N "checking ${EXP10_DIR}/include/ presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking  presence" >&5
+echo $ECHO_N "checking  presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <${EXP10_DIR}/include/>
+#include <>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -28971,147 +25222,10 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${EXP10_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${EXP10_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${EXP10_DIR}/include/: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${EXP10_DIR}/include/: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${EXP10_DIR}/include/: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${EXP10_DIR}/include/: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${EXP10_DIR}/include/:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${EXP10_DIR}/include/:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${EXP10_DIR}/include/: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${EXP10_DIR}/include/: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${EXP10_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${EXP10_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${EXP10_DIR}/include/: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${EXP10_DIR}/include/: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${EXP10_DIR}/include/: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${EXP10_DIR}/include/: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${EXP10_DIR}/include/" >&5
-echo $ECHO_N "checking for ${EXP10_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  EXP10_HEADER_FOUND=1
-else
-  EXP10_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "x" != "x" ; then
-            if test "${ac_cv_header_+set}" = set; then
-  { echo "$as_me:$LINENO: checking for " >&5
-echo $ECHO_N "checking for ... $ECHO_C" >&6; }
-if test "${ac_cv_header_+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
-echo "${ECHO_T}$ac_cv_header_" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking  usability" >&5
-echo $ECHO_N "checking  usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking  presence" >&5
-echo $ECHO_N "checking  presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: : proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: : proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: : proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: : proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
@@ -29148,7 +25262,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${EXP10_HEADER_FOUND}" = "x0" ; then
          EXP10_LIB=""
@@ -29176,6 +25290,7 @@ fi
 
 if test "x${PBX_LOG10}" != "x1" -a "${USE_LOG10}" != "no"; then
    pbxlibdir=""
+   # if --with-LOG10=DIR has been specified, use it.
    if test "x${LOG10_DIR}" != "x"; then
       if test -d ${LOG10_DIR}/lib; then
         pbxlibdir="-L${LOG10_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_LOG10_FOUND}" = "yes"; then
-      LOG10_LIB="-lm "
-      LOG10_HEADER_FOUND="1"
+      LOG10_LIB="${pbxlibdir} -lm "
+      # if --with-LOG10=DIR has been specified, use it.
       if test "x${LOG10_DIR}" != "x"; then
-         LOG10_LIB="${pbxlibdir} ${LOG10_LIB}"
         LOG10_INCLUDE="-I${LOG10_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${LOG10_DIR}/include"
-        if test "x" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${LOG10_DIR}/include/" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${LOG10_DIR}/include/" >&5
-echo $ECHO_N "checking for ${LOG10_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${LOG10_DIR}/include/ usability" >&5
-echo $ECHO_N "checking ${LOG10_DIR}/include/ usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <${LOG10_DIR}/include/>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking ${LOG10_DIR}/include/ presence" >&5
-echo $ECHO_N "checking ${LOG10_DIR}/include/ presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${LOG10_DIR}/include/>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${LOG10_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${LOG10_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${LOG10_DIR}/include/: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${LOG10_DIR}/include/: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${LOG10_DIR}/include/: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${LOG10_DIR}/include/: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${LOG10_DIR}/include/:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${LOG10_DIR}/include/:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${LOG10_DIR}/include/: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${LOG10_DIR}/include/: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${LOG10_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${LOG10_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${LOG10_DIR}/include/: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${LOG10_DIR}/include/: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${LOG10_DIR}/include/: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${LOG10_DIR}/include/: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${LOG10_DIR}/include/" >&5
-echo $ECHO_N "checking for ${LOG10_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  LOG10_HEADER_FOUND=1
-else
-  LOG10_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "x" != "x" ; then
-            if test "${ac_cv_header_+set}" = set; then
+      fi
+      LOG10_INCLUDE="${LOG10_INCLUDE} "
+      if test "x" = "x" ; then # no header, assume found
+         LOG10_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${LOG10_INCLUDE} "
+        if test "${ac_cv_header_+set}" = set; then
   { echo "$as_me:$LINENO: checking for " >&5
 echo $ECHO_N "checking for ... $ECHO_C" >&6; }
 if test "${ac_cv_header_+set}" = set; then
@@ -29538,7 +25518,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${LOG10_HEADER_FOUND}" = "x0" ; then
          LOG10_LIB=""
@@ -29566,6 +25546,7 @@ fi
 
 if test "x${PBX_SIN}" != "x1" -a "${USE_SIN}" != "no"; then
    pbxlibdir=""
+   # if --with-SIN=DIR has been specified, use it.
    if test "x${SIN_DIR}" != "x"; then
       if test -d ${SIN_DIR}/lib; then
         pbxlibdir="-L${SIN_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_SIN_FOUND}" = "yes"; then
-      SIN_LIB="-lm "
-      SIN_HEADER_FOUND="1"
+      SIN_LIB="${pbxlibdir} -lm "
+      # if --with-SIN=DIR has been specified, use it.
       if test "x${SIN_DIR}" != "x"; then
-         SIN_LIB="${pbxlibdir} ${SIN_LIB}"
         SIN_INCLUDE="-I${SIN_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${SIN_DIR}/include"
-        if test "x" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${SIN_DIR}/include/" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${SIN_DIR}/include/" >&5
-echo $ECHO_N "checking for ${SIN_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+      fi
+      SIN_INCLUDE="${SIN_INCLUDE} "
+      if test "x" = "x" ; then # no header, assume found
+         SIN_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${SIN_INCLUDE} "
+        if test "${ac_cv_header_+set}" = set; then
+  { echo "$as_me:$LINENO: checking for " >&5
+echo $ECHO_N "checking for ... $ECHO_C" >&6; }
+if test "${ac_cv_header_+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
+echo "${ECHO_T}$ac_cv_header_" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${SIN_DIR}/include/ usability" >&5
-echo $ECHO_N "checking ${SIN_DIR}/include/ usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking  usability" >&5
+echo $ECHO_N "checking  usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -29678,7 +25661,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <${SIN_DIR}/include/>
+#include <>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -29710,15 +25693,15 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking ${SIN_DIR}/include/ presence" >&5
-echo $ECHO_N "checking ${SIN_DIR}/include/ presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking  presence" >&5
+echo $ECHO_N "checking  presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <${SIN_DIR}/include/>
+#include <>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -29751,147 +25734,10 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${SIN_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${SIN_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SIN_DIR}/include/: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${SIN_DIR}/include/: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${SIN_DIR}/include/: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${SIN_DIR}/include/: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SIN_DIR}/include/:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${SIN_DIR}/include/:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SIN_DIR}/include/: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${SIN_DIR}/include/: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SIN_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${SIN_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SIN_DIR}/include/: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${SIN_DIR}/include/: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SIN_DIR}/include/: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${SIN_DIR}/include/: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${SIN_DIR}/include/" >&5
-echo $ECHO_N "checking for ${SIN_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  SIN_HEADER_FOUND=1
-else
-  SIN_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "x" != "x" ; then
-            if test "${ac_cv_header_+set}" = set; then
-  { echo "$as_me:$LINENO: checking for " >&5
-echo $ECHO_N "checking for ... $ECHO_C" >&6; }
-if test "${ac_cv_header_+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
-echo "${ECHO_T}$ac_cv_header_" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking  usability" >&5
-echo $ECHO_N "checking  usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking  presence" >&5
-echo $ECHO_N "checking  presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: : proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: : proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: : proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: : proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
@@ -29928,7 +25774,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${SIN_HEADER_FOUND}" = "x0" ; then
          SIN_LIB=""
@@ -29956,6 +25802,7 @@ fi
 
 if test "x${PBX_COS}" != "x1" -a "${USE_COS}" != "no"; then
    pbxlibdir=""
+   # if --with-COS=DIR has been specified, use it.
    if test "x${COS_DIR}" != "x"; then
       if test -d ${COS_DIR}/lib; then
         pbxlibdir="-L${COS_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_COS_FOUND}" = "yes"; then
-      COS_LIB="-lm "
-      COS_HEADER_FOUND="1"
+      COS_LIB="${pbxlibdir} -lm "
+      # if --with-COS=DIR has been specified, use it.
       if test "x${COS_DIR}" != "x"; then
-         COS_LIB="${pbxlibdir} ${COS_LIB}"
         COS_INCLUDE="-I${COS_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${COS_DIR}/include"
-        if test "x" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${COS_DIR}/include/" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${COS_DIR}/include/" >&5
-echo $ECHO_N "checking for ${COS_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${COS_DIR}/include/ usability" >&5
-echo $ECHO_N "checking ${COS_DIR}/include/ usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <${COS_DIR}/include/>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking ${COS_DIR}/include/ presence" >&5
-echo $ECHO_N "checking ${COS_DIR}/include/ presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${COS_DIR}/include/>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${COS_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${COS_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${COS_DIR}/include/: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${COS_DIR}/include/: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${COS_DIR}/include/: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${COS_DIR}/include/: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${COS_DIR}/include/:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${COS_DIR}/include/:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${COS_DIR}/include/: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${COS_DIR}/include/: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${COS_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${COS_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${COS_DIR}/include/: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${COS_DIR}/include/: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${COS_DIR}/include/: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${COS_DIR}/include/: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${COS_DIR}/include/" >&5
-echo $ECHO_N "checking for ${COS_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  COS_HEADER_FOUND=1
-else
-  COS_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "x" != "x" ; then
-            if test "${ac_cv_header_+set}" = set; then
+      fi
+      COS_INCLUDE="${COS_INCLUDE} "
+      if test "x" = "x" ; then # no header, assume found
+         COS_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${COS_INCLUDE} "
+        if test "${ac_cv_header_+set}" = set; then
   { echo "$as_me:$LINENO: checking for " >&5
 echo $ECHO_N "checking for ... $ECHO_C" >&6; }
 if test "${ac_cv_header_+set}" = set; then
@@ -30318,7 +26030,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${COS_HEADER_FOUND}" = "x0" ; then
          COS_LIB=""
@@ -30346,6 +26058,7 @@ fi
 
 if test "x${PBX_TAN}" != "x1" -a "${USE_TAN}" != "no"; then
    pbxlibdir=""
+   # if --with-TAN=DIR has been specified, use it.
    if test "x${TAN_DIR}" != "x"; then
       if test -d ${TAN_DIR}/lib; then
         pbxlibdir="-L${TAN_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_TAN_FOUND}" = "yes"; then
-      TAN_LIB="-lm "
-      TAN_HEADER_FOUND="1"
+      TAN_LIB="${pbxlibdir} -lm "
+      # if --with-TAN=DIR has been specified, use it.
       if test "x${TAN_DIR}" != "x"; then
-         TAN_LIB="${pbxlibdir} ${TAN_LIB}"
         TAN_INCLUDE="-I${TAN_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${TAN_DIR}/include"
-        if test "x" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${TAN_DIR}/include/" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${TAN_DIR}/include/" >&5
-echo $ECHO_N "checking for ${TAN_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+      fi
+      TAN_INCLUDE="${TAN_INCLUDE} "
+      if test "x" = "x" ; then # no header, assume found
+         TAN_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${TAN_INCLUDE} "
+        if test "${ac_cv_header_+set}" = set; then
+  { echo "$as_me:$LINENO: checking for " >&5
+echo $ECHO_N "checking for ... $ECHO_C" >&6; }
+if test "${ac_cv_header_+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
+echo "${ECHO_T}$ac_cv_header_" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${TAN_DIR}/include/ usability" >&5
-echo $ECHO_N "checking ${TAN_DIR}/include/ usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking  usability" >&5
+echo $ECHO_N "checking  usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -30458,7 +26173,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <${TAN_DIR}/include/>
+#include <>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -30490,15 +26205,15 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking ${TAN_DIR}/include/ presence" >&5
-echo $ECHO_N "checking ${TAN_DIR}/include/ presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking  presence" >&5
+echo $ECHO_N "checking  presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <${TAN_DIR}/include/>
+#include <>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -30531,147 +26246,10 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${TAN_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${TAN_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TAN_DIR}/include/: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${TAN_DIR}/include/: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${TAN_DIR}/include/: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${TAN_DIR}/include/: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TAN_DIR}/include/:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${TAN_DIR}/include/:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TAN_DIR}/include/: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${TAN_DIR}/include/: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TAN_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${TAN_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TAN_DIR}/include/: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${TAN_DIR}/include/: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TAN_DIR}/include/: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${TAN_DIR}/include/: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${TAN_DIR}/include/" >&5
-echo $ECHO_N "checking for ${TAN_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  TAN_HEADER_FOUND=1
-else
-  TAN_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "x" != "x" ; then
-            if test "${ac_cv_header_+set}" = set; then
-  { echo "$as_me:$LINENO: checking for " >&5
-echo $ECHO_N "checking for ... $ECHO_C" >&6; }
-if test "${ac_cv_header_+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
-echo "${ECHO_T}$ac_cv_header_" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking  usability" >&5
-echo $ECHO_N "checking  usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking  presence" >&5
-echo $ECHO_N "checking  presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: : proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: : proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: : proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: : proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
@@ -30708,7 +26286,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${TAN_HEADER_FOUND}" = "x0" ; then
          TAN_LIB=""
@@ -30736,6 +26314,7 @@ fi
 
 if test "x${PBX_ASIN}" != "x1" -a "${USE_ASIN}" != "no"; then
    pbxlibdir=""
+   # if --with-ASIN=DIR has been specified, use it.
    if test "x${ASIN_DIR}" != "x"; then
       if test -d ${ASIN_DIR}/lib; then
         pbxlibdir="-L${ASIN_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_ASIN_FOUND}" = "yes"; then
-      ASIN_LIB="-lm "
-      ASIN_HEADER_FOUND="1"
+      ASIN_LIB="${pbxlibdir} -lm "
+      # if --with-ASIN=DIR has been specified, use it.
       if test "x${ASIN_DIR}" != "x"; then
-         ASIN_LIB="${pbxlibdir} ${ASIN_LIB}"
         ASIN_INCLUDE="-I${ASIN_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${ASIN_DIR}/include"
-        if test "x" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${ASIN_DIR}/include/" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${ASIN_DIR}/include/" >&5
-echo $ECHO_N "checking for ${ASIN_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${ASIN_DIR}/include/ usability" >&5
-echo $ECHO_N "checking ${ASIN_DIR}/include/ usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <${ASIN_DIR}/include/>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking ${ASIN_DIR}/include/ presence" >&5
-echo $ECHO_N "checking ${ASIN_DIR}/include/ presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${ASIN_DIR}/include/>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${ASIN_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${ASIN_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ASIN_DIR}/include/: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${ASIN_DIR}/include/: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${ASIN_DIR}/include/: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${ASIN_DIR}/include/: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ASIN_DIR}/include/:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${ASIN_DIR}/include/:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ASIN_DIR}/include/: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${ASIN_DIR}/include/: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ASIN_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${ASIN_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ASIN_DIR}/include/: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${ASIN_DIR}/include/: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ASIN_DIR}/include/: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${ASIN_DIR}/include/: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${ASIN_DIR}/include/" >&5
-echo $ECHO_N "checking for ${ASIN_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  ASIN_HEADER_FOUND=1
-else
-  ASIN_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "x" != "x" ; then
-            if test "${ac_cv_header_+set}" = set; then
+      fi
+      ASIN_INCLUDE="${ASIN_INCLUDE} "
+      if test "x" = "x" ; then # no header, assume found
+         ASIN_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${ASIN_INCLUDE} "
+        if test "${ac_cv_header_+set}" = set; then
   { echo "$as_me:$LINENO: checking for " >&5
 echo $ECHO_N "checking for ... $ECHO_C" >&6; }
 if test "${ac_cv_header_+set}" = set; then
@@ -31098,7 +26542,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${ASIN_HEADER_FOUND}" = "x0" ; then
          ASIN_LIB=""
@@ -31126,6 +26570,7 @@ fi
 
 if test "x${PBX_ACOS}" != "x1" -a "${USE_ACOS}" != "no"; then
    pbxlibdir=""
+   # if --with-ACOS=DIR has been specified, use it.
    if test "x${ACOS_DIR}" != "x"; then
       if test -d ${ACOS_DIR}/lib; then
         pbxlibdir="-L${ACOS_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_ACOS_FOUND}" = "yes"; then
-      ACOS_LIB="-lm "
-      ACOS_HEADER_FOUND="1"
+      ACOS_LIB="${pbxlibdir} -lm "
+      # if --with-ACOS=DIR has been specified, use it.
       if test "x${ACOS_DIR}" != "x"; then
-         ACOS_LIB="${pbxlibdir} ${ACOS_LIB}"
         ACOS_INCLUDE="-I${ACOS_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${ACOS_DIR}/include"
-        if test "x" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${ACOS_DIR}/include/" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${ACOS_DIR}/include/" >&5
-echo $ECHO_N "checking for ${ACOS_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+      fi
+      ACOS_INCLUDE="${ACOS_INCLUDE} "
+      if test "x" = "x" ; then # no header, assume found
+         ACOS_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${ACOS_INCLUDE} "
+        if test "${ac_cv_header_+set}" = set; then
+  { echo "$as_me:$LINENO: checking for " >&5
+echo $ECHO_N "checking for ... $ECHO_C" >&6; }
+if test "${ac_cv_header_+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
+echo "${ECHO_T}$ac_cv_header_" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${ACOS_DIR}/include/ usability" >&5
-echo $ECHO_N "checking ${ACOS_DIR}/include/ usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking  usability" >&5
+echo $ECHO_N "checking  usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -31238,7 +26685,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <${ACOS_DIR}/include/>
+#include <>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -31270,152 +26717,15 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking ${ACOS_DIR}/include/ presence" >&5
-echo $ECHO_N "checking ${ACOS_DIR}/include/ presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking  presence" >&5
+echo $ECHO_N "checking  presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <${ACOS_DIR}/include/>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${ACOS_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${ACOS_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ACOS_DIR}/include/: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${ACOS_DIR}/include/: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${ACOS_DIR}/include/: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${ACOS_DIR}/include/: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ACOS_DIR}/include/:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${ACOS_DIR}/include/:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ACOS_DIR}/include/: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${ACOS_DIR}/include/: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ACOS_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${ACOS_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ACOS_DIR}/include/: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${ACOS_DIR}/include/: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ACOS_DIR}/include/: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${ACOS_DIR}/include/: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${ACOS_DIR}/include/" >&5
-echo $ECHO_N "checking for ${ACOS_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  ACOS_HEADER_FOUND=1
-else
-  ACOS_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "x" != "x" ; then
-            if test "${ac_cv_header_+set}" = set; then
-  { echo "$as_me:$LINENO: checking for " >&5
-echo $ECHO_N "checking for ... $ECHO_C" >&6; }
-if test "${ac_cv_header_+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
-echo "${ECHO_T}$ac_cv_header_" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking  usability" >&5
-echo $ECHO_N "checking  usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking  presence" >&5
-echo $ECHO_N "checking  presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <>
+#include <>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -31488,7 +26798,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${ACOS_HEADER_FOUND}" = "x0" ; then
          ACOS_LIB=""
@@ -31516,6 +26826,7 @@ fi
 
 if test "x${PBX_ATAN}" != "x1" -a "${USE_ATAN}" != "no"; then
    pbxlibdir=""
+   # if --with-ATAN=DIR has been specified, use it.
    if test "x${ATAN_DIR}" != "x"; then
       if test -d ${ATAN_DIR}/lib; then
         pbxlibdir="-L${ATAN_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_ATAN_FOUND}" = "yes"; then
-      ATAN_LIB="-lm "
-      ATAN_HEADER_FOUND="1"
+      ATAN_LIB="${pbxlibdir} -lm "
+      # if --with-ATAN=DIR has been specified, use it.
       if test "x${ATAN_DIR}" != "x"; then
-         ATAN_LIB="${pbxlibdir} ${ATAN_LIB}"
         ATAN_INCLUDE="-I${ATAN_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${ATAN_DIR}/include"
-        if test "x" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${ATAN_DIR}/include/" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${ATAN_DIR}/include/" >&5
-echo $ECHO_N "checking for ${ATAN_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${ATAN_DIR}/include/ usability" >&5
-echo $ECHO_N "checking ${ATAN_DIR}/include/ usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <${ATAN_DIR}/include/>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking ${ATAN_DIR}/include/ presence" >&5
-echo $ECHO_N "checking ${ATAN_DIR}/include/ presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${ATAN_DIR}/include/>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${ATAN_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${ATAN_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ATAN_DIR}/include/: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${ATAN_DIR}/include/: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${ATAN_DIR}/include/: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${ATAN_DIR}/include/: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ATAN_DIR}/include/:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${ATAN_DIR}/include/:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ATAN_DIR}/include/: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${ATAN_DIR}/include/: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ATAN_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${ATAN_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ATAN_DIR}/include/: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${ATAN_DIR}/include/: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ATAN_DIR}/include/: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${ATAN_DIR}/include/: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${ATAN_DIR}/include/" >&5
-echo $ECHO_N "checking for ${ATAN_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  ATAN_HEADER_FOUND=1
-else
-  ATAN_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "x" != "x" ; then
-            if test "${ac_cv_header_+set}" = set; then
+      fi
+      ATAN_INCLUDE="${ATAN_INCLUDE} "
+      if test "x" = "x" ; then # no header, assume found
+         ATAN_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${ATAN_INCLUDE} "
+        if test "${ac_cv_header_+set}" = set; then
   { echo "$as_me:$LINENO: checking for " >&5
 echo $ECHO_N "checking for ... $ECHO_C" >&6; }
 if test "${ac_cv_header_+set}" = set; then
@@ -31878,7 +27054,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${ATAN_HEADER_FOUND}" = "x0" ; then
          ATAN_LIB=""
@@ -31906,6 +27082,7 @@ fi
 
 if test "x${PBX_ATAN2}" != "x1" -a "${USE_ATAN2}" != "no"; then
    pbxlibdir=""
+   # if --with-ATAN2=DIR has been specified, use it.
    if test "x${ATAN2_DIR}" != "x"; then
       if test -d ${ATAN2_DIR}/lib; then
         pbxlibdir="-L${ATAN2_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_ATAN2_FOUND}" = "yes"; then
-      ATAN2_LIB="-lm "
-      ATAN2_HEADER_FOUND="1"
+      ATAN2_LIB="${pbxlibdir} -lm "
+      # if --with-ATAN2=DIR has been specified, use it.
       if test "x${ATAN2_DIR}" != "x"; then
-         ATAN2_LIB="${pbxlibdir} ${ATAN2_LIB}"
         ATAN2_INCLUDE="-I${ATAN2_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${ATAN2_DIR}/include"
-        if test "x" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${ATAN2_DIR}/include/" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${ATAN2_DIR}/include/" >&5
-echo $ECHO_N "checking for ${ATAN2_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+      fi
+      ATAN2_INCLUDE="${ATAN2_INCLUDE} "
+      if test "x" = "x" ; then # no header, assume found
+         ATAN2_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${ATAN2_INCLUDE} "
+        if test "${ac_cv_header_+set}" = set; then
+  { echo "$as_me:$LINENO: checking for " >&5
+echo $ECHO_N "checking for ... $ECHO_C" >&6; }
+if test "${ac_cv_header_+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
+echo "${ECHO_T}$ac_cv_header_" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${ATAN2_DIR}/include/ usability" >&5
-echo $ECHO_N "checking ${ATAN2_DIR}/include/ usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking  usability" >&5
+echo $ECHO_N "checking  usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -32018,7 +27197,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <${ATAN2_DIR}/include/>
+#include <>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -32050,15 +27229,15 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking ${ATAN2_DIR}/include/ presence" >&5
-echo $ECHO_N "checking ${ATAN2_DIR}/include/ presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking  presence" >&5
+echo $ECHO_N "checking  presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <${ATAN2_DIR}/include/>
+#include <>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -32091,147 +27270,10 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${ATAN2_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${ATAN2_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ATAN2_DIR}/include/: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${ATAN2_DIR}/include/: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${ATAN2_DIR}/include/: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${ATAN2_DIR}/include/: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ATAN2_DIR}/include/:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${ATAN2_DIR}/include/:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ATAN2_DIR}/include/: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${ATAN2_DIR}/include/: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ATAN2_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${ATAN2_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ATAN2_DIR}/include/: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${ATAN2_DIR}/include/: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ATAN2_DIR}/include/: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${ATAN2_DIR}/include/: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${ATAN2_DIR}/include/" >&5
-echo $ECHO_N "checking for ${ATAN2_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  ATAN2_HEADER_FOUND=1
-else
-  ATAN2_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "x" != "x" ; then
-            if test "${ac_cv_header_+set}" = set; then
-  { echo "$as_me:$LINENO: checking for " >&5
-echo $ECHO_N "checking for ... $ECHO_C" >&6; }
-if test "${ac_cv_header_+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
-echo "${ECHO_T}$ac_cv_header_" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking  usability" >&5
-echo $ECHO_N "checking  usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking  presence" >&5
-echo $ECHO_N "checking  presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: : proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: : proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: : proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: : proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
@@ -32268,7 +27310,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${ATAN2_HEADER_FOUND}" = "x0" ; then
          ATAN2_LIB=""
@@ -32296,6 +27338,7 @@ fi
 
 if test "x${PBX_POW}" != "x1" -a "${USE_POW}" != "no"; then
    pbxlibdir=""
+   # if --with-POW=DIR has been specified, use it.
    if test "x${POW_DIR}" != "x"; then
       if test -d ${POW_DIR}/lib; then
         pbxlibdir="-L${POW_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_POW_FOUND}" = "yes"; then
-      POW_LIB="-lm "
-      POW_HEADER_FOUND="1"
+      POW_LIB="${pbxlibdir} -lm "
+      # if --with-POW=DIR has been specified, use it.
       if test "x${POW_DIR}" != "x"; then
-         POW_LIB="${pbxlibdir} ${POW_LIB}"
         POW_INCLUDE="-I${POW_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${POW_DIR}/include"
-        if test "x" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${POW_DIR}/include/" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${POW_DIR}/include/" >&5
-echo $ECHO_N "checking for ${POW_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${POW_DIR}/include/ usability" >&5
-echo $ECHO_N "checking ${POW_DIR}/include/ usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <${POW_DIR}/include/>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking ${POW_DIR}/include/ presence" >&5
-echo $ECHO_N "checking ${POW_DIR}/include/ presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${POW_DIR}/include/>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${POW_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${POW_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${POW_DIR}/include/: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${POW_DIR}/include/: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${POW_DIR}/include/: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${POW_DIR}/include/: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${POW_DIR}/include/:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${POW_DIR}/include/:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${POW_DIR}/include/: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${POW_DIR}/include/: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${POW_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${POW_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${POW_DIR}/include/: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${POW_DIR}/include/: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${POW_DIR}/include/: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${POW_DIR}/include/: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${POW_DIR}/include/" >&5
-echo $ECHO_N "checking for ${POW_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  POW_HEADER_FOUND=1
-else
-  POW_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "x" != "x" ; then
-            if test "${ac_cv_header_+set}" = set; then
+      fi
+      POW_INCLUDE="${POW_INCLUDE} "
+      if test "x" = "x" ; then # no header, assume found
+         POW_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${POW_INCLUDE} "
+        if test "${ac_cv_header_+set}" = set; then
   { echo "$as_me:$LINENO: checking for " >&5
 echo $ECHO_N "checking for ... $ECHO_C" >&6; }
 if test "${ac_cv_header_+set}" = set; then
@@ -32658,7 +27566,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${POW_HEADER_FOUND}" = "x0" ; then
          POW_LIB=""
@@ -32686,6 +27594,7 @@ fi
 
 if test "x${PBX_SQRT}" != "x1" -a "${USE_SQRT}" != "no"; then
    pbxlibdir=""
+   # if --with-SQRT=DIR has been specified, use it.
    if test "x${SQRT_DIR}" != "x"; then
       if test -d ${SQRT_DIR}/lib; then
         pbxlibdir="-L${SQRT_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_SQRT_FOUND}" = "yes"; then
-      SQRT_LIB="-lm "
-      SQRT_HEADER_FOUND="1"
+      SQRT_LIB="${pbxlibdir} -lm "
+      # if --with-SQRT=DIR has been specified, use it.
       if test "x${SQRT_DIR}" != "x"; then
-         SQRT_LIB="${pbxlibdir} ${SQRT_LIB}"
         SQRT_INCLUDE="-I${SQRT_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${SQRT_DIR}/include"
-        if test "x" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${SQRT_DIR}/include/" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${SQRT_DIR}/include/" >&5
-echo $ECHO_N "checking for ${SQRT_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+      fi
+      SQRT_INCLUDE="${SQRT_INCLUDE} "
+      if test "x" = "x" ; then # no header, assume found
+         SQRT_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${SQRT_INCLUDE} "
+        if test "${ac_cv_header_+set}" = set; then
+  { echo "$as_me:$LINENO: checking for " >&5
+echo $ECHO_N "checking for ... $ECHO_C" >&6; }
+if test "${ac_cv_header_+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
+echo "${ECHO_T}$ac_cv_header_" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${SQRT_DIR}/include/ usability" >&5
-echo $ECHO_N "checking ${SQRT_DIR}/include/ usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking  usability" >&5
+echo $ECHO_N "checking  usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -32798,7 +27709,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <${SQRT_DIR}/include/>
+#include <>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -32830,15 +27741,15 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking ${SQRT_DIR}/include/ presence" >&5
-echo $ECHO_N "checking ${SQRT_DIR}/include/ presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking  presence" >&5
+echo $ECHO_N "checking  presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <${SQRT_DIR}/include/>
+#include <>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -32871,147 +27782,10 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${SQRT_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${SQRT_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SQRT_DIR}/include/: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${SQRT_DIR}/include/: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${SQRT_DIR}/include/: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${SQRT_DIR}/include/: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SQRT_DIR}/include/:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${SQRT_DIR}/include/:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SQRT_DIR}/include/: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${SQRT_DIR}/include/: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SQRT_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${SQRT_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SQRT_DIR}/include/: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${SQRT_DIR}/include/: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SQRT_DIR}/include/: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${SQRT_DIR}/include/: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${SQRT_DIR}/include/" >&5
-echo $ECHO_N "checking for ${SQRT_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  SQRT_HEADER_FOUND=1
-else
-  SQRT_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "x" != "x" ; then
-            if test "${ac_cv_header_+set}" = set; then
-  { echo "$as_me:$LINENO: checking for " >&5
-echo $ECHO_N "checking for ... $ECHO_C" >&6; }
-if test "${ac_cv_header_+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
-echo "${ECHO_T}$ac_cv_header_" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking  usability" >&5
-echo $ECHO_N "checking  usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking  presence" >&5
-echo $ECHO_N "checking  presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: : proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: : proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: : proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: : proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
@@ -33048,7 +27822,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${SQRT_HEADER_FOUND}" = "x0" ; then
          SQRT_LIB=""
@@ -33076,6 +27850,7 @@ fi
 
 if test "x${PBX_RINT}" != "x1" -a "${USE_RINT}" != "no"; then
    pbxlibdir=""
+   # if --with-RINT=DIR has been specified, use it.
    if test "x${RINT_DIR}" != "x"; then
       if test -d ${RINT_DIR}/lib; then
         pbxlibdir="-L${RINT_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_RINT_FOUND}" = "yes"; then
-      RINT_LIB="-lm "
-      RINT_HEADER_FOUND="1"
+      RINT_LIB="${pbxlibdir} -lm "
+      # if --with-RINT=DIR has been specified, use it.
       if test "x${RINT_DIR}" != "x"; then
-         RINT_LIB="${pbxlibdir} ${RINT_LIB}"
         RINT_INCLUDE="-I${RINT_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${RINT_DIR}/include"
-        if test "x" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${RINT_DIR}/include/" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${RINT_DIR}/include/" >&5
-echo $ECHO_N "checking for ${RINT_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${RINT_DIR}/include/ usability" >&5
-echo $ECHO_N "checking ${RINT_DIR}/include/ usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <${RINT_DIR}/include/>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking ${RINT_DIR}/include/ presence" >&5
-echo $ECHO_N "checking ${RINT_DIR}/include/ presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${RINT_DIR}/include/>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${RINT_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${RINT_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${RINT_DIR}/include/: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${RINT_DIR}/include/: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${RINT_DIR}/include/: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${RINT_DIR}/include/: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${RINT_DIR}/include/:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${RINT_DIR}/include/:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${RINT_DIR}/include/: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${RINT_DIR}/include/: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${RINT_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${RINT_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${RINT_DIR}/include/: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${RINT_DIR}/include/: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${RINT_DIR}/include/: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${RINT_DIR}/include/: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${RINT_DIR}/include/" >&5
-echo $ECHO_N "checking for ${RINT_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  RINT_HEADER_FOUND=1
-else
-  RINT_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "x" != "x" ; then
-            if test "${ac_cv_header_+set}" = set; then
+      fi
+      RINT_INCLUDE="${RINT_INCLUDE} "
+      if test "x" = "x" ; then # no header, assume found
+         RINT_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${RINT_INCLUDE} "
+        if test "${ac_cv_header_+set}" = set; then
   { echo "$as_me:$LINENO: checking for " >&5
 echo $ECHO_N "checking for ... $ECHO_C" >&6; }
 if test "${ac_cv_header_+set}" = set; then
@@ -33438,7 +28078,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${RINT_HEADER_FOUND}" = "x0" ; then
          RINT_LIB=""
@@ -33466,6 +28106,7 @@ fi
 
 if test "x${PBX_EXP}" != "x1" -a "${USE_EXP}" != "no"; then
    pbxlibdir=""
+   # if --with-EXP=DIR has been specified, use it.
    if test "x${EXP_DIR}" != "x"; then
       if test -d ${EXP_DIR}/lib; then
         pbxlibdir="-L${EXP_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_EXP_FOUND}" = "yes"; then
-      EXP_LIB="-lm "
-      EXP_HEADER_FOUND="1"
+      EXP_LIB="${pbxlibdir} -lm "
+      # if --with-EXP=DIR has been specified, use it.
       if test "x${EXP_DIR}" != "x"; then
-         EXP_LIB="${pbxlibdir} ${EXP_LIB}"
         EXP_INCLUDE="-I${EXP_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${EXP_DIR}/include"
-        if test "x" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${EXP_DIR}/include/" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${EXP_DIR}/include/" >&5
-echo $ECHO_N "checking for ${EXP_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+      fi
+      EXP_INCLUDE="${EXP_INCLUDE} "
+      if test "x" = "x" ; then # no header, assume found
+         EXP_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${EXP_INCLUDE} "
+        if test "${ac_cv_header_+set}" = set; then
+  { echo "$as_me:$LINENO: checking for " >&5
+echo $ECHO_N "checking for ... $ECHO_C" >&6; }
+if test "${ac_cv_header_+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
+echo "${ECHO_T}$ac_cv_header_" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${EXP_DIR}/include/ usability" >&5
-echo $ECHO_N "checking ${EXP_DIR}/include/ usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking  usability" >&5
+echo $ECHO_N "checking  usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -33578,7 +28221,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <${EXP_DIR}/include/>
+#include <>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -33610,15 +28253,15 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking ${EXP_DIR}/include/ presence" >&5
-echo $ECHO_N "checking ${EXP_DIR}/include/ presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking  presence" >&5
+echo $ECHO_N "checking  presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <${EXP_DIR}/include/>
+#include <>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -33651,147 +28294,10 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${EXP_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${EXP_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${EXP_DIR}/include/: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${EXP_DIR}/include/: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${EXP_DIR}/include/: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${EXP_DIR}/include/: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${EXP_DIR}/include/:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${EXP_DIR}/include/:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${EXP_DIR}/include/: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${EXP_DIR}/include/: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${EXP_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${EXP_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${EXP_DIR}/include/: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${EXP_DIR}/include/: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${EXP_DIR}/include/: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${EXP_DIR}/include/: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${EXP_DIR}/include/" >&5
-echo $ECHO_N "checking for ${EXP_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  EXP_HEADER_FOUND=1
-else
-  EXP_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "x" != "x" ; then
-            if test "${ac_cv_header_+set}" = set; then
-  { echo "$as_me:$LINENO: checking for " >&5
-echo $ECHO_N "checking for ... $ECHO_C" >&6; }
-if test "${ac_cv_header_+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
-echo "${ECHO_T}$ac_cv_header_" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking  usability" >&5
-echo $ECHO_N "checking  usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking  presence" >&5
-echo $ECHO_N "checking  presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: : proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: : proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: : proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: : proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
@@ -33828,7 +28334,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${EXP_HEADER_FOUND}" = "x0" ; then
          EXP_LIB=""
@@ -33856,6 +28362,7 @@ fi
 
 if test "x${PBX_LOG}" != "x1" -a "${USE_LOG}" != "no"; then
    pbxlibdir=""
+   # if --with-LOG=DIR has been specified, use it.
    if test "x${LOG_DIR}" != "x"; then
       if test -d ${LOG_DIR}/lib; then
         pbxlibdir="-L${LOG_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_LOG_FOUND}" = "yes"; then
-      LOG_LIB="-lm "
-      LOG_HEADER_FOUND="1"
+      LOG_LIB="${pbxlibdir} -lm "
+      # if --with-LOG=DIR has been specified, use it.
       if test "x${LOG_DIR}" != "x"; then
-         LOG_LIB="${pbxlibdir} ${LOG_LIB}"
         LOG_INCLUDE="-I${LOG_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${LOG_DIR}/include"
-        if test "x" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${LOG_DIR}/include/" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${LOG_DIR}/include/" >&5
-echo $ECHO_N "checking for ${LOG_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${LOG_DIR}/include/ usability" >&5
-echo $ECHO_N "checking ${LOG_DIR}/include/ usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <${LOG_DIR}/include/>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking ${LOG_DIR}/include/ presence" >&5
-echo $ECHO_N "checking ${LOG_DIR}/include/ presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${LOG_DIR}/include/>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${LOG_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${LOG_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${LOG_DIR}/include/: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${LOG_DIR}/include/: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${LOG_DIR}/include/: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${LOG_DIR}/include/: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${LOG_DIR}/include/:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${LOG_DIR}/include/:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${LOG_DIR}/include/: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${LOG_DIR}/include/: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${LOG_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${LOG_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${LOG_DIR}/include/: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${LOG_DIR}/include/: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${LOG_DIR}/include/: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${LOG_DIR}/include/: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${LOG_DIR}/include/" >&5
-echo $ECHO_N "checking for ${LOG_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  LOG_HEADER_FOUND=1
-else
-  LOG_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "x" != "x" ; then
-            if test "${ac_cv_header_+set}" = set; then
+      fi
+      LOG_INCLUDE="${LOG_INCLUDE} "
+      if test "x" = "x" ; then # no header, assume found
+         LOG_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${LOG_INCLUDE} "
+        if test "${ac_cv_header_+set}" = set; then
   { echo "$as_me:$LINENO: checking for " >&5
 echo $ECHO_N "checking for ... $ECHO_C" >&6; }
 if test "${ac_cv_header_+set}" = set; then
@@ -34218,7 +28590,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${LOG_HEADER_FOUND}" = "x0" ; then
          LOG_LIB=""
@@ -34246,6 +28618,7 @@ fi
 
 if test "x${PBX_REMAINDER}" != "x1" -a "${USE_REMAINDER}" != "no"; then
    pbxlibdir=""
+   # if --with-REMAINDER=DIR has been specified, use it.
    if test "x${REMAINDER_DIR}" != "x"; then
       if test -d ${REMAINDER_DIR}/lib; then
         pbxlibdir="-L${REMAINDER_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_REMAINDER_FOUND}" = "yes"; then
-      REMAINDER_LIB="-lm "
-      REMAINDER_HEADER_FOUND="1"
+      REMAINDER_LIB="${pbxlibdir} -lm "
+      # if --with-REMAINDER=DIR has been specified, use it.
       if test "x${REMAINDER_DIR}" != "x"; then
-         REMAINDER_LIB="${pbxlibdir} ${REMAINDER_LIB}"
         REMAINDER_INCLUDE="-I${REMAINDER_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${REMAINDER_DIR}/include"
-        if test "x" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${REMAINDER_DIR}/include/" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${REMAINDER_DIR}/include/" >&5
-echo $ECHO_N "checking for ${REMAINDER_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+      fi
+      REMAINDER_INCLUDE="${REMAINDER_INCLUDE} "
+      if test "x" = "x" ; then # no header, assume found
+         REMAINDER_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${REMAINDER_INCLUDE} "
+        if test "${ac_cv_header_+set}" = set; then
+  { echo "$as_me:$LINENO: checking for " >&5
+echo $ECHO_N "checking for ... $ECHO_C" >&6; }
+if test "${ac_cv_header_+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
+echo "${ECHO_T}$ac_cv_header_" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${REMAINDER_DIR}/include/ usability" >&5
-echo $ECHO_N "checking ${REMAINDER_DIR}/include/ usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking  usability" >&5
+echo $ECHO_N "checking  usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -34358,7 +28733,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <${REMAINDER_DIR}/include/>
+#include <>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -34390,152 +28765,15 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking ${REMAINDER_DIR}/include/ presence" >&5
-echo $ECHO_N "checking ${REMAINDER_DIR}/include/ presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking  presence" >&5
+echo $ECHO_N "checking  presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <${REMAINDER_DIR}/include/>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${REMAINDER_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${REMAINDER_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${REMAINDER_DIR}/include/: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${REMAINDER_DIR}/include/: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${REMAINDER_DIR}/include/: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${REMAINDER_DIR}/include/: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${REMAINDER_DIR}/include/:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${REMAINDER_DIR}/include/:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${REMAINDER_DIR}/include/: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${REMAINDER_DIR}/include/: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${REMAINDER_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${REMAINDER_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${REMAINDER_DIR}/include/: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${REMAINDER_DIR}/include/: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${REMAINDER_DIR}/include/: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${REMAINDER_DIR}/include/: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${REMAINDER_DIR}/include/" >&5
-echo $ECHO_N "checking for ${REMAINDER_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  REMAINDER_HEADER_FOUND=1
-else
-  REMAINDER_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "x" != "x" ; then
-            if test "${ac_cv_header_+set}" = set; then
-  { echo "$as_me:$LINENO: checking for " >&5
-echo $ECHO_N "checking for ... $ECHO_C" >&6; }
-if test "${ac_cv_header_+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
-echo "${ECHO_T}$ac_cv_header_" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking  usability" >&5
-echo $ECHO_N "checking  usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking  presence" >&5
-echo $ECHO_N "checking  presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <>
+#include <>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -34608,7 +28846,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${REMAINDER_HEADER_FOUND}" = "x0" ; then
          REMAINDER_LIB=""
@@ -34636,6 +28874,7 @@ fi
 
 if test "x${PBX_FMOD}" != "x1" -a "${USE_FMOD}" != "no"; then
    pbxlibdir=""
+   # if --with-FMOD=DIR has been specified, use it.
    if test "x${FMOD_DIR}" != "x"; then
       if test -d ${FMOD_DIR}/lib; then
         pbxlibdir="-L${FMOD_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_FMOD_FOUND}" = "yes"; then
-      FMOD_LIB="-lm "
-      FMOD_HEADER_FOUND="1"
+      FMOD_LIB="${pbxlibdir} -lm "
+      # if --with-FMOD=DIR has been specified, use it.
       if test "x${FMOD_DIR}" != "x"; then
-         FMOD_LIB="${pbxlibdir} ${FMOD_LIB}"
         FMOD_INCLUDE="-I${FMOD_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${FMOD_DIR}/include"
-        if test "x" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${FMOD_DIR}/include/" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${FMOD_DIR}/include/" >&5
-echo $ECHO_N "checking for ${FMOD_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${FMOD_DIR}/include/ usability" >&5
-echo $ECHO_N "checking ${FMOD_DIR}/include/ usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <${FMOD_DIR}/include/>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking ${FMOD_DIR}/include/ presence" >&5
-echo $ECHO_N "checking ${FMOD_DIR}/include/ presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${FMOD_DIR}/include/>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${FMOD_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${FMOD_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${FMOD_DIR}/include/: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${FMOD_DIR}/include/: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${FMOD_DIR}/include/: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${FMOD_DIR}/include/: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${FMOD_DIR}/include/:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${FMOD_DIR}/include/:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${FMOD_DIR}/include/: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${FMOD_DIR}/include/: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${FMOD_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${FMOD_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${FMOD_DIR}/include/: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${FMOD_DIR}/include/: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${FMOD_DIR}/include/: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${FMOD_DIR}/include/: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${FMOD_DIR}/include/" >&5
-echo $ECHO_N "checking for ${FMOD_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  FMOD_HEADER_FOUND=1
-else
-  FMOD_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "x" != "x" ; then
-            if test "${ac_cv_header_+set}" = set; then
+      fi
+      FMOD_INCLUDE="${FMOD_INCLUDE} "
+      if test "x" = "x" ; then # no header, assume found
+         FMOD_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${FMOD_INCLUDE} "
+        if test "${ac_cv_header_+set}" = set; then
   { echo "$as_me:$LINENO: checking for " >&5
 echo $ECHO_N "checking for ... $ECHO_C" >&6; }
 if test "${ac_cv_header_+set}" = set; then
@@ -34998,7 +29102,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${FMOD_HEADER_FOUND}" = "x0" ; then
          FMOD_LIB=""
@@ -35026,6 +29130,7 @@ fi
 
 if test "x${PBX_ROUND}" != "x1" -a "${USE_ROUND}" != "no"; then
    pbxlibdir=""
+   # if --with-ROUND=DIR has been specified, use it.
    if test "x${ROUND_DIR}" != "x"; then
       if test -d ${ROUND_DIR}/lib; then
         pbxlibdir="-L${ROUND_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_ROUND_FOUND}" = "yes"; then
-      ROUND_LIB="-lm "
-      ROUND_HEADER_FOUND="1"
+      ROUND_LIB="${pbxlibdir} -lm "
+      # if --with-ROUND=DIR has been specified, use it.
       if test "x${ROUND_DIR}" != "x"; then
-         ROUND_LIB="${pbxlibdir} ${ROUND_LIB}"
         ROUND_INCLUDE="-I${ROUND_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${ROUND_DIR}/include"
-        if test "x" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${ROUND_DIR}/include/" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${ROUND_DIR}/include/" >&5
-echo $ECHO_N "checking for ${ROUND_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+      fi
+      ROUND_INCLUDE="${ROUND_INCLUDE} "
+      if test "x" = "x" ; then # no header, assume found
+         ROUND_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${ROUND_INCLUDE} "
+        if test "${ac_cv_header_+set}" = set; then
+  { echo "$as_me:$LINENO: checking for " >&5
+echo $ECHO_N "checking for ... $ECHO_C" >&6; }
+if test "${ac_cv_header_+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
+echo "${ECHO_T}$ac_cv_header_" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${ROUND_DIR}/include/ usability" >&5
-echo $ECHO_N "checking ${ROUND_DIR}/include/ usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking  usability" >&5
+echo $ECHO_N "checking  usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -35138,7 +29245,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <${ROUND_DIR}/include/>
+#include <>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -35170,15 +29277,15 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking ${ROUND_DIR}/include/ presence" >&5
-echo $ECHO_N "checking ${ROUND_DIR}/include/ presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking  presence" >&5
+echo $ECHO_N "checking  presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <${ROUND_DIR}/include/>
+#include <>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -35211,147 +29318,10 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${ROUND_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${ROUND_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ROUND_DIR}/include/: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${ROUND_DIR}/include/: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${ROUND_DIR}/include/: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${ROUND_DIR}/include/: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ROUND_DIR}/include/:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${ROUND_DIR}/include/:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ROUND_DIR}/include/: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${ROUND_DIR}/include/: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ROUND_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${ROUND_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ROUND_DIR}/include/: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${ROUND_DIR}/include/: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ROUND_DIR}/include/: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${ROUND_DIR}/include/: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${ROUND_DIR}/include/" >&5
-echo $ECHO_N "checking for ${ROUND_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  ROUND_HEADER_FOUND=1
-else
-  ROUND_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "x" != "x" ; then
-            if test "${ac_cv_header_+set}" = set; then
-  { echo "$as_me:$LINENO: checking for " >&5
-echo $ECHO_N "checking for ... $ECHO_C" >&6; }
-if test "${ac_cv_header_+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
-echo "${ECHO_T}$ac_cv_header_" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking  usability" >&5
-echo $ECHO_N "checking  usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking  presence" >&5
-echo $ECHO_N "checking  presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: : proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: : proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: : proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: : proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
@@ -35388,7 +29358,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${ROUND_HEADER_FOUND}" = "x0" ; then
          ROUND_LIB=""
@@ -35416,6 +29386,7 @@ fi
 
 if test "x${PBX_TRUNC}" != "x1" -a "${USE_TRUNC}" != "no"; then
    pbxlibdir=""
+   # if --with-TRUNC=DIR has been specified, use it.
    if test "x${TRUNC_DIR}" != "x"; then
       if test -d ${TRUNC_DIR}/lib; then
         pbxlibdir="-L${TRUNC_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_TRUNC_FOUND}" = "yes"; then
-      TRUNC_LIB="-lm "
-      TRUNC_HEADER_FOUND="1"
+      TRUNC_LIB="${pbxlibdir} -lm "
+      # if --with-TRUNC=DIR has been specified, use it.
       if test "x${TRUNC_DIR}" != "x"; then
-         TRUNC_LIB="${pbxlibdir} ${TRUNC_LIB}"
         TRUNC_INCLUDE="-I${TRUNC_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${TRUNC_DIR}/include"
-        if test "x" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${TRUNC_DIR}/include/" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${TRUNC_DIR}/include/" >&5
-echo $ECHO_N "checking for ${TRUNC_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${TRUNC_DIR}/include/ usability" >&5
-echo $ECHO_N "checking ${TRUNC_DIR}/include/ usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <${TRUNC_DIR}/include/>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking ${TRUNC_DIR}/include/ presence" >&5
-echo $ECHO_N "checking ${TRUNC_DIR}/include/ presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${TRUNC_DIR}/include/>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${TRUNC_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${TRUNC_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TRUNC_DIR}/include/: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${TRUNC_DIR}/include/: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${TRUNC_DIR}/include/: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${TRUNC_DIR}/include/: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TRUNC_DIR}/include/:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${TRUNC_DIR}/include/:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TRUNC_DIR}/include/: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${TRUNC_DIR}/include/: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TRUNC_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${TRUNC_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TRUNC_DIR}/include/: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${TRUNC_DIR}/include/: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TRUNC_DIR}/include/: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${TRUNC_DIR}/include/: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${TRUNC_DIR}/include/" >&5
-echo $ECHO_N "checking for ${TRUNC_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  TRUNC_HEADER_FOUND=1
-else
-  TRUNC_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "x" != "x" ; then
-            if test "${ac_cv_header_+set}" = set; then
+      fi
+      TRUNC_INCLUDE="${TRUNC_INCLUDE} "
+      if test "x" = "x" ; then # no header, assume found
+         TRUNC_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${TRUNC_INCLUDE} "
+        if test "${ac_cv_header_+set}" = set; then
   { echo "$as_me:$LINENO: checking for " >&5
 echo $ECHO_N "checking for ... $ECHO_C" >&6; }
 if test "${ac_cv_header_+set}" = set; then
@@ -35778,7 +29614,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${TRUNC_HEADER_FOUND}" = "x0" ; then
          TRUNC_LIB=""
@@ -35806,6 +29642,7 @@ fi
 
 if test "x${PBX_STRTOD}" != "x1" -a "${USE_STRTOD}" != "no"; then
    pbxlibdir=""
+   # if --with-STRTOD=DIR has been specified, use it.
    if test "x${STRTOD_DIR}" != "x"; then
       if test -d ${STRTOD_DIR}/lib; then
         pbxlibdir="-L${STRTOD_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_STRTOD_FOUND}" = "yes"; then
-      STRTOD_LIB="-lc "
-      STRTOD_HEADER_FOUND="1"
+      STRTOD_LIB="${pbxlibdir} -lc "
+      # if --with-STRTOD=DIR has been specified, use it.
       if test "x${STRTOD_DIR}" != "x"; then
-         STRTOD_LIB="${pbxlibdir} ${STRTOD_LIB}"
         STRTOD_INCLUDE="-I${STRTOD_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${STRTOD_DIR}/include"
-        if test "xstdlib.h" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${STRTOD_DIR}/include/stdlib.h" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${STRTOD_DIR}/include/stdlib.h" >&5
-echo $ECHO_N "checking for ${STRTOD_DIR}/include/stdlib.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+      fi
+      STRTOD_INCLUDE="${STRTOD_INCLUDE} "
+      if test "xstdlib.h" = "x" ; then # no header, assume found
+         STRTOD_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${STRTOD_INCLUDE} "
+        if test "${ac_cv_header_stdlib_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for stdlib.h" >&5
+echo $ECHO_N "checking for stdlib.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_stdlib_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_stdlib_h" >&5
+echo "${ECHO_T}$ac_cv_header_stdlib_h" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${STRTOD_DIR}/include/stdlib.h usability" >&5
-echo $ECHO_N "checking ${STRTOD_DIR}/include/stdlib.h usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking stdlib.h usability" >&5
+echo $ECHO_N "checking stdlib.h usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -35918,7 +29757,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <${STRTOD_DIR}/include/stdlib.h>
+#include <stdlib.h>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -35950,15 +29789,15 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking ${STRTOD_DIR}/include/stdlib.h presence" >&5
-echo $ECHO_N "checking ${STRTOD_DIR}/include/stdlib.h presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking stdlib.h presence" >&5
+echo $ECHO_N "checking stdlib.h presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <${STRTOD_DIR}/include/stdlib.h>
+#include <stdlib.h>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -35991,147 +29830,10 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${STRTOD_DIR}/include/stdlib.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${STRTOD_DIR}/include/stdlib.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${STRTOD_DIR}/include/stdlib.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${STRTOD_DIR}/include/stdlib.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${STRTOD_DIR}/include/stdlib.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${STRTOD_DIR}/include/stdlib.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${STRTOD_DIR}/include/stdlib.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${STRTOD_DIR}/include/stdlib.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${STRTOD_DIR}/include/stdlib.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${STRTOD_DIR}/include/stdlib.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${STRTOD_DIR}/include/stdlib.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${STRTOD_DIR}/include/stdlib.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${STRTOD_DIR}/include/stdlib.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${STRTOD_DIR}/include/stdlib.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${STRTOD_DIR}/include/stdlib.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${STRTOD_DIR}/include/stdlib.h: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${STRTOD_DIR}/include/stdlib.h" >&5
-echo $ECHO_N "checking for ${STRTOD_DIR}/include/stdlib.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  STRTOD_HEADER_FOUND=1
-else
-  STRTOD_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "xstdlib.h" != "x" ; then
-            if test "${ac_cv_header_stdlib_h+set}" = set; then
-  { echo "$as_me:$LINENO: checking for stdlib.h" >&5
-echo $ECHO_N "checking for stdlib.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_stdlib_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_stdlib_h" >&5
-echo "${ECHO_T}$ac_cv_header_stdlib_h" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking stdlib.h usability" >&5
-echo $ECHO_N "checking stdlib.h usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <stdlib.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking stdlib.h presence" >&5
-echo $ECHO_N "checking stdlib.h presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <stdlib.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: stdlib.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: stdlib.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: stdlib.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: stdlib.h: proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: stdlib.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: stdlib.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: stdlib.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: stdlib.h: proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
@@ -36168,7 +29870,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${STRTOD_HEADER_FOUND}" = "x0" ; then
          STRTOD_LIB=""
@@ -36196,6 +29898,7 @@ fi
 
 if test "x${PBX_FLOOR}" != "x1" -a "${USE_FLOOR}" != "no"; then
    pbxlibdir=""
+   # if --with-FLOOR=DIR has been specified, use it.
    if test "x${FLOOR_DIR}" != "x"; then
       if test -d ${FLOOR_DIR}/lib; then
         pbxlibdir="-L${FLOOR_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_FLOOR_FOUND}" = "yes"; then
-      FLOOR_LIB="-lm "
-      FLOOR_HEADER_FOUND="1"
+      FLOOR_LIB="${pbxlibdir} -lm "
+      # if --with-FLOOR=DIR has been specified, use it.
       if test "x${FLOOR_DIR}" != "x"; then
-         FLOOR_LIB="${pbxlibdir} ${FLOOR_LIB}"
         FLOOR_INCLUDE="-I${FLOOR_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${FLOOR_DIR}/include"
-        if test "x" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${FLOOR_DIR}/include/" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${FLOOR_DIR}/include/" >&5
-echo $ECHO_N "checking for ${FLOOR_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${FLOOR_DIR}/include/ usability" >&5
-echo $ECHO_N "checking ${FLOOR_DIR}/include/ usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <${FLOOR_DIR}/include/>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking ${FLOOR_DIR}/include/ presence" >&5
-echo $ECHO_N "checking ${FLOOR_DIR}/include/ presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${FLOOR_DIR}/include/>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${FLOOR_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${FLOOR_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${FLOOR_DIR}/include/: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${FLOOR_DIR}/include/: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${FLOOR_DIR}/include/: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${FLOOR_DIR}/include/: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${FLOOR_DIR}/include/:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${FLOOR_DIR}/include/:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${FLOOR_DIR}/include/: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${FLOOR_DIR}/include/: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${FLOOR_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${FLOOR_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${FLOOR_DIR}/include/: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${FLOOR_DIR}/include/: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${FLOOR_DIR}/include/: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${FLOOR_DIR}/include/: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${FLOOR_DIR}/include/" >&5
-echo $ECHO_N "checking for ${FLOOR_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  FLOOR_HEADER_FOUND=1
-else
-  FLOOR_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "x" != "x" ; then
-            if test "${ac_cv_header_+set}" = set; then
+      fi
+      FLOOR_INCLUDE="${FLOOR_INCLUDE} "
+      if test "x" = "x" ; then # no header, assume found
+         FLOOR_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${FLOOR_INCLUDE} "
+        if test "${ac_cv_header_+set}" = set; then
   { echo "$as_me:$LINENO: checking for " >&5
 echo $ECHO_N "checking for ... $ECHO_C" >&6; }
 if test "${ac_cv_header_+set}" = set; then
@@ -36558,7 +30126,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${FLOOR_HEADER_FOUND}" = "x0" ; then
          FLOOR_LIB=""
@@ -36586,6 +30154,7 @@ fi
 
 if test "x${PBX_CEIL}" != "x1" -a "${USE_CEIL}" != "no"; then
    pbxlibdir=""
+   # if --with-CEIL=DIR has been specified, use it.
    if test "x${CEIL_DIR}" != "x"; then
       if test -d ${CEIL_DIR}/lib; then
         pbxlibdir="-L${CEIL_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_CEIL_FOUND}" = "yes"; then
-      CEIL_LIB="-lm "
-      CEIL_HEADER_FOUND="1"
+      CEIL_LIB="${pbxlibdir} -lm "
+      # if --with-CEIL=DIR has been specified, use it.
       if test "x${CEIL_DIR}" != "x"; then
-         CEIL_LIB="${pbxlibdir} ${CEIL_LIB}"
         CEIL_INCLUDE="-I${CEIL_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${CEIL_DIR}/include"
-        if test "x" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${CEIL_DIR}/include/" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${CEIL_DIR}/include/" >&5
-echo $ECHO_N "checking for ${CEIL_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+      fi
+      CEIL_INCLUDE="${CEIL_INCLUDE} "
+      if test "x" = "x" ; then # no header, assume found
+         CEIL_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${CEIL_INCLUDE} "
+        if test "${ac_cv_header_+set}" = set; then
+  { echo "$as_me:$LINENO: checking for " >&5
+echo $ECHO_N "checking for ... $ECHO_C" >&6; }
+if test "${ac_cv_header_+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
+echo "${ECHO_T}$ac_cv_header_" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${CEIL_DIR}/include/ usability" >&5
-echo $ECHO_N "checking ${CEIL_DIR}/include/ usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking  usability" >&5
+echo $ECHO_N "checking  usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -36698,7 +30269,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <${CEIL_DIR}/include/>
+#include <>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -36730,15 +30301,15 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking ${CEIL_DIR}/include/ presence" >&5
-echo $ECHO_N "checking ${CEIL_DIR}/include/ presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking  presence" >&5
+echo $ECHO_N "checking  presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <${CEIL_DIR}/include/>
+#include <>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -36771,147 +30342,10 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${CEIL_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${CEIL_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${CEIL_DIR}/include/: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${CEIL_DIR}/include/: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${CEIL_DIR}/include/: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${CEIL_DIR}/include/: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${CEIL_DIR}/include/:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${CEIL_DIR}/include/:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${CEIL_DIR}/include/: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${CEIL_DIR}/include/: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${CEIL_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${CEIL_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${CEIL_DIR}/include/: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${CEIL_DIR}/include/: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${CEIL_DIR}/include/: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${CEIL_DIR}/include/: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${CEIL_DIR}/include/" >&5
-echo $ECHO_N "checking for ${CEIL_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  CEIL_HEADER_FOUND=1
-else
-  CEIL_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "x" != "x" ; then
-            if test "${ac_cv_header_+set}" = set; then
-  { echo "$as_me:$LINENO: checking for " >&5
-echo $ECHO_N "checking for ... $ECHO_C" >&6; }
-if test "${ac_cv_header_+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
-echo "${ECHO_T}$ac_cv_header_" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking  usability" >&5
-echo $ECHO_N "checking  usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking  presence" >&5
-echo $ECHO_N "checking  presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: : proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: : proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: : proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: : proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
@@ -36948,7 +30382,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${CEIL_HEADER_FOUND}" = "x0" ; then
          CEIL_LIB=""
@@ -37656,6 +31090,7 @@ fi
 
 if test "x${PBX_IKSEMEL}" != "x1" -a "${USE_IKSEMEL}" != "no"; then
    pbxlibdir=""
+   # if --with-IKSEMEL=DIR has been specified, use it.
    if test "x${IKSEMEL_DIR}" != "x"; then
       if test -d ${IKSEMEL_DIR}/lib; then
         pbxlibdir="-L${IKSEMEL_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_IKSEMEL_FOUND}" = "yes"; then
-      IKSEMEL_LIB="-liksemel "
-      IKSEMEL_HEADER_FOUND="1"
+      IKSEMEL_LIB="${pbxlibdir} -liksemel "
+      # if --with-IKSEMEL=DIR has been specified, use it.
       if test "x${IKSEMEL_DIR}" != "x"; then
-         IKSEMEL_LIB="${pbxlibdir} ${IKSEMEL_LIB}"
         IKSEMEL_INCLUDE="-I${IKSEMEL_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${IKSEMEL_DIR}/include"
-        if test "xiksemel.h" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${IKSEMEL_DIR}/include/iksemel.h" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${IKSEMEL_DIR}/include/iksemel.h" >&5
-echo $ECHO_N "checking for ${IKSEMEL_DIR}/include/iksemel.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${IKSEMEL_DIR}/include/iksemel.h usability" >&5
-echo $ECHO_N "checking ${IKSEMEL_DIR}/include/iksemel.h usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <${IKSEMEL_DIR}/include/iksemel.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking ${IKSEMEL_DIR}/include/iksemel.h presence" >&5
-echo $ECHO_N "checking ${IKSEMEL_DIR}/include/iksemel.h presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${IKSEMEL_DIR}/include/iksemel.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${IKSEMEL_DIR}/include/iksemel.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${IKSEMEL_DIR}/include/iksemel.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${IKSEMEL_DIR}/include/iksemel.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${IKSEMEL_DIR}/include/iksemel.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${IKSEMEL_DIR}/include/iksemel.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${IKSEMEL_DIR}/include/iksemel.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${IKSEMEL_DIR}/include/iksemel.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${IKSEMEL_DIR}/include/iksemel.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${IKSEMEL_DIR}/include/iksemel.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${IKSEMEL_DIR}/include/iksemel.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${IKSEMEL_DIR}/include/iksemel.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${IKSEMEL_DIR}/include/iksemel.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${IKSEMEL_DIR}/include/iksemel.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${IKSEMEL_DIR}/include/iksemel.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${IKSEMEL_DIR}/include/iksemel.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${IKSEMEL_DIR}/include/iksemel.h: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${IKSEMEL_DIR}/include/iksemel.h" >&5
-echo $ECHO_N "checking for ${IKSEMEL_DIR}/include/iksemel.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  IKSEMEL_HEADER_FOUND=1
-else
-  IKSEMEL_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "xiksemel.h" != "x" ; then
-            if test "${ac_cv_header_iksemel_h+set}" = set; then
+      fi
+      IKSEMEL_INCLUDE="${IKSEMEL_INCLUDE} "
+      if test "xiksemel.h" = "x" ; then        # no header, assume found
+         IKSEMEL_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${IKSEMEL_INCLUDE} "
+        if test "${ac_cv_header_iksemel_h+set}" = set; then
   { echo "$as_me:$LINENO: checking for iksemel.h" >&5
 echo $ECHO_N "checking for iksemel.h... $ECHO_C" >&6; }
 if test "${ac_cv_header_iksemel_h+set}" = set; then
@@ -38018,7 +31318,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${IKSEMEL_HEADER_FOUND}" = "x0" ; then
          IKSEMEL_LIB=""
@@ -38302,6 +31602,7 @@ fi
 
 if test "x${PBX_LTDL}" != "x1" -a "${USE_LTDL}" != "no"; then
    pbxlibdir=""
+   # if --with-LTDL=DIR has been specified, use it.
    if test "x${LTDL_DIR}" != "x"; then
       if test -d ${LTDL_DIR}/lib; then
         pbxlibdir="-L${LTDL_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_LTDL_FOUND}" = "yes"; then
-      LTDL_LIB="-lltdl "
-      LTDL_HEADER_FOUND="1"
+      LTDL_LIB="${pbxlibdir} -lltdl "
+      # if --with-LTDL=DIR has been specified, use it.
       if test "x${LTDL_DIR}" != "x"; then
-         LTDL_LIB="${pbxlibdir} ${LTDL_LIB}"
         LTDL_INCLUDE="-I${LTDL_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${LTDL_DIR}/include"
-        if test "xltdl.h" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${LTDL_DIR}/include/ltdl.h" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${LTDL_DIR}/include/ltdl.h" >&5
-echo $ECHO_N "checking for ${LTDL_DIR}/include/ltdl.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+      fi
+      LTDL_INCLUDE="${LTDL_INCLUDE} "
+      if test "xltdl.h" = "x" ; then   # no header, assume found
+         LTDL_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${LTDL_INCLUDE} "
+        if test "${ac_cv_header_ltdl_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for ltdl.h" >&5
+echo $ECHO_N "checking for ltdl.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_ltdl_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_ltdl_h" >&5
+echo "${ECHO_T}$ac_cv_header_ltdl_h" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${LTDL_DIR}/include/ltdl.h usability" >&5
-echo $ECHO_N "checking ${LTDL_DIR}/include/ltdl.h usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking ltdl.h usability" >&5
+echo $ECHO_N "checking ltdl.h usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -38414,7 +31717,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <${LTDL_DIR}/include/ltdl.h>
+#include <ltdl.h>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -38446,152 +31749,15 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking ${LTDL_DIR}/include/ltdl.h presence" >&5
-echo $ECHO_N "checking ${LTDL_DIR}/include/ltdl.h presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking ltdl.h presence" >&5
+echo $ECHO_N "checking ltdl.h presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <${LTDL_DIR}/include/ltdl.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${LTDL_DIR}/include/ltdl.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${LTDL_DIR}/include/ltdl.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${LTDL_DIR}/include/ltdl.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${LTDL_DIR}/include/ltdl.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${LTDL_DIR}/include/ltdl.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${LTDL_DIR}/include/ltdl.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${LTDL_DIR}/include/ltdl.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${LTDL_DIR}/include/ltdl.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${LTDL_DIR}/include/ltdl.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${LTDL_DIR}/include/ltdl.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${LTDL_DIR}/include/ltdl.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${LTDL_DIR}/include/ltdl.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${LTDL_DIR}/include/ltdl.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${LTDL_DIR}/include/ltdl.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${LTDL_DIR}/include/ltdl.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${LTDL_DIR}/include/ltdl.h: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${LTDL_DIR}/include/ltdl.h" >&5
-echo $ECHO_N "checking for ${LTDL_DIR}/include/ltdl.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  LTDL_HEADER_FOUND=1
-else
-  LTDL_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "xltdl.h" != "x" ; then
-            if test "${ac_cv_header_ltdl_h+set}" = set; then
-  { echo "$as_me:$LINENO: checking for ltdl.h" >&5
-echo $ECHO_N "checking for ltdl.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_ltdl_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_ltdl_h" >&5
-echo "${ECHO_T}$ac_cv_header_ltdl_h" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ltdl.h usability" >&5
-echo $ECHO_N "checking ltdl.h usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <ltdl.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking ltdl.h presence" >&5
-echo $ECHO_N "checking ltdl.h presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <ltdl.h>
+#include <ltdl.h>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -38664,7 +31830,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${LTDL_HEADER_FOUND}" = "x0" ; then
          LTDL_LIB=""
@@ -38898,6 +32064,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 if test "x${PBX_MISDN}" != "x1" -a "${USE_MISDN}" != "no"; then
    pbxlibdir=""
+   # if --with-MISDN=DIR has been specified, use it.
    if test "x${MISDN_DIR}" != "x"; then
       if test -d ${MISDN_DIR}/lib; then
         pbxlibdir="-L${MISDN_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_MISDN_FOUND}" = "yes"; then
-      MISDN_LIB="-lmISDN "
-      MISDN_HEADER_FOUND="1"
+      MISDN_LIB="${pbxlibdir} -lmISDN "
+      # if --with-MISDN=DIR has been specified, use it.
       if test "x${MISDN_DIR}" != "x"; then
-         MISDN_LIB="${pbxlibdir} ${MISDN_LIB}"
         MISDN_INCLUDE="-I${MISDN_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${MISDN_DIR}/include"
-        if test "xmISDNuser/mISDNlib.h" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${MISDN_DIR}/include/mISDNuser/mISDNlib.h" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${MISDN_DIR}/include/mISDNuser/mISDNlib.h" >&5
-echo $ECHO_N "checking for ${MISDN_DIR}/include/mISDNuser/mISDNlib.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${MISDN_DIR}/include/mISDNuser/mISDNlib.h usability" >&5
-echo $ECHO_N "checking ${MISDN_DIR}/include/mISDNuser/mISDNlib.h usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <${MISDN_DIR}/include/mISDNuser/mISDNlib.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking ${MISDN_DIR}/include/mISDNuser/mISDNlib.h presence" >&5
-echo $ECHO_N "checking ${MISDN_DIR}/include/mISDNuser/mISDNlib.h presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${MISDN_DIR}/include/mISDNuser/mISDNlib.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${MISDN_DIR}/include/mISDNuser/mISDNlib.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${MISDN_DIR}/include/mISDNuser/mISDNlib.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${MISDN_DIR}/include/mISDNuser/mISDNlib.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${MISDN_DIR}/include/mISDNuser/mISDNlib.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${MISDN_DIR}/include/mISDNuser/mISDNlib.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${MISDN_DIR}/include/mISDNuser/mISDNlib.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${MISDN_DIR}/include/mISDNuser/mISDNlib.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${MISDN_DIR}/include/mISDNuser/mISDNlib.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${MISDN_DIR}/include/mISDNuser/mISDNlib.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${MISDN_DIR}/include/mISDNuser/mISDNlib.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${MISDN_DIR}/include/mISDNuser/mISDNlib.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${MISDN_DIR}/include/mISDNuser/mISDNlib.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${MISDN_DIR}/include/mISDNuser/mISDNlib.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${MISDN_DIR}/include/mISDNuser/mISDNlib.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${MISDN_DIR}/include/mISDNuser/mISDNlib.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${MISDN_DIR}/include/mISDNuser/mISDNlib.h: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${MISDN_DIR}/include/mISDNuser/mISDNlib.h" >&5
-echo $ECHO_N "checking for ${MISDN_DIR}/include/mISDNuser/mISDNlib.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  MISDN_HEADER_FOUND=1
-else
-  MISDN_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "xmISDNuser/mISDNlib.h" != "x" ; then
-            if test "${ac_cv_header_mISDNuser_mISDNlib_h+set}" = set; then
+      fi
+      MISDN_INCLUDE="${MISDN_INCLUDE} "
+      if test "xmISDNuser/mISDNlib.h" = "x" ; then     # no header, assume found
+         MISDN_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${MISDN_INCLUDE} "
+        if test "${ac_cv_header_mISDNuser_mISDNlib_h+set}" = set; then
   { echo "$as_me:$LINENO: checking for mISDNuser/mISDNlib.h" >&5
 echo $ECHO_N "checking for mISDNuser/mISDNlib.h... $ECHO_C" >&6; }
 if test "${ac_cv_header_mISDNuser_mISDNlib_h+set}" = set; then
@@ -39260,7 +32292,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${MISDN_HEADER_FOUND}" = "x0" ; then
          MISDN_LIB=""
@@ -39290,6 +32322,7 @@ if test "${PBX_MISDN}" = 1; then
 
 if test "x${PBX_ISDNNET}" != "x1" -a "${USE_ISDNNET}" != "no"; then
    pbxlibdir=""
+   # if --with-ISDNNET=DIR has been specified, use it.
    if test "x${ISDNNET_DIR}" != "x"; then
       if test -d ${ISDNNET_DIR}/lib; then
         pbxlibdir="-L${ISDNNET_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_ISDNNET_FOUND}" = "yes"; then
-      ISDNNET_LIB="-lisdnnet -lmISDN -lpthread"
-      ISDNNET_HEADER_FOUND="1"
+      ISDNNET_LIB="${pbxlibdir} -lisdnnet -lmISDN -lpthread"
+      # if --with-ISDNNET=DIR has been specified, use it.
       if test "x${ISDNNET_DIR}" != "x"; then
-         ISDNNET_LIB="${pbxlibdir} ${ISDNNET_LIB}"
         ISDNNET_INCLUDE="-I${ISDNNET_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${ISDNNET_DIR}/include"
-        if test "xmISDNuser/isdn_net.h" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${ISDNNET_DIR}/include/mISDNuser/isdn_net.h" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${ISDNNET_DIR}/include/mISDNuser/isdn_net.h" >&5
-echo $ECHO_N "checking for ${ISDNNET_DIR}/include/mISDNuser/isdn_net.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+      fi
+      ISDNNET_INCLUDE="${ISDNNET_INCLUDE} "
+      if test "xmISDNuser/isdn_net.h" = "x" ; then     # no header, assume found
+         ISDNNET_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${ISDNNET_INCLUDE} "
+        if test "${ac_cv_header_mISDNuser_isdn_net_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for mISDNuser/isdn_net.h" >&5
+echo $ECHO_N "checking for mISDNuser/isdn_net.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_mISDNuser_isdn_net_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_mISDNuser_isdn_net_h" >&5
+echo "${ECHO_T}$ac_cv_header_mISDNuser_isdn_net_h" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${ISDNNET_DIR}/include/mISDNuser/isdn_net.h usability" >&5
-echo $ECHO_N "checking ${ISDNNET_DIR}/include/mISDNuser/isdn_net.h usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking mISDNuser/isdn_net.h usability" >&5
+echo $ECHO_N "checking mISDNuser/isdn_net.h usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -39402,7 +32437,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <${ISDNNET_DIR}/include/mISDNuser/isdn_net.h>
+#include <mISDNuser/isdn_net.h>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -39434,15 +32469,15 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking ${ISDNNET_DIR}/include/mISDNuser/isdn_net.h presence" >&5
-echo $ECHO_N "checking ${ISDNNET_DIR}/include/mISDNuser/isdn_net.h presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking mISDNuser/isdn_net.h presence" >&5
+echo $ECHO_N "checking mISDNuser/isdn_net.h presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <${ISDNNET_DIR}/include/mISDNuser/isdn_net.h>
+#include <mISDNuser/isdn_net.h>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -39475,147 +32510,10 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${ISDNNET_DIR}/include/mISDNuser/isdn_net.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${ISDNNET_DIR}/include/mISDNuser/isdn_net.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ISDNNET_DIR}/include/mISDNuser/isdn_net.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${ISDNNET_DIR}/include/mISDNuser/isdn_net.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${ISDNNET_DIR}/include/mISDNuser/isdn_net.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${ISDNNET_DIR}/include/mISDNuser/isdn_net.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ISDNNET_DIR}/include/mISDNuser/isdn_net.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${ISDNNET_DIR}/include/mISDNuser/isdn_net.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ISDNNET_DIR}/include/mISDNuser/isdn_net.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${ISDNNET_DIR}/include/mISDNuser/isdn_net.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ISDNNET_DIR}/include/mISDNuser/isdn_net.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${ISDNNET_DIR}/include/mISDNuser/isdn_net.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ISDNNET_DIR}/include/mISDNuser/isdn_net.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${ISDNNET_DIR}/include/mISDNuser/isdn_net.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ISDNNET_DIR}/include/mISDNuser/isdn_net.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${ISDNNET_DIR}/include/mISDNuser/isdn_net.h: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${ISDNNET_DIR}/include/mISDNuser/isdn_net.h" >&5
-echo $ECHO_N "checking for ${ISDNNET_DIR}/include/mISDNuser/isdn_net.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  ISDNNET_HEADER_FOUND=1
-else
-  ISDNNET_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "xmISDNuser/isdn_net.h" != "x" ; then
-            if test "${ac_cv_header_mISDNuser_isdn_net_h+set}" = set; then
-  { echo "$as_me:$LINENO: checking for mISDNuser/isdn_net.h" >&5
-echo $ECHO_N "checking for mISDNuser/isdn_net.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_mISDNuser_isdn_net_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_mISDNuser_isdn_net_h" >&5
-echo "${ECHO_T}$ac_cv_header_mISDNuser_isdn_net_h" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking mISDNuser/isdn_net.h usability" >&5
-echo $ECHO_N "checking mISDNuser/isdn_net.h usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <mISDNuser/isdn_net.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking mISDNuser/isdn_net.h presence" >&5
-echo $ECHO_N "checking mISDNuser/isdn_net.h presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <mISDNuser/isdn_net.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: mISDNuser/isdn_net.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: mISDNuser/isdn_net.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: mISDNuser/isdn_net.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: mISDNuser/isdn_net.h: proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: mISDNuser/isdn_net.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: mISDNuser/isdn_net.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: mISDNuser/isdn_net.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: mISDNuser/isdn_net.h: proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
@@ -39652,7 +32550,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${ISDNNET_HEADER_FOUND}" = "x0" ; then
          ISDNNET_LIB=""
@@ -39680,6 +32578,7 @@ fi
 
 if test "x${PBX_SUPPSERV}" != "x1" -a "${USE_SUPPSERV}" != "no"; then
    pbxlibdir=""
+   # if --with-SUPPSERV=DIR has been specified, use it.
    if test "x${SUPPSERV_DIR}" != "x"; then
       if test -d ${SUPPSERV_DIR}/lib; then
         pbxlibdir="-L${SUPPSERV_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_SUPPSERV_FOUND}" = "yes"; then
-      SUPPSERV_LIB="-lsuppserv "
-      SUPPSERV_HEADER_FOUND="1"
+      SUPPSERV_LIB="${pbxlibdir} -lsuppserv "
+      # if --with-SUPPSERV=DIR has been specified, use it.
       if test "x${SUPPSERV_DIR}" != "x"; then
-         SUPPSERV_LIB="${pbxlibdir} ${SUPPSERV_LIB}"
         SUPPSERV_INCLUDE="-I${SUPPSERV_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${SUPPSERV_DIR}/include"
-        if test "xmISDNuser/suppserv.h" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${SUPPSERV_DIR}/include/mISDNuser/suppserv.h" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${SUPPSERV_DIR}/include/mISDNuser/suppserv.h" >&5
-echo $ECHO_N "checking for ${SUPPSERV_DIR}/include/mISDNuser/suppserv.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${SUPPSERV_DIR}/include/mISDNuser/suppserv.h usability" >&5
-echo $ECHO_N "checking ${SUPPSERV_DIR}/include/mISDNuser/suppserv.h usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <${SUPPSERV_DIR}/include/mISDNuser/suppserv.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking ${SUPPSERV_DIR}/include/mISDNuser/suppserv.h presence" >&5
-echo $ECHO_N "checking ${SUPPSERV_DIR}/include/mISDNuser/suppserv.h presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${SUPPSERV_DIR}/include/mISDNuser/suppserv.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${SUPPSERV_DIR}/include/mISDNuser/suppserv.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${SUPPSERV_DIR}/include/mISDNuser/suppserv.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SUPPSERV_DIR}/include/mISDNuser/suppserv.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${SUPPSERV_DIR}/include/mISDNuser/suppserv.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${SUPPSERV_DIR}/include/mISDNuser/suppserv.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${SUPPSERV_DIR}/include/mISDNuser/suppserv.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SUPPSERV_DIR}/include/mISDNuser/suppserv.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${SUPPSERV_DIR}/include/mISDNuser/suppserv.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SUPPSERV_DIR}/include/mISDNuser/suppserv.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${SUPPSERV_DIR}/include/mISDNuser/suppserv.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SUPPSERV_DIR}/include/mISDNuser/suppserv.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${SUPPSERV_DIR}/include/mISDNuser/suppserv.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SUPPSERV_DIR}/include/mISDNuser/suppserv.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${SUPPSERV_DIR}/include/mISDNuser/suppserv.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SUPPSERV_DIR}/include/mISDNuser/suppserv.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${SUPPSERV_DIR}/include/mISDNuser/suppserv.h: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${SUPPSERV_DIR}/include/mISDNuser/suppserv.h" >&5
-echo $ECHO_N "checking for ${SUPPSERV_DIR}/include/mISDNuser/suppserv.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  SUPPSERV_HEADER_FOUND=1
-else
-  SUPPSERV_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "xmISDNuser/suppserv.h" != "x" ; then
-            if test "${ac_cv_header_mISDNuser_suppserv_h+set}" = set; then
+      fi
+      SUPPSERV_INCLUDE="${SUPPSERV_INCLUDE} "
+      if test "xmISDNuser/suppserv.h" = "x" ; then     # no header, assume found
+         SUPPSERV_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${SUPPSERV_INCLUDE} "
+        if test "${ac_cv_header_mISDNuser_suppserv_h+set}" = set; then
   { echo "$as_me:$LINENO: checking for mISDNuser/suppserv.h" >&5
 echo $ECHO_N "checking for mISDNuser/suppserv.h... $ECHO_C" >&6; }
 if test "${ac_cv_header_mISDNuser_suppserv_h+set}" = set; then
@@ -40042,7 +32806,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${SUPPSERV_HEADER_FOUND}" = "x0" ; then
          SUPPSERV_LIB=""
@@ -40344,6 +33108,7 @@ fi
 
 if test "x${PBX_NBS}" != "x1" -a "${USE_NBS}" != "no"; then
    pbxlibdir=""
+   # if --with-NBS=DIR has been specified, use it.
    if test "x${NBS_DIR}" != "x"; then
       if test -d ${NBS_DIR}/lib; then
         pbxlibdir="-L${NBS_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_NBS_FOUND}" = "yes"; then
-      NBS_LIB="-lnbs "
-      NBS_HEADER_FOUND="1"
+      NBS_LIB="${pbxlibdir} -lnbs "
+      # if --with-NBS=DIR has been specified, use it.
       if test "x${NBS_DIR}" != "x"; then
-         NBS_LIB="${pbxlibdir} ${NBS_LIB}"
         NBS_INCLUDE="-I${NBS_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${NBS_DIR}/include"
-        if test "xnbs.h" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${NBS_DIR}/include/nbs.h" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${NBS_DIR}/include/nbs.h" >&5
-echo $ECHO_N "checking for ${NBS_DIR}/include/nbs.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+      fi
+      NBS_INCLUDE="${NBS_INCLUDE} "
+      if test "xnbs.h" = "x" ; then    # no header, assume found
+         NBS_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${NBS_INCLUDE} "
+        if test "${ac_cv_header_nbs_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for nbs.h" >&5
+echo $ECHO_N "checking for nbs.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_nbs_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_nbs_h" >&5
+echo "${ECHO_T}$ac_cv_header_nbs_h" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${NBS_DIR}/include/nbs.h usability" >&5
-echo $ECHO_N "checking ${NBS_DIR}/include/nbs.h usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking nbs.h usability" >&5
+echo $ECHO_N "checking nbs.h usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -40456,7 +33223,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <${NBS_DIR}/include/nbs.h>
+#include <nbs.h>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -40488,15 +33255,15 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking ${NBS_DIR}/include/nbs.h presence" >&5
-echo $ECHO_N "checking ${NBS_DIR}/include/nbs.h presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking nbs.h presence" >&5
+echo $ECHO_N "checking nbs.h presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <${NBS_DIR}/include/nbs.h>
+#include <nbs.h>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -40529,147 +33296,10 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${NBS_DIR}/include/nbs.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${NBS_DIR}/include/nbs.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${NBS_DIR}/include/nbs.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${NBS_DIR}/include/nbs.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${NBS_DIR}/include/nbs.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${NBS_DIR}/include/nbs.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${NBS_DIR}/include/nbs.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${NBS_DIR}/include/nbs.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${NBS_DIR}/include/nbs.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${NBS_DIR}/include/nbs.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${NBS_DIR}/include/nbs.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${NBS_DIR}/include/nbs.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${NBS_DIR}/include/nbs.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${NBS_DIR}/include/nbs.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${NBS_DIR}/include/nbs.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${NBS_DIR}/include/nbs.h: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${NBS_DIR}/include/nbs.h" >&5
-echo $ECHO_N "checking for ${NBS_DIR}/include/nbs.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  NBS_HEADER_FOUND=1
-else
-  NBS_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "xnbs.h" != "x" ; then
-            if test "${ac_cv_header_nbs_h+set}" = set; then
-  { echo "$as_me:$LINENO: checking for nbs.h" >&5
-echo $ECHO_N "checking for nbs.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_nbs_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_nbs_h" >&5
-echo "${ECHO_T}$ac_cv_header_nbs_h" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking nbs.h usability" >&5
-echo $ECHO_N "checking nbs.h usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <nbs.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking nbs.h presence" >&5
-echo $ECHO_N "checking nbs.h presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <nbs.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: nbs.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: nbs.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: nbs.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: nbs.h: proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: nbs.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: nbs.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: nbs.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: nbs.h: proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
@@ -40706,7 +33336,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${NBS_HEADER_FOUND}" = "x0" ; then
          NBS_LIB=""
@@ -40735,6 +33365,7 @@ fi
 
 if test "x${PBX_NCURSES}" != "x1" -a "${USE_NCURSES}" != "no"; then
    pbxlibdir=""
+   # if --with-NCURSES=DIR has been specified, use it.
    if test "x${NCURSES_DIR}" != "x"; then
       if test -d ${NCURSES_DIR}/lib; then
         pbxlibdir="-L${NCURSES_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_NCURSES_FOUND}" = "yes"; then
-      NCURSES_LIB="-lncurses "
-      NCURSES_HEADER_FOUND="1"
+      NCURSES_LIB="${pbxlibdir} -lncurses "
+      # if --with-NCURSES=DIR has been specified, use it.
       if test "x${NCURSES_DIR}" != "x"; then
-         NCURSES_LIB="${pbxlibdir} ${NCURSES_LIB}"
         NCURSES_INCLUDE="-I${NCURSES_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${NCURSES_DIR}/include"
-        if test "xcurses.h" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${NCURSES_DIR}/include/curses.h" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${NCURSES_DIR}/include/curses.h" >&5
-echo $ECHO_N "checking for ${NCURSES_DIR}/include/curses.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${NCURSES_DIR}/include/curses.h usability" >&5
-echo $ECHO_N "checking ${NCURSES_DIR}/include/curses.h usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <${NCURSES_DIR}/include/curses.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking ${NCURSES_DIR}/include/curses.h presence" >&5
-echo $ECHO_N "checking ${NCURSES_DIR}/include/curses.h presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${NCURSES_DIR}/include/curses.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${NCURSES_DIR}/include/curses.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${NCURSES_DIR}/include/curses.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${NCURSES_DIR}/include/curses.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${NCURSES_DIR}/include/curses.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${NCURSES_DIR}/include/curses.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${NCURSES_DIR}/include/curses.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${NCURSES_DIR}/include/curses.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${NCURSES_DIR}/include/curses.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${NCURSES_DIR}/include/curses.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${NCURSES_DIR}/include/curses.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${NCURSES_DIR}/include/curses.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${NCURSES_DIR}/include/curses.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${NCURSES_DIR}/include/curses.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${NCURSES_DIR}/include/curses.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${NCURSES_DIR}/include/curses.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${NCURSES_DIR}/include/curses.h: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${NCURSES_DIR}/include/curses.h" >&5
-echo $ECHO_N "checking for ${NCURSES_DIR}/include/curses.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  NCURSES_HEADER_FOUND=1
-else
-  NCURSES_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "xcurses.h" != "x" ; then
-            if test "${ac_cv_header_curses_h+set}" = set; then
+      fi
+      NCURSES_INCLUDE="${NCURSES_INCLUDE} "
+      if test "xcurses.h" = "x" ; then # no header, assume found
+         NCURSES_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${NCURSES_INCLUDE} "
+        if test "${ac_cv_header_curses_h+set}" = set; then
   { echo "$as_me:$LINENO: checking for curses.h" >&5
 echo $ECHO_N "checking for curses.h... $ECHO_C" >&6; }
 if test "${ac_cv_header_curses_h+set}" = set; then
@@ -41097,7 +33593,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${NCURSES_HEADER_FOUND}" = "x0" ; then
          NCURSES_LIB=""
@@ -41428,6 +33924,7 @@ fi
 
 if test "x${PBX_NEWT}" != "x1" -a "${USE_NEWT}" != "no"; then
    pbxlibdir=""
+   # if --with-NEWT=DIR has been specified, use it.
    if test "x${NEWT_DIR}" != "x"; then
       if test -d ${NEWT_DIR}/lib; then
         pbxlibdir="-L${NEWT_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_NEWT_FOUND}" = "yes"; then
-      NEWT_LIB="-lnewt "
-      NEWT_HEADER_FOUND="1"
+      NEWT_LIB="${pbxlibdir} -lnewt "
+      # if --with-NEWT=DIR has been specified, use it.
       if test "x${NEWT_DIR}" != "x"; then
-         NEWT_LIB="${pbxlibdir} ${NEWT_LIB}"
         NEWT_INCLUDE="-I${NEWT_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${NEWT_DIR}/include"
-        if test "xnewt.h" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${NEWT_DIR}/include/newt.h" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${NEWT_DIR}/include/newt.h" >&5
-echo $ECHO_N "checking for ${NEWT_DIR}/include/newt.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+      fi
+      NEWT_INCLUDE="${NEWT_INCLUDE} "
+      if test "xnewt.h" = "x" ; then   # no header, assume found
+         NEWT_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${NEWT_INCLUDE} "
+        if test "${ac_cv_header_newt_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for newt.h" >&5
+echo $ECHO_N "checking for newt.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_newt_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_newt_h" >&5
+echo "${ECHO_T}$ac_cv_header_newt_h" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${NEWT_DIR}/include/newt.h usability" >&5
-echo $ECHO_N "checking ${NEWT_DIR}/include/newt.h usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking newt.h usability" >&5
+echo $ECHO_N "checking newt.h usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -41540,7 +34039,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <${NEWT_DIR}/include/newt.h>
+#include <newt.h>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -41572,15 +34071,15 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking ${NEWT_DIR}/include/newt.h presence" >&5
-echo $ECHO_N "checking ${NEWT_DIR}/include/newt.h presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking newt.h presence" >&5
+echo $ECHO_N "checking newt.h presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <${NEWT_DIR}/include/newt.h>
+#include <newt.h>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -41613,147 +34112,10 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${NEWT_DIR}/include/newt.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${NEWT_DIR}/include/newt.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${NEWT_DIR}/include/newt.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${NEWT_DIR}/include/newt.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${NEWT_DIR}/include/newt.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${NEWT_DIR}/include/newt.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${NEWT_DIR}/include/newt.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${NEWT_DIR}/include/newt.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${NEWT_DIR}/include/newt.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${NEWT_DIR}/include/newt.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${NEWT_DIR}/include/newt.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${NEWT_DIR}/include/newt.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${NEWT_DIR}/include/newt.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${NEWT_DIR}/include/newt.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${NEWT_DIR}/include/newt.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${NEWT_DIR}/include/newt.h: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${NEWT_DIR}/include/newt.h" >&5
-echo $ECHO_N "checking for ${NEWT_DIR}/include/newt.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  NEWT_HEADER_FOUND=1
-else
-  NEWT_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "xnewt.h" != "x" ; then
-            if test "${ac_cv_header_newt_h+set}" = set; then
-  { echo "$as_me:$LINENO: checking for newt.h" >&5
-echo $ECHO_N "checking for newt.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_newt_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_newt_h" >&5
-echo "${ECHO_T}$ac_cv_header_newt_h" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking newt.h usability" >&5
-echo $ECHO_N "checking newt.h usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <newt.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking newt.h presence" >&5
-echo $ECHO_N "checking newt.h presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <newt.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: newt.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: newt.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: newt.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: newt.h: proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: newt.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: newt.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: newt.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: newt.h: proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
@@ -41790,7 +34152,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${NEWT_HEADER_FOUND}" = "x0" ; then
          NEWT_LIB=""
@@ -41819,6 +34181,7 @@ fi
 
 if test "x${PBX_UNIXODBC}" != "x1" -a "${USE_UNIXODBC}" != "no"; then
    pbxlibdir=""
+   # if --with-UNIXODBC=DIR has been specified, use it.
    if test "x${UNIXODBC_DIR}" != "x"; then
       if test -d ${UNIXODBC_DIR}/lib; then
         pbxlibdir="-L${UNIXODBC_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_UNIXODBC_FOUND}" = "yes"; then
-      UNIXODBC_LIB="-lodbc "
-      UNIXODBC_HEADER_FOUND="1"
+      UNIXODBC_LIB="${pbxlibdir} -lodbc "
+      # if --with-UNIXODBC=DIR has been specified, use it.
       if test "x${UNIXODBC_DIR}" != "x"; then
-         UNIXODBC_LIB="${pbxlibdir} ${UNIXODBC_LIB}"
         UNIXODBC_INCLUDE="-I${UNIXODBC_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${UNIXODBC_DIR}/include"
-        if test "xsql.h" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${UNIXODBC_DIR}/include/sql.h" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${UNIXODBC_DIR}/include/sql.h" >&5
-echo $ECHO_N "checking for ${UNIXODBC_DIR}/include/sql.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${UNIXODBC_DIR}/include/sql.h usability" >&5
-echo $ECHO_N "checking ${UNIXODBC_DIR}/include/sql.h usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <${UNIXODBC_DIR}/include/sql.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking ${UNIXODBC_DIR}/include/sql.h presence" >&5
-echo $ECHO_N "checking ${UNIXODBC_DIR}/include/sql.h presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${UNIXODBC_DIR}/include/sql.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${UNIXODBC_DIR}/include/sql.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${UNIXODBC_DIR}/include/sql.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${UNIXODBC_DIR}/include/sql.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${UNIXODBC_DIR}/include/sql.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${UNIXODBC_DIR}/include/sql.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${UNIXODBC_DIR}/include/sql.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${UNIXODBC_DIR}/include/sql.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${UNIXODBC_DIR}/include/sql.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${UNIXODBC_DIR}/include/sql.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${UNIXODBC_DIR}/include/sql.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${UNIXODBC_DIR}/include/sql.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${UNIXODBC_DIR}/include/sql.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${UNIXODBC_DIR}/include/sql.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${UNIXODBC_DIR}/include/sql.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${UNIXODBC_DIR}/include/sql.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${UNIXODBC_DIR}/include/sql.h: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${UNIXODBC_DIR}/include/sql.h" >&5
-echo $ECHO_N "checking for ${UNIXODBC_DIR}/include/sql.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  UNIXODBC_HEADER_FOUND=1
-else
-  UNIXODBC_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "xsql.h" != "x" ; then
-            if test "${ac_cv_header_sql_h+set}" = set; then
+      fi
+      UNIXODBC_INCLUDE="${UNIXODBC_INCLUDE} "
+      if test "xsql.h" = "x" ; then    # no header, assume found
+         UNIXODBC_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${UNIXODBC_INCLUDE} "
+        if test "${ac_cv_header_sql_h+set}" = set; then
   { echo "$as_me:$LINENO: checking for sql.h" >&5
 echo $ECHO_N "checking for sql.h... $ECHO_C" >&6; }
 if test "${ac_cv_header_sql_h+set}" = set; then
@@ -42181,7 +34409,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${UNIXODBC_HEADER_FOUND}" = "x0" ; then
          UNIXODBC_LIB=""
@@ -42210,6 +34438,7 @@ fi
 
 if test "x${PBX_OGG}" != "x1" -a "${USE_OGG}" != "no"; then
    pbxlibdir=""
+   # if --with-OGG=DIR has been specified, use it.
    if test "x${OGG_DIR}" != "x"; then
       if test -d ${OGG_DIR}/lib; then
         pbxlibdir="-L${OGG_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_OGG_FOUND}" = "yes"; then
-      OGG_LIB="-logg "
-      OGG_HEADER_FOUND="1"
+      OGG_LIB="${pbxlibdir} -logg "
+      # if --with-OGG=DIR has been specified, use it.
       if test "x${OGG_DIR}" != "x"; then
-         OGG_LIB="${pbxlibdir} ${OGG_LIB}"
         OGG_INCLUDE="-I${OGG_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${OGG_DIR}/include"
-        if test "x" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${OGG_DIR}/include/" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${OGG_DIR}/include/" >&5
-echo $ECHO_N "checking for ${OGG_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+      fi
+      OGG_INCLUDE="${OGG_INCLUDE} "
+      if test "x" = "x" ; then # no header, assume found
+         OGG_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${OGG_INCLUDE} "
+        if test "${ac_cv_header_+set}" = set; then
+  { echo "$as_me:$LINENO: checking for " >&5
+echo $ECHO_N "checking for ... $ECHO_C" >&6; }
+if test "${ac_cv_header_+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
+echo "${ECHO_T}$ac_cv_header_" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${OGG_DIR}/include/ usability" >&5
-echo $ECHO_N "checking ${OGG_DIR}/include/ usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking  usability" >&5
+echo $ECHO_N "checking  usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -42322,7 +34553,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <${OGG_DIR}/include/>
+#include <>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -42354,152 +34585,15 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking ${OGG_DIR}/include/ presence" >&5
-echo $ECHO_N "checking ${OGG_DIR}/include/ presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking  presence" >&5
+echo $ECHO_N "checking  presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <${OGG_DIR}/include/>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${OGG_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${OGG_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${OGG_DIR}/include/: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${OGG_DIR}/include/: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${OGG_DIR}/include/: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${OGG_DIR}/include/: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${OGG_DIR}/include/:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${OGG_DIR}/include/:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${OGG_DIR}/include/: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${OGG_DIR}/include/: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${OGG_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${OGG_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${OGG_DIR}/include/: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${OGG_DIR}/include/: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${OGG_DIR}/include/: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${OGG_DIR}/include/: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${OGG_DIR}/include/" >&5
-echo $ECHO_N "checking for ${OGG_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  OGG_HEADER_FOUND=1
-else
-  OGG_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "x" != "x" ; then
-            if test "${ac_cv_header_+set}" = set; then
-  { echo "$as_me:$LINENO: checking for " >&5
-echo $ECHO_N "checking for ... $ECHO_C" >&6; }
-if test "${ac_cv_header_+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
-echo "${ECHO_T}$ac_cv_header_" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking  usability" >&5
-echo $ECHO_N "checking  usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking  presence" >&5
-echo $ECHO_N "checking  presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <>
+#include <>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -42572,7 +34666,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${OGG_HEADER_FOUND}" = "x0" ; then
          OGG_LIB=""
@@ -42601,6 +34695,7 @@ fi
 
 if test "x${PBX_BKTR}" != "x1" -a "${USE_BKTR}" != "no"; then
    pbxlibdir=""
+   # if --with-BKTR=DIR has been specified, use it.
    if test "x${BKTR_DIR}" != "x"; then
       if test -d ${BKTR_DIR}/lib; then
         pbxlibdir="-L${BKTR_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_BKTR_FOUND}" = "yes"; then
-      BKTR_LIB="-lexecinfo -lexecinfo"
-      BKTR_HEADER_FOUND="1"
+      BKTR_LIB="${pbxlibdir} -lexecinfo -lexecinfo"
+      # if --with-BKTR=DIR has been specified, use it.
       if test "x${BKTR_DIR}" != "x"; then
-         BKTR_LIB="${pbxlibdir} ${BKTR_LIB}"
         BKTR_INCLUDE="-I${BKTR_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${BKTR_DIR}/include"
-        if test "xexecinfo.h" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${BKTR_DIR}/include/execinfo.h" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${BKTR_DIR}/include/execinfo.h" >&5
-echo $ECHO_N "checking for ${BKTR_DIR}/include/execinfo.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${BKTR_DIR}/include/execinfo.h usability" >&5
-echo $ECHO_N "checking ${BKTR_DIR}/include/execinfo.h usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <${BKTR_DIR}/include/execinfo.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking ${BKTR_DIR}/include/execinfo.h presence" >&5
-echo $ECHO_N "checking ${BKTR_DIR}/include/execinfo.h presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${BKTR_DIR}/include/execinfo.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${BKTR_DIR}/include/execinfo.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${BKTR_DIR}/include/execinfo.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${BKTR_DIR}/include/execinfo.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${BKTR_DIR}/include/execinfo.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${BKTR_DIR}/include/execinfo.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${BKTR_DIR}/include/execinfo.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${BKTR_DIR}/include/execinfo.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${BKTR_DIR}/include/execinfo.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${BKTR_DIR}/include/execinfo.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${BKTR_DIR}/include/execinfo.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${BKTR_DIR}/include/execinfo.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${BKTR_DIR}/include/execinfo.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${BKTR_DIR}/include/execinfo.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${BKTR_DIR}/include/execinfo.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${BKTR_DIR}/include/execinfo.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${BKTR_DIR}/include/execinfo.h: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${BKTR_DIR}/include/execinfo.h" >&5
-echo $ECHO_N "checking for ${BKTR_DIR}/include/execinfo.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  BKTR_HEADER_FOUND=1
-else
-  BKTR_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "xexecinfo.h" != "x" ; then
-            if test "${ac_cv_header_execinfo_h+set}" = set; then
+      fi
+      BKTR_INCLUDE="${BKTR_INCLUDE} "
+      if test "xexecinfo.h" = "x" ; then       # no header, assume found
+         BKTR_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${BKTR_INCLUDE} "
+        if test "${ac_cv_header_execinfo_h+set}" = set; then
   { echo "$as_me:$LINENO: checking for execinfo.h" >&5
 echo $ECHO_N "checking for execinfo.h... $ECHO_C" >&6; }
 if test "${ac_cv_header_execinfo_h+set}" = set; then
@@ -42963,7 +34923,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${BKTR_HEADER_FOUND}" = "x0" ; then
          BKTR_LIB=""
@@ -42993,6 +34953,7 @@ fi
 
 if test "x${PBX_OSS}" != "x1" -a "${USE_OSS}" != "no"; then
    pbxlibdir=""
+   # if --with-OSS=DIR has been specified, use it.
    if test "x${OSS_DIR}" != "x"; then
       if test -d ${OSS_DIR}/lib; then
         pbxlibdir="-L${OSS_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_OSS_FOUND}" = "yes"; then
-      OSS_LIB="-lossaudio "
-      OSS_HEADER_FOUND="1"
+      OSS_LIB="${pbxlibdir} -lossaudio "
+      # if --with-OSS=DIR has been specified, use it.
       if test "x${OSS_DIR}" != "x"; then
-         OSS_LIB="${pbxlibdir} ${OSS_LIB}"
         OSS_INCLUDE="-I${OSS_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${OSS_DIR}/include"
-        if test "xlinux/soundcard.h" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${OSS_DIR}/include/linux/soundcard.h" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${OSS_DIR}/include/linux/soundcard.h" >&5
-echo $ECHO_N "checking for ${OSS_DIR}/include/linux/soundcard.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+      fi
+      OSS_INCLUDE="${OSS_INCLUDE} "
+      if test "xlinux/soundcard.h" = "x" ; then        # no header, assume found
+         OSS_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${OSS_INCLUDE} "
+        if test "${ac_cv_header_linux_soundcard_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for linux/soundcard.h" >&5
+echo $ECHO_N "checking for linux/soundcard.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_linux_soundcard_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_linux_soundcard_h" >&5
+echo "${ECHO_T}$ac_cv_header_linux_soundcard_h" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${OSS_DIR}/include/linux/soundcard.h usability" >&5
-echo $ECHO_N "checking ${OSS_DIR}/include/linux/soundcard.h usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking linux/soundcard.h usability" >&5
+echo $ECHO_N "checking linux/soundcard.h usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -43105,7 +35068,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <${OSS_DIR}/include/linux/soundcard.h>
+#include <linux/soundcard.h>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -43137,15 +35100,15 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking ${OSS_DIR}/include/linux/soundcard.h presence" >&5
-echo $ECHO_N "checking ${OSS_DIR}/include/linux/soundcard.h presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking linux/soundcard.h presence" >&5
+echo $ECHO_N "checking linux/soundcard.h presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <${OSS_DIR}/include/linux/soundcard.h>
+#include <linux/soundcard.h>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -43178,147 +35141,10 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${OSS_DIR}/include/linux/soundcard.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${OSS_DIR}/include/linux/soundcard.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${OSS_DIR}/include/linux/soundcard.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${OSS_DIR}/include/linux/soundcard.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${OSS_DIR}/include/linux/soundcard.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${OSS_DIR}/include/linux/soundcard.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${OSS_DIR}/include/linux/soundcard.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${OSS_DIR}/include/linux/soundcard.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${OSS_DIR}/include/linux/soundcard.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${OSS_DIR}/include/linux/soundcard.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${OSS_DIR}/include/linux/soundcard.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${OSS_DIR}/include/linux/soundcard.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${OSS_DIR}/include/linux/soundcard.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${OSS_DIR}/include/linux/soundcard.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${OSS_DIR}/include/linux/soundcard.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${OSS_DIR}/include/linux/soundcard.h: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${OSS_DIR}/include/linux/soundcard.h" >&5
-echo $ECHO_N "checking for ${OSS_DIR}/include/linux/soundcard.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  OSS_HEADER_FOUND=1
-else
-  OSS_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "xlinux/soundcard.h" != "x" ; then
-            if test "${ac_cv_header_linux_soundcard_h+set}" = set; then
-  { echo "$as_me:$LINENO: checking for linux/soundcard.h" >&5
-echo $ECHO_N "checking for linux/soundcard.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_linux_soundcard_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_linux_soundcard_h" >&5
-echo "${ECHO_T}$ac_cv_header_linux_soundcard_h" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking linux/soundcard.h usability" >&5
-echo $ECHO_N "checking linux/soundcard.h usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <linux/soundcard.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking linux/soundcard.h presence" >&5
-echo $ECHO_N "checking linux/soundcard.h presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <linux/soundcard.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: linux/soundcard.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: linux/soundcard.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: linux/soundcard.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: linux/soundcard.h: proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: linux/soundcard.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: linux/soundcard.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: linux/soundcard.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: linux/soundcard.h: proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
@@ -43355,7 +35181,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${OSS_HEADER_FOUND}" = "x0" ; then
          OSS_LIB=""
@@ -43383,6 +35209,7 @@ fi
 
 if test "x${PBX_OSS}" != "x1" -a "${USE_OSS}" != "no"; then
    pbxlibdir=""
+   # if --with-OSS=DIR has been specified, use it.
    if test "x${OSS_DIR}" != "x"; then
       if test -d ${OSS_DIR}/lib; then
         pbxlibdir="-L${OSS_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_OSS_FOUND}" = "yes"; then
-      OSS_LIB="-lossaudio "
-      OSS_HEADER_FOUND="1"
+      OSS_LIB="${pbxlibdir} -lossaudio "
+      # if --with-OSS=DIR has been specified, use it.
       if test "x${OSS_DIR}" != "x"; then
-         OSS_LIB="${pbxlibdir} ${OSS_LIB}"
         OSS_INCLUDE="-I${OSS_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${OSS_DIR}/include"
-        if test "xsys/soundcard.h" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${OSS_DIR}/include/sys/soundcard.h" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${OSS_DIR}/include/sys/soundcard.h" >&5
-echo $ECHO_N "checking for ${OSS_DIR}/include/sys/soundcard.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${OSS_DIR}/include/sys/soundcard.h usability" >&5
-echo $ECHO_N "checking ${OSS_DIR}/include/sys/soundcard.h usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <${OSS_DIR}/include/sys/soundcard.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking ${OSS_DIR}/include/sys/soundcard.h presence" >&5
-echo $ECHO_N "checking ${OSS_DIR}/include/sys/soundcard.h presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${OSS_DIR}/include/sys/soundcard.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${OSS_DIR}/include/sys/soundcard.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${OSS_DIR}/include/sys/soundcard.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${OSS_DIR}/include/sys/soundcard.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${OSS_DIR}/include/sys/soundcard.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${OSS_DIR}/include/sys/soundcard.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${OSS_DIR}/include/sys/soundcard.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${OSS_DIR}/include/sys/soundcard.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${OSS_DIR}/include/sys/soundcard.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${OSS_DIR}/include/sys/soundcard.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${OSS_DIR}/include/sys/soundcard.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${OSS_DIR}/include/sys/soundcard.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${OSS_DIR}/include/sys/soundcard.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${OSS_DIR}/include/sys/soundcard.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${OSS_DIR}/include/sys/soundcard.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${OSS_DIR}/include/sys/soundcard.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${OSS_DIR}/include/sys/soundcard.h: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${OSS_DIR}/include/sys/soundcard.h" >&5
-echo $ECHO_N "checking for ${OSS_DIR}/include/sys/soundcard.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  OSS_HEADER_FOUND=1
-else
-  OSS_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "xsys/soundcard.h" != "x" ; then
-            if test "${ac_cv_header_sys_soundcard_h+set}" = set; then
+      fi
+      OSS_INCLUDE="${OSS_INCLUDE} "
+      if test "xsys/soundcard.h" = "x" ; then  # no header, assume found
+         OSS_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${OSS_INCLUDE} "
+        if test "${ac_cv_header_sys_soundcard_h+set}" = set; then
   { echo "$as_me:$LINENO: checking for sys/soundcard.h" >&5
 echo $ECHO_N "checking for sys/soundcard.h... $ECHO_C" >&6; }
 if test "${ac_cv_header_sys_soundcard_h+set}" = set; then
@@ -43745,7 +35437,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${OSS_HEADER_FOUND}" = "x0" ; then
          OSS_LIB=""
@@ -43773,6 +35465,7 @@ fi
 
 if test "x${PBX_OSS}" != "x1" -a "${USE_OSS}" != "no"; then
    pbxlibdir=""
+   # if --with-OSS=DIR has been specified, use it.
    if test "x${OSS_DIR}" != "x"; then
       if test -d ${OSS_DIR}/lib; then
         pbxlibdir="-L${OSS_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_OSS_FOUND}" = "yes"; then
-      OSS_LIB="-lossaudio "
-      OSS_HEADER_FOUND="1"
+      OSS_LIB="${pbxlibdir} -lossaudio "
+      # if --with-OSS=DIR has been specified, use it.
       if test "x${OSS_DIR}" != "x"; then
-         OSS_LIB="${pbxlibdir} ${OSS_LIB}"
         OSS_INCLUDE="-I${OSS_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${OSS_DIR}/include"
-        if test "xsoundcard.h" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${OSS_DIR}/include/soundcard.h" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${OSS_DIR}/include/soundcard.h" >&5
-echo $ECHO_N "checking for ${OSS_DIR}/include/soundcard.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+      fi
+      OSS_INCLUDE="${OSS_INCLUDE} "
+      if test "xsoundcard.h" = "x" ; then      # no header, assume found
+         OSS_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${OSS_INCLUDE} "
+        if test "${ac_cv_header_soundcard_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for soundcard.h" >&5
+echo $ECHO_N "checking for soundcard.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_soundcard_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_soundcard_h" >&5
+echo "${ECHO_T}$ac_cv_header_soundcard_h" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${OSS_DIR}/include/soundcard.h usability" >&5
-echo $ECHO_N "checking ${OSS_DIR}/include/soundcard.h usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking soundcard.h usability" >&5
+echo $ECHO_N "checking soundcard.h usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -43885,7 +35580,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <${OSS_DIR}/include/soundcard.h>
+#include <soundcard.h>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -43917,15 +35612,15 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking ${OSS_DIR}/include/soundcard.h presence" >&5
-echo $ECHO_N "checking ${OSS_DIR}/include/soundcard.h presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking soundcard.h presence" >&5
+echo $ECHO_N "checking soundcard.h presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <${OSS_DIR}/include/soundcard.h>
+#include <soundcard.h>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -43958,147 +35653,10 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${OSS_DIR}/include/soundcard.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${OSS_DIR}/include/soundcard.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${OSS_DIR}/include/soundcard.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${OSS_DIR}/include/soundcard.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${OSS_DIR}/include/soundcard.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${OSS_DIR}/include/soundcard.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${OSS_DIR}/include/soundcard.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${OSS_DIR}/include/soundcard.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${OSS_DIR}/include/soundcard.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${OSS_DIR}/include/soundcard.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${OSS_DIR}/include/soundcard.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${OSS_DIR}/include/soundcard.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${OSS_DIR}/include/soundcard.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${OSS_DIR}/include/soundcard.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${OSS_DIR}/include/soundcard.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${OSS_DIR}/include/soundcard.h: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${OSS_DIR}/include/soundcard.h" >&5
-echo $ECHO_N "checking for ${OSS_DIR}/include/soundcard.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  OSS_HEADER_FOUND=1
-else
-  OSS_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "xsoundcard.h" != "x" ; then
-            if test "${ac_cv_header_soundcard_h+set}" = set; then
-  { echo "$as_me:$LINENO: checking for soundcard.h" >&5
-echo $ECHO_N "checking for soundcard.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_soundcard_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_soundcard_h" >&5
-echo "${ECHO_T}$ac_cv_header_soundcard_h" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking soundcard.h usability" >&5
-echo $ECHO_N "checking soundcard.h usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <soundcard.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking soundcard.h presence" >&5
-echo $ECHO_N "checking soundcard.h presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <soundcard.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: soundcard.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: soundcard.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: soundcard.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: soundcard.h: proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: soundcard.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: soundcard.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: soundcard.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: soundcard.h: proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
@@ -44135,7 +35693,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${OSS_HEADER_FOUND}" = "x0" ; then
          OSS_LIB=""
@@ -44492,6 +36050,7 @@ fi
 
 if test "x${PBX_POPT}" != "x1" -a "${USE_POPT}" != "no"; then
    pbxlibdir=""
+   # if --with-POPT=DIR has been specified, use it.
    if test "x${POPT_DIR}" != "x"; then
       if test -d ${POPT_DIR}/lib; then
         pbxlibdir="-L${POPT_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_POPT_FOUND}" = "yes"; then
-      POPT_LIB="-lpopt "
-      POPT_HEADER_FOUND="1"
+      POPT_LIB="${pbxlibdir} -lpopt "
+      # if --with-POPT=DIR has been specified, use it.
       if test "x${POPT_DIR}" != "x"; then
-         POPT_LIB="${pbxlibdir} ${POPT_LIB}"
         POPT_INCLUDE="-I${POPT_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${POPT_DIR}/include"
-        if test "xpopt.h" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${POPT_DIR}/include/popt.h" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${POPT_DIR}/include/popt.h" >&5
-echo $ECHO_N "checking for ${POPT_DIR}/include/popt.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${POPT_DIR}/include/popt.h usability" >&5
-echo $ECHO_N "checking ${POPT_DIR}/include/popt.h usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <${POPT_DIR}/include/popt.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking ${POPT_DIR}/include/popt.h presence" >&5
-echo $ECHO_N "checking ${POPT_DIR}/include/popt.h presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${POPT_DIR}/include/popt.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${POPT_DIR}/include/popt.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${POPT_DIR}/include/popt.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${POPT_DIR}/include/popt.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${POPT_DIR}/include/popt.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${POPT_DIR}/include/popt.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${POPT_DIR}/include/popt.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${POPT_DIR}/include/popt.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${POPT_DIR}/include/popt.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${POPT_DIR}/include/popt.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${POPT_DIR}/include/popt.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${POPT_DIR}/include/popt.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${POPT_DIR}/include/popt.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${POPT_DIR}/include/popt.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${POPT_DIR}/include/popt.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${POPT_DIR}/include/popt.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${POPT_DIR}/include/popt.h: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${POPT_DIR}/include/popt.h" >&5
-echo $ECHO_N "checking for ${POPT_DIR}/include/popt.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  POPT_HEADER_FOUND=1
-else
-  POPT_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "xpopt.h" != "x" ; then
-            if test "${ac_cv_header_popt_h+set}" = set; then
+      fi
+      POPT_INCLUDE="${POPT_INCLUDE} "
+      if test "xpopt.h" = "x" ; then   # no header, assume found
+         POPT_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${POPT_INCLUDE} "
+        if test "${ac_cv_header_popt_h+set}" = set; then
   { echo "$as_me:$LINENO: checking for popt.h" >&5
 echo $ECHO_N "checking for popt.h... $ECHO_C" >&6; }
 if test "${ac_cv_header_popt_h+set}" = set; then
@@ -44854,7 +36278,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${POPT_HEADER_FOUND}" = "x0" ; then
          POPT_LIB=""
@@ -44883,6 +36307,7 @@ fi
 
 if test "x${PBX_PRI}" != "x1" -a "${USE_PRI}" != "no"; then
    pbxlibdir=""
+   # if --with-PRI=DIR has been specified, use it.
    if test "x${PRI_DIR}" != "x"; then
       if test -d ${PRI_DIR}/lib; then
         pbxlibdir="-L${PRI_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_PRI_FOUND}" = "yes"; then
-      PRI_LIB="-lpri "
-      PRI_HEADER_FOUND="1"
+      PRI_LIB="${pbxlibdir} -lpri "
+      # if --with-PRI=DIR has been specified, use it.
       if test "x${PRI_DIR}" != "x"; then
-         PRI_LIB="${pbxlibdir} ${PRI_LIB}"
         PRI_INCLUDE="-I${PRI_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${PRI_DIR}/include"
-        if test "xlibpri.h" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${PRI_DIR}/include/libpri.h" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${PRI_DIR}/include/libpri.h" >&5
-echo $ECHO_N "checking for ${PRI_DIR}/include/libpri.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+      fi
+      PRI_INCLUDE="${PRI_INCLUDE} "
+      if test "xlibpri.h" = "x" ; then # no header, assume found
+         PRI_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${PRI_INCLUDE} "
+        if test "${ac_cv_header_libpri_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for libpri.h" >&5
+echo $ECHO_N "checking for libpri.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_libpri_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_libpri_h" >&5
+echo "${ECHO_T}$ac_cv_header_libpri_h" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${PRI_DIR}/include/libpri.h usability" >&5
-echo $ECHO_N "checking ${PRI_DIR}/include/libpri.h usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking libpri.h usability" >&5
+echo $ECHO_N "checking libpri.h usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -44995,7 +36422,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <${PRI_DIR}/include/libpri.h>
+#include <libpri.h>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -45027,15 +36454,15 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking ${PRI_DIR}/include/libpri.h presence" >&5
-echo $ECHO_N "checking ${PRI_DIR}/include/libpri.h presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking libpri.h presence" >&5
+echo $ECHO_N "checking libpri.h presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <${PRI_DIR}/include/libpri.h>
+#include <libpri.h>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -45068,147 +36495,10 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${PRI_DIR}/include/libpri.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${PRI_DIR}/include/libpri.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${PRI_DIR}/include/libpri.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${PRI_DIR}/include/libpri.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${PRI_DIR}/include/libpri.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${PRI_DIR}/include/libpri.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${PRI_DIR}/include/libpri.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${PRI_DIR}/include/libpri.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${PRI_DIR}/include/libpri.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${PRI_DIR}/include/libpri.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${PRI_DIR}/include/libpri.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${PRI_DIR}/include/libpri.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${PRI_DIR}/include/libpri.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${PRI_DIR}/include/libpri.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${PRI_DIR}/include/libpri.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${PRI_DIR}/include/libpri.h: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${PRI_DIR}/include/libpri.h" >&5
-echo $ECHO_N "checking for ${PRI_DIR}/include/libpri.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  PRI_HEADER_FOUND=1
-else
-  PRI_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "xlibpri.h" != "x" ; then
-            if test "${ac_cv_header_libpri_h+set}" = set; then
-  { echo "$as_me:$LINENO: checking for libpri.h" >&5
-echo $ECHO_N "checking for libpri.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_libpri_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_libpri_h" >&5
-echo "${ECHO_T}$ac_cv_header_libpri_h" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking libpri.h usability" >&5
-echo $ECHO_N "checking libpri.h usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <libpri.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking libpri.h presence" >&5
-echo $ECHO_N "checking libpri.h presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <libpri.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: libpri.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: libpri.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: libpri.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: libpri.h: proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: libpri.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: libpri.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: libpri.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: libpri.h: proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
@@ -45245,7 +36535,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${PRI_HEADER_FOUND}" = "x0" ; then
          PRI_LIB=""
@@ -45274,6 +36564,7 @@ fi
 
 if test "x${PBX_SS7}" != "x1" -a "${USE_SS7}" != "no"; then
    pbxlibdir=""
+   # if --with-SS7=DIR has been specified, use it.
    if test "x${SS7_DIR}" != "x"; then
       if test -d ${SS7_DIR}/lib; then
         pbxlibdir="-L${SS7_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_SS7_FOUND}" = "yes"; then
-      SS7_LIB="-lss7 "
-      SS7_HEADER_FOUND="1"
+      SS7_LIB="${pbxlibdir} -lss7 "
+      # if --with-SS7=DIR has been specified, use it.
       if test "x${SS7_DIR}" != "x"; then
-         SS7_LIB="${pbxlibdir} ${SS7_LIB}"
         SS7_INCLUDE="-I${SS7_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${SS7_DIR}/include"
-        if test "xlibss7.h" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${SS7_DIR}/include/libss7.h" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${SS7_DIR}/include/libss7.h" >&5
-echo $ECHO_N "checking for ${SS7_DIR}/include/libss7.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${SS7_DIR}/include/libss7.h usability" >&5
-echo $ECHO_N "checking ${SS7_DIR}/include/libss7.h usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <${SS7_DIR}/include/libss7.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking ${SS7_DIR}/include/libss7.h presence" >&5
-echo $ECHO_N "checking ${SS7_DIR}/include/libss7.h presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${SS7_DIR}/include/libss7.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${SS7_DIR}/include/libss7.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${SS7_DIR}/include/libss7.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SS7_DIR}/include/libss7.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${SS7_DIR}/include/libss7.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${SS7_DIR}/include/libss7.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${SS7_DIR}/include/libss7.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SS7_DIR}/include/libss7.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${SS7_DIR}/include/libss7.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SS7_DIR}/include/libss7.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${SS7_DIR}/include/libss7.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SS7_DIR}/include/libss7.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${SS7_DIR}/include/libss7.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SS7_DIR}/include/libss7.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${SS7_DIR}/include/libss7.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SS7_DIR}/include/libss7.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${SS7_DIR}/include/libss7.h: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${SS7_DIR}/include/libss7.h" >&5
-echo $ECHO_N "checking for ${SS7_DIR}/include/libss7.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  SS7_HEADER_FOUND=1
-else
-  SS7_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "xlibss7.h" != "x" ; then
-            if test "${ac_cv_header_libss7_h+set}" = set; then
+      fi
+      SS7_INCLUDE="${SS7_INCLUDE} "
+      if test "xlibss7.h" = "x" ; then # no header, assume found
+         SS7_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${SS7_INCLUDE} "
+        if test "${ac_cv_header_libss7_h+set}" = set; then
   { echo "$as_me:$LINENO: checking for libss7.h" >&5
 echo $ECHO_N "checking for libss7.h... $ECHO_C" >&6; }
 if test "${ac_cv_header_libss7_h+set}" = set; then
@@ -45636,7 +36792,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${SS7_HEADER_FOUND}" = "x0" ; then
          SS7_LIB=""
@@ -47924,6 +39080,7 @@ LUA_LIB="-llua5.1"
 
 if test "x${PBX_LUA}" != "x1" -a "${USE_LUA}" != "no"; then
    pbxlibdir=""
+   # if --with-LUA=DIR has been specified, use it.
    if test "x${LUA_DIR}" != "x"; then
       if test -d ${LUA_DIR}/lib; then
         pbxlibdir="-L${LUA_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_LUA_FOUND}" = "yes"; then
-      LUA_LIB="-llua5.1 "
-      LUA_HEADER_FOUND="1"
+      LUA_LIB="${pbxlibdir} -llua5.1 "
+      # if --with-LUA=DIR has been specified, use it.
       if test "x${LUA_DIR}" != "x"; then
-         LUA_LIB="${pbxlibdir} ${LUA_LIB}"
         LUA_INCLUDE="-I${LUA_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${LUA_DIR}/include"
-        if test "xlua5.1/lua.h" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${LUA_DIR}/include/lua5.1/lua.h" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${LUA_DIR}/include/lua5.1/lua.h" >&5
-echo $ECHO_N "checking for ${LUA_DIR}/include/lua5.1/lua.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+      fi
+      LUA_INCLUDE="${LUA_INCLUDE} "
+      if test "xlua5.1/lua.h" = "x" ; then     # no header, assume found
+         LUA_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${LUA_INCLUDE} "
+        if test "${ac_cv_header_lua5_1_lua_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for lua5.1/lua.h" >&5
+echo $ECHO_N "checking for lua5.1/lua.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_lua5_1_lua_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_lua5_1_lua_h" >&5
+echo "${ECHO_T}$ac_cv_header_lua5_1_lua_h" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${LUA_DIR}/include/lua5.1/lua.h usability" >&5
-echo $ECHO_N "checking ${LUA_DIR}/include/lua5.1/lua.h usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking lua5.1/lua.h usability" >&5
+echo $ECHO_N "checking lua5.1/lua.h usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -48036,7 +39195,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <${LUA_DIR}/include/lua5.1/lua.h>
+#include <lua5.1/lua.h>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -48068,152 +39227,15 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking ${LUA_DIR}/include/lua5.1/lua.h presence" >&5
-echo $ECHO_N "checking ${LUA_DIR}/include/lua5.1/lua.h presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking lua5.1/lua.h presence" >&5
+echo $ECHO_N "checking lua5.1/lua.h presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <${LUA_DIR}/include/lua5.1/lua.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${LUA_DIR}/include/lua5.1/lua.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${LUA_DIR}/include/lua5.1/lua.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${LUA_DIR}/include/lua5.1/lua.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${LUA_DIR}/include/lua5.1/lua.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${LUA_DIR}/include/lua5.1/lua.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${LUA_DIR}/include/lua5.1/lua.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${LUA_DIR}/include/lua5.1/lua.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${LUA_DIR}/include/lua5.1/lua.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${LUA_DIR}/include/lua5.1/lua.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${LUA_DIR}/include/lua5.1/lua.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${LUA_DIR}/include/lua5.1/lua.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${LUA_DIR}/include/lua5.1/lua.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${LUA_DIR}/include/lua5.1/lua.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${LUA_DIR}/include/lua5.1/lua.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${LUA_DIR}/include/lua5.1/lua.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${LUA_DIR}/include/lua5.1/lua.h: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${LUA_DIR}/include/lua5.1/lua.h" >&5
-echo $ECHO_N "checking for ${LUA_DIR}/include/lua5.1/lua.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  LUA_HEADER_FOUND=1
-else
-  LUA_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "xlua5.1/lua.h" != "x" ; then
-            if test "${ac_cv_header_lua5_1_lua_h+set}" = set; then
-  { echo "$as_me:$LINENO: checking for lua5.1/lua.h" >&5
-echo $ECHO_N "checking for lua5.1/lua.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_lua5_1_lua_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_lua5_1_lua_h" >&5
-echo "${ECHO_T}$ac_cv_header_lua5_1_lua_h" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking lua5.1/lua.h usability" >&5
-echo $ECHO_N "checking lua5.1/lua.h usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <lua5.1/lua.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking lua5.1/lua.h presence" >&5
-echo $ECHO_N "checking lua5.1/lua.h presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <lua5.1/lua.h>
+#include <lua5.1/lua.h>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -48286,7 +39308,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${LUA_HEADER_FOUND}" = "x0" ; then
          LUA_LIB=""
@@ -48315,6 +39337,7 @@ fi
 
 if test "x${PBX_RADIUS}" != "x1" -a "${USE_RADIUS}" != "no"; then
    pbxlibdir=""
+   # if --with-RADIUS=DIR has been specified, use it.
    if test "x${RADIUS_DIR}" != "x"; then
       if test -d ${RADIUS_DIR}/lib; then
         pbxlibdir="-L${RADIUS_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_RADIUS_FOUND}" = "yes"; then
-      RADIUS_LIB="-lradiusclient-ng "
-      RADIUS_HEADER_FOUND="1"
+      RADIUS_LIB="${pbxlibdir} -lradiusclient-ng "
+      # if --with-RADIUS=DIR has been specified, use it.
       if test "x${RADIUS_DIR}" != "x"; then
-         RADIUS_LIB="${pbxlibdir} ${RADIUS_LIB}"
         RADIUS_INCLUDE="-I${RADIUS_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${RADIUS_DIR}/include"
-        if test "xradiusclient-ng.h" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${RADIUS_DIR}/include/radiusclient-ng.h" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${RADIUS_DIR}/include/radiusclient-ng.h" >&5
-echo $ECHO_N "checking for ${RADIUS_DIR}/include/radiusclient-ng.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${RADIUS_DIR}/include/radiusclient-ng.h usability" >&5
-echo $ECHO_N "checking ${RADIUS_DIR}/include/radiusclient-ng.h usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <${RADIUS_DIR}/include/radiusclient-ng.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking ${RADIUS_DIR}/include/radiusclient-ng.h presence" >&5
-echo $ECHO_N "checking ${RADIUS_DIR}/include/radiusclient-ng.h presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${RADIUS_DIR}/include/radiusclient-ng.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${RADIUS_DIR}/include/radiusclient-ng.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${RADIUS_DIR}/include/radiusclient-ng.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${RADIUS_DIR}/include/radiusclient-ng.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${RADIUS_DIR}/include/radiusclient-ng.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${RADIUS_DIR}/include/radiusclient-ng.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${RADIUS_DIR}/include/radiusclient-ng.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${RADIUS_DIR}/include/radiusclient-ng.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${RADIUS_DIR}/include/radiusclient-ng.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${RADIUS_DIR}/include/radiusclient-ng.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${RADIUS_DIR}/include/radiusclient-ng.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${RADIUS_DIR}/include/radiusclient-ng.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${RADIUS_DIR}/include/radiusclient-ng.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${RADIUS_DIR}/include/radiusclient-ng.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${RADIUS_DIR}/include/radiusclient-ng.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${RADIUS_DIR}/include/radiusclient-ng.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${RADIUS_DIR}/include/radiusclient-ng.h: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${RADIUS_DIR}/include/radiusclient-ng.h" >&5
-echo $ECHO_N "checking for ${RADIUS_DIR}/include/radiusclient-ng.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  RADIUS_HEADER_FOUND=1
-else
-  RADIUS_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "xradiusclient-ng.h" != "x" ; then
-            if test "${ac_cv_header_radiusclient_ng_h+set}" = set; then
+      fi
+      RADIUS_INCLUDE="${RADIUS_INCLUDE} "
+      if test "xradiusclient-ng.h" = "x" ; then        # no header, assume found
+         RADIUS_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${RADIUS_INCLUDE} "
+        if test "${ac_cv_header_radiusclient_ng_h+set}" = set; then
   { echo "$as_me:$LINENO: checking for radiusclient-ng.h" >&5
 echo $ECHO_N "checking for radiusclient-ng.h... $ECHO_C" >&6; }
 if test "${ac_cv_header_radiusclient_ng_h+set}" = set; then
@@ -48677,7 +39565,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${RADIUS_HEADER_FOUND}" = "x0" ; then
          RADIUS_LIB=""
@@ -48706,6 +39594,7 @@ fi
 
 if test "x${PBX_SPEEX}" != "x1" -a "${USE_SPEEX}" != "no"; then
    pbxlibdir=""
+   # if --with-SPEEX=DIR has been specified, use it.
    if test "x${SPEEX_DIR}" != "x"; then
       if test -d ${SPEEX_DIR}/lib; then
         pbxlibdir="-L${SPEEX_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_SPEEX_FOUND}" = "yes"; then
-      SPEEX_LIB="-lspeex -lm"
-      SPEEX_HEADER_FOUND="1"
+      SPEEX_LIB="${pbxlibdir} -lspeex -lm"
+      # if --with-SPEEX=DIR has been specified, use it.
       if test "x${SPEEX_DIR}" != "x"; then
-         SPEEX_LIB="${pbxlibdir} ${SPEEX_LIB}"
         SPEEX_INCLUDE="-I${SPEEX_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${SPEEX_DIR}/include"
-        if test "xspeex/speex.h" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${SPEEX_DIR}/include/speex/speex.h" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${SPEEX_DIR}/include/speex/speex.h" >&5
-echo $ECHO_N "checking for ${SPEEX_DIR}/include/speex/speex.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+      fi
+      SPEEX_INCLUDE="${SPEEX_INCLUDE} "
+      if test "xspeex/speex.h" = "x" ; then    # no header, assume found
+         SPEEX_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${SPEEX_INCLUDE} "
+        if test "${ac_cv_header_speex_speex_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for speex/speex.h" >&5
+echo $ECHO_N "checking for speex/speex.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_speex_speex_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_speex_speex_h" >&5
+echo "${ECHO_T}$ac_cv_header_speex_speex_h" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${SPEEX_DIR}/include/speex/speex.h usability" >&5
-echo $ECHO_N "checking ${SPEEX_DIR}/include/speex/speex.h usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking speex/speex.h usability" >&5
+echo $ECHO_N "checking speex/speex.h usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -48818,7 +39709,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <${SPEEX_DIR}/include/speex/speex.h>
+#include <speex/speex.h>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -48850,15 +39741,15 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking ${SPEEX_DIR}/include/speex/speex.h presence" >&5
-echo $ECHO_N "checking ${SPEEX_DIR}/include/speex/speex.h presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking speex/speex.h presence" >&5
+echo $ECHO_N "checking speex/speex.h presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <${SPEEX_DIR}/include/speex/speex.h>
+#include <speex/speex.h>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -48891,147 +39782,10 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${SPEEX_DIR}/include/speex/speex.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${SPEEX_DIR}/include/speex/speex.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SPEEX_DIR}/include/speex/speex.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${SPEEX_DIR}/include/speex/speex.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${SPEEX_DIR}/include/speex/speex.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${SPEEX_DIR}/include/speex/speex.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SPEEX_DIR}/include/speex/speex.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${SPEEX_DIR}/include/speex/speex.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SPEEX_DIR}/include/speex/speex.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${SPEEX_DIR}/include/speex/speex.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SPEEX_DIR}/include/speex/speex.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${SPEEX_DIR}/include/speex/speex.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SPEEX_DIR}/include/speex/speex.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${SPEEX_DIR}/include/speex/speex.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SPEEX_DIR}/include/speex/speex.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${SPEEX_DIR}/include/speex/speex.h: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${SPEEX_DIR}/include/speex/speex.h" >&5
-echo $ECHO_N "checking for ${SPEEX_DIR}/include/speex/speex.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  SPEEX_HEADER_FOUND=1
-else
-  SPEEX_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "xspeex/speex.h" != "x" ; then
-            if test "${ac_cv_header_speex_speex_h+set}" = set; then
-  { echo "$as_me:$LINENO: checking for speex/speex.h" >&5
-echo $ECHO_N "checking for speex/speex.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_speex_speex_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_speex_speex_h" >&5
-echo "${ECHO_T}$ac_cv_header_speex_speex_h" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking speex/speex.h usability" >&5
-echo $ECHO_N "checking speex/speex.h usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <speex/speex.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking speex/speex.h presence" >&5
-echo $ECHO_N "checking speex/speex.h presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <speex/speex.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: speex/speex.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: speex/speex.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: speex/speex.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: speex/speex.h: proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: speex/speex.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: speex/speex.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: speex/speex.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: speex/speex.h: proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
@@ -49068,7 +39822,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${SPEEX_HEADER_FOUND}" = "x0" ; then
          SPEEX_LIB=""
@@ -49097,6 +39851,7 @@ fi
 
 if test "x${PBX_SQLITE}" != "x1" -a "${USE_SQLITE}" != "no"; then
    pbxlibdir=""
+   # if --with-SQLITE=DIR has been specified, use it.
    if test "x${SQLITE_DIR}" != "x"; then
       if test -d ${SQLITE_DIR}/lib; then
         pbxlibdir="-L${SQLITE_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_SQLITE_FOUND}" = "yes"; then
-      SQLITE_LIB="-lsqlite "
-      SQLITE_HEADER_FOUND="1"
+      SQLITE_LIB="${pbxlibdir} -lsqlite "
+      # if --with-SQLITE=DIR has been specified, use it.
       if test "x${SQLITE_DIR}" != "x"; then
-         SQLITE_LIB="${pbxlibdir} ${SQLITE_LIB}"
         SQLITE_INCLUDE="-I${SQLITE_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${SQLITE_DIR}/include"
-        if test "xsqlite.h" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${SQLITE_DIR}/include/sqlite.h" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${SQLITE_DIR}/include/sqlite.h" >&5
-echo $ECHO_N "checking for ${SQLITE_DIR}/include/sqlite.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${SQLITE_DIR}/include/sqlite.h usability" >&5
-echo $ECHO_N "checking ${SQLITE_DIR}/include/sqlite.h usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <${SQLITE_DIR}/include/sqlite.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking ${SQLITE_DIR}/include/sqlite.h presence" >&5
-echo $ECHO_N "checking ${SQLITE_DIR}/include/sqlite.h presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${SQLITE_DIR}/include/sqlite.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${SQLITE_DIR}/include/sqlite.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${SQLITE_DIR}/include/sqlite.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SQLITE_DIR}/include/sqlite.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${SQLITE_DIR}/include/sqlite.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${SQLITE_DIR}/include/sqlite.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${SQLITE_DIR}/include/sqlite.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SQLITE_DIR}/include/sqlite.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${SQLITE_DIR}/include/sqlite.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SQLITE_DIR}/include/sqlite.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${SQLITE_DIR}/include/sqlite.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SQLITE_DIR}/include/sqlite.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${SQLITE_DIR}/include/sqlite.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SQLITE_DIR}/include/sqlite.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${SQLITE_DIR}/include/sqlite.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SQLITE_DIR}/include/sqlite.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${SQLITE_DIR}/include/sqlite.h: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${SQLITE_DIR}/include/sqlite.h" >&5
-echo $ECHO_N "checking for ${SQLITE_DIR}/include/sqlite.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  SQLITE_HEADER_FOUND=1
-else
-  SQLITE_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "xsqlite.h" != "x" ; then
-            if test "${ac_cv_header_sqlite_h+set}" = set; then
+      fi
+      SQLITE_INCLUDE="${SQLITE_INCLUDE} "
+      if test "xsqlite.h" = "x" ; then # no header, assume found
+         SQLITE_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${SQLITE_INCLUDE} "
+        if test "${ac_cv_header_sqlite_h+set}" = set; then
   { echo "$as_me:$LINENO: checking for sqlite.h" >&5
 echo $ECHO_N "checking for sqlite.h... $ECHO_C" >&6; }
 if test "${ac_cv_header_sqlite_h+set}" = set; then
@@ -49459,7 +40079,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${SQLITE_HEADER_FOUND}" = "x0" ; then
          SQLITE_LIB=""
@@ -49488,6 +40108,7 @@ fi
 
 if test "x${PBX_SQLITE3}" != "x1" -a "${USE_SQLITE3}" != "no"; then
    pbxlibdir=""
+   # if --with-SQLITE3=DIR has been specified, use it.
    if test "x${SQLITE3_DIR}" != "x"; then
       if test -d ${SQLITE3_DIR}/lib; then
         pbxlibdir="-L${SQLITE3_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_SQLITE3_FOUND}" = "yes"; then
-      SQLITE3_LIB="-lsqlite3 "
-      SQLITE3_HEADER_FOUND="1"
+      SQLITE3_LIB="${pbxlibdir} -lsqlite3 "
+      # if --with-SQLITE3=DIR has been specified, use it.
       if test "x${SQLITE3_DIR}" != "x"; then
-         SQLITE3_LIB="${pbxlibdir} ${SQLITE3_LIB}"
         SQLITE3_INCLUDE="-I${SQLITE3_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${SQLITE3_DIR}/include"
-        if test "xsqlite3.h" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${SQLITE3_DIR}/include/sqlite3.h" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${SQLITE3_DIR}/include/sqlite3.h" >&5
-echo $ECHO_N "checking for ${SQLITE3_DIR}/include/sqlite3.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+      fi
+      SQLITE3_INCLUDE="${SQLITE3_INCLUDE} "
+      if test "xsqlite3.h" = "x" ; then        # no header, assume found
+         SQLITE3_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${SQLITE3_INCLUDE} "
+        if test "${ac_cv_header_sqlite3_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for sqlite3.h" >&5
+echo $ECHO_N "checking for sqlite3.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_sqlite3_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_sqlite3_h" >&5
+echo "${ECHO_T}$ac_cv_header_sqlite3_h" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${SQLITE3_DIR}/include/sqlite3.h usability" >&5
-echo $ECHO_N "checking ${SQLITE3_DIR}/include/sqlite3.h usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking sqlite3.h usability" >&5
+echo $ECHO_N "checking sqlite3.h usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -49600,7 +40223,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <${SQLITE3_DIR}/include/sqlite3.h>
+#include <sqlite3.h>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -49632,15 +40255,15 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking ${SQLITE3_DIR}/include/sqlite3.h presence" >&5
-echo $ECHO_N "checking ${SQLITE3_DIR}/include/sqlite3.h presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking sqlite3.h presence" >&5
+echo $ECHO_N "checking sqlite3.h presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <${SQLITE3_DIR}/include/sqlite3.h>
+#include <sqlite3.h>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -49673,147 +40296,10 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${SQLITE3_DIR}/include/sqlite3.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${SQLITE3_DIR}/include/sqlite3.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SQLITE3_DIR}/include/sqlite3.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${SQLITE3_DIR}/include/sqlite3.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${SQLITE3_DIR}/include/sqlite3.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${SQLITE3_DIR}/include/sqlite3.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SQLITE3_DIR}/include/sqlite3.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${SQLITE3_DIR}/include/sqlite3.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SQLITE3_DIR}/include/sqlite3.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${SQLITE3_DIR}/include/sqlite3.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SQLITE3_DIR}/include/sqlite3.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${SQLITE3_DIR}/include/sqlite3.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SQLITE3_DIR}/include/sqlite3.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${SQLITE3_DIR}/include/sqlite3.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SQLITE3_DIR}/include/sqlite3.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${SQLITE3_DIR}/include/sqlite3.h: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${SQLITE3_DIR}/include/sqlite3.h" >&5
-echo $ECHO_N "checking for ${SQLITE3_DIR}/include/sqlite3.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  SQLITE3_HEADER_FOUND=1
-else
-  SQLITE3_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "xsqlite3.h" != "x" ; then
-            if test "${ac_cv_header_sqlite3_h+set}" = set; then
-  { echo "$as_me:$LINENO: checking for sqlite3.h" >&5
-echo $ECHO_N "checking for sqlite3.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_sqlite3_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_sqlite3_h" >&5
-echo "${ECHO_T}$ac_cv_header_sqlite3_h" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking sqlite3.h usability" >&5
-echo $ECHO_N "checking sqlite3.h usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <sqlite3.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking sqlite3.h presence" >&5
-echo $ECHO_N "checking sqlite3.h presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <sqlite3.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: sqlite3.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: sqlite3.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: sqlite3.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: sqlite3.h: proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: sqlite3.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: sqlite3.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: sqlite3.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: sqlite3.h: proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
@@ -49850,7 +40336,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${SQLITE3_HEADER_FOUND}" = "x0" ; then
          SQLITE3_LIB=""
@@ -49879,6 +40365,7 @@ fi
 
 if test "x${PBX_CRYPTO}" != "x1" -a "${USE_CRYPTO}" != "no"; then
    pbxlibdir=""
+   # if --with-CRYPTO=DIR has been specified, use it.
    if test "x${CRYPTO_DIR}" != "x"; then
       if test -d ${CRYPTO_DIR}/lib; then
         pbxlibdir="-L${CRYPTO_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_CRYPTO_FOUND}" = "yes"; then
-      CRYPTO_LIB="-lcrypto "
-      CRYPTO_HEADER_FOUND="1"
+      CRYPTO_LIB="${pbxlibdir} -lcrypto "
+      # if --with-CRYPTO=DIR has been specified, use it.
       if test "x${CRYPTO_DIR}" != "x"; then
-         CRYPTO_LIB="${pbxlibdir} ${CRYPTO_LIB}"
         CRYPTO_INCLUDE="-I${CRYPTO_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${CRYPTO_DIR}/include"
-        if test "xopenssl/aes.h" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${CRYPTO_DIR}/include/openssl/aes.h" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${CRYPTO_DIR}/include/openssl/aes.h" >&5
-echo $ECHO_N "checking for ${CRYPTO_DIR}/include/openssl/aes.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${CRYPTO_DIR}/include/openssl/aes.h usability" >&5
-echo $ECHO_N "checking ${CRYPTO_DIR}/include/openssl/aes.h usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <${CRYPTO_DIR}/include/openssl/aes.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking ${CRYPTO_DIR}/include/openssl/aes.h presence" >&5
-echo $ECHO_N "checking ${CRYPTO_DIR}/include/openssl/aes.h presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${CRYPTO_DIR}/include/openssl/aes.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${CRYPTO_DIR}/include/openssl/aes.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${CRYPTO_DIR}/include/openssl/aes.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${CRYPTO_DIR}/include/openssl/aes.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${CRYPTO_DIR}/include/openssl/aes.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${CRYPTO_DIR}/include/openssl/aes.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${CRYPTO_DIR}/include/openssl/aes.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${CRYPTO_DIR}/include/openssl/aes.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${CRYPTO_DIR}/include/openssl/aes.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${CRYPTO_DIR}/include/openssl/aes.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${CRYPTO_DIR}/include/openssl/aes.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${CRYPTO_DIR}/include/openssl/aes.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${CRYPTO_DIR}/include/openssl/aes.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${CRYPTO_DIR}/include/openssl/aes.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${CRYPTO_DIR}/include/openssl/aes.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${CRYPTO_DIR}/include/openssl/aes.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${CRYPTO_DIR}/include/openssl/aes.h: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${CRYPTO_DIR}/include/openssl/aes.h" >&5
-echo $ECHO_N "checking for ${CRYPTO_DIR}/include/openssl/aes.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  CRYPTO_HEADER_FOUND=1
-else
-  CRYPTO_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "xopenssl/aes.h" != "x" ; then
-            if test "${ac_cv_header_openssl_aes_h+set}" = set; then
+      fi
+      CRYPTO_INCLUDE="${CRYPTO_INCLUDE} "
+      if test "xopenssl/aes.h" = "x" ; then    # no header, assume found
+         CRYPTO_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${CRYPTO_INCLUDE} "
+        if test "${ac_cv_header_openssl_aes_h+set}" = set; then
   { echo "$as_me:$LINENO: checking for openssl/aes.h" >&5
 echo $ECHO_N "checking for openssl/aes.h... $ECHO_C" >&6; }
 if test "${ac_cv_header_openssl_aes_h+set}" = set; then
@@ -50241,7 +40593,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${CRYPTO_HEADER_FOUND}" = "x0" ; then
          CRYPTO_LIB=""
@@ -50272,6 +40624,7 @@ then
 
 if test "x${PBX_OPENSSL}" != "x1" -a "${USE_OPENSSL}" != "no"; then
    pbxlibdir=""
+   # if --with-OPENSSL=DIR has been specified, use it.
    if test "x${OPENSSL_DIR}" != "x"; then
       if test -d ${OPENSSL_DIR}/lib; then
         pbxlibdir="-L${OPENSSL_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_OPENSSL_FOUND}" = "yes"; then
-      OPENSSL_LIB="-lssl -lcrypto"
-      OPENSSL_HEADER_FOUND="1"
+      OPENSSL_LIB="${pbxlibdir} -lssl -lcrypto"
+      # if --with-OPENSSL=DIR has been specified, use it.
       if test "x${OPENSSL_DIR}" != "x"; then
-         OPENSSL_LIB="${pbxlibdir} ${OPENSSL_LIB}"
         OPENSSL_INCLUDE="-I${OPENSSL_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${OPENSSL_DIR}/include"
-        if test "xopenssl/ssl.h" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${OPENSSL_DIR}/include/openssl/ssl.h" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${OPENSSL_DIR}/include/openssl/ssl.h" >&5
-echo $ECHO_N "checking for ${OPENSSL_DIR}/include/openssl/ssl.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+      fi
+      OPENSSL_INCLUDE="${OPENSSL_INCLUDE} "
+      if test "xopenssl/ssl.h" = "x" ; then    # no header, assume found
+         OPENSSL_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${OPENSSL_INCLUDE} "
+        if test "${ac_cv_header_openssl_ssl_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for openssl/ssl.h" >&5
+echo $ECHO_N "checking for openssl/ssl.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_openssl_ssl_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_openssl_ssl_h" >&5
+echo "${ECHO_T}$ac_cv_header_openssl_ssl_h" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${OPENSSL_DIR}/include/openssl/ssl.h usability" >&5
-echo $ECHO_N "checking ${OPENSSL_DIR}/include/openssl/ssl.h usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking openssl/ssl.h usability" >&5
+echo $ECHO_N "checking openssl/ssl.h usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -50384,7 +40739,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <${OPENSSL_DIR}/include/openssl/ssl.h>
+#include <openssl/ssl.h>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -50416,15 +40771,15 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking ${OPENSSL_DIR}/include/openssl/ssl.h presence" >&5
-echo $ECHO_N "checking ${OPENSSL_DIR}/include/openssl/ssl.h presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking openssl/ssl.h presence" >&5
+echo $ECHO_N "checking openssl/ssl.h presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <${OPENSSL_DIR}/include/openssl/ssl.h>
+#include <openssl/ssl.h>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -50457,147 +40812,10 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${OPENSSL_DIR}/include/openssl/ssl.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${OPENSSL_DIR}/include/openssl/ssl.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${OPENSSL_DIR}/include/openssl/ssl.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${OPENSSL_DIR}/include/openssl/ssl.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${OPENSSL_DIR}/include/openssl/ssl.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${OPENSSL_DIR}/include/openssl/ssl.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${OPENSSL_DIR}/include/openssl/ssl.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${OPENSSL_DIR}/include/openssl/ssl.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${OPENSSL_DIR}/include/openssl/ssl.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${OPENSSL_DIR}/include/openssl/ssl.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${OPENSSL_DIR}/include/openssl/ssl.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${OPENSSL_DIR}/include/openssl/ssl.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${OPENSSL_DIR}/include/openssl/ssl.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${OPENSSL_DIR}/include/openssl/ssl.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${OPENSSL_DIR}/include/openssl/ssl.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${OPENSSL_DIR}/include/openssl/ssl.h: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${OPENSSL_DIR}/include/openssl/ssl.h" >&5
-echo $ECHO_N "checking for ${OPENSSL_DIR}/include/openssl/ssl.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  OPENSSL_HEADER_FOUND=1
-else
-  OPENSSL_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "xopenssl/ssl.h" != "x" ; then
-            if test "${ac_cv_header_openssl_ssl_h+set}" = set; then
-  { echo "$as_me:$LINENO: checking for openssl/ssl.h" >&5
-echo $ECHO_N "checking for openssl/ssl.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_openssl_ssl_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_openssl_ssl_h" >&5
-echo "${ECHO_T}$ac_cv_header_openssl_ssl_h" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking openssl/ssl.h usability" >&5
-echo $ECHO_N "checking openssl/ssl.h usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <openssl/ssl.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking openssl/ssl.h presence" >&5
-echo $ECHO_N "checking openssl/ssl.h presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <openssl/ssl.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: openssl/ssl.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: openssl/ssl.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: openssl/ssl.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: openssl/ssl.h: proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: openssl/ssl.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: openssl/ssl.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: openssl/ssl.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: openssl/ssl.h: proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
@@ -50634,7 +40852,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${OPENSSL_HEADER_FOUND}" = "x0" ; then
          OPENSSL_LIB=""
@@ -50666,6 +40884,7 @@ then
 
 if test "x${PBX_OSPTK}" != "x1" -a "${USE_OSPTK}" != "no"; then
    pbxlibdir=""
+   # if --with-OSPTK=DIR has been specified, use it.
    if test "x${OSPTK_DIR}" != "x"; then
       if test -d ${OSPTK_DIR}/lib; then
         pbxlibdir="-L${OSPTK_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_OSPTK_FOUND}" = "yes"; then
-      OSPTK_LIB="-losptk -lcrypto -lssl"
-      OSPTK_HEADER_FOUND="1"
+      OSPTK_LIB="${pbxlibdir} -losptk -lcrypto -lssl"
+      # if --with-OSPTK=DIR has been specified, use it.
       if test "x${OSPTK_DIR}" != "x"; then
-         OSPTK_LIB="${pbxlibdir} ${OSPTK_LIB}"
         OSPTK_INCLUDE="-I${OSPTK_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${OSPTK_DIR}/include"
-        if test "xosp/osp.h" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${OSPTK_DIR}/include/osp/osp.h" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${OSPTK_DIR}/include/osp/osp.h" >&5
-echo $ECHO_N "checking for ${OSPTK_DIR}/include/osp/osp.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${OSPTK_DIR}/include/osp/osp.h usability" >&5
-echo $ECHO_N "checking ${OSPTK_DIR}/include/osp/osp.h usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <${OSPTK_DIR}/include/osp/osp.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking ${OSPTK_DIR}/include/osp/osp.h presence" >&5
-echo $ECHO_N "checking ${OSPTK_DIR}/include/osp/osp.h presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${OSPTK_DIR}/include/osp/osp.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${OSPTK_DIR}/include/osp/osp.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${OSPTK_DIR}/include/osp/osp.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${OSPTK_DIR}/include/osp/osp.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${OSPTK_DIR}/include/osp/osp.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${OSPTK_DIR}/include/osp/osp.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${OSPTK_DIR}/include/osp/osp.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${OSPTK_DIR}/include/osp/osp.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${OSPTK_DIR}/include/osp/osp.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${OSPTK_DIR}/include/osp/osp.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${OSPTK_DIR}/include/osp/osp.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${OSPTK_DIR}/include/osp/osp.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${OSPTK_DIR}/include/osp/osp.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${OSPTK_DIR}/include/osp/osp.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${OSPTK_DIR}/include/osp/osp.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${OSPTK_DIR}/include/osp/osp.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${OSPTK_DIR}/include/osp/osp.h: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${OSPTK_DIR}/include/osp/osp.h" >&5
-echo $ECHO_N "checking for ${OSPTK_DIR}/include/osp/osp.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  OSPTK_HEADER_FOUND=1
-else
-  OSPTK_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "xosp/osp.h" != "x" ; then
-            if test "${ac_cv_header_osp_osp_h+set}" = set; then
+      fi
+      OSPTK_INCLUDE="${OSPTK_INCLUDE} "
+      if test "xosp/osp.h" = "x" ; then        # no header, assume found
+         OSPTK_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${OSPTK_INCLUDE} "
+        if test "${ac_cv_header_osp_osp_h+set}" = set; then
   { echo "$as_me:$LINENO: checking for osp/osp.h" >&5
 echo $ECHO_N "checking for osp/osp.h... $ECHO_C" >&6; }
 if test "${ac_cv_header_osp_osp_h+set}" = set; then
@@ -51028,7 +41112,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${OSPTK_HEADER_FOUND}" = "x0" ; then
          OSPTK_LIB=""
@@ -51058,6 +41142,7 @@ fi
 
 if test "x${PBX_FREETDS}" != "x1" -a "${USE_FREETDS}" != "no"; then
    pbxlibdir=""
+   # if --with-FREETDS=DIR has been specified, use it.
    if test "x${FREETDS_DIR}" != "x"; then
       if test -d ${FREETDS_DIR}/lib; then
         pbxlibdir="-L${FREETDS_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_FREETDS_FOUND}" = "yes"; then
-      FREETDS_LIB="-ltds "
-      FREETDS_HEADER_FOUND="1"
+      FREETDS_LIB="${pbxlibdir} -ltds "
+      # if --with-FREETDS=DIR has been specified, use it.
       if test "x${FREETDS_DIR}" != "x"; then
-         FREETDS_LIB="${pbxlibdir} ${FREETDS_LIB}"
         FREETDS_INCLUDE="-I${FREETDS_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${FREETDS_DIR}/include"
-        if test "xtds.h" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${FREETDS_DIR}/include/tds.h" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${FREETDS_DIR}/include/tds.h" >&5
-echo $ECHO_N "checking for ${FREETDS_DIR}/include/tds.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+      fi
+      FREETDS_INCLUDE="${FREETDS_INCLUDE} "
+      if test "xtds.h" = "x" ; then    # no header, assume found
+         FREETDS_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${FREETDS_INCLUDE} "
+        if test "${ac_cv_header_tds_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for tds.h" >&5
+echo $ECHO_N "checking for tds.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_tds_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_tds_h" >&5
+echo "${ECHO_T}$ac_cv_header_tds_h" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${FREETDS_DIR}/include/tds.h usability" >&5
-echo $ECHO_N "checking ${FREETDS_DIR}/include/tds.h usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking tds.h usability" >&5
+echo $ECHO_N "checking tds.h usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -51170,7 +41257,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <${FREETDS_DIR}/include/tds.h>
+#include <tds.h>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -51202,152 +41289,15 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking ${FREETDS_DIR}/include/tds.h presence" >&5
-echo $ECHO_N "checking ${FREETDS_DIR}/include/tds.h presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking tds.h presence" >&5
+echo $ECHO_N "checking tds.h presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <${FREETDS_DIR}/include/tds.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${FREETDS_DIR}/include/tds.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${FREETDS_DIR}/include/tds.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${FREETDS_DIR}/include/tds.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${FREETDS_DIR}/include/tds.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${FREETDS_DIR}/include/tds.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${FREETDS_DIR}/include/tds.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${FREETDS_DIR}/include/tds.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${FREETDS_DIR}/include/tds.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${FREETDS_DIR}/include/tds.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${FREETDS_DIR}/include/tds.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${FREETDS_DIR}/include/tds.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${FREETDS_DIR}/include/tds.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${FREETDS_DIR}/include/tds.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${FREETDS_DIR}/include/tds.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${FREETDS_DIR}/include/tds.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${FREETDS_DIR}/include/tds.h: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${FREETDS_DIR}/include/tds.h" >&5
-echo $ECHO_N "checking for ${FREETDS_DIR}/include/tds.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  FREETDS_HEADER_FOUND=1
-else
-  FREETDS_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "xtds.h" != "x" ; then
-            if test "${ac_cv_header_tds_h+set}" = set; then
-  { echo "$as_me:$LINENO: checking for tds.h" >&5
-echo $ECHO_N "checking for tds.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_tds_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_tds_h" >&5
-echo "${ECHO_T}$ac_cv_header_tds_h" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking tds.h usability" >&5
-echo $ECHO_N "checking tds.h usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <tds.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking tds.h presence" >&5
-echo $ECHO_N "checking tds.h presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <tds.h>
+#include <tds.h>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -51420,7 +41370,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${FREETDS_HEADER_FOUND}" = "x0" ; then
          FREETDS_LIB=""
@@ -51466,6 +41416,7 @@ fi
 
 if test "x${PBX_TERMCAP}" != "x1" -a "${USE_TERMCAP}" != "no"; then
    pbxlibdir=""
+   # if --with-TERMCAP=DIR has been specified, use it.
    if test "x${TERMCAP_DIR}" != "x"; then
       if test -d ${TERMCAP_DIR}/lib; then
         pbxlibdir="-L${TERMCAP_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_TERMCAP_FOUND}" = "yes"; then
-      TERMCAP_LIB="-ltermcap "
-      TERMCAP_HEADER_FOUND="1"
+      TERMCAP_LIB="${pbxlibdir} -ltermcap "
+      # if --with-TERMCAP=DIR has been specified, use it.
       if test "x${TERMCAP_DIR}" != "x"; then
-         TERMCAP_LIB="${pbxlibdir} ${TERMCAP_LIB}"
         TERMCAP_INCLUDE="-I${TERMCAP_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${TERMCAP_DIR}/include"
-        if test "x" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${TERMCAP_DIR}/include/" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${TERMCAP_DIR}/include/" >&5
-echo $ECHO_N "checking for ${TERMCAP_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${TERMCAP_DIR}/include/ usability" >&5
-echo $ECHO_N "checking ${TERMCAP_DIR}/include/ usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <${TERMCAP_DIR}/include/>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking ${TERMCAP_DIR}/include/ presence" >&5
-echo $ECHO_N "checking ${TERMCAP_DIR}/include/ presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${TERMCAP_DIR}/include/>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${TERMCAP_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${TERMCAP_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TERMCAP_DIR}/include/: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${TERMCAP_DIR}/include/: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${TERMCAP_DIR}/include/: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${TERMCAP_DIR}/include/: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TERMCAP_DIR}/include/:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${TERMCAP_DIR}/include/:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TERMCAP_DIR}/include/: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${TERMCAP_DIR}/include/: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TERMCAP_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${TERMCAP_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TERMCAP_DIR}/include/: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${TERMCAP_DIR}/include/: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TERMCAP_DIR}/include/: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${TERMCAP_DIR}/include/: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${TERMCAP_DIR}/include/" >&5
-echo $ECHO_N "checking for ${TERMCAP_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  TERMCAP_HEADER_FOUND=1
-else
-  TERMCAP_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "x" != "x" ; then
-            if test "${ac_cv_header_+set}" = set; then
+      fi
+      TERMCAP_INCLUDE="${TERMCAP_INCLUDE} "
+      if test "x" = "x" ; then # no header, assume found
+         TERMCAP_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${TERMCAP_INCLUDE} "
+        if test "${ac_cv_header_+set}" = set; then
   { echo "$as_me:$LINENO: checking for " >&5
 echo $ECHO_N "checking for ... $ECHO_C" >&6; }
 if test "${ac_cv_header_+set}" = set; then
@@ -51828,7 +41644,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${TERMCAP_HEADER_FOUND}" = "x0" ; then
          TERMCAP_LIB=""
@@ -51857,6 +41673,7 @@ fi
 
 if test "x${PBX_TINFO}" != "x1" -a "${USE_TINFO}" != "no"; then
    pbxlibdir=""
+   # if --with-TINFO=DIR has been specified, use it.
    if test "x${TINFO_DIR}" != "x"; then
       if test -d ${TINFO_DIR}/lib; then
         pbxlibdir="-L${TINFO_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_TINFO_FOUND}" = "yes"; then
-      TINFO_LIB="-ltinfo "
-      TINFO_HEADER_FOUND="1"
+      TINFO_LIB="${pbxlibdir} -ltinfo "
+      # if --with-TINFO=DIR has been specified, use it.
       if test "x${TINFO_DIR}" != "x"; then
-         TINFO_LIB="${pbxlibdir} ${TINFO_LIB}"
         TINFO_INCLUDE="-I${TINFO_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${TINFO_DIR}/include"
-        if test "x" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${TINFO_DIR}/include/" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${TINFO_DIR}/include/" >&5
-echo $ECHO_N "checking for ${TINFO_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+      fi
+      TINFO_INCLUDE="${TINFO_INCLUDE} "
+      if test "x" = "x" ; then # no header, assume found
+         TINFO_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${TINFO_INCLUDE} "
+        if test "${ac_cv_header_+set}" = set; then
+  { echo "$as_me:$LINENO: checking for " >&5
+echo $ECHO_N "checking for ... $ECHO_C" >&6; }
+if test "${ac_cv_header_+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
+echo "${ECHO_T}$ac_cv_header_" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${TINFO_DIR}/include/ usability" >&5
-echo $ECHO_N "checking ${TINFO_DIR}/include/ usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking  usability" >&5
+echo $ECHO_N "checking  usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -51969,7 +41788,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <${TINFO_DIR}/include/>
+#include <>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -52001,15 +41820,15 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking ${TINFO_DIR}/include/ presence" >&5
-echo $ECHO_N "checking ${TINFO_DIR}/include/ presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking  presence" >&5
+echo $ECHO_N "checking  presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <${TINFO_DIR}/include/>
+#include <>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -52042,147 +41861,10 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${TINFO_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${TINFO_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TINFO_DIR}/include/: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${TINFO_DIR}/include/: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${TINFO_DIR}/include/: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${TINFO_DIR}/include/: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TINFO_DIR}/include/:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${TINFO_DIR}/include/:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TINFO_DIR}/include/: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${TINFO_DIR}/include/: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TINFO_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${TINFO_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TINFO_DIR}/include/: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${TINFO_DIR}/include/: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TINFO_DIR}/include/: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${TINFO_DIR}/include/: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${TINFO_DIR}/include/" >&5
-echo $ECHO_N "checking for ${TINFO_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  TINFO_HEADER_FOUND=1
-else
-  TINFO_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "x" != "x" ; then
-            if test "${ac_cv_header_+set}" = set; then
-  { echo "$as_me:$LINENO: checking for " >&5
-echo $ECHO_N "checking for ... $ECHO_C" >&6; }
-if test "${ac_cv_header_+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
-echo "${ECHO_T}$ac_cv_header_" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking  usability" >&5
-echo $ECHO_N "checking  usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking  presence" >&5
-echo $ECHO_N "checking  presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: : proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: : proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: : proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: : proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
@@ -52219,7 +41901,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${TINFO_HEADER_FOUND}" = "x0" ; then
          TINFO_LIB=""
@@ -52253,6 +41935,7 @@ fi
 
 if test "x${PBX_TONEZONE}" != "x1" -a "${USE_TONEZONE}" != "no"; then
    pbxlibdir=""
+   # if --with-TONEZONE=DIR has been specified, use it.
    if test "x${TONEZONE_DIR}" != "x"; then
       if test -d ${TONEZONE_DIR}/lib; then
         pbxlibdir="-L${TONEZONE_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_TONEZONE_FOUND}" = "yes"; then
-      TONEZONE_LIB="-ltonezone ${tonezone_extra}"
-      TONEZONE_HEADER_FOUND="1"
+      TONEZONE_LIB="${pbxlibdir} -ltonezone ${tonezone_extra}"
+      # if --with-TONEZONE=DIR has been specified, use it.
       if test "x${TONEZONE_DIR}" != "x"; then
-         TONEZONE_LIB="${pbxlibdir} ${TONEZONE_LIB}"
         TONEZONE_INCLUDE="-I${TONEZONE_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${TONEZONE_DIR}/include"
-        if test "xzaptel/tonezone.h" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${TONEZONE_DIR}/include/zaptel/tonezone.h" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${TONEZONE_DIR}/include/zaptel/tonezone.h" >&5
-echo $ECHO_N "checking for ${TONEZONE_DIR}/include/zaptel/tonezone.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${TONEZONE_DIR}/include/zaptel/tonezone.h usability" >&5
-echo $ECHO_N "checking ${TONEZONE_DIR}/include/zaptel/tonezone.h usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <${TONEZONE_DIR}/include/zaptel/tonezone.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking ${TONEZONE_DIR}/include/zaptel/tonezone.h presence" >&5
-echo $ECHO_N "checking ${TONEZONE_DIR}/include/zaptel/tonezone.h presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${TONEZONE_DIR}/include/zaptel/tonezone.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${TONEZONE_DIR}/include/zaptel/tonezone.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${TONEZONE_DIR}/include/zaptel/tonezone.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TONEZONE_DIR}/include/zaptel/tonezone.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${TONEZONE_DIR}/include/zaptel/tonezone.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${TONEZONE_DIR}/include/zaptel/tonezone.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${TONEZONE_DIR}/include/zaptel/tonezone.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TONEZONE_DIR}/include/zaptel/tonezone.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${TONEZONE_DIR}/include/zaptel/tonezone.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TONEZONE_DIR}/include/zaptel/tonezone.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${TONEZONE_DIR}/include/zaptel/tonezone.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TONEZONE_DIR}/include/zaptel/tonezone.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${TONEZONE_DIR}/include/zaptel/tonezone.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TONEZONE_DIR}/include/zaptel/tonezone.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${TONEZONE_DIR}/include/zaptel/tonezone.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TONEZONE_DIR}/include/zaptel/tonezone.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${TONEZONE_DIR}/include/zaptel/tonezone.h: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${TONEZONE_DIR}/include/zaptel/tonezone.h" >&5
-echo $ECHO_N "checking for ${TONEZONE_DIR}/include/zaptel/tonezone.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  TONEZONE_HEADER_FOUND=1
-else
-  TONEZONE_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "xzaptel/tonezone.h" != "x" ; then
-            if test "${ac_cv_header_zaptel_tonezone_h+set}" = set; then
+      fi
+      TONEZONE_INCLUDE="${TONEZONE_INCLUDE} 140"
+      if test "xzaptel/tonezone.h" = "x" ; then        # no header, assume found
+         TONEZONE_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${TONEZONE_INCLUDE} 140"
+        if test "${ac_cv_header_zaptel_tonezone_h+set}" = set; then
   { echo "$as_me:$LINENO: checking for zaptel/tonezone.h" >&5
 echo $ECHO_N "checking for zaptel/tonezone.h... $ECHO_C" >&6; }
 if test "${ac_cv_header_zaptel_tonezone_h+set}" = set; then
@@ -52615,7 +42163,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${TONEZONE_HEADER_FOUND}" = "x0" ; then
          TONEZONE_LIB=""
@@ -52644,6 +42192,7 @@ fi
 
 if test "x${PBX_TONEZONE}" != "x1" -a "${USE_TONEZONE}" != "no"; then
    pbxlibdir=""
+   # if --with-TONEZONE=DIR has been specified, use it.
    if test "x${TONEZONE_DIR}" != "x"; then
       if test -d ${TONEZONE_DIR}/lib; then
         pbxlibdir="-L${TONEZONE_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_TONEZONE_FOUND}" = "yes"; then
-      TONEZONE_LIB="-ltonezone ${tonezone_extra}"
-      TONEZONE_HEADER_FOUND="1"
+      TONEZONE_LIB="${pbxlibdir} -ltonezone ${tonezone_extra}"
+      # if --with-TONEZONE=DIR has been specified, use it.
       if test "x${TONEZONE_DIR}" != "x"; then
-         TONEZONE_LIB="${pbxlibdir} ${TONEZONE_LIB}"
         TONEZONE_INCLUDE="-I${TONEZONE_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${TONEZONE_DIR}/include"
-        if test "xzaptel/zaptel.h" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${TONEZONE_DIR}/include/zaptel/zaptel.h" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${TONEZONE_DIR}/include/zaptel/zaptel.h" >&5
-echo $ECHO_N "checking for ${TONEZONE_DIR}/include/zaptel/zaptel.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${TONEZONE_DIR}/include/zaptel/zaptel.h usability" >&5
-echo $ECHO_N "checking ${TONEZONE_DIR}/include/zaptel/zaptel.h usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <${TONEZONE_DIR}/include/zaptel/zaptel.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking ${TONEZONE_DIR}/include/zaptel/zaptel.h presence" >&5
-echo $ECHO_N "checking ${TONEZONE_DIR}/include/zaptel/zaptel.h presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${TONEZONE_DIR}/include/zaptel/zaptel.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${TONEZONE_DIR}/include/zaptel/zaptel.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${TONEZONE_DIR}/include/zaptel/zaptel.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TONEZONE_DIR}/include/zaptel/zaptel.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${TONEZONE_DIR}/include/zaptel/zaptel.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${TONEZONE_DIR}/include/zaptel/zaptel.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${TONEZONE_DIR}/include/zaptel/zaptel.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TONEZONE_DIR}/include/zaptel/zaptel.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${TONEZONE_DIR}/include/zaptel/zaptel.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TONEZONE_DIR}/include/zaptel/zaptel.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${TONEZONE_DIR}/include/zaptel/zaptel.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TONEZONE_DIR}/include/zaptel/zaptel.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${TONEZONE_DIR}/include/zaptel/zaptel.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TONEZONE_DIR}/include/zaptel/zaptel.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${TONEZONE_DIR}/include/zaptel/zaptel.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TONEZONE_DIR}/include/zaptel/zaptel.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${TONEZONE_DIR}/include/zaptel/zaptel.h: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${TONEZONE_DIR}/include/zaptel/zaptel.h" >&5
-echo $ECHO_N "checking for ${TONEZONE_DIR}/include/zaptel/zaptel.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  TONEZONE_HEADER_FOUND=1
-else
-  TONEZONE_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "xzaptel/zaptel.h" != "x" ; then
-            if test "${ac_cv_header_zaptel_zaptel_h+set}" = set; then
+      fi
+      TONEZONE_INCLUDE="${TONEZONE_INCLUDE} 80"
+      if test "xzaptel/zaptel.h" = "x" ; then  # no header, assume found
+         TONEZONE_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${TONEZONE_INCLUDE} 80"
+        if test "${ac_cv_header_zaptel_zaptel_h+set}" = set; then
   { echo "$as_me:$LINENO: checking for zaptel/zaptel.h" >&5
 echo $ECHO_N "checking for zaptel/zaptel.h... $ECHO_C" >&6; }
 if test "${ac_cv_header_zaptel_zaptel_h+set}" = set; then
@@ -53006,7 +42420,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${TONEZONE_HEADER_FOUND}" = "x0" ; then
          TONEZONE_LIB=""
@@ -53035,6 +42449,7 @@ fi
 
 if test "x${PBX_USB}" != "x1" -a "${USE_USB}" != "no"; then
    pbxlibdir=""
+   # if --with-USB=DIR has been specified, use it.
    if test "x${USB_DIR}" != "x"; then
       if test -d ${USB_DIR}/lib; then
         pbxlibdir="-L${USB_DIR}/lib"
@@ -53090,182 +42505,47 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
-  eval "$as_ac_Lib=yes"
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-ac_res=`eval echo '${'$as_ac_Lib'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-if test `eval echo '${'$as_ac_Lib'}'` = yes; then
-  AST_USB_FOUND=yes
-else
-  AST_USB_FOUND=no
-fi
-
-   fi
-
-   if test "${AST_USB_FOUND}" = "yes"; then
-      USB_LIB="-lusb "
-      USB_HEADER_FOUND="1"
-      if test "x${USB_DIR}" != "x"; then
-         USB_LIB="${pbxlibdir} ${USB_LIB}"
-        USB_INCLUDE="-I${USB_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${USB_DIR}/include"
-        if test "xusb.h" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${USB_DIR}/include/usb.h" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${USB_DIR}/include/usb.h" >&5
-echo $ECHO_N "checking for ${USB_DIR}/include/usb.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${USB_DIR}/include/usb.h usability" >&5
-echo $ECHO_N "checking ${USB_DIR}/include/usb.h usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <${USB_DIR}/include/usb.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking ${USB_DIR}/include/usb.h presence" >&5
-echo $ECHO_N "checking ${USB_DIR}/include/usb.h presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${USB_DIR}/include/usb.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${USB_DIR}/include/usb.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${USB_DIR}/include/usb.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${USB_DIR}/include/usb.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${USB_DIR}/include/usb.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${USB_DIR}/include/usb.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${USB_DIR}/include/usb.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${USB_DIR}/include/usb.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${USB_DIR}/include/usb.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${USB_DIR}/include/usb.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${USB_DIR}/include/usb.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${USB_DIR}/include/usb.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${USB_DIR}/include/usb.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${USB_DIR}/include/usb.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${USB_DIR}/include/usb.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${USB_DIR}/include/usb.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${USB_DIR}/include/usb.h: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${USB_DIR}/include/usb.h" >&5
-echo $ECHO_N "checking for ${USB_DIR}/include/usb.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  eval "$as_ac_Lib=yes"
 else
-  eval "$as_ac_Header=\$ac_header_preproc"
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       eval "$as_ac_Lib=no"
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
 
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
 fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  USB_HEADER_FOUND=1
+ac_res=`eval echo '${'$as_ac_Lib'}'`
+              { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_Lib'}'` = yes; then
+  AST_USB_FOUND=yes
 else
-  USB_HEADER_FOUND=0
+  AST_USB_FOUND=no
 fi
 
+   fi
 
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "xusb.h" != "x" ; then
-            if test "${ac_cv_header_usb_h+set}" = set; then
+   # now check for the header.
+   if test "${AST_USB_FOUND}" = "yes"; then
+      USB_LIB="${pbxlibdir} -lusb "
+      # if --with-USB=DIR has been specified, use it.
+      if test "x${USB_DIR}" != "x"; then
+        USB_INCLUDE="-I${USB_DIR}/include"
+      fi
+      USB_INCLUDE="${USB_INCLUDE} "
+      if test "xusb.h" = "x" ; then    # no header, assume found
+         USB_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${USB_INCLUDE} "
+        if test "${ac_cv_header_usb_h+set}" = set; then
   { echo "$as_me:$LINENO: checking for usb.h" >&5
 echo $ECHO_N "checking for usb.h... $ECHO_C" >&6; }
 if test "${ac_cv_header_usb_h+set}" = set; then
@@ -53397,7 +42677,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${USB_HEADER_FOUND}" = "x0" ; then
          USB_LIB=""
@@ -53426,6 +42706,7 @@ fi
 
 if test "x${PBX_VORBIS}" != "x1" -a "${USE_VORBIS}" != "no"; then
    pbxlibdir=""
+   # if --with-VORBIS=DIR has been specified, use it.
    if test "x${VORBIS_DIR}" != "x"; then
       if test -d ${VORBIS_DIR}/lib; then
         pbxlibdir="-L${VORBIS_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_VORBIS_FOUND}" = "yes"; then
-      VORBIS_LIB="-lvorbis -lm -lvorbisenc"
-      VORBIS_HEADER_FOUND="1"
+      VORBIS_LIB="${pbxlibdir} -lvorbis -lm -lvorbisenc"
+      # if --with-VORBIS=DIR has been specified, use it.
       if test "x${VORBIS_DIR}" != "x"; then
-         VORBIS_LIB="${pbxlibdir} ${VORBIS_LIB}"
         VORBIS_INCLUDE="-I${VORBIS_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${VORBIS_DIR}/include"
-        if test "xvorbis/codec.h" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${VORBIS_DIR}/include/vorbis/codec.h" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${VORBIS_DIR}/include/vorbis/codec.h" >&5
-echo $ECHO_N "checking for ${VORBIS_DIR}/include/vorbis/codec.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${VORBIS_DIR}/include/vorbis/codec.h usability" >&5
-echo $ECHO_N "checking ${VORBIS_DIR}/include/vorbis/codec.h usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <${VORBIS_DIR}/include/vorbis/codec.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking ${VORBIS_DIR}/include/vorbis/codec.h presence" >&5
-echo $ECHO_N "checking ${VORBIS_DIR}/include/vorbis/codec.h presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${VORBIS_DIR}/include/vorbis/codec.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${VORBIS_DIR}/include/vorbis/codec.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${VORBIS_DIR}/include/vorbis/codec.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${VORBIS_DIR}/include/vorbis/codec.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${VORBIS_DIR}/include/vorbis/codec.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${VORBIS_DIR}/include/vorbis/codec.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${VORBIS_DIR}/include/vorbis/codec.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${VORBIS_DIR}/include/vorbis/codec.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${VORBIS_DIR}/include/vorbis/codec.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${VORBIS_DIR}/include/vorbis/codec.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${VORBIS_DIR}/include/vorbis/codec.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${VORBIS_DIR}/include/vorbis/codec.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${VORBIS_DIR}/include/vorbis/codec.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${VORBIS_DIR}/include/vorbis/codec.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${VORBIS_DIR}/include/vorbis/codec.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${VORBIS_DIR}/include/vorbis/codec.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${VORBIS_DIR}/include/vorbis/codec.h: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${VORBIS_DIR}/include/vorbis/codec.h" >&5
-echo $ECHO_N "checking for ${VORBIS_DIR}/include/vorbis/codec.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  VORBIS_HEADER_FOUND=1
-else
-  VORBIS_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "xvorbis/codec.h" != "x" ; then
-            if test "${ac_cv_header_vorbis_codec_h+set}" = set; then
+      fi
+      VORBIS_INCLUDE="${VORBIS_INCLUDE} "
+      if test "xvorbis/codec.h" = "x" ; then   # no header, assume found
+         VORBIS_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${VORBIS_INCLUDE} "
+        if test "${ac_cv_header_vorbis_codec_h+set}" = set; then
   { echo "$as_me:$LINENO: checking for vorbis/codec.h" >&5
 echo $ECHO_N "checking for vorbis/codec.h... $ECHO_C" >&6; }
 if test "${ac_cv_header_vorbis_codec_h+set}" = set; then
@@ -53788,7 +42934,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${VORBIS_HEADER_FOUND}" = "x0" ; then
          VORBIS_LIB=""
@@ -53915,6 +43061,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 if test "x${PBX_ZLIB}" != "x1" -a "${USE_ZLIB}" != "no"; then
    pbxlibdir=""
+   # if --with-ZLIB=DIR has been specified, use it.
    if test "x${ZLIB_DIR}" != "x"; then
       if test -d ${ZLIB_DIR}/lib; then
         pbxlibdir="-L${ZLIB_DIR}/lib"
@@ -53982,170 +43129,35 @@ sed 's/^/| /' conftest.$ac_ext >&5
        eval "$as_ac_Lib=no"
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-ac_res=`eval echo '${'$as_ac_Lib'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-if test `eval echo '${'$as_ac_Lib'}'` = yes; then
-  AST_ZLIB_FOUND=yes
-else
-  AST_ZLIB_FOUND=no
-fi
-
-   fi
-
-   if test "${AST_ZLIB_FOUND}" = "yes"; then
-      ZLIB_LIB="-lz "
-      ZLIB_HEADER_FOUND="1"
-      if test "x${ZLIB_DIR}" != "x"; then
-         ZLIB_LIB="${pbxlibdir} ${ZLIB_LIB}"
-        ZLIB_INCLUDE="-I${ZLIB_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${ZLIB_DIR}/include"
-        if test "xzlib.h" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${ZLIB_DIR}/include/zlib.h" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${ZLIB_DIR}/include/zlib.h" >&5
-echo $ECHO_N "checking for ${ZLIB_DIR}/include/zlib.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${ZLIB_DIR}/include/zlib.h usability" >&5
-echo $ECHO_N "checking ${ZLIB_DIR}/include/zlib.h usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <${ZLIB_DIR}/include/zlib.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking ${ZLIB_DIR}/include/zlib.h presence" >&5
-echo $ECHO_N "checking ${ZLIB_DIR}/include/zlib.h presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${ZLIB_DIR}/include/zlib.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${ZLIB_DIR}/include/zlib.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${ZLIB_DIR}/include/zlib.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ZLIB_DIR}/include/zlib.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${ZLIB_DIR}/include/zlib.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${ZLIB_DIR}/include/zlib.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${ZLIB_DIR}/include/zlib.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ZLIB_DIR}/include/zlib.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${ZLIB_DIR}/include/zlib.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ZLIB_DIR}/include/zlib.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${ZLIB_DIR}/include/zlib.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ZLIB_DIR}/include/zlib.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${ZLIB_DIR}/include/zlib.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ZLIB_DIR}/include/zlib.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${ZLIB_DIR}/include/zlib.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ZLIB_DIR}/include/zlib.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${ZLIB_DIR}/include/zlib.h: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${ZLIB_DIR}/include/zlib.h" >&5
-echo $ECHO_N "checking for ${ZLIB_DIR}/include/zlib.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
+ac_res=`eval echo '${'$as_ac_Lib'}'`
               { echo "$as_me:$LINENO: result: $ac_res" >&5
 echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  ZLIB_HEADER_FOUND=1
+if test `eval echo '${'$as_ac_Lib'}'` = yes; then
+  AST_ZLIB_FOUND=yes
 else
-  ZLIB_HEADER_FOUND=0
+  AST_ZLIB_FOUND=no
 fi
 
+   fi
 
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "xzlib.h" != "x" ; then
-            if test "${ac_cv_header_zlib_h+set}" = set; then
+   # now check for the header.
+   if test "${AST_ZLIB_FOUND}" = "yes"; then
+      ZLIB_LIB="${pbxlibdir} -lz "
+      # if --with-ZLIB=DIR has been specified, use it.
+      if test "x${ZLIB_DIR}" != "x"; then
+        ZLIB_INCLUDE="-I${ZLIB_DIR}/include"
+      fi
+      ZLIB_INCLUDE="${ZLIB_INCLUDE} "
+      if test "xzlib.h" = "x" ; then   # no header, assume found
+         ZLIB_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${ZLIB_INCLUDE} "
+        if test "${ac_cv_header_zlib_h+set}" = set; then
   { echo "$as_me:$LINENO: checking for zlib.h" >&5
 echo $ECHO_N "checking for zlib.h... $ECHO_C" >&6; }
 if test "${ac_cv_header_zlib_h+set}" = set; then
@@ -54277,7 +43289,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${ZLIB_HEADER_FOUND}" = "x0" ; then
          ZLIB_LIB=""
@@ -54595,6 +43607,7 @@ case "${host_os}" in
 
 if test "x${PBX_ZAPTEL}" != "x1" -a "${USE_ZAPTEL}" != "no"; then
    pbxlibdir=""
+   # if --with-ZAPTEL=DIR has been specified, use it.
    if test "x${ZAPTEL_DIR}" != "x"; then
       if test -d ${ZAPTEL_DIR}/lib; then
         pbxlibdir="-L${ZAPTEL_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_ZAPTEL_FOUND}" = "yes"; then
-      ZAPTEL_LIB="-lzaptel "
-      ZAPTEL_HEADER_FOUND="1"
+      ZAPTEL_LIB="${pbxlibdir} -lzaptel "
+      # if --with-ZAPTEL=DIR has been specified, use it.
       if test "x${ZAPTEL_DIR}" != "x"; then
-         ZAPTEL_LIB="${pbxlibdir} ${ZAPTEL_LIB}"
         ZAPTEL_INCLUDE="-I${ZAPTEL_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${ZAPTEL_DIR}/include"
-        if test "xzaptel.h" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${ZAPTEL_DIR}/include/zaptel.h" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${ZAPTEL_DIR}/include/zaptel.h" >&5
-echo $ECHO_N "checking for ${ZAPTEL_DIR}/include/zaptel.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${ZAPTEL_DIR}/include/zaptel.h usability" >&5
-echo $ECHO_N "checking ${ZAPTEL_DIR}/include/zaptel.h usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <${ZAPTEL_DIR}/include/zaptel.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking ${ZAPTEL_DIR}/include/zaptel.h presence" >&5
-echo $ECHO_N "checking ${ZAPTEL_DIR}/include/zaptel.h presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${ZAPTEL_DIR}/include/zaptel.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${ZAPTEL_DIR}/include/zaptel.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${ZAPTEL_DIR}/include/zaptel.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ZAPTEL_DIR}/include/zaptel.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${ZAPTEL_DIR}/include/zaptel.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${ZAPTEL_DIR}/include/zaptel.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${ZAPTEL_DIR}/include/zaptel.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ZAPTEL_DIR}/include/zaptel.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${ZAPTEL_DIR}/include/zaptel.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ZAPTEL_DIR}/include/zaptel.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${ZAPTEL_DIR}/include/zaptel.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ZAPTEL_DIR}/include/zaptel.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${ZAPTEL_DIR}/include/zaptel.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ZAPTEL_DIR}/include/zaptel.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${ZAPTEL_DIR}/include/zaptel.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ZAPTEL_DIR}/include/zaptel.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${ZAPTEL_DIR}/include/zaptel.h: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${ZAPTEL_DIR}/include/zaptel.h" >&5
-echo $ECHO_N "checking for ${ZAPTEL_DIR}/include/zaptel.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  ZAPTEL_HEADER_FOUND=1
-else
-  ZAPTEL_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "xzaptel.h" != "x" ; then
-            if test "${ac_cv_header_zaptel_h+set}" = set; then
+      fi
+      ZAPTEL_INCLUDE="${ZAPTEL_INCLUDE} "
+      if test "xzaptel.h" = "x" ; then # no header, assume found
+         ZAPTEL_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${ZAPTEL_INCLUDE} "
+        if test "${ac_cv_header_zaptel_h+set}" = set; then
   { echo "$as_me:$LINENO: checking for zaptel.h" >&5
 echo $ECHO_N "checking for zaptel.h... $ECHO_C" >&6; }
 if test "${ac_cv_header_zaptel_h+set}" = set; then
@@ -54957,7 +43835,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${ZAPTEL_HEADER_FOUND}" = "x0" ; then
          ZAPTEL_LIB=""
@@ -54975,7 +43853,7 @@ _ACEOF
 
 
 cat >>confdefs.h <<_ACEOF
-#define HAVE_ZAPTEL_VERSION 80
+#define HAVE_ZAPTEL_VERSION
 _ACEOF
 
       fi
@@ -54985,6 +43863,7 @@ fi
 
 if test "x${PBX_ZAPTEL_VLDTMF}" != "x1" -a "${USE_ZAPTEL_VLDTMF}" != "no"; then
    pbxlibdir=""
+   # if --with-ZAPTEL_VLDTMF=DIR has been specified, use it.
    if test "x${ZAPTEL_VLDTMF_DIR}" != "x"; then
       if test -d ${ZAPTEL_VLDTMF_DIR}/lib; then
         pbxlibdir="-L${ZAPTEL_VLDTMF_DIR}/lib"
@@ -55052,170 +43931,35 @@ sed 's/^/| /' conftest.$ac_ext >&5
        eval "$as_ac_Lib=no"
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-ac_res=`eval echo '${'$as_ac_Lib'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-if test `eval echo '${'$as_ac_Lib'}'` = yes; then
-  AST_ZAPTEL_VLDTMF_FOUND=yes
-else
-  AST_ZAPTEL_VLDTMF_FOUND=no
-fi
-
-   fi
-
-   if test "${AST_ZAPTEL_VLDTMF_FOUND}" = "yes"; then
-      ZAPTEL_VLDTMF_LIB="-lzaptel "
-      ZAPTEL_VLDTMF_HEADER_FOUND="1"
-      if test "x${ZAPTEL_VLDTMF_DIR}" != "x"; then
-         ZAPTEL_VLDTMF_LIB="${pbxlibdir} ${ZAPTEL_VLDTMF_LIB}"
-        ZAPTEL_VLDTMF_INCLUDE="-I${ZAPTEL_VLDTMF_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${ZAPTEL_VLDTMF_DIR}/include"
-        if test "xzaptel/zaptel.h" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${ZAPTEL_VLDTMF_DIR}/include/zaptel/zaptel.h" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${ZAPTEL_VLDTMF_DIR}/include/zaptel/zaptel.h" >&5
-echo $ECHO_N "checking for ${ZAPTEL_VLDTMF_DIR}/include/zaptel/zaptel.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${ZAPTEL_VLDTMF_DIR}/include/zaptel/zaptel.h usability" >&5
-echo $ECHO_N "checking ${ZAPTEL_VLDTMF_DIR}/include/zaptel/zaptel.h usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <${ZAPTEL_VLDTMF_DIR}/include/zaptel/zaptel.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking ${ZAPTEL_VLDTMF_DIR}/include/zaptel/zaptel.h presence" >&5
-echo $ECHO_N "checking ${ZAPTEL_VLDTMF_DIR}/include/zaptel/zaptel.h presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${ZAPTEL_VLDTMF_DIR}/include/zaptel/zaptel.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${ZAPTEL_VLDTMF_DIR}/include/zaptel/zaptel.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${ZAPTEL_VLDTMF_DIR}/include/zaptel/zaptel.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ZAPTEL_VLDTMF_DIR}/include/zaptel/zaptel.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${ZAPTEL_VLDTMF_DIR}/include/zaptel/zaptel.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${ZAPTEL_VLDTMF_DIR}/include/zaptel/zaptel.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${ZAPTEL_VLDTMF_DIR}/include/zaptel/zaptel.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ZAPTEL_VLDTMF_DIR}/include/zaptel/zaptel.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${ZAPTEL_VLDTMF_DIR}/include/zaptel/zaptel.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ZAPTEL_VLDTMF_DIR}/include/zaptel/zaptel.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${ZAPTEL_VLDTMF_DIR}/include/zaptel/zaptel.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ZAPTEL_VLDTMF_DIR}/include/zaptel/zaptel.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${ZAPTEL_VLDTMF_DIR}/include/zaptel/zaptel.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ZAPTEL_VLDTMF_DIR}/include/zaptel/zaptel.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${ZAPTEL_VLDTMF_DIR}/include/zaptel/zaptel.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ZAPTEL_VLDTMF_DIR}/include/zaptel/zaptel.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${ZAPTEL_VLDTMF_DIR}/include/zaptel/zaptel.h: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${ZAPTEL_VLDTMF_DIR}/include/zaptel/zaptel.h" >&5
-echo $ECHO_N "checking for ${ZAPTEL_VLDTMF_DIR}/include/zaptel/zaptel.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
+ac_res=`eval echo '${'$as_ac_Lib'}'`
               { echo "$as_me:$LINENO: result: $ac_res" >&5
 echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  ZAPTEL_VLDTMF_HEADER_FOUND=1
+if test `eval echo '${'$as_ac_Lib'}'` = yes; then
+  AST_ZAPTEL_VLDTMF_FOUND=yes
 else
-  ZAPTEL_VLDTMF_HEADER_FOUND=0
+  AST_ZAPTEL_VLDTMF_FOUND=no
 fi
 
+   fi
 
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "xzaptel/zaptel.h" != "x" ; then
-            if test "${ac_cv_header_zaptel_zaptel_h+set}" = set; then
+   # now check for the header.
+   if test "${AST_ZAPTEL_VLDTMF_FOUND}" = "yes"; then
+      ZAPTEL_VLDTMF_LIB="${pbxlibdir} -lzaptel "
+      # if --with-ZAPTEL_VLDTMF=DIR has been specified, use it.
+      if test "x${ZAPTEL_VLDTMF_DIR}" != "x"; then
+        ZAPTEL_VLDTMF_INCLUDE="-I${ZAPTEL_VLDTMF_DIR}/include"
+      fi
+      ZAPTEL_VLDTMF_INCLUDE="${ZAPTEL_VLDTMF_INCLUDE} "
+      if test "xzaptel/zaptel.h" = "x" ; then  # no header, assume found
+         ZAPTEL_VLDTMF_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${ZAPTEL_VLDTMF_INCLUDE} "
+        if test "${ac_cv_header_zaptel_zaptel_h+set}" = set; then
   { echo "$as_me:$LINENO: checking for zaptel/zaptel.h" >&5
 echo $ECHO_N "checking for zaptel/zaptel.h... $ECHO_C" >&6; }
 if test "${ac_cv_header_zaptel_zaptel_h+set}" = set; then
@@ -55347,7 +44091,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${ZAPTEL_VLDTMF_HEADER_FOUND}" = "x0" ; then
          ZAPTEL_VLDTMF_LIB=""
@@ -55365,7 +44109,7 @@ _ACEOF
 
 
 cat >>confdefs.h <<_ACEOF
-#define HAVE_ZAPTEL_VLDTMF_VERSION 90
+#define HAVE_ZAPTEL_VLDTMF_VERSION
 _ACEOF
 
       fi
@@ -55375,6 +44119,7 @@ fi
 
 if test "x${PBX_ZAPTEL_VLDTMF}" != "x1" -a "${USE_ZAPTEL_VLDTMF}" != "no"; then
    pbxlibdir=""
+   # if --with-ZAPTEL_VLDTMF=DIR has been specified, use it.
    if test "x${ZAPTEL_VLDTMF_DIR}" != "x"; then
       if test -d ${ZAPTEL_VLDTMF_DIR}/lib; then
         pbxlibdir="-L${ZAPTEL_VLDTMF_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_ZAPTEL_VLDTMF_FOUND}" = "yes"; then
-      ZAPTEL_VLDTMF_LIB="-lzaptel "
-      ZAPTEL_VLDTMF_HEADER_FOUND="1"
+      ZAPTEL_VLDTMF_LIB="${pbxlibdir} -lzaptel "
+      # if --with-ZAPTEL_VLDTMF=DIR has been specified, use it.
       if test "x${ZAPTEL_VLDTMF_DIR}" != "x"; then
-         ZAPTEL_VLDTMF_LIB="${pbxlibdir} ${ZAPTEL_VLDTMF_LIB}"
         ZAPTEL_VLDTMF_INCLUDE="-I${ZAPTEL_VLDTMF_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${ZAPTEL_VLDTMF_DIR}/include"
-        if test "xzaptel.h" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${ZAPTEL_VLDTMF_DIR}/include/zaptel.h" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${ZAPTEL_VLDTMF_DIR}/include/zaptel.h" >&5
-echo $ECHO_N "checking for ${ZAPTEL_VLDTMF_DIR}/include/zaptel.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${ZAPTEL_VLDTMF_DIR}/include/zaptel.h usability" >&5
-echo $ECHO_N "checking ${ZAPTEL_VLDTMF_DIR}/include/zaptel.h usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <${ZAPTEL_VLDTMF_DIR}/include/zaptel.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking ${ZAPTEL_VLDTMF_DIR}/include/zaptel.h presence" >&5
-echo $ECHO_N "checking ${ZAPTEL_VLDTMF_DIR}/include/zaptel.h presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${ZAPTEL_VLDTMF_DIR}/include/zaptel.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${ZAPTEL_VLDTMF_DIR}/include/zaptel.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${ZAPTEL_VLDTMF_DIR}/include/zaptel.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ZAPTEL_VLDTMF_DIR}/include/zaptel.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${ZAPTEL_VLDTMF_DIR}/include/zaptel.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${ZAPTEL_VLDTMF_DIR}/include/zaptel.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${ZAPTEL_VLDTMF_DIR}/include/zaptel.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ZAPTEL_VLDTMF_DIR}/include/zaptel.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${ZAPTEL_VLDTMF_DIR}/include/zaptel.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ZAPTEL_VLDTMF_DIR}/include/zaptel.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${ZAPTEL_VLDTMF_DIR}/include/zaptel.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ZAPTEL_VLDTMF_DIR}/include/zaptel.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${ZAPTEL_VLDTMF_DIR}/include/zaptel.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ZAPTEL_VLDTMF_DIR}/include/zaptel.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${ZAPTEL_VLDTMF_DIR}/include/zaptel.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ZAPTEL_VLDTMF_DIR}/include/zaptel.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${ZAPTEL_VLDTMF_DIR}/include/zaptel.h: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${ZAPTEL_VLDTMF_DIR}/include/zaptel.h" >&5
-echo $ECHO_N "checking for ${ZAPTEL_VLDTMF_DIR}/include/zaptel.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  ZAPTEL_VLDTMF_HEADER_FOUND=1
-else
-  ZAPTEL_VLDTMF_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "xzaptel.h" != "x" ; then
-            if test "${ac_cv_header_zaptel_h+set}" = set; then
+      fi
+      ZAPTEL_VLDTMF_INCLUDE="${ZAPTEL_VLDTMF_INCLUDE} "
+      if test "xzaptel.h" = "x" ; then # no header, assume found
+         ZAPTEL_VLDTMF_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${ZAPTEL_VLDTMF_INCLUDE} "
+        if test "${ac_cv_header_zaptel_h+set}" = set; then
   { echo "$as_me:$LINENO: checking for zaptel.h" >&5
 echo $ECHO_N "checking for zaptel.h... $ECHO_C" >&6; }
 if test "${ac_cv_header_zaptel_h+set}" = set; then
@@ -55737,7 +44347,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${ZAPTEL_VLDTMF_HEADER_FOUND}" = "x0" ; then
          ZAPTEL_VLDTMF_LIB=""
@@ -55755,7 +44365,7 @@ _ACEOF
 
 
 cat >>confdefs.h <<_ACEOF
-#define HAVE_ZAPTEL_VLDTMF_VERSION 80
+#define HAVE_ZAPTEL_VLDTMF_VERSION
 _ACEOF
 
       fi
@@ -55767,6 +44377,7 @@ fi
 
 if test "x${PBX_TONEZONE}" != "x1" -a "${USE_TONEZONE}" != "no"; then
    pbxlibdir=""
+   # if --with-TONEZONE=DIR has been specified, use it.
    if test "x${TONEZONE_DIR}" != "x"; then
       if test -d ${TONEZONE_DIR}/lib; then
         pbxlibdir="-L${TONEZONE_DIR}/lib"
@@ -55830,174 +44441,39 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-ac_res=`eval echo '${'$as_ac_Lib'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-if test `eval echo '${'$as_ac_Lib'}'` = yes; then
-  AST_TONEZONE_FOUND=yes
-else
-  AST_TONEZONE_FOUND=no
-fi
-
-   fi
-
-   if test "${AST_TONEZONE_FOUND}" = "yes"; then
-      TONEZONE_LIB="-ltonezone ${tonezone_extra}"
-      TONEZONE_HEADER_FOUND="1"
-      if test "x${TONEZONE_DIR}" != "x"; then
-         TONEZONE_LIB="${pbxlibdir} ${TONEZONE_LIB}"
-        TONEZONE_INCLUDE="-I${TONEZONE_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${TONEZONE_DIR}/include"
-        if test "xzaptel.h" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${TONEZONE_DIR}/include/zaptel.h" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${TONEZONE_DIR}/include/zaptel.h" >&5
-echo $ECHO_N "checking for ${TONEZONE_DIR}/include/zaptel.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${TONEZONE_DIR}/include/zaptel.h usability" >&5
-echo $ECHO_N "checking ${TONEZONE_DIR}/include/zaptel.h usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <${TONEZONE_DIR}/include/zaptel.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking ${TONEZONE_DIR}/include/zaptel.h presence" >&5
-echo $ECHO_N "checking ${TONEZONE_DIR}/include/zaptel.h presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${TONEZONE_DIR}/include/zaptel.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${TONEZONE_DIR}/include/zaptel.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${TONEZONE_DIR}/include/zaptel.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TONEZONE_DIR}/include/zaptel.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${TONEZONE_DIR}/include/zaptel.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${TONEZONE_DIR}/include/zaptel.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${TONEZONE_DIR}/include/zaptel.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TONEZONE_DIR}/include/zaptel.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${TONEZONE_DIR}/include/zaptel.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TONEZONE_DIR}/include/zaptel.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${TONEZONE_DIR}/include/zaptel.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TONEZONE_DIR}/include/zaptel.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${TONEZONE_DIR}/include/zaptel.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TONEZONE_DIR}/include/zaptel.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${TONEZONE_DIR}/include/zaptel.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TONEZONE_DIR}/include/zaptel.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${TONEZONE_DIR}/include/zaptel.h: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${TONEZONE_DIR}/include/zaptel.h" >&5
-echo $ECHO_N "checking for ${TONEZONE_DIR}/include/zaptel.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
+
+       eval "$as_ac_Lib=no"
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
 
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
 fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  TONEZONE_HEADER_FOUND=1
+ac_res=`eval echo '${'$as_ac_Lib'}'`
+              { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_Lib'}'` = yes; then
+  AST_TONEZONE_FOUND=yes
 else
-  TONEZONE_HEADER_FOUND=0
+  AST_TONEZONE_FOUND=no
 fi
 
+   fi
 
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "xzaptel.h" != "x" ; then
-            if test "${ac_cv_header_zaptel_h+set}" = set; then
+   # now check for the header.
+   if test "${AST_TONEZONE_FOUND}" = "yes"; then
+      TONEZONE_LIB="${pbxlibdir} -ltonezone ${tonezone_extra}"
+      # if --with-TONEZONE=DIR has been specified, use it.
+      if test "x${TONEZONE_DIR}" != "x"; then
+        TONEZONE_INCLUDE="-I${TONEZONE_DIR}/include"
+      fi
+      TONEZONE_INCLUDE="${TONEZONE_INCLUDE} "
+      if test "xzaptel.h" = "x" ; then # no header, assume found
+         TONEZONE_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${TONEZONE_INCLUDE} "
+        if test "${ac_cv_header_zaptel_h+set}" = set; then
   { echo "$as_me:$LINENO: checking for zaptel.h" >&5
 echo $ECHO_N "checking for zaptel.h... $ECHO_C" >&6; }
 if test "${ac_cv_header_zaptel_h+set}" = set; then
@@ -56129,7 +44605,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${TONEZONE_HEADER_FOUND}" = "x0" ; then
          TONEZONE_LIB=""
@@ -56147,7 +44623,7 @@ _ACEOF
 
 
 cat >>confdefs.h <<_ACEOF
-#define HAVE_TONEZONE_VERSION 80
+#define HAVE_TONEZONE_VERSION
 _ACEOF
 
       fi
@@ -56614,6 +45090,7 @@ _ACEOF
 
 if test "x${PBX_SDL_IMAGE}" != "x1" -a "${USE_SDL_IMAGE}" != "no"; then
    pbxlibdir=""
+   # if --with-SDL_IMAGE=DIR has been specified, use it.
    if test "x${SDL_IMAGE_DIR}" != "x"; then
       if test -d ${SDL_IMAGE_DIR}/lib; then
         pbxlibdir="-L${SDL_IMAGE_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_SDL_IMAGE_FOUND}" = "yes"; then
-      SDL_IMAGE_LIB="-lSDL_image ${SDL_LIB}"
-      SDL_IMAGE_HEADER_FOUND="1"
+      SDL_IMAGE_LIB="${pbxlibdir} -lSDL_image ${SDL_LIB}"
+      # if --with-SDL_IMAGE=DIR has been specified, use it.
       if test "x${SDL_IMAGE_DIR}" != "x"; then
-         SDL_IMAGE_LIB="${pbxlibdir} ${SDL_IMAGE_LIB}"
         SDL_IMAGE_INCLUDE="-I${SDL_IMAGE_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${SDL_IMAGE_DIR}/include"
-        if test "xSDL/SDL_image.h" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${SDL_IMAGE_DIR}/include/SDL/SDL_image.h" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${SDL_IMAGE_DIR}/include/SDL/SDL_image.h" >&5
-echo $ECHO_N "checking for ${SDL_IMAGE_DIR}/include/SDL/SDL_image.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${SDL_IMAGE_DIR}/include/SDL/SDL_image.h usability" >&5
-echo $ECHO_N "checking ${SDL_IMAGE_DIR}/include/SDL/SDL_image.h usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <${SDL_IMAGE_DIR}/include/SDL/SDL_image.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking ${SDL_IMAGE_DIR}/include/SDL/SDL_image.h presence" >&5
-echo $ECHO_N "checking ${SDL_IMAGE_DIR}/include/SDL/SDL_image.h presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${SDL_IMAGE_DIR}/include/SDL/SDL_image.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${SDL_IMAGE_DIR}/include/SDL/SDL_image.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${SDL_IMAGE_DIR}/include/SDL/SDL_image.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SDL_IMAGE_DIR}/include/SDL/SDL_image.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${SDL_IMAGE_DIR}/include/SDL/SDL_image.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${SDL_IMAGE_DIR}/include/SDL/SDL_image.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${SDL_IMAGE_DIR}/include/SDL/SDL_image.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SDL_IMAGE_DIR}/include/SDL/SDL_image.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${SDL_IMAGE_DIR}/include/SDL/SDL_image.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SDL_IMAGE_DIR}/include/SDL/SDL_image.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${SDL_IMAGE_DIR}/include/SDL/SDL_image.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SDL_IMAGE_DIR}/include/SDL/SDL_image.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${SDL_IMAGE_DIR}/include/SDL/SDL_image.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SDL_IMAGE_DIR}/include/SDL/SDL_image.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${SDL_IMAGE_DIR}/include/SDL/SDL_image.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SDL_IMAGE_DIR}/include/SDL/SDL_image.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${SDL_IMAGE_DIR}/include/SDL/SDL_image.h: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${SDL_IMAGE_DIR}/include/SDL/SDL_image.h" >&5
-echo $ECHO_N "checking for ${SDL_IMAGE_DIR}/include/SDL/SDL_image.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  SDL_IMAGE_HEADER_FOUND=1
-else
-  SDL_IMAGE_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "xSDL/SDL_image.h" != "x" ; then
-            if test "${ac_cv_header_SDL_SDL_image_h+set}" = set; then
-  { echo "$as_me:$LINENO: checking for SDL/SDL_image.h" >&5
-echo $ECHO_N "checking for SDL/SDL_image.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_SDL_SDL_image_h+set}" = set; then
+      fi
+      SDL_IMAGE_INCLUDE="${SDL_IMAGE_INCLUDE} ${SDL_INCLUDE}"
+      if test "xSDL_image.h" = "x" ; then      # no header, assume found
+         SDL_IMAGE_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${SDL_IMAGE_INCLUDE} ${SDL_INCLUDE}"
+        if test "${ac_cv_header_SDL_image_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for SDL_image.h" >&5
+echo $ECHO_N "checking for SDL_image.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_SDL_image_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_SDL_SDL_image_h" >&5
-echo "${ECHO_T}$ac_cv_header_SDL_SDL_image_h" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_SDL_image_h" >&5
+echo "${ECHO_T}$ac_cv_header_SDL_image_h" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking SDL/SDL_image.h usability" >&5
-echo $ECHO_N "checking SDL/SDL_image.h usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking SDL_image.h usability" >&5
+echo $ECHO_N "checking SDL_image.h usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -56863,7 +45205,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <SDL/SDL_image.h>
+#include <SDL_image.h>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -56895,15 +45237,15 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking SDL/SDL_image.h presence" >&5
-echo $ECHO_N "checking SDL/SDL_image.h presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking SDL_image.h presence" >&5
+echo $ECHO_N "checking SDL_image.h presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <SDL/SDL_image.h>
+#include <SDL_image.h>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -56936,47 +45278,47 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: SDL/SDL_image.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: SDL/SDL_image.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: SDL/SDL_image.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: SDL/SDL_image.h: proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: SDL_image.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: SDL_image.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: SDL_image.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: SDL_image.h: proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: SDL/SDL_image.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: SDL/SDL_image.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: SDL/SDL_image.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: SDL/SDL_image.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: SDL/SDL_image.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: SDL/SDL_image.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: SDL/SDL_image.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: SDL/SDL_image.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: SDL/SDL_image.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: SDL/SDL_image.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: SDL/SDL_image.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: SDL/SDL_image.h: in the future, the compiler will take precedence" >&2;}
+    { echo "$as_me:$LINENO: WARNING: SDL_image.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: SDL_image.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: SDL_image.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: SDL_image.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: SDL_image.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: SDL_image.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: SDL_image.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: SDL_image.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: SDL_image.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: SDL_image.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: SDL_image.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: SDL_image.h: in the future, the compiler will take precedence" >&2;}
 
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for SDL/SDL_image.h" >&5
-echo $ECHO_N "checking for SDL/SDL_image.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_SDL_SDL_image_h+set}" = set; then
+{ echo "$as_me:$LINENO: checking for SDL_image.h" >&5
+echo $ECHO_N "checking for SDL_image.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_SDL_image_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_cv_header_SDL_SDL_image_h=$ac_header_preproc
+  ac_cv_header_SDL_image_h=$ac_header_preproc
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_SDL_SDL_image_h" >&5
-echo "${ECHO_T}$ac_cv_header_SDL_SDL_image_h" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_SDL_image_h" >&5
+echo "${ECHO_T}$ac_cv_header_SDL_image_h" >&6; }
 
 fi
-if test $ac_cv_header_SDL_SDL_image_h = yes; then
+if test $ac_cv_header_SDL_image_h = yes; then
   SDL_IMAGE_HEADER_FOUND=1
 else
   SDL_IMAGE_HEADER_FOUND=0
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${SDL_IMAGE_HEADER_FOUND}" = "x0" ; then
          SDL_IMAGE_LIB=""
@@ -56994,7 +45336,7 @@ _ACEOF
 
 
 cat >>confdefs.h <<_ACEOF
-#define HAVE_SDL_IMAGE_VERSION
+#define HAVE_SDL_IMAGE_VERSION ${SDL_INCLUDE}
 _ACEOF
 
       fi
@@ -57004,6 +45346,7 @@ fi
 
 if test "x${PBX_FFMPEG}" != "x1" -a "${USE_FFMPEG}" != "no"; then
    pbxlibdir=""
+   # if --with-FFMPEG=DIR has been specified, use it.
    if test "x${FFMPEG_DIR}" != "x"; then
       if test -d ${FFMPEG_DIR}/lib; then
         pbxlibdir="-L${FFMPEG_DIR}/lib"
 
    fi
 
+   # now check for the header.
    if test "${AST_FFMPEG_FOUND}" = "yes"; then
-      FFMPEG_LIB="-lavcodec -lpthread -lz -lm"
-      FFMPEG_HEADER_FOUND="1"
+      FFMPEG_LIB="${pbxlibdir} -lavcodec -lpthread -lz -lm"
+      # if --with-FFMPEG=DIR has been specified, use it.
       if test "x${FFMPEG_DIR}" != "x"; then
-         FFMPEG_LIB="${pbxlibdir} ${FFMPEG_LIB}"
         FFMPEG_INCLUDE="-I${FFMPEG_DIR}/include"
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I${FFMPEG_DIR}/include"
-        if test "xffmpeg/avcodec.h" != "x" ; then
-           as_ac_Header=`echo "ac_cv_header_${FFMPEG_DIR}/include/ffmpeg/avcodec.h" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${FFMPEG_DIR}/include/ffmpeg/avcodec.h" >&5
-echo $ECHO_N "checking for ${FFMPEG_DIR}/include/ffmpeg/avcodec.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${FFMPEG_DIR}/include/ffmpeg/avcodec.h usability" >&5
-echo $ECHO_N "checking ${FFMPEG_DIR}/include/ffmpeg/avcodec.h usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <${FFMPEG_DIR}/include/ffmpeg/avcodec.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking ${FFMPEG_DIR}/include/ffmpeg/avcodec.h presence" >&5
-echo $ECHO_N "checking ${FFMPEG_DIR}/include/ffmpeg/avcodec.h presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${FFMPEG_DIR}/include/ffmpeg/avcodec.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${FFMPEG_DIR}/include/ffmpeg/avcodec.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${FFMPEG_DIR}/include/ffmpeg/avcodec.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${FFMPEG_DIR}/include/ffmpeg/avcodec.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${FFMPEG_DIR}/include/ffmpeg/avcodec.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${FFMPEG_DIR}/include/ffmpeg/avcodec.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${FFMPEG_DIR}/include/ffmpeg/avcodec.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${FFMPEG_DIR}/include/ffmpeg/avcodec.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${FFMPEG_DIR}/include/ffmpeg/avcodec.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${FFMPEG_DIR}/include/ffmpeg/avcodec.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${FFMPEG_DIR}/include/ffmpeg/avcodec.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${FFMPEG_DIR}/include/ffmpeg/avcodec.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${FFMPEG_DIR}/include/ffmpeg/avcodec.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${FFMPEG_DIR}/include/ffmpeg/avcodec.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${FFMPEG_DIR}/include/ffmpeg/avcodec.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${FFMPEG_DIR}/include/ffmpeg/avcodec.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${FFMPEG_DIR}/include/ffmpeg/avcodec.h: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${FFMPEG_DIR}/include/ffmpeg/avcodec.h" >&5
-echo $ECHO_N "checking for ${FFMPEG_DIR}/include/ffmpeg/avcodec.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  FFMPEG_HEADER_FOUND=1
-else
-  FFMPEG_HEADER_FOUND=0
-fi
-
-
-        fi
-        CPPFLAGS="${saved_cppflags}"
-      else
-        if test "xffmpeg/avcodec.h" != "x" ; then
-            if test "${ac_cv_header_ffmpeg_avcodec_h+set}" = set; then
+      fi
+      FFMPEG_INCLUDE="${FFMPEG_INCLUDE} "
+      if test "xffmpeg/avcodec.h" = "x" ; then # no header, assume found
+         FFMPEG_HEADER_FOUND="1"
+      else                             # check for the header
+         saved_cppflags="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${FFMPEG_INCLUDE} "
+        if test "${ac_cv_header_ffmpeg_avcodec_h+set}" = set; then
   { echo "$as_me:$LINENO: checking for ffmpeg/avcodec.h" >&5
 echo $ECHO_N "checking for ffmpeg/avcodec.h... $ECHO_C" >&6; }
 if test "${ac_cv_header_ffmpeg_avcodec_h+set}" = set; then
@@ -57366,7 +45574,7 @@ else
 fi
 
 
-        fi
+         CPPFLAGS="${saved_cppflags}"
       fi
       if test "x${FFMPEG_HEADER_FOUND}" = "x0" ; then
          FFMPEG_LIB=""
index 63702a33f81aee747c3282e0d6fe56fb2e66a510..26ab76b2d70ae0eb980efc8941fb94f306ff8202 100644 (file)
@@ -1141,12 +1141,12 @@ AST_C_DEFINE_CHECK([ZAPTEL_TRANSCODE], [ZT_TCOP_ALLOCATE], [zaptel/zaptel.h])
 # On FreeBSD, try old zaptel (0.80 or so) and pretend we have vldtmf
 case "${host_os}" in
     freebsd*)
-       AST_EXT_LIB_CHECK([ZAPTEL], [zaptel],, [zaptel.h],, [80])
-       AST_EXT_LIB_CHECK([ZAPTEL_VLDTMF], [zaptel],, [zaptel/zaptel.h],, [90])
-       AST_EXT_LIB_CHECK([ZAPTEL_VLDTMF], [zaptel],, [zaptel.h],, [80])
+       AST_EXT_LIB_CHECK([ZAPTEL], [zaptel],, [zaptel.h],,, [80])
+       AST_EXT_LIB_CHECK([ZAPTEL_VLDTMF], [zaptel],, [zaptel/zaptel.h],,, [90])
+       AST_EXT_LIB_CHECK([ZAPTEL_VLDTMF], [zaptel],, [zaptel.h],,, [80])
 
        # other case, old tonezone (0.80)
-       AST_EXT_LIB_CHECK([TONEZONE], [tonezone], [tone_zone_find], [zaptel.h], [${tonezone_extra}], [80])
+       AST_EXT_LIB_CHECK([TONEZONE], [tonezone], [tone_zone_find], [zaptel.h], [${tonezone_extra}],, [80])
        ;;
 esac
 
@@ -1179,7 +1179,7 @@ AC_CHECK_HEADER([linux/ixjuser.h], [PBX_IXJUSER=1], [PBX_IXJUSER=0], [
 AC_SUBST(PBX_IXJUSER)
 
 AST_EXT_TOOL_CHECK([SDL], [sdl])
-AST_EXT_LIB_CHECK([SDL_IMAGE], [SDL_image], [IMG_Load], [SDL/SDL_image.h], [${SDL_LIB}])
+AST_EXT_LIB_CHECK([SDL_IMAGE], [SDL_image], [IMG_Load], [SDL_image.h], [${SDL_LIB}], [${SDL_INCLUDE}])
 AST_EXT_LIB_CHECK([FFMPEG], [avcodec], [sws_getContext], [ffmpeg/avcodec.h], [-lpthread -lz -lm])
 
 PBX_GTK=0