[asterisk-dev] simplification of zaptel feature detection

Luigi Rizzo rizzo at icir.org
Thu Jan 18 09:14:20 MST 2007


As discussed with kevin, the following patch for trunk
largely simplifies and improves the detection of zaptel features
in configure.ac - it retains the current semantics for linux, and
adds the ability to put overrides for other platform where an
up-to-date version of the zaptel drivers does not exist.

It works for me, but it would be great if someone could
give it a try before i commit it tomorrow.
(you need to run bootstrap.sh to regenerate configure)

	cheers
	luigi

Index: configure.ac
===================================================================
--- configure.ac	(revision 51221)
+++ configure.ac	(working copy)
@@ -215,6 +216,8 @@
 AST_EXT_LIB_SETUP([VPB], [Voicetronix API], [vpb])
 AST_EXT_LIB_SETUP([ZLIB], [zlib], [z])
 AST_EXT_LIB_SETUP([ZAPTEL], [Zaptel], [zaptel])
+AST_EXT_LIB_SETUP([ZAPTEL_TRANSCODE], [Zaptel_transcode], [zaptel_transcode])
+AST_EXT_LIB_SETUP([ZAPTEL_VLDTMF], [Zaptel_vldtmf], [zaptel_vldtmf])
 
 # check for basic system features and functionality before
 # checking for package libraries
@@ -852,57 +858,25 @@
 
 AST_EXT_LIB_CHECK([ZLIB], [z], [compress], [zlib.h])
 
-AST_C_DEFINE_CHECK([ZAPTEL], [ZT_DIAL_OP_CANCEL], [zaptel/zaptel.h])
+# check for zaptel 1.4.0 - use ZT_TONE_DTMF_BASE
+AST_C_DEFINE_CHECK([ZAPTEL], [ZT_TONE_DTMF_BASE], [zaptel/zaptel.h], [140])
+# if not, at least see if we have an old zaptel
+AST_C_DEFINE_CHECK([ZAPTEL], [ZT_DIAL_OP_CANCEL], [zaptel/zaptel.h], [80])
 
-if test "${PBX_ZAPTEL}" = 1; then
-   AC_MSG_CHECKING(for ZT_TONE_DTMF_BASE in zaptel/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 <zaptel/zaptel.h>],
-	[int foo = ZT_TONE_DTMF_BASE;])
-	],
-	[	AC_MSG_RESULT(yes) 
-		ac_cv_zaptel_vldtmf="yes" 
-	],
-	[	AC_MSG_RESULT(no) 
-		ac_cv_zaptel_vldtmf="no" 
-	]
-	)
-   CPPFLAGS="${saved_cppflags}"
-   if test "${ac_cv_zaptel_vldtmf}" = "yes"; then
-	PBX_ZAPTEL_VLDTMF=1
-   fi
-   AC_MSG_CHECKING(for ZT_TCOP_TRANSCODE in zaptel/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 <zaptel/zaptel.h>],
-	[int foo = ZT_TCOP_TRANSCODE;])
-	],
-	[	AC_MSG_RESULT(yes) 
-		ac_cv_zaptel_transcode="yes" 
-	],
-	[	AC_MSG_RESULT(no) 
-		ac_cv_zaptel_transcode="no" 
-	]
-	)
-   CPPFLAGS="${saved_cppflags}"
-   if test "${ac_cv_zaptel_transcode}" = "yes"; then
-	PBX_ZAPTEL_TRANSCODE=1
-   fi
-fi
-AC_SUBST(PBX_ZAPTEL_VLDTMF)
-AC_SUBST(PBX_ZAPTEL_TRANSCODE)
+# check for VLDTMF support
+AST_C_DEFINE_CHECK([ZAPTEL_VLDTMF], [ZT_TONE_DTMF_BASE], [zaptel/zaptel.h], [140])
 
+# and for transcode support
+AST_C_DEFINE_CHECK([ZAPTEL_TRANSCODE], [ZT_TCOP_TRANSCODE], [zaptel/zaptel.h], [140])
+
+# or, on FreeBSD, try old zaptel (0.80 or so) and assume we have vldtmf
+case "${host_os}" in
+    freebsd*)
+	AST_EXT_LIB_CHECK([ZAPTEL], [zaptel],, [zaptel.h],, [80])
+	AST_EXT_LIB_CHECK([ZAPTEL_VLDTMF], [zaptel],, [zaptel.h],, [80])
+	;;
+esac
+
 EDITLINE_LIB=""
 if test "x$TERMCAP_LIB" != "x" ; then
   EDITLINE_LIB="$TERMCAP_LIB"


More information about the asterisk-dev mailing list