From 1bf2d9e9c615686421bd12a556b51f7884705d03 Mon Sep 17 00:00:00 2001
From: Tilghman Lesher <tilghman@meg.abyt.es>
Date: Tue, 13 Sep 2011 18:56:45 +0000
Subject: [PATCH] Merged revisions 335656 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/10

................
  r335656 | tilghman | 2011-09-13 13:55:33 -0500 (Tue, 13 Sep 2011) | 11 lines

  Merged revisions 335655 via svnmerge from
  https://origsvn.digium.com/svn/asterisk/branches/1.8

  ........
    r335655 | tilghman | 2011-09-13 13:52:38 -0500 (Tue, 13 Sep 2011) | 4 lines

    Move mandatory checks closer to the beginning of the file.

    If these are going to fail, they should fail as quickly as possible.
  ........
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@335657 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 configure    | 1673 +++++++++++++++++++++++++-------------------------
 configure.ac |   87 ++-
 2 files changed, 879 insertions(+), 881 deletions(-)

diff --git a/configure b/configure
index a8264d6fa9..ffe9fc6bb7 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.ac Revision: 332388 .
+# From configure.ac Revision: 333204 .
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.67 for asterisk trunk.
 #
@@ -620,7 +620,6 @@ PBX_SO_NOSIGPIPE
 PBX_MSG_NOSIGNAL
 PBX_IXJUSER
 PBX_H323
-EDITLINE_LIB
 CONFIG_GMIME
 AIS_LIB
 AIS_INCLUDE
@@ -642,7 +641,6 @@ CONFIG_NEON
 CONFIG_MYSQLCLIENT
 PBX_MISDN_FAC_ERROR
 PBX_MISDN_FAC_RESULT
-CONFIG_LIBXML2
 GSM_INTERNAL
 PBX_DAHDI_HALF_FULL
 PKGCONFIG
@@ -665,6 +663,8 @@ PBX_DYNAMIC_LIST
 POW_LIB
 PBX_WORKING_FORK
 LIBOBJS
+CONFIG_LIBXML2
+EDITLINE_LIB
 ALLOCA
 PBX_ZLIB
 ZLIB_DIR
@@ -1237,9 +1237,9 @@ with_vorbis
 with_vpb
 with_x11
 with_z
+enable_xmldoc
 enable_largefile
 enable_internal_poll
-enable_xmldoc
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1871,9 +1871,9 @@ Optional Features:
   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
   --enable-dev-mode       Turn on developer mode
   --enable-coverage       Turn on code coverage tracking (for gcov)
+  --disable-xmldoc        Explicity disable XML documentation
   --disable-largefile     omit support for large files
   --enable-internal-poll  Use Asterisk's poll implementation
-  --disable-xmldoc        Explicity disable XML documentation
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -11510,126 +11510,735 @@ fi
 done
 
 
-# some embedded systems omit internationalization (locale) support
-for ac_header in xlocale.h
-do :
-  ac_fn_c_check_header_mongrel "$LINENO" "xlocale.h" "ac_cv_header_xlocale_h" "$ac_includes_default"
-if test "x$ac_cv_header_xlocale_h" = x""yes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_XLOCALE_H 1
-_ACEOF
-
-fi
-
-done
+# Any one of these 4 packages support a mandatory requirement, so we want to check on them as early as possible.
 
+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"
+      else
+      	 pbxlibdir="-L${TERMCAP_DIR}"
+      fi
+   fi
+   pbxfuncname="tgetent"
+   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
+      AST_TERMCAP_FOUND=yes
+   else
+      ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
+      CFLAGS="${CFLAGS} "
+      as_ac_Lib=`$as_echo "ac_cv_lib_termcap_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -ltermcap" >&5
+$as_echo_n "checking for ${pbxfuncname} in -ltermcap... " >&6; }
+if eval "test \"\${$as_ac_Lib+set}\"" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ltermcap ${pbxlibdir}  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
-for ac_header in winsock.h winsock2.h
-do :
-  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
-if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char ${pbxfuncname} ();
+int
+main ()
+{
+return ${pbxfuncname} ();
+  ;
+  return 0;
+}
 _ACEOF
-
+if ac_fn_c_try_link "$LINENO"; then :
+  eval "$as_ac_Lib=yes"
+else
+  eval "$as_ac_Lib=no"
 fi
-
-done
-
-
-ac_fn_c_check_header_mongrel "$LINENO" "sys/poll.h" "ac_cv_header_sys_poll_h" "$ac_includes_default"
-if test "x$ac_cv_header_sys_poll_h" = x""yes; then :
-
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+eval ac_res=\$$as_ac_Lib
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
+  AST_TERMCAP_FOUND=yes
 else
+  AST_TERMCAP_FOUND=no
+fi
 
-$as_echo "#define AST_POLL_COMPAT 1" >>confdefs.h
+      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
+   fi
 
+   # now check for the header.
+   if test "${AST_TERMCAP_FOUND}" = "yes"; then
+      TERMCAP_LIB="${pbxlibdir} -ltermcap "
+      # if --with-TERMCAP=DIR has been specified, use it.
+      if test "x${TERMCAP_DIR}" != "x"; then
+         TERMCAP_INCLUDE="-I${TERMCAP_DIR}/include"
+      fi
+      TERMCAP_INCLUDE="${TERMCAP_INCLUDE} "
+      if test "x" = "x" ; then	# no header, assume found
+         TERMCAP_HEADER_FOUND="1"
+      else				# check for the header
+         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${TERMCAP_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "" "ac_cv_header_" "$ac_includes_default"
+if test "x$ac_cv_header_" = x""yes; then :
+  TERMCAP_HEADER_FOUND=1
+else
+  TERMCAP_HEADER_FOUND=0
 fi
 
 
+         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
+      fi
+      if test "x${TERMCAP_HEADER_FOUND}" = "x0" ; then
+         TERMCAP_LIB=""
+         TERMCAP_INCLUDE=""
+      else
+         if test "x${pbxfuncname}" = "x" ; then		# only checking headers -> no library
+            TERMCAP_LIB=""
+         fi
+         PBX_TERMCAP=1
+         cat >>confdefs.h <<_ACEOF
+#define HAVE_TERMCAP 1
+_ACEOF
 
-# Check whether --enable-largefile was given.
-if test "${enable_largefile+set}" = set; then :
-  enableval=$enable_largefile;
+      fi
+   fi
 fi
 
-if test "$enable_largefile" != no; then
 
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5
-$as_echo_n "checking for special C compiler options needed for large files... " >&6; }
-if test "${ac_cv_sys_largefile_CC+set}" = set; then :
+
+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"
+      else
+      	 pbxlibdir="-L${TINFO_DIR}"
+      fi
+   fi
+   pbxfuncname="tgetent"
+   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
+      AST_TINFO_FOUND=yes
+   else
+      ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
+      CFLAGS="${CFLAGS} "
+      as_ac_Lib=`$as_echo "ac_cv_lib_tinfo_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -ltinfo" >&5
+$as_echo_n "checking for ${pbxfuncname} in -ltinfo... " >&6; }
+if eval "test \"\${$as_ac_Lib+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  ac_cv_sys_largefile_CC=no
-     if test "$GCC" != yes; then
-       ac_save_CC=$CC
-       while :; do
-	 # IRIX 6.2 and later do not support large files by default,
-	 # so use the C compiler's -n32 option if that helps.
-	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ltinfo ${pbxlibdir}  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <sys/types.h>
- /* Check that off_t can represent 2**63 - 1 correctly.
-    We can't simply define LARGE_OFF_T to be 9223372036854775807,
-    since some C++ compilers masquerading as C compilers
-    incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
-  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
-		       && LARGE_OFF_T % 2147483647 == 1)
-		      ? 1 : -1];
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char ${pbxfuncname} ();
 int
 main ()
 {
-
+return ${pbxfuncname} ();
   ;
   return 0;
 }
 _ACEOF
-	 if ac_fn_c_try_compile "$LINENO"; then :
-  break
+if ac_fn_c_try_link "$LINENO"; then :
+  eval "$as_ac_Lib=yes"
+else
+  eval "$as_ac_Lib=no"
 fi
-rm -f core conftest.err conftest.$ac_objext
-	 CC="$CC -n32"
-	 if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_sys_largefile_CC=' -n32'; break
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
 fi
-rm -f core conftest.err conftest.$ac_objext
-	 break
-       done
-       CC=$ac_save_CC
-       rm -f conftest.$ac_ext
-    fi
+eval ac_res=\$$as_ac_Lib
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
+  AST_TINFO_FOUND=yes
+else
+  AST_TINFO_FOUND=no
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5
-$as_echo "$ac_cv_sys_largefile_CC" >&6; }
-  if test "$ac_cv_sys_largefile_CC" != no; then
-    CC=$CC$ac_cv_sys_largefile_CC
-  fi
 
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5
-$as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; }
-if test "${ac_cv_sys_file_offset_bits+set}" = set; then :
-  $as_echo_n "(cached) " >&6
+      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
+   fi
+
+   # now check for the header.
+   if test "${AST_TINFO_FOUND}" = "yes"; then
+      TINFO_LIB="${pbxlibdir} -ltinfo "
+      # if --with-TINFO=DIR has been specified, use it.
+      if test "x${TINFO_DIR}" != "x"; then
+         TINFO_INCLUDE="-I${TINFO_DIR}/include"
+      fi
+      TINFO_INCLUDE="${TINFO_INCLUDE} "
+      if test "x" = "x" ; then	# no header, assume found
+         TINFO_HEADER_FOUND="1"
+      else				# check for the header
+         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${TINFO_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "" "ac_cv_header_" "$ac_includes_default"
+if test "x$ac_cv_header_" = x""yes; then :
+  TINFO_HEADER_FOUND=1
 else
-  while :; do
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <sys/types.h>
- /* Check that off_t can represent 2**63 - 1 correctly.
-    We can't simply define LARGE_OFF_T to be 9223372036854775807,
-    since some C++ compilers masquerading as C compilers
-    incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
-  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
-		       && LARGE_OFF_T % 2147483647 == 1)
-		      ? 1 : -1];
-int
-main ()
-{
+  TINFO_HEADER_FOUND=0
+fi
 
-  ;
-  return 0;
+
+         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
+      fi
+      if test "x${TINFO_HEADER_FOUND}" = "x0" ; then
+         TINFO_LIB=""
+         TINFO_INCLUDE=""
+      else
+         if test "x${pbxfuncname}" = "x" ; then		# only checking headers -> no library
+            TINFO_LIB=""
+         fi
+         PBX_TINFO=1
+         cat >>confdefs.h <<_ACEOF
+#define HAVE_TINFO 1
+_ACEOF
+
+      fi
+   fi
+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"
+      else
+      	 pbxlibdir="-L${CURSES_DIR}"
+      fi
+   fi
+   pbxfuncname="initscr"
+   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
+      AST_CURSES_FOUND=yes
+   else
+      ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
+      CFLAGS="${CFLAGS} "
+      as_ac_Lib=`$as_echo "ac_cv_lib_curses_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lcurses" >&5
+$as_echo_n "checking for ${pbxfuncname} in -lcurses... " >&6; }
+if eval "test \"\${$as_ac_Lib+set}\"" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lcurses ${pbxlibdir}  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char ${pbxfuncname} ();
+int
+main ()
+{
+return ${pbxfuncname} ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  eval "$as_ac_Lib=yes"
+else
+  eval "$as_ac_Lib=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+eval ac_res=\$$as_ac_Lib
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
+  AST_CURSES_FOUND=yes
+else
+  AST_CURSES_FOUND=no
+fi
+
+      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
+   fi
+
+   # now check for the header.
+   if test "${AST_CURSES_FOUND}" = "yes"; then
+      CURSES_LIB="${pbxlibdir} -lcurses "
+      # if --with-CURSES=DIR has been specified, use it.
+      if test "x${CURSES_DIR}" != "x"; then
+         CURSES_INCLUDE="-I${CURSES_DIR}/include"
+      fi
+      CURSES_INCLUDE="${CURSES_INCLUDE} "
+      if test "xcurses.h" = "x" ; then	# no header, assume found
+         CURSES_HEADER_FOUND="1"
+      else				# check for the header
+         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${CURSES_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "curses.h" "ac_cv_header_curses_h" "$ac_includes_default"
+if test "x$ac_cv_header_curses_h" = x""yes; then :
+  CURSES_HEADER_FOUND=1
+else
+  CURSES_HEADER_FOUND=0
+fi
+
+
+         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
+      fi
+      if test "x${CURSES_HEADER_FOUND}" = "x0" ; then
+         CURSES_LIB=""
+         CURSES_INCLUDE=""
+      else
+         if test "x${pbxfuncname}" = "x" ; then		# only checking headers -> no library
+            CURSES_LIB=""
+         fi
+         PBX_CURSES=1
+         cat >>confdefs.h <<_ACEOF
+#define HAVE_CURSES 1
+_ACEOF
+
+      fi
+   fi
+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"
+      else
+      	 pbxlibdir="-L${NCURSES_DIR}"
+      fi
+   fi
+   pbxfuncname="initscr"
+   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
+      AST_NCURSES_FOUND=yes
+   else
+      ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
+      CFLAGS="${CFLAGS} "
+      as_ac_Lib=`$as_echo "ac_cv_lib_ncurses_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lncurses" >&5
+$as_echo_n "checking for ${pbxfuncname} in -lncurses... " >&6; }
+if eval "test \"\${$as_ac_Lib+set}\"" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lncurses ${pbxlibdir}  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char ${pbxfuncname} ();
+int
+main ()
+{
+return ${pbxfuncname} ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  eval "$as_ac_Lib=yes"
+else
+  eval "$as_ac_Lib=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+eval ac_res=\$$as_ac_Lib
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
+  AST_NCURSES_FOUND=yes
+else
+  AST_NCURSES_FOUND=no
+fi
+
+      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
+   fi
+
+   # now check for the header.
+   if test "${AST_NCURSES_FOUND}" = "yes"; then
+      NCURSES_LIB="${pbxlibdir} -lncurses "
+      # if --with-NCURSES=DIR has been specified, use it.
+      if test "x${NCURSES_DIR}" != "x"; then
+         NCURSES_INCLUDE="-I${NCURSES_DIR}/include"
+      fi
+      NCURSES_INCLUDE="${NCURSES_INCLUDE} "
+      if test "xcurses.h" = "x" ; then	# no header, assume found
+         NCURSES_HEADER_FOUND="1"
+      else				# check for the header
+         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${NCURSES_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "curses.h" "ac_cv_header_curses_h" "$ac_includes_default"
+if test "x$ac_cv_header_curses_h" = x""yes; then :
+  NCURSES_HEADER_FOUND=1
+else
+  NCURSES_HEADER_FOUND=0
+fi
+
+
+         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
+      fi
+      if test "x${NCURSES_HEADER_FOUND}" = "x0" ; then
+         NCURSES_LIB=""
+         NCURSES_INCLUDE=""
+      else
+         if test "x${pbxfuncname}" = "x" ; then		# only checking headers -> no library
+            NCURSES_LIB=""
+         fi
+         PBX_NCURSES=1
+         cat >>confdefs.h <<_ACEOF
+#define HAVE_NCURSES 1
+_ACEOF
+
+      fi
+   fi
+fi
+
+
+
+EDITLINE_LIB=""
+if test "x$TERMCAP_LIB" != "x" ; then
+  EDITLINE_LIB="$TERMCAP_LIB"
+elif test "x$TINFO_LIB" != "x" ; then
+  EDITLINE_LIB="$TINFO_LIB"
+elif test "x$CURSES_LIB" != "x" ; then
+  EDITLINE_LIB="$CURSES_LIB"
+elif test "x$NCURSES_LIB" != "x" ; then
+  EDITLINE_LIB="$NCURSES_LIB"
+else
+  as_fn_error $? "*** termcap support not found (on modern systems, this typically means the ncurses development package is missing)" "$LINENO" 5
+fi
+
+
+# Another mandatory item (unless it's explicitly disabled)
+# Check whether --enable-xmldoc was given.
+if test "${enable_xmldoc+set}" = set; then :
+  enableval=$enable_xmldoc; case "${enableval}" in
+		y|ye|yes) disable_xmldoc=no ;;
+		n|no)  disable_xmldoc=yes ;;
+		*) as_fn_error $? "bad value ${enableval} for --disable-xmldoc" "$LINENO" 5   ;;
+	esac
+else
+  disable_xmldoc=no
+fi
+
+
+if test "${disable_xmldoc}" != "yes"; then
+
+    if test "x${PBX_LIBXML2}" != "x1" -a "${USE_LIBXML2}" != "no"; then
+	PBX_LIBXML2=0
+	if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}xml2-config", so it can be a program name with args.
+set dummy ${ac_tool_prefix}xml2-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_CONFIG_LIBXML2+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $CONFIG_LIBXML2 in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_CONFIG_LIBXML2="$CONFIG_LIBXML2" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+as_dummy="${LIBXML2_DIR}/bin:$PATH"
+for as_dir in $as_dummy
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_CONFIG_LIBXML2="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+CONFIG_LIBXML2=$ac_cv_path_CONFIG_LIBXML2
+if test -n "$CONFIG_LIBXML2"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CONFIG_LIBXML2" >&5
+$as_echo "$CONFIG_LIBXML2" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_CONFIG_LIBXML2"; then
+  ac_pt_CONFIG_LIBXML2=$CONFIG_LIBXML2
+  # Extract the first word of "xml2-config", so it can be a program name with args.
+set dummy xml2-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_ac_pt_CONFIG_LIBXML2+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $ac_pt_CONFIG_LIBXML2 in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_ac_pt_CONFIG_LIBXML2="$ac_pt_CONFIG_LIBXML2" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+as_dummy="${LIBXML2_DIR}/bin:$PATH"
+for as_dir in $as_dummy
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_ac_pt_CONFIG_LIBXML2="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+ac_pt_CONFIG_LIBXML2=$ac_cv_path_ac_pt_CONFIG_LIBXML2
+if test -n "$ac_pt_CONFIG_LIBXML2"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_CONFIG_LIBXML2" >&5
+$as_echo "$ac_pt_CONFIG_LIBXML2" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_pt_CONFIG_LIBXML2" = x; then
+    CONFIG_LIBXML2="No"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    CONFIG_LIBXML2=$ac_pt_CONFIG_LIBXML2
+  fi
+else
+  CONFIG_LIBXML2="$ac_cv_path_CONFIG_LIBXML2"
+fi
+
+	if test ! "x${CONFIG_LIBXML2}" = xNo; then
+	    if test x"" = x ; then A=--cflags ; else A="" ; fi
+	    LIBXML2_INCLUDE=$(${CONFIG_LIBXML2} $A)
+	    if test x"" = x ; then A=--libs ; else A="" ; fi
+	    LIBXML2_LIB=$(${CONFIG_LIBXML2} $A)
+	    if test x"#include <libxml/tree.h>
+	#include <libxml/parser.h>" != x ; then
+		saved_cppflags="${CPPFLAGS}"
+		if test "x${LIBXML2_DIR}" != "x"; then
+		    LIBXML2_INCLUDE="-I${LIBXML2_DIR}/include"
+		fi
+		CPPFLAGS="${CPPFLAGS} ${LIBXML2_INCLUDE}"
+
+		saved_libs="${LIBS}"
+		LIBS="${LIBXML2_LIB}"
+
+		cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+  #include <libxml/tree.h>
+	#include <libxml/parser.h>
+int
+main ()
+{
+ LIBXML_TEST_VERSION;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+     PBX_LIBXML2=1
+
+$as_echo "#define HAVE_LIBXML2 1" >>confdefs.h
+
+
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+		CPPFLAGS="${saved_cppflags}"
+		LIBS="${saved_libs}"
+	    else
+		PBX_LIBXML2=1
+
+$as_echo "#define HAVE_LIBXML2 1" >>confdefs.h
+
+	    fi
+	fi
+    fi
+
+	if test "${PBX_LIBXML2}" != 1; then
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: *** XML documentation will not be available because the 'libxml2' development package is missing." >&5
+$as_echo "$as_me: *** XML documentation will not be available because the 'libxml2' development package is missing." >&6;}
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: *** Please run the 'configure' script with the '--disable-xmldoc' parameter option" >&5
+$as_echo "$as_me: *** Please run the 'configure' script with the '--disable-xmldoc' parameter option" >&6;}
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: *** or install the 'libxml2' development package." >&5
+$as_echo "$as_me: *** or install the 'libxml2' development package." >&6;}
+		exit 1
+	fi
+fi
+
+# some embedded systems omit internationalization (locale) support
+for ac_header in xlocale.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "xlocale.h" "ac_cv_header_xlocale_h" "$ac_includes_default"
+if test "x$ac_cv_header_xlocale_h" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_XLOCALE_H 1
+_ACEOF
+
+fi
+
+done
+
+
+for ac_header in winsock.h winsock2.h
+do :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+ac_fn_c_check_header_mongrel "$LINENO" "sys/poll.h" "ac_cv_header_sys_poll_h" "$ac_includes_default"
+if test "x$ac_cv_header_sys_poll_h" = x""yes; then :
+
+else
+
+$as_echo "#define AST_POLL_COMPAT 1" >>confdefs.h
+
+fi
+
+
+
+# Check whether --enable-largefile was given.
+if test "${enable_largefile+set}" = set; then :
+  enableval=$enable_largefile;
+fi
+
+if test "$enable_largefile" != no; then
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5
+$as_echo_n "checking for special C compiler options needed for large files... " >&6; }
+if test "${ac_cv_sys_largefile_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_cv_sys_largefile_CC=no
+     if test "$GCC" != yes; then
+       ac_save_CC=$CC
+       while :; do
+	 # IRIX 6.2 and later do not support large files by default,
+	 # so use the C compiler's -n32 option if that helps.
+	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+		       && LARGE_OFF_T % 2147483647 == 1)
+		      ? 1 : -1];
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+	 if ac_fn_c_try_compile "$LINENO"; then :
+  break
+fi
+rm -f core conftest.err conftest.$ac_objext
+	 CC="$CC -n32"
+	 if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_sys_largefile_CC=' -n32'; break
+fi
+rm -f core conftest.err conftest.$ac_objext
+	 break
+       done
+       CC=$ac_save_CC
+       rm -f conftest.$ac_ext
+    fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5
+$as_echo "$ac_cv_sys_largefile_CC" >&6; }
+  if test "$ac_cv_sys_largefile_CC" != no; then
+    CC=$CC$ac_cv_sys_largefile_CC
+  fi
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5
+$as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; }
+if test "${ac_cv_sys_file_offset_bits+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  while :; do
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+		       && LARGE_OFF_T % 2147483647 == 1)
+		      ? 1 : -1];
+int
+main ()
+{
+
+  ;
+  return 0;
 }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
@@ -16372,152 +16981,47 @@ eval ac_res=\$$as_ac_Lib
 	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
 if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
-  AST_BFD_FOUND=yes
-else
-  AST_BFD_FOUND=no
-fi
-
-      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
-   fi
-
-   # now check for the header.
-   if test "${AST_BFD_FOUND}" = "yes"; then
-      BFD_LIB="${pbxlibdir} -lbfd "
-      # if --with-BFD=DIR has been specified, use it.
-      if test "x${BFD_DIR}" != "x"; then
-         BFD_INCLUDE="-I${BFD_DIR}/include"
-      fi
-      BFD_INCLUDE="${BFD_INCLUDE} "
-      if test "xbfd.h" = "x" ; then	# no header, assume found
-         BFD_HEADER_FOUND="1"
-      else				# check for the header
-         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${BFD_INCLUDE}"
-         ac_fn_c_check_header_mongrel "$LINENO" "bfd.h" "ac_cv_header_bfd_h" "$ac_includes_default"
-if test "x$ac_cv_header_bfd_h" = x""yes; then :
-  BFD_HEADER_FOUND=1
-else
-  BFD_HEADER_FOUND=0
-fi
-
-
-         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
-      fi
-      if test "x${BFD_HEADER_FOUND}" = "x0" ; then
-         BFD_LIB=""
-         BFD_INCLUDE=""
-      else
-         if test "x${pbxfuncname}" = "x" ; then		# only checking headers -> no library
-            BFD_LIB=""
-         fi
-         PBX_BFD=1
-         cat >>confdefs.h <<_ACEOF
-#define HAVE_BFD 1
-_ACEOF
-
-      fi
-   fi
-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"
-      else
-      	 pbxlibdir="-L${CURSES_DIR}"
-      fi
-   fi
-   pbxfuncname="initscr"
-   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_CURSES_FOUND=yes
-   else
-      ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
-      CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_curses_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lcurses" >&5
-$as_echo_n "checking for ${pbxfuncname} in -lcurses... " >&6; }
-if eval "test \"\${$as_ac_Lib+set}\"" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lcurses ${pbxlibdir}  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char ${pbxfuncname} ();
-int
-main ()
-{
-return ${pbxfuncname} ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
-else
-  eval "$as_ac_Lib=no"
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-eval ac_res=\$$as_ac_Lib
-	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
-  AST_CURSES_FOUND=yes
+  AST_BFD_FOUND=yes
 else
-  AST_CURSES_FOUND=no
+  AST_BFD_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
    fi
 
    # now check for the header.
-   if test "${AST_CURSES_FOUND}" = "yes"; then
-      CURSES_LIB="${pbxlibdir} -lcurses "
-      # if --with-CURSES=DIR has been specified, use it.
-      if test "x${CURSES_DIR}" != "x"; then
-         CURSES_INCLUDE="-I${CURSES_DIR}/include"
+   if test "${AST_BFD_FOUND}" = "yes"; then
+      BFD_LIB="${pbxlibdir} -lbfd "
+      # if --with-BFD=DIR has been specified, use it.
+      if test "x${BFD_DIR}" != "x"; then
+         BFD_INCLUDE="-I${BFD_DIR}/include"
       fi
-      CURSES_INCLUDE="${CURSES_INCLUDE} "
-      if test "xcurses.h" = "x" ; then	# no header, assume found
-         CURSES_HEADER_FOUND="1"
+      BFD_INCLUDE="${BFD_INCLUDE} "
+      if test "xbfd.h" = "x" ; then	# no header, assume found
+         BFD_HEADER_FOUND="1"
       else				# check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${CURSES_INCLUDE}"
-         ac_fn_c_check_header_mongrel "$LINENO" "curses.h" "ac_cv_header_curses_h" "$ac_includes_default"
-if test "x$ac_cv_header_curses_h" = x""yes; then :
-  CURSES_HEADER_FOUND=1
+         CPPFLAGS="${CPPFLAGS} ${BFD_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "bfd.h" "ac_cv_header_bfd_h" "$ac_includes_default"
+if test "x$ac_cv_header_bfd_h" = x""yes; then :
+  BFD_HEADER_FOUND=1
 else
-  CURSES_HEADER_FOUND=0
+  BFD_HEADER_FOUND=0
 fi
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
       fi
-      if test "x${CURSES_HEADER_FOUND}" = "x0" ; then
-         CURSES_LIB=""
-         CURSES_INCLUDE=""
+      if test "x${BFD_HEADER_FOUND}" = "x0" ; then
+         BFD_LIB=""
+         BFD_INCLUDE=""
       else
          if test "x${pbxfuncname}" = "x" ; then		# only checking headers -> no library
-            CURSES_LIB=""
+            BFD_LIB=""
          fi
-         PBX_CURSES=1
+         PBX_BFD=1
          cat >>confdefs.h <<_ACEOF
-#define HAVE_CURSES 1
+#define HAVE_BFD 1
 _ACEOF
 
       fi
@@ -18846,298 +19350,122 @@ fi
             LTDL_LIB=""
          fi
          PBX_LTDL=1
-         cat >>confdefs.h <<_ACEOF
-#define HAVE_LTDL 1
-_ACEOF
-
-      fi
-   fi
-fi
-
-
-
-
-if test "x${PBX_LDAP}" != "x1" -a "${USE_LDAP}" != "no"; then
-   pbxlibdir=""
-   # if --with-LDAP=DIR has been specified, use it.
-   if test "x${LDAP_DIR}" != "x"; then
-      if test -d ${LDAP_DIR}/lib; then
-      	 pbxlibdir="-L${LDAP_DIR}/lib"
-      else
-      	 pbxlibdir="-L${LDAP_DIR}"
-      fi
-   fi
-   pbxfuncname="ldap_initialize"
-   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_LDAP_FOUND=yes
-   else
-      ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
-      CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_ldap_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lldap" >&5
-$as_echo_n "checking for ${pbxfuncname} in -lldap... " >&6; }
-if eval "test \"\${$as_ac_Lib+set}\"" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lldap ${pbxlibdir}  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char ${pbxfuncname} ();
-int
-main ()
-{
-return ${pbxfuncname} ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
-else
-  eval "$as_ac_Lib=no"
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-eval ac_res=\$$as_ac_Lib
-	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
-  AST_LDAP_FOUND=yes
-else
-  AST_LDAP_FOUND=no
-fi
-
-      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
-   fi
-
-   # now check for the header.
-   if test "${AST_LDAP_FOUND}" = "yes"; then
-      LDAP_LIB="${pbxlibdir} -lldap "
-      # if --with-LDAP=DIR has been specified, use it.
-      if test "x${LDAP_DIR}" != "x"; then
-         LDAP_INCLUDE="-I${LDAP_DIR}/include"
-      fi
-      LDAP_INCLUDE="${LDAP_INCLUDE} "
-      if test "xldap.h" = "x" ; then	# no header, assume found
-         LDAP_HEADER_FOUND="1"
-      else				# check for the header
-         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${LDAP_INCLUDE}"
-         ac_fn_c_check_header_mongrel "$LINENO" "ldap.h" "ac_cv_header_ldap_h" "$ac_includes_default"
-if test "x$ac_cv_header_ldap_h" = x""yes; then :
-  LDAP_HEADER_FOUND=1
-else
-  LDAP_HEADER_FOUND=0
-fi
-
-
-         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
-      fi
-      if test "x${LDAP_HEADER_FOUND}" = "x0" ; then
-         LDAP_LIB=""
-         LDAP_INCLUDE=""
-      else
-         if test "x${pbxfuncname}" = "x" ; then		# only checking headers -> no library
-            LDAP_LIB=""
-         fi
-         PBX_LDAP=1
-         cat >>confdefs.h <<_ACEOF
-#define HAVE_LDAP 1
-_ACEOF
-
-      fi
-   fi
-fi
-
-
-
-# Check whether --enable-xmldoc was given.
-if test "${enable_xmldoc+set}" = set; then :
-  enableval=$enable_xmldoc; case "${enableval}" in
-		y|ye|yes) disable_xmldoc=no ;;
-		n|no)  disable_xmldoc=yes ;;
-		*) as_fn_error $? "bad value ${enableval} for --disable-xmldoc" "$LINENO" 5   ;;
-	esac
-else
-  disable_xmldoc=no
-fi
-
-
-if test "${disable_xmldoc}" != "yes"; then
-
-    if test "x${PBX_LIBXML2}" != "x1" -a "${USE_LIBXML2}" != "no"; then
-	PBX_LIBXML2=0
-	if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}xml2-config", so it can be a program name with args.
-set dummy ${ac_tool_prefix}xml2-config; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_CONFIG_LIBXML2+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $CONFIG_LIBXML2 in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_CONFIG_LIBXML2="$CONFIG_LIBXML2" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-as_dummy="${LIBXML2_DIR}/bin:$PATH"
-for as_dir in $as_dummy
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_CONFIG_LIBXML2="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-  ;;
-esac
-fi
-CONFIG_LIBXML2=$ac_cv_path_CONFIG_LIBXML2
-if test -n "$CONFIG_LIBXML2"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CONFIG_LIBXML2" >&5
-$as_echo "$CONFIG_LIBXML2" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_path_CONFIG_LIBXML2"; then
-  ac_pt_CONFIG_LIBXML2=$CONFIG_LIBXML2
-  # Extract the first word of "xml2-config", so it can be a program name with args.
-set dummy xml2-config; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_ac_pt_CONFIG_LIBXML2+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $ac_pt_CONFIG_LIBXML2 in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_ac_pt_CONFIG_LIBXML2="$ac_pt_CONFIG_LIBXML2" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-as_dummy="${LIBXML2_DIR}/bin:$PATH"
-for as_dir in $as_dummy
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_ac_pt_CONFIG_LIBXML2="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-  ;;
-esac
-fi
-ac_pt_CONFIG_LIBXML2=$ac_cv_path_ac_pt_CONFIG_LIBXML2
-if test -n "$ac_pt_CONFIG_LIBXML2"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_CONFIG_LIBXML2" >&5
-$as_echo "$ac_pt_CONFIG_LIBXML2" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
+         cat >>confdefs.h <<_ACEOF
+#define HAVE_LTDL 1
+_ACEOF
 
-  if test "x$ac_pt_CONFIG_LIBXML2" = x; then
-    CONFIG_LIBXML2="No"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    CONFIG_LIBXML2=$ac_pt_CONFIG_LIBXML2
-  fi
-else
-  CONFIG_LIBXML2="$ac_cv_path_CONFIG_LIBXML2"
+      fi
+   fi
 fi
 
-	if test ! "x${CONFIG_LIBXML2}" = xNo; then
-	    if test x"" = x ; then A=--cflags ; else A="" ; fi
-	    LIBXML2_INCLUDE=$(${CONFIG_LIBXML2} $A)
-	    if test x"" = x ; then A=--libs ; else A="" ; fi
-	    LIBXML2_LIB=$(${CONFIG_LIBXML2} $A)
-	    if test x"#include <libxml/tree.h>
-	#include <libxml/parser.h>" != x ; then
-		saved_cppflags="${CPPFLAGS}"
-		if test "x${LIBXML2_DIR}" != "x"; then
-		    LIBXML2_INCLUDE="-I${LIBXML2_DIR}/include"
-		fi
-		CPPFLAGS="${CPPFLAGS} ${LIBXML2_INCLUDE}"
 
-		saved_libs="${LIBS}"
-		LIBS="${LIBXML2_LIB}"
 
-		cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+
+if test "x${PBX_LDAP}" != "x1" -a "${USE_LDAP}" != "no"; then
+   pbxlibdir=""
+   # if --with-LDAP=DIR has been specified, use it.
+   if test "x${LDAP_DIR}" != "x"; then
+      if test -d ${LDAP_DIR}/lib; then
+      	 pbxlibdir="-L${LDAP_DIR}/lib"
+      else
+      	 pbxlibdir="-L${LDAP_DIR}"
+      fi
+   fi
+   pbxfuncname="ldap_initialize"
+   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
+      AST_LDAP_FOUND=yes
+   else
+      ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
+      CFLAGS="${CFLAGS} "
+      as_ac_Lib=`$as_echo "ac_cv_lib_ldap_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lldap" >&5
+$as_echo_n "checking for ${pbxfuncname} in -lldap... " >&6; }
+if eval "test \"\${$as_ac_Lib+set}\"" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lldap ${pbxlibdir}  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-  #include <libxml/tree.h>
-	#include <libxml/parser.h>
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char ${pbxfuncname} ();
 int
 main ()
 {
- LIBXML_TEST_VERSION;
-
+return ${pbxfuncname} ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-     PBX_LIBXML2=1
-
-$as_echo "#define HAVE_LIBXML2 1" >>confdefs.h
-
-
+  eval "$as_ac_Lib=yes"
+else
+  eval "$as_ac_Lib=no"
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-		CPPFLAGS="${saved_cppflags}"
-		LIBS="${saved_libs}"
-	    else
-		PBX_LIBXML2=1
+LIBS=$ac_check_lib_save_LIBS
+fi
+eval ac_res=\$$as_ac_Lib
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
+  AST_LDAP_FOUND=yes
+else
+  AST_LDAP_FOUND=no
+fi
 
-$as_echo "#define HAVE_LIBXML2 1" >>confdefs.h
+      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
+   fi
 
-	    fi
-	fi
-    fi
+   # now check for the header.
+   if test "${AST_LDAP_FOUND}" = "yes"; then
+      LDAP_LIB="${pbxlibdir} -lldap "
+      # if --with-LDAP=DIR has been specified, use it.
+      if test "x${LDAP_DIR}" != "x"; then
+         LDAP_INCLUDE="-I${LDAP_DIR}/include"
+      fi
+      LDAP_INCLUDE="${LDAP_INCLUDE} "
+      if test "xldap.h" = "x" ; then	# no header, assume found
+         LDAP_HEADER_FOUND="1"
+      else				# check for the header
+         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${LDAP_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "ldap.h" "ac_cv_header_ldap_h" "$ac_includes_default"
+if test "x$ac_cv_header_ldap_h" = x""yes; then :
+  LDAP_HEADER_FOUND=1
+else
+  LDAP_HEADER_FOUND=0
+fi
 
-	if test "${PBX_LIBXML2}" != 1; then
-		{ $as_echo "$as_me:${as_lineno-$LINENO}: *** XML documentation will not be available because the 'libxml2' development package is missing." >&5
-$as_echo "$as_me: *** XML documentation will not be available because the 'libxml2' development package is missing." >&6;}
-		{ $as_echo "$as_me:${as_lineno-$LINENO}: *** Please run the 'configure' script with the '--disable-xmldoc' parameter option" >&5
-$as_echo "$as_me: *** Please run the 'configure' script with the '--disable-xmldoc' parameter option" >&6;}
-		{ $as_echo "$as_me:${as_lineno-$LINENO}: *** or install the 'libxml2' development package." >&5
-$as_echo "$as_me: *** or install the 'libxml2' development package." >&6;}
-		exit 1
-	fi
+
+         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
+      fi
+      if test "x${LDAP_HEADER_FOUND}" = "x0" ; then
+         LDAP_LIB=""
+         LDAP_INCLUDE=""
+      else
+         if test "x${pbxfuncname}" = "x" ; then		# only checking headers -> no library
+            LDAP_LIB=""
+         fi
+         PBX_LDAP=1
+         cat >>confdefs.h <<_ACEOF
+#define HAVE_LDAP 1
+_ACEOF
+
+      fi
+   fi
 fi
 
 
+
+
 if test "x${PBX_MISDN}" != "x1" -a "${USE_MISDN}" != "no"; then
    pbxlibdir=""
    # if --with-MISDN=DIR has been specified, use it.
@@ -19780,142 +20108,37 @@ fi
 
    # now check for the header.
    if test "${AST_NBS_FOUND}" = "yes"; then
-      NBS_LIB="${pbxlibdir} -lnbs "
-      # if --with-NBS=DIR has been specified, use it.
-      if test "x${NBS_DIR}" != "x"; then
-         NBS_INCLUDE="-I${NBS_DIR}/include"
-      fi
-      NBS_INCLUDE="${NBS_INCLUDE} "
-      if test "xnbs.h" = "x" ; then	# no header, assume found
-         NBS_HEADER_FOUND="1"
-      else				# check for the header
-         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${NBS_INCLUDE}"
-         ac_fn_c_check_header_mongrel "$LINENO" "nbs.h" "ac_cv_header_nbs_h" "$ac_includes_default"
-if test "x$ac_cv_header_nbs_h" = x""yes; then :
-  NBS_HEADER_FOUND=1
-else
-  NBS_HEADER_FOUND=0
-fi
-
-
-         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
-      fi
-      if test "x${NBS_HEADER_FOUND}" = "x0" ; then
-         NBS_LIB=""
-         NBS_INCLUDE=""
-      else
-         if test "x${pbxfuncname}" = "x" ; then		# only checking headers -> no library
-            NBS_LIB=""
-         fi
-         PBX_NBS=1
-         cat >>confdefs.h <<_ACEOF
-#define HAVE_NBS 1
-_ACEOF
-
-      fi
-   fi
-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"
-      else
-      	 pbxlibdir="-L${NCURSES_DIR}"
-      fi
-   fi
-   pbxfuncname="initscr"
-   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_NCURSES_FOUND=yes
-   else
-      ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
-      CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_ncurses_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lncurses" >&5
-$as_echo_n "checking for ${pbxfuncname} in -lncurses... " >&6; }
-if eval "test \"\${$as_ac_Lib+set}\"" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lncurses ${pbxlibdir}  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char ${pbxfuncname} ();
-int
-main ()
-{
-return ${pbxfuncname} ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
-else
-  eval "$as_ac_Lib=no"
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-eval ac_res=\$$as_ac_Lib
-	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
-  AST_NCURSES_FOUND=yes
-else
-  AST_NCURSES_FOUND=no
-fi
-
-      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
-   fi
-
-   # now check for the header.
-   if test "${AST_NCURSES_FOUND}" = "yes"; then
-      NCURSES_LIB="${pbxlibdir} -lncurses "
-      # if --with-NCURSES=DIR has been specified, use it.
-      if test "x${NCURSES_DIR}" != "x"; then
-         NCURSES_INCLUDE="-I${NCURSES_DIR}/include"
+      NBS_LIB="${pbxlibdir} -lnbs "
+      # if --with-NBS=DIR has been specified, use it.
+      if test "x${NBS_DIR}" != "x"; then
+         NBS_INCLUDE="-I${NBS_DIR}/include"
       fi
-      NCURSES_INCLUDE="${NCURSES_INCLUDE} "
-      if test "xcurses.h" = "x" ; then	# no header, assume found
-         NCURSES_HEADER_FOUND="1"
+      NBS_INCLUDE="${NBS_INCLUDE} "
+      if test "xnbs.h" = "x" ; then	# no header, assume found
+         NBS_HEADER_FOUND="1"
       else				# check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${NCURSES_INCLUDE}"
-         ac_fn_c_check_header_mongrel "$LINENO" "curses.h" "ac_cv_header_curses_h" "$ac_includes_default"
-if test "x$ac_cv_header_curses_h" = x""yes; then :
-  NCURSES_HEADER_FOUND=1
+         CPPFLAGS="${CPPFLAGS} ${NBS_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "nbs.h" "ac_cv_header_nbs_h" "$ac_includes_default"
+if test "x$ac_cv_header_nbs_h" = x""yes; then :
+  NBS_HEADER_FOUND=1
 else
-  NCURSES_HEADER_FOUND=0
+  NBS_HEADER_FOUND=0
 fi
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
       fi
-      if test "x${NCURSES_HEADER_FOUND}" = "x0" ; then
-         NCURSES_LIB=""
-         NCURSES_INCLUDE=""
+      if test "x${NBS_HEADER_FOUND}" = "x0" ; then
+         NBS_LIB=""
+         NBS_INCLUDE=""
       else
          if test "x${pbxfuncname}" = "x" ; then		# only checking headers -> no library
-            NCURSES_LIB=""
+            NBS_LIB=""
          fi
-         PBX_NCURSES=1
+         PBX_NBS=1
          cat >>confdefs.h <<_ACEOF
-#define HAVE_NCURSES 1
+#define HAVE_NBS 1
 _ACEOF
 
       fi
@@ -27167,216 +27390,6 @@ 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"
-      else
-      	 pbxlibdir="-L${TERMCAP_DIR}"
-      fi
-   fi
-   pbxfuncname="tgetent"
-   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_TERMCAP_FOUND=yes
-   else
-      ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
-      CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_termcap_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -ltermcap" >&5
-$as_echo_n "checking for ${pbxfuncname} in -ltermcap... " >&6; }
-if eval "test \"\${$as_ac_Lib+set}\"" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-ltermcap ${pbxlibdir}  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char ${pbxfuncname} ();
-int
-main ()
-{
-return ${pbxfuncname} ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
-else
-  eval "$as_ac_Lib=no"
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-eval ac_res=\$$as_ac_Lib
-	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
-  AST_TERMCAP_FOUND=yes
-else
-  AST_TERMCAP_FOUND=no
-fi
-
-      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
-   fi
-
-   # now check for the header.
-   if test "${AST_TERMCAP_FOUND}" = "yes"; then
-      TERMCAP_LIB="${pbxlibdir} -ltermcap "
-      # if --with-TERMCAP=DIR has been specified, use it.
-      if test "x${TERMCAP_DIR}" != "x"; then
-         TERMCAP_INCLUDE="-I${TERMCAP_DIR}/include"
-      fi
-      TERMCAP_INCLUDE="${TERMCAP_INCLUDE} "
-      if test "x" = "x" ; then	# no header, assume found
-         TERMCAP_HEADER_FOUND="1"
-      else				# check for the header
-         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${TERMCAP_INCLUDE}"
-         ac_fn_c_check_header_mongrel "$LINENO" "" "ac_cv_header_" "$ac_includes_default"
-if test "x$ac_cv_header_" = x""yes; then :
-  TERMCAP_HEADER_FOUND=1
-else
-  TERMCAP_HEADER_FOUND=0
-fi
-
-
-         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
-      fi
-      if test "x${TERMCAP_HEADER_FOUND}" = "x0" ; then
-         TERMCAP_LIB=""
-         TERMCAP_INCLUDE=""
-      else
-         if test "x${pbxfuncname}" = "x" ; then		# only checking headers -> no library
-            TERMCAP_LIB=""
-         fi
-         PBX_TERMCAP=1
-         cat >>confdefs.h <<_ACEOF
-#define HAVE_TERMCAP 1
-_ACEOF
-
-      fi
-   fi
-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"
-      else
-      	 pbxlibdir="-L${TINFO_DIR}"
-      fi
-   fi
-   pbxfuncname="tgetent"
-   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_TINFO_FOUND=yes
-   else
-      ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
-      CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_tinfo_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -ltinfo" >&5
-$as_echo_n "checking for ${pbxfuncname} in -ltinfo... " >&6; }
-if eval "test \"\${$as_ac_Lib+set}\"" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-ltinfo ${pbxlibdir}  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char ${pbxfuncname} ();
-int
-main ()
-{
-return ${pbxfuncname} ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
-else
-  eval "$as_ac_Lib=no"
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-eval ac_res=\$$as_ac_Lib
-	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
-  AST_TINFO_FOUND=yes
-else
-  AST_TINFO_FOUND=no
-fi
-
-      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
-   fi
-
-   # now check for the header.
-   if test "${AST_TINFO_FOUND}" = "yes"; then
-      TINFO_LIB="${pbxlibdir} -ltinfo "
-      # if --with-TINFO=DIR has been specified, use it.
-      if test "x${TINFO_DIR}" != "x"; then
-         TINFO_INCLUDE="-I${TINFO_DIR}/include"
-      fi
-      TINFO_INCLUDE="${TINFO_INCLUDE} "
-      if test "x" = "x" ; then	# no header, assume found
-         TINFO_HEADER_FOUND="1"
-      else				# check for the header
-         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${TINFO_INCLUDE}"
-         ac_fn_c_check_header_mongrel "$LINENO" "" "ac_cv_header_" "$ac_includes_default"
-if test "x$ac_cv_header_" = x""yes; then :
-  TINFO_HEADER_FOUND=1
-else
-  TINFO_HEADER_FOUND=0
-fi
-
-
-         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
-      fi
-      if test "x${TINFO_HEADER_FOUND}" = "x0" ; then
-         TINFO_LIB=""
-         TINFO_INCLUDE=""
-      else
-         if test "x${pbxfuncname}" = "x" ; then		# only checking headers -> no library
-            TINFO_LIB=""
-         fi
-         PBX_TINFO=1
-         cat >>confdefs.h <<_ACEOF
-#define HAVE_TINFO 1
-_ACEOF
-
-      fi
-   fi
-fi
-
-
-
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tone_zone_find_by_num in -ltonezone" >&5
 $as_echo_n "checking for tone_zone_find_by_num in -ltonezone... " >&6; }
 if test "${ac_cv_lib_tonezone_tone_zone_find_by_num+set}" = set; then :
@@ -28024,20 +28037,6 @@ fi
 
 
 
-EDITLINE_LIB=""
-if test "x$TERMCAP_LIB" != "x" ; then
-  EDITLINE_LIB="$TERMCAP_LIB"
-elif test "x$TINFO_LIB" != "x" ; then
-  EDITLINE_LIB="$TINFO_LIB"
-elif test "x$CURSES_LIB" != "x" ; then
-  EDITLINE_LIB="$CURSES_LIB"
-elif test "x$NCURSES_LIB" != "x" ; then
-  EDITLINE_LIB="$NCURSES_LIB"
-else
-  as_fn_error $? "*** termcap support not found (on modern systems, this typically means the ncurses development package is missing)" "$LINENO" 5
-fi
-
-
 if test "x${PBX_UNIXODBC}" = "x1" -o "x${PBX_IODBC}" = "x1"; then
 	# Does ODBC support wide characters?
 	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ODBC has support for Unicode types" >&5
diff --git a/configure.ac b/configure.ac
index bc945ab0e3..d8ba950a6c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -475,6 +475,49 @@ AC_HEADER_STDC
 AC_HEADER_SYS_WAIT
 AC_CHECK_HEADERS([arpa/inet.h fcntl.h inttypes.h libintl.h limits.h locale.h malloc.h netdb.h netinet/in.h stddef.h stdint.h stdlib.h string.h strings.h sys/event.h sys/file.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h syslog.h termios.h unistd.h utime.h arpa/nameser.h sys/io.h])
 
+# Any one of these 4 packages support a mandatory requirement, so we want to check on them as early as possible.
+AST_EXT_LIB_CHECK([TERMCAP], [termcap], [tgetent], [])
+AST_EXT_LIB_CHECK([TINFO], [tinfo], [tgetent], [])
+AST_EXT_LIB_CHECK([CURSES], [curses], [initscr], [curses.h])
+AST_EXT_LIB_CHECK([NCURSES], [ncurses], [initscr], [curses.h])
+
+EDITLINE_LIB=""
+if test "x$TERMCAP_LIB" != "x" ; then
+  EDITLINE_LIB="$TERMCAP_LIB"
+elif test "x$TINFO_LIB" != "x" ; then
+  EDITLINE_LIB="$TINFO_LIB"
+elif test "x$CURSES_LIB" != "x" ; then
+  EDITLINE_LIB="$CURSES_LIB"
+elif test "x$NCURSES_LIB" != "x" ; then
+  EDITLINE_LIB="$NCURSES_LIB"
+else
+  AC_MSG_ERROR([*** termcap support not found (on modern systems, this typically means the ncurses development package is missing)])
+fi
+AC_SUBST(EDITLINE_LIB)
+
+# Another mandatory item (unless it's explicitly disabled)
+AC_ARG_ENABLE([xmldoc],
+	[AS_HELP_STRING([--disable-xmldoc],
+		[Explicity disable XML documentation])],
+	[case "${enableval}" in
+		y|ye|yes) disable_xmldoc=no ;;
+		n|no)  disable_xmldoc=yes ;;
+		*) AC_MSG_ERROR(bad value ${enableval} for --disable-xmldoc)  ;;
+	esac], [disable_xmldoc=no])
+
+if test "${disable_xmldoc}" != "yes"; then
+	AST_EXT_TOOL_CHECK([LIBXML2], [xml2-config], , ,
+	[#include <libxml/tree.h>
+	#include <libxml/parser.h>],
+	[LIBXML_TEST_VERSION])
+	if test "${PBX_LIBXML2}" != 1; then
+		AC_MSG_NOTICE(*** XML documentation will not be available because the 'libxml2' development package is missing.)
+		AC_MSG_NOTICE(*** Please run the 'configure' script with the '--disable-xmldoc' parameter option)
+		AC_MSG_NOTICE(*** or install the 'libxml2' development package.)
+		exit 1
+	fi
+fi
+
 # some embedded systems omit internationalization (locale) support
 AC_CHECK_HEADERS([xlocale.h])
 
@@ -1057,8 +1100,6 @@ AST_EXT_LIB_CHECK([ALSA], [asound], [snd_spcm_init], [alsa/asoundlib.h], [-lm -l
 
 AST_EXT_LIB_CHECK([BFD], [bfd], [bfd_openr], [bfd.h])
 
-AST_EXT_LIB_CHECK([CURSES], [curses], [initscr], [curses.h])
-
 if test "x${OSARCH}" = "xlinux-gnu" ; then
   AST_EXT_LIB_CHECK([CAP], [cap], [cap_from_text], [sys/capability.h])
 fi
@@ -1692,28 +1733,6 @@ AST_EXT_LIB_CHECK([LTDL], [ltdl], [lt_dlinit], [ltdl.h], [])
 
 AST_EXT_LIB_CHECK([LDAP], [ldap], [ldap_initialize], [ldap.h])
 
-AC_ARG_ENABLE([xmldoc],
-	[AS_HELP_STRING([--disable-xmldoc],
-		[Explicity disable XML documentation])],
-	[case "${enableval}" in
-		y|ye|yes) disable_xmldoc=no ;;
-		n|no)  disable_xmldoc=yes ;;
-		*) AC_MSG_ERROR(bad value ${enableval} for --disable-xmldoc)  ;;
-	esac], [disable_xmldoc=no])
-
-if test "${disable_xmldoc}" != "yes"; then
-	AST_EXT_TOOL_CHECK([LIBXML2], [xml2-config], , ,
-	[#include <libxml/tree.h>
-	#include <libxml/parser.h>],
-	[LIBXML_TEST_VERSION])
-	if test "${PBX_LIBXML2}" != 1; then
-		AC_MSG_NOTICE(*** XML documentation will not be available because the 'libxml2' development package is missing.)
-		AC_MSG_NOTICE(*** Please run the 'configure' script with the '--disable-xmldoc' parameter option)
-		AC_MSG_NOTICE(*** or install the 'libxml2' development package.)
-		exit 1
-	fi
-fi
-
 AST_EXT_LIB_CHECK([MISDN], [mISDN], [mISDN_open], [mISDNuser/mISDNlib.h])
 
 if test "${PBX_MISDN}" = 1; then
@@ -1729,8 +1748,6 @@ AST_EXT_TOOL_CHECK([MYSQLCLIENT], [mysql_config])
 
 AST_EXT_LIB_CHECK([NBS], [nbs], [nbs_connect], [nbs.h])
 
-AST_EXT_LIB_CHECK([NCURSES], [ncurses], [initscr], [curses.h])
-
 AST_EXT_TOOL_CHECK([NEON], [neon-config])
 
 AST_EXT_TOOL_CHECK([NEON29], [neon-config], , [--libs],
@@ -2049,10 +2066,6 @@ AST_EXT_LIB_CHECK([HOARD], [hoard], [malloc], [])
 
 AST_EXT_LIB_CHECK([FREETDS], [sybdb], [dbinit], [sybdb.h])
 
-AST_EXT_LIB_CHECK([TERMCAP], [termcap], [tgetent], [])
-
-AST_EXT_LIB_CHECK([TINFO], [tinfo], [tgetent], [])
-
 AC_CHECK_LIB([tonezone], [tone_zone_find_by_num], tonezone_does_not_need_lm=yes, tonezone_does_not_need_lm=no)
 
 if test "${tonezone_does_not_need_lm}" = "no" ; then
@@ -2117,20 +2130,6 @@ AC_LANG_POP
 
 AST_EXT_LIB_CHECK([ZLIB], [z], [compress], [zlib.h])
 
-EDITLINE_LIB=""
-if test "x$TERMCAP_LIB" != "x" ; then
-  EDITLINE_LIB="$TERMCAP_LIB"
-elif test "x$TINFO_LIB" != "x" ; then
-  EDITLINE_LIB="$TINFO_LIB"
-elif test "x$CURSES_LIB" != "x" ; then
-  EDITLINE_LIB="$CURSES_LIB"
-elif test "x$NCURSES_LIB" != "x" ; then
-  EDITLINE_LIB="$NCURSES_LIB"
-else
-  AC_MSG_ERROR([*** termcap support not found (on modern systems, this typically means the ncurses development package is missing)])
-fi
-AC_SUBST(EDITLINE_LIB)
-
 if test "x${PBX_UNIXODBC}" = "x1" -o "x${PBX_IODBC}" = "x1"; then
 	# Does ODBC support wide characters?
 	AC_MSG_CHECKING(whether ODBC has support for Unicode types)
-- 
GitLab