res_fax: Resolve module reference leak caused by reserved sessions
[asterisk/asterisk.git] / configure
index 2a6d356..039b796 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.ac Revision: 366649 .
+# From configure.ac Revision: 419077 .
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.68 for asterisk trunk.
 #
@@ -629,7 +629,6 @@ CONFIG_SDL
 PBX_SO_NOSIGPIPE
 PBX_MSG_NOSIGNAL
 PBX_IXJUSER
-PBX_H323
 GMIME_LIBS
 GMIME_CFLAGS
 OPENH323_BUILD
@@ -642,6 +641,8 @@ PWLIB_LIBDIR
 PWLIB_INCDIR
 PWLIBDIR
 PTLIB_CONFIG
+PJPROJECT_LIBS
+PJPROJECT_CFLAGS
 PG_CONFIG
 CONFIG_NETSNMP
 CONFIG_NEON29
@@ -649,6 +650,12 @@ CONFIG_NEON
 CONFIG_MYSQLCLIENT
 PBX_MISDN_FAC_ERROR
 PBX_MISDN_FAC_RESULT
+LIBEDIT_LIBS
+LIBEDIT_CFLAGS
+LIBEDIT_INTERNAL
+ILBC_LIBS
+ILBC_CFLAGS
+ILBC_INTERNAL
 GSM_INTERNAL
 PBX_DAHDI_HALF_FULL
 PKG_CONFIG_LIBDIR
@@ -656,8 +663,11 @@ PKG_CONFIG_PATH
 PKG_CONFIG
 PBX_DLADDR
 PBX_IP_MTU_DISCOVER
+PBX_RTLD_NOLOAD
 PBX_GLOB_BRACE
 PBX_GLOB_NOMAGIC
+AST_RPATH
+AST_NESTED_FUNCTIONS
 AST_NATIVE_ARCH
 AST_SHADOW_WARNINGS
 AST_NO_STRICT_OVERFLOW
@@ -666,7 +676,6 @@ AST_TRAMPOLINES
 AST_DECLARATION_AFTER_STATEMENT
 GC_LDFLAGS
 GC_CFLAGS
-PBX_WEAKREF
 PBX_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
 PBX_PTHREAD_RWLOCK_INITIALIZER
 AST_ASTERISKSSL
@@ -676,6 +685,8 @@ POW_LIB
 PBX_WORKING_FORK
 LIBOBJS
 CONFIG_LIBXML2
+UUID_LIB
+UUID_INCLUDE
 EDITLINE_LIB
 ALLOCA
 PBX_ZLIB
@@ -726,6 +737,10 @@ PBX_OPENSSL
 OPENSSL_DIR
 OPENSSL_INCLUDE
 OPENSSL_LIB
+PBX_SRTP_SHUTDOWN
+SRTP_SHUTDOWN_DIR
+SRTP_SHUTDOWN_INCLUDE
+SRTP_SHUTDOWN_LIB
 PBX_SRTP
 SRTP_DIR
 SRTP_INCLUDE
@@ -855,6 +870,10 @@ PBX_PRI_L2_PERSISTENCE
 PRI_L2_PERSISTENCE_DIR
 PRI_L2_PERSISTENCE_INCLUDE
 PRI_L2_PERSISTENCE_LIB
+PBX_PRI_SETUP_ACK_INBAND
+PRI_SETUP_ACK_INBAND_DIR
+PRI_SETUP_ACK_INBAND_INCLUDE
+PRI_SETUP_ACK_INBAND_LIB
 PBX_PRI
 PRI_DIR
 PRI_INCLUDE
@@ -863,10 +882,22 @@ PBX_PORTAUDIO
 PORTAUDIO_DIR
 PORTAUDIO_INCLUDE
 PORTAUDIO_LIB
+PBX_PJSIP_REPLACE_MEDIA_STREAM
+PJSIP_REPLACE_MEDIA_STREAM_DIR
+PJSIP_REPLACE_MEDIA_STREAM_INCLUDE
+PJSIP_REPLACE_MEDIA_STREAM_LIB
+PBX_PJ_TRANSACTION_GRP_LOCK
+PJ_TRANSACTION_GRP_LOCK_DIR
+PJ_TRANSACTION_GRP_LOCK_INCLUDE
+PJ_TRANSACTION_GRP_LOCK_LIB
 PBX_POPT
 POPT_DIR
 POPT_INCLUDE
 POPT_LIB
+PBX_PJPROJECT
+PJPROJECT_DIR
+PJPROJECT_INCLUDE
+PJPROJECT_LIB
 PBX_PGSQL
 PGSQL_DIR
 PGSQL_INCLUDE
@@ -927,10 +958,22 @@ PBX_LTDL
 LTDL_DIR
 LTDL_INCLUDE
 LTDL_LIB
+PBX_LIBXSLT_CLEANUP
+LIBXSLT_CLEANUP_DIR
+LIBXSLT_CLEANUP_INCLUDE
+LIBXSLT_CLEANUP_LIB
+PBX_LIBXSLT
+LIBXSLT_DIR
+LIBXSLT_INCLUDE
+LIBXSLT_LIB
 PBX_LIBXML2
 LIBXML2_DIR
 LIBXML2_INCLUDE
 LIBXML2_LIB
+PBX_LIBEDIT
+LIBEDIT_DIR
+LIBEDIT_INCLUDE
+LIBEDIT_LIB
 CURL_LIB
 CURL_INCLUDE
 _libcurl_config
@@ -943,6 +986,14 @@ PBX_KQUEUE
 KQUEUE_DIR
 KQUEUE_INCLUDE
 KQUEUE_LIB
+PBX_URIPARSER
+URIPARSER_DIR
+URIPARSER_INCLUDE
+URIPARSER_LIB
+PBX_JANSSON
+JANSSON_DIR
+JANSSON_INCLUDE
+JANSSON_LIB
 PBX_JACK
 JACK_DIR
 JACK_INCLUDE
@@ -991,6 +1042,10 @@ PBX_GTK2
 GTK2_DIR
 GTK2_INCLUDE
 GTK2_LIB
+PBX_ILBC
+ILBC_DIR
+ILBC_INCLUDE
+ILBC_LIB
 PBX_GSM
 GSM_DIR
 GSM_INCLUDE
@@ -1003,10 +1058,22 @@ PBX_DAHDI
 DAHDI_DIR
 DAHDI_INCLUDE
 DAHDI_LIB
+PBX_OPENSSL_EC
+OPENSSL_EC_DIR
+OPENSSL_EC_INCLUDE
+OPENSSL_EC_LIB
+PBX_OPENSSL_SRTP
+OPENSSL_SRTP_DIR
+OPENSSL_SRTP_INCLUDE
+OPENSSL_SRTP_LIB
 PBX_CRYPTO
 CRYPTO_DIR
 CRYPTO_INCLUDE
 CRYPTO_LIB
+PBX_CRYPT
+CRYPT_DIR
+CRYPT_INCLUDE
+CRYPT_LIB
 PBX_CURSES
 CURSES_DIR
 CURSES_INCLUDE
@@ -1056,6 +1123,7 @@ SHA1SUM
 LDCONFIG
 DOWNLOAD
 FETCH
+GIT
 XMLSTARLET
 XMLLINT
 KPATHSEA
@@ -1064,11 +1132,13 @@ RUBBER
 CURL
 WGET
 DOT
+DOXYGEN
 LN
 DIRNAME
 BASENAME
 COMPRESS
 FIND
+PYTHON
 FLEX
 CMP
 BISON
@@ -1186,10 +1256,12 @@ with_bluetooth
 with_cap
 with_cpg
 with_curses
+with_crypt
 with_crypto
 with_dahdi
 with_avcodec
 with_gsm
+with_ilbc
 with_gtk2
 with_gmime
 with_h323
@@ -1202,10 +1274,14 @@ with_inotify
 with_iodbc
 with_isdnnet
 with_jack
+with_jansson
+with_uriparser
 with_kqueue
 with_ldap
 with_libcurl
+with_libedit
 with_libxml2
+with_libxslt
 with_ltdl
 with_lua
 with_misdn
@@ -1221,6 +1297,7 @@ with_openr2
 with_osptk
 with_oss
 with_postgres
+with_pjproject
 with_popt
 with_portaudio
 with_pri
@@ -1253,6 +1330,7 @@ enable_xmldoc
 enable_largefile
 enable_internal_poll
 enable_asteriskssl
+enable_rpath
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1270,6 +1348,12 @@ CXXCPP
 PKG_CONFIG
 PKG_CONFIG_PATH
 PKG_CONFIG_LIBDIR
+ILBC_CFLAGS
+ILBC_LIBS
+LIBEDIT_CFLAGS
+LIBEDIT_LIBS
+PJPROJECT_CFLAGS
+PJPROJECT_LIBS
 GMIME_CFLAGS
 GMIME_LIBS
 GTK2_CFLAGS
@@ -1895,6 +1979,7 @@ Optional Features:
   --disable-largefile     omit support for large files
   --enable-internal-poll  Use Asterisk's poll implementation
   --disable-asteriskssl   Disable Asterisk's SSL wrapper library
+  --disable-rpath         Disables rpath linker option checking
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -1907,11 +1992,14 @@ Optional Packages:
   --with-cap=PATH         use POSIX 1.e capabilities files in PATH
   --with-cpg=PATH         use Corosync files in PATH
   --with-curses=PATH      use curses files in PATH
+  --with-crypt=PATH       use password and data encryption files in PATH
   --with-crypto=PATH      use OpenSSL Cryptography files in PATH
   --with-dahdi=PATH       use DAHDI files in PATH
   --with-avcodec=PATH     use Ffmpeg and avcodec files in PATH
   --with-gsm=PATH         use External GSM files in PATH, use 'internal' GSM
                           otherwise
+  --with-ilbc=PATH        use System iLBC files in PATH, use 'internal' iLBC
+                          otherwise
   --with-gtk2=PATH        use gtk2 files in PATH
   --with-gmime=PATH       use GMime files in PATH
   --with-h323=PATH        use OpenH323 files in PATH
@@ -1924,10 +2012,15 @@ Optional Packages:
   --with-iodbc=PATH       use iODBC files in PATH
   --with-isdnnet=PATH     use ISDN4Linux files in PATH
   --with-jack=PATH        use Jack Audio Connection Kit files in PATH
+  --with-jansson=PATH     use Jansson JSON library files in PATH
+  --with-uriparser=PATH   use uriparser library files in PATH
   --with-kqueue=PATH      use kqueue support files in PATH
   --with-ldap=PATH        use OpenLDAP files in PATH
   --with-libcurl=DIR      look for the curl library in DIR
+  --with-libedit=PATH     use NetBSD Editline library files in PATH, use
+                          'internal' Editline otherwise
   --with-libxml2=PATH     use LibXML2 files in PATH
+  --with-libxslt=PATH     use LibXSLT files in PATH
   --with-ltdl=PATH        use libtool files in PATH
   --with-lua=PATH         use Lua files in PATH
   --with-misdn=PATH       use mISDN user files in PATH
@@ -1943,6 +2036,7 @@ Optional Packages:
   --with-osptk=PATH       use OSP Toolkit files in PATH
   --with-oss=PATH         use Open Sound System files in PATH
   --with-postgres=PATH    use PostgreSQL files in PATH
+  --with-pjproject=PATH   use PJPROJECT files in PATH
   --with-popt=PATH        use popt files in PATH
   --with-portaudio=PATH   use PortAudio files in PATH
   --with-pri=PATH         use ISDN PRI files in PATH
@@ -1991,6 +2085,16 @@ Some influential environment variables:
               directories to add to pkg-config's search path
   PKG_CONFIG_LIBDIR
               path overriding pkg-config's built-in search path
+  ILBC_CFLAGS C compiler flags for ILBC, overriding pkg-config
+  ILBC_LIBS   linker flags for ILBC, overriding pkg-config
+  LIBEDIT_CFLAGS
+              C compiler flags for LIBEDIT, overriding pkg-config
+  LIBEDIT_LIBS
+              linker flags for LIBEDIT, overriding pkg-config
+  PJPROJECT_CFLAGS
+              C compiler flags for PJPROJECT, overriding pkg-config
+  PJPROJECT_LIBS
+              linker flags for PJPROJECT, overriding pkg-config
   GMIME_CFLAGS
               C compiler flags for GMIME, overriding pkg-config
   GMIME_LIBS  linker flags for GMIME, overriding pkg-config
@@ -4672,7 +4776,7 @@ case "${host_os}" in
      OSARCH=cygwin
      PBX_WINARCH=1
      ;;
-     linux-gnueabi)
+     linux-gnueabi* |  linux-gnuspe)
      OSARCH=linux-gnu
      ;;
      kfreebsd*-gnu)
@@ -6591,6 +6695,47 @@ $as_echo "no" >&6; }
 fi
 
 
+# Extract the first word of "python", so it can be a program name with args.
+set dummy python; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_PYTHON+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $PYTHON in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_PYTHON="$PYTHON" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+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_PYTHON="$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
+
+  test -z "$ac_cv_path_PYTHON" && ac_cv_path_PYTHON=":"
+  ;;
+esac
+fi
+PYTHON=$ac_cv_path_PYTHON
+if test -n "$PYTHON"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON" >&5
+$as_echo "$PYTHON" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
 # Extract the first word of "find", so it can be a program name with args.
 set dummy find; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
@@ -6837,6 +6982,47 @@ $as_echo "no" >&6; }
 fi
 
 
+# Extract the first word of "doxygen", so it can be a program name with args.
+set dummy doxygen; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_DOXYGEN+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $DOXYGEN in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_DOXYGEN="$DOXYGEN" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+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_DOXYGEN="$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
+
+  test -z "$ac_cv_path_DOXYGEN" && ac_cv_path_DOXYGEN=":"
+  ;;
+esac
+fi
+DOXYGEN=$ac_cv_path_DOXYGEN
+if test -n "$DOXYGEN"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DOXYGEN" >&5
+$as_echo "$DOXYGEN" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
 # Extract the first word of "dot", so it can be a program name with args.
 set dummy dot; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
@@ -7165,6 +7351,47 @@ $as_echo "no" >&6; }
 fi
 
 
+# Extract the first word of "git", so it can be a program name with args.
+set dummy git; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_GIT+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $GIT in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_GIT="$GIT" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+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_GIT="$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
+
+  test -z "$ac_cv_path_GIT" && ac_cv_path_GIT=":"
+  ;;
+esac
+fi
+GIT=$ac_cv_path_GIT
+if test -n "$GIT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GIT" >&5
+$as_echo "$GIT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
 if test "${WGET}" != ":" ; then
   DOWNLOAD=${WGET}
 else if test "${CURL}" != ":" ; then
@@ -8172,6 +8399,38 @@ fi
 
 
 
+    CRYPT_DESCRIP="password and data encryption"
+    CRYPT_OPTION="crypt"
+    PBX_CRYPT=0
+
+# Check whether --with-crypt was given.
+if test "${with_crypt+set}" = set; then :
+  withval=$with_crypt;
+       case ${withval} in
+       n|no)
+       USE_CRYPT=no
+       # -1 is a magic value used by menuselect to know that the package
+       # was disabled, other than 'not found'
+       PBX_CRYPT=-1
+       ;;
+       y|ye|yes)
+       ac_mandatory_list="${ac_mandatory_list} CRYPT"
+       ;;
+       *)
+       CRYPT_DIR="${withval}"
+       ac_mandatory_list="${ac_mandatory_list} CRYPT"
+       ;;
+       esac
+
+fi
+
+
+
+
+
+
+
+
     CRYPTO_DESCRIP="OpenSSL Cryptography"
     CRYPTO_OPTION="crypto"
     PBX_CRYPTO=0
@@ -8204,6 +8463,30 @@ fi
 
 
 
+OPENSSL_SRTP_DESCRIP="OpenSSL SRTP Extension Support"
+OPENSSL_SRTP_OPTION=crypto
+OPENSSL_SRTP_DIR=${CRYPTO_DIR}
+
+PBX_OPENSSL_SRTP=0
+
+
+
+
+
+
+
+OPENSSL_EC_DESCRIP="OpenSSL Elliptic Curve Support"
+OPENSSL_EC_OPTION=crypto
+OPENSSL_EC_DIR=${CRYPTO_DIR}
+
+PBX_OPENSSL_EC=0
+
+
+
+
+
+
+
     DAHDI_DESCRIP="DAHDI"
     DAHDI_OPTION="dahdi"
     PBX_DAHDI=0
@@ -8300,6 +8583,38 @@ fi
 
 
 
+    ILBC_DESCRIP="System iLBC"
+    ILBC_OPTION="ilbc"
+    PBX_ILBC=0
+
+# Check whether --with-ilbc was given.
+if test "${with_ilbc+set}" = set; then :
+  withval=$with_ilbc;
+       case ${withval} in
+       n|no)
+       USE_ILBC=no
+       # -1 is a magic value used by menuselect to know that the package
+       # was disabled, other than 'not found'
+       PBX_ILBC=-1
+       ;;
+       y|ye|yes)
+       ac_mandatory_list="${ac_mandatory_list} ILBC"
+       ;;
+       *)
+       ILBC_DIR="${withval}"
+       ac_mandatory_list="${ac_mandatory_list} ILBC"
+       ;;
+       esac
+
+fi
+
+
+
+
+
+
+
+
     GTK2_DESCRIP="gtk2"
     GTK2_OPTION="gtk2"
     PBX_GTK2=0
@@ -8684,6 +8999,70 @@ fi
 
 
 
+    JANSSON_DESCRIP="Jansson JSON library"
+    JANSSON_OPTION="jansson"
+    PBX_JANSSON=0
+
+# Check whether --with-jansson was given.
+if test "${with_jansson+set}" = set; then :
+  withval=$with_jansson;
+       case ${withval} in
+       n|no)
+       USE_JANSSON=no
+       # -1 is a magic value used by menuselect to know that the package
+       # was disabled, other than 'not found'
+       PBX_JANSSON=-1
+       ;;
+       y|ye|yes)
+       ac_mandatory_list="${ac_mandatory_list} JANSSON"
+       ;;
+       *)
+       JANSSON_DIR="${withval}"
+       ac_mandatory_list="${ac_mandatory_list} JANSSON"
+       ;;
+       esac
+
+fi
+
+
+
+
+
+
+
+
+    URIPARSER_DESCRIP="uriparser library"
+    URIPARSER_OPTION="uriparser"
+    PBX_URIPARSER=0
+
+# Check whether --with-uriparser was given.
+if test "${with_uriparser+set}" = set; then :
+  withval=$with_uriparser;
+       case ${withval} in
+       n|no)
+       USE_URIPARSER=no
+       # -1 is a magic value used by menuselect to know that the package
+       # was disabled, other than 'not found'
+       PBX_URIPARSER=-1
+       ;;
+       y|ye|yes)
+       ac_mandatory_list="${ac_mandatory_list} URIPARSER"
+       ;;
+       *)
+       URIPARSER_DIR="${withval}"
+       ac_mandatory_list="${ac_mandatory_list} URIPARSER"
+       ;;
+       esac
+
+fi
+
+
+
+
+
+
+
+
     KQUEUE_DESCRIP="kqueue support"
     KQUEUE_OPTION="kqueue"
     PBX_KQUEUE=0
@@ -9125,6 +9504,38 @@ _ACEOF
   unset _libcurl_with
 
 
+    LIBEDIT_DESCRIP="NetBSD Editline library"
+    LIBEDIT_OPTION="libedit"
+    PBX_LIBEDIT=0
+
+# Check whether --with-libedit was given.
+if test "${with_libedit+set}" = set; then :
+  withval=$with_libedit;
+       case ${withval} in
+       n|no)
+       USE_LIBEDIT=no
+       # -1 is a magic value used by menuselect to know that the package
+       # was disabled, other than 'not found'
+       PBX_LIBEDIT=-1
+       ;;
+       y|ye|yes)
+       ac_mandatory_list="${ac_mandatory_list} LIBEDIT"
+       ;;
+       *)
+       LIBEDIT_DIR="${withval}"
+       ac_mandatory_list="${ac_mandatory_list} LIBEDIT"
+       ;;
+       esac
+
+fi
+
+
+
+
+
+
+
+
     LIBXML2_DESCRIP="LibXML2"
     LIBXML2_OPTION="libxml2"
     PBX_LIBXML2=0
@@ -9157,6 +9568,50 @@ fi
 
 
 
+    LIBXSLT_DESCRIP="LibXSLT"
+    LIBXSLT_OPTION="libxslt"
+    PBX_LIBXSLT=0
+
+# Check whether --with-libxslt was given.
+if test "${with_libxslt+set}" = set; then :
+  withval=$with_libxslt;
+       case ${withval} in
+       n|no)
+       USE_LIBXSLT=no
+       # -1 is a magic value used by menuselect to know that the package
+       # was disabled, other than 'not found'
+       PBX_LIBXSLT=-1
+       ;;
+       y|ye|yes)
+       ac_mandatory_list="${ac_mandatory_list} LIBXSLT"
+       ;;
+       *)
+       LIBXSLT_DIR="${withval}"
+       ac_mandatory_list="${ac_mandatory_list} LIBXSLT"
+       ;;
+       esac
+
+fi
+
+
+
+
+
+
+
+
+LIBXSLT_CLEANUP_DESCRIP="LibXSLT Library Cleanup Function"
+LIBXSLT_CLEANUP_OPTION=libxslt
+LIBXSLT_CLEANUP_DIR=${LIBXSLT_DIR}
+
+PBX_LIBXSLT_CLEANUP=0
+
+
+
+
+
+
+
     LTDL_DESCRIP="libtool"
     LTDL_OPTION="ltdl"
     PBX_LTDL=0
 
 
 
-    POPT_DESCRIP="popt"
-    POPT_OPTION="popt"
-    PBX_POPT=0
+    PJPROJECT_DESCRIP="PJPROJECT"
+    PJPROJECT_OPTION="pjproject"
+    PBX_PJPROJECT=0
 
-# Check whether --with-popt was given.
-if test "${with_popt+set}" = set; then :
-  withval=$with_popt;
+# Check whether --with-pjproject was given.
+if test "${with_pjproject+set}" = set; then :
+  withval=$with_pjproject;
        case ${withval} in
        n|no)
-       USE_POPT=no
+       USE_PJPROJECT=no
        # -1 is a magic value used by menuselect to know that the package
        # was disabled, other than 'not found'
-       PBX_POPT=-1
+       PBX_PJPROJECT=-1
        ;;
        y|ye|yes)
-       ac_mandatory_list="${ac_mandatory_list} POPT"
+       ac_mandatory_list="${ac_mandatory_list} PJPROJECT"
        ;;
        *)
-       POPT_DIR="${withval}"
-       ac_mandatory_list="${ac_mandatory_list} POPT"
+       PJPROJECT_DIR="${withval}"
+       ac_mandatory_list="${ac_mandatory_list} PJPROJECT"
        ;;
        esac
 
 
 
 
-    PORTAUDIO_DESCRIP="PortAudio"
-    PORTAUDIO_OPTION="portaudio"
-    PBX_PORTAUDIO=0
-
+    POPT_DESCRIP="popt"
+    POPT_OPTION="popt"
+    PBX_POPT=0
+
+# Check whether --with-popt was given.
+if test "${with_popt+set}" = set; then :
+  withval=$with_popt;
+       case ${withval} in
+       n|no)
+       USE_POPT=no
+       # -1 is a magic value used by menuselect to know that the package
+       # was disabled, other than 'not found'
+       PBX_POPT=-1
+       ;;
+       y|ye|yes)
+       ac_mandatory_list="${ac_mandatory_list} POPT"
+       ;;
+       *)
+       POPT_DIR="${withval}"
+       ac_mandatory_list="${ac_mandatory_list} POPT"
+       ;;
+       esac
+
+fi
+
+
+
+
+
+
+
+
+PJ_TRANSACTION_GRP_LOCK_DESCRIP="PJSIP Transaction Group Lock Support"
+PJ_TRANSACTION_GRP_LOCK_OPTION=pjsip
+PJ_TRANSACTION_GRP_LOCK_DIR=${PJPROJECT_DIR}
+
+PBX_PJ_TRANSACTION_GRP_LOCK=0
+
+
+
+
+
+
+
+PJSIP_REPLACE_MEDIA_STREAM_DESCRIP="PJSIP Media Stream Replacement Support"
+PJSIP_REPLACE_MEDIA_STREAM_OPTION=pjsip
+PJSIP_REPLACE_MEDIA_STREAM_DIR=${PJPROJECT_DIR}
+
+PBX_PJSIP_REPLACE_MEDIA_STREAM=0
+
+
+
+
+
+
+
+    PORTAUDIO_DESCRIP="PortAudio"
+    PORTAUDIO_OPTION="portaudio"
+    PBX_PORTAUDIO=0
+
 # Check whether --with-portaudio was given.
 if test "${with_portaudio+set}" = set; then :
   withval=$with_portaudio;
@@ -9733,6 +10244,18 @@ fi
 
 
 
+PRI_SETUP_ACK_INBAND_DESCRIP="ISDN PRI progress inband ie in SETUP ACK"
+PRI_SETUP_ACK_INBAND_OPTION=pri
+PRI_SETUP_ACK_INBAND_DIR=${PRI_DIR}
+
+PBX_PRI_SETUP_ACK_INBAND=0
+
+
+
+
+
+
+
 PRI_L2_PERSISTENCE_DESCRIP="ISDN Layer 2 persistence option"
 PRI_L2_PERSISTENCE_OPTION=pri
 PRI_L2_PERSISTENCE_DIR=${PRI_DIR}
 
 
 
+SRTP_SHUTDOWN_DESCRIP="SRTP Library Shutdown Function"
+SRTP_SHUTDOWN_OPTION=srtp
+SRTP_SHUTDOWN_DIR=${SRTP_DIR}
+
+PBX_SRTP_SHUTDOWN=0
+
+
+
+
+
+
+
     OPENSSL_DESCRIP="OpenSSL Secure Sockets Layer"
     OPENSSL_OPTION="ssl"
     PBX_OPENSSL=0
 done
 
 
-# Any one of these 4 packages support a mandatory requirement, so we want to check on them as early as possible.
+# Any one of these 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"
+         pbxlibdir="-L${TERMCAP_DIR}/lib"
       else
-        pbxlibdir="-L${TERMCAP_DIR}"
+         pbxlibdir="-L${TERMCAP_DIR}"
       fi
    fi
    pbxfuncname="tgetent"
@@ -11439,9 +11974,9 @@ if test "x${PBX_TINFO}" != "x1" -a "${USE_TINFO}" != "no"; then
    # 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"
+         pbxlibdir="-L${TINFO_DIR}/lib"
       else
-        pbxlibdir="-L${TINFO_DIR}"
+         pbxlibdir="-L${TINFO_DIR}"
       fi
    fi
    pbxfuncname="tgetent"
@@ -11543,9 +12078,9 @@ if test "x${PBX_CURSES}" != "x1" -a "${USE_CURSES}" != "no"; then
    # 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"
+         pbxlibdir="-L${CURSES_DIR}/lib"
       else
-        pbxlibdir="-L${CURSES_DIR}"
+         pbxlibdir="-L${CURSES_DIR}"
       fi
    fi
    pbxfuncname="initscr"
@@ -11647,9 +12182,9 @@ if test "x${PBX_NCURSES}" != "x1" -a "${USE_NCURSES}" != "no"; then
    # 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"
+         pbxlibdir="-L${NCURSES_DIR}/lib"
       else
-        pbxlibdir="-L${NCURSES_DIR}"
+         pbxlibdir="-L${NCURSES_DIR}"
       fi
    fi
    pbxfuncname="initscr"
 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 ${ac_cv_path_CONFIG_LIBXML2+:} false; 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
-
+# Find required UUID support.
+#  * -luuid on Linux
+#  * -le2fs-uuid on OpenBSD
+#  * in libsystem on OS X
 
-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 ${ac_cv_path_ac_pt_CONFIG_LIBXML2+:} false; then :
+if test "x${PBX_LIBUUID}" != "x1" -a "${USE_LIBUUID}" != "no"; then
+   pbxlibdir=""
+   # if --with-LIBUUID=DIR has been specified, use it.
+   if test "x${LIBUUID_DIR}" != "x"; then
+      if test -d ${LIBUUID_DIR}/lib; then
+         pbxlibdir="-L${LIBUUID_DIR}/lib"
+      else
+         pbxlibdir="-L${LIBUUID_DIR}"
+      fi
+   fi
+   pbxfuncname="uuid_generate_random"
+   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
+      AST_LIBUUID_FOUND=yes
+   else
+      ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
+      CFLAGS="${CFLAGS} "
+      as_ac_Lib=`$as_echo "ac_cv_lib_uuid_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -luuid" >&5
+$as_echo_n "checking for ${pbxfuncname} in -luuid... " >&6; }
+if eval \${$as_ac_Lib+:} false; 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
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-luuid ${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
-
-$as_echo "#define HAVE_LIBXML2 1" >>confdefs.h
+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_LIBUUID_FOUND=yes
+else
+  AST_LIBUUID_FOUND=no
+fi
 
-           fi
-       fi
-    fi
+      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
+   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
+   # now check for the header.
+   if test "${AST_LIBUUID_FOUND}" = "yes"; then
+      LIBUUID_LIB="${pbxlibdir} -luuid "
+      # if --with-LIBUUID=DIR has been specified, use it.
+      if test "x${LIBUUID_DIR}" != "x"; then
+         LIBUUID_INCLUDE="-I${LIBUUID_DIR}/include"
+      fi
+      LIBUUID_INCLUDE="${LIBUUID_INCLUDE} "
+      if test "xuuid/uuid.h" = "x" ; then      # no header, assume found
+         LIBUUID_HEADER_FOUND="1"
+      else                             # check for the header
+         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${LIBUUID_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "uuid/uuid.h" "ac_cv_header_uuid_uuid_h" "$ac_includes_default"
+if test "x$ac_cv_header_uuid_uuid_h" = xyes; then :
+  LIBUUID_HEADER_FOUND=1
+else
+  LIBUUID_HEADER_FOUND=0
 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" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_XLOCALE_H 1
+
+         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
+      fi
+      if test "x${LIBUUID_HEADER_FOUND}" = "x0" ; then
+         LIBUUID_LIB=""
+         LIBUUID_INCLUDE=""
+      else
+         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
+            LIBUUID_LIB=""
+         fi
+         PBX_LIBUUID=1
+         cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBUUID 1
 _ACEOF
 
+      fi
+   fi
 fi
 
-done
 
 
-for ac_header in winsock.h winsock2.h
-do :
-  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if test "x${PBX_E2FSUUID}" != "x1" -a "${USE_E2FSUUID}" != "no"; then
+   pbxlibdir=""
+   # if --with-E2FSUUID=DIR has been specified, use it.
+   if test "x${E2FSUUID_DIR}" != "x"; then
+      if test -d ${E2FSUUID_DIR}/lib; then
+         pbxlibdir="-L${E2FSUUID_DIR}/lib"
+      else
+         pbxlibdir="-L${E2FSUUID_DIR}"
+      fi
+   fi
+   pbxfuncname="uuid_generate_random"
+   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
+      AST_E2FSUUID_FOUND=yes
+   else
+      ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
+      CFLAGS="${CFLAGS} "
+      as_ac_Lib=`$as_echo "ac_cv_lib_e2fs-uuid_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -le2fs-uuid" >&5
+$as_echo_n "checking for ${pbxfuncname} in -le2fs-uuid... " >&6; }
+if eval \${$as_ac_Lib+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-le2fs-uuid ${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_E2FSUUID_FOUND=yes
+else
+  AST_E2FSUUID_FOUND=no
+fi
+
+      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
+   fi
+
+   # now check for the header.
+   if test "${AST_E2FSUUID_FOUND}" = "yes"; then
+      E2FSUUID_LIB="${pbxlibdir} -le2fs-uuid "
+      # if --with-E2FSUUID=DIR has been specified, use it.
+      if test "x${E2FSUUID_DIR}" != "x"; then
+         E2FSUUID_INCLUDE="-I${E2FSUUID_DIR}/include"
+      fi
+      E2FSUUID_INCLUDE="${E2FSUUID_INCLUDE} "
+      if test "xuuid/uuid.h" = "x" ; then      # no header, assume found
+         E2FSUUID_HEADER_FOUND="1"
+      else                             # check for the header
+         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${E2FSUUID_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "uuid/uuid.h" "ac_cv_header_uuid_uuid_h" "$ac_includes_default"
+if test "x$ac_cv_header_uuid_uuid_h" = xyes; then :
+  E2FSUUID_HEADER_FOUND=1
+else
+  E2FSUUID_HEADER_FOUND=0
+fi
+
+
+         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
+      fi
+      if test "x${E2FSUUID_HEADER_FOUND}" = "x0" ; then
+         E2FSUUID_LIB=""
+         E2FSUUID_INCLUDE=""
+      else
+         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
+            E2FSUUID_LIB=""
+         fi
+         PBX_E2FSUUID=1
+         cat >>confdefs.h <<_ACEOF
+#define HAVE_E2FSUUID 1
+_ACEOF
+
+      fi
+   fi
+fi
+
+
+for ac_func in uuid_generate_random
+do :
+  ac_fn_c_check_func "$LINENO" "uuid_generate_random" "ac_cv_func_uuid_generate_random"
+if test "x$ac_cv_func_uuid_generate_random" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_UUID_GENERATE_RANDOM 1
+_ACEOF
+ SYSUUID=true
+else
+  SYSUUID=""
+fi
+done
+
+
+if test "x$LIBUUID_LIB" != "x" ; then
+  UUID_INCLUDE="$LIBUUID_INCLUDE"
+  UUID_LIB="$LIBUUID_LIB"
+elif test "x$E2FSUUID_LIB" != "x" ; then
+  UUID_INCLUDE="$E2FSUUID_INCLUDE"
+  UUID_LIB="$E2FSUUID_LIB"
+elif test "x$SYSUUID" != "x" ; then
+  UUID_INCLUDE=""
+  UUID_LIB=""
+else
+  as_fn_error $? "*** uuid support not found (this typically means the uuid development package is missing)" "$LINENO" 5
+fi
+
+
+
+# Find required JSON support.
+
+if test "x${PBX_JANSSON}" != "x1" -a "${USE_JANSSON}" != "no"; then
+   pbxlibdir=""
+   # if --with-JANSSON=DIR has been specified, use it.
+   if test "x${JANSSON_DIR}" != "x"; then
+      if test -d ${JANSSON_DIR}/lib; then
+         pbxlibdir="-L${JANSSON_DIR}/lib"
+      else
+         pbxlibdir="-L${JANSSON_DIR}"
+      fi
+   fi
+   pbxfuncname="json_dumps"
+   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
+      AST_JANSSON_FOUND=yes
+   else
+      ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
+      CFLAGS="${CFLAGS} "
+      as_ac_Lib=`$as_echo "ac_cv_lib_jansson_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -ljansson" >&5
+$as_echo_n "checking for ${pbxfuncname} in -ljansson... " >&6; }
+if eval \${$as_ac_Lib+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ljansson ${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_JANSSON_FOUND=yes
+else
+  AST_JANSSON_FOUND=no
+fi
+
+      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
+   fi
+
+   # now check for the header.
+   if test "${AST_JANSSON_FOUND}" = "yes"; then
+      JANSSON_LIB="${pbxlibdir} -ljansson "
+      # if --with-JANSSON=DIR has been specified, use it.
+      if test "x${JANSSON_DIR}" != "x"; then
+         JANSSON_INCLUDE="-I${JANSSON_DIR}/include"
+      fi
+      JANSSON_INCLUDE="${JANSSON_INCLUDE} "
+      if test "xjansson.h" = "x" ; then        # no header, assume found
+         JANSSON_HEADER_FOUND="1"
+      else                             # check for the header
+         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${JANSSON_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "jansson.h" "ac_cv_header_jansson_h" "$ac_includes_default"
+if test "x$ac_cv_header_jansson_h" = xyes; then :
+  JANSSON_HEADER_FOUND=1
+else
+  JANSSON_HEADER_FOUND=0
+fi
+
+
+         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
+      fi
+      if test "x${JANSSON_HEADER_FOUND}" = "x0" ; then
+         JANSSON_LIB=""
+         JANSSON_INCLUDE=""
+      else
+         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
+            JANSSON_LIB=""
+         fi
+         PBX_JANSSON=1
+         cat >>confdefs.h <<_ACEOF
+#define HAVE_JANSSON 1
+_ACEOF
+
+      fi
+   fi
+fi
+
+
+
+if test "x$JANSSON_LIB" == "x"; then
+  as_fn_error $? "*** JSON support not found (this typically means the libjansson development package is missing)" "$LINENO" 5
+fi
+
+
+               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 ${ac_cv_path_CONFIG_LIBXML2+:} false; 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 ${ac_cv_path_ac_pt_CONFIG_LIBXML2+:} false; 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)
+                       LIBXML2_INCLUDE=$(echo ${LIBXML2_INCLUDE} | $SED -e "s|-I|-I${LIBXML2_DIR}|g")
+
+                       if test x"" = x ; then A=--libs ; else A="" ; fi
+                       LIBXML2_LIB=$(${CONFIG_LIBXML2} $A)
+                       LIBXML2_LIB=$(echo ${LIBXML2_LIB} | $SED -e "s|-L|-L${LIBXML2_DIR}|g")
+
+                       if test x"#include <libxml/tree.h>
+        #include <libxml/parser.h>" != x ; then
+                               saved_cppflags="${CPPFLAGS}"
+                               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}: *** The Asterisk menuselect tool requires the 'libxml2' development package." >&5
+$as_echo "$as_me: *** The Asterisk menuselect tool requires the 'libxml2' development package." >&6;}
+       { $as_echo "$as_me:${as_lineno-$LINENO}: *** Please install the 'libxml2' development package." >&5
+$as_echo "$as_me: *** Please install the 'libxml2' development package." >&6;}
+       exit 1
+fi
+
+
+if test "x${PBX_URIPARSER}" != "x1" -a "${USE_URIPARSER}" != "no"; then
+   pbxlibdir=""
+   # if --with-URIPARSER=DIR has been specified, use it.
+   if test "x${URIPARSER_DIR}" != "x"; then
+      if test -d ${URIPARSER_DIR}/lib; then
+         pbxlibdir="-L${URIPARSER_DIR}/lib"
+      else
+         pbxlibdir="-L${URIPARSER_DIR}"
+      fi
+   fi
+   pbxfuncname="uriParseUriA"
+   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
+      AST_URIPARSER_FOUND=yes
+   else
+      ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
+      CFLAGS="${CFLAGS} "
+      as_ac_Lib=`$as_echo "ac_cv_lib_uriparser_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -luriparser" >&5
+$as_echo_n "checking for ${pbxfuncname} in -luriparser... " >&6; }
+if eval \${$as_ac_Lib+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-luriparser ${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_URIPARSER_FOUND=yes
+else
+  AST_URIPARSER_FOUND=no
+fi
+
+      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
+   fi
+
+   # now check for the header.
+   if test "${AST_URIPARSER_FOUND}" = "yes"; then
+      URIPARSER_LIB="${pbxlibdir} -luriparser "
+      # if --with-URIPARSER=DIR has been specified, use it.
+      if test "x${URIPARSER_DIR}" != "x"; then
+         URIPARSER_INCLUDE="-I${URIPARSER_DIR}/include"
+      fi
+      URIPARSER_INCLUDE="${URIPARSER_INCLUDE} "
+      if test "xuriparser/Uri.h" = "x" ; then  # no header, assume found
+         URIPARSER_HEADER_FOUND="1"
+      else                             # check for the header
+         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${URIPARSER_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "uriparser/Uri.h" "ac_cv_header_uriparser_Uri_h" "$ac_includes_default"
+if test "x$ac_cv_header_uriparser_Uri_h" = xyes; then :
+  URIPARSER_HEADER_FOUND=1
+else
+  URIPARSER_HEADER_FOUND=0
+fi
+
+
+         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
+      fi
+      if test "x${URIPARSER_HEADER_FOUND}" = "x0" ; then
+         URIPARSER_LIB=""
+         URIPARSER_INCLUDE=""
+      else
+         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
+            URIPARSER_LIB=""
+         fi
+         PBX_URIPARSER=1
+         cat >>confdefs.h <<_ACEOF
+#define HAVE_URIPARSER 1
+_ACEOF
+
+      fi
+   fi
+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_LIBXSLT}" != "x1" -a "${USE_LIBXSLT}" != "no"; then
+   pbxlibdir=""
+   # if --with-LIBXSLT=DIR has been specified, use it.
+   if test "x${LIBXSLT_DIR}" != "x"; then
+      if test -d ${LIBXSLT_DIR}/lib; then
+         pbxlibdir="-L${LIBXSLT_DIR}/lib"
+      else
+         pbxlibdir="-L${LIBXSLT_DIR}"
+      fi
+   fi
+   pbxfuncname="xsltLoadStylesheetPI"
+   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
+      AST_LIBXSLT_FOUND=yes
+   else
+      ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
+      CFLAGS="${CFLAGS} ${LIBXML2_INCLUDE}"
+      as_ac_Lib=`$as_echo "ac_cv_lib_xslt_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lxslt" >&5
+$as_echo_n "checking for ${pbxfuncname} in -lxslt... " >&6; }
+if eval \${$as_ac_Lib+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lxslt ${pbxlibdir} ${LIBXML2_LIB} $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_LIBXSLT_FOUND=yes
+else
+  AST_LIBXSLT_FOUND=no
+fi
+
+      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
+   fi
+
+   # now check for the header.
+   if test "${AST_LIBXSLT_FOUND}" = "yes"; then
+      LIBXSLT_LIB="${pbxlibdir} -lxslt ${LIBXML2_LIB}"
+      # if --with-LIBXSLT=DIR has been specified, use it.
+      if test "x${LIBXSLT_DIR}" != "x"; then
+         LIBXSLT_INCLUDE="-I${LIBXSLT_DIR}/include"
+      fi
+      LIBXSLT_INCLUDE="${LIBXSLT_INCLUDE} ${LIBXML2_INCLUDE}"
+      if test "xlibxslt/xsltInternals.h" = "x" ; then  # no header, assume found
+         LIBXSLT_HEADER_FOUND="1"
+      else                             # check for the header
+         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${LIBXSLT_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "libxslt/xsltInternals.h" "ac_cv_header_libxslt_xsltInternals_h" "$ac_includes_default"
+if test "x$ac_cv_header_libxslt_xsltInternals_h" = xyes; then :
+  LIBXSLT_HEADER_FOUND=1
+else
+  LIBXSLT_HEADER_FOUND=0
+fi
+
+
+         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
+      fi
+      if test "x${LIBXSLT_HEADER_FOUND}" = "x0" ; then
+         LIBXSLT_LIB=""
+         LIBXSLT_INCLUDE=""
+      else
+         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
+            LIBXSLT_LIB=""
+         fi
+         PBX_LIBXSLT=1
+         cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBXSLT 1
+_ACEOF
+
+      fi
+   fi
+fi
+
+
+
+if test "x${PBX_LIBXSLT_CLEANUP}" != "x1" -a "${USE_LIBXSLT_CLEANUP}" != "no"; then
+   pbxlibdir=""
+   # if --with-LIBXSLT_CLEANUP=DIR has been specified, use it.
+   if test "x${LIBXSLT_CLEANUP_DIR}" != "x"; then
+      if test -d ${LIBXSLT_CLEANUP_DIR}/lib; then
+         pbxlibdir="-L${LIBXSLT_CLEANUP_DIR}/lib"
+      else
+         pbxlibdir="-L${LIBXSLT_CLEANUP_DIR}"
+      fi
+   fi
+   pbxfuncname="xsltCleanupGlobals"
+   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
+      AST_LIBXSLT_CLEANUP_FOUND=yes
+   else
+      ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
+      CFLAGS="${CFLAGS} ${LIBXML2_INCLUDE}"
+      as_ac_Lib=`$as_echo "ac_cv_lib_xslt_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lxslt" >&5
+$as_echo_n "checking for ${pbxfuncname} in -lxslt... " >&6; }
+if eval \${$as_ac_Lib+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lxslt ${pbxlibdir} ${LIBXML2_LIB} $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_LIBXSLT_CLEANUP_FOUND=yes
+else
+  AST_LIBXSLT_CLEANUP_FOUND=no
+fi
+
+      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
+   fi
+
+   # now check for the header.
+   if test "${AST_LIBXSLT_CLEANUP_FOUND}" = "yes"; then
+      LIBXSLT_CLEANUP_LIB="${pbxlibdir} -lxslt ${LIBXML2_LIB}"
+      # if --with-LIBXSLT_CLEANUP=DIR has been specified, use it.
+      if test "x${LIBXSLT_CLEANUP_DIR}" != "x"; then
+         LIBXSLT_CLEANUP_INCLUDE="-I${LIBXSLT_CLEANUP_DIR}/include"
+      fi
+      LIBXSLT_CLEANUP_INCLUDE="${LIBXSLT_CLEANUP_INCLUDE} ${LIBXML2_INCLUDE}"
+      if test "xlibxslt/xsltInternals.h" = "x" ; then  # no header, assume found
+         LIBXSLT_CLEANUP_HEADER_FOUND="1"
+      else                             # check for the header
+         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${LIBXSLT_CLEANUP_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "libxslt/xsltInternals.h" "ac_cv_header_libxslt_xsltInternals_h" "$ac_includes_default"
+if test "x$ac_cv_header_libxslt_xsltInternals_h" = xyes; then :
+  LIBXSLT_CLEANUP_HEADER_FOUND=1
+else
+  LIBXSLT_CLEANUP_HEADER_FOUND=0
+fi
+
+
+         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
+      fi
+      if test "x${LIBXSLT_CLEANUP_HEADER_FOUND}" = "x0" ; then
+         LIBXSLT_CLEANUP_LIB=""
+         LIBXSLT_CLEANUP_INCLUDE=""
+      else
+         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
+            LIBXSLT_CLEANUP_LIB=""
+         fi
+         PBX_LIBXSLT_CLEANUP=1
+         cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBXSLT_CLEANUP 1
+_ACEOF
+
+      fi
+   fi
+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" = xyes; 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
 $as_echo "$ac_cv_c_volatile" >&6; }
 if test $ac_cv_c_volatile = no; then
 
-$as_echo "#define volatile /**/" >>confdefs.h
+$as_echo "#define volatile /**/" >>confdefs.h
+
+fi
+
+ac_fn_c_check_type "$LINENO" "ptrdiff_t" "ac_cv_type_ptrdiff_t" "$ac_includes_default"
+if test "x$ac_cv_type_ptrdiff_t" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_PTRDIFF_T 1
+_ACEOF
+
+
+fi
+
+stat_nsec_found=no
+ac_fn_c_check_member "$LINENO" "struct stat" "st_mtim" "ac_cv_member_struct_stat_st_mtim" "#include <sys/stat.h>
+"
+if test "x$ac_cv_member_struct_stat_st_mtim" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_STAT_ST_MTIM 1
+_ACEOF
+
+stat_nsec_found=yes
+fi
+ac_fn_c_check_member "$LINENO" "struct stat" "st_mtimensec" "ac_cv_member_struct_stat_st_mtimensec" "#include <sys/stat.h>
+"
+if test "x$ac_cv_member_struct_stat_st_mtimensec" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_STAT_ST_MTIMENSEC 1
+_ACEOF
 
+stat_nsec_found=yes
 fi
-
-ac_fn_c_check_type "$LINENO" "ptrdiff_t" "ac_cv_type_ptrdiff_t" "$ac_includes_default"
-if test "x$ac_cv_type_ptrdiff_t" = xyes; then :
+ac_fn_c_check_member "$LINENO" "struct stat" "st_mtimespec" "ac_cv_member_struct_stat_st_mtimespec" "#include <sys/stat.h>
+"
+if test "x$ac_cv_member_struct_stat_st_mtimespec" = xyes; then :
 
 cat >>confdefs.h <<_ACEOF
-#define HAVE_PTRDIFF_T 1
+#define HAVE_STRUCT_STAT_ST_MTIMESPEC 1
 _ACEOF
 
-
+stat_nsec_found=yes
 fi
 
 
+if test "${stat_nsec_found}" != yes; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Cannot determine nanosecond field of struct stat" >&5
+$as_echo "$as_me: WARNING: Cannot determine nanosecond field of struct stat" >&2;}
+fi
+
 # Checks for library functions.
 for ac_header in unistd.h
 do :
@@ -14039,7 +15274,7 @@ _ACEOF
 fi
 
 # BSD might not have exp2, and/or log2
-for ac_func in exp2 log2 exp10 log10 sin cos tan asin acos atan atan2 pow rint exp log remainder fmod round trunc floor ceil
+for ac_func in exp2 log2 exp10 log10 sin cos tan asin acos atan atan2 pow rint exp log remainder fmod round roundf trunc floor ceil
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 
-if test "${cross_compiling}" = "no";
-then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for /dev/urandom" >&5
-$as_echo_n "checking for /dev/urandom... " >&6; }
-if ${ac_cv_file__dev_urandom+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  test "$cross_compiling" = yes &&
-  as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5
-if test -r "/dev/urandom"; then
-  ac_cv_file__dev_urandom=yes
-else
-  ac_cv_file__dev_urandom=no
-fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_file__dev_urandom" >&5
-$as_echo "$ac_cv_file__dev_urandom" >&6; }
-if test "x$ac_cv_file__dev_urandom" = xyes; then :
-
-$as_echo "#define HAVE_DEV_URANDOM 1" >>confdefs.h
-
-fi
-
-fi
-
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for locale_t in locale.h" >&5
 $as_echo_n "checking for locale_t in locale.h... " >&6; }
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_rwlock_timedwrlock() in pthread.h" >&5
-$as_echo_n "checking for pthread_rwlock_timedwrlock() in pthread.h... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PTHREAD_MUTEX_ADAPTIVE_NP in pthread.h" >&5
+$as_echo_n "checking for PTHREAD_MUTEX_ADAPTIVE_NP in pthread.h... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <pthread.h>
+int
+main ()
+{
+int a = PTHREAD_MUTEX_ADAPTIVE_NP;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+$as_echo "#define HAVE_PTHREAD_MUTEX_ADAPTIVE_NP 1" >>confdefs.h
+
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_spinlock_t in pthread.h" >&5
+$as_echo_n "checking for pthread_spinlock_t in pthread.h... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <pthread.h>
+int
+main ()
+{
+pthread_spinlock_t spin;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+$as_echo "#define HAVE_PTHREAD_SPINLOCK 1" >>confdefs.h
+
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+
 save_LIBS="$LIBS"
 save_CFLAGS="$CFLAGS"
 LIBS="$PTHREAD_LIBS $LIBS"
 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_rwlock_timedwrlock() in pthread.h" >&5
+$as_echo_n "checking for pthread_rwlock_timedwrlock() in pthread.h... " >&6; }
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <pthread.h>
@@ -14695,6 +15960,43 @@ $as_echo "no" >&6; }
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
+
+# Some platforms define sem_init(), but only support sem_open(). joyous.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working unnamed semaphores" >&5
+$as_echo_n "checking for working unnamed semaphores... " >&6; }
+if test "$cross_compiling" = yes; then :
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot run test program while cross compiling
+See \`config.log' for more details" "$LINENO" 5; }
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <semaphore.h>
+int
+main ()
+{
+sem_t sem; return sem_init(&sem, 0, 0);
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+$as_echo "#define HAS_WORKING_SEMAPHORE 1" >>confdefs.h
+
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+
 LIBS="$save_LIBS"
 CFLAGS="$save_CFLAGS"
 if test "${ac_cv_pthread_rwlock_timedwrlock}" = "yes"; then
@@ -15547,28 +16849,17 @@ CFLAGS="$saved_CFLAGS"
 
 
 
-# Support weak symbols on a platform specific basis.  The Mac OS X
-# (Darwin) support must be isolated from the other platforms because
-# it has caused other platforms to fail.
-#
-case "${OSARCH}" in
-       darwin*)
-       # Allow weak symbol support on Darwin platforms only because there
-       # is active community support for it.
-       # However, Darwin seems to break weak symbols for each new version.
-       #
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for compiler 'attribute weak_import' support" >&5
-$as_echo_n "checking for compiler 'attribute weak_import' support... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for compiler 'attribute may_alias' support" >&5
+$as_echo_n "checking for compiler 'attribute may_alias' support... " >&6; }
 saved_CFLAGS="$CFLAGS"
 CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
-PBX_WEAKREF=0
+
 
 if test "x" = "x"
 then
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
- void __attribute__((weak_import)) *test(void *muffin, ...) {return (void *) 0;}
+ void __attribute__((may_alias)) *test(void *muffin, ...) {return (void *) 0;}
 int
 main ()
 {
@@ -15580,10 +16871,10 @@ _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
-       PBX_WEAKREF=1
+
 
 cat >>confdefs.h <<_ACEOF
-#define HAVE_ATTRIBUTE_weak_import 1
+#define HAVE_ATTRIBUTE_may_alias 1
 _ACEOF
 
 else
@@ -15607,10 +16898,10 @@ _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
-       PBX_WEAKREF=1
+
 
 cat >>confdefs.h <<_ACEOF
-#define HAVE_ATTRIBUTE_weak_import 1
+#define HAVE_ATTRIBUTE_may_alias 1
 _ACEOF
 
 else
@@ -15626,21 +16917,17 @@ CFLAGS="$saved_CFLAGS"
 
 
 
-       # Several other platforms including Linux have GCC versions that
-       # define the weak attribute.  However, this attribute is only
-       # setup for use in the code by Darwin.
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for compiler 'attribute weak' support" >&5
-$as_echo_n "checking for compiler 'attribute weak' support... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for compiler 'attribute constructor' support" >&5
+$as_echo_n "checking for compiler 'attribute constructor' support... " >&6; }
 saved_CFLAGS="$CFLAGS"
 CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
-PBX_WEAKREF=0
+
 
 if test "x" = "x"
 then
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
- void __attribute__((weak)) *test(void *muffin, ...) {return (void *) 0;}
+ void __attribute__((constructor)) *test(void *muffin, ...) {return (void *) 0;}
 int
 main ()
 {
@@ -15652,10 +16939,10 @@ _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
-       PBX_WEAKREF=1
+
 
 cat >>confdefs.h <<_ACEOF
-#define HAVE_ATTRIBUTE_weak 1
+#define HAVE_ATTRIBUTE_constructor 1
 _ACEOF
 
 else
@@ -15679,82 +16966,10 @@ _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
-       PBX_WEAKREF=1
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_ATTRIBUTE_weak 1
-_ACEOF
-
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-
-CFLAGS="$saved_CFLAGS"
-
-
-       ;;
-       linux-gnu)
-       # Primarily support weak symbols on Linux platforms.
-       #
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for compiler 'attribute weakref' support" >&5
-$as_echo_n "checking for compiler 'attribute weakref' support... " >&6; }
-saved_CFLAGS="$CFLAGS"
-CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
-PBX_WEAKREF=0
-
-if test "xweakref("foo")" = "x"
-then
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-static void __attribute__((weakref)) *test(void *muffin, ...) {return (void *) 0;}
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-       PBX_WEAKREF=1
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_ATTRIBUTE_weakref 1
-_ACEOF
-
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-static void __attribute__((weakref("foo"))) *test(void *muffin, ...) {return (void *) 0;}
-int
-main ()
-{
 
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-       PBX_WEAKREF=1
 
 cat >>confdefs.h <<_ACEOF
-#define HAVE_ATTRIBUTE_weakref 1
+#define HAVE_ATTRIBUTE_constructor 1
 _ACEOF
 
 else
 CFLAGS="$saved_CFLAGS"
 
 
-       ;;
-       *)
-       # Allow weak symbols on other platforms.  However, any problems
-       # with this feature on other platforms must be fixed by the
-       # community.
-       #
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for compiler 'attribute weakref' support" >&5
-$as_echo_n "checking for compiler 'attribute weakref' support... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for compiler 'attribute destructor' support" >&5
+$as_echo_n "checking for compiler 'attribute destructor' support... " >&6; }
 saved_CFLAGS="$CFLAGS"
 CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
-PBX_WEAKREF=0
 
-if test "xweakref("foo")" = "x"
+
+if test "x" = "x"
 then
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-static void __attribute__((weakref)) *test(void *muffin, ...) {return (void *) 0;}
+ void __attribute__((destructor)) *test(void *muffin, ...) {return (void *) 0;}
 int
 main ()
 {
@@ -15798,10 +17007,10 @@ _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
-       PBX_WEAKREF=1
+
 
 cat >>confdefs.h <<_ACEOF
-#define HAVE_ATTRIBUTE_weakref 1
+#define HAVE_ATTRIBUTE_destructor 1
 _ACEOF
 
 else
@@ -15813,7 +17022,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 else
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-static void __attribute__((weakref("foo"))) *test(void *muffin, ...) {return (void *) 0;}
+ void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;}
 int
 main ()
 {
@@ -15825,10 +17034,10 @@ _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
-       PBX_WEAKREF=1
+
 
 cat >>confdefs.h <<_ACEOF
-#define HAVE_ATTRIBUTE_weakref 1
+#define HAVE_ATTRIBUTE_destructor 1
 _ACEOF
 
 else
@@ -15843,8 +17052,6 @@ fi
 CFLAGS="$saved_CFLAGS"
 
 
-       ;;
-esac
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -ffunction-sections support" >&5
 $as_echo_n "checking for -ffunction-sections support... " >&6; }
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FORTIFY_SOURCE support" >&5
 $as_echo_n "checking for _FORTIFY_SOURCE support... " >&6; }
-if $(${CC} -D_FORTIFY_SOURCE=2 -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
+if $(${CC} -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
-       AST_FORTIFY_SOURCE=-D_FORTIFY_SOURCE=2
+       AST_FORTIFY_SOURCE="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2"
 else
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
@@ -15986,6 +17193,58 @@ $as_echo "no" >&6; }
 fi
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -fnested-functions" >&5
+$as_echo_n "checking for -fnested-functions... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+auto void foo(void); void foo(void) {}
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+       AST_NESTED_FUNCTIONS=
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: required" >&5
+$as_echo "required" >&6; }
+       AST_NESTED_FUNCTIONS=-fnested-functions
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+
+# Check whether --enable-rpath was given.
+if test "${enable_rpath+set}" = set; then :
+  enableval=$enable_rpath; case "${enableval}" in
+               y|ye|yes) check_rpath=yes ;;
+               n|no) check_rpath=no ;;
+                *) as_fn_error $? "bad value ${enableval} for --disable-rpath" "$LINENO" 5 ;;
+       esac
+else
+  check_rpath=yes
+fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use rpath" >&5
+$as_echo_n "checking whether to use rpath... " >&6; }
+AST_RPATH=
+if test "${check_rpath}" != yes; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: skipped" >&5
+$as_echo "skipped" >&6; }
+elif test "${prefix}" = /usr || test "${prefix}" = NONE; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: not needed" >&5
+$as_echo "not needed" >&6; }
+else
+       AST_RPATH="-Wl,-rpath,${libdir}"
+fi
+
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysinfo" >&5
 $as_echo_n "checking for sysinfo... " >&6; }
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -16295,10 +17554,57 @@ rm -f core conftest.err conftest.$ac_objext \
        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GLOB_NOMAGIC in glob.h" >&5
 $as_echo_n "checking for GLOB_NOMAGIC in glob.h... " >&6; }
        saved_cppflags="${CPPFLAGS}"
-       if test "x${GLOB_NOMAGIC_DIR}" != "x"; then
-           GLOB_NOMAGIC_INCLUDE="-I${GLOB_NOMAGIC_DIR}/include"
+       if test "x${GLOB_NOMAGIC_DIR}" != "x"; then
+           GLOB_NOMAGIC_INCLUDE="-I${GLOB_NOMAGIC_DIR}/include"
+       fi
+       CPPFLAGS="${CPPFLAGS} ${GLOB_NOMAGIC_INCLUDE}"
+
+       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+ #include <glob.h>
+int
+main ()
+{
+#if defined(GLOB_NOMAGIC)
+                               int foo = 0;
+                               #else
+                               int foo = bar;
+                               #endif
+                               0
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+               PBX_GLOB_NOMAGIC=1
+
+$as_echo "#define HAVE_GLOB_NOMAGIC 1" >>confdefs.h
+
+
+
+else
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+       CPPFLAGS="${saved_cppflags}"
+    fi
+
+
+
+
+    if test "x${PBX_GLOB_BRACE}" != "x1"; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GLOB_BRACE in glob.h" >&5
+$as_echo_n "checking for GLOB_BRACE in glob.h... " >&6; }
+       saved_cppflags="${CPPFLAGS}"
+       if test "x${GLOB_BRACE_DIR}" != "x"; then
+           GLOB_BRACE_INCLUDE="-I${GLOB_BRACE_DIR}/include"
        fi
-       CPPFLAGS="${CPPFLAGS} ${GLOB_NOMAGIC_INCLUDE}"
+       CPPFLAGS="${CPPFLAGS} ${GLOB_BRACE_INCLUDE}"
 
        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
@@ -16306,7 +17612,7 @@ $as_echo_n "checking for GLOB_NOMAGIC in glob.h... " >&6; }
 int
 main ()
 {
-#if defined(GLOB_NOMAGIC)
+#if defined(GLOB_BRACE)
                                int foo = 0;
                                #else
                                int foo = bar;
@@ -16320,9 +17626,9 @@ _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
      { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
-               PBX_GLOB_NOMAGIC=1
+               PBX_GLOB_BRACE=1
 
-$as_echo "#define HAVE_GLOB_NOMAGIC 1" >>confdefs.h
+$as_echo "#define HAVE_GLOB_BRACE 1" >>confdefs.h
 
 
 
@@ -16338,22 +17644,22 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
 
 
-    if test "x${PBX_GLOB_BRACE}" != "x1"; then
-       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GLOB_BRACE in glob.h" >&5
-$as_echo_n "checking for GLOB_BRACE in glob.h... " >&6; }
+    if test "x${PBX_RTLD_NOLOAD}" != "x1"; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for RTLD_NOLOAD in dlfcn.h" >&5
+$as_echo_n "checking for RTLD_NOLOAD in dlfcn.h... " >&6; }
        saved_cppflags="${CPPFLAGS}"
-       if test "x${GLOB_BRACE_DIR}" != "x"; then
-           GLOB_BRACE_INCLUDE="-I${GLOB_BRACE_DIR}/include"
+       if test "x${RTLD_NOLOAD_DIR}" != "x"; then
+           RTLD_NOLOAD_INCLUDE="-I${RTLD_NOLOAD_DIR}/include"
        fi
-       CPPFLAGS="${CPPFLAGS} ${GLOB_BRACE_INCLUDE}"
+       CPPFLAGS="${CPPFLAGS} ${RTLD_NOLOAD_INCLUDE}"
 
        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
- #include <glob.h>
+ #include <dlfcn.h>
 int
 main ()
 {
-#if defined(GLOB_BRACE)
+#if defined(RTLD_NOLOAD)
                                int foo = 0;
                                #else
                                int foo = bar;
@@ -16367,9 +17673,9 @@ _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
      { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
-               PBX_GLOB_BRACE=1
+               PBX_RTLD_NOLOAD=1
 
-$as_echo "#define HAVE_GLOB_BRACE 1" >>confdefs.h
+$as_echo "#define HAVE_RTLD_NOLOAD 1" >>confdefs.h
 
 
 
@@ -16864,9 +18170,9 @@ if test "x${PBX_ALSA}" != "x1" -a "${USE_ALSA}" != "no"; then
    # 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"
+         pbxlibdir="-L${ALSA_DIR}/lib"
       else
-        pbxlibdir="-L${ALSA_DIR}"
+         pbxlibdir="-L${ALSA_DIR}"
       fi
    fi
    pbxfuncname="snd_spcm_init"
@@ -16969,9 +18275,9 @@ if test "x${PBX_BFD}" != "x1" -a "${USE_BFD}" != "no"; then
    # if --with-BFD=DIR has been specified, use it.
    if test "x${BFD_DIR}" != "x"; then
       if test -d ${BFD_DIR}/lib; then
-        pbxlibdir="-L${BFD_DIR}/lib"
+         pbxlibdir="-L${BFD_DIR}/lib"
       else
-        pbxlibdir="-L${BFD_DIR}"
+         pbxlibdir="-L${BFD_DIR}"
       fi
    fi
    pbxfuncname="bfd_openr"
@@ -17076,9 +18382,9 @@ if test "x${PBX_BFD}" != "x1" -a "${USE_BFD}" != "no"; then
    # if --with-BFD=DIR has been specified, use it.
    if test "x${BFD_DIR}" != "x"; then
       if test -d ${BFD_DIR}/lib; then
-        pbxlibdir="-L${BFD_DIR}/lib"
+         pbxlibdir="-L${BFD_DIR}/lib"
       else
-        pbxlibdir="-L${BFD_DIR}"
+         pbxlibdir="-L${BFD_DIR}"
       fi
    fi
    pbxfuncname="bfd_check_format"
 
 fi
 
+if test "${PBX_BFD}" = "0"; then
+  # openSUSE requires -lz
+
+if test "x${PBX_BFD}" != "x1" -a "${USE_BFD}" != "no"; then
+   pbxlibdir=""
+   # if --with-BFD=DIR has been specified, use it.
+   if test "x${BFD_DIR}" != "x"; then
+      if test -d ${BFD_DIR}/lib; then
+         pbxlibdir="-L${BFD_DIR}/lib"
+      else
+         pbxlibdir="-L${BFD_DIR}"
+      fi
+   fi
+   pbxfuncname="bfd_check_format"
+   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
+      AST_BFD_FOUND=yes
+   else
+      ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
+      CFLAGS="${CFLAGS} "
+      as_ac_Lib=`$as_echo "ac_cv_lib_bfd_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lbfd" >&5
+$as_echo_n "checking for ${pbxfuncname} in -lbfd... " >&6; }
+if eval \${$as_ac_Lib+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lbfd ${pbxlibdir} -ldl -liberty -lz $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_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 -ldl -liberty -lz"
+      # 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" = xyes; 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
+
+
+fi
+
 if test "x${OSARCH}" = "xlinux-gnu" ; then
 
 if test "x${PBX_CAP}" != "x1" -a "${USE_CAP}" != "no"; then
@@ -17183,9 +18597,9 @@ if test "x${PBX_CAP}" != "x1" -a "${USE_CAP}" != "no"; then
    # 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"
+         pbxlibdir="-L${CAP_DIR}/lib"
       else
-        pbxlibdir="-L${CAP_DIR}"
+         pbxlibdir="-L${CAP_DIR}"
       fi
    fi
    pbxfuncname="cap_from_text"
@@ -17805,10 +19219,224 @@ _ACEOF
    if test "${GSM_INTERNAL}" = "yes"; then
       PBX_GSM=1
 
-cat >>confdefs.h <<_ACEOF
-#define HAVE_GSM_HEADER 1
-_ACEOF
+cat >>confdefs.h <<_ACEOF
+#define HAVE_GSM_HEADER 1
+_ACEOF
+
+   fi
+fi
+
+ILBC_INTERNAL="yes"
+
+ILBC_SYSTEM="yes"
+if test "${USE_ILBC}" != "no"; then
+   if test "${ILBC_DIR}" = "internal"; then
+      ILBC_SYSTEM="no"
+   elif test "${ILBC_DIR}" != ""; then
+      ILBC_INTERNAL="no"
+   fi
+   if test "${ILBC_SYSTEM}" = "yes"; then
+
+   if test "x${PBX_ILBC}" != "x1" -a "${USE_ILBC}" != "no"; then
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ILBC" >&5
+$as_echo_n "checking for ILBC... " >&6; }
+
+if test -n "$ILBC_CFLAGS"; then
+    pkg_cv_ILBC_CFLAGS="$ILBC_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libilbc\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "libilbc") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_ILBC_CFLAGS=`$PKG_CONFIG --cflags "libilbc" 2>/dev/null`
+                     test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+if test -n "$ILBC_LIBS"; then
+    pkg_cv_ILBC_LIBS="$ILBC_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libilbc\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "libilbc") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_ILBC_LIBS=`$PKG_CONFIG --libs "libilbc" 2>/dev/null`
+                     test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi
+        if test $_pkg_short_errors_supported = yes; then
+               ILBC_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libilbc" 2>&1`
+        else
+               ILBC_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libilbc" 2>&1`
+        fi
+       # Put the nasty error message in config.log where it belongs
+       echo "$ILBC_PKG_ERRORS" >&5
+
+
+            PBX_ILBC=0
+
+
+elif test $pkg_failed = untried; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+            PBX_ILBC=0
+
+
+else
+       ILBC_CFLAGS=$pkg_cv_ILBC_CFLAGS
+       ILBC_LIBS=$pkg_cv_ILBC_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+            PBX_ILBC=1
+            ILBC_INCLUDE="$ILBC_CFLAGS"
+            ILBC_LIB="$ILBC_LIBS"
+
+$as_echo "#define HAVE_ILBC 1" >>confdefs.h
+
+
+fi
+   fi
+
+      if test "$PBX_ILBC" = "1"; then
+        ILBC_INTERNAL="no"
+      fi
+   fi
+   if test "${ILBC_INTERNAL}" = "yes"; then
+      PBX_ILBC=1
+   fi
+fi
+
+LIBEDIT_INTERNAL="yes"
+
+LIBEDIT_SYSTEM="yes"
+if test "${USE_LIBEDIT}" != "no"; then
+   if test "${LIBEDIT_DIR}" = "internal"; then
+      LIBEDIT_SYSTEM="no"
+   elif test "${LIBEDIT_DIR}" != ""; then
+      LIBEDIT_INTERNAL="no"
+   fi
+   if test "${LIBEDIT_SYSTEM}" = "yes"; then
+
+   if test "x${PBX_LIBEDIT}" != "x1" -a "${USE_LIBEDIT}" != "no"; then
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBEDIT" >&5
+$as_echo_n "checking for LIBEDIT... " >&6; }
+
+if test -n "$LIBEDIT_CFLAGS"; then
+    pkg_cv_LIBEDIT_CFLAGS="$LIBEDIT_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libedit\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "libedit") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_LIBEDIT_CFLAGS=`$PKG_CONFIG --cflags "libedit" 2>/dev/null`
+                     test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+if test -n "$LIBEDIT_LIBS"; then
+    pkg_cv_LIBEDIT_LIBS="$LIBEDIT_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libedit\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "libedit") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_LIBEDIT_LIBS=`$PKG_CONFIG --libs "libedit" 2>/dev/null`
+                     test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi
+        if test $_pkg_short_errors_supported = yes; then
+               LIBEDIT_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libedit" 2>&1`
+        else
+               LIBEDIT_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libedit" 2>&1`
+        fi
+       # Put the nasty error message in config.log where it belongs
+       echo "$LIBEDIT_PKG_ERRORS" >&5
+
+
+            PBX_LIBEDIT=0
+
+
+elif test $pkg_failed = untried; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+            PBX_LIBEDIT=0
+
+
+else
+       LIBEDIT_CFLAGS=$pkg_cv_LIBEDIT_CFLAGS
+       LIBEDIT_LIBS=$pkg_cv_LIBEDIT_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+            PBX_LIBEDIT=1
+            LIBEDIT_INCLUDE="$LIBEDIT_CFLAGS"
+            LIBEDIT_LIB="$LIBEDIT_LIBS"
+
+$as_echo "#define HAVE_LIBEDIT 1" >>confdefs.h
+
+
+fi
+   fi
 
+      if test "$PBX_LIBEDIT" = "1"; then
+        LIBEDIT_INTERNAL="no"
+      fi
+   fi
+   if test "${LIBEDIT_INTERNAL}" = "yes"; then
+      PBX_LIBEDIT=1
    fi
 fi
 
@@ -17818,9 +19446,9 @@ if test "x${PBX_ICONV}" != "x1" -a "${USE_ICONV}" != "no"; then
    # if --with-ICONV=DIR has been specified, use it.
    if test "x${ICONV_DIR}" != "x"; then
       if test -d ${ICONV_DIR}/lib; then
-        pbxlibdir="-L${ICONV_DIR}/lib"
+         pbxlibdir="-L${ICONV_DIR}/lib"
       else
-        pbxlibdir="-L${ICONV_DIR}"
+         pbxlibdir="-L${ICONV_DIR}"
       fi
    fi
    pbxfuncname="iconv_open"
@@ -17923,9 +19551,9 @@ if test "x${PBX_ICONV}" != "x1" -a "${USE_ICONV}" != "no"; then
    # if --with-ICONV=DIR has been specified, use it.
    if test "x${ICONV_DIR}" != "x"; then
       if test -d ${ICONV_DIR}/lib; then
-        pbxlibdir="-L${ICONV_DIR}/lib"
+         pbxlibdir="-L${ICONV_DIR}/lib"
       else
-        pbxlibdir="-L${ICONV_DIR}"
+         pbxlibdir="-L${ICONV_DIR}"
       fi
    fi
    pbxfuncname="libiconv_open"
@@ -18028,9 +19656,9 @@ if test "x${PBX_ICONV}" != "x1" -a "${USE_ICONV}" != "no"; then
    # if --with-ICONV=DIR has been specified, use it.
    if test "x${ICONV_DIR}" != "x"; then
       if test -d ${ICONV_DIR}/lib; then
-        pbxlibdir="-L${ICONV_DIR}/lib"
+         pbxlibdir="-L${ICONV_DIR}/lib"
       else
-        pbxlibdir="-L${ICONV_DIR}"
+         pbxlibdir="-L${ICONV_DIR}"
       fi
    fi
    pbxfuncname="iconv_close"
@@ -18134,9 +19762,9 @@ if test "x${PBX_ICAL}" != "x1" -a "${USE_ICAL}" != "no"; then
    # if --with-ICAL=DIR has been specified, use it.
    if test "x${ICAL_DIR}" != "x"; then
       if test -d ${ICAL_DIR}/lib; then
-        pbxlibdir="-L${ICAL_DIR}/lib"
+         pbxlibdir="-L${ICAL_DIR}/lib"
       else
-        pbxlibdir="-L${ICAL_DIR}"
+         pbxlibdir="-L${ICAL_DIR}"
       fi
    fi
    pbxfuncname="icaltimezone_get_utc_timezone"
@@ -18239,9 +19867,9 @@ if test "x${PBX_IKSEMEL}" != "x1" -a "${USE_IKSEMEL}" != "no"; then
    # 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"
+         pbxlibdir="-L${IKSEMEL_DIR}/lib"
       else
-        pbxlibdir="-L${IKSEMEL_DIR}"
+         pbxlibdir="-L${IKSEMEL_DIR}"
       fi
    fi
    pbxfuncname="iks_start_sasl"
@@ -18972,9 +20600,9 @@ if test "x${PBX_IODBC}" != "x1" -a "${USE_IODBC}" != "no"; then
    # if --with-IODBC=DIR has been specified, use it.
    if test "x${IODBC_DIR}" != "x"; then
       if test -d ${IODBC_DIR}/lib; then
-        pbxlibdir="-L${IODBC_DIR}/lib"
+         pbxlibdir="-L${IODBC_DIR}/lib"
       else
-        pbxlibdir="-L${IODBC_DIR}"
+         pbxlibdir="-L${IODBC_DIR}"
       fi
    fi
    pbxfuncname="SQLConnect"
@@ -19077,9 +20705,9 @@ if test "x${PBX_INOTIFY}" != "x1" -a "${USE_INOTIFY}" != "no"; then
    # if --with-INOTIFY=DIR has been specified, use it.
    if test "x${INOTIFY_DIR}" != "x"; then
       if test -d ${INOTIFY_DIR}/lib; then
-        pbxlibdir="-L${INOTIFY_DIR}/lib"
+         pbxlibdir="-L${INOTIFY_DIR}/lib"
       else
-        pbxlibdir="-L${INOTIFY_DIR}"
+         pbxlibdir="-L${INOTIFY_DIR}"
       fi
    fi
    pbxfuncname="inotify_init"
@@ -19182,9 +20810,9 @@ if test "x${PBX_JACK}" != "x1" -a "${USE_JACK}" != "no"; then
    # if --with-JACK=DIR has been specified, use it.
    if test "x${JACK_DIR}" != "x"; then
       if test -d ${JACK_DIR}/lib; then
-        pbxlibdir="-L${JACK_DIR}/lib"
+         pbxlibdir="-L${JACK_DIR}/lib"
       else
-        pbxlibdir="-L${JACK_DIR}"
+         pbxlibdir="-L${JACK_DIR}"
       fi
    fi
    pbxfuncname="jack_activate"
@@ -19288,9 +20916,9 @@ if test "x${PBX_KQUEUE}" != "x1" -a "${USE_KQUEUE}" != "no"; then
    # if --with-KQUEUE=DIR has been specified, use it.
    if test "x${KQUEUE_DIR}" != "x"; then
       if test -d ${KQUEUE_DIR}/lib; then
-        pbxlibdir="-L${KQUEUE_DIR}/lib"
+         pbxlibdir="-L${KQUEUE_DIR}/lib"
       else
-        pbxlibdir="-L${KQUEUE_DIR}"
+         pbxlibdir="-L${KQUEUE_DIR}"
       fi
    fi
    pbxfuncname="kqueue"
@@ -19407,9 +21035,9 @@ if test "x${PBX_LTDL}" != "x1" -a "${USE_LTDL}" != "no"; then
    # 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"
+         pbxlibdir="-L${LTDL_DIR}/lib"
       else
-        pbxlibdir="-L${LTDL_DIR}"
+         pbxlibdir="-L${LTDL_DIR}"
       fi
    fi
    pbxfuncname="lt_dlinit"
@@ -19512,9 +21140,9 @@ if test "x${PBX_LDAP}" != "x1" -a "${USE_LDAP}" != "no"; then
    # 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"
+         pbxlibdir="-L${LDAP_DIR}/lib"
       else
-        pbxlibdir="-L${LDAP_DIR}"
+         pbxlibdir="-L${LDAP_DIR}"
       fi
    fi
    pbxfuncname="ldap_initialize"
@@ -19617,9 +21245,9 @@ if test "x${PBX_MISDN}" != "x1" -a "${USE_MISDN}" != "no"; then
    # 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"
+         pbxlibdir="-L${MISDN_DIR}/lib"
       else
-        pbxlibdir="-L${MISDN_DIR}"
+         pbxlibdir="-L${MISDN_DIR}"
       fi
    fi
    pbxfuncname="mISDN_open"
@@ -19723,9 +21351,9 @@ if test "x${PBX_ISDNNET}" != "x1" -a "${USE_ISDNNET}" != "no"; then
    # 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"
+         pbxlibdir="-L${ISDNNET_DIR}/lib"
       else
-        pbxlibdir="-L${ISDNNET_DIR}"
+         pbxlibdir="-L${ISDNNET_DIR}"
       fi
    fi
    pbxfuncname="init_manager"
@@ -19827,9 +21455,9 @@ if test "x${PBX_SUPPSERV}" != "x1" -a "${USE_SUPPSERV}" != "no"; then
    # 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"
+         pbxlibdir="-L${SUPPSERV_DIR}/lib"
       else
-        pbxlibdir="-L${SUPPSERV_DIR}"
+         pbxlibdir="-L${SUPPSERV_DIR}"
       fi
    fi
    pbxfuncname="encodeFac"
@@ -20038,9 +21666,9 @@ fi
 fi
 
 
-    if test "x${PBX_MYSQLCLIENT}" != "x1" -a "${USE_MYSQLCLIENT}" != "no"; then
-       PBX_MYSQLCLIENT=0
-       if test -n "$ac_tool_prefix"; then
+               if test "x${PBX_MYSQLCLIENT}" != "x1" -a "${USE_MYSQLCLIENT}" != "no"; then
+               PBX_MYSQLCLIENT=0
+               if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}mysql_config", so it can be a program name with args.
 set dummy ${ac_tool_prefix}mysql_config; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
@@ -20140,52 +21768,50 @@ else
   CONFIG_MYSQLCLIENT="$ac_cv_path_CONFIG_MYSQLCLIENT"
 fi
 
-       if test ! "x${CONFIG_MYSQLCLIENT}" = xNo; then
-           if test x"" = x ; then A=--cflags ; else A="" ; fi
-           MYSQLCLIENT_INCLUDE=$(${CONFIG_MYSQLCLIENT} $A)
-           if test x"" = x ; then A=--libs ; else A="" ; fi
-           MYSQLCLIENT_LIB=$(${CONFIG_MYSQLCLIENT} $A)
-           if test x"" != x ; then
-               saved_cppflags="${CPPFLAGS}"
-               if test "x${MYSQLCLIENT_DIR}" != "x"; then
-                   MYSQLCLIENT_INCLUDE="-I${MYSQLCLIENT_DIR}/include"
-               fi
-               CPPFLAGS="${CPPFLAGS} ${MYSQLCLIENT_INCLUDE}"
+               if test ! "x${CONFIG_MYSQLCLIENT}" = xNo; then
+                       if test x"" = x ; then A=--cflags ; else A="" ; fi
+                       MYSQLCLIENT_INCLUDE=$(${CONFIG_MYSQLCLIENT} $A)
+                       MYSQLCLIENT_INCLUDE=$(echo ${MYSQLCLIENT_INCLUDE} | $SED -e "s|-I|-I${MYSQLCLIENT_DIR}|g")
 
-               saved_libs="${LIBS}"
-               LIBS="${MYSQLCLIENT_LIB}"
+                       if test x"" = x ; then A=--libs ; else A="" ; fi
+                       MYSQLCLIENT_LIB=$(${CONFIG_MYSQLCLIENT} $A)
+                       MYSQLCLIENT_LIB=$(echo ${MYSQLCLIENT_LIB} | $SED -e "s|-L|-L${MYSQLCLIENT_DIR}|g")
 
-               cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+                       if test x"" != x ; then
+                               saved_cppflags="${CPPFLAGS}"
+                               CPPFLAGS="${CPPFLAGS} ${MYSQLCLIENT_INCLUDE}"
+
+                               saved_libs="${LIBS}"
+                               LIBS=${MYSQLCLIENT_LIB}
+
+                               cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
 main ()
 {
  ;
-
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-     PBX_MYSQLCLIENT=1
-
+   PBX_MYSQLCLIENT=1
 $as_echo "#define HAVE_MYSQLCLIENT 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_MYSQLCLIENT=1
+                               CPPFLAGS="${saved_cppflags}"
+                               LIBS="${saved_libs}"
+                       else
+                               PBX_MYSQLCLIENT=1
 
 $as_echo "#define HAVE_MYSQLCLIENT 1" >>confdefs.h
 
-           fi
+                       fi
+               fi
        fi
-    fi
 
 
 
@@ -20194,9 +21820,9 @@ if test "x${PBX_NBS}" != "x1" -a "${USE_NBS}" != "no"; then
    # 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"
+         pbxlibdir="-L${NBS_DIR}/lib"
       else
-        pbxlibdir="-L${NBS_DIR}"
+         pbxlibdir="-L${NBS_DIR}"
       fi
    fi
    pbxfuncname="nbs_connect"
@@ -20294,9 +21920,9 @@ fi
 
 
 
-    if test "x${PBX_NEON}" != "x1" -a "${USE_NEON}" != "no"; then
-       PBX_NEON=0
-       if test -n "$ac_tool_prefix"; then
+               if test "x${PBX_NEON}" != "x1" -a "${USE_NEON}" != "no"; then
+               PBX_NEON=0
+               if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}neon-config", so it can be a program name with args.
 set dummy ${ac_tool_prefix}neon-config; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
@@ -20396,58 +22022,56 @@ else
   CONFIG_NEON="$ac_cv_path_CONFIG_NEON"
 fi
 
-       if test ! "x${CONFIG_NEON}" = xNo; then
-           if test x"" = x ; then A=--cflags ; else A="" ; fi
-           NEON_INCLUDE=$(${CONFIG_NEON} $A)
-           if test x"" = x ; then A=--libs ; else A="" ; fi
-           NEON_LIB=$(${CONFIG_NEON} $A)
-           if test x"" != x ; then
-               saved_cppflags="${CPPFLAGS}"
-               if test "x${NEON_DIR}" != "x"; then
-                   NEON_INCLUDE="-I${NEON_DIR}/include"
-               fi
-               CPPFLAGS="${CPPFLAGS} ${NEON_INCLUDE}"
+               if test ! "x${CONFIG_NEON}" = xNo; then
+                       if test x"" = x ; then A=--cflags ; else A="" ; fi
+                       NEON_INCLUDE=$(${CONFIG_NEON} $A)
+                       NEON_INCLUDE=$(echo ${NEON_INCLUDE} | $SED -e "s|-I|-I${NEON_DIR}|g")
 
-               saved_libs="${LIBS}"
-               LIBS="${NEON_LIB}"
+                       if test x"" = x ; then A=--libs ; else A="" ; fi
+                       NEON_LIB=$(${CONFIG_NEON} $A)
+                       NEON_LIB=$(echo ${NEON_LIB} | $SED -e "s|-L|-L${NEON_DIR}|g")
 
-               cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+                       if test x"" != x ; then
+                               saved_cppflags="${CPPFLAGS}"
+                               CPPFLAGS="${CPPFLAGS} ${NEON_INCLUDE}"
+
+                               saved_libs="${LIBS}"
+                               LIBS=${NEON_LIB}
+
+                               cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
 main ()
 {
  ;
-
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-     PBX_NEON=1
-
+   PBX_NEON=1
 $as_echo "#define HAVE_NEON 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_NEON=1
+                               CPPFLAGS="${saved_cppflags}"
+                               LIBS="${saved_libs}"
+                       else
+                               PBX_NEON=1
 
 $as_echo "#define HAVE_NEON 1" >>confdefs.h
 
-           fi
+                       fi
+               fi
        fi
-    fi
 
 
 
-    if test "x${PBX_NEON29}" != "x1" -a "${USE_NEON29}" != "no"; then
-       PBX_NEON29=0
-       if test -n "$ac_tool_prefix"; then
+               if test "x${PBX_NEON29}" != "x1" -a "${USE_NEON29}" != "no"; then
+               PBX_NEON29=0
+               if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}neon-config", so it can be a program name with args.
 set dummy ${ac_tool_prefix}neon-config; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
@@ -20547,22 +22171,23 @@ else
   CONFIG_NEON29="$ac_cv_path_CONFIG_NEON29"
 fi
 
-       if test ! "x${CONFIG_NEON29}" = xNo; then
-           if test x"" = x ; then A=--cflags ; else A="" ; fi
-           NEON29_INCLUDE=$(${CONFIG_NEON29} $A)
-           if test x"--libs" = x ; then A=--libs ; else A="--libs" ; fi
-           NEON29_LIB=$(${CONFIG_NEON29} $A)
-           if test x"#include <ne_auth.h>" != x ; then
-               saved_cppflags="${CPPFLAGS}"
-               if test "x${NEON29_DIR}" != "x"; then
-                   NEON29_INCLUDE="-I${NEON29_DIR}/include"
-               fi
-               CPPFLAGS="${CPPFLAGS} ${NEON29_INCLUDE}"
+               if test ! "x${CONFIG_NEON29}" = xNo; then
+                       if test x"" = x ; then A=--cflags ; else A="" ; fi
+                       NEON29_INCLUDE=$(${CONFIG_NEON29} $A)
+                       NEON29_INCLUDE=$(echo ${NEON29_INCLUDE} | $SED -e "s|-I|-I${NEON29_DIR}|g")
 
-               saved_libs="${LIBS}"
-               LIBS="${NEON29_LIB}"
+                       if test x"--libs" = x ; then A=--libs ; else A="--libs" ; fi
+                       NEON29_LIB=$(${CONFIG_NEON29} $A)
+                       NEON29_LIB=$(echo ${NEON29_LIB} | $SED -e "s|-L|-L${NEON29_DIR}|g")
 
-               cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+                       if test x"#include <ne_auth.h>" != x ; then
+                               saved_cppflags="${CPPFLAGS}"
+                               CPPFLAGS="${CPPFLAGS} ${NEON29_INCLUDE}"
+
+                               saved_libs="${LIBS}"
+                               LIBS=${NEON29_LIB}
+
+                               cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
   #include <ne_auth.h>
 int
@@ -20571,36 +22196,33 @@ main ()
  #ifndef NE_AUTH_NTLM
 #error Need libneon >= 0.29.0
 #endif;
-
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-     PBX_NEON29=1
-
+   PBX_NEON29=1
 $as_echo "#define HAVE_NEON29 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_NEON29=1
+                               CPPFLAGS="${saved_cppflags}"
+                               LIBS="${saved_libs}"
+                       else
+                               PBX_NEON29=1
 
 $as_echo "#define HAVE_NEON29 1" >>confdefs.h
 
-           fi
+                       fi
+               fi
        fi
-    fi
 
 
 
-    if test "x${PBX_NETSNMP}" != "x1" -a "${USE_NETSNMP}" != "no"; then
-       PBX_NETSNMP=0
-       if test -n "$ac_tool_prefix"; then
+               if test "x${PBX_NETSNMP}" != "x1" -a "${USE_NETSNMP}" != "no"; then
+               PBX_NETSNMP=0
+               if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}net-snmp-config", so it can be a program name with args.
 set dummy ${ac_tool_prefix}net-snmp-config; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
@@ -20700,24 +22322,25 @@ else
   CONFIG_NETSNMP="$ac_cv_path_CONFIG_NETSNMP"
 fi
 
-       if test ! "x${CONFIG_NETSNMP}" = xNo; then
-           if test x"" = x ; then A=--cflags ; else A="" ; fi
-           NETSNMP_INCLUDE=$(${CONFIG_NETSNMP} $A)
-           if test x"--agent-libs" = x ; then A=--libs ; else A="--agent-libs" ; fi
-           NETSNMP_LIB=$(${CONFIG_NETSNMP} $A)
-           if test x"#include <net-snmp/net-snmp-config.h>
+               if test ! "x${CONFIG_NETSNMP}" = xNo; then
+                       if test x"" = x ; then A=--cflags ; else A="" ; fi
+                       NETSNMP_INCLUDE=$(${CONFIG_NETSNMP} $A)
+                       NETSNMP_INCLUDE=$(echo ${NETSNMP_INCLUDE} | $SED -e "s|-I|-I${NETSNMP_DIR}|g")
+
+                       if test x"--agent-libs" = x ; then A=--libs ; else A="--agent-libs" ; fi
+                       NETSNMP_LIB=$(${CONFIG_NETSNMP} $A)
+                       NETSNMP_LIB=$(echo ${NETSNMP_LIB} | $SED -e "s|-L|-L${NETSNMP_DIR}|g")
+
+                       if test x"#include <net-snmp/net-snmp-config.h>
 #include <net-snmp/net-snmp-includes.h>
 #include <net-snmp/agent/net-snmp-agent-includes.h>" != x ; then
-               saved_cppflags="${CPPFLAGS}"
-               if test "x${NETSNMP_DIR}" != "x"; then
-                   NETSNMP_INCLUDE="-I${NETSNMP_DIR}/include"
-               fi
-               CPPFLAGS="${CPPFLAGS} ${NETSNMP_INCLUDE}"
+                               saved_cppflags="${CPPFLAGS}"
+                               CPPFLAGS="${CPPFLAGS} ${NETSNMP_INCLUDE}"
 
-               saved_libs="${LIBS}"
-               LIBS="${NETSNMP_LIB}"
+                               saved_libs="${LIBS}"
+                               LIBS=${NETSNMP_LIB}
 
-               cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+                               cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
   #include <net-snmp/net-snmp-config.h>
 #include <net-snmp/net-snmp-includes.h>
@@ -20726,30 +22349,27 @@ int
 main ()
 {
  int callback = snmp_register_callback(0, 0, NULL, NULL);
-
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-     PBX_NETSNMP=1
-
+   PBX_NETSNMP=1
 $as_echo "#define HAVE_NETSNMP 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_NETSNMP=1
+                               CPPFLAGS="${saved_cppflags}"
+                               LIBS="${saved_libs}"
+                       else
+                               PBX_NETSNMP=1
 
 $as_echo "#define HAVE_NETSNMP 1" >>confdefs.h
 
-           fi
+                       fi
+               fi
        fi
-    fi
 
 
 
@@ -20758,9 +22378,9 @@ if test "x${PBX_NEWT}" != "x1" -a "${USE_NEWT}" != "no"; then
    # 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"
+         pbxlibdir="-L${NEWT_DIR}/lib"
       else
-        pbxlibdir="-L${NEWT_DIR}"
+         pbxlibdir="-L${NEWT_DIR}"
       fi
    fi
    pbxfuncname="newtBell"
@@ -20863,9 +22483,9 @@ if test "x${PBX_UNIXODBC}" != "x1" -a "${USE_UNIXODBC}" != "no"; then
    # 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"
+         pbxlibdir="-L${UNIXODBC_DIR}/lib"
       else
-        pbxlibdir="-L${UNIXODBC_DIR}"
+         pbxlibdir="-L${UNIXODBC_DIR}"
       fi
    fi
    pbxfuncname="SQLConnect"
@@ -20968,9 +22588,9 @@ if test "x${PBX_OGG}" != "x1" -a "${USE_OGG}" != "no"; then
    # 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"
+         pbxlibdir="-L${OGG_DIR}/lib"
       else
-        pbxlibdir="-L${OGG_DIR}"
+         pbxlibdir="-L${OGG_DIR}"
       fi
    fi
    pbxfuncname="ogg_sync_init"
@@ -21074,9 +22694,9 @@ if test "x${PBX_BKTR}" != "x1" -a "${USE_BKTR}" != "no"; then
    # 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"
+         pbxlibdir="-L${BKTR_DIR}/lib"
       else
-        pbxlibdir="-L${BKTR_DIR}"
+         pbxlibdir="-L${BKTR_DIR}"
       fi
    fi
    pbxfuncname="backtrace"
@@ -21179,9 +22799,9 @@ if test "x${PBX_BKTR}" != "x1" -a "${USE_BKTR}" != "no"; then
    # 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"
+         pbxlibdir="-L${BKTR_DIR}/lib"
       else
-        pbxlibdir="-L${BKTR_DIR}"
+         pbxlibdir="-L${BKTR_DIR}"
       fi
    fi
    pbxfuncname="backtrace"
@@ -21284,9 +22904,9 @@ if test "x${PBX_BLUETOOTH}" != "x1" -a "${USE_BLUETOOTH}" != "no"; then
    # if --with-BLUETOOTH=DIR has been specified, use it.
    if test "x${BLUETOOTH_DIR}" != "x"; then
       if test -d ${BLUETOOTH_DIR}/lib; then
-        pbxlibdir="-L${BLUETOOTH_DIR}/lib"
+         pbxlibdir="-L${BLUETOOTH_DIR}/lib"
       else
-        pbxlibdir="-L${BLUETOOTH_DIR}"
+         pbxlibdir="-L${BLUETOOTH_DIR}"
       fi
    fi
    pbxfuncname="ba2str"
@@ -21390,9 +23010,9 @@ if test "x${PBX_OSS}" != "x1" -a "${USE_OSS}" != "no"; then
    # 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"
+         pbxlibdir="-L${OSS_DIR}/lib"
       else
-        pbxlibdir="-L${OSS_DIR}"
+         pbxlibdir="-L${OSS_DIR}"
       fi
    fi
    pbxfuncname=""
@@ -21494,9 +23114,9 @@ if test "x${PBX_OSS}" != "x1" -a "${USE_OSS}" != "no"; then
    # 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"
+         pbxlibdir="-L${OSS_DIR}/lib"
       else
-        pbxlibdir="-L${OSS_DIR}"
+         pbxlibdir="-L${OSS_DIR}"
       fi
    fi
    pbxfuncname=""
@@ -21598,9 +23218,9 @@ if test "x${PBX_OSS}" != "x1" -a "${USE_OSS}" != "no"; then
    # 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"
+         pbxlibdir="-L${OSS_DIR}/lib"
       else
-        pbxlibdir="-L${OSS_DIR}"
+         pbxlibdir="-L${OSS_DIR}"
       fi
    fi
    pbxfuncname="oss_ioctl_mixer"
@@ -21895,46 +23515,251 @@ else
 $as_echo "no" >&6; }
 fi
 
-  if test "x$ac_pt_PG_CONFIG" = x; then
-    PG_CONFIG="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
-    PG_CONFIG=$ac_pt_PG_CONFIG
-  fi
+  if test "x$ac_pt_PG_CONFIG" = x; then
+    PG_CONFIG="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
+    PG_CONFIG=$ac_pt_PG_CONFIG
+  fi
+else
+  PG_CONFIG="$ac_cv_path_PG_CONFIG"
+fi
+
+   fi
+fi
+if test "${PG_CONFIG}" != No; then
+   PGSQL_libdir=`${PG_CONFIG} --libdir`
+   PGSQL_includedir=`${PG_CONFIG} --includedir`
+   if test "x$?" != "x0" ; then
+      if test -n "${PGSQL_MANDATORY}" ; then
+         { $as_echo "$as_me:${as_lineno-$LINENO}: ***" >&5
+$as_echo "$as_me: ***" >&6;}
+         { $as_echo "$as_me:${as_lineno-$LINENO}: *** The PostgreSQL installation on this system appears to be broken." >&5
+$as_echo "$as_me: *** The PostgreSQL installation on this system appears to be broken." >&6;}
+         { $as_echo "$as_me:${as_lineno-$LINENO}: *** Either correct the installation, or run configure" >&5
+$as_echo "$as_me: *** Either correct the installation, or run configure" >&6;}
+         { $as_echo "$as_me:${as_lineno-$LINENO}: *** including --without-postgres" >&5
+$as_echo "$as_me: *** including --without-postgres" >&6;}
+         exit 1
+         fi
+   else
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PQescapeStringConn in -lpq" >&5
+$as_echo_n "checking for PQescapeStringConn in -lpq... " >&6; }
+if ${ac_cv_lib_pq_PQescapeStringConn+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lpq -L${PGSQL_libdir} -lz $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 PQescapeStringConn ();
+int
+main ()
+{
+return PQescapeStringConn ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_pq_PQescapeStringConn=yes
+else
+  ac_cv_lib_pq_PQescapeStringConn=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pq_PQescapeStringConn" >&5
+$as_echo "$ac_cv_lib_pq_PQescapeStringConn" >&6; }
+if test "x$ac_cv_lib_pq_PQescapeStringConn" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_PGSQL 1
+_ACEOF
+
+fi
+
+
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pg_encoding_to_char within Postgres headers" >&5
+$as_echo_n "checking for pg_encoding_to_char within Postgres headers... " >&6; }
+      old_CFLAGS=${CFLAGS}
+      CFLAGS="${CFLAGS} -I${PGSQL_includedir} -Werror"
+      old_LDFLAGS=${LDFLAGS}
+      LDFLAGS="${LDFLAGS} -L${PGSQL_libdir} -lpq -lz"
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <libpq-fe.h>
+int
+main ()
+{
+const char *foo = pg_encoding_to_char(1)
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_PGSQL_pg_encoding_to_char 1
+_ACEOF
+
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+      CFLAGS=${old_CFLAGS}
+      LDFLAGS=${old_LDFLAGS}
+
+      if test "${ac_cv_lib_pq_PQescapeStringConn}" = "yes"; then
+         PGSQL_LIB="-L${PGSQL_libdir} -lpq -lz"
+         PGSQL_INCLUDE="-I${PGSQL_includedir}"
+         PBX_PGSQL=1
+      elif test -n "${PGSQL_MANDATORY}";
+      then
+         { $as_echo "$as_me:${as_lineno-$LINENO}: ***" >&5
+$as_echo "$as_me: ***" >&6;}
+         { $as_echo "$as_me:${as_lineno-$LINENO}: *** The PostgreSQL installation on this system appears to be broken." >&5
+$as_echo "$as_me: *** The PostgreSQL installation on this system appears to be broken." >&6;}
+         { $as_echo "$as_me:${as_lineno-$LINENO}: *** Either correct the installation, or run configure" >&5
+$as_echo "$as_me: *** Either correct the installation, or run configure" >&6;}
+         { $as_echo "$as_me:${as_lineno-$LINENO}: *** including --without-postgres" >&5
+$as_echo "$as_me: *** including --without-postgres" >&6;}
+         exit 1
+      fi
+   fi
+fi
+
+
+   if test "x${PBX_PJPROJECT}" != "x1" -a "${USE_PJPROJECT}" != "no"; then
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PJPROJECT" >&5
+$as_echo_n "checking for PJPROJECT... " >&6; }
+
+if test -n "$PJPROJECT_CFLAGS"; then
+    pkg_cv_PJPROJECT_CFLAGS="$PJPROJECT_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpjproject\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "libpjproject") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_PJPROJECT_CFLAGS=`$PKG_CONFIG --cflags "libpjproject" 2>/dev/null`
+                     test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+if test -n "$PJPROJECT_LIBS"; then
+    pkg_cv_PJPROJECT_LIBS="$PJPROJECT_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpjproject\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "libpjproject") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_PJPROJECT_LIBS=`$PKG_CONFIG --libs "libpjproject" 2>/dev/null`
+                     test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi
+        if test $_pkg_short_errors_supported = yes; then
+               PJPROJECT_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libpjproject" 2>&1`
+        else
+               PJPROJECT_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libpjproject" 2>&1`
+        fi
+       # Put the nasty error message in config.log where it belongs
+       echo "$PJPROJECT_PKG_ERRORS" >&5
+
+
+            PBX_PJPROJECT=0
+
+
+elif test $pkg_failed = untried; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+            PBX_PJPROJECT=0
+
+
 else
-  PG_CONFIG="$ac_cv_path_PG_CONFIG"
+       PJPROJECT_CFLAGS=$pkg_cv_PJPROJECT_CFLAGS
+       PJPROJECT_LIBS=$pkg_cv_PJPROJECT_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+            PBX_PJPROJECT=1
+            PJPROJECT_INCLUDE="$PJPROJECT_CFLAGS"
+            PJPROJECT_LIB="$PJPROJECT_LIBS"
+
+$as_echo "#define HAVE_PJPROJECT 1" >>confdefs.h
+
+
 fi
+   fi
+
+
 
+if test "x${PBX_PJ_TRANSACTION_GRP_LOCK}" != "x1" -a "${USE_PJ_TRANSACTION_GRP_LOCK}" != "no"; then
+   pbxlibdir=""
+   # if --with-PJ_TRANSACTION_GRP_LOCK=DIR has been specified, use it.
+   if test "x${PJ_TRANSACTION_GRP_LOCK_DIR}" != "x"; then
+      if test -d ${PJ_TRANSACTION_GRP_LOCK_DIR}/lib; then
+         pbxlibdir="-L${PJ_TRANSACTION_GRP_LOCK_DIR}/lib"
+      else
+         pbxlibdir="-L${PJ_TRANSACTION_GRP_LOCK_DIR}"
+      fi
    fi
-fi
-if test "${PG_CONFIG}" != No; then
-   PGSQL_libdir=`${PG_CONFIG} --libdir`
-   PGSQL_includedir=`${PG_CONFIG} --includedir`
-   if test "x$?" != "x0" ; then
-      if test -n "${PGSQL_MANDATORY}" ; then
-         { $as_echo "$as_me:${as_lineno-$LINENO}: ***" >&5
-$as_echo "$as_me: ***" >&6;}
-         { $as_echo "$as_me:${as_lineno-$LINENO}: *** The PostgreSQL installation on this system appears to be broken." >&5
-$as_echo "$as_me: *** The PostgreSQL installation on this system appears to be broken." >&6;}
-         { $as_echo "$as_me:${as_lineno-$LINENO}: *** Either correct the installation, or run configure" >&5
-$as_echo "$as_me: *** Either correct the installation, or run configure" >&6;}
-         { $as_echo "$as_me:${as_lineno-$LINENO}: *** including --without-postgres" >&5
-$as_echo "$as_me: *** including --without-postgres" >&6;}
-         exit 1
-         fi
+   pbxfuncname="pjsip_tsx_create_uac2"
+   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
+      AST_PJ_TRANSACTION_GRP_LOCK_FOUND=yes
    else
-      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PQescapeStringConn in -lpq" >&5
-$as_echo_n "checking for PQescapeStringConn in -lpq... " >&6; }
-if ${ac_cv_lib_pq_PQescapeStringConn+:} false; then :
+      ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
+      CFLAGS="${CFLAGS} $PJPROJECT_CFLAGS"
+      as_ac_Lib=`$as_echo "ac_cv_lib_pjsip_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpjsip" >&5
+$as_echo_n "checking for ${pbxfuncname} in -lpjsip... " >&6; }
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpq -L${PGSQL_libdir} -lz $LIBS"
+LIBS="-lpjsip ${pbxlibdir} $PJPROJECT_LIBS $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -21944,87 +23769,128 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char PQescapeStringConn ();
+char ${pbxfuncname} ();
 int
 main ()
 {
-return PQescapeStringConn ();
+return ${pbxfuncname} ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_pq_PQescapeStringConn=yes
+  eval "$as_ac_Lib=yes"
 else
-  ac_cv_lib_pq_PQescapeStringConn=no
+  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
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pq_PQescapeStringConn" >&5
-$as_echo "$ac_cv_lib_pq_PQescapeStringConn" >&6; }
-if test "x$ac_cv_lib_pq_PQescapeStringConn" = xyes; then :
+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_PJ_TRANSACTION_GRP_LOCK_FOUND=yes
+else
+  AST_PJ_TRANSACTION_GRP_LOCK_FOUND=no
+fi
 
-cat >>confdefs.h <<_ACEOF
-#define HAVE_PGSQL 1
+      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
+   fi
+
+   # now check for the header.
+   if test "${AST_PJ_TRANSACTION_GRP_LOCK_FOUND}" = "yes"; then
+      PJ_TRANSACTION_GRP_LOCK_LIB="${pbxlibdir} -lpjsip $PJPROJECT_LIBS"
+      # if --with-PJ_TRANSACTION_GRP_LOCK=DIR has been specified, use it.
+      if test "x${PJ_TRANSACTION_GRP_LOCK_DIR}" != "x"; then
+         PJ_TRANSACTION_GRP_LOCK_INCLUDE="-I${PJ_TRANSACTION_GRP_LOCK_DIR}/include"
+      fi
+      PJ_TRANSACTION_GRP_LOCK_INCLUDE="${PJ_TRANSACTION_GRP_LOCK_INCLUDE} $PJPROJECT_CFLAGS"
+      if test "xpjsip.h" = "x" ; then  # no header, assume found
+         PJ_TRANSACTION_GRP_LOCK_HEADER_FOUND="1"
+      else                             # check for the header
+         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${PJ_TRANSACTION_GRP_LOCK_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "pjsip.h" "ac_cv_header_pjsip_h" "$ac_includes_default"
+if test "x$ac_cv_header_pjsip_h" = xyes; then :
+  PJ_TRANSACTION_GRP_LOCK_HEADER_FOUND=1
+else
+  PJ_TRANSACTION_GRP_LOCK_HEADER_FOUND=0
+fi
+
+
+         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
+      fi
+      if test "x${PJ_TRANSACTION_GRP_LOCK_HEADER_FOUND}" = "x0" ; then
+         PJ_TRANSACTION_GRP_LOCK_LIB=""
+         PJ_TRANSACTION_GRP_LOCK_INCLUDE=""
+      else
+         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
+            PJ_TRANSACTION_GRP_LOCK_LIB=""
+         fi
+         PBX_PJ_TRANSACTION_GRP_LOCK=1
+         cat >>confdefs.h <<_ACEOF
+#define HAVE_PJ_TRANSACTION_GRP_LOCK 1
 _ACEOF
 
+      fi
+   fi
 fi
 
 
-      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pg_encoding_to_char within Postgres headers" >&5
-$as_echo_n "checking for pg_encoding_to_char within Postgres headers... " >&6; }
-      old_CFLAGS=${CFLAGS}
-      CFLAGS="${CFLAGS} -I${PGSQL_includedir} -Werror"
-      old_LDFLAGS=${LDFLAGS}
-      LDFLAGS="${LDFLAGS} -L${PGSQL_libdir} -lpq -lz"
-      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+
+saved_cppflags="${CPPFLAGS}"
+saved_libs="${LIBS}"
+CPPFLAGS="${CPPFLAGS} ${PJPROJECT_CFLAGS}"
+LIBS="${LIBS} ${PJPROJECT_LIBS}"
+
+    if test "x${PBX_PJSIP_REPLACE_MEDIA_STREAM}" != "x1" -a "${USE_PJSIP_REPLACE_MEDIA_STREAM}" != "no"; then
+        if test "x" != "x"; then
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for " >&5
+$as_echo_n "checking for ... " >&6; }
+       else
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking if \"pjmedia_mod_offer_flag flag = PJMEDIA_SDP_NEG_ALLOW_MEDIA_CHANGE\" compiles using pjmedia.h" >&5
+$as_echo_n "checking if \"pjmedia_mod_offer_flag flag = PJMEDIA_SDP_NEG_ALLOW_MEDIA_CHANGE\" compiles using pjmedia.h... " >&6; }
+       fi
+       saved_cppflags="${CPPFLAGS}"
+       if test "x${PJSIP_REPLACE_MEDIA_STREAM_DIR}" != "x"; then
+           PJSIP_REPLACE_MEDIA_STREAM_INCLUDE="-I${PJSIP_REPLACE_MEDIA_STREAM_DIR}/include"
+       fi
+       CPPFLAGS="${CPPFLAGS} ${PJSIP_REPLACE_MEDIA_STREAM_INCLUDE}"
+
+       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <libpq-fe.h>
+ #include <pjmedia.h>
 int
 main ()
 {
-const char *foo = pg_encoding_to_char(1)
+ pjmedia_mod_offer_flag flag = PJMEDIA_SDP_NEG_ALLOW_MEDIA_CHANGE;
+
   ;
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+if ac_fn_c_try_compile "$LINENO"; then :
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
+               PBX_PJSIP_REPLACE_MEDIA_STREAM=1
+
+$as_echo "#define HAVE_PJSIP_REPLACE_MEDIA_STREAM 1" >>confdefs.h
+
 
-cat >>confdefs.h <<_ACEOF
-#define HAVE_PGSQL_pg_encoding_to_char 1
-_ACEOF
 
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+         { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-      CFLAGS=${old_CFLAGS}
-      LDFLAGS=${old_LDFLAGS}
 
-      if test "${ac_cv_lib_pq_PQescapeStringConn}" = "yes"; then
-         PGSQL_LIB="-L${PGSQL_libdir} -lpq -lz"
-         PGSQL_INCLUDE="-I${PGSQL_includedir}"
-         PBX_PGSQL=1
-      elif test -n "${PGSQL_MANDATORY}";
-      then
-         { $as_echo "$as_me:${as_lineno-$LINENO}: ***" >&5
-$as_echo "$as_me: ***" >&6;}
-         { $as_echo "$as_me:${as_lineno-$LINENO}: *** The PostgreSQL installation on this system appears to be broken." >&5
-$as_echo "$as_me: *** The PostgreSQL installation on this system appears to be broken." >&6;}
-         { $as_echo "$as_me:${as_lineno-$LINENO}: *** Either correct the installation, or run configure" >&5
-$as_echo "$as_me: *** Either correct the installation, or run configure" >&6;}
-         { $as_echo "$as_me:${as_lineno-$LINENO}: *** including --without-postgres" >&5
-$as_echo "$as_me: *** including --without-postgres" >&6;}
-         exit 1
-      fi
-   fi
 fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+       CPPFLAGS="${saved_cppflags}"
+    fi
+
+LIBS="${saved_libs}"
+CPPFLAGS="${saved_cppflags}"
 
 
 if test "x${PBX_POPT}" != "x1" -a "${USE_POPT}" != "no"; then
@@ -22032,9 +23898,9 @@ if test "x${PBX_POPT}" != "x1" -a "${USE_POPT}" != "no"; then
    # 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"
+         pbxlibdir="-L${POPT_DIR}/lib"
       else
-        pbxlibdir="-L${POPT_DIR}"
+         pbxlibdir="-L${POPT_DIR}"
       fi
    fi
    pbxfuncname="poptStrerror"
@@ -22137,9 +24003,9 @@ if test "x${PBX_PORTAUDIO}" != "x1" -a "${USE_PORTAUDIO}" != "no"; then
    # if --with-PORTAUDIO=DIR has been specified, use it.
    if test "x${PORTAUDIO_DIR}" != "x"; then
       if test -d ${PORTAUDIO_DIR}/lib; then
-        pbxlibdir="-L${PORTAUDIO_DIR}/lib"
+         pbxlibdir="-L${PORTAUDIO_DIR}/lib"
       else
-        pbxlibdir="-L${PORTAUDIO_DIR}"
+         pbxlibdir="-L${PORTAUDIO_DIR}"
       fi
    fi
    pbxfuncname="Pa_GetDeviceCount"
       if test "x${PORTAUDIO_DIR}" != "x"; then
          PORTAUDIO_INCLUDE="-I${PORTAUDIO_DIR}/include"
       fi
-      PORTAUDIO_INCLUDE="${PORTAUDIO_INCLUDE} "
-      if test "xportaudio.h" = "x" ; then      # no header, assume found
-         PORTAUDIO_HEADER_FOUND="1"
+      PORTAUDIO_INCLUDE="${PORTAUDIO_INCLUDE} "
+      if test "xportaudio.h" = "x" ; then      # no header, assume found
+         PORTAUDIO_HEADER_FOUND="1"
+      else                             # check for the header
+         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${PORTAUDIO_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "portaudio.h" "ac_cv_header_portaudio_h" "$ac_includes_default"
+if test "x$ac_cv_header_portaudio_h" = xyes; then :
+  PORTAUDIO_HEADER_FOUND=1
+else
+  PORTAUDIO_HEADER_FOUND=0
+fi
+
+
+         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
+      fi
+      if test "x${PORTAUDIO_HEADER_FOUND}" = "x0" ; then
+         PORTAUDIO_LIB=""
+         PORTAUDIO_INCLUDE=""
+      else
+         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
+            PORTAUDIO_LIB=""
+         fi
+         PBX_PORTAUDIO=1
+         cat >>confdefs.h <<_ACEOF
+#define HAVE_PORTAUDIO 1
+_ACEOF
+
+      fi
+   fi
+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"
+      else
+         pbxlibdir="-L${PRI_DIR}"
+      fi
+   fi
+   pbxfuncname="pri_connected_line_update"
+   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
+      AST_PRI_FOUND=yes
+   else
+      ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
+      CFLAGS="${CFLAGS} "
+      as_ac_Lib=`$as_echo "ac_cv_lib_pri_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpri" >&5
+$as_echo_n "checking for ${pbxfuncname} in -lpri... " >&6; }
+if eval \${$as_ac_Lib+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lpri ${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_PRI_FOUND=yes
+else
+  AST_PRI_FOUND=no
+fi
+
+      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
+   fi
+
+   # now check for the header.
+   if test "${AST_PRI_FOUND}" = "yes"; then
+      PRI_LIB="${pbxlibdir} -lpri "
+      # if --with-PRI=DIR has been specified, use it.
+      if test "x${PRI_DIR}" != "x"; then
+         PRI_INCLUDE="-I${PRI_DIR}/include"
+      fi
+      PRI_INCLUDE="${PRI_INCLUDE} "
+      if test "xlibpri.h" = "x" ; then # no header, assume found
+         PRI_HEADER_FOUND="1"
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${PORTAUDIO_INCLUDE}"
-         ac_fn_c_check_header_mongrel "$LINENO" "portaudio.h" "ac_cv_header_portaudio_h" "$ac_includes_default"
-if test "x$ac_cv_header_portaudio_h" = xyes; then :
-  PORTAUDIO_HEADER_FOUND=1
+         CPPFLAGS="${CPPFLAGS} ${PRI_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
+if test "x$ac_cv_header_libpri_h" = xyes; then :
+  PRI_HEADER_FOUND=1
 else
-  PORTAUDIO_HEADER_FOUND=0
+  PRI_HEADER_FOUND=0
 fi
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
       fi
-      if test "x${PORTAUDIO_HEADER_FOUND}" = "x0" ; then
-         PORTAUDIO_LIB=""
-         PORTAUDIO_INCLUDE=""
+      if test "x${PRI_HEADER_FOUND}" = "x0" ; then
+         PRI_LIB=""
+         PRI_INCLUDE=""
       else
          if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            PORTAUDIO_LIB=""
+            PRI_LIB=""
          fi
-         PBX_PORTAUDIO=1
+         PBX_PRI=1
          cat >>confdefs.h <<_ACEOF
-#define HAVE_PORTAUDIO 1
+#define HAVE_PRI 1
 _ACEOF
 
       fi
 
 
 
-
-if test "x${PBX_PRI}" != "x1" -a "${USE_PRI}" != "no"; then
+if test "x${PBX_PRI_SETUP_ACK_INBAND}" != "x1" -a "${USE_PRI_SETUP_ACK_INBAND}" != "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"
+   # if --with-PRI_SETUP_ACK_INBAND=DIR has been specified, use it.
+   if test "x${PRI_SETUP_ACK_INBAND_DIR}" != "x"; then
+      if test -d ${PRI_SETUP_ACK_INBAND_DIR}/lib; then
+         pbxlibdir="-L${PRI_SETUP_ACK_INBAND_DIR}/lib"
       else
-        pbxlibdir="-L${PRI_DIR}"
+         pbxlibdir="-L${PRI_SETUP_ACK_INBAND_DIR}"
       fi
    fi
-   pbxfuncname="pri_connected_line_update"
+   pbxfuncname="pri_setup_ack"
    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_PRI_FOUND=yes
+      AST_PRI_SETUP_ACK_INBAND_FOUND=yes
    else
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
@@ -22292,47 +24262,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_PRI_FOUND=yes
+  AST_PRI_SETUP_ACK_INBAND_FOUND=yes
 else
-  AST_PRI_FOUND=no
+  AST_PRI_SETUP_ACK_INBAND_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
    fi
 
    # now check for the header.
-   if test "${AST_PRI_FOUND}" = "yes"; then
-      PRI_LIB="${pbxlibdir} -lpri "
-      # if --with-PRI=DIR has been specified, use it.
-      if test "x${PRI_DIR}" != "x"; then
-         PRI_INCLUDE="-I${PRI_DIR}/include"
+   if test "${AST_PRI_SETUP_ACK_INBAND_FOUND}" = "yes"; then
+      PRI_SETUP_ACK_INBAND_LIB="${pbxlibdir} -lpri "
+      # if --with-PRI_SETUP_ACK_INBAND=DIR has been specified, use it.
+      if test "x${PRI_SETUP_ACK_INBAND_DIR}" != "x"; then
+         PRI_SETUP_ACK_INBAND_INCLUDE="-I${PRI_SETUP_ACK_INBAND_DIR}/include"
       fi
-      PRI_INCLUDE="${PRI_INCLUDE} "
+      PRI_SETUP_ACK_INBAND_INCLUDE="${PRI_SETUP_ACK_INBAND_INCLUDE} "
       if test "xlibpri.h" = "x" ; then # no header, assume found
-         PRI_HEADER_FOUND="1"
+         PRI_SETUP_ACK_INBAND_HEADER_FOUND="1"
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${PRI_INCLUDE}"
+         CPPFLAGS="${CPPFLAGS} ${PRI_SETUP_ACK_INBAND_INCLUDE}"
          ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
 if test "x$ac_cv_header_libpri_h" = xyes; then :
-  PRI_HEADER_FOUND=1
+  PRI_SETUP_ACK_INBAND_HEADER_FOUND=1
 else
-  PRI_HEADER_FOUND=0
+  PRI_SETUP_ACK_INBAND_HEADER_FOUND=0
 fi
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
       fi
-      if test "x${PRI_HEADER_FOUND}" = "x0" ; then
-         PRI_LIB=""
-         PRI_INCLUDE=""
+      if test "x${PRI_SETUP_ACK_INBAND_HEADER_FOUND}" = "x0" ; then
+         PRI_SETUP_ACK_INBAND_LIB=""
+         PRI_SETUP_ACK_INBAND_INCLUDE=""
       else
          if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            PRI_LIB=""
+            PRI_SETUP_ACK_INBAND_LIB=""
          fi
-         PBX_PRI=1
+         PBX_PRI_SETUP_ACK_INBAND=1
          cat >>confdefs.h <<_ACEOF
-#define HAVE_PRI 1
+#define HAVE_PRI_SETUP_ACK_INBAND 1
 _ACEOF
 
       fi
@@ -22346,9 +24316,9 @@ if test "x${PBX_PRI_L2_PERSISTENCE}" != "x1" -a "${USE_PRI_L2_PERSISTENCE}" != "
    # if --with-PRI_L2_PERSISTENCE=DIR has been specified, use it.
    if test "x${PRI_L2_PERSISTENCE_DIR}" != "x"; then
       if test -d ${PRI_L2_PERSISTENCE_DIR}/lib; then
-        pbxlibdir="-L${PRI_L2_PERSISTENCE_DIR}/lib"
+         pbxlibdir="-L${PRI_L2_PERSISTENCE_DIR}/lib"
       else
-        pbxlibdir="-L${PRI_L2_PERSISTENCE_DIR}"
+         pbxlibdir="-L${PRI_L2_PERSISTENCE_DIR}"
       fi
    fi
    pbxfuncname="pri_persistent_layer2_option"
@@ -22450,9 +24420,9 @@ if test "x${PBX_PRI_DATETIME_SEND}" != "x1" -a "${USE_PRI_DATETIME_SEND}" != "no
    # if --with-PRI_DATETIME_SEND=DIR has been specified, use it.
    if test "x${PRI_DATETIME_SEND_DIR}" != "x"; then
       if test -d ${PRI_DATETIME_SEND_DIR}/lib; then
-        pbxlibdir="-L${PRI_DATETIME_SEND_DIR}/lib"
+         pbxlibdir="-L${PRI_DATETIME_SEND_DIR}/lib"
       else
-        pbxlibdir="-L${PRI_DATETIME_SEND_DIR}"
+         pbxlibdir="-L${PRI_DATETIME_SEND_DIR}"
       fi
    fi
    pbxfuncname="pri_date_time_send_option"
@@ -22554,9 +24524,9 @@ if test "x${PBX_PRI_MWI_V2}" != "x1" -a "${USE_PRI_MWI_V2}" != "no"; then
    # if --with-PRI_MWI_V2=DIR has been specified, use it.
    if test "x${PRI_MWI_V2_DIR}" != "x"; then
       if test -d ${PRI_MWI_V2_DIR}/lib; then
-        pbxlibdir="-L${PRI_MWI_V2_DIR}/lib"
+         pbxlibdir="-L${PRI_MWI_V2_DIR}/lib"
       else
-        pbxlibdir="-L${PRI_MWI_V2_DIR}"
+         pbxlibdir="-L${PRI_MWI_V2_DIR}"
       fi
    fi
    pbxfuncname="pri_mwi_indicate_v2"
@@ -22658,9 +24628,9 @@ if test "x${PBX_PRI_DISPLAY_TEXT}" != "x1" -a "${USE_PRI_DISPLAY_TEXT}" != "no";
    # if --with-PRI_DISPLAY_TEXT=DIR has been specified, use it.
    if test "x${PRI_DISPLAY_TEXT_DIR}" != "x"; then
       if test -d ${PRI_DISPLAY_TEXT_DIR}/lib; then
-        pbxlibdir="-L${PRI_DISPLAY_TEXT_DIR}/lib"
+         pbxlibdir="-L${PRI_DISPLAY_TEXT_DIR}/lib"
       else
-        pbxlibdir="-L${PRI_DISPLAY_TEXT_DIR}"
+         pbxlibdir="-L${PRI_DISPLAY_TEXT_DIR}"
       fi
    fi
    pbxfuncname="pri_display_text"
@@ -22762,9 +24732,9 @@ if test "x${PBX_PRI_MWI}" != "x1" -a "${USE_PRI_MWI}" != "no"; then
    # if --with-PRI_MWI=DIR has been specified, use it.
    if test "x${PRI_MWI_DIR}" != "x"; then
       if test -d ${PRI_MWI_DIR}/lib; then
-        pbxlibdir="-L${PRI_MWI_DIR}/lib"
+         pbxlibdir="-L${PRI_MWI_DIR}/lib"
       else
-        pbxlibdir="-L${PRI_MWI_DIR}"
+         pbxlibdir="-L${PRI_MWI_DIR}"
       fi
    fi
    pbxfuncname="pri_mwi_indicate"
@@ -22866,9 +24836,9 @@ if test "x${PBX_PRI_MCID}" != "x1" -a "${USE_PRI_MCID}" != "no"; then
    # if --with-PRI_MCID=DIR has been specified, use it.
    if test "x${PRI_MCID_DIR}" != "x"; then
       if test -d ${PRI_MCID_DIR}/lib; then
-        pbxlibdir="-L${PRI_MCID_DIR}/lib"
+         pbxlibdir="-L${PRI_MCID_DIR}/lib"
       else
-        pbxlibdir="-L${PRI_MCID_DIR}"
+         pbxlibdir="-L${PRI_MCID_DIR}"
       fi
    fi
    pbxfuncname="pri_mcid_enable"
@@ -22970,9 +24940,9 @@ if test "x${PBX_PRI_CALL_WAITING}" != "x1" -a "${USE_PRI_CALL_WAITING}" != "no";
    # if --with-PRI_CALL_WAITING=DIR has been specified, use it.
    if test "x${PRI_CALL_WAITING_DIR}" != "x"; then
       if test -d ${PRI_CALL_WAITING_DIR}/lib; then
-        pbxlibdir="-L${PRI_CALL_WAITING_DIR}/lib"
+         pbxlibdir="-L${PRI_CALL_WAITING_DIR}/lib"
       else
-        pbxlibdir="-L${PRI_CALL_WAITING_DIR}"
+         pbxlibdir="-L${PRI_CALL_WAITING_DIR}"
       fi
    fi
    pbxfuncname="pri_connect_ack_enable"
@@ -23074,9 +25044,9 @@ if test "x${PBX_PRI_AOC_EVENTS}" != "x1" -a "${USE_PRI_AOC_EVENTS}" != "no"; the
    # if --with-PRI_AOC_EVENTS=DIR has been specified, use it.
    if test "x${PRI_AOC_EVENTS_DIR}" != "x"; then
       if test -d ${PRI_AOC_EVENTS_DIR}/lib; then
-        pbxlibdir="-L${PRI_AOC_EVENTS_DIR}/lib"
+         pbxlibdir="-L${PRI_AOC_EVENTS_DIR}/lib"
       else
-        pbxlibdir="-L${PRI_AOC_EVENTS_DIR}"
+         pbxlibdir="-L${PRI_AOC_EVENTS_DIR}"
       fi
    fi
    pbxfuncname="pri_aoc_events_enable"
@@ -23178,9 +25148,9 @@ if test "x${PBX_PRI_TRANSFER}" != "x1" -a "${USE_PRI_TRANSFER}" != "no"; then
    # if --with-PRI_TRANSFER=DIR has been specified, use it.
    if test "x${PRI_TRANSFER_DIR}" != "x"; then
       if test -d ${PRI_TRANSFER_DIR}/lib; then
-        pbxlibdir="-L${PRI_TRANSFER_DIR}/lib"
+         pbxlibdir="-L${PRI_TRANSFER_DIR}/lib"
       else
-        pbxlibdir="-L${PRI_TRANSFER_DIR}"
+         pbxlibdir="-L${PRI_TRANSFER_DIR}"
       fi
    fi
    pbxfuncname="pri_transfer_enable"
@@ -23282,9 +25252,9 @@ if test "x${PBX_PRI_CCSS}" != "x1" -a "${USE_PRI_CCSS}" != "no"; then
    # if --with-PRI_CCSS=DIR has been specified, use it.
    if test "x${PRI_CCSS_DIR}" != "x"; then
       if test -d ${PRI_CCSS_DIR}/lib; then
-        pbxlibdir="-L${PRI_CCSS_DIR}/lib"
+         pbxlibdir="-L${PRI_CCSS_DIR}/lib"
       else
-        pbxlibdir="-L${PRI_CCSS_DIR}"
+         pbxlibdir="-L${PRI_CCSS_DIR}"
       fi
    fi
    pbxfuncname="pri_cc_enable"
@@ -23386,9 +25356,9 @@ if test "x${PBX_PRI_HANGUP_FIX}" != "x1" -a "${USE_PRI_HANGUP_FIX}" != "no"; the
    # if --with-PRI_HANGUP_FIX=DIR has been specified, use it.
    if test "x${PRI_HANGUP_FIX_DIR}" != "x"; then
       if test -d ${PRI_HANGUP_FIX_DIR}/lib; then
-        pbxlibdir="-L${PRI_HANGUP_FIX_DIR}/lib"
+         pbxlibdir="-L${PRI_HANGUP_FIX_DIR}/lib"
       else
-        pbxlibdir="-L${PRI_HANGUP_FIX_DIR}"
+         pbxlibdir="-L${PRI_HANGUP_FIX_DIR}"
       fi
    fi
    pbxfuncname="pri_hangup_fix_enable"
@@ -23490,9 +25460,9 @@ if test "x${PBX_PRI_SUBADDR}" != "x1" -a "${USE_PRI_SUBADDR}" != "no"; then
    # if --with-PRI_SUBADDR=DIR has been specified, use it.
    if test "x${PRI_SUBADDR_DIR}" != "x"; then
       if test -d ${PRI_SUBADDR_DIR}/lib; then
-        pbxlibdir="-L${PRI_SUBADDR_DIR}/lib"
+         pbxlibdir="-L${PRI_SUBADDR_DIR}/lib"
       else
-        pbxlibdir="-L${PRI_SUBADDR_DIR}"
+         pbxlibdir="-L${PRI_SUBADDR_DIR}"
       fi
    fi
    pbxfuncname="pri_sr_set_called_subaddress"
@@ -23594,9 +25564,9 @@ if test "x${PBX_PRI_CALL_HOLD}" != "x1" -a "${USE_PRI_CALL_HOLD}" != "no"; then
    # if --with-PRI_CALL_HOLD=DIR has been specified, use it.
    if test "x${PRI_CALL_HOLD_DIR}" != "x"; then
       if test -d ${PRI_CALL_HOLD_DIR}/lib; then
-        pbxlibdir="-L${PRI_CALL_HOLD_DIR}/lib"
+         pbxlibdir="-L${PRI_CALL_HOLD_DIR}/lib"
       else
-        pbxlibdir="-L${PRI_CALL_HOLD_DIR}"
+         pbxlibdir="-L${PRI_CALL_HOLD_DIR}"
       fi
    fi
    pbxfuncname="pri_hold_enable"
@@ -23698,9 +25668,9 @@ if test "x${PBX_PRI_CALL_REROUTING}" != "x1" -a "${USE_PRI_CALL_REROUTING}" != "
    # if --with-PRI_CALL_REROUTING=DIR has been specified, use it.
    if test "x${PRI_CALL_REROUTING_DIR}" != "x"; then
       if test -d ${PRI_CALL_REROUTING_DIR}/lib; then
-        pbxlibdir="-L${PRI_CALL_REROUTING_DIR}/lib"
+         pbxlibdir="-L${PRI_CALL_REROUTING_DIR}/lib"
       else
-        pbxlibdir="-L${PRI_CALL_REROUTING_DIR}"
+         pbxlibdir="-L${PRI_CALL_REROUTING_DIR}"
       fi
    fi
    pbxfuncname="pri_reroute_enable"
@@ -23802,9 +25772,9 @@ if test "x${PBX_PRI_SETUP_KEYPAD}" != "x1" -a "${USE_PRI_SETUP_KEYPAD}" != "no";
    # if --with-PRI_SETUP_KEYPAD=DIR has been specified, use it.
    if test "x${PRI_SETUP_KEYPAD_DIR}" != "x"; then
       if test -d ${PRI_SETUP_KEYPAD_DIR}/lib; then
-        pbxlibdir="-L${PRI_SETUP_KEYPAD_DIR}/lib"
+         pbxlibdir="-L${PRI_SETUP_KEYPAD_DIR}/lib"
       else
-        pbxlibdir="-L${PRI_SETUP_KEYPAD_DIR}"
+         pbxlibdir="-L${PRI_SETUP_KEYPAD_DIR}"
       fi
    fi
    pbxfuncname="pri_sr_set_keypad_digits"
@@ -23910,9 +25880,9 @@ if test "x${PBX_PRI_PROG_W_CAUSE}" != "x1" -a "${USE_PRI_PROG_W_CAUSE}" != "no";
    # if --with-PRI_PROG_W_CAUSE=DIR has been specified, use it.
    if test "x${PRI_PROG_W_CAUSE_DIR}" != "x"; then
       if test -d ${PRI_PROG_W_CAUSE_DIR}/lib; then
-        pbxlibdir="-L${PRI_PROG_W_CAUSE_DIR}/lib"
+         pbxlibdir="-L${PRI_PROG_W_CAUSE_DIR}/lib"
       else
-        pbxlibdir="-L${PRI_PROG_W_CAUSE_DIR}"
+         pbxlibdir="-L${PRI_PROG_W_CAUSE_DIR}"
       fi
    fi
    pbxfuncname="pri_progress_with_cause"
@@ -24014,9 +25984,9 @@ if test "x${PBX_PRI_INBANDDISCONNECT}" != "x1" -a "${USE_PRI_INBANDDISCONNECT}"
    # if --with-PRI_INBANDDISCONNECT=DIR has been specified, use it.
    if test "x${PRI_INBANDDISCONNECT_DIR}" != "x"; then
       if test -d ${PRI_INBANDDISCONNECT_DIR}/lib; then
-        pbxlibdir="-L${PRI_INBANDDISCONNECT_DIR}/lib"
+         pbxlibdir="-L${PRI_INBANDDISCONNECT_DIR}/lib"
       else
-        pbxlibdir="-L${PRI_INBANDDISCONNECT_DIR}"
+         pbxlibdir="-L${PRI_INBANDDISCONNECT_DIR}"
       fi
    fi
    pbxfuncname="pri_set_inbanddisconnect"
@@ -24118,9 +26088,9 @@ if test "x${PBX_PRI_SERVICE_MESSAGES}" != "x1" -a "${USE_PRI_SERVICE_MESSAGES}"
    # if --with-PRI_SERVICE_MESSAGES=DIR has been specified, use it.
    if test "x${PRI_SERVICE_MESSAGES_DIR}" != "x"; then
       if test -d ${PRI_SERVICE_MESSAGES_DIR}/lib; then
-        pbxlibdir="-L${PRI_SERVICE_MESSAGES_DIR}/lib"
+         pbxlibdir="-L${PRI_SERVICE_MESSAGES_DIR}/lib"
       else
-        pbxlibdir="-L${PRI_SERVICE_MESSAGES_DIR}"
+         pbxlibdir="-L${PRI_SERVICE_MESSAGES_DIR}"
       fi
    fi
    pbxfuncname="pri_maintenance_service"
@@ -24222,9 +26192,9 @@ if test "x${PBX_PRI_REVERSE_CHARGE}" != "x1" -a "${USE_PRI_REVERSE_CHARGE}" != "
    # if --with-PRI_REVERSE_CHARGE=DIR has been specified, use it.
    if test "x${PRI_REVERSE_CHARGE_DIR}" != "x"; then
       if test -d ${PRI_REVERSE_CHARGE_DIR}/lib; then
-        pbxlibdir="-L${PRI_REVERSE_CHARGE_DIR}/lib"
+         pbxlibdir="-L${PRI_REVERSE_CHARGE_DIR}/lib"
       else
-        pbxlibdir="-L${PRI_REVERSE_CHARGE_DIR}"
+         pbxlibdir="-L${PRI_REVERSE_CHARGE_DIR}"
       fi
    fi
    pbxfuncname="pri_sr_set_reversecharge"
@@ -24328,9 +26298,9 @@ if test "x${PBX_RESAMPLE}" != "x1" -a "${USE_RESAMPLE}" != "no"; then
    # if --with-RESAMPLE=DIR has been specified, use it.
    if test "x${RESAMPLE_DIR}" != "x"; then
       if test -d ${RESAMPLE_DIR}/lib; then
-        pbxlibdir="-L${RESAMPLE_DIR}/lib"
+         pbxlibdir="-L${RESAMPLE_DIR}/lib"
       else
-        pbxlibdir="-L${RESAMPLE_DIR}"
+         pbxlibdir="-L${RESAMPLE_DIR}"
       fi
    fi
    pbxfuncname="resample_open"
@@ -24495,9 +26465,9 @@ if test "x${PBX_SPANDSP}" != "x1" -a "${USE_SPANDSP}" != "no"; then
    # if --with-SPANDSP=DIR has been specified, use it.
    if test "x${SPANDSP_DIR}" != "x"; then
       if test -d ${SPANDSP_DIR}/lib; then
-        pbxlibdir="-L${SPANDSP_DIR}/lib"
+         pbxlibdir="-L${SPANDSP_DIR}/lib"
       else
-        pbxlibdir="-L${SPANDSP_DIR}"
+         pbxlibdir="-L${SPANDSP_DIR}"
       fi
    fi
    pbxfuncname="span_set_message_handler"
@@ -24604,9 +26574,9 @@ if test "x${PBX_SPANDSP}" != "x1" -a "${USE_SPANDSP}" != "no"; then
    # if --with-SPANDSP=DIR has been specified, use it.
    if test "x${SPANDSP_DIR}" != "x"; then
       if test -d ${SPANDSP_DIR}/lib; then
-        pbxlibdir="-L${SPANDSP_DIR}/lib"
+         pbxlibdir="-L${SPANDSP_DIR}/lib"
       else
-        pbxlibdir="-L${SPANDSP_DIR}"
+         pbxlibdir="-L${SPANDSP_DIR}"
       fi
    fi
    pbxfuncname="t38_terminal_init"
 
 fi
 
+# Check for libss7 v2.0 branch compatible version.
 
 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"
+         pbxlibdir="-L${SS7_DIR}/lib"
       else
-        pbxlibdir="-L${SS7_DIR}"
+         pbxlibdir="-L${SS7_DIR}"
       fi
    fi
-   pbxfuncname="ss7_pollflags"
+   pbxfuncname="ss7_set_isup_timer"
    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
       AST_SS7_FOUND=yes
    else
@@ -24815,9 +26786,9 @@ if test "x${PBX_OPENR2}" != "x1" -a "${USE_OPENR2}" != "no"; then
    # if --with-OPENR2=DIR has been specified, use it.
    if test "x${OPENR2_DIR}" != "x"; then
       if test -d ${OPENR2_DIR}/lib; then
-        pbxlibdir="-L${OPENR2_DIR}/lib"
+         pbxlibdir="-L${OPENR2_DIR}/lib"
       else
-        pbxlibdir="-L${OPENR2_DIR}"
+         pbxlibdir="-L${OPENR2_DIR}"
       fi
    fi
    pbxfuncname="openr2_chan_new"
@@ -25150,7 +27121,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
        fi
 
        if test "${HAS_PWLIB:-unset}" != "unset"; then
-               PWLIB_VERSION=`grep "$VNAME" ${PWLIB_INCDIR}/ptbuildopts.h | sed -e 's/[[:space:]]\{1,\}/ /g' | cut -f3 -d ' ' | sed -e 's/"//g'`
+               PWLIB_VERSION=`grep "$VNAME \"" ${PWLIB_INCDIR}/ptbuildopts.h | sed -e 's/[[:space:]]\{1,\}/ /g' | cut -f3 -d ' ' | sed -e 's/"//g'`
                PWLIB_MAJOR_VERSION=`echo ${PWLIB_VERSION} | cut -f1 -d.`
                PWLIB_MINOR_VERSION=`echo ${PWLIB_VERSION} | cut -f2 -d.`
                PWLIB_BUILD_NUMBER=`echo ${PWLIB_VERSION} | cut -f3 -d.`
@@ -25483,7 +27454,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
        fi
 
        if test "${HAS_OPENH323:-unset}" != "unset"; then
-               OPENH323_VERSION=`grep "$VNAME" ${OPENH323_INCDIR}/openh323buildopts.h | sed -e 's/[[:space:]]\{1,\}/ /g' | cut -f3 -d ' ' | sed -e 's/"//g'`
+               OPENH323_VERSION=`grep "$VNAME \"" ${OPENH323_INCDIR}/openh323buildopts.h | sed -e 's/[[:space:]]\{1,\}/ /g' | cut -f3 -d ' ' | sed -e 's/"//g'`
                OPENH323_MAJOR_VERSION=`echo ${OPENH323_VERSION} | cut -f1 -d.`
                OPENH323_MINOR_VERSION=`echo ${OPENH323_VERSION} | cut -f2 -d.`
                OPENH323_BUILD_NUMBER=`echo ${OPENH323_VERSION} | cut -f3 -d.`
@@ -25660,9 +27631,121 @@ if test "x${PBX_LUA}" != "x1" -a "${USE_LUA}" != "no"; then
    # 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"
+         pbxlibdir="-L${LUA_DIR}/lib"
+      else
+         pbxlibdir="-L${LUA_DIR}"
+      fi
+   fi
+   pbxfuncname="luaL_newstate"
+   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
+      AST_LUA_FOUND=yes
+   else
+      ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
+      CFLAGS="${CFLAGS} "
+      as_ac_Lib=`$as_echo "ac_cv_lib_lua5.2_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -llua5.2" >&5
+$as_echo_n "checking for ${pbxfuncname} in -llua5.2... " >&6; }
+if eval \${$as_ac_Lib+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-llua5.2 ${pbxlibdir} -lm $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_LUA_FOUND=yes
+else
+  AST_LUA_FOUND=no
+fi
+
+      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
+   fi
+
+   # now check for the header.
+   if test "${AST_LUA_FOUND}" = "yes"; then
+      LUA_LIB="${pbxlibdir} -llua5.2 -lm"
+      # if --with-LUA=DIR has been specified, use it.
+      if test "x${LUA_DIR}" != "x"; then
+         LUA_INCLUDE="-I${LUA_DIR}/include"
+      fi
+      LUA_INCLUDE="${LUA_INCLUDE} "
+      if test "xlua5.2/lua.h" = "x" ; then     # no header, assume found
+         LUA_HEADER_FOUND="1"
+      else                             # check for the header
+         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${LUA_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "lua5.2/lua.h" "ac_cv_header_lua5_2_lua_h" "$ac_includes_default"
+if test "x$ac_cv_header_lua5_2_lua_h" = xyes; then :
+  LUA_HEADER_FOUND=1
+else
+  LUA_HEADER_FOUND=0
+fi
+
+
+         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
+      fi
+      if test "x${LUA_HEADER_FOUND}" = "x0" ; then
+         LUA_LIB=""
+         LUA_INCLUDE=""
+      else
+         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
+            LUA_LIB=""
+         fi
+         PBX_LUA=1
+         cat >>confdefs.h <<_ACEOF
+#define HAVE_LUA 1
+_ACEOF
+
+      fi
+   fi
+fi
+
+
+if test "x${PBX_LUA}" = "x1" ; then
+       if test x"${LUA_DIR}" = x; then
+               LUA_INCLUDE="${LUA_INCLUDE} -I/usr/include/lua5.2"
+       else
+               LUA_INCLUDE="${LUA_INCLUDE} -I${LUA_DIR}/lua5.2"
+       fi
+fi
+
+
+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"
       else
-        pbxlibdir="-L${LUA_DIR}"
+         pbxlibdir="-L${LUA_DIR}"
       fi
    fi
    pbxfuncname="luaL_newstate"
@@ -25773,12 +27856,12 @@ if test "x${PBX_LUA}" != "x1" -a "${USE_LUA}" != "no"; then
    # 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"
+         pbxlibdir="-L${LUA_DIR}/lib"
       else
-        pbxlibdir="-L${LUA_DIR}"
+         pbxlibdir="-L${LUA_DIR}"
       fi
    fi
-   pbxfuncname="luaL_register"
+   pbxfuncname="luaL_openlib"
    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
       AST_LUA_FOUND=yes
    else
       if test "x${LUA_DIR}" != "x"; then
          LUA_INCLUDE="-I${LUA_DIR}/include"
       fi
-      LUA_INCLUDE="${LUA_INCLUDE} "
-      if test "xlua.h" = "x" ; then    # no header, assume found
-         LUA_HEADER_FOUND="1"
+      LUA_INCLUDE="${LUA_INCLUDE} "
+      if test "xlua.h" = "x" ; then    # no header, assume found
+         LUA_HEADER_FOUND="1"
+      else                             # check for the header
+         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${LUA_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "lua.h" "ac_cv_header_lua_h" "$ac_includes_default"
+if test "x$ac_cv_header_lua_h" = xyes; then :
+  LUA_HEADER_FOUND=1
+else
+  LUA_HEADER_FOUND=0
+fi
+
+
+         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
+      fi
+      if test "x${LUA_HEADER_FOUND}" = "x0" ; then
+         LUA_LIB=""
+         LUA_INCLUDE=""
+      else
+         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
+            LUA_LIB=""
+         fi
+         PBX_LUA=1
+         cat >>confdefs.h <<_ACEOF
+#define HAVE_LUA 1
+_ACEOF
+
+      fi
+   fi
+fi
+
+
+
+# Accept either RADIUS client library, their APIs are fully compatible,
+# just different header filenames and different SONAMEs
+
+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"
+      else
+         pbxlibdir="-L${RADIUS_DIR}"
+      fi
+   fi
+   pbxfuncname="rc_read_config"
+   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
+      AST_RADIUS_FOUND=yes
+   else
+      ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
+      CFLAGS="${CFLAGS} "
+      as_ac_Lib=`$as_echo "ac_cv_lib_freeradius-client_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lfreeradius-client" >&5
+$as_echo_n "checking for ${pbxfuncname} in -lfreeradius-client... " >&6; }
+if eval \${$as_ac_Lib+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lfreeradius-client ${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_RADIUS_FOUND=yes
+else
+  AST_RADIUS_FOUND=no
+fi
+
+      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
+   fi
+
+   # now check for the header.
+   if test "${AST_RADIUS_FOUND}" = "yes"; then
+      RADIUS_LIB="${pbxlibdir} -lfreeradius-client "
+      # if --with-RADIUS=DIR has been specified, use it.
+      if test "x${RADIUS_DIR}" != "x"; then
+         RADIUS_INCLUDE="-I${RADIUS_DIR}/include"
+      fi
+      RADIUS_INCLUDE="${RADIUS_INCLUDE} "
+      if test "xfreeradius-client.h" = "x" ; then      # no header, assume found
+         RADIUS_HEADER_FOUND="1"
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${LUA_INCLUDE}"
-         ac_fn_c_check_header_mongrel "$LINENO" "lua.h" "ac_cv_header_lua_h" "$ac_includes_default"
-if test "x$ac_cv_header_lua_h" = xyes; then :
-  LUA_HEADER_FOUND=1
+         CPPFLAGS="${CPPFLAGS} ${RADIUS_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "freeradius-client.h" "ac_cv_header_freeradius_client_h" "$ac_includes_default"
+if test "x$ac_cv_header_freeradius_client_h" = xyes; then :
+  RADIUS_HEADER_FOUND=1
 else
-  LUA_HEADER_FOUND=0
+  RADIUS_HEADER_FOUND=0
 fi
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
       fi
-      if test "x${LUA_HEADER_FOUND}" = "x0" ; then
-         LUA_LIB=""
-         LUA_INCLUDE=""
+      if test "x${RADIUS_HEADER_FOUND}" = "x0" ; then
+         RADIUS_LIB=""
+         RADIUS_INCLUDE=""
       else
          if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            LUA_LIB=""
+            RADIUS_LIB=""
          fi
-         PBX_LUA=1
+         PBX_RADIUS=1
          cat >>confdefs.h <<_ACEOF
-#define HAVE_LUA 1
+#define HAVE_RADIUS 1
 _ACEOF
 
       fi
@@ -25871,16 +28061,20 @@ _ACEOF
 fi
 
 
+if test "x${PBX_RADIUS}" = "x1"; then
 
+$as_echo "#define FREERADIUS_CLIENT /**/" >>confdefs.h
+
+else
 
 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"
+         pbxlibdir="-L${RADIUS_DIR}/lib"
       else
-        pbxlibdir="-L${RADIUS_DIR}"
+         pbxlibdir="-L${RADIUS_DIR}"
       fi
    fi
    pbxfuncname="rc_read_config"
@@ -25976,6 +28170,7 @@ _ACEOF
 fi
 
 
+fi
 
 
 if test "x${PBX_COROSYNC}" != "x1" -a "${USE_COROSYNC}" != "no"; then
@@ -25983,9 +28178,9 @@ if test "x${PBX_COROSYNC}" != "x1" -a "${USE_COROSYNC}" != "no"; then
    # if --with-COROSYNC=DIR has been specified, use it.
    if test "x${COROSYNC_DIR}" != "x"; then
       if test -d ${COROSYNC_DIR}/lib; then
-        pbxlibdir="-L${COROSYNC_DIR}/lib"
+         pbxlibdir="-L${COROSYNC_DIR}/lib"
       else
-        pbxlibdir="-L${COROSYNC_DIR}"
+         pbxlibdir="-L${COROSYNC_DIR}"
       fi
    fi
    pbxfuncname="cpg_join"
@@ -26087,9 +28282,9 @@ if test "x${PBX_COROSYNC_CFG_STATE_TRACK}" != "x1" -a "${USE_COROSYNC_CFG_STATE_
    # if --with-COROSYNC_CFG_STATE_TRACK=DIR has been specified, use it.
    if test "x${COROSYNC_CFG_STATE_TRACK_DIR}" != "x"; then
       if test -d ${COROSYNC_CFG_STATE_TRACK_DIR}/lib; then
-        pbxlibdir="-L${COROSYNC_CFG_STATE_TRACK_DIR}/lib"
+         pbxlibdir="-L${COROSYNC_CFG_STATE_TRACK_DIR}/lib"
       else
-        pbxlibdir="-L${COROSYNC_CFG_STATE_TRACK_DIR}"
+         pbxlibdir="-L${COROSYNC_CFG_STATE_TRACK_DIR}"
       fi
    fi
    pbxfuncname="corosync_cfg_state_track"
@@ -26192,9 +28387,9 @@ if test "x${PBX_SPEEX}" != "x1" -a "${USE_SPEEX}" != "no"; then
    # 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"
+         pbxlibdir="-L${SPEEX_DIR}/lib"
       else
-        pbxlibdir="-L${SPEEX_DIR}"
+         pbxlibdir="-L${SPEEX_DIR}"
       fi
    fi
    pbxfuncname="speex_encode"
@@ -26298,9 +28493,9 @@ if test "x${PBX_SPEEX_PREPROCESS}" != "x1" -a "${USE_SPEEX_PREPROCESS}" != "no";
    # if --with-SPEEX_PREPROCESS=DIR has been specified, use it.
    if test "x${SPEEX_PREPROCESS_DIR}" != "x"; then
       if test -d ${SPEEX_PREPROCESS_DIR}/lib; then
-        pbxlibdir="-L${SPEEX_PREPROCESS_DIR}/lib"
+         pbxlibdir="-L${SPEEX_PREPROCESS_DIR}/lib"
       else
-        pbxlibdir="-L${SPEEX_PREPROCESS_DIR}"
+         pbxlibdir="-L${SPEEX_PREPROCESS_DIR}"
       fi
    fi
    pbxfuncname="speex_preprocess_ctl"
@@ -26406,9 +28601,9 @@ if test "x${PBX_SPEEXDSP}" != "x1" -a "${USE_SPEEXDSP}" != "no"; then
    # if --with-SPEEXDSP=DIR has been specified, use it.
    if test "x${SPEEXDSP_DIR}" != "x"; then
       if test -d ${SPEEXDSP_DIR}/lib; then
-        pbxlibdir="-L${SPEEXDSP_DIR}/lib"
+         pbxlibdir="-L${SPEEXDSP_DIR}/lib"
       else
-        pbxlibdir="-L${SPEEXDSP_DIR}"
+         pbxlibdir="-L${SPEEXDSP_DIR}"
       fi
    fi
    pbxfuncname="speex_preprocess_ctl"
@@ -26516,9 +28711,9 @@ if test "x${PBX_SQLITE}" != "x1" -a "${USE_SQLITE}" != "no"; then
    # 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"
+         pbxlibdir="-L${SQLITE_DIR}/lib"
       else
-        pbxlibdir="-L${SQLITE_DIR}"
+         pbxlibdir="-L${SQLITE_DIR}"
       fi
    fi
    pbxfuncname="sqlite_exec"
@@ -26621,25 +28816,314 @@ if test "x${PBX_SQLITE3}" != "x1" -a "${USE_SQLITE3}" != "no"; then
    # 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"
+         pbxlibdir="-L${SQLITE3_DIR}/lib"
+      else
+         pbxlibdir="-L${SQLITE3_DIR}"
+      fi
+   fi
+   pbxfuncname="sqlite3_open"
+   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
+      AST_SQLITE3_FOUND=yes
+   else
+      ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
+      CFLAGS="${CFLAGS} ${PTHREAD_CFLAGS}"
+      as_ac_Lib=`$as_echo "ac_cv_lib_sqlite3_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lsqlite3" >&5
+$as_echo_n "checking for ${pbxfuncname} in -lsqlite3... " >&6; }
+if eval \${$as_ac_Lib+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsqlite3 ${pbxlibdir} ${PTHREAD_LIBS} $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_SQLITE3_FOUND=yes
+else
+  AST_SQLITE3_FOUND=no
+fi
+
+      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
+   fi
+
+   # now check for the header.
+   if test "${AST_SQLITE3_FOUND}" = "yes"; then
+      SQLITE3_LIB="${pbxlibdir} -lsqlite3 ${PTHREAD_LIBS}"
+      # if --with-SQLITE3=DIR has been specified, use it.
+      if test "x${SQLITE3_DIR}" != "x"; then
+         SQLITE3_INCLUDE="-I${SQLITE3_DIR}/include"
+      fi
+      SQLITE3_INCLUDE="${SQLITE3_INCLUDE} ${PTHREAD_CFLAGS}"
+      if test "xsqlite3.h" = "x" ; then        # no header, assume found
+         SQLITE3_HEADER_FOUND="1"
+      else                             # check for the header
+         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${SQLITE3_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "sqlite3.h" "ac_cv_header_sqlite3_h" "$ac_includes_default"
+if test "x$ac_cv_header_sqlite3_h" = xyes; then :
+  SQLITE3_HEADER_FOUND=1
+else
+  SQLITE3_HEADER_FOUND=0
+fi
+
+
+         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
+      fi
+      if test "x${SQLITE3_HEADER_FOUND}" = "x0" ; then
+         SQLITE3_LIB=""
+         SQLITE3_INCLUDE=""
+      else
+         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
+            SQLITE3_LIB=""
+         fi
+         PBX_SQLITE3=1
+         cat >>confdefs.h <<_ACEOF
+#define HAVE_SQLITE3 1
+_ACEOF
+
+      fi
+   fi
+fi
+
+
+
+if test "${PBX_SQLITE3}" != 1; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** Asterisk now uses SQLite3 for the internal Asterisk database." >&5
+$as_echo "$as_me: WARNING: *** Asterisk now uses SQLite3 for the internal Asterisk database." >&2;}
+       { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** Please install the SQLite3 development package." >&5
+$as_echo "$as_me: WARNING: *** Please install the SQLite3 development package." >&2;}
+       exit 1
+fi
+
+# Find crypt support
+# * -lcrypt on *NIX
+# * in libsystem on OS X
+
+if test "x${PBX_LIBCRYPT}" != "x1" -a "${USE_LIBCRYPT}" != "no"; then
+   pbxlibdir=""
+   # if --with-LIBCRYPT=DIR has been specified, use it.
+   if test "x${LIBCRYPT_DIR}" != "x"; then
+      if test -d ${LIBCRYPT_DIR}/lib; then
+         pbxlibdir="-L${LIBCRYPT_DIR}/lib"
+      else
+         pbxlibdir="-L${LIBCRYPT_DIR}"
+      fi
+   fi
+   pbxfuncname="crypt"
+   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
+      AST_LIBCRYPT_FOUND=yes
+   else
+      ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
+      CFLAGS="${CFLAGS} "
+      as_ac_Lib=`$as_echo "ac_cv_lib_crypt_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lcrypt" >&5
+$as_echo_n "checking for ${pbxfuncname} in -lcrypt... " >&6; }
+if eval \${$as_ac_Lib+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lcrypt ${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_LIBCRYPT_FOUND=yes
+else
+  AST_LIBCRYPT_FOUND=no
+fi
+
+      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
+   fi
+
+   # now check for the header.
+   if test "${AST_LIBCRYPT_FOUND}" = "yes"; then
+      LIBCRYPT_LIB="${pbxlibdir} -lcrypt "
+      # if --with-LIBCRYPT=DIR has been specified, use it.
+      if test "x${LIBCRYPT_DIR}" != "x"; then
+         LIBCRYPT_INCLUDE="-I${LIBCRYPT_DIR}/include"
+      fi
+      LIBCRYPT_INCLUDE="${LIBCRYPT_INCLUDE} "
+      if test "xcrypt.h" = "x" ; then  # no header, assume found
+         LIBCRYPT_HEADER_FOUND="1"
+      else                             # check for the header
+         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${LIBCRYPT_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "crypt.h" "ac_cv_header_crypt_h" "$ac_includes_default"
+if test "x$ac_cv_header_crypt_h" = xyes; then :
+  LIBCRYPT_HEADER_FOUND=1
+else
+  LIBCRYPT_HEADER_FOUND=0
+fi
+
+
+         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
+      fi
+      if test "x${LIBCRYPT_HEADER_FOUND}" = "x0" ; then
+         LIBCRYPT_LIB=""
+         LIBCRYPT_INCLUDE=""
+      else
+         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
+            LIBCRYPT_LIB=""
+         fi
+         PBX_LIBCRYPT=1
+         cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBCRYPT 1
+_ACEOF
+
+      fi
+   fi
+fi
+
+
+ac_fn_c_check_func "$LINENO" "crypt" "ac_cv_func_crypt"
+if test "x$ac_cv_func_crypt" = xyes; then :
+  SYSCRYPT=true
+else
+  SYSCRYPT=""
+fi
+
+
+if test "x$LIBCRYPT_LIB" != "x" ; then
+    CRYPT_LIB="$LIBCRYPT_LIB"
+    CRYPT_INCLUDE="$LIBCRYPT_INCLUDE"
+
+$as_echo "#define HAVE_CRYPT 1" >>confdefs.h
+
+elif test "x$SYSCRYPT" != "x" ; then
+    CRYPT_LIB=""
+    CRYPT_INCLUDE=""
+
+$as_echo "#define HAVE_CRYPT 1" >>confdefs.h
+
+fi
+
+
+
+
+# Find crypt_r support
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for crypt_r in -lcrypt" >&5
+$as_echo_n "checking for crypt_r in -lcrypt... " >&6; }
+if ${ac_cv_lib_crypt_crypt_r+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lcrypt  $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 crypt_r ();
+int
+main ()
+{
+return crypt_r ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_crypt_crypt_r=yes
+else
+  ac_cv_lib_crypt_crypt_r=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypt_crypt_r" >&5
+$as_echo "$ac_cv_lib_crypt_crypt_r" >&6; }
+if test "x$ac_cv_lib_crypt_crypt_r" = xyes; then :
+
+$as_echo "#define HAVE_CRYPT_R 1" >>confdefs.h
+
+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"
       else
-        pbxlibdir="-L${SQLITE3_DIR}"
+         pbxlibdir="-L${CRYPTO_DIR}"
       fi
    fi
-   pbxfuncname="sqlite3_open"
+   pbxfuncname="AES_encrypt"
    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_SQLITE3_FOUND=yes
+      AST_CRYPTO_FOUND=yes
    else
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
-      CFLAGS="${CFLAGS} ${PTHREAD_CFLAGS}"
-      as_ac_Lib=`$as_echo "ac_cv_lib_sqlite3_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lsqlite3" >&5
-$as_echo_n "checking for ${pbxfuncname} in -lsqlite3... " >&6; }
+      CFLAGS="${CFLAGS} "
+      as_ac_Lib=`$as_echo "ac_cv_lib_crypto_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lcrypto" >&5
+$as_echo_n "checking for ${pbxfuncname} in -lcrypto... " >&6; }
 if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lsqlite3 ${pbxlibdir} ${PTHREAD_LIBS} $LIBS"
+LIBS="-lcrypto ${pbxlibdir}  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -26671,47 +29155,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_SQLITE3_FOUND=yes
+  AST_CRYPTO_FOUND=yes
 else
-  AST_SQLITE3_FOUND=no
+  AST_CRYPTO_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
    fi
 
    # now check for the header.
-   if test "${AST_SQLITE3_FOUND}" = "yes"; then
-      SQLITE3_LIB="${pbxlibdir} -lsqlite3 ${PTHREAD_LIBS}"
-      # if --with-SQLITE3=DIR has been specified, use it.
-      if test "x${SQLITE3_DIR}" != "x"; then
-         SQLITE3_INCLUDE="-I${SQLITE3_DIR}/include"
+   if test "${AST_CRYPTO_FOUND}" = "yes"; then
+      CRYPTO_LIB="${pbxlibdir} -lcrypto "
+      # if --with-CRYPTO=DIR has been specified, use it.
+      if test "x${CRYPTO_DIR}" != "x"; then
+         CRYPTO_INCLUDE="-I${CRYPTO_DIR}/include"
       fi
-      SQLITE3_INCLUDE="${SQLITE3_INCLUDE} ${PTHREAD_CFLAGS}"
-      if test "xsqlite3.h" = "x" ; then        # no header, assume found
-         SQLITE3_HEADER_FOUND="1"
+      CRYPTO_INCLUDE="${CRYPTO_INCLUDE} "
+      if test "xopenssl/aes.h" = "x" ; then    # no header, assume found
+         CRYPTO_HEADER_FOUND="1"
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${SQLITE3_INCLUDE}"
-         ac_fn_c_check_header_mongrel "$LINENO" "sqlite3.h" "ac_cv_header_sqlite3_h" "$ac_includes_default"
-if test "x$ac_cv_header_sqlite3_h" = xyes; then :
-  SQLITE3_HEADER_FOUND=1
+         CPPFLAGS="${CPPFLAGS} ${CRYPTO_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "openssl/aes.h" "ac_cv_header_openssl_aes_h" "$ac_includes_default"
+if test "x$ac_cv_header_openssl_aes_h" = xyes; then :
+  CRYPTO_HEADER_FOUND=1
 else
-  SQLITE3_HEADER_FOUND=0
+  CRYPTO_HEADER_FOUND=0
 fi
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
       fi
-      if test "x${SQLITE3_HEADER_FOUND}" = "x0" ; then
-         SQLITE3_LIB=""
-         SQLITE3_INCLUDE=""
+      if test "x${CRYPTO_HEADER_FOUND}" = "x0" ; then
+         CRYPTO_LIB=""
+         CRYPTO_INCLUDE=""
       else
          if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            SQLITE3_LIB=""
+            CRYPTO_LIB=""
          fi
-         PBX_SQLITE3=1
+         PBX_CRYPTO=1
          cat >>confdefs.h <<_ACEOF
-#define HAVE_SQLITE3 1
+#define HAVE_CRYPTO 1
 _ACEOF
 
       fi
 
 
 
-if test "${PBX_SQLITE3}" != 1; then
-       { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** Asterisk now uses SQLite3 for the internal Asterisk database." >&5
-$as_echo "$as_me: WARNING: *** Asterisk now uses SQLite3 for the internal Asterisk database." >&2;}
-       { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** Please install the SQLite3 development package." >&5
-$as_echo "$as_me: WARNING: *** Please install the SQLite3 development package." >&2;}
-       exit 1
-fi
-
+if test "$PBX_CRYPTO" = "1";
+then
 
-if test "x${PBX_CRYPTO}" != "x1" -a "${USE_CRYPTO}" != "no"; then
+if test "x${PBX_OPENSSL}" != "x1" -a "${USE_OPENSSL}" != "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"
+   # 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"
       else
-        pbxlibdir="-L${CRYPTO_DIR}"
+         pbxlibdir="-L${OPENSSL_DIR}"
       fi
    fi
-   pbxfuncname="AES_encrypt"
+   pbxfuncname="SSL_connect"
    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_CRYPTO_FOUND=yes
+      AST_OPENSSL_FOUND=yes
    else
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_crypto_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lcrypto" >&5
-$as_echo_n "checking for ${pbxfuncname} in -lcrypto... " >&6; }
+      as_ac_Lib=`$as_echo "ac_cv_lib_ssl_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lssl" >&5
+$as_echo_n "checking for ${pbxfuncname} in -lssl... " >&6; }
 if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lcrypto ${pbxlibdir}  $LIBS"
+LIBS="-lssl ${pbxlibdir} -lcrypto $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -26784,47 +29262,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_CRYPTO_FOUND=yes
+  AST_OPENSSL_FOUND=yes
 else
-  AST_CRYPTO_FOUND=no
+  AST_OPENSSL_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
    fi
 
    # now check for the header.
-   if test "${AST_CRYPTO_FOUND}" = "yes"; then
-      CRYPTO_LIB="${pbxlibdir} -lcrypto "
-      # if --with-CRYPTO=DIR has been specified, use it.
-      if test "x${CRYPTO_DIR}" != "x"; then
-         CRYPTO_INCLUDE="-I${CRYPTO_DIR}/include"
+   if test "${AST_OPENSSL_FOUND}" = "yes"; then
+      OPENSSL_LIB="${pbxlibdir} -lssl -lcrypto"
+      # if --with-OPENSSL=DIR has been specified, use it.
+      if test "x${OPENSSL_DIR}" != "x"; then
+         OPENSSL_INCLUDE="-I${OPENSSL_DIR}/include"
       fi
-      CRYPTO_INCLUDE="${CRYPTO_INCLUDE} "
-      if test "xopenssl/aes.h" = "x" ; then    # no header, assume found
-         CRYPTO_HEADER_FOUND="1"
+      OPENSSL_INCLUDE="${OPENSSL_INCLUDE} "
+      if test "xopenssl/ssl.h" = "x" ; then    # no header, assume found
+         OPENSSL_HEADER_FOUND="1"
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${CRYPTO_INCLUDE}"
-         ac_fn_c_check_header_mongrel "$LINENO" "openssl/aes.h" "ac_cv_header_openssl_aes_h" "$ac_includes_default"
-if test "x$ac_cv_header_openssl_aes_h" = xyes; then :
-  CRYPTO_HEADER_FOUND=1
+         CPPFLAGS="${CPPFLAGS} ${OPENSSL_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "openssl/ssl.h" "ac_cv_header_openssl_ssl_h" "$ac_includes_default"
+if test "x$ac_cv_header_openssl_ssl_h" = xyes; then :
+  OPENSSL_HEADER_FOUND=1
 else
-  CRYPTO_HEADER_FOUND=0
+  OPENSSL_HEADER_FOUND=0
 fi
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
       fi
-      if test "x${CRYPTO_HEADER_FOUND}" = "x0" ; then
-         CRYPTO_LIB=""
-         CRYPTO_INCLUDE=""
+      if test "x${OPENSSL_HEADER_FOUND}" = "x0" ; then
+         OPENSSL_LIB=""
+         OPENSSL_INCLUDE=""
       else
          if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            CRYPTO_LIB=""
+            OPENSSL_LIB=""
          fi
-         PBX_CRYPTO=1
+         PBX_OPENSSL=1
          cat >>confdefs.h <<_ACEOF
-#define HAVE_CRYPTO 1
+#define HAVE_OPENSSL 1
 _ACEOF
 
       fi
@@ -26832,23 +29310,151 @@ _ACEOF
 fi
 
 
+fi
+
+if test "$PBX_OPENSSL" = "1";
+then
+
+       # if OSPTK has not been checked and is not excluded
+       if test "x${PBX_OSPTK}" != "x1" -a "${USE_OSPTK}" != "no"; then
+               # if --with-osptk=DIR has been specified, use it.
+               if test "x${OSPTK_DIR}" != "x"; then
+                       osptk_cflags="-I${OSPTK_DIR}/include"
+                       osptk_ldflags="-L${OSPTK_DIR}/lib"
+               else
+                       osptk_cflags=""
+                       osptk_ldflags=""
+               fi
+
+               # check for the header
+               osptk_saved_cppflags="${CPPFLAGS}"
+               CPPFLAGS="${CPPFLAGS} ${osptk_cflags}"
+               ac_fn_c_check_header_mongrel "$LINENO" "osp/osp.h" "ac_cv_header_osp_osp_h" "$ac_includes_default"
+if test "x$ac_cv_header_osp_osp_h" = xyes; then :
+  osptk_header_found=yes
+else
+  osptk_header_found=no
+fi
+
+
+               CPPFLAGS="${osptk_saved_cppflags}"
+
+               # check for the library
+               if test "${osptk_header_found}" = "yes"; then
+                       osptk_extralibs="-lssl -lcrypto"
+
+                       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OSPPInit in -losptk" >&5
+$as_echo_n "checking for OSPPInit in -losptk... " >&6; }
+if ${ac_cv_lib_osptk_OSPPInit+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-losptk ${osptk_ldflags} ${osptk_extralibs} $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 OSPPInit ();
+int
+main ()
+{
+return OSPPInit ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_osptk_OSPPInit=yes
+else
+  ac_cv_lib_osptk_OSPPInit=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_osptk_OSPPInit" >&5
+$as_echo "$ac_cv_lib_osptk_OSPPInit" >&6; }
+if test "x$ac_cv_lib_osptk_OSPPInit" = xyes; then :
+  osptk_library_found=yes
+else
+  osptk_library_found=no
+fi
+
+
+                       # check OSP Toolkit version
+                       if test "${osptk_library_found}" = "yes"; then
+                               { $as_echo "$as_me:${as_lineno-$LINENO}: checking if OSP Toolkit version is compatible with app_osplookup" >&5
+$as_echo_n "checking if OSP Toolkit version is compatible with app_osplookup... " >&6; }
+
+                               osptk_saved_cppflags="${CPPFLAGS}"
+                               CPPFLAGS="${CPPFLAGS} ${osptk_cflags}"
+                               if test "$cross_compiling" = yes; then :
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot run test program while cross compiling
+See \`config.log' for more details" "$LINENO" 5; }
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+                                               #include <osp/osp.h>
+                                               int main(void) {
+                                                       int ver = OSP_CLIENT_TOOLKIT_VERSION_MAJOR * 10000 + OSP_CLIENT_TOOLKIT_VERSION_MINOR * 100 + OSP_CLIENT_TOOLKIT_VERSION_BUGFIX;
+                                                       int req = 4 * 10000 + 0 * 100 + 0;
+                                                       return (ver < req) ? 1 : 0;
+                                               }
+
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  osptk_compatible=yes
+else
+  osptk_compatible=no
+
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+                               CPPFLAGS="${osptk_saved_cppflags}"
+
+                               if test "${osptk_compatible}" = "yes"; then
+                                       { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+                                       PBX_OSPTK=1
+                                       OSPTK_INCLUDE="${osptk_cflags}"
+                                       OSPTK_LIB="${osptk_ldflags} -losptk ${osptk_extralibs}"
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_OSPTK 1
+_ACEOF
+
+                               else
+                                       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+                               fi
+                       fi
+               fi
+       fi
 
-if test "$PBX_CRYPTO" = "1";
-then
 
-if test "x${PBX_OPENSSL}" != "x1" -a "${USE_OPENSSL}" != "no"; then
+if test "x${PBX_OPENSSL_SRTP}" != "x1" -a "${USE_OPENSSL_SRTP}" != "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"
+   # if --with-OPENSSL_SRTP=DIR has been specified, use it.
+   if test "x${OPENSSL_SRTP_DIR}" != "x"; then
+      if test -d ${OPENSSL_SRTP_DIR}/lib; then
+         pbxlibdir="-L${OPENSSL_SRTP_DIR}/lib"
       else
-        pbxlibdir="-L${OPENSSL_DIR}"
+         pbxlibdir="-L${OPENSSL_SRTP_DIR}"
       fi
    fi
-   pbxfuncname="SSL_connect"
+   pbxfuncname="SSL_CTX_set_tlsext_use_srtp"
    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_OPENSSL_FOUND=yes
+      AST_OPENSSL_SRTP_FOUND=yes
    else
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
@@ -26891,47 +29497,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_OPENSSL_FOUND=yes
+  AST_OPENSSL_SRTP_FOUND=yes
 else
-  AST_OPENSSL_FOUND=no
+  AST_OPENSSL_SRTP_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
    fi
 
    # now check for the header.
-   if test "${AST_OPENSSL_FOUND}" = "yes"; then
-      OPENSSL_LIB="${pbxlibdir} -lssl -lcrypto"
-      # if --with-OPENSSL=DIR has been specified, use it.
-      if test "x${OPENSSL_DIR}" != "x"; then
-         OPENSSL_INCLUDE="-I${OPENSSL_DIR}/include"
+   if test "${AST_OPENSSL_SRTP_FOUND}" = "yes"; then
+      OPENSSL_SRTP_LIB="${pbxlibdir} -lssl -lcrypto"
+      # if --with-OPENSSL_SRTP=DIR has been specified, use it.
+      if test "x${OPENSSL_SRTP_DIR}" != "x"; then
+         OPENSSL_SRTP_INCLUDE="-I${OPENSSL_SRTP_DIR}/include"
       fi
-      OPENSSL_INCLUDE="${OPENSSL_INCLUDE} "
+      OPENSSL_SRTP_INCLUDE="${OPENSSL_SRTP_INCLUDE} "
       if test "xopenssl/ssl.h" = "x" ; then    # no header, assume found
-         OPENSSL_HEADER_FOUND="1"
+         OPENSSL_SRTP_HEADER_FOUND="1"
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${OPENSSL_INCLUDE}"
+         CPPFLAGS="${CPPFLAGS} ${OPENSSL_SRTP_INCLUDE}"
          ac_fn_c_check_header_mongrel "$LINENO" "openssl/ssl.h" "ac_cv_header_openssl_ssl_h" "$ac_includes_default"
 if test "x$ac_cv_header_openssl_ssl_h" = xyes; then :
-  OPENSSL_HEADER_FOUND=1
+  OPENSSL_SRTP_HEADER_FOUND=1
 else
-  OPENSSL_HEADER_FOUND=0
+  OPENSSL_SRTP_HEADER_FOUND=0
 fi
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
       fi
-      if test "x${OPENSSL_HEADER_FOUND}" = "x0" ; then
-         OPENSSL_LIB=""
-         OPENSSL_INCLUDE=""
+      if test "x${OPENSSL_SRTP_HEADER_FOUND}" = "x0" ; then
+         OPENSSL_SRTP_LIB=""
+         OPENSSL_SRTP_INCLUDE=""
       else
          if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            OPENSSL_LIB=""
+            OPENSSL_SRTP_LIB=""
          fi
-         PBX_OPENSSL=1
+         PBX_OPENSSL_SRTP=1
          cat >>confdefs.h <<_ACEOF
-#define HAVE_OPENSSL 1
+#define HAVE_OPENSSL_SRTP 1
 _ACEOF
 
       fi
 if test "$PBX_OPENSSL" = "1";
 then
 
-       # if OSPTK has not been checked and is not excluded
-       if test "x${PBX_OSPTK}" != "x1" -a "${USE_OSPTK}" != "no"; then
-               # if --with-osptk=DIR has been specified, use it.
-               if test "x${OSPTK_DIR}" != "x"; then
-                       osptk_cflags="-I${OSPTK_DIR}/include"
-                       osptk_ldflags="-L${OSPTK_DIR}/lib"
-               else
-                       osptk_cflags=""
-                       osptk_ldflags=""
-               fi
-
-               # check for the header
-               osptk_saved_cppflags="${CPPFLAGS}"
-               CPPFLAGS="${CPPFLAGS} ${osptk_cflags}"
-               ac_fn_c_check_header_mongrel "$LINENO" "osp/osp.h" "ac_cv_header_osp_osp_h" "$ac_includes_default"
-if test "x$ac_cv_header_osp_osp_h" = xyes; then :
-  osptk_header_found=yes
-else
-  osptk_header_found=no
-fi
-
-
-               CPPFLAGS="${osptk_saved_cppflags}"
-
-               # check for the library
-               if test "${osptk_header_found}" = "yes"; then
-                       osptk_extralibs="-lssl -lcrypto"
-
-                       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OSPPInit in -losptk" >&5
-$as_echo_n "checking for OSPPInit in -losptk... " >&6; }
-if ${ac_cv_lib_osptk_OSPPInit+:} false; then :
+if test "x${PBX_OPENSSL_EC}" != "x1" -a "${USE_OPENSSL_EC}" != "no"; then
+   pbxlibdir=""
+   # if --with-OPENSSL_EC=DIR has been specified, use it.
+   if test "x${OPENSSL_EC_DIR}" != "x"; then
+      if test -d ${OPENSSL_EC_DIR}/lib; then
+         pbxlibdir="-L${OPENSSL_EC_DIR}/lib"
+      else
+         pbxlibdir="-L${OPENSSL_EC_DIR}"
+      fi
+   fi
+   pbxfuncname="EC_KEY_new_by_curve_name"
+   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
+      AST_OPENSSL_EC_FOUND=yes
+   else
+      ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
+      CFLAGS="${CFLAGS} "
+      as_ac_Lib=`$as_echo "ac_cv_lib_ssl_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lssl" >&5
+$as_echo_n "checking for ${pbxfuncname} in -lssl... " >&6; }
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-losptk ${osptk_ldflags} ${osptk_extralibs} $LIBS"
+LIBS="-lssl ${pbxlibdir} -lcrypto $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -26988,87 +29583,75 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char OSPPInit ();
+char ${pbxfuncname} ();
 int
 main ()
 {
-return OSPPInit ();
+return ${pbxfuncname} ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_osptk_OSPPInit=yes
+  eval "$as_ac_Lib=yes"
 else
-  ac_cv_lib_osptk_OSPPInit=no
+  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
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_osptk_OSPPInit" >&5
-$as_echo "$ac_cv_lib_osptk_OSPPInit" >&6; }
-if test "x$ac_cv_lib_osptk_OSPPInit" = xyes; then :
-  osptk_library_found=yes
+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_OPENSSL_EC_FOUND=yes
 else
-  osptk_library_found=no
+  AST_OPENSSL_EC_FOUND=no
 fi
 
+      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
+   fi
 
-                       # check OSP Toolkit version
-                       if test "${osptk_library_found}" = "yes"; then
-                               { $as_echo "$as_me:${as_lineno-$LINENO}: checking if OSP Toolkit version is compatible with app_osplookup" >&5
-$as_echo_n "checking if OSP Toolkit version is compatible with app_osplookup... " >&6; }
-
-                               osptk_saved_cppflags="${CPPFLAGS}"
-                               CPPFLAGS="${CPPFLAGS} ${osptk_cflags}"
-                               if test "$cross_compiling" = yes; then :
-  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "cannot run test program while cross compiling
-See \`config.log' for more details" "$LINENO" 5; }
+   # now check for the header.
+   if test "${AST_OPENSSL_EC_FOUND}" = "yes"; then
+      OPENSSL_EC_LIB="${pbxlibdir} -lssl -lcrypto"
+      # if --with-OPENSSL_EC=DIR has been specified, use it.
+      if test "x${OPENSSL_EC_DIR}" != "x"; then
+         OPENSSL_EC_INCLUDE="-I${OPENSSL_EC_DIR}/include"
+      fi
+      OPENSSL_EC_INCLUDE="${OPENSSL_EC_INCLUDE} "
+      if test "xopenssl/ec.h" = "x" ; then     # no header, assume found
+         OPENSSL_EC_HEADER_FOUND="1"
+      else                             # check for the header
+         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${OPENSSL_EC_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "openssl/ec.h" "ac_cv_header_openssl_ec_h" "$ac_includes_default"
+if test "x$ac_cv_header_openssl_ec_h" = xyes; then :
+  OPENSSL_EC_HEADER_FOUND=1
 else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
+  OPENSSL_EC_HEADER_FOUND=0
+fi
 
-                                               #include <osp/osp.h>
-                                               int main(void) {
-                                                       int ver = OSP_CLIENT_TOOLKIT_VERSION_MAJOR * 10000 + OSP_CLIENT_TOOLKIT_VERSION_MINOR * 100 + OSP_CLIENT_TOOLKIT_VERSION_BUGFIX;
-                                                       int req = 4 * 10000 + 0 * 100 + 0;
-                                                       return (ver < req) ? 1 : 0;
-                                               }
 
+         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
+      fi
+      if test "x${OPENSSL_EC_HEADER_FOUND}" = "x0" ; then
+         OPENSSL_EC_LIB=""
+         OPENSSL_EC_INCLUDE=""
+      else
+         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
+            OPENSSL_EC_LIB=""
+         fi
+         PBX_OPENSSL_EC=1
+         cat >>confdefs.h <<_ACEOF
+#define HAVE_OPENSSL_EC 1
 _ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-  osptk_compatible=yes
-else
-  osptk_compatible=no
 
+      fi
+   fi
 fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-
-                               CPPFLAGS="${osptk_saved_cppflags}"
-
-                               if test "${osptk_compatible}" = "yes"; then
-                                       { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-                                       PBX_OSPTK=1
-                                       OSPTK_INCLUDE="${osptk_cflags}"
-                                       OSPTK_LIB="${osptk_ldflags} -losptk ${osptk_extralibs}"
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_OSPTK 1
-_ACEOF
 
-                               else
-                                       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-                               fi
-                       fi
-               fi
-       fi
 
 fi
 
@@ -27078,9 +29661,9 @@ if test "x${PBX_SRTP}" != "x1" -a "${USE_SRTP}" != "no"; then
    # if --with-SRTP=DIR has been specified, use it.
    if test "x${SRTP_DIR}" != "x"; then
       if test -d ${SRTP_DIR}/lib; then
-        pbxlibdir="-L${SRTP_DIR}/lib"
+         pbxlibdir="-L${SRTP_DIR}/lib"
       else
-        pbxlibdir="-L${SRTP_DIR}"
+         pbxlibdir="-L${SRTP_DIR}"
       fi
    fi
    pbxfuncname="srtp_init"
@@ -27240,6 +29823,110 @@ rm -f core conftest.err conftest.$ac_objext \
 fi
 
 
+if test "x${PBX_SRTP_SHUTDOWN}" != "x1" -a "${USE_SRTP_SHUTDOWN}" != "no"; then
+   pbxlibdir=""
+   # if --with-SRTP_SHUTDOWN=DIR has been specified, use it.
+   if test "x${SRTP_SHUTDOWN_DIR}" != "x"; then
+      if test -d ${SRTP_SHUTDOWN_DIR}/lib; then
+         pbxlibdir="-L${SRTP_SHUTDOWN_DIR}/lib"
+      else
+         pbxlibdir="-L${SRTP_SHUTDOWN_DIR}"
+      fi
+   fi
+   pbxfuncname="srtp_shutdown"
+   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
+      AST_SRTP_SHUTDOWN_FOUND=yes
+   else
+      ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
+      CFLAGS="${CFLAGS} "
+      as_ac_Lib=`$as_echo "ac_cv_lib_srtp_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lsrtp" >&5
+$as_echo_n "checking for ${pbxfuncname} in -lsrtp... " >&6; }
+if eval \${$as_ac_Lib+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsrtp ${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_SRTP_SHUTDOWN_FOUND=yes
+else
+  AST_SRTP_SHUTDOWN_FOUND=no
+fi
+
+      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
+   fi
+
+   # now check for the header.
+   if test "${AST_SRTP_SHUTDOWN_FOUND}" = "yes"; then
+      SRTP_SHUTDOWN_LIB="${pbxlibdir} -lsrtp "
+      # if --with-SRTP_SHUTDOWN=DIR has been specified, use it.
+      if test "x${SRTP_SHUTDOWN_DIR}" != "x"; then
+         SRTP_SHUTDOWN_INCLUDE="-I${SRTP_SHUTDOWN_DIR}/include"
+      fi
+      SRTP_SHUTDOWN_INCLUDE="${SRTP_SHUTDOWN_INCLUDE} "
+      if test "xsrtp/srtp.h" = "x" ; then      # no header, assume found
+         SRTP_SHUTDOWN_HEADER_FOUND="1"
+      else                             # check for the header
+         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${SRTP_SHUTDOWN_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "srtp/srtp.h" "ac_cv_header_srtp_srtp_h" "$ac_includes_default"
+if test "x$ac_cv_header_srtp_srtp_h" = xyes; then :
+  SRTP_SHUTDOWN_HEADER_FOUND=1
+else
+  SRTP_SHUTDOWN_HEADER_FOUND=0
+fi
+
+
+         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
+      fi
+      if test "x${SRTP_SHUTDOWN_HEADER_FOUND}" = "x0" ; then
+         SRTP_SHUTDOWN_LIB=""
+         SRTP_SHUTDOWN_INCLUDE=""
+      else
+         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
+            SRTP_SHUTDOWN_LIB=""
+         fi
+         PBX_SRTP_SHUTDOWN=1
+         cat >>confdefs.h <<_ACEOF
+#define HAVE_SRTP_SHUTDOWN 1
+_ACEOF
+
+      fi
+   fi
+fi
+
+
+
 for ver in 2.0 2.2 2.4 2.6; do
 
    if test "x${PBX_GMIME}" != "x1" -a "${USE_GMIME}" != "no"; then
@@ -27340,9 +30027,9 @@ if test "x${PBX_HOARD}" != "x1" -a "${USE_HOARD}" != "no"; then
    # if --with-HOARD=DIR has been specified, use it.
    if test "x${HOARD_DIR}" != "x"; then
       if test -d ${HOARD_DIR}/lib; then
-        pbxlibdir="-L${HOARD_DIR}/lib"
+         pbxlibdir="-L${HOARD_DIR}/lib"
       else
-        pbxlibdir="-L${HOARD_DIR}"
+         pbxlibdir="-L${HOARD_DIR}"
       fi
    fi
    pbxfuncname="malloc"
@@ -27445,9 +30132,9 @@ if test "x${PBX_FREETDS}" != "x1" -a "${USE_FREETDS}" != "no"; then
    # 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"
+         pbxlibdir="-L${FREETDS_DIR}/lib"
       else
-        pbxlibdir="-L${FREETDS_DIR}"
+         pbxlibdir="-L${FREETDS_DIR}"
       fi
    fi
    pbxfuncname="dbinit"
@@ -27597,9 +30284,9 @@ if test "x${PBX_TONEZONE}" != "x1" -a "${USE_TONEZONE}" != "no"; then
    # 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"
+         pbxlibdir="-L${TONEZONE_DIR}/lib"
       else
-        pbxlibdir="-L${TONEZONE_DIR}"
+         pbxlibdir="-L${TONEZONE_DIR}"
       fi
    fi
    pbxfuncname="tone_zone_find"
@@ -27704,9 +30391,9 @@ if test "x${PBX_VORBIS}" != "x1" -a "${USE_VORBIS}" != "no"; then
    # 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"
+         pbxlibdir="-L${VORBIS_DIR}/lib"
       else
-        pbxlibdir="-L${VORBIS_DIR}"
+         pbxlibdir="-L${VORBIS_DIR}"
       fi
    fi
    pbxfuncname="vorbis_info_init"
@@ -27809,9 +30496,9 @@ if test "x${PBX_VORBIS}" != "x1" -a "${USE_VORBIS}" != "no"; then
    # 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"
+         pbxlibdir="-L${VORBIS_DIR}/lib"
       else
-        pbxlibdir="-L${VORBIS_DIR}"
+         pbxlibdir="-L${VORBIS_DIR}"
       fi
    fi
    pbxfuncname="vorbis_info_init"
@@ -28030,9 +30717,9 @@ if test "x${PBX_ZLIB}" != "x1" -a "${USE_ZLIB}" != "no"; then
    # 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"
+         pbxlibdir="-L${ZLIB_DIR}/lib"
       else
-        pbxlibdir="-L${ZLIB_DIR}"
+         pbxlibdir="-L${ZLIB_DIR}"
       fi
    fi
    pbxfuncname="compress"
@@ -28160,16 +30847,6 @@ rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 fi
 
-ac_fn_c_check_header_mongrel "$LINENO" "h323.h" "ac_cv_header_h323_h" "$ac_includes_default"
-if test "x$ac_cv_header_h323_h" = xyes; then :
-  PBX_H323=1
-else
-  PBX_H323=0
-fi
-
-
-
-
 ac_fn_c_check_header_mongrel "$LINENO" "linux/compiler.h" "ac_cv_header_linux_compiler_h" "$ac_includes_default"
 if test "x$ac_cv_header_linux_compiler_h" = xyes; then :
 
@@ -28292,9 +30969,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
 
 
-    if test "x${PBX_SDL}" != "x1" -a "${USE_SDL}" != "no"; then
-       PBX_SDL=0
-       if test -n "$ac_tool_prefix"; then
+               if test "x${PBX_SDL}" != "x1" -a "${USE_SDL}" != "no"; then
+               PBX_SDL=0
+               if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}sdl-config", so it can be a program name with args.
 set dummy ${ac_tool_prefix}sdl-config; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
@@ -28394,52 +31071,50 @@ else
   CONFIG_SDL="$ac_cv_path_CONFIG_SDL"
 fi
 
-       if test ! "x${CONFIG_SDL}" = xNo; then
-           if test x"" = x ; then A=--cflags ; else A="" ; fi
-           SDL_INCLUDE=$(${CONFIG_SDL} $A)
-           if test x"" = x ; then A=--libs ; else A="" ; fi
-           SDL_LIB=$(${CONFIG_SDL} $A)
-           if test x"" != x ; then
-               saved_cppflags="${CPPFLAGS}"
-               if test "x${SDL_DIR}" != "x"; then
-                   SDL_INCLUDE="-I${SDL_DIR}/include"
-               fi
-               CPPFLAGS="${CPPFLAGS} ${SDL_INCLUDE}"
+               if test ! "x${CONFIG_SDL}" = xNo; then
+                       if test x"" = x ; then A=--cflags ; else A="" ; fi
+                       SDL_INCLUDE=$(${CONFIG_SDL} $A)
+                       SDL_INCLUDE=$(echo ${SDL_INCLUDE} | $SED -e "s|-I|-I${SDL_DIR}|g")
 
-               saved_libs="${LIBS}"
-               LIBS="${SDL_LIB}"
+                       if test x"" = x ; then A=--libs ; else A="" ; fi
+                       SDL_LIB=$(${CONFIG_SDL} $A)
+                       SDL_LIB=$(echo ${SDL_LIB} | $SED -e "s|-L|-L${SDL_DIR}|g")
 
-               cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+                       if test x"" != x ; then
+                               saved_cppflags="${CPPFLAGS}"
+                               CPPFLAGS="${CPPFLAGS} ${SDL_INCLUDE}"
+
+                               saved_libs="${LIBS}"
+                               LIBS=${SDL_LIB}
+
+                               cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
 main ()
 {
  ;
-
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-     PBX_SDL=1
-
+   PBX_SDL=1
 $as_echo "#define HAVE_SDL 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_SDL=1
+                               CPPFLAGS="${saved_cppflags}"
+                               LIBS="${saved_libs}"
+                       else
+                               PBX_SDL=1
 
 $as_echo "#define HAVE_SDL 1" >>confdefs.h
 
-           fi
+                       fi
+               fi
        fi
-    fi
 
 
 if test "x${PBX_SDL_IMAGE}" != "x1" -a "${USE_SDL_IMAGE}" != "no"; then
@@ -28447,9 +31122,9 @@ if test "x${PBX_SDL_IMAGE}" != "x1" -a "${USE_SDL_IMAGE}" != "no"; then
    # 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"
+         pbxlibdir="-L${SDL_IMAGE_DIR}/lib"
       else
-        pbxlibdir="-L${SDL_IMAGE_DIR}"
+         pbxlibdir="-L${SDL_IMAGE_DIR}"
       fi
    fi
    pbxfuncname="IMG_Load"
@@ -28551,9 +31226,9 @@ if test "x${PBX_FFMPEG}" != "x1" -a "${USE_FFMPEG}" != "no"; then
    # 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"
+         pbxlibdir="-L${FFMPEG_DIR}/lib"
       else
-        pbxlibdir="-L${FFMPEG_DIR}"
+         pbxlibdir="-L${FFMPEG_DIR}"
       fi
    fi
    pbxfuncname="sws_getContext"
@@ -28669,9 +31344,9 @@ if test "x${PBX_X11}" != "x1" -a "${USE_X11}" != "no"; then
    # if --with-X11=DIR has been specified, use it.
    if test "x${X11_DIR}" != "x"; then
       if test -d ${X11_DIR}/lib; then
-        pbxlibdir="-L${X11_DIR}/lib"
+         pbxlibdir="-L${X11_DIR}/lib"
       else
-        pbxlibdir="-L${X11_DIR}"
+         pbxlibdir="-L${X11_DIR}"
       fi
    fi
    pbxfuncname="XOpenDisplay"
@@ -28777,9 +31452,9 @@ if test "x${PBX_X11}" != "x1" -a "${USE_X11}" != "no"; then
    # if --with-X11=DIR has been specified, use it.
    if test "x${X11_DIR}" != "x"; then
       if test -d ${X11_DIR}/lib; then
-        pbxlibdir="-L${X11_DIR}/lib"
+         pbxlibdir="-L${X11_DIR}/lib"
       else
-        pbxlibdir="-L${X11_DIR}"
+         pbxlibdir="-L${X11_DIR}"
       fi
    fi
    pbxfuncname="XOpenDisplay"
@@ -28904,7 +31579,9 @@ $as_echo "#define HAVE_SBIN_LAUNCHD 1" >>confdefs.h
 
 fi
 
-  PBX_LAUNCHD=1
+  if test "${HAVE_SBIN_LAUNCHD}" = 1; then
+    PBX_LAUNCHD=1
+  fi
 fi
 
 
@@ -29537,7 +32214,7 @@ else
        touch makeopts.acbak
 fi
 
-ac_config_files="$ac_config_files build_tools/menuselect-deps makeopts channels/h323/Makefile"
+ac_config_files="$ac_config_files build_tools/menuselect-deps makeopts"
 
 
        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for mandatory modules: ${ac_mandatory_list}" >&5
@@ -30282,7 +32959,6 @@ do
     "include/asterisk/autoconfig.h") CONFIG_HEADERS="$CONFIG_HEADERS include/asterisk/autoconfig.h" ;;
     "build_tools/menuselect-deps") CONFIG_FILES="$CONFIG_FILES build_tools/menuselect-deps" ;;
     "makeopts") CONFIG_FILES="$CONFIG_FILES makeopts" ;;
-    "channels/h323/Makefile") CONFIG_FILES="$CONFIG_FILES channels/h323/Makefile" ;;
 
   *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
   esac
@@ -30906,6 +33582,15 @@ echo "       \$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$.                "
 echo
 fi
 
+if test "x${AST_IODBC_FOUND}" = "xyes"; then
+       echo "WARNING: iodbc libs/headers found!"
+       echo
+       echo "  If you plan to use ODBC functionality, you should consider"
+       echo "  switching to unixodbc instead."
+       echo "  See: https://issues.asterisk.org/jira/browse/ASTERISK-22459"
+       echo
+fi
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: Package configured for: " >&5
 $as_echo "$as_me: Package configured for: " >&6;}
 { $as_echo "$as_me:${as_lineno-$LINENO}: OS type  : $host_os" >&5