From e61d3d91f37f8b5b2fbcd30c2d3d0ba3abd5478f Mon Sep 17 00:00:00 2001
From: "Kevin P. Fleming" <kpfleming@digium.com>
Date: Sat, 24 Jun 2006 19:43:31 +0000
Subject: [PATCH] The Eurostar Commit! (it's amazing how much work you can get
 done on a 150 minute train ride from Paris to London <G>)

support the new location for zaptel.h and tonezone.h
use the dependency information output by menuselect to build Makefile rules for each module for header files and libraries
combine the common rules into a top-level Makefile.rules file
remove all (now) unnecessary stuff from subdir Makefiles
change translator API so that the newpvt() callback returns an int instead of a pointer (it no longer allocates memory)
alphabetize --with-<foo> options in configure script
enhance Net-SNMP support in configure script to provide a --with-netsnmp option
fix support for --with-pq so that if pg-config is not found when --with-pq is specified, an error will be generated
add 'optional package' usage to modules now that menuselect can output it
allow res_snmp to build by default, since the new loader changes coming soon will solve the function naming problem (and users can disable it via menuselect anyway)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@35832 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 Makefile                         |    15 +-
 apps/Makefile                    |    45 +-
 apps/app_flash.c                 |     4 -
 apps/app_meetme.c                |     4 -
 apps/app_rpt.c                   |     2 +-
 apps/app_zapbarge.c              |     5 -
 apps/app_zapras.c                |     6 -
 apps/app_zapscan.c               |     5 -
 build_tools/menuselect-deps.in   |     2 +-
 cdr/Makefile                     |    74 +-
 channel.c                        |     7 -
 channels/Makefile                |    91 +-
 channels/chan_iax2.c             |     8 +-
 channels/chan_zap.c              |     8 +-
 codecs/codec_g726.c              |     5 +-
 codecs/codec_gsm.c               |     6 +-
 codecs/codec_ilbc.c              |    10 +-
 codecs/codec_lpc10.c             |    12 +-
 codecs/codec_speex.c             |    15 +-
 codecs/codec_zap.c               |    16 +-
 configure                        | 10172 +++++++++++++++--------------
 configure.ac                     |   620 +-
 formats/Makefile                 |    39 +-
 formats/format_ogg_vorbis.c      |     2 +-
 funcs/Makefile                   |    46 +-
 include/asterisk/autoconfig.h.in |     3 +
 include/asterisk/translate.h     |     2 +-
 makeopts.in                      |    52 +-
 pbx/Makefile                     |    70 +-
 res/Makefile                     |    82 +-
 res/res_musiconhold.c            |     5 +-
 res/res_snmp.c                   |     1 -
 translate.c                      |     2 +-
 33 files changed, 5683 insertions(+), 5753 deletions(-)

diff --git a/Makefile b/Makefile
index 7c693ff043..7af2cca9bc 100644
--- a/Makefile
+++ b/Makefile
@@ -228,9 +228,6 @@ ifeq ($(OSARCH),FreeBSD)
   BSDVERSION=$(shell make -V OSVERSION -f $(CROSS_COMPILE_TARGET)/usr/share/mk/bsd.port.subdir.mk)
   ASTCFLAGS+=$(shell if test $(BSDVERSION) -lt 500016 ; then echo "-D_THREAD_SAFE"; fi)
   LIBS+=$(shell if test  $(BSDVERSION) -lt 502102 ; then echo "-lc_r"; else echo "-pthread"; fi)
-  ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/local/include/spandsp),)
-    ASTCFLAGS+=-I$(CROSS_COMPILE_TARGET)/usr/local/include/spandsp
-  endif
 endif # FreeBSD
 
 ifeq ($(OSARCH),NetBSD)
@@ -303,9 +300,9 @@ ifeq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/dlfcn.h),)
 endif
 
 ifeq ($(OSARCH),Linux)
-  LIBS+=-ldl -lpthread $(EDITLINE_LIBS) -lm -lresolv  #-lnjamd
+  LIBS+=-ldl -lpthread $(EDITLINE_LIB) -lm -lresolv  #-lnjamd
 else
-  LIBS+=$(EDITLINE_LIBS) -lm
+  LIBS+=$(EDITLINE_LIB) -lm
 endif
 
 ifeq ($(OSARCH),Darwin)
@@ -333,11 +330,11 @@ ifeq ($(OSARCH),FreeBSD)
 endif
 
 ifeq ($(OSARCH),NetBSD)
-  LIBS+=-lpthread -lcrypto -lm -L$(CROSS_COMPILE_TARGET)/usr/pkg/lib $(EDITLINE_LIBS)
+  LIBS+=-lpthread -lcrypto -lm -L$(CROSS_COMPILE_TARGET)/usr/pkg/lib $(EDITLINE_LIB)
 endif
 
 ifeq ($(OSARCH),OpenBSD)
-  LIBS+=-lcrypto -lpthread -lm $(EDITLINE_LIBS)
+  LIBS+=-lcrypto -lpthread -lm $(EDITLINE_LIB)
 endif
 
 ifeq ($(OSARCH),SunOS)
@@ -474,6 +471,9 @@ include/asterisk/buildopts.h: menuselect.makeopts
 	fi
 	@rm -f $@.tmp
 
+channel.o: channel.c
+	$(CC) -c -o $@ $< $(CFLAGS) $(ZAPTEL_INCLUDE)
+
 asterisk: include/asterisk/buildopts.h editline/libedit.a db1-ast/libdb1.a $(OBJS)
 	build_tools/make_build_h > include/asterisk/build.h.tmp
 	if cmp -s include/asterisk/build.h.tmp include/asterisk/build.h ; then echo ; else \
@@ -885,5 +885,6 @@ mxml/libmxml.a:
 makeopts.xml: $(foreach dir,$(MOD_SUBDIRS),$(dir)/*.c) build_tools/cflags.xml sounds/sounds.xml
 	@echo "Generating list of available modules ..."
 	@build_tools/prep_moduledeps > $@
+	@sed -i -e /MENUSELECT_DEPENDS/d menuselect.makeopts
 
 .PHONY: menuselect sounds clean clean-depend dist-clean distclean all _all depend cleantest uninstall _uninstall uninstall-all dont-optimize valgrind $(SUBDIRS_INSTALL) $(SUBDIRS_CLEAN) $(SUBDIRS_CLEAN_DEPEND) $(SUBDIRS_DEPEND) $(SUBDIRS_UNINSTALL) $(SUBDIRS)
diff --git a/apps/Makefile b/apps/Makefile
index a48477abe2..01d70c6af3 100644
--- a/apps/Makefile
+++ b/apps/Makefile
@@ -5,62 +5,23 @@
 #
 # Copyright (C) 1999-2006, Digium, Inc.
 #
-# Mark Spencer <markster@digium.com>
-#
 # This program is free software, distributed under the terms of
 # the GNU General Public License
 #
 
-.PHONY: clean clean-depend all depend uninstall
-
 ifneq ($(wildcard ../menuselect.makeopts),)
   include ../menuselect.makeopts
 endif
 
 SELECTED_MODS:=$(filter-out $(MENUSELECT_APPS),$(patsubst %.c,%,$(wildcard app_*.c)))
 
-MODS:=$(patsubst %,%.so,$(SELECTED_MODS))
-
-app_voicemail.o: CFLAGS+=$(patsubst %,-D%,$(MENUSELECT_app_voicemail))
-
-all: $(MODS)
-
-clean-depend:
-	rm -f .depend
-
-clean: clean-depend
-	rm -f *.so *.o
-
-%.so: %.o
-	$(CC) $(SOLINK) -o $@ $<
-
-app_rpt.so: app_rpt.o
-	$(CC) $(SOLINK) -o $@ $< $(TONEZONE_LIB)
+MENUSELECT_DEPENDS_app_voicemail+=$(MENUSELECT_DEPENDS_ODBC_STORAGE) $(MENUSELECT_DEPENDS_EXTENDED_ODBC_STORAGE)
 
-app_rpt.o: app_rpt.c
-	$(CC) -c -o $@ $(CFLAGS) $(TONEZONE_INCLUDE) $(ZAPTEL_INCLUDE) $<
+all: _all
 
-app_flash.o app_meetme.o app_page.o app_zapbarge.o app_zapras.o app_zapscan.o: %.o: %.c
-	$(CC) -c -o $@ $(CFLAGS) $(ZAPTEL_INCLUDE) $<
-
-install: all
-	for x in $(MODS); do $(INSTALL) -m 755 $$x $(DESTDIR)$(MODULES_DIR) ; done
-
-uninstall:
+include ../Makefile.rules
 
 ifeq (SunOS,$(shell uname))
 app_chanspy.so: app_chanspy.o
 	$(CC) $(SOLINK) -o $@ $< -lrt
 endif
-
-ifneq ($(wildcard .depend),)
- include .depend
-endif
-
-depend: .depend
-
-.depend:
-	../build_tools/mkdep $(CFLAGS) `ls *.c`
-
-env:
-	env
diff --git a/apps/app_flash.c b/apps/app_flash.c
index f1e652a6ab..a49505210e 100644
--- a/apps/app_flash.c
+++ b/apps/app_flash.c
@@ -38,11 +38,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 #include <string.h>
 #include <errno.h>
 #include <sys/ioctl.h>
-#ifdef __linux__
-#include <linux/zaptel.h>
-#else
 #include <zaptel.h>
-#endif /* __linux__ */
 
 #include "asterisk/lock.h"
 #include "asterisk/file.h"
diff --git a/apps/app_meetme.c b/apps/app_meetme.c
index f19ecccf8b..16cf7f1a85 100644
--- a/apps/app_meetme.c
+++ b/apps/app_meetme.c
@@ -39,11 +39,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 #include <unistd.h>
 #include <errno.h>
 #include <sys/ioctl.h>
-#ifdef __linux__
-#include <linux/zaptel.h>
-#else
 #include <zaptel.h>
-#endif /* __linux__ */
 
 #include "asterisk/lock.h"
 #include "asterisk/file.h"
diff --git a/apps/app_rpt.c b/apps/app_rpt.c
index c18fc20715..506683b31d 100644
--- a/apps/app_rpt.c
+++ b/apps/app_rpt.c
@@ -222,8 +222,8 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 #include <sys/ioctl.h>
 #include <sys/io.h>
 #include <math.h>
+#include <zaptel.h>
 #include <tonezone.h>
-#include <linux/zaptel.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
 
diff --git a/apps/app_zapbarge.c b/apps/app_zapbarge.c
index 943d41bb73..2381509bb2 100644
--- a/apps/app_zapbarge.c
+++ b/apps/app_zapbarge.c
@@ -45,12 +45,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 #include <unistd.h>
 #include <errno.h>
 #include <sys/ioctl.h>
-
-#ifdef __linux__
-#include <linux/zaptel.h>
-#else
 #include <zaptel.h>
-#endif /* __linux__ */
 
 #include "asterisk/lock.h"
 #include "asterisk/file.h"
diff --git a/apps/app_zapras.c b/apps/app_zapras.c
index 95e69ac66f..8511c4ea5d 100644
--- a/apps/app_zapras.c
+++ b/apps/app_zapras.c
@@ -48,13 +48,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 #include <errno.h>
 #include <stdio.h>
 #include <fcntl.h>
-
-/* Need some zaptel help here */
-#ifdef __linux__
-#include <linux/zaptel.h>
-#else
 #include <zaptel.h>
-#endif /* __linux__ */
 
 #include "asterisk/lock.h"
 #include "asterisk/file.h"
diff --git a/apps/app_zapscan.c b/apps/app_zapscan.c
index b4257d8edc..7697f11b1c 100644
--- a/apps/app_zapscan.c
+++ b/apps/app_zapscan.c
@@ -44,12 +44,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 #include <unistd.h>
 #include <errno.h>
 #include <sys/ioctl.h>
-
-#ifdef __linux__
-#include <linux/zaptel.h>
-#else
 #include <zaptel.h>
-#endif /* __linux__ */
 
 #include "asterisk/lock.h"
 #include "asterisk/file.h"
diff --git a/build_tools/menuselect-deps.in b/build_tools/menuselect-deps.in
index 968e16dc39..aa4e15c9f1 100644
--- a/build_tools/menuselect-deps.in
+++ b/build_tools/menuselect-deps.in
@@ -11,7 +11,7 @@ LIBPRI=@PBX_LIBLIBPRI@
 LIBSPEEX=@PBX_LIBSPEEX@
 LIBVORBIS=@PBX_LIBVORBIS@
 NBS=@PBX_LIBNBS@
-OGG=@PBX_LIBOGG@
+LIBOGG=@PBX_LIBOGG@
 OSSAUDIO=@PBX_LIBOSS@
 PGSQL=@PBX_LIBpq@
 QT=@PBX_QT@
diff --git a/cdr/Makefile b/cdr/Makefile
index cfc6fbfa5b..5b1f5071b4 100644
--- a/cdr/Makefile
+++ b/cdr/Makefile
@@ -5,31 +5,17 @@
 #
 # Copyright (C) 1999-2006, Digium, Inc.
 #
-# Mark Spencer <markster@digium.com>
-#
 # This program is free software, distributed under the terms of
 # the GNU General Public License
 #
 
-.PHONY: clean clean-depend all depend uninstall
-
 ifneq ($(wildcard ../menuselect.makeopts),)
   include ../menuselect.makeopts
 endif
 
 SELECTED_MODS:=$(filter-out $(MENUSELECT_CDR),$(patsubst %.c,%,$(wildcard cdr_*.c)))
 
-#The problem with sparc is the best stuff is in newer versions of gcc (post 3.0) only.
-#This works for even old (2.96) versions of gcc and provides a small boost either way.
-#A ultrasparc cpu is really v9 but the stock debian stable 3.0 gcc doesn.t support it.
-#So we go lowest common available by gcc and go a step down, still a step up from
-#the default as we now have a better instruction set to work with. - Belgarath
-ifeq ($(PROC),sparc64)
-  PROC=ultrasparc
-  CFLAGS += -mtune=$(PROC) -pipe -fomit-frame-pointer -mcpu=v8
-endif
-
-ifneq ($(TDS_LIB),)
+ifneq ($(FREETDS_LIB),)
   ifeq ($(shell grep -s TDS_VERSION_NO $(CROSS_COMPILE_TARGET)/usr/include/tdsver.h $(CROSS_COMPILE_TARGET)/usr/local/include/tdsver.h $(CROSS_COMPILE_TARGET)/usr/include/freetds/tdsver.h | grep -c 0.63),1)
     CFLAGS += -DFREETDS_0_63
   else
@@ -41,60 +27,6 @@ ifneq ($(TDS_LIB),)
   endif
 endif
 
-MODS:=$(patsubst %,%.so,$(SELECTED_MODS))
-
-all: $(MODS)
-
-install: all
-	for x in $(MODS); do $(INSTALL) -m 755 $$x $(DESTDIR)$(MODULES_DIR) ; done
-
-uninstall:
-
-clean-depend:
-	rm -f .depend
-
-clean: clean-depend
-	rm -f *.so *.o
-
-%.so : %.o
-	$(CC) $(SOLINK) -o $@ $<
-
-cdr_odbc.so: cdr_odbc.o
-	$(CC) $(SOLINK) -o $@ $< $(ODBC_LIB)
-
-cdr_odbc.o: cdr_odbc.c
-	$(CC) -c -o $@ $(CFLAGS) $(ODBC_INCLUDE) $<
-
-cdr_tds.so: cdr_tds.o
-	$(CC) $(SOLINK) -o $@ $< $(TDS_LIB)
-
-cdr_tds.o: cdr_tds.c
-	$(CC) -c -o $@ $(CFLAGS) $(TDS_INCLUDE) $<
-
-cdr_pgsql.so: cdr_pgsql.o
-	$(CC) $(SOLINK) -o $@ $< $(PGSQL_LIB)
-
-cdr_pgsql.o: cdr_pgsql.c
-	$(CC) -c -o $@ $(CFLAGS) $(PGSQL_INCLUDE) $<
-
-cdr_sqlite.so: cdr_sqlite.o
-	$(CC) $(SOLINK) -o $@ $< $(SQLITE_LIB)
-
-cdr_sqlite.o: cdr_sqlite.c
-	$(CC) -c -o $@ $(CFLAGS) $(SQLITE_INCLUDE) $<
-
-cdr_radius.so: cdr_radius.o
-	$(CC) $(SOLINK) -o $@ $< $(RADIUSCLIENT_LIB)
-
-cdr_radius.o: cdr_radius.c
-	$(CC) -c -o $@ $(CFLAGS) $(RADIUSCLIENT_INCLUDE) $<
-
-
-ifneq ($(wildcard .depend),)
-  include .depend
-endif
-
-depend: .depend
+all: _all
 
-.depend:
-	../build_tools/mkdep $(CFLAGS) `ls *.c`
+include ../Makefile.rules
diff --git a/channel.c b/channel.c
index 30a1ad073a..90d8a2e48f 100644
--- a/channel.c
+++ b/channel.c
@@ -38,14 +38,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #ifdef HAVE_ZAPTEL
 #include <sys/ioctl.h>
-#ifdef __linux__
-#include <linux/zaptel.h>
-#else
 #include <zaptel.h>
-#endif /* __linux__ */
-#ifndef ZT_TIMERPING
-#error "You need newer zaptel!  Please cvs update zaptel"
-#endif
 #endif
 
 #include "asterisk/pbx.h"
diff --git a/channels/Makefile b/channels/Makefile
index c98af29d0d..e65ce12566 100644
--- a/channels/Makefile
+++ b/channels/Makefile
@@ -5,14 +5,10 @@
 #
 # Copyright (C) 1999-2006, Digium, Inc.
 #
-# Mark Spencer <markster@digium.com>
-#
 # This program is free software, distributed under the terms of
 # the GNU General Public License
 #
 
-.PHONY: clean clean-depend all depend uninstall
-
 ifneq ($(wildcard ../menuselect.makeopts),)
   include ../menuselect.makeopts
 endif
@@ -30,11 +26,6 @@ ifeq ($(OSARCH),Linux)
   CHANH323LIB=-ldl
 endif
 
-ifeq ($(PROC),sparc64)
-  PROC=ultrasparc
-  CFLAGS += -mtune=$(PROC) -pipe -fomit-frame-pointer -mcpu=v8
-endif
-
 ifeq ($(OSARCH),FreeBSD)
   PTLIB=-lpt_FreeBSD_x86_r
   H323LIB=-lh323_FreeBSD_x86_r
@@ -46,10 +37,6 @@ ifeq ($(OSARCH),NetBSD)
   H323LIB=-lh323_NetBSD_x86_r
 endif
 
-ifeq ($(OSARCH),SunOS)
-  SOLINK+=-lrt
-endif
-
 ifeq ($(wildcard h323/libchanh323.a),)
   SELECTED_MODS:=$(filter-out chan_h323,$(SELECTED_MODS))
 endif
@@ -68,24 +55,15 @@ ifndef PWLIBDIR
   PWLIBDIR=$(HOME)/pwlib
 endif
 
-MODS:=$(patsubst %,%.so,$(SELECTED_MODS))
+MENUSELECT_OPTS_chan_misdn+=CHAN_MISDN_VERSION=\"0.3.0\"
 
-all: $(MODS) 
+all: _all
 
-clean-depend:
-	rm -f .depend
+include ../Makefile.rules
 
-clean: clean-depend
-	rm -f *.so *.o
+clean::
 	rm -f busy.h ringtone.h gentone gentone-ulaw
 
-%.so : %.o
-	$(CC) $(SOLINK) -o $@ $<
-
-ifneq ($(wildcard .depend),)
-  include .depend
-endif
-
 ifneq ($(wildcard h323/Makefile.ast),)
   include h323/Makefile.ast
 endif
@@ -94,11 +72,8 @@ ifneq ($(wildcard misdn/Makefile.ast),)
   include misdn/Makefile.ast
 endif
 
-gentone: gentone.c
-	$(HOST_CC) -o gentone gentone.c -lm
-
-gentone-ulaw: gentone-ulaw.c
-	$(HOST_CC) -o gentone-ulaw gentone-ulaw.c -lm
+gentone gentone-ulaw: %: %.c
+	$(HOST_CC) -o $@ $< -lm
 
 busy.h: gentone
 	./gentone busy 480 620
@@ -107,31 +82,10 @@ ringtone.h: gentone
 	./gentone ringtone 440 480
 
 chan_oss.o: chan_oss.c busy.h ringtone.h
-	$(CC) -c -o $@ $(CFLAGS) $(OSSAUDIO_INCLUDE) $<
-
-chan_oss.so: chan_oss.o
-	$(CC) $(SOLINK) -o $@ chan_oss.o $(OSSAUDIO_LIB)
-
-chan_iax2.so: chan_iax2.o iax2-parser.o iax2-provision.o
-	$(CC) $(SOLINK) -o $@ $^
-
-chan_zap.so: chan_zap.o
-	$(CC) $(SOLINK) -o $@ $< $(PRI_LIB) $(TONEZONE_LIB)
 
-chan_zap.o: chan_zap.c
-	$(CC) -c -o $@ $(CFLAGS) $(TONEZONE_INCLUDE) $(ZAPTEL_INCLUDE) $<
+chan_iax2.so: iax2-parser.o iax2-provision.o
 
-chan_alsa.so: chan_alsa.o
-	$(CC) $(SOLINK) -o $@ $< $(ASOUND_LIB)
-
-chan_alsa.o: chan_alsa.c busy.h ringtone.h
-	$(CC) -c -o $@ $(CFLAGS) $(ASOUND_INCLUDE) $<
-
-chan_nbs.so: chan_nbs.o
-	$(CC) $(SOLINK) -o $@ $< $(NBS_LIB)
-
-chan_nbs.o: chan_nbs.c
-	$(CC) -c -o $@ $(CFLAGS) $(NBS_INCLUDE) $<
+chan_alsa.o: busy.h ringtone.h
 
 chan_vpb.o: chan_vpb.c
 	$(CXX) -c $(CFLAGS:-Werror=) -o $@ chan_vpb.c
@@ -139,12 +93,6 @@ chan_vpb.o: chan_vpb.c
 chan_vpb.so: chan_vpb.o
 	 $(CXX) $(SOLINK) -o $@ $< -lvpb -lpthread -lm -ldl
 
-chan_jingle.o: chan_jingle.c
-	$(CC) -c -o $@ $(CFLAGS) $(IKSEMEL_INCLUDE) $<
-
-chan_jingle.so: chan_jingle.o
-	$(CC) $(SOLINK) -o $@ $< $(IKSEMEL_LIB)
-
 ifeq ($(OSARCH),Linux)
 chan_h323.so: chan_h323.o h323/libchanh323.a h323/Makefile.ast
 	$(CC) $(SOLINK) $(H323LDFLAGS) -o $@ $< h323/libchanh323.a $(H323LDLIBS) -lstdc++
@@ -156,24 +104,5 @@ endif
 misdn/chan_misdn_lib.a:
 	make -C misdn
 
-chan_misdn.so: chan_misdn.o misdn_config.o misdn/chan_misdn_lib.a
-	$(CC) -shared -Xlinker -x -L/usr/lib -o $@ $^ -lisdnnet -lmISDN
-
-chan_misdn.o: chan_misdn.c
-	$(CC) $(CFLAGS) -DCHAN_MISDN_VERSION=\"0.3.0\" -c $< -o $@
-
-misdn_config.o: misdn_config.c misdn/chan_misdn_config.h
-	$(CC) $(CFLAGS) -DCHAN_MISDN_VERSION=\"0.3.0\" -c $< -o $@
-
-install: all
-	for x in $(MODS); do $(INSTALL) -m 755 $$x $(DESTDIR)$(MODULES_DIR) ; done
-
-uninstall:
-
-depend: .depend
-
-.depend:
-	../build_tools/mkdep $(CFLAGS) `ls *.c`
-
-env:
-	env
+chan_misdn.so: misdn_config.o misdn/chan_misdn_lib.a
+	$(CC) $(SOLINK) -o $@ $^ -lisdnnet -lmISDN
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index ab48d9a01d..7eb42457e0 100644
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -28,6 +28,10 @@
  * \ingroup channel_drivers
  */
 
+/*** MODULEINFO
+	<use>zaptel</use>
+ ***/
+
 #include "asterisk.h"
 
 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
@@ -56,11 +60,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #ifdef HAVE_ZAPTEL
 #include <sys/ioctl.h>
-#ifdef __linux__
-#include <linux/zaptel.h>
-#else
 #include <zaptel.h>
-#endif /* __linux__ */
 #endif
 
 #include "asterisk/lock.h"
diff --git a/channels/chan_zap.c b/channels/chan_zap.c
index 47599e4d97..e2d96b1293 100644
--- a/channels/chan_zap.c
+++ b/channels/chan_zap.c
@@ -40,6 +40,7 @@
 /*** MODULEINFO
 	<depend>zaptel</depend>
 	<depend>tonezone</depend>
+	<use>libpri</use>
  ***/
 
 #include "asterisk.h"
@@ -61,20 +62,13 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 #endif
 #include <unistd.h>
 #include <sys/ioctl.h>
-#ifdef __linux__
-#include <linux/zaptel.h>
-#else
 #include <zaptel.h>
-#endif /* __linux__ */
 #include <math.h>
 #include <tonezone.h>
 #include <ctype.h>
 
 #ifdef HAVE_LIBPRI
 #include <libpri.h>
-#ifndef PRI_KEYPAD_FACILITY_TX
-#error "You need newer libpri"
-#endif
 #endif
 
 #include "asterisk/lock.h"
diff --git a/codecs/codec_g726.c b/codecs/codec_g726.c
index f4cfdd7498..1634ae5d22 100644
--- a/codecs/codec_g726.c
+++ b/codecs/codec_g726.c
@@ -700,12 +700,13 @@ struct g726_coder_pvt {
 };
 
 /*! \brief init a new instance of g726_coder_pvt. */
-static void *lintog726_new(struct ast_trans_pvt *pvt)
+static int lintog726_new(struct ast_trans_pvt *pvt)
 {
 	struct g726_coder_pvt *tmp = pvt->pvt;
 
 	g726_init_state(&tmp->g726);
-	return tmp;
+
+	return 0;
 }
 
 /*! \brief decode packed 4-bit G726 values and store in buffer. */
diff --git a/codecs/codec_gsm.c b/codecs/codec_gsm.c
index c7b0b100cd..a23306e574 100644
--- a/codecs/codec_gsm.c
+++ b/codecs/codec_gsm.c
@@ -68,13 +68,11 @@ struct gsm_translator_pvt {	/* both gsm2lin and lin2gsm */
 	int16_t buf[BUFFER_SAMPLES];	/* lin2gsm, temporary storage */
 };
 
-static void *gsm_new(struct ast_trans_pvt *pvt)
+static int gsm_new(struct ast_trans_pvt *pvt)
 {
 	struct gsm_translator_pvt *tmp = pvt->pvt;
 	
-	if (!(tmp->gsm = gsm_create()))
-		return NULL;
-	return tmp;
+	return (tmp->gsm = gsm_create()) ? 0 : -1;
 }
 
 static struct ast_frame *lintogsm_sample(void)
diff --git a/codecs/codec_ilbc.c b/codecs/codec_ilbc.c
index e41e4776fd..883a385c8d 100644
--- a/codecs/codec_ilbc.c
+++ b/codecs/codec_ilbc.c
@@ -67,20 +67,22 @@ struct ilbc_coder_pvt {
 	int16_t buf[BUFFER_SAMPLES];
 };
 
-static void *lintoilbc_new(struct ast_trans_pvt *pvt)
+static int lintoilbc_new(struct ast_trans_pvt *pvt)
 {
 	struct ilbc_coder_pvt *tmp = pvt->pvt;
 
 	initEncode(&tmp->enc, ILBC_MS);
-	return tmp;
+
+	return 0;
 }
 
-static void *ilbctolin_new(struct ast_trans_pvt *pvt)
+static int ilbctolin_new(struct ast_trans_pvt *pvt)
 {
 	struct ilbc_coder_pvt *tmp = pvt->pvt;
 
 	initDecode(&tmp->dec, ILBC_MS, USE_ILBC_ENHANCER);
-	return tmp;
+
+	return 0;
 }
 
 static struct ast_frame *lintoilbc_sample(void)
diff --git a/codecs/codec_lpc10.c b/codecs/codec_lpc10.c
index 8f1c81a432..e41137de1b 100644
--- a/codecs/codec_lpc10.c
+++ b/codecs/codec_lpc10.c
@@ -72,22 +72,18 @@ struct lpc10_coder_pvt {
 	int longer;
 };
 
-static void *lpc10_enc_new(struct ast_trans_pvt *pvt)
+static int lpc10_enc_new(struct ast_trans_pvt *pvt)
 {
 	struct lpc10_coder_pvt *tmp = pvt->pvt;
 
-	if (!(tmp->lpc10.enc = create_lpc10_encoder_state()))
-		return NULL;
-	return tmp;
+	return (tmp->lpc10.enc = create_lpc10_encoder_state()) ? 0 : -1;
 }
 
-static void *lpc10_dec_new(struct ast_trans_pvt *pvt)
+static int lpc10_dec_new(struct ast_trans_pvt *pvt)
 {
 	struct lpc10_coder_pvt *tmp = pvt->pvt;
 
-	if (!(tmp->lpc10.dec = create_lpc10_decoder_state()))
-		return NULL;
-	return tmp;
+	return (tmp->lpc10.dec = create_lpc10_decoder_state()) ? 0 : -1;
 }
 
 static struct ast_frame *lintolpc10_sample(void)
diff --git a/codecs/codec_speex.c b/codecs/codec_speex.c
index 81808f9fd9..ebc1ed5664 100644
--- a/codecs/codec_speex.c
+++ b/codecs/codec_speex.c
@@ -103,17 +103,16 @@ struct speex_coder_pvt {
 };
 
 
-static void *lintospeex_new(struct ast_trans_pvt *pvt)
+static int lintospeex_new(struct ast_trans_pvt *pvt)
 {
 	struct speex_coder_pvt *tmp = pvt->pvt;
 
 	if (!(tmp->speex = speex_encoder_init(&speex_nb_mode)))
-		return NULL;
+		return -1;
 
 	speex_bits_init(&tmp->bits);
 	speex_bits_reset(&tmp->bits);
 	speex_encoder_ctl(tmp->speex, SPEEX_GET_FRAME_SIZE, &tmp->framesize);
-	ast_log(LOG_WARNING, "speex framesize is %d\n", tmp->framesize);
 	speex_encoder_ctl(tmp->speex, SPEEX_SET_COMPLEXITY, &complexity);
 #ifdef _SPEEX_TYPES_H
 	if (preproc) {
@@ -142,20 +141,22 @@ static void *lintospeex_new(struct ast_trans_pvt *pvt)
 		speex_encoder_ctl(tmp->speex, SPEEX_SET_DTX, &dtx); 
 	tmp->silent_state = 0;
 
-	return tmp;
+	return 0;
 }
 
-static void *speextolin_new(struct ast_trans_pvt *pvt)
+static int speextolin_new(struct ast_trans_pvt *pvt)
 {
 	struct speex_coder_pvt *tmp = pvt->pvt;
 	
 	if (!(tmp->speex = speex_decoder_init(&speex_nb_mode)))
-		return NULL;
+		return -1;
+
 	speex_bits_init(&tmp->bits);
 	speex_decoder_ctl(tmp->speex, SPEEX_GET_FRAME_SIZE, &tmp->framesize);
 	if (enhancement)
 		speex_decoder_ctl(tmp->speex, SPEEX_SET_ENH, &enhancement);
-	return tmp;
+
+	return 0;
 }
 
 static struct ast_frame *lintospeex_sample(void)
diff --git a/codecs/codec_zap.c b/codecs/codec_zap.c
index cad97c4751..e7ece201d0 100644
--- a/codecs/codec_zap.c
+++ b/codecs/codec_zap.c
@@ -43,7 +43,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 #include <sys/ioctl.h>
 #include <errno.h>
 #include <sys/mman.h>
-#include <linux/zaptel.h>
+#include <zaptel.h>
 
 #include "asterisk/lock.h"
 #include "asterisk/translate.h"
@@ -162,7 +162,7 @@ static void zap_destroy(struct ast_trans_pvt *pvt)
 	close(ztp->fd);
 }
 
-static struct ast_trans_pvt *zap_translate(struct ast_trans_pvt *pvt, int dest, int source)
+static int zap_translate(struct ast_trans_pvt *pvt, int dest, int source)
 {
 	/* Request translation through zap if possible */
 	int fd;
@@ -171,13 +171,13 @@ static struct ast_trans_pvt *zap_translate(struct ast_trans_pvt *pvt, int dest,
 	struct zt_transcode_header *hdr;
 	
 	if ((fd = open("/dev/zap/transcode", O_RDWR)) < 0)
-		return NULL;
+		return -1;
 
 	if ((hdr = mmap(NULL, sizeof(*hdr), PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0)) == MAP_FAILED) {
 		ast_log(LOG_ERROR, "Memory Map failed for transcoding (%s)\n", strerror(errno));
 		close(fd);
 
-		return NULL;
+		return -1;
 	}
 
 	if (hdr->magic != ZT_TRANSCODE_MAGIC) {
@@ -185,7 +185,7 @@ static struct ast_trans_pvt *zap_translate(struct ast_trans_pvt *pvt, int dest,
 		munmap(hdr, sizeof(*hdr));
 		close(fd);
 
-		return NULL;
+		return -1;
 	}
 	
 	hdr->srcfmt = (1 << source);
@@ -195,17 +195,17 @@ static struct ast_trans_pvt *zap_translate(struct ast_trans_pvt *pvt, int dest,
 		munmap(hdr, sizeof(*hdr));
 		close(fd);
 
-		return NULL;
+		return -1;
 	}
 
 	ztp = pvt->pvt;
 	ztp->fd = fd;
 	ztp->hdr = hdr;
 
-	return pvt;
+	return 0;
 }
 
-static void *zap_new(struct ast_trans_pvt *pvt)
+static int zap_new(struct ast_trans_pvt *pvt)
 {
 	return zap_translate(pvt, pvt->t->dstfmt, pvt->t->srcfmt);
 }
diff --git a/configure b/configure
index 9e5d49674e..ddccf78822 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.ac Revision: 35607 .
+# From configure.ac Revision: 35812 .
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.59e.
 #
@@ -697,6 +697,14 @@ PBX_LIBALSA
 CURSES_LIB
 CURSES_INCLUDE
 PBX_LIBCURSES
+gsm_LIB
+gsm_INCLUDE
+PBX_LIBgsm
+KDE_INCLUDE
+KDE_LIBS
+PBX_KDE
+KDEINIT
+KDEDIR
 IKSEMEL_LIB
 IKSEMEL_INCLUDE
 PBX_LIBIKSEMEL
@@ -706,6 +714,9 @@ PBX_LIBNBS
 NCURSES_LIB
 NCURSES_INCLUDE
 PBX_LIBNCURSES
+NETSNMP_CONFIG
+NETSNMP_LIB
+PBX_NETSNMP
 NEWT_LIB
 NEWT_INCLUDE
 PBX_LIBNEWT
@@ -718,12 +729,26 @@ PBX_LIBOGG
 OSPTK_LIB
 OSPTK_INCLUDE
 PBX_LIBOSPTK
+OSS_LIB
+OSS_INCLUDE
+PBX_LIBOSS
+PG_CONFIG
+pq_INCLUDE
+pq_LIB
+PBX_LIBpq
 POPT_LIB
 POPT_INCLUDE
 PBX_LIBPOPT
 LIBPRI_LIB
 LIBPRI_INCLUDE
 PBX_LIBLIBPRI
+PWLIB_INCLUDE
+PWLIB_LIB
+PBX_LIBPWLIB
+QT_INCLUDE
+QT_LIB
+QTMOC
+PBX_QT
 RADIUSCLIENT_LIB
 RADIUSCLIENT_INCLUDE
 PBX_LIBRADIUSCLIENT
@@ -745,52 +770,27 @@ PBX_LIBTERMCAP
 TINFO_LIB
 TINFO_INCLUDE
 PBX_LIBTINFO
+TONEZONE_LIB
+TONEZONE_INCLUDE
+PBX_LIBTONEZONE
 VORBIS_LIB
 VORBIS_INCLUDE
 PBX_LIBVORBIS
+VPB_INCLUDE
+VPB_LIB
+PBX_LIBvpb
 ZLIB_LIB
 ZLIB_INCLUDE
 PBX_LIBZLIB
-EDITLINE_LIBS
-OSS_LIB
-OSS_INCLUDE
-PBX_LIBOSS
-TONEZONE_LIB
-TONEZONE_INCLUDE
-PBX_LIBTONEZONE
 ZAPTEL_INCLUDE
 PBX_ZAPTEL
-gsm_LIB
-gsm_INCLUDE
-PBX_LIBgsm
-PG_CONFIG
-pq_INCLUDE
-pq_LIB
-PBX_LIBpq
-NET_SNMP_CONFIG
-NETSNMP_LIBS
-PBX_NETSNMP
+EDITLINE_LIBS
 PBX_H323
 PBX_IXJUSER
-VPB_INCLUDE
-VPB_LIB
-PBX_LIBvpb
-QT_INCLUDE
-QT_LIB
-QTMOC
-PBX_QT
-KDE_INCLUDE
-KDE_LIBS
-PBX_KDE
-KDEINIT
-KDEDIR
 GTKCONFIG
 PBX_GTK
 GTK_INCLUDE
 GTK_LIBS
-PWLIB_INCLUDE
-PWLIB_LIB
-PBX_LIBPWLIB
 CURL
 PBX_CURL
 CURLLIBS
@@ -1392,15 +1392,22 @@ Optional Packages:
   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
   --with-asound=PATH      use Advanced Linux Sound Architecture files in PATH
   --with-curses=PATH      use curses files in PATH
+  --with-gsm=PATH         use libgsm files in PATH, or 'internal'
+  --with-kde=PATH         use KDE files in PATH
   --with-iksemel=PATH     use Iksemel Jabber Library files in PATH
   --with-nbs=PATH         use Network Broadcast Sound files in PATH
   --with-ncurses=PATH     use ncurses files in PATH
+  --with-netsnmp=PATH     use Net-SNMP in PATH
   --with-newt=PATH        use newt files in PATH
   --with-odbc=PATH        use unixODBC files in PATH
   --with-ogg=PATH         use OGG files in PATH
   --with-osptk=PATH       use OSP Toolkit files in PATH
+  --with-ossaudio=PATH    use Open Sound System files in PATH
+  --with-pq=PATH          use PostgreSQL files in PATH
   --with-popt=PATH        use popt files in PATH
   --with-pri=PATH         use ISDN PRI files in PATH
+  --with-pwlib=PATH       use PWLib files in PATH
+  --with-qt=PATH          use Qt files in PATH
   --with-radiusclient-ng=PATH
                           use Radius Client files in PATH
   --with-speex=PATH       use Speex files in PATH
@@ -1409,17 +1416,11 @@ Optional Packages:
   --with-tds=PATH         use FreeTDS files in PATH
   --with-termcap=PATH     use Termcap files in PATH
   --with-tinfo=PATH       use Term Info files in PATH
+  --with-tonezone=PATH    use tonezone files in PATH
   --with-vorbis=PATH      use Vorbis files in PATH
+  --with-vpb=PATH         use vpb files in PATH
   --with-z=PATH           use zlib files in PATH
-  --with-ossaudio=PATH    use Open Sound System files in PATH
-  --with-tonezone=PATH    use tonezone files in PATH
   --with-zaptel=PATH      use Zaptel files in PATH
-  --with-gsm=PATH         use libgsm files in PATH, or 'internal'
-  --with-pq=PATH          use PostgreSQL files in PATH
-  --with-vpb=PATH         use vpb files in PATH
-  --with-qt=PATH          use Qt files in PATH
-  --with-kde=PATH         use KDE files in PATH
-  --with-pwlib=PATH       use PWLib files in PATH
 
 Some influential environment variables:
   CC          C compiler command
@@ -5545,6 +5546,9 @@ fi
 
 
 
+# from here on down, library checking should be done in alphabetical order
+# by the --with option name, to make things easier for the users :-)
+
 
 
 { echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5
@@ -6931,40 +6935,45 @@ fi
 
 
 
+GSM_INTERNAL="yes"
+GSM_SYSTEM="yes"
 
-# Check whether --with-iksemel was given.
-if test "${with_iksemel+set}" = set; then
-  withval=$with_iksemel;
+# Check whether --with-gsm was given.
+if test "${with_gsm+set}" = set; then
+  withval=$with_gsm;
 case ${withval} in
      n|no)
-     USE_IKSEMEL=no
+     USE_GSM=no
      ;;
      y|ye|yes)
-     IKSEMEL_MANDATORY="yes"
+     ;;
+     internal)
+     GSM_SYSTEM="no"
      ;;
      *)
-     IKSEMEL_DIR="${withval}"
-     IKSEMEL_MANDATORY="yes"
+     GSM_DIR="${withval}"
+     GSM_INTERNAL="no"
      ;;
 esac
 
 fi
 
 
-PBX_LIBIKSEMEL=0
+PBX_LIBgsm=0
 
-if test "${USE_IKSEMEL}" != "no"; then
-   pbxlibdir=""
-   if test "x${IKSEMEL_DIR}" != "x"; then
-      pbxlibdir="-L${iksemel_DIR}/lib"
-   fi
-   { echo "$as_me:$LINENO: checking for iks_start_sasl in -liksemel" >&5
-echo $ECHO_N "checking for iks_start_sasl in -liksemel... $ECHO_C" >&6; }
-if test "${ac_cv_lib_iksemel_iks_start_sasl+set}" = set; then
+if test "${USE_GSM}" != "no"; then
+   if test "${GSM_SYSTEM}" = "yes"; then
+      gsmlibdir=""
+      if test "x${GSM_DIR}" != "x"; then
+         gsmlibdir="-L${GSM_DIR}/lib"
+      fi
+      { echo "$as_me:$LINENO: checking for gsm_create in -lgsm" >&5
+echo $ECHO_N "checking for gsm_create in -lgsm... $ECHO_C" >&6; }
+if test "${ac_cv_lib_gsm_gsm_create+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-liksemel ${pbxlibdir}  $LIBS"
+LIBS="-lgsm ${gsmlibdir} $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -6978,11 +6987,11 @@ cat >>conftest.$ac_ext <<_ACEOF
 #ifdef __cplusplus
 extern "C"
 #endif
-char iks_start_sasl ();
+char gsm_create ();
 int
 main ()
 {
-return iks_start_sasl ();
+return gsm_create ();
   ;
   return 0;
 }
@@ -7021,72 +7030,120 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_iksemel_iks_start_sasl=yes
+  ac_cv_lib_gsm_gsm_create=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_lib_iksemel_iks_start_sasl=no
+	ac_cv_lib_gsm_gsm_create=no
 fi
 
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_iksemel_iks_start_sasl" >&5
-echo "${ECHO_T}$ac_cv_lib_iksemel_iks_start_sasl" >&6; }
-if test $ac_cv_lib_iksemel_iks_start_sasl = yes; then
-  AST_IKSEMEL_FOUND=yes
-else
-  AST_IKSEMEL_FOUND=no
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_gsm_gsm_create" >&5
+echo "${ECHO_T}$ac_cv_lib_gsm_gsm_create" >&6; }
+if test $ac_cv_lib_gsm_gsm_create = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_GSM 1
+_ACEOF
+
+fi
+
+      if test "${ac_cv_lib_gsm_gsm_create}" = "yes"; then
+	 gsm_LIB="-lgsm"
+	 if test "x${GSM_DIR}" != "x"; then
+	    gsm_LIB="${gsmlibdir} ${gsm_LIB}"
+	    gsm_INCLUDE="-I${GSM_DIR}/include"
+	 fi
+	 PBX_LIBgsm=1
+	 GSM_INTERNAL="no"
+      fi
+   fi
+   if test "${GSM_INTERNAL}" = "yes"; then
+      gsm_LIB="internal"
+      PBX_LIBgsm=1
+   fi
+   if test "x${PBX_LIBgsm}" = "x0"; then
+      echo "***"
+      echo "*** The GSM installation on this system appears to be broken."
+      echo "*** Either correct the installation, or run configure"
+      echo "*** including --without-gsm"
+      exit 1
+   fi
 fi
 
 
-   if test "${AST_IKSEMEL_FOUND}" = "yes"; then
-      IKSEMEL_LIB="-liksemel "
-      IKSEMEL_HEADER_FOUND="1"
-      if test "x${IKSEMEL_DIR}" != "x"; then
-         IKSEMEL_LIB="${pbxlibdir} ${IKSEMEL_LIB}"
-	 IKSEMEL_INCLUDE="-I${IKSEMEL_DIR}/include"
-	 if test "xiksemel.h" != "x" ; then
-	    as_ac_Header=`echo "ac_cv_header_${IKSEMEL_DIR}/include/iksemel.h" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${IKSEMEL_DIR}/include/iksemel.h" >&5
-echo $ECHO_N "checking for ${IKSEMEL_DIR}/include/iksemel.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+
+
+
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+
+
+# Check whether --with-kde was given.
+if test "${with_kde+set}" = set; then
+  withval=$with_kde;
+case ${withval} in
+     n|no)
+     USE_KDE=no
+     ;;
+     y|ye|yes)
+     KDE_MANDATORY="yes"
+     ;;
+     *)
+     KDE_DIR="${withval}"
+     KDE_MANDATORY="yes"
+     ;;
+esac
+
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-	       { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${IKSEMEL_DIR}/include/iksemel.h usability" >&5
-echo $ECHO_N "checking ${IKSEMEL_DIR}/include/iksemel.h usability... $ECHO_C" >&6; }
+
+
+PBX_KDE=0
+if test "${USE_KDE}" != "no"; then
+   echo -n "checking for crashHandler in -lkdecore... "
+   saved_ldflags="${LDFLAGS}"
+   LDFLAGS="-I${KDE_DIR}/include ${LDFLAGS} -L${KDE_DIR}/lib -lkdecore"
+
 cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
+
+		/* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-$ac_includes_default
-#include <${IKSEMEL_DIR}/include/iksemel.h>
+#include "kcrash.h"
+int
+main ()
+{
+KCrash::defaultCrashHandler(1);
+  ;
+  return 0;
+}
+
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
   { (case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
@@ -7096,7 +7153,7 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
+	 { ac_try='test -s conftest$ac_exeext'
   { (case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
@@ -7106,337 +7163,204 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_header_compiler=yes
+  ac_cv_lib_kde_crash="yes"
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_header_compiler=no
+	ac_cv_lib_kde_crash="no"
 fi
 
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
 
-# Is the header present?
-{ echo "$as_me:$LINENO: checking ${IKSEMEL_DIR}/include/iksemel.h presence" >&5
-echo $ECHO_N "checking ${IKSEMEL_DIR}/include/iksemel.h presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${IKSEMEL_DIR}/include/iksemel.h>
+	LDFLAGS="${saved_ldflags}"
+
+	if test "${ac_cv_lib_kde_crash}" = "yes"; then
+		{ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+	else
+		{ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+	fi
+
+	if test "${ac_cv_lib_kde_crash}" = "yes"; then
+		KDE_LIBS="-lkdecore -lkdeui"
+		if test "${KDE_DIR}" != ""; then
+			KDE_LIBS="-L${KDE_DIR}/lib ${KDE_LIBS}"
+			KDE_INCLUDE="-I${KDE_DIR}/include"
+
+		fi
+
+		PBX_KDE=1
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_LIBKDE 1
 _ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
+
+   elif test ! -z "${KDE_MANDATORY}";
+   then
+      echo "***"
+      echo "*** The KDE installation on this system appears to be broken."
+      echo "*** Either correct the installation, or run configure"
+      echo "*** including --without-kde."
+      exit 1
+   fi
 fi
-if test -z "$ac_cpp_err"; then
-  ac_header_preproc=yes
+
+
+if test x"${PBX_KDE}" = x1; then
+	if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}kdeinit", so it can be a program name with args.
+set dummy ${ac_tool_prefix}kdeinit; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_path_KDEINIT+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  case $KDEINIT in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_KDEINIT="$KDEINIT" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_KDEINIT="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
 
-  ac_header_preproc=no
+  ;;
+esac
+fi
+KDEINIT=$ac_cv_path_KDEINIT
+if test -n "$KDEINIT"; then
+  { echo "$as_me:$LINENO: result: $KDEINIT" >&5
+echo "${ECHO_T}$KDEINIT" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
 fi
 
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
 
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${IKSEMEL_DIR}/include/iksemel.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${IKSEMEL_DIR}/include/iksemel.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${IKSEMEL_DIR}/include/iksemel.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${IKSEMEL_DIR}/include/iksemel.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${IKSEMEL_DIR}/include/iksemel.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${IKSEMEL_DIR}/include/iksemel.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${IKSEMEL_DIR}/include/iksemel.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${IKSEMEL_DIR}/include/iksemel.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${IKSEMEL_DIR}/include/iksemel.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${IKSEMEL_DIR}/include/iksemel.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${IKSEMEL_DIR}/include/iksemel.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${IKSEMEL_DIR}/include/iksemel.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${IKSEMEL_DIR}/include/iksemel.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${IKSEMEL_DIR}/include/iksemel.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${IKSEMEL_DIR}/include/iksemel.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${IKSEMEL_DIR}/include/iksemel.h: in the future, the compiler will take precedence" >&2;}
+fi
+if test -z "$ac_cv_path_KDEINIT"; then
+  ac_pt_KDEINIT=$KDEINIT
+  # Extract the first word of "kdeinit", so it can be a program name with args.
+set dummy kdeinit; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_path_ac_pt_KDEINIT+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $ac_pt_KDEINIT in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_ac_pt_KDEINIT="$ac_pt_KDEINIT" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_ac_pt_KDEINIT="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
 
-    ;;
+  ;;
 esac
-{ echo "$as_me:$LINENO: checking for ${IKSEMEL_DIR}/include/iksemel.h" >&5
-echo $ECHO_N "checking for ${IKSEMEL_DIR}/include/iksemel.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+ac_pt_KDEINIT=$ac_cv_path_ac_pt_KDEINIT
+if test -n "$ac_pt_KDEINIT"; then
+  { echo "$as_me:$LINENO: result: $ac_pt_KDEINIT" >&5
+echo "${ECHO_T}$ac_pt_KDEINIT" >&6; }
 else
-  eval "$as_ac_Header=\$ac_header_preproc"
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-	       { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
 
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  IKSEMEL_HEADER_FOUND=1
+  if test "x$ac_pt_KDEINIT" = x; then
+    KDEINIT="No"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    KDEINIT=$ac_pt_KDEINIT
+  fi
 else
-  IKSEMEL_HEADER_FOUND=0
+  KDEINIT="$ac_cv_path_KDEINIT"
+fi
+
+	if test ! x"${KDEINIT}" = xNo; then
+   	KDEDIR=$(${DIRNAME} ${KDEINIT})
+   	KDEDIR=$(${DIRNAME} ${KDEDIR})
+	fi
+
 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
+
+
+
+
+# Check whether --with-iksemel was given.
+if test "${with_iksemel+set}" = set; then
+  withval=$with_iksemel;
+case ${withval} in
+     n|no)
+     USE_IKSEMEL=no
+     ;;
+     y|ye|yes)
+     IKSEMEL_MANDATORY="yes"
+     ;;
+     *)
+     IKSEMEL_DIR="${withval}"
+     IKSEMEL_MANDATORY="yes"
+     ;;
+esac
 
-	 fi
-      else
-	 if test "xiksemel.h" != "x" ; then
-            if test "${ac_cv_header_iksemel_h+set}" = set; then
-  { echo "$as_me:$LINENO: checking for iksemel.h" >&5
-echo $ECHO_N "checking for iksemel.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_iksemel_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_iksemel_h" >&5
-echo "${ECHO_T}$ac_cv_header_iksemel_h" >&6; }
+
+
+PBX_LIBIKSEMEL=0
+
+if test "${USE_IKSEMEL}" != "no"; then
+   pbxlibdir=""
+   if test "x${IKSEMEL_DIR}" != "x"; then
+      pbxlibdir="-L${iksemel_DIR}/lib"
+   fi
+   { echo "$as_me:$LINENO: checking for iks_start_sasl in -liksemel" >&5
+echo $ECHO_N "checking for iks_start_sasl in -liksemel... $ECHO_C" >&6; }
+if test "${ac_cv_lib_iksemel_iks_start_sasl+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking iksemel.h usability" >&5
-echo $ECHO_N "checking iksemel.h usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <iksemel.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_header_compiler=no
-fi
-
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking iksemel.h presence" >&5
-echo $ECHO_N "checking iksemel.h presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <iksemel.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: iksemel.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: iksemel.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: iksemel.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: iksemel.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: iksemel.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: iksemel.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: iksemel.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: iksemel.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: iksemel.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: iksemel.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: iksemel.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: iksemel.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: iksemel.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: iksemel.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: iksemel.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: iksemel.h: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for iksemel.h" >&5
-echo $ECHO_N "checking for iksemel.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_iksemel_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_cv_header_iksemel_h=$ac_header_preproc
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_iksemel_h" >&5
-echo "${ECHO_T}$ac_cv_header_iksemel_h" >&6; }
-
-fi
-if test $ac_cv_header_iksemel_h = yes; then
-  IKSEMEL_HEADER_FOUND=1
-else
-  IKSEMEL_HEADER_FOUND=0
-fi
-
-
-	 fi
-      fi
-      if test "x${IKSEMEL_HEADER_FOUND}" = "x0" ; then
-         if test ! -z "${IKSEMEL_MANDATORY}" ;
-         then
-            echo " ***"
-            echo " *** It appears that you do not have the iksemel development package installed."
-            echo " *** Please install it to include Iksemel Jabber Library support, or re-run configure"
-            echo " *** without explicitly specifying --with-iksemel"
-            exit 1
-         fi
-         IKSEMEL_LIB=""
-         IKSEMEL_INCLUDE=""
-         PBX_LIBIKSEMEL=0
-      else
-         PBX_LIBIKSEMEL=1
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_IKSEMEL 1
-_ACEOF
-
-      fi
-   elif test ! -z "${IKSEMEL_MANDATORY}";
-   then
-      echo "***"
-      echo "*** The Iksemel Jabber Library installation on this system appears to be broken."
-      echo "*** Either correct the installation, or run configure"
-      echo "*** without explicity specifying --with-iksemel"
-      exit 1
-   fi
-fi
-
-
-
-
-
-
-# Check whether --with-nbs was given.
-if test "${with_nbs+set}" = set; then
-  withval=$with_nbs;
-case ${withval} in
-     n|no)
-     USE_NBS=no
-     ;;
-     y|ye|yes)
-     NBS_MANDATORY="yes"
-     ;;
-     *)
-     NBS_DIR="${withval}"
-     NBS_MANDATORY="yes"
-     ;;
-esac
-
-fi
-
-
-PBX_LIBNBS=0
-
-if test "${USE_NBS}" != "no"; then
-   pbxlibdir=""
-   if test "x${NBS_DIR}" != "x"; then
-      pbxlibdir="-L${nbs_DIR}/lib"
-   fi
-   { echo "$as_me:$LINENO: checking for nbs_connect in -lnbs" >&5
-echo $ECHO_N "checking for nbs_connect in -lnbs... $ECHO_C" >&6; }
-if test "${ac_cv_lib_nbs_nbs_connect+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lnbs ${pbxlibdir}  $LIBS"
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-liksemel ${pbxlibdir}  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -7450,11 +7374,11 @@ cat >>conftest.$ac_ext <<_ACEOF
 #ifdef __cplusplus
 extern "C"
 #endif
-char nbs_connect ();
+char iks_start_sasl ();
 int
 main ()
 {
-return nbs_connect ();
+return iks_start_sasl ();
   ;
   return 0;
 }
@@ -7493,38 +7417,38 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_nbs_nbs_connect=yes
+  ac_cv_lib_iksemel_iks_start_sasl=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_lib_nbs_nbs_connect=no
+	ac_cv_lib_iksemel_iks_start_sasl=no
 fi
 
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_nbs_nbs_connect" >&5
-echo "${ECHO_T}$ac_cv_lib_nbs_nbs_connect" >&6; }
-if test $ac_cv_lib_nbs_nbs_connect = yes; then
-  AST_NBS_FOUND=yes
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_iksemel_iks_start_sasl" >&5
+echo "${ECHO_T}$ac_cv_lib_iksemel_iks_start_sasl" >&6; }
+if test $ac_cv_lib_iksemel_iks_start_sasl = yes; then
+  AST_IKSEMEL_FOUND=yes
 else
-  AST_NBS_FOUND=no
+  AST_IKSEMEL_FOUND=no
 fi
 
 
-   if test "${AST_NBS_FOUND}" = "yes"; then
-      NBS_LIB="-lnbs "
-      NBS_HEADER_FOUND="1"
-      if test "x${NBS_DIR}" != "x"; then
-         NBS_LIB="${pbxlibdir} ${NBS_LIB}"
-	 NBS_INCLUDE="-I${NBS_DIR}/include"
-	 if test "xnbs.h" != "x" ; then
-	    as_ac_Header=`echo "ac_cv_header_${NBS_DIR}/include/nbs.h" | $as_tr_sh`
+   if test "${AST_IKSEMEL_FOUND}" = "yes"; then
+      IKSEMEL_LIB="-liksemel "
+      IKSEMEL_HEADER_FOUND="1"
+      if test "x${IKSEMEL_DIR}" != "x"; then
+         IKSEMEL_LIB="${pbxlibdir} ${IKSEMEL_LIB}"
+	 IKSEMEL_INCLUDE="-I${IKSEMEL_DIR}/include"
+	 if test "xiksemel.h" != "x" ; then
+	    as_ac_Header=`echo "ac_cv_header_${IKSEMEL_DIR}/include/iksemel.h" | $as_tr_sh`
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${NBS_DIR}/include/nbs.h" >&5
-echo $ECHO_N "checking for ${NBS_DIR}/include/nbs.h... $ECHO_C" >&6; }
+  { echo "$as_me:$LINENO: checking for ${IKSEMEL_DIR}/include/iksemel.h" >&5
+echo $ECHO_N "checking for ${IKSEMEL_DIR}/include/iksemel.h... $ECHO_C" >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
@@ -7533,8 +7457,8 @@ ac_res=`eval echo '${'$as_ac_Header'}'`
 echo "${ECHO_T}$ac_res" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${NBS_DIR}/include/nbs.h usability" >&5
-echo $ECHO_N "checking ${NBS_DIR}/include/nbs.h usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking ${IKSEMEL_DIR}/include/iksemel.h usability" >&5
+echo $ECHO_N "checking ${IKSEMEL_DIR}/include/iksemel.h usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -7542,7 +7466,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <${NBS_DIR}/include/nbs.h>
+#include <${IKSEMEL_DIR}/include/iksemel.h>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -7591,15 +7515,15 @@ rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking ${NBS_DIR}/include/nbs.h presence" >&5
-echo $ECHO_N "checking ${NBS_DIR}/include/nbs.h presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking ${IKSEMEL_DIR}/include/iksemel.h presence" >&5
+echo $ECHO_N "checking ${IKSEMEL_DIR}/include/iksemel.h presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <${NBS_DIR}/include/nbs.h>
+#include <${IKSEMEL_DIR}/include/iksemel.h>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -7639,30 +7563,30 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${NBS_DIR}/include/nbs.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${NBS_DIR}/include/nbs.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${NBS_DIR}/include/nbs.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${NBS_DIR}/include/nbs.h: proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${IKSEMEL_DIR}/include/iksemel.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: ${IKSEMEL_DIR}/include/iksemel.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${IKSEMEL_DIR}/include/iksemel.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: ${IKSEMEL_DIR}/include/iksemel.h: proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${NBS_DIR}/include/nbs.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${NBS_DIR}/include/nbs.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${NBS_DIR}/include/nbs.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${NBS_DIR}/include/nbs.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${NBS_DIR}/include/nbs.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${NBS_DIR}/include/nbs.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${NBS_DIR}/include/nbs.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${NBS_DIR}/include/nbs.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${NBS_DIR}/include/nbs.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${NBS_DIR}/include/nbs.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${NBS_DIR}/include/nbs.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${NBS_DIR}/include/nbs.h: in the future, the compiler will take precedence" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${IKSEMEL_DIR}/include/iksemel.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: ${IKSEMEL_DIR}/include/iksemel.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${IKSEMEL_DIR}/include/iksemel.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: ${IKSEMEL_DIR}/include/iksemel.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${IKSEMEL_DIR}/include/iksemel.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: ${IKSEMEL_DIR}/include/iksemel.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${IKSEMEL_DIR}/include/iksemel.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: ${IKSEMEL_DIR}/include/iksemel.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${IKSEMEL_DIR}/include/iksemel.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: ${IKSEMEL_DIR}/include/iksemel.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${IKSEMEL_DIR}/include/iksemel.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: ${IKSEMEL_DIR}/include/iksemel.h: in the future, the compiler will take precedence" >&2;}
 
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for ${NBS_DIR}/include/nbs.h" >&5
-echo $ECHO_N "checking for ${NBS_DIR}/include/nbs.h... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking for ${IKSEMEL_DIR}/include/iksemel.h" >&5
+echo $ECHO_N "checking for ${IKSEMEL_DIR}/include/iksemel.h... $ECHO_C" >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -7674,27 +7598,27 @@ echo "${ECHO_T}$ac_res" >&6; }
 
 fi
 if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  NBS_HEADER_FOUND=1
+  IKSEMEL_HEADER_FOUND=1
 else
-  NBS_HEADER_FOUND=0
+  IKSEMEL_HEADER_FOUND=0
 fi
 
 
 	 fi
       else
-	 if test "xnbs.h" != "x" ; then
-            if test "${ac_cv_header_nbs_h+set}" = set; then
-  { echo "$as_me:$LINENO: checking for nbs.h" >&5
-echo $ECHO_N "checking for nbs.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_nbs_h+set}" = set; then
+	 if test "xiksemel.h" != "x" ; then
+            if test "${ac_cv_header_iksemel_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for iksemel.h" >&5
+echo $ECHO_N "checking for iksemel.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_iksemel_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_nbs_h" >&5
-echo "${ECHO_T}$ac_cv_header_nbs_h" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_iksemel_h" >&5
+echo "${ECHO_T}$ac_cv_header_iksemel_h" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking nbs.h usability" >&5
-echo $ECHO_N "checking nbs.h usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking iksemel.h usability" >&5
+echo $ECHO_N "checking iksemel.h usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -7702,7 +7626,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <nbs.h>
+#include <iksemel.h>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -7751,15 +7675,15 @@ rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking nbs.h presence" >&5
-echo $ECHO_N "checking nbs.h presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking iksemel.h presence" >&5
+echo $ECHO_N "checking iksemel.h presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <nbs.h>
+#include <iksemel.h>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -7799,74 +7723,74 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: nbs.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: nbs.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: nbs.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: nbs.h: proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: iksemel.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: iksemel.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: iksemel.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: iksemel.h: proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: nbs.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: nbs.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: nbs.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: nbs.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: nbs.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: nbs.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: nbs.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: nbs.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: nbs.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: nbs.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: nbs.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: nbs.h: in the future, the compiler will take precedence" >&2;}
+    { echo "$as_me:$LINENO: WARNING: iksemel.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: iksemel.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: iksemel.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: iksemel.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: iksemel.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: iksemel.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: iksemel.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: iksemel.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: iksemel.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: iksemel.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: iksemel.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: iksemel.h: in the future, the compiler will take precedence" >&2;}
 
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for nbs.h" >&5
-echo $ECHO_N "checking for nbs.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_nbs_h+set}" = set; then
+{ echo "$as_me:$LINENO: checking for iksemel.h" >&5
+echo $ECHO_N "checking for iksemel.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_iksemel_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_cv_header_nbs_h=$ac_header_preproc
+  ac_cv_header_iksemel_h=$ac_header_preproc
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_nbs_h" >&5
-echo "${ECHO_T}$ac_cv_header_nbs_h" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_iksemel_h" >&5
+echo "${ECHO_T}$ac_cv_header_iksemel_h" >&6; }
 
 fi
-if test $ac_cv_header_nbs_h = yes; then
-  NBS_HEADER_FOUND=1
+if test $ac_cv_header_iksemel_h = yes; then
+  IKSEMEL_HEADER_FOUND=1
 else
-  NBS_HEADER_FOUND=0
+  IKSEMEL_HEADER_FOUND=0
 fi
 
 
 	 fi
       fi
-      if test "x${NBS_HEADER_FOUND}" = "x0" ; then
-         if test ! -z "${NBS_MANDATORY}" ;
+      if test "x${IKSEMEL_HEADER_FOUND}" = "x0" ; then
+         if test ! -z "${IKSEMEL_MANDATORY}" ;
          then
             echo " ***"
-            echo " *** It appears that you do not have the nbs development package installed."
-            echo " *** Please install it to include Network Broadcast Sound support, or re-run configure"
-            echo " *** without explicitly specifying --with-nbs"
+            echo " *** It appears that you do not have the iksemel development package installed."
+            echo " *** Please install it to include Iksemel Jabber Library support, or re-run configure"
+            echo " *** without explicitly specifying --with-iksemel"
             exit 1
          fi
-         NBS_LIB=""
-         NBS_INCLUDE=""
-         PBX_LIBNBS=0
+         IKSEMEL_LIB=""
+         IKSEMEL_INCLUDE=""
+         PBX_LIBIKSEMEL=0
       else
-         PBX_LIBNBS=1
+         PBX_LIBIKSEMEL=1
 
 cat >>confdefs.h <<_ACEOF
-#define HAVE_NBS 1
+#define HAVE_IKSEMEL 1
 _ACEOF
 
       fi
-   elif test ! -z "${NBS_MANDATORY}";
+   elif test ! -z "${IKSEMEL_MANDATORY}";
    then
       echo "***"
-      echo "*** The Network Broadcast Sound installation on this system appears to be broken."
+      echo "*** The Iksemel Jabber Library installation on this system appears to be broken."
       echo "*** Either correct the installation, or run configure"
-      echo "*** without explicity specifying --with-nbs"
+      echo "*** without explicity specifying --with-iksemel"
       exit 1
    fi
 fi
@@ -7876,39 +7800,39 @@ fi
 
 
 
-# Check whether --with-ncurses was given.
-if test "${with_ncurses+set}" = set; then
-  withval=$with_ncurses;
+# Check whether --with-nbs was given.
+if test "${with_nbs+set}" = set; then
+  withval=$with_nbs;
 case ${withval} in
      n|no)
-     USE_NCURSES=no
+     USE_NBS=no
      ;;
      y|ye|yes)
-     NCURSES_MANDATORY="yes"
+     NBS_MANDATORY="yes"
      ;;
      *)
-     NCURSES_DIR="${withval}"
-     NCURSES_MANDATORY="yes"
+     NBS_DIR="${withval}"
+     NBS_MANDATORY="yes"
      ;;
 esac
 
 fi
 
 
-PBX_LIBNCURSES=0
+PBX_LIBNBS=0
 
-if test "${USE_NCURSES}" != "no"; then
+if test "${USE_NBS}" != "no"; then
    pbxlibdir=""
-   if test "x${NCURSES_DIR}" != "x"; then
-      pbxlibdir="-L${ncurses_DIR}/lib"
+   if test "x${NBS_DIR}" != "x"; then
+      pbxlibdir="-L${nbs_DIR}/lib"
    fi
-   { echo "$as_me:$LINENO: checking for initscr in -lncurses" >&5
-echo $ECHO_N "checking for initscr in -lncurses... $ECHO_C" >&6; }
-if test "${ac_cv_lib_ncurses_initscr+set}" = set; then
+   { echo "$as_me:$LINENO: checking for nbs_connect in -lnbs" >&5
+echo $ECHO_N "checking for nbs_connect in -lnbs... $ECHO_C" >&6; }
+if test "${ac_cv_lib_nbs_nbs_connect+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lncurses ${pbxlibdir}  $LIBS"
+LIBS="-lnbs ${pbxlibdir}  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -7922,11 +7846,11 @@ cat >>conftest.$ac_ext <<_ACEOF
 #ifdef __cplusplus
 extern "C"
 #endif
-char initscr ();
+char nbs_connect ();
 int
 main ()
 {
-return initscr ();
+return nbs_connect ();
   ;
   return 0;
 }
@@ -7965,38 +7889,38 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_ncurses_initscr=yes
+  ac_cv_lib_nbs_nbs_connect=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_lib_ncurses_initscr=no
+	ac_cv_lib_nbs_nbs_connect=no
 fi
 
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_ncurses_initscr" >&5
-echo "${ECHO_T}$ac_cv_lib_ncurses_initscr" >&6; }
-if test $ac_cv_lib_ncurses_initscr = yes; then
-  AST_NCURSES_FOUND=yes
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_nbs_nbs_connect" >&5
+echo "${ECHO_T}$ac_cv_lib_nbs_nbs_connect" >&6; }
+if test $ac_cv_lib_nbs_nbs_connect = yes; then
+  AST_NBS_FOUND=yes
 else
-  AST_NCURSES_FOUND=no
+  AST_NBS_FOUND=no
 fi
 
 
-   if test "${AST_NCURSES_FOUND}" = "yes"; then
-      NCURSES_LIB="-lncurses "
-      NCURSES_HEADER_FOUND="1"
-      if test "x${NCURSES_DIR}" != "x"; then
-         NCURSES_LIB="${pbxlibdir} ${NCURSES_LIB}"
-	 NCURSES_INCLUDE="-I${NCURSES_DIR}/include"
-	 if test "xcurses.h" != "x" ; then
-	    as_ac_Header=`echo "ac_cv_header_${NCURSES_DIR}/include/curses.h" | $as_tr_sh`
+   if test "${AST_NBS_FOUND}" = "yes"; then
+      NBS_LIB="-lnbs "
+      NBS_HEADER_FOUND="1"
+      if test "x${NBS_DIR}" != "x"; then
+         NBS_LIB="${pbxlibdir} ${NBS_LIB}"
+	 NBS_INCLUDE="-I${NBS_DIR}/include"
+	 if test "xnbs.h" != "x" ; then
+	    as_ac_Header=`echo "ac_cv_header_${NBS_DIR}/include/nbs.h" | $as_tr_sh`
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${NCURSES_DIR}/include/curses.h" >&5
-echo $ECHO_N "checking for ${NCURSES_DIR}/include/curses.h... $ECHO_C" >&6; }
+  { echo "$as_me:$LINENO: checking for ${NBS_DIR}/include/nbs.h" >&5
+echo $ECHO_N "checking for ${NBS_DIR}/include/nbs.h... $ECHO_C" >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
@@ -8005,8 +7929,8 @@ ac_res=`eval echo '${'$as_ac_Header'}'`
 echo "${ECHO_T}$ac_res" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${NCURSES_DIR}/include/curses.h usability" >&5
-echo $ECHO_N "checking ${NCURSES_DIR}/include/curses.h usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking ${NBS_DIR}/include/nbs.h usability" >&5
+echo $ECHO_N "checking ${NBS_DIR}/include/nbs.h usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -8014,7 +7938,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <${NCURSES_DIR}/include/curses.h>
+#include <${NBS_DIR}/include/nbs.h>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -8063,15 +7987,15 @@ rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking ${NCURSES_DIR}/include/curses.h presence" >&5
-echo $ECHO_N "checking ${NCURSES_DIR}/include/curses.h presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking ${NBS_DIR}/include/nbs.h presence" >&5
+echo $ECHO_N "checking ${NBS_DIR}/include/nbs.h presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <${NCURSES_DIR}/include/curses.h>
+#include <${NBS_DIR}/include/nbs.h>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -8111,30 +8035,30 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${NCURSES_DIR}/include/curses.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${NCURSES_DIR}/include/curses.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${NCURSES_DIR}/include/curses.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${NCURSES_DIR}/include/curses.h: proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${NBS_DIR}/include/nbs.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: ${NBS_DIR}/include/nbs.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${NBS_DIR}/include/nbs.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: ${NBS_DIR}/include/nbs.h: proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${NCURSES_DIR}/include/curses.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${NCURSES_DIR}/include/curses.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${NCURSES_DIR}/include/curses.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${NCURSES_DIR}/include/curses.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${NCURSES_DIR}/include/curses.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${NCURSES_DIR}/include/curses.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${NCURSES_DIR}/include/curses.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${NCURSES_DIR}/include/curses.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${NCURSES_DIR}/include/curses.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${NCURSES_DIR}/include/curses.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${NCURSES_DIR}/include/curses.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${NCURSES_DIR}/include/curses.h: in the future, the compiler will take precedence" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${NBS_DIR}/include/nbs.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: ${NBS_DIR}/include/nbs.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${NBS_DIR}/include/nbs.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: ${NBS_DIR}/include/nbs.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${NBS_DIR}/include/nbs.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: ${NBS_DIR}/include/nbs.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${NBS_DIR}/include/nbs.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: ${NBS_DIR}/include/nbs.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${NBS_DIR}/include/nbs.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: ${NBS_DIR}/include/nbs.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${NBS_DIR}/include/nbs.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: ${NBS_DIR}/include/nbs.h: in the future, the compiler will take precedence" >&2;}
 
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for ${NCURSES_DIR}/include/curses.h" >&5
-echo $ECHO_N "checking for ${NCURSES_DIR}/include/curses.h... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking for ${NBS_DIR}/include/nbs.h" >&5
+echo $ECHO_N "checking for ${NBS_DIR}/include/nbs.h... $ECHO_C" >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -8146,27 +8070,27 @@ echo "${ECHO_T}$ac_res" >&6; }
 
 fi
 if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  NCURSES_HEADER_FOUND=1
+  NBS_HEADER_FOUND=1
 else
-  NCURSES_HEADER_FOUND=0
+  NBS_HEADER_FOUND=0
 fi
 
 
 	 fi
       else
-	 if test "xcurses.h" != "x" ; then
-            if test "${ac_cv_header_curses_h+set}" = set; then
-  { echo "$as_me:$LINENO: checking for curses.h" >&5
-echo $ECHO_N "checking for curses.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_curses_h+set}" = set; then
+	 if test "xnbs.h" != "x" ; then
+            if test "${ac_cv_header_nbs_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for nbs.h" >&5
+echo $ECHO_N "checking for nbs.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_nbs_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_curses_h" >&5
-echo "${ECHO_T}$ac_cv_header_curses_h" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_nbs_h" >&5
+echo "${ECHO_T}$ac_cv_header_nbs_h" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking curses.h usability" >&5
-echo $ECHO_N "checking curses.h usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking nbs.h usability" >&5
+echo $ECHO_N "checking nbs.h usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -8174,7 +8098,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <curses.h>
+#include <nbs.h>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -8223,15 +8147,15 @@ rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking curses.h presence" >&5
-echo $ECHO_N "checking curses.h presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking nbs.h presence" >&5
+echo $ECHO_N "checking nbs.h presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <curses.h>
+#include <nbs.h>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -8271,74 +8195,74 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: curses.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: curses.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: curses.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: curses.h: proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: nbs.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: nbs.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: nbs.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: nbs.h: proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: curses.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: curses.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: curses.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: curses.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: curses.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: curses.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: curses.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: curses.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: curses.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: curses.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: curses.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: curses.h: in the future, the compiler will take precedence" >&2;}
+    { echo "$as_me:$LINENO: WARNING: nbs.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: nbs.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: nbs.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: nbs.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: nbs.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: nbs.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: nbs.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: nbs.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: nbs.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: nbs.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: nbs.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: nbs.h: in the future, the compiler will take precedence" >&2;}
 
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for curses.h" >&5
-echo $ECHO_N "checking for curses.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_curses_h+set}" = set; then
+{ echo "$as_me:$LINENO: checking for nbs.h" >&5
+echo $ECHO_N "checking for nbs.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_nbs_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_cv_header_curses_h=$ac_header_preproc
+  ac_cv_header_nbs_h=$ac_header_preproc
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_curses_h" >&5
-echo "${ECHO_T}$ac_cv_header_curses_h" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_nbs_h" >&5
+echo "${ECHO_T}$ac_cv_header_nbs_h" >&6; }
 
 fi
-if test $ac_cv_header_curses_h = yes; then
-  NCURSES_HEADER_FOUND=1
+if test $ac_cv_header_nbs_h = yes; then
+  NBS_HEADER_FOUND=1
 else
-  NCURSES_HEADER_FOUND=0
+  NBS_HEADER_FOUND=0
 fi
 
 
 	 fi
       fi
-      if test "x${NCURSES_HEADER_FOUND}" = "x0" ; then
-         if test ! -z "${NCURSES_MANDATORY}" ;
+      if test "x${NBS_HEADER_FOUND}" = "x0" ; then
+         if test ! -z "${NBS_MANDATORY}" ;
          then
             echo " ***"
-            echo " *** It appears that you do not have the ncurses development package installed."
-            echo " *** Please install it to include ncurses support, or re-run configure"
-            echo " *** without explicitly specifying --with-ncurses"
+            echo " *** It appears that you do not have the nbs development package installed."
+            echo " *** Please install it to include Network Broadcast Sound support, or re-run configure"
+            echo " *** without explicitly specifying --with-nbs"
             exit 1
          fi
-         NCURSES_LIB=""
-         NCURSES_INCLUDE=""
-         PBX_LIBNCURSES=0
+         NBS_LIB=""
+         NBS_INCLUDE=""
+         PBX_LIBNBS=0
       else
-         PBX_LIBNCURSES=1
+         PBX_LIBNBS=1
 
 cat >>confdefs.h <<_ACEOF
-#define HAVE_NCURSES 1
+#define HAVE_NBS 1
 _ACEOF
 
       fi
-   elif test ! -z "${NCURSES_MANDATORY}";
+   elif test ! -z "${NBS_MANDATORY}";
    then
       echo "***"
-      echo "*** The ncurses installation on this system appears to be broken."
+      echo "*** The Network Broadcast Sound installation on this system appears to be broken."
       echo "*** Either correct the installation, or run configure"
-      echo "*** without explicity specifying --with-ncurses"
+      echo "*** without explicity specifying --with-nbs"
       exit 1
    fi
 fi
@@ -8348,39 +8272,39 @@ fi
 
 
 
-# Check whether --with-newt was given.
-if test "${with_newt+set}" = set; then
-  withval=$with_newt;
+# Check whether --with-ncurses was given.
+if test "${with_ncurses+set}" = set; then
+  withval=$with_ncurses;
 case ${withval} in
      n|no)
-     USE_NEWT=no
+     USE_NCURSES=no
      ;;
      y|ye|yes)
-     NEWT_MANDATORY="yes"
+     NCURSES_MANDATORY="yes"
      ;;
      *)
-     NEWT_DIR="${withval}"
-     NEWT_MANDATORY="yes"
+     NCURSES_DIR="${withval}"
+     NCURSES_MANDATORY="yes"
      ;;
 esac
 
 fi
 
 
-PBX_LIBNEWT=0
+PBX_LIBNCURSES=0
 
-if test "${USE_NEWT}" != "no"; then
+if test "${USE_NCURSES}" != "no"; then
    pbxlibdir=""
-   if test "x${NEWT_DIR}" != "x"; then
-      pbxlibdir="-L${newt_DIR}/lib"
+   if test "x${NCURSES_DIR}" != "x"; then
+      pbxlibdir="-L${ncurses_DIR}/lib"
    fi
-   { echo "$as_me:$LINENO: checking for newtBell in -lnewt" >&5
-echo $ECHO_N "checking for newtBell in -lnewt... $ECHO_C" >&6; }
-if test "${ac_cv_lib_newt_newtBell+set}" = set; then
+   { echo "$as_me:$LINENO: checking for initscr in -lncurses" >&5
+echo $ECHO_N "checking for initscr in -lncurses... $ECHO_C" >&6; }
+if test "${ac_cv_lib_ncurses_initscr+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lnewt ${pbxlibdir}  $LIBS"
+LIBS="-lncurses ${pbxlibdir}  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -8394,11 +8318,11 @@ cat >>conftest.$ac_ext <<_ACEOF
 #ifdef __cplusplus
 extern "C"
 #endif
-char newtBell ();
+char initscr ();
 int
 main ()
 {
-return newtBell ();
+return initscr ();
   ;
   return 0;
 }
@@ -8437,38 +8361,38 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_newt_newtBell=yes
+  ac_cv_lib_ncurses_initscr=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_lib_newt_newtBell=no
+	ac_cv_lib_ncurses_initscr=no
 fi
 
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_newt_newtBell" >&5
-echo "${ECHO_T}$ac_cv_lib_newt_newtBell" >&6; }
-if test $ac_cv_lib_newt_newtBell = yes; then
-  AST_NEWT_FOUND=yes
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_ncurses_initscr" >&5
+echo "${ECHO_T}$ac_cv_lib_ncurses_initscr" >&6; }
+if test $ac_cv_lib_ncurses_initscr = yes; then
+  AST_NCURSES_FOUND=yes
 else
-  AST_NEWT_FOUND=no
+  AST_NCURSES_FOUND=no
 fi
 
 
-   if test "${AST_NEWT_FOUND}" = "yes"; then
-      NEWT_LIB="-lnewt "
-      NEWT_HEADER_FOUND="1"
-      if test "x${NEWT_DIR}" != "x"; then
-         NEWT_LIB="${pbxlibdir} ${NEWT_LIB}"
-	 NEWT_INCLUDE="-I${NEWT_DIR}/include"
-	 if test "xnewt.h" != "x" ; then
-	    as_ac_Header=`echo "ac_cv_header_${NEWT_DIR}/include/newt.h" | $as_tr_sh`
+   if test "${AST_NCURSES_FOUND}" = "yes"; then
+      NCURSES_LIB="-lncurses "
+      NCURSES_HEADER_FOUND="1"
+      if test "x${NCURSES_DIR}" != "x"; then
+         NCURSES_LIB="${pbxlibdir} ${NCURSES_LIB}"
+	 NCURSES_INCLUDE="-I${NCURSES_DIR}/include"
+	 if test "xcurses.h" != "x" ; then
+	    as_ac_Header=`echo "ac_cv_header_${NCURSES_DIR}/include/curses.h" | $as_tr_sh`
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${NEWT_DIR}/include/newt.h" >&5
-echo $ECHO_N "checking for ${NEWT_DIR}/include/newt.h... $ECHO_C" >&6; }
+  { echo "$as_me:$LINENO: checking for ${NCURSES_DIR}/include/curses.h" >&5
+echo $ECHO_N "checking for ${NCURSES_DIR}/include/curses.h... $ECHO_C" >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
@@ -8477,8 +8401,8 @@ ac_res=`eval echo '${'$as_ac_Header'}'`
 echo "${ECHO_T}$ac_res" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${NEWT_DIR}/include/newt.h usability" >&5
-echo $ECHO_N "checking ${NEWT_DIR}/include/newt.h usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking ${NCURSES_DIR}/include/curses.h usability" >&5
+echo $ECHO_N "checking ${NCURSES_DIR}/include/curses.h usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -8486,7 +8410,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <${NEWT_DIR}/include/newt.h>
+#include <${NCURSES_DIR}/include/curses.h>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -8535,15 +8459,15 @@ rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking ${NEWT_DIR}/include/newt.h presence" >&5
-echo $ECHO_N "checking ${NEWT_DIR}/include/newt.h presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking ${NCURSES_DIR}/include/curses.h presence" >&5
+echo $ECHO_N "checking ${NCURSES_DIR}/include/curses.h presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <${NEWT_DIR}/include/newt.h>
+#include <${NCURSES_DIR}/include/curses.h>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -8583,30 +8507,30 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${NEWT_DIR}/include/newt.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${NEWT_DIR}/include/newt.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${NEWT_DIR}/include/newt.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${NEWT_DIR}/include/newt.h: proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${NCURSES_DIR}/include/curses.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: ${NCURSES_DIR}/include/curses.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${NCURSES_DIR}/include/curses.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: ${NCURSES_DIR}/include/curses.h: proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${NEWT_DIR}/include/newt.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${NEWT_DIR}/include/newt.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${NEWT_DIR}/include/newt.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${NEWT_DIR}/include/newt.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${NEWT_DIR}/include/newt.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${NEWT_DIR}/include/newt.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${NEWT_DIR}/include/newt.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${NEWT_DIR}/include/newt.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${NEWT_DIR}/include/newt.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${NEWT_DIR}/include/newt.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${NEWT_DIR}/include/newt.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${NEWT_DIR}/include/newt.h: in the future, the compiler will take precedence" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${NCURSES_DIR}/include/curses.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: ${NCURSES_DIR}/include/curses.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${NCURSES_DIR}/include/curses.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: ${NCURSES_DIR}/include/curses.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${NCURSES_DIR}/include/curses.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: ${NCURSES_DIR}/include/curses.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${NCURSES_DIR}/include/curses.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: ${NCURSES_DIR}/include/curses.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${NCURSES_DIR}/include/curses.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: ${NCURSES_DIR}/include/curses.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${NCURSES_DIR}/include/curses.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: ${NCURSES_DIR}/include/curses.h: in the future, the compiler will take precedence" >&2;}
 
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for ${NEWT_DIR}/include/newt.h" >&5
-echo $ECHO_N "checking for ${NEWT_DIR}/include/newt.h... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking for ${NCURSES_DIR}/include/curses.h" >&5
+echo $ECHO_N "checking for ${NCURSES_DIR}/include/curses.h... $ECHO_C" >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -8618,27 +8542,27 @@ echo "${ECHO_T}$ac_res" >&6; }
 
 fi
 if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  NEWT_HEADER_FOUND=1
+  NCURSES_HEADER_FOUND=1
 else
-  NEWT_HEADER_FOUND=0
+  NCURSES_HEADER_FOUND=0
 fi
 
 
 	 fi
       else
-	 if test "xnewt.h" != "x" ; then
-            if test "${ac_cv_header_newt_h+set}" = set; then
-  { echo "$as_me:$LINENO: checking for newt.h" >&5
-echo $ECHO_N "checking for newt.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_newt_h+set}" = set; then
+	 if test "xcurses.h" != "x" ; then
+            if test "${ac_cv_header_curses_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for curses.h" >&5
+echo $ECHO_N "checking for curses.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_curses_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_newt_h" >&5
-echo "${ECHO_T}$ac_cv_header_newt_h" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_curses_h" >&5
+echo "${ECHO_T}$ac_cv_header_curses_h" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking newt.h usability" >&5
-echo $ECHO_N "checking newt.h usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking curses.h usability" >&5
+echo $ECHO_N "checking curses.h usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -8646,7 +8570,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <newt.h>
+#include <curses.h>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -8695,15 +8619,15 @@ rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking newt.h presence" >&5
-echo $ECHO_N "checking newt.h presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking curses.h presence" >&5
+echo $ECHO_N "checking curses.h presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <newt.h>
+#include <curses.h>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -8743,74 +8667,74 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: newt.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: newt.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: newt.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: newt.h: proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: curses.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: curses.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: curses.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: curses.h: proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: newt.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: newt.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: newt.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: newt.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: newt.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: newt.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: newt.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: newt.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: newt.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: newt.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: newt.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: newt.h: in the future, the compiler will take precedence" >&2;}
+    { echo "$as_me:$LINENO: WARNING: curses.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: curses.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: curses.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: curses.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: curses.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: curses.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: curses.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: curses.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: curses.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: curses.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: curses.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: curses.h: in the future, the compiler will take precedence" >&2;}
 
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for newt.h" >&5
-echo $ECHO_N "checking for newt.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_newt_h+set}" = set; then
+{ echo "$as_me:$LINENO: checking for curses.h" >&5
+echo $ECHO_N "checking for curses.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_curses_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_cv_header_newt_h=$ac_header_preproc
+  ac_cv_header_curses_h=$ac_header_preproc
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_newt_h" >&5
-echo "${ECHO_T}$ac_cv_header_newt_h" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_curses_h" >&5
+echo "${ECHO_T}$ac_cv_header_curses_h" >&6; }
 
 fi
-if test $ac_cv_header_newt_h = yes; then
-  NEWT_HEADER_FOUND=1
+if test $ac_cv_header_curses_h = yes; then
+  NCURSES_HEADER_FOUND=1
 else
-  NEWT_HEADER_FOUND=0
+  NCURSES_HEADER_FOUND=0
 fi
 
 
 	 fi
       fi
-      if test "x${NEWT_HEADER_FOUND}" = "x0" ; then
-         if test ! -z "${NEWT_MANDATORY}" ;
+      if test "x${NCURSES_HEADER_FOUND}" = "x0" ; then
+         if test ! -z "${NCURSES_MANDATORY}" ;
          then
             echo " ***"
-            echo " *** It appears that you do not have the newt development package installed."
-            echo " *** Please install it to include newt support, or re-run configure"
-            echo " *** without explicitly specifying --with-newt"
+            echo " *** It appears that you do not have the ncurses development package installed."
+            echo " *** Please install it to include ncurses support, or re-run configure"
+            echo " *** without explicitly specifying --with-ncurses"
             exit 1
          fi
-         NEWT_LIB=""
-         NEWT_INCLUDE=""
-         PBX_LIBNEWT=0
+         NCURSES_LIB=""
+         NCURSES_INCLUDE=""
+         PBX_LIBNCURSES=0
       else
-         PBX_LIBNEWT=1
+         PBX_LIBNCURSES=1
 
 cat >>confdefs.h <<_ACEOF
-#define HAVE_NEWT 1
+#define HAVE_NCURSES 1
 _ACEOF
 
       fi
-   elif test ! -z "${NEWT_MANDATORY}";
+   elif test ! -z "${NCURSES_MANDATORY}";
    then
       echo "***"
-      echo "*** The newt installation on this system appears to be broken."
+      echo "*** The ncurses installation on this system appears to be broken."
       echo "*** Either correct the installation, or run configure"
-      echo "*** without explicity specifying --with-newt"
+      echo "*** without explicity specifying --with-ncurses"
       exit 1
    fi
 fi
@@ -8820,154 +8744,285 @@ fi
 
 
 
-# Check whether --with-odbc was given.
-if test "${with_odbc+set}" = set; then
-  withval=$with_odbc;
+# Check whether --with-netsnmp was given.
+if test "${with_netsnmp+set}" = set; then
+  withval=$with_netsnmp;
 case ${withval} in
      n|no)
-     USE_UNIXODBC=no
+     USE_NETSNMP=no
      ;;
      y|ye|yes)
-     UNIXODBC_MANDATORY="yes"
+     NETSNMP_MANDATORY="yes"
      ;;
      *)
-     UNIXODBC_DIR="${withval}"
-     UNIXODBC_MANDATORY="yes"
+     NETSNMP_DIR="${withval}"
+     NETSNMP_MANDATORY="yes"
      ;;
 esac
 
 fi
 
 
-PBX_LIBUNIXODBC=0
-
-if test "${USE_UNIXODBC}" != "no"; then
-   pbxlibdir=""
-   if test "x${UNIXODBC_DIR}" != "x"; then
-      pbxlibdir="-L${odbc_DIR}/lib"
-   fi
-   { echo "$as_me:$LINENO: checking for SQLConnect in -lodbc" >&5
-echo $ECHO_N "checking for SQLConnect in -lodbc... $ECHO_C" >&6; }
-if test "${ac_cv_lib_odbc_SQLConnect+set}" = set; then
+PBX_NETSNMP=0
+NETSNMP_CONFIG=No
+if test "${USE_NETSNMP}" != "no"; then
+   if test "x${NETSNMP_DIR}" != "x"; then
+      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
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_path_NETSNMP_CONFIG+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lodbc ${pbxlibdir}  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
+  case $NETSNMP_CONFIG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_NETSNMP_CONFIG="$NETSNMP_CONFIG" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in ${NETSNMP_DIR}/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_NETSNMP_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
 
-/* 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 SQLConnect ();
-int
-main ()
-{
-return SQLConnect ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
+  ;;
 esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_lib_odbc_SQLConnect=yes
+fi
+NETSNMP_CONFIG=$ac_cv_path_NETSNMP_CONFIG
+if test -n "$NETSNMP_CONFIG"; then
+  { echo "$as_me:$LINENO: result: $NETSNMP_CONFIG" >&5
+echo "${ECHO_T}$NETSNMP_CONFIG" >&6; }
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
 
-	ac_cv_lib_odbc_SQLConnect=no
 fi
+if test -z "$ac_cv_path_NETSNMP_CONFIG"; then
+  ac_pt_NETSNMP_CONFIG=$NETSNMP_CONFIG
+  # Extract the first word of "net-snmp-config", so it can be a program name with args.
+set dummy net-snmp-config; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_path_ac_pt_NETSNMP_CONFIG+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $ac_pt_NETSNMP_CONFIG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_ac_pt_NETSNMP_CONFIG="$ac_pt_NETSNMP_CONFIG" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in ${NETSNMP_DIR}/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_ac_pt_NETSNMP_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
 
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+  ;;
+esac
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_odbc_SQLConnect" >&5
-echo "${ECHO_T}$ac_cv_lib_odbc_SQLConnect" >&6; }
-if test $ac_cv_lib_odbc_SQLConnect = yes; then
-  AST_UNIXODBC_FOUND=yes
+ac_pt_NETSNMP_CONFIG=$ac_cv_path_ac_pt_NETSNMP_CONFIG
+if test -n "$ac_pt_NETSNMP_CONFIG"; then
+  { echo "$as_me:$LINENO: result: $ac_pt_NETSNMP_CONFIG" >&5
+echo "${ECHO_T}$ac_pt_NETSNMP_CONFIG" >&6; }
 else
-  AST_UNIXODBC_FOUND=no
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
 fi
 
+  if test "x$ac_pt_NETSNMP_CONFIG" = x; then
+    NETSNMP_CONFIG="No"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    NETSNMP_CONFIG=$ac_pt_NETSNMP_CONFIG
+  fi
+else
+  NETSNMP_CONFIG="$ac_cv_path_NETSNMP_CONFIG"
+fi
 
-   if test "${AST_UNIXODBC_FOUND}" = "yes"; then
-      UNIXODBC_LIB="-lodbc "
-      UNIXODBC_HEADER_FOUND="1"
-      if test "x${UNIXODBC_DIR}" != "x"; then
-         UNIXODBC_LIB="${pbxlibdir} ${UNIXODBC_LIB}"
-	 UNIXODBC_INCLUDE="-I${UNIXODBC_DIR}/include"
-	 if test "xsql.h" != "x" ; then
-	    as_ac_Header=`echo "ac_cv_header_${UNIXODBC_DIR}/include/sql.h" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${UNIXODBC_DIR}/include/sql.h" >&5
-echo $ECHO_N "checking for ${UNIXODBC_DIR}/include/sql.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+      if test x"${NETSNMP_CONFIG}" = xNo; then
+         echo "***"
+         echo "*** net-snmp-config was not found in the path you specified:"
+         echo "*** ${NETSNMP_DIR}/bin"
+         echo "*** Either correct the installation, or run configure"
+         echo "*** including --without-netsnmp"
+         exit 1
+      fi
+   else
+      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
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_path_NETSNMP_CONFIG+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-	       { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
 else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${UNIXODBC_DIR}/include/sql.h usability" >&5
-echo $ECHO_N "checking ${UNIXODBC_DIR}/include/sql.h usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
+  case $NETSNMP_CONFIG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_NETSNMP_CONFIG="$NETSNMP_CONFIG" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_NETSNMP_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+NETSNMP_CONFIG=$ac_cv_path_NETSNMP_CONFIG
+if test -n "$NETSNMP_CONFIG"; then
+  { echo "$as_me:$LINENO: result: $NETSNMP_CONFIG" >&5
+echo "${ECHO_T}$NETSNMP_CONFIG" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_NETSNMP_CONFIG"; then
+  ac_pt_NETSNMP_CONFIG=$NETSNMP_CONFIG
+  # Extract the first word of "net-snmp-config", so it can be a program name with args.
+set dummy net-snmp-config; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_path_ac_pt_NETSNMP_CONFIG+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $ac_pt_NETSNMP_CONFIG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_ac_pt_NETSNMP_CONFIG="$ac_pt_NETSNMP_CONFIG" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_ac_pt_NETSNMP_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+ac_pt_NETSNMP_CONFIG=$ac_cv_path_ac_pt_NETSNMP_CONFIG
+if test -n "$ac_pt_NETSNMP_CONFIG"; then
+  { echo "$as_me:$LINENO: result: $ac_pt_NETSNMP_CONFIG" >&5
+echo "${ECHO_T}$ac_pt_NETSNMP_CONFIG" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+  if test "x$ac_pt_NETSNMP_CONFIG" = x; then
+    NETSNMP_CONFIG="No"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    NETSNMP_CONFIG=$ac_pt_NETSNMP_CONFIG
+  fi
+else
+  NETSNMP_CONFIG="$ac_cv_path_NETSNMP_CONFIG"
+fi
+
+   fi
+fi
+
+if test x"${NETSNMP_CONFIG}" != xNo; then
+   NETSNMP_libs=`net-snmp-config --agent-libs`
+
+   { echo "$as_me:$LINENO: checking for snmp_register_callback in -lnetsnmp" >&5
+echo $ECHO_N "checking for snmp_register_callback in -lnetsnmp... $ECHO_C" >&6; }
+if test "${ac_cv_lib_netsnmp_snmp_register_callback+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lnetsnmp ${NETSNMP_libs} $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-$ac_includes_default
-#include <${UNIXODBC_DIR}/include/sql.h>
+
+/* 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 snmp_register_callback ();
+int
+main ()
+{
+return snmp_register_callback ();
+  ;
+  return 0;
+}
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
@@ -8984,7 +9039,7 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
+	 { ac_try='test -s conftest$ac_exeext'
   { (case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
@@ -8994,123 +9049,184 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_header_compiler=yes
+  ac_cv_lib_netsnmp_snmp_register_callback=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_header_compiler=no
+	ac_cv_lib_netsnmp_snmp_register_callback=no
 fi
 
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_netsnmp_snmp_register_callback" >&5
+echo "${ECHO_T}$ac_cv_lib_netsnmp_snmp_register_callback" >&6; }
+if test $ac_cv_lib_netsnmp_snmp_register_callback = yes; then
 
-# Is the header present?
-{ echo "$as_me:$LINENO: checking ${UNIXODBC_DIR}/include/sql.h presence" >&5
-echo $ECHO_N "checking ${UNIXODBC_DIR}/include/sql.h presence... $ECHO_C" >&6; }
+cat >>confdefs.h <<_ACEOF
+#define HAVE_NETSNMP 1
+_ACEOF
+
+fi
+
+
+   if test "${ac_cv_lib_netsnmp_snmp_register_callback}" = "yes"; then
+      NETSNMP_LIB="${NETSNMP_libs}"
+      PBX_NETSNMP=1
+   elif test ! -z "${NETSNMP_MANDATORY}";
+   then
+      echo "***"
+      echo "*** The Net-SNMP installation on this system appears to be broken."
+      echo "*** Either correct the installation, or run configure"
+      echo "*** including --without-netsnmp"
+      exit 1
+   fi
+elif test ! -z "${NETSNMP_MANDATORY}";
+then
+   echo "***"
+   echo "*** The Net-SNMP installation on this system appears to be broken."
+   echo "*** Either correct the installation, or run configure"
+   echo "*** including --without-netsnmp"
+   exit 1
+fi
+
+
+
+
+
+# Check whether --with-newt was given.
+if test "${with_newt+set}" = set; then
+  withval=$with_newt;
+case ${withval} in
+     n|no)
+     USE_NEWT=no
+     ;;
+     y|ye|yes)
+     NEWT_MANDATORY="yes"
+     ;;
+     *)
+     NEWT_DIR="${withval}"
+     NEWT_MANDATORY="yes"
+     ;;
+esac
+
+fi
+
+
+PBX_LIBNEWT=0
+
+if test "${USE_NEWT}" != "no"; then
+   pbxlibdir=""
+   if test "x${NEWT_DIR}" != "x"; then
+      pbxlibdir="-L${newt_DIR}/lib"
+   fi
+   { echo "$as_me:$LINENO: checking for newtBell in -lnewt" >&5
+echo $ECHO_N "checking for newtBell in -lnewt... $ECHO_C" >&6; }
+if test "${ac_cv_lib_newt_newtBell+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lnewt ${pbxlibdir}  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <${UNIXODBC_DIR}/include/sql.h>
+
+/* 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 newtBell ();
+int
+main ()
+{
+return newtBell ();
+  ;
+  return 0;
+}
 _ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
-  ac_header_preproc=yes
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_newt_newtBell=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-  ac_header_preproc=no
+	ac_cv_lib_newt_newtBell=no
 fi
 
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_newt_newtBell" >&5
+echo "${ECHO_T}$ac_cv_lib_newt_newtBell" >&6; }
+if test $ac_cv_lib_newt_newtBell = yes; then
+  AST_NEWT_FOUND=yes
+else
+  AST_NEWT_FOUND=no
+fi
 
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${UNIXODBC_DIR}/include/sql.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${UNIXODBC_DIR}/include/sql.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${UNIXODBC_DIR}/include/sql.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${UNIXODBC_DIR}/include/sql.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${UNIXODBC_DIR}/include/sql.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${UNIXODBC_DIR}/include/sql.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${UNIXODBC_DIR}/include/sql.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${UNIXODBC_DIR}/include/sql.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${UNIXODBC_DIR}/include/sql.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${UNIXODBC_DIR}/include/sql.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${UNIXODBC_DIR}/include/sql.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${UNIXODBC_DIR}/include/sql.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${UNIXODBC_DIR}/include/sql.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${UNIXODBC_DIR}/include/sql.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${UNIXODBC_DIR}/include/sql.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${UNIXODBC_DIR}/include/sql.h: in the future, the compiler will take precedence" >&2;}
 
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${UNIXODBC_DIR}/include/sql.h" >&5
-echo $ECHO_N "checking for ${UNIXODBC_DIR}/include/sql.h... $ECHO_C" >&6; }
+   if test "${AST_NEWT_FOUND}" = "yes"; then
+      NEWT_LIB="-lnewt "
+      NEWT_HEADER_FOUND="1"
+      if test "x${NEWT_DIR}" != "x"; then
+         NEWT_LIB="${pbxlibdir} ${NEWT_LIB}"
+	 NEWT_INCLUDE="-I${NEWT_DIR}/include"
+	 if test "xnewt.h" != "x" ; then
+	    as_ac_Header=`echo "ac_cv_header_${NEWT_DIR}/include/newt.h" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  { echo "$as_me:$LINENO: checking for ${NEWT_DIR}/include/newt.h" >&5
+echo $ECHO_N "checking for ${NEWT_DIR}/include/newt.h... $ECHO_C" >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
 fi
 ac_res=`eval echo '${'$as_ac_Header'}'`
 	       { echo "$as_me:$LINENO: result: $ac_res" >&5
 echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  UNIXODBC_HEADER_FOUND=1
-else
-  UNIXODBC_HEADER_FOUND=0
-fi
-
-
-	 fi
-      else
-	 if test "xsql.h" != "x" ; then
-            if test "${ac_cv_header_sql_h+set}" = set; then
-  { echo "$as_me:$LINENO: checking for sql.h" >&5
-echo $ECHO_N "checking for sql.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_sql_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_sql_h" >&5
-echo "${ECHO_T}$ac_cv_header_sql_h" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking sql.h usability" >&5
-echo $ECHO_N "checking sql.h usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking ${NEWT_DIR}/include/newt.h usability" >&5
+echo $ECHO_N "checking ${NEWT_DIR}/include/newt.h usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -9118,7 +9234,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <sql.h>
+#include <${NEWT_DIR}/include/newt.h>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -9167,15 +9283,15 @@ rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking sql.h presence" >&5
-echo $ECHO_N "checking sql.h presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking ${NEWT_DIR}/include/newt.h presence" >&5
+echo $ECHO_N "checking ${NEWT_DIR}/include/newt.h presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <sql.h>
+#include <${NEWT_DIR}/include/newt.h>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -9215,146 +9331,79 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: sql.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: sql.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: sql.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: sql.h: proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${NEWT_DIR}/include/newt.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: ${NEWT_DIR}/include/newt.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${NEWT_DIR}/include/newt.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: ${NEWT_DIR}/include/newt.h: proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: sql.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: sql.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: sql.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: sql.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: sql.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: sql.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: sql.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: sql.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: sql.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: sql.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: sql.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: sql.h: in the future, the compiler will take precedence" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${NEWT_DIR}/include/newt.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: ${NEWT_DIR}/include/newt.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${NEWT_DIR}/include/newt.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: ${NEWT_DIR}/include/newt.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${NEWT_DIR}/include/newt.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: ${NEWT_DIR}/include/newt.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${NEWT_DIR}/include/newt.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: ${NEWT_DIR}/include/newt.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${NEWT_DIR}/include/newt.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: ${NEWT_DIR}/include/newt.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${NEWT_DIR}/include/newt.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: ${NEWT_DIR}/include/newt.h: in the future, the compiler will take precedence" >&2;}
 
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for sql.h" >&5
-echo $ECHO_N "checking for sql.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_sql_h+set}" = set; then
+{ echo "$as_me:$LINENO: checking for ${NEWT_DIR}/include/newt.h" >&5
+echo $ECHO_N "checking for ${NEWT_DIR}/include/newt.h... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_cv_header_sql_h=$ac_header_preproc
+  eval "$as_ac_Header=\$ac_header_preproc"
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_sql_h" >&5
-echo "${ECHO_T}$ac_cv_header_sql_h" >&6; }
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
 
 fi
-if test $ac_cv_header_sql_h = yes; then
-  UNIXODBC_HEADER_FOUND=1
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  NEWT_HEADER_FOUND=1
 else
-  UNIXODBC_HEADER_FOUND=0
+  NEWT_HEADER_FOUND=0
 fi
 
 
 	 fi
-      fi
-      if test "x${UNIXODBC_HEADER_FOUND}" = "x0" ; then
-         if test ! -z "${UNIXODBC_MANDATORY}" ;
-         then
-            echo " ***"
-            echo " *** It appears that you do not have the odbc development package installed."
-            echo " *** Please install it to include unixODBC support, or re-run configure"
-            echo " *** without explicitly specifying --with-odbc"
-            exit 1
-         fi
-         UNIXODBC_LIB=""
-         UNIXODBC_INCLUDE=""
-         PBX_LIBUNIXODBC=0
       else
-         PBX_LIBUNIXODBC=1
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_UNIXODBC 1
-_ACEOF
-
-      fi
-   elif test ! -z "${UNIXODBC_MANDATORY}";
-   then
-      echo "***"
-      echo "*** The unixODBC installation on this system appears to be broken."
-      echo "*** Either correct the installation, or run configure"
-      echo "*** without explicity specifying --with-odbc"
-      exit 1
-   fi
-fi
-
-
-
-
-
-
-# Check whether --with-ogg was given.
-if test "${with_ogg+set}" = set; then
-  withval=$with_ogg;
-case ${withval} in
-     n|no)
-     USE_OGG=no
-     ;;
-     y|ye|yes)
-     OGG_MANDATORY="yes"
-     ;;
-     *)
-     OGG_DIR="${withval}"
-     OGG_MANDATORY="yes"
-     ;;
-esac
-
-fi
-
-
-PBX_LIBOGG=0
-
-if test "${USE_OGG}" != "no"; then
-   pbxlibdir=""
-   if test "x${OGG_DIR}" != "x"; then
-      pbxlibdir="-L${ogg_DIR}/lib"
-   fi
-   { echo "$as_me:$LINENO: checking for ogg_sync_init in -logg" >&5
-echo $ECHO_N "checking for ogg_sync_init in -logg... $ECHO_C" >&6; }
-if test "${ac_cv_lib_ogg_ogg_sync_init+set}" = set; then
+	 if test "xnewt.h" != "x" ; then
+            if test "${ac_cv_header_newt_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for newt.h" >&5
+echo $ECHO_N "checking for newt.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_newt_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_newt_h" >&5
+echo "${ECHO_T}$ac_cv_header_newt_h" >&6; }
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-logg ${pbxlibdir}  $LIBS"
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking newt.h usability" >&5
+echo $ECHO_N "checking newt.h usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-
-/* 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;
-}
+$ac_includes_default
+#include <newt.h>
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
@@ -9371,7 +9420,7 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
+	 { ac_try='test -s conftest.$ac_objext'
   { (case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
@@ -9381,115 +9430,30 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_ogg_ogg_sync_init=yes
+  ac_header_compiler=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_lib_ogg_ogg_sync_init=no
-fi
-
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_ogg_ogg_sync_init" >&5
-echo "${ECHO_T}$ac_cv_lib_ogg_ogg_sync_init" >&6; }
-if test $ac_cv_lib_ogg_ogg_sync_init = yes; then
-  AST_OGG_FOUND=yes
-else
-  AST_OGG_FOUND=no
+	ac_header_compiler=no
 fi
 
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
 
-   if test "${AST_OGG_FOUND}" = "yes"; then
-      OGG_LIB="-logg "
-      OGG_HEADER_FOUND="1"
-      if test "x${OGG_DIR}" != "x"; then
-         OGG_LIB="${pbxlibdir} ${OGG_LIB}"
-	 OGG_INCLUDE="-I${OGG_DIR}/include"
-	 if test "x" != "x" ; then
-	    as_ac_Header=`echo "ac_cv_header_${OGG_DIR}/include/" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${OGG_DIR}/include/" >&5
-echo $ECHO_N "checking for ${OGG_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-	       { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${OGG_DIR}/include/ usability" >&5
-echo $ECHO_N "checking ${OGG_DIR}/include/ usability... $ECHO_C" >&6; }
+# Is the header present?
+{ echo "$as_me:$LINENO: checking newt.h presence" >&5
+echo $ECHO_N "checking newt.h presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-$ac_includes_default
-#include <${OGG_DIR}/include/>
+#include <newt.h>
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_header_compiler=no
-fi
-
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking ${OGG_DIR}/include/ presence" >&5
-echo $ECHO_N "checking ${OGG_DIR}/include/ presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${OGG_DIR}/include/>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
+if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
@@ -9527,79 +9491,146 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${OGG_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${OGG_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${OGG_DIR}/include/: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${OGG_DIR}/include/: proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: newt.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: newt.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: newt.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: newt.h: proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${OGG_DIR}/include/: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${OGG_DIR}/include/: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${OGG_DIR}/include/:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${OGG_DIR}/include/:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${OGG_DIR}/include/: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${OGG_DIR}/include/: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${OGG_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${OGG_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${OGG_DIR}/include/: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${OGG_DIR}/include/: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${OGG_DIR}/include/: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${OGG_DIR}/include/: in the future, the compiler will take precedence" >&2;}
+    { echo "$as_me:$LINENO: WARNING: newt.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: newt.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: newt.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: newt.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: newt.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: newt.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: newt.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: newt.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: newt.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: newt.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: newt.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: newt.h: in the future, the compiler will take precedence" >&2;}
 
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for ${OGG_DIR}/include/" >&5
-echo $ECHO_N "checking for ${OGG_DIR}/include/... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+{ echo "$as_me:$LINENO: checking for newt.h" >&5
+echo $ECHO_N "checking for newt.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_newt_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  eval "$as_ac_Header=\$ac_header_preproc"
+  ac_cv_header_newt_h=$ac_header_preproc
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-	       { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_newt_h" >&5
+echo "${ECHO_T}$ac_cv_header_newt_h" >&6; }
 
 fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  OGG_HEADER_FOUND=1
+if test $ac_cv_header_newt_h = yes; then
+  NEWT_HEADER_FOUND=1
 else
-  OGG_HEADER_FOUND=0
+  NEWT_HEADER_FOUND=0
 fi
 
 
 	 fi
+      fi
+      if test "x${NEWT_HEADER_FOUND}" = "x0" ; then
+         if test ! -z "${NEWT_MANDATORY}" ;
+         then
+            echo " ***"
+            echo " *** It appears that you do not have the newt development package installed."
+            echo " *** Please install it to include newt support, or re-run configure"
+            echo " *** without explicitly specifying --with-newt"
+            exit 1
+         fi
+         NEWT_LIB=""
+         NEWT_INCLUDE=""
+         PBX_LIBNEWT=0
       else
-	 if test "x" != "x" ; then
-            if test "${ac_cv_header_+set}" = set; then
-  { echo "$as_me:$LINENO: checking for " >&5
-echo $ECHO_N "checking for ... $ECHO_C" >&6; }
-if test "${ac_cv_header_+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+         PBX_LIBNEWT=1
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_NEWT 1
+_ACEOF
+
+      fi
+   elif test ! -z "${NEWT_MANDATORY}";
+   then
+      echo "***"
+      echo "*** The newt installation on this system appears to be broken."
+      echo "*** Either correct the installation, or run configure"
+      echo "*** without explicity specifying --with-newt"
+      exit 1
+   fi
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
-echo "${ECHO_T}$ac_cv_header_" >&6; }
+
+
+
+
+
+
+# Check whether --with-odbc was given.
+if test "${with_odbc+set}" = set; then
+  withval=$with_odbc;
+case ${withval} in
+     n|no)
+     USE_UNIXODBC=no
+     ;;
+     y|ye|yes)
+     UNIXODBC_MANDATORY="yes"
+     ;;
+     *)
+     UNIXODBC_DIR="${withval}"
+     UNIXODBC_MANDATORY="yes"
+     ;;
+esac
+
+fi
+
+
+PBX_LIBUNIXODBC=0
+
+if test "${USE_UNIXODBC}" != "no"; then
+   pbxlibdir=""
+   if test "x${UNIXODBC_DIR}" != "x"; then
+      pbxlibdir="-L${odbc_DIR}/lib"
+   fi
+   { echo "$as_me:$LINENO: checking for SQLConnect in -lodbc" >&5
+echo $ECHO_N "checking for SQLConnect in -lodbc... $ECHO_C" >&6; }
+if test "${ac_cv_lib_odbc_SQLConnect+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking  usability" >&5
-echo $ECHO_N "checking  usability... $ECHO_C" >&6; }
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lodbc ${pbxlibdir}  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-$ac_includes_default
-#include <>
+
+/* 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 SQLConnect ();
+int
+main ()
+{
+return SQLConnect ();
+  ;
+  return 0;
+}
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
@@ -9616,7 +9647,7 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
+	 { ac_try='test -s conftest$ac_exeext'
   { (case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
@@ -9626,30 +9657,115 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_header_compiler=yes
+  ac_cv_lib_odbc_SQLConnect=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_header_compiler=no
+	ac_cv_lib_odbc_SQLConnect=no
 fi
 
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_odbc_SQLConnect" >&5
+echo "${ECHO_T}$ac_cv_lib_odbc_SQLConnect" >&6; }
+if test $ac_cv_lib_odbc_SQLConnect = yes; then
+  AST_UNIXODBC_FOUND=yes
+else
+  AST_UNIXODBC_FOUND=no
+fi
 
-# Is the header present?
-{ echo "$as_me:$LINENO: checking  presence" >&5
-echo $ECHO_N "checking  presence... $ECHO_C" >&6; }
+
+   if test "${AST_UNIXODBC_FOUND}" = "yes"; then
+      UNIXODBC_LIB="-lodbc "
+      UNIXODBC_HEADER_FOUND="1"
+      if test "x${UNIXODBC_DIR}" != "x"; then
+         UNIXODBC_LIB="${pbxlibdir} ${UNIXODBC_LIB}"
+	 UNIXODBC_INCLUDE="-I${UNIXODBC_DIR}/include"
+	 if test "xsql.h" != "x" ; then
+	    as_ac_Header=`echo "ac_cv_header_${UNIXODBC_DIR}/include/sql.h" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  { echo "$as_me:$LINENO: checking for ${UNIXODBC_DIR}/include/sql.h" >&5
+echo $ECHO_N "checking for ${UNIXODBC_DIR}/include/sql.h... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking ${UNIXODBC_DIR}/include/sql.h usability" >&5
+echo $ECHO_N "checking ${UNIXODBC_DIR}/include/sql.h usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <>
+$ac_includes_default
+#include <${UNIXODBC_DIR}/include/sql.h>
 _ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_header_compiler=no
+fi
+
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking ${UNIXODBC_DIR}/include/sql.h presence" >&5
+echo $ECHO_N "checking ${UNIXODBC_DIR}/include/sql.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <${UNIXODBC_DIR}/include/sql.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
@@ -9687,146 +9803,79 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: : proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: : proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${UNIXODBC_DIR}/include/sql.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: ${UNIXODBC_DIR}/include/sql.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${UNIXODBC_DIR}/include/sql.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: ${UNIXODBC_DIR}/include/sql.h: proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: : present but cannot be compiled" >&5
-echo "$as_me: WARNING: : present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: :     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: :     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: : see the Autoconf documentation" >&5
-echo "$as_me: WARNING: : see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: :     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: :     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: : proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: : proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: : in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: : in the future, the compiler will take precedence" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${UNIXODBC_DIR}/include/sql.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: ${UNIXODBC_DIR}/include/sql.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${UNIXODBC_DIR}/include/sql.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: ${UNIXODBC_DIR}/include/sql.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${UNIXODBC_DIR}/include/sql.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: ${UNIXODBC_DIR}/include/sql.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${UNIXODBC_DIR}/include/sql.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: ${UNIXODBC_DIR}/include/sql.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${UNIXODBC_DIR}/include/sql.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: ${UNIXODBC_DIR}/include/sql.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${UNIXODBC_DIR}/include/sql.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: ${UNIXODBC_DIR}/include/sql.h: in the future, the compiler will take precedence" >&2;}
 
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for " >&5
-echo $ECHO_N "checking for ... $ECHO_C" >&6; }
-if test "${ac_cv_header_+set}" = set; then
+{ echo "$as_me:$LINENO: checking for ${UNIXODBC_DIR}/include/sql.h" >&5
+echo $ECHO_N "checking for ${UNIXODBC_DIR}/include/sql.h... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_cv_header_=$ac_header_preproc
+  eval "$as_ac_Header=\$ac_header_preproc"
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
-echo "${ECHO_T}$ac_cv_header_" >&6; }
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
 
 fi
-if test $ac_cv_header_ = yes; then
-  OGG_HEADER_FOUND=1
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  UNIXODBC_HEADER_FOUND=1
 else
-  OGG_HEADER_FOUND=0
+  UNIXODBC_HEADER_FOUND=0
 fi
 
 
 	 fi
-      fi
-      if test "x${OGG_HEADER_FOUND}" = "x0" ; then
-         if test ! -z "${OGG_MANDATORY}" ;
-         then
-            echo " ***"
-            echo " *** It appears that you do not have the ogg development package installed."
-            echo " *** Please install it to include OGG support, or re-run configure"
-            echo " *** without explicitly specifying --with-ogg"
-            exit 1
-         fi
-         OGG_LIB=""
-         OGG_INCLUDE=""
-         PBX_LIBOGG=0
       else
-         PBX_LIBOGG=1
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_OGG 1
-_ACEOF
-
-      fi
-   elif test ! -z "${OGG_MANDATORY}";
-   then
-      echo "***"
-      echo "*** The OGG installation on this system appears to be broken."
-      echo "*** Either correct the installation, or run configure"
-      echo "*** without explicity specifying --with-ogg"
-      exit 1
-   fi
-fi
-
-
-
-
-
-
-# Check whether --with-osptk was given.
-if test "${with_osptk+set}" = set; then
-  withval=$with_osptk;
-case ${withval} in
-     n|no)
-     USE_OSPTK=no
-     ;;
-     y|ye|yes)
-     OSPTK_MANDATORY="yes"
-     ;;
-     *)
-     OSPTK_DIR="${withval}"
-     OSPTK_MANDATORY="yes"
-     ;;
-esac
-
-fi
-
-
-PBX_LIBOSPTK=0
-
-if test "${USE_OSPTK}" != "no"; then
-   pbxlibdir=""
-   if test "x${OSPTK_DIR}" != "x"; then
-      pbxlibdir="-L${osptk_DIR}/lib"
-   fi
-   { echo "$as_me:$LINENO: checking for OSPPCryptoDecrypt in -losptk" >&5
-echo $ECHO_N "checking for OSPPCryptoDecrypt in -losptk... $ECHO_C" >&6; }
-if test "${ac_cv_lib_osptk_OSPPCryptoDecrypt+set}" = set; then
+	 if test "xsql.h" != "x" ; then
+            if test "${ac_cv_header_sql_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for sql.h" >&5
+echo $ECHO_N "checking for sql.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_sql_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_sql_h" >&5
+echo "${ECHO_T}$ac_cv_header_sql_h" >&6; }
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-losptk ${pbxlibdir} -lcrypto -lssl $LIBS"
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking sql.h usability" >&5
+echo $ECHO_N "checking sql.h usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-
-/* 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 OSPPCryptoDecrypt ();
-int
-main ()
-{
-return OSPPCryptoDecrypt ();
-  ;
-  return 0;
-}
+$ac_includes_default
+#include <sql.h>
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
@@ -9843,7 +9892,7 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
+	 { ac_try='test -s conftest.$ac_objext'
   { (case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
@@ -9853,113 +9902,28 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_osptk_OSPPCryptoDecrypt=yes
+  ac_header_compiler=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_lib_osptk_OSPPCryptoDecrypt=no
-fi
-
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_osptk_OSPPCryptoDecrypt" >&5
-echo "${ECHO_T}$ac_cv_lib_osptk_OSPPCryptoDecrypt" >&6; }
-if test $ac_cv_lib_osptk_OSPPCryptoDecrypt = yes; then
-  AST_OSPTK_FOUND=yes
-else
-  AST_OSPTK_FOUND=no
+	ac_header_compiler=no
 fi
 
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
 
-   if test "${AST_OSPTK_FOUND}" = "yes"; then
-      OSPTK_LIB="-losptk -lcrypto -lssl"
-      OSPTK_HEADER_FOUND="1"
-      if test "x${OSPTK_DIR}" != "x"; then
-         OSPTK_LIB="${pbxlibdir} ${OSPTK_LIB}"
-	 OSPTK_INCLUDE="-I${OSPTK_DIR}/include"
-	 if test "xosp/osp.h" != "x" ; then
-	    as_ac_Header=`echo "ac_cv_header_${OSPTK_DIR}/include/osp/osp.h" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${OSPTK_DIR}/include/osp/osp.h" >&5
-echo $ECHO_N "checking for ${OSPTK_DIR}/include/osp/osp.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-	       { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${OSPTK_DIR}/include/osp/osp.h usability" >&5
-echo $ECHO_N "checking ${OSPTK_DIR}/include/osp/osp.h usability... $ECHO_C" >&6; }
+# Is the header present?
+{ echo "$as_me:$LINENO: checking sql.h presence" >&5
+echo $ECHO_N "checking sql.h presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-$ac_includes_default
-#include <${OSPTK_DIR}/include/osp/osp.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_header_compiler=no
-fi
-
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking ${OSPTK_DIR}/include/osp/osp.h presence" >&5
-echo $ECHO_N "checking ${OSPTK_DIR}/include/osp/osp.h presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${OSPTK_DIR}/include/osp/osp.h>
+#include <sql.h>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -9999,79 +9963,146 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${OSPTK_DIR}/include/osp/osp.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${OSPTK_DIR}/include/osp/osp.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${OSPTK_DIR}/include/osp/osp.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${OSPTK_DIR}/include/osp/osp.h: proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: sql.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: sql.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: sql.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: sql.h: proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${OSPTK_DIR}/include/osp/osp.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${OSPTK_DIR}/include/osp/osp.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${OSPTK_DIR}/include/osp/osp.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${OSPTK_DIR}/include/osp/osp.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${OSPTK_DIR}/include/osp/osp.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${OSPTK_DIR}/include/osp/osp.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${OSPTK_DIR}/include/osp/osp.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${OSPTK_DIR}/include/osp/osp.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${OSPTK_DIR}/include/osp/osp.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${OSPTK_DIR}/include/osp/osp.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${OSPTK_DIR}/include/osp/osp.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${OSPTK_DIR}/include/osp/osp.h: in the future, the compiler will take precedence" >&2;}
+    { echo "$as_me:$LINENO: WARNING: sql.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: sql.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: sql.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: sql.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: sql.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: sql.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: sql.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: sql.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: sql.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: sql.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: sql.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: sql.h: in the future, the compiler will take precedence" >&2;}
 
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for ${OSPTK_DIR}/include/osp/osp.h" >&5
-echo $ECHO_N "checking for ${OSPTK_DIR}/include/osp/osp.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+{ echo "$as_me:$LINENO: checking for sql.h" >&5
+echo $ECHO_N "checking for sql.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_sql_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  eval "$as_ac_Header=\$ac_header_preproc"
+  ac_cv_header_sql_h=$ac_header_preproc
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-	       { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_sql_h" >&5
+echo "${ECHO_T}$ac_cv_header_sql_h" >&6; }
 
 fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  OSPTK_HEADER_FOUND=1
+if test $ac_cv_header_sql_h = yes; then
+  UNIXODBC_HEADER_FOUND=1
 else
-  OSPTK_HEADER_FOUND=0
+  UNIXODBC_HEADER_FOUND=0
 fi
 
 
 	 fi
+      fi
+      if test "x${UNIXODBC_HEADER_FOUND}" = "x0" ; then
+         if test ! -z "${UNIXODBC_MANDATORY}" ;
+         then
+            echo " ***"
+            echo " *** It appears that you do not have the odbc development package installed."
+            echo " *** Please install it to include unixODBC support, or re-run configure"
+            echo " *** without explicitly specifying --with-odbc"
+            exit 1
+         fi
+         UNIXODBC_LIB=""
+         UNIXODBC_INCLUDE=""
+         PBX_LIBUNIXODBC=0
       else
-	 if test "xosp/osp.h" != "x" ; then
-            if test "${ac_cv_header_osp_osp_h+set}" = set; then
-  { echo "$as_me:$LINENO: checking for osp/osp.h" >&5
-echo $ECHO_N "checking for osp/osp.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_osp_osp_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+         PBX_LIBUNIXODBC=1
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_UNIXODBC 1
+_ACEOF
+
+      fi
+   elif test ! -z "${UNIXODBC_MANDATORY}";
+   then
+      echo "***"
+      echo "*** The unixODBC installation on this system appears to be broken."
+      echo "*** Either correct the installation, or run configure"
+      echo "*** without explicity specifying --with-odbc"
+      exit 1
+   fi
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_osp_osp_h" >&5
-echo "${ECHO_T}$ac_cv_header_osp_osp_h" >&6; }
+
+
+
+
+
+
+# Check whether --with-ogg was given.
+if test "${with_ogg+set}" = set; then
+  withval=$with_ogg;
+case ${withval} in
+     n|no)
+     USE_OGG=no
+     ;;
+     y|ye|yes)
+     OGG_MANDATORY="yes"
+     ;;
+     *)
+     OGG_DIR="${withval}"
+     OGG_MANDATORY="yes"
+     ;;
+esac
+
+fi
+
+
+PBX_LIBOGG=0
+
+if test "${USE_OGG}" != "no"; then
+   pbxlibdir=""
+   if test "x${OGG_DIR}" != "x"; then
+      pbxlibdir="-L${ogg_DIR}/lib"
+   fi
+   { echo "$as_me:$LINENO: checking for ogg_sync_init in -logg" >&5
+echo $ECHO_N "checking for ogg_sync_init in -logg... $ECHO_C" >&6; }
+if test "${ac_cv_lib_ogg_ogg_sync_init+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking osp/osp.h usability" >&5
-echo $ECHO_N "checking osp/osp.h usability... $ECHO_C" >&6; }
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-logg ${pbxlibdir}  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-$ac_includes_default
-#include <osp/osp.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
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
@@ -10088,7 +10119,7 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
+	 { ac_try='test -s conftest$ac_exeext'
   { (case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
@@ -10098,29 +10129,114 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_header_compiler=yes
+  ac_cv_lib_ogg_ogg_sync_init=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_header_compiler=no
+	ac_cv_lib_ogg_ogg_sync_init=no
 fi
 
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_ogg_ogg_sync_init" >&5
+echo "${ECHO_T}$ac_cv_lib_ogg_ogg_sync_init" >&6; }
+if test $ac_cv_lib_ogg_ogg_sync_init = yes; then
+  AST_OGG_FOUND=yes
+else
+  AST_OGG_FOUND=no
+fi
 
-# Is the header present?
-{ echo "$as_me:$LINENO: checking osp/osp.h presence" >&5
-echo $ECHO_N "checking osp/osp.h presence... $ECHO_C" >&6; }
+
+   if test "${AST_OGG_FOUND}" = "yes"; then
+      OGG_LIB="-logg "
+      OGG_HEADER_FOUND="1"
+      if test "x${OGG_DIR}" != "x"; then
+         OGG_LIB="${pbxlibdir} ${OGG_LIB}"
+	 OGG_INCLUDE="-I${OGG_DIR}/include"
+	 if test "x" != "x" ; then
+	    as_ac_Header=`echo "ac_cv_header_${OGG_DIR}/include/" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  { echo "$as_me:$LINENO: checking for ${OGG_DIR}/include/" >&5
+echo $ECHO_N "checking for ${OGG_DIR}/include/... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking ${OGG_DIR}/include/ usability" >&5
+echo $ECHO_N "checking ${OGG_DIR}/include/ usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <osp/osp.h>
-_ACEOF
+$ac_includes_default
+#include <${OGG_DIR}/include/>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_header_compiler=no
+fi
+
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking ${OGG_DIR}/include/ presence" >&5
+echo $ECHO_N "checking ${OGG_DIR}/include/ presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <${OGG_DIR}/include/>
+_ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
@@ -10159,146 +10275,79 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: osp/osp.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: osp/osp.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: osp/osp.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: osp/osp.h: proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${OGG_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: ${OGG_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${OGG_DIR}/include/: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: ${OGG_DIR}/include/: proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: osp/osp.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: osp/osp.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: osp/osp.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: osp/osp.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: osp/osp.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: osp/osp.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: osp/osp.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: osp/osp.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: osp/osp.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: osp/osp.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: osp/osp.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: osp/osp.h: in the future, the compiler will take precedence" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${OGG_DIR}/include/: present but cannot be compiled" >&5
+echo "$as_me: WARNING: ${OGG_DIR}/include/: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${OGG_DIR}/include/:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: ${OGG_DIR}/include/:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${OGG_DIR}/include/: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: ${OGG_DIR}/include/: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${OGG_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: ${OGG_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${OGG_DIR}/include/: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: ${OGG_DIR}/include/: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${OGG_DIR}/include/: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: ${OGG_DIR}/include/: in the future, the compiler will take precedence" >&2;}
 
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for osp/osp.h" >&5
-echo $ECHO_N "checking for osp/osp.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_osp_osp_h+set}" = set; then
+{ echo "$as_me:$LINENO: checking for ${OGG_DIR}/include/" >&5
+echo $ECHO_N "checking for ${OGG_DIR}/include/... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_cv_header_osp_osp_h=$ac_header_preproc
+  eval "$as_ac_Header=\$ac_header_preproc"
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_osp_osp_h" >&5
-echo "${ECHO_T}$ac_cv_header_osp_osp_h" >&6; }
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
 
 fi
-if test $ac_cv_header_osp_osp_h = yes; then
-  OSPTK_HEADER_FOUND=1
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  OGG_HEADER_FOUND=1
 else
-  OSPTK_HEADER_FOUND=0
+  OGG_HEADER_FOUND=0
 fi
 
 
 	 fi
-      fi
-      if test "x${OSPTK_HEADER_FOUND}" = "x0" ; then
-         if test ! -z "${OSPTK_MANDATORY}" ;
-         then
-            echo " ***"
-            echo " *** It appears that you do not have the osptk development package installed."
-            echo " *** Please install it to include OSP Toolkit support, or re-run configure"
-            echo " *** without explicitly specifying --with-osptk"
-            exit 1
-         fi
-         OSPTK_LIB=""
-         OSPTK_INCLUDE=""
-         PBX_LIBOSPTK=0
       else
-         PBX_LIBOSPTK=1
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_OSPTK 1
-_ACEOF
-
-      fi
-   elif test ! -z "${OSPTK_MANDATORY}";
-   then
-      echo "***"
-      echo "*** The OSP Toolkit installation on this system appears to be broken."
-      echo "*** Either correct the installation, or run configure"
-      echo "*** without explicity specifying --with-osptk"
-      exit 1
-   fi
-fi
-
-
-
-
-
-
-# Check whether --with-popt was given.
-if test "${with_popt+set}" = set; then
-  withval=$with_popt;
-case ${withval} in
-     n|no)
-     USE_POPT=no
-     ;;
-     y|ye|yes)
-     POPT_MANDATORY="yes"
-     ;;
-     *)
-     POPT_DIR="${withval}"
-     POPT_MANDATORY="yes"
-     ;;
-esac
-
-fi
-
-
-PBX_LIBPOPT=0
-
-if test "${USE_POPT}" != "no"; then
-   pbxlibdir=""
-   if test "x${POPT_DIR}" != "x"; then
-      pbxlibdir="-L${popt_DIR}/lib"
-   fi
-   { echo "$as_me:$LINENO: checking for poptStrerror in -lpopt" >&5
-echo $ECHO_N "checking for poptStrerror in -lpopt... $ECHO_C" >&6; }
-if test "${ac_cv_lib_popt_poptStrerror+set}" = set; then
+	 if test "x" != "x" ; then
+            if test "${ac_cv_header_+set}" = set; then
+  { echo "$as_me:$LINENO: checking for " >&5
+echo $ECHO_N "checking for ... $ECHO_C" >&6; }
+if test "${ac_cv_header_+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
+echo "${ECHO_T}$ac_cv_header_" >&6; }
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpopt ${pbxlibdir}  $LIBS"
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking  usability" >&5
+echo $ECHO_N "checking  usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-
-/* 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 poptStrerror ();
-int
-main ()
-{
-return poptStrerror ();
-  ;
-  return 0;
-}
+$ac_includes_default
+#include <>
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
@@ -10315,7 +10364,7 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
+	 { ac_try='test -s conftest.$ac_objext'
   { (case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
@@ -10325,113 +10374,28 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_popt_poptStrerror=yes
+  ac_header_compiler=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_lib_popt_poptStrerror=no
-fi
-
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_popt_poptStrerror" >&5
-echo "${ECHO_T}$ac_cv_lib_popt_poptStrerror" >&6; }
-if test $ac_cv_lib_popt_poptStrerror = yes; then
-  AST_POPT_FOUND=yes
-else
-  AST_POPT_FOUND=no
+	ac_header_compiler=no
 fi
 
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
 
-   if test "${AST_POPT_FOUND}" = "yes"; then
-      POPT_LIB="-lpopt "
-      POPT_HEADER_FOUND="1"
-      if test "x${POPT_DIR}" != "x"; then
-         POPT_LIB="${pbxlibdir} ${POPT_LIB}"
-	 POPT_INCLUDE="-I${POPT_DIR}/include"
-	 if test "xpopt.h" != "x" ; then
-	    as_ac_Header=`echo "ac_cv_header_${POPT_DIR}/include/popt.h" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${POPT_DIR}/include/popt.h" >&5
-echo $ECHO_N "checking for ${POPT_DIR}/include/popt.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-	       { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${POPT_DIR}/include/popt.h usability" >&5
-echo $ECHO_N "checking ${POPT_DIR}/include/popt.h usability... $ECHO_C" >&6; }
+# Is the header present?
+{ echo "$as_me:$LINENO: checking  presence" >&5
+echo $ECHO_N "checking  presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-$ac_includes_default
-#include <${POPT_DIR}/include/popt.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_header_compiler=no
-fi
-
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking ${POPT_DIR}/include/popt.h presence" >&5
-echo $ECHO_N "checking ${POPT_DIR}/include/popt.h presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${POPT_DIR}/include/popt.h>
+#include <>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -10471,79 +10435,146 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${POPT_DIR}/include/popt.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${POPT_DIR}/include/popt.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${POPT_DIR}/include/popt.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${POPT_DIR}/include/popt.h: proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: : proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: : proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${POPT_DIR}/include/popt.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${POPT_DIR}/include/popt.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${POPT_DIR}/include/popt.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${POPT_DIR}/include/popt.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${POPT_DIR}/include/popt.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${POPT_DIR}/include/popt.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${POPT_DIR}/include/popt.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${POPT_DIR}/include/popt.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${POPT_DIR}/include/popt.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${POPT_DIR}/include/popt.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${POPT_DIR}/include/popt.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${POPT_DIR}/include/popt.h: in the future, the compiler will take precedence" >&2;}
+    { echo "$as_me:$LINENO: WARNING: : present but cannot be compiled" >&5
+echo "$as_me: WARNING: : present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: :     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: :     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: : see the Autoconf documentation" >&5
+echo "$as_me: WARNING: : see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: :     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: :     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: : proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: : proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: : in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: : in the future, the compiler will take precedence" >&2;}
 
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for ${POPT_DIR}/include/popt.h" >&5
-echo $ECHO_N "checking for ${POPT_DIR}/include/popt.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+{ echo "$as_me:$LINENO: checking for " >&5
+echo $ECHO_N "checking for ... $ECHO_C" >&6; }
+if test "${ac_cv_header_+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  eval "$as_ac_Header=\$ac_header_preproc"
+  ac_cv_header_=$ac_header_preproc
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-	       { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
+echo "${ECHO_T}$ac_cv_header_" >&6; }
 
 fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  POPT_HEADER_FOUND=1
+if test $ac_cv_header_ = yes; then
+  OGG_HEADER_FOUND=1
 else
-  POPT_HEADER_FOUND=0
+  OGG_HEADER_FOUND=0
 fi
 
 
 	 fi
+      fi
+      if test "x${OGG_HEADER_FOUND}" = "x0" ; then
+         if test ! -z "${OGG_MANDATORY}" ;
+         then
+            echo " ***"
+            echo " *** It appears that you do not have the ogg development package installed."
+            echo " *** Please install it to include OGG support, or re-run configure"
+            echo " *** without explicitly specifying --with-ogg"
+            exit 1
+         fi
+         OGG_LIB=""
+         OGG_INCLUDE=""
+         PBX_LIBOGG=0
       else
-	 if test "xpopt.h" != "x" ; then
-            if test "${ac_cv_header_popt_h+set}" = set; then
-  { echo "$as_me:$LINENO: checking for popt.h" >&5
-echo $ECHO_N "checking for popt.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_popt_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+         PBX_LIBOGG=1
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_OGG 1
+_ACEOF
+
+      fi
+   elif test ! -z "${OGG_MANDATORY}";
+   then
+      echo "***"
+      echo "*** The OGG installation on this system appears to be broken."
+      echo "*** Either correct the installation, or run configure"
+      echo "*** without explicity specifying --with-ogg"
+      exit 1
+   fi
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_popt_h" >&5
-echo "${ECHO_T}$ac_cv_header_popt_h" >&6; }
+
+
+
+
+
+
+# Check whether --with-osptk was given.
+if test "${with_osptk+set}" = set; then
+  withval=$with_osptk;
+case ${withval} in
+     n|no)
+     USE_OSPTK=no
+     ;;
+     y|ye|yes)
+     OSPTK_MANDATORY="yes"
+     ;;
+     *)
+     OSPTK_DIR="${withval}"
+     OSPTK_MANDATORY="yes"
+     ;;
+esac
+
+fi
+
+
+PBX_LIBOSPTK=0
+
+if test "${USE_OSPTK}" != "no"; then
+   pbxlibdir=""
+   if test "x${OSPTK_DIR}" != "x"; then
+      pbxlibdir="-L${osptk_DIR}/lib"
+   fi
+   { echo "$as_me:$LINENO: checking for OSPPCryptoDecrypt in -losptk" >&5
+echo $ECHO_N "checking for OSPPCryptoDecrypt in -losptk... $ECHO_C" >&6; }
+if test "${ac_cv_lib_osptk_OSPPCryptoDecrypt+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking popt.h usability" >&5
-echo $ECHO_N "checking popt.h usability... $ECHO_C" >&6; }
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-losptk ${pbxlibdir} -lcrypto -lssl $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-$ac_includes_default
-#include <popt.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 OSPPCryptoDecrypt ();
+int
+main ()
+{
+return OSPPCryptoDecrypt ();
+  ;
+  return 0;
+}
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
@@ -10560,7 +10591,7 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
+	 { ac_try='test -s conftest$ac_exeext'
   { (case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
@@ -10570,28 +10601,113 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_header_compiler=yes
+  ac_cv_lib_osptk_OSPPCryptoDecrypt=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_header_compiler=no
+	ac_cv_lib_osptk_OSPPCryptoDecrypt=no
 fi
 
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_osptk_OSPPCryptoDecrypt" >&5
+echo "${ECHO_T}$ac_cv_lib_osptk_OSPPCryptoDecrypt" >&6; }
+if test $ac_cv_lib_osptk_OSPPCryptoDecrypt = yes; then
+  AST_OSPTK_FOUND=yes
+else
+  AST_OSPTK_FOUND=no
+fi
 
-# Is the header present?
-{ echo "$as_me:$LINENO: checking popt.h presence" >&5
-echo $ECHO_N "checking popt.h presence... $ECHO_C" >&6; }
+
+   if test "${AST_OSPTK_FOUND}" = "yes"; then
+      OSPTK_LIB="-losptk -lcrypto -lssl"
+      OSPTK_HEADER_FOUND="1"
+      if test "x${OSPTK_DIR}" != "x"; then
+         OSPTK_LIB="${pbxlibdir} ${OSPTK_LIB}"
+	 OSPTK_INCLUDE="-I${OSPTK_DIR}/include"
+	 if test "xosp/osp.h" != "x" ; then
+	    as_ac_Header=`echo "ac_cv_header_${OSPTK_DIR}/include/osp/osp.h" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  { echo "$as_me:$LINENO: checking for ${OSPTK_DIR}/include/osp/osp.h" >&5
+echo $ECHO_N "checking for ${OSPTK_DIR}/include/osp/osp.h... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking ${OSPTK_DIR}/include/osp/osp.h usability" >&5
+echo $ECHO_N "checking ${OSPTK_DIR}/include/osp/osp.h usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <popt.h>
+$ac_includes_default
+#include <${OSPTK_DIR}/include/osp/osp.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_header_compiler=no
+fi
+
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking ${OSPTK_DIR}/include/osp/osp.h presence" >&5
+echo $ECHO_N "checking ${OSPTK_DIR}/include/osp/osp.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <${OSPTK_DIR}/include/osp/osp.h>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -10631,146 +10747,79 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: popt.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: popt.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: popt.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: popt.h: proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${OSPTK_DIR}/include/osp/osp.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: ${OSPTK_DIR}/include/osp/osp.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${OSPTK_DIR}/include/osp/osp.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: ${OSPTK_DIR}/include/osp/osp.h: proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: popt.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: popt.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: popt.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: popt.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: popt.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: popt.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: popt.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: popt.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: popt.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: popt.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: popt.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: popt.h: in the future, the compiler will take precedence" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${OSPTK_DIR}/include/osp/osp.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: ${OSPTK_DIR}/include/osp/osp.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${OSPTK_DIR}/include/osp/osp.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: ${OSPTK_DIR}/include/osp/osp.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${OSPTK_DIR}/include/osp/osp.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: ${OSPTK_DIR}/include/osp/osp.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${OSPTK_DIR}/include/osp/osp.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: ${OSPTK_DIR}/include/osp/osp.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${OSPTK_DIR}/include/osp/osp.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: ${OSPTK_DIR}/include/osp/osp.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${OSPTK_DIR}/include/osp/osp.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: ${OSPTK_DIR}/include/osp/osp.h: in the future, the compiler will take precedence" >&2;}
 
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for popt.h" >&5
-echo $ECHO_N "checking for popt.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_popt_h+set}" = set; then
+{ echo "$as_me:$LINENO: checking for ${OSPTK_DIR}/include/osp/osp.h" >&5
+echo $ECHO_N "checking for ${OSPTK_DIR}/include/osp/osp.h... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_cv_header_popt_h=$ac_header_preproc
+  eval "$as_ac_Header=\$ac_header_preproc"
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_popt_h" >&5
-echo "${ECHO_T}$ac_cv_header_popt_h" >&6; }
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
 
 fi
-if test $ac_cv_header_popt_h = yes; then
-  POPT_HEADER_FOUND=1
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  OSPTK_HEADER_FOUND=1
 else
-  POPT_HEADER_FOUND=0
+  OSPTK_HEADER_FOUND=0
 fi
 
 
 	 fi
-      fi
-      if test "x${POPT_HEADER_FOUND}" = "x0" ; then
-         if test ! -z "${POPT_MANDATORY}" ;
-         then
-            echo " ***"
-            echo " *** It appears that you do not have the popt development package installed."
-            echo " *** Please install it to include popt support, or re-run configure"
-            echo " *** without explicitly specifying --with-popt"
-            exit 1
-         fi
-         POPT_LIB=""
-         POPT_INCLUDE=""
-         PBX_LIBPOPT=0
       else
-         PBX_LIBPOPT=1
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_POPT 1
-_ACEOF
-
-      fi
-   elif test ! -z "${POPT_MANDATORY}";
-   then
-      echo "***"
-      echo "*** The popt installation on this system appears to be broken."
-      echo "*** Either correct the installation, or run configure"
-      echo "*** without explicity specifying --with-popt"
-      exit 1
-   fi
-fi
-
-
-
-
-
-
-# Check whether --with-pri was given.
-if test "${with_pri+set}" = set; then
-  withval=$with_pri;
-case ${withval} in
-     n|no)
-     USE_LIBPRI=no
-     ;;
-     y|ye|yes)
-     LIBPRI_MANDATORY="yes"
-     ;;
-     *)
-     LIBPRI_DIR="${withval}"
-     LIBPRI_MANDATORY="yes"
-     ;;
-esac
-
-fi
-
-
-PBX_LIBLIBPRI=0
-
-if test "${USE_LIBPRI}" != "no"; then
-   pbxlibdir=""
-   if test "x${LIBPRI_DIR}" != "x"; then
-      pbxlibdir="-L${pri_DIR}/lib"
-   fi
-   { echo "$as_me:$LINENO: checking for pri_call in -lpri" >&5
-echo $ECHO_N "checking for pri_call in -lpri... $ECHO_C" >&6; }
-if test "${ac_cv_lib_pri_pri_call+set}" = set; then
+	 if test "xosp/osp.h" != "x" ; then
+            if test "${ac_cv_header_osp_osp_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for osp/osp.h" >&5
+echo $ECHO_N "checking for osp/osp.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_osp_osp_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_osp_osp_h" >&5
+echo "${ECHO_T}$ac_cv_header_osp_osp_h" >&6; }
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpri ${pbxlibdir}  $LIBS"
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking osp/osp.h usability" >&5
+echo $ECHO_N "checking osp/osp.h usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-
-/* 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 pri_call ();
-int
-main ()
-{
-return pri_call ();
-  ;
-  return 0;
-}
+$ac_includes_default
+#include <osp/osp.h>
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
@@ -10787,7 +10836,7 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
+	 { ac_try='test -s conftest.$ac_objext'
   { (case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
@@ -10797,48 +10846,156 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_pri_pri_call=yes
+  ac_header_compiler=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_lib_pri_pri_call=no
-fi
-
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_pri_pri_call" >&5
-echo "${ECHO_T}$ac_cv_lib_pri_pri_call" >&6; }
-if test $ac_cv_lib_pri_pri_call = yes; then
-  AST_LIBPRI_FOUND=yes
-else
-  AST_LIBPRI_FOUND=no
+	ac_header_compiler=no
 fi
 
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
 
-   if test "${AST_LIBPRI_FOUND}" = "yes"; then
-      LIBPRI_LIB="-lpri "
-      LIBPRI_HEADER_FOUND="1"
-      if test "x${LIBPRI_DIR}" != "x"; then
-         LIBPRI_LIB="${pbxlibdir} ${LIBPRI_LIB}"
-	 LIBPRI_INCLUDE="-I${LIBPRI_DIR}/include"
-	 if test "xlibpri.h" != "x" ; then
-	    as_ac_Header=`echo "ac_cv_header_${LIBPRI_DIR}/include/libpri.h" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${LIBPRI_DIR}/include/libpri.h" >&5
-echo $ECHO_N "checking for ${LIBPRI_DIR}/include/libpri.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-	       { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${LIBPRI_DIR}/include/libpri.h usability" >&5
-echo $ECHO_N "checking ${LIBPRI_DIR}/include/libpri.h usability... $ECHO_C" >&6; }
+# Is the header present?
+{ echo "$as_me:$LINENO: checking osp/osp.h presence" >&5
+echo $ECHO_N "checking osp/osp.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <osp/osp.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: osp/osp.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: osp/osp.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: osp/osp.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: osp/osp.h: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: osp/osp.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: osp/osp.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: osp/osp.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: osp/osp.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: osp/osp.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: osp/osp.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: osp/osp.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: osp/osp.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: osp/osp.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: osp/osp.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: osp/osp.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: osp/osp.h: in the future, the compiler will take precedence" >&2;}
+
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for osp/osp.h" >&5
+echo $ECHO_N "checking for osp/osp.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_osp_osp_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_osp_osp_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_osp_osp_h" >&5
+echo "${ECHO_T}$ac_cv_header_osp_osp_h" >&6; }
+
+fi
+if test $ac_cv_header_osp_osp_h = yes; then
+  OSPTK_HEADER_FOUND=1
+else
+  OSPTK_HEADER_FOUND=0
+fi
+
+
+	 fi
+      fi
+      if test "x${OSPTK_HEADER_FOUND}" = "x0" ; then
+         if test ! -z "${OSPTK_MANDATORY}" ;
+         then
+            echo " ***"
+            echo " *** It appears that you do not have the osptk development package installed."
+            echo " *** Please install it to include OSP Toolkit support, or re-run configure"
+            echo " *** without explicitly specifying --with-osptk"
+            exit 1
+         fi
+         OSPTK_LIB=""
+         OSPTK_INCLUDE=""
+         PBX_LIBOSPTK=0
+      else
+         PBX_LIBOSPTK=1
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_OSPTK 1
+_ACEOF
+
+      fi
+   elif test ! -z "${OSPTK_MANDATORY}";
+   then
+      echo "***"
+      echo "*** The OSP Toolkit installation on this system appears to be broken."
+      echo "*** Either correct the installation, or run configure"
+      echo "*** without explicity specifying --with-osptk"
+      exit 1
+   fi
+fi
+
+
+
+
+
+PBX_LIBOSS=0
+if test "${ac_cv_header_linux_soundcard_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for linux/soundcard.h" >&5
+echo $ECHO_N "checking for linux/soundcard.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_linux_soundcard_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_linux_soundcard_h" >&5
+echo "${ECHO_T}$ac_cv_header_linux_soundcard_h" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking linux/soundcard.h usability" >&5
+echo $ECHO_N "checking linux/soundcard.h usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -10846,7 +11003,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <${LIBPRI_DIR}/include/libpri.h>
+#include <linux/soundcard.h>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -10895,15 +11052,15 @@ rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking ${LIBPRI_DIR}/include/libpri.h presence" >&5
-echo $ECHO_N "checking ${LIBPRI_DIR}/include/libpri.h presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking linux/soundcard.h presence" >&5
+echo $ECHO_N "checking linux/soundcard.h presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <${LIBPRI_DIR}/include/libpri.h>
+#include <linux/soundcard.h>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -10943,62 +11100,64 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${LIBPRI_DIR}/include/libpri.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${LIBPRI_DIR}/include/libpri.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${LIBPRI_DIR}/include/libpri.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${LIBPRI_DIR}/include/libpri.h: proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: linux/soundcard.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: linux/soundcard.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: linux/soundcard.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: linux/soundcard.h: proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${LIBPRI_DIR}/include/libpri.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${LIBPRI_DIR}/include/libpri.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${LIBPRI_DIR}/include/libpri.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${LIBPRI_DIR}/include/libpri.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${LIBPRI_DIR}/include/libpri.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${LIBPRI_DIR}/include/libpri.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${LIBPRI_DIR}/include/libpri.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${LIBPRI_DIR}/include/libpri.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${LIBPRI_DIR}/include/libpri.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${LIBPRI_DIR}/include/libpri.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${LIBPRI_DIR}/include/libpri.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${LIBPRI_DIR}/include/libpri.h: in the future, the compiler will take precedence" >&2;}
+    { echo "$as_me:$LINENO: WARNING: linux/soundcard.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: linux/soundcard.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: linux/soundcard.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: linux/soundcard.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: linux/soundcard.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: linux/soundcard.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: linux/soundcard.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: linux/soundcard.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: linux/soundcard.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: linux/soundcard.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: linux/soundcard.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: linux/soundcard.h: in the future, the compiler will take precedence" >&2;}
 
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for ${LIBPRI_DIR}/include/libpri.h" >&5
-echo $ECHO_N "checking for ${LIBPRI_DIR}/include/libpri.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+{ echo "$as_me:$LINENO: checking for linux/soundcard.h" >&5
+echo $ECHO_N "checking for linux/soundcard.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_linux_soundcard_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  eval "$as_ac_Header=\$ac_header_preproc"
+  ac_cv_header_linux_soundcard_h=$ac_header_preproc
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-	       { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_linux_soundcard_h" >&5
+echo "${ECHO_T}$ac_cv_header_linux_soundcard_h" >&6; }
 
 fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  LIBPRI_HEADER_FOUND=1
-else
-  LIBPRI_HEADER_FOUND=0
+if test $ac_cv_header_linux_soundcard_h = yes; then
+
+		PBX_LIBOSS=1
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_OSS 1
+_ACEOF
+
+
 fi
 
 
-	 fi
-      else
-	 if test "xlibpri.h" != "x" ; then
-            if test "${ac_cv_header_libpri_h+set}" = set; then
-  { echo "$as_me:$LINENO: checking for libpri.h" >&5
-echo $ECHO_N "checking for libpri.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_libpri_h+set}" = set; then
+if test "$PBX_LIBOSS" = "0"; then
+   if test "${ac_cv_header_sys_soundcard_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for sys/soundcard.h" >&5
+echo $ECHO_N "checking for sys/soundcard.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_sys_soundcard_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_libpri_h" >&5
-echo "${ECHO_T}$ac_cv_header_libpri_h" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_sys_soundcard_h" >&5
+echo "${ECHO_T}$ac_cv_header_sys_soundcard_h" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking libpri.h usability" >&5
-echo $ECHO_N "checking libpri.h usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking sys/soundcard.h usability" >&5
+echo $ECHO_N "checking sys/soundcard.h usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -11006,7 +11165,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <libpri.h>
+#include <sys/soundcard.h>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -11055,15 +11214,15 @@ rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking libpri.h presence" >&5
-echo $ECHO_N "checking libpri.h presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking sys/soundcard.h presence" >&5
+echo $ECHO_N "checking sys/soundcard.h presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <libpri.h>
+#include <sys/soundcard.h>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -11103,116 +11262,88 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: libpri.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: libpri.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: libpri.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: libpri.h: proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: sys/soundcard.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: sys/soundcard.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: sys/soundcard.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: sys/soundcard.h: proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: libpri.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: libpri.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: libpri.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: libpri.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: libpri.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: libpri.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: libpri.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: libpri.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: libpri.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: libpri.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: libpri.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: libpri.h: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for libpri.h" >&5
-echo $ECHO_N "checking for libpri.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_libpri_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_cv_header_libpri_h=$ac_header_preproc
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_libpri_h" >&5
-echo "${ECHO_T}$ac_cv_header_libpri_h" >&6; }
+    { echo "$as_me:$LINENO: WARNING: sys/soundcard.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: sys/soundcard.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: sys/soundcard.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: sys/soundcard.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: sys/soundcard.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: sys/soundcard.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: sys/soundcard.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: sys/soundcard.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: sys/soundcard.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: sys/soundcard.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: sys/soundcard.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: sys/soundcard.h: in the future, the compiler will take precedence" >&2;}
 
-fi
-if test $ac_cv_header_libpri_h = yes; then
-  LIBPRI_HEADER_FOUND=1
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for sys/soundcard.h" >&5
+echo $ECHO_N "checking for sys/soundcard.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_sys_soundcard_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  LIBPRI_HEADER_FOUND=0
+  ac_cv_header_sys_soundcard_h=$ac_header_preproc
 fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_sys_soundcard_h" >&5
+echo "${ECHO_T}$ac_cv_header_sys_soundcard_h" >&6; }
 
+fi
+if test $ac_cv_header_sys_soundcard_h = yes; then
 
-	 fi
-      fi
-      if test "x${LIBPRI_HEADER_FOUND}" = "x0" ; then
-         if test ! -z "${LIBPRI_MANDATORY}" ;
-         then
-            echo " ***"
-            echo " *** It appears that you do not have the pri development package installed."
-            echo " *** Please install it to include ISDN PRI support, or re-run configure"
-            echo " *** without explicitly specifying --with-pri"
-            exit 1
-         fi
-         LIBPRI_LIB=""
-         LIBPRI_INCLUDE=""
-         PBX_LIBLIBPRI=0
-      else
-         PBX_LIBLIBPRI=1
+		   PBX_LIBossaudio=1
 
 cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBPRI 1
+#define HAVE_OSS 1
 _ACEOF
 
-      fi
-   elif test ! -z "${LIBPRI_MANDATORY}";
-   then
-      echo "***"
-      echo "*** The ISDN PRI installation on this system appears to be broken."
-      echo "*** Either correct the installation, or run configure"
-      echo "*** without explicity specifying --with-pri"
-      exit 1
-   fi
-fi
-
 
+fi
 
 
+fi
+if test "$PBX_LIBOSS" = "0"; then
 
 
-# Check whether --with-radiusclient-ng was given.
-if test "${with_radiusclient_ng+set}" = set; then
-  withval=$with_radiusclient_ng;
+# Check whether --with-ossaudio was given.
+if test "${with_ossaudio+set}" = set; then
+  withval=$with_ossaudio;
 case ${withval} in
      n|no)
-     USE_RADIUSCLIENT=no
+     USE_OSS=no
      ;;
      y|ye|yes)
-     RADIUSCLIENT_MANDATORY="yes"
+     OSS_MANDATORY="yes"
      ;;
      *)
-     RADIUSCLIENT_DIR="${withval}"
-     RADIUSCLIENT_MANDATORY="yes"
+     OSS_DIR="${withval}"
+     OSS_MANDATORY="yes"
      ;;
 esac
 
 fi
 
 
-PBX_LIBRADIUSCLIENT=0
+PBX_LIBOSS=0
 
-if test "${USE_RADIUSCLIENT}" != "no"; then
+if test "${USE_OSS}" != "no"; then
    pbxlibdir=""
-   if test "x${RADIUSCLIENT_DIR}" != "x"; then
-      pbxlibdir="-L${radiusclient-ng_DIR}/lib"
+   if test "x${OSS_DIR}" != "x"; then
+      pbxlibdir="-L${ossaudio_DIR}/lib"
    fi
-   { echo "$as_me:$LINENO: checking for rc_read_config in -lradiusclient-ng" >&5
-echo $ECHO_N "checking for rc_read_config in -lradiusclient-ng... $ECHO_C" >&6; }
-if test "${ac_cv_lib_radiusclient_ng_rc_read_config+set}" = set; then
+   { echo "$as_me:$LINENO: checking for oss_ioctl_mixer in -lossaudio" >&5
+echo $ECHO_N "checking for oss_ioctl_mixer in -lossaudio... $ECHO_C" >&6; }
+if test "${ac_cv_lib_ossaudio_oss_ioctl_mixer+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lradiusclient-ng ${pbxlibdir}  $LIBS"
+LIBS="-lossaudio ${pbxlibdir}  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -11226,11 +11357,11 @@ cat >>conftest.$ac_ext <<_ACEOF
 #ifdef __cplusplus
 extern "C"
 #endif
-char rc_read_config ();
+char oss_ioctl_mixer ();
 int
 main ()
 {
-return rc_read_config ();
+return oss_ioctl_mixer ();
   ;
   return 0;
 }
@@ -11269,38 +11400,38 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_radiusclient_ng_rc_read_config=yes
+  ac_cv_lib_ossaudio_oss_ioctl_mixer=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_lib_radiusclient_ng_rc_read_config=no
+	ac_cv_lib_ossaudio_oss_ioctl_mixer=no
 fi
 
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_radiusclient_ng_rc_read_config" >&5
-echo "${ECHO_T}$ac_cv_lib_radiusclient_ng_rc_read_config" >&6; }
-if test $ac_cv_lib_radiusclient_ng_rc_read_config = yes; then
-  AST_RADIUSCLIENT_FOUND=yes
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_ossaudio_oss_ioctl_mixer" >&5
+echo "${ECHO_T}$ac_cv_lib_ossaudio_oss_ioctl_mixer" >&6; }
+if test $ac_cv_lib_ossaudio_oss_ioctl_mixer = yes; then
+  AST_OSS_FOUND=yes
 else
-  AST_RADIUSCLIENT_FOUND=no
+  AST_OSS_FOUND=no
 fi
 
 
-   if test "${AST_RADIUSCLIENT_FOUND}" = "yes"; then
-      RADIUSCLIENT_LIB="-lradiusclient-ng "
-      RADIUSCLIENT_HEADER_FOUND="1"
-      if test "x${RADIUSCLIENT_DIR}" != "x"; then
-         RADIUSCLIENT_LIB="${pbxlibdir} ${RADIUSCLIENT_LIB}"
-	 RADIUSCLIENT_INCLUDE="-I${RADIUSCLIENT_DIR}/include"
-	 if test "xradiusclient-ng.h" != "x" ; then
-	    as_ac_Header=`echo "ac_cv_header_${RADIUSCLIENT_DIR}/include/radiusclient-ng.h" | $as_tr_sh`
+   if test "${AST_OSS_FOUND}" = "yes"; then
+      OSS_LIB="-lossaudio "
+      OSS_HEADER_FOUND="1"
+      if test "x${OSS_DIR}" != "x"; then
+         OSS_LIB="${pbxlibdir} ${OSS_LIB}"
+	 OSS_INCLUDE="-I${OSS_DIR}/include"
+	 if test "xsoundcard.h" != "x" ; then
+	    as_ac_Header=`echo "ac_cv_header_${OSS_DIR}/include/soundcard.h" | $as_tr_sh`
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${RADIUSCLIENT_DIR}/include/radiusclient-ng.h" >&5
-echo $ECHO_N "checking for ${RADIUSCLIENT_DIR}/include/radiusclient-ng.h... $ECHO_C" >&6; }
+  { echo "$as_me:$LINENO: checking for ${OSS_DIR}/include/soundcard.h" >&5
+echo $ECHO_N "checking for ${OSS_DIR}/include/soundcard.h... $ECHO_C" >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
@@ -11309,8 +11440,8 @@ ac_res=`eval echo '${'$as_ac_Header'}'`
 echo "${ECHO_T}$ac_res" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${RADIUSCLIENT_DIR}/include/radiusclient-ng.h usability" >&5
-echo $ECHO_N "checking ${RADIUSCLIENT_DIR}/include/radiusclient-ng.h usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking ${OSS_DIR}/include/soundcard.h usability" >&5
+echo $ECHO_N "checking ${OSS_DIR}/include/soundcard.h usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -11318,7 +11449,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <${RADIUSCLIENT_DIR}/include/radiusclient-ng.h>
+#include <${OSS_DIR}/include/soundcard.h>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -11367,15 +11498,15 @@ rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking ${RADIUSCLIENT_DIR}/include/radiusclient-ng.h presence" >&5
-echo $ECHO_N "checking ${RADIUSCLIENT_DIR}/include/radiusclient-ng.h presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking ${OSS_DIR}/include/soundcard.h presence" >&5
+echo $ECHO_N "checking ${OSS_DIR}/include/soundcard.h presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <${RADIUSCLIENT_DIR}/include/radiusclient-ng.h>
+#include <${OSS_DIR}/include/soundcard.h>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -11415,30 +11546,30 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${RADIUSCLIENT_DIR}/include/radiusclient-ng.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${RADIUSCLIENT_DIR}/include/radiusclient-ng.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${RADIUSCLIENT_DIR}/include/radiusclient-ng.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${RADIUSCLIENT_DIR}/include/radiusclient-ng.h: proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${OSS_DIR}/include/soundcard.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: ${OSS_DIR}/include/soundcard.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${OSS_DIR}/include/soundcard.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: ${OSS_DIR}/include/soundcard.h: proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${RADIUSCLIENT_DIR}/include/radiusclient-ng.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${RADIUSCLIENT_DIR}/include/radiusclient-ng.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${RADIUSCLIENT_DIR}/include/radiusclient-ng.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${RADIUSCLIENT_DIR}/include/radiusclient-ng.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${RADIUSCLIENT_DIR}/include/radiusclient-ng.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${RADIUSCLIENT_DIR}/include/radiusclient-ng.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${RADIUSCLIENT_DIR}/include/radiusclient-ng.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${RADIUSCLIENT_DIR}/include/radiusclient-ng.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${RADIUSCLIENT_DIR}/include/radiusclient-ng.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${RADIUSCLIENT_DIR}/include/radiusclient-ng.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${RADIUSCLIENT_DIR}/include/radiusclient-ng.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${RADIUSCLIENT_DIR}/include/radiusclient-ng.h: in the future, the compiler will take precedence" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${OSS_DIR}/include/soundcard.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: ${OSS_DIR}/include/soundcard.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${OSS_DIR}/include/soundcard.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: ${OSS_DIR}/include/soundcard.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${OSS_DIR}/include/soundcard.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: ${OSS_DIR}/include/soundcard.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${OSS_DIR}/include/soundcard.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: ${OSS_DIR}/include/soundcard.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${OSS_DIR}/include/soundcard.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: ${OSS_DIR}/include/soundcard.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${OSS_DIR}/include/soundcard.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: ${OSS_DIR}/include/soundcard.h: in the future, the compiler will take precedence" >&2;}
 
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for ${RADIUSCLIENT_DIR}/include/radiusclient-ng.h" >&5
-echo $ECHO_N "checking for ${RADIUSCLIENT_DIR}/include/radiusclient-ng.h... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking for ${OSS_DIR}/include/soundcard.h" >&5
+echo $ECHO_N "checking for ${OSS_DIR}/include/soundcard.h... $ECHO_C" >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -11450,27 +11581,27 @@ echo "${ECHO_T}$ac_res" >&6; }
 
 fi
 if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  RADIUSCLIENT_HEADER_FOUND=1
+  OSS_HEADER_FOUND=1
 else
-  RADIUSCLIENT_HEADER_FOUND=0
+  OSS_HEADER_FOUND=0
 fi
 
 
 	 fi
       else
-	 if test "xradiusclient-ng.h" != "x" ; then
-            if test "${ac_cv_header_radiusclient_ng_h+set}" = set; then
-  { echo "$as_me:$LINENO: checking for radiusclient-ng.h" >&5
-echo $ECHO_N "checking for radiusclient-ng.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_radiusclient_ng_h+set}" = set; then
+	 if test "xsoundcard.h" != "x" ; then
+            if test "${ac_cv_header_soundcard_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for soundcard.h" >&5
+echo $ECHO_N "checking for soundcard.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_soundcard_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_radiusclient_ng_h" >&5
-echo "${ECHO_T}$ac_cv_header_radiusclient_ng_h" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_soundcard_h" >&5
+echo "${ECHO_T}$ac_cv_header_soundcard_h" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking radiusclient-ng.h usability" >&5
-echo $ECHO_N "checking radiusclient-ng.h usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking soundcard.h usability" >&5
+echo $ECHO_N "checking soundcard.h usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -11478,7 +11609,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <radiusclient-ng.h>
+#include <soundcard.h>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -11527,15 +11658,15 @@ rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking radiusclient-ng.h presence" >&5
-echo $ECHO_N "checking radiusclient-ng.h presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking soundcard.h presence" >&5
+echo $ECHO_N "checking soundcard.h presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <radiusclient-ng.h>
+#include <soundcard.h>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -11575,74 +11706,74 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: radiusclient-ng.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: radiusclient-ng.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: radiusclient-ng.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: radiusclient-ng.h: proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: soundcard.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: soundcard.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: soundcard.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: soundcard.h: proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: radiusclient-ng.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: radiusclient-ng.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: radiusclient-ng.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: radiusclient-ng.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: radiusclient-ng.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: radiusclient-ng.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: radiusclient-ng.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: radiusclient-ng.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: radiusclient-ng.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: radiusclient-ng.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: radiusclient-ng.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: radiusclient-ng.h: in the future, the compiler will take precedence" >&2;}
+    { echo "$as_me:$LINENO: WARNING: soundcard.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: soundcard.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: soundcard.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: soundcard.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: soundcard.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: soundcard.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: soundcard.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: soundcard.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: soundcard.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: soundcard.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: soundcard.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: soundcard.h: in the future, the compiler will take precedence" >&2;}
 
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for radiusclient-ng.h" >&5
-echo $ECHO_N "checking for radiusclient-ng.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_radiusclient_ng_h+set}" = set; then
+{ echo "$as_me:$LINENO: checking for soundcard.h" >&5
+echo $ECHO_N "checking for soundcard.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_soundcard_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_cv_header_radiusclient_ng_h=$ac_header_preproc
+  ac_cv_header_soundcard_h=$ac_header_preproc
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_radiusclient_ng_h" >&5
-echo "${ECHO_T}$ac_cv_header_radiusclient_ng_h" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_soundcard_h" >&5
+echo "${ECHO_T}$ac_cv_header_soundcard_h" >&6; }
 
 fi
-if test $ac_cv_header_radiusclient_ng_h = yes; then
-  RADIUSCLIENT_HEADER_FOUND=1
+if test $ac_cv_header_soundcard_h = yes; then
+  OSS_HEADER_FOUND=1
 else
-  RADIUSCLIENT_HEADER_FOUND=0
+  OSS_HEADER_FOUND=0
 fi
 
 
 	 fi
       fi
-      if test "x${RADIUSCLIENT_HEADER_FOUND}" = "x0" ; then
-         if test ! -z "${RADIUSCLIENT_MANDATORY}" ;
+      if test "x${OSS_HEADER_FOUND}" = "x0" ; then
+         if test ! -z "${OSS_MANDATORY}" ;
          then
             echo " ***"
-            echo " *** It appears that you do not have the radiusclient-ng development package installed."
-            echo " *** Please install it to include Radius Client support, or re-run configure"
-            echo " *** without explicitly specifying --with-radiusclient-ng"
+            echo " *** It appears that you do not have the ossaudio development package installed."
+            echo " *** Please install it to include Open Sound System support, or re-run configure"
+            echo " *** without explicitly specifying --with-ossaudio"
             exit 1
          fi
-         RADIUSCLIENT_LIB=""
-         RADIUSCLIENT_INCLUDE=""
-         PBX_LIBRADIUSCLIENT=0
+         OSS_LIB=""
+         OSS_INCLUDE=""
+         PBX_LIBOSS=0
       else
-         PBX_LIBRADIUSCLIENT=1
+         PBX_LIBOSS=1
 
 cat >>confdefs.h <<_ACEOF
-#define HAVE_RADIUSCLIENT 1
+#define HAVE_OSS 1
 _ACEOF
 
       fi
-   elif test ! -z "${RADIUSCLIENT_MANDATORY}";
+   elif test ! -z "${OSS_MANDATORY}";
    then
       echo "***"
-      echo "*** The Radius Client installation on this system appears to be broken."
+      echo "*** The Open Sound System installation on this system appears to be broken."
       echo "*** Either correct the installation, or run configure"
-      echo "*** without explicity specifying --with-radiusclient-ng"
+      echo "*** without explicity specifying --with-ossaudio"
       exit 1
    fi
 fi
@@ -11650,316 +11781,291 @@ fi
 
 
 
+fi
+
 
 
-# Check whether --with-speex was given.
-if test "${with_speex+set}" = set; then
-  withval=$with_speex;
+
+# Check whether --with-pq was given.
+if test "${with_pq+set}" = set; then
+  withval=$with_pq;
 case ${withval} in
      n|no)
-     USE_SPEEX=no
+     USE_PQ=no
      ;;
      y|ye|yes)
-     SPEEX_MANDATORY="yes"
+     PQ_MANDATORY="yes"
      ;;
      *)
-     SPEEX_DIR="${withval}"
-     SPEEX_MANDATORY="yes"
+     PQ_DIR="${withval}"
+     PQ_MANDATORY="yes"
      ;;
 esac
 
 fi
 
 
-PBX_LIBSPEEX=0
-
-if test "${USE_SPEEX}" != "no"; then
-   pbxlibdir=""
-   if test "x${SPEEX_DIR}" != "x"; then
-      pbxlibdir="-L${speex_DIR}/lib"
-   fi
-   { echo "$as_me:$LINENO: checking for speex_encode in -lspeex" >&5
-echo $ECHO_N "checking for speex_encode in -lspeex... $ECHO_C" >&6; }
-if test "${ac_cv_lib_speex_speex_encode+set}" = set; then
+PBX_LIBpq=0
+PG_CONFIG=No
+if test "${USE_PQ}" != "no"; then
+   if test "x${PQ_DIR}" != "x"; then
+      if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}pg_config", so it can be a program name with args.
+set dummy ${ac_tool_prefix}pg_config; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_path_PG_CONFIG+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lspeex ${pbxlibdir} -lm $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
+  case $PG_CONFIG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_PG_CONFIG="$PG_CONFIG" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in ${PQ_DIR}/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_PG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
 
-/* 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 speex_encode ();
-int
-main ()
-{
-return speex_encode ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
+  ;;
 esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_lib_speex_speex_encode=yes
+fi
+PG_CONFIG=$ac_cv_path_PG_CONFIG
+if test -n "$PG_CONFIG"; then
+  { echo "$as_me:$LINENO: result: $PG_CONFIG" >&5
+echo "${ECHO_T}$PG_CONFIG" >&6; }
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
 
-	ac_cv_lib_speex_speex_encode=no
 fi
+if test -z "$ac_cv_path_PG_CONFIG"; then
+  ac_pt_PG_CONFIG=$PG_CONFIG
+  # Extract the first word of "pg_config", so it can be a program name with args.
+set dummy pg_config; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_path_ac_pt_PG_CONFIG+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $ac_pt_PG_CONFIG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_ac_pt_PG_CONFIG="$ac_pt_PG_CONFIG" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in ${PQ_DIR}/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_ac_pt_PG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
 
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+  ;;
+esac
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_speex_speex_encode" >&5
-echo "${ECHO_T}$ac_cv_lib_speex_speex_encode" >&6; }
-if test $ac_cv_lib_speex_speex_encode = yes; then
-  AST_SPEEX_FOUND=yes
+ac_pt_PG_CONFIG=$ac_cv_path_ac_pt_PG_CONFIG
+if test -n "$ac_pt_PG_CONFIG"; then
+  { echo "$as_me:$LINENO: result: $ac_pt_PG_CONFIG" >&5
+echo "${ECHO_T}$ac_pt_PG_CONFIG" >&6; }
 else
-  AST_SPEEX_FOUND=no
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
 fi
 
+  if test "x$ac_pt_PG_CONFIG" = x; then
+    PG_CONFIG="No"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    PG_CONFIG=$ac_pt_PG_CONFIG
+  fi
+else
+  PG_CONFIG="$ac_cv_path_PG_CONFIG"
+fi
 
-   if test "${AST_SPEEX_FOUND}" = "yes"; then
-      SPEEX_LIB="-lspeex -lm"
-      SPEEX_HEADER_FOUND="1"
-      if test "x${SPEEX_DIR}" != "x"; then
-         SPEEX_LIB="${pbxlibdir} ${SPEEX_LIB}"
-	 SPEEX_INCLUDE="-I${SPEEX_DIR}/include"
-	 if test "xspeex/speex.h" != "x" ; then
-	    as_ac_Header=`echo "ac_cv_header_${SPEEX_DIR}/include/speex/speex.h" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${SPEEX_DIR}/include/speex/speex.h" >&5
-echo $ECHO_N "checking for ${SPEEX_DIR}/include/speex/speex.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+      if test x"${PG_CONFIG}" = xNo; then
+         echo "***"
+         echo "*** pg_config was not found in the path you specified:"
+         echo "*** ${PQ_DIR}/bin"
+         echo "*** Either correct the installation, or run configure"
+         echo "*** including --without-pq"
+         exit 1
+      fi
+   else
+      if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}pg_config", so it can be a program name with args.
+set dummy ${ac_tool_prefix}pg_config; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_path_PG_CONFIG+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-	       { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
 else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${SPEEX_DIR}/include/speex/speex.h usability" >&5
-echo $ECHO_N "checking ${SPEEX_DIR}/include/speex/speex.h usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <${SPEEX_DIR}/include/speex/speex.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
+  case $PG_CONFIG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_PG_CONFIG="$PG_CONFIG" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_PG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+  ;;
 esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_header_compiler=yes
+fi
+PG_CONFIG=$ac_cv_path_PG_CONFIG
+if test -n "$PG_CONFIG"; then
+  { echo "$as_me:$LINENO: result: $PG_CONFIG" >&5
+echo "${ECHO_T}$PG_CONFIG" >&6; }
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_header_compiler=no
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
 fi
 
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
 
-# Is the header present?
-{ echo "$as_me:$LINENO: checking ${SPEEX_DIR}/include/speex/speex.h presence" >&5
-echo $ECHO_N "checking ${SPEEX_DIR}/include/speex/speex.h presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${SPEEX_DIR}/include/speex/speex.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
 fi
-if test -z "$ac_cpp_err"; then
-  ac_header_preproc=yes
+if test -z "$ac_cv_path_PG_CONFIG"; then
+  ac_pt_PG_CONFIG=$PG_CONFIG
+  # Extract the first word of "pg_config", so it can be a program name with args.
+set dummy pg_config; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_path_ac_pt_PG_CONFIG+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  case $ac_pt_PG_CONFIG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_ac_pt_PG_CONFIG="$ac_pt_PG_CONFIG" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_ac_pt_PG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
 
-  ac_header_preproc=no
+  ;;
+esac
+fi
+ac_pt_PG_CONFIG=$ac_cv_path_ac_pt_PG_CONFIG
+if test -n "$ac_pt_PG_CONFIG"; then
+  { echo "$as_me:$LINENO: result: $ac_pt_PG_CONFIG" >&5
+echo "${ECHO_T}$ac_pt_PG_CONFIG" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
 fi
 
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${SPEEX_DIR}/include/speex/speex.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${SPEEX_DIR}/include/speex/speex.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SPEEX_DIR}/include/speex/speex.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${SPEEX_DIR}/include/speex/speex.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${SPEEX_DIR}/include/speex/speex.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${SPEEX_DIR}/include/speex/speex.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SPEEX_DIR}/include/speex/speex.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${SPEEX_DIR}/include/speex/speex.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SPEEX_DIR}/include/speex/speex.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${SPEEX_DIR}/include/speex/speex.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SPEEX_DIR}/include/speex/speex.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${SPEEX_DIR}/include/speex/speex.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SPEEX_DIR}/include/speex/speex.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${SPEEX_DIR}/include/speex/speex.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SPEEX_DIR}/include/speex/speex.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${SPEEX_DIR}/include/speex/speex.h: in the future, the compiler will take precedence" >&2;}
-
-    ;;
+  if test "x$ac_pt_PG_CONFIG" = x; then
+    PG_CONFIG="No"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
 esac
-{ echo "$as_me:$LINENO: checking for ${SPEEX_DIR}/include/speex/speex.h" >&5
-echo $ECHO_N "checking for ${SPEEX_DIR}/include/speex/speex.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+    PG_CONFIG=$ac_pt_PG_CONFIG
+  fi
 else
-  eval "$as_ac_Header=\$ac_header_preproc"
+  PG_CONFIG="$ac_cv_path_PG_CONFIG"
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-	       { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
 
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  SPEEX_HEADER_FOUND=1
-else
-  SPEEX_HEADER_FOUND=0
+   fi
 fi
 
+if test x"${PG_CONFIG}" != xNo; then
+   PQ_libdir=`pg_config --libdir`
+   PQ_includedir=`pg_config --includedir`
 
-	 fi
-      else
-	 if test "xspeex/speex.h" != "x" ; then
-            if test "${ac_cv_header_speex_speex_h+set}" = set; then
-  { echo "$as_me:$LINENO: checking for speex/speex.h" >&5
-echo $ECHO_N "checking for speex/speex.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_speex_speex_h+set}" = set; then
+   { echo "$as_me:$LINENO: checking for PQexec in -lpq" >&5
+echo $ECHO_N "checking for PQexec in -lpq... $ECHO_C" >&6; }
+if test "${ac_cv_lib_pq_PQexec+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_speex_speex_h" >&5
-echo "${ECHO_T}$ac_cv_header_speex_speex_h" >&6; }
 else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking speex/speex.h usability" >&5
-echo $ECHO_N "checking speex/speex.h usability... $ECHO_C" >&6; }
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lpq -L${PQ_libdir} -lz $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-$ac_includes_default
-#include <speex/speex.h>
+
+/* 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 PQexec ();
+int
+main ()
+{
+return PQexec ();
+  ;
+  return 0;
+}
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
@@ -11976,7 +12082,7 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
+	 { ac_try='test -s conftest$ac_exeext'
   { (case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
@@ -11986,137 +12092,48 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_header_compiler=yes
+  ac_cv_lib_pq_PQexec=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_header_compiler=no
+	ac_cv_lib_pq_PQexec=no
 fi
 
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking speex/speex.h presence" >&5
-echo $ECHO_N "checking speex/speex.h presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <speex/speex.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
 fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_pq_PQexec" >&5
+echo "${ECHO_T}$ac_cv_lib_pq_PQexec" >&6; }
+if test $ac_cv_lib_pq_PQexec = yes; then
 
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: speex/speex.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: speex/speex.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: speex/speex.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: speex/speex.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: speex/speex.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: speex/speex.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: speex/speex.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: speex/speex.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: speex/speex.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: speex/speex.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: speex/speex.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: speex/speex.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: speex/speex.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: speex/speex.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: speex/speex.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: speex/speex.h: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for speex/speex.h" >&5
-echo $ECHO_N "checking for speex/speex.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_speex_speex_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_cv_header_speex_speex_h=$ac_header_preproc
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_speex_speex_h" >&5
-echo "${ECHO_T}$ac_cv_header_speex_speex_h" >&6; }
+cat >>confdefs.h <<_ACEOF
+#define HAVE_PQ 1
+_ACEOF
 
-fi
-if test $ac_cv_header_speex_speex_h = yes; then
-  SPEEX_HEADER_FOUND=1
-else
-  SPEEX_HEADER_FOUND=0
 fi
 
 
-	 fi
-      fi
-      if test "x${SPEEX_HEADER_FOUND}" = "x0" ; then
-         if test ! -z "${SPEEX_MANDATORY}" ;
-         then
-            echo " ***"
-            echo " *** It appears that you do not have the speex development package installed."
-            echo " *** Please install it to include Speex support, or re-run configure"
-            echo " *** without explicitly specifying --with-speex"
-            exit 1
-         fi
-         SPEEX_LIB=""
-         SPEEX_INCLUDE=""
-         PBX_LIBSPEEX=0
-      else
-         PBX_LIBSPEEX=1
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_SPEEX 1
-_ACEOF
-
-      fi
-   elif test ! -z "${SPEEX_MANDATORY}";
+   if test "${ac_cv_lib_pq_PQexec}" = "yes"; then
+      pq_LIB="-L${PQ_libdir} -lpq -lz"
+      pq_INCLUDE="-I${PQ_includedir}"
+      PBX_LIBpq=1
+   elif test ! -z "${PQ_MANDATORY}";
    then
       echo "***"
-      echo "*** The Speex installation on this system appears to be broken."
+      echo "*** The PostgreSQL installation on this system appears to be broken."
       echo "*** Either correct the installation, or run configure"
-      echo "*** without explicity specifying --with-speex"
+      echo "*** including --without-pq"
       exit 1
    fi
+elif test ! -z "${PQ_MANDATORY}";
+then
+   echo "***"
+   echo "*** The PostgreSQL installation on this system appears to be broken."
+   echo "*** Either correct the installation, or run configure"
+   echo "*** including --without-pq"
+   exit 1
 fi
 
 
@@ -12124,39 +12141,39 @@ fi
 
 
 
-# Check whether --with-sqlite was given.
-if test "${with_sqlite+set}" = set; then
-  withval=$with_sqlite;
+# Check whether --with-popt was given.
+if test "${with_popt+set}" = set; then
+  withval=$with_popt;
 case ${withval} in
      n|no)
-     USE_SQLITE=no
+     USE_POPT=no
      ;;
      y|ye|yes)
-     SQLITE_MANDATORY="yes"
+     POPT_MANDATORY="yes"
      ;;
      *)
-     SQLITE_DIR="${withval}"
-     SQLITE_MANDATORY="yes"
+     POPT_DIR="${withval}"
+     POPT_MANDATORY="yes"
      ;;
 esac
 
 fi
 
 
-PBX_LIBSQLITE=0
+PBX_LIBPOPT=0
 
-if test "${USE_SQLITE}" != "no"; then
+if test "${USE_POPT}" != "no"; then
    pbxlibdir=""
-   if test "x${SQLITE_DIR}" != "x"; then
-      pbxlibdir="-L${sqlite_DIR}/lib"
+   if test "x${POPT_DIR}" != "x"; then
+      pbxlibdir="-L${popt_DIR}/lib"
    fi
-   { echo "$as_me:$LINENO: checking for sqlite_exec in -lsqlite" >&5
-echo $ECHO_N "checking for sqlite_exec in -lsqlite... $ECHO_C" >&6; }
-if test "${ac_cv_lib_sqlite_sqlite_exec+set}" = set; then
+   { echo "$as_me:$LINENO: checking for poptStrerror in -lpopt" >&5
+echo $ECHO_N "checking for poptStrerror in -lpopt... $ECHO_C" >&6; }
+if test "${ac_cv_lib_popt_poptStrerror+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lsqlite ${pbxlibdir}  $LIBS"
+LIBS="-lpopt ${pbxlibdir}  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -12170,11 +12187,11 @@ cat >>conftest.$ac_ext <<_ACEOF
 #ifdef __cplusplus
 extern "C"
 #endif
-char sqlite_exec ();
+char poptStrerror ();
 int
 main ()
 {
-return sqlite_exec ();
+return poptStrerror ();
   ;
   return 0;
 }
@@ -12213,38 +12230,38 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_sqlite_sqlite_exec=yes
+  ac_cv_lib_popt_poptStrerror=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_lib_sqlite_sqlite_exec=no
+	ac_cv_lib_popt_poptStrerror=no
 fi
 
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_sqlite_sqlite_exec" >&5
-echo "${ECHO_T}$ac_cv_lib_sqlite_sqlite_exec" >&6; }
-if test $ac_cv_lib_sqlite_sqlite_exec = yes; then
-  AST_SQLITE_FOUND=yes
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_popt_poptStrerror" >&5
+echo "${ECHO_T}$ac_cv_lib_popt_poptStrerror" >&6; }
+if test $ac_cv_lib_popt_poptStrerror = yes; then
+  AST_POPT_FOUND=yes
 else
-  AST_SQLITE_FOUND=no
+  AST_POPT_FOUND=no
 fi
 
 
-   if test "${AST_SQLITE_FOUND}" = "yes"; then
-      SQLITE_LIB="-lsqlite "
-      SQLITE_HEADER_FOUND="1"
-      if test "x${SQLITE_DIR}" != "x"; then
-         SQLITE_LIB="${pbxlibdir} ${SQLITE_LIB}"
-	 SQLITE_INCLUDE="-I${SQLITE_DIR}/include"
-	 if test "xsqlite.h" != "x" ; then
-	    as_ac_Header=`echo "ac_cv_header_${SQLITE_DIR}/include/sqlite.h" | $as_tr_sh`
+   if test "${AST_POPT_FOUND}" = "yes"; then
+      POPT_LIB="-lpopt "
+      POPT_HEADER_FOUND="1"
+      if test "x${POPT_DIR}" != "x"; then
+         POPT_LIB="${pbxlibdir} ${POPT_LIB}"
+	 POPT_INCLUDE="-I${POPT_DIR}/include"
+	 if test "xpopt.h" != "x" ; then
+	    as_ac_Header=`echo "ac_cv_header_${POPT_DIR}/include/popt.h" | $as_tr_sh`
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${SQLITE_DIR}/include/sqlite.h" >&5
-echo $ECHO_N "checking for ${SQLITE_DIR}/include/sqlite.h... $ECHO_C" >&6; }
+  { echo "$as_me:$LINENO: checking for ${POPT_DIR}/include/popt.h" >&5
+echo $ECHO_N "checking for ${POPT_DIR}/include/popt.h... $ECHO_C" >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
@@ -12253,8 +12270,8 @@ ac_res=`eval echo '${'$as_ac_Header'}'`
 echo "${ECHO_T}$ac_res" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${SQLITE_DIR}/include/sqlite.h usability" >&5
-echo $ECHO_N "checking ${SQLITE_DIR}/include/sqlite.h usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking ${POPT_DIR}/include/popt.h usability" >&5
+echo $ECHO_N "checking ${POPT_DIR}/include/popt.h usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -12262,7 +12279,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <${SQLITE_DIR}/include/sqlite.h>
+#include <${POPT_DIR}/include/popt.h>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -12311,15 +12328,15 @@ rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking ${SQLITE_DIR}/include/sqlite.h presence" >&5
-echo $ECHO_N "checking ${SQLITE_DIR}/include/sqlite.h presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking ${POPT_DIR}/include/popt.h presence" >&5
+echo $ECHO_N "checking ${POPT_DIR}/include/popt.h presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <${SQLITE_DIR}/include/sqlite.h>
+#include <${POPT_DIR}/include/popt.h>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -12359,30 +12376,30 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${SQLITE_DIR}/include/sqlite.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${SQLITE_DIR}/include/sqlite.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SQLITE_DIR}/include/sqlite.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${SQLITE_DIR}/include/sqlite.h: proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${POPT_DIR}/include/popt.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: ${POPT_DIR}/include/popt.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${POPT_DIR}/include/popt.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: ${POPT_DIR}/include/popt.h: proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${SQLITE_DIR}/include/sqlite.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${SQLITE_DIR}/include/sqlite.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SQLITE_DIR}/include/sqlite.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${SQLITE_DIR}/include/sqlite.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SQLITE_DIR}/include/sqlite.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${SQLITE_DIR}/include/sqlite.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SQLITE_DIR}/include/sqlite.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${SQLITE_DIR}/include/sqlite.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SQLITE_DIR}/include/sqlite.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${SQLITE_DIR}/include/sqlite.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${SQLITE_DIR}/include/sqlite.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${SQLITE_DIR}/include/sqlite.h: in the future, the compiler will take precedence" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${POPT_DIR}/include/popt.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: ${POPT_DIR}/include/popt.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${POPT_DIR}/include/popt.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: ${POPT_DIR}/include/popt.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${POPT_DIR}/include/popt.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: ${POPT_DIR}/include/popt.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${POPT_DIR}/include/popt.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: ${POPT_DIR}/include/popt.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${POPT_DIR}/include/popt.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: ${POPT_DIR}/include/popt.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${POPT_DIR}/include/popt.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: ${POPT_DIR}/include/popt.h: in the future, the compiler will take precedence" >&2;}
 
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for ${SQLITE_DIR}/include/sqlite.h" >&5
-echo $ECHO_N "checking for ${SQLITE_DIR}/include/sqlite.h... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking for ${POPT_DIR}/include/popt.h" >&5
+echo $ECHO_N "checking for ${POPT_DIR}/include/popt.h... $ECHO_C" >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -12394,27 +12411,27 @@ echo "${ECHO_T}$ac_res" >&6; }
 
 fi
 if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  SQLITE_HEADER_FOUND=1
+  POPT_HEADER_FOUND=1
 else
-  SQLITE_HEADER_FOUND=0
+  POPT_HEADER_FOUND=0
 fi
 
 
 	 fi
       else
-	 if test "xsqlite.h" != "x" ; then
-            if test "${ac_cv_header_sqlite_h+set}" = set; then
-  { echo "$as_me:$LINENO: checking for sqlite.h" >&5
-echo $ECHO_N "checking for sqlite.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_sqlite_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+	 if test "xpopt.h" != "x" ; then
+            if test "${ac_cv_header_popt_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for popt.h" >&5
+echo $ECHO_N "checking for popt.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_popt_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_sqlite_h" >&5
-echo "${ECHO_T}$ac_cv_header_sqlite_h" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_popt_h" >&5
+echo "${ECHO_T}$ac_cv_header_popt_h" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking sqlite.h usability" >&5
-echo $ECHO_N "checking sqlite.h usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking popt.h usability" >&5
+echo $ECHO_N "checking popt.h usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -12422,7 +12439,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <sqlite.h>
+#include <popt.h>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -12471,15 +12488,15 @@ rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking sqlite.h presence" >&5
-echo $ECHO_N "checking sqlite.h presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking popt.h presence" >&5
+echo $ECHO_N "checking popt.h presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <sqlite.h>
+#include <popt.h>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -12519,74 +12536,74 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: sqlite.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: sqlite.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: sqlite.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: sqlite.h: proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: popt.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: popt.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: popt.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: popt.h: proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: sqlite.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: sqlite.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: sqlite.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: sqlite.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: sqlite.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: sqlite.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: sqlite.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: sqlite.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: sqlite.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: sqlite.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: sqlite.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: sqlite.h: in the future, the compiler will take precedence" >&2;}
+    { echo "$as_me:$LINENO: WARNING: popt.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: popt.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: popt.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: popt.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: popt.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: popt.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: popt.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: popt.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: popt.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: popt.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: popt.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: popt.h: in the future, the compiler will take precedence" >&2;}
 
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for sqlite.h" >&5
-echo $ECHO_N "checking for sqlite.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_sqlite_h+set}" = set; then
+{ echo "$as_me:$LINENO: checking for popt.h" >&5
+echo $ECHO_N "checking for popt.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_popt_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_cv_header_sqlite_h=$ac_header_preproc
+  ac_cv_header_popt_h=$ac_header_preproc
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_sqlite_h" >&5
-echo "${ECHO_T}$ac_cv_header_sqlite_h" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_popt_h" >&5
+echo "${ECHO_T}$ac_cv_header_popt_h" >&6; }
 
 fi
-if test $ac_cv_header_sqlite_h = yes; then
-  SQLITE_HEADER_FOUND=1
+if test $ac_cv_header_popt_h = yes; then
+  POPT_HEADER_FOUND=1
 else
-  SQLITE_HEADER_FOUND=0
+  POPT_HEADER_FOUND=0
 fi
 
 
 	 fi
       fi
-      if test "x${SQLITE_HEADER_FOUND}" = "x0" ; then
-         if test ! -z "${SQLITE_MANDATORY}" ;
+      if test "x${POPT_HEADER_FOUND}" = "x0" ; then
+         if test ! -z "${POPT_MANDATORY}" ;
          then
             echo " ***"
-            echo " *** It appears that you do not have the sqlite development package installed."
-            echo " *** Please install it to include SQLite support, or re-run configure"
-            echo " *** without explicitly specifying --with-sqlite"
+            echo " *** It appears that you do not have the popt development package installed."
+            echo " *** Please install it to include popt support, or re-run configure"
+            echo " *** without explicitly specifying --with-popt"
             exit 1
          fi
-         SQLITE_LIB=""
-         SQLITE_INCLUDE=""
-         PBX_LIBSQLITE=0
+         POPT_LIB=""
+         POPT_INCLUDE=""
+         PBX_LIBPOPT=0
       else
-         PBX_LIBSQLITE=1
+         PBX_LIBPOPT=1
 
 cat >>confdefs.h <<_ACEOF
-#define HAVE_SQLITE 1
+#define HAVE_POPT 1
 _ACEOF
 
       fi
-   elif test ! -z "${SQLITE_MANDATORY}";
+   elif test ! -z "${POPT_MANDATORY}";
    then
       echo "***"
-      echo "*** The SQLite installation on this system appears to be broken."
+      echo "*** The popt installation on this system appears to be broken."
       echo "*** Either correct the installation, or run configure"
-      echo "*** without explicity specifying --with-sqlite"
+      echo "*** without explicity specifying --with-popt"
       exit 1
    fi
 fi
@@ -12596,39 +12613,39 @@ fi
 
 
 
-# Check whether --with-ssl was given.
-if test "${with_ssl+set}" = set; then
-  withval=$with_ssl;
+# Check whether --with-pri was given.
+if test "${with_pri+set}" = set; then
+  withval=$with_pri;
 case ${withval} in
      n|no)
-     USE_OPENSSL=no
+     USE_LIBPRI=no
      ;;
      y|ye|yes)
-     OPENSSL_MANDATORY="yes"
+     LIBPRI_MANDATORY="yes"
      ;;
      *)
-     OPENSSL_DIR="${withval}"
-     OPENSSL_MANDATORY="yes"
+     LIBPRI_DIR="${withval}"
+     LIBPRI_MANDATORY="yes"
      ;;
 esac
 
 fi
 
 
-PBX_LIBOPENSSL=0
+PBX_LIBLIBPRI=0
 
-if test "${USE_OPENSSL}" != "no"; then
+if test "${USE_LIBPRI}" != "no"; then
    pbxlibdir=""
-   if test "x${OPENSSL_DIR}" != "x"; then
-      pbxlibdir="-L${ssl_DIR}/lib"
+   if test "x${LIBPRI_DIR}" != "x"; then
+      pbxlibdir="-L${pri_DIR}/lib"
    fi
-   { echo "$as_me:$LINENO: checking for ssl2_connect in -lssl" >&5
-echo $ECHO_N "checking for ssl2_connect in -lssl... $ECHO_C" >&6; }
-if test "${ac_cv_lib_ssl_ssl2_connect+set}" = set; then
+   { echo "$as_me:$LINENO: checking for pri_call in -lpri" >&5
+echo $ECHO_N "checking for pri_call in -lpri... $ECHO_C" >&6; }
+if test "${ac_cv_lib_pri_pri_call+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lssl ${pbxlibdir} -lcrypto $LIBS"
+LIBS="-lpri ${pbxlibdir}  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -12642,11 +12659,11 @@ cat >>conftest.$ac_ext <<_ACEOF
 #ifdef __cplusplus
 extern "C"
 #endif
-char ssl2_connect ();
+char pri_call ();
 int
 main ()
 {
-return ssl2_connect ();
+return pri_call ();
   ;
   return 0;
 }
@@ -12685,38 +12702,38 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_ssl_ssl2_connect=yes
+  ac_cv_lib_pri_pri_call=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_lib_ssl_ssl2_connect=no
+	ac_cv_lib_pri_pri_call=no
 fi
 
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_ssl_ssl2_connect" >&5
-echo "${ECHO_T}$ac_cv_lib_ssl_ssl2_connect" >&6; }
-if test $ac_cv_lib_ssl_ssl2_connect = yes; then
-  AST_OPENSSL_FOUND=yes
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_pri_pri_call" >&5
+echo "${ECHO_T}$ac_cv_lib_pri_pri_call" >&6; }
+if test $ac_cv_lib_pri_pri_call = yes; then
+  AST_LIBPRI_FOUND=yes
 else
-  AST_OPENSSL_FOUND=no
+  AST_LIBPRI_FOUND=no
 fi
 
 
-   if test "${AST_OPENSSL_FOUND}" = "yes"; then
-      OPENSSL_LIB="-lssl -lcrypto"
-      OPENSSL_HEADER_FOUND="1"
-      if test "x${OPENSSL_DIR}" != "x"; then
-         OPENSSL_LIB="${pbxlibdir} ${OPENSSL_LIB}"
-	 OPENSSL_INCLUDE="-I${OPENSSL_DIR}/include"
-	 if test "xopenssl/ssl.h" != "x" ; then
-	    as_ac_Header=`echo "ac_cv_header_${OPENSSL_DIR}/include/openssl/ssl.h" | $as_tr_sh`
+   if test "${AST_LIBPRI_FOUND}" = "yes"; then
+      LIBPRI_LIB="-lpri "
+      LIBPRI_HEADER_FOUND="1"
+      if test "x${LIBPRI_DIR}" != "x"; then
+         LIBPRI_LIB="${pbxlibdir} ${LIBPRI_LIB}"
+	 LIBPRI_INCLUDE="-I${LIBPRI_DIR}/include"
+	 if test "xlibpri.h" != "x" ; then
+	    as_ac_Header=`echo "ac_cv_header_${LIBPRI_DIR}/include/libpri.h" | $as_tr_sh`
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${OPENSSL_DIR}/include/openssl/ssl.h" >&5
-echo $ECHO_N "checking for ${OPENSSL_DIR}/include/openssl/ssl.h... $ECHO_C" >&6; }
+  { echo "$as_me:$LINENO: checking for ${LIBPRI_DIR}/include/libpri.h" >&5
+echo $ECHO_N "checking for ${LIBPRI_DIR}/include/libpri.h... $ECHO_C" >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
@@ -12725,8 +12742,8 @@ ac_res=`eval echo '${'$as_ac_Header'}'`
 echo "${ECHO_T}$ac_res" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${OPENSSL_DIR}/include/openssl/ssl.h usability" >&5
-echo $ECHO_N "checking ${OPENSSL_DIR}/include/openssl/ssl.h usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking ${LIBPRI_DIR}/include/libpri.h usability" >&5
+echo $ECHO_N "checking ${LIBPRI_DIR}/include/libpri.h usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -12734,7 +12751,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <${OPENSSL_DIR}/include/openssl/ssl.h>
+#include <${LIBPRI_DIR}/include/libpri.h>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -12783,15 +12800,15 @@ rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking ${OPENSSL_DIR}/include/openssl/ssl.h presence" >&5
-echo $ECHO_N "checking ${OPENSSL_DIR}/include/openssl/ssl.h presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking ${LIBPRI_DIR}/include/libpri.h presence" >&5
+echo $ECHO_N "checking ${LIBPRI_DIR}/include/libpri.h presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <${OPENSSL_DIR}/include/openssl/ssl.h>
+#include <${LIBPRI_DIR}/include/libpri.h>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -12831,30 +12848,30 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${OPENSSL_DIR}/include/openssl/ssl.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${OPENSSL_DIR}/include/openssl/ssl.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${OPENSSL_DIR}/include/openssl/ssl.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${OPENSSL_DIR}/include/openssl/ssl.h: proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${LIBPRI_DIR}/include/libpri.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: ${LIBPRI_DIR}/include/libpri.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${LIBPRI_DIR}/include/libpri.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: ${LIBPRI_DIR}/include/libpri.h: proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${OPENSSL_DIR}/include/openssl/ssl.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${OPENSSL_DIR}/include/openssl/ssl.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${OPENSSL_DIR}/include/openssl/ssl.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${OPENSSL_DIR}/include/openssl/ssl.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${OPENSSL_DIR}/include/openssl/ssl.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${OPENSSL_DIR}/include/openssl/ssl.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${OPENSSL_DIR}/include/openssl/ssl.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${OPENSSL_DIR}/include/openssl/ssl.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${OPENSSL_DIR}/include/openssl/ssl.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${OPENSSL_DIR}/include/openssl/ssl.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${OPENSSL_DIR}/include/openssl/ssl.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${OPENSSL_DIR}/include/openssl/ssl.h: in the future, the compiler will take precedence" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${LIBPRI_DIR}/include/libpri.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: ${LIBPRI_DIR}/include/libpri.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${LIBPRI_DIR}/include/libpri.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: ${LIBPRI_DIR}/include/libpri.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${LIBPRI_DIR}/include/libpri.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: ${LIBPRI_DIR}/include/libpri.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${LIBPRI_DIR}/include/libpri.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: ${LIBPRI_DIR}/include/libpri.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${LIBPRI_DIR}/include/libpri.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: ${LIBPRI_DIR}/include/libpri.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${LIBPRI_DIR}/include/libpri.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: ${LIBPRI_DIR}/include/libpri.h: in the future, the compiler will take precedence" >&2;}
 
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for ${OPENSSL_DIR}/include/openssl/ssl.h" >&5
-echo $ECHO_N "checking for ${OPENSSL_DIR}/include/openssl/ssl.h... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking for ${LIBPRI_DIR}/include/libpri.h" >&5
+echo $ECHO_N "checking for ${LIBPRI_DIR}/include/libpri.h... $ECHO_C" >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -12866,27 +12883,27 @@ echo "${ECHO_T}$ac_res" >&6; }
 
 fi
 if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  OPENSSL_HEADER_FOUND=1
+  LIBPRI_HEADER_FOUND=1
 else
-  OPENSSL_HEADER_FOUND=0
+  LIBPRI_HEADER_FOUND=0
 fi
 
 
 	 fi
       else
-	 if test "xopenssl/ssl.h" != "x" ; then
-            if test "${ac_cv_header_openssl_ssl_h+set}" = set; then
-  { echo "$as_me:$LINENO: checking for openssl/ssl.h" >&5
-echo $ECHO_N "checking for openssl/ssl.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_openssl_ssl_h+set}" = set; then
+	 if test "xlibpri.h" != "x" ; then
+            if test "${ac_cv_header_libpri_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for libpri.h" >&5
+echo $ECHO_N "checking for libpri.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_libpri_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_openssl_ssl_h" >&5
-echo "${ECHO_T}$ac_cv_header_openssl_ssl_h" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_libpri_h" >&5
+echo "${ECHO_T}$ac_cv_header_libpri_h" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking openssl/ssl.h usability" >&5
-echo $ECHO_N "checking openssl/ssl.h usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking libpri.h usability" >&5
+echo $ECHO_N "checking libpri.h usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -12894,7 +12911,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <openssl/ssl.h>
+#include <libpri.h>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -12943,15 +12960,15 @@ rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking openssl/ssl.h presence" >&5
-echo $ECHO_N "checking openssl/ssl.h presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking libpri.h presence" >&5
+echo $ECHO_N "checking libpri.h presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <openssl/ssl.h>
+#include <libpri.h>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -12991,74 +13008,74 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: openssl/ssl.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: openssl/ssl.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: openssl/ssl.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: openssl/ssl.h: proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: libpri.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: libpri.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: libpri.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: libpri.h: proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: openssl/ssl.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: openssl/ssl.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: openssl/ssl.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: openssl/ssl.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: openssl/ssl.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: openssl/ssl.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: openssl/ssl.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: openssl/ssl.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: openssl/ssl.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: openssl/ssl.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: openssl/ssl.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: openssl/ssl.h: in the future, the compiler will take precedence" >&2;}
+    { echo "$as_me:$LINENO: WARNING: libpri.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: libpri.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: libpri.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: libpri.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: libpri.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: libpri.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: libpri.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: libpri.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: libpri.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: libpri.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: libpri.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: libpri.h: in the future, the compiler will take precedence" >&2;}
 
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for openssl/ssl.h" >&5
-echo $ECHO_N "checking for openssl/ssl.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_openssl_ssl_h+set}" = set; then
+{ echo "$as_me:$LINENO: checking for libpri.h" >&5
+echo $ECHO_N "checking for libpri.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_libpri_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_cv_header_openssl_ssl_h=$ac_header_preproc
+  ac_cv_header_libpri_h=$ac_header_preproc
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_openssl_ssl_h" >&5
-echo "${ECHO_T}$ac_cv_header_openssl_ssl_h" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_libpri_h" >&5
+echo "${ECHO_T}$ac_cv_header_libpri_h" >&6; }
 
 fi
-if test $ac_cv_header_openssl_ssl_h = yes; then
-  OPENSSL_HEADER_FOUND=1
+if test $ac_cv_header_libpri_h = yes; then
+  LIBPRI_HEADER_FOUND=1
 else
-  OPENSSL_HEADER_FOUND=0
+  LIBPRI_HEADER_FOUND=0
 fi
 
 
 	 fi
       fi
-      if test "x${OPENSSL_HEADER_FOUND}" = "x0" ; then
-         if test ! -z "${OPENSSL_MANDATORY}" ;
+      if test "x${LIBPRI_HEADER_FOUND}" = "x0" ; then
+         if test ! -z "${LIBPRI_MANDATORY}" ;
          then
             echo " ***"
-            echo " *** It appears that you do not have the ssl development package installed."
-            echo " *** Please install it to include OpenSSL support, or re-run configure"
-            echo " *** without explicitly specifying --with-ssl"
+            echo " *** It appears that you do not have the pri development package installed."
+            echo " *** Please install it to include ISDN PRI support, or re-run configure"
+            echo " *** without explicitly specifying --with-pri"
             exit 1
          fi
-         OPENSSL_LIB=""
-         OPENSSL_INCLUDE=""
-         PBX_LIBOPENSSL=0
+         LIBPRI_LIB=""
+         LIBPRI_INCLUDE=""
+         PBX_LIBLIBPRI=0
       else
-         PBX_LIBOPENSSL=1
+         PBX_LIBLIBPRI=1
 
 cat >>confdefs.h <<_ACEOF
-#define HAVE_OPENSSL 1
+#define HAVE_LIBPRI 1
 _ACEOF
 
       fi
-   elif test ! -z "${OPENSSL_MANDATORY}";
+   elif test ! -z "${LIBPRI_MANDATORY}";
    then
       echo "***"
-      echo "*** The OpenSSL installation on this system appears to be broken."
+      echo "*** The ISDN PRI installation on this system appears to be broken."
       echo "*** Either correct the installation, or run configure"
-      echo "*** without explicity specifying --with-ssl"
+      echo "*** without explicity specifying --with-pri"
       exit 1
    fi
 fi
@@ -13067,61 +13084,47 @@ fi
 
 
 
+PLATFORM_PTLIB="ptlib_${OSTYPE}_${MACHTYPE}_r"
 
-# Check whether --with-tds was given.
-if test "${with_tds+set}" = set; then
-  withval=$with_tds;
+
+# Check whether --with-pwlib was given.
+if test "${with_pwlib+set}" = set; then
+  withval=$with_pwlib;
 case ${withval} in
      n|no)
-     USE_FREETDS=no
+     USE_PWLIB=no
      ;;
      y|ye|yes)
-     FREETDS_MANDATORY="yes"
      ;;
      *)
-     FREETDS_DIR="${withval}"
-     FREETDS_MANDATORY="yes"
+     PWLIB_DIR="${withval}"
      ;;
 esac
 
 fi
 
+if test "${USE_PWLIB}" != "no"; then
+	echo -n "checking for existence of pwlib... "
 
-PBX_LIBFREETDS=0
+	saved_ldflags="${LDFLAGS}"
+	LDFLAGS="${LDFLAGS} -L${PWLIB_DIR} -l${PLATFORM_PTLIB}"
 
-if test "${USE_FREETDS}" != "no"; then
-   pbxlibdir=""
-   if test "x${FREETDS_DIR}" != "x"; then
-      pbxlibdir="-L${tds_DIR}/lib"
-   fi
-   { echo "$as_me:$LINENO: checking for tds_version in -ltds" >&5
-echo $ECHO_N "checking for tds_version in -ltds... $ECHO_C" >&6; }
-if test "${ac_cv_lib_tds_tds_version+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-ltds ${pbxlibdir}  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
+	cat >conftest.$ac_ext <<_ACEOF
+
+	/* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* 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 tds_version ();
+#include "${PWDIR_DIR}ptime.h"
 int
 main ()
 {
-return tds_version ();
+int q = PTime::IsDaylightSaving();
   ;
   return 0;
 }
+
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
 if { (ac_try="$ac_link"
@@ -13157,72 +13160,122 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_tds_tds_version=yes
+  	{ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+		ac_cv_lib_pwlib="yes"
+
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_lib_tds_tds_version=no
+		{ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+		ac_cv_lib_pwlib="no"
+
+
 fi
 
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_tds_tds_version" >&5
-echo "${ECHO_T}$ac_cv_lib_tds_tds_version" >&6; }
-if test $ac_cv_lib_tds_tds_version = yes; then
-  AST_FREETDS_FOUND=yes
-else
-  AST_FREETDS_FOUND=no
+	LDFLAGS="${saved_ldflags}"
+
+	PBX_LIBPWLIB=0
+
+   if test "${ac_cv_lib_pwlib}" = "yes"; then
+      PWLIB_LIB="-l{PLATFORM_PWLIB}"
+      if test "${PWLIB_DIR}" != ""; then
+         PWLIB_LIB="-L${PWLIB_DIR}/lib ${PWLIB_LIB}"
+	 		PWLIB_INCLUDE="-I${PWLIB_DIR}/include"
+
+      fi
+
+   	PBX_LIBPWLIB=1
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_LIBPWLIB 1
+_ACEOF
+
+   elif test ! -z "${PWLIB_DIR}";
+   then
+      echo "***"
+      echo "*** The PWLIB installation on this system appears to be broken."
+      echo "*** Either correct the installation, or run configure"
+      echo "*** including --without-pwlib"
+      exit 1
+   fi
 fi
 
 
-   if test "${AST_FREETDS_FOUND}" = "yes"; then
-      FREETDS_LIB="-ltds "
-      FREETDS_HEADER_FOUND="1"
-      if test "x${FREETDS_DIR}" != "x"; then
-         FREETDS_LIB="${pbxlibdir} ${FREETDS_LIB}"
-	 FREETDS_INCLUDE="-I${FREETDS_DIR}/include"
-	 if test "xtds.h" != "x" ; then
-	    as_ac_Header=`echo "ac_cv_header_${FREETDS_DIR}/include/tds.h" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${FREETDS_DIR}/include/tds.h" >&5
-echo $ECHO_N "checking for ${FREETDS_DIR}/include/tds.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+
+
+# Check whether --with-qt was given.
+if test "${with_qt+set}" = set; then
+  withval=$with_qt;
+case ${withval} in
+     n|no)
+     USE_QT=no
+     ;;
+     y|ye|yes)
+     QT_MANDATORY="yes"
+     ;;
+     *)
+     QT_DIR="${withval}"
+     QT_MANDATORY="yes"
+     ;;
+esac
+
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-	       { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${FREETDS_DIR}/include/tds.h usability" >&5
-echo $ECHO_N "checking ${FREETDS_DIR}/include/tds.h usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
+
+
+PBX_QT=0
+if test "${USE_QT}" != "no"; then
+   echo -n "checking for QDate in -lqt... "
+   saved_libs="${LIBS}"
+   saved_cppflags="${CPPFLAGS}"
+   if test "x${QT_DIR}" != "x"; then
+      LIBS="${LIBS} -L${QT_DIR}/lib"
+      CPPFLAGS="${CPPFLAGS} -I${QT_DIR}/include"
+   fi
+   LIBS="${LIBS} -lqt"
+   qtlib="qt"
+   cat >conftest.$ac_ext <<_ACEOF
+
+		/* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-$ac_includes_default
-#include <${FREETDS_DIR}/include/tds.h>
+#include <qt3/qdatetime.h>
+int
+main ()
+{
+QDate date();
+  ;
+  return 0;
+}
+
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
   { (case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
@@ -13232,7 +13285,7 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
+	 { ac_try='test -s conftest$ac_exeext'
   { (case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
@@ -13242,147 +13295,60 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_header_compiler=yes
+  ac_cv_lib_qt_qt_date="yes"
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_header_compiler=no
+	ac_cv_lib_qt_qt_date="no"
 fi
 
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking ${FREETDS_DIR}/include/tds.h presence" >&5
-echo $ECHO_N "checking ${FREETDS_DIR}/include/tds.h presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${FREETDS_DIR}/include/tds.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${FREETDS_DIR}/include/tds.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${FREETDS_DIR}/include/tds.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${FREETDS_DIR}/include/tds.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${FREETDS_DIR}/include/tds.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${FREETDS_DIR}/include/tds.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${FREETDS_DIR}/include/tds.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${FREETDS_DIR}/include/tds.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${FREETDS_DIR}/include/tds.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${FREETDS_DIR}/include/tds.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${FREETDS_DIR}/include/tds.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${FREETDS_DIR}/include/tds.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${FREETDS_DIR}/include/tds.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${FREETDS_DIR}/include/tds.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${FREETDS_DIR}/include/tds.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${FREETDS_DIR}/include/tds.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${FREETDS_DIR}/include/tds.h: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for ${FREETDS_DIR}/include/tds.h" >&5
-echo $ECHO_N "checking for ${FREETDS_DIR}/include/tds.h... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-	       { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  FREETDS_HEADER_FOUND=1
-else
-  FREETDS_HEADER_FOUND=0
-fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+   LIBS="${saved_libs}"
+   CPPFLAGS="${saved_cppflags}"
 
+   if test "${ac_cv_lib_qt_qt_date}" = "no"; then
+      saved_libs="${LIBS}"
+      saved_cppflags="${CPPFLAGS}"
+      if test "x${QT_DIR}" != "x"; then
+      	 LIBS="${LIBS} -L${QT_DIR}/lib"
+	 CPPFLAGS="${CPPFLAGS} -I${QT_DIR}/include"
+      fi
+      LIBS="${LIBS} -lqt-mt"
+      qtlib="qt-mt"
+      cat >conftest.$ac_ext <<_ACEOF
 
-	 fi
-      else
-	 if test "xtds.h" != "x" ; then
-            if test "${ac_cv_header_tds_h+set}" = set; then
-  { echo "$as_me:$LINENO: checking for tds.h" >&5
-echo $ECHO_N "checking for tds.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_tds_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_tds_h" >&5
-echo "${ECHO_T}$ac_cv_header_tds_h" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking tds.h usability" >&5
-echo $ECHO_N "checking tds.h usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
+			/* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-$ac_includes_default
-#include <tds.h>
+#include <qt3/qdatetime.h>
+int
+main ()
+{
+QDate date();
+  ;
+  return 0;
+}
+
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
   { (case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
@@ -13392,7 +13358,7 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
+	 { ac_try='test -s conftest$ac_exeext'
   { (case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
@@ -13402,177 +13368,197 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_header_compiler=yes
+  ac_cv_lib_qt_qt_date="yes"
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_header_compiler=no
+	ac_cv_lib_qt_qt_date="no"
 fi
 
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+      LIBS="${saved_libs}"
+      CPPFLAGS="${saved_cppflags}"
+   fi
 
-# Is the header present?
-{ echo "$as_me:$LINENO: checking tds.h presence" >&5
-echo $ECHO_N "checking tds.h presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <tds.h>
+   if test "${ac_cv_lib_qt_qt_date}" = "yes"; then
+      { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+   else
+      { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+   fi
+
+   if test "${ac_cv_lib_qt_qt_date}" = "yes"; then
+      QT_LIB="-l${qtlib}"
+      if test "${QT_DIR}" != ""; then
+      	 QT_LIB="-L${QT_DIR}/lib ${QT_LIB}"
+	 QT_INCLUDE="-I${QT_DIR}/include"
+
+      fi
+
+      PBX_QT=1
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_LIBQT 1
 _ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
-  else
-    ac_cpp_err=
-  fi
+
+      if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}moc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}moc; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_path_QTMOC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_cpp_err=yes
+  case $QTMOC in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_QTMOC="$QTMOC" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_QTMOC="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+  ;;
+esac
 fi
-if test -z "$ac_cpp_err"; then
-  ac_header_preproc=yes
+QTMOC=$ac_cv_path_QTMOC
+if test -n "$QTMOC"; then
+  { echo "$as_me:$LINENO: result: $QTMOC" >&5
+echo "${ECHO_T}$QTMOC" >&6; }
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
 fi
 
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
 
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: tds.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: tds.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: tds.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: tds.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: tds.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: tds.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: tds.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: tds.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: tds.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: tds.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: tds.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: tds.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: tds.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: tds.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: tds.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: tds.h: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for tds.h" >&5
-echo $ECHO_N "checking for tds.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_tds_h+set}" = set; then
+fi
+if test -z "$ac_cv_path_QTMOC"; then
+  ac_pt_QTMOC=$QTMOC
+  # Extract the first word of "moc", so it can be a program name with args.
+set dummy moc; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_path_ac_pt_QTMOC+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_cv_header_tds_h=$ac_header_preproc
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_tds_h" >&5
-echo "${ECHO_T}$ac_cv_header_tds_h" >&6; }
+  case $ac_pt_QTMOC in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_ac_pt_QTMOC="$ac_pt_QTMOC" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_ac_pt_QTMOC="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
 
+  ;;
+esac
 fi
-if test $ac_cv_header_tds_h = yes; then
-  FREETDS_HEADER_FOUND=1
+ac_pt_QTMOC=$ac_cv_path_ac_pt_QTMOC
+if test -n "$ac_pt_QTMOC"; then
+  { echo "$as_me:$LINENO: result: $ac_pt_QTMOC" >&5
+echo "${ECHO_T}$ac_pt_QTMOC" >&6; }
 else
-  FREETDS_HEADER_FOUND=0
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
 fi
 
+  if test "x$ac_pt_QTMOC" = x; then
+    QTMOC="No"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    QTMOC=$ac_pt_QTMOC
+  fi
+else
+  QTMOC="$ac_cv_path_QTMOC"
+fi
 
-	 fi
-      fi
-      if test "x${FREETDS_HEADER_FOUND}" = "x0" ; then
-         if test ! -z "${FREETDS_MANDATORY}" ;
-         then
-            echo " ***"
-            echo " *** It appears that you do not have the tds development package installed."
-            echo " *** Please install it to include FreeTDS support, or re-run configure"
-            echo " *** without explicitly specifying --with-tds"
-            exit 1
-         fi
-         FREETDS_LIB=""
-         FREETDS_INCLUDE=""
-         PBX_LIBFREETDS=0
-      else
-         PBX_LIBFREETDS=1
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_FREETDS 1
-_ACEOF
-
-      fi
-   elif test ! -z "${FREETDS_MANDATORY}";
+   elif test ! -z "${QT_MANDATORY}";
    then
       echo "***"
-      echo "*** The FreeTDS installation on this system appears to be broken."
+      echo "*** The Qt installation on this system appears to be broken."
       echo "*** Either correct the installation, or run configure"
-      echo "*** without explicity specifying --with-tds"
+      echo "*** including --without-qt."
       exit 1
    fi
 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
 
 
 
 
-# Check whether --with-termcap was given.
-if test "${with_termcap+set}" = set; then
-  withval=$with_termcap;
+# Check whether --with-radiusclient-ng was given.
+if test "${with_radiusclient_ng+set}" = set; then
+  withval=$with_radiusclient_ng;
 case ${withval} in
      n|no)
-     USE_TERMCAP=no
+     USE_RADIUSCLIENT=no
      ;;
      y|ye|yes)
-     TERMCAP_MANDATORY="yes"
+     RADIUSCLIENT_MANDATORY="yes"
      ;;
      *)
-     TERMCAP_DIR="${withval}"
-     TERMCAP_MANDATORY="yes"
+     RADIUSCLIENT_DIR="${withval}"
+     RADIUSCLIENT_MANDATORY="yes"
      ;;
 esac
 
 fi
 
 
-PBX_LIBTERMCAP=0
+PBX_LIBRADIUSCLIENT=0
 
-if test "${USE_TERMCAP}" != "no"; then
+if test "${USE_RADIUSCLIENT}" != "no"; then
    pbxlibdir=""
-   if test "x${TERMCAP_DIR}" != "x"; then
-      pbxlibdir="-L${termcap_DIR}/lib"
+   if test "x${RADIUSCLIENT_DIR}" != "x"; then
+      pbxlibdir="-L${radiusclient-ng_DIR}/lib"
    fi
-   { echo "$as_me:$LINENO: checking for tgetent in -ltermcap" >&5
-echo $ECHO_N "checking for tgetent in -ltermcap... $ECHO_C" >&6; }
-if test "${ac_cv_lib_termcap_tgetent+set}" = set; then
+   { echo "$as_me:$LINENO: checking for rc_read_config in -lradiusclient-ng" >&5
+echo $ECHO_N "checking for rc_read_config in -lradiusclient-ng... $ECHO_C" >&6; }
+if test "${ac_cv_lib_radiusclient_ng_rc_read_config+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-ltermcap ${pbxlibdir}  $LIBS"
+LIBS="-lradiusclient-ng ${pbxlibdir}  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -13586,11 +13572,11 @@ cat >>conftest.$ac_ext <<_ACEOF
 #ifdef __cplusplus
 extern "C"
 #endif
-char tgetent ();
+char rc_read_config ();
 int
 main ()
 {
-return tgetent ();
+return rc_read_config ();
   ;
   return 0;
 }
@@ -13629,38 +13615,38 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_termcap_tgetent=yes
+  ac_cv_lib_radiusclient_ng_rc_read_config=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_lib_termcap_tgetent=no
+	ac_cv_lib_radiusclient_ng_rc_read_config=no
 fi
 
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_termcap_tgetent" >&5
-echo "${ECHO_T}$ac_cv_lib_termcap_tgetent" >&6; }
-if test $ac_cv_lib_termcap_tgetent = yes; then
-  AST_TERMCAP_FOUND=yes
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_radiusclient_ng_rc_read_config" >&5
+echo "${ECHO_T}$ac_cv_lib_radiusclient_ng_rc_read_config" >&6; }
+if test $ac_cv_lib_radiusclient_ng_rc_read_config = yes; then
+  AST_RADIUSCLIENT_FOUND=yes
 else
-  AST_TERMCAP_FOUND=no
+  AST_RADIUSCLIENT_FOUND=no
 fi
 
 
-   if test "${AST_TERMCAP_FOUND}" = "yes"; then
-      TERMCAP_LIB="-ltermcap "
-      TERMCAP_HEADER_FOUND="1"
-      if test "x${TERMCAP_DIR}" != "x"; then
-         TERMCAP_LIB="${pbxlibdir} ${TERMCAP_LIB}"
-	 TERMCAP_INCLUDE="-I${TERMCAP_DIR}/include"
-	 if test "x" != "x" ; then
-	    as_ac_Header=`echo "ac_cv_header_${TERMCAP_DIR}/include/" | $as_tr_sh`
+   if test "${AST_RADIUSCLIENT_FOUND}" = "yes"; then
+      RADIUSCLIENT_LIB="-lradiusclient-ng "
+      RADIUSCLIENT_HEADER_FOUND="1"
+      if test "x${RADIUSCLIENT_DIR}" != "x"; then
+         RADIUSCLIENT_LIB="${pbxlibdir} ${RADIUSCLIENT_LIB}"
+	 RADIUSCLIENT_INCLUDE="-I${RADIUSCLIENT_DIR}/include"
+	 if test "xradiusclient-ng.h" != "x" ; then
+	    as_ac_Header=`echo "ac_cv_header_${RADIUSCLIENT_DIR}/include/radiusclient-ng.h" | $as_tr_sh`
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${TERMCAP_DIR}/include/" >&5
-echo $ECHO_N "checking for ${TERMCAP_DIR}/include/... $ECHO_C" >&6; }
+  { echo "$as_me:$LINENO: checking for ${RADIUSCLIENT_DIR}/include/radiusclient-ng.h" >&5
+echo $ECHO_N "checking for ${RADIUSCLIENT_DIR}/include/radiusclient-ng.h... $ECHO_C" >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
@@ -13669,8 +13655,8 @@ ac_res=`eval echo '${'$as_ac_Header'}'`
 echo "${ECHO_T}$ac_res" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${TERMCAP_DIR}/include/ usability" >&5
-echo $ECHO_N "checking ${TERMCAP_DIR}/include/ usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking ${RADIUSCLIENT_DIR}/include/radiusclient-ng.h usability" >&5
+echo $ECHO_N "checking ${RADIUSCLIENT_DIR}/include/radiusclient-ng.h usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -13678,7 +13664,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <${TERMCAP_DIR}/include/>
+#include <${RADIUSCLIENT_DIR}/include/radiusclient-ng.h>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -13727,15 +13713,15 @@ rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking ${TERMCAP_DIR}/include/ presence" >&5
-echo $ECHO_N "checking ${TERMCAP_DIR}/include/ presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking ${RADIUSCLIENT_DIR}/include/radiusclient-ng.h presence" >&5
+echo $ECHO_N "checking ${RADIUSCLIENT_DIR}/include/radiusclient-ng.h presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <${TERMCAP_DIR}/include/>
+#include <${RADIUSCLIENT_DIR}/include/radiusclient-ng.h>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -13775,30 +13761,30 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${TERMCAP_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${TERMCAP_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TERMCAP_DIR}/include/: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${TERMCAP_DIR}/include/: proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${RADIUSCLIENT_DIR}/include/radiusclient-ng.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: ${RADIUSCLIENT_DIR}/include/radiusclient-ng.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${RADIUSCLIENT_DIR}/include/radiusclient-ng.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: ${RADIUSCLIENT_DIR}/include/radiusclient-ng.h: proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${TERMCAP_DIR}/include/: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${TERMCAP_DIR}/include/: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TERMCAP_DIR}/include/:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${TERMCAP_DIR}/include/:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TERMCAP_DIR}/include/: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${TERMCAP_DIR}/include/: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TERMCAP_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${TERMCAP_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TERMCAP_DIR}/include/: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${TERMCAP_DIR}/include/: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TERMCAP_DIR}/include/: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${TERMCAP_DIR}/include/: in the future, the compiler will take precedence" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${RADIUSCLIENT_DIR}/include/radiusclient-ng.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: ${RADIUSCLIENT_DIR}/include/radiusclient-ng.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${RADIUSCLIENT_DIR}/include/radiusclient-ng.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: ${RADIUSCLIENT_DIR}/include/radiusclient-ng.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${RADIUSCLIENT_DIR}/include/radiusclient-ng.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: ${RADIUSCLIENT_DIR}/include/radiusclient-ng.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${RADIUSCLIENT_DIR}/include/radiusclient-ng.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: ${RADIUSCLIENT_DIR}/include/radiusclient-ng.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${RADIUSCLIENT_DIR}/include/radiusclient-ng.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: ${RADIUSCLIENT_DIR}/include/radiusclient-ng.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${RADIUSCLIENT_DIR}/include/radiusclient-ng.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: ${RADIUSCLIENT_DIR}/include/radiusclient-ng.h: in the future, the compiler will take precedence" >&2;}
 
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for ${TERMCAP_DIR}/include/" >&5
-echo $ECHO_N "checking for ${TERMCAP_DIR}/include/... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking for ${RADIUSCLIENT_DIR}/include/radiusclient-ng.h" >&5
+echo $ECHO_N "checking for ${RADIUSCLIENT_DIR}/include/radiusclient-ng.h... $ECHO_C" >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -13810,27 +13796,27 @@ echo "${ECHO_T}$ac_res" >&6; }
 
 fi
 if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  TERMCAP_HEADER_FOUND=1
+  RADIUSCLIENT_HEADER_FOUND=1
 else
-  TERMCAP_HEADER_FOUND=0
+  RADIUSCLIENT_HEADER_FOUND=0
 fi
 
 
 	 fi
       else
-	 if test "x" != "x" ; then
-            if test "${ac_cv_header_+set}" = set; then
-  { echo "$as_me:$LINENO: checking for " >&5
-echo $ECHO_N "checking for ... $ECHO_C" >&6; }
-if test "${ac_cv_header_+set}" = set; then
+	 if test "xradiusclient-ng.h" != "x" ; then
+            if test "${ac_cv_header_radiusclient_ng_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for radiusclient-ng.h" >&5
+echo $ECHO_N "checking for radiusclient-ng.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_radiusclient_ng_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
-echo "${ECHO_T}$ac_cv_header_" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_radiusclient_ng_h" >&5
+echo "${ECHO_T}$ac_cv_header_radiusclient_ng_h" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking  usability" >&5
-echo $ECHO_N "checking  usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking radiusclient-ng.h usability" >&5
+echo $ECHO_N "checking radiusclient-ng.h usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -13838,7 +13824,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <>
+#include <radiusclient-ng.h>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -13887,15 +13873,15 @@ rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking  presence" >&5
-echo $ECHO_N "checking  presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking radiusclient-ng.h presence" >&5
+echo $ECHO_N "checking radiusclient-ng.h presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <>
+#include <radiusclient-ng.h>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -13935,74 +13921,74 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: : proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: : proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
+    { echo "$as_me:$LINENO: WARNING: radiusclient-ng.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: radiusclient-ng.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: radiusclient-ng.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: radiusclient-ng.h: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
     ;;
   no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: : present but cannot be compiled" >&5
-echo "$as_me: WARNING: : present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: :     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: :     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: : see the Autoconf documentation" >&5
-echo "$as_me: WARNING: : see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: :     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: :     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: : proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: : proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: : in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: : in the future, the compiler will take precedence" >&2;}
+    { echo "$as_me:$LINENO: WARNING: radiusclient-ng.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: radiusclient-ng.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: radiusclient-ng.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: radiusclient-ng.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: radiusclient-ng.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: radiusclient-ng.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: radiusclient-ng.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: radiusclient-ng.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: radiusclient-ng.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: radiusclient-ng.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: radiusclient-ng.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: radiusclient-ng.h: in the future, the compiler will take precedence" >&2;}
 
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for " >&5
-echo $ECHO_N "checking for ... $ECHO_C" >&6; }
-if test "${ac_cv_header_+set}" = set; then
+{ echo "$as_me:$LINENO: checking for radiusclient-ng.h" >&5
+echo $ECHO_N "checking for radiusclient-ng.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_radiusclient_ng_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_cv_header_=$ac_header_preproc
+  ac_cv_header_radiusclient_ng_h=$ac_header_preproc
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
-echo "${ECHO_T}$ac_cv_header_" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_radiusclient_ng_h" >&5
+echo "${ECHO_T}$ac_cv_header_radiusclient_ng_h" >&6; }
 
 fi
-if test $ac_cv_header_ = yes; then
-  TERMCAP_HEADER_FOUND=1
+if test $ac_cv_header_radiusclient_ng_h = yes; then
+  RADIUSCLIENT_HEADER_FOUND=1
 else
-  TERMCAP_HEADER_FOUND=0
+  RADIUSCLIENT_HEADER_FOUND=0
 fi
 
 
 	 fi
       fi
-      if test "x${TERMCAP_HEADER_FOUND}" = "x0" ; then
-         if test ! -z "${TERMCAP_MANDATORY}" ;
+      if test "x${RADIUSCLIENT_HEADER_FOUND}" = "x0" ; then
+         if test ! -z "${RADIUSCLIENT_MANDATORY}" ;
          then
             echo " ***"
-            echo " *** It appears that you do not have the termcap development package installed."
-            echo " *** Please install it to include Termcap support, or re-run configure"
-            echo " *** without explicitly specifying --with-termcap"
+            echo " *** It appears that you do not have the radiusclient-ng development package installed."
+            echo " *** Please install it to include Radius Client support, or re-run configure"
+            echo " *** without explicitly specifying --with-radiusclient-ng"
             exit 1
          fi
-         TERMCAP_LIB=""
-         TERMCAP_INCLUDE=""
-         PBX_LIBTERMCAP=0
+         RADIUSCLIENT_LIB=""
+         RADIUSCLIENT_INCLUDE=""
+         PBX_LIBRADIUSCLIENT=0
       else
-         PBX_LIBTERMCAP=1
+         PBX_LIBRADIUSCLIENT=1
 
 cat >>confdefs.h <<_ACEOF
-#define HAVE_TERMCAP 1
+#define HAVE_RADIUSCLIENT 1
 _ACEOF
 
       fi
-   elif test ! -z "${TERMCAP_MANDATORY}";
+   elif test ! -z "${RADIUSCLIENT_MANDATORY}";
    then
       echo "***"
-      echo "*** The Termcap installation on this system appears to be broken."
+      echo "*** The Radius Client installation on this system appears to be broken."
       echo "*** Either correct the installation, or run configure"
-      echo "*** without explicity specifying --with-termcap"
+      echo "*** without explicity specifying --with-radiusclient-ng"
       exit 1
    fi
 fi
@@ -14012,39 +13998,39 @@ fi
 
 
 
-# Check whether --with-tinfo was given.
-if test "${with_tinfo+set}" = set; then
-  withval=$with_tinfo;
+# Check whether --with-speex was given.
+if test "${with_speex+set}" = set; then
+  withval=$with_speex;
 case ${withval} in
      n|no)
-     USE_TINFO=no
+     USE_SPEEX=no
      ;;
      y|ye|yes)
-     TINFO_MANDATORY="yes"
+     SPEEX_MANDATORY="yes"
      ;;
      *)
-     TINFO_DIR="${withval}"
-     TINFO_MANDATORY="yes"
+     SPEEX_DIR="${withval}"
+     SPEEX_MANDATORY="yes"
      ;;
 esac
 
 fi
 
 
-PBX_LIBTINFO=0
+PBX_LIBSPEEX=0
 
-if test "${USE_TINFO}" != "no"; then
+if test "${USE_SPEEX}" != "no"; then
    pbxlibdir=""
-   if test "x${TINFO_DIR}" != "x"; then
-      pbxlibdir="-L${tinfo_DIR}/lib"
+   if test "x${SPEEX_DIR}" != "x"; then
+      pbxlibdir="-L${speex_DIR}/lib"
    fi
-   { echo "$as_me:$LINENO: checking for tgetent in -ltinfo" >&5
-echo $ECHO_N "checking for tgetent in -ltinfo... $ECHO_C" >&6; }
-if test "${ac_cv_lib_tinfo_tgetent+set}" = set; then
+   { echo "$as_me:$LINENO: checking for speex_encode in -lspeex" >&5
+echo $ECHO_N "checking for speex_encode in -lspeex... $ECHO_C" >&6; }
+if test "${ac_cv_lib_speex_speex_encode+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-ltinfo ${pbxlibdir}  $LIBS"
+LIBS="-lspeex ${pbxlibdir} -lm $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -14058,11 +14044,11 @@ cat >>conftest.$ac_ext <<_ACEOF
 #ifdef __cplusplus
 extern "C"
 #endif
-char tgetent ();
+char speex_encode ();
 int
 main ()
 {
-return tgetent ();
+return speex_encode ();
   ;
   return 0;
 }
@@ -14101,38 +14087,38 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_tinfo_tgetent=yes
+  ac_cv_lib_speex_speex_encode=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_lib_tinfo_tgetent=no
+	ac_cv_lib_speex_speex_encode=no
 fi
 
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_tinfo_tgetent" >&5
-echo "${ECHO_T}$ac_cv_lib_tinfo_tgetent" >&6; }
-if test $ac_cv_lib_tinfo_tgetent = yes; then
-  AST_TINFO_FOUND=yes
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_speex_speex_encode" >&5
+echo "${ECHO_T}$ac_cv_lib_speex_speex_encode" >&6; }
+if test $ac_cv_lib_speex_speex_encode = yes; then
+  AST_SPEEX_FOUND=yes
 else
-  AST_TINFO_FOUND=no
+  AST_SPEEX_FOUND=no
 fi
 
 
-   if test "${AST_TINFO_FOUND}" = "yes"; then
-      TINFO_LIB="-ltinfo "
-      TINFO_HEADER_FOUND="1"
-      if test "x${TINFO_DIR}" != "x"; then
-         TINFO_LIB="${pbxlibdir} ${TINFO_LIB}"
-	 TINFO_INCLUDE="-I${TINFO_DIR}/include"
-	 if test "x" != "x" ; then
-	    as_ac_Header=`echo "ac_cv_header_${TINFO_DIR}/include/" | $as_tr_sh`
+   if test "${AST_SPEEX_FOUND}" = "yes"; then
+      SPEEX_LIB="-lspeex -lm"
+      SPEEX_HEADER_FOUND="1"
+      if test "x${SPEEX_DIR}" != "x"; then
+         SPEEX_LIB="${pbxlibdir} ${SPEEX_LIB}"
+	 SPEEX_INCLUDE="-I${SPEEX_DIR}/include"
+	 if test "xspeex/speex.h" != "x" ; then
+	    as_ac_Header=`echo "ac_cv_header_${SPEEX_DIR}/include/speex/speex.h" | $as_tr_sh`
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${TINFO_DIR}/include/" >&5
-echo $ECHO_N "checking for ${TINFO_DIR}/include/... $ECHO_C" >&6; }
+  { echo "$as_me:$LINENO: checking for ${SPEEX_DIR}/include/speex/speex.h" >&5
+echo $ECHO_N "checking for ${SPEEX_DIR}/include/speex/speex.h... $ECHO_C" >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
@@ -14141,8 +14127,8 @@ ac_res=`eval echo '${'$as_ac_Header'}'`
 echo "${ECHO_T}$ac_res" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${TINFO_DIR}/include/ usability" >&5
-echo $ECHO_N "checking ${TINFO_DIR}/include/ usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking ${SPEEX_DIR}/include/speex/speex.h usability" >&5
+echo $ECHO_N "checking ${SPEEX_DIR}/include/speex/speex.h usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -14150,7 +14136,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <${TINFO_DIR}/include/>
+#include <${SPEEX_DIR}/include/speex/speex.h>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -14199,15 +14185,15 @@ rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking ${TINFO_DIR}/include/ presence" >&5
-echo $ECHO_N "checking ${TINFO_DIR}/include/ presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking ${SPEEX_DIR}/include/speex/speex.h presence" >&5
+echo $ECHO_N "checking ${SPEEX_DIR}/include/speex/speex.h presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <${TINFO_DIR}/include/>
+#include <${SPEEX_DIR}/include/speex/speex.h>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -14247,30 +14233,30 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${TINFO_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${TINFO_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TINFO_DIR}/include/: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${TINFO_DIR}/include/: proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${SPEEX_DIR}/include/speex/speex.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: ${SPEEX_DIR}/include/speex/speex.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${SPEEX_DIR}/include/speex/speex.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: ${SPEEX_DIR}/include/speex/speex.h: proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${TINFO_DIR}/include/: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${TINFO_DIR}/include/: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TINFO_DIR}/include/:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${TINFO_DIR}/include/:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TINFO_DIR}/include/: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${TINFO_DIR}/include/: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TINFO_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${TINFO_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TINFO_DIR}/include/: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${TINFO_DIR}/include/: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TINFO_DIR}/include/: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${TINFO_DIR}/include/: in the future, the compiler will take precedence" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${SPEEX_DIR}/include/speex/speex.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: ${SPEEX_DIR}/include/speex/speex.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${SPEEX_DIR}/include/speex/speex.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: ${SPEEX_DIR}/include/speex/speex.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${SPEEX_DIR}/include/speex/speex.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: ${SPEEX_DIR}/include/speex/speex.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${SPEEX_DIR}/include/speex/speex.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: ${SPEEX_DIR}/include/speex/speex.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${SPEEX_DIR}/include/speex/speex.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: ${SPEEX_DIR}/include/speex/speex.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${SPEEX_DIR}/include/speex/speex.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: ${SPEEX_DIR}/include/speex/speex.h: in the future, the compiler will take precedence" >&2;}
 
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for ${TINFO_DIR}/include/" >&5
-echo $ECHO_N "checking for ${TINFO_DIR}/include/... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking for ${SPEEX_DIR}/include/speex/speex.h" >&5
+echo $ECHO_N "checking for ${SPEEX_DIR}/include/speex/speex.h... $ECHO_C" >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -14282,27 +14268,27 @@ echo "${ECHO_T}$ac_res" >&6; }
 
 fi
 if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  TINFO_HEADER_FOUND=1
+  SPEEX_HEADER_FOUND=1
 else
-  TINFO_HEADER_FOUND=0
+  SPEEX_HEADER_FOUND=0
 fi
 
 
 	 fi
       else
-	 if test "x" != "x" ; then
-            if test "${ac_cv_header_+set}" = set; then
-  { echo "$as_me:$LINENO: checking for " >&5
-echo $ECHO_N "checking for ... $ECHO_C" >&6; }
-if test "${ac_cv_header_+set}" = set; then
+	 if test "xspeex/speex.h" != "x" ; then
+            if test "${ac_cv_header_speex_speex_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for speex/speex.h" >&5
+echo $ECHO_N "checking for speex/speex.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_speex_speex_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
-echo "${ECHO_T}$ac_cv_header_" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_speex_speex_h" >&5
+echo "${ECHO_T}$ac_cv_header_speex_speex_h" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking  usability" >&5
-echo $ECHO_N "checking  usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking speex/speex.h usability" >&5
+echo $ECHO_N "checking speex/speex.h usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -14310,7 +14296,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <>
+#include <speex/speex.h>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -14359,15 +14345,15 @@ rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking  presence" >&5
-echo $ECHO_N "checking  presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking speex/speex.h presence" >&5
+echo $ECHO_N "checking speex/speex.h presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <>
+#include <speex/speex.h>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -14407,74 +14393,74 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: : proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: : proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: speex/speex.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: speex/speex.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: speex/speex.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: speex/speex.h: proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: : present but cannot be compiled" >&5
-echo "$as_me: WARNING: : present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: :     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: :     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: : see the Autoconf documentation" >&5
-echo "$as_me: WARNING: : see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: :     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: :     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: : proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: : proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: : in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: : in the future, the compiler will take precedence" >&2;}
+    { echo "$as_me:$LINENO: WARNING: speex/speex.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: speex/speex.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: speex/speex.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: speex/speex.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: speex/speex.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: speex/speex.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: speex/speex.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: speex/speex.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: speex/speex.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: speex/speex.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: speex/speex.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: speex/speex.h: in the future, the compiler will take precedence" >&2;}
 
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for " >&5
-echo $ECHO_N "checking for ... $ECHO_C" >&6; }
-if test "${ac_cv_header_+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_cv_header_=$ac_header_preproc
+{ echo "$as_me:$LINENO: checking for speex/speex.h" >&5
+echo $ECHO_N "checking for speex/speex.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_speex_speex_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_speex_speex_h=$ac_header_preproc
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
-echo "${ECHO_T}$ac_cv_header_" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_speex_speex_h" >&5
+echo "${ECHO_T}$ac_cv_header_speex_speex_h" >&6; }
 
 fi
-if test $ac_cv_header_ = yes; then
-  TINFO_HEADER_FOUND=1
+if test $ac_cv_header_speex_speex_h = yes; then
+  SPEEX_HEADER_FOUND=1
 else
-  TINFO_HEADER_FOUND=0
+  SPEEX_HEADER_FOUND=0
 fi
 
 
 	 fi
       fi
-      if test "x${TINFO_HEADER_FOUND}" = "x0" ; then
-         if test ! -z "${TINFO_MANDATORY}" ;
+      if test "x${SPEEX_HEADER_FOUND}" = "x0" ; then
+         if test ! -z "${SPEEX_MANDATORY}" ;
          then
             echo " ***"
-            echo " *** It appears that you do not have the tinfo development package installed."
-            echo " *** Please install it to include Term Info support, or re-run configure"
-            echo " *** without explicitly specifying --with-tinfo"
+            echo " *** It appears that you do not have the speex development package installed."
+            echo " *** Please install it to include Speex support, or re-run configure"
+            echo " *** without explicitly specifying --with-speex"
             exit 1
          fi
-         TINFO_LIB=""
-         TINFO_INCLUDE=""
-         PBX_LIBTINFO=0
+         SPEEX_LIB=""
+         SPEEX_INCLUDE=""
+         PBX_LIBSPEEX=0
       else
-         PBX_LIBTINFO=1
+         PBX_LIBSPEEX=1
 
 cat >>confdefs.h <<_ACEOF
-#define HAVE_TINFO 1
+#define HAVE_SPEEX 1
 _ACEOF
 
       fi
-   elif test ! -z "${TINFO_MANDATORY}";
+   elif test ! -z "${SPEEX_MANDATORY}";
    then
       echo "***"
-      echo "*** The Term Info installation on this system appears to be broken."
+      echo "*** The Speex installation on this system appears to be broken."
       echo "*** Either correct the installation, or run configure"
-      echo "*** without explicity specifying --with-tinfo"
+      echo "*** without explicity specifying --with-speex"
       exit 1
    fi
 fi
@@ -14484,39 +14470,39 @@ fi
 
 
 
-# Check whether --with-vorbis was given.
-if test "${with_vorbis+set}" = set; then
-  withval=$with_vorbis;
+# Check whether --with-sqlite was given.
+if test "${with_sqlite+set}" = set; then
+  withval=$with_sqlite;
 case ${withval} in
      n|no)
-     USE_VORBIS=no
+     USE_SQLITE=no
      ;;
      y|ye|yes)
-     VORBIS_MANDATORY="yes"
+     SQLITE_MANDATORY="yes"
      ;;
      *)
-     VORBIS_DIR="${withval}"
-     VORBIS_MANDATORY="yes"
+     SQLITE_DIR="${withval}"
+     SQLITE_MANDATORY="yes"
      ;;
 esac
 
 fi
 
 
-PBX_LIBVORBIS=0
+PBX_LIBSQLITE=0
 
-if test "${USE_VORBIS}" != "no"; then
+if test "${USE_SQLITE}" != "no"; then
    pbxlibdir=""
-   if test "x${VORBIS_DIR}" != "x"; then
-      pbxlibdir="-L${vorbis_DIR}/lib"
+   if test "x${SQLITE_DIR}" != "x"; then
+      pbxlibdir="-L${sqlite_DIR}/lib"
    fi
-   { echo "$as_me:$LINENO: checking for vorbis_info_init in -lvorbis" >&5
-echo $ECHO_N "checking for vorbis_info_init in -lvorbis... $ECHO_C" >&6; }
-if test "${ac_cv_lib_vorbis_vorbis_info_init+set}" = set; then
+   { echo "$as_me:$LINENO: checking for sqlite_exec in -lsqlite" >&5
+echo $ECHO_N "checking for sqlite_exec in -lsqlite... $ECHO_C" >&6; }
+if test "${ac_cv_lib_sqlite_sqlite_exec+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lvorbis ${pbxlibdir} -lm -lvorbisenc $LIBS"
+LIBS="-lsqlite ${pbxlibdir}  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -14530,11 +14516,11 @@ cat >>conftest.$ac_ext <<_ACEOF
 #ifdef __cplusplus
 extern "C"
 #endif
-char vorbis_info_init ();
+char sqlite_exec ();
 int
 main ()
 {
-return vorbis_info_init ();
+return sqlite_exec ();
   ;
   return 0;
 }
@@ -14573,38 +14559,38 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_vorbis_vorbis_info_init=yes
+  ac_cv_lib_sqlite_sqlite_exec=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_lib_vorbis_vorbis_info_init=no
+	ac_cv_lib_sqlite_sqlite_exec=no
 fi
 
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_vorbis_vorbis_info_init" >&5
-echo "${ECHO_T}$ac_cv_lib_vorbis_vorbis_info_init" >&6; }
-if test $ac_cv_lib_vorbis_vorbis_info_init = yes; then
-  AST_VORBIS_FOUND=yes
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_sqlite_sqlite_exec" >&5
+echo "${ECHO_T}$ac_cv_lib_sqlite_sqlite_exec" >&6; }
+if test $ac_cv_lib_sqlite_sqlite_exec = yes; then
+  AST_SQLITE_FOUND=yes
 else
-  AST_VORBIS_FOUND=no
+  AST_SQLITE_FOUND=no
 fi
 
 
-   if test "${AST_VORBIS_FOUND}" = "yes"; then
-      VORBIS_LIB="-lvorbis -lm -lvorbisenc"
-      VORBIS_HEADER_FOUND="1"
-      if test "x${VORBIS_DIR}" != "x"; then
-         VORBIS_LIB="${pbxlibdir} ${VORBIS_LIB}"
-	 VORBIS_INCLUDE="-I${VORBIS_DIR}/include"
-	 if test "xvorbis/codec.h" != "x" ; then
-	    as_ac_Header=`echo "ac_cv_header_${VORBIS_DIR}/include/vorbis/codec.h" | $as_tr_sh`
+   if test "${AST_SQLITE_FOUND}" = "yes"; then
+      SQLITE_LIB="-lsqlite "
+      SQLITE_HEADER_FOUND="1"
+      if test "x${SQLITE_DIR}" != "x"; then
+         SQLITE_LIB="${pbxlibdir} ${SQLITE_LIB}"
+	 SQLITE_INCLUDE="-I${SQLITE_DIR}/include"
+	 if test "xsqlite.h" != "x" ; then
+	    as_ac_Header=`echo "ac_cv_header_${SQLITE_DIR}/include/sqlite.h" | $as_tr_sh`
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${VORBIS_DIR}/include/vorbis/codec.h" >&5
-echo $ECHO_N "checking for ${VORBIS_DIR}/include/vorbis/codec.h... $ECHO_C" >&6; }
+  { echo "$as_me:$LINENO: checking for ${SQLITE_DIR}/include/sqlite.h" >&5
+echo $ECHO_N "checking for ${SQLITE_DIR}/include/sqlite.h... $ECHO_C" >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
@@ -14613,8 +14599,8 @@ ac_res=`eval echo '${'$as_ac_Header'}'`
 echo "${ECHO_T}$ac_res" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${VORBIS_DIR}/include/vorbis/codec.h usability" >&5
-echo $ECHO_N "checking ${VORBIS_DIR}/include/vorbis/codec.h usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking ${SQLITE_DIR}/include/sqlite.h usability" >&5
+echo $ECHO_N "checking ${SQLITE_DIR}/include/sqlite.h usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -14622,7 +14608,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <${VORBIS_DIR}/include/vorbis/codec.h>
+#include <${SQLITE_DIR}/include/sqlite.h>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -14671,15 +14657,15 @@ rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking ${VORBIS_DIR}/include/vorbis/codec.h presence" >&5
-echo $ECHO_N "checking ${VORBIS_DIR}/include/vorbis/codec.h presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking ${SQLITE_DIR}/include/sqlite.h presence" >&5
+echo $ECHO_N "checking ${SQLITE_DIR}/include/sqlite.h presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <${VORBIS_DIR}/include/vorbis/codec.h>
+#include <${SQLITE_DIR}/include/sqlite.h>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -14719,30 +14705,30 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${VORBIS_DIR}/include/vorbis/codec.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${VORBIS_DIR}/include/vorbis/codec.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${VORBIS_DIR}/include/vorbis/codec.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${VORBIS_DIR}/include/vorbis/codec.h: proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${SQLITE_DIR}/include/sqlite.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: ${SQLITE_DIR}/include/sqlite.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${SQLITE_DIR}/include/sqlite.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: ${SQLITE_DIR}/include/sqlite.h: proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${VORBIS_DIR}/include/vorbis/codec.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${VORBIS_DIR}/include/vorbis/codec.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${VORBIS_DIR}/include/vorbis/codec.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${VORBIS_DIR}/include/vorbis/codec.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${VORBIS_DIR}/include/vorbis/codec.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${VORBIS_DIR}/include/vorbis/codec.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${VORBIS_DIR}/include/vorbis/codec.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${VORBIS_DIR}/include/vorbis/codec.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${VORBIS_DIR}/include/vorbis/codec.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${VORBIS_DIR}/include/vorbis/codec.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${VORBIS_DIR}/include/vorbis/codec.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${VORBIS_DIR}/include/vorbis/codec.h: in the future, the compiler will take precedence" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${SQLITE_DIR}/include/sqlite.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: ${SQLITE_DIR}/include/sqlite.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${SQLITE_DIR}/include/sqlite.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: ${SQLITE_DIR}/include/sqlite.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${SQLITE_DIR}/include/sqlite.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: ${SQLITE_DIR}/include/sqlite.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${SQLITE_DIR}/include/sqlite.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: ${SQLITE_DIR}/include/sqlite.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${SQLITE_DIR}/include/sqlite.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: ${SQLITE_DIR}/include/sqlite.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${SQLITE_DIR}/include/sqlite.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: ${SQLITE_DIR}/include/sqlite.h: in the future, the compiler will take precedence" >&2;}
 
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for ${VORBIS_DIR}/include/vorbis/codec.h" >&5
-echo $ECHO_N "checking for ${VORBIS_DIR}/include/vorbis/codec.h... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking for ${SQLITE_DIR}/include/sqlite.h" >&5
+echo $ECHO_N "checking for ${SQLITE_DIR}/include/sqlite.h... $ECHO_C" >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -14754,27 +14740,27 @@ echo "${ECHO_T}$ac_res" >&6; }
 
 fi
 if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  VORBIS_HEADER_FOUND=1
+  SQLITE_HEADER_FOUND=1
 else
-  VORBIS_HEADER_FOUND=0
+  SQLITE_HEADER_FOUND=0
 fi
 
 
 	 fi
       else
-	 if test "xvorbis/codec.h" != "x" ; then
-            if test "${ac_cv_header_vorbis_codec_h+set}" = set; then
-  { echo "$as_me:$LINENO: checking for vorbis/codec.h" >&5
-echo $ECHO_N "checking for vorbis/codec.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_vorbis_codec_h+set}" = set; then
+	 if test "xsqlite.h" != "x" ; then
+            if test "${ac_cv_header_sqlite_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for sqlite.h" >&5
+echo $ECHO_N "checking for sqlite.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_sqlite_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_vorbis_codec_h" >&5
-echo "${ECHO_T}$ac_cv_header_vorbis_codec_h" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_sqlite_h" >&5
+echo "${ECHO_T}$ac_cv_header_sqlite_h" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking vorbis/codec.h usability" >&5
-echo $ECHO_N "checking vorbis/codec.h usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking sqlite.h usability" >&5
+echo $ECHO_N "checking sqlite.h usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -14782,7 +14768,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <vorbis/codec.h>
+#include <sqlite.h>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -14831,15 +14817,15 @@ rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking vorbis/codec.h presence" >&5
-echo $ECHO_N "checking vorbis/codec.h presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking sqlite.h presence" >&5
+echo $ECHO_N "checking sqlite.h presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <vorbis/codec.h>
+#include <sqlite.h>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -14879,74 +14865,74 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: vorbis/codec.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: vorbis/codec.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: vorbis/codec.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: vorbis/codec.h: proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: sqlite.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: sqlite.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: sqlite.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: sqlite.h: proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: vorbis/codec.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: vorbis/codec.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: vorbis/codec.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: vorbis/codec.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: vorbis/codec.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: vorbis/codec.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: vorbis/codec.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: vorbis/codec.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: vorbis/codec.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: vorbis/codec.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: vorbis/codec.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: vorbis/codec.h: in the future, the compiler will take precedence" >&2;}
+    { echo "$as_me:$LINENO: WARNING: sqlite.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: sqlite.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: sqlite.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: sqlite.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: sqlite.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: sqlite.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: sqlite.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: sqlite.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: sqlite.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: sqlite.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: sqlite.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: sqlite.h: in the future, the compiler will take precedence" >&2;}
 
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for vorbis/codec.h" >&5
-echo $ECHO_N "checking for vorbis/codec.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_vorbis_codec_h+set}" = set; then
+{ echo "$as_me:$LINENO: checking for sqlite.h" >&5
+echo $ECHO_N "checking for sqlite.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_sqlite_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_cv_header_vorbis_codec_h=$ac_header_preproc
+  ac_cv_header_sqlite_h=$ac_header_preproc
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_vorbis_codec_h" >&5
-echo "${ECHO_T}$ac_cv_header_vorbis_codec_h" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_sqlite_h" >&5
+echo "${ECHO_T}$ac_cv_header_sqlite_h" >&6; }
 
 fi
-if test $ac_cv_header_vorbis_codec_h = yes; then
-  VORBIS_HEADER_FOUND=1
+if test $ac_cv_header_sqlite_h = yes; then
+  SQLITE_HEADER_FOUND=1
 else
-  VORBIS_HEADER_FOUND=0
+  SQLITE_HEADER_FOUND=0
 fi
 
 
 	 fi
       fi
-      if test "x${VORBIS_HEADER_FOUND}" = "x0" ; then
-         if test ! -z "${VORBIS_MANDATORY}" ;
+      if test "x${SQLITE_HEADER_FOUND}" = "x0" ; then
+         if test ! -z "${SQLITE_MANDATORY}" ;
          then
             echo " ***"
-            echo " *** It appears that you do not have the vorbis development package installed."
-            echo " *** Please install it to include Vorbis support, or re-run configure"
-            echo " *** without explicitly specifying --with-vorbis"
+            echo " *** It appears that you do not have the sqlite development package installed."
+            echo " *** Please install it to include SQLite support, or re-run configure"
+            echo " *** without explicitly specifying --with-sqlite"
             exit 1
          fi
-         VORBIS_LIB=""
-         VORBIS_INCLUDE=""
-         PBX_LIBVORBIS=0
+         SQLITE_LIB=""
+         SQLITE_INCLUDE=""
+         PBX_LIBSQLITE=0
       else
-         PBX_LIBVORBIS=1
+         PBX_LIBSQLITE=1
 
 cat >>confdefs.h <<_ACEOF
-#define HAVE_VORBIS 1
+#define HAVE_SQLITE 1
 _ACEOF
 
       fi
-   elif test ! -z "${VORBIS_MANDATORY}";
+   elif test ! -z "${SQLITE_MANDATORY}";
    then
       echo "***"
-      echo "*** The Vorbis installation on this system appears to be broken."
+      echo "*** The SQLite installation on this system appears to be broken."
       echo "*** Either correct the installation, or run configure"
-      echo "*** without explicity specifying --with-vorbis"
+      echo "*** without explicity specifying --with-sqlite"
       exit 1
    fi
 fi
@@ -14956,39 +14942,39 @@ fi
 
 
 
-# Check whether --with-z was given.
-if test "${with_z+set}" = set; then
-  withval=$with_z;
+# Check whether --with-ssl was given.
+if test "${with_ssl+set}" = set; then
+  withval=$with_ssl;
 case ${withval} in
      n|no)
-     USE_ZLIB=no
+     USE_OPENSSL=no
      ;;
      y|ye|yes)
-     ZLIB_MANDATORY="yes"
+     OPENSSL_MANDATORY="yes"
      ;;
      *)
-     ZLIB_DIR="${withval}"
-     ZLIB_MANDATORY="yes"
+     OPENSSL_DIR="${withval}"
+     OPENSSL_MANDATORY="yes"
      ;;
 esac
 
 fi
 
 
-PBX_LIBZLIB=0
+PBX_LIBOPENSSL=0
 
-if test "${USE_ZLIB}" != "no"; then
+if test "${USE_OPENSSL}" != "no"; then
    pbxlibdir=""
-   if test "x${ZLIB_DIR}" != "x"; then
-      pbxlibdir="-L${z_DIR}/lib"
+   if test "x${OPENSSL_DIR}" != "x"; then
+      pbxlibdir="-L${ssl_DIR}/lib"
    fi
-   { echo "$as_me:$LINENO: checking for compress in -lz" >&5
-echo $ECHO_N "checking for compress in -lz... $ECHO_C" >&6; }
-if test "${ac_cv_lib_z_compress+set}" = set; then
+   { echo "$as_me:$LINENO: checking for ssl2_connect in -lssl" >&5
+echo $ECHO_N "checking for ssl2_connect in -lssl... $ECHO_C" >&6; }
+if test "${ac_cv_lib_ssl_ssl2_connect+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lz ${pbxlibdir}  $LIBS"
+LIBS="-lssl ${pbxlibdir} -lcrypto $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -15002,11 +14988,11 @@ cat >>conftest.$ac_ext <<_ACEOF
 #ifdef __cplusplus
 extern "C"
 #endif
-char compress ();
+char ssl2_connect ();
 int
 main ()
 {
-return compress ();
+return ssl2_connect ();
   ;
   return 0;
 }
@@ -15045,38 +15031,38 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_z_compress=yes
+  ac_cv_lib_ssl_ssl2_connect=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_lib_z_compress=no
+	ac_cv_lib_ssl_ssl2_connect=no
 fi
 
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_z_compress" >&5
-echo "${ECHO_T}$ac_cv_lib_z_compress" >&6; }
-if test $ac_cv_lib_z_compress = yes; then
-  AST_ZLIB_FOUND=yes
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_ssl_ssl2_connect" >&5
+echo "${ECHO_T}$ac_cv_lib_ssl_ssl2_connect" >&6; }
+if test $ac_cv_lib_ssl_ssl2_connect = yes; then
+  AST_OPENSSL_FOUND=yes
 else
-  AST_ZLIB_FOUND=no
+  AST_OPENSSL_FOUND=no
 fi
 
 
-   if test "${AST_ZLIB_FOUND}" = "yes"; then
-      ZLIB_LIB="-lz "
-      ZLIB_HEADER_FOUND="1"
-      if test "x${ZLIB_DIR}" != "x"; then
-         ZLIB_LIB="${pbxlibdir} ${ZLIB_LIB}"
-	 ZLIB_INCLUDE="-I${ZLIB_DIR}/include"
-	 if test "xzlib.h" != "x" ; then
-	    as_ac_Header=`echo "ac_cv_header_${ZLIB_DIR}/include/zlib.h" | $as_tr_sh`
+   if test "${AST_OPENSSL_FOUND}" = "yes"; then
+      OPENSSL_LIB="-lssl -lcrypto"
+      OPENSSL_HEADER_FOUND="1"
+      if test "x${OPENSSL_DIR}" != "x"; then
+         OPENSSL_LIB="${pbxlibdir} ${OPENSSL_LIB}"
+	 OPENSSL_INCLUDE="-I${OPENSSL_DIR}/include"
+	 if test "xopenssl/ssl.h" != "x" ; then
+	    as_ac_Header=`echo "ac_cv_header_${OPENSSL_DIR}/include/openssl/ssl.h" | $as_tr_sh`
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${ZLIB_DIR}/include/zlib.h" >&5
-echo $ECHO_N "checking for ${ZLIB_DIR}/include/zlib.h... $ECHO_C" >&6; }
+  { echo "$as_me:$LINENO: checking for ${OPENSSL_DIR}/include/openssl/ssl.h" >&5
+echo $ECHO_N "checking for ${OPENSSL_DIR}/include/openssl/ssl.h... $ECHO_C" >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
@@ -15085,8 +15071,8 @@ ac_res=`eval echo '${'$as_ac_Header'}'`
 echo "${ECHO_T}$ac_res" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${ZLIB_DIR}/include/zlib.h usability" >&5
-echo $ECHO_N "checking ${ZLIB_DIR}/include/zlib.h usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking ${OPENSSL_DIR}/include/openssl/ssl.h usability" >&5
+echo $ECHO_N "checking ${OPENSSL_DIR}/include/openssl/ssl.h usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -15094,7 +15080,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <${ZLIB_DIR}/include/zlib.h>
+#include <${OPENSSL_DIR}/include/openssl/ssl.h>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -15143,15 +15129,15 @@ rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking ${ZLIB_DIR}/include/zlib.h presence" >&5
-echo $ECHO_N "checking ${ZLIB_DIR}/include/zlib.h presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking ${OPENSSL_DIR}/include/openssl/ssl.h presence" >&5
+echo $ECHO_N "checking ${OPENSSL_DIR}/include/openssl/ssl.h presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <${ZLIB_DIR}/include/zlib.h>
+#include <${OPENSSL_DIR}/include/openssl/ssl.h>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -15191,30 +15177,30 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${ZLIB_DIR}/include/zlib.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${ZLIB_DIR}/include/zlib.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ZLIB_DIR}/include/zlib.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${ZLIB_DIR}/include/zlib.h: proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${OPENSSL_DIR}/include/openssl/ssl.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: ${OPENSSL_DIR}/include/openssl/ssl.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${OPENSSL_DIR}/include/openssl/ssl.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: ${OPENSSL_DIR}/include/openssl/ssl.h: proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${ZLIB_DIR}/include/zlib.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${ZLIB_DIR}/include/zlib.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ZLIB_DIR}/include/zlib.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${ZLIB_DIR}/include/zlib.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ZLIB_DIR}/include/zlib.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${ZLIB_DIR}/include/zlib.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ZLIB_DIR}/include/zlib.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${ZLIB_DIR}/include/zlib.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ZLIB_DIR}/include/zlib.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${ZLIB_DIR}/include/zlib.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${ZLIB_DIR}/include/zlib.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${ZLIB_DIR}/include/zlib.h: in the future, the compiler will take precedence" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${OPENSSL_DIR}/include/openssl/ssl.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: ${OPENSSL_DIR}/include/openssl/ssl.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${OPENSSL_DIR}/include/openssl/ssl.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: ${OPENSSL_DIR}/include/openssl/ssl.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${OPENSSL_DIR}/include/openssl/ssl.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: ${OPENSSL_DIR}/include/openssl/ssl.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${OPENSSL_DIR}/include/openssl/ssl.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: ${OPENSSL_DIR}/include/openssl/ssl.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${OPENSSL_DIR}/include/openssl/ssl.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: ${OPENSSL_DIR}/include/openssl/ssl.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${OPENSSL_DIR}/include/openssl/ssl.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: ${OPENSSL_DIR}/include/openssl/ssl.h: in the future, the compiler will take precedence" >&2;}
 
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for ${ZLIB_DIR}/include/zlib.h" >&5
-echo $ECHO_N "checking for ${ZLIB_DIR}/include/zlib.h... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking for ${OPENSSL_DIR}/include/openssl/ssl.h" >&5
+echo $ECHO_N "checking for ${OPENSSL_DIR}/include/openssl/ssl.h... $ECHO_C" >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -15226,27 +15212,27 @@ echo "${ECHO_T}$ac_res" >&6; }
 
 fi
 if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  ZLIB_HEADER_FOUND=1
+  OPENSSL_HEADER_FOUND=1
 else
-  ZLIB_HEADER_FOUND=0
+  OPENSSL_HEADER_FOUND=0
 fi
 
 
 	 fi
       else
-	 if test "xzlib.h" != "x" ; then
-            if test "${ac_cv_header_zlib_h+set}" = set; then
-  { echo "$as_me:$LINENO: checking for zlib.h" >&5
-echo $ECHO_N "checking for zlib.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_zlib_h+set}" = set; then
+	 if test "xopenssl/ssl.h" != "x" ; then
+            if test "${ac_cv_header_openssl_ssl_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for openssl/ssl.h" >&5
+echo $ECHO_N "checking for openssl/ssl.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_openssl_ssl_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_zlib_h" >&5
-echo "${ECHO_T}$ac_cv_header_zlib_h" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_openssl_ssl_h" >&5
+echo "${ECHO_T}$ac_cv_header_openssl_ssl_h" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking zlib.h usability" >&5
-echo $ECHO_N "checking zlib.h usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking openssl/ssl.h usability" >&5
+echo $ECHO_N "checking openssl/ssl.h usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -15254,7 +15240,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <zlib.h>
+#include <openssl/ssl.h>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -15303,15 +15289,15 @@ rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking zlib.h presence" >&5
-echo $ECHO_N "checking zlib.h presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking openssl/ssl.h presence" >&5
+echo $ECHO_N "checking openssl/ssl.h presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <zlib.h>
+#include <openssl/ssl.h>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -15351,74 +15337,74 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: zlib.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: zlib.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: zlib.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: zlib.h: proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: openssl/ssl.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: openssl/ssl.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: openssl/ssl.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: openssl/ssl.h: proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: zlib.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: zlib.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: zlib.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: zlib.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: zlib.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: zlib.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: zlib.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: zlib.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: zlib.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: zlib.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: zlib.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: zlib.h: in the future, the compiler will take precedence" >&2;}
+    { echo "$as_me:$LINENO: WARNING: openssl/ssl.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: openssl/ssl.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: openssl/ssl.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: openssl/ssl.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: openssl/ssl.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: openssl/ssl.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: openssl/ssl.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: openssl/ssl.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: openssl/ssl.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: openssl/ssl.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: openssl/ssl.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: openssl/ssl.h: in the future, the compiler will take precedence" >&2;}
 
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for zlib.h" >&5
-echo $ECHO_N "checking for zlib.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_zlib_h+set}" = set; then
+{ echo "$as_me:$LINENO: checking for openssl/ssl.h" >&5
+echo $ECHO_N "checking for openssl/ssl.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_openssl_ssl_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_cv_header_zlib_h=$ac_header_preproc
+  ac_cv_header_openssl_ssl_h=$ac_header_preproc
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_zlib_h" >&5
-echo "${ECHO_T}$ac_cv_header_zlib_h" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_openssl_ssl_h" >&5
+echo "${ECHO_T}$ac_cv_header_openssl_ssl_h" >&6; }
 
 fi
-if test $ac_cv_header_zlib_h = yes; then
-  ZLIB_HEADER_FOUND=1
+if test $ac_cv_header_openssl_ssl_h = yes; then
+  OPENSSL_HEADER_FOUND=1
 else
-  ZLIB_HEADER_FOUND=0
+  OPENSSL_HEADER_FOUND=0
 fi
 
 
 	 fi
       fi
-      if test "x${ZLIB_HEADER_FOUND}" = "x0" ; then
-         if test ! -z "${ZLIB_MANDATORY}" ;
+      if test "x${OPENSSL_HEADER_FOUND}" = "x0" ; then
+         if test ! -z "${OPENSSL_MANDATORY}" ;
          then
             echo " ***"
-            echo " *** It appears that you do not have the z development package installed."
-            echo " *** Please install it to include zlib support, or re-run configure"
-            echo " *** without explicitly specifying --with-z"
+            echo " *** It appears that you do not have the ssl development package installed."
+            echo " *** Please install it to include OpenSSL support, or re-run configure"
+            echo " *** without explicitly specifying --with-ssl"
             exit 1
          fi
-         ZLIB_LIB=""
-         ZLIB_INCLUDE=""
-         PBX_LIBZLIB=0
+         OPENSSL_LIB=""
+         OPENSSL_INCLUDE=""
+         PBX_LIBOPENSSL=0
       else
-         PBX_LIBZLIB=1
+         PBX_LIBOPENSSL=1
 
 cat >>confdefs.h <<_ACEOF
-#define HAVE_ZLIB 1
+#define HAVE_OPENSSL 1
 _ACEOF
 
       fi
-   elif test ! -z "${ZLIB_MANDATORY}";
+   elif test ! -z "${OPENSSL_MANDATORY}";
    then
       echo "***"
-      echo "*** The zlib installation on this system appears to be broken."
+      echo "*** The OpenSSL installation on this system appears to be broken."
       echo "*** Either correct the installation, or run configure"
-      echo "*** without explicity specifying --with-z"
+      echo "*** without explicity specifying --with-ssl"
       exit 1
    fi
 fi
@@ -15427,34 +15413,138 @@ fi
 
 
 
-EDITLINE_LIBS=""
-if test "x$TERMCAP_LIB" != "x" ; then
-  EDITLINE_LIBS="$TERMCAP_LIB"
-elif test "x$TINFO_LIB" != "x" ; then
-  EDITLINE_LIBS="$TINFO_LIB"
-elif test "x$CURSES_LIB" != "x" ; then
-  EDITLINE_LIBS="$CURSES_LIB"
-elif test "x$NCURSES_LIB" != "x" ; then
-  EDITLINE_LIBS="$NCURSES_LIB"
-else
-  echo "*** termcap support not found"
-  exit 1
-fi
-
 
-PBX_LIBOSS=0
-if test "${ac_cv_header_linux_soundcard_h+set}" = set; then
-  { echo "$as_me:$LINENO: checking for linux/soundcard.h" >&5
-echo $ECHO_N "checking for linux/soundcard.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_linux_soundcard_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_linux_soundcard_h" >&5
-echo "${ECHO_T}$ac_cv_header_linux_soundcard_h" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking linux/soundcard.h usability" >&5
-echo $ECHO_N "checking linux/soundcard.h usability... $ECHO_C" >&6; }
+# Check whether --with-tds was given.
+if test "${with_tds+set}" = set; then
+  withval=$with_tds;
+case ${withval} in
+     n|no)
+     USE_FREETDS=no
+     ;;
+     y|ye|yes)
+     FREETDS_MANDATORY="yes"
+     ;;
+     *)
+     FREETDS_DIR="${withval}"
+     FREETDS_MANDATORY="yes"
+     ;;
+esac
+
+fi
+
+
+PBX_LIBFREETDS=0
+
+if test "${USE_FREETDS}" != "no"; then
+   pbxlibdir=""
+   if test "x${FREETDS_DIR}" != "x"; then
+      pbxlibdir="-L${tds_DIR}/lib"
+   fi
+   { echo "$as_me:$LINENO: checking for tds_version in -ltds" >&5
+echo $ECHO_N "checking for tds_version in -ltds... $ECHO_C" >&6; }
+if test "${ac_cv_lib_tds_tds_version+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ltds ${pbxlibdir}  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* 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 tds_version ();
+int
+main ()
+{
+return tds_version ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_tds_tds_version=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_tds_tds_version=no
+fi
+
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_tds_tds_version" >&5
+echo "${ECHO_T}$ac_cv_lib_tds_tds_version" >&6; }
+if test $ac_cv_lib_tds_tds_version = yes; then
+  AST_FREETDS_FOUND=yes
+else
+  AST_FREETDS_FOUND=no
+fi
+
+
+   if test "${AST_FREETDS_FOUND}" = "yes"; then
+      FREETDS_LIB="-ltds "
+      FREETDS_HEADER_FOUND="1"
+      if test "x${FREETDS_DIR}" != "x"; then
+         FREETDS_LIB="${pbxlibdir} ${FREETDS_LIB}"
+	 FREETDS_INCLUDE="-I${FREETDS_DIR}/include"
+	 if test "xtds.h" != "x" ; then
+	    as_ac_Header=`echo "ac_cv_header_${FREETDS_DIR}/include/tds.h" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  { echo "$as_me:$LINENO: checking for ${FREETDS_DIR}/include/tds.h" >&5
+echo $ECHO_N "checking for ${FREETDS_DIR}/include/tds.h... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking ${FREETDS_DIR}/include/tds.h usability" >&5
+echo $ECHO_N "checking ${FREETDS_DIR}/include/tds.h usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -15462,7 +15552,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <linux/soundcard.h>
+#include <${FREETDS_DIR}/include/tds.h>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -15511,15 +15601,15 @@ rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking linux/soundcard.h presence" >&5
-echo $ECHO_N "checking linux/soundcard.h presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking ${FREETDS_DIR}/include/tds.h presence" >&5
+echo $ECHO_N "checking ${FREETDS_DIR}/include/tds.h presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <linux/soundcard.h>
+#include <${FREETDS_DIR}/include/tds.h>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -15559,64 +15649,62 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: linux/soundcard.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: linux/soundcard.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: linux/soundcard.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: linux/soundcard.h: proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${FREETDS_DIR}/include/tds.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: ${FREETDS_DIR}/include/tds.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${FREETDS_DIR}/include/tds.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: ${FREETDS_DIR}/include/tds.h: proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: linux/soundcard.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: linux/soundcard.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: linux/soundcard.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: linux/soundcard.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: linux/soundcard.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: linux/soundcard.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: linux/soundcard.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: linux/soundcard.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: linux/soundcard.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: linux/soundcard.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: linux/soundcard.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: linux/soundcard.h: in the future, the compiler will take precedence" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${FREETDS_DIR}/include/tds.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: ${FREETDS_DIR}/include/tds.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${FREETDS_DIR}/include/tds.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: ${FREETDS_DIR}/include/tds.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${FREETDS_DIR}/include/tds.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: ${FREETDS_DIR}/include/tds.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${FREETDS_DIR}/include/tds.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: ${FREETDS_DIR}/include/tds.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${FREETDS_DIR}/include/tds.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: ${FREETDS_DIR}/include/tds.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${FREETDS_DIR}/include/tds.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: ${FREETDS_DIR}/include/tds.h: in the future, the compiler will take precedence" >&2;}
 
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for linux/soundcard.h" >&5
-echo $ECHO_N "checking for linux/soundcard.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_linux_soundcard_h+set}" = set; then
+{ echo "$as_me:$LINENO: checking for ${FREETDS_DIR}/include/tds.h" >&5
+echo $ECHO_N "checking for ${FREETDS_DIR}/include/tds.h... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_cv_header_linux_soundcard_h=$ac_header_preproc
+  eval "$as_ac_Header=\$ac_header_preproc"
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_linux_soundcard_h" >&5
-echo "${ECHO_T}$ac_cv_header_linux_soundcard_h" >&6; }
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
 
 fi
-if test $ac_cv_header_linux_soundcard_h = yes; then
-
-		PBX_LIBOSS=1
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_OSS 1
-_ACEOF
-
-
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  FREETDS_HEADER_FOUND=1
+else
+  FREETDS_HEADER_FOUND=0
 fi
 
 
-if test "$PBX_LIBOSS" = "0"; then
-   if test "${ac_cv_header_sys_soundcard_h+set}" = set; then
-  { echo "$as_me:$LINENO: checking for sys/soundcard.h" >&5
-echo $ECHO_N "checking for sys/soundcard.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_sys_soundcard_h+set}" = set; then
+	 fi
+      else
+	 if test "xtds.h" != "x" ; then
+            if test "${ac_cv_header_tds_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for tds.h" >&5
+echo $ECHO_N "checking for tds.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_tds_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_sys_soundcard_h" >&5
-echo "${ECHO_T}$ac_cv_header_sys_soundcard_h" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_tds_h" >&5
+echo "${ECHO_T}$ac_cv_header_tds_h" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking sys/soundcard.h usability" >&5
-echo $ECHO_N "checking sys/soundcard.h usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking tds.h usability" >&5
+echo $ECHO_N "checking tds.h usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -15624,7 +15712,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <sys/soundcard.h>
+#include <tds.h>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -15673,15 +15761,15 @@ rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking sys/soundcard.h presence" >&5
-echo $ECHO_N "checking sys/soundcard.h presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking tds.h presence" >&5
+echo $ECHO_N "checking tds.h presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <sys/soundcard.h>
+#include <tds.h>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -15721,88 +15809,116 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: sys/soundcard.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: sys/soundcard.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: sys/soundcard.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: sys/soundcard.h: proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: tds.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: tds.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: tds.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: tds.h: proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: sys/soundcard.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: sys/soundcard.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: sys/soundcard.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: sys/soundcard.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: sys/soundcard.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: sys/soundcard.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: sys/soundcard.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: sys/soundcard.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: sys/soundcard.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: sys/soundcard.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: sys/soundcard.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: sys/soundcard.h: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for sys/soundcard.h" >&5
-echo $ECHO_N "checking for sys/soundcard.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_sys_soundcard_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_cv_header_sys_soundcard_h=$ac_header_preproc
+    { echo "$as_me:$LINENO: WARNING: tds.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: tds.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: tds.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: tds.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: tds.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: tds.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: tds.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: tds.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: tds.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: tds.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: tds.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: tds.h: in the future, the compiler will take precedence" >&2;}
+
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for tds.h" >&5
+echo $ECHO_N "checking for tds.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_tds_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_tds_h=$ac_header_preproc
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_sys_soundcard_h" >&5
-echo "${ECHO_T}$ac_cv_header_sys_soundcard_h" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_tds_h" >&5
+echo "${ECHO_T}$ac_cv_header_tds_h" >&6; }
 
 fi
-if test $ac_cv_header_sys_soundcard_h = yes; then
+if test $ac_cv_header_tds_h = yes; then
+  FREETDS_HEADER_FOUND=1
+else
+  FREETDS_HEADER_FOUND=0
+fi
 
-		   PBX_LIBossaudio=1
+
+	 fi
+      fi
+      if test "x${FREETDS_HEADER_FOUND}" = "x0" ; then
+         if test ! -z "${FREETDS_MANDATORY}" ;
+         then
+            echo " ***"
+            echo " *** It appears that you do not have the tds development package installed."
+            echo " *** Please install it to include FreeTDS support, or re-run configure"
+            echo " *** without explicitly specifying --with-tds"
+            exit 1
+         fi
+         FREETDS_LIB=""
+         FREETDS_INCLUDE=""
+         PBX_LIBFREETDS=0
+      else
+         PBX_LIBFREETDS=1
 
 cat >>confdefs.h <<_ACEOF
-#define HAVE_OSS 1
+#define HAVE_FREETDS 1
 _ACEOF
 
-
+      fi
+   elif test ! -z "${FREETDS_MANDATORY}";
+   then
+      echo "***"
+      echo "*** The FreeTDS installation on this system appears to be broken."
+      echo "*** Either correct the installation, or run configure"
+      echo "*** without explicity specifying --with-tds"
+      exit 1
+   fi
 fi
 
 
-fi
-if test "$PBX_LIBOSS" = "0"; then
 
 
-# Check whether --with-ossaudio was given.
-if test "${with_ossaudio+set}" = set; then
-  withval=$with_ossaudio;
+
+
+# Check whether --with-termcap was given.
+if test "${with_termcap+set}" = set; then
+  withval=$with_termcap;
 case ${withval} in
      n|no)
-     USE_OSS=no
+     USE_TERMCAP=no
      ;;
      y|ye|yes)
-     OSS_MANDATORY="yes"
+     TERMCAP_MANDATORY="yes"
      ;;
      *)
-     OSS_DIR="${withval}"
-     OSS_MANDATORY="yes"
+     TERMCAP_DIR="${withval}"
+     TERMCAP_MANDATORY="yes"
      ;;
 esac
 
 fi
 
 
-PBX_LIBOSS=0
+PBX_LIBTERMCAP=0
 
-if test "${USE_OSS}" != "no"; then
+if test "${USE_TERMCAP}" != "no"; then
    pbxlibdir=""
-   if test "x${OSS_DIR}" != "x"; then
-      pbxlibdir="-L${ossaudio_DIR}/lib"
+   if test "x${TERMCAP_DIR}" != "x"; then
+      pbxlibdir="-L${termcap_DIR}/lib"
    fi
-   { echo "$as_me:$LINENO: checking for oss_ioctl_mixer in -lossaudio" >&5
-echo $ECHO_N "checking for oss_ioctl_mixer in -lossaudio... $ECHO_C" >&6; }
-if test "${ac_cv_lib_ossaudio_oss_ioctl_mixer+set}" = set; then
+   { echo "$as_me:$LINENO: checking for tgetent in -ltermcap" >&5
+echo $ECHO_N "checking for tgetent in -ltermcap... $ECHO_C" >&6; }
+if test "${ac_cv_lib_termcap_tgetent+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lossaudio ${pbxlibdir}  $LIBS"
+LIBS="-ltermcap ${pbxlibdir}  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -15816,11 +15932,11 @@ cat >>conftest.$ac_ext <<_ACEOF
 #ifdef __cplusplus
 extern "C"
 #endif
-char oss_ioctl_mixer ();
+char tgetent ();
 int
 main ()
 {
-return oss_ioctl_mixer ();
+return tgetent ();
   ;
   return 0;
 }
@@ -15859,38 +15975,38 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_ossaudio_oss_ioctl_mixer=yes
+  ac_cv_lib_termcap_tgetent=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_lib_ossaudio_oss_ioctl_mixer=no
+	ac_cv_lib_termcap_tgetent=no
 fi
 
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_ossaudio_oss_ioctl_mixer" >&5
-echo "${ECHO_T}$ac_cv_lib_ossaudio_oss_ioctl_mixer" >&6; }
-if test $ac_cv_lib_ossaudio_oss_ioctl_mixer = yes; then
-  AST_OSS_FOUND=yes
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_termcap_tgetent" >&5
+echo "${ECHO_T}$ac_cv_lib_termcap_tgetent" >&6; }
+if test $ac_cv_lib_termcap_tgetent = yes; then
+  AST_TERMCAP_FOUND=yes
 else
-  AST_OSS_FOUND=no
+  AST_TERMCAP_FOUND=no
 fi
 
 
-   if test "${AST_OSS_FOUND}" = "yes"; then
-      OSS_LIB="-lossaudio "
-      OSS_HEADER_FOUND="1"
-      if test "x${OSS_DIR}" != "x"; then
-         OSS_LIB="${pbxlibdir} ${OSS_LIB}"
-	 OSS_INCLUDE="-I${OSS_DIR}/include"
-	 if test "xsoundcard.h" != "x" ; then
-	    as_ac_Header=`echo "ac_cv_header_${OSS_DIR}/include/soundcard.h" | $as_tr_sh`
+   if test "${AST_TERMCAP_FOUND}" = "yes"; then
+      TERMCAP_LIB="-ltermcap "
+      TERMCAP_HEADER_FOUND="1"
+      if test "x${TERMCAP_DIR}" != "x"; then
+         TERMCAP_LIB="${pbxlibdir} ${TERMCAP_LIB}"
+	 TERMCAP_INCLUDE="-I${TERMCAP_DIR}/include"
+	 if test "x" != "x" ; then
+	    as_ac_Header=`echo "ac_cv_header_${TERMCAP_DIR}/include/" | $as_tr_sh`
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${OSS_DIR}/include/soundcard.h" >&5
-echo $ECHO_N "checking for ${OSS_DIR}/include/soundcard.h... $ECHO_C" >&6; }
+  { echo "$as_me:$LINENO: checking for ${TERMCAP_DIR}/include/" >&5
+echo $ECHO_N "checking for ${TERMCAP_DIR}/include/... $ECHO_C" >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
@@ -15899,8 +16015,8 @@ ac_res=`eval echo '${'$as_ac_Header'}'`
 echo "${ECHO_T}$ac_res" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${OSS_DIR}/include/soundcard.h usability" >&5
-echo $ECHO_N "checking ${OSS_DIR}/include/soundcard.h usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking ${TERMCAP_DIR}/include/ usability" >&5
+echo $ECHO_N "checking ${TERMCAP_DIR}/include/ usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -15908,7 +16024,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <${OSS_DIR}/include/soundcard.h>
+#include <${TERMCAP_DIR}/include/>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -15957,15 +16073,15 @@ rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking ${OSS_DIR}/include/soundcard.h presence" >&5
-echo $ECHO_N "checking ${OSS_DIR}/include/soundcard.h presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking ${TERMCAP_DIR}/include/ presence" >&5
+echo $ECHO_N "checking ${TERMCAP_DIR}/include/ presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <${OSS_DIR}/include/soundcard.h>
+#include <${TERMCAP_DIR}/include/>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -16005,30 +16121,30 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${OSS_DIR}/include/soundcard.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${OSS_DIR}/include/soundcard.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${OSS_DIR}/include/soundcard.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${OSS_DIR}/include/soundcard.h: proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${TERMCAP_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: ${TERMCAP_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${TERMCAP_DIR}/include/: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: ${TERMCAP_DIR}/include/: proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${OSS_DIR}/include/soundcard.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${OSS_DIR}/include/soundcard.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${OSS_DIR}/include/soundcard.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${OSS_DIR}/include/soundcard.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${OSS_DIR}/include/soundcard.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${OSS_DIR}/include/soundcard.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${OSS_DIR}/include/soundcard.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${OSS_DIR}/include/soundcard.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${OSS_DIR}/include/soundcard.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${OSS_DIR}/include/soundcard.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${OSS_DIR}/include/soundcard.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${OSS_DIR}/include/soundcard.h: in the future, the compiler will take precedence" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${TERMCAP_DIR}/include/: present but cannot be compiled" >&5
+echo "$as_me: WARNING: ${TERMCAP_DIR}/include/: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${TERMCAP_DIR}/include/:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: ${TERMCAP_DIR}/include/:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${TERMCAP_DIR}/include/: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: ${TERMCAP_DIR}/include/: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${TERMCAP_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: ${TERMCAP_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${TERMCAP_DIR}/include/: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: ${TERMCAP_DIR}/include/: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${TERMCAP_DIR}/include/: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: ${TERMCAP_DIR}/include/: in the future, the compiler will take precedence" >&2;}
 
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for ${OSS_DIR}/include/soundcard.h" >&5
-echo $ECHO_N "checking for ${OSS_DIR}/include/soundcard.h... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking for ${TERMCAP_DIR}/include/" >&5
+echo $ECHO_N "checking for ${TERMCAP_DIR}/include/... $ECHO_C" >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -16040,27 +16156,27 @@ echo "${ECHO_T}$ac_res" >&6; }
 
 fi
 if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  OSS_HEADER_FOUND=1
+  TERMCAP_HEADER_FOUND=1
 else
-  OSS_HEADER_FOUND=0
+  TERMCAP_HEADER_FOUND=0
 fi
 
 
 	 fi
       else
-	 if test "xsoundcard.h" != "x" ; then
-            if test "${ac_cv_header_soundcard_h+set}" = set; then
-  { echo "$as_me:$LINENO: checking for soundcard.h" >&5
-echo $ECHO_N "checking for soundcard.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_soundcard_h+set}" = set; then
+	 if test "x" != "x" ; then
+            if test "${ac_cv_header_+set}" = set; then
+  { echo "$as_me:$LINENO: checking for " >&5
+echo $ECHO_N "checking for ... $ECHO_C" >&6; }
+if test "${ac_cv_header_+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_soundcard_h" >&5
-echo "${ECHO_T}$ac_cv_header_soundcard_h" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
+echo "${ECHO_T}$ac_cv_header_" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking soundcard.h usability" >&5
-echo $ECHO_N "checking soundcard.h usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking  usability" >&5
+echo $ECHO_N "checking  usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -16068,7 +16184,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <soundcard.h>
+#include <>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -16117,15 +16233,15 @@ rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking soundcard.h presence" >&5
-echo $ECHO_N "checking soundcard.h presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking  presence" >&5
+echo $ECHO_N "checking  presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <soundcard.h>
+#include <>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -16165,74 +16281,74 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: soundcard.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: soundcard.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: soundcard.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: soundcard.h: proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: : proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: : proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: soundcard.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: soundcard.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: soundcard.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: soundcard.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: soundcard.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: soundcard.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: soundcard.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: soundcard.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: soundcard.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: soundcard.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: soundcard.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: soundcard.h: in the future, the compiler will take precedence" >&2;}
+    { echo "$as_me:$LINENO: WARNING: : present but cannot be compiled" >&5
+echo "$as_me: WARNING: : present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: :     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: :     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: : see the Autoconf documentation" >&5
+echo "$as_me: WARNING: : see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: :     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: :     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: : proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: : proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: : in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: : in the future, the compiler will take precedence" >&2;}
 
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for soundcard.h" >&5
-echo $ECHO_N "checking for soundcard.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_soundcard_h+set}" = set; then
+{ echo "$as_me:$LINENO: checking for " >&5
+echo $ECHO_N "checking for ... $ECHO_C" >&6; }
+if test "${ac_cv_header_+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_cv_header_soundcard_h=$ac_header_preproc
+  ac_cv_header_=$ac_header_preproc
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_soundcard_h" >&5
-echo "${ECHO_T}$ac_cv_header_soundcard_h" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
+echo "${ECHO_T}$ac_cv_header_" >&6; }
 
 fi
-if test $ac_cv_header_soundcard_h = yes; then
-  OSS_HEADER_FOUND=1
+if test $ac_cv_header_ = yes; then
+  TERMCAP_HEADER_FOUND=1
 else
-  OSS_HEADER_FOUND=0
+  TERMCAP_HEADER_FOUND=0
 fi
 
 
 	 fi
       fi
-      if test "x${OSS_HEADER_FOUND}" = "x0" ; then
-         if test ! -z "${OSS_MANDATORY}" ;
+      if test "x${TERMCAP_HEADER_FOUND}" = "x0" ; then
+         if test ! -z "${TERMCAP_MANDATORY}" ;
          then
             echo " ***"
-            echo " *** It appears that you do not have the ossaudio development package installed."
-            echo " *** Please install it to include Open Sound System support, or re-run configure"
-            echo " *** without explicitly specifying --with-ossaudio"
+            echo " *** It appears that you do not have the termcap development package installed."
+            echo " *** Please install it to include Termcap support, or re-run configure"
+            echo " *** without explicitly specifying --with-termcap"
             exit 1
          fi
-         OSS_LIB=""
-         OSS_INCLUDE=""
-         PBX_LIBOSS=0
+         TERMCAP_LIB=""
+         TERMCAP_INCLUDE=""
+         PBX_LIBTERMCAP=0
       else
-         PBX_LIBOSS=1
+         PBX_LIBTERMCAP=1
 
 cat >>confdefs.h <<_ACEOF
-#define HAVE_OSS 1
+#define HAVE_TERMCAP 1
 _ACEOF
 
       fi
-   elif test ! -z "${OSS_MANDATORY}";
+   elif test ! -z "${TERMCAP_MANDATORY}";
    then
       echo "***"
-      echo "*** The Open Sound System installation on this system appears to be broken."
+      echo "*** The Termcap installation on this system appears to be broken."
       echo "*** Either correct the installation, or run configure"
-      echo "*** without explicity specifying --with-ossaudio"
+      echo "*** without explicity specifying --with-termcap"
       exit 1
    fi
 fi
@@ -16240,46 +16356,41 @@ fi
 
 
 
-fi
-
-
-
-if test "${PBX_OSTYPE}" = "Linux" ; then
 
 
-# Check whether --with-tonezone was given.
-if test "${with_tonezone+set}" = set; then
-  withval=$with_tonezone;
+# Check whether --with-tinfo was given.
+if test "${with_tinfo+set}" = set; then
+  withval=$with_tinfo;
 case ${withval} in
      n|no)
-     USE_TONEZONE=no
+     USE_TINFO=no
      ;;
      y|ye|yes)
-     TONEZONE_MANDATORY="yes"
+     TINFO_MANDATORY="yes"
      ;;
      *)
-     TONEZONE_DIR="${withval}"
-     TONEZONE_MANDATORY="yes"
+     TINFO_DIR="${withval}"
+     TINFO_MANDATORY="yes"
      ;;
 esac
 
 fi
 
 
-PBX_LIBTONEZONE=0
+PBX_LIBTINFO=0
 
-if test "${USE_TONEZONE}" != "no"; then
+if test "${USE_TINFO}" != "no"; then
    pbxlibdir=""
-   if test "x${TONEZONE_DIR}" != "x"; then
-      pbxlibdir="-L${tonezone_DIR}/lib"
+   if test "x${TINFO_DIR}" != "x"; then
+      pbxlibdir="-L${tinfo_DIR}/lib"
    fi
-   { echo "$as_me:$LINENO: checking for tone_zone_find in -ltonezone" >&5
-echo $ECHO_N "checking for tone_zone_find in -ltonezone... $ECHO_C" >&6; }
-if test "${ac_cv_lib_tonezone_tone_zone_find+set}" = set; then
+   { echo "$as_me:$LINENO: checking for tgetent in -ltinfo" >&5
+echo $ECHO_N "checking for tgetent in -ltinfo... $ECHO_C" >&6; }
+if test "${ac_cv_lib_tinfo_tgetent+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-ltonezone ${pbxlibdir}  $LIBS"
+LIBS="-ltinfo ${pbxlibdir}  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -16293,11 +16404,11 @@ cat >>conftest.$ac_ext <<_ACEOF
 #ifdef __cplusplus
 extern "C"
 #endif
-char tone_zone_find ();
+char tgetent ();
 int
 main ()
 {
-return tone_zone_find ();
+return tgetent ();
   ;
   return 0;
 }
@@ -16336,38 +16447,38 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_tonezone_tone_zone_find=yes
+  ac_cv_lib_tinfo_tgetent=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_lib_tonezone_tone_zone_find=no
+	ac_cv_lib_tinfo_tgetent=no
 fi
 
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_tonezone_tone_zone_find" >&5
-echo "${ECHO_T}$ac_cv_lib_tonezone_tone_zone_find" >&6; }
-if test $ac_cv_lib_tonezone_tone_zone_find = yes; then
-  AST_TONEZONE_FOUND=yes
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_tinfo_tgetent" >&5
+echo "${ECHO_T}$ac_cv_lib_tinfo_tgetent" >&6; }
+if test $ac_cv_lib_tinfo_tgetent = yes; then
+  AST_TINFO_FOUND=yes
 else
-  AST_TONEZONE_FOUND=no
+  AST_TINFO_FOUND=no
 fi
 
 
-   if test "${AST_TONEZONE_FOUND}" = "yes"; then
-      TONEZONE_LIB="-ltonezone "
-      TONEZONE_HEADER_FOUND="1"
-      if test "x${TONEZONE_DIR}" != "x"; then
-         TONEZONE_LIB="${pbxlibdir} ${TONEZONE_LIB}"
-	 TONEZONE_INCLUDE="-I${TONEZONE_DIR}/include"
-	 if test "xtonezone.h" != "x" ; then
-	    as_ac_Header=`echo "ac_cv_header_${TONEZONE_DIR}/include/tonezone.h" | $as_tr_sh`
+   if test "${AST_TINFO_FOUND}" = "yes"; then
+      TINFO_LIB="-ltinfo "
+      TINFO_HEADER_FOUND="1"
+      if test "x${TINFO_DIR}" != "x"; then
+         TINFO_LIB="${pbxlibdir} ${TINFO_LIB}"
+	 TINFO_INCLUDE="-I${TINFO_DIR}/include"
+	 if test "x" != "x" ; then
+	    as_ac_Header=`echo "ac_cv_header_${TINFO_DIR}/include/" | $as_tr_sh`
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for ${TONEZONE_DIR}/include/tonezone.h" >&5
-echo $ECHO_N "checking for ${TONEZONE_DIR}/include/tonezone.h... $ECHO_C" >&6; }
+  { echo "$as_me:$LINENO: checking for ${TINFO_DIR}/include/" >&5
+echo $ECHO_N "checking for ${TINFO_DIR}/include/... $ECHO_C" >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
@@ -16376,8 +16487,8 @@ ac_res=`eval echo '${'$as_ac_Header'}'`
 echo "${ECHO_T}$ac_res" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${TONEZONE_DIR}/include/tonezone.h usability" >&5
-echo $ECHO_N "checking ${TONEZONE_DIR}/include/tonezone.h usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking ${TINFO_DIR}/include/ usability" >&5
+echo $ECHO_N "checking ${TINFO_DIR}/include/ usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -16385,7 +16496,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <${TONEZONE_DIR}/include/tonezone.h>
+#include <${TINFO_DIR}/include/>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -16434,15 +16545,15 @@ rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking ${TONEZONE_DIR}/include/tonezone.h presence" >&5
-echo $ECHO_N "checking ${TONEZONE_DIR}/include/tonezone.h presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking ${TINFO_DIR}/include/ presence" >&5
+echo $ECHO_N "checking ${TINFO_DIR}/include/ presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <${TONEZONE_DIR}/include/tonezone.h>
+#include <${TINFO_DIR}/include/>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -16482,30 +16593,30 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: ${TONEZONE_DIR}/include/tonezone.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${TONEZONE_DIR}/include/tonezone.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TONEZONE_DIR}/include/tonezone.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${TONEZONE_DIR}/include/tonezone.h: proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${TINFO_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: ${TINFO_DIR}/include/: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${TINFO_DIR}/include/: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: ${TINFO_DIR}/include/: proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: ${TONEZONE_DIR}/include/tonezone.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${TONEZONE_DIR}/include/tonezone.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TONEZONE_DIR}/include/tonezone.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${TONEZONE_DIR}/include/tonezone.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TONEZONE_DIR}/include/tonezone.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${TONEZONE_DIR}/include/tonezone.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TONEZONE_DIR}/include/tonezone.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${TONEZONE_DIR}/include/tonezone.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TONEZONE_DIR}/include/tonezone.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${TONEZONE_DIR}/include/tonezone.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: ${TONEZONE_DIR}/include/tonezone.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${TONEZONE_DIR}/include/tonezone.h: in the future, the compiler will take precedence" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${TINFO_DIR}/include/: present but cannot be compiled" >&5
+echo "$as_me: WARNING: ${TINFO_DIR}/include/: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${TINFO_DIR}/include/:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: ${TINFO_DIR}/include/:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${TINFO_DIR}/include/: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: ${TINFO_DIR}/include/: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${TINFO_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: ${TINFO_DIR}/include/:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${TINFO_DIR}/include/: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: ${TINFO_DIR}/include/: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${TINFO_DIR}/include/: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: ${TINFO_DIR}/include/: in the future, the compiler will take precedence" >&2;}
 
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for ${TONEZONE_DIR}/include/tonezone.h" >&5
-echo $ECHO_N "checking for ${TONEZONE_DIR}/include/tonezone.h... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking for ${TINFO_DIR}/include/" >&5
+echo $ECHO_N "checking for ${TINFO_DIR}/include/... $ECHO_C" >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -16517,27 +16628,27 @@ echo "${ECHO_T}$ac_res" >&6; }
 
 fi
 if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  TONEZONE_HEADER_FOUND=1
+  TINFO_HEADER_FOUND=1
 else
-  TONEZONE_HEADER_FOUND=0
+  TINFO_HEADER_FOUND=0
 fi
 
 
 	 fi
       else
-	 if test "xtonezone.h" != "x" ; then
-            if test "${ac_cv_header_tonezone_h+set}" = set; then
-  { echo "$as_me:$LINENO: checking for tonezone.h" >&5
-echo $ECHO_N "checking for tonezone.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_tonezone_h+set}" = set; then
+	 if test "x" != "x" ; then
+            if test "${ac_cv_header_+set}" = set; then
+  { echo "$as_me:$LINENO: checking for " >&5
+echo $ECHO_N "checking for ... $ECHO_C" >&6; }
+if test "${ac_cv_header_+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_tonezone_h" >&5
-echo "${ECHO_T}$ac_cv_header_tonezone_h" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
+echo "${ECHO_T}$ac_cv_header_" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking tonezone.h usability" >&5
-echo $ECHO_N "checking tonezone.h usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking  usability" >&5
+echo $ECHO_N "checking  usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -16545,7 +16656,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <tonezone.h>
+#include <>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -16594,15 +16705,15 @@ rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking tonezone.h presence" >&5
-echo $ECHO_N "checking tonezone.h presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking  presence" >&5
+echo $ECHO_N "checking  presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <tonezone.h>
+#include <>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -16642,74 +16753,74 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: tonezone.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: tonezone.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: tonezone.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: tonezone.h: proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: : proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: : proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: tonezone.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: tonezone.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: tonezone.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: tonezone.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: tonezone.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: tonezone.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: tonezone.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: tonezone.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: tonezone.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: tonezone.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: tonezone.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: tonezone.h: in the future, the compiler will take precedence" >&2;}
+    { echo "$as_me:$LINENO: WARNING: : present but cannot be compiled" >&5
+echo "$as_me: WARNING: : present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: :     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: :     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: : see the Autoconf documentation" >&5
+echo "$as_me: WARNING: : see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: :     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: :     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: : proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: : proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: : in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: : in the future, the compiler will take precedence" >&2;}
 
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for tonezone.h" >&5
-echo $ECHO_N "checking for tonezone.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_tonezone_h+set}" = set; then
+{ echo "$as_me:$LINENO: checking for " >&5
+echo $ECHO_N "checking for ... $ECHO_C" >&6; }
+if test "${ac_cv_header_+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_cv_header_tonezone_h=$ac_header_preproc
+  ac_cv_header_=$ac_header_preproc
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_tonezone_h" >&5
-echo "${ECHO_T}$ac_cv_header_tonezone_h" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
+echo "${ECHO_T}$ac_cv_header_" >&6; }
 
 fi
-if test $ac_cv_header_tonezone_h = yes; then
-  TONEZONE_HEADER_FOUND=1
+if test $ac_cv_header_ = yes; then
+  TINFO_HEADER_FOUND=1
 else
-  TONEZONE_HEADER_FOUND=0
+  TINFO_HEADER_FOUND=0
 fi
 
 
 	 fi
       fi
-      if test "x${TONEZONE_HEADER_FOUND}" = "x0" ; then
-         if test ! -z "${TONEZONE_MANDATORY}" ;
+      if test "x${TINFO_HEADER_FOUND}" = "x0" ; then
+         if test ! -z "${TINFO_MANDATORY}" ;
          then
             echo " ***"
-            echo " *** It appears that you do not have the tonezone development package installed."
-            echo " *** Please install it to include tonezone support, or re-run configure"
-            echo " *** without explicitly specifying --with-tonezone"
+            echo " *** It appears that you do not have the tinfo development package installed."
+            echo " *** Please install it to include Term Info support, or re-run configure"
+            echo " *** without explicitly specifying --with-tinfo"
             exit 1
          fi
-         TONEZONE_LIB=""
-         TONEZONE_INCLUDE=""
-         PBX_LIBTONEZONE=0
+         TINFO_LIB=""
+         TINFO_INCLUDE=""
+         PBX_LIBTINFO=0
       else
-         PBX_LIBTONEZONE=1
+         PBX_LIBTINFO=1
 
 cat >>confdefs.h <<_ACEOF
-#define HAVE_TONEZONE 1
+#define HAVE_TINFO 1
 _ACEOF
 
       fi
-   elif test ! -z "${TONEZONE_MANDATORY}";
+   elif test ! -z "${TINFO_MANDATORY}";
    then
       echo "***"
-      echo "*** The tonezone installation on this system appears to be broken."
+      echo "*** The Term Info installation on this system appears to be broken."
       echo "*** Either correct the installation, or run configure"
-      echo "*** without explicity specifying --with-tonezone"
+      echo "*** without explicity specifying --with-tinfo"
       exit 1
    fi
 fi
@@ -16717,7 +16828,8 @@ fi
 
 
 
-else
+
+if test "${PBX_OSTYPE}" = "Linux" ; then
 
 
 # Check whether --with-tonezone was given.
@@ -16752,7 +16864,7 @@ if test "${ac_cv_lib_tonezone_tone_zone_find+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-ltonezone ${pbxlibdir} -lm $LIBS"
+LIBS="-ltonezone ${pbxlibdir}  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -16831,7 +16943,7 @@ fi
 
 
    if test "${AST_TONEZONE_FOUND}" = "yes"; then
-      TONEZONE_LIB="-ltonezone -lm"
+      TONEZONE_LIB="-ltonezone "
       TONEZONE_HEADER_FOUND="1"
       if test "x${TONEZONE_DIR}" != "x"; then
          TONEZONE_LIB="${pbxlibdir} ${TONEZONE_LIB}"
@@ -17190,65 +17302,72 @@ fi
 
 
 
-fi
+else
 
 
-# Check whether --with-zaptel was given.
-if test "${with_zaptel+set}" = set; then
-  withval=$with_zaptel;
+# Check whether --with-tonezone was given.
+if test "${with_tonezone+set}" = set; then
+  withval=$with_tonezone;
 case ${withval} in
      n|no)
-     USE_ZAPTEL=no
+     USE_TONEZONE=no
      ;;
      y|ye|yes)
-     ZAPTEL_MANDATORY=yes
+     TONEZONE_MANDATORY="yes"
      ;;
      *)
-     ZAPTEL_DIR="${withval}"
-     ZAPTEL_MANDATORY=yes
+     TONEZONE_DIR="${withval}"
+     TONEZONE_MANDATORY="yes"
      ;;
 esac
 
 fi
 
 
-PBX_ZAPTEL=0
-if test "${USE_ZAPTEL}" != "no"; then
-   echo -n "checking for usability of zaptel.h... "
-   if test "${PBX_OSTYPE}" = "Linux" ; then
-      zapheader=linux/zaptel.h
-   else
-      zapheader=zaptel.h
-   fi
-   saved_cppflags="${CPPFLAGS}"
-   if test "x${ZAPTEL_DIR}" != "x"; then
-      CPPFLAGS="${CPPFLAGS} -I${ZAPTEL_DIR}/include"
-   fi
-   cat >conftest.$ac_ext <<_ACEOF
+PBX_LIBTONEZONE=0
 
-	/* confdefs.h.  */
+if test "${USE_TONEZONE}" != "no"; then
+   pbxlibdir=""
+   if test "x${TONEZONE_DIR}" != "x"; then
+      pbxlibdir="-L${tonezone_DIR}/lib"
+   fi
+   { echo "$as_me:$LINENO: checking for tone_zone_find in -ltonezone" >&5
+echo $ECHO_N "checking for tone_zone_find in -ltonezone... $ECHO_C" >&6; }
+if test "${ac_cv_lib_tonezone_tone_zone_find+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ltonezone ${pbxlibdir} -lm $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <${zapheader}>
+
+/* 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 tone_zone_find ();
 int
 main ()
 {
-struct zt_transcode_header test;
+return tone_zone_find ();
   ;
   return 0;
 }
-
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
@@ -17265,7 +17384,7 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
+	 { ac_try='test -s conftest$ac_exeext'
   { (case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
@@ -17275,115 +17394,65 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  	{ echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
-		ac_cv_zaptel_h="yes"
-
+  ac_cv_lib_tonezone_tone_zone_find=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-		{ echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-		ac_cv_zaptel_h="no"
-
-
+	ac_cv_lib_tonezone_tone_zone_find=no
 fi
 
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-   CPPFLAGS="${saved_cppflags}"
-   if test "${ac_cv_zaptel_h}" = "yes"; then
-	if test "${ZAPTEL_DIR}" != ""; then
-	   ZAPTEL_INCLUDE="-I${ZAPTEL_DIR}/include"
-
-	fi
-	PBX_ZAPTEL=1
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_ZAPTEL 1
-_ACEOF
-
-   elif test ! -z "${ZAPTEL_MANDATORY}";
-   then
-      echo "***"
-      echo "*** The Zaptel installation on this system appears to be broken."
-      echo "*** Either correct the installation, or run configure"
-      echo "*** including --without-zaptel."
-      exit 1
-   fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
 fi
-
-
-
-GSM_INTERNAL="yes"
-GSM_SYSTEM="yes"
-
-# Check whether --with-gsm was given.
-if test "${with_gsm+set}" = set; then
-  withval=$with_gsm;
-case ${withval} in
-     n|no)
-     USE_GSM=no
-     ;;
-     y|ye|yes)
-     ;;
-     internal)
-     GSM_SYSTEM="no"
-     ;;
-     *)
-     GSM_DIR="${withval}"
-     GSM_INTERNAL="no"
-     ;;
-esac
-
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_tonezone_tone_zone_find" >&5
+echo "${ECHO_T}$ac_cv_lib_tonezone_tone_zone_find" >&6; }
+if test $ac_cv_lib_tonezone_tone_zone_find = yes; then
+  AST_TONEZONE_FOUND=yes
+else
+  AST_TONEZONE_FOUND=no
 fi
 
 
-PBX_LIBgsm=0
-
-if test "${USE_GSM}" != "no"; then
-   if test "${GSM_SYSTEM}" = "yes"; then
-      gsmlibdir=""
-      if test "x${GSM_DIR}" != "x"; then
-         gsmlibdir="-L${GSM_DIR}/lib"
-      fi
-      { echo "$as_me:$LINENO: checking for gsm_create in -lgsm" >&5
-echo $ECHO_N "checking for gsm_create in -lgsm... $ECHO_C" >&6; }
-if test "${ac_cv_lib_gsm_gsm_create+set}" = set; then
+   if test "${AST_TONEZONE_FOUND}" = "yes"; then
+      TONEZONE_LIB="-ltonezone -lm"
+      TONEZONE_HEADER_FOUND="1"
+      if test "x${TONEZONE_DIR}" != "x"; then
+         TONEZONE_LIB="${pbxlibdir} ${TONEZONE_LIB}"
+	 TONEZONE_INCLUDE="-I${TONEZONE_DIR}/include"
+	 if test "xtonezone.h" != "x" ; then
+	    as_ac_Header=`echo "ac_cv_header_${TONEZONE_DIR}/include/tonezone.h" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  { echo "$as_me:$LINENO: checking for ${TONEZONE_DIR}/include/tonezone.h" >&5
+echo $ECHO_N "checking for ${TONEZONE_DIR}/include/tonezone.h... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lgsm ${gsmlibdir} $LIBS"
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking ${TONEZONE_DIR}/include/tonezone.h usability" >&5
+echo $ECHO_N "checking ${TONEZONE_DIR}/include/tonezone.h usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-
-/* 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 gsm_create ();
-int
-main ()
-{
-return gsm_create ();
-  ;
-  return 0;
-}
+$ac_includes_default
+#include <${TONEZONE_DIR}/include/tonezone.h>
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
@@ -17400,7 +17469,7 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
+	 { ac_try='test -s conftest.$ac_objext'
   { (case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
@@ -17410,47 +17479,295 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_gsm_gsm_create=yes
+  ac_header_compiler=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_lib_gsm_gsm_create=no
+	ac_header_compiler=no
 fi
 
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_gsm_gsm_create" >&5
-echo "${ECHO_T}$ac_cv_lib_gsm_gsm_create" >&6; }
-if test $ac_cv_lib_gsm_gsm_create = yes; then
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
 
-cat >>confdefs.h <<_ACEOF
-#define HAVE_GSM 1
+# Is the header present?
+{ echo "$as_me:$LINENO: checking ${TONEZONE_DIR}/include/tonezone.h presence" >&5
+echo $ECHO_N "checking ${TONEZONE_DIR}/include/tonezone.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <${TONEZONE_DIR}/include/tonezone.h>
 _ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
 
+  ac_header_preproc=no
 fi
 
-      if test "${ac_cv_lib_gsm_gsm_create}" = "yes"; then
-	 gsm_LIB="-lgsm"
-	 if test "x${GSM_DIR}" != "x"; then
-	    gsm_LIB="${gsmlibdir} ${gsm_LIB}"
-	    gsm_INCLUDE="-I${GSM_DIR}/include"
-	 fi
-	 PBX_LIBgsm=1
-	 GSM_INTERNAL="no"
-      fi
-   fi
-   if test "${GSM_INTERNAL}" = "yes"; then
-      gsm_LIB="internal"
-      PBX_LIBgsm=1
-   fi
-   if test "x${PBX_LIBgsm}" = "x0"; then
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: ${TONEZONE_DIR}/include/tonezone.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: ${TONEZONE_DIR}/include/tonezone.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${TONEZONE_DIR}/include/tonezone.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: ${TONEZONE_DIR}/include/tonezone.h: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: ${TONEZONE_DIR}/include/tonezone.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: ${TONEZONE_DIR}/include/tonezone.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${TONEZONE_DIR}/include/tonezone.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: ${TONEZONE_DIR}/include/tonezone.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${TONEZONE_DIR}/include/tonezone.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: ${TONEZONE_DIR}/include/tonezone.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${TONEZONE_DIR}/include/tonezone.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: ${TONEZONE_DIR}/include/tonezone.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${TONEZONE_DIR}/include/tonezone.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: ${TONEZONE_DIR}/include/tonezone.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${TONEZONE_DIR}/include/tonezone.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: ${TONEZONE_DIR}/include/tonezone.h: in the future, the compiler will take precedence" >&2;}
+
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for ${TONEZONE_DIR}/include/tonezone.h" >&5
+echo $ECHO_N "checking for ${TONEZONE_DIR}/include/tonezone.h... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  TONEZONE_HEADER_FOUND=1
+else
+  TONEZONE_HEADER_FOUND=0
+fi
+
+
+	 fi
+      else
+	 if test "xtonezone.h" != "x" ; then
+            if test "${ac_cv_header_tonezone_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for tonezone.h" >&5
+echo $ECHO_N "checking for tonezone.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_tonezone_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_tonezone_h" >&5
+echo "${ECHO_T}$ac_cv_header_tonezone_h" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking tonezone.h usability" >&5
+echo $ECHO_N "checking tonezone.h usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <tonezone.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_header_compiler=no
+fi
+
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking tonezone.h presence" >&5
+echo $ECHO_N "checking tonezone.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <tonezone.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: tonezone.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: tonezone.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: tonezone.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: tonezone.h: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: tonezone.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: tonezone.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: tonezone.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: tonezone.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: tonezone.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: tonezone.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: tonezone.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: tonezone.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: tonezone.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: tonezone.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: tonezone.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: tonezone.h: in the future, the compiler will take precedence" >&2;}
+
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for tonezone.h" >&5
+echo $ECHO_N "checking for tonezone.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_tonezone_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_tonezone_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_tonezone_h" >&5
+echo "${ECHO_T}$ac_cv_header_tonezone_h" >&6; }
+
+fi
+if test $ac_cv_header_tonezone_h = yes; then
+  TONEZONE_HEADER_FOUND=1
+else
+  TONEZONE_HEADER_FOUND=0
+fi
+
+
+	 fi
+      fi
+      if test "x${TONEZONE_HEADER_FOUND}" = "x0" ; then
+         if test ! -z "${TONEZONE_MANDATORY}" ;
+         then
+            echo " ***"
+            echo " *** It appears that you do not have the tonezone development package installed."
+            echo " *** Please install it to include tonezone support, or re-run configure"
+            echo " *** without explicitly specifying --with-tonezone"
+            exit 1
+         fi
+         TONEZONE_LIB=""
+         TONEZONE_INCLUDE=""
+         PBX_LIBTONEZONE=0
+      else
+         PBX_LIBTONEZONE=1
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_TONEZONE 1
+_ACEOF
+
+      fi
+   elif test ! -z "${TONEZONE_MANDATORY}";
+   then
       echo "***"
-      echo "*** The GSM installation on this system appears to be broken."
+      echo "*** The tonezone installation on this system appears to be broken."
       echo "*** Either correct the installation, or run configure"
-      echo "*** including --without-gsm"
+      echo "*** without explicity specifying --with-tonezone"
       exit 1
    fi
 fi
@@ -17458,279 +17775,532 @@ fi
 
 
 
+fi
+
 
 
-# Check whether --with-pq was given.
-if test "${with_pq+set}" = set; then
-  withval=$with_pq;
+# Check whether --with-vorbis was given.
+if test "${with_vorbis+set}" = set; then
+  withval=$with_vorbis;
 case ${withval} in
      n|no)
-     USE_PQ=no
+     USE_VORBIS=no
      ;;
      y|ye|yes)
-     PQ_MANDATORY="yes"
+     VORBIS_MANDATORY="yes"
      ;;
      *)
-     PQ_DIR="${withval}"
-     PQ_MANDATORY="yes"
+     VORBIS_DIR="${withval}"
+     VORBIS_MANDATORY="yes"
      ;;
 esac
 
 fi
 
 
-PBX_LIBpq=0
-PG_CONFIG=No
-if test "${USE_PQ}" != "no"; then
-   if test "x${PQ_DIR}" != "x"; then
-      if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}pg_config", so it can be a program name with args.
-set dummy ${ac_tool_prefix}pg_config; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_path_PG_CONFIG+set}" = set; then
+PBX_LIBVORBIS=0
+
+if test "${USE_VORBIS}" != "no"; then
+   pbxlibdir=""
+   if test "x${VORBIS_DIR}" != "x"; then
+      pbxlibdir="-L${vorbis_DIR}/lib"
+   fi
+   { echo "$as_me:$LINENO: checking for vorbis_info_init in -lvorbis" >&5
+echo $ECHO_N "checking for vorbis_info_init in -lvorbis... $ECHO_C" >&6; }
+if test "${ac_cv_lib_vorbis_vorbis_info_init+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lvorbis ${pbxlibdir} -lm -lvorbisenc $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* 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 vorbis_info_init ();
+int
+main ()
+{
+return vorbis_info_init ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_vorbis_vorbis_info_init=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_vorbis_vorbis_info_init=no
+fi
+
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_vorbis_vorbis_info_init" >&5
+echo "${ECHO_T}$ac_cv_lib_vorbis_vorbis_info_init" >&6; }
+if test $ac_cv_lib_vorbis_vorbis_info_init = yes; then
+  AST_VORBIS_FOUND=yes
+else
+  AST_VORBIS_FOUND=no
+fi
+
+
+   if test "${AST_VORBIS_FOUND}" = "yes"; then
+      VORBIS_LIB="-lvorbis -lm -lvorbisenc"
+      VORBIS_HEADER_FOUND="1"
+      if test "x${VORBIS_DIR}" != "x"; then
+         VORBIS_LIB="${pbxlibdir} ${VORBIS_LIB}"
+	 VORBIS_INCLUDE="-I${VORBIS_DIR}/include"
+	 if test "xvorbis/codec.h" != "x" ; then
+	    as_ac_Header=`echo "ac_cv_header_${VORBIS_DIR}/include/vorbis/codec.h" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  { echo "$as_me:$LINENO: checking for ${VORBIS_DIR}/include/vorbis/codec.h" >&5
+echo $ECHO_N "checking for ${VORBIS_DIR}/include/vorbis/codec.h... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking ${VORBIS_DIR}/include/vorbis/codec.h usability" >&5
+echo $ECHO_N "checking ${VORBIS_DIR}/include/vorbis/codec.h usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <${VORBIS_DIR}/include/vorbis/codec.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_header_compiler=no
+fi
+
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking ${VORBIS_DIR}/include/vorbis/codec.h presence" >&5
+echo $ECHO_N "checking ${VORBIS_DIR}/include/vorbis/codec.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <${VORBIS_DIR}/include/vorbis/codec.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: ${VORBIS_DIR}/include/vorbis/codec.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: ${VORBIS_DIR}/include/vorbis/codec.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${VORBIS_DIR}/include/vorbis/codec.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: ${VORBIS_DIR}/include/vorbis/codec.h: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: ${VORBIS_DIR}/include/vorbis/codec.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: ${VORBIS_DIR}/include/vorbis/codec.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${VORBIS_DIR}/include/vorbis/codec.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: ${VORBIS_DIR}/include/vorbis/codec.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${VORBIS_DIR}/include/vorbis/codec.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: ${VORBIS_DIR}/include/vorbis/codec.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${VORBIS_DIR}/include/vorbis/codec.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: ${VORBIS_DIR}/include/vorbis/codec.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${VORBIS_DIR}/include/vorbis/codec.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: ${VORBIS_DIR}/include/vorbis/codec.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${VORBIS_DIR}/include/vorbis/codec.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: ${VORBIS_DIR}/include/vorbis/codec.h: in the future, the compiler will take precedence" >&2;}
+
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for ${VORBIS_DIR}/include/vorbis/codec.h" >&5
+echo $ECHO_N "checking for ${VORBIS_DIR}/include/vorbis/codec.h... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  case $PG_CONFIG in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_PG_CONFIG="$PG_CONFIG" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in ${PQ_DIR}/bin
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_PG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  VORBIS_HEADER_FOUND=1
+else
+  VORBIS_HEADER_FOUND=0
+fi
+
+
+	 fi
+      else
+	 if test "xvorbis/codec.h" != "x" ; then
+            if test "${ac_cv_header_vorbis_codec_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for vorbis/codec.h" >&5
+echo $ECHO_N "checking for vorbis/codec.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_vorbis_codec_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_vorbis_codec_h" >&5
+echo "${ECHO_T}$ac_cv_header_vorbis_codec_h" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking vorbis/codec.h usability" >&5
+echo $ECHO_N "checking vorbis/codec.h usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <vorbis/codec.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
 
-  ;;
+	ac_header_compiler=no
+fi
+
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking vorbis/codec.h presence" >&5
+echo $ECHO_N "checking vorbis/codec.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <vorbis/codec.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
 esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
 fi
-PG_CONFIG=$ac_cv_path_PG_CONFIG
-if test -n "$PG_CONFIG"; then
-  { echo "$as_me:$LINENO: result: $PG_CONFIG" >&5
-echo "${ECHO_T}$PG_CONFIG" >&6; }
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
 fi
 
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
 
-fi
-if test -z "$ac_cv_path_PG_CONFIG"; then
-  ac_pt_PG_CONFIG=$PG_CONFIG
-  # Extract the first word of "pg_config", so it can be a program name with args.
-set dummy pg_config; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_path_ac_pt_PG_CONFIG+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  case $ac_pt_PG_CONFIG in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_ac_pt_PG_CONFIG="$ac_pt_PG_CONFIG" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in ${PQ_DIR}/bin
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_ac_pt_PG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: vorbis/codec.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: vorbis/codec.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: vorbis/codec.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: vorbis/codec.h: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: vorbis/codec.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: vorbis/codec.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: vorbis/codec.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: vorbis/codec.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: vorbis/codec.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: vorbis/codec.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: vorbis/codec.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: vorbis/codec.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: vorbis/codec.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: vorbis/codec.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: vorbis/codec.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: vorbis/codec.h: in the future, the compiler will take precedence" >&2;}
 
-  ;;
+    ;;
 esac
-fi
-ac_pt_PG_CONFIG=$ac_cv_path_ac_pt_PG_CONFIG
-if test -n "$ac_pt_PG_CONFIG"; then
-  { echo "$as_me:$LINENO: result: $ac_pt_PG_CONFIG" >&5
-echo "${ECHO_T}$ac_pt_PG_CONFIG" >&6; }
+{ echo "$as_me:$LINENO: checking for vorbis/codec.h" >&5
+echo $ECHO_N "checking for vorbis/codec.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_vorbis_codec_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  ac_cv_header_vorbis_codec_h=$ac_header_preproc
 fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_vorbis_codec_h" >&5
+echo "${ECHO_T}$ac_cv_header_vorbis_codec_h" >&6; }
 
-  if test "x$ac_pt_PG_CONFIG" = x; then
-    PG_CONFIG="No"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
-    PG_CONFIG=$ac_pt_PG_CONFIG
-  fi
+fi
+if test $ac_cv_header_vorbis_codec_h = yes; then
+  VORBIS_HEADER_FOUND=1
 else
-  PG_CONFIG="$ac_cv_path_PG_CONFIG"
+  VORBIS_HEADER_FOUND=0
 fi
 
-      if test x"${PG_CONFIG}" = xNo; then
-         echo "***"
-         echo "*** pg_config was not found in the path you specified:"
-         echo "*** ${PQ_DIR}/bin"
-         echo "*** Either correct the installation, or run configure"
-         echo "*** including --without-pq"
-         exit 1
+
+	 fi
       fi
-   else
-      if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}pg_config", so it can be a program name with args.
-set dummy ${ac_tool_prefix}pg_config; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_path_PG_CONFIG+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  case $PG_CONFIG in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_PG_CONFIG="$PG_CONFIG" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_PG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
+      if test "x${VORBIS_HEADER_FOUND}" = "x0" ; then
+         if test ! -z "${VORBIS_MANDATORY}" ;
+         then
+            echo " ***"
+            echo " *** It appears that you do not have the vorbis development package installed."
+            echo " *** Please install it to include Vorbis support, or re-run configure"
+            echo " *** without explicitly specifying --with-vorbis"
+            exit 1
+         fi
+         VORBIS_LIB=""
+         VORBIS_INCLUDE=""
+         PBX_LIBVORBIS=0
+      else
+         PBX_LIBVORBIS=1
 
-  ;;
-esac
-fi
-PG_CONFIG=$ac_cv_path_PG_CONFIG
-if test -n "$PG_CONFIG"; then
-  { echo "$as_me:$LINENO: result: $PG_CONFIG" >&5
-echo "${ECHO_T}$PG_CONFIG" >&6; }
-else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+cat >>confdefs.h <<_ACEOF
+#define HAVE_VORBIS 1
+_ACEOF
+
+      fi
+   elif test ! -z "${VORBIS_MANDATORY}";
+   then
+      echo "***"
+      echo "*** The Vorbis installation on this system appears to be broken."
+      echo "*** Either correct the installation, or run configure"
+      echo "*** without explicity specifying --with-vorbis"
+      exit 1
+   fi
 fi
 
 
-fi
-if test -z "$ac_cv_path_PG_CONFIG"; then
-  ac_pt_PG_CONFIG=$PG_CONFIG
-  # Extract the first word of "pg_config", so it can be a program name with args.
-set dummy pg_config; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_path_ac_pt_PG_CONFIG+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  case $ac_pt_PG_CONFIG in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_ac_pt_PG_CONFIG="$ac_pt_PG_CONFIG" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_ac_pt_PG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
 
-  ;;
-esac
-fi
-ac_pt_PG_CONFIG=$ac_cv_path_ac_pt_PG_CONFIG
-if test -n "$ac_pt_PG_CONFIG"; then
-  { echo "$as_me:$LINENO: result: $ac_pt_PG_CONFIG" >&5
-echo "${ECHO_T}$ac_pt_PG_CONFIG" >&6; }
-else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-fi
 
-  if test "x$ac_pt_PG_CONFIG" = x; then
-    PG_CONFIG="No"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
-ac_tool_warned=yes ;;
+
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+
+
+# Check whether --with-vpb was given.
+if test "${with_vpb+set}" = set; then
+  withval=$with_vpb;
+case ${withval} in
+     n|no)
+     USE_VPB=no
+     ;;
+     y|ye|yes)
+     VPB_MANDATORY="yes"
+     ;;
+     *)
+     VPB_DIR="${withval}"
+     VPB_MANDATORY="yes"
+     ;;
 esac
-    PG_CONFIG=$ac_pt_PG_CONFIG
-  fi
-else
-  PG_CONFIG="$ac_cv_path_PG_CONFIG"
-fi
 
-   fi
 fi
 
-if test x"${PG_CONFIG}" != xNo; then
-   PQ_libdir=`pg_config --libdir`
-   PQ_includedir=`pg_config --includedir`
+if test "${USE_VPB}" != "no"; then
+   echo -n "checking for vpb_open in -lvpb... "
+   saved_libs="${LIBS}"
+   saved_cppflags="${CPPFLAGS}"
+   if test "x${VPB_DIR}" != "x"; then
+      LIBS="${LIBS} -L${VPB_DIR}/lib"
+      CPPFLAGS="${CPPFLAGS} -I${VPB_DIR}/include"
+   fi
+   LIBS="${LIBS} -lvpb -lpthread"
+   cat >conftest.$ac_ext <<_ACEOF
 
-   { echo "$as_me:$LINENO: checking for PQexec in -lpq" >&5
-echo $ECHO_N "checking for PQexec in -lpq... $ECHO_C" >&6; }
-if test "${ac_cv_lib_pq_PQexec+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpq -L${PQ_libdir} -lz $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
+	/* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* 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 PQexec ();
+#include <vpbapi.h>
 int
 main ()
 {
-return PQexec ();
+int q = vpb_open(0,0);
   ;
   return 0;
 }
+
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
 if { (ac_try="$ac_link"
@@ -17746,7 +18316,7 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
   { (case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
@@ -17766,169 +18336,191 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_pq_PQexec=yes
+  	{ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+		ac_cv_lib_vpb_vpb_open="yes"
+
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_lib_pq_PQexec=no
+		{ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+		ac_cv_lib_vpb_vpb_open="no"
+
+
 fi
 
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_pq_PQexec" >&5
-echo "${ECHO_T}$ac_cv_lib_pq_PQexec" >&6; }
-if test $ac_cv_lib_pq_PQexec = yes; then
+   LIBS="${saved_libs}"
+   CPPFLAGS="${saved_cppflags}"
+   PBX_LIBvpb=0
+   if test "${ac_cv_lib_vpb_vpb_open}" = "yes"; then
+	VPB_LIB="-lvpb"
+	if test "${VPB_DIR}" != ""; then
+	   VPB_LIB="-L${VPB_DIR}/lib ${VPB_LIB}"
+	   VPB_INCLUDE="-I${VPB_DIR}/include"
 
-cat >>confdefs.h <<_ACEOF
-#define HAVE_PQ 1
-_ACEOF
+	fi
 
-fi
+	PBX_LIBvpb=1
 
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_LIBVPB 1
+_ACEOF
 
-   if test "${ac_cv_lib_pq_PQexec}" = "yes"; then
-      pq_LIB="-L${PQ_libdir} -lpq -lz"
-      pq_INCLUDE="-I${PQ_includedir}"
-      PBX_LIBpq=1
-   elif test ! -z "${PQ_MANDATORY}";
+   elif test ! -z "${VPB_MANDATORY}";
    then
       echo "***"
-      echo "*** The PostgreSQL installation on this system appears to be broken."
+      echo "*** The VoiceTronix (vpb) installation on this system appears to be broken."
       echo "*** Either correct the installation, or run configure"
-      echo "*** including --without-pq"
+      echo "*** including --without-vpb."
       exit 1
    fi
 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
+
+
 
 
-NETSNMP_LIBS=
-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
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_path_NET_SNMP_CONFIG+set}" = set; then
+# Check whether --with-z was given.
+if test "${with_z+set}" = set; then
+  withval=$with_z;
+case ${withval} in
+     n|no)
+     USE_ZLIB=no
+     ;;
+     y|ye|yes)
+     ZLIB_MANDATORY="yes"
+     ;;
+     *)
+     ZLIB_DIR="${withval}"
+     ZLIB_MANDATORY="yes"
+     ;;
+esac
+
+fi
+
+
+PBX_LIBZLIB=0
+
+if test "${USE_ZLIB}" != "no"; then
+   pbxlibdir=""
+   if test "x${ZLIB_DIR}" != "x"; then
+      pbxlibdir="-L${z_DIR}/lib"
+   fi
+   { echo "$as_me:$LINENO: checking for compress in -lz" >&5
+echo $ECHO_N "checking for compress in -lz... $ECHO_C" >&6; }
+if test "${ac_cv_lib_z_compress+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  case $NET_SNMP_CONFIG in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_NET_SNMP_CONFIG="$NET_SNMP_CONFIG" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_NET_SNMP_CONFIG="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lz ${pbxlibdir}  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* 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 compress ();
+int
+main ()
+{
+return compress ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
 esac
-fi
-NET_SNMP_CONFIG=$ac_cv_path_NET_SNMP_CONFIG
-if test -n "$NET_SNMP_CONFIG"; then
-  { echo "$as_me:$LINENO: result: $NET_SNMP_CONFIG" >&5
-echo "${ECHO_T}$NET_SNMP_CONFIG" >&6; }
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_z_compress=yes
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-fi
-
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
 
+	ac_cv_lib_z_compress=no
 fi
-if test -z "$ac_cv_path_NET_SNMP_CONFIG"; then
-  ac_pt_NET_SNMP_CONFIG=$NET_SNMP_CONFIG
-  # Extract the first word of "net-snmp-config", so it can be a program name with args.
-set dummy net-snmp-config; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_path_ac_pt_NET_SNMP_CONFIG+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  case $ac_pt_NET_SNMP_CONFIG in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_ac_pt_NET_SNMP_CONFIG="$ac_pt_NET_SNMP_CONFIG" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_ac_pt_NET_SNMP_CONFIG="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
 
-  ;;
-esac
-fi
-ac_pt_NET_SNMP_CONFIG=$ac_cv_path_ac_pt_NET_SNMP_CONFIG
-if test -n "$ac_pt_NET_SNMP_CONFIG"; then
-  { echo "$as_me:$LINENO: result: $ac_pt_NET_SNMP_CONFIG" >&5
-echo "${ECHO_T}$ac_pt_NET_SNMP_CONFIG" >&6; }
-else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
 fi
-
-  if test "x$ac_pt_NET_SNMP_CONFIG" = x; then
-    NET_SNMP_CONFIG="No"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
-    NET_SNMP_CONFIG=$ac_pt_NET_SNMP_CONFIG
-  fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_z_compress" >&5
+echo "${ECHO_T}$ac_cv_lib_z_compress" >&6; }
+if test $ac_cv_lib_z_compress = yes; then
+  AST_ZLIB_FOUND=yes
 else
-  NET_SNMP_CONFIG="$ac_cv_path_NET_SNMP_CONFIG"
-fi
-
-if test "x${NET_SNMP_CONFIG}" != "xNo" ; then
-   NETSNMP_LIBS=`${NET_SNMP_CONFIG} --agent-libs`
-   PBX_NETSNMP=1
+  AST_ZLIB_FOUND=no
 fi
 
 
-
-if test "${ac_cv_header_h323_h+set}" = set; then
-  { echo "$as_me:$LINENO: checking for h323.h" >&5
-echo $ECHO_N "checking for h323.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_h323_h+set}" = set; then
+   if test "${AST_ZLIB_FOUND}" = "yes"; then
+      ZLIB_LIB="-lz "
+      ZLIB_HEADER_FOUND="1"
+      if test "x${ZLIB_DIR}" != "x"; then
+         ZLIB_LIB="${pbxlibdir} ${ZLIB_LIB}"
+	 ZLIB_INCLUDE="-I${ZLIB_DIR}/include"
+	 if test "xzlib.h" != "x" ; then
+	    as_ac_Header=`echo "ac_cv_header_${ZLIB_DIR}/include/zlib.h" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  { echo "$as_me:$LINENO: checking for ${ZLIB_DIR}/include/zlib.h" >&5
+echo $ECHO_N "checking for ${ZLIB_DIR}/include/zlib.h... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_h323_h" >&5
-echo "${ECHO_T}$ac_cv_header_h323_h" >&6; }
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking h323.h usability" >&5
-echo $ECHO_N "checking h323.h usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking ${ZLIB_DIR}/include/zlib.h usability" >&5
+echo $ECHO_N "checking ${ZLIB_DIR}/include/zlib.h usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -17936,7 +18528,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <h323.h>
+#include <${ZLIB_DIR}/include/zlib.h>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -17985,15 +18577,15 @@ rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking h323.h presence" >&5
-echo $ECHO_N "checking h323.h presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking ${ZLIB_DIR}/include/zlib.h presence" >&5
+echo $ECHO_N "checking ${ZLIB_DIR}/include/zlib.h presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <h323.h>
+#include <${ZLIB_DIR}/include/zlib.h>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -18033,191 +18625,86 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: h323.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: h323.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: h323.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: h323.h: proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${ZLIB_DIR}/include/zlib.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: ${ZLIB_DIR}/include/zlib.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${ZLIB_DIR}/include/zlib.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: ${ZLIB_DIR}/include/zlib.h: proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: h323.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: h323.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: h323.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: h323.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: h323.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: h323.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: h323.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: h323.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: h323.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: h323.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: h323.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: h323.h: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for h323.h" >&5
-echo $ECHO_N "checking for h323.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_h323_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_cv_header_h323_h=$ac_header_preproc
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_h323_h" >&5
-echo "${ECHO_T}$ac_cv_header_h323_h" >&6; }
-
-fi
-if test $ac_cv_header_h323_h = yes; then
-  PBX_H323=1
-else
-  PBX_H323=0
-fi
-
-
-
-
-{ echo "$as_me:$LINENO: checking for linux/ixjuser.h" >&5
-echo $ECHO_N "checking for linux/ixjuser.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_linux_ixjuser_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-				   #include <linux/version.h>
-				   #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-				   #include <linux/compiler.h>
-				   #endif
-
-
-#include <linux/ixjuser.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_header_linux_ixjuser_h=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_header_linux_ixjuser_h=no
-fi
-
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_linux_ixjuser_h" >&5
-echo "${ECHO_T}$ac_cv_header_linux_ixjuser_h" >&6; }
-if test $ac_cv_header_linux_ixjuser_h = yes; then
-  PBX_IXJUSER=1
-else
-  PBX_IXJUSER=0
-fi
-
-
-
-
-ac_ext=cpp
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-
-
-
-# Check whether --with-vpb was given.
-if test "${with_vpb+set}" = set; then
-  withval=$with_vpb;
-case ${withval} in
-     n|no)
-     USE_VPB=no
-     ;;
-     y|ye|yes)
-     VPB_MANDATORY="yes"
-     ;;
-     *)
-     VPB_DIR="${withval}"
-     VPB_MANDATORY="yes"
-     ;;
+    { echo "$as_me:$LINENO: WARNING: ${ZLIB_DIR}/include/zlib.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: ${ZLIB_DIR}/include/zlib.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${ZLIB_DIR}/include/zlib.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: ${ZLIB_DIR}/include/zlib.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${ZLIB_DIR}/include/zlib.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: ${ZLIB_DIR}/include/zlib.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${ZLIB_DIR}/include/zlib.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: ${ZLIB_DIR}/include/zlib.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${ZLIB_DIR}/include/zlib.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: ${ZLIB_DIR}/include/zlib.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ${ZLIB_DIR}/include/zlib.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: ${ZLIB_DIR}/include/zlib.h: in the future, the compiler will take precedence" >&2;}
+
+    ;;
 esac
+{ echo "$as_me:$LINENO: checking for ${ZLIB_DIR}/include/zlib.h" >&5
+echo $ECHO_N "checking for ${ZLIB_DIR}/include/zlib.h... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
 
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  ZLIB_HEADER_FOUND=1
+else
+  ZLIB_HEADER_FOUND=0
 fi
 
-if test "${USE_VPB}" != "no"; then
-   echo -n "checking for vpb_open in -lvpb... "
-   saved_libs="${LIBS}"
-   saved_cppflags="${CPPFLAGS}"
-   if test "x${VPB_DIR}" != "x"; then
-      LIBS="${LIBS} -L${VPB_DIR}/lib"
-      CPPFLAGS="${CPPFLAGS} -I${VPB_DIR}/include"
-   fi
-   LIBS="${LIBS} -lvpb -lpthread"
 
+	 fi
+      else
+	 if test "xzlib.h" != "x" ; then
+            if test "${ac_cv_header_zlib_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for zlib.h" >&5
+echo $ECHO_N "checking for zlib.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_zlib_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_zlib_h" >&5
+echo "${ECHO_T}$ac_cv_header_zlib_h" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking zlib.h usability" >&5
+echo $ECHO_N "checking zlib.h usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
-
-	/* confdefs.h.  */
+/* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <vpbapi.h>
-int
-main ()
-{
-int q = vpb_open(0,0);
-  ;
-  return 0;
-}
-
+$ac_includes_default
+#include <zlib.h>
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
   { (case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
@@ -18227,7 +18714,7 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
+	 { ac_try='test -s conftest.$ac_objext'
   { (case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
@@ -18237,187 +18724,202 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  	{ echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
-		ac_cv_lib_vpb_vpb_open="yes"
-
+  ac_header_compiler=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-		{ echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-		ac_cv_lib_vpb_vpb_open="no"
-
-
-fi
-
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-   LIBS="${saved_libs}"
-   CPPFLAGS="${saved_cppflags}"
-   PBX_LIBvpb=0
-   if test "${ac_cv_lib_vpb_vpb_open}" = "yes"; then
-	VPB_LIB="-lvpb"
-	if test "${VPB_DIR}" != ""; then
-	   VPB_LIB="-L${VPB_DIR}/lib ${VPB_LIB}"
-	   VPB_INCLUDE="-I${VPB_DIR}/include"
-
-	fi
-
-	PBX_LIBvpb=1
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_LIBVPB 1
-_ACEOF
-
-   elif test ! -z "${VPB_MANDATORY}";
-   then
-      echo "***"
-      echo "*** The VoiceTronix (vpb) installation on this system appears to be broken."
-      echo "*** Either correct the installation, or run configure"
-      echo "*** including --without-vpb."
-      exit 1
-   fi
-fi
-
-
-
-# Check whether --with-qt was given.
-if test "${with_qt+set}" = set; then
-  withval=$with_qt;
-case ${withval} in
-     n|no)
-     USE_QT=no
-     ;;
-     y|ye|yes)
-     QT_MANDATORY="yes"
-     ;;
-     *)
-     QT_DIR="${withval}"
-     QT_MANDATORY="yes"
-     ;;
-esac
-
+	ac_header_compiler=no
 fi
 
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
 
-PBX_QT=0
-if test "${USE_QT}" != "no"; then
-   echo -n "checking for QDate in -lqt... "
-   saved_libs="${LIBS}"
-   saved_cppflags="${CPPFLAGS}"
-   if test "x${QT_DIR}" != "x"; then
-      LIBS="${LIBS} -L${QT_DIR}/lib"
-      CPPFLAGS="${CPPFLAGS} -I${QT_DIR}/include"
-   fi
-   LIBS="${LIBS} -lqt"
-   qtlib="qt"
-   cat >conftest.$ac_ext <<_ACEOF
-
-		/* confdefs.h.  */
+# Is the header present?
+{ echo "$as_me:$LINENO: checking zlib.h presence" >&5
+echo $ECHO_N "checking zlib.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <qt3/qdatetime.h>
-int
-main ()
-{
-QDate date();
-  ;
-  return 0;
-}
-
+#include <zlib.h>
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
+if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: zlib.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: zlib.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: zlib.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: zlib.h: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: zlib.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: zlib.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: zlib.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: zlib.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: zlib.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: zlib.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: zlib.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: zlib.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: zlib.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: zlib.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: zlib.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: zlib.h: in the future, the compiler will take precedence" >&2;}
+
+    ;;
 esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
+{ echo "$as_me:$LINENO: checking for zlib.h" >&5
+echo $ECHO_N "checking for zlib.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_zlib_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_zlib_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_zlib_h" >&5
+echo "${ECHO_T}$ac_cv_header_zlib_h" >&6; }
+
+fi
+if test $ac_cv_header_zlib_h = yes; then
+  ZLIB_HEADER_FOUND=1
+else
+  ZLIB_HEADER_FOUND=0
+fi
+
+
+	 fi
+      fi
+      if test "x${ZLIB_HEADER_FOUND}" = "x0" ; then
+         if test ! -z "${ZLIB_MANDATORY}" ;
+         then
+            echo " ***"
+            echo " *** It appears that you do not have the z development package installed."
+            echo " *** Please install it to include zlib support, or re-run configure"
+            echo " *** without explicitly specifying --with-z"
+            exit 1
+         fi
+         ZLIB_LIB=""
+         ZLIB_INCLUDE=""
+         PBX_LIBZLIB=0
+      else
+         PBX_LIBZLIB=1
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_ZLIB 1
+_ACEOF
+
+      fi
+   elif test ! -z "${ZLIB_MANDATORY}";
+   then
+      echo "***"
+      echo "*** The zlib installation on this system appears to be broken."
+      echo "*** Either correct the installation, or run configure"
+      echo "*** without explicity specifying --with-z"
+      exit 1
+   fi
+fi
+
+
+
+
+
+
+# Check whether --with-zaptel was given.
+if test "${with_zaptel+set}" = set; then
+  withval=$with_zaptel;
+case ${withval} in
+     n|no)
+     USE_ZAPTEL=no
+     ;;
+     y|ye|yes)
+     ZAPTEL_MANDATORY=yes
+     ;;
+     *)
+     ZAPTEL_DIR="${withval}"
+     ZAPTEL_MANDATORY=yes
+     ;;
 esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_lib_qt_qt_date="yes"
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_lib_qt_qt_date="no"
 fi
 
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-   LIBS="${saved_libs}"
-   CPPFLAGS="${saved_cppflags}"
 
-   if test "${ac_cv_lib_qt_qt_date}" = "no"; then
-      saved_libs="${LIBS}"
-      saved_cppflags="${CPPFLAGS}"
-      if test "x${QT_DIR}" != "x"; then
-      	 LIBS="${LIBS} -L${QT_DIR}/lib"
-	 CPPFLAGS="${CPPFLAGS} -I${QT_DIR}/include"
-      fi
-      LIBS="${LIBS} -lqt-mt"
-      qtlib="qt-mt"
-      cat >conftest.$ac_ext <<_ACEOF
+PBX_ZAPTEL=0
+if test "${USE_ZAPTEL}" != "no"; then
+   echo -n "checking for zt_transcode_header in zaptel.h... "
+   saved_cppflags="${CPPFLAGS}"
+   if test "x${ZAPTEL_DIR}" != "x"; then
+      CPPFLAGS="${CPPFLAGS} -I${ZAPTEL_DIR}/include"
+   fi
+   cat >conftest.$ac_ext <<_ACEOF
 
-			/* confdefs.h.  */
+	/* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <qt3/qdatetime.h>
+#include <zaptel.h>
 int
 main ()
 {
-QDate date();
+struct zt_transcode_header test;
   ;
   return 0;
 }
 
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
   { (case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
@@ -18427,7 +18929,7 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
+	 { ac_try='test -s conftest.$ac_objext'
   { (case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
@@ -18437,212 +18939,97 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_qt_qt_date="yes"
+  	{ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+		ac_cv_zaptel_h="yes"
+
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_lib_qt_qt_date="no"
-fi
-
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-      LIBS="${saved_libs}"
-      CPPFLAGS="${saved_cppflags}"
-   fi
-
-   if test "${ac_cv_lib_qt_qt_date}" = "yes"; then
-      { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
-   else
-      { echo "$as_me:$LINENO: result: no" >&5
+		{ echo "$as_me:$LINENO: result: no" >&5
 echo "${ECHO_T}no" >&6; }
-   fi
-
-   if test "${ac_cv_lib_qt_qt_date}" = "yes"; then
-      QT_LIB="-l${qtlib}"
-      if test "${QT_DIR}" != ""; then
-      	 QT_LIB="-L${QT_DIR}/lib ${QT_LIB}"
-	 QT_INCLUDE="-I${QT_DIR}/include"
-
-      fi
-
-      PBX_QT=1
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_LIBQT 1
-_ACEOF
+		ac_cv_zaptel_h="no"
 
-      if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}moc", so it can be a program name with args.
-set dummy ${ac_tool_prefix}moc; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_path_QTMOC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  case $QTMOC in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_QTMOC="$QTMOC" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_QTMOC="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
 
-  ;;
-esac
-fi
-QTMOC=$ac_cv_path_QTMOC
-if test -n "$QTMOC"; then
-  { echo "$as_me:$LINENO: result: $QTMOC" >&5
-echo "${ECHO_T}$QTMOC" >&6; }
-else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
 fi
 
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+   CPPFLAGS="${saved_cppflags}"
+   if test "${ac_cv_zaptel_h}" = "yes"; then
+	if test "${ZAPTEL_DIR}" != ""; then
+	   ZAPTEL_INCLUDE="-I${ZAPTEL_DIR}/include"
 
-fi
-if test -z "$ac_cv_path_QTMOC"; then
-  ac_pt_QTMOC=$QTMOC
-  # Extract the first word of "moc", so it can be a program name with args.
-set dummy moc; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_path_ac_pt_QTMOC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  case $ac_pt_QTMOC in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_ac_pt_QTMOC="$ac_pt_QTMOC" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_ac_pt_QTMOC="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-  ;;
-esac
-fi
-ac_pt_QTMOC=$ac_cv_path_ac_pt_QTMOC
-if test -n "$ac_pt_QTMOC"; then
-  { echo "$as_me:$LINENO: result: $ac_pt_QTMOC" >&5
-echo "${ECHO_T}$ac_pt_QTMOC" >&6; }
-else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-fi
+	fi
+	PBX_ZAPTEL=1
 
-  if test "x$ac_pt_QTMOC" = x; then
-    QTMOC="No"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
-    QTMOC=$ac_pt_QTMOC
-  fi
-else
-  QTMOC="$ac_cv_path_QTMOC"
-fi
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_ZAPTEL 1
+_ACEOF
 
-   elif test ! -z "${QT_MANDATORY}";
+   elif test ! -z "${ZAPTEL_MANDATORY}";
    then
       echo "***"
-      echo "*** The Qt installation on this system appears to be broken."
+      echo "*** The Zaptel installation on this system appears to be broken."
       echo "*** Either correct the installation, or run configure"
-      echo "*** including --without-qt."
+      echo "*** including --without-zaptel."
       exit 1
    fi
 fi
 
 
 
-# Check whether --with-kde was given.
-if test "${with_kde+set}" = set; then
-  withval=$with_kde;
-case ${withval} in
-     n|no)
-     USE_KDE=no
-     ;;
-     y|ye|yes)
-     KDE_MANDATORY="yes"
-     ;;
-     *)
-     KDE_DIR="${withval}"
-     KDE_MANDATORY="yes"
-     ;;
-esac
-
+EDITLINE_LIBS=""
+if test "x$TERMCAP_LIB" != "x" ; then
+  EDITLINE_LIBS="$TERMCAP_LIB"
+elif test "x$TINFO_LIB" != "x" ; then
+  EDITLINE_LIBS="$TINFO_LIB"
+elif test "x$CURSES_LIB" != "x" ; then
+  EDITLINE_LIBS="$CURSES_LIB"
+elif test "x$NCURSES_LIB" != "x" ; then
+  EDITLINE_LIBS="$NCURSES_LIB"
+else
+  echo "*** termcap support not found"
+  exit 1
 fi
 
 
-PBX_KDE=0
-if test "${USE_KDE}" != "no"; then
-   echo -n "checking for crashHandler in -lkdecore... "
-   saved_ldflags="${LDFLAGS}"
-   LDFLAGS="-I${KDE_DIR}/include ${LDFLAGS} -L${KDE_DIR}/lib -lkdecore"
-	cat >conftest.$ac_ext <<_ACEOF
-
-		/* confdefs.h.  */
+if test "${ac_cv_header_h323_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for h323.h" >&5
+echo $ECHO_N "checking for h323.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_h323_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_h323_h" >&5
+echo "${ECHO_T}$ac_cv_header_h323_h" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking h323.h usability" >&5
+echo $ECHO_N "checking h323.h usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include "kcrash.h"
-int
-main ()
-{
-KCrash::defaultCrashHandler(1);
-  ;
-  return 0;
-}
-
+$ac_includes_default
+#include <h323.h>
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
+	 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
   { (case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
@@ -18652,7 +19039,7 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
+	 { ac_try='test -s conftest.$ac_objext'
   { (case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
@@ -18662,167 +19049,182 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_kde_crash="yes"
+  ac_header_compiler=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_lib_kde_crash="no"
+	ac_header_compiler=no
 fi
 
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-
-	LDFLAGS="${saved_ldflags}"
-
-	if test "${ac_cv_lib_kde_crash}" = "yes"; then
-		{ echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
-	else
-		{ echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-	fi
-
-	if test "${ac_cv_lib_kde_crash}" = "yes"; then
-		KDE_LIBS="-lkdecore -lkdeui"
-		if test "${KDE_DIR}" != ""; then
-			KDE_LIBS="-L${KDE_DIR}/lib ${KDE_LIBS}"
-			KDE_INCLUDE="-I${KDE_DIR}/include"
-
-		fi
-
-		PBX_KDE=1
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_LIBKDE 1
+# Is the header present?
+{ echo "$as_me:$LINENO: checking h323.h presence" >&5
+echo $ECHO_N "checking h323.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <h323.h>
 _ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
 
-   elif test ! -z "${KDE_MANDATORY}";
-   then
-      echo "***"
-      echo "*** The KDE installation on this system appears to be broken."
-      echo "*** Either correct the installation, or run configure"
-      echo "*** including --without-kde."
-      exit 1
-   fi
+  ac_header_preproc=no
 fi
 
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
 
-if test x"${PBX_KDE}" = x1; then
-	if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}kdeinit", so it can be a program name with args.
-set dummy ${ac_tool_prefix}kdeinit; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_path_KDEINIT+set}" = set; then
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: h323.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: h323.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: h323.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: h323.h: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: h323.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: h323.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: h323.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: h323.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: h323.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: h323.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: h323.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: h323.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: h323.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: h323.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: h323.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: h323.h: in the future, the compiler will take precedence" >&2;}
+
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for h323.h" >&5
+echo $ECHO_N "checking for h323.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_h323_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  case $KDEINIT in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_KDEINIT="$KDEINIT" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_KDEINIT="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
+  ac_cv_header_h323_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_h323_h" >&5
+echo "${ECHO_T}$ac_cv_header_h323_h" >&6; }
 
-  ;;
-esac
 fi
-KDEINIT=$ac_cv_path_KDEINIT
-if test -n "$KDEINIT"; then
-  { echo "$as_me:$LINENO: result: $KDEINIT" >&5
-echo "${ECHO_T}$KDEINIT" >&6; }
+if test $ac_cv_header_h323_h = yes; then
+  PBX_H323=1
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  PBX_H323=0
 fi
 
 
-fi
-if test -z "$ac_cv_path_KDEINIT"; then
-  ac_pt_KDEINIT=$KDEINIT
-  # Extract the first word of "kdeinit", so it can be a program name with args.
-set dummy kdeinit; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_path_ac_pt_KDEINIT+set}" = set; then
+
+
+{ echo "$as_me:$LINENO: checking for linux/ixjuser.h" >&5
+echo $ECHO_N "checking for linux/ixjuser.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_linux_ixjuser_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  case $ac_pt_KDEINIT in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_ac_pt_KDEINIT="$ac_pt_KDEINIT" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_ac_pt_KDEINIT="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
 
-  ;;
+				   #include <linux/version.h>
+				   #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+				   #include <linux/compiler.h>
+				   #endif
+
+
+#include <linux/ixjuser.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
 esac
-fi
-ac_pt_KDEINIT=$ac_cv_path_ac_pt_KDEINIT
-if test -n "$ac_pt_KDEINIT"; then
-  { echo "$as_me:$LINENO: result: $ac_pt_KDEINIT" >&5
-echo "${ECHO_T}$ac_pt_KDEINIT" >&6; }
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_header_linux_ixjuser_h=yes
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_header_linux_ixjuser_h=no
 fi
 
-  if test "x$ac_pt_KDEINIT" = x; then
-    KDEINIT="No"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
-    KDEINIT=$ac_pt_KDEINIT
-  fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_linux_ixjuser_h" >&5
+echo "${ECHO_T}$ac_cv_header_linux_ixjuser_h" >&6; }
+if test $ac_cv_header_linux_ixjuser_h = yes; then
+  PBX_IXJUSER=1
 else
-  KDEINIT="$ac_cv_path_KDEINIT"
+  PBX_IXJUSER=0
 fi
 
-	if test ! x"${KDEINIT}" = xNo; then
-   	KDEDIR=$(${DIRNAME} ${KDEINIT})
-   	KDEDIR=$(${DIRNAME} ${KDEDIR})
-	fi
-
-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
 
 
 PBX_GTK=0
@@ -18936,128 +19338,6 @@ fi
 
 
 
-PLATFORM_PTLIB="ptlib_${OSTYPE}_${MACHTYPE}_r"
-
-
-# Check whether --with-pwlib was given.
-if test "${with_pwlib+set}" = set; then
-  withval=$with_pwlib;
-case ${withval} in
-     n|no)
-     USE_PWLIB=no
-     ;;
-     y|ye|yes)
-     ;;
-     *)
-     PWLIB_DIR="${withval}"
-     ;;
-esac
-
-fi
-
-if test "${USE_PWLIB}" != "no"; then
-	echo -n "checking for existence of pwlib... "
-
-	saved_ldflags="${LDFLAGS}"
-	LDFLAGS="${LDFLAGS} -L${PWLIB_DIR} -l${PLATFORM_PTLIB}"
-
-	cat >conftest.$ac_ext <<_ACEOF
-
-	/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include "${PWDIR_DIR}ptime.h"
-int
-main ()
-{
-int q = PTime::IsDaylightSaving();
-  ;
-  return 0;
-}
-
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  	{ echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
-		ac_cv_lib_pwlib="yes"
-
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-		{ echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-		ac_cv_lib_pwlib="no"
-
-
-fi
-
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-	LDFLAGS="${saved_ldflags}"
-
-	PBX_LIBPWLIB=0
-
-   if test "${ac_cv_lib_pwlib}" = "yes"; then
-      PWLIB_LIB="-l{PLATFORM_PWLIB}"
-      if test "${PWLIB_DIR}" != ""; then
-         PWLIB_LIB="-L${PWLIB_DIR}/lib ${PWLIB_LIB}"
-	 		PWLIB_INCLUDE="-I${PWLIB_DIR}/include"
-
-      fi
-
-   	PBX_LIBPWLIB=1
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_LIBPWLIB 1
-_ACEOF
-
-   elif test ! -z "${PWLIB_DIR}";
-   then
-      echo "***"
-      echo "*** The PWLIB installation on this system appears to be broken."
-      echo "*** Either correct the installation, or run configure"
-      echo "*** including --without-pwlib"
-      exit 1
-   fi
-fi
-
-
 PBX_CURL=0
 if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}curl-config", so it can be a program name with args.
@@ -27324,8 +27604,8 @@ PBX_LIBALSA!$PBX_LIBALSA$ac_delim
 CURSES_LIB!$CURSES_LIB$ac_delim
 CURSES_INCLUDE!$CURSES_INCLUDE$ac_delim
 PBX_LIBCURSES!$PBX_LIBCURSES$ac_delim
-IKSEMEL_LIB!$IKSEMEL_LIB$ac_delim
-IKSEMEL_INCLUDE!$IKSEMEL_INCLUDE$ac_delim
+gsm_LIB!$gsm_LIB$ac_delim
+gsm_INCLUDE!$gsm_INCLUDE$ac_delim
 _ACEOF
 
   if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
@@ -27367,6 +27647,14 @@ _ACEOF
 ac_delim='%!_!# '
 for ac_last_try in false false false false false :; do
   cat >conf$$subs.sed <<_ACEOF
+PBX_LIBgsm!$PBX_LIBgsm$ac_delim
+KDE_INCLUDE!$KDE_INCLUDE$ac_delim
+KDE_LIBS!$KDE_LIBS$ac_delim
+PBX_KDE!$PBX_KDE$ac_delim
+KDEINIT!$KDEINIT$ac_delim
+KDEDIR!$KDEDIR$ac_delim
+IKSEMEL_LIB!$IKSEMEL_LIB$ac_delim
+IKSEMEL_INCLUDE!$IKSEMEL_INCLUDE$ac_delim
 PBX_LIBIKSEMEL!$PBX_LIBIKSEMEL$ac_delim
 NBS_LIB!$NBS_LIB$ac_delim
 NBS_INCLUDE!$NBS_INCLUDE$ac_delim
@@ -27374,6 +27662,9 @@ PBX_LIBNBS!$PBX_LIBNBS$ac_delim
 NCURSES_LIB!$NCURSES_LIB$ac_delim
 NCURSES_INCLUDE!$NCURSES_INCLUDE$ac_delim
 PBX_LIBNCURSES!$PBX_LIBNCURSES$ac_delim
+NETSNMP_CONFIG!$NETSNMP_CONFIG$ac_delim
+NETSNMP_LIB!$NETSNMP_LIB$ac_delim
+PBX_NETSNMP!$PBX_NETSNMP$ac_delim
 NEWT_LIB!$NEWT_LIB$ac_delim
 NEWT_INCLUDE!$NEWT_INCLUDE$ac_delim
 PBX_LIBNEWT!$PBX_LIBNEWT$ac_delim
@@ -27386,12 +27677,26 @@ PBX_LIBOGG!$PBX_LIBOGG$ac_delim
 OSPTK_LIB!$OSPTK_LIB$ac_delim
 OSPTK_INCLUDE!$OSPTK_INCLUDE$ac_delim
 PBX_LIBOSPTK!$PBX_LIBOSPTK$ac_delim
+OSS_LIB!$OSS_LIB$ac_delim
+OSS_INCLUDE!$OSS_INCLUDE$ac_delim
+PBX_LIBOSS!$PBX_LIBOSS$ac_delim
+PG_CONFIG!$PG_CONFIG$ac_delim
+pq_INCLUDE!$pq_INCLUDE$ac_delim
+pq_LIB!$pq_LIB$ac_delim
+PBX_LIBpq!$PBX_LIBpq$ac_delim
 POPT_LIB!$POPT_LIB$ac_delim
 POPT_INCLUDE!$POPT_INCLUDE$ac_delim
 PBX_LIBPOPT!$PBX_LIBPOPT$ac_delim
 LIBPRI_LIB!$LIBPRI_LIB$ac_delim
 LIBPRI_INCLUDE!$LIBPRI_INCLUDE$ac_delim
 PBX_LIBLIBPRI!$PBX_LIBLIBPRI$ac_delim
+PWLIB_INCLUDE!$PWLIB_INCLUDE$ac_delim
+PWLIB_LIB!$PWLIB_LIB$ac_delim
+PBX_LIBPWLIB!$PBX_LIBPWLIB$ac_delim
+QT_INCLUDE!$QT_INCLUDE$ac_delim
+QT_LIB!$QT_LIB$ac_delim
+QTMOC!$QTMOC$ac_delim
+PBX_QT!$PBX_QT$ac_delim
 RADIUSCLIENT_LIB!$RADIUSCLIENT_LIB$ac_delim
 RADIUSCLIENT_INCLUDE!$RADIUSCLIENT_INCLUDE$ac_delim
 PBX_LIBRADIUSCLIENT!$PBX_LIBRADIUSCLIENT$ac_delim
@@ -27413,52 +27718,27 @@ PBX_LIBTERMCAP!$PBX_LIBTERMCAP$ac_delim
 TINFO_LIB!$TINFO_LIB$ac_delim
 TINFO_INCLUDE!$TINFO_INCLUDE$ac_delim
 PBX_LIBTINFO!$PBX_LIBTINFO$ac_delim
+TONEZONE_LIB!$TONEZONE_LIB$ac_delim
+TONEZONE_INCLUDE!$TONEZONE_INCLUDE$ac_delim
+PBX_LIBTONEZONE!$PBX_LIBTONEZONE$ac_delim
 VORBIS_LIB!$VORBIS_LIB$ac_delim
 VORBIS_INCLUDE!$VORBIS_INCLUDE$ac_delim
 PBX_LIBVORBIS!$PBX_LIBVORBIS$ac_delim
+VPB_INCLUDE!$VPB_INCLUDE$ac_delim
+VPB_LIB!$VPB_LIB$ac_delim
+PBX_LIBvpb!$PBX_LIBvpb$ac_delim
 ZLIB_LIB!$ZLIB_LIB$ac_delim
 ZLIB_INCLUDE!$ZLIB_INCLUDE$ac_delim
 PBX_LIBZLIB!$PBX_LIBZLIB$ac_delim
-EDITLINE_LIBS!$EDITLINE_LIBS$ac_delim
-OSS_LIB!$OSS_LIB$ac_delim
-OSS_INCLUDE!$OSS_INCLUDE$ac_delim
-PBX_LIBOSS!$PBX_LIBOSS$ac_delim
-TONEZONE_LIB!$TONEZONE_LIB$ac_delim
-TONEZONE_INCLUDE!$TONEZONE_INCLUDE$ac_delim
-PBX_LIBTONEZONE!$PBX_LIBTONEZONE$ac_delim
 ZAPTEL_INCLUDE!$ZAPTEL_INCLUDE$ac_delim
 PBX_ZAPTEL!$PBX_ZAPTEL$ac_delim
-gsm_LIB!$gsm_LIB$ac_delim
-gsm_INCLUDE!$gsm_INCLUDE$ac_delim
-PBX_LIBgsm!$PBX_LIBgsm$ac_delim
-PG_CONFIG!$PG_CONFIG$ac_delim
-pq_INCLUDE!$pq_INCLUDE$ac_delim
-pq_LIB!$pq_LIB$ac_delim
-PBX_LIBpq!$PBX_LIBpq$ac_delim
-NET_SNMP_CONFIG!$NET_SNMP_CONFIG$ac_delim
-NETSNMP_LIBS!$NETSNMP_LIBS$ac_delim
-PBX_NETSNMP!$PBX_NETSNMP$ac_delim
+EDITLINE_LIBS!$EDITLINE_LIBS$ac_delim
 PBX_H323!$PBX_H323$ac_delim
 PBX_IXJUSER!$PBX_IXJUSER$ac_delim
-VPB_INCLUDE!$VPB_INCLUDE$ac_delim
-VPB_LIB!$VPB_LIB$ac_delim
-PBX_LIBvpb!$PBX_LIBvpb$ac_delim
-QT_INCLUDE!$QT_INCLUDE$ac_delim
-QT_LIB!$QT_LIB$ac_delim
-QTMOC!$QTMOC$ac_delim
-PBX_QT!$PBX_QT$ac_delim
-KDE_INCLUDE!$KDE_INCLUDE$ac_delim
-KDE_LIBS!$KDE_LIBS$ac_delim
-PBX_KDE!$PBX_KDE$ac_delim
-KDEINIT!$KDEINIT$ac_delim
-KDEDIR!$KDEDIR$ac_delim
 GTKCONFIG!$GTKCONFIG$ac_delim
 PBX_GTK!$PBX_GTK$ac_delim
 GTK_INCLUDE!$GTK_INCLUDE$ac_delim
 GTK_LIBS!$GTK_LIBS$ac_delim
-PWLIB_INCLUDE!$PWLIB_INCLUDE$ac_delim
-PWLIB_LIB!$PWLIB_LIB$ac_delim
-PBX_LIBPWLIB!$PBX_LIBPWLIB$ac_delim
 CURL!$CURL$ac_delim
 PBX_CURL!$PBX_CURL$ac_delim
 CURLLIBS!$CURLLIBS$ac_delim
diff --git a/configure.ac b/configure.ac
index e28aef4fc6..85e8ec8f67 100644
--- a/configure.ac
+++ b/configure.ac
@@ -193,126 +193,11 @@ AC_ARG_ENABLE(dev-mode,
 	esac])
 AC_SUBST(AST_DEVMODE)
 
+# from here on down, library checking should be done in alphabetical order
+# by the --with option name, to make things easier for the users :-)
+
 AST_EXT_LIB([asound], [snd_spcm_init], [alsa/asoundlib.h], [ALSA], [Advanced Linux Sound Architecture], [-lm -ldl])
 AST_EXT_LIB([curses], [initscr], [curses.h], [CURSES], [curses], [])
-AST_EXT_LIB([iksemel], [iks_start_sasl], [iksemel.h], [IKSEMEL], [Iksemel Jabber Library])
-AST_EXT_LIB([nbs], [nbs_connect], [nbs.h], [NBS], [Network Broadcast Sound])
-AST_EXT_LIB([ncurses], [initscr], [curses.h], [NCURSES], [ncurses], [])
-AST_EXT_LIB([newt], [newtBell], [newt.h], [NEWT], [newt])
-AST_EXT_LIB([odbc], [SQLConnect], [sql.h], [UNIXODBC], [unixODBC])
-AST_EXT_LIB([ogg], [ogg_sync_init], [], [OGG], [OGG])
-AST_EXT_LIB([osptk], [OSPPCryptoDecrypt], [osp/osp.h], [OSPTK], [OSP Toolkit], [-lcrypto -lssl])
-AST_EXT_LIB([popt], [poptStrerror], [popt.h], [POPT], [popt])
-AST_EXT_LIB([pri], [pri_call], [libpri.h], [LIBPRI], [ISDN PRI])
-AST_EXT_LIB([radiusclient-ng], [rc_read_config], [radiusclient-ng.h], [RADIUSCLIENT], [Radius Client])
-AST_EXT_LIB([speex], [speex_encode], [speex/speex.h], [SPEEX], [Speex], [-lm])
-AST_EXT_LIB([sqlite], [sqlite_exec], [sqlite.h], [SQLITE], [SQLite])
-AST_EXT_LIB([ssl], [ssl2_connect], [openssl/ssl.h], [OPENSSL], [OpenSSL], [-lcrypto])
-AST_EXT_LIB([tds], [tds_version], [tds.h], [FREETDS], [FreeTDS])
-AST_EXT_LIB([termcap], [tgetent], [], [TERMCAP], [Termcap])
-AST_EXT_LIB([tinfo], [tgetent], [], [TINFO], [Term Info])
-AST_EXT_LIB([vorbis], [vorbis_info_init], [vorbis/codec.h], [VORBIS], [Vorbis], [-lm -lvorbisenc])
-AST_EXT_LIB([z], [compress], [zlib.h], [ZLIB], [zlib])
-
-EDITLINE_LIBS=""
-if test "x$TERMCAP_LIB" != "x" ; then
-  EDITLINE_LIBS="$TERMCAP_LIB"
-elif test "x$TINFO_LIB" != "x" ; then
-  EDITLINE_LIBS="$TINFO_LIB"
-elif test "x$CURSES_LIB" != "x" ; then
-  EDITLINE_LIBS="$CURSES_LIB"
-elif test "x$NCURSES_LIB" != "x" ; then
-  EDITLINE_LIBS="$NCURSES_LIB"
-else
-  echo "*** termcap support not found"
-  exit 1
-fi
-AC_SUBST(EDITLINE_LIBS)
-
-PBX_LIBOSS=0
-AC_CHECK_HEADER([linux/soundcard.h],
-	        [
-		PBX_LIBOSS=1
-                AC_DEFINE_UNQUOTED([HAVE_OSS], 1, [Define to indicate the Open Sound System library])
-		])
-if test "$PBX_LIBOSS" = "0"; then
-   AC_CHECK_HEADER([sys/soundcard.h],
-                   [
-		   PBX_LIBossaudio=1
-		   AC_DEFINE_UNQUOTED([HAVE_OSS], 1, [Define to indicate the Open Sound System library])
-		   ])
-fi
-if test "$PBX_LIBOSS" = "0"; then
-   AST_EXT_LIB([ossaudio], [oss_ioctl_mixer], [soundcard.h], [OSS], [Open Sound System])
-fi
-
-AC_SUBST([PBX_LIBOSS])
-
-if test "${PBX_OSTYPE}" = "Linux" ; then
-  AST_EXT_LIB([tonezone], [tone_zone_find], [tonezone.h], [TONEZONE], [tonezone])
-else
-  AST_EXT_LIB([tonezone], [tone_zone_find], [tonezone.h], [TONEZONE], [tonezone], [-lm])
-fi
-
-AC_ARG_WITH([zaptel], AC_HELP_STRING([--with-zaptel=PATH], [use Zaptel files in PATH]), [
-case ${withval} in
-     n|no)
-     USE_ZAPTEL=no
-     ;;
-     y|ye|yes)
-     ZAPTEL_MANDATORY=yes
-     ;;
-     *)
-     ZAPTEL_DIR="${withval}"
-     ZAPTEL_MANDATORY=yes
-     ;;
-esac
-])
-
-PBX_ZAPTEL=0
-if test "${USE_ZAPTEL}" != "no"; then
-   echo -n "checking for usability of zaptel.h... "
-   if test "${PBX_OSTYPE}" = "Linux" ; then
-      zapheader=linux/zaptel.h
-   else
-      zapheader=zaptel.h
-   fi
-   saved_cppflags="${CPPFLAGS}"
-   if test "x${ZAPTEL_DIR}" != "x"; then
-      CPPFLAGS="${CPPFLAGS} -I${ZAPTEL_DIR}/include"
-   fi
-   AC_COMPILE_IFELSE(
-	[
-	AC_LANG_PROGRAM(
-	[#include <${zapheader}>],
-	[struct zt_transcode_header test;])
-	],
-	[	AC_MSG_RESULT(yes) 
-		ac_cv_zaptel_h="yes" 
-	],
-	[	AC_MSG_RESULT(no) 
-		ac_cv_zaptel_h="no" 
-	]
-	)
-   CPPFLAGS="${saved_cppflags}"
-   if test "${ac_cv_zaptel_h}" = "yes"; then
-	if test "${ZAPTEL_DIR}" != ""; then
-	   ZAPTEL_INCLUDE="-I${ZAPTEL_DIR}/include"
-	   AC_SUBST([ZAPTEL_INCLUDE])
-	fi
-	PBX_ZAPTEL=1
-	AC_DEFINE([HAVE_ZAPTEL], 1, [Define if your system has the Zaptel headers.])
-   elif test ! -z "${ZAPTEL_MANDATORY}"; 
-   then
-      echo "***"
-      echo "*** The Zaptel installation on this system appears to be broken."
-      echo "*** Either correct the installation, or run configure"
-      echo "*** including --without-zaptel."
-      exit 1
-   fi
-fi
-
-AC_SUBST([PBX_ZAPTEL])
 
 GSM_INTERNAL="yes"
 GSM_SYSTEM="yes"
@@ -370,6 +255,166 @@ AC_SUBST([gsm_LIB])
 AC_SUBST([gsm_INCLUDE])
 AC_SUBST([PBX_LIBgsm])
 
+AC_LANG_PUSH(C++)
+
+AC_ARG_WITH([kde], AC_HELP_STRING([--with-kde=PATH],[use KDE files in PATH]),[
+case ${withval} in
+     n|no)
+     USE_KDE=no
+     ;;
+     y|ye|yes)
+     KDE_MANDATORY="yes"
+     ;;
+     *)
+     KDE_DIR="${withval}"
+     KDE_MANDATORY="yes"
+     ;;
+esac
+])
+
+PBX_KDE=0
+if test "${USE_KDE}" != "no"; then
+   echo -n "checking for crashHandler in -lkdecore... "
+   saved_ldflags="${LDFLAGS}"
+   LDFLAGS="-I${KDE_DIR}/include ${LDFLAGS} -L${KDE_DIR}/lib -lkdecore"
+	AC_LINK_IFELSE(
+	[
+		AC_LANG_PROGRAM(
+		[#include "kcrash.h"],
+		[KCrash::defaultCrashHandler(1);])
+	],
+	[ac_cv_lib_kde_crash="yes"],
+	[ac_cv_lib_kde_crash="no"])
+		
+	LDFLAGS="${saved_ldflags}"
+	
+	if test "${ac_cv_lib_kde_crash}" = "yes"; then
+		AC_MSG_RESULT(yes) 
+	else
+		AC_MSG_RESULT(no) 
+	fi
+	
+	if test "${ac_cv_lib_kde_crash}" = "yes"; then
+		KDE_LIBS="-lkdecore -lkdeui"
+		if test "${KDE_DIR}" != ""; then
+			KDE_LIBS="-L${KDE_DIR}/lib ${KDE_LIBS}"
+			KDE_INCLUDE="-I${KDE_DIR}/include"
+			AC_SUBST([KDE_INCLUDE])
+		fi
+		AC_SUBST([KDE_LIBS])
+		PBX_KDE=1
+		AC_DEFINE([HAVE_LIBKDE], 1, [Define if your system has the KDE library])
+   elif test ! -z "${KDE_MANDATORY}"; 
+   then
+      echo "***"
+      echo "*** The KDE installation on this system appears to be broken."
+      echo "*** Either correct the installation, or run configure"
+      echo "*** including --without-kde."
+      exit 1
+   fi
+fi
+AC_SUBST([PBX_KDE])
+
+if test x"${PBX_KDE}" = x1; then
+	AC_PATH_TOOL(KDEINIT, kdeinit, No)
+	if test ! x"${KDEINIT}" = xNo; then
+   	KDEDIR=$(${DIRNAME} ${KDEINIT})
+   	KDEDIR=$(${DIRNAME} ${KDEDIR})
+	fi
+	AC_SUBST([KDEDIR])
+fi
+
+AC_LANG_POP
+
+AST_EXT_LIB([iksemel], [iks_start_sasl], [iksemel.h], [IKSEMEL], [Iksemel Jabber Library])
+AST_EXT_LIB([nbs], [nbs_connect], [nbs.h], [NBS], [Network Broadcast Sound])
+AST_EXT_LIB([ncurses], [initscr], [curses.h], [NCURSES], [ncurses], [])
+
+AC_ARG_WITH([netsnmp], AC_HELP_STRING([--with-netsnmp=PATH],[use Net-SNMP in PATH]),[
+case ${withval} in
+     n|no)
+     USE_NETSNMP=no
+     ;;
+     y|ye|yes)
+     NETSNMP_MANDATORY="yes"
+     ;;
+     *)
+     NETSNMP_DIR="${withval}"
+     NETSNMP_MANDATORY="yes"
+     ;;
+esac
+])
+
+PBX_NETSNMP=0
+NETSNMP_CONFIG=No
+if test "${USE_NETSNMP}" != "no"; then	
+   if test "x${NETSNMP_DIR}" != "x"; then
+      AC_PATH_TOOL([NETSNMP_CONFIG], [net-snmp-config], No, [${NETSNMP_DIR}/bin])
+      if test x"${NETSNMP_CONFIG}" = xNo; then
+         echo "***"
+         echo "*** net-snmp-config was not found in the path you specified:"
+         echo "*** ${NETSNMP_DIR}/bin"
+         echo "*** Either correct the installation, or run configure"
+         echo "*** including --without-netsnmp"
+         exit 1
+      fi
+   else
+      AC_PATH_TOOL([NETSNMP_CONFIG], [net-snmp-config], No)
+   fi
+fi
+
+if test x"${NETSNMP_CONFIG}" != xNo; then
+   NETSNMP_libs=`net-snmp-config --agent-libs`
+   
+   AC_CHECK_LIB([netsnmp], [snmp_register_callback], AC_DEFINE_UNQUOTED([HAVE_NETSNMP], 1,
+   [Define to indicate the Net-SNMP library]), [], ${NETSNMP_libs})
+
+   if test "${ac_cv_lib_netsnmp_snmp_register_callback}" = "yes"; then
+      NETSNMP_LIB="${NETSNMP_libs}"
+      PBX_NETSNMP=1
+   elif test ! -z "${NETSNMP_MANDATORY}";
+   then
+      echo "***"
+      echo "*** The Net-SNMP installation on this system appears to be broken."
+      echo "*** Either correct the installation, or run configure"
+      echo "*** including --without-netsnmp"
+      exit 1
+   fi
+elif test ! -z "${NETSNMP_MANDATORY}";
+then
+   echo "***"
+   echo "*** The Net-SNMP installation on this system appears to be broken."
+   echo "*** Either correct the installation, or run configure"
+   echo "*** including --without-netsnmp"
+   exit 1
+fi
+AC_SUBST([NETSNMP_LIB])
+AC_SUBST([PBX_NETSNMP])
+
+AST_EXT_LIB([newt], [newtBell], [newt.h], [NEWT], [newt])
+AST_EXT_LIB([odbc], [SQLConnect], [sql.h], [UNIXODBC], [unixODBC])
+AST_EXT_LIB([ogg], [ogg_sync_init], [], [OGG], [OGG])
+AST_EXT_LIB([osptk], [OSPPCryptoDecrypt], [osp/osp.h], [OSPTK], [OSP Toolkit], [-lcrypto -lssl])
+
+PBX_LIBOSS=0
+AC_CHECK_HEADER([linux/soundcard.h],
+	        [
+		PBX_LIBOSS=1
+                AC_DEFINE_UNQUOTED([HAVE_OSS], 1, [Define to indicate the Open Sound System library])
+		])
+if test "$PBX_LIBOSS" = "0"; then
+   AC_CHECK_HEADER([sys/soundcard.h],
+                   [
+		   PBX_LIBossaudio=1
+		   AC_DEFINE_UNQUOTED([HAVE_OSS], 1, [Define to indicate the Open Sound System library])
+		   ])
+fi
+if test "$PBX_LIBOSS" = "0"; then
+   AST_EXT_LIB([ossaudio], [oss_ioctl_mixer], [soundcard.h], [OSS], [Open Sound System])
+fi
+
+AC_SUBST([PBX_LIBOSS])
+
 AC_ARG_WITH([pq], AC_HELP_STRING([--with-pq=PATH],[use PostgreSQL files in PATH]),[
 case ${withval} in
      n|no)
@@ -422,93 +467,80 @@ if test x"${PG_CONFIG}" != xNo; then
       echo "*** including --without-pq"
       exit 1
    fi
+elif test ! -z "${PQ_MANDATORY}";
+then
+   echo "***"
+   echo "*** The PostgreSQL installation on this system appears to be broken."
+   echo "*** Either correct the installation, or run configure"
+   echo "*** including --without-pq"
+   exit 1
 fi
 AC_SUBST([pq_INCLUDE])
 AC_SUBST([pq_LIB])
 AC_SUBST([PBX_LIBpq])
 
-NETSNMP_LIBS=
-PBX_NETSNMP=0
-AC_PATH_TOOL([NET_SNMP_CONFIG], [net-snmp-config], No)
-if test "x${NET_SNMP_CONFIG}" != "xNo" ; then
-   NETSNMP_LIBS=`${NET_SNMP_CONFIG} --agent-libs`
-   PBX_NETSNMP=1
-fi
-AC_SUBST([NETSNMP_LIBS])
-AC_SUBST([PBX_NETSNMP])
-
-AC_CHECK_HEADER([h323.h], [PBX_H323=1], [PBX_H323=0])
-AC_SUBST(PBX_H323)
-
-AC_CHECK_HEADER([linux/ixjuser.h], [PBX_IXJUSER=1], [PBX_IXJUSER=0], [
-				   #include <linux/version.h>
-				   #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-				   #include <linux/compiler.h>
-				   #endif
-				   ])
-AC_SUBST(PBX_IXJUSER)
+AST_EXT_LIB([popt], [poptStrerror], [popt.h], [POPT], [popt])
+AST_EXT_LIB([pri], [pri_call], [libpri.h], [LIBPRI], [ISDN PRI])
 
-AC_LANG_PUSH(C++)
+PLATFORM_PTLIB="ptlib_${OSTYPE}_${MACHTYPE}_r"
 
-AC_ARG_WITH([vpb], AC_HELP_STRING([--with-vpb=PATH],[use vpb files in PATH]),[
+AC_ARG_WITH([pwlib], AC_HELP_STRING([--with-pwlib=PATH],[use PWLib files in PATH]),[
 case ${withval} in
      n|no)
-     USE_VPB=no
+     USE_PWLIB=no
      ;;
      y|ye|yes)
-     VPB_MANDATORY="yes"
      ;;
      *)
-     VPB_DIR="${withval}"
-     VPB_MANDATORY="yes"
+     PWLIB_DIR="${withval}"
      ;;
 esac
 ])
-if test "${USE_VPB}" != "no"; then
-   echo -n "checking for vpb_open in -lvpb... "
-   saved_libs="${LIBS}"
-   saved_cppflags="${CPPFLAGS}"
-   if test "x${VPB_DIR}" != "x"; then
-      LIBS="${LIBS} -L${VPB_DIR}/lib"
-      CPPFLAGS="${CPPFLAGS} -I${VPB_DIR}/include"
-   fi
-   LIBS="${LIBS} -lvpb -lpthread"
-   AC_LINK_IFELSE(
+if test "${USE_PWLIB}" != "no"; then
+	echo -n "checking for existence of pwlib... "
+	
+	saved_ldflags="${LDFLAGS}"
+	LDFLAGS="${LDFLAGS} -L${PWLIB_DIR} -l${PLATFORM_PTLIB}"
+	
+	AC_LINK_IFELSE(
 	[
-	AC_LANG_PROGRAM(
-	[#include <vpbapi.h>],
-	[int q = vpb_open(0,0);])
-	],
-	[	AC_MSG_RESULT(yes) 
-		ac_cv_lib_vpb_vpb_open="yes" 
-	],
-	[	AC_MSG_RESULT(no) 
-		ac_cv_lib_vpb_vpb_open="no" 
-	]
-	)
-   LIBS="${saved_libs}"
-   CPPFLAGS="${saved_cppflags}"
-   PBX_LIBvpb=0
-   if test "${ac_cv_lib_vpb_vpb_open}" = "yes"; then
-	VPB_LIB="-lvpb"
-	if test "${VPB_DIR}" != ""; then
-	   VPB_LIB="-L${VPB_DIR}/lib ${VPB_LIB}"
-	   VPB_INCLUDE="-I${VPB_DIR}/include"
-	   AC_SUBST([VPB_INCLUDE])
-	fi
-	AC_SUBST([VPB_LIB])
-	PBX_LIBvpb=1
-	AC_DEFINE([HAVE_LIBVPB], 1, [Define if your system has the VoiceTronix (vpb) libraries.])
-   elif test ! -z "${VPB_MANDATORY}"; 
+	AC_LANG_PROGRAM(
+	[#include "${PWDIR_DIR}ptime.h"],
+	[int q = PTime::IsDaylightSaving();])
+	],
+	[	AC_MSG_RESULT(yes) 
+		ac_cv_lib_pwlib="yes" 
+	],
+	[	AC_MSG_RESULT(no) 
+		ac_cv_lib_pwlib="no" 
+	]
+	)
+	LDFLAGS="${saved_ldflags}"
+
+	PBX_LIBPWLIB=0
+   
+   if test "${ac_cv_lib_pwlib}" = "yes"; then
+      PWLIB_LIB="-l{PLATFORM_PWLIB}"
+      if test "${PWLIB_DIR}" != ""; then
+         PWLIB_LIB="-L${PWLIB_DIR}/lib ${PWLIB_LIB}"
+	 		PWLIB_INCLUDE="-I${PWLIB_DIR}/include"
+	 		AC_SUBST([PWLIB_INCLUDE])
+      fi
+   	AC_SUBST([PWLIB_LIB])
+   	PBX_LIBPWLIB=1
+   	AC_DEFINE([HAVE_LIBPWLIB], 1, [Define if your system has the pwlib libraries.])
+   elif test ! -z "${PWLIB_DIR}"; 
    then
       echo "***"
-      echo "*** The VoiceTronix (vpb) installation on this system appears to be broken."
+      echo "*** The PWLIB installation on this system appears to be broken."
       echo "*** Either correct the installation, or run configure"
-      echo "*** including --without-vpb."
+      echo "*** including --without-pwlib"
       exit 1
    fi
 fi
-AC_SUBST([PBX_LIBvpb])
+AC_SUBST([PBX_LIBPWLIB])
+
+AC_LANG_PUSH(C++)
 
 AC_ARG_WITH([qt], AC_HELP_STRING([--with-qt=PATH],[use Qt files in PATH]),[
 case ${withval} in
@@ -596,144 +628,182 @@ if test "${USE_QT}" != "no"; then
 fi
 AC_SUBST([PBX_QT])
 
-AC_ARG_WITH([kde], AC_HELP_STRING([--with-kde=PATH],[use KDE files in PATH]),[
+AC_LANG_POP
+
+AST_EXT_LIB([radiusclient-ng], [rc_read_config], [radiusclient-ng.h], [RADIUSCLIENT], [Radius Client])
+AST_EXT_LIB([speex], [speex_encode], [speex/speex.h], [SPEEX], [Speex], [-lm])
+AST_EXT_LIB([sqlite], [sqlite_exec], [sqlite.h], [SQLITE], [SQLite])
+AST_EXT_LIB([ssl], [ssl2_connect], [openssl/ssl.h], [OPENSSL], [OpenSSL], [-lcrypto])
+AST_EXT_LIB([tds], [tds_version], [tds.h], [FREETDS], [FreeTDS])
+AST_EXT_LIB([termcap], [tgetent], [], [TERMCAP], [Termcap])
+AST_EXT_LIB([tinfo], [tgetent], [], [TINFO], [Term Info])
+
+if test "${PBX_OSTYPE}" = "Linux" ; then
+  AST_EXT_LIB([tonezone], [tone_zone_find], [tonezone.h], [TONEZONE], [tonezone])
+else
+  AST_EXT_LIB([tonezone], [tone_zone_find], [tonezone.h], [TONEZONE], [tonezone], [-lm])
+fi
+
+AST_EXT_LIB([vorbis], [vorbis_info_init], [vorbis/codec.h], [VORBIS], [Vorbis], [-lm -lvorbisenc])
+
+AC_LANG_PUSH(C++)
+
+AC_ARG_WITH([vpb], AC_HELP_STRING([--with-vpb=PATH],[use vpb files in PATH]),[
 case ${withval} in
      n|no)
-     USE_KDE=no
+     USE_VPB=no
      ;;
      y|ye|yes)
-     KDE_MANDATORY="yes"
+     VPB_MANDATORY="yes"
      ;;
      *)
-     KDE_DIR="${withval}"
-     KDE_MANDATORY="yes"
+     VPB_DIR="${withval}"
+     VPB_MANDATORY="yes"
      ;;
 esac
 ])
-
-PBX_KDE=0
-if test "${USE_KDE}" != "no"; then
-   echo -n "checking for crashHandler in -lkdecore... "
-   saved_ldflags="${LDFLAGS}"
-   LDFLAGS="-I${KDE_DIR}/include ${LDFLAGS} -L${KDE_DIR}/lib -lkdecore"
-	AC_LINK_IFELSE(
+if test "${USE_VPB}" != "no"; then
+   echo -n "checking for vpb_open in -lvpb... "
+   saved_libs="${LIBS}"
+   saved_cppflags="${CPPFLAGS}"
+   if test "x${VPB_DIR}" != "x"; then
+      LIBS="${LIBS} -L${VPB_DIR}/lib"
+      CPPFLAGS="${CPPFLAGS} -I${VPB_DIR}/include"
+   fi
+   LIBS="${LIBS} -lvpb -lpthread"
+   AC_LINK_IFELSE(
 	[
-		AC_LANG_PROGRAM(
-		[#include "kcrash.h"],
-		[KCrash::defaultCrashHandler(1);])
+	AC_LANG_PROGRAM(
+	[#include <vpbapi.h>],
+	[int q = vpb_open(0,0);])
 	],
-	[ac_cv_lib_kde_crash="yes"],
-	[ac_cv_lib_kde_crash="no"])
-		
-	LDFLAGS="${saved_ldflags}"
-	
-	if test "${ac_cv_lib_kde_crash}" = "yes"; then
-		AC_MSG_RESULT(yes) 
-	else
-		AC_MSG_RESULT(no) 
+	[	AC_MSG_RESULT(yes) 
+		ac_cv_lib_vpb_vpb_open="yes" 
+	],
+	[	AC_MSG_RESULT(no) 
+		ac_cv_lib_vpb_vpb_open="no" 
+	]
+	)
+   LIBS="${saved_libs}"
+   CPPFLAGS="${saved_cppflags}"
+   PBX_LIBvpb=0
+   if test "${ac_cv_lib_vpb_vpb_open}" = "yes"; then
+	VPB_LIB="-lvpb"
+	if test "${VPB_DIR}" != ""; then
+	   VPB_LIB="-L${VPB_DIR}/lib ${VPB_LIB}"
+	   VPB_INCLUDE="-I${VPB_DIR}/include"
+	   AC_SUBST([VPB_INCLUDE])
 	fi
-	
-	if test "${ac_cv_lib_kde_crash}" = "yes"; then
-		KDE_LIBS="-lkdecore -lkdeui"
-		if test "${KDE_DIR}" != ""; then
-			KDE_LIBS="-L${KDE_DIR}/lib ${KDE_LIBS}"
-			KDE_INCLUDE="-I${KDE_DIR}/include"
-			AC_SUBST([KDE_INCLUDE])
-		fi
-		AC_SUBST([KDE_LIBS])
-		PBX_KDE=1
-		AC_DEFINE([HAVE_LIBKDE], 1, [Define if your system has the KDE library])
-   elif test ! -z "${KDE_MANDATORY}"; 
+	AC_SUBST([VPB_LIB])
+	PBX_LIBvpb=1
+	AC_DEFINE([HAVE_LIBVPB], 1, [Define if your system has the VoiceTronix (vpb) libraries.])
+   elif test ! -z "${VPB_MANDATORY}"; 
    then
       echo "***"
-      echo "*** The KDE installation on this system appears to be broken."
+      echo "*** The VoiceTronix (vpb) installation on this system appears to be broken."
       echo "*** Either correct the installation, or run configure"
-      echo "*** including --without-kde."
+      echo "*** including --without-vpb."
       exit 1
    fi
 fi
-AC_SUBST([PBX_KDE])
-
-if test x"${PBX_KDE}" = x1; then
-	AC_PATH_TOOL(KDEINIT, kdeinit, No)
-	if test ! x"${KDEINIT}" = xNo; then
-   	KDEDIR=$(${DIRNAME} ${KDEINIT})
-   	KDEDIR=$(${DIRNAME} ${KDEDIR})
-	fi
-	AC_SUBST([KDEDIR])
-fi
+AC_SUBST([PBX_LIBvpb])
 
 AC_LANG_POP
 
-PBX_GTK=0
-AC_CHECK_TOOL(GTKCONFIG, gtk-config, No)
-if test ! "x${GTKCONFIG}" = xNo; then
-   GTK_INCLUDE=$(${GTKCONFIG} --cflags gthread)
-   GTK_LIBS=$(${GTKCONFIG} --libs gthread)
-   PBX_GTK=1
-   AC_DEFINE([HAVE_GTK], 1, [Define if your system has the GTK libraries.])
-fi
-AC_SUBST(PBX_GTK)
-AC_SUBST(GTK_INCLUDE)
-AC_SUBST(GTK_LIBS)
-
-PLATFORM_PTLIB="ptlib_${OSTYPE}_${MACHTYPE}_r"
+AST_EXT_LIB([z], [compress], [zlib.h], [ZLIB], [zlib])
 
-AC_ARG_WITH([pwlib], AC_HELP_STRING([--with-pwlib=PATH],[use PWLib files in PATH]),[
+AC_ARG_WITH([zaptel], AC_HELP_STRING([--with-zaptel=PATH], [use Zaptel files in PATH]), [
 case ${withval} in
      n|no)
-     USE_PWLIB=no
+     USE_ZAPTEL=no
      ;;
      y|ye|yes)
+     ZAPTEL_MANDATORY=yes
      ;;
      *)
-     PWLIB_DIR="${withval}"
+     ZAPTEL_DIR="${withval}"
+     ZAPTEL_MANDATORY=yes
      ;;
 esac
 ])
-if test "${USE_PWLIB}" != "no"; then
-	echo -n "checking for existence of pwlib... "
-	
-	saved_ldflags="${LDFLAGS}"
-	LDFLAGS="${LDFLAGS} -L${PWLIB_DIR} -l${PLATFORM_PTLIB}"
-	
-	AC_LINK_IFELSE(
+
+PBX_ZAPTEL=0
+if test "${USE_ZAPTEL}" != "no"; then
+   echo -n "checking for zt_transcode_header in zaptel.h... "
+   saved_cppflags="${CPPFLAGS}"
+   if test "x${ZAPTEL_DIR}" != "x"; then
+      CPPFLAGS="${CPPFLAGS} -I${ZAPTEL_DIR}/include"
+   fi
+   AC_COMPILE_IFELSE(
 	[
 	AC_LANG_PROGRAM(
-	[#include "${PWDIR_DIR}ptime.h"],
-	[int q = PTime::IsDaylightSaving();])
+	[#include <zaptel.h>],
+	[struct zt_transcode_header test;])
 	],
 	[	AC_MSG_RESULT(yes) 
-		ac_cv_lib_pwlib="yes" 
+		ac_cv_zaptel_h="yes" 
 	],
 	[	AC_MSG_RESULT(no) 
-		ac_cv_lib_pwlib="no" 
+		ac_cv_zaptel_h="no" 
 	]
 	)
-	LDFLAGS="${saved_ldflags}"
-
-	PBX_LIBPWLIB=0
-   
-   if test "${ac_cv_lib_pwlib}" = "yes"; then
-      PWLIB_LIB="-l{PLATFORM_PWLIB}"
-      if test "${PWLIB_DIR}" != ""; then
-         PWLIB_LIB="-L${PWLIB_DIR}/lib ${PWLIB_LIB}"
-	 		PWLIB_INCLUDE="-I${PWLIB_DIR}/include"
-	 		AC_SUBST([PWLIB_INCLUDE])
-      fi
-   	AC_SUBST([PWLIB_LIB])
-   	PBX_LIBPWLIB=1
-   	AC_DEFINE([HAVE_LIBPWLIB], 1, [Define if your system has the pwlib libraries.])
-   elif test ! -z "${PWLIB_DIR}"; 
+   CPPFLAGS="${saved_cppflags}"
+   if test "${ac_cv_zaptel_h}" = "yes"; then
+	if test "${ZAPTEL_DIR}" != ""; then
+	   ZAPTEL_INCLUDE="-I${ZAPTEL_DIR}/include"
+	   AC_SUBST([ZAPTEL_INCLUDE])
+	fi
+	PBX_ZAPTEL=1
+	AC_DEFINE([HAVE_ZAPTEL], 1, [Define if your system has the Zaptel headers.])
+   elif test ! -z "${ZAPTEL_MANDATORY}"; 
    then
       echo "***"
-      echo "*** The PWLIB installation on this system appears to be broken."
+      echo "*** The Zaptel installation on this system appears to be broken."
       echo "*** Either correct the installation, or run configure"
-      echo "*** including --without-pwlib"
+      echo "*** including --without-zaptel."
       exit 1
    fi
 fi
-AC_SUBST([PBX_LIBPWLIB])
+
+AC_SUBST([PBX_ZAPTEL])
+
+EDITLINE_LIBS=""
+if test "x$TERMCAP_LIB" != "x" ; then
+  EDITLINE_LIBS="$TERMCAP_LIB"
+elif test "x$TINFO_LIB" != "x" ; then
+  EDITLINE_LIBS="$TINFO_LIB"
+elif test "x$CURSES_LIB" != "x" ; then
+  EDITLINE_LIBS="$CURSES_LIB"
+elif test "x$NCURSES_LIB" != "x" ; then
+  EDITLINE_LIBS="$NCURSES_LIB"
+else
+  echo "*** termcap support not found"
+  exit 1
+fi
+AC_SUBST(EDITLINE_LIBS)
+
+AC_CHECK_HEADER([h323.h], [PBX_H323=1], [PBX_H323=0])
+AC_SUBST(PBX_H323)
+
+AC_CHECK_HEADER([linux/ixjuser.h], [PBX_IXJUSER=1], [PBX_IXJUSER=0], [
+				   #include <linux/version.h>
+				   #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+				   #include <linux/compiler.h>
+				   #endif
+				   ])
+AC_SUBST(PBX_IXJUSER)
+
+PBX_GTK=0
+AC_CHECK_TOOL(GTKCONFIG, gtk-config, No)
+if test ! "x${GTKCONFIG}" = xNo; then
+   GTK_INCLUDE=$(${GTKCONFIG} --cflags gthread)
+   GTK_LIBS=$(${GTKCONFIG} --libs gthread)
+   PBX_GTK=1
+   AC_DEFINE([HAVE_GTK], 1, [Define if your system has the GTK libraries.])
+fi
+AC_SUBST(PBX_GTK)
+AC_SUBST(GTK_INCLUDE)
+AC_SUBST(GTK_LIBS)
 
 PBX_CURL=0
 AC_PATH_TOOL([CURL], [curl-config], No)
diff --git a/formats/Makefile b/formats/Makefile
index 8440aa0dd7..351f1e8a10 100644
--- a/formats/Makefile
+++ b/formats/Makefile
@@ -5,51 +5,16 @@
 #
 # Copyright (C) 1999-2006, Digium, Inc.
 #
-# Mark Spencer <markster@digium.com>
-#
 # This program is free software, distributed under the terms of
 # the GNU General Public License
 #
 
-.PHONY: clean clean-depend all depend uninstall
-
 ifneq ($(wildcard ../menuselect.makeopts),)
   include ../menuselect.makeopts
 endif
 
 SELECTED_MODS:=$(filter-out $(MENUSELECT_FORMATS),$(patsubst %.c,%,$(wildcard format_*.c)))
 
-GSMLIB=../codecs/gsm/lib/libgsm.a
-
-MODS:=$(patsubst %,%.so,$(SELECTED_MODS))
-
-all: $(MODS)
-
-clean-depend:
-	rm -f .depend
-
-clean: clean-depend
-	rm -f *.so *.o
-
-%.so : %.o
-	$(CC) $(SOLINK) -o $@ $<
-
-ifneq ($(wildcard .depend),)
-  include .depend
-endif
-
-format_ogg_vorbis.so : format_ogg_vorbis.o
-	$(CC) $(SOLINK) -o $@ $< $(OGG_LIB) $(VORBIS_LIB)
-
-format_ogg_vorbis.o: format_ogg_vorbis.c
-	$(CC) -c -o $@ $(CFLAGS) $(OGG_INCLUDE) $(VORBIS_INCLUDE) $<
-
-install: all
-	for x in $(MODS); do $(INSTALL) -m 755 $$x $(DESTDIR)$(MODULES_DIR) ; done
-
-uninstall:
-
-depend: .depend
+all: _all
 
-.depend:
-	../build_tools/mkdep $(CFLAGS) `ls *.c`
+include ../Makefile.rules
diff --git a/formats/format_ogg_vorbis.c b/formats/format_ogg_vorbis.c
index d3959745e6..a9f9262513 100644
--- a/formats/format_ogg_vorbis.c
+++ b/formats/format_ogg_vorbis.c
@@ -23,7 +23,7 @@
 
 /*** MODULEINFO
 	<depend>libvorbis</depend>
-	<depend>ogg</depend>
+	<depend>libogg</depend>
  ***/
 
 #include "asterisk.h"
diff --git a/funcs/Makefile b/funcs/Makefile
index b9e55d1e61..381a3d72cd 100644
--- a/funcs/Makefile
+++ b/funcs/Makefile
@@ -5,14 +5,10 @@
 #
 # Copyright (C) 2005-2006, Digium, Inc.
 #
-# Kevin P. Fleming <kpfleming@digium.com>
-#
 # This program is free software, distributed under the terms of
 # the GNU General Public License
 #
 
-.PHONY: clean clean-depend all depend uninstall
-
 ifneq ($(wildcard ../menuselect.makeopts),)
   include ../menuselect.makeopts
 endif
@@ -30,44 +26,6 @@ else
   endif
 endif
 
-MODS:=$(patsubst %,%.so,$(SELECTED_MODS))
-
-all: $(MODS)
-
-clean-depend:
-	rm -f .depend
-
-clean: clean-depend
-	rm -f *.so *.o
-
-%.so : %.o
-	$(CC) $(SOLINK) -o $@ $<
-
-func_curl.so: func_curl.o
-	$(CC) $(SOLINK) -o $@ $< $(CURL_LIB)
-
-func_curl.o: func_curl.c
-	$(CC) -c -o $@ $(CFLAGS) $(CURL_INCLUDE) $<
-
-func_odbc.so: func_odbc.o
-	$(CC) $(SOLINK) -o $@ $< $(ODBC_LIB)
-
-func_odbc.o: func_odbc.c
-	$(CC) -c -o $@ $(CFLAGS) $(ODBC_INCLUDE) $<
-
-install: all
-	for x in $(MODS); do $(INSTALL) -m 755 $$x $(DESTDIR)$(MODULES_DIR) ; done
-
-uninstall:
-
-ifneq ($(wildcard .depend),)
-  include .depend
-endif
-
-depend: .depend
-
-.depend:
-	../build_tools/mkdep $(CFLAGS) `ls *.c`
+all: _all
 
-env:
-	env
+include ../Makefile.rules
diff --git a/include/asterisk/autoconfig.h.in b/include/asterisk/autoconfig.h.in
index a0cf4bc9ea..fd441011a2 100644
--- a/include/asterisk/autoconfig.h.in
+++ b/include/asterisk/autoconfig.h.in
@@ -200,6 +200,9 @@
 /* Define to 1 if you have the <netinet/in.h> header file. */
 #undef HAVE_NETINET_IN_H
 
+/* Define to indicate the Net-SNMP library */
+#undef HAVE_NETSNMP
+
 /* Define to indicate the newt library */
 #undef HAVE_NEWT
 
diff --git a/include/asterisk/translate.h b/include/asterisk/translate.h
index 29c3fd56c4..ed6f6275bf 100644
--- a/include/asterisk/translate.h
+++ b/include/asterisk/translate.h
@@ -72,7 +72,7 @@ struct ast_translator {
 	int dstfmt;			/*!< Destination format (note: bit position,
 					  converted to index during registration) */
 
-	void *(*newpvt)(struct ast_trans_pvt *); /*!< initialize private data 
+	int (*newpvt)(struct ast_trans_pvt *); /*!< initialize private data 
 					associated with the translator */
 
 	int (*framein)(struct ast_trans_pvt *pvt, struct ast_frame *in);
diff --git a/makeopts.in b/makeopts.in
index 28da92e85a..c2a7565e64 100644
--- a/makeopts.in
+++ b/makeopts.in
@@ -1,3 +1,7 @@
+# NOTE: Names of _INCLUDE and _LIB entries in this file must be
+#       the exact uppercase equivalents of the names used for
+#       dependencies in menuselect for the same package.
+
 CC=@CC@
 HOST_CC=@CC@
 CXX=@CXX@
@@ -38,11 +42,11 @@ sysconfdir = @sysconfdir@
 
 AST_DEVMODE=@AST_DEVMODE@
 
-OGG_LIB=@OGG_LIB@
-OGG_INCLUDE=@OGG_INCLUDE@
+LIBOGG_LIB=@OGG_LIB@
+LIBOGG_INCLUDE=@OGG_INCLUDE@
 
-VORBIS_LIB=@VORBIS_LIB@
-VORBIS_INCLUDE=@VORBIS_INCLUDE@
+LIBVORBIS_LIB=@VORBIS_LIB@
+LIBVORBIS_INCLUDE=@VORBIS_INCLUDE@
 
 ASOUND_LIB=@ALSA_LIB@
 ASOUND_INCLUDE=@ALSA_INCLUDE@
@@ -53,25 +57,25 @@ NBS_INCLUDE=@NBS_INCLUDE@
 OSSAUDIO_LIB=@OSS_LIB@
 OSSAUDIO_INCLUDE=@OSS_INCLUDE@
 
-SPEEX_LIB=@SPEEX_LIB@
-SPEEX_INCLUDE=@SPEEX_INCLUDE@
+LIBSPEEX_LIB=@SPEEX_LIB@
+LIBSPEEX_INCLUDE=@SPEEX_INCLUDE@
 
 TONEZONE_LIB=@TONEZONE_LIB@
 TONEZONE_INCLUDE=@TONEZONE_INCLUDE@
 
 ZAPTEL_INCLUDE=@ZAPTEL_INCLUDE@
 
-VPB_LIB=@VPB_LIB@
-VPB_INCLUDE=@VPB_INCLUDE@
+VPBAPI_LIB=@VPB_LIB@
+VPBAPI_INCLUDE=@VPB_INCLUDE@
 
-PRI_LIB=@LIBPRI_LIB@
-PRI_INCLUDE=@LIBPRI_INCLUDE@
+LIBPRI_LIB=@LIBPRI_LIB@
+LIBPRI_INCLUDE=@LIBPRI_INCLUDE@
 
-OSPTK_LIB=@OSPTK_LIB@
-OSPTK_INCLUDE=@OSPTK_INCLUDE@
+LIBOSPTK_LIB=@OSPTK_LIB@
+LIBOSPTK_INCLUDE=@OSPTK_INCLUDE@
 
-ODBC_LIB=@UNIXODBC_LIB@
-ODBC_INCLUDE=@UNIXODBC_INCLUDE@
+UNIXODBC_LIB=@UNIXODBC_LIB@
+UNIXODBC_INCLUDE=@UNIXODBC_INCLUDE@
 
 PGSQL_LIB=@pq_LIB@
 PGSQL_INCLUDE=@pq_INCLUDE@
@@ -79,8 +83,8 @@ PGSQL_INCLUDE=@pq_INCLUDE@
 SQLITE_LIB=@SQLITE_LIB@
 SQLITE_INCLUDE=@SQLITE_INCLUDE@
 
-TDS_LIB=@FREETDS_LIB@
-TDS_INCLUDE=@FREETDS_INCLUDE@
+FREETDS_LIB=@FREETDS_LIB@
+FREETDS_INCLUDE=@FREETDS_INCLUDE@
 
 POPT_LIB=@POPT_LIB@
 POPT_INCLUDE=@POPT_INCLUDE@
@@ -97,23 +101,23 @@ IKSEMEL_INCLUDE=@IKSEMEL_INCLUDE@
 SSL_LIB=@OPENSSL_LIB@
 SSL_INCLUDE=@OPENSSL_INCLUDE@
 
-Z_LIB=@ZLIB_LIB@
-Z_INCLUDE=@ZLIB_INCLUDE@
+ZLIB_LIB=@ZLIB_LIB@
+ZLIB_INCLUDE=@ZLIB_INCLUDE@
 
 QT_LIB=@QT_LIB@
 QT_INCLUDE=@QT_INCLUDE@
 
 KDEDIR=@KDEDIR@
 KDE_INCLUDE=@KDE_INCLUDE@
-KDE_LIBS=@KDE_LIBS@
+KDE_LIB=@KDE_LIBS@
 
 GTK_INCLUDE=@GTK_INCLUDE@
-GTK_LIBS=@GTK_LIBS@
+GTK_LIB=@GTK_LIBS@
 
 CURL_LIB=@CURLLIBS@
 
-GSM_LIB=@gsm_LIB@
-GSM_INCLUDE=@gsm_INCLUDE@
+LIBGSM_LIB=@gsm_LIB@
+LIBGSM_INCLUDE=@gsm_INCLUDE@
 
 CURSES_LIB=@CURSES_LIB@
 CURSES_INCLUDE=@CURSES_INCLUDE@
@@ -121,9 +125,9 @@ CURSES_INCLUDE=@CURSES_INCLUDE@
 NCURSES_LIB=@NCURSES_LIB@
 NCURSES_INCLUDE=@NCURSES_INCLUDE@
 
-EDITLINE_LIBS=@EDITLINE_LIBS@
+EDITLINE_LIB=@EDITLINE_LIBS@
 
 RADIUSCLIENT_LIB=@RADIUSCLIENT_LIB@
 RADIUSCLIENT_INCLUDE=@RADIUSCLIENT_INCLUDE@
 
-NETSNMP_LIBS=@NETSNMP_LIBS@
+NETSNMP_LIB=@NETSNMP_LIBS@
diff --git a/pbx/Makefile b/pbx/Makefile
index 74168c0700..c505d417e7 100644
--- a/pbx/Makefile
+++ b/pbx/Makefile
@@ -5,91 +5,35 @@
 #
 # Copyright (C) 1999-2006, Digium, Inc.
 #
-# Mark Spencer <markster@digium.com>
-#
 # This program is free software, distributed under the terms of
 # the GNU General Public License
 #
 
-.PHONY: clean clean-depend all depend uninstall
-
 ifneq ($(wildcard ../menuselect.makeopts),)
   include ../menuselect.makeopts
 endif
 
 SELECTED_MODS:=$(filter-out $(MENUSELECT_PBX),$(patsubst %.c,%,$(wildcard pbx_*.c)))
 
-MOC=$(QTDIR)/bin/moc
-KDE_FLAGS=-I$(KDEDIR)/include -I$(KDEDIR)/include/kde -I$(QTDIR)/include
-KDE_LIBS=-L$(KDEDIR)/lib -L$(QTDIR)/lib -lqt -lkdecore -lkdeui
-
-KDE_CONSOLE_OBJS=pbx_kdeconsole_main.o pbx_kdeconsole.o 
-
 MODS:=$(patsubst %,%.so,$(SELECTED_MODS))
 
-all: $(MODS)
+all: _all
 
-clean-depend:
-	rm -f .depend
+include ../Makefile.rules
 
-clean: clean-depend
-	rm -f *.so *.o
+clean::
 	rm -f ael/*.o
 
-pbx_gtkconsole.o: pbx_gtkconsole.c
-	$(CC) $(CFLAGS) $(GTK_FLAGS) -c -o $@ $<
-
-pbx_gtkconsole.so: pbx_gtkconsole.o
-	$(CC) $(SOLINK) -o $@ $< $(GTK_LIBS)
-
-pbx_kdeconsole.o: pbx_kdeconsole.cc pbx_kdeconsole.moc
-	$(CXX) $(CFLAGS) $(KDE_FLAGS) -c -o $@ $<
-
-pbx_kdeconsole_main.o: pbx_kdeconsole_main.cc pbx_kdeconsole.h
-	$(CXX) $(CFLAGS) $(KDE_FLAGS) -c -o $@ $<
-
-pbx_kdeconsole.so: $(KDE_CONSOLE_OBJS)
-	$(CC) $(SOLINK) -o $@ $(KDE_CONSOLE_OBJS) $(KDE_LIBS)
-
-pbx_dundi.so: pbx_dundi.o dundi-parser.o
-	$(CC) $(SOLINK) -o $@ $< dundi-parser.o $(Z_LIB)
-
-pbx_dundi.o: pbx_dundi.c
-	$(CC) -c -o $@ $(CFLAGS) $(Z_INCLUDE) $<
-
-pbx_ael.o: ael/aelflex.o ael/aelbison.o ../include/asterisk/ael_structs.h
-
-pbx_ael.so: pbx_ael.o ael/aelbison.o ael/aelflex.o
-	$(CC) $(SOLINK) -o $@ pbx_ael.o ael/aelbison.o ael/aelflex.o
-
 ael/aelflex.o: ael/ael_lex.c ../include/asterisk/ael_structs.h ael/ael.tab.h
-	$(CC) $(CFLAGS) -I. -c -o ael/aelflex.o ael/ael_lex.c
+	$(CC) $(CFLAGS) -I. -c -o $@ $<
 
 ael/aelbison.o: ael/ael.tab.c ael/ael.tab.h ../include/asterisk/ael_structs.h
-	$(CC) $(CFLAGS) -I. -c -o ael/aelbison.o ael/ael.tab.c
+	$(CC) $(CFLAGS) -I. -c -o $@ $<
+
+pbx_ael.so: pbx_ael.o ael/aelbison.o ael/aelflex.o
 
 ael/ael_lex.c:
 	(cd ael; flex ael.flex; sed -i -e "/begin standard C headers/i#include \"asterisk.h\"" ael_lex.c)
 
 ael/ael.tab.c ael/ael.tab.h:
 	(cd ael; bison -v -d ael.y)
-
-%.moc : %.h
-	$(MOC) $< -o $@
-
-%.so : %.o
-	$(CC) $(SOLINK) -o $@ $<
-
-ifneq ($(wildcard .depend),)
-  include .depend
-endif
-
-install: all
-	for x in $(MODS); do $(INSTALL) -m 755 $$x $(DESTDIR)$(MODULES_DIR) ; done
-
-uninstall:
-
-depend: .depend
-
-.depend:
-	../build_tools/mkdep $(CFLAGS) `ls *.c`
diff --git a/res/Makefile b/res/Makefile
index 4c92c5e7cf..3fc5a406bc 100644
--- a/res/Makefile
+++ b/res/Makefile
@@ -3,16 +3,12 @@
 # 
 # Makefile for resource modules
 #
-# Copyright (C) 1999-2006, Digium
-#
-# Mark Spencer <markster@digium.com>
+# Copyright (C) 1999-2006, Digium, Inc.
 #
 # This program is free software, distributed under the terms of
 # the GNU General Public License
 #
 
-.PHONY: clean clean-depend all depend uninstall
-
 ifneq ($(wildcard ../menuselect.makeopts),)
   include ../menuselect.makeopts
 endif
@@ -23,80 +19,10 @@ ifeq ($(OSARCH),FreeBSD)
   SELECTED_MODS:=$(filter-out $(shell if test ${BSDVERSION} -lt 500000 ; then echo "res_config_odbc"; fi),$(SELECTED_MODS))
 endif
 
-MODS:=$(patsubst %,%.so,$(SELECTED_MODS))
-
-all: $(MODS)
-
-install: all
-	for x in $(MODS); do $(INSTALL) -m 755 $$x $(DESTDIR)$(MODULES_DIR) ; done
-	@if [ x`which mpg123 2>/dev/null | grep -v '^no'` != x ] ; then \
-	  if mpg123 --longhelp 2>&1 | grep -q .59r 2>&1 >/dev/null ; then echo ; else \
-			echo "*************************************************************";\
-			echo "*** You have the WRONG version of mpg123... you need .59r ***";\
-			echo "*** Use 'make mpg123' to get the right verison            ***";\
-			echo "*************************************************************";\
-	  fi ;\
-	else \
-		echo "*** You don't have mpg123 installed. You may need ***";\
-		echo "***       it if you want to use MusicOnHold       ***";\
-	fi
-
-uninstall:
-
-res_crypto.so: res_crypto.o
-	$(CC) $(SOLINK) -o $@ $< $(SSL_LIB)
+all: _all
 
-res_crypto.o: res_crypto.c
-	$(CC) -c -o $@ $(CFLAGS) $(SSL_INCLUDE) $<
+include ../Makefile.rules
 
-clean-depend:
-	rm -f .depend
-
-clean: clean-depend
-	rm -f *.so *.o
+clean::
 	rm -f snmp/*.o
 
-res_odbc.so: res_odbc.o
-	$(CC) $(SOLINK) -o $@ $< $(ODBC_LIB) 
-
-res_odbc.o: res_odbc.c
-	$(CC) -c -o $@ $(CFLAGS) $(ODBC_INCLUDE) $<
-
-res_jabber.o: res_jabber.c
-	$(CC) -c -o $@ $(CFLAGS) $(IKSEMEL_INCLUDE) $<
-
-res_jabber.so: res_jabber.o
-	$(CC) $(SOLINK) -o $@ $< $(IKSEMEL_LIB) 
-
-res_osp.so: res_osp.o
-	$(CC) $(SOLINK) -o $@ $< $(OSPTK_LIB)
-
-res_osp.o: res_osp.c
-	$(CC) -c -o $@ $(CFLAGS) $(OSPTK_INCLUDE) $<
-
-%.so : %.o
-	$(CC) -o $@ $(SOLINK) $<
-
-res_config_odbc.o: res_config_odbc.c
-	$(CC) -c -o $@ $(CFLAGS) $(ODBC_INCLUDE) $<
-
-res_snmp.so: res_snmp.o snmp/agent.o
-	$(CC) $(SOLINK) -o $@ $^ $(NETSNMP_LIBS)
-
-res_config_pgsql.so: res_config_pgsql.o
-	$(CC) $(SOLINK) -o $@ $< $(PGSQL_LIB)
-
-res_config_pgsql.o: res_config_pgsql.c
-	$(CC) -c -o $@ $(CFLAGS) $(PGSQL_INCLUDE) $<
-
-ifneq ($(wildcard .depend),)
-  include .depend
-endif
-
-depend: .depend
-
-.depend:
-	../build_tools/mkdep $(CFLAGS) `ls *.c`	
-
-env:
-	env
diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c
index b19fb69fce..379f33c4e1 100644
--- a/res/res_musiconhold.c
+++ b/res/res_musiconhold.c
@@ -27,6 +27,7 @@
 
 /*** MODULEINFO
 	<conflict>win32</conflict>
+	<use>zaptel</use>
  ***/
 
 #include "asterisk.h"
@@ -49,11 +50,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 #include <sys/ioctl.h>
 
 #ifdef HAVE_ZAPTEL
-#ifdef __linux__
-#include <linux/zaptel.h>
-#else
 #include <zaptel.h>
-#endif /* __linux__ */
 #endif
 
 #include "asterisk/lock.h"
diff --git a/res/res_snmp.c b/res/res_snmp.c
index bacc43962c..3848e93304 100644
--- a/res/res_snmp.c
+++ b/res/res_snmp.c
@@ -16,7 +16,6 @@
 
 /*** MODULEINFO
 	<depend>netsnmp</depend>
-	<defaultenabled>no</defaultenabled>
  ***/
 
 #include "asterisk.h"
diff --git a/translate.c b/translate.c
index 256130c828..a1651f2dbf 100644
--- a/translate.c
+++ b/translate.c
@@ -127,7 +127,7 @@ static void *newpvt(struct ast_translator *t)
 	if (t->buf_size)		/* finally buffer and header */
 		pvt->outbuf = ofs + AST_FRIENDLY_OFFSET;
 	/* call local init routine, if present */
-	if (t->newpvt && t->newpvt(pvt) == NULL) {
+	if (t->newpvt && t->newpvt(pvt)) {
 		free(pvt);
 		return NULL;
 	}
-- 
GitLab