Merge "endpoint identifiers: Some code cleanup."
[asterisk/asterisk.git] / configure
index 2d04b6d..f6e83d9 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,5 +1,4 @@
 #! /bin/sh
-# From configure.ac Revision: 395985 .
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.69 for asterisk trunk.
 #
@@ -639,6 +638,11 @@ PBX_SYSLOG_FACILITY_LOG_DAEMON
 PBX_SYSLOG_FACILITY_LOG_CRON
 PBX_SYSLOG_FACILITY_LOG_AUTHPRIV
 PBX_SYSLOG_FACILITY_LOG_AUTH
+SYSTEMD_LIBS
+SYSTEMD_CFLAGS
+SYSTEMD_INCLUDE
+SYSTEMD_LIB
+PBX_SYSTEMD
 PBX_GENERIC_ODBC
 GENERIC_ODBC_INCLUDE
 GENERIC_ODBC_LIB
@@ -649,9 +653,10 @@ CONFIG_SDL
 PBX_SO_NOSIGPIPE
 PBX_MSG_NOSIGNAL
 PBX_IXJUSER
-PBX_H323
 GMIME_LIBS
 GMIME_CFLAGS
+PBX_SSL_OP_NO_TLSV1_2
+PBX_SSL_OP_NO_TLSV1_1
 OPENH323_BUILD
 OPENH323_SUFFIX
 OPENH323_LIBDIR
@@ -662,6 +667,10 @@ PWLIB_LIBDIR
 PWLIB_INCDIR
 PWLIBDIR
 PTLIB_CONFIG
+PYTHONDEV_LIBS
+PYTHONDEV_CFLAGS
+PYTHONDEV_INCLUDE
+PYTHONDEV_LIB
 PJPROJECT_LIBS
 PJPROJECT_CFLAGS
 PG_CONFIG
@@ -684,19 +693,22 @@ PKG_CONFIG_PATH
 PKG_CONFIG
 PBX_DLADDR
 PBX_IP_MTU_DISCOVER
+PBX_RTLD_NOLOAD
 PBX_GLOB_BRACE
 PBX_GLOB_NOMAGIC
+BIND8_CFLAGS
 AST_RPATH
-AST_NESTED_FUNCTIONS
 AST_NATIVE_ARCH
 AST_SHADOW_WARNINGS
+AST_NO_FORMAT_TRUNCATION
 AST_NO_STRICT_OVERFLOW
 AST_FORTIFY_SOURCE
 AST_TRAMPOLINES
 AST_DECLARATION_AFTER_STATEMENT
-GC_LDFLAGS
-GC_CFLAGS
-PBX_WEAKREF
+AST_UNDEFINED_SANITIZER
+AST_LEAK_SANITIZER
+AST_THREAD_SANITIZER
+AST_ADDRESS_SANITIZER
 PBX_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
 PBX_PTHREAD_RWLOCK_INITIALIZER
 AST_ASTERISKSSL
@@ -705,6 +717,7 @@ PBX_DYNAMIC_LIST
 POW_LIB
 PBX_WORKING_FORK
 LIBOBJS
+DISABLE_XMLDOC
 CONFIG_LIBXML2
 UUID_LIB
 UUID_INCLUDE
@@ -730,6 +743,10 @@ PBX_UNIXODBC
 UNIXODBC_DIR
 UNIXODBC_INCLUDE
 UNIXODBC_LIB
+PBX_UNBOUND
+UNBOUND_DIR
+UNBOUND_INCLUDE
+UNBOUND_LIB
 PBX_TONEZONE
 TONEZONE_DIR
 TONEZONE_INCLUDE
@@ -754,6 +771,10 @@ PBX_SUPPSERV
 SUPPSERV_DIR
 SUPPSERV_INCLUDE
 SUPPSERV_LIB
+PBX_RT
+RT_DIR
+RT_INCLUDE
+RT_LIB
 PBX_OPENSSL
 OPENSSL_DIR
 OPENSSL_INCLUDE
@@ -762,6 +783,18 @@ PBX_SRTP_SHUTDOWN
 SRTP_SHUTDOWN_DIR
 SRTP_SHUTDOWN_INCLUDE
 SRTP_SHUTDOWN_LIB
+PBX_SRTP_GCM
+SRTP_GCM_DIR
+SRTP_GCM_INCLUDE
+SRTP_GCM_LIB
+PBX_SRTP_192
+SRTP_192_DIR
+SRTP_192_INCLUDE
+SRTP_192_LIB
+PBX_SRTP_256
+SRTP_256_DIR
+SRTP_256_INCLUDE
+SRTP_256_LIB
 PBX_SRTP
 SRTP_DIR
 SRTP_INCLUDE
@@ -794,7 +827,6 @@ PBX_SPANDSP
 SPANDSP_DIR
 SPANDSP_INCLUDE
 SPANDSP_LIB
-SOUNDS_CACHE_DIR
 PBX_SDL_IMAGE
 SDL_IMAGE_DIR
 SDL_IMAGE_INCLUDE
@@ -803,10 +835,18 @@ PBX_SDL
 SDL_DIR
 SDL_INCLUDE
 SDL_LIB
+PBX_SNDFILE
+SNDFILE_DIR
+SNDFILE_INCLUDE
+SNDFILE_LIB
 PBX_RESAMPLE
 RESAMPLE_DIR
 RESAMPLE_INCLUDE
 RESAMPLE_LIB
+PBX_FFTW3
+FFTW3_DIR
+FFTW3_INCLUDE
+FFTW3_LIB
 PBX_RADIUS
 RADIUS_DIR
 RADIUS_INCLUDE
@@ -891,6 +931,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
@@ -903,10 +947,54 @@ PBX_POPT
 POPT_DIR
 POPT_INCLUDE
 POPT_LIB
-PBX_PJPROJECT
-PJPROJECT_DIR
-PJPROJECT_INCLUDE
-PJPROJECT_LIB
+PBX_PJSIP_TSX_LAYER_FIND_TSX2
+PJSIP_TSX_LAYER_FIND_TSX2_DIR
+PJSIP_TSX_LAYER_FIND_TSX2_INCLUDE
+PJSIP_TSX_LAYER_FIND_TSX2_LIB
+PBX_PJSIP_AUTH_CLT_DEINIT
+PJSIP_AUTH_CLT_DEINIT_DIR
+PJSIP_AUTH_CLT_DEINIT_INCLUDE
+PJSIP_AUTH_CLT_DEINIT_LIB
+PBX_PJSIP_INV_SESSION_REF
+PJSIP_INV_SESSION_REF_DIR
+PJSIP_INV_SESSION_REF_INCLUDE
+PJSIP_INV_SESSION_REF_LIB
+PBX_PJSIP_EVSUB_GRP_LOCK
+PJSIP_EVSUB_GRP_LOCK_DIR
+PJSIP_EVSUB_GRP_LOCK_INCLUDE
+PJSIP_EVSUB_GRP_LOCK_LIB
+PBX_PJSIP_TLS_TRANSPORT_PROTO
+PJSIP_TLS_TRANSPORT_PROTO_DIR
+PJSIP_TLS_TRANSPORT_PROTO_INCLUDE
+PJSIP_TLS_TRANSPORT_PROTO_LIB
+PBX_PJSIP_EXTERNAL_RESOLVER
+PJSIP_EXTERNAL_RESOLVER_DIR
+PJSIP_EXTERNAL_RESOLVER_INCLUDE
+PJSIP_EXTERNAL_RESOLVER_LIB
+PBX_PJ_SSL_CERT_LOAD_FROM_FILES2
+PJ_SSL_CERT_LOAD_FROM_FILES2_DIR
+PJ_SSL_CERT_LOAD_FROM_FILES2_INCLUDE
+PJ_SSL_CERT_LOAD_FROM_FILES2_LIB
+PBX_PJSIP_GET_DEST_INFO
+PJSIP_GET_DEST_INFO_DIR
+PJSIP_GET_DEST_INFO_INCLUDE
+PJSIP_GET_DEST_INFO_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_PJSIP_DLG_CREATE_UAS_AND_INC_LOCK
+PJSIP_DLG_CREATE_UAS_AND_INC_LOCK_DIR
+PJSIP_DLG_CREATE_UAS_AND_INC_LOCK_INCLUDE
+PJSIP_DLG_CREATE_UAS_AND_INC_LOCK_LIB
+PBX_BEANSTALK
+BEANSTALK_DIR
+BEANSTALK_INCLUDE
+BEANSTALK_LIB
 PBX_PGSQL
 PGSQL_DIR
 PGSQL_INCLUDE
@@ -919,6 +1007,14 @@ PBX_OSPTK
 OSPTK_DIR
 OSPTK_INCLUDE
 OSPTK_LIB
+PBX_OPUSFILE
+OPUSFILE_DIR
+OPUSFILE_INCLUDE
+OPUSFILE_LIB
+PBX_OPUS
+OPUS_DIR
+OPUS_INCLUDE
+OPUS_LIB
 PBX_OPENR2
 OPENR2_DIR
 OPENR2_INCLUDE
@@ -967,6 +1063,10 @@ 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
@@ -975,6 +1075,10 @@ PBX_LIBXML2
 LIBXML2_DIR
 LIBXML2_INCLUDE
 LIBXML2_LIB
+PBX_LIBEDIT_IS_UNICODE
+LIBEDIT_IS_UNICODE_DIR
+LIBEDIT_IS_UNICODE_INCLUDE
+LIBEDIT_IS_UNICODE_LIB
 PBX_LIBEDIT
 LIBEDIT_DIR
 LIBEDIT_INCLUDE
@@ -1063,6 +1167,10 @@ 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
@@ -1087,6 +1195,10 @@ PBX_COROSYNC
 COROSYNC_DIR
 COROSYNC_INCLUDE
 COROSYNC_LIB
+PBX_CODEC2
+CODEC2_DIR
+CODEC2_INCLUDE
+CODEC2_LIB
 PBX_CAP
 CAP_DIR
 CAP_INCLUDE
@@ -1107,24 +1219,47 @@ PBX_ALSA
 ALSA_DIR
 ALSA_INCLUDE
 ALSA_LIB
+PJPROJECT_INCLUDE
+PJPROJECT_LIB
+PBX_PJPROJECT
+PJPROJECT_DIR
+PJPROJECT_BUNDLED
+PJPROJECT_CONFIGURE_OPTS
+AST_C_COMPILER_FAMILY
+AST_CLANG_BLOCKS
+AST_CLANG_BLOCKS_LIBS
+AST_NESTED_FUNCTIONS
 AST_CODE_COVERAGE
+EXTERNALS_CACHE_DIR
+SOUNDS_CACHE_DIR
+AST_DOWNLOAD_CACHE
 AST_DEVMODE_STRICT
 AST_DEVMODE
 NOISY_BUILD
 PTHREAD_CFLAGS
 PTHREAD_LIBS
 PTHREAD_CC
-acx_pthread_config
+ax_pthread_config
 MD5
 SOXMIX
+PBX_BASH
+PBX_XMLSTARLET
 PBX_FLEX
 PBX_BISON
 OPENSSL
 SHA1SUM
 LDCONFIG
+DOWNLOAD_TIMEOUT
+DOWNLOAD_TO_STDOUT
 DOWNLOAD
 FETCH
+NM
+PATCH
+TAR
+BZIP2
+ALEMBIC
 GIT
+BASH
 XMLSTARLET
 XMLLINT
 KPATHSEA
@@ -1141,6 +1276,8 @@ COMPRESS
 FIND
 PYTHON
 FLEX
+CUT
+CAT
 CMP
 BISON
 GNU_LD
@@ -1163,6 +1300,7 @@ LD
 CXX
 PBX_OSREV
 UNAME
+CONFIG_SIGNED_CHAR
 PBX_WINARCH
 OSARCH
 HOST_OS
@@ -1249,12 +1387,17 @@ ac_user_opts='
 enable_option_checking
 with_gnu_ld
 enable_dev_mode
+with_download_cache
+with_sounds_cache
+with_externals_cache
 enable_coverage
+with_pjproject_bundled
 with_asound
 with_bfd
 with_execinfo
 with_bluetooth
 with_cap
+with_codec2
 with_cpg
 with_curses
 with_crypt
@@ -1295,19 +1438,23 @@ with_netsnmp
 with_newt
 with_ogg
 with_openr2
+with_opus
+with_opusfile
 with_osptk
 with_oss
 with_postgres
+with_beanstalk
 with_pjproject
 with_popt
 with_portaudio
 with_pri
 with_pwlib
 with_radius
+with_fftw3
 with_resample
+with_sndfile
 with_sdl
 with_SDL_image
-with_sounds_cache
 with_spandsp
 with_ss7
 with_speex
@@ -1322,6 +1469,7 @@ with_termcap
 with_timerfd
 with_tinfo
 with_tonezone
+with_unbound
 with_unixodbc
 with_vorbis
 with_vpb
@@ -1346,6 +1494,7 @@ CXX
 CXXFLAGS
 CCC
 CXXCPP
+PJPROJECT_CONFIGURE_OPTS
 PKG_CONFIG
 PKG_CONFIG_PATH
 PKG_CONFIG_LIBDIR
@@ -1355,10 +1504,14 @@ LIBEDIT_CFLAGS
 LIBEDIT_LIBS
 PJPROJECT_CFLAGS
 PJPROJECT_LIBS
+PYTHONDEV_CFLAGS
+PYTHONDEV_LIBS
 GMIME_CFLAGS
 GMIME_LIBS
 GTK2_CFLAGS
-GTK2_LIBS'
+GTK2_LIBS
+SYSTEMD_CFLAGS
+SYSTEMD_LIBS'
 
 
 # Initialize some variables set by options.
@@ -1984,11 +2137,21 @@ Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
   --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
+  --with-download-cache=PATH
+                          use cached sound AND external module tarfiles in
+                          PATH
+  --with-sounds-cache=PATH
+                          use cached sound tarfiles in PATH
+  --with-externals-cache=PATH
+                          use cached external module tarfiles in PATH
+  --with-pjproject-bundled
+                          Use bundled pjproject libraries (default)
   --with-asound=PATH      use Advanced Linux Sound Architecture files in PATH
   --with-bfd=PATH         use Debug symbol decoding files in PATH
   --with-execinfo=PATH    use Stack Backtrace files in PATH
   --with-bluetooth=PATH   use Bluetooth files in PATH
   --with-cap=PATH         use POSIX 1.e capabilities files in PATH
+  --with-codec2=PATH      use Codec 2 Audio Decoder/Encoder 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
@@ -2015,7 +2178,8 @@ Optional Packages:
   --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-libcurl=PREFIX   look for the curl library in PREFIX/lib and headers
+                          in PREFIX/include
   --with-libedit=PATH     use NetBSD Editline library files in PATH, use
                           'internal' Editline otherwise
   --with-libxml2=PATH     use LibXML2 files in PATH
@@ -2032,20 +2196,23 @@ Optional Packages:
   --with-newt=PATH        use newt files in PATH
   --with-ogg=PATH         use OGG files in PATH
   --with-openr2=PATH      use MFR2 files in PATH
+  --with-opus=PATH        use Opus files in PATH
+  --with-opusfile=PATH    use Opusfile files in PATH
   --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-beanstalk=PATH   use Beanstalk Job Queue 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
   --with-pwlib=PATH       use PWlib files in PATH
   --with-radius=PATH      use Radius Client files in PATH
+  --with-fftw3=PATH       use LIBFFTW3 files in PATH
   --with-resample=PATH    use LIBRESAMPLE files in PATH
+  --with-sndfile=PATH     use libsndfile files in PATH
   --with-sdl=PATH         use Sdl files in PATH
   --with-SDL_image=PATH   use Sdl Image files in PATH
-  --with-sounds-cache=PATH
-                          use cached sound tarfiles in PATH
   --with-spandsp=PATH     use SPANDSP files in PATH
   --with-ss7=PATH         use ISDN SS7 files in PATH
   --with-speex=PATH       use Speex files in PATH
@@ -2061,6 +2228,7 @@ Optional Packages:
   --with-timerfd=PATH     use timerfd files in PATH
   --with-tinfo=PATH       use Term Info files in PATH
   --with-tonezone=PATH    use tonezone files in PATH
+  --with-unbound=PATH     use unbound files in PATH
   --with-unixodbc=PATH    use unixODBC files in PATH
   --with-vorbis=PATH      use Vorbis files in PATH
   --with-vpb=PATH         use Voicetronix API files in PATH
@@ -2079,6 +2247,8 @@ Some influential environment variables:
   CXX         C++ compiler command
   CXXFLAGS    C++ compiler flags
   CXXCPP      C++ preprocessor
+  PJPROJECT_CONFIGURE_OPTS
+              Additional configure options to pass to bundled pjproject
   PKG_CONFIG  path to pkg-config utility
   PKG_CONFIG_PATH
               directories to add to pkg-config's search path
@@ -2094,11 +2264,19 @@ Some influential environment variables:
               C compiler flags for PJPROJECT, overriding pkg-config
   PJPROJECT_LIBS
               linker flags for PJPROJECT, overriding pkg-config
+  PYTHONDEV_CFLAGS
+              C compiler flags for PYTHONDEV, overriding pkg-config
+  PYTHONDEV_LIBS
+              linker flags for PYTHONDEV, overriding pkg-config
   GMIME_CFLAGS
               C compiler flags for GMIME, overriding pkg-config
   GMIME_LIBS  linker flags for GMIME, overriding pkg-config
   GTK2_CFLAGS C compiler flags for GTK2, overriding pkg-config
   GTK2_LIBS   linker flags for GTK2, overriding pkg-config
+  SYSTEMD_CFLAGS
+              C compiler flags for SYSTEMD, overriding pkg-config
+  SYSTEMD_LIBS
+              linker flags for SYSTEMD, overriding pkg-config
 
 Use these variables to override the choices made by `configure' or to help
 it to find libraries and programs with nonstandard names/locations.
@@ -3532,37 +3710,6 @@ case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
 # check existence of the package
 
 
-ac_aux_dir=
-for ac_dir in `pwd` "$srcdir"/`pwd`; do
-  if test -f "$ac_dir/install-sh"; then
-    ac_aux_dir=$ac_dir
-    ac_install_sh="$ac_aux_dir/install-sh -c"
-    break
-  elif test -f "$ac_dir/install.sh"; then
-    ac_aux_dir=$ac_dir
-    ac_install_sh="$ac_aux_dir/install.sh -c"
-    break
-  elif test -f "$ac_dir/shtool"; then
-    ac_aux_dir=$ac_dir
-    ac_install_sh="$ac_aux_dir/shtool install -c"
-    break
-  fi
-done
-if test -z "$ac_aux_dir"; then
-  as_fn_error $? "cannot find install-sh, install.sh, or shtool in \`pwd\` \"$srcdir\"/\`pwd\`" "$LINENO" 5
-fi
-
-# These three variables are undocumented and unsupported,
-# and are intended to be withdrawn in a future Autoconf release.
-# They can cause serious problems if a builder's source tree is in a directory
-# whose full name contains unusual characters.
-ac_config_guess="$SHELL $ac_aux_dir/config.guess"  # Please don't use this var.
-ac_config_sub="$SHELL $ac_aux_dir/config.sub"  # Please don't use this var.
-ac_configure="$SHELL $ac_aux_dir/configure"  # Please don't use this var.
-
-
-
-
 
 
 # preserve any CFLAGS or LDFLAGS that may be set
@@ -4779,9 +4926,12 @@ case "${host_os}" in
      OSARCH=cygwin
      PBX_WINARCH=1
      ;;
-     linux-gnueabi* |  linux-gnuspe)
+     linux-gnu*)
      OSARCH=linux-gnu
      ;;
+     linux-musl*)
+     OSARCH=linux-musl
+     ;;
      kfreebsd*-gnu)
      OSARCH=kfreebsd-gnu
      ;;
@@ -4793,6 +4943,35 @@ esac
 
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether char is unsigned" >&5
+$as_echo_n "checking whether char is unsigned... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+               #include <limits.h>
+#if CHAR_MIN == 0
+#error
+#endif
+
+
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+               { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+               CONFIG_SIGNED_CHAR=""
+
+else
+
+               { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+               CONFIG_SIGNED_CHAR="-fsigned-char"
+
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+
 #  check for uname
 if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}uname", so it can be a program name with args.
@@ -6616,6 +6795,88 @@ $as_echo "no" >&6; }
 fi
 
 
+# Extract the first word of "cat", so it can be a program name with args.
+set dummy cat; 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_CAT+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $CAT in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_CAT="$CAT" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_CAT="$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_CAT" && ac_cv_path_CAT=":"
+  ;;
+esac
+fi
+CAT=$ac_cv_path_CAT
+if test -n "$CAT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CAT" >&5
+$as_echo "$CAT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+# Extract the first word of "cut", so it can be a program name with args.
+set dummy cut; 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_CUT+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $CUT in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_CUT="$CUT" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_CUT="$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_CUT" && ac_cv_path_CUT=":"
+  ;;
+esac
+fi
+CUT=$ac_cv_path_CUT
+if test -n "$CUT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CUT" >&5
+$as_echo "$CUT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
 # Extract the first word of "flex", so it can be a program name with args.
 set dummy flex; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
@@ -7313,8 +7574,10 @@ $as_echo "no" >&6; }
 fi
 
 
-# Extract the first word of "xmlstarlet", so it can be a program name with args.
-set dummy xmlstarlet; ac_word=$2
+for ac_prog in xmlstarlet xml
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; 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_XMLSTARLET+:} false; then :
@@ -7340,7 +7603,6 @@ done
   done
 IFS=$as_save_IFS
 
-  test -z "$ac_cv_path_XMLSTARLET" && ac_cv_path_XMLSTARLET=":"
   ;;
 esac
 fi
@@ -7354,6 +7616,51 @@ $as_echo "no" >&6; }
 fi
 
 
+  test -n "$XMLSTARLET" && break
+done
+test -n "$XMLSTARLET" || XMLSTARLET=":"
+
+# Extract the first word of "bash", so it can be a program name with args.
+set dummy bash; 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_BASH+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $BASH in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_BASH="$BASH" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_BASH="$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_BASH" && ac_cv_path_BASH=":"
+  ;;
+esac
+fi
+BASH=$ac_cv_path_BASH
+if test -n "$BASH"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BASH" >&5
+$as_echo "$BASH" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$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
@@ -7395,21 +7702,16 @@ $as_echo "no" >&6; }
 fi
 
 
-if test "${WGET}" != ":" ; then
-  DOWNLOAD=${WGET}
-else if test "${CURL}" != ":" ; then
-  DOWNLOAD="${CURL} -O --progress-bar -w \"%{url_effective}\n\""
-else
-  # Extract the first word of "fetch", so it can be a program name with args.
-set dummy fetch; ac_word=$2
+# Extract the first word of "alembic", so it can be a program name with args.
+set dummy alembic; 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_FETCH+:} false; then :
+if ${ac_cv_path_ALEMBIC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  case $FETCH in
+  case $ALEMBIC in
   [\\/]* | ?:[\\/]*)
-  ac_cv_path_FETCH="$FETCH" # Let the user override the test with a path.
+  ac_cv_path_ALEMBIC="$ALEMBIC" # Let the user override the test with a path.
   ;;
   *)
   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -7419,7 +7721,7 @@ do
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
   if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_FETCH="$as_dir/$ac_word$ac_exec_ext"
+    ac_cv_path_ALEMBIC="$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
@@ -7427,34 +7729,71 @@ done
   done
 IFS=$as_save_IFS
 
-  test -z "$ac_cv_path_FETCH" && ac_cv_path_FETCH=":"
+  test -z "$ac_cv_path_ALEMBIC" && ac_cv_path_ALEMBIC=":"
   ;;
 esac
 fi
-FETCH=$ac_cv_path_FETCH
-if test -n "$FETCH"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FETCH" >&5
-$as_echo "$FETCH" >&6; }
+ALEMBIC=$ac_cv_path_ALEMBIC
+if test -n "$ALEMBIC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ALEMBIC" >&5
+$as_echo "$ALEMBIC" >&6; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
-  DOWNLOAD=${FETCH}
+# Extract the first word of "bzip2", so it can be a program name with args.
+set dummy bzip2; 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_BZIP2+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $BZIP2 in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_BZIP2="$BZIP2" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_BZIP2="$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_BZIP2" && ac_cv_path_BZIP2=":"
+  ;;
+esac
 fi
+BZIP2=$ac_cv_path_BZIP2
+if test -n "$BZIP2"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BZIP2" >&5
+$as_echo "$BZIP2" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
-# Extract the first word of "ldconfig", so it can be a program name with args.
-set dummy ldconfig; ac_word=$2
+
+# Extract the first word of "tar", so it can be a program name with args.
+set dummy tar; 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_LDCONFIG+:} false; then :
+if ${ac_cv_path_TAR+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  case $LDCONFIG in
+  case $TAR in
   [\\/]* | ?:[\\/]*)
-  ac_cv_path_LDCONFIG="$LDCONFIG" # Let the user override the test with a path.
+  ac_cv_path_TAR="$TAR" # Let the user override the test with a path.
   ;;
   *)
   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -7464,7 +7803,7 @@ do
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
   if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_LDCONFIG="$as_dir/$ac_word$ac_exec_ext"
+    ac_cv_path_TAR="$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
@@ -7472,30 +7811,30 @@ done
   done
 IFS=$as_save_IFS
 
-  test -z "$ac_cv_path_LDCONFIG" && ac_cv_path_LDCONFIG=":"
+  test -z "$ac_cv_path_TAR" && ac_cv_path_TAR=":"
   ;;
 esac
 fi
-LDCONFIG=$ac_cv_path_LDCONFIG
-if test -n "$LDCONFIG"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LDCONFIG" >&5
-$as_echo "$LDCONFIG" >&6; }
+TAR=$ac_cv_path_TAR
+if test -n "$TAR"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TAR" >&5
+$as_echo "$TAR" >&6; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
-# Extract the first word of "sha1sum", so it can be a program name with args.
-set dummy sha1sum; ac_word=$2
+# Extract the first word of "patch", so it can be a program name with args.
+set dummy patch; 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_SHA1SUM+:} false; then :
+if ${ac_cv_path_PATCH+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  case $SHA1SUM in
+  case $PATCH in
   [\\/]* | ?:[\\/]*)
-  ac_cv_path_SHA1SUM="$SHA1SUM" # Let the user override the test with a path.
+  ac_cv_path_PATCH="$PATCH" # Let the user override the test with a path.
   ;;
   *)
   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -7505,7 +7844,7 @@ do
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
   if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_SHA1SUM="$as_dir/$ac_word$ac_exec_ext"
+    ac_cv_path_PATCH="$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
@@ -7513,30 +7852,30 @@ done
   done
 IFS=$as_save_IFS
 
-  test -z "$ac_cv_path_SHA1SUM" && ac_cv_path_SHA1SUM="$ac_aux_dir/build_tools/sha1sum-sh"
+  test -z "$ac_cv_path_PATCH" && ac_cv_path_PATCH=":"
   ;;
 esac
 fi
-SHA1SUM=$ac_cv_path_SHA1SUM
-if test -n "$SHA1SUM"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SHA1SUM" >&5
-$as_echo "$SHA1SUM" >&6; }
+PATCH=$ac_cv_path_PATCH
+if test -n "$PATCH"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PATCH" >&5
+$as_echo "$PATCH" >&6; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
-# Extract the first word of "openssl", so it can be a program name with args.
-set dummy openssl; ac_word=$2
+# Extract the first word of "sed", so it can be a program name with args.
+set dummy sed; 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_OPENSSL+:} false; then :
+if ${ac_cv_path_SED+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  case $OPENSSL in
+  case $SED in
   [\\/]* | ?:[\\/]*)
-  ac_cv_path_OPENSSL="$OPENSSL" # Let the user override the test with a path.
+  ac_cv_path_SED="$SED" # Let the user override the test with a path.
   ;;
   *)
   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -7546,7 +7885,7 @@ do
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
   if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_OPENSSL="$as_dir/$ac_word$ac_exec_ext"
+    ac_cv_path_SED="$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
@@ -7554,32 +7893,257 @@ done
   done
 IFS=$as_save_IFS
 
-  test -z "$ac_cv_path_OPENSSL" && ac_cv_path_OPENSSL=":"
+  test -z "$ac_cv_path_SED" && ac_cv_path_SED=":"
   ;;
 esac
 fi
-OPENSSL=$ac_cv_path_OPENSSL
-if test -n "$OPENSSL"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OPENSSL" >&5
-$as_echo "$OPENSSL" >&6; }
+SED=$ac_cv_path_SED
+if test -n "$SED"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SED" >&5
+$as_echo "$SED" >&6; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for bison that supports parse-param" >&5
-$as_echo_n "checking for bison that supports parse-param... " >&6; }
-if ${ac_cv_path_BISON2+:} false; then :
+# Extract the first word of "nm", so it can be a program name with args.
+set dummy nm; 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_NM+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-
-       if test "x$BISON" != "x:" ; then
-               # Create a temporary directory $tmp in $TMPDIR (default /tmp).
-               # Use mktemp if possible; otherwise fall back on mkdir,
-               # with $RANDOM to make collisions less likely.
-               : ${TMPDIR=/tmp}
+  case $NM in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_NM="$NM" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_NM="$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_NM" && ac_cv_path_NM=":"
+  ;;
+esac
+fi
+NM=$ac_cv_path_NM
+if test -n "$NM"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NM" >&5
+$as_echo "$NM" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+
+if test "${WGET}" != ":" ; then
+  DOWNLOAD=${WGET}
+  DOWNLOAD_TO_STDOUT="${WGET} -q -O-"
+  DOWNLOAD_TIMEOUT='--timeout=$1'
+else if test "${CURL}" != ":" ; then
+  DOWNLOAD="${CURL} -O --progress-bar -w \"%{url_effective}\n\""
+  DOWNLOAD_TO_STDOUT="${CURL} -Ls"
+  DOWNLOAD_TIMEOUT='--max-time $(or $2,$1)'
+else
+  # Extract the first word of "fetch", so it can be a program name with args.
+set dummy fetch; 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_FETCH+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $FETCH in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_FETCH="$FETCH" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_FETCH="$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_FETCH" && ac_cv_path_FETCH=":"
+  ;;
+esac
+fi
+FETCH=$ac_cv_path_FETCH
+if test -n "$FETCH"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FETCH" >&5
+$as_echo "$FETCH" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  DOWNLOAD=${FETCH}
+  DOWNLOAD_TO_STDOUT="${FETCH} -o-"
+  DOWNLOAD_TIMEOUT='--timeout=$(or $2,$1)'
+fi
+fi
+
+
+
+
+
+# Extract the first word of "ldconfig", so it can be a program name with args.
+set dummy ldconfig; 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_LDCONFIG+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $LDCONFIG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_LDCONFIG="$LDCONFIG" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_LDCONFIG="$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_LDCONFIG" && ac_cv_path_LDCONFIG=":"
+  ;;
+esac
+fi
+LDCONFIG=$ac_cv_path_LDCONFIG
+if test -n "$LDCONFIG"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LDCONFIG" >&5
+$as_echo "$LDCONFIG" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+# Extract the first word of "sha1sum", so it can be a program name with args.
+set dummy sha1sum; 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_SHA1SUM+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $SHA1SUM in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_SHA1SUM="$SHA1SUM" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_SHA1SUM="$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_SHA1SUM" && ac_cv_path_SHA1SUM="$ac_aux_dir/build_tools/sha1sum-sh"
+  ;;
+esac
+fi
+SHA1SUM=$ac_cv_path_SHA1SUM
+if test -n "$SHA1SUM"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SHA1SUM" >&5
+$as_echo "$SHA1SUM" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+# Extract the first word of "openssl", so it can be a program name with args.
+set dummy openssl; 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_OPENSSL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $OPENSSL in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_OPENSSL="$OPENSSL" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_OPENSSL="$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_OPENSSL" && ac_cv_path_OPENSSL=":"
+  ;;
+esac
+fi
+OPENSSL=$ac_cv_path_OPENSSL
+if test -n "$OPENSSL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OPENSSL" >&5
+$as_echo "$OPENSSL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for bison that supports parse-param" >&5
+$as_echo_n "checking for bison that supports parse-param... " >&6; }
+if ${ac_cv_path_BISON2+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+       if test "x$BISON" != "x:" ; then
+               # Create a temporary directory $tmp in $TMPDIR (default /tmp).
+               # Use mktemp if possible; otherwise fall back on mkdir,
+               # with $RANDOM to make collisions less likely.
+               : ${TMPDIR=/tmp}
                {
                  tmp=`
                    (umask 077 && mktemp -d "$TMPDIR/fooXXXXXX") 2>/dev/null
@@ -7620,6 +8184,20 @@ else
 fi
 
 
+if test "x${XMLSTARLET}" = "x:" ; then
+       PBX_XMLSTARLET=0
+else
+       PBX_XMLSTARLET=1
+fi
+
+
+if test "x${BASH}" = "x:" ; then
+       PBX_BASH=0
+else
+       PBX_BASH=1
+fi
+
+
 if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}soxmix", so it can be a program name with args.
 set dummy ${ac_tool_prefix}soxmix; ac_word=$2
@@ -7765,62 +8343,137 @@ if test "${MD5}" = "digest" ; then
    MD5="${MD5} -a md5"
 fi
 
-
-
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-acx_pthread_ok=no
-
-# We used to check for pthread.h first, but this fails if pthread.h
-# requires special compiler flags (e.g. on True64 or Sequent).
-# It gets checked for in the link test anyway.
-
-# First of all, check if the user has set any of the PTHREAD_LIBS,
-# etcetera environment variables, and if threads linking works using
-# them:
-if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
-        save_CFLAGS="$CFLAGS"
-        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
-        save_LIBS="$LIBS"
-        LIBS="$PTHREAD_LIBS $LIBS"
-        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS" >&5
-$as_echo_n "checking for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS... " >&6; }
-        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 pthread_join ();
-int
-main ()
-{
-return pthread_join ();
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
+$as_echo_n "checking for a sed that does not truncate output... " >&6; }
+if ${ac_cv_path_SED+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+            ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
+     for ac_i in 1 2 3 4 5 6 7; do
+       ac_script="$ac_script$as_nl$ac_script"
+     done
+     echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed
+     { ac_script=; unset ac_script;}
+     if test -z "$SED"; then
+  ac_path_SED_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  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_prog in sed gsed; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
+      as_fn_executable_p "$ac_path_SED" || continue
+# Check for GNU ac_path_SED and select it if it is found.
+  # Check for GNU $ac_path_SED
+case `"$ac_path_SED" --version 2>&1` in
+*GNU*)
+  ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo '' >> "conftest.nl"
+    "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_SED_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_SED="$ac_path_SED"
+      ac_path_SED_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+      $ac_path_SED_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_SED"; then
+    as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5
+  fi
+else
+  ac_cv_path_SED=$SED
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5
+$as_echo "$ac_cv_path_SED" >&6; }
+ SED="$ac_cv_path_SED"
+  rm -f conftest.sed
+
+
+
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ax_pthread_ok=no
+
+# We used to check for pthread.h first, but this fails if pthread.h
+# requires special compiler flags (e.g. on Tru64 or Sequent).
+# It gets checked for in the link test anyway.
+
+# First of all, check if the user has set any of the PTHREAD_LIBS,
+# etcetera environment variables, and if threads linking works using
+# them:
+if test "x$PTHREAD_CFLAGS$PTHREAD_LIBS" != "x"; then
+        ax_pthread_save_CC="$CC"
+        ax_pthread_save_CFLAGS="$CFLAGS"
+        ax_pthread_save_LIBS="$LIBS"
+        if test "x$PTHREAD_CC" != "x"; then :
+  CC="$PTHREAD_CC"
+fi
+        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+        LIBS="$PTHREAD_LIBS $LIBS"
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS" >&5
+$as_echo_n "checking for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS... " >&6; }
+        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 pthread_join ();
+int
+main ()
+{
+return pthread_join ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  acx_pthread_ok=yes
+  ax_pthread_ok=yes
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_pthread_ok" >&5
-$as_echo "$acx_pthread_ok" >&6; }
-        if test x"$acx_pthread_ok" = xno; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_pthread_ok" >&5
+$as_echo "$ax_pthread_ok" >&6; }
+        if test "x$ax_pthread_ok" = "xno"; then
                 PTHREAD_LIBS=""
                 PTHREAD_CFLAGS=""
         fi
-        LIBS="$save_LIBS"
-        CFLAGS="$save_CFLAGS"
+        CC="$ax_pthread_save_CC"
+        CFLAGS="$ax_pthread_save_CFLAGS"
+        LIBS="$ax_pthread_save_LIBS"
 fi
 
 # We must check for the threads library under a number of different
@@ -7833,7 +8486,7 @@ fi
 # which indicates that we try without any flags at all, and "pthread-config"
 # which is a program returning the flags for the Pth emulation library.
 
-acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
+ax_pthread_flags="pthreads none -Kthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
 
 # The ordering *is* (sometimes) important.  Some notes on the
 # individual items follow:
@@ -7842,59 +8495,269 @@ acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -m
 # none: in case threads are in libc; should be tried before -Kthread and
 #       other compiler flags to prevent continual compiler warnings
 # -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
-# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
-# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
-# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
-# -pthreads: Solaris/gcc
-# -mthreads: Mingw32/gcc, Lynx/gcc
+# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads), Tru64
+#           (Note: HP C rejects this with "bad form for `-t' option")
+# -pthreads: Solaris/gcc (Note: HP C also rejects)
 # -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
-#      doesn't hurt to check since this sometimes defines pthreads too;
-#      also defines -D_REENTRANT)
-#      ... -mt is also the pthreads flag for HP/aCC
+#      doesn't hurt to check since this sometimes defines pthreads and
+#      -D_REENTRANT too), HP C (must be checked before -lpthread, which
+#      is present but should not be used directly; and before -mthreads,
+#      because the compiler interprets this as "-mt" + "-hreads")
+# -mthreads: Mingw32/gcc, Lynx/gcc
 # pthread: Linux, etcetera
 # --thread-safe: KAI C++
 # pthread-config: use pthread-config program (for GNU Pth library)
 
-case "${host_cpu}-${host_os}" in
-        *solaris*)
+case $host_os in
+
+        freebsd*)
+
+        # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
+        # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
+
+        ax_pthread_flags="-kthread lthread $ax_pthread_flags"
+        ;;
+
+        hpux*)
+
+        # From the cc(1) man page: "[-mt] Sets various -D flags to enable
+        # multi-threading and also sets -lpthread."
+
+        ax_pthread_flags="-mt -pthread pthread $ax_pthread_flags"
+        ;;
+
+        openedition*)
+
+        # IBM z/OS requires a feature-test macro to be defined in order to
+        # enable POSIX threads at all, so give the user a hint if this is
+        # not set. (We don't define these ourselves, as they can affect
+        # other portions of the system API in unpredictable ways.)
+
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#            if !defined(_OPEN_THREADS) && !defined(_UNIX03_THREADS)
+             AX_PTHREAD_ZOS_MISSING
+#            endif
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "AX_PTHREAD_ZOS_MISSING" >/dev/null 2>&1; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support." >&5
+$as_echo "$as_me: WARNING: IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support." >&2;}
+fi
+rm -f conftest*
+
+        ;;
+
+        solaris*)
 
         # On Solaris (at least, for some versions), libc contains stubbed
         # (non-functional) versions of the pthreads routines, so link-based
-        # tests will erroneously succeed.  (We need to link with -pthreads/-mt/
-        # -lpthread.)  (The stubs are missing pthread_cleanup_push, or rather
-        # a function called by this macro, so we could check for that, but
-        # who knows whether they'll stub that too in a future libc.)  So,
-        # we'll just look for -pthreads and -lpthread first:
+        # tests will erroneously succeed. (N.B.: The stubs are missing
+        # pthread_cleanup_push, or rather a function called by this macro,
+        # so we could check for that, but who knows whether they'll stub
+        # that too in a future libc.)  So we'll check first for the
+        # standard Solaris way of linking pthreads (-mt -lpthread).
+
+        ax_pthread_flags="-mt,pthread pthread $ax_pthread_flags"
+        ;;
+esac
 
-        acx_pthread_flags="-pthreads pthread -mt -pthread $acx_pthread_flags"
+# GCC generally uses -pthread, or -pthreads on some platforms (e.g. SPARC)
+
+if test "x$GCC" = "xyes"; then :
+  ax_pthread_flags="-pthread -pthreads $ax_pthread_flags"
+fi
+
+# The presence of a feature test macro requesting re-entrant function
+# definitions is, on some systems, a strong hint that pthreads support is
+# correctly enabled
+
+case $host_os in
+        darwin* | hpux* | linux* | osf* | solaris*)
+        ax_pthread_check_macro="_REENTRANT"
+        ;;
+
+        aix*)
+        ax_pthread_check_macro="_THREAD_SAFE"
+        ;;
+
+        *)
+        ax_pthread_check_macro="--"
         ;;
 esac
+if test "x$ax_pthread_check_macro" = "x--"; then :
+  ax_pthread_check_cond=0
+else
+  ax_pthread_check_cond="!defined($ax_pthread_check_macro)"
+fi
+
+# Are we compiling with Clang?
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC is Clang" >&5
+$as_echo_n "checking whether $CC is Clang... " >&6; }
+if ${ax_cv_PTHREAD_CLANG+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ax_cv_PTHREAD_CLANG=no
+     # Note that Autoconf sets GCC=yes for Clang as well as GCC
+     if test "x$GCC" = "xyes"; then
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+/* Note: Clang 2.7 lacks __clang_[a-z]+__ */
+#            if defined(__clang__) && defined(__llvm__)
+             AX_PTHREAD_CC_IS_CLANG
+#            endif
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "AX_PTHREAD_CC_IS_CLANG" >/dev/null 2>&1; then :
+  ax_cv_PTHREAD_CLANG=yes
+fi
+rm -f conftest*
+
+     fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_CLANG" >&5
+$as_echo "$ax_cv_PTHREAD_CLANG" >&6; }
+ax_pthread_clang="$ax_cv_PTHREAD_CLANG"
+
+ax_pthread_clang_warning=no
+
+# Clang needs special handling, because older versions handle the -pthread
+# option in a rather... idiosyncratic way
+
+if test "x$ax_pthread_clang" = "xyes"; then
+
+        # Clang takes -pthread; it has never supported any other flag
+
+        # (Note 1: This will need to be revisited if a system that Clang
+        # supports has POSIX threads in a separate library.  This tends not
+        # to be the way of modern systems, but it's conceivable.)
+
+        # (Note 2: On some systems, notably Darwin, -pthread is not needed
+        # to get POSIX threads support; the API is always present and
+        # active.  We could reasonably leave PTHREAD_CFLAGS empty.  But
+        # -pthread does define _REENTRANT, and while the Darwin headers
+        # ignore this macro, third-party headers might not.)
+
+        PTHREAD_CFLAGS="-pthread"
+        PTHREAD_LIBS=
+
+        ax_pthread_ok=yes
+
+        # However, older versions of Clang make a point of warning the user
+        # that, in an invocation where only linking and no compilation is
+        # taking place, the -pthread option has no effect ("argument unused
+        # during compilation").  They expect -pthread to be passed in only
+        # when source code is being compiled.
+        #
+        # Problem is, this is at odds with the way Automake and most other
+        # C build frameworks function, which is that the same flags used in
+        # compilation (CFLAGS) are also used in linking.  Many systems
+        # supported by AX_PTHREAD require exactly this for POSIX threads
+        # support, and in fact it is often not straightforward to specify a
+        # flag that is used only in the compilation phase and not in
+        # linking.  Such a scenario is extremely rare in practice.
+        #
+        # Even though use of the -pthread flag in linking would only print
+        # a warning, this can be a nuisance for well-run software projects
+        # that build with -Werror.  So if the active version of Clang has
+        # this misfeature, we search for an option to squash it.
+
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether Clang needs flag to prevent \"argument unused\" warning when linking with -pthread" >&5
+$as_echo_n "checking whether Clang needs flag to prevent \"argument unused\" warning when linking with -pthread... " >&6; }
+if ${ax_cv_PTHREAD_CLANG_NO_WARN_FLAG+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ax_cv_PTHREAD_CLANG_NO_WARN_FLAG=unknown
+             # Create an alternate version of $ac_link that compiles and
+             # links in two steps (.c -> .o, .o -> exe) instead of one
+             # (.c -> exe), because the warning occurs only in the second
+             # step
+             ax_pthread_save_ac_link="$ac_link"
+             ax_pthread_sed='s/conftest\.\$ac_ext/conftest.$ac_objext/g'
+             ax_pthread_link_step=`$as_echo "$ac_link" | sed "$ax_pthread_sed"`
+             ax_pthread_2step_ac_link="($ac_compile) && (echo ==== >&5) && ($ax_pthread_link_step)"
+             ax_pthread_save_CFLAGS="$CFLAGS"
+             for ax_pthread_try in '' -Qunused-arguments -Wno-unused-command-line-argument unknown; do
+                if test "x$ax_pthread_try" = "xunknown"; then :
+  break
+fi
+                CFLAGS="-Werror -Wunknown-warning-option $ax_pthread_try -pthread $ax_pthread_save_CFLAGS"
+                ac_link="$ax_pthread_save_ac_link"
+                cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+int main(void){return 0;}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_link="$ax_pthread_2step_ac_link"
+                     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+int main(void){return 0;}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  break
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+             done
+             ac_link="$ax_pthread_save_ac_link"
+             CFLAGS="$ax_pthread_save_CFLAGS"
+             if test "x$ax_pthread_try" = "x"; then :
+  ax_pthread_try=no
+fi
+             ax_cv_PTHREAD_CLANG_NO_WARN_FLAG="$ax_pthread_try"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" >&5
+$as_echo "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" >&6; }
+
+        case "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" in
+                no | unknown) ;;
+                *) PTHREAD_CFLAGS="$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG $PTHREAD_CFLAGS" ;;
+        esac
+
+fi # $ax_pthread_clang = yes
 
-if test x"$acx_pthread_ok" = xno; then
-for flag in $acx_pthread_flags; do
+if test "x$ax_pthread_ok" = "xno"; then
+for ax_pthread_try_flag in $ax_pthread_flags; do
 
-        case $flag in
+        case $ax_pthread_try_flag in
                 none)
                 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads work without any flags" >&5
 $as_echo_n "checking whether pthreads work without any flags... " >&6; }
                 ;;
 
+                -mt,pthread)
+                { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads work with -mt -lpthread" >&5
+$as_echo_n "checking whether pthreads work with -mt -lpthread... " >&6; }
+                PTHREAD_CFLAGS="-mt"
+                PTHREAD_LIBS="-lpthread"
+                ;;
+
                 -*)
-                { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads work with $flag" >&5
-$as_echo_n "checking whether pthreads work with $flag... " >&6; }
-                PTHREAD_CFLAGS="$flag"
+                { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads work with $ax_pthread_try_flag" >&5
+$as_echo_n "checking whether pthreads work with $ax_pthread_try_flag... " >&6; }
+                PTHREAD_CFLAGS="$ax_pthread_try_flag"
                 ;;
 
-               pthread-config)
-               # Extract the first word of "pthread-config", so it can be a program name with args.
+                pthread-config)
+                # Extract the first word of "pthread-config", so it can be a program name with args.
 set dummy pthread-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_prog_acx_pthread_config+:} false; then :
+if ${ac_cv_prog_ax_pthread_config+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  if test -n "$acx_pthread_config"; then
-  ac_cv_prog_acx_pthread_config="$acx_pthread_config" # Let the user override the test.
+  if test -n "$ax_pthread_config"; then
+  ac_cv_prog_ax_pthread_config="$ax_pthread_config" # Let the user override the test.
 else
 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
@@ -7903,7 +8766,7 @@ do
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
   if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_acx_pthread_config="yes"
+    ac_cv_prog_ax_pthread_config="yes"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
@@ -7911,35 +8774,37 @@ done
   done
 IFS=$as_save_IFS
 
-  test -z "$ac_cv_prog_acx_pthread_config" && ac_cv_prog_acx_pthread_config="no"
+  test -z "$ac_cv_prog_ax_pthread_config" && ac_cv_prog_ax_pthread_config="no"
 fi
 fi
-acx_pthread_config=$ac_cv_prog_acx_pthread_config
-if test -n "$acx_pthread_config"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_pthread_config" >&5
-$as_echo "$acx_pthread_config" >&6; }
+ax_pthread_config=$ac_cv_prog_ax_pthread_config
+if test -n "$ax_pthread_config"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_pthread_config" >&5
+$as_echo "$ax_pthread_config" >&6; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
-               if test x"$acx_pthread_config" = xno; then continue; fi
-               PTHREAD_CFLAGS="`pthread-config --cflags`"
-               PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
-               ;;
+                if test "x$ax_pthread_config" = "xno"; then :
+  continue
+fi
+                PTHREAD_CFLAGS="`pthread-config --cflags`"
+                PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
+                ;;
 
                 *)
-                { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the pthreads library -l$flag" >&5
-$as_echo_n "checking for the pthreads library -l$flag... " >&6; }
-                PTHREAD_LIBS="-l$flag"
+                { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the pthreads library -l$ax_pthread_try_flag" >&5
+$as_echo_n "checking for the pthreads library -l$ax_pthread_try_flag... " >&6; }
+                PTHREAD_LIBS="-l$ax_pthread_try_flag"
                 ;;
         esac
 
-        save_LIBS="$LIBS"
-        save_CFLAGS="$CFLAGS"
-        LIBS="$PTHREAD_LIBS $LIBS"
+        ax_pthread_save_CFLAGS="$CFLAGS"
+        ax_pthread_save_LIBS="$LIBS"
         CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+        LIBS="$PTHREAD_LIBS $LIBS"
 
         # Check for various functions.  We must include pthread.h,
         # since some functions may be macros.  (On the Sequent, we
@@ -7950,33 +8815,42 @@ $as_echo_n "checking for the pthreads library -l$flag... " >&6; }
         # pthread_cleanup_push because it is one of the few pthread
         # functions on Solaris that doesn't have a non-functional libc stub.
         # We try pthread_create on general principles.
+
         cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <pthread.h>
+#                       if $ax_pthread_check_cond
+#                        error "$ax_pthread_check_macro must be defined"
+#                       endif
+                        static void routine(void *a) { a = 0; }
+                        static void *start_routine(void *a) { return a; }
 int
 main ()
 {
-pthread_t th; pthread_join(th, 0);
-                     pthread_attr_init(0); pthread_cleanup_push(0, 0);
-                     pthread_create(0,0,0,0); pthread_cleanup_pop(0);
+pthread_t th; pthread_attr_t attr;
+                        pthread_create(&th, 0, start_routine, 0);
+                        pthread_join(th, 0);
+                        pthread_attr_init(&attr);
+                        pthread_cleanup_push(routine, 0);
+                        pthread_cleanup_pop(0) /* ; */
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  acx_pthread_ok=yes
+  ax_pthread_ok=yes
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 
-        LIBS="$save_LIBS"
-        CFLAGS="$save_CFLAGS"
+        CFLAGS="$ax_pthread_save_CFLAGS"
+        LIBS="$ax_pthread_save_LIBS"
 
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_pthread_ok" >&5
-$as_echo "$acx_pthread_ok" >&6; }
-        if test "x$acx_pthread_ok" = xyes; then
-                break;
-        fi
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_pthread_ok" >&5
+$as_echo "$ax_pthread_ok" >&6; }
+        if test "x$ax_pthread_ok" = "xyes"; then :
+  break
+fi
 
         PTHREAD_LIBS=""
         PTHREAD_CFLAGS=""
@@ -7984,63 +8858,127 @@ done
 fi
 
 # Various other checks:
-if test "x$acx_pthread_ok" = xyes; then
-        save_LIBS="$LIBS"
-        LIBS="$PTHREAD_LIBS $LIBS"
-        save_CFLAGS="$CFLAGS"
+if test "x$ax_pthread_ok" = "xyes"; then
+        ax_pthread_save_CFLAGS="$CFLAGS"
+        ax_pthread_save_LIBS="$LIBS"
         CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+        LIBS="$PTHREAD_LIBS $LIBS"
 
         # Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
-       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for joinable pthread attribute" >&5
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for joinable pthread attribute" >&5
 $as_echo_n "checking for joinable pthread attribute... " >&6; }
-       attr_name=unknown
-       for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
-           cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+if ${ax_cv_PTHREAD_JOINABLE_ATTR+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ax_cv_PTHREAD_JOINABLE_ATTR=unknown
+             for ax_pthread_attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
+                 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <pthread.h>
 int
 main ()
 {
-int attr=$attr; return attr;
+int attr = $ax_pthread_attr; return attr /* ; */
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  attr_name=$attr; break
+  ax_cv_PTHREAD_JOINABLE_ATTR=$ax_pthread_attr; break
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-       done
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $attr_name" >&5
-$as_echo "$attr_name" >&6; }
-        if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
+             done
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_JOINABLE_ATTR" >&5
+$as_echo "$ax_cv_PTHREAD_JOINABLE_ATTR" >&6; }
+        if test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xunknown" && \
+               test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xPTHREAD_CREATE_JOINABLE" && \
+               test "x$ax_pthread_joinable_attr_defined" != "xyes"; then :
 
 cat >>confdefs.h <<_ACEOF
-#define PTHREAD_CREATE_JOINABLE $attr_name
+#define PTHREAD_CREATE_JOINABLE $ax_cv_PTHREAD_JOINABLE_ATTR
 _ACEOF
 
-        fi
+               ax_pthread_joinable_attr_defined=yes
 
-        { $as_echo "$as_me:${as_lineno-$LINENO}: checking if more special flags are required for pthreads" >&5
-$as_echo_n "checking if more special flags are required for pthreads... " >&6; }
-        flag=no
-        case "${host_cpu}-${host_os}" in
-            *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";;
-            *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
-        esac
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${flag}" >&5
-$as_echo "${flag}" >&6; }
-        if test "x$flag" != xno; then
-            PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
-        fi
+fi
+
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether more special flags are required for pthreads" >&5
+$as_echo_n "checking whether more special flags are required for pthreads... " >&6; }
+if ${ax_cv_PTHREAD_SPECIAL_FLAGS+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ax_cv_PTHREAD_SPECIAL_FLAGS=no
+             case $host_os in
+             solaris*)
+             ax_cv_PTHREAD_SPECIAL_FLAGS="-D_POSIX_PTHREAD_SEMANTICS"
+             ;;
+             esac
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_SPECIAL_FLAGS" >&5
+$as_echo "$ax_cv_PTHREAD_SPECIAL_FLAGS" >&6; }
+        if test "x$ax_cv_PTHREAD_SPECIAL_FLAGS" != "xno" && \
+               test "x$ax_pthread_special_flags_added" != "xyes"; then :
+  PTHREAD_CFLAGS="$ax_cv_PTHREAD_SPECIAL_FLAGS $PTHREAD_CFLAGS"
+               ax_pthread_special_flags_added=yes
+fi
+
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PTHREAD_PRIO_INHERIT" >&5
+$as_echo_n "checking for PTHREAD_PRIO_INHERIT... " >&6; }
+if ${ax_cv_PTHREAD_PRIO_INHERIT+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <pthread.h>
+int
+main ()
+{
+int i = PTHREAD_PRIO_INHERIT;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ax_cv_PTHREAD_PRIO_INHERIT=yes
+else
+  ax_cv_PTHREAD_PRIO_INHERIT=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_PRIO_INHERIT" >&5
+$as_echo "$ax_cv_PTHREAD_PRIO_INHERIT" >&6; }
+        if test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes" && \
+               test "x$ax_pthread_prio_inherit_defined" != "xyes"; then :
 
-        LIBS="$save_LIBS"
-        CFLAGS="$save_CFLAGS"
+$as_echo "#define HAVE_PTHREAD_PRIO_INHERIT 1" >>confdefs.h
 
-        # More AIX lossage: must compile with xlc_r or cc_r
-       if test x"$GCC" != xyes; then
-          for ac_prog in xlc_r cc_r
+               ax_pthread_prio_inherit_defined=yes
+
+fi
+
+        CFLAGS="$ax_pthread_save_CFLAGS"
+        LIBS="$ax_pthread_save_LIBS"
+
+        # More AIX lossage: compile with *_r variant
+        if test "x$GCC" != "xyes"; then
+            case $host_os in
+                aix*)
+                case "x/$CC" in #(
+  x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6) :
+    #handle absolute path differently from PATH based program lookup
+                     case "x$CC" in #(
+  x/*) :
+    if as_fn_executable_p ${CC}_r; then :
+  PTHREAD_CC="${CC}_r"
+fi ;; #(
+  *) :
+    for ac_prog in ${CC}_r
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
@@ -8081,27 +9019,31 @@ fi
 
   test -n "$PTHREAD_CC" && break
 done
-test -n "$PTHREAD_CC" || PTHREAD_CC="${CC}"
-
-        else
-          PTHREAD_CC=$CC
-       fi
-else
-        PTHREAD_CC="$CC"
+test -n "$PTHREAD_CC" || PTHREAD_CC="$CC"
+ ;;
+esac ;; #(
+  *) :
+     ;;
+esac
+                ;;
+            esac
+        fi
 fi
 
+test -n "$PTHREAD_CC" || PTHREAD_CC="$CC"
+
 
 
 
 
 # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
-if test x"$acx_pthread_ok" = xyes; then
+if test "x$ax_pthread_ok" = "xyes"; then
 
 $as_echo "#define HAVE_PTHREAD 1" >>confdefs.h
 
         :
 else
-        acx_pthread_ok=no
+        ax_pthread_ok=no
 
 fi
 ac_ext=c
 
 
 
-AST_CODE_COVERAGE=no
-# Check whether --enable-coverage was given.
-if test "${enable_coverage+set}" = set; then :
-  enableval=$enable_coverage; case "${enableval}" in
-             y|ye|yes) AST_CODE_COVERAGE=yes ;;
-             n|no) AST_CODE_COVERAGE=no ;;
-             *) as_fn_error $? "bad value ${enableval} for --enable-coverage" "$LINENO" 5  ;;
-       esac
-fi
-
 
 
-# AST_EXT_LIB_SETUP is used to tell configure to handle variables for
-# various packages.
-# $1 is the prefix for the variables in makeopts and autoconfig.h
-# $2 is the short comment, $4 is the long comment
-# $3 is the name used in --with- or --without- flags for configure.
-#
+# Check whether --with-download-cache was given.
+if test "${with_download_cache+set}" = set; then :
+  withval=$with_download_cache;
+       case ${withval} in
+       n|no)
+               unset AST_DOWNLOAD_CACHE
+               ;;
+       *)
+               if test "x${withval}" = "x"; then
+                       :
+               else
+                       AST_DOWNLOAD_CACHE="${withval}"
+               fi
+               ;;
+       esac
+
+else
+  :
+fi
+
+
+
+
+
+# Check whether --with-sounds-cache was given.
+if test "${with_sounds_cache+set}" = set; then :
+  withval=$with_sounds_cache;
+       case ${withval} in
+       n|no)
+               unset SOUNDS_CACHE_DIR
+               ;;
+       *)
+               if test "x${withval}" = "x"; then
+                       :
+               else
+                       SOUNDS_CACHE_DIR="${withval}"
+               fi
+               ;;
+       esac
+
+else
+  :
+fi
+
+
+
+
+
+# Check whether --with-externals-cache was given.
+if test "${with_externals_cache+set}" = set; then :
+  withval=$with_externals_cache;
+       case ${withval} in
+       n|no)
+               unset EXTERNALS_CACHE_DIR
+               ;;
+       *)
+               if test "x${withval}" = "x"; then
+                       :
+               else
+                       EXTERNALS_CACHE_DIR="${withval}"
+               fi
+               ;;
+       esac
+
+else
+  :
+fi
+
+
+
+
+AST_CODE_COVERAGE=no
+# Check whether --enable-coverage was given.
+if test "${enable_coverage+set}" = set; then :
+  enableval=$enable_coverage; case "${enableval}" in
+             y|ye|yes) AST_CODE_COVERAGE=yes ;;
+             n|no) AST_CODE_COVERAGE=no ;;
+             *) as_fn_error $? "bad value ${enableval} for --enable-coverage" "$LINENO" 5  ;;
+       esac
+fi
+
+
+
+
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for RAII support" >&5
+$as_echo_n "checking for RAII support... " >&6; }
+       AST_C_COMPILER_FAMILY=""
+       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+                       int main() {
+                               #if defined(__clang__)
+                               choke
+                               #endif
+                               return 0;
+                       }
+
+  ;
+  return 0;
+}
+
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+                                               { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gcc -fnested-functions" >&5
+$as_echo_n "checking for gcc -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 :
+
+                                       AST_NESTED_FUNCTIONS=""
+                                       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+else
+
+                                       AST_NESTED_FUNCTIONS="-fnested-functions"
+                                       { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+                       AST_C_COMPILER_FAMILY="gcc"
+
+else
+
+                       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for clang -fblocks" >&5
+$as_echo_n "checking for clang -fblocks... " >&6; }
+                       if test "`echo "int main(){return ^{return 42;}();}" | ${CC} -o /dev/null -fblocks -x c - 2>&1`" = ""; then
+                               AST_CLANG_BLOCKS_LIBS=""
+                               AST_CLANG_BLOCKS="-Wno-unknown-warning-option -fblocks"
+                               { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+                       elif test "`echo "int main(){return ^{return 42;}();}" | ${CC} -o /dev/null -fblocks -x c -lBlocksRuntime - 2>&1`" = ""; then
+                               AST_CLANG_BLOCKS_LIBS="-lBlocksRuntime"
+                               AST_CLANG_BLOCKS="-fblocks"
+                               { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+                       else
+                               as_fn_error $? "BlocksRuntime is required for clang, please install libblocksruntime" "$LINENO" 5
+                       fi
+
+
+                       AST_C_COMPILER_FAMILY="clang"
+
+
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+       if test -z "${AST_C_COMPILER_FAMILY}"; then
+               as_fn_error $? "Compiler ${CC} not supported. Mminimum required gcc-4.3 / llvm-gcc-4.3 / clang-3.3 + libblocksruntime-dev" "$LINENO" 5
+       fi
+
+
+
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for clang strsep/strcmp optimization" >&5
+$as_echo_n "checking for clang strsep/strcmp optimization... " >&6; }
+       save_CFLAGS="$CFLAGS"
+       CFLAGS="$CFLAGS -O1 -Werror=array-bounds"
+       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+
+                               #include <stdio.h>
+                               #include <string.h>
+
+                               /* fails with clang and -O1 */
+                               void test_strsep_strcmp (void) {
+                                       char *haystackstr = "test1,test2";
+                                       char *outstr;
+                                       if (!strcmp(haystackstr, ",")) {
+                                               printf("fail\n");
+                                       }
+                                       if ((outstr = strsep(&haystackstr, ","))) {
+                                               printf("fail:%s\n", outstr);
+                                       }
+                               }
+                               int main(int argc, char *argv) {
+                                       test_strsep_strcmp();
+                                       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; }
+
+else
+
+
+$as_echo "#define _HAVE_STRING_ARCH_strcmp 1" >>confdefs.h
+
+
+$as_echo "#define _HAVE_STRING_ARCH_strsep 1" >>confdefs.h
+
+                       { $as_echo "$as_me:${as_lineno-$LINENO}: result: prevent use of __string2_1bptr_p / strsep / strcmp from bits/string2.h" >&5
+$as_echo "prevent use of __string2_1bptr_p / strsep / strcmp from bits/string2.h" >&6; }
+
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+       CFLAGS="$save_CFLAGS"
+
+
+PJPROJECT_BUNDLED=yes
+
+
+
+# Check whether --with-pjproject-bundled was given.
+if test "${with_pjproject_bundled+set}" = set; then :
+  withval=$with_pjproject_bundled; case "${withval}" in
+             n|no) PJPROJECT_BUNDLED=no ;;
+             *) PJPROJECT_BUNDLED=yes ;;
+       esac
+fi
+
+
+
+
+       if test "$PJPROJECT_BUNDLED" = "yes" ; then
+
+       if test "${ac_mandatory_list#*PJPROJECT*}" != "$ac_mandatory_list" ; then
+               as_fn_error $? "--with-pjproject and --with-pjproject-bundled can't both be specified" "$LINENO" 5
+       fi
+
+       ac_mandatory_list="$ac_mandatory_list PJPROJECT"
+       PJPROJECT_DIR="${ac_top_build_prefix}third-party/pjproject"
+
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for embedded pjproject (may have to download)" >&5
+$as_echo_n "checking for embedded pjproject (may have to download)... " >&6; }
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: configuring" >&5
+$as_echo "configuring" >&6; }
+
+       if test "x${DOWNLOAD_TO_STDOUT}" = "x" ; then
+               as_fn_error $? "A download utility (wget, curl or fetch) is required to download bundled pjproject" "$LINENO" 5
+       fi
+       if test "${BZIP2}" = ":" ; then
+               as_fn_error $? "bzip2 is required to extract the pjproject tar file" "$LINENO" 5
+       fi
+       if test "${TAR}" = ":" ; then
+               as_fn_error $? "tar is required to extract the pjproject tar file" "$LINENO" 5
+       fi
+       if test "${PATCH}" = ":" ; then
+               as_fn_error $? "patch is required to configure bundled pjproject" "$LINENO" 5
+       fi
+       if test "${SED}" = ":" ; then
+               as_fn_error $? "sed is required to configure bundled pjproject" "$LINENO" 5
+       fi
+       if test "${NM}" = ":" ; then
+               as_fn_error $? "nm is required to build bundled pjproject" "$LINENO" 5
+       fi
+       if test "${MD5}" = ":" ; then
+               as_fn_error $? "md5sum is required to build bundled pjproject" "$LINENO" 5
+       fi
+       if test "${CAT}" = ":" ; then
+               as_fn_error $? "cat is required to build bundled pjproject" "$LINENO" 5
+       fi
+       if test "${CUT}" = ":" ; then
+               as_fn_error $? "cut is required to build bundled pjproject" "$LINENO" 5
+       fi
+       if test "${GREP}" = ":" ; then
+               as_fn_error $? "grep is required to build bundled pjproject" "$LINENO" 5
+       fi
+
+
+       this_host=$(./config.sub $(./config.guess))
+       if test "$build" != "$this_host" ; then
+               PJPROJECT_CONFIGURE_OPTS+=" --build=$build"
+       fi
+       if test "$host" != "$this_host" ; then
+               PJPROJECT_CONFIGURE_OPTS+=" --host=$host"
+       fi
+
+       export TAR PATCH SED NM EXTERNALS_CACHE_DIR AST_DOWNLOAD_CACHE DOWNLOAD_TO_STDOUT DOWNLOAD_TIMEOUT DOWNLOAD MD5 CAT CUT GREP
+       export NOISY_BUILD
+       ${GNU_MAKE} --quiet --no-print-directory -C ${PJPROJECT_DIR} \
+               PJPROJECT_CONFIGURE_OPTS="$PJPROJECT_CONFIGURE_OPTS" \
+               EXTERNALS_CACHE_DIR="${EXTERNALS_CACHE_DIR:-${AST_DOWNLOAD_CACHE}}" \
+               configure
+       if test $? -ne 0 ; then
+               { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5
+$as_echo "failed" >&6; }
+               { $as_echo "$as_me:${as_lineno-$LINENO}: Unable to configure ${PJPROJECT_DIR}" >&5
+$as_echo "$as_me: Unable to configure ${PJPROJECT_DIR}" >&6;}
+               as_fn_error $? "Re-run the ./configure command with 'NOISY_BUILD=yes' appended to see error details." "$LINENO" 5
+       fi
+
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for bundled pjproject" >&5
+$as_echo_n "checking for bundled pjproject... " >&6; }
+
+       PJPROJECT_INCLUDE=$(${GNU_MAKE} --quiet --no-print-directory -C ${PJPROJECT_DIR} PJPROJECT_CONFIGURE_OPTS="$PJPROJECT_CONFIGURE_OPTS" EXTERNALS_CACHE_DIR="${EXTERNALS_CACHE_DIR:-${AST_DOWNLOAD_CACHE}}" echo_cflags)
+       PJPROJECT_CFLAGS="$PJPROJECT_INCLUDE"
+       PBX_PJPROJECT=1
+
+
+$as_echo "#define HAVE_PJPROJECT 1" >>confdefs.h
+
+
+$as_echo "#define HAVE_PJPROJECT_BUNDLED 1" >>confdefs.h
+
+
+
+$as_echo "#define HAVE_PJSIP_DLG_CREATE_UAS_AND_INC_LOCK 1" >>confdefs.h
+
+
+$as_echo "#define HAVE_PJ_TRANSACTION_GRP_LOCK 1" >>confdefs.h
+
+
+$as_echo "#define HAVE_PJSIP_REPLACE_MEDIA_STREAM 1" >>confdefs.h
+
+
+$as_echo "#define HAVE_PJSIP_GET_DEST_INFO 1" >>confdefs.h
+
+
+$as_echo "#define HAVE_PJ_SSL_CERT_LOAD_FROM_FILES2 1" >>confdefs.h
+
+
+$as_echo "#define HAVE_PJSIP_EXTERNAL_RESOLVER 1" >>confdefs.h
+
+
+$as_echo "#define HAVE_PJSIP_TLS_TRANSPORT_PROTO 1" >>confdefs.h
+
+
+$as_echo "#define HAVE_PJSIP_EVSUB_GRP_LOCK 1" >>confdefs.h
+
+
+$as_echo "#define HAVE_PJSIP_INV_SESSION_REF 1" >>confdefs.h
+
+
+$as_echo "#define HAVE_PJSIP_AUTH_CLT_DEINIT 1" >>confdefs.h
+
+
+$as_echo "#define HAVE_PJSIP_TSX_LAYER_FIND_TSX2 1" >>confdefs.h
+
+
+
+
+
+
+
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+       fi
+
+
+
+# AST_EXT_LIB_SETUP is used to tell configure to handle variables for
+# various packages.
+# $1 is the prefix for the variables in makeopts and autoconfig.h
+# $2 is the short comment, $4 is the long comment
+# $3 is the name used in --with- or --without- flags for configure.
+#
 # Package option names should be in alphabetical order
 # by the --with option name (the third field),
 # to make things easier for the users.
@@ -8326,25 +9624,57 @@ fi
 
 
 
-    COROSYNC_DESCRIP="Corosync"
-    COROSYNC_OPTION="cpg"
-    PBX_COROSYNC=0
+    CODEC2_DESCRIP="Codec 2 Audio Decoder/Encoder"
+    CODEC2_OPTION="codec2"
+    PBX_CODEC2=0
 
-# Check whether --with-cpg was given.
-if test "${with_cpg+set}" = set; then :
-  withval=$with_cpg;
+# Check whether --with-codec2 was given.
+if test "${with_codec2+set}" = set; then :
+  withval=$with_codec2;
        case ${withval} in
        n|no)
-       USE_COROSYNC=no
+       USE_CODEC2=no
        # -1 is a magic value used by menuselect to know that the package
        # was disabled, other than 'not found'
-       PBX_COROSYNC=-1
+       PBX_CODEC2=-1
        ;;
        y|ye|yes)
-       ac_mandatory_list="${ac_mandatory_list} COROSYNC"
+       ac_mandatory_list="${ac_mandatory_list} CODEC2"
        ;;
        *)
-       COROSYNC_DIR="${withval}"
+       CODEC2_DIR="${withval}"
+       ac_mandatory_list="${ac_mandatory_list} CODEC2"
+       ;;
+       esac
+
+fi
+
+
+
+
+
+
+
+
+    COROSYNC_DESCRIP="Corosync"
+    COROSYNC_OPTION="cpg"
+    PBX_COROSYNC=0
+
+# Check whether --with-cpg was given.
+if test "${with_cpg+set}" = set; then :
+  withval=$with_cpg;
+       case ${withval} in
+       n|no)
+       USE_COROSYNC=no
+       # -1 is a magic value used by menuselect to know that the package
+       # was disabled, other than 'not found'
+       PBX_COROSYNC=-1
+       ;;
+       y|ye|yes)
+       ac_mandatory_list="${ac_mandatory_list} COROSYNC"
+       ;;
+       *)
+       COROSYNC_DIR="${withval}"
        ac_mandatory_list="${ac_mandatory_list} COROSYNC"
        ;;
        esac
@@ -8478,6 +9808,18 @@ 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
@@ -9139,6 +10481,10 @@ fi
 
 
 
+
+
+
+
 # Check whether --with-libcurl was given.
 if test "${with_libcurl+set}" = set; then :
   withval=$with_libcurl; _libcurl_with=$withval
@@ -9226,7 +10572,6 @@ done
   done
 IFS=$as_save_IFS
 
-  test -z "$ac_cv_path__libcurl_config" && ac_cv_path__libcurl_config=""$withval/bin""
   ;;
 esac
 fi
@@ -9376,10 +10721,11 @@ int x;
 curl_easy_setopt(NULL,CURLOPT_URL,NULL);
 x=CURL_ERROR_SIZE;
 x=CURLOPT_WRITEFUNCTION;
-x=CURLOPT_FILE;
+x=CURLOPT_WRITEDATA;
 x=CURLOPT_ERRORBUFFER;
 x=CURLOPT_STDERR;
 x=CURLOPT_VERBOSE;
+if (x) {;}
 
   ;
   return 0;
@@ -9446,17 +10792,23 @@ _ACEOF
 
               # We don't have --protocols, so just assume that all
               # protocols are available
-              _libcurl_protocols="HTTP FTP FILE TELNET LDAP DICT"
+              _libcurl_protocols="HTTP FTP FILE TELNET LDAP DICT TFTP"
 
               if test x$libcurl_feature_SSL = xyes ; then
                  _libcurl_protocols="$_libcurl_protocols HTTPS"
 
                  # FTPS wasn't standards-compliant until version
-                 # 7.11.0
+                 # 7.11.0 (0x070b00 == 461568)
                  if test $_libcurl_version -ge 461568; then
                     _libcurl_protocols="$_libcurl_protocols FTPS"
                  fi
               fi
+
+              # RTSP, IMAP, POP3 and SMTP were added in
+              # 7.20.0 (0x071400 == 463872)
+              if test $_libcurl_version -ge 463872; then
+                 _libcurl_protocols="$_libcurl_protocols RTSP IMAP POP3 SMTP"
+              fi
            fi
 
            for _libcurl_protocol in $_libcurl_protocols ; do
@@ -9527,6 +10879,18 @@ fi
 
 
 
+LIBEDIT_IS_UNICODE_DESCRIP="Libedit compiled for unicode"
+LIBEDIT_IS_UNICODE_OPTION=libedit
+LIBEDIT_IS_UNICODE_DIR=${LIBEDIT_DIR}
+
+PBX_LIBEDIT_IS_UNICODE=0
+
+
+
+
+
+
+
     LIBXML2_DESCRIP="LibXML2"
     LIBXML2_OPTION="libxml2"
     PBX_LIBXML2=0
@@ -9591,6 +10955,18 @@ 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
@@ -9975,6 +11351,70 @@ fi
 
 
 
+    OPUS_DESCRIP="Opus"
+    OPUS_OPTION="opus"
+    PBX_OPUS=0
+
+# Check whether --with-opus was given.
+if test "${with_opus+set}" = set; then :
+  withval=$with_opus;
+       case ${withval} in
+       n|no)
+       USE_OPUS=no
+       # -1 is a magic value used by menuselect to know that the package
+       # was disabled, other than 'not found'
+       PBX_OPUS=-1
+       ;;
+       y|ye|yes)
+       ac_mandatory_list="${ac_mandatory_list} OPUS"
+       ;;
+       *)
+       OPUS_DIR="${withval}"
+       ac_mandatory_list="${ac_mandatory_list} OPUS"
+       ;;
+       esac
+
+fi
+
+
+
+
+
+
+
+
+    OPUSFILE_DESCRIP="Opusfile"
+    OPUSFILE_OPTION="opusfile"
+    PBX_OPUSFILE=0
+
+# Check whether --with-opusfile was given.
+if test "${with_opusfile+set}" = set; then :
+  withval=$with_opusfile;
+       case ${withval} in
+       n|no)
+       USE_OPUSFILE=no
+       # -1 is a magic value used by menuselect to know that the package
+       # was disabled, other than 'not found'
+       PBX_OPUSFILE=-1
+       ;;
+       y|ye|yes)
+       ac_mandatory_list="${ac_mandatory_list} OPUSFILE"
+       ;;
+       *)
+       OPUSFILE_DIR="${withval}"
+       ac_mandatory_list="${ac_mandatory_list} OPUSFILE"
+       ;;
+       esac
+
+fi
+
+
+
+
+
+
+
+
     OSPTK_DESCRIP="OSP Toolkit"
     OSPTK_OPTION="osptk"
     PBX_OSPTK=0
 
 
 
+    BEANSTALK_DESCRIP="Beanstalk Job Queue"
+    BEANSTALK_OPTION="beanstalk"
+    PBX_BEANSTALK=0
+
+# Check whether --with-beanstalk was given.
+if test "${with_beanstalk+set}" = set; then :
+  withval=$with_beanstalk;
+       case ${withval} in
+       n|no)
+       USE_BEANSTALK=no
+       # -1 is a magic value used by menuselect to know that the package
+       # was disabled, other than 'not found'
+       PBX_BEANSTALK=-1
+       ;;
+       y|ye|yes)
+       ac_mandatory_list="${ac_mandatory_list} BEANSTALK"
+       ;;
+       *)
+       BEANSTALK_DIR="${withval}"
+       ac_mandatory_list="${ac_mandatory_list} BEANSTALK"
+       ;;
+       esac
+
+fi
+
+
+
+
+
+
+
+
+if test "x${PBX_PJPROJECT}" != "x1" ; then
+
     PJPROJECT_DESCRIP="PJPROJECT"
     PJPROJECT_OPTION="pjproject"
     PBX_PJPROJECT=0
 
 
 
+PJSIP_DLG_CREATE_UAS_AND_INC_LOCK_DESCRIP="PJSIP Dialog Create UAS with Incremented Lock"
+PJSIP_DLG_CREATE_UAS_AND_INC_LOCK_OPTION=pjsip
+PJSIP_DLG_CREATE_UAS_AND_INC_LOCK_DIR=${PJPROJECT_DIR}
+
+PBX_PJSIP_DLG_CREATE_UAS_AND_INC_LOCK=0
+
+
+
+
+
+
+
+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
+
+
+
+
+
+
+
+PJSIP_GET_DEST_INFO_DESCRIP="pjsip_get_dest_info support"
+PJSIP_GET_DEST_INFO_OPTION=pjsip
+PJSIP_GET_DEST_INFO_DIR=${PJPROJECT_DIR}
+
+PBX_PJSIP_GET_DEST_INFO=0
+
+
+
+
+
+
+
+PJ_SSL_CERT_LOAD_FROM_FILES2_DESCRIP="pj_ssl_cert_load_from_files2 support"
+PJ_SSL_CERT_LOAD_FROM_FILES2_OPTION=pjsip
+PJ_SSL_CERT_LOAD_FROM_FILES2_DIR=${PJPROJECT_DIR}
+
+PBX_PJ_SSL_CERT_LOAD_FROM_FILES2=0
+
+
+
+
+
+
+
+PJSIP_EXTERNAL_RESOLVER_DESCRIP="PJSIP External Resolver Support"
+PJSIP_EXTERNAL_RESOLVER_OPTION=pjsip
+PJSIP_EXTERNAL_RESOLVER_DIR=${PJPROJECT_DIR}
+
+PBX_PJSIP_EXTERNAL_RESOLVER=0
+
+
+
+
+
+
+
+PJSIP_TLS_TRANSPORT_PROTO_DESCRIP="PJSIP TLS Transport proto field support"
+PJSIP_TLS_TRANSPORT_PROTO_OPTION=pjsip
+PJSIP_TLS_TRANSPORT_PROTO_DIR=${PJPROJECT_DIR}
+
+PBX_PJSIP_TLS_TRANSPORT_PROTO=0
+
+
+
+
+
+
+
+PJSIP_EVSUB_GRP_LOCK_DESCRIP="PJSIP EVSUB Group Lock support"
+PJSIP_EVSUB_GRP_LOCK_OPTION=pjsip
+PJSIP_EVSUB_GRP_LOCK_DIR=${PJPROJECT_DIR}
+
+PBX_PJSIP_EVSUB_GRP_LOCK=0
+
+
+
+
+
+
+
+PJSIP_INV_SESSION_REF_DESCRIP="PJSIP INVITE Session Reference Count support"
+PJSIP_INV_SESSION_REF_OPTION=pjsip
+PJSIP_INV_SESSION_REF_DIR=${PJPROJECT_DIR}
+
+PBX_PJSIP_INV_SESSION_REF=0
+
+
+
+
+
+
+
+PJSIP_AUTH_CLT_DEINIT_DESCRIP="pjsip_auth_clt_deinit support"
+PJSIP_AUTH_CLT_DEINIT_OPTION=pjsip
+PJSIP_AUTH_CLT_DEINIT_DIR=${PJPROJECT_DIR}
+
+PBX_PJSIP_AUTH_CLT_DEINIT=0
+
+
+
+
+
+
+
+PJSIP_TSX_LAYER_FIND_TSX2_DESCRIP="pjsip_tsx_layer_find_tsx2 support"
+PJSIP_TSX_LAYER_FIND_TSX2_OPTION=pjsip
+PJSIP_TSX_LAYER_FIND_TSX2_DIR=${PJPROJECT_DIR}
+
+PBX_PJSIP_TSX_LAYER_FIND_TSX2=0
+
+
+
+
+
+
+fi
+
+
     POPT_DESCRIP="popt"
     POPT_OPTION="popt"
     PBX_POPT=0
 
 
 
+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}
 
 
 
+    FFTW3_DESCRIP="LIBFFTW3"
+    FFTW3_OPTION="fftw3"
+    PBX_FFTW3=0
+
+# Check whether --with-fftw3 was given.
+if test "${with_fftw3+set}" = set; then :
+  withval=$with_fftw3;
+       case ${withval} in
+       n|no)
+       USE_FFTW3=no
+       # -1 is a magic value used by menuselect to know that the package
+       # was disabled, other than 'not found'
+       PBX_FFTW3=-1
+       ;;
+       y|ye|yes)
+       ac_mandatory_list="${ac_mandatory_list} FFTW3"
+       ;;
+       *)
+       FFTW3_DIR="${withval}"
+       ac_mandatory_list="${ac_mandatory_list} FFTW3"
+       ;;
+       esac
+
+fi
+
+
+
+
+
+
+
+
     RESAMPLE_DESCRIP="LIBRESAMPLE"
     RESAMPLE_OPTION="resample"
     PBX_RESAMPLE=0
 
 
 
-    SDL_DESCRIP="Sdl"
-    SDL_OPTION="sdl"
-    PBX_SDL=0
+    SNDFILE_DESCRIP="libsndfile"
+    SNDFILE_OPTION="sndfile"
+    PBX_SNDFILE=0
 
-# Check whether --with-sdl was given.
-if test "${with_sdl+set}" = set; then :
-  withval=$with_sdl;
+# Check whether --with-sndfile was given.
+if test "${with_sndfile+set}" = set; then :
+  withval=$with_sndfile;
        case ${withval} in
        n|no)
-       USE_SDL=no
+       USE_SNDFILE=no
        # -1 is a magic value used by menuselect to know that the package
        # was disabled, other than 'not found'
-       PBX_SDL=-1
+       PBX_SNDFILE=-1
        ;;
        y|ye|yes)
-       ac_mandatory_list="${ac_mandatory_list} SDL"
+       ac_mandatory_list="${ac_mandatory_list} SNDFILE"
        ;;
        *)
-       SDL_DIR="${withval}"
-       ac_mandatory_list="${ac_mandatory_list} SDL"
+       SNDFILE_DIR="${withval}"
+       ac_mandatory_list="${ac_mandatory_list} SNDFILE"
        ;;
        esac
 
 
 
 
-    SDL_IMAGE_DESCRIP="Sdl Image"
-    SDL_IMAGE_OPTION="SDL_image"
-    PBX_SDL_IMAGE=0
+    SDL_DESCRIP="Sdl"
+    SDL_OPTION="sdl"
+    PBX_SDL=0
 
-# Check whether --with-SDL_image was given.
-if test "${with_SDL_image+set}" = set; then :
-  withval=$with_SDL_image;
+# Check whether --with-sdl was given.
+if test "${with_sdl+set}" = set; then :
+  withval=$with_sdl;
        case ${withval} in
        n|no)
-       USE_SDL_IMAGE=no
+       USE_SDL=no
        # -1 is a magic value used by menuselect to know that the package
        # was disabled, other than 'not found'
-       PBX_SDL_IMAGE=-1
+       PBX_SDL=-1
        ;;
        y|ye|yes)
-       ac_mandatory_list="${ac_mandatory_list} SDL_IMAGE"
+       ac_mandatory_list="${ac_mandatory_list} SDL"
        ;;
        *)
-       SDL_IMAGE_DIR="${withval}"
-       ac_mandatory_list="${ac_mandatory_list} SDL_IMAGE"
+       SDL_DIR="${withval}"
+       ac_mandatory_list="${ac_mandatory_list} SDL"
        ;;
        esac
 
 
 
 
+    SDL_IMAGE_DESCRIP="Sdl Image"
+    SDL_IMAGE_OPTION="SDL_image"
+    PBX_SDL_IMAGE=0
 
-# Check whether --with-sounds-cache was given.
-if test "${with_sounds_cache+set}" = set; then :
-  withval=$with_sounds_cache;
+# Check whether --with-SDL_image was given.
+if test "${with_SDL_image+set}" = set; then :
+  withval=$with_SDL_image;
        case ${withval} in
        n|no)
-               unset SOUNDS_CACHE_DIR
-               ;;
+       USE_SDL_IMAGE=no
+       # -1 is a magic value used by menuselect to know that the package
+       # was disabled, other than 'not found'
+       PBX_SDL_IMAGE=-1
+       ;;
+       y|ye|yes)
+       ac_mandatory_list="${ac_mandatory_list} SDL_IMAGE"
+       ;;
        *)
-               if test "x${withval}" = "x"; then
-                       :
-               else
-                       SOUNDS_CACHE_DIR="${withval}"
-               fi
-               ;;
+       SDL_IMAGE_DIR="${withval}"
+       ac_mandatory_list="${ac_mandatory_list} SDL_IMAGE"
+       ;;
        esac
 
-else
-  :
 fi
 
 
 
 
+
+
+
+
     SPANDSP_DESCRIP="SPANDSP"
     SPANDSP_OPTION="spandsp"
     PBX_SPANDSP=0
 
 
 
+SRTP_256_DESCRIP="SRTP Library AES-256 (ICM)"
+SRTP_256_OPTION=srtp
+SRTP_256_DIR=${SRTP_DIR}
+
+PBX_SRTP_256=0
+
+
+
+
+
+
+
+SRTP_192_DESCRIP="SRTP Library AES-192 (ICM)"
+SRTP_192_OPTION=srtp
+SRTP_192_DIR=${SRTP_DIR}
+
+PBX_SRTP_192=0
+
+
+
+
+
+
+
+SRTP_GCM_DESCRIP="SRTP Library AES-128 (GCM) and AES-256 (GCM)"
+SRTP_GCM_OPTION=srtp
+SRTP_GCM_DIR=${SRTP_DIR}
+
+PBX_SRTP_GCM=0
+
+
+
+
+
+
+
 SRTP_SHUTDOWN_DESCRIP="SRTP Library Shutdown Function"
 SRTP_SHUTDOWN_OPTION=srtp
 SRTP_SHUTDOWN_DIR=${SRTP_DIR}
 
 
 
+RT_DESCRIP="Realtime functions"
+
+RT_DIR=${rt_DIR}
+
+PBX_RT=0
+
+
+
+
+
+
+
     SUPPSERV_DESCRIP="mISDN Supplemental Services"
     SUPPSERV_OPTION="suppserv"
     PBX_SUPPSERV=0
 
 
 
+    UNBOUND_DESCRIP="unbound"
+    UNBOUND_OPTION="unbound"
+    PBX_UNBOUND=0
+
+# Check whether --with-unbound was given.
+if test "${with_unbound+set}" = set; then :
+  withval=$with_unbound;
+       case ${withval} in
+       n|no)
+       USE_UNBOUND=no
+       # -1 is a magic value used by menuselect to know that the package
+       # was disabled, other than 'not found'
+       PBX_UNBOUND=-1
+       ;;
+       y|ye|yes)
+       ac_mandatory_list="${ac_mandatory_list} UNBOUND"
+       ;;
+       *)
+       UNBOUND_DIR="${withval}"
+       ac_mandatory_list="${ac_mandatory_list} UNBOUND"
+       ;;
+       esac
+
+fi
+
+
+
+
+
+
+
+
     UNIXODBC_DESCRIP="unixODBC"
     UNIXODBC_OPTION="unixodbc"
     PBX_UNIXODBC=0
 
 fi
 
+if test -z $ac_header_dirent -o "$ac_header_dirent" = "no"; then
+  as_fn_error $? "*** Could not find dirent header that defines 'DIR'." "$LINENO" 5
+fi
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
 $as_echo_n "checking for ANSI C header files... " >&6; }
 if ${ac_cv_header_stdc+:} false; then :
@@ -11748,6 +13492,10 @@ $as_echo "#define STDC_HEADERS 1" >>confdefs.h
 
 fi
 
+if test "$ac_cv_header_stdc" != "yes"; then
+  as_fn_error $? "*** ANSI C header files not found." "$LINENO" 5
+fi
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sys/wait.h that is POSIX.1 compatible" >&5
 $as_echo_n "checking for sys/wait.h that is POSIX.1 compatible... " >&6; }
 if ${ac_cv_header_sys_wait_h+:} false; then :
@@ -11789,7 +13537,68 @@ $as_echo "#define HAVE_SYS_WAIT_H 1" >>confdefs.h
 
 fi
 
-for ac_header in arpa/inet.h fcntl.h inttypes.h libintl.h limits.h locale.h malloc.h netdb.h netinet/in.h stddef.h stdint.h stdlib.h string.h strings.h sys/event.h sys/file.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h syslog.h termios.h unistd.h utime.h arpa/nameser.h sys/io.h
+if test "$ac_cv_header_sys_wait_h" != "yes"; then
+  as_fn_error $? "*** POSIX.1 compatible sys/wait.h is required." "$LINENO" 5
+fi
+
+for ac_header in sys/types.h netinet/in.h arpa/nameser.h netdb.h resolv.h
+do :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "#ifdef HAVE_SYS_TYPES_H
+#  include <sys/types.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
+#  include <netinet/in.h>   /* inet_ functions / structs */
+#endif
+#ifdef HAVE_ARPA_NAMESER_H
+#  include <arpa/nameser.h> /* DNS HEADER struct */
+#endif
+#ifdef HAVE_NETDB_H
+#  include <netdb.h>
+#endif
+"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+if test "$ac_cv_header_resolv_h" != "yes"; then
+  as_fn_error $? "*** resolv.h is required." "$LINENO" 5
+fi
+
+# Check for headers that are unconditionally required on all platforms.  Do not use
+# this to check for headers that are only needed by modules.
+for ac_header in  \
+  arpa/nameser.h assert.h ctype.h dlfcn.h errno.h fcntl.h float.h grp.h \
+  inttypes.h limits.h locale.h math.h pwd.h netinet/in.h regex.h \
+  sched.h stdarg.h stdint.h stdio.h stdlib.h string.h syslog.h \
+  sys/file.h sys/ioctl.h sys/param.h sys/resource.h sys/socket.h sys/stat.h \
+  sys/time.h sys/types.h sys/un.h \
+  termios.h time.h unistd.h \
+
+do :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+else
+
+  as_fn_error $? "*** A required header was not found." "$LINENO" 5
+
+fi
+
+done
+
+
+for ac_header in arpa/inet.h libintl.h malloc.h netdb.h stddef.h strings.h sys/event.h utime.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"
@@ -11815,16 +13624,12 @@ if test "x${PBX_TERMCAP}" != "x1" -a "${USE_TERMCAP}" != "no"; then
          pbxlibdir="-L${TERMCAP_DIR}"
       fi
    fi
-   pbxfuncname="tgetent"
-   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_TERMCAP_FOUND=yes
-   else
+
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_termcap_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -ltermcap" >&5
-$as_echo_n "checking for ${pbxfuncname} in -ltermcap... " >&6; }
-if eval \${$as_ac_Lib+:} false; then :
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tgetent in -ltermcap" >&5
+$as_echo_n "checking for tgetent in -ltermcap... " >&6; }
+if ${ac_cv_lib_termcap_tgetent+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -11838,35 +13643,34 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char ${pbxfuncname} ();
+char tgetent ();
 int
 main ()
 {
-return ${pbxfuncname} ();
+return tgetent ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
+  ac_cv_lib_termcap_tgetent=yes
 else
-  eval "$as_ac_Lib=no"
+  ac_cv_lib_termcap_tgetent=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 :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_termcap_tgetent" >&5
+$as_echo "$ac_cv_lib_termcap_tgetent" >&6; }
+if test "x$ac_cv_lib_termcap_tgetent" = xyes; then :
   AST_TERMCAP_FOUND=yes
 else
   AST_TERMCAP_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
-   fi
+
 
    # now check for the header.
    if test "${AST_TERMCAP_FOUND}" = "yes"; then
          TERMCAP_INCLUDE="-I${TERMCAP_DIR}/include"
       fi
       TERMCAP_INCLUDE="${TERMCAP_INCLUDE} "
-      if test "x" = "x" ; then # no header, assume found
-         TERMCAP_HEADER_FOUND="1"
-      else                             # check for the header
-         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${TERMCAP_INCLUDE}"
-         ac_fn_c_check_header_mongrel "$LINENO" "" "ac_cv_header_" "$ac_includes_default"
-if test "x$ac_cv_header_" = xyes; then :
-  TERMCAP_HEADER_FOUND=1
-else
-  TERMCAP_HEADER_FOUND=0
-fi
 
+         # no header, assume found
+         TERMCAP_HEADER_FOUND="1"
 
-         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
-      fi
       if test "x${TERMCAP_HEADER_FOUND}" = "x0" ; then
          TERMCAP_LIB=""
          TERMCAP_INCLUDE=""
       else
-         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            TERMCAP_LIB=""
-         fi
+
          PBX_TERMCAP=1
          cat >>confdefs.h <<_ACEOF
 #define HAVE_TERMCAP 1
@@ -11919,16 +13710,12 @@ if test "x${PBX_TINFO}" != "x1" -a "${USE_TINFO}" != "no"; then
          pbxlibdir="-L${TINFO_DIR}"
       fi
    fi
-   pbxfuncname="tgetent"
-   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_TINFO_FOUND=yes
-   else
+
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_tinfo_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -ltinfo" >&5
-$as_echo_n "checking for ${pbxfuncname} in -ltinfo... " >&6; }
-if eval \${$as_ac_Lib+:} false; then :
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tgetent in -ltinfo" >&5
+$as_echo_n "checking for tgetent in -ltinfo... " >&6; }
+if ${ac_cv_lib_tinfo_tgetent+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -11942,35 +13729,34 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char ${pbxfuncname} ();
+char tgetent ();
 int
 main ()
 {
-return ${pbxfuncname} ();
+return tgetent ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
+  ac_cv_lib_tinfo_tgetent=yes
 else
-  eval "$as_ac_Lib=no"
+  ac_cv_lib_tinfo_tgetent=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 :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_tinfo_tgetent" >&5
+$as_echo "$ac_cv_lib_tinfo_tgetent" >&6; }
+if test "x$ac_cv_lib_tinfo_tgetent" = xyes; then :
   AST_TINFO_FOUND=yes
 else
   AST_TINFO_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
-   fi
+
 
    # now check for the header.
    if test "${AST_TINFO_FOUND}" = "yes"; then
          TINFO_INCLUDE="-I${TINFO_DIR}/include"
       fi
       TINFO_INCLUDE="${TINFO_INCLUDE} "
-      if test "x" = "x" ; then # no header, assume found
-         TINFO_HEADER_FOUND="1"
-      else                             # check for the header
-         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${TINFO_INCLUDE}"
-         ac_fn_c_check_header_mongrel "$LINENO" "" "ac_cv_header_" "$ac_includes_default"
-if test "x$ac_cv_header_" = xyes; then :
-  TINFO_HEADER_FOUND=1
-else
-  TINFO_HEADER_FOUND=0
-fi
 
+         # no header, assume found
+         TINFO_HEADER_FOUND="1"
 
-         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
-      fi
       if test "x${TINFO_HEADER_FOUND}" = "x0" ; then
          TINFO_LIB=""
          TINFO_INCLUDE=""
       else
-         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            TINFO_LIB=""
-         fi
+
          PBX_TINFO=1
          cat >>confdefs.h <<_ACEOF
 #define HAVE_TINFO 1
@@ -12023,16 +13796,12 @@ if test "x${PBX_CURSES}" != "x1" -a "${USE_CURSES}" != "no"; then
          pbxlibdir="-L${CURSES_DIR}"
       fi
    fi
-   pbxfuncname="initscr"
-   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_CURSES_FOUND=yes
-   else
+
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_curses_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lcurses" >&5
-$as_echo_n "checking for ${pbxfuncname} in -lcurses... " >&6; }
-if eval \${$as_ac_Lib+:} false; then :
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for initscr in -lcurses" >&5
+$as_echo_n "checking for initscr in -lcurses... " >&6; }
+if ${ac_cv_lib_curses_initscr+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -12046,35 +13815,34 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char ${pbxfuncname} ();
+char initscr ();
 int
 main ()
 {
-return ${pbxfuncname} ();
+return initscr ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
+  ac_cv_lib_curses_initscr=yes
 else
-  eval "$as_ac_Lib=no"
+  ac_cv_lib_curses_initscr=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 :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_curses_initscr" >&5
+$as_echo "$ac_cv_lib_curses_initscr" >&6; }
+if test "x$ac_cv_lib_curses_initscr" = xyes; then :
   AST_CURSES_FOUND=yes
 else
   AST_CURSES_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
-   fi
+
 
    # now check for the header.
    if test "${AST_CURSES_FOUND}" = "yes"; then
@@ -12084,9 +13852,8 @@ fi
          CURSES_INCLUDE="-I${CURSES_DIR}/include"
       fi
       CURSES_INCLUDE="${CURSES_INCLUDE} "
-      if test "xcurses.h" = "x" ; then # no header, assume found
-         CURSES_HEADER_FOUND="1"
-      else                             # check for the header
+
+         # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${CURSES_INCLUDE}"
          ac_fn_c_check_header_mongrel "$LINENO" "curses.h" "ac_cv_header_curses_h" "$ac_includes_default"
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
-      fi
+
       if test "x${CURSES_HEADER_FOUND}" = "x0" ; then
          CURSES_LIB=""
          CURSES_INCLUDE=""
       else
-         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            CURSES_LIB=""
-         fi
+
          PBX_CURSES=1
          cat >>confdefs.h <<_ACEOF
 #define HAVE_CURSES 1
@@ -12127,16 +13892,12 @@ if test "x${PBX_NCURSES}" != "x1" -a "${USE_NCURSES}" != "no"; then
          pbxlibdir="-L${NCURSES_DIR}"
       fi
    fi
-   pbxfuncname="initscr"
-   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_NCURSES_FOUND=yes
-   else
+
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_ncurses_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lncurses" >&5
-$as_echo_n "checking for ${pbxfuncname} in -lncurses... " >&6; }
-if eval \${$as_ac_Lib+:} false; then :
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for initscr in -lncurses" >&5
+$as_echo_n "checking for initscr in -lncurses... " >&6; }
+if ${ac_cv_lib_ncurses_initscr+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -12150,35 +13911,34 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char ${pbxfuncname} ();
+char initscr ();
 int
 main ()
 {
-return ${pbxfuncname} ();
+return initscr ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
+  ac_cv_lib_ncurses_initscr=yes
 else
-  eval "$as_ac_Lib=no"
+  ac_cv_lib_ncurses_initscr=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 :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ncurses_initscr" >&5
+$as_echo "$ac_cv_lib_ncurses_initscr" >&6; }
+if test "x$ac_cv_lib_ncurses_initscr" = xyes; then :
   AST_NCURSES_FOUND=yes
 else
   AST_NCURSES_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
-   fi
+
 
    # now check for the header.
    if test "${AST_NCURSES_FOUND}" = "yes"; then
@@ -12188,9 +13948,8 @@ fi
          NCURSES_INCLUDE="-I${NCURSES_DIR}/include"
       fi
       NCURSES_INCLUDE="${NCURSES_INCLUDE} "
-      if test "xcurses.h" = "x" ; then # no header, assume found
-         NCURSES_HEADER_FOUND="1"
-      else                             # check for the header
+
+         # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${NCURSES_INCLUDE}"
          ac_fn_c_check_header_mongrel "$LINENO" "curses.h" "ac_cv_header_curses_h" "$ac_includes_default"
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
-      fi
+
       if test "x${NCURSES_HEADER_FOUND}" = "x0" ; then
          NCURSES_LIB=""
          NCURSES_INCLUDE=""
       else
-         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            NCURSES_LIB=""
-         fi
+
          PBX_NCURSES=1
          cat >>confdefs.h <<_ACEOF
 #define HAVE_NCURSES 1
@@ -12250,16 +14007,12 @@ if test "x${PBX_LIBUUID}" != "x1" -a "${USE_LIBUUID}" != "no"; then
          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 "$as_me:${as_lineno-$LINENO}: checking for uuid_generate_random in -luuid" >&5
+$as_echo_n "checking for uuid_generate_random in -luuid... " >&6; }
+if ${ac_cv_lib_uuid_uuid_generate_random+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -12273,35 +14026,34 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char ${pbxfuncname} ();
+char uuid_generate_random ();
 int
 main ()
 {
-return ${pbxfuncname} ();
+return uuid_generate_random ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
+  ac_cv_lib_uuid_uuid_generate_random=yes
 else
-  eval "$as_ac_Lib=no"
+  ac_cv_lib_uuid_uuid_generate_random=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 :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_uuid_uuid_generate_random" >&5
+$as_echo "$ac_cv_lib_uuid_uuid_generate_random" >&6; }
+if test "x$ac_cv_lib_uuid_uuid_generate_random" = xyes; then :
   AST_LIBUUID_FOUND=yes
 else
   AST_LIBUUID_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
-   fi
+
 
    # now check for the header.
    if test "${AST_LIBUUID_FOUND}" = "yes"; then
@@ -12311,9 +14063,8 @@ fi
          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
+
+         # 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"
 
 
          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
@@ -12354,16 +14103,12 @@ if test "x${PBX_E2FSUUID}" != "x1" -a "${USE_E2FSUUID}" != "no"; then
          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 "$as_me:${as_lineno-$LINENO}: checking for uuid_generate_random in -le2fs-uuid" >&5
+$as_echo_n "checking for uuid_generate_random in -le2fs-uuid... " >&6; }
+if ${ac_cv_lib_e2fs_uuid_uuid_generate_random+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -12377,35 +14122,34 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char ${pbxfuncname} ();
+char uuid_generate_random ();
 int
 main ()
 {
-return ${pbxfuncname} ();
+return uuid_generate_random ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
+  ac_cv_lib_e2fs_uuid_uuid_generate_random=yes
 else
-  eval "$as_ac_Lib=no"
+  ac_cv_lib_e2fs_uuid_uuid_generate_random=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 :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_e2fs_uuid_uuid_generate_random" >&5
+$as_echo "$ac_cv_lib_e2fs_uuid_uuid_generate_random" >&6; }
+if test "x$ac_cv_lib_e2fs_uuid_uuid_generate_random" = xyes; 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
@@ -12415,9 +14159,8 @@ fi
          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
+
+         # 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"
 
 
          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
@@ -12488,16 +14229,12 @@ if test "x${PBX_JANSSON}" != "x1" -a "${USE_JANSSON}" != "no"; then
          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 "$as_me:${as_lineno-$LINENO}: checking for json_dumps in -ljansson" >&5
+$as_echo_n "checking for json_dumps in -ljansson... " >&6; }
+if ${ac_cv_lib_jansson_json_dumps+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -12511,35 +14248,34 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char ${pbxfuncname} ();
+char json_dumps ();
 int
 main ()
 {
-return ${pbxfuncname} ();
+return json_dumps ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
+  ac_cv_lib_jansson_json_dumps=yes
 else
-  eval "$as_ac_Lib=no"
+  ac_cv_lib_jansson_json_dumps=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 :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_jansson_json_dumps" >&5
+$as_echo "$ac_cv_lib_jansson_json_dumps" >&6; }
+if test "x$ac_cv_lib_jansson_json_dumps" = xyes; 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
@@ -12549,9 +14285,8 @@ fi
          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
+
+         # 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"
 
 
          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
@@ -12586,31 +14319,28 @@ 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
 
+# See if clock_gettime is in librt
 
-if test "x${PBX_URIPARSER}" != "x1" -a "${USE_URIPARSER}" != "no"; then
+if test "x${PBX_RT}" != "x1" -a "${USE_RT}" != "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"
+   # if --with-RT=DIR has been specified, use it.
+   if test "x${RT_DIR}" != "x"; then
+      if test -d ${RT_DIR}/lib; then
+         pbxlibdir="-L${RT_DIR}/lib"
       else
-         pbxlibdir="-L${URIPARSER_DIR}"
+         pbxlibdir="-L${RT_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 "$as_me:${as_lineno-$LINENO}: checking for clock_gettime in -lrt" >&5
+$as_echo_n "checking for clock_gettime in -lrt... " >&6; }
+if ${ac_cv_lib_rt_clock_gettime+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-luriparser ${pbxlibdir}  $LIBS"
+LIBS="-lrt ${pbxlibdir}  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -12620,69 +14350,55 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char ${pbxfuncname} ();
+char clock_gettime ();
 int
 main ()
 {
-return ${pbxfuncname} ();
+return clock_gettime ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
+  ac_cv_lib_rt_clock_gettime=yes
 else
-  eval "$as_ac_Lib=no"
+  ac_cv_lib_rt_clock_gettime=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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rt_clock_gettime" >&5
+$as_echo "$ac_cv_lib_rt_clock_gettime" >&6; }
+if test "x$ac_cv_lib_rt_clock_gettime" = xyes; then :
+  AST_RT_FOUND=yes
 else
-  AST_URIPARSER_FOUND=no
+  AST_RT_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"
+   if test "${AST_RT_FOUND}" = "yes"; then
+      RT_LIB="${pbxlibdir} -lrt "
+      # if --with-RT=DIR has been specified, use it.
+      if test "x${RT_DIR}" != "x"; then
+         RT_INCLUDE="-I${RT_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
+      RT_INCLUDE="${RT_INCLUDE} "
 
+         # no header, assume found
+         RT_HEADER_FOUND="1"
 
-         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
-      fi
-      if test "x${URIPARSER_HEADER_FOUND}" = "x0" ; then
-         URIPARSER_LIB=""
-         URIPARSER_INCLUDE=""
+      if test "x${RT_HEADER_FOUND}" = "x0" ; then
+         RT_LIB=""
+         RT_INCLUDE=""
       else
-         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            URIPARSER_LIB=""
-         fi
-         PBX_URIPARSER=1
+
+         PBX_RT=1
          cat >>confdefs.h <<_ACEOF
-#define HAVE_URIPARSER 1
+#define HAVE_RT 1
 _ACEOF
 
       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
+               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
@@ -12808,64 +14510,168 @@ 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}"
+               if test ! "x${CONFIG_LIBXML2}" = xNo; then
+                       LIBXML2_INCLUDE=$(${CONFIG_LIBXML2} --cflags)
+                       LIBXML2_INCLUDE=$(echo ${LIBXML2_INCLUDE} | $SED -e "s|-I|-I${LIBXML2_DIR}|g")
 
-               saved_libs="${LIBS}"
-               LIBS="${LIBXML2_LIB}"
+                       LIBXML2_LIB=$(${CONFIG_LIBXML2} --libs)
+                       LIBXML2_LIB=$(echo ${LIBXML2_LIB} | $SED -e "s|-L|-L${LIBXML2_DIR}|g")
 
-               cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+
+                               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>
+        #include <libxml/parser.h>
 int
 main ()
 {
  LIBXML_TEST_VERSION;
-
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-     PBX_LIBXML2=1
-
+   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}"
+
+               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
+
+      ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
+      CFLAGS="${CFLAGS} "
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uriParseUriA in -luriparser" >&5
+$as_echo_n "checking for uriParseUriA in -luriparser... " >&6; }
+if ${ac_cv_lib_uriparser_uriParseUriA+:} 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 uriParseUriA ();
+int
+main ()
+{
+return uriParseUriA ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_uriparser_uriParseUriA=yes
+else
+  ac_cv_lib_uriparser_uriParseUriA=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-               CPPFLAGS="${saved_cppflags}"
-               LIBS="${saved_libs}"
-           else
-               PBX_LIBXML2=1
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_uriparser_uriParseUriA" >&5
+$as_echo "$ac_cv_lib_uriparser_uriParseUriA" >&6; }
+if test "x$ac_cv_lib_uriparser_uriParseUriA" = xyes; then :
+  AST_URIPARSER_FOUND=yes
+else
+  AST_URIPARSER_FOUND=no
+fi
 
-$as_echo "#define HAVE_LIBXML2 1" >>confdefs.h
+      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
 
-           fi
-       fi
-    fi
 
-       if test "${PBX_LIBXML2}" != 1; then
-               { $as_echo "$as_me:${as_lineno-$LINENO}: *** XML documentation will not be available because the 'libxml2' development package is missing." >&5
-$as_echo "$as_me: *** XML documentation will not be available because the 'libxml2' development package is missing." >&6;}
-               { $as_echo "$as_me:${as_lineno-$LINENO}: *** Please run the 'configure' script with the '--disable-xmldoc' parameter option" >&5
-$as_echo "$as_me: *** Please run the 'configure' script with the '--disable-xmldoc' parameter option" >&6;}
-               { $as_echo "$as_me:${as_lineno-$LINENO}: *** or install the 'libxml2' development package." >&5
-$as_echo "$as_me: *** or install the 'libxml2' development package." >&6;}
-               exit 1
-       fi
+   # 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} "
+
+         # 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}"
+
+      if test "x${URIPARSER_HEADER_FOUND}" = "x0" ; then
+         URIPARSER_LIB=""
+         URIPARSER_INCLUDE=""
+      else
+
+         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
+
+$as_echo "#define AST_XML_DOCS 1" >>confdefs.h
 
 
 if test "x${PBX_LIBXSLT}" != "x1" -a "${USE_LIBXSLT}" != "no"; then
@@ -12878,16 +14684,12 @@ if test "x${PBX_LIBXSLT}" != "x1" -a "${USE_LIBXSLT}" != "no"; then
          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 "$as_me:${as_lineno-$LINENO}: checking for xsltLoadStylesheetPI in -lxslt" >&5
+$as_echo_n "checking for xsltLoadStylesheetPI in -lxslt... " >&6; }
+if ${ac_cv_lib_xslt_xsltLoadStylesheetPI+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -12901,35 +14703,34 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char ${pbxfuncname} ();
+char xsltLoadStylesheetPI ();
 int
 main ()
 {
-return ${pbxfuncname} ();
+return xsltLoadStylesheetPI ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
+  ac_cv_lib_xslt_xsltLoadStylesheetPI=yes
 else
-  eval "$as_ac_Lib=no"
+  ac_cv_lib_xslt_xsltLoadStylesheetPI=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 :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_xslt_xsltLoadStylesheetPI" >&5
+$as_echo "$ac_cv_lib_xslt_xsltLoadStylesheetPI" >&6; }
+if test "x$ac_cv_lib_xslt_xsltLoadStylesheetPI" = xyes; 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
@@ -12939,9 +14740,8 @@ fi
          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
+
+         # 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"
 
 
          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
 
 
 
+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
+
+      ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
+      CFLAGS="${CFLAGS} ${LIBXML2_INCLUDE}"
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for xsltCleanupGlobals in -lxslt" >&5
+$as_echo_n "checking for xsltCleanupGlobals in -lxslt... " >&6; }
+if ${ac_cv_lib_xslt_xsltCleanupGlobals+:} 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 xsltCleanupGlobals ();
+int
+main ()
+{
+return xsltCleanupGlobals ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_xslt_xsltCleanupGlobals=yes
+else
+  ac_cv_lib_xslt_xsltCleanupGlobals=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_xslt_xsltCleanupGlobals" >&5
+$as_echo "$ac_cv_lib_xslt_xsltCleanupGlobals" >&6; }
+if test "x$ac_cv_lib_xslt_xsltCleanupGlobals" = xyes; then :
+  AST_LIBXSLT_CLEANUP_FOUND=yes
+else
+  AST_LIBXSLT_CLEANUP_FOUND=no
+fi
+
+      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
+
+
+   # 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}"
+
+         # 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}"
+
+      if test "x${LIBXSLT_CLEANUP_HEADER_FOUND}" = "x0" ; then
+         LIBXSLT_CLEANUP_LIB=""
+         LIBXSLT_CLEANUP_INCLUDE=""
+      else
+
+         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
@@ -13726,6 +15620,43 @@ _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_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_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
@@ -14537,56 +16468,16 @@ _ACEOF
 
 rm -f conftest*
 
-if ${ac_cv_func_setvbuf_reversed+:} false; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether lstat correctly handles trailing slash" >&5
+$as_echo_n "checking whether lstat correctly handles trailing slash... " >&6; }
+if ${ac_cv_func_lstat_dereferences_slashed_symlink+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  ac_cv_func_setvbuf_reversed=no
-fi
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of signal handlers" >&5
-$as_echo_n "checking return type of signal handlers... " >&6; }
-if ${ac_cv_type_signal+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <sys/types.h>
-#include <signal.h>
-
-int
-main ()
-{
-return *(signal (0, 0)) (0) == 1;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_type_signal=int
-else
-  ac_cv_type_signal=void
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_signal" >&5
-$as_echo "$ac_cv_type_signal" >&6; }
-
-cat >>confdefs.h <<_ACEOF
-#define RETSIGTYPE $ac_cv_type_signal
-_ACEOF
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether lstat correctly handles trailing slash" >&5
-$as_echo_n "checking whether lstat correctly handles trailing slash... " >&6; }
-if ${ac_cv_func_lstat_dereferences_slashed_symlink+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  rm -f conftest.sym conftest.file
-echo >conftest.file
-if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then
-  if test "$cross_compiling" = yes; then :
-  ac_cv_func_lstat_dereferences_slashed_symlink=no
+  rm -f conftest.sym conftest.file
+echo >conftest.file
+if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then
+  if test "$cross_compiling" = yes; then :
+  ac_cv_func_lstat_dereferences_slashed_symlink=no
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
@@ -15020,7 +16911,7 @@ fi
 done
 
 
-for ac_func in asprintf atexit closefrom dup2 eaccess endpwent euidaccess ffsll ftruncate getcwd gethostbyname gethostname getloadavg gettimeofday glob htonll ioperm inet_ntoa isascii memchr memmove memset mkdir mkdtemp munmap ntohll newlocale ppoll putenv re_comp regcomp select setenv socket strcasecmp strcasestr strchr strcspn strdup strerror strlcat strlcpy strncasecmp strndup strnlen strrchr strsep strspn strstr strtod strtol strtold strtoq unsetenv utime vasprintf getpeereid sysctl swapctl
+for ac_func in asprintf atexit closefrom dup2 eaccess endpwent euidaccess ffsll ftruncate getcwd gethostbyname gethostname getloadavg gettimeofday glob ioperm inet_ntoa isascii memchr memmove memset mkdir mkdtemp munmap newlocale ppoll putenv re_comp regcomp select setenv socket strcasecmp strcasestr strchr strcspn strdup strerror strlcat strlcpy strncasecmp strndup strnlen strrchr strsep strspn strstr strtod strtol strtold strtoq unsetenv utime vasprintf getpeereid sysctl swapctl
 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"
 done
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for htonll" >&5
+$as_echo_n "checking for htonll... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <arpa/inet.h>
+int
+main ()
+{
+return htonll(0);
+  ;
+  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_HTONLL 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 ntohll" >&5
+$as_echo_n "checking for ntohll... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <arpa/inet.h>
+int
+main ()
+{
+return ntohll(0);
+  ;
+  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_NTOHLL 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
+
 # NOTE: we use AC_CHECK_LIB to get -lm into the arguments for later checks,
 # so that AC_CHECK_FUNCS can detect functions in that library.
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sqrt in -lm" >&5
 
 
 
-# https support (in main/http.c) uses funopen on BSD systems,
-# fopencookie on linux
-for ac_func in funopen fopencookie
-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"
-if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
-
 for ac_func in inet_aton
 do :
   ac_fn_c_check_func "$LINENO" "inet_aton" "ac_cv_func_inet_aton"
 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>
@@ -15712,6 +17697,46 @@ $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}: result: cross-compile" >&5
+$as_echo "cross-compile" >&6; }
+       { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result yes guessed because of cross compilation" >&5
+$as_echo "$as_me: WARNING: result yes guessed because of cross compilation" >&6;}
+
+$as_echo "#define HAS_WORKING_SEMAPHORE 1" >>confdefs.h
+
+
+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
@@ -15868,8 +17893,8 @@ fi
 done
 
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for compiler atomic operations" >&5
-$as_echo_n "checking for compiler atomic operations... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for compiler sync operations" >&5
+$as_echo_n "checking for compiler sync operations... " >&6; }
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -15884,6 +17909,7 @@ _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
+ax_cv_have_gcc_atomics=1
 
 $as_echo "#define HAVE_GCC_ATOMICS 1" >>confdefs.h
 
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for compiler atomic operations" >&5
+$as_echo_n "checking for compiler atomic operations... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+int foo1; int foo2 = __atomic_fetch_add(&foo1, 1, __ATOMIC_RELAXED);
+  ;
+  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; }
+ax_cv_have_c_atomics=1
+
+$as_echo "#define HAVE_C_ATOMICS 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
+
+if test -z $ax_cv_have_c_atomics$ax_cv_have_gcc_atomics; then
+       as_fn_error $? "*** Atomic operations are not supported by your compiler." "$LINENO" 5
+fi
+
 # glibc, AFAIK, is the only C library that makes printing a NULL to a string safe.
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if your system printf is NULL-safe." >&5
 $as_echo_n "checking if your system printf is NULL-safe.... " >&6; }
 
 fi
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we have usable eventfd support" >&5
+$as_echo_n "checking if we have usable eventfd support... " >&6; }
+if test "$cross_compiling" = yes; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: cross-compile" >&5
+$as_echo "cross-compile" >&6; }
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for compiler 'attribute pure' support" >&5
-$as_echo_n "checking for compiler 'attribute pure' support... " >&6; }
-saved_CFLAGS="$CFLAGS"
-CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
-
-
-if test "x" = "x"
-then
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
- void __attribute__((pure)) *test(void *muffin, ...) {return (void *) 0;}
+#include <sys/eventfd.h>
 int
 main ()
 {
-
+return eventfd(0, EFD_NONBLOCK | EFD_SEMAPHORE) == -1;
   ;
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
+if ac_fn_c_try_run "$LINENO"; then :
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_ATTRIBUTE_pure 1
-_ACEOF
+$as_echo "#define HAVE_EVENTFD 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
-else
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for compiler 'attribute pure' support" >&5
+$as_echo_n "checking for compiler 'attribute pure' support... " >&6; }
+saved_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
+
+ax_cv_have_func_attribute_pure=0
+
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
- void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;}
+ void __attribute__((pure)) *test(void *muffin, ...) {return (void *) 0;}
 int
 main ()
 {
@@ -16070,6 +18133,7 @@ if ac_fn_c_try_compile "$LINENO"; then :
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 
+       ax_cv_have_func_attribute_pure=1
 
 cat >>confdefs.h <<_ACEOF
 #define HAVE_ATTRIBUTE_pure 1
@@ -16081,7 +18145,6 @@ $as_echo "no" >&6; }
 
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
 
 
 CFLAGS="$saved_CFLAGS"
@@ -16093,9 +18156,8 @@ $as_echo_n "checking for compiler 'attribute malloc' support... " >&6; }
 saved_CFLAGS="$CFLAGS"
 CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
 
+ax_cv_have_func_attribute_malloc=0
 
-if test "x" = "x"
-then
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
  void __attribute__((malloc)) *test(void *muffin, ...) {return (void *) 0;}
@@ -16111,6 +18173,7 @@ if ac_fn_c_try_compile "$LINENO"; then :
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 
+       ax_cv_have_func_attribute_malloc=1
 
 cat >>confdefs.h <<_ACEOF
 #define HAVE_ATTRIBUTE_malloc 1
@@ -16122,10 +18185,22 @@ $as_echo "no" >&6; }
 
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
+
+
+CFLAGS="$saved_CFLAGS"
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for compiler 'attribute const' support" >&5
+$as_echo_n "checking for compiler 'attribute const' support... " >&6; }
+saved_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
+
+ax_cv_have_func_attribute_const=0
+
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
- void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;}
+ void __attribute__((const)) *test(void *muffin, ...) {return (void *) 0;}
 int
 main ()
 {
@@ -16138,9 +18213,10 @@ if ac_fn_c_try_compile "$LINENO"; then :
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 
+       ax_cv_have_func_attribute_const=1
 
 cat >>confdefs.h <<_ACEOF
-#define HAVE_ATTRIBUTE_malloc 1
+#define HAVE_ATTRIBUTE_const 1
 _ACEOF
 
 else
@@ -16149,75 +18225,6 @@ $as_echo "no" >&6; }
 
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-
-CFLAGS="$saved_CFLAGS"
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for compiler 'attribute const' support" >&5
-$as_echo_n "checking for compiler 'attribute const' support... " >&6; }
-saved_CFLAGS="$CFLAGS"
-CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
-
-
-if test "x" = "x"
-then
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
- void __attribute__((const)) *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; }
-
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_ATTRIBUTE_const 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.  */
- void __attribute__(()) *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; }
-
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_ATTRIBUTE_const 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"
@@ -16229,9 +18236,8 @@ $as_echo_n "checking for compiler 'attribute unused' support... " >&6; }
 saved_CFLAGS="$CFLAGS"
 CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
 
+ax_cv_have_func_attribute_unused=0
 
-if test "x" = "x"
-then
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
  void __attribute__((unused)) *test(void *muffin, ...) {return (void *) 0;}
@@ -16247,6 +18253,7 @@ if ac_fn_c_try_compile "$LINENO"; then :
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 
+       ax_cv_have_func_attribute_unused=1
 
 cat >>confdefs.h <<_ACEOF
 #define HAVE_ATTRIBUTE_unused 1
@@ -16258,34 +18265,6 @@ $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.  */
- void __attribute__(()) *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; }
-
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_ATTRIBUTE_unused 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"
@@ -16297,9 +18276,8 @@ $as_echo_n "checking for compiler 'attribute always_inline' support... " >&6; }
 saved_CFLAGS="$CFLAGS"
 CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
 
+ax_cv_have_func_attribute_always_inline=0
 
-if test "x" = "x"
-then
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
  void __attribute__((always_inline)) *test(void *muffin, ...) {return (void *) 0;}
@@ -16315,6 +18293,7 @@ if ac_fn_c_try_compile "$LINENO"; then :
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 
+       ax_cv_have_func_attribute_always_inline=1
 
 cat >>confdefs.h <<_ACEOF
 #define HAVE_ATTRIBUTE_always_inline 1
@@ -16326,34 +18305,6 @@ $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.  */
- void __attribute__(()) *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; }
-
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_ATTRIBUTE_always_inline 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"
@@ -16365,9 +18316,8 @@ $as_echo_n "checking for compiler 'attribute deprecated' support... " >&6; }
 saved_CFLAGS="$CFLAGS"
 CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
 
+ax_cv_have_func_attribute_deprecated=0
 
-if test "x" = "x"
-then
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
  void __attribute__((deprecated)) *test(void *muffin, ...) {return (void *) 0;}
@@ -16383,6 +18333,7 @@ if ac_fn_c_try_compile "$LINENO"; then :
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 
+       ax_cv_have_func_attribute_deprecated=1
 
 cat >>confdefs.h <<_ACEOF
 #define HAVE_ATTRIBUTE_deprecated 1
@@ -16394,34 +18345,6 @@ $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.  */
- void __attribute__(()) *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; }
-
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_ATTRIBUTE_deprecated 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"
@@ -16433,9 +18356,8 @@ $as_echo_n "checking for compiler 'attribute sentinel' support... " >&6; }
 saved_CFLAGS="$CFLAGS"
 CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
 
+ax_cv_have_func_attribute_sentinel=0
 
-if test "x" = "x"
-then
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
  void __attribute__((sentinel)) *test(void *muffin, ...) {return (void *) 0;}
@@ -16451,6 +18373,7 @@ if ac_fn_c_try_compile "$LINENO"; then :
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 
+       ax_cv_have_func_attribute_sentinel=1
 
 cat >>confdefs.h <<_ACEOF
 #define HAVE_ATTRIBUTE_sentinel 1
@@ -16462,10 +18385,22 @@ $as_echo "no" >&6; }
 
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
+
+
+CFLAGS="$saved_CFLAGS"
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for compiler 'attribute warn_unused_result' support" >&5
+$as_echo_n "checking for compiler 'attribute warn_unused_result' support... " >&6; }
+saved_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
+
+ax_cv_have_func_attribute_warn_unused_result=0
+
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
- void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;}
+ void __attribute__((warn_unused_result)) *test(void *muffin, ...) {return (void *) 0;}
 int
 main ()
 {
@@ -16478,9 +18413,10 @@ if ac_fn_c_try_compile "$LINENO"; then :
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 
+       ax_cv_have_func_attribute_warn_unused_result=1
 
 cat >>confdefs.h <<_ACEOF
-#define HAVE_ATTRIBUTE_sentinel 1
+#define HAVE_ATTRIBUTE_warn_unused_result 1
 _ACEOF
 
 else
@@ -16489,24 +18425,22 @@ $as_echo "no" >&6; }
 
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
 
 
 CFLAGS="$saved_CFLAGS"
 
 
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for compiler 'attribute warn_unused_result' support" >&5
-$as_echo_n "checking for compiler 'attribute warn_unused_result' 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"
 
+ax_cv_have_func_attribute_may_alias=0
 
-if test "x" = "x"
-then
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
- void __attribute__((warn_unused_result)) *test(void *muffin, ...) {return (void *) 0;}
+ void __attribute__((may_alias)) *test(void *muffin, ...) {return (void *) 0;}
 int
 main ()
 {
@@ -16519,9 +18453,10 @@ if ac_fn_c_try_compile "$LINENO"; then :
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 
+       ax_cv_have_func_attribute_may_alias=1
 
 cat >>confdefs.h <<_ACEOF
-#define HAVE_ATTRIBUTE_warn_unused_result 1
+#define HAVE_ATTRIBUTE_may_alias 1
 _ACEOF
 
 else
@@ -16530,10 +18465,22 @@ $as_echo "no" >&6; }
 
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
+
+
+CFLAGS="$saved_CFLAGS"
+
+
+
+{ $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"
+
+ax_cv_have_func_attribute_constructor=0
+
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
- void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;}
+ void __attribute__((constructor)) *test(void *muffin, ...) {return (void *) 0;}
 int
 main ()
 {
@@ -16546,9 +18493,10 @@ if ac_fn_c_try_compile "$LINENO"; then :
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 
+       ax_cv_have_func_attribute_constructor=1
 
 cat >>confdefs.h <<_ACEOF
-#define HAVE_ATTRIBUTE_warn_unused_result 1
+#define HAVE_ATTRIBUTE_constructor 1
 _ACEOF
 
 else
@@ -16557,35 +18505,26 @@ $as_echo "no" >&6; }
 
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
 
 
 CFLAGS="$saved_CFLAGS"
 
 
+if test "$ax_cv_have_func_attribute_constructor" != "1"; then
+       as_fn_error $? "*** Function constructor attribute is not supported by your compiler." "$LINENO" 5
+fi
 
-# 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 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 "x" = "x"
-then
+ax_cv_have_func_attribute_destructor=0
+
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
- void __attribute__((weak_import)) *test(void *muffin, ...) {return (void *) 0;}
+ void __attribute__((destructor)) *test(void *muffin, ...) {return (void *) 0;}
 int
 main ()
 {
@@ -16597,10 +18536,11 @@ _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
+
+       ax_cv_have_func_attribute_destructor=1
 
 cat >>confdefs.h <<_ACEOF
-#define HAVE_ATTRIBUTE_weak_import 1
+#define HAVE_ATTRIBUTE_destructor 1
 _ACEOF
 
 else
@@ -16609,10 +18549,25 @@ $as_echo "no" >&6; }
 
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
+
+
+CFLAGS="$saved_CFLAGS"
+
+
+if test "$ax_cv_have_func_attribute_destructor" != "1"; then
+       as_fn_error $? "*** Function destructor attribute is not supported by your compiler." "$LINENO" 5
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for compiler 'attribute noreturn' support" >&5
+$as_echo_n "checking for compiler 'attribute noreturn' support... " >&6; }
+saved_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
+
+ax_cv_have_func_attribute_noreturn=0
+
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
- void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;}
+ void __attribute__((noreturn)) *test(void *muffin, ...) ;
 int
 main ()
 {
@@ -16624,10 +18579,11 @@ _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
+
+       ax_cv_have_func_attribute_noreturn=1
 
 cat >>confdefs.h <<_ACEOF
-#define HAVE_ATTRIBUTE_weak_import 1
+#define HAVE_ATTRIBUTE_noreturn 1
 _ACEOF
 
 else
@@ -16636,32 +18592,25 @@ $as_echo "no" >&6; }
 
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
 
 
 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; }
-saved_CFLAGS="$CFLAGS"
-CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
-PBX_WEAKREF=0
-
-if test "x" = "x"
-then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -fsanitize=address support" >&5
+$as_echo_n "checking for -fsanitize=address support... " >&6; }
+saved_sanitize_CFLAGS="${CFLAGS}"
+saved_sanitize_LDFLAGS="${LDFLAGS}"
+CFLAGS="-fsanitize=address -fno-omit-frame-pointer"
+LDFLAGS="-fsanitize=address"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
- void __attribute__((weak)) *test(void *muffin, ...) {return (void *) 0;}
+
 int
 main ()
 {
-
+int x = 1;
   ;
   return 0;
 }
@@ -16669,26 +18618,31 @@ _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
-
+       AST_ADDRESS_SANITIZER=1
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+  AST_ADDRESS_SANITIZER=0
+       { $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
+CFLAGS="${saved_sanitize_CFLAGS}"
+LDFLAGS="${saved_sanitize_LDFLAGS}"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -fsanitize=thread support" >&5
+$as_echo_n "checking for -fsanitize=thread support... " >&6; }
+saved_sanitize_CFLAGS="${CFLAGS}"
+saved_sanitize_LDFLAGS="${LDFLAGS}"
+CFLAGS="-fno-omit-frame-pointer -pie -fPIE -fsanitize=thread"
+LDFLAGS="-fsanitize=thread -pie -fPIE"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
- void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;}
+
 int
 main ()
 {
-
+int x = 1;
   ;
   return 0;
 }
@@ -16696,44 +18650,31 @@ _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
-
+       AST_THREAD_SANITIZER=1
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+  AST_THREAD_SANITIZER=0
+       { $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_sanitize_CFLAGS}"
+LDFLAGS="${saved_sanitize_LDFLAGS}"
 
 
-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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -fsanitize=leak support" >&5
+$as_echo_n "checking for -fsanitize=leak support... " >&6; }
+saved_sanitize_CFLAGS="${CFLAGS}"
+saved_sanitize_LDFLAGS="${LDFLAGS}"
+CFLAGS="-fno-omit-frame-pointer -fsanitize=leak"
+LDFLAGS="-fsanitize=leak"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-static void __attribute__((weakref)) *test(void *muffin, ...) {return (void *) 0;}
+
 int
 main ()
 {
-
+int x = 1;
   ;
   return 0;
 }
@@ -16741,26 +18682,31 @@ _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
-
+       AST_LEAK_SANITIZER=1
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+  AST_LEAK_SANITIZER=0
+       { $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
+CFLAGS="${saved_sanitize_CFLAGS}"
+LDFLAGS="${saved_sanitize_LDFLAGS}"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -fsanitize=undefined support" >&5
+$as_echo_n "checking for -fsanitize=undefined support... " >&6; }
+saved_sanitize_CFLAGS="${CFLAGS}"
+saved_sanitize_LDFLAGS="${LDFLAGS}"
+CFLAGS="-fno-omit-frame-pointer -fsanitize=undefined"
+LDFLAGS="-fsanitize=undefined"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-static void __attribute__((weakref("foo"))) *test(void *muffin, ...) {return (void *) 0;}
+
 int
 main ()
 {
-
+int x = 1;
   ;
   return 0;
 }
@@ -16768,160 +18714,21 @@ _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
-fi
-
-
-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; }
-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
-_ACEOF
-
+       AST_UNDEFINED_SANITIZER=1
 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"
-
-
-       ;;
-esac
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -ffunction-sections support" >&5
-$as_echo_n "checking for -ffunction-sections support... " >&6; }
-saved_CFLAGS="${CFLAGS}"
-CFLAGS="${CFLAGS} -ffunction-sections"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-int x = 1;
-  ;
-  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; }
-       saved_LDFLAGS="${LDFLAGS}"
-       LDFLAGS="${LDFLAGS} -Wl,--gc-sections"
-       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for --gc-sections support" >&5
-$as_echo_n "checking for --gc-sections support... " >&6; }
-       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-int x = 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; }
-               GC_CFLAGS="-ffunction-sections"
-               GC_LDFLAGS="-Wl,--gc-sections"
-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
-       LDFLAGS="${saved_LDFLAGS}"
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+  AST_UNDEFINED_SANITIZER=0
+       { $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
-CFLAGS="${saved_CFLAGS}"
-
+CFLAGS="${saved_sanitize_CFLAGS}"
+LDFLAGS="${saved_sanitize_LDFLAGS}"
 
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -Wdeclaration-after-statement support" >&5
 $as_echo_n "checking for -Wdeclaration-after-statement support... " >&6; }
-if $(${CC} -Wdeclaration-after-statement -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
+if $(${CC} -Wdeclaration-after-statement -Werror -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_DECLARATION_AFTER_STATEMENT=-Wdeclaration-after-statement
@@ -16934,7 +18741,7 @@ fi
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -Wtrampolines support" >&5
 $as_echo_n "checking for -Wtrampolines support... " >&6; }
-if $(${CC} -Wtrampolines -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
+if $(${CC} -Wtrampolines -Werror -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_TRAMPOLINES=-Wtrampolines
 
 { $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; }
@@ -16971,9 +18778,22 @@ $as_echo "no" >&6; }
 fi
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -Wno-format-truncation" >&5
+$as_echo_n "checking for -Wno-format-truncation... " >&6; }
+if $(${CC} -Wno-format-truncation -Werror -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_NO_FORMAT_TRUNCATION=-Wno-format-truncation
+else
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+       AST_NO_FORMAT_TRUNCATION=
+fi
+
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -Wshadow" >&5
 $as_echo_n "checking for -Wshadow... " >&6; }
-if $(${CC} -Wshadow -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
+if $(${CC} -Wshadow -Werror -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_SHADOW_WARNINGS=-Wshadow
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -march=native support" >&5
 $as_echo_n "checking for -march=native support... " >&6; }
 if $(${CC} -march=native -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
-       if test "${CONFIG_CFLAGS}" = ""; then
-               { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
-               AST_NATIVE_ARCH=1
-       else
-               { $as_echo "$as_me:${as_lineno-$LINENO}: result: user CFLAGS present" >&5
-$as_echo "user CFLAGS present" >&6; }
-               AST_NATIVE_ARCH=
-       fi
+       AST_NATIVE_ARCH=1
 else
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
-       AST_NATIVE_ARCH=
+       AST_NATIVE_ARCH=0
 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 :
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BIND_8_COMPAT required" >&5
+$as_echo_n "checking for BIND_8_COMPAT required... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#undef BIND_8_COMPAT
+#include <arpa/nameser.h>
+
+int
+main ()
+{
+int x = NXDOMAIN
+  ;
+  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; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+BIND8_CFLAGS=-DBIND_8_COMPAT
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+
 
     if test "x${PBX_GLOB_NOMAGIC}" != "x1"; then
        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GLOB_NOMAGIC in glob.h" >&5
@@ -17454,6 +19270,53 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
 
 
+    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${RTLD_NOLOAD_DIR}" != "x"; then
+           RTLD_NOLOAD_INCLUDE="-I${RTLD_NOLOAD_DIR}/include"
+       fi
+       CPPFLAGS="${CPPFLAGS} ${RTLD_NOLOAD_INCLUDE}"
+
+       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+ #include <dlfcn.h>
+int
+main ()
+{
+#if defined(RTLD_NOLOAD)
+                               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_RTLD_NOLOAD=1
+
+$as_echo "#define HAVE_RTLD_NOLOAD 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_IP_MTU_DISCOVER}" != "x1"; then
        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for IP_MTU_DISCOVER in netinet/in.h" >&5
 $as_echo_n "checking for IP_MTU_DISCOVER in netinet/in.h... " >&6; }
@@ -17500,17 +19363,6 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
 
 
-ac_fn_c_check_header_mongrel "$LINENO" "libkern/OSAtomic.h" "ac_cv_header_libkern_OSAtomic_h" "$ac_includes_default"
-if test "x$ac_cv_header_libkern_OSAtomic_h" = xyes; then :
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_OSX_ATOMICS 1
-_ACEOF
-
-fi
-
-
-
 # The cast to long int works around a bug in the HP C Compiler
 # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
 # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
@@ -17938,16 +19790,12 @@ if test "x${PBX_ALSA}" != "x1" -a "${USE_ALSA}" != "no"; then
          pbxlibdir="-L${ALSA_DIR}"
       fi
    fi
-   pbxfuncname="snd_spcm_init"
-   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_ALSA_FOUND=yes
-   else
+
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_asound_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lasound" >&5
-$as_echo_n "checking for ${pbxfuncname} in -lasound... " >&6; }
-if eval \${$as_ac_Lib+:} false; then :
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for snd_spcm_init in -lasound" >&5
+$as_echo_n "checking for snd_spcm_init in -lasound... " >&6; }
+if ${ac_cv_lib_asound_snd_spcm_init+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -17961,35 +19809,34 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char ${pbxfuncname} ();
+char snd_spcm_init ();
 int
 main ()
 {
-return ${pbxfuncname} ();
+return snd_spcm_init ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
+  ac_cv_lib_asound_snd_spcm_init=yes
 else
-  eval "$as_ac_Lib=no"
+  ac_cv_lib_asound_snd_spcm_init=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 :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_asound_snd_spcm_init" >&5
+$as_echo "$ac_cv_lib_asound_snd_spcm_init" >&6; }
+if test "x$ac_cv_lib_asound_snd_spcm_init" = xyes; then :
   AST_ALSA_FOUND=yes
 else
   AST_ALSA_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
-   fi
+
 
    # now check for the header.
    if test "${AST_ALSA_FOUND}" = "yes"; then
@@ -17999,9 +19846,8 @@ fi
          ALSA_INCLUDE="-I${ALSA_DIR}/include"
       fi
       ALSA_INCLUDE="${ALSA_INCLUDE} "
-      if test "xalsa/asoundlib.h" = "x" ; then # no header, assume found
-         ALSA_HEADER_FOUND="1"
-      else                             # check for the header
+
+         # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${ALSA_INCLUDE}"
          ac_fn_c_check_header_mongrel "$LINENO" "alsa/asoundlib.h" "ac_cv_header_alsa_asoundlib_h" "$ac_includes_default"
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
-      fi
+
       if test "x${ALSA_HEADER_FOUND}" = "x0" ; then
          ALSA_LIB=""
          ALSA_INCLUDE=""
       else
-         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            ALSA_LIB=""
-         fi
+
          PBX_ALSA=1
          cat >>confdefs.h <<_ACEOF
 #define HAVE_ALSA 1
@@ -18043,16 +19887,12 @@ if test "x${PBX_BFD}" != "x1" -a "${USE_BFD}" != "no"; then
          pbxlibdir="-L${BFD_DIR}"
       fi
    fi
-   pbxfuncname="bfd_openr"
-   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 "$as_me:${as_lineno-$LINENO}: checking for bfd_openr in -lbfd" >&5
+$as_echo_n "checking for bfd_openr in -lbfd... " >&6; }
+if ${ac_cv_lib_bfd_bfd_openr+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -18066,35 +19906,34 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char ${pbxfuncname} ();
+char bfd_openr ();
 int
 main ()
 {
-return ${pbxfuncname} ();
+return bfd_openr ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
+  ac_cv_lib_bfd_bfd_openr=yes
 else
-  eval "$as_ac_Lib=no"
+  ac_cv_lib_bfd_bfd_openr=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 :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bfd_bfd_openr" >&5
+$as_echo "$ac_cv_lib_bfd_bfd_openr" >&6; }
+if test "x$ac_cv_lib_bfd_bfd_openr" = xyes; 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
@@ -18104,9 +19943,8 @@ fi
          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
+
+         # 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"
 
 
          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
@@ -18150,16 +19986,12 @@ if test "x${PBX_BFD}" != "x1" -a "${USE_BFD}" != "no"; then
          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 "$as_me:${as_lineno-$LINENO}: checking for bfd_check_format in -lbfd" >&5
+$as_echo_n "checking for bfd_check_format in -lbfd... " >&6; }
+if ${ac_cv_lib_bfd_bfd_check_format+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -18173,35 +20005,34 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char ${pbxfuncname} ();
+char bfd_check_format ();
 int
 main ()
 {
-return ${pbxfuncname} ();
+return bfd_check_format ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
+  ac_cv_lib_bfd_bfd_check_format=yes
 else
-  eval "$as_ac_Lib=no"
+  ac_cv_lib_bfd_bfd_check_format=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 :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bfd_bfd_check_format" >&5
+$as_echo "$ac_cv_lib_bfd_bfd_check_format" >&6; }
+if test "x$ac_cv_lib_bfd_bfd_check_format" = xyes; 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
@@ -18211,9 +20042,8 @@ fi
          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
+
+         # 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"
 
 
          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
 
 fi
 
-if test "x${OSARCH}" = "xlinux-gnu" ; then
+if test "${PBX_BFD}" = "0"; then
+  # openSUSE requires -lz
 
-if test "x${PBX_CAP}" != "x1" -a "${USE_CAP}" != "no"; then
+if test "x${PBX_BFD}" != "x1" -a "${USE_BFD}" != "no"; then
    pbxlibdir=""
-   # if --with-CAP=DIR has been specified, use it.
-   if test "x${CAP_DIR}" != "x"; then
-      if test -d ${CAP_DIR}/lib; then
-         pbxlibdir="-L${CAP_DIR}/lib"
+   # 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
+
+      ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
+      CFLAGS="${CFLAGS} "
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for bfd_check_format in -lbfd" >&5
+$as_echo_n "checking for bfd_check_format in -lbfd... " >&6; }
+if ${ac_cv_lib_bfd_bfd_check_format+:} 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 bfd_check_format ();
+int
+main ()
+{
+return bfd_check_format ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_bfd_bfd_check_format=yes
+else
+  ac_cv_lib_bfd_bfd_check_format=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_bfd_bfd_check_format" >&5
+$as_echo "$ac_cv_lib_bfd_bfd_check_format" >&6; }
+if test "x$ac_cv_lib_bfd_bfd_check_format" = xyes; then :
+  AST_BFD_FOUND=yes
+else
+  AST_BFD_FOUND=no
+fi
+
+      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
+
+
+   # 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} "
+
+         # 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}"
+
+      if test "x${BFD_HEADER_FOUND}" = "x0" ; then
+         BFD_LIB=""
+         BFD_INCLUDE=""
+      else
+
+         PBX_BFD=1
+         cat >>confdefs.h <<_ACEOF
+#define HAVE_BFD 1
+_ACEOF
+
+      fi
+   fi
+fi
+
+
+fi
+
+case "${OSARCH}" in
+linux*)
+
+if test "x${PBX_CAP}" != "x1" -a "${USE_CAP}" != "no"; then
+   pbxlibdir=""
+   # if --with-CAP=DIR has been specified, use it.
+   if test "x${CAP_DIR}" != "x"; then
+      if test -d ${CAP_DIR}/lib; then
+         pbxlibdir="-L${CAP_DIR}/lib"
       else
          pbxlibdir="-L${CAP_DIR}"
       fi
    fi
-   pbxfuncname="cap_from_text"
-   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_CAP_FOUND=yes
-   else
+
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_cap_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lcap" >&5
-$as_echo_n "checking for ${pbxfuncname} in -lcap... " >&6; }
-if eval \${$as_ac_Lib+:} false; then :
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cap_from_text in -lcap" >&5
+$as_echo_n "checking for cap_from_text in -lcap... " >&6; }
+if ${ac_cv_lib_cap_cap_from_text+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -18280,35 +20205,34 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char ${pbxfuncname} ();
+char cap_from_text ();
 int
 main ()
 {
-return ${pbxfuncname} ();
+return cap_from_text ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
+  ac_cv_lib_cap_cap_from_text=yes
 else
-  eval "$as_ac_Lib=no"
+  ac_cv_lib_cap_cap_from_text=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 :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_cap_cap_from_text" >&5
+$as_echo "$ac_cv_lib_cap_cap_from_text" >&6; }
+if test "x$ac_cv_lib_cap_cap_from_text" = xyes; then :
   AST_CAP_FOUND=yes
 else
   AST_CAP_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
-   fi
+
 
    # now check for the header.
    if test "${AST_CAP_FOUND}" = "yes"; then
@@ -18318,9 +20242,8 @@ fi
          CAP_INCLUDE="-I${CAP_DIR}/include"
       fi
       CAP_INCLUDE="${CAP_INCLUDE} "
-      if test "xsys/capability.h" = "x" ; then # no header, assume found
-         CAP_HEADER_FOUND="1"
-      else                             # check for the header
+
+         # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${CAP_INCLUDE}"
          ac_fn_c_check_header_mongrel "$LINENO" "sys/capability.h" "ac_cv_header_sys_capability_h" "$ac_includes_default"
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
-      fi
+
       if test "x${CAP_HEADER_FOUND}" = "x0" ; then
          CAP_LIB=""
          CAP_INCLUDE=""
       else
-         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            CAP_LIB=""
-         fi
+
          PBX_CAP=1
          cat >>confdefs.h <<_ACEOF
 #define HAVE_CAP 1
@@ -18350,7 +20271,8 @@ _ACEOF
 fi
 
 
-fi
+  ;;
+esac
 
 
     if test "x${PBX_DAHDI}" != "x1"; then
@@ -18546,13 +20468,8 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
 
     if test "x${PBX_DAHDI_LINEREVERSE_VMWI}" != "x1" -a "${USE_DAHDI_LINEREVERSE_VMWI}" != "no"; then
-        if test "xenhanced dahdi vmwi support" != "x"; then
-            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for enhanced dahdi vmwi support" >&5
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for enhanced dahdi vmwi support" >&5
 $as_echo_n "checking for enhanced dahdi vmwi support... " >&6; }
-       else
-            { $as_echo "$as_me:${as_lineno-$LINENO}: checking if \"struct dahdi_vmwi_info booger\" compiles using dahdi/user.h" >&5
-$as_echo_n "checking if \"struct dahdi_vmwi_info booger\" compiles using dahdi/user.h... " >&6; }
-       fi
        saved_cppflags="${CPPFLAGS}"
        if test "x${DAHDI_LINEREVERSE_VMWI_DIR}" != "x"; then
            DAHDI_LINEREVERSE_VMWI_INCLUDE="-I${DAHDI_LINEREVERSE_VMWI_DIR}/include"
@@ -18592,13 +20509,8 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
 
     if test "x${PBX_DAHDI_ECHOCANCEL_FAX_MODE}" != "x1" -a "${USE_DAHDI_ECHOCANCEL_FAX_MODE}" != "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 \"int foo = DAHDI_ECHOCANCEL_FAX_MODE\" compiles using dahdi/user.h" >&5
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking if \"int foo = DAHDI_ECHOCANCEL_FAX_MODE\" compiles using dahdi/user.h" >&5
 $as_echo_n "checking if \"int foo = DAHDI_ECHOCANCEL_FAX_MODE\" compiles using dahdi/user.h... " >&6; }
-       fi
        saved_cppflags="${CPPFLAGS}"
        if test "x${DAHDI_ECHOCANCEL_FAX_MODE_DIR}" != "x"; then
            DAHDI_ECHOCANCEL_FAX_MODE_INCLUDE="-I${DAHDI_ECHOCANCEL_FAX_MODE_DIR}/include"
@@ -18638,13 +20550,8 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
 
     if test "x${PBX_GETIFADDRS}" != "x1" -a "${USE_GETIFADDRS}" != "no"; then
-        if test "xgetifaddrs() support" != "x"; then
-            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getifaddrs() support" >&5
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getifaddrs() support" >&5
 $as_echo_n "checking for getifaddrs() support... " >&6; }
-       else
-            { $as_echo "$as_me:${as_lineno-$LINENO}: checking if \"struct ifaddrs *p; getifaddrs(&p)\" compiles using ifaddrs.h" >&5
-$as_echo_n "checking if \"struct ifaddrs *p; getifaddrs(&p)\" compiles using ifaddrs.h... " >&6; }
-       fi
        saved_cppflags="${CPPFLAGS}"
        if test "x${GETIFADDRS_DIR}" != "x"; then
            GETIFADDRS_INCLUDE="-I${GETIFADDRS_DIR}/include"
@@ -18683,13 +20590,8 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
 
     if test "x${PBX_TIMERFD}" != "x1" -a "${USE_TIMERFD}" != "no"; then
-        if test "xtimerfd support" != "x"; then
-            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for timerfd support" >&5
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for timerfd support" >&5
 $as_echo_n "checking for timerfd support... " >&6; }
-       else
-            { $as_echo "$as_me:${as_lineno-$LINENO}: checking if \"timerfd_create(0,0); timerfd_settime(0,0,NULL,NULL);\" compiles using sys/timerfd.h" >&5
-$as_echo_n "checking if \"timerfd_create(0,0); timerfd_settime(0,0,NULL,NULL);\" compiles using sys/timerfd.h... " >&6; }
-       fi
        saved_cppflags="${CPPFLAGS}"
        if test "x${TIMERFD_DIR}" != "x"; then
            TIMERFD_INCLUDE="-I${TIMERFD_DIR}/include"
    fi
 
       if test "$PBX_LIBEDIT" = "1"; then
-        LIBEDIT_INTERNAL="no"
+      LIBEDIT_INTERNAL="no"
       fi
    fi
    if test "${LIBEDIT_INTERNAL}" = "yes"; then
       PBX_LIBEDIT=1
+      LIBEDIT_IS_UNICODE=no
+   else
+
+    if test "x${PBX_LIBEDIT_IS_UNICODE}" != "x1" -a "${USE_LIBEDIT_IS_UNICODE}" != "no"; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Testing for libedit unicode support" >&5
+$as_echo_n "checking for Testing for libedit unicode support... " >&6; }
+       saved_cppflags="${CPPFLAGS}"
+       if test "x${LIBEDIT_IS_UNICODE_DIR}" != "x"; then
+           LIBEDIT_IS_UNICODE_INCLUDE="-I${LIBEDIT_IS_UNICODE_DIR}/include"
+       fi
+       CPPFLAGS="${CPPFLAGS} ${LIBEDIT_IS_UNICODE_INCLUDE}"
+
+       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+ #include <histedit.h>
+int
+main ()
+{
+ el_rfunc_t *callback;;
+
+  ;
+  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_LIBEDIT_IS_UNICODE=1
+
+$as_echo "#define HAVE_LIBEDIT_IS_UNICODE 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
+
    fi
 fi
 
@@ -19106,16 +21050,12 @@ if test "x${PBX_ICONV}" != "x1" -a "${USE_ICONV}" != "no"; then
          pbxlibdir="-L${ICONV_DIR}"
       fi
    fi
-   pbxfuncname="iconv_open"
-   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_ICONV_FOUND=yes
-   else
+
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_iconv_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -liconv" >&5
-$as_echo_n "checking for ${pbxfuncname} in -liconv... " >&6; }
-if eval \${$as_ac_Lib+:} false; then :
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for iconv_open in -liconv" >&5
+$as_echo_n "checking for iconv_open in -liconv... " >&6; }
+if ${ac_cv_lib_iconv_iconv_open+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -19129,35 +21069,34 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char ${pbxfuncname} ();
+char iconv_open ();
 int
 main ()
 {
-return ${pbxfuncname} ();
+return iconv_open ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
+  ac_cv_lib_iconv_iconv_open=yes
 else
-  eval "$as_ac_Lib=no"
+  ac_cv_lib_iconv_iconv_open=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 :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_iconv_iconv_open" >&5
+$as_echo "$ac_cv_lib_iconv_iconv_open" >&6; }
+if test "x$ac_cv_lib_iconv_iconv_open" = xyes; then :
   AST_ICONV_FOUND=yes
 else
   AST_ICONV_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
-   fi
+
 
    # now check for the header.
    if test "${AST_ICONV_FOUND}" = "yes"; then
@@ -19167,9 +21106,8 @@ fi
          ICONV_INCLUDE="-I${ICONV_DIR}/include"
       fi
       ICONV_INCLUDE="${ICONV_INCLUDE} "
-      if test "xiconv.h" = "x" ; then  # no header, assume found
-         ICONV_HEADER_FOUND="1"
-      else                             # check for the header
+
+         # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${ICONV_INCLUDE}"
          ac_fn_c_check_header_mongrel "$LINENO" "iconv.h" "ac_cv_header_iconv_h" "$ac_includes_default"
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
-      fi
+
       if test "x${ICONV_HEADER_FOUND}" = "x0" ; then
          ICONV_LIB=""
          ICONV_INCLUDE=""
       else
-         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            ICONV_LIB=""
-         fi
+
          PBX_ICONV=1
          cat >>confdefs.h <<_ACEOF
 #define HAVE_ICONV 1
@@ -19211,16 +21147,12 @@ if test "x${PBX_ICONV}" != "x1" -a "${USE_ICONV}" != "no"; then
          pbxlibdir="-L${ICONV_DIR}"
       fi
    fi
-   pbxfuncname="libiconv_open"
-   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_ICONV_FOUND=yes
-   else
+
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_iconv_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -liconv" >&5
-$as_echo_n "checking for ${pbxfuncname} in -liconv... " >&6; }
-if eval \${$as_ac_Lib+:} false; then :
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libiconv_open in -liconv" >&5
+$as_echo_n "checking for libiconv_open in -liconv... " >&6; }
+if ${ac_cv_lib_iconv_libiconv_open+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -19234,35 +21166,34 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char ${pbxfuncname} ();
+char libiconv_open ();
 int
 main ()
 {
-return ${pbxfuncname} ();
+return libiconv_open ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
+  ac_cv_lib_iconv_libiconv_open=yes
 else
-  eval "$as_ac_Lib=no"
+  ac_cv_lib_iconv_libiconv_open=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 :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_iconv_libiconv_open" >&5
+$as_echo "$ac_cv_lib_iconv_libiconv_open" >&6; }
+if test "x$ac_cv_lib_iconv_libiconv_open" = xyes; then :
   AST_ICONV_FOUND=yes
 else
   AST_ICONV_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
-   fi
+
 
    # now check for the header.
    if test "${AST_ICONV_FOUND}" = "yes"; then
@@ -19272,9 +21203,8 @@ fi
          ICONV_INCLUDE="-I${ICONV_DIR}/include"
       fi
       ICONV_INCLUDE="${ICONV_INCLUDE} "
-      if test "xiconv.h" = "x" ; then  # no header, assume found
-         ICONV_HEADER_FOUND="1"
-      else                             # check for the header
+
+         # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${ICONV_INCLUDE}"
          ac_fn_c_check_header_mongrel "$LINENO" "iconv.h" "ac_cv_header_iconv_h" "$ac_includes_default"
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
-      fi
+
       if test "x${ICONV_HEADER_FOUND}" = "x0" ; then
          ICONV_LIB=""
          ICONV_INCLUDE=""
       else
-         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            ICONV_LIB=""
-         fi
+
          PBX_ICONV=1
          cat >>confdefs.h <<_ACEOF
 #define HAVE_ICONV 1
@@ -19316,16 +21244,12 @@ if test "x${PBX_ICONV}" != "x1" -a "${USE_ICONV}" != "no"; then
          pbxlibdir="-L${ICONV_DIR}"
       fi
    fi
-   pbxfuncname="iconv_close"
-   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_ICONV_FOUND=yes
-   else
+
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_c_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lc" >&5
-$as_echo_n "checking for ${pbxfuncname} in -lc... " >&6; }
-if eval \${$as_ac_Lib+:} false; then :
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for iconv_close in -lc" >&5
+$as_echo_n "checking for iconv_close in -lc... " >&6; }
+if ${ac_cv_lib_c_iconv_close+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -19339,35 +21263,34 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char ${pbxfuncname} ();
+char iconv_close ();
 int
 main ()
 {
-return ${pbxfuncname} ();
+return iconv_close ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
+  ac_cv_lib_c_iconv_close=yes
 else
-  eval "$as_ac_Lib=no"
+  ac_cv_lib_c_iconv_close=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 :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_iconv_close" >&5
+$as_echo "$ac_cv_lib_c_iconv_close" >&6; }
+if test "x$ac_cv_lib_c_iconv_close" = xyes; then :
   AST_ICONV_FOUND=yes
 else
   AST_ICONV_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
-   fi
+
 
    # now check for the header.
    if test "${AST_ICONV_FOUND}" = "yes"; then
@@ -19377,9 +21300,8 @@ fi
          ICONV_INCLUDE="-I${ICONV_DIR}/include"
       fi
       ICONV_INCLUDE="${ICONV_INCLUDE} "
-      if test "xiconv.h" = "x" ; then  # no header, assume found
-         ICONV_HEADER_FOUND="1"
-      else                             # check for the header
+
+         # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${ICONV_INCLUDE}"
          ac_fn_c_check_header_mongrel "$LINENO" "iconv.h" "ac_cv_header_iconv_h" "$ac_includes_default"
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
-      fi
+
       if test "x${ICONV_HEADER_FOUND}" = "x0" ; then
          ICONV_LIB=""
          ICONV_INCLUDE=""
       else
-         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            ICONV_LIB=""
-         fi
+
          PBX_ICONV=1
          cat >>confdefs.h <<_ACEOF
 #define HAVE_ICONV 1
@@ -19422,16 +21342,12 @@ if test "x${PBX_ICAL}" != "x1" -a "${USE_ICAL}" != "no"; then
          pbxlibdir="-L${ICAL_DIR}"
       fi
    fi
-   pbxfuncname="icaltimezone_get_utc_timezone"
-   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_ICAL_FOUND=yes
-   else
+
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} ${PTHREAD_CFLAGS}"
-      as_ac_Lib=`$as_echo "ac_cv_lib_ical_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lical" >&5
-$as_echo_n "checking for ${pbxfuncname} in -lical... " >&6; }
-if eval \${$as_ac_Lib+:} false; then :
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for icaltimezone_get_utc_timezone in -lical" >&5
+$as_echo_n "checking for icaltimezone_get_utc_timezone in -lical... " >&6; }
+if ${ac_cv_lib_ical_icaltimezone_get_utc_timezone+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -19445,35 +21361,34 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char ${pbxfuncname} ();
+char icaltimezone_get_utc_timezone ();
 int
 main ()
 {
-return ${pbxfuncname} ();
+return icaltimezone_get_utc_timezone ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
+  ac_cv_lib_ical_icaltimezone_get_utc_timezone=yes
 else
-  eval "$as_ac_Lib=no"
+  ac_cv_lib_ical_icaltimezone_get_utc_timezone=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 :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ical_icaltimezone_get_utc_timezone" >&5
+$as_echo "$ac_cv_lib_ical_icaltimezone_get_utc_timezone" >&6; }
+if test "x$ac_cv_lib_ical_icaltimezone_get_utc_timezone" = xyes; then :
   AST_ICAL_FOUND=yes
 else
   AST_ICAL_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
-   fi
+
 
    # now check for the header.
    if test "${AST_ICAL_FOUND}" = "yes"; then
@@ -19483,9 +21398,8 @@ fi
          ICAL_INCLUDE="-I${ICAL_DIR}/include"
       fi
       ICAL_INCLUDE="${ICAL_INCLUDE} ${PTHREAD_CFLAGS}"
-      if test "xlibical/ical.h" = "x" ; then   # no header, assume found
-         ICAL_HEADER_FOUND="1"
-      else                             # check for the header
+
+         # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${ICAL_INCLUDE}"
          ac_fn_c_check_header_mongrel "$LINENO" "libical/ical.h" "ac_cv_header_libical_ical_h" "$ac_includes_default"
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
-      fi
+
       if test "x${ICAL_HEADER_FOUND}" = "x0" ; then
          ICAL_LIB=""
          ICAL_INCLUDE=""
       else
-         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            ICAL_LIB=""
-         fi
+
          PBX_ICAL=1
          cat >>confdefs.h <<_ACEOF
 #define HAVE_ICAL 1
@@ -19527,16 +21439,12 @@ if test "x${PBX_IKSEMEL}" != "x1" -a "${USE_IKSEMEL}" != "no"; then
          pbxlibdir="-L${IKSEMEL_DIR}"
       fi
    fi
-   pbxfuncname="iks_start_sasl"
-   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_IKSEMEL_FOUND=yes
-   else
+
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_iksemel_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -liksemel" >&5
-$as_echo_n "checking for ${pbxfuncname} in -liksemel... " >&6; }
-if eval \${$as_ac_Lib+:} false; then :
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for iks_start_sasl in -liksemel" >&5
+$as_echo_n "checking for iks_start_sasl in -liksemel... " >&6; }
+if ${ac_cv_lib_iksemel_iks_start_sasl+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -19550,35 +21458,34 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char ${pbxfuncname} ();
+char iks_start_sasl ();
 int
 main ()
 {
-return ${pbxfuncname} ();
+return iks_start_sasl ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
+  ac_cv_lib_iksemel_iks_start_sasl=yes
 else
-  eval "$as_ac_Lib=no"
+  ac_cv_lib_iksemel_iks_start_sasl=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 :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_iksemel_iks_start_sasl" >&5
+$as_echo "$ac_cv_lib_iksemel_iks_start_sasl" >&6; }
+if test "x$ac_cv_lib_iksemel_iks_start_sasl" = xyes; then :
   AST_IKSEMEL_FOUND=yes
 else
   AST_IKSEMEL_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
-   fi
+
 
    # now check for the header.
    if test "${AST_IKSEMEL_FOUND}" = "yes"; then
@@ -19588,9 +21495,8 @@ fi
          IKSEMEL_INCLUDE="-I${IKSEMEL_DIR}/include"
       fi
       IKSEMEL_INCLUDE="${IKSEMEL_INCLUDE} "
-      if test "xiksemel.h" = "x" ; then        # no header, assume found
-         IKSEMEL_HEADER_FOUND="1"
-      else                             # check for the header
+
+         # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${IKSEMEL_INCLUDE}"
          ac_fn_c_check_header_mongrel "$LINENO" "iksemel.h" "ac_cv_header_iksemel_h" "$ac_includes_default"
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
-      fi
+
       if test "x${IKSEMEL_HEADER_FOUND}" = "x0" ; then
          IKSEMEL_LIB=""
          IKSEMEL_INCLUDE=""
       else
-         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            IKSEMEL_LIB=""
-         fi
+
          PBX_IKSEMEL=1
          cat >>confdefs.h <<_ACEOF
 #define HAVE_IKSEMEL 1
@@ -20260,16 +22164,12 @@ if test "x${PBX_IODBC}" != "x1" -a "${USE_IODBC}" != "no"; then
          pbxlibdir="-L${IODBC_DIR}"
       fi
    fi
-   pbxfuncname="SQLConnect"
-   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_IODBC_FOUND=yes
-   else
+
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} ${PTHREAD_CFLAGS}"
-      as_ac_Lib=`$as_echo "ac_cv_lib_iodbc_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -liodbc" >&5
-$as_echo_n "checking for ${pbxfuncname} in -liodbc... " >&6; }
-if eval \${$as_ac_Lib+:} false; then :
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SQLConnect in -liodbc" >&5
+$as_echo_n "checking for SQLConnect in -liodbc... " >&6; }
+if ${ac_cv_lib_iodbc_SQLConnect+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -20283,35 +22183,34 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char ${pbxfuncname} ();
+char SQLConnect ();
 int
 main ()
 {
-return ${pbxfuncname} ();
+return SQLConnect ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
+  ac_cv_lib_iodbc_SQLConnect=yes
 else
-  eval "$as_ac_Lib=no"
+  ac_cv_lib_iodbc_SQLConnect=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 :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_iodbc_SQLConnect" >&5
+$as_echo "$ac_cv_lib_iodbc_SQLConnect" >&6; }
+if test "x$ac_cv_lib_iodbc_SQLConnect" = xyes; then :
   AST_IODBC_FOUND=yes
 else
   AST_IODBC_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
-   fi
+
 
    # now check for the header.
    if test "${AST_IODBC_FOUND}" = "yes"; then
@@ -20321,9 +22220,8 @@ fi
          IODBC_INCLUDE="-I${IODBC_DIR}/include"
       fi
       IODBC_INCLUDE="${IODBC_INCLUDE} ${PTHREAD_CFLAGS}"
-      if test "xsql.h" = "x" ; then    # no header, assume found
-         IODBC_HEADER_FOUND="1"
-      else                             # check for the header
+
+         # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${IODBC_INCLUDE}"
          ac_fn_c_check_header_mongrel "$LINENO" "sql.h" "ac_cv_header_sql_h" "$ac_includes_default"
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
-      fi
+
       if test "x${IODBC_HEADER_FOUND}" = "x0" ; then
          IODBC_LIB=""
          IODBC_INCLUDE=""
       else
-         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            IODBC_LIB=""
-         fi
+
          PBX_IODBC=1
          cat >>confdefs.h <<_ACEOF
 #define HAVE_IODBC 1
@@ -20365,16 +22261,12 @@ if test "x${PBX_INOTIFY}" != "x1" -a "${USE_INOTIFY}" != "no"; then
          pbxlibdir="-L${INOTIFY_DIR}"
       fi
    fi
-   pbxfuncname="inotify_init"
-   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_INOTIFY_FOUND=yes
-   else
+
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_c_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lc" >&5
-$as_echo_n "checking for ${pbxfuncname} in -lc... " >&6; }
-if eval \${$as_ac_Lib+:} false; then :
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inotify_init in -lc" >&5
+$as_echo_n "checking for inotify_init in -lc... " >&6; }
+if ${ac_cv_lib_c_inotify_init+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -20388,35 +22280,34 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char ${pbxfuncname} ();
+char inotify_init ();
 int
 main ()
 {
-return ${pbxfuncname} ();
+return inotify_init ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
+  ac_cv_lib_c_inotify_init=yes
 else
-  eval "$as_ac_Lib=no"
+  ac_cv_lib_c_inotify_init=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 :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_inotify_init" >&5
+$as_echo "$ac_cv_lib_c_inotify_init" >&6; }
+if test "x$ac_cv_lib_c_inotify_init" = xyes; then :
   AST_INOTIFY_FOUND=yes
 else
   AST_INOTIFY_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
-   fi
+
 
    # now check for the header.
    if test "${AST_INOTIFY_FOUND}" = "yes"; then
@@ -20426,9 +22317,8 @@ fi
          INOTIFY_INCLUDE="-I${INOTIFY_DIR}/include"
       fi
       INOTIFY_INCLUDE="${INOTIFY_INCLUDE} "
-      if test "xsys/inotify.h" = "x" ; then    # no header, assume found
-         INOTIFY_HEADER_FOUND="1"
-      else                             # check for the header
+
+         # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${INOTIFY_INCLUDE}"
          ac_fn_c_check_header_mongrel "$LINENO" "sys/inotify.h" "ac_cv_header_sys_inotify_h" "$ac_includes_default"
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
-      fi
+
       if test "x${INOTIFY_HEADER_FOUND}" = "x0" ; then
          INOTIFY_LIB=""
          INOTIFY_INCLUDE=""
       else
-         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            INOTIFY_LIB=""
-         fi
+
          PBX_INOTIFY=1
          cat >>confdefs.h <<_ACEOF
 #define HAVE_INOTIFY 1
@@ -20470,16 +22358,12 @@ if test "x${PBX_JACK}" != "x1" -a "${USE_JACK}" != "no"; then
          pbxlibdir="-L${JACK_DIR}"
       fi
    fi
-   pbxfuncname="jack_activate"
-   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_JACK_FOUND=yes
-   else
+
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_jack_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -ljack" >&5
-$as_echo_n "checking for ${pbxfuncname} in -ljack... " >&6; }
-if eval \${$as_ac_Lib+:} false; then :
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for jack_activate in -ljack" >&5
+$as_echo_n "checking for jack_activate in -ljack... " >&6; }
+if ${ac_cv_lib_jack_jack_activate+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -20493,35 +22377,34 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char ${pbxfuncname} ();
+char jack_activate ();
 int
 main ()
 {
-return ${pbxfuncname} ();
+return jack_activate ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
+  ac_cv_lib_jack_jack_activate=yes
 else
-  eval "$as_ac_Lib=no"
+  ac_cv_lib_jack_jack_activate=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 :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_jack_jack_activate" >&5
+$as_echo "$ac_cv_lib_jack_jack_activate" >&6; }
+if test "x$ac_cv_lib_jack_jack_activate" = xyes; then :
   AST_JACK_FOUND=yes
 else
   AST_JACK_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
-   fi
+
 
    # now check for the header.
    if test "${AST_JACK_FOUND}" = "yes"; then
@@ -20531,9 +22414,8 @@ fi
          JACK_INCLUDE="-I${JACK_DIR}/include"
       fi
       JACK_INCLUDE="${JACK_INCLUDE} "
-      if test "xjack/jack.h" = "x" ; then      # no header, assume found
-         JACK_HEADER_FOUND="1"
-      else                             # check for the header
+
+         # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${JACK_INCLUDE}"
          ac_fn_c_check_header_mongrel "$LINENO" "jack/jack.h" "ac_cv_header_jack_jack_h" "$ac_includes_default"
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
-      fi
+
       if test "x${JACK_HEADER_FOUND}" = "x0" ; then
          JACK_LIB=""
          JACK_INCLUDE=""
       else
-         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            JACK_LIB=""
-         fi
+
          PBX_JACK=1
          cat >>confdefs.h <<_ACEOF
 #define HAVE_JACK 1
@@ -20576,16 +22456,12 @@ if test "x${PBX_KQUEUE}" != "x1" -a "${USE_KQUEUE}" != "no"; then
          pbxlibdir="-L${KQUEUE_DIR}"
       fi
    fi
-   pbxfuncname="kqueue"
-   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_KQUEUE_FOUND=yes
-   else
+
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_c_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lc" >&5
-$as_echo_n "checking for ${pbxfuncname} in -lc... " >&6; }
-if eval \${$as_ac_Lib+:} false; then :
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for kqueue in -lc" >&5
+$as_echo_n "checking for kqueue in -lc... " >&6; }
+if ${ac_cv_lib_c_kqueue+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -20599,35 +22475,34 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char ${pbxfuncname} ();
+char kqueue ();
 int
 main ()
 {
-return ${pbxfuncname} ();
+return kqueue ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
+  ac_cv_lib_c_kqueue=yes
 else
-  eval "$as_ac_Lib=no"
+  ac_cv_lib_c_kqueue=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 :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_kqueue" >&5
+$as_echo "$ac_cv_lib_c_kqueue" >&6; }
+if test "x$ac_cv_lib_c_kqueue" = xyes; then :
   AST_KQUEUE_FOUND=yes
 else
   AST_KQUEUE_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
-   fi
+
 
    # now check for the header.
    if test "${AST_KQUEUE_FOUND}" = "yes"; then
@@ -20637,9 +22512,8 @@ fi
          KQUEUE_INCLUDE="-I${KQUEUE_DIR}/include"
       fi
       KQUEUE_INCLUDE="${KQUEUE_INCLUDE} "
-      if test "xsys/event.h" = "x" ; then      # no header, assume found
-         KQUEUE_HEADER_FOUND="1"
-      else                             # check for the header
+
+         # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${KQUEUE_INCLUDE}"
          ac_fn_c_check_header_mongrel "$LINENO" "sys/event.h" "ac_cv_header_sys_event_h" "$ac_includes_default"
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
-      fi
+
       if test "x${KQUEUE_HEADER_FOUND}" = "x0" ; then
          KQUEUE_LIB=""
          KQUEUE_INCLUDE=""
       else
-         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            KQUEUE_LIB=""
-         fi
+
          PBX_KQUEUE=1
          cat >>confdefs.h <<_ACEOF
 #define HAVE_KQUEUE 1
@@ -20695,16 +22567,12 @@ if test "x${PBX_LTDL}" != "x1" -a "${USE_LTDL}" != "no"; then
          pbxlibdir="-L${LTDL_DIR}"
       fi
    fi
-   pbxfuncname="lt_dlinit"
-   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_LTDL_FOUND=yes
-   else
+
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_ltdl_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lltdl" >&5
-$as_echo_n "checking for ${pbxfuncname} in -lltdl... " >&6; }
-if eval \${$as_ac_Lib+:} false; then :
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lt_dlinit in -lltdl" >&5
+$as_echo_n "checking for lt_dlinit in -lltdl... " >&6; }
+if ${ac_cv_lib_ltdl_lt_dlinit+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -20718,35 +22586,34 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char ${pbxfuncname} ();
+char lt_dlinit ();
 int
 main ()
 {
-return ${pbxfuncname} ();
+return lt_dlinit ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
+  ac_cv_lib_ltdl_lt_dlinit=yes
 else
-  eval "$as_ac_Lib=no"
+  ac_cv_lib_ltdl_lt_dlinit=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 :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ltdl_lt_dlinit" >&5
+$as_echo "$ac_cv_lib_ltdl_lt_dlinit" >&6; }
+if test "x$ac_cv_lib_ltdl_lt_dlinit" = xyes; then :
   AST_LTDL_FOUND=yes
 else
   AST_LTDL_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
-   fi
+
 
    # now check for the header.
    if test "${AST_LTDL_FOUND}" = "yes"; then
@@ -20756,9 +22623,8 @@ fi
          LTDL_INCLUDE="-I${LTDL_DIR}/include"
       fi
       LTDL_INCLUDE="${LTDL_INCLUDE} "
-      if test "xltdl.h" = "x" ; then   # no header, assume found
-         LTDL_HEADER_FOUND="1"
-      else                             # check for the header
+
+         # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${LTDL_INCLUDE}"
          ac_fn_c_check_header_mongrel "$LINENO" "ltdl.h" "ac_cv_header_ltdl_h" "$ac_includes_default"
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
-      fi
+
       if test "x${LTDL_HEADER_FOUND}" = "x0" ; then
          LTDL_LIB=""
          LTDL_INCLUDE=""
       else
-         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            LTDL_LIB=""
-         fi
+
          PBX_LTDL=1
          cat >>confdefs.h <<_ACEOF
 #define HAVE_LTDL 1
@@ -20800,16 +22664,12 @@ if test "x${PBX_LDAP}" != "x1" -a "${USE_LDAP}" != "no"; then
          pbxlibdir="-L${LDAP_DIR}"
       fi
    fi
-   pbxfuncname="ldap_initialize"
-   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_LDAP_FOUND=yes
-   else
+
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_ldap_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lldap" >&5
-$as_echo_n "checking for ${pbxfuncname} in -lldap... " >&6; }
-if eval \${$as_ac_Lib+:} false; then :
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldap_initialize in -lldap" >&5
+$as_echo_n "checking for ldap_initialize in -lldap... " >&6; }
+if ${ac_cv_lib_ldap_ldap_initialize+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -20823,35 +22683,34 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char ${pbxfuncname} ();
+char ldap_initialize ();
 int
 main ()
 {
-return ${pbxfuncname} ();
+return ldap_initialize ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
+  ac_cv_lib_ldap_ldap_initialize=yes
 else
-  eval "$as_ac_Lib=no"
+  ac_cv_lib_ldap_ldap_initialize=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 :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ldap_ldap_initialize" >&5
+$as_echo "$ac_cv_lib_ldap_ldap_initialize" >&6; }
+if test "x$ac_cv_lib_ldap_ldap_initialize" = xyes; then :
   AST_LDAP_FOUND=yes
 else
   AST_LDAP_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
-   fi
+
 
    # now check for the header.
    if test "${AST_LDAP_FOUND}" = "yes"; then
@@ -20861,9 +22720,8 @@ fi
          LDAP_INCLUDE="-I${LDAP_DIR}/include"
       fi
       LDAP_INCLUDE="${LDAP_INCLUDE} "
-      if test "xldap.h" = "x" ; then   # no header, assume found
-         LDAP_HEADER_FOUND="1"
-      else                             # check for the header
+
+         # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${LDAP_INCLUDE}"
          ac_fn_c_check_header_mongrel "$LINENO" "ldap.h" "ac_cv_header_ldap_h" "$ac_includes_default"
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
-      fi
+
       if test "x${LDAP_HEADER_FOUND}" = "x0" ; then
          LDAP_LIB=""
          LDAP_INCLUDE=""
       else
-         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            LDAP_LIB=""
-         fi
+
          PBX_LDAP=1
          cat >>confdefs.h <<_ACEOF
 #define HAVE_LDAP 1
@@ -20905,16 +22761,12 @@ if test "x${PBX_MISDN}" != "x1" -a "${USE_MISDN}" != "no"; then
          pbxlibdir="-L${MISDN_DIR}"
       fi
    fi
-   pbxfuncname="mISDN_open"
-   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_MISDN_FOUND=yes
-   else
+
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_mISDN_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lmISDN" >&5
-$as_echo_n "checking for ${pbxfuncname} in -lmISDN... " >&6; }
-if eval \${$as_ac_Lib+:} false; then :
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for mISDN_open in -lmISDN" >&5
+$as_echo_n "checking for mISDN_open in -lmISDN... " >&6; }
+if ${ac_cv_lib_mISDN_mISDN_open+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -20928,35 +22780,34 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char ${pbxfuncname} ();
+char mISDN_open ();
 int
 main ()
 {
-return ${pbxfuncname} ();
+return mISDN_open ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
+  ac_cv_lib_mISDN_mISDN_open=yes
 else
-  eval "$as_ac_Lib=no"
+  ac_cv_lib_mISDN_mISDN_open=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 :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mISDN_mISDN_open" >&5
+$as_echo "$ac_cv_lib_mISDN_mISDN_open" >&6; }
+if test "x$ac_cv_lib_mISDN_mISDN_open" = xyes; then :
   AST_MISDN_FOUND=yes
 else
   AST_MISDN_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
-   fi
+
 
    # now check for the header.
    if test "${AST_MISDN_FOUND}" = "yes"; then
@@ -20966,9 +22817,8 @@ fi
          MISDN_INCLUDE="-I${MISDN_DIR}/include"
       fi
       MISDN_INCLUDE="${MISDN_INCLUDE} "
-      if test "xmISDNuser/mISDNlib.h" = "x" ; then     # no header, assume found
-         MISDN_HEADER_FOUND="1"
-      else                             # check for the header
+
+         # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${MISDN_INCLUDE}"
          ac_fn_c_check_header_mongrel "$LINENO" "mISDNuser/mISDNlib.h" "ac_cv_header_mISDNuser_mISDNlib_h" "$ac_includes_default"
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
-      fi
+
       if test "x${MISDN_HEADER_FOUND}" = "x0" ; then
          MISDN_LIB=""
          MISDN_INCLUDE=""
       else
-         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            MISDN_LIB=""
-         fi
+
          PBX_MISDN=1
          cat >>confdefs.h <<_ACEOF
 #define HAVE_MISDN 1
@@ -21011,16 +22859,12 @@ if test "x${PBX_ISDNNET}" != "x1" -a "${USE_ISDNNET}" != "no"; then
          pbxlibdir="-L${ISDNNET_DIR}"
       fi
    fi
-   pbxfuncname="init_manager"
-   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_ISDNNET_FOUND=yes
-   else
+
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_isdnnet_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lisdnnet" >&5
-$as_echo_n "checking for ${pbxfuncname} in -lisdnnet... " >&6; }
-if eval \${$as_ac_Lib+:} false; then :
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for init_manager in -lisdnnet" >&5
+$as_echo_n "checking for init_manager in -lisdnnet... " >&6; }
+if ${ac_cv_lib_isdnnet_init_manager+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -21034,35 +22878,34 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char ${pbxfuncname} ();
+char init_manager ();
 int
 main ()
 {
-return ${pbxfuncname} ();
+return init_manager ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
+  ac_cv_lib_isdnnet_init_manager=yes
 else
-  eval "$as_ac_Lib=no"
+  ac_cv_lib_isdnnet_init_manager=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 :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_isdnnet_init_manager" >&5
+$as_echo "$ac_cv_lib_isdnnet_init_manager" >&6; }
+if test "x$ac_cv_lib_isdnnet_init_manager" = xyes; then :
   AST_ISDNNET_FOUND=yes
 else
   AST_ISDNNET_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
-   fi
+
 
    # now check for the header.
    if test "${AST_ISDNNET_FOUND}" = "yes"; then
@@ -21072,9 +22915,8 @@ fi
          ISDNNET_INCLUDE="-I${ISDNNET_DIR}/include"
       fi
       ISDNNET_INCLUDE="${ISDNNET_INCLUDE} "
-      if test "xmISDNuser/isdn_net.h" = "x" ; then     # no header, assume found
-         ISDNNET_HEADER_FOUND="1"
-      else                             # check for the header
+
+         # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${ISDNNET_INCLUDE}"
          ac_fn_c_check_header_mongrel "$LINENO" "mISDNuser/isdn_net.h" "ac_cv_header_mISDNuser_isdn_net_h" "$ac_includes_default"
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
-      fi
+
       if test "x${ISDNNET_HEADER_FOUND}" = "x0" ; then
          ISDNNET_LIB=""
          ISDNNET_INCLUDE=""
       else
-         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            ISDNNET_LIB=""
-         fi
+
          PBX_ISDNNET=1
          cat >>confdefs.h <<_ACEOF
 #define HAVE_ISDNNET 1
@@ -21115,16 +22955,12 @@ if test "x${PBX_SUPPSERV}" != "x1" -a "${USE_SUPPSERV}" != "no"; then
          pbxlibdir="-L${SUPPSERV_DIR}"
       fi
    fi
-   pbxfuncname="encodeFac"
-   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_SUPPSERV_FOUND=yes
-   else
+
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_suppserv_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lsuppserv" >&5
-$as_echo_n "checking for ${pbxfuncname} in -lsuppserv... " >&6; }
-if eval \${$as_ac_Lib+:} false; then :
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for encodeFac in -lsuppserv" >&5
+$as_echo_n "checking for encodeFac in -lsuppserv... " >&6; }
+if ${ac_cv_lib_suppserv_encodeFac+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -21138,35 +22974,34 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char ${pbxfuncname} ();
+char encodeFac ();
 int
 main ()
 {
-return ${pbxfuncname} ();
+return encodeFac ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
+  ac_cv_lib_suppserv_encodeFac=yes
 else
-  eval "$as_ac_Lib=no"
+  ac_cv_lib_suppserv_encodeFac=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 :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_suppserv_encodeFac" >&5
+$as_echo "$ac_cv_lib_suppserv_encodeFac" >&6; }
+if test "x$ac_cv_lib_suppserv_encodeFac" = xyes; then :
   AST_SUPPSERV_FOUND=yes
 else
   AST_SUPPSERV_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
-   fi
+
 
    # now check for the header.
    if test "${AST_SUPPSERV_FOUND}" = "yes"; then
@@ -21176,9 +23011,8 @@ fi
          SUPPSERV_INCLUDE="-I${SUPPSERV_DIR}/include"
       fi
       SUPPSERV_INCLUDE="${SUPPSERV_INCLUDE} "
-      if test "xmISDNuser/suppserv.h" = "x" ; then     # no header, assume found
-         SUPPSERV_HEADER_FOUND="1"
-      else                             # check for the header
+
+         # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${SUPPSERV_INCLUDE}"
          ac_fn_c_check_header_mongrel "$LINENO" "mISDNuser/suppserv.h" "ac_cv_header_mISDNuser_suppserv_h" "$ac_includes_default"
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
-      fi
+
       if test "x${SUPPSERV_HEADER_FOUND}" = "x0" ; then
          SUPPSERV_LIB=""
          SUPPSERV_INCLUDE=""
       else
-         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            SUPPSERV_LIB=""
-         fi
+
          PBX_SUPPSERV=1
          cat >>confdefs.h <<_ACEOF
 #define HAVE_SUPPSERV 1
@@ -21321,9 +23153,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
@@ -21423,52 +23255,21 @@ 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}"
-
-               saved_libs="${LIBS}"
-               LIBS="${MYSQLCLIENT_LIB}"
+               if test ! "x${CONFIG_MYSQLCLIENT}" = xNo; then
+                       MYSQLCLIENT_INCLUDE=$(${CONFIG_MYSQLCLIENT} --cflags)
+                       MYSQLCLIENT_INCLUDE=$(echo ${MYSQLCLIENT_INCLUDE} | $SED -e "s|-I|-I${MYSQLCLIENT_DIR}|g")
 
-               cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
+                       MYSQLCLIENT_LIB=$(${CONFIG_MYSQLCLIENT} --libs)
+                       MYSQLCLIENT_LIB=$(echo ${MYSQLCLIENT_LIB} | $SED -e "s|-L|-L${MYSQLCLIENT_DIR}|g")
 
-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
-
-$as_echo "#define HAVE_MYSQLCLIENT 1" >>confdefs.h
-
-           fi
+               fi
        fi
-    fi
 
 
 
@@ -21482,16 +23283,12 @@ if test "x${PBX_NBS}" != "x1" -a "${USE_NBS}" != "no"; then
          pbxlibdir="-L${NBS_DIR}"
       fi
    fi
-   pbxfuncname="nbs_connect"
-   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_NBS_FOUND=yes
-   else
+
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_nbs_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lnbs" >&5
-$as_echo_n "checking for ${pbxfuncname} in -lnbs... " >&6; }
-if eval \${$as_ac_Lib+:} false; then :
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for nbs_connect in -lnbs" >&5
+$as_echo_n "checking for nbs_connect in -lnbs... " >&6; }
+if ${ac_cv_lib_nbs_nbs_connect+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -21505,35 +23302,34 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char ${pbxfuncname} ();
+char nbs_connect ();
 int
 main ()
 {
-return ${pbxfuncname} ();
+return nbs_connect ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
+  ac_cv_lib_nbs_nbs_connect=yes
 else
-  eval "$as_ac_Lib=no"
+  ac_cv_lib_nbs_nbs_connect=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 :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nbs_nbs_connect" >&5
+$as_echo "$ac_cv_lib_nbs_nbs_connect" >&6; }
+if test "x$ac_cv_lib_nbs_nbs_connect" = xyes; then :
   AST_NBS_FOUND=yes
 else
   AST_NBS_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
-   fi
+
 
    # now check for the header.
    if test "${AST_NBS_FOUND}" = "yes"; then
@@ -21543,9 +23339,8 @@ fi
          NBS_INCLUDE="-I${NBS_DIR}/include"
       fi
       NBS_INCLUDE="${NBS_INCLUDE} "
-      if test "xnbs.h" = "x" ; then    # no header, assume found
-         NBS_HEADER_FOUND="1"
-      else                             # check for the header
+
+         # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${NBS_INCLUDE}"
          ac_fn_c_check_header_mongrel "$LINENO" "nbs.h" "ac_cv_header_nbs_h" "$ac_includes_default"
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
-      fi
+
       if test "x${NBS_HEADER_FOUND}" = "x0" ; then
          NBS_LIB=""
          NBS_INCLUDE=""
       else
-         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            NBS_LIB=""
-         fi
+
          PBX_NBS=1
          cat >>confdefs.h <<_ACEOF
 #define HAVE_NBS 1
@@ -21577,9 +23370,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
@@ -21679,58 +23472,27 @@ 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}"
-
-               saved_libs="${LIBS}"
-               LIBS="${NEON_LIB}"
+               if test ! "x${CONFIG_NEON}" = xNo; then
+                       NEON_INCLUDE=$(${CONFIG_NEON} --cflags)
+                       NEON_INCLUDE=$(echo ${NEON_INCLUDE} | $SED -e "s|-I|-I${NEON_DIR}|g")
 
-               cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
+                       NEON_LIB=$(${CONFIG_NEON} --libs)
+                       NEON_LIB=$(echo ${NEON_LIB} | $SED -e "s|-L|-L${NEON_DIR}|g")
 
-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
-
-$as_echo "#define HAVE_NEON 1" >>confdefs.h
-
-           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
@@ -21830,22 +23592,21 @@ 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
+                       NEON29_INCLUDE=$(${CONFIG_NEON29} --cflags)
+                       NEON29_INCLUDE=$(echo ${NEON29_INCLUDE} | $SED -e "s|-I|-I${NEON29_DIR}|g")
 
-               saved_libs="${LIBS}"
-               LIBS="${NEON29_LIB}"
+                       NEON29_LIB=$(${CONFIG_NEON29} --libs)
+                       NEON29_LIB=$(echo ${NEON29_LIB} | $SED -e "s|-L|-L${NEON29_DIR}|g")
 
-               cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+
+                               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
@@ -21854,36 +23615,28 @@ 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
-
-$as_echo "#define HAVE_NEON29 1" >>confdefs.h
+                               CPPFLAGS="${saved_cppflags}"
+                               LIBS="${saved_libs}"
 
-           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
@@ -21983,24 +23736,21 @@ 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>
-#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}"
+               if test ! "x${CONFIG_NETSNMP}" = xNo; then
+                       NETSNMP_INCLUDE=$(${CONFIG_NETSNMP} --cflags)
+                       NETSNMP_INCLUDE=$(echo ${NETSNMP_INCLUDE} | $SED -e "s|-I|-I${NETSNMP_DIR}|g")
 
-               saved_libs="${LIBS}"
-               LIBS="${NETSNMP_LIB}"
+                       NETSNMP_LIB=$(${CONFIG_NETSNMP} --agent-libs)
+                       NETSNMP_LIB=$(echo ${NETSNMP_LIB} | $SED -e "s|-L|-L${NETSNMP_DIR}|g")
 
-               cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+
+                               saved_cppflags="${CPPFLAGS}"
+                               CPPFLAGS="${CPPFLAGS} ${NETSNMP_INCLUDE}"
+
+                               saved_libs="${LIBS}"
+                               LIBS=${NETSNMP_LIB}
+
+                               cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
   #include <net-snmp/net-snmp-config.h>
 #include <net-snmp/net-snmp-includes.h>
@@ -22009,30 +23759,22 @@ 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
-
-$as_echo "#define HAVE_NETSNMP 1" >>confdefs.h
+                               CPPFLAGS="${saved_cppflags}"
+                               LIBS="${saved_libs}"
 
-           fi
+               fi
        fi
-    fi
 
 
 
@@ -22046,16 +23788,12 @@ if test "x${PBX_NEWT}" != "x1" -a "${USE_NEWT}" != "no"; then
          pbxlibdir="-L${NEWT_DIR}"
       fi
    fi
-   pbxfuncname="newtBell"
-   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_NEWT_FOUND=yes
-   else
+
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_newt_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lnewt" >&5
-$as_echo_n "checking for ${pbxfuncname} in -lnewt... " >&6; }
-if eval \${$as_ac_Lib+:} false; then :
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for newtBell in -lnewt" >&5
+$as_echo_n "checking for newtBell in -lnewt... " >&6; }
+if ${ac_cv_lib_newt_newtBell+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -22069,35 +23807,34 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char ${pbxfuncname} ();
+char newtBell ();
 int
 main ()
 {
-return ${pbxfuncname} ();
+return newtBell ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
+  ac_cv_lib_newt_newtBell=yes
 else
-  eval "$as_ac_Lib=no"
+  ac_cv_lib_newt_newtBell=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 :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_newt_newtBell" >&5
+$as_echo "$ac_cv_lib_newt_newtBell" >&6; }
+if test "x$ac_cv_lib_newt_newtBell" = xyes; then :
   AST_NEWT_FOUND=yes
 else
   AST_NEWT_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
-   fi
+
 
    # now check for the header.
    if test "${AST_NEWT_FOUND}" = "yes"; then
@@ -22107,9 +23844,8 @@ fi
          NEWT_INCLUDE="-I${NEWT_DIR}/include"
       fi
       NEWT_INCLUDE="${NEWT_INCLUDE} "
-      if test "xnewt.h" = "x" ; then   # no header, assume found
-         NEWT_HEADER_FOUND="1"
-      else                             # check for the header
+
+         # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${NEWT_INCLUDE}"
          ac_fn_c_check_header_mongrel "$LINENO" "newt.h" "ac_cv_header_newt_h" "$ac_includes_default"
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
-      fi
+
       if test "x${NEWT_HEADER_FOUND}" = "x0" ; then
          NEWT_LIB=""
          NEWT_INCLUDE=""
       else
-         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            NEWT_LIB=""
-         fi
+
          PBX_NEWT=1
          cat >>confdefs.h <<_ACEOF
 #define HAVE_NEWT 1
 
 
 
+# libunbound v1.5.0 added the ub_ctx_add_ta_autr() API call that we can
+# detect as a useable version so that is going to be the minimum version
+# that we will require.
+# Technically v1.4.21 and later could be used but v1.4.21 has a configure
+# script bug which does not find the ldns library.  The bug is fixed in
+# v1.4.22 but that version is not easily detectable.
+#
 
-if test "x${PBX_UNIXODBC}" != "x1" -a "${USE_UNIXODBC}" != "no"; then
+if test "x${PBX_UNBOUND}" != "x1" -a "${USE_UNBOUND}" != "no"; then
    pbxlibdir=""
-   # if --with-UNIXODBC=DIR has been specified, use it.
-   if test "x${UNIXODBC_DIR}" != "x"; then
-      if test -d ${UNIXODBC_DIR}/lib; then
-         pbxlibdir="-L${UNIXODBC_DIR}/lib"
+   # if --with-UNBOUND=DIR has been specified, use it.
+   if test "x${UNBOUND_DIR}" != "x"; then
+      if test -d ${UNBOUND_DIR}/lib; then
+         pbxlibdir="-L${UNBOUND_DIR}/lib"
       else
-         pbxlibdir="-L${UNIXODBC_DIR}"
+         pbxlibdir="-L${UNBOUND_DIR}"
       fi
    fi
-   pbxfuncname="SQLConnect"
-   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_UNIXODBC_FOUND=yes
-   else
+
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_odbc_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lodbc" >&5
-$as_echo_n "checking for ${pbxfuncname} in -lodbc... " >&6; }
-if eval \${$as_ac_Lib+:} false; then :
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ub_ctx_delete in -lunbound" >&5
+$as_echo_n "checking for ub_ctx_delete in -lunbound... " >&6; }
+if ${ac_cv_lib_unbound_ub_ctx_delete+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lodbc ${pbxlibdir}  $LIBS"
+LIBS="-lunbound ${pbxlibdir}  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -22174,69 +23911,65 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char ${pbxfuncname} ();
+char ub_ctx_delete ();
 int
 main ()
 {
-return ${pbxfuncname} ();
+return ub_ctx_delete ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
+  ac_cv_lib_unbound_ub_ctx_delete=yes
 else
-  eval "$as_ac_Lib=no"
+  ac_cv_lib_unbound_ub_ctx_delete=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_UNIXODBC_FOUND=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_unbound_ub_ctx_delete" >&5
+$as_echo "$ac_cv_lib_unbound_ub_ctx_delete" >&6; }
+if test "x$ac_cv_lib_unbound_ub_ctx_delete" = xyes; then :
+  AST_UNBOUND_FOUND=yes
 else
-  AST_UNIXODBC_FOUND=no
+  AST_UNBOUND_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
-   fi
+
 
    # now check for the header.
-   if test "${AST_UNIXODBC_FOUND}" = "yes"; then
-      UNIXODBC_LIB="${pbxlibdir} -lodbc "
-      # if --with-UNIXODBC=DIR has been specified, use it.
-      if test "x${UNIXODBC_DIR}" != "x"; then
-         UNIXODBC_INCLUDE="-I${UNIXODBC_DIR}/include"
+   if test "${AST_UNBOUND_FOUND}" = "yes"; then
+      UNBOUND_LIB="${pbxlibdir} -lunbound "
+      # if --with-UNBOUND=DIR has been specified, use it.
+      if test "x${UNBOUND_DIR}" != "x"; then
+         UNBOUND_INCLUDE="-I${UNBOUND_DIR}/include"
       fi
-      UNIXODBC_INCLUDE="${UNIXODBC_INCLUDE} "
-      if test "xsql.h" = "x" ; then    # no header, assume found
-         UNIXODBC_HEADER_FOUND="1"
-      else                             # check for the header
+      UNBOUND_INCLUDE="${UNBOUND_INCLUDE} "
+
+         # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${UNIXODBC_INCLUDE}"
-         ac_fn_c_check_header_mongrel "$LINENO" "sql.h" "ac_cv_header_sql_h" "$ac_includes_default"
-if test "x$ac_cv_header_sql_h" = xyes; then :
-  UNIXODBC_HEADER_FOUND=1
+         CPPFLAGS="${CPPFLAGS} ${UNBOUND_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "unbound.h" "ac_cv_header_unbound_h" "$ac_includes_default"
+if test "x$ac_cv_header_unbound_h" = xyes; then :
+  UNBOUND_HEADER_FOUND=1
 else
-  UNIXODBC_HEADER_FOUND=0
+  UNBOUND_HEADER_FOUND=0
 fi
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
-      fi
-      if test "x${UNIXODBC_HEADER_FOUND}" = "x0" ; then
-         UNIXODBC_LIB=""
-         UNIXODBC_INCLUDE=""
+
+      if test "x${UNBOUND_HEADER_FOUND}" = "x0" ; then
+         UNBOUND_LIB=""
+         UNBOUND_INCLUDE=""
       else
-         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            UNIXODBC_LIB=""
-         fi
-         PBX_UNIXODBC=1
+
+         PBX_UNBOUND=1
          cat >>confdefs.h <<_ACEOF
-#define HAVE_UNIXODBC 1
+#define HAVE_UNBOUND 1
 _ACEOF
 
       fi
 
 
 
+    if test "x${PBX_UNBOUND_CONST_PARAMS}" != "x1" -a "${USE_UNBOUND_CONST_PARAMS}" != "no"; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for UNBOUND_VERSION_MAJOR declared in unbound.h" >&5
+$as_echo_n "checking for UNBOUND_VERSION_MAJOR declared in unbound.h... " >&6; }
+        saved_cppflags="${CPPFLAGS}"
+        if test "x${UNBOUND_CONST_PARAMS_DIR}" != "x"; then
+            UNBOUND_CONST_PARAMS_INCLUDE="-I${UNBOUND_CONST_PARAMS_DIR}/include"
+        fi
+        CPPFLAGS="${CPPFLAGS} ${UNBOUND_CONST_PARAMS_INCLUDE}"
 
-if test "x${PBX_OGG}" != "x1" -a "${USE_OGG}" != "no"; then
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+ #include <unbound.h>
+int
+main ()
+{
+#if !defined(UNBOUND_VERSION_MAJOR)
+                                    (void) UNBOUND_VERSION_MAJOR;
+                                #endif
+
+  ;
+  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_UNBOUND_CONST_PARAMS=1
+
+$as_echo "#define HAVE_UNBOUND_CONST_PARAMS 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_UNIXODBC}" != "x1" -a "${USE_UNIXODBC}" != "no"; then
    pbxlibdir=""
-   # if --with-OGG=DIR has been specified, use it.
-   if test "x${OGG_DIR}" != "x"; then
-      if test -d ${OGG_DIR}/lib; then
-         pbxlibdir="-L${OGG_DIR}/lib"
+   # 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"
       else
-         pbxlibdir="-L${OGG_DIR}"
+         pbxlibdir="-L${UNIXODBC_DIR}"
       fi
    fi
-   pbxfuncname="ogg_sync_init"
-   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_OGG_FOUND=yes
-   else
+
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_ogg_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -logg" >&5
-$as_echo_n "checking for ${pbxfuncname} in -logg... " >&6; }
-if eval \${$as_ac_Lib+:} false; then :
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SQLConnect in -lodbc" >&5
+$as_echo_n "checking for SQLConnect in -lodbc... " >&6; }
+if ${ac_cv_lib_odbc_SQLConnect+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-logg ${pbxlibdir}  $LIBS"
+LIBS="-lodbc ${pbxlibdir}  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -22279,66 +24051,149 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char ${pbxfuncname} ();
+char SQLConnect ();
 int
 main ()
 {
-return ${pbxfuncname} ();
+return SQLConnect ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
+  ac_cv_lib_odbc_SQLConnect=yes
 else
-  eval "$as_ac_Lib=no"
+  ac_cv_lib_odbc_SQLConnect=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_OGG_FOUND=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_odbc_SQLConnect" >&5
+$as_echo "$ac_cv_lib_odbc_SQLConnect" >&6; }
+if test "x$ac_cv_lib_odbc_SQLConnect" = xyes; then :
+  AST_UNIXODBC_FOUND=yes
 else
-  AST_OGG_FOUND=no
+  AST_UNIXODBC_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
-   fi
+
 
    # now check for the header.
-   if test "${AST_OGG_FOUND}" = "yes"; then
-      OGG_LIB="${pbxlibdir} -logg "
-      # if --with-OGG=DIR has been specified, use it.
-      if test "x${OGG_DIR}" != "x"; then
-         OGG_INCLUDE="-I${OGG_DIR}/include"
+   if test "${AST_UNIXODBC_FOUND}" = "yes"; then
+      UNIXODBC_LIB="${pbxlibdir} -lodbc "
+      # if --with-UNIXODBC=DIR has been specified, use it.
+      if test "x${UNIXODBC_DIR}" != "x"; then
+         UNIXODBC_INCLUDE="-I${UNIXODBC_DIR}/include"
       fi
-      OGG_INCLUDE="${OGG_INCLUDE} "
-      if test "x" = "x" ; then # no header, assume found
-         OGG_HEADER_FOUND="1"
-      else                             # check for the header
+      UNIXODBC_INCLUDE="${UNIXODBC_INCLUDE} "
+
+         # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${OGG_INCLUDE}"
-         ac_fn_c_check_header_mongrel "$LINENO" "" "ac_cv_header_" "$ac_includes_default"
-if test "x$ac_cv_header_" = xyes; then :
-  OGG_HEADER_FOUND=1
+         CPPFLAGS="${CPPFLAGS} ${UNIXODBC_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "sql.h" "ac_cv_header_sql_h" "$ac_includes_default"
+if test "x$ac_cv_header_sql_h" = xyes; then :
+  UNIXODBC_HEADER_FOUND=1
 else
-  OGG_HEADER_FOUND=0
+  UNIXODBC_HEADER_FOUND=0
 fi
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
+
+      if test "x${UNIXODBC_HEADER_FOUND}" = "x0" ; then
+         UNIXODBC_LIB=""
+         UNIXODBC_INCLUDE=""
+      else
+
+         PBX_UNIXODBC=1
+         cat >>confdefs.h <<_ACEOF
+#define HAVE_UNIXODBC 1
+_ACEOF
+
+      fi
+   fi
+fi
+
+
+
+
+if test "x${PBX_OGG}" != "x1" -a "${USE_OGG}" != "no"; then
+   pbxlibdir=""
+   # if --with-OGG=DIR has been specified, use it.
+   if test "x${OGG_DIR}" != "x"; then
+      if test -d ${OGG_DIR}/lib; then
+         pbxlibdir="-L${OGG_DIR}/lib"
+      else
+         pbxlibdir="-L${OGG_DIR}"
+      fi
+   fi
+
+      ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
+      CFLAGS="${CFLAGS} "
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ogg_sync_init in -logg" >&5
+$as_echo_n "checking for ogg_sync_init in -logg... " >&6; }
+if ${ac_cv_lib_ogg_ogg_sync_init+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-logg ${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 ogg_sync_init ();
+int
+main ()
+{
+return ogg_sync_init ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_ogg_ogg_sync_init=yes
+else
+  ac_cv_lib_ogg_ogg_sync_init=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_ogg_ogg_sync_init" >&5
+$as_echo "$ac_cv_lib_ogg_ogg_sync_init" >&6; }
+if test "x$ac_cv_lib_ogg_ogg_sync_init" = xyes; then :
+  AST_OGG_FOUND=yes
+else
+  AST_OGG_FOUND=no
+fi
+
+      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
+
+
+   # now check for the header.
+   if test "${AST_OGG_FOUND}" = "yes"; then
+      OGG_LIB="${pbxlibdir} -logg "
+      # if --with-OGG=DIR has been specified, use it.
+      if test "x${OGG_DIR}" != "x"; then
+         OGG_INCLUDE="-I${OGG_DIR}/include"
       fi
+      OGG_INCLUDE="${OGG_INCLUDE} "
+
+         # no header, assume found
+         OGG_HEADER_FOUND="1"
+
       if test "x${OGG_HEADER_FOUND}" = "x0" ; then
          OGG_LIB=""
          OGG_INCLUDE=""
       else
-         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            OGG_LIB=""
-         fi
+
          PBX_OGG=1
          cat >>confdefs.h <<_ACEOF
 #define HAVE_OGG 1
@@ -22362,16 +24217,12 @@ if test "x${PBX_BKTR}" != "x1" -a "${USE_BKTR}" != "no"; then
          pbxlibdir="-L${BKTR_DIR}"
       fi
    fi
-   pbxfuncname="backtrace"
-   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_BKTR_FOUND=yes
-   else
+
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_execinfo_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lexecinfo" >&5
-$as_echo_n "checking for ${pbxfuncname} in -lexecinfo... " >&6; }
-if eval \${$as_ac_Lib+:} false; then :
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for backtrace in -lexecinfo" >&5
+$as_echo_n "checking for backtrace in -lexecinfo... " >&6; }
+if ${ac_cv_lib_execinfo_backtrace+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -22385,35 +24236,34 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char ${pbxfuncname} ();
+char backtrace ();
 int
 main ()
 {
-return ${pbxfuncname} ();
+return backtrace ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
+  ac_cv_lib_execinfo_backtrace=yes
 else
-  eval "$as_ac_Lib=no"
+  ac_cv_lib_execinfo_backtrace=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 :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_execinfo_backtrace" >&5
+$as_echo "$ac_cv_lib_execinfo_backtrace" >&6; }
+if test "x$ac_cv_lib_execinfo_backtrace" = xyes; then :
   AST_BKTR_FOUND=yes
 else
   AST_BKTR_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
-   fi
+
 
    # now check for the header.
    if test "${AST_BKTR_FOUND}" = "yes"; then
@@ -22423,9 +24273,8 @@ fi
          BKTR_INCLUDE="-I${BKTR_DIR}/include"
       fi
       BKTR_INCLUDE="${BKTR_INCLUDE} "
-      if test "xexecinfo.h" = "x" ; then       # no header, assume found
-         BKTR_HEADER_FOUND="1"
-      else                             # check for the header
+
+         # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${BKTR_INCLUDE}"
          ac_fn_c_check_header_mongrel "$LINENO" "execinfo.h" "ac_cv_header_execinfo_h" "$ac_includes_default"
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
-      fi
+
       if test "x${BKTR_HEADER_FOUND}" = "x0" ; then
          BKTR_LIB=""
          BKTR_INCLUDE=""
       else
-         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            BKTR_LIB=""
-         fi
+
          PBX_BKTR=1
          cat >>confdefs.h <<_ACEOF
 #define HAVE_BKTR 1
@@ -22467,16 +24314,12 @@ if test "x${PBX_BKTR}" != "x1" -a "${USE_BKTR}" != "no"; then
          pbxlibdir="-L${BKTR_DIR}"
       fi
    fi
-   pbxfuncname="backtrace"
-   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_BKTR_FOUND=yes
-   else
+
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_c_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lc" >&5
-$as_echo_n "checking for ${pbxfuncname} in -lc... " >&6; }
-if eval \${$as_ac_Lib+:} false; then :
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for backtrace in -lc" >&5
+$as_echo_n "checking for backtrace in -lc... " >&6; }
+if ${ac_cv_lib_c_backtrace+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -22490,35 +24333,34 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char ${pbxfuncname} ();
+char backtrace ();
 int
 main ()
 {
-return ${pbxfuncname} ();
+return backtrace ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
+  ac_cv_lib_c_backtrace=yes
 else
-  eval "$as_ac_Lib=no"
+  ac_cv_lib_c_backtrace=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 :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_backtrace" >&5
+$as_echo "$ac_cv_lib_c_backtrace" >&6; }
+if test "x$ac_cv_lib_c_backtrace" = xyes; then :
   AST_BKTR_FOUND=yes
 else
   AST_BKTR_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
-   fi
+
 
    # now check for the header.
    if test "${AST_BKTR_FOUND}" = "yes"; then
@@ -22528,9 +24370,8 @@ fi
          BKTR_INCLUDE="-I${BKTR_DIR}/include"
       fi
       BKTR_INCLUDE="${BKTR_INCLUDE} "
-      if test "xexecinfo.h" = "x" ; then       # no header, assume found
-         BKTR_HEADER_FOUND="1"
-      else                             # check for the header
+
+         # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${BKTR_INCLUDE}"
          ac_fn_c_check_header_mongrel "$LINENO" "execinfo.h" "ac_cv_header_execinfo_h" "$ac_includes_default"
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
-      fi
+
       if test "x${BKTR_HEADER_FOUND}" = "x0" ; then
          BKTR_LIB=""
          BKTR_INCLUDE=""
       else
-         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            BKTR_LIB=""
-         fi
+
          PBX_BKTR=1
          cat >>confdefs.h <<_ACEOF
 #define HAVE_BKTR 1
@@ -22572,16 +24411,12 @@ if test "x${PBX_BLUETOOTH}" != "x1" -a "${USE_BLUETOOTH}" != "no"; then
          pbxlibdir="-L${BLUETOOTH_DIR}"
       fi
    fi
-   pbxfuncname="ba2str"
-   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_BLUETOOTH_FOUND=yes
-   else
+
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_bluetooth_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lbluetooth" >&5
-$as_echo_n "checking for ${pbxfuncname} in -lbluetooth... " >&6; }
-if eval \${$as_ac_Lib+:} false; then :
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ba2str in -lbluetooth" >&5
+$as_echo_n "checking for ba2str in -lbluetooth... " >&6; }
+if ${ac_cv_lib_bluetooth_ba2str+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -22595,35 +24430,34 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char ${pbxfuncname} ();
+char ba2str ();
 int
 main ()
 {
-return ${pbxfuncname} ();
+return ba2str ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
+  ac_cv_lib_bluetooth_ba2str=yes
 else
-  eval "$as_ac_Lib=no"
+  ac_cv_lib_bluetooth_ba2str=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 :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bluetooth_ba2str" >&5
+$as_echo "$ac_cv_lib_bluetooth_ba2str" >&6; }
+if test "x$ac_cv_lib_bluetooth_ba2str" = xyes; then :
   AST_BLUETOOTH_FOUND=yes
 else
   AST_BLUETOOTH_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
-   fi
+
 
    # now check for the header.
    if test "${AST_BLUETOOTH_FOUND}" = "yes"; then
@@ -22633,9 +24467,8 @@ fi
          BLUETOOTH_INCLUDE="-I${BLUETOOTH_DIR}/include"
       fi
       BLUETOOTH_INCLUDE="${BLUETOOTH_INCLUDE} "
-      if test "xbluetooth/bluetooth.h" = "x" ; then    # no header, assume found
-         BLUETOOTH_HEADER_FOUND="1"
-      else                             # check for the header
+
+         # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${BLUETOOTH_INCLUDE}"
          ac_fn_c_check_header_mongrel "$LINENO" "bluetooth/bluetooth.h" "ac_cv_header_bluetooth_bluetooth_h" "$ac_includes_default"
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
-      fi
+
       if test "x${BLUETOOTH_HEADER_FOUND}" = "x0" ; then
          BLUETOOTH_LIB=""
          BLUETOOTH_INCLUDE=""
       else
-         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            BLUETOOTH_LIB=""
-         fi
+
          PBX_BLUETOOTH=1
          cat >>confdefs.h <<_ACEOF
 #define HAVE_BLUETOOTH 1
 
 
 
-# possible places for oss definitions
 
-if test "x${PBX_OSS}" != "x1" -a "${USE_OSS}" != "no"; then
+if test "x${PBX_BEANSTALK}" != "x1" -a "${USE_BEANSTALK}" != "no"; then
    pbxlibdir=""
-   # if --with-OSS=DIR has been specified, use it.
-   if test "x${OSS_DIR}" != "x"; then
-      if test -d ${OSS_DIR}/lib; then
-         pbxlibdir="-L${OSS_DIR}/lib"
+   # if --with-BEANSTALK=DIR has been specified, use it.
+   if test "x${BEANSTALK_DIR}" != "x"; then
+      if test -d ${BEANSTALK_DIR}/lib; then
+         pbxlibdir="-L${BEANSTALK_DIR}/lib"
       else
-         pbxlibdir="-L${OSS_DIR}"
+         pbxlibdir="-L${BEANSTALK_DIR}"
       fi
    fi
-   pbxfuncname=""
-   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_OSS_FOUND=yes
-   else
+
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_ossaudio_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lossaudio" >&5
-$as_echo_n "checking for ${pbxfuncname} in -lossaudio... " >&6; }
-if eval \${$as_ac_Lib+:} false; then :
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for bs_version in -lbeanstalk" >&5
+$as_echo_n "checking for bs_version in -lbeanstalk... " >&6; }
+if ${ac_cv_lib_beanstalk_bs_version+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lossaudio ${pbxlibdir}  $LIBS"
+LIBS="-lbeanstalk ${pbxlibdir}  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -22701,36 +24527,90 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char ${pbxfuncname} ();
+char bs_version ();
 int
 main ()
 {
-return ${pbxfuncname} ();
+return bs_version ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
+  ac_cv_lib_beanstalk_bs_version=yes
 else
-  eval "$as_ac_Lib=no"
+  ac_cv_lib_beanstalk_bs_version=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_OSS_FOUND=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_beanstalk_bs_version" >&5
+$as_echo "$ac_cv_lib_beanstalk_bs_version" >&6; }
+if test "x$ac_cv_lib_beanstalk_bs_version" = xyes; then :
+  AST_BEANSTALK_FOUND=yes
 else
-  AST_OSS_FOUND=no
+  AST_BEANSTALK_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
+
+
+   # now check for the header.
+   if test "${AST_BEANSTALK_FOUND}" = "yes"; then
+      BEANSTALK_LIB="${pbxlibdir} -lbeanstalk "
+      # if --with-BEANSTALK=DIR has been specified, use it.
+      if test "x${BEANSTALK_DIR}" != "x"; then
+         BEANSTALK_INCLUDE="-I${BEANSTALK_DIR}/include"
+      fi
+      BEANSTALK_INCLUDE="${BEANSTALK_INCLUDE} "
+
+         # check for the header
+         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${BEANSTALK_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "beanstalk.h" "ac_cv_header_beanstalk_h" "$ac_includes_default"
+if test "x$ac_cv_header_beanstalk_h" = xyes; then :
+  BEANSTALK_HEADER_FOUND=1
+else
+  BEANSTALK_HEADER_FOUND=0
+fi
+
+
+         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
+
+      if test "x${BEANSTALK_HEADER_FOUND}" = "x0" ; then
+         BEANSTALK_LIB=""
+         BEANSTALK_INCLUDE=""
+      else
+
+         PBX_BEANSTALK=1
+         cat >>confdefs.h <<_ACEOF
+#define HAVE_BEANSTALK 1
+_ACEOF
+
+      fi
+   fi
+fi
+
+
+
+# possible places for oss definitions
+
+if test "x${PBX_OSS}" != "x1" -a "${USE_OSS}" != "no"; then
+   pbxlibdir=""
+   # if --with-OSS=DIR has been specified, use it.
+   if test "x${OSS_DIR}" != "x"; then
+      if test -d ${OSS_DIR}/lib; then
+         pbxlibdir="-L${OSS_DIR}/lib"
+      else
+         pbxlibdir="-L${OSS_DIR}"
+      fi
    fi
 
+      # empty lib, assume only headers
+      AST_OSS_FOUND=yes
+
+
    # now check for the header.
    if test "${AST_OSS_FOUND}" = "yes"; then
       OSS_LIB="${pbxlibdir} -lossaudio "
@@ -22739,9 +24619,8 @@ fi
          OSS_INCLUDE="-I${OSS_DIR}/include"
       fi
       OSS_INCLUDE="${OSS_INCLUDE} "
-      if test "xlinux/soundcard.h" = "x" ; then        # no header, assume found
-         OSS_HEADER_FOUND="1"
-      else                             # check for the header
+
+         # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${OSS_INCLUDE}"
          ac_fn_c_check_header_mongrel "$LINENO" "linux/soundcard.h" "ac_cv_header_linux_soundcard_h" "$ac_includes_default"
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
-      fi
+
       if test "x${OSS_HEADER_FOUND}" = "x0" ; then
          OSS_LIB=""
          OSS_INCLUDE=""
       else
-         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
+
+            # only checking headers -> no library
             OSS_LIB=""
-         fi
+
          PBX_OSS=1
          cat >>confdefs.h <<_ACEOF
 #define HAVE_OSS 1
@@ -22782,58 +24662,10 @@ if test "x${PBX_OSS}" != "x1" -a "${USE_OSS}" != "no"; then
          pbxlibdir="-L${OSS_DIR}"
       fi
    fi
-   pbxfuncname=""
-   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_OSS_FOUND=yes
-   else
-      ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
-      CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_ossaudio_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lossaudio" >&5
-$as_echo_n "checking for ${pbxfuncname} in -lossaudio... " >&6; }
-if eval \${$as_ac_Lib+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lossaudio ${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_OSS_FOUND=yes
-else
-  AST_OSS_FOUND=no
-fi
+      # empty lib, assume only headers
+      AST_OSS_FOUND=yes
 
-      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
-   fi
 
    # now check for the header.
    if test "${AST_OSS_FOUND}" = "yes"; then
@@ -22843,9 +24675,8 @@ fi
          OSS_INCLUDE="-I${OSS_DIR}/include"
       fi
       OSS_INCLUDE="${OSS_INCLUDE} "
-      if test "xsys/soundcard.h" = "x" ; then  # no header, assume found
-         OSS_HEADER_FOUND="1"
-      else                             # check for the header
+
+         # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${OSS_INCLUDE}"
          ac_fn_c_check_header_mongrel "$LINENO" "sys/soundcard.h" "ac_cv_header_sys_soundcard_h" "$ac_includes_default"
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
-      fi
+
       if test "x${OSS_HEADER_FOUND}" = "x0" ; then
          OSS_LIB=""
          OSS_INCLUDE=""
       else
-         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
+
+            # only checking headers -> no library
             OSS_LIB=""
-         fi
+
          PBX_OSS=1
          cat >>confdefs.h <<_ACEOF
 #define HAVE_OSS 1
@@ -22886,16 +24718,12 @@ if test "x${PBX_OSS}" != "x1" -a "${USE_OSS}" != "no"; then
          pbxlibdir="-L${OSS_DIR}"
       fi
    fi
-   pbxfuncname="oss_ioctl_mixer"
-   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_OSS_FOUND=yes
-   else
+
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_ossaudio_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lossaudio" >&5
-$as_echo_n "checking for ${pbxfuncname} in -lossaudio... " >&6; }
-if eval \${$as_ac_Lib+:} false; then :
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for oss_ioctl_mixer in -lossaudio" >&5
+$as_echo_n "checking for oss_ioctl_mixer in -lossaudio... " >&6; }
+if ${ac_cv_lib_ossaudio_oss_ioctl_mixer+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -22909,35 +24737,34 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char ${pbxfuncname} ();
+char oss_ioctl_mixer ();
 int
 main ()
 {
-return ${pbxfuncname} ();
+return oss_ioctl_mixer ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
+  ac_cv_lib_ossaudio_oss_ioctl_mixer=yes
 else
-  eval "$as_ac_Lib=no"
+  ac_cv_lib_ossaudio_oss_ioctl_mixer=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 :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ossaudio_oss_ioctl_mixer" >&5
+$as_echo "$ac_cv_lib_ossaudio_oss_ioctl_mixer" >&6; }
+if test "x$ac_cv_lib_ossaudio_oss_ioctl_mixer" = xyes; then :
   AST_OSS_FOUND=yes
 else
   AST_OSS_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
-   fi
+
 
    # now check for the header.
    if test "${AST_OSS_FOUND}" = "yes"; then
@@ -22947,9 +24774,8 @@ fi
          OSS_INCLUDE="-I${OSS_DIR}/include"
       fi
       OSS_INCLUDE="${OSS_INCLUDE} "
-      if test "xsoundcard.h" = "x" ; then      # no header, assume found
-         OSS_HEADER_FOUND="1"
-      else                             # check for the header
+
+         # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${OSS_INCLUDE}"
          ac_fn_c_check_header_mongrel "$LINENO" "soundcard.h" "ac_cv_header_soundcard_h" "$ac_includes_default"
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
-      fi
+
       if test "x${OSS_HEADER_FOUND}" = "x0" ; then
          OSS_LIB=""
          OSS_INCLUDE=""
       else
-         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            OSS_LIB=""
-         fi
+
          PBX_OSS=1
          cat >>confdefs.h <<_ACEOF
 #define HAVE_OSS 1
@@ -23309,6 +25133,8 @@ $as_echo "$as_me: *** including --without-postgres" >&6;}
    fi
 fi
 
+if test "$USE_PJPROJECT" != "no" ; then
+   if test "$PJPROJECT_BUNDLED" = "no" ; then
 
    if test "x${PBX_PJPROJECT}" != "x1" -a "${USE_PJPROJECT}" != "no"; then
 
 
 
 
-if test "x${PBX_POPT}" != "x1" -a "${USE_POPT}" != "no"; then
+if test "x${PBX_PJSIP_DLG_CREATE_UAS_AND_INC_LOCK}" != "x1" -a "${USE_PJSIP_DLG_CREATE_UAS_AND_INC_LOCK}" != "no"; then
    pbxlibdir=""
-   # if --with-POPT=DIR has been specified, use it.
-   if test "x${POPT_DIR}" != "x"; then
-      if test -d ${POPT_DIR}/lib; then
-         pbxlibdir="-L${POPT_DIR}/lib"
+   # if --with-PJSIP_DLG_CREATE_UAS_AND_INC_LOCK=DIR has been specified, use it.
+   if test "x${PJSIP_DLG_CREATE_UAS_AND_INC_LOCK_DIR}" != "x"; then
+      if test -d ${PJSIP_DLG_CREATE_UAS_AND_INC_LOCK_DIR}/lib; then
+         pbxlibdir="-L${PJSIP_DLG_CREATE_UAS_AND_INC_LOCK_DIR}/lib"
       else
-         pbxlibdir="-L${POPT_DIR}"
+         pbxlibdir="-L${PJSIP_DLG_CREATE_UAS_AND_INC_LOCK_DIR}"
       fi
    fi
-   pbxfuncname="poptStrerror"
-   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_POPT_FOUND=yes
-   else
+
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
-      CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_popt_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpopt" >&5
-$as_echo_n "checking for ${pbxfuncname} in -lpopt... " >&6; }
-if eval \${$as_ac_Lib+:} false; then :
+      CFLAGS="${CFLAGS} $PJPROJECT_CFLAGS"
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pjsip_dlg_create_uas_and_inc_lock in -lpjsip" >&5
+$as_echo_n "checking for pjsip_dlg_create_uas_and_inc_lock in -lpjsip... " >&6; }
+if ${ac_cv_lib_pjsip_pjsip_dlg_create_uas_and_inc_lock+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpopt ${pbxlibdir}  $LIBS"
+LIBS="-lpjsip ${pbxlibdir} $PJPROJECT_LIBS $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -23432,69 +25254,65 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char ${pbxfuncname} ();
+char pjsip_dlg_create_uas_and_inc_lock ();
 int
 main ()
 {
-return ${pbxfuncname} ();
+return pjsip_dlg_create_uas_and_inc_lock ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
+  ac_cv_lib_pjsip_pjsip_dlg_create_uas_and_inc_lock=yes
 else
-  eval "$as_ac_Lib=no"
+  ac_cv_lib_pjsip_pjsip_dlg_create_uas_and_inc_lock=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_POPT_FOUND=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pjsip_pjsip_dlg_create_uas_and_inc_lock" >&5
+$as_echo "$ac_cv_lib_pjsip_pjsip_dlg_create_uas_and_inc_lock" >&6; }
+if test "x$ac_cv_lib_pjsip_pjsip_dlg_create_uas_and_inc_lock" = xyes; then :
+  AST_PJSIP_DLG_CREATE_UAS_AND_INC_LOCK_FOUND=yes
 else
-  AST_POPT_FOUND=no
+  AST_PJSIP_DLG_CREATE_UAS_AND_INC_LOCK_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
-   fi
+
 
    # now check for the header.
-   if test "${AST_POPT_FOUND}" = "yes"; then
-      POPT_LIB="${pbxlibdir} -lpopt "
-      # if --with-POPT=DIR has been specified, use it.
-      if test "x${POPT_DIR}" != "x"; then
-         POPT_INCLUDE="-I${POPT_DIR}/include"
+   if test "${AST_PJSIP_DLG_CREATE_UAS_AND_INC_LOCK_FOUND}" = "yes"; then
+      PJSIP_DLG_CREATE_UAS_AND_INC_LOCK_LIB="${pbxlibdir} -lpjsip $PJPROJECT_LIBS"
+      # if --with-PJSIP_DLG_CREATE_UAS_AND_INC_LOCK=DIR has been specified, use it.
+      if test "x${PJSIP_DLG_CREATE_UAS_AND_INC_LOCK_DIR}" != "x"; then
+         PJSIP_DLG_CREATE_UAS_AND_INC_LOCK_INCLUDE="-I${PJSIP_DLG_CREATE_UAS_AND_INC_LOCK_DIR}/include"
       fi
-      POPT_INCLUDE="${POPT_INCLUDE} "
-      if test "xpopt.h" = "x" ; then   # no header, assume found
-         POPT_HEADER_FOUND="1"
-      else                             # check for the header
+      PJSIP_DLG_CREATE_UAS_AND_INC_LOCK_INCLUDE="${PJSIP_DLG_CREATE_UAS_AND_INC_LOCK_INCLUDE} $PJPROJECT_CFLAGS"
+
+         # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${POPT_INCLUDE}"
-         ac_fn_c_check_header_mongrel "$LINENO" "popt.h" "ac_cv_header_popt_h" "$ac_includes_default"
-if test "x$ac_cv_header_popt_h" = xyes; then :
-  POPT_HEADER_FOUND=1
+         CPPFLAGS="${CPPFLAGS} ${PJSIP_DLG_CREATE_UAS_AND_INC_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 :
+  PJSIP_DLG_CREATE_UAS_AND_INC_LOCK_HEADER_FOUND=1
 else
-  POPT_HEADER_FOUND=0
+  PJSIP_DLG_CREATE_UAS_AND_INC_LOCK_HEADER_FOUND=0
 fi
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
-      fi
-      if test "x${POPT_HEADER_FOUND}" = "x0" ; then
-         POPT_LIB=""
-         POPT_INCLUDE=""
+
+      if test "x${PJSIP_DLG_CREATE_UAS_AND_INC_LOCK_HEADER_FOUND}" = "x0" ; then
+         PJSIP_DLG_CREATE_UAS_AND_INC_LOCK_LIB=""
+         PJSIP_DLG_CREATE_UAS_AND_INC_LOCK_INCLUDE=""
       else
-         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            POPT_LIB=""
-         fi
-         PBX_POPT=1
+
+         PBX_PJSIP_DLG_CREATE_UAS_AND_INC_LOCK=1
          cat >>confdefs.h <<_ACEOF
-#define HAVE_POPT 1
+#define HAVE_PJSIP_DLG_CREATE_UAS_AND_INC_LOCK 1
 _ACEOF
 
       fi
 
 
 
-
-if test "x${PBX_PORTAUDIO}" != "x1" -a "${USE_PORTAUDIO}" != "no"; then
+if test "x${PBX_PJ_TRANSACTION_GRP_LOCK}" != "x1" -a "${USE_PJ_TRANSACTION_GRP_LOCK}" != "no"; then
    pbxlibdir=""
-   # 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"
+   # 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${PORTAUDIO_DIR}"
+         pbxlibdir="-L${PJ_TRANSACTION_GRP_LOCK_DIR}"
       fi
    fi
-   pbxfuncname="Pa_GetDeviceCount"
-   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_PORTAUDIO_FOUND=yes
-   else
+
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
-      CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_portaudio_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lportaudio" >&5
-$as_echo_n "checking for ${pbxfuncname} in -lportaudio... " >&6; }
-if eval \${$as_ac_Lib+:} false; then :
+      CFLAGS="${CFLAGS} $PJPROJECT_CFLAGS"
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pjsip_tsx_create_uac2 in -lpjsip" >&5
+$as_echo_n "checking for pjsip_tsx_create_uac2 in -lpjsip... " >&6; }
+if ${ac_cv_lib_pjsip_pjsip_tsx_create_uac2+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lportaudio ${pbxlibdir}  $LIBS"
+LIBS="-lpjsip ${pbxlibdir} $PJPROJECT_LIB $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -23537,69 +25350,65 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char ${pbxfuncname} ();
+char pjsip_tsx_create_uac2 ();
 int
 main ()
 {
-return ${pbxfuncname} ();
+return pjsip_tsx_create_uac2 ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
+  ac_cv_lib_pjsip_pjsip_tsx_create_uac2=yes
 else
-  eval "$as_ac_Lib=no"
+  ac_cv_lib_pjsip_pjsip_tsx_create_uac2=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_PORTAUDIO_FOUND=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pjsip_pjsip_tsx_create_uac2" >&5
+$as_echo "$ac_cv_lib_pjsip_pjsip_tsx_create_uac2" >&6; }
+if test "x$ac_cv_lib_pjsip_pjsip_tsx_create_uac2" = xyes; then :
+  AST_PJ_TRANSACTION_GRP_LOCK_FOUND=yes
 else
-  AST_PORTAUDIO_FOUND=no
+  AST_PJ_TRANSACTION_GRP_LOCK_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
-   fi
+
 
    # now check for the header.
-   if test "${AST_PORTAUDIO_FOUND}" = "yes"; then
-      PORTAUDIO_LIB="${pbxlibdir} -lportaudio "
-      # if --with-PORTAUDIO=DIR has been specified, use it.
-      if test "x${PORTAUDIO_DIR}" != "x"; then
-         PORTAUDIO_INCLUDE="-I${PORTAUDIO_DIR}/include"
+   if test "${AST_PJ_TRANSACTION_GRP_LOCK_FOUND}" = "yes"; then
+      PJ_TRANSACTION_GRP_LOCK_LIB="${pbxlibdir} -lpjsip $PJPROJECT_LIB"
+      # 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
-      PORTAUDIO_INCLUDE="${PORTAUDIO_INCLUDE} "
-      if test "xportaudio.h" = "x" ; then      # no header, assume found
-         PORTAUDIO_HEADER_FOUND="1"
-      else                             # check for the header
+      PJ_TRANSACTION_GRP_LOCK_INCLUDE="${PJ_TRANSACTION_GRP_LOCK_INCLUDE} $PJPROJECT_CFLAGS"
+
+         # 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} ${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
-  PORTAUDIO_HEADER_FOUND=0
+  PJ_TRANSACTION_GRP_LOCK_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${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
-            PORTAUDIO_LIB=""
-         fi
-         PBX_PORTAUDIO=1
+
+         PBX_PJ_TRANSACTION_GRP_LOCK=1
          cat >>confdefs.h <<_ACEOF
-#define HAVE_PORTAUDIO 1
+#define HAVE_PJ_TRANSACTION_GRP_LOCK 1
 _ACEOF
 
       fi
 
 
 
+      saved_cppflags="${CPPFLAGS}"
+      saved_libs="${LIBS}"
+      CPPFLAGS="${CPPFLAGS} ${PJPROJECT_CFLAGS}"
+      LIBS="${LIBS} ${PJPROJECT_LIB}"
 
-if test "x${PBX_PRI}" != "x1" -a "${USE_PRI}" != "no"; then
+    if test "x${PBX_PJSIP_REPLACE_MEDIA_STREAM}" != "x1" -a "${USE_PJSIP_REPLACE_MEDIA_STREAM}" != "no"; then
+       { $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; }
+       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 <pjmedia.h>
+int
+main ()
+{
+ pjmedia_mod_offer_flag flag = PJMEDIA_SDP_NEG_ALLOW_MEDIA_CHANGE;
+
+  ;
+  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_PJSIP_REPLACE_MEDIA_STREAM=1
+
+$as_echo "#define HAVE_PJSIP_REPLACE_MEDIA_STREAM 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
+
+      LIBS="${saved_libs}"
+      CPPFLAGS="${saved_cppflags}"
+
+
+if test "x${PBX_PJSIP_GET_DEST_INFO}" != "x1" -a "${USE_PJSIP_GET_DEST_INFO}" != "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-PJSIP_GET_DEST_INFO=DIR has been specified, use it.
+   if test "x${PJSIP_GET_DEST_INFO_DIR}" != "x"; then
+      if test -d ${PJSIP_GET_DEST_INFO_DIR}/lib; then
+         pbxlibdir="-L${PJSIP_GET_DEST_INFO_DIR}/lib"
       else
-         pbxlibdir="-L${PRI_DIR}"
+         pbxlibdir="-L${PJSIP_GET_DEST_INFO_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 :
+      CFLAGS="${CFLAGS} $PJPROJECT_CFLAGS"
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pjsip_get_dest_info in -lpjsip" >&5
+$as_echo_n "checking for pjsip_get_dest_info in -lpjsip... " >&6; }
+if ${ac_cv_lib_pjsip_pjsip_get_dest_info+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpri ${pbxlibdir}  $LIBS"
+LIBS="-lpjsip ${pbxlibdir} $PJPROJECT_LIB $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -23642,69 +25494,65 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char ${pbxfuncname} ();
+char pjsip_get_dest_info ();
 int
 main ()
 {
-return ${pbxfuncname} ();
+return pjsip_get_dest_info ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
+  ac_cv_lib_pjsip_pjsip_get_dest_info=yes
 else
-  eval "$as_ac_Lib=no"
+  ac_cv_lib_pjsip_pjsip_get_dest_info=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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pjsip_pjsip_get_dest_info" >&5
+$as_echo "$ac_cv_lib_pjsip_pjsip_get_dest_info" >&6; }
+if test "x$ac_cv_lib_pjsip_pjsip_get_dest_info" = xyes; then :
+  AST_PJSIP_GET_DEST_INFO_FOUND=yes
 else
-  AST_PRI_FOUND=no
+  AST_PJSIP_GET_DEST_INFO_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_PJSIP_GET_DEST_INFO_FOUND}" = "yes"; then
+      PJSIP_GET_DEST_INFO_LIB="${pbxlibdir} -lpjsip $PJPROJECT_LIB"
+      # if --with-PJSIP_GET_DEST_INFO=DIR has been specified, use it.
+      if test "x${PJSIP_GET_DEST_INFO_DIR}" != "x"; then
+         PJSIP_GET_DEST_INFO_INCLUDE="-I${PJSIP_GET_DEST_INFO_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
+      PJSIP_GET_DEST_INFO_INCLUDE="${PJSIP_GET_DEST_INFO_INCLUDE} $PJPROJECT_CFLAGS"
+
+         # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         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
+         CPPFLAGS="${CPPFLAGS} ${PJSIP_GET_DEST_INFO_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 :
+  PJSIP_GET_DEST_INFO_HEADER_FOUND=1
 else
-  PRI_HEADER_FOUND=0
+  PJSIP_GET_DEST_INFO_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${PJSIP_GET_DEST_INFO_HEADER_FOUND}" = "